瀏覽代碼

调整优惠券使用流程

DELL 3 年之前
父節點
當前提交
6f37ffccd8
共有 2 個文件被更改,包括 31 次插入10 次删除
  1. 15 4
      components/pay-popup/pay-popup.vue
  2. 16 6
      pages/coupon/index.vue

+ 15 - 4
components/pay-popup/pay-popup.vue

@@ -8,7 +8,7 @@
 					</view>
 					<view class="info">
 						<view class="info-title">{{ payInfo.title }}</view>
-						<view class="info-stock">¥{{ $numberFormat( payInfo.salePrice ) }}</view>
+						<view class="info-stock coupon-right-color">¥{{ $numberFormat( payInfo.salePrice ) }}</view>
 					</view>
 				</view>
 				<view class="flex coupon" @click="toCoupon">
@@ -17,7 +17,8 @@
 						<view class="txt">优惠券</view>
 					</view>
 					<view class="flex coupon-right">
-						<view class="txt" v-if="payInfo.couponTitle">{{ payInfo.couponTitle }}</view>
+						<view class="txt coupon-right-color" v-if="$numberFormat(payInfo.discountAmt) != 0">-¥{{ $numberFormat(payInfo.discountAmt)}}</view>
+						<view class="txt" v-else-if="payInfo.listNum != undefined">{{payInfo.listNum}}张可用</view>
 						<view class="txt" v-else>暂无可用优惠券</view>
 						<u-icon name="arrow-right" size="16" color="#333"></u-icon>
 					</view>
@@ -25,9 +26,9 @@
 				<view class="flex agreement">
 					<view class="txt" @click="toRule">同意<text>《盲票购买协议》</text></view>
 					<view class="checked">
-						<u-checkbox-group>
+						<u-checkbox-group @change="changeChecked">
 							<u-checkbox :value="checked" :checked="checked" size="24" shape="circle"
-								activeColor="#E96737" @change="changeChecked"></u-checkbox>
+								activeColor="#E96737"></u-checkbox>
 						</u-checkbox-group>
 					</view>
 				</view>
@@ -115,6 +116,7 @@
 				}).then(res => {
 					uni.hideLoading();
 					payIng = true
+					console.log("res.data.orderId:"+ res.data.orderId)
 					if (res.code == 0) {
 						if (res.data.needPay == 1) {
 							$http.post('/api/v1/mp/user/ticket/order/pay', {
@@ -157,6 +159,7 @@
 								icon: 'success',
 								duration: 2000
 							})
+							console.log(res.data.orderId+"111111111111112")
 							_this.success(res.data.orderId)
 						}
 					} else if (res.code == 1020) {
@@ -179,6 +182,13 @@
 	}
 </script>
 
+<style lang="scss" scoped>
+	.coupon-right-color{
+		font-size: 32rpx;
+		line-height: 44rpx;
+		color: rgba(235, 112, 9, 100);
+	}
+</style>
 <style lang="scss" scoped>
 	.choiceShow-wrap {
 		min-height: 400rpx;
@@ -289,6 +299,7 @@
 					color: rgba(255, 255, 255, 100);
 					text-align: center;
 				}
+				
 			}
 		}
 	}

+ 16 - 6
pages/coupon/index.vue

@@ -14,7 +14,7 @@
 							<view class="txt">
 								使用期限:{{ $parseTime(item.validStart, '{y}.{m}.{d}')}}-{{$parseTime(item.validEnd, '{y}.{m}.{d}')}}
 							</view>
-							<view class="txt">用范围:{{ item.useAreaDesc || '-' }}</view>
+							<view class="txt">使用范围:{{ item.useAreaDesc || '-' }}</view>
 						</view>
 					</view>
 					<u-radio :customStyle="{ marginBottom: '8px' }" :name="item.id" activeColor="#E96737" size="24">
@@ -91,13 +91,21 @@
 
 			// 点击切换事件
 			changeChechk(e) {
-				this.couponId = e
+				
+				if(this.couponId == e){
+					this.radiovalue1 = -1
+					this.couponId = []
+					return
+				}else{
+					this.couponId = [e]
+					return
+				}
 			},
 
 			// 点击确认事件
 			exchange() {
 				let data = {
-					userCouponIds: [this.couponId],
+					userCouponIds: this.couponId,
 					autoCoupon: 0,
 					boxId: this.boxId,
 					orderNum: 1
@@ -109,10 +117,12 @@
 						let payInfo = {
 							...res.data,
 							picUrl: env.filePublic + res.data.picUrl,
-							couponTitle: res.data && res.data.couponList && res.data.couponList.length && res
-								.data.couponList[0].title,
+							couponDiscount: res.data && res.data.couponList && res.data.couponList.length &&
+								res
+								.data.couponList[0].discount,
 							couponId: res.data && res.data.couponList && res.data.couponList.length && res.data
-								.couponList[0].id
+								.couponList[0].id,
+							listNum:this.listNum
 						}
 						page.$vm.payInfo = payInfo
 						uni.navigateBack({