|
|
@@ -3,21 +3,17 @@
|
|
|
<a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
|
|
|
<input type="text" v-model="keyword" @input="onKeywordInput()" :placeholder="placeholder" @keyup.13="onSearch()">
|
|
|
<span @click="onSearch()"><i class="iconfont icon-sousuo"></i></span>
|
|
|
- <ul v-if="emptyStatus && type == 'supplier' && keyword && keyword !== '' && showSimilarWord">
|
|
|
- <template v-if="similarList.pBrandEn && similarList.pBrandEn.length">
|
|
|
- <li class="title text-ellipse">品牌</li>
|
|
|
- <li class="text-ellipse" v-for="brand in similarList.pBrandEn.slice(0, 4)" @click="onSearch(brand.nameEn, 'pBrandEn', $event)">{{brand.nameEn}}</li>
|
|
|
+ <ul v-if="emptyStatus && keyword && keyword !== '' && showSimilarWord">
|
|
|
+ <template v-if="similarList.store && similarList.store.length && (similarType == 'all' || similarType == 'store')">
|
|
|
+ <template v-if="type === 'supplier' || type === 'default'">
|
|
|
+ <li class="title text-ellipse" v-if="similarType == 'all'" v-text="type === 'supplier' ? '公司名' : type === 'default' ? '店铺名' : ''">公司名</li>
|
|
|
+ <li class="text-ellipse" v-for="store in similarList.store.slice(0, 8)" @click="onSearch(store.name, 'store', $event)">{{store.name}}</li>
|
|
|
+ </template>
|
|
|
+ <template v-if="type=== 'purchase' && user.logged">
|
|
|
+ <li class="title text-ellipse" v-if="similarType == 'all'">公司</li>
|
|
|
+ <li class="text-ellipse" v-for="store in similarList.store.slice(0, 8)" @click="onSearch(store.name, 'store', $event)">{{store.name}}</li>
|
|
|
+ </template>
|
|
|
</template>
|
|
|
- <template v-if="similarList.kind && similarList.kind.length">
|
|
|
- <li class="title text-ellipse">物料名称</li>
|
|
|
- <li class="text-ellipse" v-for="kind in similarList.kind.slice(0, 4)" @click="onSearch(kind.kind, 'kind', $event)">{{kind.kind}}</li>
|
|
|
- </template>
|
|
|
- <template v-if="similarList.pCmpCode && similarList.pCmpCode.length">
|
|
|
- <li class="title text-ellipse">型号</li>
|
|
|
- <li class="text-ellipse" v-for="code in similarList.pCmpCode.slice(0, 4)" @click="onSearch(code.pCmpCode, 'pCmpCode', $event)">{{code.pCmpCode}}</li>
|
|
|
- </template>
|
|
|
- </ul>
|
|
|
- <ul v-if="emptyStatus && type == 'default' && keyword && keyword !== '' && showSimilarWord">
|
|
|
<template v-if="similarList.brand && similarList.brand.length && (similarType == 'all' || similarType == 'brand')">
|
|
|
<li class="title text-ellipse" v-if="similarType == 'all'">品牌</li>
|
|
|
<li class="text-ellipse" v-for="brand in similarList.brand.slice(0, 8)" @click="onSearch(brand.nameEn, 'brand', $event)">{{brand.nameEn}}</li>
|
|
|
@@ -97,15 +93,10 @@
|
|
|
computed: {
|
|
|
emptyStatus () {
|
|
|
let similarList = this.similarList
|
|
|
- if (this.type === 'supplier') {
|
|
|
- return (similarList.pCmpCode && similarList.pCmpCode.length) ||
|
|
|
- (similarList.pBrandEn && similarList.pBrandEn.length) ||
|
|
|
- (similarList.kind && similarList.kind.length)
|
|
|
- } else if (this.type === 'default') {
|
|
|
- return (similarList.component && similarList.component.length) ||
|
|
|
- (similarList.brand && similarList.brand.length) ||
|
|
|
- (similarList.kind && similarList.kind.length)
|
|
|
- }
|
|
|
+ return (similarList.store && similarList.store.length) ||
|
|
|
+ (similarList.component && similarList.component.length) ||
|
|
|
+ (similarList.brand && similarList.brand.length) ||
|
|
|
+ (similarList.kind && similarList.kind.length)
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -124,17 +115,22 @@
|
|
|
})
|
|
|
} else {
|
|
|
let sType = null
|
|
|
- if (this.type === 'default' && this.keyword && this.keyword !== '' && this.similarList.brand) { // 防止接口报错无法搜索
|
|
|
- if (this.similarList.brand[0] && this.keyword === this.similarList.brand[0].nameEn) {
|
|
|
+ if (this.keyword && this.keyword !== '' && this.similarList.brand) { // 防止接口报错无法搜索
|
|
|
+ if (this.similarList.store[0] && this.keyword === this.similarList.store[0].name) {
|
|
|
+ sType = 'store'
|
|
|
+ } else if (this.similarList.brand[0] && this.keyword === this.similarList.brand[0].nameEn) {
|
|
|
sType = 'brand'
|
|
|
} else if (this.similarList.kind[0] && this.keyword === this.similarList.kind[0].nameCn) {
|
|
|
sType = 'kind'
|
|
|
} else if (this.similarList.component[0] && this.keyword === this.similarList.component[0].code) {
|
|
|
sType = 'code'
|
|
|
} else {
|
|
|
- let arr = [...this.similarList.brand, ...this.similarList.kind, ...this.similarList.component]
|
|
|
+ let arr = [...this.similarList.store, ...this.similarList.brand, ...this.similarList.kind, ...this.similarList.component]
|
|
|
if (arr[0]) {
|
|
|
- if (arr[0].nameEn) {
|
|
|
+ if (arr[0].name) {
|
|
|
+ this.keyword = arr[0].name
|
|
|
+ sType = 'store'
|
|
|
+ } else if (arr[0].nameEn) {
|
|
|
this.keyword = arr[0].nameEn
|
|
|
sType = 'brand'
|
|
|
} else if (arr[0].nameCn) {
|
|
|
@@ -146,28 +142,6 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- } else if (this.type === 'supplier' && this.keyword && this.keyword !== '' && this.similarList.pBrandEn) { // 防止接口报错无法搜索
|
|
|
- if (this.similarList.pBrandEn[0] && this.keyword === this.similarList.pBrandEn[0].nameEn) {
|
|
|
- sType = 'pBrandEn'
|
|
|
- } else if (this.similarList.kind[0] && this.keyword === this.similarList.kind[0].kind) {
|
|
|
- sType = 'kind'
|
|
|
- } else if (this.similarList.pCmpCode[0] && this.keyword === this.similarList.pCmpCode[0].pCmpCode) {
|
|
|
- sType = 'pCmpCode'
|
|
|
- } else {
|
|
|
- let arr = [...this.similarList.pBrandEn, ...this.similarList.kind, ...this.similarList.pCmpCode]
|
|
|
- if (arr[0]) {
|
|
|
- if (arr[0].nameEn) {
|
|
|
- this.keyword = arr[0].nameEn
|
|
|
- sType = 'pBrandEn'
|
|
|
- } else if (arr[0].kind) {
|
|
|
- this.keyword = arr[0].kind
|
|
|
- sType = 'kind'
|
|
|
- } else if (arr[0].pCmpCode) {
|
|
|
- this.keyword = arr[0].pCmpCode
|
|
|
- sType = 'pCmpCode'
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
this.$emit('searchAction', {
|
|
|
keyword: this.keyword,
|