material.vue 39 KB

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