ソースを参照

免费抽奖模块修改

DELL 3 年 前
コミット
54926b72df

+ 71 - 3
components/activity-help/activity-help.vue

@@ -1,17 +1,85 @@
 <template>
 	<view>
-		
+		<u-popup :show="activityShow" mode="center" round="17" @close="close" :closeable="true" overlayOpacity="0.5" @touchmove.prevent.stop>
+			<view class="choiceShow-wrap">
+				<view style="width: 400rpx; height: 400rpx;line-height: 400rpx; text-align: center;">
+					是否帮好友助力
+				</view>
+				<button @click="activityHelp()">确定助力</button>
+			</view>
+		</u-popup>
+		<u-popup :show="closeShow" mode="center" round="17" @close="close" :closeable="true" overlayOpacity="0.5" @touchmove.prevent.stop>
+			<view class="choiceShow-wrap">
+				<view style="width: 400rpx; height: 400rpx;line-height: 400rpx; text-align: center;">
+					助力成功
+				</view>
+				<button @click="close()">取消</button>
+			</view>
+		</u-popup>
 	</view>
 </template>
 
 <script>
+	import env from '../../config/env.js'
+	import $http from '@/utils/request.js'
 	export default {
 		name:"activity-help",
+		props: {
+			activityShow: {
+				type: [Boolean],
+				default: false
+			},
+			inviteCode: {
+				type: [String],
+				default: {}
+			},
+			marketingId: {
+				type: [String],
+				default: {}
+			},
+			
+		},
 		data() {
 			return {
-				
+				closeShow: false,
 			};
-		}
+		},
+		onShow(){
+			// this.activity()
+		},
+		methods: {
+			activity() {
+				console.log(this.marketingId);
+				console.log(this.inviteCode);
+			},
+			
+			//关闭
+			close() {
+				this.$emit('close')
+			},
+			
+			success(id) {
+				this.$emit('success', id)
+			},
+			
+			activityHelp() {
+				console.log(this.marketingId);
+				console.log(this.inviteCode);
+				uni.showLoading({
+					title: '助力中'
+				});
+				$http.post('/api/v1/mp/user/marketing/help', {
+					inviteCode:this.inviteCode,
+					marketingId: this.marketingId
+				}).then(res => {
+					uni.hideLoading();
+					if(res.code == 0){
+						this.closeShow = true
+					} 
+					this.close()
+				})
+			}
+		},
 	}
 </script>
 

+ 39 - 15
packageOperate/activity/index.vue

@@ -1,10 +1,23 @@
 <template>
 	<view>
 		<u-navbar title="免费抽奖" :border="true" :placeholder="true" :autoBack="true" bgColor="#fff" />
-		<u-count-down :time="activityTime" format="DD:HH:mm:ss" autoStart millisecond @change="onChange">
+		<u-count-down v-if="info.status && JSON.parse(info.status).value == 3" :time="activityTime" format="DD:HH:mm:ss"
+			autoStart millisecond @change="onChange">
 			<view style="height: 98rpx;background-color: #fff;margin: 0 30rpx;line-height: 98rpx;overflow: hidden;">
 				<view class="data-btn">距离开奖时间:
