|
|
@@ -277,46 +277,75 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="update-materiel-wrapper">
|
|
|
- <div class="clearfix">
|
|
|
- <div class="update-materiel-wrapper-image pull-left">
|
|
|
- <upload :url="regieUrl" @uploadAction="onUpload" :NopassThree="false" :maxSize="'20'" :imgStyle="imgStyle"></upload>
|
|
|
- <span>点击上传</span>
|
|
|
- </div>
|
|
|
- <div class="uploadImgBtn pull-left">上传图片</div>
|
|
|
- <span class="uploadImgInfo pull-left">图片上传须知</span>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="update-materiel-wrapper-list clearfix">
|
|
|
+ <!--<div class="clearfix">-->
|
|
|
+ <!--<div class="update-materiel-wrapper-image pull-left">-->
|
|
|
+ <!--<img :src="cmpImg || '/images/mobile/openStore/upload.png'" style='width: 1.1rem; height: 1.1rem;display:block;margin: 0.2rem auto'/>-->
|
|
|
+ <!--<input type="file" class="com-input" @change="update" accept="image/jpeg,image/jpg,image/gif,image/bmp,image/png,.pdf" />-->
|
|
|
+ <!--<span style="position: relative">点击上传</span>-->
|
|
|
+ <!--</div>-->
|
|
|
+ <!--<div class="uploadImgBtn pull-left">上传图片<input type="file" class="com-input" @change="update" accept="image/jpeg,image/jpg,image/gif,image/bmp,image/png,.pdf" /></div>-->
|
|
|
+ <!--<span class="uploadImgInfo pull-left">图片上传须知</span>-->
|
|
|
+ <!--</div>-->
|
|
|
+ <template v-if="MaterielItem.standard === 1">
|
|
|
+ <img class="imgUrl" src="/images/mobile/@2x/productDetail/Strand.png" />
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <img class="imgUrl" src="/images/mobile/@2x/productDetail/isStrand.png" />
|
|
|
+ </template>
|
|
|
+ <div class="update-materiel-wrapper-list clearfix overHidden">
|
|
|
<div class="name pull-left"><a class="red">*</a>品牌:</div>
|
|
|
- <div class="input pull-left clearfix">
|
|
|
- <input type="text" placeholder="请输入品牌"/>
|
|
|
- <i class="iconfont icon-guanbi1"></i>
|
|
|
- </div>
|
|
|
+ <template v-if="MaterielItem.standard === 1">
|
|
|
+ {{MaterielItem.brand}}
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <div class="input pull-left clearfix overHidden">
|
|
|
+ <input type="text" v-model="MaterielItem.brand" placeholder="请勿填中文符号" @blur="checkBrand" @input="onBrandChange"/>
|
|
|
+ <ul class="similar brand-similar-list" v-show="showSimilarBrandList && MaterielItem.brand">
|
|
|
+ <li v-for="sBrand in similarBrand" @click="setBrand(sBrand.nameEn)">{{sBrand.nameEn}}</li>
|
|
|
+ </ul>
|
|
|
+ <i class="iconfont icon-guanbi1" @click="MaterielItem.brand = ''"></i>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
- <div class="update-materiel-wrapper-list clearfix">
|
|
|
+ <div class="update-materiel-wrapper-list clearfix overHidden">
|
|
|
<div class="name pull-left"><a class="red">*</a>物料名称(类目):</div>
|
|
|
- <div class="input pull-left clearfix" style="width: 4.09rem">
|
|
|
- <input type="text" placeholder="请输入物料名称(类目)"/>
|
|
|
- <i class="iconfont icon-guanbi1"></i>
|
|
|
- </div>
|
|
|
+ <template v-if="MaterielItem.standard === 1">
|
|
|
+ {{MaterielItem.kind}}
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <div class="input pull-left clearfix" style="width: 4.09rem">
|
|
|
+ <!--<input type="text" v-model="MaterielItem.kind" @blur="checkCode" @input="onCodeChange" placeholder="请勿填中文符号">-->
|
|
|
+ <input type="text" placeholder="请输入物料名称(类目)" v-model="MaterielItem.kind"/>
|
|
|
+ <i class="iconfont icon-guanbi1" @click="MaterielItem.kind = ''"></i>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
<div class="update-materiel-wrapper-list clearfix">
|
|
|
<div class="name pull-left"><a class="red">*</a>型号:</div>
|
|
|
- <div class="input pull-left clearfix">
|
|
|
- <input type="text" placeholder="请输入型号"/>
|
|
|
- <i class="iconfont icon-guanbi1"></i>
|
|
|
- </div>
|
|
|
+ <template v-if="MaterielItem.standard === 1">
|
|
|
+ {{MaterielItem.cmpCode}}
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <div class="input pull-left clearfix">
|
|
|
+ <input type="text" v-model="MaterielItem.cmpCode" @blur="checkCode" @input="onCodeChange" placeholder="请勿填中文符号">
|
|
|
+ <ul class="similar" v-show="showSimilarCodeList && MaterielItem.cmpCode">
|
|
|
+ <li v-for="sCode in similarCode" @click="setCode(sCode.code)">{{sCode.code}}</li>
|
|
|
+ </ul>
|
|
|
+ <!--<input type="text" placeholder="请输入型号" v-model="MaterielItem.cmpCode"/>-->
|
|
|
+ <i class="iconfont icon-guanbi1" @click="MaterielItem.code = ''"></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="请输入规格"/>
|
|
|
- <i class="iconfont icon-guanbi1"></i>
|
|
|
+ <input type="text" placeholder="请输入规格" v-model="MaterielItem.spec" @blur="checkSpec" @input="onSpecInput"/>
|
|
|
+ <i class="iconfont icon-guanbi1" @click="MaterielItem.spec = ''"></i>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="update-materiel-wrapper-controll clearfix">
|
|
|
- <div class="pull-left">保存</div>
|
|
|
- <div class="pull-right">取消</div>
|
|
|
+ <div class="pull-left" @click="saveMateriel()">保存</div>
|
|
|
+ <div class="pull-right" @click="showMateriel = false">取消</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -345,9 +374,14 @@
|
|
|
chooseItem: {},
|
|
|
vendorlist: [], // 查看更多信息
|
|
|
showoffshelf: false,
|
|
|
- showMateriel: true,
|
|
|
- regieUrl: '',
|
|
|
- imgStyle: 'width: 1.1rem;height:1.1rem'
|
|
|
+ showMateriel: false,
|
|
|
+ imgStyle: 'width: 1.1rem;height:1.1rem',
|
|
|
+ MaterielItem: {},
|
|
|
+ showSimilarCodeList: false,
|
|
|
+ showSimilarBrandList: false,
|
|
|
+ similarCode: [],
|
|
|
+ similarBrand: [],
|
|
|
+ cmpImg: ''
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -404,7 +438,6 @@
|
|
|
this.collectResult = err.response.data
|
|
|
})
|
|
|
},
|
|
|
- onUpload() {},
|
|
|
// scroll: function () {
|
|
|
// let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
|
|
|
// if (Math.ceil(scrolled + window.screen.availHeight) >= document.body.scrollHeight && !this.isSearchSearchingMore && this.seekPage < this.EnterprisePage) {
|
|
|
@@ -550,6 +583,9 @@
|
|
|
},
|
|
|
// 编辑物料
|
|
|
updateMateriel(item) {
|
|
|
+ this.MaterielItem = item
|
|
|
+ this.cmpImg = item.cmpImg || ''
|
|
|
+ // this.MaterielItem.cmpImg = item.cmpImg || ''
|
|
|
this.showMateriel = true
|
|
|
},
|
|
|
addProtoperson: function(item) {
|
|
|
@@ -571,6 +607,144 @@
|
|
|
this.collectResult = '绑定失败'
|
|
|
this.timeoutCount++
|
|
|
})
|
|
|
+ },
|
|
|
+ checkBrand: function () {
|
|
|
+ // this.MaterielItem.brand = this.MaterielItem.brand && this.MaterielItem.brand !== ''
|
|
|
+ if (!this.MaterielItem.brand || this.MaterielItem.brand === '') {
|
|
|
+ this.setRemindText('品牌不能为空')
|
|
|
+ }
|
|
|
+ return this.MaterielItem.brand
|
|
|
+ },
|
|
|
+ checkCode: function () {
|
|
|
+ if (!this.MaterielItem.cmpCode || this.MaterielItem.cmpCode === '') {
|
|
|
+ this.setRemindText('型号不能为空')
|
|
|
+ }
|
|
|
+ return this.MaterielItem.cmpCode
|
|
|
+ },
|
|
|
+ onCodeChange: function () {
|
|
|
+ this.MaterielItem.cmpCode = this.MaterielItem.cmpCode.trim()
|
|
|
+ if ((/[^\x00-\xff]/g).test(this.MaterielItem.cmpCode)) {
|
|
|
+ let chineseIndex = -1
|
|
|
+ for (let i = 0; i < this.MaterielItem.cmpCode.length; i++) {
|
|
|
+ if ((/[^\x00-\xff]/g).test(this.MaterielItem.cmpCode.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)
|
|
|
+ } else {
|
|
|
+ this.getSimilarCode()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onBrandChange: function () {
|
|
|
+ this.MaterielItem.brand = this.MaterielItem.brand.trim()
|
|
|
+ if ((/[^\x00-\xff]/g).test(this.MaterielItem.brand)) {
|
|
|
+ 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))) {
|
|
|
+ chineseIndex = i
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (chineseIndex > -1) {
|
|
|
+ this.MaterielItem.brand = this.MaterielItem.brand.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 {
|
|
|
+ this.getSimilarBrand()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getSimilarBrand: function () {
|
|
|
+ if (this.MaterielItem.brand) {
|
|
|
+ this.$http.get('/search/similarBrands', {params: {keyword: this.MaterielItem.brand}})
|
|
|
+ .then(response => {
|
|
|
+ this.similarBrand = response.data
|
|
|
+ this.showSimilarBrandList = response.data.length > 0
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.showSimilarBrandList = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getSimilarCode: function () {
|
|
|
+ if (this.MaterielItem.cmpCode) {
|
|
|
+ this.$http.get('/search/similarComponents', {params: {keyword: this.MaterielItem.cmpCode}})
|
|
|
+ .then(response => {
|
|
|
+ this.similarCode = response.data
|
|
|
+ this.showSimilarCodeList = response.data.length > 0
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.showSimilarCodeList = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setCode: function (code) {
|
|
|
+ this.MaterielItem.cmpCode = code
|
|
|
+ this.showSimilarCodeList = false
|
|
|
+ },
|
|
|
+ setBrand: function (brand) {
|
|
|
+ this.MaterielItem.brand = brand
|
|
|
+ this.showSimilarBrandList = false
|
|
|
+ },
|
|
|
+ setRemindText: function (str) {
|
|
|
+ this.collectResult = str
|
|
|
+ this.timeoutCount++
|
|
|
+ },
|
|
|
+ checkSpec: function () {
|
|
|
+ // let nullStrFlag =
|
|
|
+ // this.MaterielItem.spec = nullStrFlag
|
|
|
+ if (!this.baseUtils.checkNullStr(this.MaterielItem.spec)) {
|
|
|
+ this.setRemindText('规格输入不合法')
|
|
|
+ }
|
|
|
+ return this.MaterielItem.spec
|
|
|
+ },
|
|
|
+ onSpecInput: function () {
|
|
|
+ if (this.MaterielItem.spec && this.baseUtils.getRealLen(this.MaterielItem.spec) > 100) {
|
|
|
+ this.MaterielItem.spec = this.baseUtils.cutOutString(this.MaterielItem.spec, 100)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ saveMateriel() {
|
|
|
+ if (this.MaterielItem.brand === '') {
|
|
|
+ this.setRemindText('品牌不能为空')
|
|
|
+ return
|
|
|
+ } else if (this.MaterielItem.kind === '') {
|
|
|
+ this.setRemindText('类目不能为空')
|
|
|
+ return
|
|
|
+ } else if (this.MaterielItem.cmpCode === '') {
|
|
|
+ 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.setRemindText('修改成功')
|
|
|
+ this.showMateriel = false
|
|
|
+ this.page = 1
|
|
|
+ this.getResourceProvidor()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ update (e) {
|
|
|
+ let file = e.target.files[0]
|
|
|
+ if (file.size > 3 * 1024 * 1024) {
|
|
|
+ this.setRemindText(`上传文件不得超过3M`)
|
|
|
+ }
|
|
|
+ let param = new FormData()
|
|
|
+ param.append('file', file, file.name)
|
|
|
+ param.append('chunk', '0')
|
|
|
+ if (file.type === 'application/pdf') {
|
|
|
+ this.setRemindText(`请选择有效图片进行上传`)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let config = {
|
|
|
+ headers: {'Content-Type': 'multipart/form-data'}
|
|
|
+ }
|
|
|
+ this.$http.post('/api/images', param, config)
|
|
|
+ .then(response => {
|
|
|
+ this.MaterielItem.img = response.data[0].path
|
|
|
+ this.cmpImg = response.data[0].path
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -630,6 +804,9 @@
|
|
|
height: $value;
|
|
|
line-height: $value;
|
|
|
}
|
|
|
+ .overHidden {
|
|
|
+ @include overFlowHidden()
|
|
|
+ }
|
|
|
.user-content{
|
|
|
position: absolute;
|
|
|
width: 100%;
|
|
|
@@ -1516,6 +1693,15 @@
|
|
|
margin: 1.46rem 0.2rem 0;
|
|
|
position: relative;
|
|
|
padding-bottom: 0.4rem;
|
|
|
+ padding-top: 1rem;
|
|
|
+ position: relative;
|
|
|
+ .imgUrl{
|
|
|
+ position: absolute;
|
|
|
+ width: 0.94rem;
|
|
|
+ height: 0.94rem;
|
|
|
+ right: 0;
|
|
|
+ top: 0;
|
|
|
+ }
|
|
|
.update-materiel-wrapper-image {
|
|
|
width: 2.28rem;
|
|
|
height: 2.28rem;
|
|
|
@@ -1524,10 +1710,21 @@
|
|
|
position: relative;
|
|
|
margin: 0.27rem 0 0 0.55rem;
|
|
|
text-align: center;
|
|
|
+ position: relative;
|
|
|
span {
|
|
|
color: #b2b2b2;
|
|
|
font-size: 0.28rem;
|
|
|
}
|
|
|
+ .com-input {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ text-align: center;
|
|
|
+ position: absolute;
|
|
|
+ bottom: 0;
|
|
|
+ left: 0;
|
|
|
+ opacity: 0;
|
|
|
+ display: inline-block !important;
|
|
|
+ }
|
|
|
}
|
|
|
.uploadImgBtn {
|
|
|
color: #fff;
|
|
|
@@ -1538,6 +1735,17 @@
|
|
|
background: #f9b209;
|
|
|
text-align: center;
|
|
|
margin:2rem 0.1rem 0;
|
|
|
+ position: relative;
|
|
|
+ .com-input {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ text-align: center;
|
|
|
+ position: absolute;
|
|
|
+ bottom: 0;
|
|
|
+ left: 0;
|
|
|
+ opacity: 0;
|
|
|
+ display: inline-block !important;
|
|
|
+ }
|
|
|
}
|
|
|
.uploadImgInfo {
|
|
|
color: #3f84f6;
|
|
|
@@ -1551,6 +1759,7 @@
|
|
|
.red {color: #ea0f42}
|
|
|
.name {color: #666;}
|
|
|
.input {
|
|
|
+ position: relative;
|
|
|
width:5.4rem;
|
|
|
line-height: 0.5rem;
|
|
|
height: 0.5rem;border: 1px solid #dcdcdc;
|
|
|
@@ -1570,6 +1779,29 @@
|
|
|
vertical-align: top;
|
|
|
color: #666;
|
|
|
float: right;
|
|
|
+ margin-right: 0.05rem
|
|
|
+ }
|
|
|
+ .similar {
|
|
|
+ position: absolute;
|
|
|
+ width:100%;
|
|
|
+ max-height: 2.5rem;
|
|
|
+ overflow-y: auto;
|
|
|
+ z-index: 12;
|
|
|
+ border: 1px solid #7e7e7e;
|
|
|
+ border-radius: .05rem;
|
|
|
+ top: .5rem;
|
|
|
+ background: #fff;
|
|
|
+ li {
|
|
|
+ height: .5rem;
|
|
|
+ line-height: .5rem;
|
|
|
+ font-size: .26rem;
|
|
|
+ color: #999;
|
|
|
+ padding-left: .19rem;
|
|
|
+ &:focus, &:active, &:hover {
|
|
|
+ background: #999;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|