ソースを参照

首页兑奖优化

hwb0 3 年 前
コミット
6e86334596
3 ファイル変更26 行追加13 行削除
  1. 1 1
      components/custom-tab-bar/custom-tab-bar.vue
  2. 1 1
      config/env.js
  3. 24 11
      pages/index/index.vue

+ 1 - 1
components/custom-tab-bar/custom-tab-bar.vue

@@ -1,6 +1,6 @@
 <template>
 	<view>
-		<u-tabbar :value="activeValue" @change="changeTabbar" :fixed="true" activeColor="#E96737" :placeholder="true"
+		<u-tabbar :value="activeValue" @change="changeTabbar" zIndex="999" :fixed="true" activeColor="#E96737" :placeholder="true"
 			:safeAreaInsetBottom="true">
 			<u-tabbar-item :text="item.text" :name="item.name" v-for="(item, index) in list" :key="index">
 				<image class="icon" slot="active-icon" :src="item.selectedIconPath"></image>

+ 1 - 1
config/env.js

@@ -1,4 +1,4 @@
 import dev from './dev.js'
 import prod from './prod.js'
 
-export default prod
+export default dev

+ 24 - 11
pages/index/index.vue

@@ -46,7 +46,7 @@
 				</swiper>
 				<!-- 奖品 -->
 				<swiper class="prize-container" previous-margin="270rpx" next-margin="270rpx" circular :duration="15000"
-					:interval="1500" easing-function="easeOutCubic" :current="currentPrizeIndex" :disable-touch="true"
+					:interval="1500" easing-function="easeOutCubic" :disable-touch="true"
 					:autoplay="true">
 					<swiper-item class="swiper-item" v-for="(item, index) in prizeList" :key="index"
 						@click="toPrizeGoods(item)">
@@ -103,7 +103,6 @@
 				payShow: false, // 支付弹框显示
 				payInfo: {}, // 支付详情
 				currentIndex: 0, // 盲票选中下标
-				currentPrizeIndex: 0, // 奖品选中下标
 			};
 		},
 		onLoad(opthios) {
@@ -118,11 +117,10 @@
 				uni.setStorageSync('shareUid', this.sceneArr[0])
 				uni.setStorageSync('shareType', this.sceneArr[1])
 			}
+			this.getList()
 		},
 		onShow(opthios) {
 			this.loginState = uni.getStorageSync('token') ? true : false
-			if (this.payShow) return
-			this.getList()
 			this.getPrizeNews()
 		},
 		methods: {
@@ -141,9 +139,9 @@
 					res => {
 						uni.hideLoading();
 						if (res.code == 0) {
-							res.rows.forEach(item => item.picUrl = env.filePublic + item.picUrl.split(',')[0] + '?imageView2/2/w/375')
+							res.rows.forEach(item => item.picUrl = env.filePublic + item.picUrl.split(',')[0] +
+								'?imageView2/2/w/375')
 							this.ticketList = res.rows
-							console.log("res.rows==index: ",res.rows);
 							this.getPrize(this.ticketList[0].boxId)
 						}
 					}).catch(() => {
@@ -191,8 +189,6 @@
 							item.picUrl = env.filePublic + picUrlArr[0] + '?imageView2/2/w/170'
 						})
 						this.prizeList = prizeList
-						console.log("this.prizeList: ",prizeList);
-						this.currentPrizeIndex = 2
 						this.payInfo = this.ticketList[this.currentIndex]
 					}
 				}).catch(() => {
@@ -203,7 +199,6 @@
 			// 立即开刮
 			payment() {
 				this.payInfo = this.ticketList[this.currentIndex]
-				console.log()
 				let data = {
 					userCouponIds: [],
 					autoCoupon: 1,
@@ -235,11 +230,27 @@
 
 			// 盲票选中改变
 			changeTicket(e) {
-				this.dontFirstAnimation = false
-				this.currentIndex = e.detail.current
 				this.getPrize(this.ticketList[this.currentIndex].boxId)
 			},
 
+			changeList() {
+				let data = {
+					categoryId: '',
+					tagId: '',
+					type: 'online',
+					noToken: true
+				}
+				$http.post(`/api/v1/mp/user/mall/ticket/list?pageNum=${this.pageNum}&pageSize=100`, data).then(
+					res => {
+						const boxIdStr = this.ticketList.map(item => item.boxId).join()
+						let boxIdStrNew = res && res.rows && res.rows.map(item => item.boxId).join()
+						if (boxIdStr != boxIdStrNew) {
+							this.currentIndex = 0
+							this.getList()
+						}
+					})
+			},
+
 			// 盲票向左箭头
 			ticketLeft() {
 				if ((this.currentIndex >= 0) && (this.currentIndex < (this.ticketList.length - 1))) {
@@ -247,6 +258,7 @@
 				} else if (this.currentIndex == (this.ticketList.length - 1)) {
 					this.currentIndex = 0
 				}
+				this.changeList()
 			},
 
 			// 盲票向右箭头
@@ -256,6 +268,7 @@
 				} else if (this.currentIndex == 0) {
 					this.currentIndex = this.ticketList.length - 1
 				}
+				this.changeList()
 			},
 
 			// 线上立即刮票成功,跳转到刮奖过程