-					<text v-if="timeData.days != 0" >{{timeData.days}}&nbsp;天</text>
+					<text v-if="timeData.days != 0">{{timeData.days}}&nbsp;天</text>
+					<text>{{ timeData.hours>10?timeData.hours:'0'+timeData.hours }}&nbsp;:</text>
+					<text>{{ timeData.minutes>10?timeData.minutes:'0'+timeData.minutes }}&nbsp;:</text>
+					<text>{{ timeData.seconds>10?timeData.seconds:'0'+timeData.seconds }}</text>
+				</view>
+				<view style="float: right;"><span style="font-weight: 600;">{{info.fakeNum}}</span>人已参与</view>
+			</view>
+		</u-count-down>
+		<u-count-down v-if="info.status && JSON.parse(info.status).value == 2" :time="activityTimeTwo"
+			format="DD:HH:mm:ss" autoStart millisecond @change="onChange">
+			<view style="height: 98rpx;background-color: #fff;margin: 0 30rpx;line-height: 98rpx;overflow: hidden;">
+				<view class="data-btn">距离开始时间:
+					<text v-if="timeData.days != 0">{{timeData.days}}&nbsp;天</text>
 					<text>{{ timeData.hours>10?timeData.hours:'0'+timeData.hours}}&nbsp;:</text>
 					<text>{{timeData.minutes>10?timeData.minutes:'0'+timeData.minutes}}&nbsp;:</text>
 					<text>{{timeData.seconds>10?timeData.seconds:'0'+timeData.seconds}}</text>
@@ -36,8 +49,9 @@
 			<view v-for="(item,index) in awardsList" :key="index">
 				<view v-if="item.name != '一等奖'">
 					<view style="height: 60rpx;">
-						<view style="float: left;"> 
-							<text style="display: inline-block; background-color: #bbbbbb;width: 200rpx;height: 60rpx;line-height:60rpx;text-align: center;">{{item.name}}</text>
+						<view style="float: left;">
+							<text
+								style="display: inline-block; background-color: #bbbbbb;width: 200rpx;height: 60rpx;line-height:60rpx;text-align: center;">{{item.name}}</text>
 						</view>
 						<view style="float: right;line-height: 60rpx;">{{item.quantity}}个名额</view>
 					</view>
@@ -81,9 +95,16 @@
 		<view style="height: 200rpx;"></view>
 		<view class="footer-fixed">
 			<view class="flex btn">
-				<button type="default" @click="exChange">获取抽奖码</button>
+				<button v-if="info.status && JSON.parse(info.status).value == 3" type="default" @click="exChange">获取抽奖码</button>
+				<u-count-down v-else  :time="activityTimeTwo" format="DD:HH:mm:ss" autoStart millisecond @change="onChange">
+					<button style="background-color: #555;" type="default" @click="exChange">
+						开启倒计时:{{timeData.days}}&nbsp;天{{ timeData.hours>10?timeData.hours:'0'+timeData.hours}}&nbsp;:{{timeData.minutes>10?timeData.minutes:'0'+timeData.minutes}}&nbsp;:{{timeData.seconds>10?timeData.seconds:'0'+timeData.seconds}}
+					</button>
+				</u-count-down>
 			</view>
 		</view>
+
+
 		<u-popup :show="popupShow" mode="bottom" @close="close" closeable>
 			<view
 				style="height: 98rpx;width: 100%; border-bottom: 2rpx solid #bbbbbb;text-align: center;line-height: 98rpx;">
@@ -93,7 +114,8 @@
 				<text style="color: #8c8c8c; font-size: 24rpx;">每邀请一位好友助力成功,即可获得1个抽奖码,没有上限</text>
 			</view>
 			<view style="padding: 0rpx 20rpx 50rpx ; ">
-				<button type="default" style="background-color: #f7682b; color: #fff;"  open-type="share">立即邀请好友助力</button>
+				<button type="default" style="background-color: #f7682b; color: #fff;"
+					open-type="share">立即邀请好友助力</button>
 			</view>
 
 
