material.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172
  1. <template>
  2. <div>
  3. <div class="material-wrapper" >
  4. <div class="order-nav">
  5. <div :class="activeType === '' ? 'active': ''" @click="ChangeList('')"><span>公司产品库</span></div>
  6. <div :class="activeType === 'mine' ? 'active' : ''" @click="ChangeList('mine')"><span>我的产品库</span></div>
  7. </div>
  8. <div class="search-content">
  9. <input type="text" placeholder="请输入您要查找的品牌或型号" v-model="seekKeyword" @keyup.13="searchSeek">
  10. <span @click="searchSeek" >
  11. <i class="iconfont icon-sousuo"></i>
  12. </span>
  13. </div>
  14. <div class="scrollContent" id="provider-wrapper">
  15. <div class="providerList" v-for="(item, index) in GetEnterpriseListData">
  16. <div class="top">
  17. <div class="icon" :class="item.standard ? 'standed' : 'istanded'"></div>
  18. <div class="text" style="width: 4.3rem">
  19. {{item.pcmpcode}}
  20. </div>
  21. <div class="text" style="width: 1rem;color: #666;font-size: 0.28rem">
  22. {{item.goods && item.goods.storeid === '33069557578d44e69bd91ad12d28a8d4' ? '寄售' : '自营' || '寄售'}}
  23. <!--{{item.goods && item.goods.selfSale === 1 ? '自营' : '寄售' || '-'}}-->
  24. </div>
  25. <div class="text" style="width: 1rem;color: #666;font-size: 0.28rem">
  26. {{item.goods && item.goods.autoPublish ? '已上架' : '已下架' }}
  27. </div>
  28. <!-- <div class="pms">
  29. {{item.storeid === '33069557578d44e69bd91ad12d28a8d4' ? '寄售' : '自营'}}
  30. </div>-->
  31. <!--<img class="store-type" v-if="item.goods && item.goods.storeid === '33069557578d44e69bd91ad12d28a8d4'" src="/images/mobile/product/consignment.png" alt="">-->
  32. <!--<img class="store-type" src="/images/mobile/product/self.png" alt="" v-else >=-->
  33. <img class="store-type" src="/images/mobile/product/mine_icon.png" v-if="item.addProductPerson"/>
  34. </div>
  35. <div class="middle">
  36. <div class="list" style="height: 0.46rem;">
  37. <div class="fl">
  38. <div class="name">品牌:</div>
  39. <div class="text">{{item.pbranden || item.pbrand || '-'}}</div>
  40. </div>
  41. <!--<div class="fr">-->
  42. <!--<div class="button" @click="update(item)">编辑</div>-->
  43. <!--<div class="button" @click="offProduct(item, index)">下架</div>-->
  44. <!--</div>-->
  45. </div>
  46. <div class="list">
  47. <div class="name">物料名称:</div>
  48. <div class="text">{{item.kind || item.kinden || '-'}}</div>
  49. <!--<div class="fr">-->
  50. <!--<div class="textinfo" v-if="item.goods && item.goods.breakUp">可拆卖</div>-->
  51. <!--</div>-->
  52. </div>
  53. <div class="list">
  54. <div class="name">规格:</div>
  55. <div class="text">{{item.spec || '-'}}</div>
  56. </div>
  57. <div class="list">
  58. <div class="fl">
  59. <div class="name">包装方式:</div>
  60. <div class="text">{{item.packaging || '无包装信息'}}</div>
  61. </div>
  62. <div class="fr">
  63. <div class="name">库存:</div>
  64. <div class="text">{{item.erpReserve || '-'}}</div>
  65. </div>
  66. </div>
  67. <div class="list">
  68. <div class="fl">
  69. <div class="name">最小包装数:</div>
  70. <div class="text">{{item.minPackQty || '-'}}</div>
  71. </div>
  72. <div class="fr">
  73. <div class="name">成本单价:</div>
  74. <div class="text">{{item.price || '-'}}</div>
  75. </div>
  76. </div>
  77. <div class="list">
  78. <div class="fl">
  79. <div class="name">最小起订量:</div>
  80. <div class="text">{{item.goods && item.goods.minBuyQty || '-'}}</div>
  81. </div>
  82. <div class="fr">
  83. <div class="name">交期(天):</div>
  84. <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>
  85. <div class="text" v-if="item.goods && item.goods.b2cMaxDelivery && (item.goods.b2cMaxDelivery == item.goods.b2cMinDelivery)" v-text="item.goods.b2cMinDelivery"></div>
  86. </div>
  87. </div>
  88. <!--<div class="list">-->
  89. <!--<div class="name">生产日期:</div>-->
  90. <!--<div class="text" :title="item.produceDate">{{item.produceDate || '-'}}</div>-->
  91. <!--</div>-->
  92. <div class="list">
  93. <div class="name left">价格梯度:</div>
  94. <div class="table left">
  95. <ul>
  96. <li class="title">
  97. <div>分段数量/PCS</div>
  98. <div>分段单价</div>
  99. </li>
  100. <template v-if="item.goods">
  101. <li v-for="price in item.goods.prices">
  102. <div>{{price.start}}+</div>
  103. <div v-if="item.currencyName == 'RMB'">¥{{price.rMBPrice}}</div>
  104. <div v-else>${{price.rMBPrice}}</div>
  105. </li>
  106. </template>
  107. </ul>
  108. </div>
  109. </div>
  110. </div>
  111. <div class="clearfix">
  112. <div class="pull-right add" @click="addProtoperson(item)" :class="{noadd: item.addProductPerson}">加入个人产品</div>
  113. <div class="pull-right look" @click="toAddpro(item, index)">编辑上架</div>
  114. <div class="pull-right look" @click="updateMateriel(item)">编辑物料</div>
  115. </div>
  116. </div>
  117. </div>
  118. <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
  119. <pull-up :fixId="'provider-wrapper'" :searchMore="isSearchSearchingMore" :allPage="EnterprisePage" :page="seekPage" @pullUpAction="getMoreSearch"></pull-up>
  120. </div>
  121. <!-- 编辑物料 -->
  122. <div class="update-materiel" v-show="showMateriel" @click="closeAlert">
  123. <div class="mobile-nav">
  124. <div class="mobile-header mobile-center-header">
  125. <a @click="showMateriel = false"><i class="iconfont icon-fanhui"></i></a>
  126. <p>编辑物料</p>
  127. <p class="en-name">
  128. <img :src="`/images/mobile/center/${user.data.enterprise && user.data.enterprise.uu ? 'en' : 'self'}.png`" alt="">{{currentEnName}}
  129. </p>
  130. </div>
  131. </div>
  132. <div class="update-materiel-wrapper" @click="clearInfo()">
  133. <template v-if="MaterielItem.standard === 1">
  134. <img class="imgUrl" src="/images/mobile/@2x/productDetail/Strand.png" />
  135. </template>
  136. <template v-else>
  137. <img class="imgUrl" src="/images/mobile/@2x/productDetail/isStrand.png" />
  138. </template>
  139. <div ref="scroll" style="height: 100%;overflow-y:scroll">
  140. <div>
  141. <div style="background: #fff;border: 1px solid #dcdcdc;padding-bottom: 0.5rem;">
  142. <div class="update-materiel-wrapper-list clearfix" :class="{'overHidden': MaterielItem.standard === 1}">
  143. <div class="name pull-left"><a class="red">*</a>品牌:</div>
  144. <template v-if="MaterielItem.standard === 1">
  145. {{MaterielItem.pbranden}}
  146. </template>
  147. <template v-else>
  148. <div class="input pull-left clearfix" :class="{'overHidden': MaterielItem.standard === 1}">
  149. <input type="text" v-model="MaterielItem.pbranden" placeholder="请勿填中文符号" @blur.stop="checkBrand" @input.stop="onBrandChange"/>
  150. <ul class="similar brand-similar-list" v-show="showSimilarBrandList && MaterielItem.pbranden">
  151. <li v-for="sBrand in similarBrand" @click.stop="setBrand(sBrand.nameEn)">{{sBrand.nameEn}}</li>
  152. </ul>
  153. <i class="iconfont icon-guanbi1" @click.stop="MaterielItem.pbranden = ''"></i>
  154. </div>
  155. </template>
  156. </div>
  157. <div class="update-materiel-wrapper-list clearfix" :class="{'overHidden': MaterielItem.standard === 1}">
  158. <div class="name pull-left"><a class="red">*</a>物料名称:</div>
  159. <template v-if="MaterielItem.standard === 1">
  160. {{MaterielItem.kind}}
  161. </template>
  162. <template v-else>
  163. <div class="input pull-left clearfix" style="width: 4.44rem">
  164. <!--<input type="text" v-model="MaterielItem.kind" @blur="checkCode" @input="onCodeChange" placeholder="请勿填中文符号">-->
  165. <input type="text" placeholder="请输入物料名称" v-model="MaterielItem.kind"/>
  166. <i class="iconfont icon-guanbi1" @click.stop="MaterielItem.kind = ''"></i>
  167. </div>
  168. </template>
  169. </div>
  170. <div class="update-materiel-wrapper-list clearfix">
  171. <div class="name pull-left"><a class="red">*</a>型号:</div>
  172. <template v-if="MaterielItem.standard === 1">
  173. {{MaterielItem.pcmpcode}}
  174. </template>
  175. <template v-else>
  176. <div class="input pull-left clearfix">
  177. <input type="text" v-model="MaterielItem.pcmpcode" @blur.stop="checkCode" @input.stop="onCodeChange" placeholder="请勿填中文符号">
  178. <ul class="similar" v-show="showSimilarCodeList && MaterielItem.pcmpcode">
  179. <li v-for="sCode in similarCode" @click.stop="setCode(sCode.code)">{{sCode.code}}</li>
  180. </ul>
  181. <!--<input type="text" placeholder="请输入型号" v-model="MaterielItem.pcmpcode"/>-->
  182. <i class="iconfont icon-guanbi1" @click.stop="MaterielItem.pcmpcode = ''"></i>
  183. </div>
  184. </template>
  185. </div>
  186. <div class="update-materiel-wrapper-list clearfix">
  187. <div class="name pull-left"><a class="red" style="opacity: 0">*</a>规格:</div>
  188. <div class="input pull-left clearfix">
  189. <input type="text" placeholder="请输入规格" v-model="MaterielItem.spec" @blur="checkSpec" @input="onSpecInput" maxlength="50"/>
  190. <i class="iconfont icon-guanbi1" @click.stop="MaterielItem.spec = ''"></i>
  191. </div>
  192. </div>
  193. <div class="update-materiel-wrapper-list clearfix">
  194. <div class="name pull-left"><a class="red" style="opacity: 0">*</a>最小包装数:</div>
  195. <div class="input pull-left clearfix" style="width: 4.15rem;">
  196. <input type="number" placeholder="请输入最小包装数" v-model="MaterielItem.minPackQty" maxlength="6"/>
  197. <i class="iconfont icon-guanbi1" @click.stop="MaterielItem.minPackQty = ''"></i>
  198. </div>
  199. </div>
  200. <div class="update-materiel-wrapper-list clearfix">
  201. <div class="name pull-left"><a class="red" style="opacity: 0">*</a>包装方式:</div>
  202. <div class="selectInput pull-left" @click.stop="showdropmenu('pack')">
  203. <span>{{MaterielItem.packaging || '无包装信息'}}</span>
  204. <img src="/images/mobile/product/drop_icon.png"/>
  205. <ul :class="{active : showDrop === 'pack' }">
  206. <li v-for="item in packObj" @click.stop="choosePack(item)">{{item}}</li>
  207. </ul>
  208. </div>
  209. </div>
  210. <div class="update-materiel-wrapper-list clearfix">
  211. <div class="name pull-left"><a class="red" style="opacity: 0">*</a>规格书:</div>
  212. </div>
  213. <div class="clearfix">
  214. <div class="update-materiel-wrapper-image">
  215. <a :href="MaterielItem.Regulpic" target="_blank" v-if="MaterielItem.IsSave">
  216. <img src="/images/mobile/openStore/pdf.png" style='width: 0.49rem; height: 0.49rem;display:block;margin: 0.2rem auto 0'/>
  217. </a>
  218. <img v-else src="/images/mobile/openStore/upload.png" style='width: 0.49rem; height: 0.49rem;display:block;margin: 0.2rem auto 0'/>
  219. <input type="file" class="com-input" @change="update" accept=".pdf" v-if="MaterielItem.standard !== 1"/>
  220. <span style="position: relative" v-if="MaterielItem.Regulpic === ''">上传规格书</span>
  221. </div>
  222. <span class="uploadImgInfo pull-left">
  223. <div class="name"><a class="red">*</a>仅支持PDF格式文件,大小不超过20M:</div>
  224. <div class="name"><a class="red">*</a>规格书上传后,将在两个工作日内完成审核</div>
  225. <div class="name"><a class="red">*</a>如审核不通过,将会以消息的形式通知您</div>
  226. <div class="name"><a class="red">*</a>已有原厂规格书的器件暂不开放上传</div>
  227. <div class="name"><a class="red">*</a>更新规格书需重新审核</div>
  228. </span>
  229. <div style="clear:both"></div>
  230. <div class="uploadImgBtn pull-left">上传规格书<input type="file" class="com-input" @change="update" accept=".pdf" /></div>
  231. </div>
  232. <div class="update-materiel-wrapper-list clearfix">
  233. <div class="name pull-left"><a class="red" style="opacity: 0">*</a>物料图片:</div>
  234. </div>
  235. <div class="clearfix">
  236. <div class="update-materiel-wrapper-image">
  237. <img :src="MaterielItem.cmpImg || '/images/mobile/openStore/upload.png'" style='width: 0.49rem; height: 0.49rem;display:block;margin: 0.2rem auto 0'/>
  238. <input type="file" class="com-input" @change="update2" accept="image/jpeg,image/jpg,image/png" />
  239. <span style="position: relative" v-if="MaterielItem.cmpImg === ''">上传图片</span>
  240. </div>
  241. <span class="uploadImgInfo pull-left" style="line-height: 1.09rem">
  242. <div class="name"><a class="red">*</a>仅支持JPG、PNG格式文件,大小不超过1M</div>
  243. </span>
  244. <div style="clear:both"></div>
  245. <div class="uploadImgBtn pull-left" style="margin-top: 0.15rem">上传图片<input type="file" class="com-input" @change="update2" accept="image/jpeg,image/jpg,image/png" /></div>
  246. </div>
  247. </div>
  248. <div class="update-materiel-wrapper-controll clearfix">
  249. <div class="pull-left" @click.stop="saveMateriel()">保存</div>
  250. <div class="pull-right" @click.stop="saveMateriel('a')">取消</div>
  251. </div>
  252. <div style="height: 1rem;position:relative"></div>
  253. </div>
  254. </div>
  255. </div>
  256. </div>
  257. <!-- 物料上下架 -->
  258. <div>
  259. <upoff-material ref="upoffMaterial" :chooseItem="MaterielItem" @upoffMaterial="upoffMaterial">
  260. </upoff-material>
  261. </div>
  262. <!-- /end 物料上下架 -->
  263. </div>
  264. </template>
  265. <script>
  266. import { RemindBox, PullUp } from '~components/mobile/common'
  267. import { upoffMaterial } from '~components/mobile/center'
  268. export default {
  269. layout: 'mobile',
  270. middleware: 'authenticated',
  271. name: 'mobileProduct',
  272. fetch ({store}) {
  273. return Promise.all([
  274. store.dispatch('loadStoreStatus', {op: 'check'})
  275. ])
  276. },
  277. data() {
  278. return {
  279. activeType: '',
  280. collectResult: '',
  281. timeoutCount: 0,
  282. isSearchSearchingMore: false, // 是否请求状态
  283. EnterprisePage: 0, // 总页数
  284. GetEnterpriseListData: [], // 当前数据源
  285. seekPage: 1, // 当前页数
  286. seekKeyword: '', // 搜索关键字
  287. MaterielItem: {}, // 当前选择编辑物料对象 或者 编辑上下架对象
  288. showMateriel: false, // 编辑物料弹窗
  289. showSimilarCodeList: false, // 型号选择框
  290. showSimilarBrandList: false, // 品牌选择框
  291. similarBrand: [],
  292. similarCode: [],
  293. packObj: ['Bulk-散装', 'Reel-卷装', 'Tape/Reel-编带', 'Tray-盘装', 'Tube-管装', '盒装', '袋装', '罐装', '瓶装', '桶装', '箱装', '其他'],
  294. showDrop: ''
  295. }
  296. },
  297. created() {
  298. this.getResourceProvidor()
  299. },
  300. computed: {
  301. // 是否展示空数据
  302. StateNone() {
  303. return this.GetEnterpriseListData.length === 0 && this.EnterprisePage === 0
  304. }
  305. },
  306. methods: {
  307. // 获取当前企业产品库
  308. GetEnterpriseList: function() {
  309. let params = {
  310. _status: 'all',
  311. count: 20,
  312. isStandard: true,
  313. keyword: this.seekKeyword || '',
  314. page: this.seekPage,
  315. sorting: { id: 'DESC' },
  316. type: 'nStandard'
  317. }
  318. return this.$http.get('/trade/products', { params })
  319. },
  320. // 获取当前个人产品库
  321. GetPersonList: function(cb) {
  322. let params = {
  323. _status: 'all',
  324. count: 20,
  325. isStandard: true,
  326. keyword: this.seekKeyword || '',
  327. page: this.seekPage,
  328. sorting: { id: 'DESC' },
  329. type: 'all'
  330. }
  331. return this.$http.get('/trade/products/person', { params })
  332. },
  333. ChangeList(_tp) {
  334. this.activeType = _tp
  335. this.seekPage = 0
  336. this.GetEnterpriseListData = []
  337. this.getResourceProvidor()
  338. },
  339. getResourceProvidor: function() {
  340. if (this.activeType === '') {
  341. this.GetEnterpriseList().then(res => {
  342. this.GetEnterpriseListData = this.GetEnterpriseListData.concat(res.data.content)
  343. this.EnterprisePage = res.data.totalPages
  344. this.isSearchSearchingMore = false
  345. })
  346. } else if (this.activeType === 'mine') {
  347. this.GetPersonList().then(res => {
  348. this.GetEnterpriseListData = this.GetEnterpriseListData.concat(res.data.content)
  349. this.EnterprisePage = res.data.totalPages
  350. this.isSearchSearchingMore = false
  351. })
  352. } else if (this.providerType === 'onLine') {
  353. this.GetOnlineList().then(res => {
  354. this.GetEnterpriseListData = this.GetEnterpriseListData.concat(res.data.content)
  355. this.EnterprisePage = res.data.totalPages
  356. this.isSearchSearchingMore = false
  357. })
  358. }
  359. },
  360. getMoreSearch: function () {
  361. this.seekPage++
  362. this.isSearchSearchingMore = true
  363. this.getResourceProvidor()
  364. },
  365. searchSeek: function() {
  366. this.ChangeList(this.activeType)
  367. },
  368. addProtoperson: function(item) {
  369. if (item.addProductPerson) {
  370. this.collectResult = '已在个人产品库'
  371. this.timeoutCount++
  372. return false
  373. }
  374. this.$http.post('/trade/products/person', [item.id])
  375. .then(response => {
  376. this.collectResult = '绑定成功'
  377. this.timeoutCount++
  378. this.seekPage = 1
  379. this.GetEnterpriseListData.splice(0, this.GetEnterpriseListData.length)
  380. this.GetEnterpriseListData = null
  381. this.GetEnterpriseListData = []
  382. this.reloadData()
  383. }, () => {
  384. this.collectResult = '绑定失败'
  385. this.timeoutCount++
  386. })
  387. },
  388. // 编辑上架
  389. toAddpro(item, index) {
  390. this.$item = this.baseUtils.deepCopy(item)
  391. this.$index = index
  392. this.MaterielItem = item
  393. if (!this.MaterielItem.goods) {
  394. this.$set(this.MaterielItem, 'goods', {
  395. prices: [{end: '',
  396. rMBNTPrice: '',
  397. rMBPrice: '',
  398. start: ''}],
  399. selfSale: 1,
  400. breakUp: false,
  401. autoPublish: false,
  402. productid: item.id
  403. })
  404. }
  405. this.$refs.upoffMaterial.show()
  406. },
  407. update2 (e) {
  408. // 上传图片
  409. let file = e.target.files[0]
  410. if (file.size > 1024 * 1024) {
  411. this.setRemindText(`上传文件不得超过1M`)
  412. return false
  413. }
  414. let param = new FormData()
  415. param.append('file', file, file.name)
  416. param.append('chunk', '0')
  417. let config = {
  418. headers: {'Content-Type': 'multipart/form-data'}
  419. }
  420. this.$http.post('/api/images', param, config)
  421. .then(response => {
  422. this.$set(this.MaterielItem, 'cmpImg', response.data[0].path)
  423. // this.MaterielItem.cmpImg = response.data[0].path
  424. })
  425. },
  426. update (e) {
  427. // 上传PDF
  428. let file = e.target.files[0]
  429. if (file.size > 1024 * 1024 * 20) {
  430. this.setRemindText(`上传文件不得超过20M`)
  431. return false
  432. }
  433. let param = new FormData()
  434. param.append('file', file, file.name)
  435. param.append('chunk', '0')
  436. let config = {
  437. headers: {'Content-Type': file.type}
  438. }
  439. this.$http.post('/file', param, config)
  440. .then(response => {
  441. this.MaterielItem.IsSave = true
  442. this.MaterielItem.Regulpic = response.data[0].path
  443. }, err => {
  444. console.log(err)
  445. })
  446. },
  447. // 编辑物料
  448. updateMateriel(item) {
  449. // Object.assign(this.MaterielItem, item, {Regulpic: '', IsSave: false, cmpImg: ''})
  450. this.MaterielItem = item
  451. this.$item = this.baseUtils.deepCopy(item)
  452. this.MaterielItem.IsSave = (item.productAttachSubmit && item.productAttachSubmit.uploadAttach || item.attach) ? true : false // 规格书是否存在
  453. this.$set(this.MaterielItem, 'cmpImg', item.cmpImg || '')
  454. this.$set(this.MaterielItem, 'Regulpic', (item.productAttachSubmit && item.productAttachSubmit.uploadAttach) || item.attach || '')
  455. this.showMateriel = true
  456. // this._initScroll()
  457. },
  458. // 编辑物料保存按钮
  459. saveMateriel(str) {
  460. if (str) {
  461. let _key1 = Object.keys(this.$item)
  462. let _key2 = Object.keys(this.MaterielItem)
  463. for (let i = 0; i < _key1.length; i++) {
  464. this.MaterielItem[_key2[i]] = this.$item[_key1[i]]
  465. }
  466. this.showMateriel = false
  467. return
  468. }
  469. if (this.MaterielItem.pbranden === '') {
  470. this.setRemindText('品牌不能为空')
  471. return
  472. } else if (this.MaterielItem.kind === '') {
  473. this.setRemindText('物料名称不能为空')
  474. return
  475. } else if (this.MaterielItem.minPackQty === '') {
  476. this.setRemindText('最小包装数不能为空')
  477. return
  478. } else if (this.MaterielItem.pcmpcode === '') {
  479. this.setRemindText('型号不能为空')
  480. return
  481. }
  482. this.MaterielItem.pcmpcode = this.MaterielItem.pcmpcode
  483. this.MaterielItem.pbranden = this.MaterielItem.pbranden
  484. let item = {
  485. id: this.MaterielItem.id,
  486. kind : this.MaterielItem.kind,
  487. pbranden: this.MaterielItem.pbranden,
  488. pcmpcode: this.MaterielItem.pcmpcode,
  489. spec: this.MaterielItem.spec,
  490. url: this.MaterielItem.Regulpic || '',
  491. cmpImg: this.MaterielItem.cmpImg, // 物料图片
  492. packaging: this.MaterielItem.packaging, // 包装
  493. minPackQty: this.MaterielItem.minPackQty // 最小包装数
  494. }
  495. this.$http.post(`/trade/products/update/product?attachUrl=${item.url}`, item).then(res => {
  496. if (res.data.success) {
  497. this.setRemindText('修改成功')
  498. this.showMateriel = false
  499. this.page = 1
  500. this.GetEnterpriseListData = null
  501. this.GetEnterpriseListData = []
  502. this.getResourceProvidor()
  503. } else {
  504. this.setRemindText(res.data.message)
  505. }
  506. })
  507. },
  508. // 显示包装选择
  509. showdropmenu(str) {
  510. this.showDrop = str
  511. },
  512. // 选择包装
  513. choosePack(item) {
  514. this.showDrop = ''
  515. this.MaterielItem.packaging = item
  516. },
  517. // 关闭包装选项
  518. closeAlert() {
  519. this.MaterielItem = this.$item
  520. this.showDrop = ''
  521. },
  522. clearInfo() {
  523. this.showSimilarCodeList = false
  524. this.showSimilarBrandList = false
  525. },
  526. checkBrand: function () {
  527. // this.MaterielItem.brand = this.MaterielItem.brand && this.MaterielItem.brand !== ''
  528. if (!this.MaterielItem.pbranden || this.MaterielItem.pbranden === '') {
  529. this.setRemindText('品牌不能为空')
  530. }
  531. return this.MaterielItem.pbranden
  532. },
  533. checkCode: function () {
  534. if (!this.MaterielItem.pcmpcode || this.MaterielItem.pcmpcode === '') {
  535. this.setRemindText('型号不能为空')
  536. }
  537. return this.MaterielItem.pcmpcode
  538. },
  539. onCodeChange: function () {
  540. this.MaterielItem.pcmpcode = this.MaterielItem.pcmpcode.trim()
  541. if ((/[^\x00-\xff]/g).test(this.MaterielItem.pcmpcode)) {
  542. let chineseIndex = -1
  543. for (let i = 0; i < this.MaterielItem.pcmpcode.length; i++) {
  544. if ((/[^\x00-\xff]/g).test(this.MaterielItem.pcmpcode.charAt(i))) {
  545. chineseIndex = i
  546. break
  547. }
  548. }
  549. this.MaterielItem.pcmpcode = this.baseUtils.cutOutString(this.MaterielItem.pcmpcode, chineseIndex)
  550. } else if (this.MaterielItem.pcmpcode && this.baseUtils.getRealLen(this.MaterielItem.pcmpcode) > 100) {
  551. this.MaterielItem.pcmpcode = this.baseUtils.cutOutString(this.MaterielItem.pcmpcode, 100)
  552. } else {
  553. this.getSimilarCode()
  554. }
  555. },
  556. onBrandChange: function () {
  557. this.MaterielItem.pbranden = this.MaterielItem.pbranden.trim()
  558. if ((/[^\x00-\xff]/g).test(this.MaterielItem.pbranden)) {
  559. let chineseIndex = -1
  560. for (let i = 0; i < this.MaterielItem.pbranden.length; i++) {
  561. if ((/[^\x00-\xff]/g).test(this.MaterielItem.pbranden.charAt(i)) && !(/[\u4e00-\u9fa5]/).test(this.MaterielItem.pbranden.charAt(i))) {
  562. chineseIndex = i
  563. break
  564. }
  565. }
  566. if (chineseIndex > -1) {
  567. this.MaterielItem.pbranden = this.MaterielItem.pbranden.substring(0, chineseIndex)
  568. }
  569. } else if (this.MaterielItem.pbranden && this.baseUtils.getRealLen(this.MaterielItem.pbranden) > 50) {
  570. this.MaterielItem.pbranden = this.baseUtils.cutOutString(this.MaterielItem.pbranden, 50)
  571. } else {
  572. this.getSimilarBrand()
  573. }
  574. },
  575. getSimilarBrand: function () {
  576. if (this.MaterielItem.pbranden) {
  577. this.$http.get('/search/similarBrands', {params: {keyword: this.MaterielItem.pbranden}})
  578. .then(response => {
  579. this.similarBrand = response.data
  580. this.showSimilarBrandList = response.data.length > 0
  581. })
  582. } else {
  583. this.showSimilarBrandList = false
  584. }
  585. },
  586. getSimilarCode: function () {
  587. if (this.MaterielItem.pcmpcode) {
  588. this.$http.get('/search/similarComponents', {params: {keyword: this.MaterielItem.pcmpcode}})
  589. .then(response => {
  590. this.similarCode = response.data
  591. this.showSimilarCodeList = response.data.length > 0
  592. })
  593. } else {
  594. this.showSimilarCodeList = false
  595. }
  596. },
  597. setCode: function (code) {
  598. this.MaterielItem.pcmpcode = code
  599. this.showSimilarCodeList = false
  600. },
  601. setBrand: function (brand) {
  602. this.MaterielItem.pbranden = brand
  603. this.showSimilarBrandList = false
  604. },
  605. setRemindText: function (str) {
  606. this.collectResult = str
  607. this.timeoutCount++
  608. },
  609. checkSpec: function () {
  610. // let nullStrFlag =
  611. // this.MaterielItem.spec = nullStrFlag
  612. if (!this.baseUtils.checkNullStr(this.MaterielItem.spec)) {
  613. this.setRemindText('规格输入不合法')
  614. }
  615. return this.MaterielItem.spec
  616. },
  617. onSpecInput: function () {
  618. if (this.MaterielItem.spec && this.baseUtils.getRealLen(this.MaterielItem.spec) > 100) {
  619. this.MaterielItem.spec = this.baseUtils.cutOutString(this.MaterielItem.spec, 100)
  620. }
  621. },
  622. upoffMaterial(type) {
  623. if (!type) {
  624. this.showMateriel = false
  625. this.page = 1
  626. this.GetEnterpriseListData = null
  627. this.GetEnterpriseListData = []
  628. this.getResourceProvidor()
  629. } else {
  630. this.GetEnterpriseListData[this.$index] = this.$item
  631. console.log(this.GetEnterpriseListData[this.$index])
  632. // this.MaterielItem = this.$item
  633. }
  634. }
  635. // _initScroll() {
  636. // this.$nextTick(() => {
  637. // if (!this.scroll) {
  638. // this.scroll = new BScroll(this.$refs.scroll, {
  639. // click: true
  640. // })
  641. // } else {
  642. // this.scroll.refresh()
  643. // }
  644. // })
  645. // }
  646. },
  647. components: {
  648. RemindBox,
  649. PullUp,
  650. upoffMaterial
  651. }
  652. }
  653. </script>
  654. <style lang="scss">
  655. @mixin overFlowHidden {
  656. overflow: hidden;
  657. text-overflow: ellipsis;
  658. white-space: nowrap;
  659. }
  660. @mixin lineHeight($value) {
  661. height: $value;
  662. line-height: $value;
  663. }
  664. .material-wrapper {
  665. background: #f1f3f6;
  666. /*margin: 1.26rem 0 0.98rem 0;*/
  667. /*height: calc(100vh - 1.26rem - 0.98rem);*/
  668. position: fixed;
  669. width: 100%;
  670. top: 1.26rem;
  671. bottom: 0.98rem;
  672. overflow-y: auto;
  673. z-index: 100;
  674. .order-nav {
  675. background: #fff;
  676. div {
  677. height: 0.82rem;
  678. line-height: 0.82rem;
  679. display: inline-block;
  680. width: 50%;
  681. text-align: center;
  682. font-size: .28rem;
  683. color: #666;
  684. &.active span{
  685. color: #3f84f6;
  686. border-bottom: 0.04rem solid #3f84f6;
  687. padding-bottom: 0.2rem;
  688. }
  689. }
  690. }
  691. .search-content {
  692. text-align: center;
  693. padding: .25rem 0;
  694. input {
  695. border: 1px solid #376ff3;
  696. }
  697. span {
  698. }
  699. }
  700. .scrollContent {
  701. height: calc(100vh - 3.19rem - 0.98rem);
  702. overflow-y: auto;
  703. .providerList {
  704. margin-bottom: 0.24rem;
  705. .top {
  706. position: relative;
  707. padding: 0 0.24rem;
  708. border-bottom: 1px solid #d3d3d3;
  709. height: 0.9rem;
  710. line-height: 0.9rem;
  711. color: #0067e7;
  712. font-size: 0.3rem;
  713. background: #fff;
  714. &::after {
  715. clear: both;
  716. display: block;
  717. content: ' ';
  718. visibility: hidden;
  719. zoom: 1;
  720. }
  721. .text {
  722. width: 5.4rem;
  723. }
  724. .pms {
  725. color: #f57710;
  726. border: 1px solid #f57710;
  727. border-radius: 0.4rem;
  728. background: #fff;
  729. font-size: 0.24rem;
  730. height: 0.4rem;
  731. line-height: 0.4rem;
  732. width: 0.8rem;
  733. text-align: center;
  734. float: right;
  735. margin-top: 0.25rem;
  736. }
  737. .store-type {
  738. width: .77rem;
  739. height: .77rem;
  740. position: absolute;
  741. right: 0;
  742. top: 0;
  743. }
  744. .icon {
  745. width: 0.6rem;
  746. height: 0.36rem;
  747. line-height: 0.36rem;
  748. margin-top: 0.27rem;
  749. float: left;
  750. background-size: 100%;
  751. background-repeat: no-repeat;
  752. margin-right: 0.12rem;
  753. text-align: center;
  754. &.istanded {
  755. background-image: url('/images/mobile/@2x/istanded.png')
  756. }
  757. &.standed {
  758. background-image: url('/images/mobile/@2x/standed.png')
  759. }
  760. }
  761. .person-flag {
  762. width: .75rem;
  763. position: absolute;
  764. right: 0;
  765. }
  766. .text {
  767. float: left;
  768. width: 6.3rem;
  769. overflow: hidden;
  770. text-overflow: ellipsis;
  771. white-space: nowrap;
  772. }
  773. }
  774. .middle {
  775. padding: 0.24rem 0.24rem;
  776. background: #fff;
  777. .pms {
  778. color: #f57710;
  779. border: 1px solid #f57710;
  780. border-radius: 0.4rem;
  781. background: #fff;
  782. font-size: 0.24rem;
  783. height: 0.4rem;
  784. line-height: 0.4rem;
  785. width: 0.8rem;
  786. text-align: center;
  787. }
  788. .list {
  789. /*height: 0.46rem;*/
  790. .left {
  791. float: left;
  792. overflow: hidden;
  793. text-overflow: ellipsis;
  794. white-space: nowrap;
  795. }
  796. .textinfo {
  797. color: #0067e7;
  798. font-size: 0.3rem;
  799. }
  800. .button {
  801. font-size: 0.26rem;
  802. color: #fff;
  803. width: 0.92rem;
  804. text-align: center;
  805. border-radius: 5px;
  806. /*border:1px solid #1a58dd;*/
  807. background: #1a58dd;
  808. display: inline-block;
  809. margin-right: 0.2rem;
  810. line-height: 0.33rem;
  811. height: 0.37rem;
  812. }
  813. margin-bottom: 0.18rem;
  814. &::after{
  815. clear: both;
  816. display: block;
  817. content: ' ';
  818. visibility: hidden;
  819. zoom: 1;
  820. }
  821. .fl {
  822. width: 4.3rem;
  823. float: left;
  824. overflow: hidden;
  825. text-overflow: ellipsis;
  826. white-space: nowrap;
  827. }
  828. .fr {
  829. text-align: left;
  830. width: 2.6rem;
  831. overflow: hidden;
  832. text-overflow: ellipsis;
  833. white-space: nowrap;
  834. }
  835. &.list-long {
  836. .fl {
  837. width: 100% !important;
  838. }
  839. }
  840. .name {
  841. color: #666;
  842. font-size: 0.3rem;
  843. display: inline-block;
  844. }
  845. .text {
  846. display: inline-block;
  847. color: #333;
  848. font-size: 0.3rem
  849. }
  850. .table {
  851. width: 5.5rem;
  852. margin-bottom: 0;
  853. margin-top: 0;
  854. li {
  855. height: 0.43rem;
  856. line-height: 0.43rem;
  857. border-left: .01rem solid #c5c5c5;
  858. font-size: .28rem;
  859. &::after {
  860. clear: both;
  861. display: block;
  862. content: ' ';
  863. visibility: hidden;
  864. zoom: 1;
  865. }
  866. div {
  867. text-align: center;
  868. width: 50%;
  869. float: left;
  870. border-right: .01rem solid #c5c5c5;
  871. border-bottom: .01rem solid #c5c5c5;
  872. }
  873. &:nth-child(odd) {
  874. background: #ddd;
  875. color: #666;
  876. font-size: 0.28rem;
  877. }
  878. &:nth-child(even) {
  879. background: #fcfcfc;
  880. color: #666;
  881. font-size: 0.28rem;
  882. }
  883. &:nth-last-of-type(1){
  884. color: #f31919;
  885. }
  886. &.title {
  887. font-size: 0.28rem;
  888. color: #333;
  889. }
  890. }
  891. }
  892. }
  893. }
  894. div.clearfix {
  895. padding: 0.2rem 0.2rem;
  896. border-top: 1px solid #d3d3d3;
  897. background: #fff;
  898. div{
  899. width: 2.1rem;
  900. height: .6rem;
  901. text-align: center;
  902. line-height: .6rem;
  903. border-radius: 3px;
  904. margin-right: .2rem;
  905. &.look {
  906. color: #008bf7;
  907. border: 1px solid #008bf7;
  908. }
  909. &.add {
  910. background: #fff;
  911. color: #f57710;
  912. border: 1px solid #f57710;
  913. }
  914. &.noadd{
  915. background: #cccbcb;
  916. color: #fff;
  917. border:1px solid #cccbcb;
  918. }
  919. }
  920. }
  921. }
  922. }
  923. }
  924. .update-materiel {
  925. position: fixed;
  926. z-index: 1000;
  927. background: #f1f3f6;
  928. /*background: red;*/
  929. top: 0;
  930. left: 0;
  931. bottom: 0;
  932. right: 0;
  933. .mobile-header{
  934. position: fixed;
  935. top: 0;
  936. z-index: 100;
  937. width:100%;
  938. height: 1.26rem;
  939. line-height: 1.26rem;
  940. /*border-bottom:.01rem solid #ccc;*/
  941. background: #3e82f5;
  942. padding:0 .2rem 0 .1rem;
  943. color:#fff;
  944. }
  945. .mobile-header p{
  946. overflow: hidden;
  947. text-overflow: ellipsis;
  948. white-space: nowrap;
  949. font-size:.36rem;
  950. text-align: center;
  951. width: 6rem;
  952. padding-left: 1rem;
  953. }
  954. .mobile-center-header p.en-name {
  955. font-size: .3rem;
  956. }
  957. .mobile-header a{
  958. font-size:.28rem;
  959. color:#fff;
  960. position: absolute;
  961. }
  962. .mobile-header a i{
  963. font-size: .48rem;
  964. margin-right: -.1rem;
  965. }
  966. .update-materiel-wrapper {
  967. border-radius: 0.07rem;
  968. position: fixed;
  969. overflow: hidden;
  970. bottom: 0;
  971. top: 1.46rem;
  972. left: 0.2rem;
  973. right: 0.2rem;
  974. .imgUrl{
  975. position: absolute;
  976. width: 0.94rem;
  977. height: 0.94rem;
  978. right: 0;
  979. top: 0;
  980. z-index: 1;
  981. }
  982. .update-materiel-wrapper-image {
  983. width: 1.09rem;
  984. height: 1.09rem;
  985. border: 1px solid #dcdcdc;
  986. border-radius: 0.07rem;
  987. position: relative;
  988. margin: 0rem 0 0 0.5rem;
  989. text-align: center;
  990. position: relative;
  991. float: left;
  992. span {
  993. color: #b2b2b2;
  994. font-size: 0.2rem;
  995. }
  996. .com-input {
  997. width: 100%;
  998. height: 100%;
  999. text-align: center;
  1000. position: absolute;
  1001. bottom: 0;
  1002. left: 0;
  1003. opacity: 0;
  1004. display: inline-block !important;
  1005. }
  1006. }
  1007. .uploadImgBtn {
  1008. color: #fff;
  1009. font-size: .28rem;
  1010. width: 1.51rem;
  1011. @include lineHeight(0.47rem);
  1012. border-radius: 0.07rem;
  1013. background: #f9b209;
  1014. text-align: center;
  1015. margin: 0rem 0 0 0.3rem;
  1016. position: relative;
  1017. .com-input {
  1018. width: 100%;
  1019. height: 100%;
  1020. text-align: center;
  1021. position: absolute;
  1022. bottom: 0;
  1023. left: 0;
  1024. opacity: 0;
  1025. display: inline-block !important;
  1026. }
  1027. }
  1028. .uploadImgInfo {
  1029. font-size: 0.24rem;
  1030. margin-left: 0.44rem;
  1031. color: #999;
  1032. .red {
  1033. color: red;
  1034. }
  1035. }
  1036. .update-materiel-wrapper-list {
  1037. margin-left:0.28rem;
  1038. margin-top: 0.3rem;
  1039. line-height: 0.7rem;
  1040. .red {color: #ea0f42}
  1041. .name {color: #666;font-size: 0.28rem}
  1042. .input {
  1043. position: relative;
  1044. width: 5rem;
  1045. line-height: 0.7rem;
  1046. height: 0.7rem;
  1047. border: 1px solid #dcdcdc;
  1048. input {
  1049. text-indent: 5px;
  1050. border: 0;
  1051. border-radius: 0.07rem;
  1052. line-height: 0.64rem;
  1053. height: 0.64rem;
  1054. width: 90%;
  1055. font-size:0.28rem;
  1056. float: left;
  1057. color: #333;
  1058. }
  1059. i {
  1060. font-size: 0.16rem;
  1061. vertical-align: top;
  1062. color: #666;
  1063. float: right;
  1064. margin-right: 0.05rem
  1065. }
  1066. .similar {
  1067. position: absolute;
  1068. width:100%;
  1069. max-height: 2.5rem;
  1070. overflow-y: auto;
  1071. z-index: 12;
  1072. border: 1px solid #7e7e7e;
  1073. border-radius: .05rem;
  1074. top: .5rem;
  1075. background: #fff;
  1076. li {
  1077. height: .5rem;
  1078. line-height: .5rem;
  1079. font-size: .26rem;
  1080. color: #999;
  1081. padding-left: .19rem;
  1082. &:focus, &:active, &:hover {
  1083. background: #999;
  1084. color: #fff;
  1085. }
  1086. }
  1087. }
  1088. }
  1089. }
  1090. .update-materiel-wrapper-list2 {
  1091. margin-left: 0.28rem;
  1092. margin-top: 0.3rem;
  1093. }
  1094. .update-materiel-wrapper-controll {
  1095. margin: 0.4rem 0.2rem 0;
  1096. div {
  1097. width: 48%;
  1098. background: #b5b5b5;
  1099. font-size: 0.3rem;
  1100. color: #fafbfc;
  1101. text-align: center;
  1102. @include lineHeight(0.62rem);
  1103. border-radius: 0.07rem;
  1104. &:first-child {
  1105. background: #3f84f6;
  1106. }
  1107. }
  1108. }
  1109. }
  1110. .selectInput {
  1111. display: inline-block;
  1112. position: relative;
  1113. vertical-align: top;
  1114. height: 0.7rem;
  1115. line-height: 0.7rem;
  1116. border: 1px solid #d2d2d2;
  1117. border-radius: 2px;
  1118. width: 4.44rem;
  1119. text-indent: 0.12rem;
  1120. img {
  1121. position: absolute;
  1122. width: 0.17rem;
  1123. height: 0.11rem;
  1124. right:0.1rem;
  1125. top: 0.28rem;
  1126. }
  1127. &.selectInput2 {
  1128. width: 1.56rem;
  1129. }
  1130. span {
  1131. height: 0.64rem;
  1132. line-height: 0.64rem;
  1133. display: block;
  1134. font-size: 0.28rem;
  1135. }
  1136. ul {
  1137. position: absolute;
  1138. left: 0;
  1139. top: .64rem;
  1140. z-index: 12;
  1141. width: 100%;
  1142. max-height: 3rem;
  1143. overflow-y: auto;
  1144. display: none;
  1145. li {
  1146. text-indent: 0px;
  1147. width: 100%;
  1148. background: #666;
  1149. color: rgba(255, 255, 255, 0.89);
  1150. text-align: center;
  1151. font-size: .3rem;
  1152. }
  1153. &.active {
  1154. display: block;
  1155. }
  1156. }
  1157. }
  1158. }
  1159. </style>