Browse Source

确认页联想词

yangc 8 years ago
parent
commit
30eec4196d
2 changed files with 36 additions and 18 deletions
  1. 35 17
      components/applyPurchase/BatchPublish.vue
  2. 1 1
      nuxt.config.js

+ 35 - 17
components/applyPurchase/BatchPublish.vue

@@ -29,20 +29,20 @@
           </label>
         </td>
         <td>
-          <div v-if="item.code">{{item.code}}</div>
+          <div v-if="item.code && (!item.codeWord || item.codeWord.length == 0)">{{item.code}}</div>
           <span class="red-text" v-if="!item.code">请完善信息</span>
-          <!--<div class="similar-select">{{item.code}}</div>
-          <ul>
-            <li>123</li>
-            <li>123</li>
-            <li>123</li>
-            <li>123</li>
-            <li>123</li>
-          </ul>-->
+          <div class="similar-select" v-if="item.codeWord && item.codeWord.length > 0" @click="setShowCodeWord(index, $event)">{{item.code}}</div>
+          <ul v-show="item.showCodeWord">
+            <li v-for="code in item.codeWord" @click="modifyItemByWord(index, code.code, 'code')">{{code.code}}</li>
+          </ul>
         </td>
         <td>
-          <div v-if="item.brand">{{item.brand}}</div>
+          <div v-if="item.brand && (!item.brandWord || item.brandWord.length == 0)">{{item.brand}}</div>
           <span class="red-text" v-if="!item.brand">请完善信息</span>
+          <div class="similar-select" v-if="item.brandWord && item.brandWord.length > 0" @click="setShowBrandWord(index, $event)">{{item.brand}}</div>
+          <ul v-show="item.showBrandWord" class="brand-word-list">
+            <li v-for="brand in item.brandWord" @click="modifyItemByWord(index, brand.nameEn, 'brand')">{{brand.nameEn}}</li>
+          </ul>
         </td>
         <td>
           <div>{{item.amount || '-'}}</div>
@@ -221,6 +221,8 @@
         for (let i = 0; i < list.content.length; i++) {
           _this.$set(list.content[i], 'checked', false)
           _this.$set(list.content[i], 'active', false)
+          _this.$set(list.content[i], 'showCodeWord', false)
+          _this.$set(list.content[i], 'showBrandWord', false)
 //          list.content[i].checked = false
 //          list.content[i].active = false
 //          if (!list.content[i].code || list.content[i].brand || !list.content[i].deadline || !this.isValidDate(list.content[i].deadline)) {
@@ -238,6 +240,10 @@
       document.body.onclick = function () {
         _this.showSimilarCodeList = false
         _this.showSimilarBrandList = false
+        for (let i = 0; i < _this.bomList.content.length; i++) {
+          _this.bomList.content[i].showCodeWord = false
+          _this.bomList.content[i].showBrandWord = false
+        }
       }
     },
     filters: {
@@ -478,12 +484,6 @@
         this.validObj.unitPrice = (!this.modifyObj.unitPrice || this.modifyObj.unitPrice === '') ? true : this.modifyObj.unitPrice > 0 && this.modifyObj.unitPrice < 100000000
         return this.validObj.unitPrice
       },
-//      checkEncapsulation: function () {
-//        this.validObj.encapsulation = this.applyObj.encapsulation && this.applyObj.encapsulation !== ''
-//      },
-//      checkProduceDate: function () {
-//        this.validObj.produceDate = this.applyObj.produceDate && this.applyObj.produceDate !== ''
-//      },
       checkAmount: function () {
         this.validObj.amount = (!this.modifyObj.amount || this.modifyObj.amount === '') ? true : this.modifyObj.amount > 0 && this.modifyObj.amount < 100000000
         return this.validObj.amount
@@ -573,6 +573,21 @@
       setBrand: function (brand) {
         this.modifyObj.brand = brand
         this.showSimilarBrandList = false
+      },
+      setShowCodeWord: function (index, event) {
+        event.stopPropagation()
+        this.bomList.content[index].showCodeWord = !this.bomList.content[index].showCodeWord
+      },
+      setShowBrandWord: function (index, event) {
+        event.stopPropagation()
+        this.bomList.content[index].showBrandWord = !this.bomList.content[index].showBrandWord
+      },
+      modifyItemByWord: function (index, param, type) {
+        if (type === 'code') {
+          this.bomList.content[index].code = param
+        } else if (type === 'code') {
+          this.bomList.content[index].brand = param
+        }
       }
     }
   }
@@ -677,8 +692,11 @@
                 border-radius: 3px;
                 & + ul {
                   width: 110px;
-                  top: 50px;
+                  top: 52px;
                   left: 26px;
+                  &.brand-word-list {
+                    left: 12px;
+                  }
                 }
               }
             }

+ 1 - 1
nuxt.config.js

@@ -1,6 +1,6 @@
 const path = require('path')
 const isProdMode = Object.is(process.env.NODE_ENV, 'production')
-const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://10.10.100.107:8081/platform-b2c/' : 'http://10.1.51.88:8080/platform-b2c/')
+const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://10.10.100.107:8081/platform-b2c/' : 'http://10.1.51.90:8080/platform-b2c/')
 
 module.exports = {
   router: {