@@ -131,7 +153,6 @@
 				});
 				$http.post(`/api/v1/mp/user/marketing/detail/${this.id}`, {}).then(res => {
 					uni.hideLoading();
-					console.log(res)
 					if (res.code == 0) {
 						this.info = res.data
 						let awardsList = res.data.awardsList
@@ -149,7 +170,7 @@
 						this.description = this.formatRichText(description);
 						let timestamp = parseInt(new Date().getTime())
 						this.activityTime = this.info.endTime - timestamp
-						console.log(this.activityTime);
+						this.activityTimeTwo = this.info.startTime - timestamp
 					}
 				}).catch(() => {
 					uni.hideLoading();
@@ -161,16 +182,18 @@
 			exChange() {
 				//弹出层打开
 				this.popupShow = true
-				$http.post('/api/v1/mp/user/marketing/inviteCode', {}).then(res=>{
-					if(res.code == 0){
+				$http.post('/api/v1/mp/user/marketing/inviteCode', {}).then(res => {
+					if (res.code == 0) {
 						this.inviteCode = res.data
-						console.log(this.inviteCode);
 					}
 				})
 				uni.requestSubscribeMessage({
-					tmplIds:['3y_My-yRmqmGd3-f-vAwNaK4LQeehzXBSNDi_5wcnFI','FGcPOV1j9ApESr3VUlWjFr6E1vF4X_h0LLN82T2CLL0','92xxL8XTRPLROyNUtmN04OT0kyq4iwSCH3sz-j6zbZs'],
-					success (res) {
-						console.log(res);
+					tmplIds: ['3y_My-yRmqmGd3-f-vAwNaK4LQeehzXBSNDi_5wcnFI',
+						'FGcPOV1j9ApESr3VUlWjFr6E1vF4X_h0LLN82T2CLL0',
+						'92xxL8XTRPLROyNUtmN04OT0kyq4iwSCH3sz-j6zbZs'
+					],
+					success(res) {
+
 					}
 				})
 			},
@@ -210,7 +233,7 @@
 		onShareAppMessage(res) {
 			return {
 				title: '超值宝贝免费抽,参与活动仅需3秒',
-				path: `/pages/index/index?marketingId=${ this.info.id }?inviteCode=${ this.inviteCode }`
+				path: `/pages/index/index?marketingId=${ this.info.id }&inviteCode=${ this.inviteCode }`
 			}
 		},
 	}
@@ -252,6 +275,7 @@
 				border-radius: 20rpx;
 			}
 		}
+
 		// 设置ios刘海屏底部横线安全区域
 		padding-bottom: constant(safe-area-inset-bottom);
 		padding-bottom: env(safe-area-inset-bottom);

+ 33 - 2
packageOperate/activity/record.vue

@@ -30,6 +30,29 @@
 				</view>
 			</view>
 		</view>
+		
+		<!-- 中奖 -->
+		<u-popup :show="activityShow" mode="center" round="17" @close="close" :closeable="true" overlayOpacity="0.5" @touchmove.prevent.stop>
+			<view class="choiceShow-wrap">
+				<view style="width: 400rpx; height: 400rpx;line-height: 400rpx; text-align: center;">
+					恭喜你获得一等奖
+				</view>
+				<button @click="toPrize()">前往查看</button>
+				<button @click="close()">关闭</button>
+			</view>
+		</u-popup>
+		
+		<!-- 未中奖 -->
+		<u-popup :show="closeShow" mode="center" round="17" @close="close" :closeable="true" overlayOpacity="0.5" @touchmove.prevent.stop>
+			<view class="choiceShow-wrap">
+				<view style="width: 400rpx; height: 400rpx;line-height: 400rpx; text-align: center;">
+					很遗憾你未中奖
+					<br>
+					欢迎继续参与其他抽奖,好运就在你身边
+				</view>
+				<button @click="close()">取消</button>
+			</view>
+		</u-popup>
 	</view>
 </template>
 
@@ -42,6 +65,8 @@
 				list: [],
 				marketingId: '',
 				total: '',
+				closeShow: false,
+				activityShow: false,
 			}
 		},
 		onLoad(opthios) {
@@ -49,6 +74,8 @@
 			this.pageList()
 		},
 		methods: {
+			
+
 			pageList() {
 				this.pageNum = 1
 				this.list = []
@@ -62,7 +89,6 @@
 				$http.post(`/api/v1/mp/user/marketing/hit/prize/list`, {
 					marketingId: this.marketingId,
 				}).then(res => {
-					console.log(res);
 					uni.hideLoading();
 					this.loading = false
 					if (res.code == 0) {
@@ -79,7 +105,12 @@
 					this.loading = false
 				})
 			},
-
+			
+			toPrize() {
+				uni.navigateTo({
+					url:'/packagePrize/prize/index'
+				})
+			},
 		}
 	}
 </script>

+ 0 - 0
static/activity/one.png → packageOperate/static/activity/one.png


+ 0 - 0
static/activity/three.png → packageOperate/static/activity/three.png


+ 0 - 0
static/activity/two.png → packageOperate/static/activity/two.png


+ 0 - 1
pages/activity/index.vue

@@ -90,7 +90,6 @@
 				$http.post(`/api/v1/mp/user/marketing/list?pageNum=${ this.pageNum }&pageSize=20`, {
 					triggerStatus: this.triggerStatus,
 				}).then(res => {
-					console.log(res);
 					uni.hideLoading();
 					this.loading = false
 					if (res.code == 0) {

+ 21 - 10
pages/index/index.vue

@@ -129,6 +129,8 @@
 		<custom-tab-bar :activeValue="'index'" />
 		<!-- 支付弹框组件 -->
 		<pay-popup :pay-show="payShow" :pay-info="payInfo" @close="close" @success="toProcess" v-if="payShow" />
+		<!-- 助力邀请弹框组件 -->
+		<activity-help :activity-show="activityShow" :inviteCode="inviteCode" :marketingId="marketingId" @close="close" @success="toActivity" v-if="activityShow" />
 	</view>
 </template>
 
@@ -138,11 +140,13 @@
 	import CustomTabBar from '../../components/custom-tab-bar/custom-tab-bar.vue'
 	import PayPopup from '../../components/pay-popup/pay-popup.vue'
 	import PrizeBarrage from '@/components/prize-barrage/prize-barrage.vue'
+	import ActivityHelp from '@/components/activity-help/activity-help.vue'
 	export default {
 		components: {
 			CustomTabBar,
 			PayPopup,
-			PrizeBarrage
+			PrizeBarrage,
+			ActivityHelp
 		},
 		data() {
 			return {
@@ -162,9 +166,24 @@
 				list: [1,2,3,4,5],
 				percentage: 0,
 				checkStatus: true, 
+				
+				inviteCode: '',//助力邀请码
+				marketingId: '',//活动id
+				activityShow: false,//助力邀请弹框
 			};
 		},
 		onLoad(opthios) {
+			console.log(13233433,JSON.stringify(opthios));
+			/**
+			 * 免费活动邀请助力分享跳转接收参数
+			 * inviteCode: 邀请码
+			 * marketingId: 活动id
+			 * */
+			if (opthios.inviteCode && opthios.marketingId) {
+				this.inviteCode = opthios.inviteCode
+				this.marketingId = opthios.marketingId
+				this.activityShow = true
+			}
 			/**
 			 * 票赢天下小程序分享盲票跳转接受的参数
 			 * shareUid: 用户ID
@@ -176,15 +195,6 @@
 				uni.setStorageSync('shareUid', this.sceneArr[0])
 				uni.setStorageSync('shareType', this.sceneArr[1])
 			}
-			/**
-			 * 免费活动邀请助力分享跳转接收参数
-			 * inviteCode: 邀请码
-			 * marketingId: 活动id
-			 * */
-			if (opthios.inviteCode) {
-				console.log(opthios.inviteCode)
-				console.log(opthios.marketingId)
-			}
 			
 			// #ifdef MP-WEIXIN
 			const res = uni.getMenuButtonBoundingClientRect()
@@ -346,6 +356,7 @@
 			// 关闭支付弹框
 			close() {
 				this.payShow = false
+				this.activityShow = false
 			},
 
 			// // 盲票选中改变