소스 검색

1、免费投票新增验证码验证
2、修改分享出去的链接没带活动Id导致进入活动显示不正确
3、商家小票页加订单类型判断

lyb 4 년 전
부모
커밋
94757755ad
6개의 변경된 파일113개의 추가작업 그리고 12개의 파일을 삭제
  1. 3 1
      assets/http/api.js
  2. 68 0
      components/alert/verificationCodeAlert.vue
  3. 35 7
      pages/activity/activityDetail.vue
  4. 1 1
      pages/index/home.vue
  5. 4 2
      pages/payResult/payResult.vue
  6. 2 1
      pages/shop/detail.vue

+ 3 - 1
assets/http/api.js

@@ -244,6 +244,9 @@ const order = {
 	orderDetail: p => http.get('/sing_yeepay/yeepayorder/detail', {
 		params: p
 	}),
+	verificationCode: p => http.get('/app/help/goods/createPropsVerificationCode', {
+		params: p
+	}) 
 }
 
 /**
@@ -316,7 +319,6 @@ const yeepay={
 		params: p
 	})
 }
-
 export const api = {
 	uploadFileUrl,
 	sms,

+ 68 - 0
components/alert/verificationCodeAlert.vue

@@ -0,0 +1,68 @@
+<template>
+	<view>
+		<u-popup v-model="show" mode="center" width="80%" border-radius="15" :closeable="true" :mask-close-able="false">
+			<view class="code-alert-container">
+				<view class="title">投票验证</view>
+				<view class="code-input">
+					<u-input placeholder="请输入验证码" maxlength="4" v-model="codevalue" type="number"></u-input>
+					<image style="width: 160rpx; height: 80rpx;" :src="codeImg" @click="handleRefreshCode"></imague>
+				</view>
+				<view style="color: #EF9944; margin-bottom: 30rpx;">* 为了保证投票的公平性,防止刷票行为,请先完成验证</view>
+				<u-button :custom-style="customStyle" shape="circle" @click="confirm">确认</u-button>
+			</view>
+		</u-popup>
+		<toast ref="toast"></toast>
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			codeImg: ''
+		},
+		data() {
+			return {
+				show: false,
+				customStyle: {
+					color: 'white',
+					background: "#E72226",
+					width: '400rpx'
+				},
+				codevalue: ''
+			};
+		},
+		created() {
+			this.customStyle.background = this.vuex_theme.bgColor;
+		},
+		computed: {},
+		methods: {
+			handleRefreshCode(){
+				this.$emit('handleRefreshCode')
+			},
+			confirm(){
+				this.$emit('confirm',this.codevalue)
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.code-alert-container {
+		padding: 50rpx;
+
+		.title {
+			width: 100%;
+			text-align: center;
+			padding: 0rpx 10rpx 50rpx 10rpx;
+			font-weight: 500;
+			color: #353535;
+			letter-spacing: 2rpx;
+			font-size: 30rpx;
+		}
+		.code-input{
+			display: flex;
+			align-items: center;
+			margin-bottom: 20rpx;
+		}
+	}
+</style>

+ 35 - 7
pages/activity/activityDetail.vue

@@ -73,6 +73,7 @@
 		<vote-success ref="voteSuccess" @support="skipShop"></vote-success>
 		<home-btn></home-btn>
 		<webAuthAlert ref="webAuthAlert" tipsContent="首次现金投票助力需用户授权" @confirm="webAuthConfirm"></webAuthAlert>
+		<verificationCodeAlert ref="verificationCodeAlert" :codeImg="verificationCodeImg" @handleRefreshCode="getVerificationCode" @confirm="codeConfirm"></verificationCodeAlert>
 	</view>
 </template>
 
@@ -84,6 +85,7 @@
 	import poster from "@/components/poster/poster.vue"
 	import smsAlert from "@/components/alert/smsAlert.vue"
 	import webAuthAlert from "@/components/alert/webAuthAlert.vue"
+	import verificationCodeAlert from '@/components/alert/verificationCodeAlert.vue'
 	export default {
 		components: {
 			voteSuccess,
@@ -92,7 +94,8 @@
 			timelinePopup,
 			votePopup,
 			poster,
-			webAuthAlert
+			webAuthAlert,
+			verificationCodeAlert
 		},
 		async onLoad(props) {
 			// #ifdef MP-WEIXIN
@@ -189,6 +192,8 @@
 				},
 				//活动设置
 				activitySetting: {},
+				//验证码图片
+				verificationCodeImg: ''
 			}
 		},
 		onShareAppMessage(res) {
@@ -343,8 +348,10 @@
 				//移动积分礼物
 				if(item.payType === 'POINT_EXCHANGE_GOODS'){
 					if (item.point == 0 ) {
+						this.getVerificationCode();
+						this.$refs.verificationCodeAlert.show = true;
 						//免费投票
-						this.freeVote()
+						// this.freeVote()
 						return
 					}
 					this.$refs.votePopup.hideVote()
@@ -440,7 +447,8 @@
 					let params = {
 						orderId: res.data.data.bankOrderId,
 						orderUrl: url,
-						color: this.vuex_theme.bgColor
+						color: this.vuex_theme.bgColor,
+						type: 'VOTE_ORDER'
 					}
 					this.$api.yeepay.saveOrderUrlAndColor(params)
 					this.$shareConfig.H5Pay(JSON.parse(res.data.data.prePayTn)).then((res) => {
@@ -487,16 +495,35 @@
 					this.$refs.toast.info('助力成功')
 				}
 			},
-			async freeVote() {
+			codeConfirm(code){
+				this.freeVote(code)
+			},
+			//获取验证码
+			async getVerificationCode() {
+				let params = {
+					helpGoodsId: this.selectGoods.id,
+					productId: this.activity.id,
+					userId: this.vuex_userId
+				}
+				let res = await this.$api.order.verificationCode(params)
+				if (res.data.success) {
+					this.verificationCodeImg = res.data.data
+					
+				}
+			},
+			async freeVote(code) {
 				let params = {
 					helpGoodsId: this.selectGoods.id,
 					userId: this.vuex_userId,
 					num: 1,
 					productId: this.activity.id,
 				}
+				if(this.selectGoods.point == 0){params.code = code;}
 				let res = await this.$api.order.exchange(params)
 				if (res.data.success) {
 					this.$refs.votePopup.hideVote()
+					this.$refs.verificationCodeAlert.show = false;
+					this.$refs.verificationCodeAlert.codevalue = '';
 					this.fetchData()
 
 					let avatar = this.$cache.get('userInfo').avatar
@@ -506,10 +533,11 @@
 						this.voteSuccess()
 					}, 200)
 				} else {
-					this.$refs.votePopup.hideVote()
+					this.$u.toast(res.data.msg)
+					this.$refs.verificationCodeAlert.codevalue = '';
 					setTimeout(() => {
-						this.$refs.toast.error(res.data.msg)
-					}, 200)
+						this.getVerificationCode();
+					}, 1000)
 				}
 			},
 			customBack() {

+ 1 - 1
pages/index/home.vue

@@ -219,7 +219,7 @@
 				// #ifdef H5
 				if (this.$isNotEmpty(activeSetting.shareParam)) {
 					let shareParam = activeSetting.shareParam
-					shareParam.link = window.location.href
+					shareParam.link = window.location.href.split('?')[0] + '?activeId=' + this.activeId
 					this.$shareConfig.H5Share(shareParam)
 				}
 				// #endif

+ 4 - 2
pages/payResult/payResult.vue

@@ -2,7 +2,7 @@
 	<view class="payResult">
 		<u-icon name="checkmark-circle-fill" :color="bgColor" style="margin-top: 50rpx;" size="100"></u-icon>
 		<view>支付成功</view>
-		<u-button  shape="circle" :custom-style="customStyle" style="margin-top: 50rpx;" @click="goback">返回详情页</u-button>
+		<u-button  shape="circle" :custom-style="customStyle" style="margin-top: 50rpx;" @click="goback">{{orderType == 'VOTE_ORDER' ? '返回投票页' : '返回详情页'}}</u-button>
 	</view>
 </template>
 
@@ -21,7 +21,8 @@
 					fontSize:"26rpx"
 				},
 				redirect_url: '',
-				bgColor: ''
+				bgColor: '',
+				orderType: ''
 			}
 		},
 		async onLoad(options) {
@@ -36,6 +37,7 @@
 				this.redirect_url = res.data.data.url;
 				this.bgColor = res.data.data.color;
 				this.customStyle.background = this.bgColor;
+				this.orderType = res.data.data.type;
 			}
 			
 		},

+ 2 - 1
pages/shop/detail.vue

@@ -342,7 +342,8 @@
 							let params = {
 								orderId: res.data.data.orderId,
 								orderUrl: url,
-								color: this.vuex_theme.bgColor
+								color: this.vuex_theme.bgColor,
+								type: 'GOODS_ORDER'
 							}
 							this.$api.yeepay.saveOrderUrlAndColor(params)
 							this.$shareConfig.H5Pay(res.data.data).then((res) => {