|
|
@@ -1,6 +1,6 @@
|
|
|
<!--
|
|
|
邀请开店 / 会员开通页
|
|
|
- 用途:分享带邀请码新用户注册+支付;已开店用户仅填邀请码并本页支付
|
|
|
+ 用途:分享带邀请码新用户注册+支付;已开店用户续费(仅首次付费享邀请减免与佣金)
|
|
|
-->
|
|
|
<template>
|
|
|
<view class="apply-page app-content">
|
|
|
@@ -148,9 +148,9 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
- <!-- 会员费、邀请码、减免、应付 -->
|
|
|
+ <!-- 会员费、邀请码(仅首次付费可用)、减免、应付 -->
|
|
|
<view class="fee-card module-com apply-card">
|
|
|
- <view class="fee-row">
|
|
|
+ <view v-if="inviteBenefitAvailable" class="fee-row">
|
|
|
<text class="fee-label">邀请码</text>
|
|
|
<input
|
|
|
v-model="form.inviteCode"
|
|
|
@@ -308,13 +308,22 @@ export default {
|
|
|
mobile: ''
|
|
|
},
|
|
|
/** 分享链接/启动参数带入的邀请码,优先级高于 xhApply */
|
|
|
- inviteCodeFromLink: ''
|
|
|
+ inviteCodeFromLink: '',
|
|
|
+ /** 是否已有 xhRenew 付费成功(续费不再享受邀请减免/佣金) */
|
|
|
+ hasPaidRegisterRenew: false
|
|
|
};
|
|
|
},
|
|
|
computed:{
|
|
|
...mapGetters(["getLoginInfo"]),
|
|
|
+ /** 是否仍可使用邀请码减免 */
|
|
|
+ inviteBenefitAvailable () {
|
|
|
+ return !this.hasPaidRegisterRenew
|
|
|
+ },
|
|
|
/** 提交按钮文案 */
|
|
|
submitBtnText () {
|
|
|
+ if (this.hasShop && this.hasPaidRegisterRenew) {
|
|
|
+ return '续费'
|
|
|
+ }
|
|
|
return this.hasShop ? '立即支付' : '确认注册'
|
|
|
},
|
|
|
/** 横幅背景图 */
|
|
|
@@ -416,14 +425,31 @@ export default {
|
|
|
const code = (this.option && this.option.inviteCode) ? String(this.option.inviteCode).trim() : ''
|
|
|
return code
|
|
|
},
|
|
|
- /** 按优先级回填邀请码:链接参数 > xhApply */
|
|
|
+ /** 按优先级回填邀请码:链接参数 > xhApply(已付费续费不再回填) */
|
|
|
applyInviteCodeFromContext (applyInviteCode) {
|
|
|
+ if (this.hasPaidRegisterRenew) {
|
|
|
+ this.form.inviteCode = ''
|
|
|
+ return
|
|
|
+ }
|
|
|
if (this.inviteCodeFromLink) {
|
|
|
this.form.inviteCode = this.inviteCodeFromLink
|
|
|
} else if (applyInviteCode) {
|
|
|
this.form.inviteCode = applyInviteCode
|
|
|
}
|
|
|
},
|
|
|
+ /** 同步接口返回的首次付费邀请权益标记 */
|
|
|
+ syncInviteBenefitFlags (data) {
|
|
|
+ if (!data) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (data.hasPaidRegisterRenew === 1 || data.inviteBenefitAvailable === 0) {
|
|
|
+ this.hasPaidRegisterRenew = true
|
|
|
+ this.form.inviteCode = ''
|
|
|
+ this.inviteCodeFromLink = ''
|
|
|
+ } else if (data.inviteBenefitAvailable === 1) {
|
|
|
+ this.hasPaidRegisterRenew = false
|
|
|
+ }
|
|
|
+ },
|
|
|
/** 拉取是否已开店及 xhApply 邀请快照;skipInviteFill 为 true 时不改邀请码输入框 */
|
|
|
async loadRegisterInviteContext (skipInviteFill) {
|
|
|
const token = uni.getStorageSync('token')
|
|
|
@@ -444,6 +470,7 @@ export default {
|
|
|
name: d.shopName || '',
|
|
|
mobile: d.shopMobile || ''
|
|
|
}
|
|
|
+ this.syncInviteBenefitFlags(d)
|
|
|
if (!skipInviteFill) {
|
|
|
this.applyInviteCodeFromContext(d.inviteCode || '')
|
|
|
await this.loadRegisterFeePreview(false)
|
|
|
@@ -454,13 +481,14 @@ export default {
|
|
|
},
|
|
|
/** 拉取会员费 / 邀请减免预览 */
|
|
|
async loadRegisterFeePreview (notifyInvalid) {
|
|
|
- const code = (this.form.inviteCode || '').trim()
|
|
|
+ const code = this.inviteBenefitAvailable ? ((this.form.inviteCode || '').trim()) : ''
|
|
|
try {
|
|
|
const res = await getRegisterFeePreview({ inviteCode: code })
|
|
|
- if (code !== (this.form.inviteCode || '').trim()) {
|
|
|
+ if (code !== (this.inviteBenefitAvailable ? (this.form.inviteCode || '').trim() : '')) {
|
|
|
return
|
|
|
}
|
|
|
if (res.code === 1 && res.data) {
|
|
|
+ this.syncInviteBenefitFlags(res.data)
|
|
|
this.feePreview = { ...this.feePreview, ...res.data }
|
|
|
if (notifyInvalid && code !== '' && res.data.inviteNotFound) {
|
|
|
uni.showToast({ title: '邀请人不存在', icon: 'none' })
|
|
|
@@ -825,11 +853,6 @@ export default {
|
|
|
},
|
|
|
/** 已开店:仅校验协议与邀请码后支付 */
|
|
|
formSubmitPayOnly () {
|
|
|
- const inviteCode = (this.form.inviteCode || '').trim()
|
|
|
- if (inviteCode !== '' && this.feePreview.inviteNotFound) {
|
|
|
- this.$msg('邀请人不存在')
|
|
|
- return false
|
|
|
- }
|
|
|
if (this.agree == 0) {
|
|
|
this.$util.confirmModal({
|
|
|
content: '请阅读并同意服务协议和隐私政策',
|
|
|
@@ -843,9 +866,14 @@ export default {
|
|
|
}
|
|
|
this.confirmPayOnly()
|
|
|
},
|
|
|
- /** 已开店:保存邀请码并唤起支付 */
|
|
|
+ /** 已开店:保存邀请码并唤起支付(续费跳过邀请码) */
|
|
|
confirmPayOnly () {
|
|
|
const that = this
|
|
|
+ if (this.hasPaidRegisterRenew) {
|
|
|
+ uni.showLoading({ mask: true })
|
|
|
+ that.startPayFlow(that.applyId)
|
|
|
+ return
|
|
|
+ }
|
|
|
const inviteCode = (this.form.inviteCode || '').trim()
|
|
|
if (inviteCode !== '' && this.feePreview.inviteNotFound) {
|
|
|
this.$msg('邀请人不存在')
|
|
|
@@ -860,6 +888,7 @@ export default {
|
|
|
}
|
|
|
const d = res.data
|
|
|
that.applyId = d.applyId || that.applyId
|
|
|
+ that.syncInviteBenefitFlags(d)
|
|
|
that.feePreview = { ...that.feePreview, ...d }
|
|
|
that.startPayFlow(that.applyId)
|
|
|
}).catch(() => {
|