Browse Source

修改测试BUG

shenjj 7 years ago
parent
commit
1429fa53ed

+ 2 - 0
components/main/Search.vue

@@ -281,6 +281,8 @@
               this.$router.push({path: '/searchStore?w=' + encodeURIComponent(this.keyword)})
             }
           }
+        } else {
+          this.$message.info('请输入关键字')
         }
       },
       onAssociateClick (word) {

+ 10 - 7
pages/mobile/center/user/applyPurchase.vue

@@ -12,7 +12,7 @@
           <i class="iconfont icon-sousuo"></i>
         </span>
         <ul class="similar brand-similar-list" v-show="showSimilarBrandList && keyword">
-          <li v-for="sBrand in similarBrand" @click.stop="setBrand(sBrand.nameEn)">{{sBrand.nameEn}}</li>
+          <li v-for="sBrand in similarBrand" @click.stop="setBrand(sBrand.code)">{{sBrand.code}}</li>
         </ul>
       </div>
       <publish-seek v-if="showPublishBox" :dataObj="componentSeekObj" @remindAction="onRemind" :isNumberReg="true"></publish-seek>
@@ -100,7 +100,9 @@
     methods: {
       checkBrand: function () {
         if (!this.keyword) {
-          this.setRemindText('品牌不能为空')
+          // this.setRemindText('品牌不能为空')
+          this.remindText = '型号不能为空'
+          this.timeoutCount++
         }
         return this.keyword
       },
@@ -125,7 +127,7 @@
       },
       getSimilarBrand: function () {
         if (this.keyword) {
-          this.$http.get('/search/similarBrands', {params: {keyword: this.keyword}})
+          this.$http.get('/search/similarComponents', {params: {keyword: this.keyword}})
             .then(response => {
               this.similarBrand = response.data
               this.showSimilarBrandList = response.data.length > 0
@@ -140,11 +142,12 @@
         this.searchComplist()
       },
       searchComplist () {
-        this.showPublishBox = false
-        this.page = 1
-        this.isChange = true
-        if (this.keyword) {
+        if (this.keyword !== '') {
+          this.showSimilarBrandList = false
           this.reloadList()
+          this.showPublishBox = false
+          this.page = 1
+          this.isChange = true
         }
       },
       onRemind: function (str) {

+ 50 - 40
pages/mobile/center/vendor/product.vue

@@ -295,15 +295,15 @@
         <div class="update-materiel-wrapper-list clearfix" :class="{'overHidden': MaterielItem.standard === 1}">
           <div class="name pull-left"><a class="red">*</a>品牌:</div>
           <template v-if="MaterielItem.standard === 1">
-            {{MaterielItem.brand}}
+            {{MaterielItem.pbranden}}
           </template>
           <template v-else>
             <div class="input pull-left clearfix" :class="{'overHidden': MaterielItem.standard === 1}">
-              <input type="text" v-model="MaterielItem.brand" placeholder="请勿填中文符号" @blur.stop="checkBrand" @input.stop="onBrandChange"/>
-              <ul class="similar brand-similar-list" v-show="showSimilarBrandList && MaterielItem.brand">
+              <input type="text" v-model="MaterielItem.pbranden" placeholder="请勿填中文符号" @blur.stop="checkBrand" @input.stop="onBrandChange"/>
+              <ul class="similar brand-similar-list" v-show="showSimilarBrandList && MaterielItem.pbranden">
                 <li v-for="sBrand in similarBrand" @click.stop="setBrand(sBrand.nameEn)">{{sBrand.nameEn}}</li>
               </ul>
-              <i class="iconfont icon-guanbi1" @click.stop="MaterielItem.brand = ''"></i>
+              <i class="iconfont icon-guanbi1" @click.stop="MaterielItem.pbranden = ''"></i>
             </div>
           </template>
         </div>
@@ -323,23 +323,23 @@
         <div class="update-materiel-wrapper-list clearfix">
           <div class="name pull-left"><a class="red">*</a>型号:</div>
           <template v-if="MaterielItem.standard === 1">
-            {{MaterielItem.cmpCode}}
+            {{MaterielItem.pcmpcode}}
           </template>
           <template v-else>
             <div class="input pull-left clearfix">
-              <input type="text" v-model="MaterielItem.cmpCode" @blur.stop="checkCode" @input.stop="onCodeChange" placeholder="请勿填中文符号">
-              <ul class="similar" v-show="showSimilarCodeList && MaterielItem.cmpCode">
+              <input type="text" v-model="MaterielItem.pcmpcode" @blur.stop="checkCode" @input.stop="onCodeChange" placeholder="请勿填中文符号">
+              <ul class="similar" v-show="showSimilarCodeList && MaterielItem.pcmpcode">
                 <li v-for="sCode in similarCode" @click.stop="setCode(sCode.code)">{{sCode.code}}</li>
               </ul>
-              <!--<input type="text" placeholder="请输入型号" v-model="MaterielItem.cmpCode"/>-->
-              <i class="iconfont icon-guanbi1" @click.stop="MaterielItem.cmpCode = ''"></i>
+              <!--<input type="text" placeholder="请输入型号" v-model="MaterielItem.pcmpcode"/>-->
+              <i class="iconfont icon-guanbi1" @click.stop="MaterielItem.pcmpcode = ''"></i>
             </div>
           </template>
         </div>
         <div class="update-materiel-wrapper-list clearfix">
           <div class="name pull-left"><a class="red" style="opacity: 0">*</a>规格:</div>
           <div class="input pull-left clearfix">
-            <input type="text" placeholder="请输入规格" v-model="MaterielItem.spec" @blur="checkSpec" @input="onSpecInput"/>
+            <input type="text" placeholder="请输入规格" v-model="MaterielItem.spec" @blur="checkSpec" @input="onSpecInput" maxlength="50"/>
             <i class="iconfont icon-guanbi1" @click.stop="MaterielItem.spec = ''"></i>
           </div>
         </div>
@@ -587,6 +587,7 @@
       },
       // 编辑物料
       updateMateriel(item) {
+        console.log(item)
         this.MaterielItem = item
         this.$item = this.baseUtils.deepCopy(item)
         this.cmpImg = item.cmpImg || ''
@@ -615,56 +616,56 @@
       },
       checkBrand: function () {
         // this.MaterielItem.brand = this.MaterielItem.brand && this.MaterielItem.brand !== ''
-        if (!this.MaterielItem.brand || this.MaterielItem.brand === '') {
+        if (!this.MaterielItem.pbranden || this.MaterielItem.pbranden === '') {
           this.setRemindText('品牌不能为空')
         }
-        return this.MaterielItem.brand
+        return this.MaterielItem.pbranden
       },
       checkCode: function () {
-        if (!this.MaterielItem.cmpCode || this.MaterielItem.cmpCode === '') {
+        if (!this.MaterielItem.pcmpcode || this.MaterielItem.pcmpcode === '') {
           this.setRemindText('型号不能为空')
         }
-        return this.MaterielItem.cmpCode
+        return this.MaterielItem.pcmpcode
       },
       onCodeChange: function () {
-        this.MaterielItem.cmpCode = this.MaterielItem.cmpCode.trim()
-        if ((/[^\x00-\xff]/g).test(this.MaterielItem.cmpCode)) {
+        this.MaterielItem.pcmpcode = this.MaterielItem.pcmpcode.trim()
+        if ((/[^\x00-\xff]/g).test(this.MaterielItem.pcmpcode)) {
           let chineseIndex = -1
-          for (let i = 0; i < this.MaterielItem.cmpCode.length; i++) {
-            if ((/[^\x00-\xff]/g).test(this.MaterielItem.cmpCode.charAt(i))) {
+          for (let i = 0; i < this.MaterielItem.pcmpcode.length; i++) {
+            if ((/[^\x00-\xff]/g).test(this.MaterielItem.pcmpcode.charAt(i))) {
               chineseIndex = i
               break
             }
           }
-          this.MaterielItem.cmpCode = this.baseUtils.cutOutString(this.MaterielItem.cmpCode, chineseIndex)
-        } else if (this.MaterielItem.cmpCode && this.baseUtils.getRealLen(this.MaterielItem.cmpCode) > 100) {
-          this.MaterielItem.cmpCode = this.baseUtils.cutOutString(this.MaterielItem.cmpCode, 100)
+          this.MaterielItem.pcmpcode = this.baseUtils.cutOutString(this.MaterielItem.pcmpcode, chineseIndex)
+        } else if (this.MaterielItem.pcmpcode && this.baseUtils.getRealLen(this.MaterielItem.pcmpcode) > 100) {
+          this.MaterielItem.pcmpcode = this.baseUtils.cutOutString(this.MaterielItem.pcmpcode, 100)
         } else {
           this.getSimilarCode()
         }
       },
       onBrandChange: function () {
-        this.MaterielItem.brand = this.MaterielItem.brand.trim()
-        if ((/[^\x00-\xff]/g).test(this.MaterielItem.brand)) {
+        this.MaterielItem.pbranden = this.MaterielItem.pbranden.trim()
+        if ((/[^\x00-\xff]/g).test(this.MaterielItem.pbranden)) {
           let chineseIndex = -1
-          for (let i = 0; i < this.MaterielItem.brand.length; i++) {
-            if ((/[^\x00-\xff]/g).test(this.MaterielItem.brand.charAt(i)) && !(/[\u4e00-\u9fa5]/).test(this.MaterielItem.brand.charAt(i))) {
+          for (let i = 0; i < this.MaterielItem.pbranden.length; i++) {
+            if ((/[^\x00-\xff]/g).test(this.MaterielItem.pbranden.charAt(i)) && !(/[\u4e00-\u9fa5]/).test(this.MaterielItem.pbranden.charAt(i))) {
               chineseIndex = i
               break
             }
           }
           if (chineseIndex > -1) {
-            this.MaterielItem.brand = this.MaterielItem.brand.substring(0, chineseIndex)
+            this.MaterielItem.pbranden = this.MaterielItem.pbranden.substring(0, chineseIndex)
           }
-        } else if (this.MaterielItem.brand && this.baseUtils.getRealLen(this.MaterielItem.brand) > 50) {
-          this.MaterielItem.brand = this.baseUtils.cutOutString(this.MaterielItem.brand, 50)
+        } else if (this.MaterielItem.pbranden && this.baseUtils.getRealLen(this.MaterielItem.pbranden) > 50) {
+          this.MaterielItem.pbranden = this.baseUtils.cutOutString(this.MaterielItem.pbranden, 50)
         } else {
           this.getSimilarBrand()
         }
       },
       getSimilarBrand: function () {
-        if (this.MaterielItem.brand) {
-          this.$http.get('/search/similarBrands', {params: {keyword: this.MaterielItem.brand}})
+        if (this.MaterielItem.pbranden) {
+          this.$http.get('/search/similarBrands', {params: {keyword: this.MaterielItem.pbranden}})
             .then(response => {
               this.similarBrand = response.data
               this.showSimilarBrandList = response.data.length > 0
@@ -674,8 +675,8 @@
         }
       },
       getSimilarCode: function () {
-        if (this.MaterielItem.cmpCode) {
-          this.$http.get('/search/similarComponents', {params: {keyword: this.MaterielItem.cmpCode}})
+        if (this.MaterielItem.pcmpcode) {
+          this.$http.get('/search/similarComponents', {params: {keyword: this.MaterielItem.pcmpcode}})
             .then(response => {
               this.similarCode = response.data
               this.showSimilarCodeList = response.data.length > 0
@@ -685,11 +686,11 @@
         }
       },
       setCode: function (code) {
-        this.MaterielItem.cmpCode = code
+        this.MaterielItem.pcmpcode = code
         this.showSimilarCodeList = false
       },
       setBrand: function (brand) {
-        this.MaterielItem.brand = brand
+        this.MaterielItem.pbranden = brand
         this.showSimilarBrandList = false
       },
       setRemindText: function (str) {
@@ -719,24 +720,33 @@
           this.showMateriel = false
           return
         }
-        if (this.MaterielItem.brand === '') {
+        if (this.MaterielItem.pbranden === '') {
           this.setRemindText('品牌不能为空')
           return
         } else if (this.MaterielItem.kind === '') {
           this.setRemindText('类目不能为空')
           return
-        } else if (this.MaterielItem.cmpCode === '') {
+        } else if (this.MaterielItem.pcmpcode === '') {
           this.setRemindText('型号不能为空')
           return
         }
-        this.MaterielItem.pcmpcode = this.MaterielItem.cmpCode
-        this.MaterielItem.pbranden = this.MaterielItem.brand
-        this.MaterielItem.pbranden = this.MaterielItem.brand
-        this.$http.post('/trade/products/update/product', this.MaterielItem).then(res => {
+        this.MaterielItem.pcmpcode = this.MaterielItem.pcmpcode
+        this.MaterielItem.pbranden = this.MaterielItem.pbranden
+        let item = {
+          id: this.MaterielItem.id,
+          kind : this.MaterielItem.kind,
+          pbranden: this.MaterielItem.pbranden,
+          pcmpcode: this.MaterielItem.pcmpcode,
+          spec: this.MaterielItem.spec,
+          url: ''
+        }
+        this.$http.post('/trade/products/update/product?attachUrl=', item).then(res => {
           if (res.data.success) {
             this.setRemindText('修改成功')
             this.showMateriel = false
             this.page = 1
+            this.GetEnterpriseListData = null
+            this.GetEnterpriseListData = []
             this.getResourceProvidor()
           } else {
             this.setRemindText(res.data.message)

+ 14 - 6
pages/mobile/search/newkeycode.vue

@@ -27,14 +27,14 @@
    </ul>
    <!-- 主体内容 -->
    <div class="main-search-wrapper">
-     <div class="search-title">搜索“<span>{{displayKeyword}}</span>”为您找到{{allTotal}}条信息</div>
-     <template v-if="allTotal > 0">
+     <div class="search-title">搜索“<span>{{displayKeyword}}</span>”为您找到{{allTotal}}条信息</div>
+     <template>
        <!-- 品牌精确查找 -->
        <template v-if="ChooseTop === 'brand' && brandIsAccurate">
-         <div class="search-content" style="margin-bottom: 0.2rem;height: auto">
+         <div class="search-content" style="margin-bottom: 0.2rem;height: auto;position: static">
            <div class="middle">
              <div class="list clearfix" style="border-bottom: 1px solid #dcdcdc;padding-bottom: 0.1rem;line-height: 0.8rem;">
-               <img :src="'' || '/images/component/default.png'" class="pull-left">
+               <img :src="resourceList.brand && resourceList.brand.logoUrl || '/images/component/default.png'" class="pull-left">
                <div class="name pull-left overHidden" style="max-width: 5rem;">{{resourceList.brand && resourceList.brand.nameEn}}</div>
              </div>
              <div class="list">
@@ -160,7 +160,12 @@
                        <div class="fl" @click.stop="goAttach(item.attach)">
                          <div class="name">规格书:</div>
                          <div class="text">
-                           <a :href="item.attach" target="_blank"><i class="iconfont icon-pdf" :class="{'active': item.attach && item.attach !== '' && item.attach !== '1'}"></i></a>
+                           <a :href="item.attach" target="_blank" v-if="item.attach && item.attach !== '' && item.attach !== '1'">
+                             <i class="iconfont icon-pdf" :class="{'active': item.attach && item.attach !== '' && item.attach !== '1'}"></i>
+                           </a>
+                           <template v-else>
+                             <i class="iconfont icon-pdf" :class="{'active': item.attach && item.attach !== '' && item.attach !== '1'}"></i>
+                           </template>
                          </div>
                        </div>
                        <div class="fl">
@@ -308,7 +313,7 @@
          </template>
        </div>
      </template>
-     <template v-if="allTotal === 0">
+     <template v-if="allPage === 0">
        <div class="none-state">
          <img src="/images/mobile/@2x/search-empty.png">
          <p>暂无数据</p>
@@ -505,6 +510,7 @@
       },
       // 搜索点击事件
       onClickSearchHander() {
+        console.log(this.keyword)
         if (!this.keyword) return
         this.$router.push(`/mobile/search/newkeycode?choosetype=${this.ChooseTop}&keyword=${this.keyword}`)
         // this.setChangelistHander(this.ChooseTop)
@@ -805,6 +811,8 @@
       background: #fff;
       @include lineHeight(1rem);
       padding: 0 0.2rem;
+      position: relative;
+      z-index: 10;
       span {
         width: 50%;
         color: #666;

+ 2 - 2
pages/search/_keyword.vue

@@ -10,8 +10,8 @@
     ></kind>-->
   <brand-detail :supBrandObj="goods.brand" v-if="searchType == 'brand' && goods.brand"></brand-detail>
   <div class="search-result-type" v-if="!goods.content">
-    <span class="inline-block" :class="{active: resultType == 'current'}" @click="setResultType('current')">现货({{stockTotal}}条)</span>
-    <span class="inline-block" :class="{active: resultType == 'forward'}" @click="setResultType('forward')">期货({{futureTotal}}条)</span>
+    <span class="inline-block" :class="{active: resultType == 'current'}" @click="setResultType('current')">{{searchType === 'component' ? '现货' : '现货卖家'}}({{stockTotal}}条)</span>
+    <span class="inline-block" :class="{active: resultType == 'forward'}" @click="setResultType('forward')">{{searchType === 'component' ? '期货' : '期货卖家'}}({{futureTotal}}条)</span>
   </div>
   <template v-if="searchType == 'component'">
     <good-list v-if="resultType === 'current'"