BatchPublish.vue 49 KB

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