diff --git a/bundle/reserve/confirm.vue b/bundle/reserve/confirm.vue
index 212f8f7..7fd4978 100644
--- a/bundle/reserve/confirm.vue
+++ b/bundle/reserve/confirm.vue
@@ -46,11 +46,11 @@
-
+
- 小时
+
@@ -94,7 +94,7 @@
-
+
会员卡选择
@@ -234,11 +234,7 @@
- 17点前预约100元/小时
-
-
-
- 17点后需要加收灯光费,120元/小时
+ 18点后需要加收灯光费
@@ -276,7 +272,7 @@
-
+
平台余额
@@ -299,6 +295,9 @@
合计:
+
+ {{ userDiscount }}折
+
费用明细
@@ -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;
+ },
+ },
+
};
diff --git a/bundle/reserve/details.vue b/bundle/reserve/details.vue
index 51df24a..3e9811f 100644
--- a/bundle/reserve/details.vue
+++ b/bundle/reserve/details.vue
@@ -53,11 +53,11 @@
-
+
- 小时
+
@@ -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,
diff --git a/bundle/reserve/reserve.vue b/bundle/reserve/reserve.vue
index 04ab8da..c0ff439 100644
--- a/bundle/reserve/reserve.vue
+++ b/bundle/reserve/reserve.vue
@@ -66,10 +66,10 @@
-
+
diff --git a/main.js b/main.js
index 0761454..4f19e5a 100644
--- a/main.js
+++ b/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'
})
diff --git a/pages.json b/pages.json
index f300508..a49ddff 100644
--- a/pages.json
+++ b/pages.json
@@ -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",
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 8184222..0c546e4 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -582,7 +582,7 @@ export default {
});
uni.setTabBarItem({
index: 1,
- text: '分类',
+ text: '商城',
iconPath: 'static/tabbar/category_7.png',
selectedIconPath: 'static/tabbar/category_8.png'
});
diff --git a/pages/order/cashier.vue b/pages/order/cashier.vue
index 24301d4..031f8eb 100644
--- a/pages/order/cashier.vue
+++ b/pages/order/cashier.vue
@@ -13,13 +13,13 @@
-
+
- 实际退款¥{{ detail.order_amount }}
+ 实际退款¥{{ detail.refund_price }}
您的订单已取消。期待下次有机会再为您服务!
@@ -242,10 +242,10 @@
-
+
@@ -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();
}
diff --git a/pages/order/confirm-order.vue b/pages/order/confirm-order.vue
index 85a51c9..679cb02 100644
--- a/pages/order/confirm-order.vue
+++ b/pages/order/confirm-order.vue
@@ -1,14 +1,14 @@
-
+
@@ -96,7 +96,7 @@
¥{{ OrderData.express_price }}
-
+
商品立减:
diff --git a/pages/order/myorder.vue b/pages/order/myorder.vue
index 8bd29fa..5998205 100644
--- a/pages/order/myorder.vue
+++ b/pages/order/myorder.vue
@@ -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;
}
diff --git a/pages/order/pay-success/pay-success.vue b/pages/order/pay-success/pay-success.vue
index 6c4dee0..fc716c8 100644
--- a/pages/order/pay-success/pay-success.vue
+++ b/pages/order/pay-success/pay-success.vue
@@ -15,7 +15,7 @@
-
+
@@ -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;
}
diff --git a/pages/user/index/index.vue b/pages/user/index/index.vue
index b7274b4..cb46cfd 100644
--- a/pages/user/index/index.vue
+++ b/pages/user/index/index.vue
@@ -21,9 +21,9 @@
{{ detail.nickName }}
-
+
{{ detail.mobile || 'ID:' + detail.user_id }}
@@ -53,7 +53,7 @@
- 我的场馆订单
+ 场馆订单
全部订单
@@ -107,7 +107,7 @@
- 我的订单
+ 商城订单
全部订单
@@ -329,7 +329,7 @@