|
|
@@ -1,13 +1,19 @@
|
|
|
<template>
|
|
|
- <div class="search-box" :class="{'search-box2': !SelectItem}">
|
|
|
+ <div class="search-box"><!-- :class="{'search-box2': !SelectItem}"-->
|
|
|
<div class="input-group">
|
|
|
<template v-if="!isPcb">
|
|
|
- <select v-model="searchType" class="form-control select-type select-adder" v-if="SelectItem">
|
|
|
+ <div class="type">
|
|
|
+ <span class="type-item" :class="{active: newSearchType == 'code'}" @click="setNewSearchType('code')">型号</span>
|
|
|
+ <span class="type-item" :class="{active: newSearchType == 'kind'}" @click="setNewSearchType('kind')">物料名称</span>
|
|
|
+ <span class="type-item" :class="{active: newSearchType == 'store'}" @click="setNewSearchType('store')">卖家</span>
|
|
|
+ <span class="type-item" :class="{active: newSearchType == 'brand'}" @click="setNewSearchType('brand')">品牌</span>
|
|
|
+ </div>
|
|
|
+ <!--<select v-model="searchType" class="form-control select-type select-adder" v-if="SelectItem">
|
|
|
<option value="product">产品</option>
|
|
|
<option value="store">店铺</option>
|
|
|
- </select>
|
|
|
+ </select>-->
|
|
|
<input v-model="keyword" type="text" class="search-input form-control input-primary"
|
|
|
- :placeholder="searchType === 'product' ? '品牌/物料名称/型号' : '店铺名称'"
|
|
|
+ :placeholder="placeholderByType"
|
|
|
@focus.stop.prevent="onFocus()"
|
|
|
@blur.stop.prevent="onBlur()"
|
|
|
@keyup.40="onSelectChange(1)"
|
|
|
@@ -31,10 +37,14 @@
|
|
|
</div>
|
|
|
<ul class="association"
|
|
|
:class="{'association2': !SelectItem, 'pcb-asso': isPcb}"
|
|
|
- v-show="showAssociate && searchType == 'product'"
|
|
|
+ v-show="showAssociate"
|
|
|
@mouseenter="associate.focus=true"
|
|
|
@mouseleave="associate.focus=false">
|
|
|
- <li v-if="similarKeywords.data.brand && similarKeywords.data.brand.length > 0" class="similar-title">品牌:</li>
|
|
|
+ <li v-for="(k, index) in similarKeywords.data.all" class="item"
|
|
|
+ :class="{'active': index==associate.activeIndex}"
|
|
|
+ @click.stop.prevent="onAssociateClick(k)">{{k}}
|
|
|
+ </li>
|
|
|
+ <!-- <li v-if="similarKeywords.data.brand && similarKeywords.data.brand.length > 0" class="similar-title">品牌:</li>
|
|
|
<li v-for="(k, index) in similarKeywords.data.brand" class="item"
|
|
|
:class="{'active': index==associate.activeIndex}"
|
|
|
@click.stop.prevent="onAssociateClick(isCnStart() ? k.nameCn : k.nameEn)">{{ isCnStart() ? k.nameCn : k.nameEn }}
|
|
|
@@ -48,7 +58,7 @@
|
|
|
<li v-for="(k, index) in similarKeywords.data.component" class="item"
|
|
|
:class="{'active': index==associate.activeIndex}"
|
|
|
@click.stop.prevent="onAssociateClick(k.code)">{{ k.code }}
|
|
|
- </li>
|
|
|
+ </li>-->
|
|
|
</ul>
|
|
|
<div class="search-hot" v-if="SelectItem">
|
|
|
<ul class="list-untyled">
|
|
|
@@ -88,7 +98,9 @@
|
|
|
activeIndex: null
|
|
|
},
|
|
|
click_flag: false,
|
|
|
- searchType: 'product'
|
|
|
+ searchType: 'product',
|
|
|
+ // 新版搜索控制变量
|
|
|
+ newSearchType: 'code'
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -134,6 +146,26 @@
|
|
|
return tmp || true
|
|
|
}
|
|
|
return true
|
|
|
+ },
|
|
|
+ placeholderByType () {
|
|
|
+ let type
|
|
|
+ switch (this.newSearchType) {
|
|
|
+ case 'code':
|
|
|
+ type = '型号'
|
|
|
+ break
|
|
|
+ case 'brand':
|
|
|
+ type = '品牌'
|
|
|
+ break
|
|
|
+ case 'kind':
|
|
|
+ type = '物料名称'
|
|
|
+ break
|
|
|
+ case 'store':
|
|
|
+ type = '卖家名称'
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ type = '型号'
|
|
|
+ }
|
|
|
+ return `请输入${type}`
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -222,6 +254,9 @@
|
|
|
if (this.keyword && this.keyword.length > 0) {
|
|
|
return this.keyword.charCodeAt(0) > 255
|
|
|
}
|
|
|
+ },
|
|
|
+ setNewSearchType (type) {
|
|
|
+ this.newSearchType = type
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
|
@@ -239,7 +274,7 @@
|
|
|
height: 40px;
|
|
|
position: relative;
|
|
|
.search-input{
|
|
|
- width: 372px;
|
|
|
+ width: 441px;
|
|
|
float: left;
|
|
|
}
|
|
|
.search-input, .search-btn {
|
|
|
@@ -309,7 +344,7 @@
|
|
|
|
|
|
.association {
|
|
|
position: absolute;
|
|
|
- left: 69px;
|
|
|
+ left: 0;
|
|
|
top: 100%;
|
|
|
right: 81px;
|
|
|
background: $white;
|
|
|
@@ -345,6 +380,23 @@
|
|
|
left: 2px;
|
|
|
right: 71px
|
|
|
}
|
|
|
+
|
|
|
+ .input-group {
|
|
|
+ .type {
|
|
|
+ position: absolute;
|
|
|
+ top: -21px;
|
|
|
+ .type-item {
|
|
|
+ padding: 4px 12px;
|
|
|
+ color: #5078cb;
|
|
|
+ font-size: 14px;
|
|
|
+ cursor: pointer;
|
|
|
+ &.active, &:hover {
|
|
|
+ background: #4071c6;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.search-box2 {
|