Przeglądaj źródła

优惠券流程与跳转调整

DELL 3 lat temu
rodzic
commit
6c85ef57a9

+ 8 - 3
components/pay-popup/pay-popup.vue

@@ -17,7 +17,7 @@
 						<view class="txt">优惠券</view>
 					</view>
 					<view class="flex coupon-right">
-						<view class="txt">暂无可用优惠券</view>
+						<view class="txt">{{}}</view>
 						<u-icon name="arrow-right" size="16" color="#333"></u-icon>
 					</view>
 				</view>
@@ -25,8 +25,8 @@
 					<view class="txt" @click="toRule">同意<text>《盲票购买协议》</text></view>
 					<view class="checked">
 						<u-checkbox-group>
-							<u-checkbox :value="checked" :checked="checked" size="24" shape="circle" activeColor="#E96737"
-								@change="changeChecked"></u-checkbox>
+							<u-checkbox :value="checked" :checked="checked" size="24" shape="circle"
+								activeColor="#E96737" @change="changeChecked"></u-checkbox>
 						</u-checkbox-group>
 					</view>
 				</view>
@@ -63,8 +63,11 @@
 				checked: false,
 				couponIds: [],
 				autoCoupon: 1,
+
+				couponTitle: '',
 			};
 		},
+
 		methods: {
 			changeChecked(e) {
 				this.checked = e
@@ -72,6 +75,7 @@
 
 			toCoupon() {
 				// return
+				console.log(this.payInfo+"11111111111111111111")
 				uni.navigateTo({
 					url: '/pages/coupon/index'
 				})
@@ -175,6 +179,7 @@
 					uni.$u.toast('支付失败!');
 				})
 			},
+
 		},
 	}
 </script>

+ 26 - 7
pages/choice/index.vue

@@ -50,14 +50,15 @@
 					<view class="title" v-else>盲豆x {{ actionInfo.value }}</view>
 				</view>
 				<view class="confirm-prize-tip" v-if="actionInfo.prizeType && actionInfo.prizeType.value != 'coin'">
-					已放入我的奖品库<text @click="toPrize">前往查看</text></view>
-				<view class="confirm-prize-tip" v-else>已放入“我的盲豆”<text @click="toPrize">前往查看</text></view>
+					已放入我的奖品库<text @click="toPrize(actionInfo.prizeType)">前往查看</text></view>
+				<view class="confirm-prize-tip" v-else>已放入“我的盲豆”<text @click="toPrize('coin')">前往查看</text></view>
 				<view class="flex confirm-prize-btn">
 					<view class="back" @click="back">返回</view>
 					<view class="confirm" @click="again">再来一张</view>
 				</view>
 			</view>
 		</u-popup>
+		
 	</view>
 </template>
 
@@ -125,6 +126,7 @@
 				let _this = this
 				let item = _this.prizeList[_this.actionIndex]
 				_this.actionInfo = item
+				console.log(this.actionInfo)
 				if (_this.prizeList.length > 1) {
 					uni.showModal({
 						title: '提示',
@@ -175,10 +177,27 @@
 				}
 			},
 
-			toPrize() {
-				uni.switchTab({
-					url: '/pages/user/index'
-				})
+			toPrize(data) {
+				
+				console.log(data)
+				if (data.value == 'goods') {
+					uni.redirectTo({
+						url: '/pages/prize/index'
+					})
+					console.log(data.value)
+				}
+				if (data.value == 'coupon') {
+					uni.redirectTo({
+						url: '/pages/prize/index?coupon=1'
+					})
+					console.log(data.value)
+				}
+				if (data == 'coin') {
+					uni.redirectTo({
+						url: '/pages/bean/index'
+					})
+				}
+				
 			},
 
 			again() {
@@ -197,7 +216,7 @@
 								url: `/pages/lucky/index?id=${ serialNo }&type=offLine`
 							})
 						},
-						fail(){
+						fail() {
 							uni.$u.toast('请扫二维码');
 						}
 					});

+ 48 - 12
pages/coupon/index.vue

@@ -1,26 +1,26 @@
 <template>
 	<view>
 		<u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="选择优惠券"></u-navbar>
-		<view class="coupon-title">可用优惠券:0</view>
+		<view class="coupon-title">可用优惠券:{{listNum}}</view>
 		<view class="coupon-list">
-			<!-- <view class="flex coupon-list-item">
+			<view class="flex coupon-list-item" v-for="(item,index) in list" :key="index">
 				<view class="flex coupon-list-item-info">
-					<image src="../../static/logo.png" mode=""></image>
-					<view class="flex content">
-						<view class="txt">xx盲票优惠券</view>
-						<view class="txt">使用期限:2022.03.02-2022.04.01</view>
-						<view class="txt">适用范围:指定盲票</view>
-					</view>
 					<view class="money">
-						<view class="">¥<text>10</text></view>
+						<view class="">¥<text>{{item.discount}}</text></view>
+					</view>
+					<view class="flex content">
+						<view class="txt title">{{item.title}}</view>
+						<view class="txt">使用期限:{{ $parseTime(item.validStart, '{y}.{m}.{d}')}}-{{$parseTime(item.validEnd, '{y}.{m}.{d}')}}</view>
+						<view class="txt">适用范围:{{item.useAreaDesc || '-'}}</view>
 					</view>
+					
 				</view>
 				<view class="checked">
 					<view class="flex circle">
 						<view class="action" v-if="actionIndex == 0"></view>
 					</view>
 				</view>
-			</view> -->
+			</view>
 		</view>
 		
 		<view class="flex empty" v-if="!list.length">
@@ -36,6 +36,8 @@
 </template>
 
 <script>
+	import env from '../../config/env.js'
+	import $http from '@/utils/request.js'
 	export default {
 		data() {
 			return {
@@ -44,11 +46,41 @@
 				pageNum: 1,
 				total: 0,
 				list: [],
+				
+				listNum:'',
 			};
 		},
+		onShow(){
+			this.getList()
+		},
 		methods:{
+			getList(){
+				uni.showLoading({
+					title: '加载中'
+				});
+				$http.post('/api/v1/mp/user/ticket/order/coupon/list', {}).then(
+					res => {
+						uni.hideLoading();
+						console.log(res)
+						if (res.code == 0) {
+							this.listNum = res.data.length
+							res.data.forEach(item =>{
+								let useAreaDesc = JSON.parse(item.useArea)
+								item.useAreaDesc = useAreaDesc.desc
+							})
+							this.list = this.list.concat(res.data)
+							console.log(this.list)
+						}
+					}).catch(() => {
+					uni.hideLoading();
+				})
+			},
 			changeChecked(e){
 				console.log(e);
+			},
+			exchange(){
+				// 获取所选项
+				// 返回立即支付位置
 			}
 		}
 	}
@@ -76,7 +108,7 @@
 				&-info{
 					flex: 1;
 					justify-content: flex-start;
-					
+					height: 170rpx;
 					image{
 						width: 84rpx;
 						height: 132rpx;
@@ -89,9 +121,13 @@
 						align-items: flex-start;
 						justify-content: space-between;
 					}
+					.content .title{
+						font-size: 32rpx;
+						line-height: 50rpx;
+					}
 					
 					.money{
-						margin-left: 10rpx;
+						padding-right: 30rpx;
 						font-weight: bold;
 						text{
 							font-size: 50rpx;

+ 1 - 1
pages/prize/coupon.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)'