shish 2 месяцев назад
Родитель
Сommit
47cee70c85
1 измененных файлов с 64 добавлено и 17 удалено
  1. 64 17
      hdApp/src/admin/home/components/purchase-ghs-panel.vue

+ 64 - 17
hdApp/src/admin/home/components/purchase-ghs-panel.vue

@@ -37,6 +37,14 @@
             </view>
           </view>
 
+          <view class="admin-contact-wrap">
+            <view class="admin-contact-inner">
+              <text class="admin-contact-name">{{ loginInfo.admin && loginInfo.admin.name ? loginInfo.admin.name : '' }}</text>
+              <text class="admin-contact-divider">|</text>
+              <text class="admin-contact-mobile">{{ loginInfo.admin && loginInfo.admin.mobile ? loginInfo.admin.mobile : '' }}</text>
+            </view>
+          </view>
+
           <view v-if="!$util.isEmpty(data.warning)" class="warning-banner">{{ data.warning }}</view>
 
           <template v-if="!$util.isEmpty(ad)">
@@ -162,8 +170,14 @@
 
           <block v-else>
 
+            <block v-if="showPendingInvite">
+              <view class="location-empty-box">
+                <view class="location-empty-title">您有新的批发店,请点击查看</view>
+                <button class="location-empty-btn" @click="goPendingInviteGhs()">查看</button>
+              </view>
+            </block>
             <!-- 如果没有请求过接口,不确定这个花店,有没批发店,暂时不显示找批发店的入口,避免引起争议 -->
-            <block v-if="hasRequestApi == 0">
+            <block v-else-if="hasRequestApi == 0">
               <view class="location-empty-box">
                 <view class="location-empty-title">暂无批发店</view>
               </view>
@@ -236,6 +250,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";
 
 export default {
   name: "PurchaseGhsPanel",
@@ -260,9 +275,17 @@ export default {
       displayGhsList: [],
       shopInfo: [],
       supplierSearchTime: 0,
-      hasRequestApi: 0
+      hasRequestApi: 0,
+      showPendingInvite: false
     };
   },
+  watch: {
+    loginInfo(newVal) {
+      if (!this.$util.isEmpty(newVal.admin) && newVal.admin.currentShopId > 0) {
+        this.refreshPendingInviteUI()
+      }
+    }
+  },
   computed: {
     ...mapGetters({ loginInfo: "getLoginInfo" }),
     workbenchTitle() {
@@ -304,6 +327,7 @@ export default {
     handlePageUnload() {},
     handlePageShow() {
       this.supplierSearchTime = uni.getStorageSync('supplier_search_time') || 0;
+      this.refreshPendingInviteUI()
       this.init();
     },
     handlePullDownRefresh() {
@@ -313,23 +337,25 @@ export default {
     },
     getShareMessage(res) {
       if (res && res.from === 'button' && res.target && res.target.dataset && res.target.dataset.ghs) {
-        const ghsInfo = res.target.dataset.ghs;
-        const hdShopAdminId = this.loginInfo && this.loginInfo.shopAdminId ? this.loginInfo.shopAdminId : 0;
-        const ghsShopAdminId = ghsInfo.shopAdminId || 0;
-        const shopId = ghsInfo.shopId || 0;
-        const fromGhsId = ghsInfo.id || 0;
-        const fromCg = 1;
-        const 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 || ''
-        };
+        const ghsInfo = res.target.dataset.ghs
+        const sharePayload = buildGhsInviteSharePayload(ghsInfo)
+        if (sharePayload) {
+          return sharePayload
+        }
       }
       return null;
     },
+    goPendingInviteGhs() {
+      const query = getGhsProductQueryFromPending()
+      if (query) {
+        this.pageTo({ url: '/pagesPurchase/ghsProduct', query: query })
+      }
+    },
+    refreshPendingInviteUI() {
+      this.showPendingInvite = refreshPendingInviteState(this.supplierList || [])
+    },
     init() {
+      this.refreshPendingInviteUI()
       // #ifdef MP-WEIXIN
       this.isMini = 1
       // #endif
@@ -339,7 +365,9 @@ export default {
         }
       })
       this.showShopName()
-      return this.getGHSList()
+      return this.getGHSList().then(() => {
+        this.refreshPendingInviteUI()
+      })
     },
     closeToShow() {
       this.$refs.toShowMore.close()
@@ -472,6 +500,7 @@ export default {
         this.supplierList = res.data.list
         this.ad = res.data.ad ? res.data.ad : []
         this.hasRequestApi = 1
+        this.refreshPendingInviteUI()
       })
     },
     toRemindCustom() {
@@ -936,10 +965,28 @@ export default {
 }
 
 .admin-contact-inner {
+  display: flex;
+  align-items: center;
+  justify-content: center;
   width: 100%;
   padding: 0;
   box-shadow: none;
-  justify-content: center;
+}
+
+.admin-contact-name {
+  color: #333;
+  font-weight: 500;
+  font-size: 28upx;
+}
+
+.admin-contact-divider {
+  margin: 0 15upx;
+  color: #ddd;
+}
+
+.admin-contact-mobile {
+  color: #666;
+  font-size: 28upx;
 }
 
 .warning-banner {