BatchPublish.vue 55 KB

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