BatchPublish.vue 54 KB

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