From cdca21c0c12fa79ad4e85321d0f0960c0c4c3f33 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期五, 06 三月 2026 10:56:17 +0800
Subject: [PATCH] 优化

---
 mini-program/pages/confirm-order/confirm-order.vue |   57 ++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 44 insertions(+), 13 deletions(-)

diff --git a/mini-program/pages/confirm-order/confirm-order.vue b/mini-program/pages/confirm-order/confirm-order.vue
index 9116c02..48ad825 100644
--- a/mini-program/pages/confirm-order/confirm-order.vue
+++ b/mini-program/pages/confirm-order/confirm-order.vue
@@ -89,23 +89,23 @@
 				<view class="info-item">
 					<view class="info-item-label">鍟嗗搧鎬讳环</view>
 					<view class="info-item-price">
-						<text>{{orderInfo.amount}}</text>
+						<text>{{((orderInfo.amount || 0)-(orderInfo.mailAmount || 0)).toFixed(2)}}</text>
 					</view>
 				</view>
 				<view class="info-item">
 					<view class="info-item-label">杩愯垂</view>
 					<view class="info-item-price1">楼{{orderInfo.mailAmount}}</view>
 				</view>
-				<view class="info-item">
+				<view class="info-item" @click="show = true">
 					<view class="info-item-label">浼樻儬鍒�</view>
-					<view class="info-item-price1" @click="show = true">
+					<view class="info-item-price1">
 						-楼{{orderInfo.couponAmount}}
 						<image src="/static/icon/ic_ar2@2x.png" mode="widthFix"></image>
 					</view>
 				</view>
-				<view class="info-item">
+				<view class="info-item" @click="show1 = true">
 					<view class="info-item-label">绉垎鎶垫墸</view>
-					<view class="info-item-price1" @click="show1 = true">
+					<view class="info-item-price1">
 						-楼{{orderInfo.integralAmount}}
 						<image src="/static/icon/ic_ar2@2x.png" mode="widthFix"></image>
 					</view>
@@ -113,7 +113,7 @@
 				<view class="info-item">
 					<view class="info-item-label" style="color: #222222; font-size: 30rpx; font-weight: 600;">搴斾粯娆�</view>
 					<view class="info-item-price2">
-						<text>{{orderInfo.payAmount}}</text>
+						<text>{{(orderInfo.payAmount || 0).toFixed(2)}}</text>
 					</view>
 				</view>
 			</view>
@@ -160,6 +160,7 @@
 					</view>
 				</scroll-view>
 				<view class="coupon-btn" @click="confirmCoupon">纭畾</view>
+				<view style="width: 100%; height: 30rpx;"></view>
 			</view>
 		</u-popup>
 		<!-- 绉垎 -->
@@ -178,6 +179,7 @@
 					</view>
 				</view>
 				<view class="coupon-btn" @click="confirmJF">纭畾</view>
+				<view style="width: 100%; height: 30rpx;"></view>
 			</view>
 		</u-popup>
 		<!-- 闂ㄥ簵 -->
@@ -199,7 +201,7 @@
 						<view :class="item.active ? 'dian active' : 'dian'" @click="seleShop(index)" v-for="(item, index) in shopList" :key="index">
 							<view class="dian-top">
 								<view class="dian-top-image">
-									<image :src="item.imgFullUrl" mode="widthFix"></image>
+									<image :src="item.imgFullUrl || '/static/icon/default2.png'" mode="widthFix"></image>
 								</view>
 								<view class="dian-top-info">
 									<view class="dian-top-info-title">
@@ -261,13 +263,14 @@
 				useIntegralCopy: 0,
 				useIntegral: 0,
 				receiveType: 0,
-				couponId: null,
+				couponId: -1,
 				shopId: null,
 				payDetailRequestList: [],
 				shopList: [],
 				isPosition: true,
 				lat: '',
 				lgt: '',
+				loading: false,
 			};
 		},
 		onLoad(option) {
@@ -283,6 +286,9 @@
 			uni.$on('city', (data) => {
 				this.cityName = data
 				this.getShopLists()
+			})
+			uni.$on('addressDele', (data) => {
+				this.getDefaultAddr()
 			})
 			this.getDefaultAddr()
 		},
@@ -406,6 +412,8 @@
 					title: '璇烽�夋嫨闂ㄥ簵',
 					icon: 'none'
 				})
+				if (this.loading) return;
+				this.loading = true
 				this.$u.api.orderPay({
 					addressId: this.addr ? this.addr.id : null,
 					couponId: this.couponId,
@@ -419,6 +427,7 @@
 					if (res.code === 200) {
 						// 绉垎鎶垫墸
 						if (res.data.payType === 1) {
+							uni.$emit('shuaxin')
 							uni.redirectTo({
 								url: `/pagesA/pages/order-details/order-details?id=${res.data.orderId}&userType=0`
 							})
@@ -430,17 +439,24 @@
 								signType: res.data.response.signType,
 								paySign: res.data.response.paySign,
 								success (pay) {
+									uni.$emit('shuaxin')
 									if (pay.errMsg === "requestPayment:ok") {
 										uni.redirectTo({
 											url: `/pagesA/pages/order-details/order-details?id=${res.data.orderId}&userType=0`
 										})
-									} else {
-										uni.showToast({ title: '璁㈠崟鍙栨秷鏀粯', icon: 'none' })
 									}
+								},
+								fail (err) {
+									uni.$emit('shuaxin')
+									uni.redirectTo({
+										url: '/pagesA/pages/order/order?userType=0&status=1'
+									})
 								}
 							})
 						}
 					}
+				}).finally(() => {
+					this.loading = false
 				})
 			},
 			// 纭畾浣跨敤绉垎
@@ -454,6 +470,8 @@
 				let arr = this.orderInfo.memberCouponList.filter(item => item.active)
 				if (arr.length > 0) {
 					this.couponId = arr[0].id
+				} else {
+					this.couponId = null
 				}
 				this.show = false
 				this.getOrderInfo()
@@ -461,7 +479,11 @@
 			// 閫夋嫨浼樻儬鍒�
 			selectCoupon(i) {
 				this.orderInfo.memberCouponList.forEach((item, index) => {
-					item.active = index === i
+					if (index === i) {
+						item.active = !item.active
+					} else {
+						item.active = false
+					}
 				})
 			},
 			// 鑾峰彇璁㈠崟璇︾粏淇℃伅
@@ -478,7 +500,11 @@
 							res.data.memberCouponList = []
 						} else {
 							res.data.memberCouponList.forEach(item => {
-								item.active = false
+								if (res.data.memberCoupon) {
+									item.active = item.id === res.data.memberCoupon.id
+								} else {
+									item.active = false
+								}
 							})
 						}
 						this.orderInfo = res.data
@@ -699,7 +725,7 @@
 				font-weight: 500;
 				font-size: 32rpx;
 				color: #FFFFFF;
-				margin-top: 60rpx;
+				margin: 60rpx 0 30rpx 0;
 			}
 			.coupon-content {
 				width: 100%;
@@ -1060,6 +1086,11 @@
 					flex-direction: column;
 					justify-content: space-between;
 					.item-info-title {
+						width: 100%;
+						display: -webkit-box;
+						-webkit-box-orient: vertical;
+						-webkit-line-clamp: 2;
+						overflow: hidden;
 						font-weight: 400;
 						font-size: 30rpx;
 						color: #222222;

--
Gitblit v1.9.3