Эх сурвалжийг харах

线下开奖预付票开奖流程

DELL 3 жил өмнө
parent
commit
60056ce2b7

+ 21 - 1
packageOperate/activity/index.vue

@@ -214,6 +214,8 @@
 				activityShow: false,//助力邀请弹框
 				inviteCodeTa: '', //邀请码
 				marketingId: '',//活动id
+				userInfo: '',//uid
+				
 			}
 		},
 		onLoad(opthios) {
@@ -231,10 +233,20 @@
 				this.id = opthios.marketingId
 				this.activityShow = true
 			}
+			
+			if (opthios.userId) {
+				uni.setStorageSync('shareUid', opthios.userId)
+			}
+			
+			if (opthios.type) {
+				uni.setStorageSync('shareType', opthios.type)
+			}
+			
 			this.getDetail()
 		},
 		onShow() {
 			this.pagesNum = getCurrentPages().length
+			this.getBaseInfo()
 		},
 		methods: {
 			toActivity() {
@@ -346,11 +358,19 @@
 					'<img style="max-width:100%;height:auto;font-size: 0;margin-top: -5px;"');
 				return newContent;
 			},
+			getBaseInfo() {
+				$http.post('/api/v1/mp/user/getLoginUserinfo', {}).then(res => {
+					uni.hideLoading();
+					if (res.code == 0) {
+						this.userInfo = res.data
+					}
+				})
+			},
 		},
 		onShareAppMessage(res) {
 			return {
 				title: '超值宝贝免费抽,参与活动仅需3秒',
-				path: `/packageOperate/activity/index?marketingId=${ this.info.id }&inviteCode=${ this.inviteCode }`,
+				path: `/packageOperate/activity/index?marketingId=${ this.info.id }&inviteCode=${ this.inviteCode }&userId=${ this.userInfo.userId }&type=1`,
 				imageUrl: 'https://mp-public-1310078123.cos.ap-shanghai.myqcloud.com/v2/free_draw_bkg.jpeg',
 			}
 		},

+ 2 - 2
packagePrize/choice/index.vue

@@ -90,7 +90,7 @@
 <script>
 	import env from '../../config/env.js'
 	import $http from '@/utils/request.js'
