| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226 |
- <template>
- <div>
- <div class="material-wrapper" >
- <div class="order-nav">
- <div :class="activeType === '' ? 'active': ''" @click="ChangeList('')"><span>公司产品库</span></div>
- <div :class="activeType === 'mine' ? 'active' : ''" @click="ChangeList('mine')"><span>我的产品库</span></div>
- </div>
- <div class="search-content">
- <input type="text" placeholder="请输入您要查找的品牌或型号" v-model="seekKeyword" @keyup.13="searchSeek">
- <span @click="searchSeek" >
- <i class="iconfont icon-sousuo"></i>
- </span>
- </div>
- <div class="scrollContent" id="provider-wrapper">
- <div class="providerList" v-for="(item, index) in GetEnterpriseListData">
- <div class="top">
- <div class="icon" :class="item.standard ? 'standed' : 'istanded'"></div>
- <div class="text" style="width: 4.3rem">
- {{item.pcmpcode}}
- </div>
- <div class="text" style="width: 1rem;color: #666;font-size: 0.28rem">
- {{item.goods && item.goods.storeid === '33069557578d44e69bd91ad12d28a8d4' ? '寄售' : '自营' || '寄售'}}
- <!--{{item.goods && item.goods.selfSale === 1 ? '自营' : '寄售' || '-'}}-->
- </div>
- <div class="text" style="width: 1rem;color: #666;font-size: 0.28rem">
- {{item.goods && (item.goods.status === 601 || item.goods.status === 602) ? '已上架' : '已下架' }}
- </div>
- <!-- <div class="pms">
- {{item.storeid === '33069557578d44e69bd91ad12d28a8d4' ? '寄售' : '自营'}}
- </div>-->
- <!--<img class="store-type" v-if="item.goods && item.goods.storeid === '33069557578d44e69bd91ad12d28a8d4'" src="/images/mobile/product/consignment.png" alt="">-->
- <!--<img class="store-type" src="/images/mobile/product/self.png" alt="" v-else >=-->
- <img class="store-type" src="/images/mobile/product/mine_icon.png" v-if="item.addProductPerson"/>
- </div>
- <div class="middle">
- <div class="list" style="height: 0.46rem;">
- <div class="fl">
- <div class="name">品牌:</div>
- <div class="text">{{item.pbranden || item.pbrand || '-'}}</div>
- </div>
- <!--<div class="fr">-->
- <!--<div class="button" @click="update(item)">编辑</div>-->
- <!--<div class="button" @click="offProduct(item, index)">下架</div>-->
- <!--</div>-->
- </div>
- <div class="list">
- <div class="name">物料名称:</div>
- <div class="text">{{item.kind || item.kinden || '-'}}</div>
- <!--<div class="fr">-->
- <!--<div class="textinfo" v-if="item.goods && item.goods.breakUp">可拆卖</div>-->
- <!--</div>-->
- </div>
- <div class="list">
- <div class="name">规格:</div>
- <div class="text">{{item.spec || '-'}}</div>
- </div>
- <div class="list">
- <div class="fl">
- <div class="name">包装方式:</div>
- <div class="text">{{item.packaging || '无包装信息'}}</div>
- </div>
- <div class="fr">
- <div class="name">库存(pcs):</div>
- <div class="text">{{item.erpReserve || '-'}}</div>
- </div>
- </div>
- <div class="list">
- <div class="fl">
- <div class="name">最小包装数:</div>
- <div class="text">{{item.minPackQty || '-'}}</div>
- </div>
- <div class="fr">
- <div class="name">成本单价:</div>
- <div class="text">{{item.price || '-'}}</div>
- </div>
- </div>
- <div class="list">
- <div class="fl">
- <div class="name">最小起订量:</div>
- <div class="text">{{item.goods && item.goods.minBuyQty || '-'}}</div>
- </div>
- <div class="fr">
- <div class="name">交期(天):</div>
- <div class="text" v-if="item.goods && item.goods.b2cMaxDelivery && (item.goods.b2cMaxDelivery != item.goods.b2cMinDelivery)" v-text="item.goods.b2cMinDelivery + '-'+ item.goods.b2cMaxDelivery"></div>
- <div class="text" v-if="item.goods && item.goods.b2cMaxDelivery && (item.goods.b2cMaxDelivery == item.goods.b2cMinDelivery)" v-text="item.goods.b2cMinDelivery"></div>
- </div>
- </div>
- <!--<div class="list">-->
- <!--<div class="name">生产日期:</div>-->
- <!--<div class="text" :title="item.produceDate">{{item.produceDate || '-'}}</div>-->
- <!--</div>-->
- <div class="list">
- <div class="name left">价格梯度:</div>
- <div class="table left">
- <ul>
- <li class="title">
- <div>分段数量/PCS</div>
- <div>分段单价</div>
- </li>
- <template v-if="item.goods">
- <li v-for="price in item.goods.prices">
- <div>{{price.start}}+</div>
- <div v-if="item.currencyName == 'RMB'">¥{{price.rMBPrice}}</div>
- <div v-else>${{price.uSDPrice}}</div>
- </li>
- </template>
- <template v-else>
- <li>
- <div style="color: #666;width: 100%">暂无梯度数据</div>
- </li>
- </template>
- </ul>
- </div>
- </div>
- </div>
- <div class="clearfix">
- <div class="pull-right add" @click="addProtoperson(item)" :class="{noadd: item.addProductPerson}" v-if="activeType !== 'mine'">加入个人产品</div>
- <div class="pull-right look" @click="toAddpro(item, index)">编辑上架</div>
- <div class="pull-right look" @click="updateMateriel(item)">编辑物料</div>
- </div>
- </div>
- </div>
- <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
- <pull-up :fixId="'provider-wrapper'" :searchMore="isSearchSearchingMore" :allPage="EnterprisePage" :page="seekPage" @pullUpAction="getMoreSearch"></pull-up>
- </div>
- <!-- 编辑物料 -->
- <div class="update-materiel" v-show="showMateriel">
- <div class="mobile-nav">
- <div class="mobile-header mobile-center-header">
- <a @click="showMateriel = false; showdropmenu(' ')"><i class="iconfont icon-fanhui"></i></a>
- <p>编辑物料</p>
- <p class="en-name">
- <img :src="`/images/mobile/center/${user.data.enterprise && user.data.enterprise.uu ? 'en' : 'self'}.png`" alt="">{{currentEnName}}
- </p>
- </div>
- </div>
- <div class="update-materiel-wrapper" @click="clearInfo()">
- <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 ref="scroll" style="height: 100%;overflow-y:scroll">
- <div>
- <div style="background: #fff;border: 1px solid #dcdcdc;padding-bottom: 0.5rem;">
- <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.pbranden}}
- </template>
- <template v-else>
- <div class="input pull-left clearfix" :class="{'overHidden': MaterielItem.standard === 1}">
- <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.pbranden = ''"></i>
- </div>
- </template>
- </div>
- <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.kind}}
- </template>
- <template v-else>
- <div class="input pull-left clearfix" style="width: 4.44rem">
- <!--<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.stop="MaterielItem.kind = ''"></i>
- </div>
- </template>
- </div>
- <div class="update-materiel-wrapper-list clearfix">
- <div class="name pull-left"><a class="red">*</a>型号:</div>
- <template v-if="MaterielItem.standard === 1">
- {{MaterielItem.pcmpcode}}
- </template>
- <template v-else>
- <div class="input pull-left clearfix">
- <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.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" maxlength="50"/>
- <i class="iconfont icon-guanbi1" @click.stop="MaterielItem.spec = ''"></i>
- </div>
- </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" style="width: 4.15rem;">
- <input type="number" placeholder="请输入最小包装数" v-model="MaterielItem.minPackQty" maxlength="6" oninput="if(value.length>6)value=value.slice(0,6)"/>
- <i class="iconfont icon-guanbi1" @click.stop="MaterielItem.minPackQty = ''"></i>
- </div>
- </div>
- <div class="update-materiel-wrapper-list clearfix">
- <div class="name pull-left"><a class="red" style="opacity: 0">*</a>包装方式:</div>
- <div class="selectInput pull-left" @click.stop="showdropmenu('pack')">
- <span>{{MaterielItem.packaging || '无包装信息'}}</span>
- <img src="/images/mobile/product/drop_icon.png"/>
- <ul :class="{active : showDrop === 'pack' }">
- <li v-for="item in packObj" @click.stop="choosePack(item)">{{item}}</li>
- </ul>
- </div>
- </div>
- <div class="update-materiel-wrapper-list clearfix">
- <div class="name pull-left"><a class="red" style="opacity: 0">*</a>规格书:</div>
- </div>
- <div class="clearfix">
- <div class="update-materiel-wrapper-image">
- <a v-if="MaterielItem.IsSave" @click.stop="WinOpen(MaterielItem.Regulpic)">
- <img src="/images/mobile/openStore/pdf.png" style='width: 0.49rem; height: 0.49rem;display:block;margin: 0.2rem auto 0'/>
- </a>
- <img v-else src="/images/mobile/openStore/upload.png" style='width: 0.49rem; height: 0.49rem;display:block;margin: 0.2rem auto 0'/>
- <!--v-if="MaterielItem.standard !== 1"-->
- <input type="file" class="com-input" @change.stop="update" accept="*.pdf" v-if="!MaterielItem.IsSave"/>
- <span style="position: relative" v-if="MaterielItem.Regulpic === ''">上传规格书</span>
- </div>
- <span class="uploadImgInfo pull-left">
- <div class="name"><a class="red">*</a>仅支持PDF格式文件,大小不超过20M:</div>
- <div class="name"><a class="red">*</a>规格书上传后,将在两个工作日内完成审核</div>
- <div class="name"><a class="red">*</a>如审核不通过,将会以消息的形式通知您</div>
- <div class="name"><a class="red">*</a>已有原厂规格书的器件暂不开放上传</div>
- <div class="name"><a class="red">*</a>更新规格书需重新审核</div>
- </span>
- <div style="clear:both"></div>
- <div class="uploadImgBtn pull-left" v-if="MaterielItem.standard !== 1">上传规格书<input type="file" class="com-input" @change.stop="update" accept=".pdf" /></div>
- <div style="color: #ea0f42;font-size: 0.2rem;line-height: 0.47rem;margin-left: 0.2rem" class="pull-left" v-if="MaterielItem.standard !== 1 && MaterielItem.Regulpic !== ''" >该规格书正在审核中</div>
- </div>
- <div class="update-materiel-wrapper-list clearfix">
- <div class="name pull-left"><a class="red" style="opacity: 0">*</a>物料图片:</div>
- </div>
- <div class="clearfix">
- <div class="update-materiel-wrapper-image">
- <img :src="MaterielItem.cmpImg || '/images/mobile/openStore/upload.png'" style='width: 0.49rem; height: 0.49rem;display:block;margin: 0.2rem auto 0'/>
- <input type="file" class="com-input" @change.stop="update2" accept="image/jpeg,image/jpg,image/png" />
- <span style="position: relative" v-if="MaterielItem.cmpImg === ''">上传图片</span>
- </div>
- <span class="uploadImgInfo pull-left" style="line-height: 1.09rem">
- <div class="name"><a class="red">*</a>仅支持JPG、PNG格式文件,大小不超过1M</div>
- </span>
- <div style="clear:both"></div>
- <div class="uploadImgBtn pull-left" style="margin-top: 0.15rem">上传图片<input type="file" class="com-input" @change.stop="update2" accept="image/jpeg,image/jpg,image/png" /></div>
- </div>
- </div>
- <div class="update-materiel-wrapper-controll clearfix">
- <div class="pull-left" @click.stop="saveMateriel()">保存</div>
- <div class="pull-right" @click.stop="saveMateriel('a')">取消</div>
- </div>
- <div style="height: 1rem;position:relative"></div>
- </div>
- </div>
- </div>
- </div>
- <!-- 物料上下架 -->
- <div>
- <upoff-material ref="upoffMaterial" :chooseItem="MaterielItem" @upoffMaterial="upoffMaterial" :firstPrice="firstPrice">
- </upoff-material>
- </div>
- <!-- /end 物料上下架 -->
- </div>
- </template>
- <script>
- // 移动端IOS不支持上传PDF文件
- import { RemindBox, PullUp } from '~components/mobile/common'
- import { upoffMaterial } from '~components/mobile/center'
- export default {
- layout: 'mobile',
- middleware: 'authenticated',
- name: 'mobileProduct',
- fetch ({store}) {
- return Promise.all([
- store.dispatch('loadStoreStatus', {op: 'check'})
- ])
- },
- data() {
- return {
- activeType: '',
- collectResult: '',
- timeoutCount: 0,
- isSearchSearchingMore: false, // 是否请求状态
- EnterprisePage: 0, // 总页数
- GetEnterpriseListData: [], // 当前数据源
- seekPage: 1, // 当前页数
- seekKeyword: '', // 搜索关键字
- MaterielItem: {}, // 当前选择编辑物料对象 或者 编辑上下架对象
- showMateriel: false, // 编辑物料弹窗
- showSimilarCodeList: false, // 型号选择框
- showSimilarBrandList: false, // 品牌选择框
- similarBrand: [],
- similarCode: [],
- packObj: ['Bulk-散装', 'Reel-卷装', 'Tape/Reel-编带', 'Tray-盘装', 'Tube-管装', '盒装', '袋装', '罐装', '瓶装', '桶装', '箱装', '其他'],
- showDrop: '',
- firstPrice: ''
- }
- },
- created() {
- this.getResourceProvidor()
- },
- computed: {
- // 是否展示空数据
- StateNone() {
- return this.GetEnterpriseListData.length === 0 && this.EnterprisePage === 0
- }
- },
- methods: {
- // 打开pdf
- WinOpen(item) {
- window.open(item, '_blank')
- },
- // 获取当前企业产品库
- GetEnterpriseList: function() {
- let params = {
- _status: 'all',
- count: 20,
- isStandard: true,
- keyword: this.seekKeyword || '',
- page: this.seekPage,
- sorting: { id: 'DESC' },
- type: 'all'
- }
- return this.$http.get('/trade/products', { params })
- },
- // 获取当前个人产品库
- GetPersonList: function(cb) {
- let params = {
- _status: 'all',
- count: 20,
- isStandard: true,
- keyword: this.seekKeyword || '',
- page: this.seekPage,
- sorting: { id: 'DESC' },
- type: 'all'
- }
- return this.$http.get('/trade/products/person', { params })
- },
- ChangeList(_tp) {
- this.activeType = _tp
- this.seekPage = 1
- this.GetEnterpriseListData = []
- this.getResourceProvidor()
- },
- getResourceProvidor: function() {
- if (this.activeType === '') {
- this.GetEnterpriseList().then(res => {
- this.GetEnterpriseListData = this.GetEnterpriseListData.concat(res.data.content)
- this.EnterprisePage = res.data.totalPages
- this.isSearchSearchingMore = false
- })
- } else if (this.activeType === 'mine') {
- this.GetPersonList().then(res => {
- this.GetEnterpriseListData = this.GetEnterpriseListData.concat(res.data.content)
- this.EnterprisePage = res.data.totalPages
- this.isSearchSearchingMore = false
- })
- } else if (this.providerType === 'onLine') {
- this.GetOnlineList().then(res => {
- this.GetEnterpriseListData = this.GetEnterpriseListData.concat(res.data.content)
- this.EnterprisePage = res.data.totalPages
- this.isSearchSearchingMore = false
- })
- }
- },
- getMoreSearch: function () {
- this.seekPage++
- this.isSearchSearchingMore = true
- this.getResourceProvidor()
- },
- searchSeek: function() {
- this.seekPage = 0
- this.GetEnterpriseListData = []
- this.getMoreSearch()
- },
- addProtoperson: function(item) {
- if (item.addProductPerson) {
- this.collectResult = '已在个人产品库'
- this.timeoutCount++
- return false
- }
- this.$http.post('/trade/products/person', [item.id])
- .then(response => {
- this.collectResult = '绑定成功'
- this.timeoutCount++
- this.seekPage = 1
- this.GetEnterpriseListData.splice(0, this.GetEnterpriseListData.length)
- this.GetEnterpriseListData = null
- this.GetEnterpriseListData = []
- this.getResourceProvidor()
- // this.reloadData()
- }, () => {
- this.collectResult = '绑定失败'
- this.timeoutCount++
- })
- },
- // 编辑上架
- toAddpro(item, index) {
- // if (item.erpReserve === '' || item.erpReserve === 0 || !item.erpReserve) {
- // this.setRemindText(`当前物料库存为0,请先入库`)
- // return false
- // }
- if (item.minPackQty === '' || item.minPackQty === 0 || !item.minPackQty) {
- this.setRemindText(`请先编辑物料,最小包装数选项`)
- return false
- }
- // this.$item = this.baseUtils.deepCopy(item)
- this.$index = index
- // this.MaterielItem = item
- this.MaterielItem = item
- this.$item = this.baseUtils.deepCopy(this.MaterielItem)
- if (!this.MaterielItem.goods) {
- this.$set(this.MaterielItem, 'goods', {
- prices: [{end: '',
- rMBNTPrice: '',
- rMBPrice: '',
- start: '1'}],
- selfSale: 1,
- breakUp: true,
- autoPublish: true,
- productid: item.id,
- minDelivery: 1,
- maxDelivery: 10,
- minBuyQty: 1
- })
- }
- this.firstPrice = this.MaterielItem.goods.prices[0].start.toString()
- let rf = document.body.offsetHeight // 触发浏览器重绘
- // console.log(item)
- this.$refs.upoffMaterial.show()
- },
- update2 (e) {
- // 上传图片
- let file = e.target.files[0]
- if (file.size > 1024 * 1024) {
- this.setRemindText(`上传文件不得超过1M`)
- return false
- }
- if (file.type.indexOf('gif') > -1) {
- this.setRemindText(`不允许上传gif`)
- return false
- }
- let param = new FormData()
- param.append('file', file, file.name)
- param.append('chunk', '0')
- let config = {
- headers: {'Content-Type': 'multipart/form-data'}
- }
- this.$http.post('/api/images', param, config)
- .then(response => {
- this.$set(this.MaterielItem, 'cmpImg', response.data[0].path)
- // this.MaterielItem.cmpImg = response.data[0].path
- })
- },
- update (e) {
- // 上传PDF
- let file = e.target.files[0]
- if (file.size > 1024 * 1024 * 20) {
- this.setRemindText(`上传文件不得超过20M`)
- return false
- }
- if (file.type.indexOf('pdf') < 0) {
- this.setRemindText(`规格书只允许上传pdf文件`)
- return false
- }
- let param = new FormData()
- param.append('file', file, file.name)
- param.append('chunk', '0')
- let config = {
- headers: {'Content-Type': file.type}
- }
- this.$http.post('/file', param, config)
- .then(response => {
- this.MaterielItem.IsSave = true
- this.MaterielItem.Regulpic = response.data[0].path
- }, err => {
- console.log(err)
- })
- },
- // 编辑物料
- updateMateriel(item) {
- // Object.assign(this.MaterielItem, item, {Regulpic: '', IsSave: false, cmpImg: ''})
- this.MaterielItem = item
- this.$item = this.baseUtils.deepCopy(item)
- this.MaterielItem.minPackQty = (this.MaterielItem.minPackQty === '' || this.MaterielItem.minPackQty === 0) ? 1 : this.MaterielItem.minPackQty
- this.MaterielItem.packaging = this.MaterielItem.packaging !== '' ? this.MaterielItem.packaging : this.packObj[1]
- this.$set(this.MaterielItem, 'IsSave', (item.productAttachSubmit && item.productAttachSubmit.uploadAttach || item.attach) ? true : false) // 规格书是否存在
- this.$set(this.MaterielItem, 'cmpImg', item.cmpImg || '')
- this.$set(this.MaterielItem, 'Regulpic', (item.productAttachSubmit && item.productAttachSubmit.uploadAttach) || item.attach || '')
- this.showMateriel = true
- // this._initScroll()
- },
- // 编辑物料保存按钮
- saveMateriel(str) {
- if (str) {
- let _key1 = Object.keys(this.$item)
- let _key2 = Object.keys(this.MaterielItem)
- for (let i = 0; i < _key1.length; i++) {
- this.MaterielItem[_key2[i]] = this.$item[_key1[i]]
- }
- this.showMateriel = false
- this.showDrop = ''
- return
- }
- if (this.MaterielItem.pbranden === '') {
- this.setRemindText('品牌不能为空')
- return
- } else if (this.MaterielItem.kind === '') {
- this.setRemindText('物料名称不能为空')
- return
- } else if (this.MaterielItem.minPackQty === '') {
- this.setRemindText('最小包装数不能为空')
- return
- } else if (this.MaterielItem.pcmpcode === '') {
- this.setRemindText('型号不能为空')
- return
- }
- 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.MaterielItem.Regulpic || '',
- cmpImg: this.MaterielItem.cmpImg, // 物料图片
- packaging: this.MaterielItem.packaging, // 包装
- minPackQty: this.MaterielItem.minPackQty // 最小包装数
- }
- let _url = item.url
- if (this.MaterielItem.standard === 1) {
- _url = ''
- }
- this.$http.post(`/trade/products/update/product?attachUrl=${_url}`, 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)
- }
- })
- },
- // 显示包装选择
- showdropmenu(str) {
- this.showDrop = str
- },
- // 选择包装
- choosePack(item) {
- this.showDrop = ''
- this.MaterielItem.packaging = item
- },
- // 关闭包装选项
- closeAlert() {
- this.MaterielItem = this.$item
- this.showDrop = ''
- },
- clearInfo() {
- this.showSimilarCodeList = false
- this.showSimilarBrandList = false
- },
- checkBrand: function () {
- // this.MaterielItem.brand = this.MaterielItem.brand && this.MaterielItem.brand !== ''
- if (!this.MaterielItem.pbranden || this.MaterielItem.pbranden === '') {
- this.setRemindText('品牌不能为空')
- }
- return this.MaterielItem.pbranden
- },
- checkCode: function () {
- if (!this.MaterielItem.pcmpcode || this.MaterielItem.pcmpcode === '') {
- this.setRemindText('型号不能为空')
- }
- return this.MaterielItem.pcmpcode
- },
- onCodeChange: function () {
- 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.pcmpcode.length; i++) {
- if ((/[^\x00-\xff]/g).test(this.MaterielItem.pcmpcode.charAt(i))) {
- chineseIndex = i
- break
- }
- }
- 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.pbranden = this.MaterielItem.pbranden.trim()
- if ((/[^\x00-\xff]/g).test(this.MaterielItem.pbranden)) {
- let chineseIndex = -1
- 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.pbranden = this.MaterielItem.pbranden.substring(0, chineseIndex)
- }
- } 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.pbranden) {
- this.$http.get('/search/similarBrands', {params: {keyword: this.MaterielItem.pbranden}})
- .then(response => {
- this.similarBrand = response.data
- this.showSimilarBrandList = response.data.length > 0
- })
- } else {
- this.showSimilarBrandList = false
- }
- },
- getSimilarCode: function () {
- 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
- })
- } else {
- this.showSimilarCodeList = false
- }
- },
- setCode: function (code) {
- this.MaterielItem.pcmpcode = code
- this.showSimilarCodeList = false
- },
- setBrand: function (brand) {
- this.MaterielItem.pbranden = 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)
- }
- },
- upoffMaterial(type, item) {
- if (!type) {
- this.showMateriel = false
- this.page = 1
- this.GetEnterpriseListData = null
- this.GetEnterpriseListData = []
- this.getResourceProvidor()
- } else {
- // console.log(this.$item)
- // console.log(this.MaterielItem)
- // let _key1 = Object.keys(this.$item)
- // let _key2 = Object.keys(this.MaterielItem)
- // for (let i = 0; i < _key1.length; i++) {
- // this.MaterielItem[_key2[i]] = this.$item[_key1[i]]
- // }
- this.GetEnterpriseListData.splice(this.$index, 1, this.$item)
- // delete item.goods
- // this.MaterielItem = this.$item
- }
- this.MaterielItem = {}
- }
- // _initScroll() {
- // this.$nextTick(() => {
- // if (!this.scroll) {
- // this.scroll = new BScroll(this.$refs.scroll, {
- // click: true
- // })
- // } else {
- // this.scroll.refresh()
- // }
- // })
- // }
- },
- components: {
- RemindBox,
- PullUp,
- upoffMaterial
- }
- }
- </script>
- <style lang="scss">
- @mixin overFlowHidden {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- @mixin lineHeight($value) {
- height: $value;
- line-height: $value;
- }
- .material-wrapper {
- background: #f1f3f6;
- /*margin: 1.26rem 0 0.98rem 0;*/
- /*height: calc(100vh - 1.26rem - 0.98rem);*/
- position: fixed;
- width: 100%;
- top: 1.26rem;
- bottom: 0.98rem;
- overflow-y: auto;
- z-index: 100;
- .order-nav {
- background: #fff;
- div {
- height: 0.82rem;
- line-height: 0.82rem;
- display: inline-block;
- width: 50%;
- text-align: center;
- font-size: .28rem;
- color: #666;
- &.active span{
- color: #3f84f6;
- border-bottom: 0.04rem solid #3f84f6;
- padding-bottom: 0.2rem;
- }
- }
- }
- .search-content {
- text-align: center;
- padding: .25rem 0;
- input {
- border: 1px solid #376ff3;
- }
- span {
- }
- }
- .scrollContent {
- height: calc(100vh - 3.19rem - 0.98rem);
- overflow-y: auto;
- .providerList {
- margin-bottom: 0.24rem;
- .top {
- position: relative;
- padding: 0 0.24rem;
- border-bottom: 1px solid #d3d3d3;
- height: 0.9rem;
- line-height: 0.9rem;
- color: #0067e7;
- font-size: 0.3rem;
- background: #fff;
- &::after {
- clear: both;
- display: block;
- content: ' ';
- visibility: hidden;
- zoom: 1;
- }
- .text {
- width: 5.4rem;
- }
- .pms {
- color: #f57710;
- border: 1px solid #f57710;
- border-radius: 0.4rem;
- background: #fff;
- font-size: 0.24rem;
- height: 0.4rem;
- line-height: 0.4rem;
- width: 0.8rem;
- text-align: center;
- float: right;
- margin-top: 0.25rem;
- }
- .store-type {
- width: .77rem;
- height: .77rem;
- position: absolute;
- right: 0;
- top: 0;
- }
- .icon {
- width: 0.6rem;
- height: 0.36rem;
- line-height: 0.36rem;
- margin-top: 0.27rem;
- float: left;
- background-size: 100%;
- background-repeat: no-repeat;
- margin-right: 0.12rem;
- text-align: center;
- &.istanded {
- background-image: url('/images/mobile/@2x/istanded.png')
- }
- &.standed {
- background-image: url('/images/mobile/@2x/standed.png')
- }
- }
- .person-flag {
- width: .75rem;
- position: absolute;
- right: 0;
- }
- .text {
- float: left;
- width: 6.3rem;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- .middle {
- padding: 0.24rem 0.24rem;
- background: #fff;
- .pms {
- color: #f57710;
- border: 1px solid #f57710;
- border-radius: 0.4rem;
- background: #fff;
- font-size: 0.24rem;
- height: 0.4rem;
- line-height: 0.4rem;
- width: 0.8rem;
- text-align: center;
- }
- .list {
- /*height: 0.46rem;*/
- .left {
- float: left;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .textinfo {
- color: #0067e7;
- font-size: 0.3rem;
- }
- .button {
- font-size: 0.26rem;
- color: #fff;
- width: 0.92rem;
- text-align: center;
- border-radius: 5px;
- /*border:1px solid #1a58dd;*/
- background: #1a58dd;
- display: inline-block;
- margin-right: 0.2rem;
- line-height: 0.33rem;
- height: 0.37rem;
- }
- margin-bottom: 0.18rem;
- &::after{
- clear: both;
- display: block;
- content: ' ';
- visibility: hidden;
- zoom: 1;
- }
- .fl {
- width: 4.3rem;
- float: left;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .fr {
- text-align: left;
- width: 2.6rem;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- &.list-long {
- .fl {
- width: 100% !important;
- }
- }
- .name {
- color: #666;
- font-size: 0.3rem;
- display: inline-block;
- }
- .text {
- display: inline-block;
- color: #333;
- font-size: 0.3rem
- }
- .table {
- width: 5.5rem;
- margin-bottom: 0;
- margin-top: 0;
- li {
- height: 0.43rem;
- line-height: 0.43rem;
- border-left: .01rem solid #c5c5c5;
- font-size: .28rem;
- &::after {
- clear: both;
- display: block;
- content: ' ';
- visibility: hidden;
- zoom: 1;
- }
- div {
- text-align: center;
- width: 50%;
- float: left;
- border-right: .01rem solid #c5c5c5;
- border-bottom: .01rem solid #c5c5c5;
- }
- &:nth-child(odd) {
- background: #ddd;
- color: #666;
- font-size: 0.28rem;
- }
- &:nth-child(even) {
- background: #fcfcfc;
- color: #666;
- font-size: 0.28rem;
- }
- &:nth-last-of-type(1){
- color: #f31919;
- }
- &.title {
- font-size: 0.28rem;
- color: #333;
- }
- }
- }
- }
- }
- div.clearfix {
- padding: 0.2rem 0.2rem;
- border-top: 1px solid #d3d3d3;
- background: #fff;
- div{
- width: 2.1rem;
- height: .6rem;
- text-align: center;
- line-height: .6rem;
- border-radius: 3px;
- margin-right: .2rem;
- &.look {
- color: #008bf7;
- border: 1px solid #008bf7;
- }
- &.add {
- background: #fff;
- color: #f57710;
- border: 1px solid #f57710;
- }
- &.noadd{
- background: #cccbcb;
- color: #fff;
- border:1px solid #cccbcb;
- }
- }
- }
- }
- }
- }
- .update-materiel {
- position: fixed;
- z-index: 1000;
- background: #f1f3f6;
- /*background: red;*/
- top: 0;
- left: 0;
- bottom: 0;
- right: 0;
- .mobile-header{
- position: fixed;
- top: 0;
- z-index: 100;
- width:100%;
- height: 1.26rem;
- line-height: 1.26rem;
- /*border-bottom:.01rem solid #ccc;*/
- background: #3e82f5;
- padding:0 .2rem 0 .1rem;
- color:#fff;
- }
- .mobile-header p{
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- font-size:.36rem;
- text-align: center;
- width: 6rem;
- padding-left: 1rem;
- }
- .mobile-center-header p.en-name {
- font-size: .3rem;
- }
- .mobile-header a{
- font-size:.28rem;
- color:#fff;
- position: absolute;
- }
- .mobile-header a i{
- font-size: .48rem;
- margin-right: -.1rem;
- }
- .update-materiel-wrapper {
- border-radius: 0.07rem;
- position: fixed;
- overflow: hidden;
- bottom: 0;
- top: 1.46rem;
- left: 0.2rem;
- right: 0.2rem;
- .imgUrl{
- position: absolute;
- width: 0.94rem;
- height: 0.94rem;
- right: 0;
- top: 0;
- z-index: 1;
- }
- .update-materiel-wrapper-image {
- width: 1.09rem;
- height: 1.09rem;
- border: 1px solid #dcdcdc;
- border-radius: 0.07rem;
- position: relative;
- margin: 0rem 0 0 0.5rem;
- text-align: center;
- position: relative;
- float: left;
- span {
- color: #b2b2b2;
- font-size: 0.2rem;
- }
- .com-input {
- width: 100%;
- height: 100%;
- text-align: center;
- position: absolute;
- bottom: 0;
- left: 0;
- opacity: 0;
- display: inline-block !important;
- }
- }
- .uploadImgBtn {
- color: #fff;
- font-size: .28rem;
- width: 1.51rem;
- @include lineHeight(0.47rem);
- border-radius: 0.07rem;
- background: #f9b209;
- text-align: center;
- margin: 0rem 0 0 0.3rem;
- position: relative;
- .com-input {
- width: 100%;
- height: 100%;
- text-align: center;
- position: absolute;
- bottom: 0;
- left: 0;
- opacity: 0;
- display: inline-block !important;
- }
- }
- .uploadImgInfo {
- font-size: 0.24rem;
- margin-left: 0.44rem;
- color: #999;
- .red {
- color: red;
- }
- }
- .update-materiel-wrapper-list {
- margin-left:0.28rem;
- margin-top: 0.3rem;
- line-height: 0.7rem;
- .red {color: #ea0f42}
- .name {color: #666;font-size: 0.28rem}
- .input {
- position: relative;
- width: 5rem;
- line-height: 0.7rem;
- height: 0.7rem;
- border: 1px solid #dcdcdc;
- input {
- text-indent: 5px;
- border: 0;
- border-radius: 0.07rem;
- line-height: 0.64rem;
- height: 0.64rem;
- width: 90%;
- font-size:0.28rem;
- float: left;
- color: #333;
- }
- i {
- font-size: 0.16rem;
- 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;
- }
- }
- }
- }
- }
- .update-materiel-wrapper-list2 {
- margin-left: 0.28rem;
- margin-top: 0.3rem;
- }
- .update-materiel-wrapper-controll {
- margin: 0.4rem 0.2rem 0;
- div {
- width: 48%;
- background: #b5b5b5;
- font-size: 0.3rem;
- color: #fafbfc;
- text-align: center;
- @include lineHeight(0.62rem);
- border-radius: 0.07rem;
- &:first-child {
- background: #3f84f6;
- }
- }
- }
- }
- .selectInput {
- display: inline-block;
- position: relative;
- vertical-align: top;
- height: 0.7rem;
- line-height: 0.7rem;
- border: 1px solid #d2d2d2;
- border-radius: 2px;
- width: 4.44rem;
- text-indent: 0.12rem;
- img {
- position: absolute;
- width: 0.17rem;
- height: 0.11rem;
- right:0.1rem;
- top: 0.28rem;
- }
- &.selectInput2 {
- width: 1.56rem;
- }
- span {
- height: 0.64rem;
- line-height: 0.64rem;
- display: block;
- font-size: 0.28rem;
- }
- ul {
- position: absolute;
- left: 0;
- top: .64rem;
- z-index: 12;
- width: 100%;
- max-height: 3rem;
- overflow-y: auto;
- display: none;
- li {
- text-indent: 0px;
- width: 100%;
- background: #666;
- color: rgba(255, 255, 255, 0.89);
- text-align: center;
- font-size: .3rem;
- }
- &.active {
- display: block;
- }
- }
- }
- }
- </style>
|