Browse Source

feat:发货工单判断

snow 1 year ago
parent
commit
e6e8fdd64f
1 changed files with 26 additions and 18 deletions
  1. 26 18
      src/views/purchaseIn/deliveryWorkOrder/detail.vue

+ 26 - 18
src/views/purchaseIn/deliveryWorkOrder/detail.vue

@@ -100,8 +100,9 @@
             </el-collapse-item>
 
             <el-collapse-item title="待库管发货" name="2"  v-if="sitem.status === '1' && !isSupertube && ppowers.includes('1')">
-              <express-node v-if="canSend" @refresh="() => initData()" :sitem="sitem" />
-              <el-alert v-else type="warning" :title="'当前节点只能由仓库管理员 ' + sitem.contactor_name + ' 操作'" :closable="false" show-icon />
+              <express-node v-if="!isSupplierClientError && !isManagerIdError" @refresh="() => initData()" :sitem="sitem" />
+              <el-alert v-else-if="isSupplierClientError" type="warning" title="由供应端账号发货" :closable="false" show-icon />
+              <el-alert v-else-if="isManagerIdError" type="warning" :title="'由仓库管理员 ' + sitem.contactor_name + ' 发货'" :closable="false" show-icon />
             </el-collapse-item>
           </el-collapse>
         </el-tab-pane>
@@ -145,6 +146,8 @@ export default {
         // { value: "4", label: "已全部收货" },
         { value: "5", label: "已取消"}
       ],
+      isSupplierClientError: false,
+      isManagerIdError: false,
       xs_order_type_options,
       sitem: null, //传给组件
       activeNames: ["0", "1", "2", "3", "4", "5", "6"],
@@ -169,26 +172,13 @@ export default {
       queryId: "",
     };
   },
-  mounted() {
+  async mounted() {
     this.queryId = this.$route.query.id;
-    this.initData();
+    await this.initData();
+    this.getSendPermission();
   },
   computed:{
     ...mapGetters(["isSupertube"]),
-    canSend(){
-      const { id:userId } = this.userInfo || {};
-      const { contactor:manangerUserId ,order_type ,has_account } = this.sitem || {};
-      const isStock = String(order_type) === '1'
-
-      /* 不是库存品&&没有供应商端账号 **/
-      if(!isStock && String(has_account) !== '1'){
-        return true
-      }
-
-      /* 库存品&&用户id和库管id一致 **/
-      if(!userId || !manangerUserId) return false
-      return userId === manangerUserId
-    },
     ...mapGetters(['isSupertube','userInfo']),
     powers() {
       const { btnList } = this.$store.getters;
@@ -204,6 +194,24 @@ export default {
     }
   },
   methods: {
+    getSendPermission(){
+      const { id:userId } = this.userInfo || {};
+      const { contactor:manangerUserId ,order_type ,has_account } = this.sitem || {};
+        
+      // 工单供应商是否开通供应商端账号
+      const isHasSupplierAccount = has_account === '1'
+
+      const isStock = String(order_type) === '1'
+  
+      if(!isStock){
+        // 非库存品&没有开通供应端账号
+        this.isSupplierClientError = !isHasSupplierAccount
+        return
+      }
+
+      // 库存品&用户id和库管id一致
+      this.isManagerIdError = String(userId) !== String(manangerUserId);
+    },
     async initData() {
       const { code, data, message } = await asyncRequest.detail({
         outChildCode: this.queryId,