-	import { formatRichText } from '@/utils/util.js'
+	import { formatRichText,urlParameter } from '@/utils/util.js'
 	export default {
 		data() {
 			return {
@@ -294,7 +294,7 @@
 						scanType: ['qrCode'],
 						success(res) {
 							const url = res.result
-							let serialNo = url.substring(url.length - 21, url.length)
+							let serialNo = urlParameter(url).id
 							uni.redirectTo({
 								url: `/pages/lucky/index?id=${ serialNo }&type=offLine`
 							})

+ 11 - 1
pages/index/index.vue

@@ -157,7 +157,7 @@
 			};
 		},
 		onLoad(opthios) {
-			
+			console.log(opthios);
 			/**
 			 * 票赢天下小程序分享盲票跳转接受的参数
 			 * shareUid: 用户ID
@@ -170,6 +170,16 @@
 				uni.setStorageSync('shareType', this.sceneArr[1])
 			}
 			
+			/**
+			* 外部app跳转接受的参数
+			* shareUid: 用户ID
+			* shareType: 分享类型
+			* */
+			if(opthios.uid) {
+				uni.setStorageSync('shareUid', opthios.uid)
+				uni.setStorageSync('shareType', opthios.t)
+			}
+			
 			// #ifdef MP-WEIXIN
 			const res = uni.getMenuButtonBoundingClientRect()
 			this.statusHeight = res.top //胶囊距离顶部

+ 71 - 28
pages/lucky/index.vue

@@ -22,14 +22,19 @@
 							<image src="../../static/lucky/lucky_ok.png" mode="" v-else></image>
 							<view class="luck-info-content-ticket-info flex">
 								<view class="title" :class="{ 'action': info.status == 2 }">{{ info.title }}</view>
-								<view class="serialNo" :class="{ 'action': info.status == 2 }">盲票序列号:{{ info.serialNo }}</view>
+								<view class="serialNo" :class="{ 'action': info.status == 2 }">盲票序列号:{{ info.serialNo }}
+								</view>
 							</view>
 						</view>
-						<view class="luck-info-content-btn" @click="pay" v-if="info.status == 1">支付{{ info.salePrice / 100 }}元 立即查看</view>
+						<view class="luck-info-content-btn" @click="pay" v-if="info.status == 1 && info.salePrice != 0">
+							支付{{ info.salePrice / 100 }}元 立即查看</view>
+						<view class="luck-info-content-btn" @click="payDetail"
+							v-else-if="info.status == 1 && info.salePrice == 0">收下盲票,查看幸运数字</view>
 						<view class="luck-info-content-btn code" @click="scanCode" v-else>扫码兑奖</view>
 					</view>
 					<view class="luck-info-close flex">
-						<navigator open-type="exit" target="miniProgram" hover-class="none" class="luck-info-close-content flex">
+						<navigator open-type="exit" target="miniProgram" hover-class="none"
+							class="luck-info-close-content flex">
 							<u-icon name="close" color="#fff" size="20"></u-icon>
 						</navigator>
 					</view>
@@ -62,7 +67,9 @@
 	import env from '../../config/env.js'
 	import $http from '@/utils/request.js'
 	import PayPopup from '../../components/pay-popup/pay-popup.vue'
-
+	import {
+		urlParameter
+	} from '@/utils/util.js'
 	export default {
 		components: {
 			PayPopup
@@ -88,12 +95,15 @@
 			}
 
 			if (options.q) {
-				let url = JSON.stringify(options.q)
-				this.serialNo = url.substring(url.length - 22, url.length - 1)
+				let obj = urlParameter(decodeURIComponent(options.q))
+				this.serialNo = obj.id
 				this.getDetail()
+				// let url = JSON.stringify(options.q)
+				// this.serialNo = url.substring(url.length - 22, url.length - 1)
+				// this.getDetail()
 			}
 		},
-		
+
 		methods: {
 			scanCode() {
 				let _this = this
@@ -101,7 +111,8 @@
 					scanType: ['qrCode'],
 					success(res) {
 						let url = res.result
-						_this.serialNo = url.substring(url.length - 21, url.length)
+						// _this.serialNo = url.substring(url.length - 21, url.length)
+						_this.serialNo = urlParameter(url).id
 						_this.getDetail()
 					},
 					fail() {
@@ -213,6 +224,38 @@
 			close() {
 				this.payShow = false
 			},
+			payDetail() {
+				let data = {
+					ticketId: this.info.ticketId,
+					autoCoupon: 0,
+					userCouponIds: [],
+					orderNum: 1
+				}
+				uni.showLoading();
+				$http.post('/api/v1/mp/user/ticket/order/settle', data).then(res => {
+					uni.hideLoading();
+					if (res.code == 0) {
+						if (res.data.payAmt == 0) {
+							$http.post('/api/v1/mp/user/ticket/order/submit', {
+								suid: uni.getStorageSync('shareUid'),
+								type: uni.getStorageSync('shareType')
+							}).then(res => {
+								uni.hideLoading();
+								if (res.code == 0) {
+									this.getDetailInfo()
+								}else {
+									this.showNull = true
+									this.luckyShow = false
+								}
+							}).catch(() => {
+								uni.hideLoading();
+							})
+						}
+					}
+				}).catch(() => {
+					uni.hideLoading();
+				})
+			},
 
 			pay() {
 				let data = {
@@ -244,7 +287,7 @@
 					uni.hideLoading();
 				})
 			},
-			
+
 			toUser() {
 				uni.switchTab({
 					url: '/pages/user/index'
@@ -267,17 +310,17 @@
 			width: 87vw;
 			height: 60vh;
 			// background-color: #fff;
-			
+
 			&-bg {
 				position: absolute;
 				top: 0;
-				
+
 				image {
 					width: 87vw;
 					height: 60vh;
 				}
 			}
-			
+
 			&-content {
 				flex-direction: column;
 				justify-content: flex-start;
@@ -286,21 +329,21 @@
 				z-index: 10;
 				width: 100%;
 				height: 100%;
-				
+
 				&-num {
 					position: relative;
 					width: 60%;
 					height: 10vh;
 					margin-top: 17vh;
 					margin-bottom: 2vh;
-					
+
 					image {
 						position: absolute;
 						top: 0;
 						width: 100%;
 						height: 100%;
 					}
-					
+
 					&__content {
 						position: absolute;
 						top: 0;
@@ -313,14 +356,14 @@
 						color: #FD3331;
 					}
 				}
-				
+
 				&-title {
 					font-size: 40rpx;
 					line-height: 40rpx;
 					color: #FEFEFE;
 					margin-bottom: 1vh;
 				}
-				
+
 				&-tip {
 					width: 80%;
 					font-size: 26rpx;
@@ -328,29 +371,29 @@
 					text-align: center;
 					color: #fff;
 				}
-				
+
 				&-ticket {
 					position: relative;
 					width: 96%;
 					height: 14vh;
 					margin-bottom: 2vh;
-					
+
 					image {
 						position: absolute;
 						top: 0;
 						width: 100%;
 						height: 100%;
 					}
-					
+
 					&-info {
 						width: 100%;
 						height: 100%;
 						position: absolute;
 						top: 0;
 						z-index: 5;
-						
+
 						flex-direction: column;
-						
+
 						.title {
 							font-size: 36rpx;
 							line-height: 36rpx;
@@ -358,18 +401,18 @@
 							color: #FF6D2C;
 							margin-bottom: 2vh;
 						}
-						
+
 						.serialNo {
 							font-size: 26rpx;
 							color: #FF6D2C;
 						}
-						
+
 						.action {
 							color: #FFCBAA;
 						}
 					}
 				}
-				
+
 				&-btn {
 					padding: 0 13%;
 					height: 8vh;
@@ -381,17 +424,17 @@
 					color: #FEFEFE;
 					font-size: 40rpx;
 				}
-				
+
 				.code {
 					padding: 0 20%;
 				}
 			}
-			
+
 			&-close {
 				width: 100%;
 				position: absolute;
 				bottom: -140rpx;
-				
+
 				&-content {
 					width: 70rpx;
 					height: 70rpx;

+ 22 - 0
utils/util.js

@@ -155,3 +155,25 @@ export function formatRichText(html) { //控制小程序中图片大小
 		'<img style="max-width:100%;height:auto;font-size: 0;margin-top: -5px;"');
 	return newContent;
 }
+
+//解析网址
+export function urlParameter(q) {
+	let url = q;
+	let params = url.split("?")
+	let obj = {};
+	for (let i = 1, len = params.length; i < len; i++) {
+		let str = params[i];
+		if (str.indexOf("#") > 0) {
+			str = str.split("#")[0];
+		}
+		if (str.indexOf("&") > 0) {
+			let result = str.split("&");
+			for (let j of result) {
+				obj[`${j.split("=")[0]}`] = j.split("=")[1];
+			}
+		} else {
+			obj[`${str.split("=")[0]}`] = str.split("=")[1];
+		}
+	}
+	return obj;
+}