BatchPublish.vue 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474
  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.baseUtils.buyOrCar(true, null, this, goods, '/user#/order/pay/', this.fragments[index].num)
  1039. },
  1040. linkSaler: function (commodity) {
  1041. this.baseUtils.goLinkUser(this, commodity.enUU)
  1042. }
  1043. },
  1044. created() {
  1045. // noDetail
  1046. this.$http.get('/seek/bom/noDetail?bomId=' + this.$route.params.id).then(res => {
  1047. this.bomInfo = res.data
  1048. this.bomInfo.count = this.bomInfo.count || 1
  1049. })
  1050. }
  1051. }
  1052. </script>
  1053. <style lang="scss">
  1054. .batch-publish {
  1055. margin: 0 auto;
  1056. width: 1190px;
  1057. .red-text {
  1058. color: #ff0000;
  1059. }
  1060. .blue-text {
  1061. color: #3c7cf5;
  1062. }
  1063. .over-ell {
  1064. overflow: hidden;
  1065. text-overflow: ellipsis;
  1066. white-space: nowrap;
  1067. }
  1068. div.batch-publish-top {
  1069. margin: 30px 0 0 0;
  1070. font-size: 16px;
  1071. /*height: 60px;*/
  1072. line-height: 60px;
  1073. background: #f7f9fd;
  1074. padding-left: 24px;
  1075. position: relative;
  1076. .modify-btn {
  1077. position: absolute;
  1078. right: 20px;
  1079. top: 40px;
  1080. font-size: 14px;
  1081. width: 126px;
  1082. height: 34px;
  1083. line-height: 34px;
  1084. text-align: center;
  1085. border-radius: 2px;
  1086. color: #fff;
  1087. background: #ff8522;
  1088. }
  1089. > img {
  1090. width: 23px;
  1091. height: 31px;
  1092. margin-right: 12px;
  1093. }
  1094. .w50 {
  1095. width: 50%;
  1096. float: left
  1097. }
  1098. input {
  1099. height: 28px;
  1100. line-height: 28px;
  1101. color: #333;
  1102. border-radius: 5px;
  1103. font-size: 14px;
  1104. border: 1px solid #ddd;
  1105. }
  1106. input.text {
  1107. width: 280px;
  1108. text-indent: 12px;
  1109. }
  1110. }
  1111. .list-wrap {
  1112. padding: 30px 0 72px 0;
  1113. margin: 26px 0 109px 0;
  1114. -webkit-box-shadow: 0 0 3px #e2eae8;
  1115. -moz-box-shadow: 0 0 3px #e2eae8;
  1116. box-shadow: 0 0 3px #e2eae8;
  1117. .list-content {
  1118. width: 1150px;
  1119. margin: 0 auto;
  1120. table-layout: fixed;
  1121. > thead {
  1122. tr {
  1123. th {
  1124. background: #89aefa;
  1125. color: #fff;
  1126. font-weight: normal;
  1127. height: 40px;
  1128. line-height: 40px;
  1129. text-align: center;
  1130. .com-check-box {
  1131. margin-right: 2px;
  1132. }
  1133. i {
  1134. margin-right: 3px;
  1135. }
  1136. }
  1137. }
  1138. }
  1139. > tbody {
  1140. > tr {
  1141. height: 101px;
  1142. text-align: center;
  1143. border : {
  1144. bottom: 1px solid #bcd2ff;
  1145. left: 1px solid #bcd2ff;
  1146. right: 1px solid #bcd2ff;
  1147. }
  1148. &:hover {
  1149. background: #f1f5ff;
  1150. }
  1151. > td {
  1152. position: relative;
  1153. .prod-items {
  1154. height: 100px;
  1155. padding-top: 17px;
  1156. .prod-item {
  1157. position: relative;
  1158. display: inline-block;
  1159. height: 30px;
  1160. line-height: 30px;
  1161. float: left;
  1162. &:nth-child(2) {
  1163. margin-top: 9px;
  1164. margin-right: 0;
  1165. }
  1166. .pi-title {
  1167. display: inline-block;
  1168. vertical-align: middle;
  1169. text-align: right;
  1170. color: #999;
  1171. .red-text {
  1172. margin-right: 3px;
  1173. }
  1174. }
  1175. .pi-content {
  1176. display: inline-block;
  1177. text-align: left;
  1178. vertical-align: middle;
  1179. }
  1180. &.prod-item-large {
  1181. .pi-content {
  1182. width: 224px;
  1183. }
  1184. .pi-title {
  1185. width: 117px;
  1186. }
  1187. }
  1188. &.prod-item-small {
  1189. .pi-content {
  1190. width: 105px;
  1191. }
  1192. .pi-title {
  1193. width: 70px;
  1194. }
  1195. }
  1196. > ul {
  1197. line-height: normal;
  1198. position: absolute;
  1199. top: 31px;
  1200. left: 115px;
  1201. background: #fff;
  1202. border: 1px solid #b5b5b5;
  1203. z-index: 1;
  1204. max-height: 120px;
  1205. overflow-y: auto;
  1206. overflow-x: hidden;
  1207. border-radius: 2px;
  1208. width: 224px;
  1209. li {
  1210. height: 30px;
  1211. line-height: 30px;
  1212. cursor: pointer;
  1213. overflow: hidden;
  1214. text-overflow: ellipsis;
  1215. white-space: nowrap;
  1216. padding: 0 5px;
  1217. text-align: left;
  1218. &:hover {
  1219. background: #89aefa;
  1220. color: #fff;
  1221. }
  1222. }
  1223. }
  1224. }
  1225. }
  1226. .similar-select {
  1227. width: 145px;
  1228. margin: 0 auto;
  1229. border: 1px solid #b5b5b5;
  1230. height: 30px;
  1231. line-height: 30px;
  1232. overflow-y: hidden;
  1233. padding: 0 22px 0 5px;
  1234. background: url('/images/all/select-icon-full.png') no-repeat;
  1235. background-color: #fff;
  1236. background-position: 194px 10px;
  1237. cursor: default;
  1238. border-radius: 2px;
  1239. & + ul {
  1240. width: 145px;
  1241. top: 48px;
  1242. left: 12px;
  1243. &.brand-word-list {
  1244. left: 7px;
  1245. }
  1246. }
  1247. }
  1248. &.operate {
  1249. text-align: left;
  1250. font-size: 12px;
  1251. a {
  1252. color: #3c7cf5;
  1253. margin-left: 5px;
  1254. &.size-s {
  1255. padding: 4px 12px;
  1256. }
  1257. &.size-m {
  1258. padding: 4px 7px;
  1259. }
  1260. &:hover {
  1261. color: #fff;
  1262. background: #3c7cf5;
  1263. border-radius: 3px;
  1264. }
  1265. &.btn-ok {
  1266. background: #ff8522;
  1267. color: #fff;
  1268. border-radius: 3px;
  1269. }
  1270. }
  1271. }
  1272. .remind {
  1273. font-size: 12px;
  1274. }
  1275. }
  1276. &.spot-goods {
  1277. background: #fff;
  1278. > td {
  1279. .spot-goods-body {
  1280. .spot-goods-title {
  1281. height: 36px;
  1282. line-height: 36px;
  1283. background: #414140;
  1284. color: #fff;
  1285. }
  1286. table {
  1287. width: 1130px;
  1288. margin-left: 9px;
  1289. table-layout: fixed;
  1290. thead tr th {
  1291. text-align: center;
  1292. height: 34px;
  1293. line-height: 34px;
  1294. background: #fce8df;
  1295. font-weight: normal;
  1296. }
  1297. }
  1298. .spot-goods-list {
  1299. max-height: 250px;
  1300. overflow-y: auto;
  1301. overflow-x: hidden;
  1302. table {
  1303. margin-bottom: 10px;
  1304. tbody tr {
  1305. border: 1px solid #fce8df;
  1306. &:nth-child(even) {
  1307. background: #fdf8f5;
  1308. }
  1309. td {
  1310. height: 48px;
  1311. line-height: 48px;
  1312. &.input-number {
  1313. > div {
  1314. position: relative;
  1315. width: 100px;
  1316. margin: 0 auto;
  1317. span {
  1318. width: 17px;
  1319. height: 26px;
  1320. background: #4290f7;
  1321. line-height: 26px;
  1322. color: #fff;
  1323. display: inline-block;
  1324. font-size: 16px;
  1325. vertical-align: middle;
  1326. position: absolute;
  1327. top: 12px;
  1328. cursor: pointer;
  1329. &.not-allowed {
  1330. cursor: not-allowed;
  1331. background: #d7d5d5;
  1332. }
  1333. &:first-child {
  1334. left: -7px;
  1335. }
  1336. &:last-child {
  1337. right: -7px;
  1338. }
  1339. }
  1340. input {
  1341. width: 81px;
  1342. height: 26px;
  1343. text-align: center;
  1344. line-height: normal;
  1345. vertical-align: middle;
  1346. outline: none;
  1347. border: 1px solid #d1d0d0;
  1348. padding: 0 5px;
  1349. }
  1350. }
  1351. }
  1352. &.operate {
  1353. a {
  1354. color: #5078cb;
  1355. font-size: 12px;
  1356. }
  1357. span {
  1358. display: inline-block;
  1359. width: 64px;
  1360. height: 24px;
  1361. line-height: 24px;
  1362. text-align: center;
  1363. background: #4290f7;
  1364. color: #fff;
  1365. margin-left: 13px;
  1366. cursor: pointer;
  1367. font-size: 12px;
  1368. border-radius: 2px;
  1369. }
  1370. }
  1371. }
  1372. }
  1373. }
  1374. }
  1375. }
  1376. }
  1377. }
  1378. &.modify-row {
  1379. td {
  1380. input, select {
  1381. height: 30px;
  1382. border-radius: 2px;
  1383. border: 1px solid #dadada;
  1384. text-align: center;
  1385. padding: 0 5px;
  1386. display: inline-block;
  1387. &.error {
  1388. border-color: #f4645f !important;
  1389. }
  1390. }
  1391. input:focus {
  1392. -webkit-box-shadow: none;
  1393. -moz-box-shadow: none;
  1394. box-shadow: none;
  1395. border: 1px solid #3c7cf5;
  1396. }
  1397. .prod-item {
  1398. position: relative;
  1399. &.prod-item-large {
  1400. input {
  1401. width: 224px;
  1402. }
  1403. }
  1404. &.prod-item-small {
  1405. input {
  1406. width: 105px;
  1407. }
  1408. }
  1409. &.pi-select {
  1410. input {
  1411. width: 103px;
  1412. padding: 0 5px 0 30px;
  1413. }
  1414. select {
  1415. width: 25px;
  1416. padding: 0 0 0 2px;
  1417. background: url(/images/applyPurchase/select2.png) no-repeat right;
  1418. background-size: 12px 28px;
  1419. background-position: 12px 0;
  1420. position: absolute;
  1421. top: 1px;
  1422. border-bottom: none;
  1423. border-top: none;
  1424. border-left: 0;
  1425. }
  1426. }
  1427. }
  1428. &:nth-child(2) {
  1429. input {
  1430. width: 83px;
  1431. }
  1432. }
  1433. &:nth-child(3) {
  1434. input {
  1435. width: 90px;
  1436. }
  1437. }
  1438. &:nth-child(4) {
  1439. div {
  1440. width: 125px;
  1441. overflow: unset;
  1442. input {
  1443. width: 115px;
  1444. border-radius: 2px;
  1445. border: 1px solid #dadada;
  1446. }
  1447. }
  1448. }
  1449. }
  1450. }
  1451. }
  1452. }
  1453. }
  1454. .submit-area {
  1455. margin: 51px auto 0;
  1456. text-align: center;
  1457. clear: both;
  1458. a {
  1459. display: inline-block;
  1460. width: 126px;
  1461. height: 34px;
  1462. line-height: 34px;
  1463. text-align: center;
  1464. border-radius: 2px;
  1465. color: #fff;
  1466. background: #ff8522;
  1467. }
  1468. }
  1469. }
  1470. }
  1471. </style>