|
|
@@ -1,15 +1,23 @@
|
|
|
<template>
|
|
|
<div class="mobile-modal" v-if="showSayPriceBox" @click="setShowCurrencyList(false)">
|
|
|
<div class="mobile-modal-box">
|
|
|
- <div class="mobile-modal-header">发布求购<i class="icon-guanbi iconfont" @click="cancel"></i></div>
|
|
|
+ <div class="mobile-modal-header">
|
|
|
+ <i class="icon-guanbi iconfont" @click="cancel"></i>
|
|
|
+ </div>
|
|
|
<div class="publish-seek">
|
|
|
<div class="content-line">
|
|
|
<span><i>*</i>型号:</span>
|
|
|
<input type="text" v-model="applyObj.code" @blur="checkCode" @input="onCodeChange" placeholder="请勿填中文符号">
|
|
|
+ <ul class="similar" v-show="showSimilarCodeList && applyObj.code">
|
|
|
+ <li v-for="sCode in similarCode" @click="setCode(sCode.code)">{{sCode.code}}</li>
|
|
|
+ </ul>
|
|
|
</div>
|
|
|
<div class="content-line">
|
|
|
<span><i>*</i>品牌:</span>
|
|
|
<input type="text" v-model="applyObj.brand" @blur="checkBrand" @input="onBrandChange" placeholder="请勿填中文符号">
|
|
|
+ <ul class="similar brand-similar-list" v-show="showSimilarBrandList && applyObj.brand">
|
|
|
+ <li v-for="sBrand in similarBrand" @click="setBrand(sBrand.nameEn)">{{sBrand.nameEn}}</li>
|
|
|
+ </ul>
|
|
|
</div>
|
|
|
<div class="content-line">
|
|
|
<span><i>*</i>截止日期:</span>
|
|
|
@@ -34,7 +42,7 @@
|
|
|
</ul>
|
|
|
</div>-->
|
|
|
<div class="content-line">
|
|
|
- <span>数量:</span>
|
|
|
+ <span>数量(PCS):</span>
|
|
|
<input type="text" v-model="applyObj.amount" @blur="checkAmount" @input="onAmountInput">
|
|
|
</div>
|
|
|
<!--<div class="content-line">
|
|
|
@@ -69,7 +77,11 @@
|
|
|
amount: true,
|
|
|
deadline: true
|
|
|
},
|
|
|
- showCurrencyList: false
|
|
|
+ showCurrencyList: false,
|
|
|
+ showSimilarCodeList: false,
|
|
|
+ showSimilarBrandList: false,
|
|
|
+ similarCode: [],
|
|
|
+ similarBrand: []
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -88,6 +100,7 @@
|
|
|
watch: {
|
|
|
showSayPriceBox: function (val, old) {
|
|
|
if (val) {
|
|
|
+ this.emptyForm()
|
|
|
document.body.style.position = 'fixed'
|
|
|
document.body.style.left = '0'
|
|
|
document.body.style.right = '0'
|
|
|
@@ -96,6 +109,13 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ mounted () {
|
|
|
+ let _this = this
|
|
|
+ document.body.onclick = function () {
|
|
|
+ _this.showSimilarCodeList = false
|
|
|
+ _this.showSimilarBrandList = false
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
cancel: function () {
|
|
|
this.$emit('cancelAction')
|
|
|
@@ -228,6 +248,28 @@
|
|
|
this.applyObj.produceDate = cutOutString(this.applyObj.produceDate, 12)
|
|
|
}
|
|
|
},
|
|
|
+ getSimilarCode: function () {
|
|
|
+ if (this.applyObj.code) {
|
|
|
+ this.$http.get('/search/similarComponents', {params: {keyword: this.applyObj.code}})
|
|
|
+ .then(response => {
|
|
|
+ this.similarCode = response.data
|
|
|
+ this.showSimilarCodeList = response.data.length > 0
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.showSimilarCodeList = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getSimilarBrand: function () {
|
|
|
+ if (this.applyObj.brand) {
|
|
|
+ this.$http.get('/search/similarBrands', {params: {keyword: this.applyObj.brand}})
|
|
|
+ .then(response => {
|
|
|
+ this.similarBrand = response.data
|
|
|
+ this.showSimilarBrandList = response.data.length > 0
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.showSimilarBrandList = false
|
|
|
+ }
|
|
|
+ },
|
|
|
onCodeChange: function () {
|
|
|
this.applyObj.code = this.applyObj.code.trim()
|
|
|
if ((/[^\x00-\xff]/g).test(this.applyObj.code)) {
|
|
|
@@ -241,6 +283,8 @@
|
|
|
this.applyObj.code = cutOutString(this.applyObj.code, chineseIndex)
|
|
|
} else if (this.applyObj.code && getRealLen(this.applyObj.code) > 100) {
|
|
|
this.applyObj.code = cutOutString(this.applyObj.code, 100)
|
|
|
+ } else {
|
|
|
+ this.getSimilarCode()
|
|
|
}
|
|
|
},
|
|
|
onBrandChange: function () {
|
|
|
@@ -258,6 +302,8 @@
|
|
|
}
|
|
|
} else if (this.applyObj.brand && getRealLen(this.applyObj.brand) > 50) {
|
|
|
this.applyObj.brand = cutOutString(this.applyObj.brand, 50)
|
|
|
+ } else {
|
|
|
+ this.getSimilarBrand()
|
|
|
}
|
|
|
},
|
|
|
onAmountInput: function () {
|
|
|
@@ -273,6 +319,14 @@
|
|
|
} else if (this.applyObj.amount.length > 9) {
|
|
|
this.applyObj.amount = cutOutString(this.applyObj.amount, 9)
|
|
|
}
|
|
|
+ },
|
|
|
+ setCode: function (code) {
|
|
|
+ this.applyObj.code = code
|
|
|
+ this.showSimilarCodeList = false
|
|
|
+ },
|
|
|
+ setBrand: function (brand) {
|
|
|
+ this.applyObj.brand = brand
|
|
|
+ this.showSimilarBrandList = false
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -289,8 +343,16 @@
|
|
|
z-index: 1000;
|
|
|
margin-top: -3.7rem;
|
|
|
margin-left: -2.96rem;
|
|
|
+ background: #fff;
|
|
|
.mobile-modal-header {
|
|
|
font-size: .38rem;
|
|
|
+ background: #fff;
|
|
|
+ background: url(/images/mobile/@2x/applyPurchase/pub.png) no-repeat;
|
|
|
+ background-size: cover;
|
|
|
+ height: 1.51rem;
|
|
|
+ i {
|
|
|
+ top: -.36rem;
|
|
|
+ }
|
|
|
}
|
|
|
.publish-seek {
|
|
|
background: #fff;
|
|
|
@@ -332,7 +394,30 @@
|
|
|
height: .06rem;
|
|
|
margin-left: .04rem;
|
|
|
}
|
|
|
- > ul {
|
|
|
+ .similar {
|
|
|
+ position: absolute;
|
|
|
+ width: 3.52rem;
|
|
|
+ max-height: 2.5rem;
|
|
|
+ overflow-y: auto;
|
|
|
+ z-index: 12;
|
|
|
+ border: 1px solid #7e7e7e;
|
|
|
+ border-radius: .05rem;
|
|
|
+ left: 1.75rem;
|
|
|
+ top: .7rem;
|
|
|
+ background: #fff;
|
|
|
+ li {
|
|
|
+ height: .5rem;
|
|
|
+ line-height: .5rem;
|
|
|
+ font-size: .26rem;
|
|
|
+ color: #999;
|
|
|
+ padding-left: .19rem;
|
|
|
+ &:focus, &:active, &:hover {
|
|
|
+ background: #999;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /*> ul {
|
|
|
position: absolute;
|
|
|
top: .6rem;
|
|
|
left: 1.16rem;
|
|
|
@@ -353,7 +438,7 @@
|
|
|
background: #dedede;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
> a {
|
|
|
display: block;
|