BatchPublish.vue 57 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508
  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" maxlength="100"/>
  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" maxlength="5" v-model="bomInfo.count" class="text" @blur="countBlur(bomInfo.count)" />
  12. </div>
  13. <div class="w50" style="padding-left: 62px;">
  14. 规格:<input type="text" v-model="bomInfo.spec" class="text" maxlength="100"/>
  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="350">卖家</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="350" 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" maxlength="4" 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. countBlur(item) {
  400. if (this.bomInfo.count < 1 || this.bomInfo.count === '') {
  401. this.bomInfo.count = 1
  402. }
  403. },
  404. getDate1: function () {
  405. 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
  406. this.bomInfo.flag = true
  407. // 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
  408. // this.validObj.deadline = true
  409. },
  410. initModifyObj: function () {
  411. for (let attr in this.modifyObj) {
  412. this.modifyObj[attr] = attr === 'currency' ? 'RMB' : ''
  413. }
  414. },
  415. initValidObj: function () {
  416. this.validObj = {
  417. code: true,
  418. brand: true,
  419. unitPrice: true,
  420. amount: true,
  421. deadline: true,
  422. spec: true,
  423. kind: true
  424. }
  425. },
  426. listenPage: function (page) {
  427. this.nowPage = page
  428. this.reloadData()
  429. },
  430. reloadData: function () {
  431. this.$store.dispatch('applyPurchase/loadBOMMaterialList', {bomId: this.$route.params.id, page: this.nowPage, count: this.pageSize})
  432. },
  433. submitBOM: function () {
  434. // let str = ''
  435. // for (let i = 0; i < this.bomList.content.length; i++) {
  436. // if (this.bomList.content[i].checked) {
  437. // if (!this.getSingleValidInfo(this.bomList.content[i])) {
  438. // this.$message.error('请选择信息完善的产品发布求购')
  439. // return
  440. // }
  441. // str += this.bomList.content[i].id + ','
  442. // }
  443. // }
  444. // let param = {'bomId': Number(this.$route.params.id)}
  445. // if (str.length) {
  446. // str = str.substring(0, str.length - 1)
  447. // param.spIds = str
  448. // }
  449. if (!this.bomInfo.count || this.bomInfo.count === '') {
  450. this.$message.error('请输入采购套数')
  451. return
  452. } else if (!this.bomInfo.endTime || this.bomInfo.endTime === '') {
  453. this.$message.error('请选择截止时间')
  454. return
  455. }
  456. // else if (!this.bomInfo.spec || this.bomInfo.spec === '') {
  457. // this.$message.error('请输入规格')
  458. // return
  459. // }
  460. let bom = this.bomInfo
  461. this.$http.post('/seek/bom/edit', bom).then(response => {
  462. this.$http.post('/seek/confirmBom?bomId=' + Number(this.$route.params.id) + '&endTime=' + this.bomInfo.endTime.getTime() + '&count=' + this.bomInfo.count)
  463. .then(response => {
  464. if (response.data.success) {
  465. // this.showRemindBox = true
  466. // this.successResult = response.data.data
  467. // this.listenPage(1)
  468. // this.$store.dispatch('applyPurchase/loadBOMNumber', {bomId: this.$route.params.id})
  469. if (response.data.data.successAmount && response.data.data.successAmount > 0) {
  470. this.$router.push('/applyPurchase/result?status=success&count=' + response.data.data.successAmount)
  471. } else {
  472. this.$router.push('/applyPurchase/result?status=error')
  473. }
  474. } else {
  475. // this.$message.error(response.data.message)
  476. this.$router.push('/applyPurchase/result?status=error')
  477. }
  478. }, err => {
  479. console.log(err)
  480. this.$message.error('系统错误')
  481. })
  482. })
  483. },
  484. onCheck: function (index) {
  485. if (typeof index === 'undefined') {
  486. let isCheckedAll = true
  487. for (let i = 0; i < this.bomList.content.length; i++) {
  488. if (!this.bomList.content[i].checked) {
  489. isCheckedAll = false
  490. break
  491. }
  492. }
  493. this.setAllCheck(!isCheckedAll)
  494. this.isCheckAll = !isCheckedAll
  495. }
  496. },
  497. setAllCheck: function (flag) {
  498. for (let i = 0; i < this.bomList.content.length; i++) {
  499. this.bomList.content[i].checked = flag
  500. }
  501. },
  502. cancelModifyItem: function () {
  503. for (let i = 0; i < this.bomList.content.length; i++) {
  504. if (this.bomList.content[i].active) {
  505. this.$message.error('抱歉,您尚有未保存的信息')
  506. return false
  507. }
  508. this.bomList.content[i].active = false
  509. }
  510. return true
  511. },
  512. modifyItem: function (index) {
  513. if (!this.cancelModifyItem()) {
  514. return
  515. }
  516. this.cancelShowSpotGoods()
  517. // this.$set(this.bomList.content[index], 'active', true)
  518. this.bomList.content[index].active = true
  519. let _this = this
  520. this.initModifyObj()
  521. this.initValidObj()
  522. for (let attr in this.bomList.content[index]) {
  523. // console.log(attr + ':' + _this.bomList.content[index][attr])
  524. _this.$set(_this.modifyObj, attr, _this.bomList.content[index][attr])
  525. // _this.modifyObj[attr] = _this.bomList.content[index][attr]
  526. }
  527. // this.modifyObj = this.bomList.content[index]
  528. this.modifyObj.deadline = this.bomList.content[index].deadline ? this.bomList.content[index].deadline : ''
  529. },
  530. cancelModify: function (index) {
  531. this.bomList.content[index].active = false
  532. },
  533. // getDate: function (input) {
  534. // const d = new Date(input)
  535. // const year = d.getFullYear()
  536. // const monthTemp = d.getMonth() + 1
  537. // const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
  538. // const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate()
  539. // return year + '-' + month + '-' + day
  540. // },
  541. // validDate: function (timestamp) {
  542. // let now = new Date().getTime()
  543. // return timestamp - now <= 1000 * 60 * 60 * 24 * 90 && timestamp - now > 0
  544. // },
  545. submitModify: function (index) {
  546. let checkValid = this.checkAll()
  547. if (this.getSingleValidInfo(this.modifyObj) && checkValid) {
  548. if (!this.modifyObj.unitPrice) {
  549. this.modifyObj.currency = null
  550. }
  551. this.modifyObj.code = this.modifyObj.code.trim()
  552. delete this.modifyObj.brandWord
  553. delete this.modifyObj.codeWord
  554. this.$http.put('/seek/updateSeekPurchaseByBatch', this.modifyObj)
  555. .then(response => {
  556. if (response.data.success) {
  557. this.reloadData()
  558. this.$message.success('修改成功')
  559. // this.bomList.content[index].active = false
  560. } else {
  561. this.$message.error('修改失败')
  562. }
  563. }, err => {
  564. console.log(err)
  565. this.$message.error('系统错误')
  566. })
  567. } else {
  568. if (!checkValid) {
  569. // if (!this.validObj.deadline) {
  570. // if (!this.isValidDate(this.modifyObj.deadline)) {
  571. // this.$message.error('截止日期需在90天以内')
  572. // } else {
  573. // this.$message.error('截止日期不能为空')
  574. // }
  575. // } else
  576. if (!this.validObj.amount || !this.validObj.unitPrice) {
  577. this.$message.error('请输入正确的数值')
  578. }
  579. } else {
  580. this.$message.error('请完善信息')
  581. }
  582. }
  583. },
  584. deleteItem: function (index) {
  585. if (!index && index !== 0) {
  586. let str = ''
  587. for (let i = 0; i < this.bomList.content.length; i++) {
  588. if (this.bomList.content[i].checked) {
  589. str += this.bomList.content[i].id + ','
  590. }
  591. }
  592. let param = {}
  593. if (str.length) {
  594. str = str.substring(0, str.length - 1)
  595. param.spIds = str
  596. this.doDelete(param)
  597. } else {
  598. this.$message.error('请勾选')
  599. return
  600. }
  601. } else {
  602. this.doDelete({spIds: this.bomList.content[index].id})
  603. }
  604. },
  605. doDelete: function (param) {
  606. this.$http.put('/seek/deleteSeekPurchaseByBatch', param)
  607. .then(response => {
  608. if (response.data.success) {
  609. this.listenPage(1)
  610. this.$message.success('删除成功')
  611. } else {
  612. this.$message.error('删除失败')
  613. }
  614. }, err => {
  615. console.log(err)
  616. this.$message.error('系统错误')
  617. })
  618. },
  619. isValidTime: function (time) {
  620. let now = this.baseUtils.getClearDay(this.baseUtils.formatDate(new Date(), 'yyyy-MM-dd'))
  621. return !time || (time >= now && time <= now + 1000 * 60 * 60 * 24 * 91)
  622. },
  623. isValidDate: function (date) {
  624. console.log(date)
  625. let dateTmp = new Date(this.baseUtils.formatDate(new Date(dateTmp), 'yyyy-MM-dd')).getTime()
  626. // this.modifyObj.deadline = date
  627. // console.log(date)
  628. let now = this.baseUtils.getClearDay(this.baseUtils.formatDate(new Date(), 'yyyy-MM-dd'))
  629. // let time = new Date(date).getTime()
  630. return !dateTmp || (dateTmp >= now && dateTmp <= now + 1000 * 60 * 60 * 24 * 91)
  631. },
  632. getSimilarCode: function () {
  633. if (this.modifyObj.code) {
  634. this.$http.get('/search/similarComponents', {params: {keyword: this.modifyObj.code}})
  635. .then(response => {
  636. this.similarCode = response.data
  637. if (response.data.length) {
  638. this.showSimilarCodeList = true
  639. } else {
  640. this.showSimilarCodeList = false
  641. }
  642. })
  643. } else {
  644. this.showSimilarCodeList = false
  645. }
  646. },
  647. getSimilarBrand: function () {
  648. if (this.modifyObj.brand) {
  649. this.$http.get('/search/similarBrands', {params: {keyword: this.modifyObj.brand}})
  650. .then(response => {
  651. this.similarBrand = response.data
  652. if (response.data.length) {
  653. this.showSimilarBrandList = true
  654. } else {
  655. this.showSimilarBrandList = false
  656. }
  657. })
  658. } else {
  659. this.showSimilarBrandList = false
  660. }
  661. },
  662. getSingleValidInfo: function (item) {
  663. // && item.deadline && this.isValidDate(item.deadline)
  664. return item.code && item.brand
  665. },
  666. checkCode: function () {
  667. let code = this.modifyObj.code.trim()
  668. let nullStrFlag = this.baseUtils.checkNullStr(code)
  669. this.validObj.code = code && code !== '' && nullStrFlag
  670. if (!this.validObj.code) {
  671. if (!nullStrFlag) {
  672. this.$message.error('型号输入不合法')
  673. } else {
  674. this.$message.error('型号不能为空')
  675. }
  676. }
  677. return this.validObj.code
  678. },
  679. checkBrand: function () {
  680. let nullStrFlag = this.baseUtils.checkNullStr(this.modifyObj.brand)
  681. this.validObj.brand = this.modifyObj.brand && this.modifyObj.brand !== '' && nullStrFlag
  682. if (!this.validObj.brand) {
  683. if (!nullStrFlag) {
  684. this.$message.error('品牌输入不合法')
  685. } else {
  686. this.$message.error('品牌不能为空')
  687. }
  688. }
  689. return this.validObj.brand
  690. },
  691. checkUnitPrice: function () {
  692. this.validObj.unitPrice = (!this.modifyObj.unitPrice || this.modifyObj.unitPrice === '') ? true : this.modifyObj.unitPrice > 0 && this.modifyObj.unitPrice < 100000000
  693. return this.validObj.unitPrice
  694. },
  695. checkAmount: function () {
  696. this.validObj.amount = (!this.modifyObj.amount || this.modifyObj.amount === '') ? true : this.modifyObj.amount > 0 && this.modifyObj.amount < 1000000000
  697. return this.validObj.amount
  698. },
  699. checkKind: function() {
  700. let nullStrFlag = this.baseUtils.checkNullStr(this.modifyObj.kind)
  701. this.validObj.kind = this.modifyObj.kind && this.modifyObj.kind !== ''
  702. // if (!this.validObj.kind) {
  703. if (!nullStrFlag) {
  704. this.$message.error('物料名称输入不合法')
  705. } else if (!this.validObj.kind) {
  706. this.$message.error('物料名称不能为空')
  707. }
  708. // }
  709. return this.validObj.kind
  710. },
  711. checkSpec: function () {
  712. let nullStrFlag = this.baseUtils.checkNullStr(this.modifyObj.spec)
  713. this.validObj.spec = nullStrFlag
  714. if (!nullStrFlag) {
  715. this.$message.error('规格输入不合法')
  716. }
  717. return this.validObj.spec
  718. },
  719. checkAll: function () {
  720. // && this.checkSpec()
  721. // && this.checkUnitPrice()
  722. // && this.checkDeadline()
  723. return this.checkBrand() && this.checkCode() && this.checkKind() && this.checkAmount()
  724. },
  725. checkDeadline: function () {
  726. this.validObj.deadline = this.modifyObj.deadline && this.modifyObj.deadline !== '' && this.isValidDate(this.modifyObj.deadline)
  727. return this.validObj.deadline
  728. },
  729. onUnitPriceInput: function () {
  730. let price = this.modifyObj.unitPrice
  731. if (price >= 10000) {
  732. this.modifyObj.unitPrice = price.substring(0, 4)
  733. } else if (price.indexOf('.') > -1) {
  734. let arr = price.split('.')
  735. if (arr[0].length > 4) {
  736. this.modifyObj.unitPrice = Number(arr[0].substring(0, 4) + '.' + arr[1])
  737. } else if (arr[1].length > 6) {
  738. this.modifyObj.unitPrice = Number(arr[0] + '.' + arr[1].substring(0, 6))
  739. }
  740. }
  741. },
  742. onProduceDateChange: function () {
  743. if (this.modifyObj.produceDate && this.baseUtils.getRealLen(this.modifyObj.produceDate) > 12) {
  744. this.modifyObj.produceDate = this.baseUtils.cutOutString(this.modifyObj.produceDate, 12)
  745. }
  746. },
  747. onEncapsulationChange: function () {
  748. if (this.modifyObj.encapsulation && this.baseUtils.getRealLen(this.modifyObj.encapsulation) > 20) {
  749. this.modifyObj.encapsulation = this.baseUtils.cutOutString(this.modifyObj.encapsulation, 20)
  750. }
  751. },
  752. onCodeChange: function () {
  753. if ((/[^\x00-\xff]/g).test(this.modifyObj.code)) {
  754. let chineseIndex = -1
  755. for (let i = 0; i < this.modifyObj.code.length; i++) {
  756. if ((/[^\x00-\xff]/g).test(this.modifyObj.code.charAt(i))) {
  757. chineseIndex = i
  758. break
  759. }
  760. }
  761. this.modifyObj.code = this.baseUtils.cutOutString(this.modifyObj.code, chineseIndex)
  762. } else if (this.modifyObj.code && this.baseUtils.getRealLen(this.modifyObj.code) > 100) {
  763. this.modifyObj.code = this.baseUtils.cutOutString(this.modifyObj.code, 100)
  764. } else {
  765. this.getSimilarCode()
  766. }
  767. },
  768. onBrandChange: function () {
  769. this.modifyObj.brand = this.modifyObj.brand.trim()
  770. if ((/[^\x00-\xff]/g).test(this.modifyObj.brand)) {
  771. let chineseIndex = -1
  772. for (let i = 0; i < this.modifyObj.brand.length; i++) {
  773. if ((/[^\x00-\xff]/g).test(this.modifyObj.brand.charAt(i)) && !(/[\u4e00-\u9fa5]/).test(this.modifyObj.brand.charAt(i))) {
  774. chineseIndex = i
  775. break
  776. }
  777. }
  778. if (chineseIndex > -1) {
  779. this.modifyObj.brand = this.modifyObj.brand.substring(0, chineseIndex)
  780. }
  781. } else if (this.modifyObj.brand && this.baseUtils.getRealLen(this.modifyObj.brand) > 50) {
  782. this.modifyObj.brand = this.baseUtils.cutOutString(this.modifyObj.brand, 50)
  783. }
  784. this.getSimilarBrand()
  785. },
  786. onProdTitleInput: function () {
  787. if (this.modifyObj.kind && this.baseUtils.getRealLen(this.modifyObj.kind) > 40) {
  788. this.modifyObj.kind = this.baseUtils.cutOutString(this.modifyObj.kind, 40)
  789. }
  790. },
  791. onSpecInput: function () {
  792. if (this.modifyObj.spec && this.baseUtils.getRealLen(this.modifyObj.spec) > 100) {
  793. this.modifyObj.spec = this.baseUtils.cutOutString(this.modifyObj.spec, 100)
  794. }
  795. },
  796. onAmountInput: function () {
  797. if (!(/^[0-9]*$/).test(this.modifyObj.amount)) {
  798. let chineseIndex = -1
  799. for (let i = 0; i < this.modifyObj.amount.length; i++) {
  800. if (!(/^[0-9]*$/).test(this.modifyObj.amount.charAt(i))) {
  801. chineseIndex = i
  802. break
  803. }
  804. }
  805. this.modifyObj.amount = this.baseUtils.cutOutString(this.modifyObj.amount, chineseIndex)
  806. } else if (this.modifyObj.amount.length > 9) {
  807. this.modifyObj.amount = this.baseUtils.cutOutString(this.modifyObj.amount, 9)
  808. }
  809. },
  810. setCode: function (code) {
  811. this.modifyObj.code = code
  812. this.showSimilarCodeList = false
  813. },
  814. setBrand: function (brand) {
  815. this.modifyObj.brand = brand
  816. this.showSimilarBrandList = false
  817. },
  818. setShowCodeWord: function (index, event) {
  819. event.stopPropagation()
  820. for (let i = 0; i < this.bomList.content.length; i++) {
  821. if (i !== index) {
  822. this.bomList.content[i].showCodeWord = false
  823. }
  824. this.bomList.content[i].showBrandWord = false
  825. }
  826. this.bomList.content[index].showCodeWord = !this.bomList.content[index].showCodeWord
  827. },
  828. setShowBrandWord: function (index, event) {
  829. event.stopPropagation()
  830. for (let i = 0; i < this.bomList.content.length; i++) {
  831. if (i !== index) {
  832. this.bomList.content[i].showBrandWord = false
  833. }
  834. this.bomList.content[i].showCodeWord = false
  835. }
  836. this.bomList.content[index].showBrandWord = !this.bomList.content[index].showBrandWord
  837. },
  838. modifyItemByWord: function (index, param, type) {
  839. if (type === 'code') {
  840. this.bomList.content[index].code = param
  841. this.requestModify(this.bomList.content[index])
  842. } else if (type === 'brand') {
  843. this.bomList.content[index].brand = param
  844. this.requestModify(this.bomList.content[index])
  845. } else {
  846. this.$message.error('修改失败')
  847. }
  848. },
  849. requestModify: function (item) {
  850. this.$http.put('/seek/updateSeekPurchaseByBatch', item)
  851. .then(response => {
  852. if (response.data.success) {
  853. this.$message.success('修改成功')
  854. } else {
  855. this.$message.error('修改失败')
  856. }
  857. this.reloadData()
  858. }, err => {
  859. console.log(err)
  860. this.$message.error('系统错误')
  861. // this.reloadData()
  862. })
  863. },
  864. cancelShowSpotGoods: function () {
  865. for (let i = 0; i < this.bomList.content.length; i++) {
  866. this.bomList.content[i].showSpotGoods = false
  867. }
  868. },
  869. setShowSpotGoods: function (flag, item) {
  870. if (flag && item && item.spotGoods.length) {
  871. this.spotGoodsData = this.baseUtils.deepCopy(item.spotGoods)
  872. this.initFragments()
  873. }
  874. if (!this.cancelModifyItem()) {
  875. return
  876. }
  877. this.cancelShowSpotGoods()
  878. item.showSpotGoods = flag
  879. },
  880. initFragment: function (commodity) {
  881. if (!commodity) {
  882. return {}
  883. }
  884. let fragment = {}
  885. let prices = commodity.prices[0]
  886. fragment.num = commodity.minBuyQty
  887. fragment.prices = prices
  888. if (commodity.currencyName !== 'USD') {
  889. fragment.currency = 'RMB'
  890. } else {
  891. fragment.currency = 'USD'
  892. }
  893. if (fragment.currency !== 'USD') {
  894. fragment.price = prices.rMBPrice
  895. } else {
  896. fragment.price = prices.uSDPrice
  897. }
  898. fragment.canAdd = true
  899. fragment.canSub = false
  900. return fragment
  901. },
  902. initFragments: function () {
  903. this.fragments = []
  904. for (let i = 0; i < this.spotGoodsData.length; i++) {
  905. this.fragments.push(this.initFragment(this.spotGoodsData[i]))
  906. }
  907. },
  908. getFragment: function (commodity, fragment) {
  909. // 判断是否小于第一分段的起订量
  910. if (commodity.prices[0].start > fragment.num) {
  911. fragment.num = commodity.prices[0].start
  912. }
  913. // 获取分段的信息
  914. let prices = commodity.prices
  915. for (let i = 0; i < prices.length; i++) {
  916. if (fragment.num <= prices[i].end) {
  917. fragment.prices = prices[i]
  918. break
  919. }
  920. }
  921. },
  922. onInput: function (index) {
  923. let prices = this.spotGoodsData[index].prices
  924. if (prices && prices.length) {
  925. for (let i = 0; i < prices.length; i++) {
  926. if (this.fragments[index].num >= prices[i].start && this.fragments[index].num <= prices[i].end) {
  927. this.fragments[index].price = this.fragments[index].currency === 'RMB' ? prices[i].rMBPrice : prices[i].uSDPrice
  928. break
  929. }
  930. }
  931. }
  932. },
  933. changeNum: function (newNum, index) {
  934. let pack = this.spotGoodsData[index].perQty || this.spotGoodsData[index].minPackQty
  935. let buy = this.spotGoodsData[index].minBuyQty
  936. let reserve = this.spotGoodsData[index].reserve
  937. let breakUp = this.spotGoodsData[index].breakUp
  938. let nowFragment = this.fragments[index]
  939. if (!newNum) {
  940. nowFragment.num = buy
  941. } else {
  942. newNum = parseInt(newNum)
  943. if (breakUp) {
  944. if (newNum < buy) {
  945. this.$message.error('最小起订量为' + buy)
  946. nowFragment.num = buy
  947. nowFragment.canSub = false
  948. nowFragment.canAdd = true
  949. } else if (newNum > reserve) {
  950. this.$message.error('库存不足')
  951. nowFragment.num = reserve
  952. nowFragment.canAdd = false
  953. nowFragment.canSub = true
  954. } else {
  955. nowFragment.canSub = true
  956. nowFragment.canAdd = true
  957. nowFragment.num = newNum
  958. newNum === buy && (nowFragment.canSub = false)
  959. newNum === reserve && (nowFragment.canAdd = false)
  960. }
  961. } else {
  962. if (newNum < buy) {
  963. this.$message.error('最小起订量为' + buy)
  964. nowFragment.num = buy
  965. nowFragment.canSub = false
  966. if (newNum > reserve) {
  967. this.$message.error('库存不足')
  968. nowFragment.num = reserve - (reserve % pack)
  969. nowFragment.canAdd = false
  970. }
  971. } else if (newNum > reserve) {
  972. nowFragment.canSub = true
  973. nowFragment.canAdd = false
  974. this.$message.error('库存不足')
  975. nowFragment.num = reserve - (reserve % pack)
  976. } else {
  977. nowFragment.canSub = true
  978. nowFragment.canAdd = true
  979. let remainder = newNum % pack
  980. if (remainder !== 0) {
  981. this.$message.error('不支持拆包且包装量为' + pack)
  982. let res = (Math.floor(newNum / pack) + 1) * pack
  983. nowFragment.num = res > reserve ? Math.floor(newNum / pack) * pack : res
  984. } else {
  985. nowFragment.num = newNum
  986. }
  987. newNum === buy && (nowFragment.canSub = false)
  988. newNum === reserve && (nowFragment.canAdd = false)
  989. }
  990. }
  991. }
  992. },
  993. subNum: function (index) {
  994. let nowFragment = this.fragments[index]
  995. if (nowFragment.canSub) {
  996. let pack = this.spotGoodsData[index].perQty || this.spotGoodsData[index].minPackQty
  997. let newNum = 0
  998. if (this.spotGoodsData[index].breakUp) {
  999. newNum = nowFragment.num - 1
  1000. } else {
  1001. newNum = nowFragment.num - pack
  1002. }
  1003. this.changeNum(newNum, index)
  1004. this.getFragment(this.spotGoodsData[index], nowFragment)
  1005. this.onInput(index)
  1006. } else {
  1007. this.$message.error('该商品最少购买' + this.spotGoodsData[index].minBuyQty + '件')
  1008. }
  1009. },
  1010. addNum: function (index) {
  1011. let nowFragment = this.fragments[index]
  1012. if (nowFragment.canAdd) {
  1013. let pack = this.spotGoodsData[index].perQty || this.spotGoodsData[index].minPackQty
  1014. let newNum = 0
  1015. if (this.spotGoodsData[index].breakUp) {
  1016. newNum = nowFragment.num + 1
  1017. } else {
  1018. newNum = nowFragment.num + pack
  1019. }
  1020. this.changeNum(newNum, index)
  1021. this.getFragment(this.spotGoodsData[index], nowFragment)
  1022. this.onInput(index)
  1023. } else {
  1024. this.$message.error('库存不足')
  1025. }
  1026. },
  1027. inputNum: function (index) {
  1028. if ((/^[\d]*$/).test(this.fragments[index].num)) {
  1029. this.changeNum(this.fragments[index].num, index)
  1030. this.getFragment(this.spotGoodsData[index], this.fragments[index])
  1031. } else {
  1032. this.message.error('请输入整数')
  1033. this.fragments[index].num = this.spotGoodsData[index].minBuyQty
  1034. }
  1035. this.onInput(index)
  1036. },
  1037. buyNow: function (goods, index) {
  1038. this.$http.post('/trade/order/buyNow', [{
  1039. uuid: goods.uuid,
  1040. batchCode: goods.batchCode,
  1041. number: this.fragments[index].num,
  1042. storeid: goods.storeid ? goods.storeid : goods.storeId,
  1043. storeUuid: goods.storeid ? goods.storeid : goods.storeId,
  1044. currencyName: goods.currencyName,
  1045. minPackQty: goods.minPackQty
  1046. }])
  1047. .then(response => {
  1048. if (response.data.success) {
  1049. if (response.data.message) {
  1050. this.$message({
  1051. message: response.data.message,
  1052. type: 'success'
  1053. })
  1054. window.setTimeout(function () {
  1055. window.open('/user#/order/pay/' + this.baseUtils.enidfilter(response.data.data.orderid))
  1056. }, 1000)
  1057. } else {
  1058. window.open('/user#/order/pay/' + this.baseUtils.enidfilter(response.data.data.orderid))
  1059. }
  1060. } else {
  1061. if (response.data.data && response.data.data.unvailable === 1) {
  1062. this.$message.error('产品信息已失效,请刷新页面')
  1063. } else {
  1064. this.$message.error(response.data.message)
  1065. }
  1066. }
  1067. }, err => {
  1068. console.log(err)
  1069. if (goods.minBuyQty > goods.reserve) {
  1070. this.$message.error('商品' + goods.code + '的库存已经不满足最小起订量')
  1071. }
  1072. })
  1073. },
  1074. linkSaler: function (commodity) {
  1075. this.baseUtils.goLinkUser(this, commodity.enUU)
  1076. }
  1077. },
  1078. created() {
  1079. // noDetail
  1080. this.$http.get('/seek/bom/noDetail?bomId=' + this.$route.params.id).then(res => {
  1081. this.bomInfo = res.data
  1082. this.bomInfo.count = this.bomInfo.count || 1
  1083. })
  1084. }
  1085. }
  1086. </script>
  1087. <style lang="scss">
  1088. .batch-publish {
  1089. margin: 0 auto;
  1090. width: 1190px;
  1091. .red-text {
  1092. color: #ff0000;
  1093. }
  1094. .blue-text {
  1095. color: #3c7cf5;
  1096. }
  1097. .over-ell {
  1098. overflow: hidden;
  1099. text-overflow: ellipsis;
  1100. white-space: nowrap;
  1101. }
  1102. div.batch-publish-top {
  1103. margin: 30px 0 0 0;
  1104. font-size: 16px;
  1105. /*height: 60px;*/
  1106. line-height: 60px;
  1107. background: #f7f9fd;
  1108. padding-left: 24px;
  1109. position: relative;
  1110. .modify-btn {
  1111. position: absolute;
  1112. right: 20px;
  1113. top: 40px;
  1114. font-size: 14px;
  1115. width: 126px;
  1116. height: 34px;
  1117. line-height: 34px;
  1118. text-align: center;
  1119. border-radius: 2px;
  1120. color: #fff;
  1121. background: #ff8522;
  1122. }
  1123. > img {
  1124. width: 23px;
  1125. height: 31px;
  1126. margin-right: 12px;
  1127. }
  1128. .w50 {
  1129. width: 50%;
  1130. float: left
  1131. }
  1132. input {
  1133. height: 28px;
  1134. line-height: 28px;
  1135. color: #333;
  1136. border-radius: 5px;
  1137. font-size: 14px;
  1138. border: 1px solid #ddd;
  1139. }
  1140. input.text {
  1141. width: 280px;
  1142. text-indent: 12px;
  1143. }
  1144. }
  1145. .list-wrap {
  1146. padding: 30px 0 72px 0;
  1147. margin: 26px 0 109px 0;
  1148. -webkit-box-shadow: 0 0 3px #e2eae8;
  1149. -moz-box-shadow: 0 0 3px #e2eae8;
  1150. box-shadow: 0 0 3px #e2eae8;
  1151. .list-content {
  1152. width: 1150px;
  1153. margin: 0 auto;
  1154. table-layout: fixed;
  1155. > thead {
  1156. tr {
  1157. th {
  1158. background: #89aefa;
  1159. color: #fff;
  1160. font-weight: normal;
  1161. height: 40px;
  1162. line-height: 40px;
  1163. text-align: center;
  1164. .com-check-box {
  1165. margin-right: 2px;
  1166. }
  1167. i {
  1168. margin-right: 3px;
  1169. }
  1170. }
  1171. }
  1172. }
  1173. > tbody {
  1174. > tr {
  1175. height: 101px;
  1176. text-align: center;
  1177. border : {
  1178. bottom: 1px solid #bcd2ff;
  1179. left: 1px solid #bcd2ff;
  1180. right: 1px solid #bcd2ff;
  1181. }
  1182. &:hover {
  1183. background: #f1f5ff;
  1184. }
  1185. > td {
  1186. position: relative;
  1187. .prod-items {
  1188. height: 100px;
  1189. padding-top: 17px;
  1190. .prod-item {
  1191. position: relative;
  1192. display: inline-block;
  1193. height: 30px;
  1194. line-height: 30px;
  1195. float: left;
  1196. &:nth-child(2) {
  1197. margin-top: 9px;
  1198. margin-right: 0;
  1199. }
  1200. .pi-title {
  1201. display: inline-block;
  1202. vertical-align: middle;
  1203. text-align: right;
  1204. color: #999;
  1205. .red-text {
  1206. margin-right: 3px;
  1207. }
  1208. }
  1209. .pi-content {
  1210. display: inline-block;
  1211. text-align: left;
  1212. vertical-align: middle;
  1213. }
  1214. &.prod-item-large {
  1215. .pi-content {
  1216. width: 224px;
  1217. }
  1218. .pi-title {
  1219. width: 117px;
  1220. }
  1221. }
  1222. &.prod-item-small {
  1223. .pi-content {
  1224. width: 105px;
  1225. }
  1226. .pi-title {
  1227. width: 70px;
  1228. }
  1229. }
  1230. > ul {
  1231. line-height: normal;
  1232. position: absolute;
  1233. top: 31px;
  1234. left: 115px;
  1235. background: #fff;
  1236. border: 1px solid #b5b5b5;
  1237. z-index: 1;
  1238. max-height: 120px;
  1239. overflow-y: auto;
  1240. overflow-x: hidden;
  1241. border-radius: 2px;
  1242. width: 224px;
  1243. li {
  1244. height: 30px;
  1245. line-height: 30px;
  1246. cursor: pointer;
  1247. overflow: hidden;
  1248. text-overflow: ellipsis;
  1249. white-space: nowrap;
  1250. padding: 0 5px;
  1251. text-align: left;
  1252. &:hover {
  1253. background: #89aefa;
  1254. color: #fff;
  1255. }
  1256. }
  1257. }
  1258. }
  1259. }
  1260. .similar-select {
  1261. width: 145px;
  1262. margin: 0 auto;
  1263. border: 1px solid #b5b5b5;
  1264. height: 30px;
  1265. line-height: 30px;
  1266. overflow-y: hidden;
  1267. padding: 0 22px 0 5px;
  1268. background: url('/images/all/select-icon-full.png') no-repeat;
  1269. background-color: #fff;
  1270. background-position: 194px 10px;
  1271. cursor: default;
  1272. border-radius: 2px;
  1273. & + ul {
  1274. width: 145px;
  1275. top: 48px;
  1276. left: 12px;
  1277. &.brand-word-list {
  1278. left: 7px;
  1279. }
  1280. }
  1281. }
  1282. &.operate {
  1283. text-align: left;
  1284. font-size: 12px;
  1285. a {
  1286. color: #3c7cf5;
  1287. margin-left: 5px;
  1288. &.size-s {
  1289. padding: 4px 12px;
  1290. }
  1291. &.size-m {
  1292. padding: 4px 7px;
  1293. }
  1294. &:hover {
  1295. color: #fff;
  1296. background: #3c7cf5;
  1297. border-radius: 3px;
  1298. }
  1299. &.btn-ok {
  1300. background: #ff8522;
  1301. color: #fff;
  1302. border-radius: 3px;
  1303. }
  1304. }
  1305. }
  1306. .remind {
  1307. font-size: 12px;
  1308. }
  1309. }
  1310. &.spot-goods {
  1311. background: #fff;
  1312. > td {
  1313. .spot-goods-body {
  1314. .spot-goods-title {
  1315. height: 36px;
  1316. line-height: 36px;
  1317. background: #414140;
  1318. color: #fff;
  1319. }
  1320. table {
  1321. width: 1130px;
  1322. margin-left: 9px;
  1323. table-layout: fixed;
  1324. thead tr th {
  1325. text-align: center;
  1326. height: 34px;
  1327. line-height: 34px;
  1328. background: #fce8df;
  1329. font-weight: normal;
  1330. }
  1331. }
  1332. .spot-goods-list {
  1333. max-height: 250px;
  1334. overflow-y: auto;
  1335. overflow-x: hidden;
  1336. table {
  1337. margin-bottom: 10px;
  1338. tbody tr {
  1339. border: 1px solid #fce8df;
  1340. &:nth-child(even) {
  1341. background: #fdf8f5;
  1342. }
  1343. td {
  1344. height: 48px;
  1345. line-height: 48px;
  1346. &.input-number {
  1347. > div {
  1348. position: relative;
  1349. width: 100px;
  1350. margin: 0 auto;
  1351. span {
  1352. width: 17px;
  1353. height: 26px;
  1354. background: #4290f7;
  1355. line-height: 26px;
  1356. color: #fff;
  1357. display: inline-block;
  1358. font-size: 16px;
  1359. vertical-align: middle;
  1360. position: absolute;
  1361. top: 12px;
  1362. cursor: pointer;
  1363. &.not-allowed {
  1364. cursor: not-allowed;
  1365. background: #d7d5d5;
  1366. }
  1367. &:first-child {
  1368. left: -7px;
  1369. }
  1370. &:last-child {
  1371. right: -7px;
  1372. }
  1373. }
  1374. input {
  1375. width: 81px;
  1376. height: 26px;
  1377. text-align: center;
  1378. line-height: normal;
  1379. vertical-align: middle;
  1380. outline: none;
  1381. border: 1px solid #d1d0d0;
  1382. padding: 0 5px;
  1383. }
  1384. }
  1385. }
  1386. &.operate {
  1387. a {
  1388. color: #5078cb;
  1389. font-size: 12px;
  1390. }
  1391. span {
  1392. display: inline-block;
  1393. width: 64px;
  1394. height: 24px;
  1395. line-height: 24px;
  1396. text-align: center;
  1397. background: #4290f7;
  1398. color: #fff;
  1399. margin-left: 13px;
  1400. cursor: pointer;
  1401. font-size: 12px;
  1402. border-radius: 2px;
  1403. }
  1404. }
  1405. }
  1406. }
  1407. }
  1408. }
  1409. }
  1410. }
  1411. }
  1412. &.modify-row {
  1413. td {
  1414. input, select {
  1415. height: 30px;
  1416. border-radius: 2px;
  1417. border: 1px solid #dadada;
  1418. text-align: center;
  1419. padding: 0 5px;
  1420. display: inline-block;
  1421. &.error {
  1422. border-color: #f4645f !important;
  1423. }
  1424. }
  1425. input:focus {
  1426. -webkit-box-shadow: none;
  1427. -moz-box-shadow: none;
  1428. box-shadow: none;
  1429. border: 1px solid #3c7cf5;
  1430. }
  1431. .prod-item {
  1432. position: relative;
  1433. &.prod-item-large {
  1434. input {
  1435. width: 224px;
  1436. }
  1437. }
  1438. &.prod-item-small {
  1439. input {
  1440. width: 105px;
  1441. }
  1442. }
  1443. &.pi-select {
  1444. input {
  1445. width: 103px;
  1446. padding: 0 5px 0 30px;
  1447. }
  1448. select {
  1449. width: 25px;
  1450. padding: 0 0 0 2px;
  1451. background: url(/images/applyPurchase/select2.png) no-repeat right;
  1452. background-size: 12px 28px;
  1453. background-position: 12px 0;
  1454. position: absolute;
  1455. top: 1px;
  1456. border-bottom: none;
  1457. border-top: none;
  1458. border-left: 0;
  1459. }
  1460. }
  1461. }
  1462. &:nth-child(2) {
  1463. input {
  1464. width: 83px;
  1465. }
  1466. }
  1467. &:nth-child(3) {
  1468. input {
  1469. width: 90px;
  1470. }
  1471. }
  1472. &:nth-child(4) {
  1473. div {
  1474. width: 125px;
  1475. overflow: unset;
  1476. input {
  1477. width: 115px;
  1478. border-radius: 2px;
  1479. border: 1px solid #dadada;
  1480. }
  1481. }
  1482. }
  1483. }
  1484. }
  1485. }
  1486. }
  1487. }
  1488. .submit-area {
  1489. margin: 51px auto 0;
  1490. text-align: center;
  1491. clear: both;
  1492. a {
  1493. display: inline-block;
  1494. width: 126px;
  1495. height: 34px;
  1496. line-height: 34px;
  1497. text-align: center;
  1498. border-radius: 2px;
  1499. color: #fff;
  1500. background: #ff8522;
  1501. }
  1502. }
  1503. }
  1504. }
  1505. </style>