Browse Source

我的奖品库-优惠券,显示盲票优惠券

DELL 3 năm trước cách đây
mục cha
commit
0b45de2e2c
3 tập tin đã thay đổi với 95 bổ sung10 xóa
  1. 10 2
      pages/prize/detail.vue
  2. 84 7
      pages/prize/index.vue
  3. 1 1
      pages/ticket/index.vue

+ 10 - 2
pages/prize/detail.vue

@@ -15,7 +15,7 @@
 					</view>
 				</view>
 			</view>
-			<view class="flex detail-code">
+			<view class="flex detail-code" v-if = " funUseArea() == 0">
 				<canvas style="width: 220px;height: 220px;" canvas-id="couponQrcode"></canvas>
 			</view>
 			<view class="detail-explain">
@@ -31,7 +31,8 @@
 	export default {
 		data() {
 			return {
-				info: {}
+				info: {},
+				infoUseArea:null,
 			};
 		},
 		onLoad(options) {
@@ -39,6 +40,9 @@
 				title: '加载中'
 			});
 			this.info = JSON.parse(options.info)
+			this.infoUseArea = JSON.parse(this.info.useArea)
+			this.infoUseArea = this.infoUseArea.value
+			
 			setTimeout(() => {
 				uni.hideLoading();
 				this.couponQrCode()
@@ -55,6 +59,10 @@
 					colorLight: "#FFFFFF",
 					correctLevel: qrCode.CorrectLevel.H
 				})
+			},
+			
+			funUseArea(){
+				return this.infoUseArea
 			}
 		}
 	}

+ 84 - 7
pages/prize/index.vue

@@ -3,8 +3,8 @@
 		<u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="我的奖品库"></u-navbar>
 		<!-- 奖品选择 -->
 		<view class="prize-state">
-			<u-tabs @change="changeTab" :scrollable="false" :list="stateArr" lineWidth="40" lineHeight="1"
-				lineColor="#D70909" :activeStyle="{
+			<u-tabs @change="changeTab" :scrollable="false" :list="stateArr" lineWidth="60" lineHeight="1"
+				:current='currentIndex' lineColor="#D70909" :activeStyle="{
 									color: '#D70909',
 									transform: 'scale(1)'
 								}" :inactiveStyle="{
@@ -54,7 +54,8 @@
 						</view>
 					</view>
 				</navigator> -->
-				<navigator :url="`/pages/prize/detail?info=${ JSON.stringify(item) }`" class="prize-coupon-list-item"
+
+				<!-- <navigator :url="`/pages/prize/detail?info=${ JSON.stringify(item) }`" class="prize-coupon-list-item"
 					hover-class="navigator-hover" v-for="(item, index) in list" :key="index">
 					<image src="../../static/icon/coupon_bg.png" mode=""></image>
 					<view class="info">
@@ -71,7 +72,28 @@
 						<view class="price"><text>¥</text>{{ item.discount / 100 }}</view>
 						<view class="title">{{ item.title }}</view>
 					</view>
-				</navigator>
+				</navigator> -->
+
+				<view @click="toPrizeDetail(item)" class="prize-coupon-list-item" hover-class="navigator-hover"
+					v-for="(item, index) in list" :key="index">
+					<image src="../../static/icon/coupon_bg.png" mode=""></image>
+					<view class="info">
+						<view class="info-item">
+							<text>使用期限:</text>
+							<text>{{ $parseTime(item.validStart, '{y}.{m}.{d}') }}-{{ $parseTime(item.validEnd, '{y}.{m}.{d}') }}</text>
+						</view>
+						<view class="info-item">
+							<text>使用范围:</text>
+							<text>{{ item.useAreaDesc || '-' }}</text>
+						</view>
+					</view>
+					<view class="info-now"><view></view>立即使用</view>
+					<view class="flex price-title">
+						<view class="price"><text>¥</text>{{ item.discount / 100 }}</view>
+						<view class="title">{{ item.title }}</view>
+					</view>
+				</view>
+				
 			</view>
 			<view class="flex empty" v-if="!list.length && !loading">
 				<u-empty text="数据为空" mode="order" />
@@ -117,11 +139,25 @@
 				pageNum: 1,
 				total: 0,
 				list: [],
+
+				currentIndex: 0,
 			};
 		},
 		onShow() {
 			this.pageList()
 			this.couponNum()
+
+
+		},
+		onLoad(opthios) {
+
+			if (opthios != undefined) {
+				if (opthios.coupon == 1) {
+					this.currentIndex = 1
+				} else {
+					this.currentIndex = 0
+				}
+			}
 		},
 		methods: {
 			getList() {
@@ -234,15 +270,40 @@
 							]
 						} else {
 							this.stateArr = [{
-									name: ' 实物商品 (0) '
+									name: ' 实物商品 (0)'
 								},
 								{
-									name: ' 优惠券 (0) '
+									name: ' 优惠券 (0)'
 								},
 							]
 						}
 					})
 				});
+			},
+
+			toPrizeDetail(item) {
+				let data = JSON.parse(item.useArea)
+				// 2为通用优惠券
+				if (data.value == 0) {
+					uni.navigateTo({
+						url: `/pages/prize/detail?info=${ JSON.stringify(item) }`
+					})
+				}
+				
+				// 3为线上票使用
+				if (data.value == 3) {
+					uni.navigateTo({
+						url: `/pages/ticketBox/index`
+					})
+				}
+				
+				// 4为线下票使用
+				if (data.value == 4) {
+					uni.navigateTo({
+						url: `/pages/prize/detail?info=${ JSON.stringify(item) }`
+					})
+				}
+
 			}
 		},
 
@@ -260,6 +321,23 @@
 	}
 </script>
 
+
+<style lang="scss" scoped>
+	.info-now{
+		margin-top: 10rpx;
+		color: #848484;
+		font-size: 30rpx;
+		height: 100rpx;
+		line-height: 90rpx;
+		text-align: center;
+	}
+	.info-now view {
+		height: 2rpx;
+		margin:0 10rpx;
+		background-image: linear-gradient(to right,#cfcfcf 0% ,#cfcfcf 50%,transparent 1%);
+		background-size: 25rpx 10rpx;
+	}
+</style>
 <style lang="scss" scoped>
 	.empty {
 		height: 60vh;
@@ -293,7 +371,6 @@
 					flex: 1;
 					justify-content: flex-start;
 				}
-
 				image {
 					width: 200rpx;
 					height: 200rpx;

+ 1 - 1
pages/ticket/index.vue

@@ -3,7 +3,7 @@
 		<u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="我的盲票"></u-navbar>
 		<!-- 优惠券筛选 -->
 		<view class="prize-state">
-			<u-tabs @change="changeTab" :scrollable="false" :list="stateArr" lineWidth="40" lineHeight="1"
+			<u-tabs @change="changeTab" :scrollable="false" :list="stateArr" lineWidth="60" lineHeight="1"
 				lineColor="#D70909" :activeStyle="{
 									color: '#D70909',
 									transform: 'scale(1)'