zhanghui 2 лет назад
Родитель
Сommit
f15e43b908
1 измененных файлов с 61 добавлено и 4 удалено
  1. 61 4
      orderPages/receiveCoupons/index.vue

+ 61 - 4
orderPages/receiveCoupons/index.vue

@@ -1,6 +1,39 @@
 <template>
 	<view class="page">
 
+		<view  class="row-list flex-row justify-start" v-for="(item,index) in countsList" :key="index">
+			<view class="h-text flex-col justify-center ">
+				<view class="money">
+					<text>¥{{item.discountsPrice}}</text>
+				</view>
+				<view class="desc">
+					<text>{{item.name}}</text>
+				</view>
+			</view>
+
+			<view class="h-center-content flex-col ">
+				<view class="h-value">
+					<text>门店通用</text>
+				</view>
+				<view class="title">
+					使用平台:<text v-if="item.strategyType == '0'">全平台</text>
+					<text v-else-if="item.strategyType == '1'">个人优惠卷</text>
+				</view>
+				<view class="title">
+					使用次数:{{item.degree}}
+				</view>
+				<view class="title">
+					到期时间:{{item.endTime.substring(0,10)}}
+				</view>
+			</view>
+
+			<view class="h-right-content flex-col justify-center ">
+				<view class="btn" @click="gotoReceiveCoupon(item)">
+					<text>立即领取</text>
+				</view>
+			</view>
+
+		</view>
 
 
 	</view>
@@ -9,21 +42,45 @@
 	export default {
 		data() {
 			return {
-
+				countsList:[]
 			};
 		},
 		onLoad(option) {
-
+			this.getUserDiscountsList()
 		},
-		computed: {
 
-		},
 		methods: {
 
+			// 领取优惠劵
+			gotoReceiveCoupon(item) {
+				this.$api.claimCoupon({id:item.id}).then((res) => {
+					uni.showToast({
+						title: "领取成功"
+					})
+					// 查询可领取的优惠劵
+					this.getUserDiscountsList();
+				})
+			},
+
+			// 查询可领取的优惠劵
+			getUserDiscountsList() {
+				let that = this;
+				// 用户绑定门店
+				this.$api.getUserDiscountsList().then((res) => {
+					console.log(res.data.data)
+					this.countsList = res.data.data;
+				}).catch(() => {
+					uni.showToast({
+						title: "操作失败"
+					})
+				})
+			},
 		},
 	};
 </script>
 <style lang="scss" scoped>
 
+	@import '/common/css/common.css';
+	@import './index.rpx.scss';
 
 </style>