feat(pay): 分享下单注册支付

This commit is contained in:
woody 2025-07-22 15:28:02 +08:00
parent 76a91884c9
commit f0bc328d52
5 changed files with 72 additions and 30 deletions

View File

@ -9,13 +9,14 @@ export default {
} }
const whiteList = [ const whiteList = [
'pages/shareRegist/index', 'pages/shareRegist/index',
// 'pages/shareRegist/success', 'pages/shareRegist/success',
'pages/login/index', 'pages/login/index',
'pages/pay/success',
// 'pages/wechatPay/bfPay/', // 'pages/wechatPay/bfPay/',
// 'pages/wechatPay/hfPay/', // 'pages/wechatPay/hfPay/',
'pages/shareArea/hiList', 'pages/shareArea/hiList',
// 'pages/shareArea/hiOrder', 'pages/shareArea/hiOrder',
// 'pages/pay/hiPay' 'pages/pay/hiPay',
] ]
if (whiteList.indexOf(options.path) !== -1) return if (whiteList.indexOf(options.path) !== -1) return
this.$store.dispatch('GetInfo') this.$store.dispatch('GetInfo')

View File

@ -19,7 +19,7 @@ module.exports = vm => {
//#ifdef DEV_SERVER //#ifdef DEV_SERVER
console.log('DEV_SERVER') console.log('DEV_SERVER')
config.baseURL = 'http://localhost:8080' config.baseURL = 'http://t-app.beida666.com/prod-api'
//#endif //#endif
//#ifdef QA_SERVER //#ifdef QA_SERVER

View File

@ -329,6 +329,7 @@ import {
PAY_AUTH, PAY_AUTH,
} from '@/util/constant.js' } from '@/util/constant.js'
var payStatus var payStatus
let getRegisterInfoTimeoutFlag = null
export default { export default {
components: { components: {
successDialog, successDialog,
@ -390,6 +391,10 @@ export default {
// //
// this.getBankList() // this.getBankList()
}, },
onUnload() {
clearTimeout(getRegisterInfoTimeoutFlag)
clearInterval(payStatus)
},
methods: { methods: {
closewxPopup() { closewxPopup() {
this.wxPopup = false this.wxPopup = false
@ -421,10 +426,16 @@ export default {
}, },
fansOrder() { fansOrder() {
api.fansOrder(this.orderCode).then(res => { api.fansOrder(this.orderCode).then(res => {
if (res.data) {
this.isLoading = false this.isLoading = false
this.isPw = false this.isPw = false
removeToken() removeToken()
this.$refs.successDialog.showSuccess(res.data) this.$refs.successDialog.showSuccess(res.data)
} else {
getRegisterInfoTimeoutFlag = setTimeout(() => {
this.fansOrder()
}, 3000)
}
}) })
}, },
payPw() { payPw() {
@ -701,7 +712,12 @@ export default {
clearInterval(payStatus) clearInterval(payStatus)
this.wxPopup = false this.wxPopup = false
// this.showSucce = true // this.showSucce = true
uni.showLoading({
title: '正在获取注册信息,请不要关闭当前页面',
})
setTimeout(() => {
this.fansOrder() this.fansOrder()
}, 2000)
} else { } else {
api.payStatus(data).then(res => { api.payStatus(data).then(res => {
that.sucPay = res.data that.sucPay = res.data

View File

@ -44,13 +44,18 @@
<view class="action-section"> <view class="action-section">
<view class="button-group"> <view class="button-group">
<button <button
v-if="!isRecharge" v-if="!isRecharge && !isSharePay"
class="btn btn-secondary" class="btn btn-secondary"
@click="goToOrderList" @click="goToOrderList"
> >
查看订单 查看订单
</button> </button>
<button class="btn btn-primary" @click="goToHome">返回首页</button> <button v-if="!isSharePay" class="btn btn-primary" @click="goToHome">
返回首页
</button>
<button v-else class="btn btn-primary" @click="goToLogin">
去登录
</button>
</view> </view>
</view> </view>
@ -60,7 +65,7 @@
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { payStatus, registerInfo } from '@/config/pay.js' import { payStatus, registerInfo, fansOrder } from '@/config/pay.js'
import successDialog from '@/components/successDialog.vue' import successDialog from '@/components/successDialog.vue'
let paySetTimeoutFlag = null let paySetTimeoutFlag = null
@ -94,9 +99,19 @@ export default {
// //
const extParam = JSON.parse(atob(options.extParam || '{}')) const extParam = JSON.parse(atob(options.extParam || '{}'))
console.log(extParam, '..extParam') console.log(extParam, '..extParam')
this.isSharePay = extParam.isSharePay
this.specialArea = extParam.specialArea this.specialArea = extParam.specialArea
this.isRecharge = extParam.isRecharge this.isRecharge = extParam.isRecharge
this.orderCode = extParam.orderCode || '' this.orderCode = extParam.orderCode || ''
if (this.isSharePay) {
uni.showLoading({
title: '正在获取注册信息,请不要关闭当前页面',
})
setTimeout(() => {
this.getShareRegistInfo()
}, 500)
return
}
if (this.orderCode) { if (this.orderCode) {
setTimeout(() => { setTimeout(() => {
this.pollingPayStatus(this.orderCode) this.pollingPayStatus(this.orderCode)
@ -154,7 +169,7 @@ export default {
}, },
successClose() { successClose() {
uni.redirectTo({ uni.redirectTo({
url: '/pages/mine/order/index', url: this.isSharePay ? '/pages/login/index' : '/pages/mine/order/index',
}) })
}, },
@ -164,6 +179,24 @@ export default {
url: '/pages/index/index', url: '/pages/index/index',
}) })
}, },
goToLogin() {
uni.redirectTo({
url: '/pages/login/index',
})
},
getShareRegistInfo() {
fansOrder(this.orderCode).then(res => {
if (res.data) {
removeToken()
uni.hideLoading()
this.$refs.successDialog.showSuccess(res.data)
} else {
getRegisterInfoTimeoutFlag = setTimeout(() => {
this.getShareRegistInfo()
}, 3000)
}
})
},
}, },
} }
</script> </script>

View File

@ -7,9 +7,9 @@
<text class="hero-main">新人专享特惠</text> <text class="hero-main">新人专享特惠</text>
<text class="hero-sub">精选好物·品质优选</text> <text class="hero-sub">精选好物·品质优选</text>
</view> </view>
<view class="promotion-banner"> <!-- <view class="promotion-banner">
<text class="promo-text">限时优惠·新人福利</text> <text class="promo-text">限时优惠·新人福利</text>
</view> </view> -->
</view> </view>
</view> </view>
@ -89,7 +89,7 @@ export default {
}, },
getCode() { getCode() {
api.fansConvertCode(this.pkParent).then(res => { api.fansConvertCode(this.pkParent).then(res => {
this.placeParent = res.msg this.placeParent = res.data
uni.setStorageSync('placeParent', this.placeParent) uni.setStorageSync('placeParent', this.placeParent)
}) })
}, },
@ -103,6 +103,10 @@ export default {
}) })
}, },
goBuy(item) { goBuy(item) {
const params = {
...item,
pkParent: this.pkParent,
}
uni.navigateTo({ uni.navigateTo({
url: '/pages/shareArea/hiOrder?allData=' + JSON.stringify(item), url: '/pages/shareArea/hiOrder?allData=' + JSON.stringify(item),
}) })
@ -298,17 +302,16 @@ export default {
align-items: baseline; align-items: baseline;
.currency { .currency {
color: #005bac; color: #ff6b35;
font-size: 24rpx; font-size: 24rpx;
font-weight: 600; font-weight: 600;
margin-right: 4rpx; margin-right: 4rpx;
} }
.price { .price {
color: #005bac; color: #ff6b35;
font-size: 36rpx; font-size: 36rpx;
font-weight: 700; font-weight: 700;
animation: priceHighlight 2s ease-in-out infinite 1s;
} }
} }
@ -428,17 +431,6 @@ export default {
} }
} }
@keyframes priceHighlight {
0%,
100% {
color: #005bac;
}
50% {
color: #0066cc;
transform: scale(1.05);
}
}
@keyframes promoBreathe { @keyframes promoBreathe {
0%, 0%,
100% { 100% {