Просмотр исходного кода

新增对是否存在有效物料进行判断后跳转

Administrator 7 лет назад
Родитель
Сommit
7140dc91f4
1 измененных файлов с 19 добавлено и 14 удалено
  1. 19 14
      components/supplier/merchant.vue

+ 19 - 14
components/supplier/merchant.vue

@@ -26,10 +26,10 @@
         </div>
       </div>
       <ul class="list-inline">
-        <li v-for="item in list.content" @click="jumpResource(item.enUU, item.hasProduct)">
+        <li v-for="item in list.content" @click="jumpResource(item.enUU)">
           <div class="has_shop" v-if="item.isStore === 1">已开店</div>
           <div class="enterprise_name" v-text="item.enName">深圳英优软科技有限公司</div>
-          <div class="select_btn" v-html="isInFrame ? '添加为<br/>供应商' : '查看<br/>更多'" @mouseleave="hasJump = false" @mouseenter="hasJump = true" @click="addResource(item.enUU, item.hasProduct)"></div>
+          <div class="select_btn" v-html="isInFrame ? '添加为<br/>供应商' : '查看<br/>更多'" @mouseleave="hasJump = false" @mouseenter="hasJump = true" @click="addResource(item.enUU)"></div>
           <div class="popups">
             <p>企业执照号:</p><p v-text="item.enBusinesscode ? item.enBusinesscode : '暂无信息'">1</p>
             <p>地址:</p><p v-text="item.enAddress ? item.enAddress : '暂无信息'">1</p>
@@ -88,7 +88,7 @@
       }
     },
     methods: {
-      addResource (id, type) {
+      addResource (id) {
         if (this.isInFrame) {
           this.$http.get(`/basic/enterprise /${id}/info`)
             .then(res => {
@@ -100,22 +100,27 @@
               console.log(err)
             })
         } else {
-          if (type === 1) {
-            this.$router.push('supplier/' + id)
-          } else {
-            this.hasDialog = true
-          }
+          this.isVaildSupplier(id)
         }
       },
-      jumpResource (id, type) {
+      jumpResource (id) {
         if (!this.hasJump) {
-          if (type === 1) {
-            this.$router.push('supplier/' + id)
-          } else {
-            this.hasDialog = true
-          }
+          this.isVaildSupplier(id)
         }
       },
+      // 判断是否有有效物料信息
+      isVaildSupplier (id) {
+        this.$http.get('vendor/introduction/product/count', {params: {vendUU: id}})
+          .then(res => {
+            if (res.data.count !== 0) {
+              this.$router.push('supplier/' + id)
+            } else {
+              this.hasDialog = true
+            }
+          }, err => {
+            console.log(err)
+          })
+      },
       goodsSearch (type) {
         this.pageParams.page = 1
         this.$store.dispatch('supplier/loadVendorList', {page: this.pageParams.page, size: this.pageParams.count, keyword: type})