lilei 4 tahun lalu
induk
melakukan
36ed343262

+ 5 - 0
components/almost-lottery/almost-lottery.vue

@@ -237,6 +237,11 @@
       }
     },
     methods: {
+	  resetAngle(){
+		  let prizeCount = this.prizeList.length
+		  let prizeClip = 360 / prizeCount
+		  this.targetAngle = this.targetAngle - prizeClip/2
+	  },
       // 开始旋转
       onRotateStart() {
         if (this.isRotate) return

+ 2 - 0
pages/index/index.vue

@@ -210,6 +210,8 @@
 							this.showFixedLottery = false
 						}
 					}else{
+						this.showFixedLottery = false
+						this.showLottery = false
 						this.$u.vuex('vuex_LuckDraw',null)
 					}
 				})

+ 24 - 13
pagesA/luckDraw/luckDraw.vue

@@ -203,13 +203,14 @@ export default {
 			// 权重随机数的最大值
 			weightTotal: 0,
 			// 权重数组
-			weightArr: []
+			weightArr: [],
+			isFirstLoad: false
 		};
 	},
 	watch: {
 		showLottery(newValue, oldValue) {
-			if(!newValue){
-				// this.handleInitCanvas()
+			if(!newValue&&(this.winTypes=='win_0'||this.winTypes=='win_2'||this.winTypes=='win_3')){
+				this.$refs.lottery.resetAngle()
 			}
 		}
 	},
@@ -240,9 +241,12 @@ export default {
 		},
 		// 获取奖品列表
 		getPrizeList() {
-			uni.showLoading({
-				title: '奖品准备中...'
-			});
+			if(!this.isFirstLoad){
+				uni.showLoading({
+					title: '奖品准备中...'
+				});
+			}
+			
 			findEnable().then(res => {
 				if(res.status == 200 && res.data){
 					this.$u.vuex('vuex_LuckDraw',res.data)
@@ -253,6 +257,7 @@ export default {
 						// 查询免费次数
 						this.getCustomerTimes()
 						this.prizeList = this.requestPrizeList()
+						this.isFirstLoad = true
 					}else{
 						uni.showToast({
 							icon: 'none',
@@ -261,7 +266,11 @@ export default {
 						uni.navigateBack()
 					}
 				}else{
-					this.$u.vuex('vuex_LuckDraw',null)
+					uni.showToast({
+						icon: 'none',
+						title: '活动已结束'
+					})
+					uni.navigateBack()
 				}
 				uni.hideLoading()
 			})
@@ -372,12 +381,14 @@ export default {
 		// 抽奖转盘绘制完成
 		handleDrawFinish(res) {
 			console.log('抽奖转盘绘制完成', res);
-			uni.showToast({
-				title: res.msg,
-				duration: 2000,
-				mask: true,
-				icon: 'none'
-			});
+			if(!this.isFirstLoad){
+				uni.showToast({
+					title: res.msg,
+					duration: 2000,
+					mask: true,
+					icon: 'none'
+				});
+			}
 		},
 		// 支付确定
 		toPaySubmit(){

+ 9 - 1
pagesA/luckDraw/myJp.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="page-cont">
 		<view class="list" v-for="(item,index) in list" :key="item.id">
-			<view>奖品{{index+1}}</view>
+			<view class="no">奖品{{index+1}}</view>
 			<view class="names">{{item.prizeDesc}}</view>
 			<view class="lingjiang" v-if="item.state == 'WAIT_RECEIVE'" @click="lingjiang(item)">领奖</view>
 			<view class="viewsDetail" v-else @click="viewsDetail(item)">查看详情</view>
@@ -143,10 +143,15 @@ export default {
 			})
 		},
 		getfindWinPrize(){
+			uni.showLoading({
+				mask: true,
+				title: '正在加载...'
+			})
 			findWinPrize().then(res => {
 				if(res.status == 200){
 					this.list = res.data
 				}
+				uni.hideLoading()
 			})
 		},
 		// 获取用户收货地址
@@ -306,6 +311,9 @@ export default {
 				border-bottom: 1px solid #FFFFFF;
 				text-align: center;
 			}
+			.no{
+				width: 150rpx;
+			}
 			.names{
 				width: 50%;
 				flex-grow: 1;