BatchPublish.vue 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501
  1. <template>
  2. <div class="batch-publish">
  3. <div class="batch-publish-top clearfix">
  4. <div class="w50">
  5. <img src="/images/applyPurchase/batch-icon.png" alt="">
  6. Bom名称:<input type="text" v-model="bomInfo.name" class="text" />
  7. 共上传<b class="blue-text">{{bomNumber.successImport || 0}}</b>个产品
  8. <!--,其中<span class="red-text">{{bomNumber.nullField || 0}}</span>个产品的必填项缺失,请在当前页完善信息-->
  9. </div>
  10. <div class="w50">
  11. 采购套数:<input type="text" v-model="bomInfo.count" class="text"/>
  12. </div>
  13. <div class="w50" style="padding-left: 62px;">
  14. 规格:<input type="text" v-model="bomInfo.spec" class="text" />
  15. </div>
  16. <div class="w50">
  17. <span style="margin-right: 1px;">*截止时间: </span><el-date-picker
  18. v-model="bomInfo.endTime"
  19. type="date"
  20. :picker-options="pickerOptions"
  21. :editable="false"
  22. :class="{'error': !bomInfo.flag}"
  23. @change="getDate1()"
  24. size="mini">
  25. </el-date-picker>
  26. </div>
  27. <a class="modify-btn" @click="submitBOM">确认发布</a>
  28. </div>
  29. <div class="list-wrap" v-if="bomList.content.length">
  30. <table class="list-content">
  31. <thead>
  32. <tr>
  33. <!--<th width="60">-->
  34. <!--<label class="com-check-box">-->
  35. <!--<input type="checkbox" id="all" @change="onCheck()" v-model="isCheckAll">-->
  36. <!--<label for="all"></label>-->
  37. <!--</label>全选-->
  38. <!--</th>-->
  39. <th width="307">品牌/物料名称</th>
  40. <th width="307">型号/规格</th>
  41. <th width="95">单位用量(PCS)</th>
  42. <!--<th width="114">生产日期</th>-->
  43. <!--<th width="136"><i class="red-text">*</i>截止时间</th>-->
  44. <th width="186">操作</th>
  45. </tr>
  46. </thead>
  47. <tbody v-for="(item, index) in bomList.content">
  48. <tr v-if="!item.active">
  49. <!--<td>
  50. <label class="com-check-box">
  51. <input type="checkbox" @change="onCheck(index)" v-model="item.checked" :id="index">
  52. <label :for="index"></label>
  53. </label>
  54. </td>-->
  55. <td>
  56. <div class="prod-items">
  57. <div class="prod-item prod-item-large" :title="item.brand">
  58. <span class="pi-title"><i class="red-text">*</i>品牌:</span>
  59. <div class="pi-content over-ell" v-if="item.brand && (!item.brandWord || item.brandWord.length == 0)" :title="item.brand">{{item.brand}}</div>
  60. <div class="pi-content red-text" v-if="!item.brand">请完善信息</div>
  61. <div class="pi-content similar-select over-ell" v-if="item.brandWord && item.brandWord.length > 0" @click="setShowBrandWord(index, $event)">{{item.brand}}</div>
  62. <ul v-show="item.showBrandWord">
  63. <li v-for="brand in item.brandWord" @click="modifyItemByWord(index, brand.nameEn, 'brand')" :title="brand.nameEn">{{brand.nameEn}}</li>
  64. </ul>
  65. </div>
  66. <!--<div class="prod-item prod-item-small">
  67. <span class="pi-title">单价预算:</span>
  68. <div class="pi-content over-ell" v-if="item.unitPrice">{{(item.currency === 'RMB' ? '¥' : '$') + item.unitPrice}}</div>
  69. <div class="pi-content over-ell" v-else="!item.unitPrice">-</div>
  70. </div>-->
  71. <div class="prod-item prod-item-large" :title="item.kind">
  72. <span class="pi-title"><i class="red-text">*</i>物料名称:</span>
  73. <div class="pi-content over-ell" v-if="item.kind && (!item.kindWord || item.kindWord.length == 0)" :title="item.kind">{{item.kind}}</div>
  74. <div class="pi-content red-text" v-if="!item.kind">请完善信息</div>
  75. <!--<div class="pi-content over-ell">{{item.kind || '-'}}</div>-->
  76. </div>
  77. <!--<div class="prod-item prod-item-small" :title="item.encapsulation">
  78. <span class="pi-title">封装:</span>
  79. <div class="pi-content over-ell">
  80. {{item.encapsulation || '-'}}
  81. </div>
  82. </div>-->
  83. </div>
  84. </td>
  85. <td>
  86. <div class="prod-items">
  87. <div class="prod-item prod-item-large" :title="item.code">
  88. <span class="pi-title"><i class="red-text">*</i>型号:</span>
  89. <div class="pi-content over-ell" v-if="item.code && (!item.codeWord || item.codeWord.length == 0)" :title="item.code">{{item.code}}</div>
  90. <div class="pi-content red-text" v-if="!item.code">请完善信息</div>
  91. <div class="pi-content over-ell similar-select" v-if="item.codeWord && item.codeWord.length > 0" @click="setShowCodeWord(index, $event)">{{item.code}}</div>
  92. <ul v-show="item.showCodeWord">
  93. <li v-for="code in item.codeWord" @click="modifyItemByWord(index, code.code, 'code')" :title="code.code">{{code.code}}</li>
  94. </ul>
  95. </div>
  96. <!--<div class="prod-item prod-item-small">
  97. <span class="pi-title">单价预算:</span>
  98. <div class="pi-content over-ell" v-if="item.unitPrice">{{(item.currency === 'RMB' ? '¥' : '$') + item.unitPrice}}</div>
  99. <div class="pi-content over-ell" v-else="!item.unitPrice">-</div>
  100. </div>-->
  101. <div class="prod-item prod-item-large" :title="item.spec">
  102. <span class="pi-title">规格:</span>
  103. <div class="pi-content over-ell">{{item.spec || '-'}}</div>
  104. </div>
  105. <!--<div class="prod-item prod-item-small" :title="item.encapsulation">
  106. <span class="pi-title">封装:</span>
  107. <div class="pi-content over-ell">
  108. {{item.encapsulation || '-'}}
  109. </div>
  110. </div>-->
  111. </div>
  112. </td>
  113. <td>
  114. <div class="over-ell" :title="item.amount">{{item.amount || '-'}}</div>
  115. </td>
  116. <!--<td>
  117. <div class="over-ell" :title="item.produceDate">
  118. {{item.produceDate || '-'}}
  119. </div>
  120. </td>-->
  121. <!--<td>-->
  122. <!--<span v-if="item.deadline">{{item.deadline | date}}</span>-->
  123. <!--<span class="red-text" v-if="!item.deadline">请完善信息</span>-->
  124. <!--<div class="red-text remind" v-if="!isValidTime(item.deadline)">默认≤90天</div>-->
  125. <!--</td>-->
  126. <td class="operate">
  127. <a @click="modifyItem(index)" class="size-s">编辑</a>
  128. <a @click="deleteItem(index)" class="size-s">删除</a>
  129. <!-- -->
  130. <a @click="setShowSpotGoods(true, item)" class="size-m" v-if="item.spotGoods && item.spotGoods.length && !item.showSpotGoods">商城现货&nbsp;<i class="fa fa-angle-double-down"></i></a>
  131. <a @click="setShowSpotGoods(false)" class="size-m" v-if="item.spotGoods && item.spotGoods.length && item.showSpotGoods">收起&nbsp;<i class="fa fa-angle-double-up"></i></a>
  132. </td>
  133. </tr>
  134. <tr class="spot-goods" v-if="item.showSpotGoods">
  135. <td colspan="4">
  136. <div class="spot-goods-body">
  137. <div class="spot-goods-title">商城现货({{spotGoodsData.length || 0}})</div>
  138. <table>
  139. <thead>
  140. <tr>
  141. <th width="214">卖家</th>
  142. <th width="83">交期(天)</th>
  143. <th width="104">单价</th>
  144. <th width="137">生产日期</th>
  145. <th width="111">库存</th>
  146. <th width="142">购买数量</th>
  147. <th width="186">操作</th>
  148. </tr>
  149. </thead>
  150. </table>
  151. <div class="spot-goods-list">
  152. <table>
  153. <tbody>
  154. <tr v-for="(spotGoods, index) in spotGoodsData">
  155. <td width="214" v-text="spotGoods.storeName"></td>
  156. <td width="83" class="red-text" v-text="spotGoods.b2cMinDelivery + '-' + spotGoods.b2cMaxDelivery">4-6</td>
  157. <td width="104" class="red-text" v-text="spotGoods.currencyName == 'RMB' ? '¥' + spotGoods.prices[0].rMBPrice: '$' + spotGoods.prices[0].uSDPrice"></td>
  158. <td width="137" v-text="spotGoods.produceDate"></td>
  159. <td width="111" v-text="spotGoods.reserve">21412</td>
  160. <td width="142" class="input-number">
  161. <div>
  162. <span @click="subNum(index)" :class="{'not-allowed': !fragments[index].canSub}">-</span>
  163. <input type="number" v-model="fragments[index].num" @blur="inputNum(index)">
  164. <span @click="addNum(index)" :class="{'not-allowed': !fragments[index].canAdd}">+</span>
  165. </div>
  166. </td>
  167. <td width="186" class="operate">
  168. <a href="javascript:void(0)" @click="linkSaler(spotGoods)">联系卖家<img src="/images/applyPurchase/link-buyer.png" alt=""></a>
  169. <span @click="buyNow(spotGoods, index)">立即购买</span>
  170. </td>
  171. </tr>
  172. </tbody>
  173. </table>
  174. </div>
  175. </div>
  176. </td>
  177. </tr>
  178. <tr class="modify-row" v-if="item.active">
  179. <!-- <td>
  180. <label class="com-check-box">
  181. <input type="checkbox" @change="onCheck(index)" v-model="item.checked" :id="index">
  182. <label :for="index"></label>
  183. </label>
  184. </td>-->
  185. <td>
  186. <div class="prod-items">
  187. <div class="prod-item prod-item-large">
  188. <span class="pi-title"><i class="red-text">*</i>品牌:</span>
  189. <input type="text" class="form-control" v-model="modifyObj.brand" :class="{'error': !validObj.brand}" @blur="checkBrand" @input="onBrandChange">
  190. <ul class="brand-similar-list" v-show="showSimilarBrandList">
  191. <li v-for="sBrand in similarBrand" @click="setBrand(sBrand.nameEn)">{{sBrand.nameEn}}</li>
  192. </ul>
  193. </div>
  194. <div class="prod-item prod-item-large">
  195. <span class="pi-title"><i class="red-text">*</i>物料名称:</span>
  196. <input type="text" class="form-control" v-model="modifyObj.kind" :class="{'error': !validObj.kind}" @input="onProdTitleInput" @blur="checkKind">
  197. </div>
  198. <!--<div class="prod-item prod-item-small pi-select">
  199. <span class="pi-title">单价预算:</span>
  200. <select class="form-control" v-model="modifyObj.currency">
  201. <option value="RMB">¥</option>
  202. <option value="USD">$</option>
  203. </select>
  204. <input class="form-control" type="number" v-model="modifyObj.unitPrice" :class="{'error': !validObj.unitPrice}" @blur="checkUnitPrice" @input="onUnitPriceInput">
  205. </div>-->
  206. <!--<div class="prod-item prod-item-small">
  207. <span class="pi-title">封装:</span>
  208. <input type="text" class="form-control" v-model="modifyObj.encapsulation" @input="onEncapsulationChange">
  209. </div>-->
  210. </div>
  211. </td>
  212. <td>
  213. <div class="prod-items">
  214. <div class="prod-item prod-item-large">
  215. <span class="pi-title"><i class="red-text">*</i>型号:</span>
  216. <input type="text" class="form-control" v-model="modifyObj.code" :class="{'error': !validObj.code}" @blur="checkCode" @input="onCodeChange" >
  217. <ul v-show="showSimilarCodeList">
  218. <li v-for="sCode in similarCode" @click="setCode(sCode.code)">{{sCode.code}}</li>
  219. </ul>
  220. </div>
  221. <div class="prod-item prod-item-large">
  222. <span class="pi-title">规格:</span>
  223. <input type="text" class="form-control" v-model="modifyObj.spec" :class="{'error': !validObj.spec}" @input="onSpecInput" @blur="checkSpec">
  224. </div>
  225. </div>
  226. </td>
  227. <td>
  228. <input type="text" class="form-control" v-model="modifyObj.amount" :class="{'error': !validObj.amount}" @blur="checkAmount" @input="onAmountInput">
  229. </td>
  230. <!--<td>
  231. <input type="text" class="form-control" v-model="modifyObj.produceDate" @input="onProduceDateChange">
  232. </td>-->
  233. <!--<td>-->
  234. <!--<el-date-picker-->
  235. <!--v-model="modifyObj.deadline"-->
  236. <!--type="date"-->
  237. <!--:picker-options="pickerOptions"-->
  238. <!--:editable="false"-->
  239. <!--:class="{'error': !validObj.deadline}"-->
  240. <!--@change="getDate1()"-->
  241. <!--size="mini">-->
  242. <!--</el-date-picker>-->
  243. <!--<input type="text" class="form-control" v-model="modifyObj.deadline">-->
  244. <!--</td>-->
  245. <td class="operate">
  246. <a class="btn-ok size-s" @click="submitModify(index)">确认</a>
  247. <a class="btn-cancel size-s" @click="cancelModify(index)">取消</a>
  248. </td>
  249. </tr>
  250. </tbody>
  251. </table>
  252. <page :total="bomList.totalElements" :page-size="pageSize"
  253. :current="nowPage" @childEvent="listenPage"></page>
  254. <div class="submit-area" v-if="bomList.content.length">
  255. <!-- <a class="modify-btn" @click="deleteItem()">删除</a>-->
  256. <a class="modify-btn" @click="submitBOM">确认发布</a>
  257. </div>
  258. </div>
  259. <link-saler-box
  260. :tel="tel"
  261. v-if="showLinkBox"
  262. @cancelAction="showLinkBox = false">
  263. </link-saler-box>
  264. </div>
  265. </template>
  266. <script>
  267. import Page from '~components/common/page/pageComponent.vue'
  268. import LinkSalerBox from '~components/common/LinkSalerBox.vue'
  269. export default {
  270. data () {
  271. return {
  272. pageSize: 10,
  273. nowPage: 1,
  274. isCheckAll: false,
  275. // showRemindBox: false,
  276. modifyObj: {
  277. code: '',
  278. brand: '',
  279. unitPrice: '',
  280. currency: 'RMB',
  281. encapsulation: '',
  282. produceDate: '',
  283. amount: '',
  284. deadline: '',
  285. kind: '',
  286. spec: ''
  287. },
  288. pickerOptions: {
  289. disabledDate (time) {
  290. // 大于等于今天 小于三个月后
  291. return time.getTime() < Date.now() - 1000 * 60 * 60 * 24 || time.getTime() > Date.now() + 1000 * 60 * 60 * 24 * 30 * 3
  292. }
  293. },
  294. similarCode: [],
  295. similarBrand: [],
  296. validObj: {
  297. code: true,
  298. brand: true,
  299. unitPrice: true,
  300. // encapsulation: true,
  301. // produceDate: true,
  302. amount: true,
  303. deadline: true,
  304. spec: true,
  305. kind: true
  306. },
  307. // successResult: 0,
  308. showSimilarCodeList: false,
  309. showSimilarBrandList: false,
  310. spotGoodsData: [],
  311. fragments: [],
  312. bomList: {},
  313. bomInfo: {},
  314. tel: '',
  315. showLinkBox: false
  316. }
  317. },
  318. components: {
  319. Page,
  320. LinkSalerBox
  321. },
  322. watch: {
  323. '$store.state.applyPurchase.bomMaterial.bomList.data': {
  324. handler: function (val) {
  325. let _this = this
  326. let list = JSON.parse(JSON.stringify(val))
  327. list.content = list.content.slice()
  328. for (let i = 0; i < list.content.length; i++) {
  329. _this.$set(list.content[i], 'checked', false)
  330. _this.$set(list.content[i], 'active', false)
  331. _this.$set(list.content[i], 'showCodeWord', false)
  332. _this.$set(list.content[i], 'showBrandWord', false)
  333. _this.$set(list.content[i], 'showSpotGoods', false)
  334. }
  335. this.bomList = list
  336. },
  337. immediate: true
  338. }
  339. },
  340. computed: {
  341. // bomList () {
  342. // let _this = this
  343. // let list = JSON.parse(JSON.stringify(this.$store.state.applyPurchase.bomMaterial.bomList.data))
  344. // list.content = list.content.slice()
  345. // for (let i = 0; i < list.content.length; i++) {
  346. // _this.$set(list.content[i], 'checked', false)
  347. // _this.$set(list.content[i], 'active', false)
  348. // _this.$set(list.content[i], 'showCodeWord', false)
  349. // _this.$set(list.content[i], 'showBrandWord', false)
  350. // _this.$set(list.content[i], 'showSpotGoods', false)
  351. // // list.content[i].checked = false
  352. // // list.content[i].active = false
  353. // // if (!list.content[i].code || list.content[i].brand || !list.content[i].deadline || !this.isValidDate(list.content[i].deadline)) {
  354. // // _this.validList = false
  355. // // }
  356. // }
  357. // console.log(list)
  358. // return list
  359. // },
  360. bomNumber () {
  361. return this.$store.state.applyPurchase.bomMaterial.bomNumber.data
  362. },
  363. tab () {
  364. return this.$store.state.chat.tab.tab.data
  365. },
  366. user () {
  367. return this.$store.state.option.user
  368. }
  369. },
  370. mounted () {
  371. let _this = this
  372. document.body.onclick = function () {
  373. _this.showSimilarCodeList = false
  374. _this.showSimilarBrandList = false
  375. for (let i = 0; i < _this.bomList.content.length; i++) {
  376. _this.bomList.content[i].showCodeWord = false
  377. _this.bomList.content[i].showBrandWord = false
  378. }
  379. }
  380. },
  381. filters: {
  382. date: function (input) {
  383. if (input) {
  384. const d = new Date(input)
  385. const year = d.getFullYear()
  386. const monthTemp = d.getMonth() + 1
  387. const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
  388. const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate()
  389. return year + '-' + month + '-' + day
  390. } else {
  391. return null
  392. }
  393. },
  394. currencyStr: function (str) {
  395. return typeof str === 'string' && str !== 'RMB' && str !== 'USD' ? str.startsWith('RMB') ? '¥' + str.substring(3, str.length) : '$' + str.substring(3, str.length) : '-'
  396. }
  397. },
  398. methods: {
  399. getDate1: function () {
  400. this.bomInfo.endTime = this.bomInfo.endTime ? this.baseUtils.getFullDay(this.baseUtils.getClearDay(new Date(this.baseUtils.formatDate(new Date(this.bomInfo.endTime), 'yyyy-MM-dd')))) : null
  401. this.bomInfo.flag = true
  402. // this.modifyObj.deadline = this.modifyObj.deadline ? this.baseUtils.getFullDay(this.baseUtils.getClearDay(new Date(this.baseUtils.formatDate(new Date(this.modifyObj.deadline), 'yyyy-MM-dd')))) : null
  403. // this.validObj.deadline = true
  404. },
  405. initModifyObj: function () {
  406. for (let attr in this.modifyObj) {
  407. this.modifyObj[attr] = attr === 'currency' ? 'RMB' : ''
  408. }
  409. },
  410. initValidObj: function () {
  411. this.validObj = {
  412. code: true,
  413. brand: true,
  414. unitPrice: true,
  415. amount: true,
  416. deadline: true,
  417. spec: true,
  418. kind: true
  419. }
  420. },
  421. listenPage: function (page) {
  422. this.nowPage = page
  423. this.reloadData()
  424. },
  425. reloadData: function () {
  426. this.$store.dispatch('applyPurchase/loadBOMMaterialList', {bomId: this.$route.params.id, page: this.nowPage, count: this.pageSize})
  427. },
  428. submitBOM: function () {
  429. // let str = ''
  430. // for (let i = 0; i < this.bomList.content.length; i++) {
  431. // if (this.bomList.content[i].checked) {
  432. // if (!this.getSingleValidInfo(this.bomList.content[i])) {
  433. // this.$message.error('请选择信息完善的产品发布求购')
  434. // return
  435. // }
  436. // str += this.bomList.content[i].id + ','
  437. // }
  438. // }
  439. // let param = {'bomId': Number(this.$route.params.id)}
  440. // if (str.length) {
  441. // str = str.substring(0, str.length - 1)
  442. // param.spIds = str
  443. // }
  444. if (!this.bomInfo.count || this.bomInfo.count === '') {
  445. this.$message.error('请输入采购套数')
  446. return
  447. } else if (!this.bomInfo.endTime || this.bomInfo.endTime === '') {
  448. this.$message.error('请选择截止时间')
  449. return
  450. } else if (!this.bomInfo.spec || this.bomInfo.spec === '') {
  451. this.$message.error('请输入规格')
  452. return
  453. }
  454. let bom = this.bomInfo
  455. this.$http.post('/seek/bom/edit', bom).then(response => {
  456. this.$http.post('/seek/confirmBom?bomId=' + Number(this.$route.params.id) + '&endTime=' + this.bomInfo.endTime.getTime() + '&count=' + this.bomInfo.count)
  457. .then(response => {
  458. if (response.data.success) {
  459. // this.showRemindBox = true
  460. // this.successResult = response.data.data
  461. // this.listenPage(1)
  462. // this.$store.dispatch('applyPurchase/loadBOMNumber', {bomId: this.$route.params.id})
  463. if (response.data.data.successAmount && response.data.data.successAmount > 0) {
  464. this.$router.push('/applyPurchase/result?status=success&count=' + response.data.data.successAmount)
  465. } else {
  466. this.$router.push('/applyPurchase/result?status=error')
  467. }
  468. } else {
  469. // this.$message.error(response.data.message)
  470. this.$router.push('/applyPurchase/result?status=error')
  471. }
  472. }, err => {
  473. console.log(err)
  474. this.$message.error('系统错误')
  475. })
  476. })
  477. },
  478. onCheck: function (index) {
  479. if (typeof index === 'undefined') {
  480. let isCheckedAll = true
  481. for (let i = 0; i < this.bomList.content.length; i++) {
  482. if (!this.bomList.content[i].checked) {
  483. isCheckedAll = false
  484. break
  485. }
  486. }
  487. this.setAllCheck(!isCheckedAll)
  488. this.isCheckAll = !isCheckedAll
  489. }
  490. },
  491. setAllCheck: function (flag) {
  492. for (let i = 0; i < this.bomList.content.length; i++) {
  493. this.bomList.content[i].checked = flag
  494. }
  495. },
  496. cancelModifyItem: function () {
  497. for (let i = 0; i < this.bomList.content.length; i++) {
  498. if (this.bomList.content[i].active) {
  499. this.$message.error('抱歉,您尚有未保存的信息')
  500. return false
  501. }
  502. this.bomList.content[i].active = false
  503. }
  504. return true
  505. },
  506. modifyItem: function (index) {
  507. if (!this.cancelModifyItem()) {
  508. return
  509. }
  510. this.cancelShowSpotGoods()
  511. // this.$set(this.bomList.content[index], 'active', true)
  512. this.bomList.content[index].active = true
  513. let _this = this
  514. this.initModifyObj()
  515. this.initValidObj()
  516. for (let attr in this.bomList.content[index]) {
  517. // console.log(attr + ':' + _this.bomList.content[index][attr])
  518. _this.$set(_this.modifyObj, attr, _this.bomList.content[index][attr])
  519. // _this.modifyObj[attr] = _this.bomList.content[index][attr]
  520. }
  521. // this.modifyObj = this.bomList.content[index]
  522. this.modifyObj.deadline = this.bomList.content[index].deadline ? this.bomList.content[index].deadline : ''
  523. },
  524. cancelModify: function (index) {
  525. this.bomList.content[index].active = false
  526. },
  527. // getDate: function (input) {
  528. // const d = new Date(input)
  529. // const year = d.getFullYear()
  530. // const monthTemp = d.getMonth() + 1
  531. // const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
  532. // const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate()
  533. // return year + '-' + month + '-' + day
  534. // },
  535. // validDate: function (timestamp) {
  536. // let now = new Date().getTime()
  537. // return timestamp - now <= 1000 * 60 * 60 * 24 * 90 && timestamp - now > 0
  538. // },
  539. submitModify: function (index) {
  540. let checkValid = this.checkAll()
  541. if (this.getSingleValidInfo(this.modifyObj) && checkValid) {
  542. if (!this.modifyObj.unitPrice) {
  543. this.modifyObj.currency = null
  544. }
  545. this.modifyObj.code = this.modifyObj.code.trim()
  546. delete this.modifyObj.brandWord
  547. delete this.modifyObj.codeWord
  548. this.$http.put('/seek/updateSeekPurchaseByBatch', this.modifyObj)
  549. .then(response => {
  550. if (response.data.success) {
  551. this.reloadData()
  552. this.$message.success('修改成功')
  553. // this.bomList.content[index].active = false
  554. } else {
  555. this.$message.error('修改失败')
  556. }
  557. }, err => {
  558. console.log(err)
  559. this.$message.error('系统错误')
  560. })
  561. } else {
  562. if (!checkValid) {
  563. // if (!this.validObj.deadline) {
  564. // if (!this.isValidDate(this.modifyObj.deadline)) {
  565. // this.$message.error('截止日期需在90天以内')
  566. // } else {
  567. // this.$message.error('截止日期不能为空')
  568. // }
  569. // } else
  570. if (!this.validObj.amount || !this.validObj.unitPrice) {
  571. this.$message.error('请输入正确的数值')
  572. }
  573. } else {
  574. this.$message.error('请完善信息')
  575. }
  576. }
  577. },
  578. deleteItem: function (index) {
  579. if (!index && index !== 0) {
  580. let str = ''
  581. for (let i = 0; i < this.bomList.content.length; i++) {
  582. if (this.bomList.content[i].checked) {
  583. str += this.bomList.content[i].id + ','
  584. }
  585. }
  586. let param = {}
  587. if (str.length) {
  588. str = str.substring(0, str.length - 1)
  589. param.spIds = str
  590. this.doDelete(param)
  591. } else {
  592. this.$message.error('请勾选')
  593. return
  594. }
  595. } else {
  596. this.doDelete({spIds: this.bomList.content[index].id})
  597. }
  598. },
  599. doDelete: function (param) {
  600. this.$http.put('/seek/deleteSeekPurchaseByBatch', param)
  601. .then(response => {
  602. if (response.data.success) {
  603. this.listenPage(1)
  604. this.$message.success('删除成功')
  605. } else {
  606. this.$message.error('删除失败')
  607. }
  608. }, err => {
  609. console.log(err)
  610. this.$message.error('系统错误')
  611. })
  612. },
  613. isValidTime: function (time) {
  614. let now = this.baseUtils.getClearDay(this.baseUtils.formatDate(new Date(), 'yyyy-MM-dd'))
  615. return !time || (time >= now && time <= now + 1000 * 60 * 60 * 24 * 91)
  616. },
  617. isValidDate: function (date) {
  618. console.log(date)
  619. let dateTmp = new Date(this.baseUtils.formatDate(new Date(dateTmp), 'yyyy-MM-dd')).getTime()
  620. // this.modifyObj.deadline = date
  621. // console.log(date)
  622. let now = this.baseUtils.getClearDay(this.baseUtils.formatDate(new Date(), 'yyyy-MM-dd'))
  623. // let time = new Date(date).getTime()
  624. return !dateTmp || (dateTmp >= now && dateTmp <= now + 1000 * 60 * 60 * 24 * 91)
  625. },
  626. getSimilarCode: function () {
  627. if (this.modifyObj.code) {
  628. this.$http.get('/search/similarComponents', {params: {keyword: this.modifyObj.code}})
  629. .then(response => {
  630. this.similarCode = response.data
  631. if (response.data.length) {
  632. this.showSimilarCodeList = true
  633. } else {
  634. this.showSimilarCodeList = false
  635. }
  636. })
  637. } else {
  638. this.showSimilarCodeList = false
  639. }
  640. },
  641. getSimilarBrand: function () {
  642. if (this.modifyObj.brand) {
  643. this.$http.get('/search/similarBrands', {params: {keyword: this.modifyObj.brand}})
  644. .then(response => {
  645. this.similarBrand = response.data
  646. if (response.data.length) {
  647. this.showSimilarBrandList = true
  648. } else {
  649. this.showSimilarBrandList = false
  650. }
  651. })
  652. } else {
  653. this.showSimilarBrandList = false
  654. }
  655. },
  656. getSingleValidInfo: function (item) {
  657. // && item.deadline && this.isValidDate(item.deadline)
  658. return item.code && item.brand
  659. },
  660. checkCode: function () {
  661. let code = this.modifyObj.code.trim()
  662. let nullStrFlag = this.baseUtils.checkNullStr(code)
  663. this.validObj.code = code && code !== '' && nullStrFlag
  664. if (!this.validObj.code) {
  665. if (!nullStrFlag) {
  666. this.$message.error('型号输入不合法')
  667. } else {
  668. this.$message.error('型号不能为空')
  669. }
  670. }
  671. return this.validObj.code
  672. },
  673. checkBrand: function () {
  674. let nullStrFlag = this.baseUtils.checkNullStr(this.modifyObj.brand)
  675. this.validObj.brand = this.modifyObj.brand && this.modifyObj.brand !== '' && nullStrFlag
  676. if (!this.validObj.brand) {
  677. if (!nullStrFlag) {
  678. this.$message.error('品牌输入不合法')
  679. } else {
  680. this.$message.error('品牌不能为空')
  681. }
  682. }
  683. return this.validObj.brand
  684. },
  685. checkUnitPrice: function () {
  686. this.validObj.unitPrice = (!this.modifyObj.unitPrice || this.modifyObj.unitPrice === '') ? true : this.modifyObj.unitPrice > 0 && this.modifyObj.unitPrice < 100000000
  687. return this.validObj.unitPrice
  688. },
  689. checkAmount: function () {
  690. this.validObj.amount = (!this.modifyObj.amount || this.modifyObj.amount === '') ? true : this.modifyObj.amount > 0 && this.modifyObj.amount < 1000000000
  691. return this.validObj.amount
  692. },
  693. checkKind: function() {
  694. let nullStrFlag = this.baseUtils.checkNullStr(this.modifyObj.kind)
  695. this.validObj.kind = this.modifyObj.kind && this.modifyObj.kind !== ''
  696. // if (!this.validObj.kind) {
  697. if (!nullStrFlag) {
  698. this.$message.error('物料名称输入不合法')
  699. } else if (!this.validObj.kind) {
  700. this.$message.error('物料名称不能为空')
  701. }
  702. // }
  703. return this.validObj.kind
  704. },
  705. checkSpec: function () {
  706. let nullStrFlag = this.baseUtils.checkNullStr(this.modifyObj.spec)
  707. this.validObj.spec = nullStrFlag
  708. if (!nullStrFlag) {
  709. this.$message.error('规格输入不合法')
  710. }
  711. return this.validObj.spec
  712. },
  713. checkAll: function () {
  714. // && this.checkSpec()
  715. // && this.checkUnitPrice()
  716. // && this.checkDeadline()
  717. return this.checkBrand() && this.checkCode() && this.checkKind() && this.checkAmount()
  718. },
  719. checkDeadline: function () {
  720. this.validObj.deadline = this.modifyObj.deadline && this.modifyObj.deadline !== '' && this.isValidDate(this.modifyObj.deadline)
  721. return this.validObj.deadline
  722. },
  723. onUnitPriceInput: function () {
  724. let price = this.modifyObj.unitPrice
  725. if (price >= 10000) {
  726. this.modifyObj.unitPrice = price.substring(0, 4)
  727. } else if (price.indexOf('.') > -1) {
  728. let arr = price.split('.')
  729. if (arr[0].length > 4) {
  730. this.modifyObj.unitPrice = Number(arr[0].substring(0, 4) + '.' + arr[1])
  731. } else if (arr[1].length > 6) {
  732. this.modifyObj.unitPrice = Number(arr[0] + '.' + arr[1].substring(0, 6))
  733. }
  734. }
  735. },
  736. onProduceDateChange: function () {
  737. if (this.modifyObj.produceDate && this.baseUtils.getRealLen(this.modifyObj.produceDate) > 12) {
  738. this.modifyObj.produceDate = this.baseUtils.cutOutString(this.modifyObj.produceDate, 12)
  739. }
  740. },
  741. onEncapsulationChange: function () {
  742. if (this.modifyObj.encapsulation && this.baseUtils.getRealLen(this.modifyObj.encapsulation) > 20) {
  743. this.modifyObj.encapsulation = this.baseUtils.cutOutString(this.modifyObj.encapsulation, 20)
  744. }
  745. },
  746. onCodeChange: function () {
  747. if ((/[^\x00-\xff]/g).test(this.modifyObj.code)) {
  748. let chineseIndex = -1
  749. for (let i = 0; i < this.modifyObj.code.length; i++) {
  750. if ((/[^\x00-\xff]/g).test(this.modifyObj.code.charAt(i))) {
  751. chineseIndex = i
  752. break
  753. }
  754. }
  755. this.modifyObj.code = this.baseUtils.cutOutString(this.modifyObj.code, chineseIndex)
  756. } else if (this.modifyObj.code && this.baseUtils.getRealLen(this.modifyObj.code) > 100) {
  757. this.modifyObj.code = this.baseUtils.cutOutString(this.modifyObj.code, 100)
  758. } else {
  759. this.getSimilarCode()
  760. }
  761. },
  762. onBrandChange: function () {
  763. this.modifyObj.brand = this.modifyObj.brand.trim()
  764. if ((/[^\x00-\xff]/g).test(this.modifyObj.brand)) {
  765. let chineseIndex = -1
  766. for (let i = 0; i < this.modifyObj.brand.length; i++) {
  767. if ((/[^\x00-\xff]/g).test(this.modifyObj.brand.charAt(i)) && !(/[\u4e00-\u9fa5]/).test(this.modifyObj.brand.charAt(i))) {
  768. chineseIndex = i
  769. break
  770. }
  771. }
  772. if (chineseIndex > -1) {
  773. this.modifyObj.brand = this.modifyObj.brand.substring(0, chineseIndex)
  774. }
  775. } else if (this.modifyObj.brand && this.baseUtils.getRealLen(this.modifyObj.brand) > 50) {
  776. this.modifyObj.brand = this.baseUtils.cutOutString(this.modifyObj.brand, 50)
  777. }
  778. this.getSimilarBrand()
  779. },
  780. onProdTitleInput: function () {
  781. if (this.modifyObj.kind && this.baseUtils.getRealLen(this.modifyObj.kind) > 40) {
  782. this.modifyObj.kind = this.baseUtils.cutOutString(this.modifyObj.kind, 40)
  783. }
  784. },
  785. onSpecInput: function () {
  786. if (this.modifyObj.spec && this.baseUtils.getRealLen(this.modifyObj.spec) > 100) {
  787. this.modifyObj.spec = this.baseUtils.cutOutString(this.modifyObj.spec, 100)
  788. }
  789. },
  790. onAmountInput: function () {
  791. if (!(/^[0-9]*$/).test(this.modifyObj.amount)) {
  792. let chineseIndex = -1
  793. for (let i = 0; i < this.modifyObj.amount.length; i++) {
  794. if (!(/^[0-9]*$/).test(this.modifyObj.amount.charAt(i))) {
  795. chineseIndex = i
  796. break
  797. }
  798. }
  799. this.modifyObj.amount = this.baseUtils.cutOutString(this.modifyObj.amount, chineseIndex)
  800. } else if (this.modifyObj.amount.length > 9) {
  801. this.modifyObj.amount = this.baseUtils.cutOutString(this.modifyObj.amount, 9)
  802. }
  803. },
  804. setCode: function (code) {
  805. this.modifyObj.code = code
  806. this.showSimilarCodeList = false
  807. },
  808. setBrand: function (brand) {
  809. this.modifyObj.brand = brand
  810. this.showSimilarBrandList = false
  811. },
  812. setShowCodeWord: function (index, event) {
  813. event.stopPropagation()
  814. for (let i = 0; i < this.bomList.content.length; i++) {
  815. if (i !== index) {
  816. this.bomList.content[i].showCodeWord = false
  817. }
  818. this.bomList.content[i].showBrandWord = false
  819. }
  820. this.bomList.content[index].showCodeWord = !this.bomList.content[index].showCodeWord
  821. },
  822. setShowBrandWord: function (index, event) {
  823. event.stopPropagation()
  824. for (let i = 0; i < this.bomList.content.length; i++) {
  825. if (i !== index) {
  826. this.bomList.content[i].showBrandWord = false
  827. }
  828. this.bomList.content[i].showCodeWord = false
  829. }
  830. this.bomList.content[index].showBrandWord = !this.bomList.content[index].showBrandWord
  831. },
  832. modifyItemByWord: function (index, param, type) {
  833. if (type === 'code') {
  834. this.bomList.content[index].code = param
  835. this.requestModify(this.bomList.content[index])
  836. } else if (type === 'brand') {
  837. this.bomList.content[index].brand = param
  838. this.requestModify(this.bomList.content[index])
  839. } else {
  840. this.$message.error('修改失败')
  841. }
  842. },
  843. requestModify: function (item) {
  844. this.$http.put('/seek/updateSeekPurchaseByBatch', item)
  845. .then(response => {
  846. if (response.data.success) {
  847. this.$message.success('修改成功')
  848. } else {
  849. this.$message.error('修改失败')
  850. }
  851. this.reloadData()
  852. }, err => {
  853. console.log(err)
  854. this.$message.error('系统错误')
  855. // this.reloadData()
  856. })
  857. },
  858. cancelShowSpotGoods: function () {
  859. for (let i = 0; i < this.bomList.content.length; i++) {
  860. this.bomList.content[i].showSpotGoods = false
  861. }
  862. },
  863. setShowSpotGoods: function (flag, item) {
  864. if (flag && item && item.spotGoods.length) {
  865. this.spotGoodsData = this.baseUtils.deepCopy(item.spotGoods)
  866. this.initFragments()
  867. }
  868. if (!this.cancelModifyItem()) {
  869. return
  870. }
  871. this.cancelShowSpotGoods()
  872. item.showSpotGoods = flag
  873. },
  874. initFragment: function (commodity) {
  875. if (!commodity) {
  876. return {}
  877. }
  878. let fragment = {}
  879. let prices = commodity.prices[0]
  880. fragment.num = commodity.minBuyQty
  881. fragment.prices = prices
  882. if (commodity.currencyName !== 'USD') {
  883. fragment.currency = 'RMB'
  884. } else {
  885. fragment.currency = 'USD'
  886. }
  887. if (fragment.currency !== 'USD') {
  888. fragment.price = prices.rMBPrice
  889. } else {
  890. fragment.price = prices.uSDPrice
  891. }
  892. fragment.canAdd = true
  893. fragment.canSub = false
  894. return fragment
  895. },
  896. initFragments: function () {
  897. this.fragments = []
  898. for (let i = 0; i < this.spotGoodsData.length; i++) {
  899. this.fragments.push(this.initFragment(this.spotGoodsData[i]))
  900. }
  901. },
  902. getFragment: function (commodity, fragment) {
  903. // 判断是否小于第一分段的起订量
  904. if (commodity.prices[0].start > fragment.num) {
  905. fragment.num = commodity.prices[0].start
  906. }
  907. // 获取分段的信息
  908. let prices = commodity.prices
  909. for (let i = 0; i < prices.length; i++) {
  910. if (fragment.num <= prices[i].end) {
  911. fragment.prices = prices[i]
  912. break
  913. }
  914. }
  915. },
  916. onInput: function (index) {
  917. let prices = this.spotGoodsData[index].prices
  918. if (prices && prices.length) {
  919. for (let i = 0; i < prices.length; i++) {
  920. if (this.fragments[index].num >= prices[i].start && this.fragments[index].num <= prices[i].end) {
  921. this.fragments[index].price = this.fragments[index].currency === 'RMB' ? prices[i].rMBPrice : prices[i].uSDPrice
  922. break
  923. }
  924. }
  925. }
  926. },
  927. changeNum: function (newNum, index) {
  928. let pack = this.spotGoodsData[index].perQty || this.spotGoodsData[index].minPackQty
  929. let buy = this.spotGoodsData[index].minBuyQty
  930. let reserve = this.spotGoodsData[index].reserve
  931. let breakUp = this.spotGoodsData[index].breakUp
  932. let nowFragment = this.fragments[index]
  933. if (!newNum) {
  934. nowFragment.num = buy
  935. } else {
  936. newNum = parseInt(newNum)
  937. if (breakUp) {
  938. if (newNum < buy) {
  939. this.$message.error('最小起订量为' + buy)
  940. nowFragment.num = buy
  941. nowFragment.canSub = false
  942. nowFragment.canAdd = true
  943. } else if (newNum > reserve) {
  944. this.$message.error('库存不足')
  945. nowFragment.num = reserve
  946. nowFragment.canAdd = false
  947. nowFragment.canSub = true
  948. } else {
  949. nowFragment.canSub = true
  950. nowFragment.canAdd = true
  951. nowFragment.num = newNum
  952. newNum === buy && (nowFragment.canSub = false)
  953. newNum === reserve && (nowFragment.canAdd = false)
  954. }
  955. } else {
  956. if (newNum < buy) {
  957. this.$message.error('最小起订量为' + buy)
  958. nowFragment.num = buy
  959. nowFragment.canSub = false
  960. if (newNum > reserve) {
  961. this.$message.error('库存不足')
  962. nowFragment.num = reserve - (reserve % pack)
  963. nowFragment.canAdd = false
  964. }
  965. } else if (newNum > reserve) {
  966. nowFragment.canSub = true
  967. nowFragment.canAdd = false
  968. this.$message.error('库存不足')
  969. nowFragment.num = reserve - (reserve % pack)
  970. } else {
  971. nowFragment.canSub = true
  972. nowFragment.canAdd = true
  973. let remainder = newNum % pack
  974. if (remainder !== 0) {
  975. this.$message.error('不支持拆包且包装量为' + pack)
  976. let res = (Math.floor(newNum / pack) + 1) * pack
  977. nowFragment.num = res > reserve ? Math.floor(newNum / pack) * pack : res
  978. } else {
  979. nowFragment.num = newNum
  980. }
  981. newNum === buy && (nowFragment.canSub = false)
  982. newNum === reserve && (nowFragment.canAdd = false)
  983. }
  984. }
  985. }
  986. },
  987. subNum: function (index) {
  988. let nowFragment = this.fragments[index]
  989. if (nowFragment.canSub) {
  990. let pack = this.spotGoodsData[index].perQty || this.spotGoodsData[index].minPackQty
  991. let newNum = 0
  992. if (this.spotGoodsData[index].breakUp) {
  993. newNum = nowFragment.num - 1
  994. } else {
  995. newNum = nowFragment.num - pack
  996. }
  997. this.changeNum(newNum, index)
  998. this.getFragment(this.spotGoodsData[index], nowFragment)
  999. this.onInput(index)
  1000. } else {
  1001. this.$message.error('该商品最少购买' + this.spotGoodsData[index].minBuyQty + '件')
  1002. }
  1003. },
  1004. addNum: function (index) {
  1005. let nowFragment = this.fragments[index]
  1006. if (nowFragment.canAdd) {
  1007. let pack = this.spotGoodsData[index].perQty || this.spotGoodsData[index].minPackQty
  1008. let newNum = 0
  1009. if (this.spotGoodsData[index].breakUp) {
  1010. newNum = nowFragment.num + 1
  1011. } else {
  1012. newNum = nowFragment.num + pack
  1013. }
  1014. this.changeNum(newNum, index)
  1015. this.getFragment(this.spotGoodsData[index], nowFragment)
  1016. this.onInput(index)
  1017. } else {
  1018. this.$message.error('库存不足')
  1019. }
  1020. },
  1021. inputNum: function (index) {
  1022. if ((/^[\d]*$/).test(this.fragments[index].num)) {
  1023. this.changeNum(this.fragments[index].num, index)
  1024. this.getFragment(this.spotGoodsData[index], this.fragments[index])
  1025. } else {
  1026. this.message.error('请输入整数')
  1027. this.fragments[index].num = this.spotGoodsData[index].minBuyQty
  1028. }
  1029. this.onInput(index)
  1030. },
  1031. buyNow: function (goods, index) {
  1032. this.$http.post('/trade/order/buyNow', [{
  1033. uuid: goods.uuid,
  1034. batchCode: goods.batchCode,
  1035. number: this.fragments[index].num,
  1036. storeid: goods.storeid ? goods.storeid : goods.storeId,
  1037. storeUuid: goods.storeid ? goods.storeid : goods.storeId,
  1038. currencyName: goods.currencyName,
  1039. minPackQty: goods.minPackQty
  1040. }])
  1041. .then(response => {
  1042. if (response.data.success) {
  1043. if (response.data.message) {
  1044. this.$message({
  1045. message: response.data.message,
  1046. type: 'success'
  1047. })
  1048. window.setTimeout(function () {
  1049. window.open('/user#/order/pay/' + this.baseUtils.enidfilter(response.data.data.orderid))
  1050. }, 1000)
  1051. } else {
  1052. window.open('/user#/order/pay/' + this.baseUtils.enidfilter(response.data.data.orderid))
  1053. }
  1054. } else {
  1055. if (response.data.data && response.data.data.unvailable === 1) {
  1056. this.$message.error('产品信息已失效,请刷新页面')
  1057. } else {
  1058. this.$message.error(response.data.message)
  1059. }
  1060. }
  1061. }, err => {
  1062. console.log(err)
  1063. if (goods.minBuyQty > goods.reserve) {
  1064. this.$message.error('商品' + goods.code + '的库存已经不满足最小起订量')
  1065. }
  1066. })
  1067. },
  1068. linkSaler: function (commodity) {
  1069. this.baseUtils.goLinkUser(this, commodity.enUU)
  1070. }
  1071. },
  1072. created() {
  1073. // noDetail
  1074. this.$http.get('/seek/bom/noDetail?bomId=' + this.$route.params.id).then(res => {
  1075. this.bomInfo = res.data
  1076. })
  1077. }
  1078. }
  1079. </script>
  1080. <style lang="scss">
  1081. .batch-publish {
  1082. margin: 0 auto;
  1083. width: 1190px;
  1084. .red-text {
  1085. color: #ff0000;
  1086. }
  1087. .blue-text {
  1088. color: #3c7cf5;
  1089. }
  1090. .over-ell {
  1091. overflow: hidden;
  1092. text-overflow: ellipsis;
  1093. white-space: nowrap;
  1094. }
  1095. div.batch-publish-top {
  1096. margin: 30px 0 0 0;
  1097. font-size: 16px;
  1098. /*height: 60px;*/
  1099. line-height: 60px;
  1100. background: #f7f9fd;
  1101. padding-left: 24px;
  1102. position: relative;
  1103. .modify-btn {
  1104. position: absolute;
  1105. right: 20px;
  1106. top: 40px;
  1107. font-size: 14px;
  1108. width: 126px;
  1109. height: 34px;
  1110. line-height: 34px;
  1111. text-align: center;
  1112. border-radius: 2px;
  1113. color: #fff;
  1114. background: #ff8522;
  1115. }
  1116. > img {
  1117. width: 23px;
  1118. height: 31px;
  1119. margin-right: 12px;
  1120. }
  1121. .w50 {
  1122. width: 50%;
  1123. float: left
  1124. }
  1125. input {
  1126. height: 28px;
  1127. line-height: 28px;
  1128. color: #333;
  1129. border-radius: 5px;
  1130. font-size: 14px;
  1131. border: 1px solid #ddd;
  1132. }
  1133. input.text {
  1134. width: 280px;
  1135. text-indent: 12px;
  1136. }
  1137. }
  1138. .list-wrap {
  1139. padding: 30px 0 72px 0;
  1140. margin: 26px 0 109px 0;
  1141. -webkit-box-shadow: 0 0 3px #e2eae8;
  1142. -moz-box-shadow: 0 0 3px #e2eae8;
  1143. box-shadow: 0 0 3px #e2eae8;
  1144. .list-content {
  1145. width: 1150px;
  1146. margin: 0 auto;
  1147. table-layout: fixed;
  1148. > thead {
  1149. tr {
  1150. th {
  1151. background: #89aefa;
  1152. color: #fff;
  1153. font-weight: normal;
  1154. height: 40px;
  1155. line-height: 40px;
  1156. text-align: center;
  1157. .com-check-box {
  1158. margin-right: 2px;
  1159. }
  1160. i {
  1161. margin-right: 3px;
  1162. }
  1163. }
  1164. }
  1165. }
  1166. > tbody {
  1167. > tr {
  1168. height: 101px;
  1169. text-align: center;
  1170. border : {
  1171. bottom: 1px solid #bcd2ff;
  1172. left: 1px solid #bcd2ff;
  1173. right: 1px solid #bcd2ff;
  1174. }
  1175. &:hover {
  1176. background: #f1f5ff;
  1177. }
  1178. > td {
  1179. position: relative;
  1180. .prod-items {
  1181. height: 100px;
  1182. padding-top: 17px;
  1183. .prod-item {
  1184. position: relative;
  1185. display: inline-block;
  1186. height: 30px;
  1187. line-height: 30px;
  1188. float: left;
  1189. &:nth-child(2) {
  1190. margin-top: 9px;
  1191. margin-right: 0;
  1192. }
  1193. .pi-title {
  1194. display: inline-block;
  1195. vertical-align: middle;
  1196. text-align: right;
  1197. color: #999;
  1198. .red-text {
  1199. margin-right: 3px;
  1200. }
  1201. }
  1202. .pi-content {
  1203. display: inline-block;
  1204. text-align: left;
  1205. vertical-align: middle;
  1206. }
  1207. &.prod-item-large {
  1208. .pi-content {
  1209. width: 224px;
  1210. }
  1211. .pi-title {
  1212. width: 117px;
  1213. }
  1214. }
  1215. &.prod-item-small {
  1216. .pi-content {
  1217. width: 105px;
  1218. }
  1219. .pi-title {
  1220. width: 70px;
  1221. }
  1222. }
  1223. > ul {
  1224. line-height: normal;
  1225. position: absolute;
  1226. top: 31px;
  1227. left: 115px;
  1228. background: #fff;
  1229. border: 1px solid #b5b5b5;
  1230. z-index: 1;
  1231. max-height: 120px;
  1232. overflow-y: auto;
  1233. overflow-x: hidden;
  1234. border-radius: 2px;
  1235. width: 224px;
  1236. li {
  1237. height: 30px;
  1238. line-height: 30px;
  1239. cursor: pointer;
  1240. overflow: hidden;
  1241. text-overflow: ellipsis;
  1242. white-space: nowrap;
  1243. padding: 0 5px;
  1244. text-align: left;
  1245. &:hover {
  1246. background: #89aefa;
  1247. color: #fff;
  1248. }
  1249. }
  1250. }
  1251. }
  1252. }
  1253. .similar-select {
  1254. width: 145px;
  1255. margin: 0 auto;
  1256. border: 1px solid #b5b5b5;
  1257. height: 30px;
  1258. line-height: 30px;
  1259. overflow-y: hidden;
  1260. padding: 0 22px 0 5px;
  1261. background: url('/images/all/select-icon-full.png') no-repeat;
  1262. background-color: #fff;
  1263. background-position: 194px 10px;
  1264. cursor: default;
  1265. border-radius: 2px;
  1266. & + ul {
  1267. width: 145px;
  1268. top: 48px;
  1269. left: 12px;
  1270. &.brand-word-list {
  1271. left: 7px;
  1272. }
  1273. }
  1274. }
  1275. &.operate {
  1276. text-align: left;
  1277. font-size: 12px;
  1278. a {
  1279. color: #3c7cf5;
  1280. margin-left: 5px;
  1281. &.size-s {
  1282. padding: 4px 12px;
  1283. }
  1284. &.size-m {
  1285. padding: 4px 7px;
  1286. }
  1287. &:hover {
  1288. color: #fff;
  1289. background: #3c7cf5;
  1290. border-radius: 3px;
  1291. }
  1292. &.btn-ok {
  1293. background: #ff8522;
  1294. color: #fff;
  1295. border-radius: 3px;
  1296. }
  1297. }
  1298. }
  1299. .remind {
  1300. font-size: 12px;
  1301. }
  1302. }
  1303. &.spot-goods {
  1304. background: #fff;
  1305. > td {
  1306. .spot-goods-body {
  1307. .spot-goods-title {
  1308. height: 36px;
  1309. line-height: 36px;
  1310. background: #414140;
  1311. color: #fff;
  1312. }
  1313. table {
  1314. width: 1130px;
  1315. margin-left: 9px;
  1316. table-layout: fixed;
  1317. thead tr th {
  1318. text-align: center;
  1319. height: 34px;
  1320. line-height: 34px;
  1321. background: #fce8df;
  1322. font-weight: normal;
  1323. }
  1324. }
  1325. .spot-goods-list {
  1326. max-height: 250px;
  1327. overflow-y: auto;
  1328. overflow-x: hidden;
  1329. table {
  1330. margin-bottom: 10px;
  1331. tbody tr {
  1332. border: 1px solid #fce8df;
  1333. &:nth-child(even) {
  1334. background: #fdf8f5;
  1335. }
  1336. td {
  1337. height: 48px;
  1338. line-height: 48px;
  1339. &.input-number {
  1340. > div {
  1341. position: relative;
  1342. width: 100px;
  1343. margin: 0 auto;
  1344. span {
  1345. width: 17px;
  1346. height: 26px;
  1347. background: #4290f7;
  1348. line-height: 26px;
  1349. color: #fff;
  1350. display: inline-block;
  1351. font-size: 16px;
  1352. vertical-align: middle;
  1353. position: absolute;
  1354. top: 12px;
  1355. cursor: pointer;
  1356. &.not-allowed {
  1357. cursor: not-allowed;
  1358. background: #d7d5d5;
  1359. }
  1360. &:first-child {
  1361. left: -7px;
  1362. }
  1363. &:last-child {
  1364. right: -7px;
  1365. }
  1366. }
  1367. input {
  1368. width: 81px;
  1369. height: 26px;
  1370. text-align: center;
  1371. line-height: normal;
  1372. vertical-align: middle;
  1373. outline: none;
  1374. border: 1px solid #d1d0d0;
  1375. padding: 0 5px;
  1376. }
  1377. }
  1378. }
  1379. &.operate {
  1380. a {
  1381. color: #5078cb;
  1382. font-size: 12px;
  1383. }
  1384. span {
  1385. display: inline-block;
  1386. width: 64px;
  1387. height: 24px;
  1388. line-height: 24px;
  1389. text-align: center;
  1390. background: #4290f7;
  1391. color: #fff;
  1392. margin-left: 13px;
  1393. cursor: pointer;
  1394. font-size: 12px;
  1395. border-radius: 2px;
  1396. }
  1397. }
  1398. }
  1399. }
  1400. }
  1401. }
  1402. }
  1403. }
  1404. }
  1405. &.modify-row {
  1406. td {
  1407. input, select {
  1408. height: 30px;
  1409. border-radius: 2px;
  1410. border: 1px solid #dadada;
  1411. text-align: center;
  1412. padding: 0 5px;
  1413. display: inline-block;
  1414. &.error {
  1415. border-color: #f4645f !important;
  1416. }
  1417. }
  1418. input:focus {
  1419. -webkit-box-shadow: none;
  1420. -moz-box-shadow: none;
  1421. box-shadow: none;
  1422. border: 1px solid #3c7cf5;
  1423. }
  1424. .prod-item {
  1425. position: relative;
  1426. &.prod-item-large {
  1427. input {
  1428. width: 224px;
  1429. }
  1430. }
  1431. &.prod-item-small {
  1432. input {
  1433. width: 105px;
  1434. }
  1435. }
  1436. &.pi-select {
  1437. input {
  1438. width: 103px;
  1439. padding: 0 5px 0 30px;
  1440. }
  1441. select {
  1442. width: 25px;
  1443. padding: 0 0 0 2px;
  1444. background: url(/images/applyPurchase/select2.png) no-repeat right;
  1445. background-size: 12px 28px;
  1446. background-position: 12px 0;
  1447. position: absolute;
  1448. top: 1px;
  1449. border-bottom: none;
  1450. border-top: none;
  1451. border-left: 0;
  1452. }
  1453. }
  1454. }
  1455. &:nth-child(2) {
  1456. input {
  1457. width: 83px;
  1458. }
  1459. }
  1460. &:nth-child(3) {
  1461. input {
  1462. width: 90px;
  1463. }
  1464. }
  1465. &:nth-child(4) {
  1466. div {
  1467. width: 125px;
  1468. overflow: unset;
  1469. input {
  1470. width: 115px;
  1471. border-radius: 2px;
  1472. border: 1px solid #dadada;
  1473. }
  1474. }
  1475. }
  1476. }
  1477. }
  1478. }
  1479. }
  1480. }
  1481. .submit-area {
  1482. margin: 51px auto 0;
  1483. text-align: center;
  1484. clear: both;
  1485. a {
  1486. display: inline-block;
  1487. width: 126px;
  1488. height: 34px;
  1489. line-height: 34px;
  1490. text-align: center;
  1491. border-radius: 2px;
  1492. color: #fff;
  1493. background: #ff8522;
  1494. }
  1495. }
  1496. }
  1497. }
  1498. </style>