BatchPublish.vue 53 KB

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