完善功能
This commit is contained in:
@ -46,11 +46,11 @@
|
||||
<price-format color="#303133" :subscript-size="30" :first-size="30" :second-size="30" :price="bill.dgf.total"></price-format>
|
||||
</view>
|
||||
</view>
|
||||
<view class="title2 d-b-c">
|
||||
<!-- <view class="title2 d-b-c"> -->
|
||||
<!-- <view>灯光费(¥{{ bill.dgf.price }}元/小时)</view> -->
|
||||
<view>小时</view>
|
||||
<!-- <view>小时</view>
|
||||
<view>x{{ bill.dgf.nums }}</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- 使用余额支付优惠的折扣 -->
|
||||
@ -94,7 +94,7 @@
|
||||
<!-- 会员卡选择弹窗 -->
|
||||
<Popup :show="balancePopup" :width='750' :padding="0" type="bottom" backgroundColor="#fff" radius="32rpx 32rpx 0 0">
|
||||
<view class="ww100 box-s-b pop-improt typeof pr">
|
||||
<image style="width: 64rpx;height: 64rpx;position: absolute; top: 26rpx;right: 30rpx;" src="@/static/icon/close2.png" mode="" @click="balancePopup = false"></image>
|
||||
<image style="width: 64rpx;height: 64rpx;position: absolute; top: 26rpx;right: 30rpx;" src="@/static/icon/close2.png" mode="" @click="closeBalancePopup"></image>
|
||||
|
||||
<view class="d-c-c pt44">
|
||||
<text class="f34 fb">会员卡选择</text>
|
||||
@ -234,11 +234,7 @@
|
||||
<template v-if="typeId == 1">
|
||||
<view class="desc2">
|
||||
<view class="dot"></view>
|
||||
<view class="">17点前预约100元/小时</view>
|
||||
</view>
|
||||
<view class="desc2">
|
||||
<view class="dot"></view>
|
||||
<view class="">17点后需要加收灯光费,120元/小时</view>
|
||||
<view class="">18点后需要加收灯光费</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="typeId == 2">
|
||||
@ -276,7 +272,7 @@
|
||||
</view>
|
||||
<view class="icon-box d-c-c"><span class="icon iconfont icon-xuanze"></span></view>
|
||||
</view>
|
||||
<view :class="payType >= 1 ? 'item active' : 'item'" @tap="payTypeFunc('balance')">
|
||||
<view :class="payType == 'balance' ? 'item active' : 'item'" @tap="payTypeFunc('balance')">
|
||||
<view class="d-s-c">
|
||||
<view class="icon-box d-c-c mr10"><span class="icon iconfont icon-yue"></span></view>
|
||||
<text class="key">平台余额</text>
|
||||
@ -299,6 +295,9 @@
|
||||
<view class="d-f d-c j-c-b">
|
||||
<view class="">
|
||||
合计: <price-format color="#FF5951" :subscript-size="26" :first-size="40" :second-size="40" :price="bill.total"></price-format>
|
||||
<template v-if="userAccount > 0">
|
||||
<text style="color: #FF5951; margin-left: 10rpx;font-size: 26rpx;">{{ userDiscount }}折</text>
|
||||
</template>
|
||||
</view>
|
||||
<view class="d-f j-c-c a-i-c" style="margin-top: 10rpx;" @tap="handleShowBill">
|
||||
<view class="price-detail">费用明细</view>
|
||||
@ -328,7 +327,7 @@
|
||||
typeId: 1, // 网球场1 篮球场2
|
||||
billPopup: false,
|
||||
showPrice: true,
|
||||
adding: true,
|
||||
adding: true,
|
||||
basketballDate: null,
|
||||
venue: {},
|
||||
room: {},
|
||||
@ -347,6 +346,7 @@
|
||||
dis: 0, // 折扣优惠
|
||||
total: 0 // 总价
|
||||
},
|
||||
originalTotal: 0, // 原始总价(未打折)
|
||||
payType: 'wxpay', // 支付方式 wxpay\balance
|
||||
order: {},
|
||||
result: '',
|
||||
@ -472,6 +472,12 @@
|
||||
|
||||
// 缓存不存在则直接从订单详情中获取费用明细
|
||||
// if (!uni.getStorageSync('billDetail')) {
|
||||
self.bill.cdf.nums = 0;
|
||||
self.bill.cdf.price = 0;
|
||||
self.bill.cdf.total = 0;
|
||||
self.bill.dgf.nums = 0;
|
||||
self.bill.dgf.price = 0;
|
||||
self.bill.dgf.total = 0;
|
||||
for (const key in self.order.trade) {
|
||||
const value = self.order.trade[key];
|
||||
for (const item of value) {
|
||||
@ -483,7 +489,17 @@
|
||||
self.bill.dgf.total += Number(item.light_price);
|
||||
}
|
||||
}
|
||||
self.bill.total = self.bill.cdf.total + self.bill.dgf.total;
|
||||
// 保留两位小数但不四舍五入
|
||||
function toFixedNoRound(num, decimal) {
|
||||
const str = num.toString();
|
||||
const idx = str.indexOf('.');
|
||||
if (idx === -1) return str + (decimal > 0 ? '.' + '0'.repeat(decimal) : '');
|
||||
return str.substring(0, idx + decimal + 1).padEnd(idx + decimal + 1, '0');
|
||||
}
|
||||
self.bill.cdf.total = Number(toFixedNoRound(self.bill.cdf.total, 2));
|
||||
self.bill.dgf.total = Number(toFixedNoRound(self.bill.dgf.total, 2));
|
||||
self.bill.total = Number(toFixedNoRound(self.bill.cdf.total + self.bill.dgf.total, 2));
|
||||
self.originalTotal = self.bill.total; // 记录原始总价
|
||||
// }
|
||||
// self.countPrice()
|
||||
}
|
||||
@ -550,25 +566,32 @@
|
||||
|
||||
// 选择支付方式
|
||||
payTypeFunc(n) {
|
||||
this.payType = n;
|
||||
this.payType = n;
|
||||
if (n == 'balance') {
|
||||
this.balancePopup = true;
|
||||
} else {
|
||||
// 切换到微信支付时还原价格
|
||||
this.userAccount = 0;
|
||||
this.userDiscount = 0;
|
||||
this.currentType = '';
|
||||
// 如果是微信支付的话则重新获取订单信息
|
||||
let bill = uni.getStorageSync('billDetail') || {};
|
||||
bill = JSON.parse(bill);
|
||||
this.bill = bill
|
||||
if (typeof this.originalTotal === 'number' && !isNaN(this.originalTotal)) {
|
||||
this.bill.total = this.originalTotal;
|
||||
this.bill.dis = 0;
|
||||
}
|
||||
this.balancePopup = false;
|
||||
}
|
||||
},
|
||||
|
||||
// 去支付
|
||||
toConfirm() {
|
||||
if (this.payType == '') {
|
||||
uni.showToast({title: '请选择支付方式', icon: 'none'});
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._submitting) return;
|
||||
this._submitting = true;
|
||||
|
||||
if (this.countSelectedTime === 0) {
|
||||
uni.showToast({title: '请选择时间后再预定', icon: 'none'});
|
||||
this._submitting = false;
|
||||
@ -584,7 +607,12 @@
|
||||
};
|
||||
oldWxPay.call(this);
|
||||
setTimeout(finish, 3000); // 兜底3秒自动解锁
|
||||
} else if (this.payType >= 1) {
|
||||
} else if (this.payType == 'balance') {
|
||||
if (this.currentType == '') {
|
||||
uni.showToast({title: '请选择会员卡类型', icon: 'none'});
|
||||
setTimeout(finish, 3000); // 兜底3秒自动解锁
|
||||
return;
|
||||
}
|
||||
const oldBalancePay = this.balancePay;
|
||||
this.balancePay = (...args) => {
|
||||
oldBalancePay.apply(this, args);
|
||||
@ -655,10 +683,10 @@
|
||||
self.result = 'fail'
|
||||
self.loadding = false;
|
||||
|
||||
uni.showToast({
|
||||
title: '支付失败',
|
||||
icon: 'none'
|
||||
});
|
||||
// uni.showToast({
|
||||
// title: '支付失败',
|
||||
// icon: 'none'
|
||||
// });
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({delta: 1})
|
||||
}, 500);
|
||||
@ -780,6 +808,14 @@
|
||||
|
||||
// 确认选择充值卡
|
||||
confirmCard() {
|
||||
if (this.currentType == '') {
|
||||
uni.showToast({
|
||||
title: '请选择会员卡类型',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.userBalance['balance' + this.currentType] <= 0 && this.bill.total > 0) {
|
||||
uni.showToast({
|
||||
title: '余额不足,请选择其他会员卡',
|
||||
@ -788,22 +824,32 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
this.userAccount = this.userBalance['balance' + this.currentType];
|
||||
this.userDiscount = this.balance['discount' + this.currentType];
|
||||
|
||||
const discount = Number(this.userDiscount) || 10; // 折扣,默认10(不打折)
|
||||
|
||||
const total = Number(this.bill.total) || 0;
|
||||
// 保留两位小数,不四舍五入
|
||||
const finalPrice = Number((total * (discount / 10)).toFixed(2));
|
||||
this.bill.dis = Number((total - finalPrice).toFixed(2));
|
||||
// 始终基于原始金额打折
|
||||
const baseTotal = Number(this.originalTotal) || 0;
|
||||
const finalPrice = Number((baseTotal * (discount / 10)).toFixed(2));
|
||||
this.bill.dis = Number((baseTotal - finalPrice).toFixed(2));
|
||||
this.bill.total = finalPrice;
|
||||
console.log("🚀 ~ finalPrice:", finalPrice)
|
||||
|
||||
this.payType = this.currentType;
|
||||
// this.payType = this.currentType;
|
||||
// this.countPrice();
|
||||
this.balancePopup = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// 关闭余额支付弹窗
|
||||
closeBalancePopup() {
|
||||
this.payType = 'wxpay';
|
||||
this.balancePopup = false;
|
||||
},
|
||||
},
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@ -53,11 +53,11 @@
|
||||
<price-format color="#303133" :subscript-size="30" :first-size="30" :second-size="30" :price="bill.dgf.total"></price-format>
|
||||
</view>
|
||||
</view>
|
||||
<view class="title2 d-b-c">
|
||||
<!-- <view class="title2 d-b-c"> -->
|
||||
<!-- <view>灯光费(¥{{ bill.dgf.price }}元/小时)</view> -->
|
||||
<view>小时</view>
|
||||
<!-- <view>小时</view>
|
||||
<view>x{{ bill.dgf.nums }}</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<view class="line"></view>
|
||||
@ -602,11 +602,16 @@ export default {
|
||||
});
|
||||
});
|
||||
|
||||
// 保留2位小数,不四舍五入
|
||||
totalPrice = Number(totalPrice.toFixed(2));
|
||||
totalLightPrice = Number(totalLightPrice.toFixed(2));
|
||||
const total = Number((totalPrice + totalLightPrice).toFixed(2));
|
||||
|
||||
this.selectedReserveTime = room_list;
|
||||
|
||||
// 计算场地费用
|
||||
self.bill = {
|
||||
total: Number(totalPrice) + Number(totalLightPrice),
|
||||
total: total,
|
||||
cdf: {
|
||||
nums: this.countSelectedTime,
|
||||
price: 0,
|
||||
|
||||
@ -66,10 +66,10 @@
|
||||
<price-format color="#303133" :subscript-size="30" :first-size="30" :second-size="30" price="100"></price-format>
|
||||
</view>
|
||||
</view>
|
||||
<view class="title2 d-b-c">
|
||||
<!-- <view class="title2 d-b-c">
|
||||
<view>灯光费(¥50元/小时)</view>
|
||||
<view>x3</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<view class="line"></view>
|
||||
|
||||
2
main.js
2
main.js
@ -471,7 +471,7 @@ Vue.prototype.setTabBarLinks = function(vars, theme) {
|
||||
})
|
||||
uni.setTabBarItem({
|
||||
index: 1,
|
||||
text: '分类',
|
||||
text: '商城',
|
||||
iconPath: 'static/tabbar/category_7.png',
|
||||
selectedIconPath: 'static/tabbar/category_8.png'
|
||||
})
|
||||
|
||||
@ -1039,12 +1039,6 @@
|
||||
"selectedIconPath": "static/tabbar/no.png",
|
||||
"text": ""
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/cart/cart",
|
||||
"iconPath": "static/tabbar/no.png",
|
||||
"selectedIconPath": "static/tabbar/no.png",
|
||||
"text": ""
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/user/index/index",
|
||||
"iconPath": "static/tabbar/no.png",
|
||||
|
||||
@ -582,7 +582,7 @@ export default {
|
||||
});
|
||||
uni.setTabBarItem({
|
||||
index: 1,
|
||||
text: '分类',
|
||||
text: '商城',
|
||||
iconPath: 'static/tabbar/category_7.png',
|
||||
selectedIconPath: 'static/tabbar/category_8.png'
|
||||
});
|
||||
|
||||
@ -13,13 +13,13 @@
|
||||
</view>
|
||||
<view class="icon-box d-c-c"><span class="icon iconfont icon-xuanze"></span></view>
|
||||
</view>
|
||||
<view v-if="item==30" :class="pay_type == 30 ? 'item active' : 'item'" @tap="payTypeFunc(30)">
|
||||
<!-- <view v-if="item==30" :class="pay_type == 30 ? 'item active' : 'item'" @tap="payTypeFunc(30)">
|
||||
<view class="d-s-c">
|
||||
<view class="icon-box d-c-c mr10"><span class="icon iconfont icon-zhifubao"></span></view>
|
||||
<text class="key">支付宝支付:</text>
|
||||
</view>
|
||||
<view class="icon-box d-c-c"><span class="icon iconfont icon-xuanze"></span></view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<!-- <view v-if="hasBanlance && balance > 0" class="item">
|
||||
<view class="d-s-c">
|
||||
@ -268,7 +268,7 @@
|
||||
@include background_color("background_color");
|
||||
@include font_color('text_color2');
|
||||
width: 100%;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
// padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
|
||||
.bottom-btn>button {
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
<!-- 退款 -->
|
||||
<view class="status-text" style="width: 100%;" v-if="detail.order_status == 5">
|
||||
<view class="d-c-c" style="margin-bottom: 18rpx;" @tap="billPopup = true">
|
||||
<view class="refund-txt">实际退款¥{{ detail.order_amount }}</view>
|
||||
<view class="refund-txt">实际退款¥{{ detail.refund_price }}</view>
|
||||
<!-- <image style="width: 48rpx;height: 48rpx;margin-left: 6rpx;margin-top: 10rpx;" src="@/static/icon/right.png" mode=""></image> -->
|
||||
</view>
|
||||
<view class="">您的订单已取消。期待下次有机会再为您服务!</view>
|
||||
@ -242,10 +242,10 @@
|
||||
<price-format color="#303133" :subscript-size="30" :first-size="30" :second-size="30" price="100"></price-format>
|
||||
</view>
|
||||
</view>
|
||||
<view class="title2 d-b-c">
|
||||
<!-- <view class="title2 d-b-c">
|
||||
<view>灯光费(¥50元/小时)</view>
|
||||
<view>x3</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<view class="line"></view>
|
||||
@ -407,7 +407,7 @@
|
||||
function(res) {
|
||||
self.cancelOrderPopup = false;
|
||||
|
||||
uni.showToast({
|
||||
window.uni.showToast({
|
||||
title: '操作成功',
|
||||
duration: 2000,
|
||||
icon: 'success'
|
||||
@ -448,7 +448,7 @@
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
self.getData();
|
||||
}, 500);
|
||||
}, 800);
|
||||
} else {
|
||||
uni.hideLoading();
|
||||
}
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
<template>
|
||||
<view class="wrap" :data-theme='theme()' :class="theme() || ''" v-if="!loading">
|
||||
<!--tab-->
|
||||
<view class="top-tabbar" v-if="OrderData.delivery != 30">
|
||||
<!-- <view class="top-tabbar" v-if="OrderData.delivery != 30">
|
||||
<block v-if="hasType(10)">
|
||||
<view :class="tab_type == 0 ? 'tab-item active' : 'tab-item'" @click="tabFunc(0)">快递配送</view>
|
||||
</block>
|
||||
<block v-if="hasType(20)">
|
||||
<view :class="tab_type == 1 ? 'tab-item active' : 'tab-item'" @click="tabFunc(1)">上门自提</view>
|
||||
</block>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="p-0-23">
|
||||
<Myinfo :dis="options.order_type == 'retainage'" v-if="tab_type == 0 && OrderData.delivery != 30"
|
||||
:Address="Address" :exist_address="exist_address">
|
||||
@ -96,7 +96,7 @@
|
||||
<text class="f24">¥{{ OrderData.express_price }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" v-if="OrderData.is_coupon">
|
||||
<!-- <view class="item" v-if="OrderData.is_coupon">
|
||||
<text class="key">优惠券:</text>
|
||||
<block v-if="coupon_num > 0">
|
||||
<view class="f24 theme-price" v-if="OrderData.coupon_id > 0"
|
||||
@ -106,7 +106,7 @@
|
||||
</view>
|
||||
</block>
|
||||
<text v-else class="f24 gray9">无优惠券可用</text>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="item" v-if="OrderData.product_reduce_money > 0">
|
||||
<text class="key">商品立减:</text>
|
||||
<view>
|
||||
|
||||
@ -204,6 +204,8 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
id: '',// 接入微信小程序所需参数
|
||||
|
||||
/*手机高度*/
|
||||
phoneHeight: 0,
|
||||
/*可滚动视图区域高度*/
|
||||
@ -252,6 +254,8 @@
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.id = e.id || '';
|
||||
|
||||
if (typeof e.dataType != 'undefined') {
|
||||
this.dataType = e.dataType;
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
</view>
|
||||
<view class="success-btns d-b-c">
|
||||
<button type="default" class="flex-1 mr10" @click="goHome()">返回首页</button>
|
||||
<button type="primary" class="flex-1 ml10" @click="goMyorder">我的订单</button>
|
||||
<button type="primary" class="flex-1 ml10" @click="goMyorder" style="background-color: #365A9A !important;">我的订单</button>
|
||||
</view>
|
||||
<!--推荐-->
|
||||
<view><recommendProduct :location="30"></recommendProduct></view>
|
||||
@ -103,7 +103,7 @@
|
||||
|
||||
.pay-success .success-icon .iconfont {
|
||||
padding: 30rpx;
|
||||
background: #04BE01;
|
||||
background: #365A9A;
|
||||
border-radius: 50%;
|
||||
font-size: 80rpx;
|
||||
color: #FFFFFF;
|
||||
@ -137,7 +137,7 @@
|
||||
}
|
||||
|
||||
.pay-success .success-btns button[type="default"] {
|
||||
border: 1px solid #04BE01;
|
||||
color: #04BE01;
|
||||
border: 1px solid #365A9A;
|
||||
color: #365A9A;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -21,9 +21,9 @@
|
||||
<view class="info">
|
||||
<view class="d-c-c mb23">
|
||||
<view class="name">{{ detail.nickName }}</view>
|
||||
<text class="ml20 grade" v-if="detail.grade_id > 0">
|
||||
<!-- <text class="ml20 grade" v-if="detail.grade_id > 0">
|
||||
{{ detail.grade.name }}
|
||||
</text>
|
||||
</text> -->
|
||||
</view>
|
||||
<view class="tel d-s-c">
|
||||
<text class="f26 id-number">{{ detail.mobile || 'ID:' + detail.user_id }}</text>
|
||||
@ -53,7 +53,7 @@
|
||||
<!-- 我的场馆订单 -->
|
||||
<view class="my-cg-order my-assets">
|
||||
<view class="my-assets-all">
|
||||
<view class="f30 fb">我的场馆订单</view>
|
||||
<view class="f30 fb">场馆订单</view>
|
||||
<view class="gray9 f26" @click="jumpPage('/pages/order/cg-my-order?dataType=all')">全部订单<text
|
||||
class="icon iconfont icon-jiantou"></text></view>
|
||||
</view>
|
||||
@ -107,7 +107,7 @@
|
||||
<!--我的资产-->
|
||||
<view class="my-assets">
|
||||
<view class="my-assets-all">
|
||||
<view class="f30 fb">我的订单</view>
|
||||
<view class="f30 fb">商城订单</view>
|
||||
<view class="gray9 f26" @click="jumpPage('/pages/order/myorder?dataType=all')">全部订单<text
|
||||
class="icon iconfont icon-jiantou"></text></view>
|
||||
</view>
|
||||
@ -329,7 +329,7 @@
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #EBEBEB;
|
||||
background-color: #F6F7F9;
|
||||
}
|
||||
|
||||
.w100 {
|
||||
@ -594,7 +594,7 @@
|
||||
}
|
||||
|
||||
.menu-wrap .item .name {
|
||||
margin-top: 19rpx;
|
||||
margin-top: 13rpx;
|
||||
}
|
||||
|
||||
.bind_phone {
|
||||
|
||||
8
uni.scss
8
uni.scss
@ -80,9 +80,9 @@ $uni-font-size-paragraph: 30upx;
|
||||
/* start--主题色--start */
|
||||
$themes: (
|
||||
theme0: (
|
||||
font_color: #ff5704,
|
||||
/* 主题色 */ background_color: #ff5704,
|
||||
border_color: #ff5704,
|
||||
font_color: #365A9A,
|
||||
/* 主题色 */ background_color: #365A9A,
|
||||
border_color: #365A9A,
|
||||
opacify_background_0: rgba(255, 204, 0, 0.09),
|
||||
text_color1: #ffffff,
|
||||
text_color2: #ffffff,
|
||||
@ -106,7 +106,7 @@ $themes: (
|
||||
),
|
||||
bg-tips:
|
||||
rgba(
|
||||
$color: #ff5704,
|
||||
$color: #365A9A,
|
||||
$alpha: 0.08
|
||||
),
|
||||
gray9: #999999,
|
||||
|
||||
Reference in New Issue
Block a user