BatchPublish.vue 47 KB

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