lilei 4 سال پیش
والد
کامیت
d8bff4e899
2فایلهای تغییر یافته به همراه9 افزوده شده و 3 حذف شده
  1. 1 1
      pages/coupon/chooseCoupon/chooseCoupon.vue
  2. 8 2
      pages/getOrder/getOrder.vue

+ 1 - 1
pages/coupon/chooseCoupon/chooseCoupon.vue

@@ -69,7 +69,7 @@
 						flex-grow: 1;
 					}
 					&:last-child{
-						background:red;
+						background:#4CD964;
 						width: 30%;
 						color: #fff;
 						text-align: center;

+ 8 - 2
pages/getOrder/getOrder.vue

@@ -269,7 +269,7 @@
 					uni.hideLoading()
 					if (res.status == 200) {
 						this.couponList = res.data
-						this.checkedCoupon = this.couponList[0]
+						this.checkedCoupon = this.findCouponMax()
 						// 计算合计
 						this.getFinalAmount()
 					} else {
@@ -278,7 +278,13 @@
 					}
 				})
 			},
-			
+			// 查找优惠卷中优惠金额最大得
+			findCouponMax(){
+				let ret = this.couponList.sort((a,b)=>{
+					return b.couponAmount-a.couponAmount
+				})
+				return ret[0]
+			},
 			// 计算合计
 			getFinalAmount() {
 				this.amount = this.itemList[this.serverIndex].currentPrice