BatchPublish.vue 56 KB

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