BatchPublish.vue 56 KB

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