shish 2 kuukautta sitten
vanhempi
commit
fa1e6b8ab0
2 muutettua tiedostoa jossa 23 lisäystä ja 15 poistoa
  1. 4 14
      hdApp/src/admin/home/workbench.vue
  2. 19 1
      hdApp/src/utils/pendingGhsInvite.js

+ 4 - 14
hdApp/src/admin/home/workbench.vue

@@ -243,7 +243,7 @@
   import { hasNotice } from "@/api/admin";
   import { APIHOST } from "@/config";
   import permision from "@/utils/wa-permission_1.1/permission.js";
-  import { hasPendingInvite, getGhsProductQueryFromPending } from "@/utils/pendingGhsInvite";
+  import { hasPendingInvite, getGhsProductQueryFromPending, buildGhsInviteSharePayload } from "@/utils/pendingGhsInvite";
   export default {
     name: "workbench",
     mixins: [autoUpdateMixins],
@@ -314,19 +314,9 @@
     onShareAppMessage(res) {
       if (res.from === 'button') {
         let ghsInfo = res.target.dataset.ghs
-        let hdShopAdminId = this.loginInfo && this.loginInfo.shopAdminId ? this.loginInfo.shopAdminId : 0
-        let ghsShopAdminId = ghsInfo.shopAdminId || 0
-        let shopId = ghsInfo.shopId || 0
-        let fromGhsId = ghsInfo.id || 0
-        let fromCg = 1
-        
-        let path = `/pagesPurchase/ghsProduct?hdShopAdminId=${hdShopAdminId}&ghsShopAdminId=${ghsShopAdminId}&shopId=${shopId}&id=0&fromGhsId=${fromGhsId}&fromCg=${fromCg}`
-        
-        return {
-          title: ghsInfo.name,
-          desc: "",
-          path: path,
-          imageUrl: ghsInfo.avatar || ghsInfo.smallAvatar || ''
+        let sharePayload = buildGhsInviteSharePayload(ghsInfo)
+        if (sharePayload) {
+          return sharePayload
         }
       }
       return { title: "花掌柜,花店管家婆", desc: "", imageUrl: "", path: "admin/home/workbench" }

+ 19 - 1
hdApp/src/utils/pendingGhsInvite.js

@@ -89,7 +89,7 @@ export function savePendingInviteFromOption(option) {
 			ghsShopId: option.shopId || option.sId,
 			ghsShopAdminId: option.ghsShopAdminId || option.gId || 0,
 			fromCg: option.fromCg || 0,
-			source: option.fromCg == 1 ? 'from_cg' : 'query'
+			source: option.fromCg == 1 ? 'hd_share' : 'query'
 		}
 	} else if (option.ghsShopAdminId) {
 		const scene = uni.getStorageSync('ghsCgScene')
@@ -147,6 +147,24 @@ export function getGhsProductQueryFromPending(pending) {
 	}
 }
 
+export function buildGhsInviteSharePayload(ghsInfo) {
+	if (!ghsInfo) {
+		return null
+	}
+	const shopId = ghsInfo.shopId || 0
+	if (!shopId) {
+		return null
+	}
+	const ghsShopAdminId = ghsInfo.ghsShopAdminId || ghsInfo.shopAdminId || 0
+	const path = `pagesPurchase/ghsProduct?shopId=${shopId}&id=0&ghsShopAdminId=${ghsShopAdminId}&fromCg=1`
+	return {
+		title: ghsInfo.name || '批发店采购',
+		desc: '',
+		path: path,
+		imageUrl: ghsInfo.shareLogo || ghsInfo.avatar || ghsInfo.smallAvatar || ''
+	}
+}
+
 export function tryBindPendingInvite() {
 	const token = uni.getStorageSync('token')
 	if (!token) {