diff --git a/package1/address/addressList.vue b/package1/address/addressList.vue
index 4f8d3d0..98d8d1c 100644
--- a/package1/address/addressList.vue
+++ b/package1/address/addressList.vue
@@ -47,16 +47,16 @@
-
+
-
+
-
+
-
+
设为默认地址
@@ -231,6 +231,29 @@
this.areaSearchInput = title;
this.closeAreaPopup();
},
+ onFloorInput(e) {
+ const value = (e.detail.value || '').toString();
+ const hasMinus = value.charAt(0) === '-';
+ let nextValue = value.replace(/[^\d-]/g, '').replace(/-/g, '');
+ if (hasMinus) nextValue = '-' + nextValue;
+ this.addressForm.floor = nextValue;
+ return nextValue;
+ },
+ onRoomNumInput(e) {
+ const nextValue = (e.detail.value || '').toString().slice(0, 30);
+ this.addressForm.roomNum = nextValue;
+ return nextValue;
+ },
+ onReceiverNameInput(e) {
+ const nextValue = (e.detail.value || '').toString().slice(0, 20);
+ this.addressForm.receiverName = nextValue;
+ return nextValue;
+ },
+ onReceiverPhoneInput(e) {
+ const nextValue = (e.detail.value || '').toString().replace(/\D/g, '').slice(0, 11);
+ this.addressForm.receiverPhone = nextValue;
+ return nextValue;
+ },
submitAddress() {
if(this.areaTitleInput) {
let match = this.areaList.find(a => a.title === this.areaTitleInput);
@@ -242,11 +265,17 @@
}
}
if(!this.addressForm.areaId) return this.tui.toast('请搜索并选择楼座');
- if(!this.addressForm.floor) return this.tui.toast('请填写所在楼层');
+ this.addressForm.floor = (this.addressForm.floor || '').toString();
+ this.addressForm.roomNum = (this.addressForm.roomNum || '').toString().trim();
+ this.addressForm.receiverName = (this.addressForm.receiverName || '').toString().trim();
+ this.addressForm.receiverPhone = (this.addressForm.receiverPhone || '').toString().replace(/\D/g, '');
+ if(!this.addressForm.floor) return this.tui.toast('请填写所在楼层,楼层必须为整数数字');
if(!/^-?\d+$/.test(this.addressForm.floor)) return this.tui.toast('楼层必须为整数');
- if(!this.addressForm.roomNum) return this.tui.toast('请填写详细地址门牌号');
- if(!this.addressForm.receiverName) return this.tui.toast('请填写收件人');
- if(!this.addressForm.receiverPhone) return this.tui.toast('请填写联系电话');
+ if(!this.addressForm.roomNum) return this.tui.toast('请填写详细地址门牌号最多30字');
+ if(this.addressForm.roomNum.length > 30) return this.tui.toast('详细地址最多30字');
+ if(!this.addressForm.receiverName) return this.tui.toast('请填写收件人最多20字');
+ if(this.addressForm.receiverName.length > 20) return this.tui.toast('收货人名字最多20字');
+ if(!this.addressForm.receiverPhone) return this.tui.toast('请输入有效的11位手机号码');
if(!/^1[3-9]\d{9}$/.test(this.addressForm.receiverPhone)) return this.tui.toast('请输入有效的11位手机号码');
let url = this.addressForm.id ? "/app/userAddress/edit" : "/app/userAddress/save";
diff --git a/package1/buyFood/buyFood.vue b/package1/buyFood/buyFood.vue
index 04d8ce5..a199918 100644
--- a/package1/buyFood/buyFood.vue
+++ b/package1/buyFood/buyFood.vue
@@ -244,6 +244,21 @@
+
+
+ 优惠券
+
+
+ -¥{{selectedCoupon.discountAmount.toFixed(2)}}
+
+
+ 有 {{availableCoupons.length}} 张可用
+
+
+ 无可用券
+
+
+
打包费
@@ -301,21 +316,7 @@
-
-
- 优惠券
-
-
- -¥{{selectedCoupon.discountAmount.toFixed(2)}}
-
-
- 有 {{availableCoupons.length}} 张可用
-
-
- 无可用券
-
-
-
+
合计
@@ -383,7 +384,7 @@
-
+
@@ -363,6 +367,15 @@
¥{{orderDetail.packageFee == undefined ? '' : orderDetail.packageFee}}
+
+
+ 锦鲤免单
+
+
+ ¥{{orderDetail.freeAmount == undefined ? '' : orderDetail.freeAmount}}
+
+
@@ -534,7 +547,7 @@
+ v-if="orderDetail.deliveryType == 1 && orderDetail.deliveryInfo.finishTime">
送达时间
@@ -542,6 +555,15 @@
{{orderDetail.deliveryInfo.finishTime ? orderDetail.deliveryInfo.finishTime : '尽快送达' | formatTime}}
+
+
+ 预计送达时间
+
+
+ {{orderDetail.deliveryInfo.mustFinishTime ? orderDetail.deliveryInfo.mustFinishTime : '尽快送达' | formatTime}}
+
+
@@ -891,7 +913,7 @@
const minute = String(date.getMinutes()).padStart(2, '0');
// 拼接格式:日-日-时:分
- return `${day}日${hour}:${minute}`;
+ return `${hour}:${minute}`;
},
formatTime(value) {
if (!value) return '';
diff --git a/package1/order/returnOrder.vue b/package1/order/returnOrder.vue
index 2f75abe..8fd0cdf 100644
--- a/package1/order/returnOrder.vue
+++ b/package1/order/returnOrder.vue
@@ -190,11 +190,13 @@
{{orderDetail.deliveryInfo.finishTime ? orderDetail.deliveryInfo.finishTime : '尽快送达' | formatTime}}
-
- 售后原因
-
-
- 申请售后¥{{returnData.refundAmount}}
+
+
+ 售后原因
+
+
+ 申请售后¥{{refundShowAmount}}
+
@@ -291,10 +293,12 @@
returnData: {
reason: '',
pictures: '',
- refundAmount: 0
+ refundAmount: 0,
+ refundType: 1
},
reasonOptions: ['配送超时', '收到的商品少了', '骑手送错地址', '收到的商品错了', '商家出餐超时', '餐品损坏或撒了', '商品质量问题'],
selectedReasonOptions: [],
+ refundShowAmount: 0,
popupPageStyle: '',
payData: {},
orderDetail: {},
@@ -369,6 +373,8 @@
onLoad(option) {
if (option.order) {
this.orderDetail = JSON.parse(decodeURIComponent(option.order));
+ this.normalizeOrderCouponAmount()
+ this.updateRefundShowAmount()
}
},
onShow() {
@@ -404,6 +410,7 @@
this.returnData.refundTypeStatus = 3
}
this.changeProduct()
+ this.updateRefundShowAmount()
},
toggleReasonOption(item) {
let index = this.selectedReasonOptions.indexOf(item);
@@ -424,6 +431,60 @@
}
}
},
+ toAmount(value) {
+ let num = Number(value)
+ return isNaN(num) ? 0 : num
+ },
+ getCouponAmount() {
+ if (this.toAmount(this.orderDetail.userCouponNum) > 0) {
+ return this.toAmount(this.orderDetail.userCouponNum)
+ }
+ if (this.orderDetail.userCoupon && this.orderDetail.userCoupon.length > 0) {
+ let couponAmount = 0
+ for (let i = 0; i < this.orderDetail.userCoupon.length; i++) {
+ couponAmount += this.toAmount(this.orderDetail.userCoupon[i].discountAmount)
+ }
+ return couponAmount
+ }
+ if (this.toAmount(this.orderDetail.couponDiscountFee) > 0) {
+ return this.toAmount(this.orderDetail.couponDiscountFee)
+ }
+ return 0
+ },
+ normalizeOrderCouponAmount() {
+ if (this.toAmount(this.orderDetail.userCouponNum) > 0) {
+ return
+ }
+ if (this.orderDetail.userCoupon && this.orderDetail.userCoupon.length > 0) {
+ let couponAmount = 0
+ for (let i = 0; i < this.orderDetail.userCoupon.length; i++) {
+ couponAmount += this.toAmount(this.orderDetail.userCoupon[i].discountAmount)
+ }
+ this.orderDetail.userCouponNum = Number(couponAmount.toFixed(2))
+ } else if (this.toAmount(this.orderDetail.couponDiscountFee) > 0) {
+ this.orderDetail.userCouponNum = this.toAmount(this.orderDetail.couponDiscountFee)
+ }
+ },
+ getRefundRatio() {
+ let couponAmount = this.getCouponAmount()
+ let freeAmount = this.toAmount(this.orderDetail.freeAmount)
+ if (couponAmount <= 0 && freeAmount <= 0) {
+ return 0
+ }
+ let allAmount = this.toAmount(this.orderDetail.totalAmount) + couponAmount + freeAmount
+ if (allAmount <= 0) {
+ return 0
+ }
+ return Number(((couponAmount + freeAmount) / allAmount).toFixed(4))
+ },
+ updateRefundShowAmount() {
+ let refundAmount = this.toAmount(this.returnData.refundAmount)
+ if (this.sellTime == 0 || this.sellTime == 1 || this.returnData.refundType == 1 || this.returnData.refundType == 2) {
+ let ratio = this.getRefundRatio()
+ refundAmount = refundAmount - refundAmount * ratio
+ }
+ this.refundShowAmount = Number(refundAmount.toFixed(2))
+ },
pictureAdd(id, huan) {
let that = this
uni.chooseMedia({
@@ -488,13 +549,20 @@
for (let i = 0; i < this.orderDetail.goodsList.length; i++) {
if (this.orderDetail.goodsList[i].returnCount) {
this.orderDetail.goodsList[i].quantity = this.orderDetail.goodsList[i].returnCount
- if (this.orderDetail.deliveryType == 1) {
+ /* if (this.orderDetail.deliveryType == 1) {
this.orderDetail.goodsList[i].price = Number(this.orderDetail.goodsList[i].price) + Number(this
.orderDetail.goodsList[i].packageFee)
- }
+ } */
this.returnData.items.push(this.orderDetail.goodsList[i])
}
}
+ if (this.returnData.refundType == 1 && this.returnData.items.length == 0) {
+ uni.showToast({
+ title: '请选择需要售后的商品',
+ icon: 'none'
+ });
+ return;
+ }
uni.showLoading({
title: '提交售后中...'
});
@@ -537,23 +605,25 @@
.quantity) {
this.orderDetail.goodsList[index].returnCount += 1
if (this.orderDetail.deliveryType == 1) {
- this.returnData.refundAmount += Number(Number(this.orderDetail.goodsList[index].price + this
- .orderDetail.goodsList[index].packageFee).toFixed(2))
+ this.returnData.refundAmount += Number((this.toAmount(this.orderDetail.goodsList[index].price) + this
+ .toAmount(this.orderDetail.goodsList[index].packageFee)).toFixed(2))
} else {
- this.returnData.refundAmount += Number(this.orderDetail.goodsList[index].price)
+ this.returnData.refundAmount += this.toAmount(this.orderDetail.goodsList[index].price)
}
this.returnData.refundAmount = Number(this.returnData.refundAmount.toFixed(2))
+ this.updateRefundShowAmount()
}
} else {
if (this.orderDetail.goodsList[index].returnCount > 0) {
if (this.orderDetail.deliveryType == 1) {
- this.returnData.refundAmount -= Number(Number(this.orderDetail.goodsList[index].price + this
- .orderDetail.goodsList[index].packageFee).toFixed(2))
+ this.returnData.refundAmount -= Number((this.toAmount(this.orderDetail.goodsList[index].price) + this
+ .toAmount(this.orderDetail.goodsList[index].packageFee)).toFixed(2))
} else {
- this.returnData.refundAmount -= Number(this.orderDetail.goodsList[index].price)
+ this.returnData.refundAmount -= this.toAmount(this.orderDetail.goodsList[index].price)
}
this.returnData.refundAmount = Number(this.returnData.refundAmount.toFixed(2))
+ this.updateRefundShowAmount()
}
this.orderDetail.goodsList[index].returnCount = this.orderDetail.goodsList[index].returnCount > 0 ?
this.orderDetail.goodsList[index].returnCount -= 1 : 0
@@ -1111,4 +1181,31 @@
text-align: center;
margin: 40rpx auto;
}
+
+ .action-row {
+ display: flex;
+ align-items: center;
+ gap: 20rpx;
+ margin: 36rpx auto 10rpx;
+ }
+
+ .action-row .btn {
+ flex: 1;
+ width: auto;
+ height: 88rpx;
+ line-height: 88rpx;
+ margin: 0;
+ font-size: 28rpx;
+ box-sizing: border-box;
+ }
+
+ .action-row .secondary-btn {
+ background: #fff;
+ border: 2rpx solid rgba(0, 35, 28, 0.12);
+ color: #243f38;
+ }
+
+ .action-row .primary-btn {
+ color: #00231C;
+ }
\ No newline at end of file