zs 2 年之前
父節點
當前提交
4e3d19b5e1
共有 3 個文件被更改,包括 33 次插入20 次删除
  1. 7 2
      components/discount/index.vue
  2. 25 17
      pagesHome/exchange/index.vue
  3. 1 1
      pagesHome/order/order.vue

+ 7 - 2
components/discount/index.vue

@@ -2,11 +2,17 @@
 	<view class="discount">
 	<view class="discount">
 		<view class="pre_one">优惠劵({{couponList.length}}张)</view>
 		<view class="pre_one">优惠劵({{couponList.length}}张)</view>
 		<view class="pre_two" v-for="(item,index) in couponList" :key="index">
 		<view class="pre_two" v-for="(item,index) in couponList" :key="index">
-			<view class="left">
+			<view class="left" v-if="item.discount_type=='min'">
 				<view class="money">¥{{item.discount_config.min||'0'}}</view>
 				<view class="money">¥{{item.discount_config.min||'0'}}</view>
 				<view v-if="item.discount_config.limit=='nolimit'" class="man">不限</view>
 				<view v-if="item.discount_config.limit=='nolimit'" class="man">不限</view>
 				<view v-else class="man">满{{item.discount_config.limit||'0'}}可用</view>
 				<view v-else class="man">满{{item.discount_config.limit||'0'}}可用</view>
 			</view>
 			</view>
+			<view class="left" v-else-if="item.discount_type=='discount'">
+				<view class="money">{{item.discount_config.min||'0'}}折</view>
+				<view v-if="item.discount_config.limit=='nolimit'" class="man">不限</view>
+				<view v-else class="man">满{{item.discount_config.limit||'0'}}可用,最多减{{item.discount_config.max||'0'}}元
+				</view>
+			</view>
 			<view class="right">
 			<view class="right">
 				<view class="other">
 				<view class="other">
 					<view class="type"><text>{{item.discount_type_label||'暂无'}}</text>
 					<view class="type"><text>{{item.discount_type_label||'暂无'}}</text>
@@ -101,7 +107,6 @@
 				display: flex;
 				display: flex;
 				justify-content: space-between;
 				justify-content: space-between;
 				align-items: center;
 				align-items: center;
-				flex-grow: 1;
 				border-radius: 3vw;
 				border-radius: 3vw;
 				padding: 1.5vw 3vw;
 				padding: 1.5vw 3vw;
 				background-color: var(--mainColor);
 				background-color: var(--mainColor);

+ 25 - 17
pagesHome/exchange/index.vue

@@ -40,23 +40,31 @@
 			// 领取优惠劵
 			// 领取优惠劵
 			async toReceive(e) {
 			async toReceive(e) {
 				const that = this;
 				const that = this;
-				const arr = await that.$api(`/userCoupon/getCoupon/${e._id}`, 'POST');
-				if (arr.errcode == '0') {
-					uni.showToast({
-						title: `领取成功`,
-						icon: 'none',
-						duration: 3000
-					})
-					uni.navigateBack({
-						detail: 1
-					})
-				} else {
-					uni.showToast({
-						title: arr.errmsg,
-						icon: 'none',
-						duration: 2000
-					});
-				}
+				uni.showModal({
+					title: '提示',
+					content: '确定领取该优惠券?',
+					success: async function(res) {
+						if (res.confirm) {
+							const arr = await that.$api(`/userCoupon/getCoupon/${e._id}`, 'POST');
+							if (arr.errcode == '0') {
+								uni.showToast({
+									title: `领取成功`,
+									icon: 'none',
+									duration: 3000
+								})
+								uni.navigateBack({
+									detail: 1
+								})
+							} else {
+								uni.showToast({
+									title: arr.errmsg,
+									icon: 'none',
+									duration: 2000
+								});
+							}
+						}
+					}
+				});
 			},
 			},
 			// 监听用户是否登录
 			// 监听用户是否登录
 			watchLogin() {
 			watchLogin() {

+ 1 - 1
pagesHome/order/order.vue

@@ -166,7 +166,7 @@
 			// 使用优惠劵
 			// 使用优惠劵
 			toDiscount(e) {
 			toDiscount(e) {
 				const that = this;
 				const that = this;
-				that.$set(that, 'coupon_name', e.coupon.name)
+				that.$set(that, 'coupon_name', e.name)
 				that.coupon.push(e._id)
 				that.coupon.push(e._id)
 				that.$refs.popup.close();
 				that.$refs.popup.close();
 			},
 			},