material.vue 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134
  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 === 1 ? '自营' : '寄售' || '-'}}
  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. <!-- 物料上下架 -->
  257. <div>
  258. <upoff-material ref="upoffMaterial" :chooseItem="MaterielItem">
  259. </upoff-material>
  260. </div>
  261. <!-- /end 物料上下架 -->
  262. </div>
  263. </template>
  264. <script>
  265. import { RemindBox, PullUp } from '~components/mobile/common'
  266. import { upoffMaterial } from '~components/mobile/center'
  267. export default {
  268. layout: 'mobile',
  269. middleware: 'authenticated',
  270. name: 'mobileProduct',
  271. data() {
  272. return {
  273. activeType: '',
  274. collectResult: '',
  275. timeoutCount: 0,
  276. isSearchSearchingMore: false, // 是否请求状态
  277. EnterprisePage: 0, // 总页数
  278. GetEnterpriseListData: [], // 当前数据源
  279. seekPage: 1, // 当前页数
  280. seekKeyword: '', // 搜索关键字
  281. MaterielItem: {}, // 当前选择编辑物料对象 或者 编辑上下架对象
  282. showMateriel: false, // 编辑物料弹窗
  283. showSimilarCodeList: false, // 型号选择框
  284. showSimilarBrandList: false, // 品牌选择框
  285. similarBrand: [],
  286. similarCode: [],
  287. packObj: ['Bulk-散装', 'Reel-卷装', 'Tape/Reel-编带', 'Tray-盘装', 'Tube-管装', '盒装', '袋装', '罐装', '瓶装', '桶装', '箱装', '其他'],
  288. showDrop: ''
  289. }
  290. },
  291. created() {
  292. this.getResourceProvidor()
  293. },
  294. computed: {
  295. // 是否展示空数据
  296. StateNone() {
  297. return this.GetEnterpriseListData.length === 0 && this.EnterprisePage === 0
  298. }
  299. },
  300. methods: {
  301. // 获取当前企业产品库
  302. GetEnterpriseList: function() {
  303. let params = {
  304. _status: 'all',
  305. count: 20,
  306. isStandard: true,
  307. keyword: this.seekKeyword || '',
  308. page: this.seekPage,
  309. sorting: { id: 'DESC' },
  310. type: 'nStandard'
  311. }
  312. return this.$http.get('/trade/products', { params })
  313. },
  314. // 获取当前个人产品库
  315. GetPersonList: function(cb) {
  316. let params = {
  317. _status: 'all',
  318. count: 20,
  319. isStandard: true,
  320. keyword: this.seekKeyword || '',
  321. page: this.seekPage,
  322. sorting: { id: 'DESC' },
  323. type: 'all'
  324. }
  325. return this.$http.get('/trade/products/person', { params })
  326. },
  327. ChangeList(_tp) {
  328. this.activeType = _tp
  329. this.seekPage = 0
  330. this.GetEnterpriseListData = []
  331. this.getResourceProvidor()
  332. },
  333. getResourceProvidor: function() {
  334. if (this.activeType === '') {
  335. this.GetEnterpriseList().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.activeType === 'mine') {
  341. this.GetPersonList().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.providerType === 'onLine') {
  347. this.GetOnlineList().then(res => {
  348. this.GetEnterpriseListData = this.GetEnterpriseListData.concat(res.data.content)
  349. this.EnterprisePage = res.data.totalPages
  350. this.isSearchSearchingMore = false
  351. })
  352. }
  353. },
  354. getMoreSearch: function () {
  355. this.seekPage++
  356. this.isSearchSearchingMore = true
  357. this.getResourceProvidor()
  358. },
  359. searchSeek: function() {
  360. this.ChangeList(this.activeType)
  361. },
  362. addProtoperson: function(item) {
  363. if (item.addProductPerson) {
  364. this.collectResult = '已在个人产品库'
  365. this.timeoutCount++
  366. return false
  367. }
  368. this.$http.post('/trade/products/person', [item.id])
  369. .then(response => {
  370. this.collectResult = '绑定成功'
  371. this.timeoutCount++
  372. this.seekPage = 1
  373. this.GetEnterpriseListData.splice(0, this.GetEnterpriseListData.length)
  374. this.GetEnterpriseListData = null
  375. this.GetEnterpriseListData = []
  376. this.reloadData()
  377. }, () => {
  378. this.collectResult = '绑定失败'
  379. this.timeoutCount++
  380. })
  381. },
  382. toAddpro(item) {
  383. this.MaterielItem = item
  384. this.$item = this.baseUtils.deepCopy(item)
  385. console.log(this.MaterielItem)
  386. this.$refs.upoffMaterial.show()
  387. },
  388. update2 (e) {
  389. // 上传图片
  390. let file = e.target.files[0]
  391. if (file.size > 1024 * 1024) {
  392. this.setRemindText(`上传文件不得超过1M`)
  393. return false
  394. }
  395. let param = new FormData()
  396. param.append('file', file, file.name)
  397. param.append('chunk', '0')
  398. let config = {
  399. headers: {'Content-Type': 'multipart/form-data'}
  400. }
  401. this.$http.post('/api/images', param, config)
  402. .then(response => {
  403. this.$set(this.MaterielItem, 'cmpImg', response.data[0].path)
  404. // this.MaterielItem.cmpImg = response.data[0].path
  405. })
  406. },
  407. update (e) {
  408. // 上传PDF
  409. let file = e.target.files[0]
  410. if (file.size > 1024 * 1024 * 20) {
  411. this.setRemindText(`上传文件不得超过20M`)
  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': file.type}
  419. }
  420. this.$http.post('/file', param, config)
  421. .then(response => {
  422. this.MaterielItem.IsSave = true
  423. this.MaterielItem.Regulpic = response.data[0].path
  424. }, err => {
  425. console.log(err)
  426. })
  427. },
  428. // 编辑物料
  429. updateMateriel(item) {
  430. // Object.assign(this.MaterielItem, item, {Regulpic: '', IsSave: false, cmpImg: ''})
  431. this.MaterielItem = item
  432. this.$item = this.baseUtils.deepCopy(item)
  433. this.MaterielItem.IsSave = (item.productAttachSubmit && item.productAttachSubmit.uploadAttach || item.attach) ? true : false // 规格书是否存在
  434. this.$set(this.MaterielItem, 'cmpImg', item.cmpImg || '')
  435. this.$set(this.MaterielItem, 'Regulpic', (item.productAttachSubmit && item.productAttachSubmit.uploadAttach) || item.attach || '')
  436. this.showMateriel = true
  437. // this._initScroll()
  438. },
  439. // 编辑物料保存按钮
  440. saveMateriel(str) {
  441. if (str) {
  442. let _key1 = Object.keys(this.$item)
  443. let _key2 = Object.keys(this.MaterielItem)
  444. for (let i = 0; i < _key1.length; i++) {
  445. this.MaterielItem[_key2[i]] = this.$item[_key1[i]]
  446. }
  447. this.showMateriel = false
  448. return
  449. }
  450. if (this.MaterielItem.pbranden === '') {
  451. this.setRemindText('品牌不能为空')
  452. return
  453. } else if (this.MaterielItem.kind === '') {
  454. this.setRemindText('物料名称不能为空')
  455. return
  456. } else if (this.MaterielItem.pcmpcode === '') {
  457. this.setRemindText('型号不能为空')
  458. return
  459. }
  460. this.MaterielItem.pcmpcode = this.MaterielItem.pcmpcode
  461. this.MaterielItem.pbranden = this.MaterielItem.pbranden
  462. let item = {
  463. id: this.MaterielItem.id,
  464. kind : this.MaterielItem.kind,
  465. pbranden: this.MaterielItem.pbranden,
  466. pcmpcode: this.MaterielItem.pcmpcode,
  467. spec: this.MaterielItem.spec,
  468. url: ''
  469. }
  470. this.$http.post('/trade/products/update/product?attachUrl=', item).then(res => {
  471. if (res.data.success) {
  472. this.setRemindText('修改成功')
  473. this.showMateriel = false
  474. this.page = 1
  475. this.GetEnterpriseListData = null
  476. this.GetEnterpriseListData = []
  477. this.getResourceProvidor()
  478. } else {
  479. this.setRemindText(res.data.message)
  480. }
  481. })
  482. },
  483. // 显示包装选择
  484. showdropmenu(str) {
  485. this.showDrop = str
  486. },
  487. // 选择包装
  488. choosePack(item) {
  489. this.showDrop = ''
  490. this.MaterielItem.packaging = item
  491. },
  492. // 关闭包装选项
  493. closeAlert() {
  494. this.MaterielItem = this.$item
  495. this.showDrop = ''
  496. },
  497. clearInfo() {
  498. this.showSimilarCodeList = false
  499. this.showSimilarBrandList = false
  500. },
  501. checkBrand: function () {
  502. // this.MaterielItem.brand = this.MaterielItem.brand && this.MaterielItem.brand !== ''
  503. if (!this.MaterielItem.pbranden || this.MaterielItem.pbranden === '') {
  504. this.setRemindText('品牌不能为空')
  505. }
  506. return this.MaterielItem.pbranden
  507. },
  508. checkCode: function () {
  509. if (!this.MaterielItem.pcmpcode || this.MaterielItem.pcmpcode === '') {
  510. this.setRemindText('型号不能为空')
  511. }
  512. return this.MaterielItem.pcmpcode
  513. },
  514. onCodeChange: function () {
  515. this.MaterielItem.pcmpcode = this.MaterielItem.pcmpcode.trim()
  516. if ((/[^\x00-\xff]/g).test(this.MaterielItem.pcmpcode)) {
  517. let chineseIndex = -1
  518. for (let i = 0; i < this.MaterielItem.pcmpcode.length; i++) {
  519. if ((/[^\x00-\xff]/g).test(this.MaterielItem.pcmpcode.charAt(i))) {
  520. chineseIndex = i
  521. break
  522. }
  523. }
  524. this.MaterielItem.pcmpcode = this.baseUtils.cutOutString(this.MaterielItem.pcmpcode, chineseIndex)
  525. } else if (this.MaterielItem.pcmpcode && this.baseUtils.getRealLen(this.MaterielItem.pcmpcode) > 100) {
  526. this.MaterielItem.pcmpcode = this.baseUtils.cutOutString(this.MaterielItem.pcmpcode, 100)
  527. } else {
  528. this.getSimilarCode()
  529. }
  530. },
  531. onBrandChange: function () {
  532. this.MaterielItem.pbranden = this.MaterielItem.pbranden.trim()
  533. if ((/[^\x00-\xff]/g).test(this.MaterielItem.pbranden)) {
  534. let chineseIndex = -1
  535. for (let i = 0; i < this.MaterielItem.pbranden.length; i++) {
  536. if ((/[^\x00-\xff]/g).test(this.MaterielItem.pbranden.charAt(i)) && !(/[\u4e00-\u9fa5]/).test(this.MaterielItem.pbranden.charAt(i))) {
  537. chineseIndex = i
  538. break
  539. }
  540. }
  541. if (chineseIndex > -1) {
  542. this.MaterielItem.pbranden = this.MaterielItem.pbranden.substring(0, chineseIndex)
  543. }
  544. } else if (this.MaterielItem.pbranden && this.baseUtils.getRealLen(this.MaterielItem.pbranden) > 50) {
  545. this.MaterielItem.pbranden = this.baseUtils.cutOutString(this.MaterielItem.pbranden, 50)
  546. } else {
  547. this.getSimilarBrand()
  548. }
  549. },
  550. getSimilarBrand: function () {
  551. if (this.MaterielItem.pbranden) {
  552. this.$http.get('/search/similarBrands', {params: {keyword: this.MaterielItem.pbranden}})
  553. .then(response => {
  554. this.similarBrand = response.data
  555. this.showSimilarBrandList = response.data.length > 0
  556. })
  557. } else {
  558. this.showSimilarBrandList = false
  559. }
  560. },
  561. getSimilarCode: function () {
  562. if (this.MaterielItem.pcmpcode) {
  563. this.$http.get('/search/similarComponents', {params: {keyword: this.MaterielItem.pcmpcode}})
  564. .then(response => {
  565. this.similarCode = response.data
  566. this.showSimilarCodeList = response.data.length > 0
  567. })
  568. } else {
  569. this.showSimilarCodeList = false
  570. }
  571. },
  572. setCode: function (code) {
  573. this.MaterielItem.pcmpcode = code
  574. this.showSimilarCodeList = false
  575. },
  576. setBrand: function (brand) {
  577. this.MaterielItem.pbranden = brand
  578. this.showSimilarBrandList = false
  579. },
  580. setRemindText: function (str) {
  581. this.collectResult = str
  582. this.timeoutCount++
  583. },
  584. checkSpec: function () {
  585. // let nullStrFlag =
  586. // this.MaterielItem.spec = nullStrFlag
  587. if (!this.baseUtils.checkNullStr(this.MaterielItem.spec)) {
  588. this.setRemindText('规格输入不合法')
  589. }
  590. return this.MaterielItem.spec
  591. },
  592. onSpecInput: function () {
  593. if (this.MaterielItem.spec && this.baseUtils.getRealLen(this.MaterielItem.spec) > 100) {
  594. this.MaterielItem.spec = this.baseUtils.cutOutString(this.MaterielItem.spec, 100)
  595. }
  596. },
  597. // _initScroll() {
  598. // this.$nextTick(() => {
  599. // if (!this.scroll) {
  600. // this.scroll = new BScroll(this.$refs.scroll, {
  601. // click: true
  602. // })
  603. // } else {
  604. // this.scroll.refresh()
  605. // }
  606. // })
  607. // }
  608. },
  609. components: {
  610. RemindBox,
  611. PullUp,
  612. upoffMaterial
  613. }
  614. }
  615. </script>
  616. <style lang="scss">
  617. @mixin overFlowHidden {
  618. overflow: hidden;
  619. text-overflow: ellipsis;
  620. white-space: nowrap;
  621. }
  622. @mixin lineHeight($value) {
  623. height: $value;
  624. line-height: $value;
  625. }
  626. .material-wrapper {
  627. background: #f1f3f6;
  628. /*margin: 1.26rem 0 0.98rem 0;*/
  629. /*height: calc(100vh - 1.26rem - 0.98rem);*/
  630. position: fixed;
  631. width: 100%;
  632. top: 1.26rem;
  633. bottom: 0.98rem;
  634. overflow-y: auto;
  635. z-index: 100;
  636. .order-nav {
  637. background: #fff;
  638. div {
  639. height: 0.82rem;
  640. line-height: 0.82rem;
  641. display: inline-block;
  642. width: 50%;
  643. text-align: center;
  644. font-size: .28rem;
  645. color: #666;
  646. &.active span{
  647. color: #3f84f6;
  648. border-bottom: 0.04rem solid #3f84f6;
  649. padding-bottom: 0.2rem;
  650. }
  651. }
  652. }
  653. .search-content {
  654. text-align: center;
  655. padding: .25rem 0;
  656. input {
  657. border: 1px solid #376ff3;
  658. }
  659. span {
  660. }
  661. }
  662. .scrollContent {
  663. height: calc(100vh - 3.19rem - 0.98rem);
  664. overflow-y: auto;
  665. .providerList {
  666. margin-bottom: 0.24rem;
  667. .top {
  668. position: relative;
  669. padding: 0 0.24rem;
  670. border-bottom: 1px solid #d3d3d3;
  671. height: 0.9rem;
  672. line-height: 0.9rem;
  673. color: #0067e7;
  674. font-size: 0.3rem;
  675. background: #fff;
  676. &::after {
  677. clear: both;
  678. display: block;
  679. content: ' ';
  680. visibility: hidden;
  681. zoom: 1;
  682. }
  683. .text {
  684. width: 5.4rem;
  685. }
  686. .pms {
  687. color: #f57710;
  688. border: 1px solid #f57710;
  689. border-radius: 0.4rem;
  690. background: #fff;
  691. font-size: 0.24rem;
  692. height: 0.4rem;
  693. line-height: 0.4rem;
  694. width: 0.8rem;
  695. text-align: center;
  696. float: right;
  697. margin-top: 0.25rem;
  698. }
  699. .store-type {
  700. width: .77rem;
  701. height: .77rem;
  702. position: absolute;
  703. right: 0;
  704. top: 0;
  705. }
  706. .icon {
  707. width: 0.6rem;
  708. height: 0.36rem;
  709. line-height: 0.36rem;
  710. margin-top: 0.27rem;
  711. float: left;
  712. background-size: 100%;
  713. background-repeat: no-repeat;
  714. margin-right: 0.12rem;
  715. text-align: center;
  716. &.istanded {
  717. background-image: url('/images/mobile/@2x/istanded.png')
  718. }
  719. &.standed {
  720. background-image: url('/images/mobile/@2x/standed.png')
  721. }
  722. }
  723. .person-flag {
  724. width: .75rem;
  725. position: absolute;
  726. right: 0;
  727. }
  728. .text {
  729. float: left;
  730. width: 6.3rem;
  731. overflow: hidden;
  732. text-overflow: ellipsis;
  733. white-space: nowrap;
  734. }
  735. }
  736. .middle {
  737. padding: 0.24rem 0.24rem;
  738. background: #fff;
  739. .pms {
  740. color: #f57710;
  741. border: 1px solid #f57710;
  742. border-radius: 0.4rem;
  743. background: #fff;
  744. font-size: 0.24rem;
  745. height: 0.4rem;
  746. line-height: 0.4rem;
  747. width: 0.8rem;
  748. text-align: center;
  749. }
  750. .list {
  751. /*height: 0.46rem;*/
  752. .left {
  753. float: left;
  754. overflow: hidden;
  755. text-overflow: ellipsis;
  756. white-space: nowrap;
  757. }
  758. .textinfo {
  759. color: #0067e7;
  760. font-size: 0.3rem;
  761. }
  762. .button {
  763. font-size: 0.26rem;
  764. color: #fff;
  765. width: 0.92rem;
  766. text-align: center;
  767. border-radius: 5px;
  768. /*border:1px solid #1a58dd;*/
  769. background: #1a58dd;
  770. display: inline-block;
  771. margin-right: 0.2rem;
  772. line-height: 0.33rem;
  773. height: 0.37rem;
  774. }
  775. margin-bottom: 0.18rem;
  776. &::after{
  777. clear: both;
  778. display: block;
  779. content: ' ';
  780. visibility: hidden;
  781. zoom: 1;
  782. }
  783. .fl {
  784. width: 4.3rem;
  785. float: left;
  786. overflow: hidden;
  787. text-overflow: ellipsis;
  788. white-space: nowrap;
  789. }
  790. .fr {
  791. text-align: left;
  792. width: 2.6rem;
  793. overflow: hidden;
  794. text-overflow: ellipsis;
  795. white-space: nowrap;
  796. }
  797. &.list-long {
  798. .fl {
  799. width: 100% !important;
  800. }
  801. }
  802. .name {
  803. color: #666;
  804. font-size: 0.3rem;
  805. display: inline-block;
  806. }
  807. .text {
  808. display: inline-block;
  809. color: #333;
  810. font-size: 0.3rem
  811. }
  812. .table {
  813. width: 5.5rem;
  814. margin-bottom: 0;
  815. margin-top: 0;
  816. li {
  817. height: 0.43rem;
  818. line-height: 0.43rem;
  819. border-left: .01rem solid #c5c5c5;
  820. font-size: .28rem;
  821. &::after {
  822. clear: both;
  823. display: block;
  824. content: ' ';
  825. visibility: hidden;
  826. zoom: 1;
  827. }
  828. div {
  829. text-align: center;
  830. width: 50%;
  831. float: left;
  832. border-right: .01rem solid #c5c5c5;
  833. border-bottom: .01rem solid #c5c5c5;
  834. }
  835. &:nth-child(odd) {
  836. background: #ddd;
  837. color: #666;
  838. font-size: 0.28rem;
  839. }
  840. &:nth-child(even) {
  841. background: #fcfcfc;
  842. color: #666;
  843. font-size: 0.28rem;
  844. }
  845. &:nth-last-of-type(1){
  846. color: #f31919;
  847. }
  848. &.title {
  849. font-size: 0.28rem;
  850. color: #333;
  851. }
  852. }
  853. }
  854. }
  855. }
  856. div.clearfix {
  857. padding: 0.2rem 0.2rem;
  858. border-top: 1px solid #d3d3d3;
  859. background: #fff;
  860. div{
  861. width: 2.1rem;
  862. height: .6rem;
  863. text-align: center;
  864. line-height: .6rem;
  865. border-radius: 3px;
  866. margin-right: .2rem;
  867. &.look {
  868. color: #008bf7;
  869. border: 1px solid #008bf7;
  870. }
  871. &.add {
  872. background: #fff;
  873. color: #f57710;
  874. border: 1px solid #f57710;
  875. }
  876. &.noadd{
  877. background: #cccbcb;
  878. color: #fff;
  879. border:1px solid #cccbcb;
  880. }
  881. }
  882. }
  883. }
  884. }
  885. }
  886. .update-materiel {
  887. position: fixed;
  888. z-index: 1000;
  889. background: #f1f3f6;
  890. /*background: red;*/
  891. top: 0;
  892. left: 0;
  893. bottom: 0;
  894. right: 0;
  895. .mobile-header{
  896. position: fixed;
  897. top: 0;
  898. z-index: 100;
  899. width:100%;
  900. height: 1.26rem;
  901. line-height: 1.26rem;
  902. /*border-bottom:.01rem solid #ccc;*/
  903. background: #3e82f5;
  904. padding:0 .2rem 0 .1rem;
  905. color:#fff;
  906. }
  907. .mobile-header p{
  908. overflow: hidden;
  909. text-overflow: ellipsis;
  910. white-space: nowrap;
  911. font-size:.36rem;
  912. text-align: center;
  913. width: 6rem;
  914. padding-left: 1rem;
  915. }
  916. .mobile-center-header p.en-name {
  917. font-size: .3rem;
  918. }
  919. .mobile-header a{
  920. font-size:.28rem;
  921. color:#fff;
  922. position: absolute;
  923. }
  924. .mobile-header a i{
  925. font-size: .48rem;
  926. margin-right: -.1rem;
  927. }
  928. .update-materiel-wrapper {
  929. border-radius: 0.07rem;
  930. position: fixed;
  931. overflow: hidden;
  932. bottom: 0;
  933. top: 1.46rem;
  934. left: 0.2rem;
  935. right: 0.2rem;
  936. .imgUrl{
  937. position: absolute;
  938. width: 0.94rem;
  939. height: 0.94rem;
  940. right: 0;
  941. top: 0;
  942. z-index: 1;
  943. }
  944. .update-materiel-wrapper-image {
  945. width: 1.09rem;
  946. height: 1.09rem;
  947. border: 1px solid #dcdcdc;
  948. border-radius: 0.07rem;
  949. position: relative;
  950. margin: 0rem 0 0 0.5rem;
  951. text-align: center;
  952. position: relative;
  953. float: left;
  954. span {
  955. color: #b2b2b2;
  956. font-size: 0.2rem;
  957. }
  958. .com-input {
  959. width: 100%;
  960. height: 100%;
  961. text-align: center;
  962. position: absolute;
  963. bottom: 0;
  964. left: 0;
  965. opacity: 0;
  966. display: inline-block !important;
  967. }
  968. }
  969. .uploadImgBtn {
  970. color: #fff;
  971. font-size: .28rem;
  972. width: 1.51rem;
  973. @include lineHeight(0.47rem);
  974. border-radius: 0.07rem;
  975. background: #f9b209;
  976. text-align: center;
  977. margin: 0rem 0 0 0.3rem;
  978. position: relative;
  979. .com-input {
  980. width: 100%;
  981. height: 100%;
  982. text-align: center;
  983. position: absolute;
  984. bottom: 0;
  985. left: 0;
  986. opacity: 0;
  987. display: inline-block !important;
  988. }
  989. }
  990. .uploadImgInfo {
  991. font-size: 0.24rem;
  992. margin-left: 0.44rem;
  993. color: #999;
  994. .red {
  995. color: red;
  996. }
  997. }
  998. .update-materiel-wrapper-list {
  999. margin-left:0.28rem;
  1000. margin-top: 0.3rem;
  1001. line-height: 0.7rem;
  1002. .red {color: #ea0f42}
  1003. .name {color: #666;font-size: 0.28rem}
  1004. .input {
  1005. position: relative;
  1006. width: 5rem;
  1007. line-height: 0.7rem;
  1008. height: 0.7rem;
  1009. border: 1px solid #dcdcdc;
  1010. input {
  1011. text-indent: 5px;
  1012. border: 0;
  1013. border-radius: 0.07rem;
  1014. line-height: 0.64rem;
  1015. height: 0.64rem;
  1016. width: 90%;
  1017. font-size:0.28rem;
  1018. float: left;
  1019. color: #333;
  1020. }
  1021. i {
  1022. font-size: 0.16rem;
  1023. vertical-align: top;
  1024. color: #666;
  1025. float: right;
  1026. margin-right: 0.05rem
  1027. }
  1028. .similar {
  1029. position: absolute;
  1030. width:100%;
  1031. max-height: 2.5rem;
  1032. overflow-y: auto;
  1033. z-index: 12;
  1034. border: 1px solid #7e7e7e;
  1035. border-radius: .05rem;
  1036. top: .5rem;
  1037. background: #fff;
  1038. li {
  1039. height: .5rem;
  1040. line-height: .5rem;
  1041. font-size: .26rem;
  1042. color: #999;
  1043. padding-left: .19rem;
  1044. &:focus, &:active, &:hover {
  1045. background: #999;
  1046. color: #fff;
  1047. }
  1048. }
  1049. }
  1050. }
  1051. }
  1052. .update-materiel-wrapper-list2 {
  1053. margin-left: 0.28rem;
  1054. margin-top: 0.3rem;
  1055. }
  1056. .update-materiel-wrapper-controll {
  1057. margin: 0.4rem 0.2rem 0;
  1058. div {
  1059. width: 48%;
  1060. background: #b5b5b5;
  1061. font-size: 0.3rem;
  1062. color: #fafbfc;
  1063. text-align: center;
  1064. @include lineHeight(0.62rem);
  1065. border-radius: 0.07rem;
  1066. &:first-child {
  1067. background: #3f84f6;
  1068. }
  1069. }
  1070. }
  1071. }
  1072. .selectInput {
  1073. display: inline-block;
  1074. position: relative;
  1075. vertical-align: top;
  1076. height: 0.7rem;
  1077. line-height: 0.7rem;
  1078. border: 1px solid #d2d2d2;
  1079. border-radius: 2px;
  1080. width: 4.44rem;
  1081. text-indent: 0.12rem;
  1082. img {
  1083. position: absolute;
  1084. width: 0.17rem;
  1085. height: 0.11rem;
  1086. right:0.1rem;
  1087. top: 0.28rem;
  1088. }
  1089. &.selectInput2 {
  1090. width: 1.56rem;
  1091. }
  1092. span {
  1093. height: 0.64rem;
  1094. line-height: 0.64rem;
  1095. display: block;
  1096. font-size: 0.28rem;
  1097. }
  1098. ul {
  1099. position: absolute;
  1100. left: 0;
  1101. top: .64rem;
  1102. z-index: 12;
  1103. width: 100%;
  1104. max-height: 3rem;
  1105. overflow-y: auto;
  1106. display: none;
  1107. li {
  1108. text-indent: 0px;
  1109. width: 100%;
  1110. background: #666;
  1111. color: rgba(255, 255, 255, 0.89);
  1112. text-align: center;
  1113. font-size: .3rem;
  1114. }
  1115. &.active {
  1116. display: block;
  1117. }
  1118. }
  1119. }
  1120. }
  1121. </style>