shish hai 2 meses
pai
achega
07e1ec4a80

+ 7 - 2
hdApp/src/admin/home/components/purchase-ghs-panel.vue

@@ -242,7 +242,7 @@ import { currentShop } from "@/api/shop";
 import { hasNotice } from "@/api/admin";
 import permision from "@/utils/wa-permission_1.1/permission.js";
 import { iconSrc } from "@/utils/iconSrc";
-import { refreshPendingInviteState, getGhsProductQueryFromPending, buildGhsInviteSharePayload } from "@/utils/pendingGhsInvite";
+import { refreshPendingInviteState, getGhsProductQueryFromPending, buildGhsInviteSharePayload, hasPendingInvite, restorePendingInviteFromLegacy } from "@/utils/pendingGhsInvite";
 
 export default {
   name: "PurchaseGhsPanel",
@@ -503,7 +503,12 @@ export default {
       })
     },
     async searchGhs() {
-      console.log('searchGhs start')
+      restorePendingInviteFromLegacy()
+      if (hasPendingInvite()) {
+        this.refreshPendingInviteUI()
+        this.$msg('您有待查看的邀请批发店,请先点击查看')
+        return
+      }
 
       // #ifdef APP-PLUS
       // App 端先显式申请权限,避免部分机型 getLocation 挂起无回调

+ 13 - 3
hdApp/src/pagesClient/official/apply.vue

@@ -133,7 +133,7 @@ import { checkShop } from '@/api/shop'
 import { ghsInfo } from "@/api/ghs/index";
 import { getMobile } from "@/api/auth";
 import {getHasMap} from "@/api/express"
-import { savePendingInviteFromOption, tryBindPendingInvite, optionHasInviteContext, clearPendingInvite } from "@/utils/pendingGhsInvite";
+import { savePendingInviteFromOption, tryBindPendingInvite, optionHasInviteContext, clearPendingInvite, restorePendingInviteFromLegacy, getPendingInvite } from "@/utils/pendingGhsInvite";
 export default {
   name: "apply-data",
   components: {
@@ -188,7 +188,13 @@ export default {
     if (optionHasInviteContext(this.option)) {
       savePendingInviteFromOption(this.option)
     } else {
-      clearPendingInvite()
+      const legacyOption = uni.getStorageSync('ghsCgOption') || {}
+      const hadLegacy = !!(uni.getStorageSync('ghsCgScene') || legacyOption.shopId)
+      if (hadLegacy) {
+        restorePendingInviteFromLegacy()
+      } else {
+        clearPendingInvite()
+      }
     }
     const token = uni.getStorageSync('token')
     this.headers.token = token
@@ -387,6 +393,10 @@ export default {
       }
     },
     confirmFn () {
+      restorePendingInviteFromLegacy()
+      const pendingInvite = getPendingInvite()
+      const ghsShopAdminId = this.option.ghsShopAdminId || (pendingInvite && pendingInvite.ghsShopAdminId) || 0
+      const hdShopAdminId = this.option.hdShopAdminId || 0
       uni.showLoading({mask:true})
       let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
       let style = this.option.style || 0
@@ -398,7 +408,7 @@ export default {
       // #ifdef APP-PLUS
       appRegister = 1
       // #endif
-      applyRegister({hdShopAdminId:this.option.hdShopAdminId,ghsShopAdminId:this.option.ghsShopAdminId,...this.form,style:style,from:from,miniOpenId:currentMiniOpenId,appRegister:appRegister,fillMobile:this.fillMobile}).then(subRes => {
+      applyRegister({hdShopAdminId:hdShopAdminId,ghsShopAdminId:ghsShopAdminId,...this.form,style:style,from:from,miniOpenId:currentMiniOpenId,appRegister:appRegister,fillMobile:this.fillMobile}).then(subRes => {
         uni.hideLoading()
         let token = subRes.data.token || ''
         uni.hideLoading()

+ 5 - 2
hdApp/src/pagesPurchase/ghsProduct.vue

@@ -207,7 +207,7 @@ import AppActivilyCoupon from "@/components/module/app-activily-coupon";
 import { mapGetters } from "vuex";
 import { getGhsDataApi, ghsInfo, visitMall } from "@/api/ghs";
 import { getLimitBuyInfo } from "@/api/purchase";
-import { savePendingInviteFromOption, tryBindPendingInvite, getPendingInvite, restorePendingInviteFromLegacy } from "@/utils/pendingGhsInvite";
+import { savePendingInviteFromOption, tryBindPendingInvite, getPendingInvite, restorePendingInviteFromLegacy, persistInviteContext } from "@/utils/pendingGhsInvite";
 export default {
 	name: "ghsProduct",
 	components: {
@@ -226,6 +226,9 @@ export default {
 		},
 	},
 	mixins: [productMins],
+	onLoad(option) {
+		persistInviteContext(option || this.option)
+	},
 	data() {
 		return {
 			pageType: "cg",
@@ -519,7 +522,7 @@ export default {
 			uni.setNavigationBarTitle({title: this.ghsInfo.name})
 		},
 		init(){
-			savePendingInviteFromOption(this.option)
+			persistInviteContext(this.option)
 			if (!getPendingInvite()) {
 				const legacyScene = uni.getStorageSync('ghsCgScene')
 				if (legacyScene) {

+ 15 - 0
hdApp/src/utils/pendingGhsInvite.js

@@ -74,6 +74,20 @@ export function optionHasInviteContext(option) {
 	return false
 }
 
+export function persistInviteContext(option) {
+	if (!option) {
+		return false
+	}
+	const saved = savePendingInviteFromOption(option)
+	if (option.scene) {
+		uni.setStorageSync('ghsCgScene', option.scene)
+	}
+	if (option.fromCg == 1 && (option.shopId || option.sId)) {
+		uni.setStorageSync('ghsCgOption', option)
+	}
+	return saved
+}
+
 export function savePendingInviteFromOption(option) {
 	if (!option) {
 		option = {}
@@ -170,6 +184,7 @@ export function tryBindPendingInvite() {
 	if (!token) {
 		return Promise.resolve(false)
 	}
+	restorePendingInviteFromLegacy()
 	const pending = getPendingInvite()
 	if (!pending || !pending.ghsShopId) {
 		return Promise.resolve(false)