Selaa lähdekoodia

邀请开店仅首次续费才有减免、佣金

ouyang 4 päivää sitten
vanhempi
commit
ae533f2c57
2 muutettua tiedostoa jossa 136 lisäystä ja 15 poistoa
  1. 94 2
      hdApp/src/admin/cg/me.vue
  2. 42 13
      hdApp/src/pagesClient/official/applyInvite.vue

+ 94 - 2
hdApp/src/admin/cg/me.vue

@@ -26,13 +26,24 @@
             </view>
           </view>
 
+          <!-- 有到期时间:样式对齐 admin/home/me.vue -->
+          <view v-if="hasMemberDeadline" class="expire-card" @click="goApplyInvite">
+            <view class="expire-main">
+              <text class="expire-label">到期时间</text>
+              <text class="expire-date">{{ memberDeadlineText }}</text>
+            </view>
+            <view class="renew-link">
+              <text class="renew-text">续费</text>
+            </view>
+          </view>
+
         </view>
       </view>
 
       <view class="content-wrap">
 
-      <!-- 已登录:邀请开店 / 年度会员开通入口 -->
-      <view class="open-shop-card" @click="goApplyInvite">
+      <!-- 未开通会员 -->
+      <view v-if="!hasMemberDeadline" class="open-shop-card" @click="goApplyInvite">
         <view class="open-shop-main">
           <text class="open-shop-label">开通状态</text>
           <text class="open-shop-desc">会员未开通</text>
@@ -241,6 +252,21 @@ export default {
         return `${name} ${mobile}`;
       }
       return name || mobile;
+    },
+    /** shopInfo.deadline 是否有有效到期时间 */
+    hasMemberDeadline () {
+      const shopInfo = this.myInfo.shopInfo || {};
+      const deadline = shopInfo.deadline || this.myInfo.deadline || "";
+      return deadline && deadline.indexOf("0000-00-00") !== 0;
+    },
+    /** 到期时间展示:年-月-日 */
+    memberDeadlineText () {
+      const shopInfo = this.myInfo.shopInfo || {};
+      const deadline = shopInfo.deadline || this.myInfo.deadline || "";
+      if (!deadline || deadline.indexOf("0000-00-00") === 0) {
+        return "";
+      }
+      return deadline.substr(0, 10);
     }
   },
   data () {
@@ -793,6 +819,72 @@ export default {
   padding: 4upx 24upx 28upx;
 }
 
+/* 到期续费卡片:与 admin/home/me.vue 保持一致 */
+.expire-card {
+  position: relative;
+  overflow: hidden;
+  min-height: 92upx;
+  margin-top: 22upx;
+  padding: 20upx 24upx;
+  border-radius: 18upx;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  background: rgba(255, 255, 255, 0.72);
+  border: 1upx solid rgba(255, 255, 255, 0.9);
+  box-shadow: 0 6upx 18upx rgba(9, 197, 103, 0.08);
+}
+
+.expire-card::after {
+  content: "";
+  position: absolute;
+  right: -20upx;
+  top: -24upx;
+  width: 120upx;
+  height: 120upx;
+  border-radius: 50%;
+  background: rgba(9, 197, 103, 0.06);
+}
+
+.expire-main,
+.renew-link {
+  position: relative;
+  z-index: 1;
+  display: flex;
+  align-items: center;
+}
+
+.expire-main {
+  flex-direction: column;
+  align-items: flex-start;
+}
+
+.expire-label {
+  font-size: 32upx;
+  line-height: 30upx;
+  color: #8a9199;
+}
+
+.expire-date {
+  margin-top: 16upx;
+  font-size: 38upx;
+  line-height: 38upx;
+  font-weight: 700;
+  color: #111416;
+}
+
+.renew-link {
+  font-size: 28upx;
+  font-weight: 700;
+  line-height: 40upx;
+  color: #09c567;
+}
+
+.renew-text {
+  line-height: 40upx;
+  color: #09c567;
+}
+
 .open-shop-card {
   position: relative;
   overflow: hidden;

+ 42 - 13
hdApp/src/pagesClient/official/applyInvite.vue

@@ -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(() => {