edit.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. <template>
  2. <div class="salesEdit-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" @back="handleBack" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="salesEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <span style="margin: 0 15px;color: #666;">客户名称:{{ detailData&&detailData.buyerName }}</span>
  9. <div style="width:420px;display:inline-block;color: #666;">
  10. <span>出库仓库:</span>
  11. <chooseWarehouse style="width:80%" ref="warehouse" v-model="warehouseSn" @change="handleWarehouse"></chooseWarehouse>
  12. </div>
  13. </template>
  14. </a-page-header>
  15. <a-card size="small" :bordered="false" class="salesEdit-cont">
  16. <div slot="title">
  17. <div class="p-title">
  18. 选择产品
  19. </div>
  20. </div>
  21. <!-- 查询配件列表 -->
  22. <queryPart ref="partQuery" :newLoading="isInster" @add="insterProduct"></queryPart>
  23. </a-card>
  24. <a-card size="small" :bordered="false" class="salesEdit-cont">
  25. <div slot="title">
  26. <a-row :gutter="15" type="flex">
  27. <a-col :span="2">
  28. <div class="p-title">
  29. 已选产品
  30. </div>
  31. </a-col>
  32. <a-col :span="16" v-if="activeName">
  33. <div class="p-notes">
  34. <a-icon style="color: #FF9900;" type="bell" /> 已选产品可参加<span>{{ activeName }}</span>的促销活动,促销产品为指定产品
  35. </div>
  36. </a-col>
  37. </a-row>
  38. </div>
  39. <!-- 总计 -->
  40. <a-alert type="info" style="margin-bottom: 10px;">
  41. <div slot="message" class="total-bar">
  42. <div>
  43. <span v-if="$hasPermissions('B_salesEdit_salesPrice')">总售价:<strong>{{ detailData&&(detailData.totalCommonAmount || detailData.totalCommonAmount==0) ? toThousands(detailData.totalCommonAmount) : '--' }}</strong>;</span>
  44. 总款数:<strong>{{ detailData&&(detailData.totalCommonCategory || detailData.totalCommonCategory==0) ? detailData.totalCommonCategory : '--' }}</strong>;
  45. 总数量:<strong>{{ detailData&&(detailData.totalCommonQty || detailData.totalCommonQty==0) ? detailData.totalCommonQty : '--' }}</strong>;
  46. </div>
  47. </div>
  48. </a-alert>
  49. <!-- 筛选条件 -->
  50. <a-row :gutter="15">
  51. <a-col :span="24">
  52. <div class="table-page-search-wrapper" style="position: relative;width: 100%;">
  53. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  54. <a-row :gutter="15">
  55. <a-col :md="6" :sm="24">
  56. <a-form-item label="产品编码" prop="productCode">
  57. <a-input id="salesEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
  58. </a-form-item>
  59. </a-col>
  60. <a-col :md="6" :sm="24">
  61. <a-form-item label="产品名称" prop="productName">
  62. <a-input id="salesEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
  63. </a-form-item>
  64. </a-col>
  65. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  66. <a-button type="primary" class="button-info" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesEdit-refresh">查询</a-button>
  67. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesEdit-reset">重置</a-button>
  68. </a-col>
  69. </a-row>
  70. </a-form>
  71. <div style="position: absolute;right: 0;top: 3px;">
  72. <span>已选{{ selectTotal }}项</span>
  73. <!-- <a-button
  74. style="margin:0 15px;"
  75. size="small"
  76. type="danger"
  77. class="button-info"
  78. id="salesEdit-plDel-btn"
  79. @click="handleBatchDel">批量删除</a-button> -->
  80. <a-dropdown>
  81. <a-menu slot="overlay" @click="handleMenuClick">
  82. <a-menu-item key="1">
  83. 删除已选项
  84. </a-menu-item>
  85. <a-menu-item key="2">
  86. 全部删除
  87. </a-menu-item>
  88. </a-menu>
  89. <a-button
  90. size="small"
  91. style="margin:0 15px;"
  92. type="danger"
  93. class="button-info"
  94. id="salesEdit-plDel-btn"> 批量删除 <a-icon type="down" /> </a-button>
  95. </a-dropdown>
  96. <a-button
  97. size="small"
  98. type="primary"
  99. class="button-info"
  100. id="salesEdit-import-btn"
  101. @click="openGuideModal=true">导入产品</a-button>
  102. </div>
  103. </div>
  104. </a-col>
  105. </a-row>
  106. <!-- 已选配件列表 -->
  107. <s-table
  108. class="sTable"
  109. ref="table"
  110. size="small"
  111. :rowKey="(record) => record.id"
  112. :columns="columns"
  113. :data="loadData"
  114. :row-selection="{ columnWidth: 40 }"
  115. @rowSelection="rowSelectionFun"
  116. :defaultLoadData="false"
  117. :scroll="{ y: 300 }"
  118. bordered>
  119. <!-- 产品编码 -->
  120. <template slot="productCode" slot-scope="text, record">
  121. <a-badge count="缺" v-if="Number(record.stockQty) < Number(record.unpushedQty)">
  122. <div style="padding-right: 15px;">{{ text }}</div>
  123. </a-badge>
  124. <span v-if="!(Number(record.stockQty) < Number(record.unpushedQty))">{{ text }}</span>
  125. </template>
  126. <!-- 产品名称 -->
  127. <template slot="productName" slot-scope="text, record">
  128. <div class="ellipsisCon">
  129. <a-tooltip placement="rightBottom">
  130. <template slot="title">
  131. <span>{{ text }}</span>
  132. </template>
  133. <span class="ellipsisText">{{ text }}</span>
  134. </a-tooltip>
  135. <a-badge :number-style="{ backgroundColor: '#52c41a' }" count="活动" v-if="record.promotableFlag == 1"></a-badge>
  136. </div>
  137. </template>
  138. <!-- 销售数量 -->
  139. <template slot="salesNums" slot-scope="text, record">
  140. <a-input-number
  141. id="salesEdit-qty"
  142. size="small"
  143. v-model="record.qty"
  144. :precision="0"
  145. :min="1"
  146. :max="999999"
  147. placeholder="请输入"
  148. @blur="e => onCellBlur(e.target.value, record)"
  149. style="width: 100%;" />
  150. </template>
  151. <!-- 当前库存 -->
  152. <template slot="stockQty" slot-scope="text, record">
  153. <div v-if="record.stockQty || record.stockQty==0">
  154. <p style="margin: 0;" v-if="Number(record.stockQty) < Number(record.unpushedQty)">{{ record.stockQty }}(<span class="redStyle">缺{{ Number(record.unpushedQty) - Number(record.stockQty) }}</span>)</p>
  155. <p style="margin: 0;" v-else>{{ record.stockQty }}</p>
  156. </div>
  157. <span v-else>--</span>
  158. </template>
  159. <!-- 操作 -->
  160. <template slot="action" slot-scope="text, record">
  161. <a-button
  162. size="small"
  163. type="link"
  164. :loading="delLoading"
  165. class="button-error"
  166. @click="handleDel(record)"
  167. >删除</a-button>
  168. <a-button
  169. size="small"
  170. type="link"
  171. :loading="delLoading"
  172. class="button-warning"
  173. @click="handleSelCx(record)"
  174. v-if="record.promotableFlag == 1"
  175. >选择促销品</a-button>
  176. </template>
  177. </s-table>
  178. </a-card>
  179. <a-card size="small" :bordered="false" class="salesEdit-cont">
  180. <div slot="title">
  181. <div class="p-title">
  182. 已选促销品
  183. </div>
  184. </div>
  185. <!-- 总计 -->
  186. <a-alert type="info" style="margin-bottom: 10px;">
  187. <div slot="message" class="total-bar">
  188. <div>
  189. <span>总成本:<strong>{{ detailData&&(detailData.totalPromoCost || detailData.totalPromoCost==0) ? toThousands(detailData.totalPromoCost) : '--' }}</strong>;</span>
  190. 总款数:<strong>{{ detailData&&(detailData.totalPromoCategory || detailData.totalPromoCategory==0) ? detailData.totalPromoCategory : '--' }}</strong>;
  191. 总数量:<strong>{{ detailData&&(detailData.totalPromoQty || detailData.totalPromoQty==0) ? detailData.totalPromoQty : '--' }}</strong>;
  192. </div>
  193. <div>
  194. </div>
  195. </div>
  196. </a-alert>
  197. <!-- 已选促销品列表 -->
  198. <queryPromotable ref="promotable" :delLoading="delLoading" @onCellBlur="onCellBlur" @del="handleDel"></queryPromotable>
  199. </a-card>
  200. </a-spin>
  201. <div class="affix-cont">
  202. <a-button
  203. size="large"
  204. style="padding: 0 60px;"
  205. :disabled="spinning"
  206. type="primary"
  207. class="button-primary"
  208. @click="handleSubmit()"
  209. id="productInfoList-handleSubmit">提交</a-button>
  210. </div>
  211. <!-- 添加产品 -->
  212. <ChooseActive
  213. ref="activeProduct"
  214. :openModal="newActive"
  215. @ok="addNewActive"
  216. :newLoading="isInster"
  217. @close="closeActive"></ChooseActive>
  218. <!-- 导入产品 -->
  219. <importGuideModal :openModal="openGuideModal" :params="{salesBillSn: $route.params.sn}" @close="closeGuideModel" @ok="hanldeOk" />
  220. </div>
  221. </template>
  222. <script>
  223. import { commonMixin } from '@/utils/mixin'
  224. import { STable, VSelect } from '@/components'
  225. import queryPart from './queryPart.vue'
  226. import queryPromotable from './queryPromotable.vue'
  227. import ChooseActive from './chooseActive.vue'
  228. import ImportGuideModal from './importGuideModal.vue'
  229. import chooseWarehouse from '@/views/common/chooseWarehouse'
  230. import { salesModify, salesDetailBySn, salesWriteSubmit, getPromoacActiveList, deleteAll } from '@/api/sales'
  231. import { salesDetailStockList, salesDetailInsert, salesDetailUpdateQty, salesDetailDel, salesDetailBatchDel, salesDetailDelAll, addPromoGoods, salesBatchInsert } from '@/api/salesDetail'
  232. export default {
  233. name: 'SalesEdit',
  234. mixins: [commonMixin],
  235. components: { STable, VSelect, queryPart, queryPromotable, ChooseActive, ImportGuideModal, chooseWarehouse },
  236. data () {
  237. return {
  238. spinning: false,
  239. salesBillSn: null, // 销售单sn
  240. disabled: false, // 查询、重置按钮是否可操作
  241. chooseDisabled: false,
  242. isInster: false, // 是否正在添加产品
  243. delLoading: false,
  244. newActive: false, // 选择促销品
  245. detailData: { discountAmount: 0, id: null, salesBillSn: '' }, // 订单基础数据
  246. dataSource: [],
  247. productForm: {
  248. salesBillSn: '',
  249. promotionFlag: 0
  250. },
  251. warehouseSn: undefined,
  252. activeName: '', // 促销活动
  253. nowData: null,
  254. // 加载数据方法 必须为 Promise 对象
  255. loadData: parameter => {
  256. this.disabled = true
  257. this.productForm.salesBillSn = this.$route.params.sn
  258. return salesDetailStockList(Object.assign(parameter, this.productForm, this.queryParam)).then(res => {
  259. let data
  260. if (res.status == 200) {
  261. data = res.data
  262. const no = (data.pageNo - 1) * data.pageSize
  263. for (var i = 0; i < data.list.length; i++) {
  264. data.list[i].no = no + i + 1
  265. data.list[i].qtyBackups = data.list[i].qty
  266. }
  267. this.disabled = false
  268. this.dataSource = data.list
  269. this.$refs.promotable.getData(this.salesBillSn)
  270. }
  271. return data
  272. })
  273. },
  274. openGuideModal: false, // 导入产品引导
  275. queryParam: {
  276. productCode: '',
  277. productName: ''
  278. },
  279. rowSelectionInfo: null
  280. }
  281. },
  282. computed: {
  283. selectTotal () {
  284. return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
  285. },
  286. columns () {
  287. const arr = [
  288. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  289. { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '20%', align: 'center', sorter: true },
  290. { title: '产品名称', dataIndex: 'productEntity.name', scopedSlots: { customRender: 'productName' }, width: '25%', align: 'left' },
  291. // { title: '售价', dataIndex: 'price', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  292. { title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: '8%', align: 'center' },
  293. { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '8%', align: 'center' },
  294. { title: '单位', dataIndex: 'productEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  295. // { title: '售价小计', dataIndex: 'totalAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  296. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  297. ]
  298. if (this.$hasPermissions('B_salesEdit_salesPrice')) { // 售价权限
  299. arr.splice(3, 0, { title: '售价', dataIndex: 'price', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  300. arr.splice(7, 0, { title: '售价小计', dataIndex: 'totalAmount', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  301. }
  302. return arr
  303. }
  304. },
  305. methods: {
  306. // 选择仓库
  307. handleWarehouse (val) {
  308. this.warehouseSn = val
  309. const _this = this
  310. _this.spinning = true
  311. salesModify({
  312. id: _this.detailData.id,
  313. warehouseSn: val
  314. }).then(res => {
  315. if (res.status == 200) {
  316. _this.$refs.partQuery.resetCurForm(val)
  317. _this.spinning = false
  318. } else {
  319. _this.spinning = false
  320. }
  321. })
  322. },
  323. handleMenuClick (e) {
  324. if (e.key == 1) { // 删除已选项
  325. this.handleBatchDel()
  326. } else {
  327. this.handleBatchDelAll()
  328. }
  329. },
  330. // 表格选中项
  331. rowSelectionFun (obj) {
  332. this.rowSelectionInfo = obj || null
  333. },
  334. handleBatchDelAll () {
  335. const _this = this
  336. if (_this.dataSource.length == 0) {
  337. _this.$message.warning('暂无可删除的已选产品!')
  338. return
  339. }
  340. this.$confirm({
  341. title: '提示',
  342. content: '确认要删除全部已选产品吗?',
  343. centered: true,
  344. onOk () {
  345. _this.spinning = true
  346. deleteAll({ salesBillSn: _this.productForm.salesBillSn }).then(res => {
  347. if (res.status == 200) {
  348. _this.resetSearchForm(true)
  349. _this.$refs.promotable.resetCurForm()
  350. _this.$message.success(res.message)
  351. }
  352. _this.spinning = false
  353. })
  354. }
  355. })
  356. },
  357. // 批量删除已选产品
  358. handleBatchDel () {
  359. const _this = this
  360. if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
  361. _this.$message.warning('请先选择要删除的产品后再进行批量操作!')
  362. return
  363. }
  364. const obj = []
  365. _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
  366. obj.push(item.salesBillDetailSn)
  367. })
  368. this.$confirm({
  369. title: '提示',
  370. content: '已选产品' + obj.length + '项,确认要批量删除吗?',
  371. centered: true,
  372. onOk () {
  373. _this.spinning = true
  374. salesDetailBatchDel({
  375. salesBillSn: _this.salesBillSn,
  376. salesBillDetailSnList: obj
  377. }).then(res => {
  378. if (res.status == 200) {
  379. _this.resetSearchForm(true)
  380. _this.$refs.promotable.resetCurForm()
  381. _this.$message.success(res.message)
  382. }
  383. _this.spinning = false
  384. })
  385. }
  386. })
  387. },
  388. // 已选产品 blur
  389. onCellBlur (val, record) {
  390. const _this = this
  391. // 光标移出,值发生改变再调用编辑接口
  392. if (val && val != record.qtyBackups) {
  393. _this.spinning = true
  394. salesDetailUpdateQty({
  395. salesBillDetailSn: record.salesBillDetailSn,
  396. qty: record.qty,
  397. salesBillSn: _this.salesBillSn
  398. }).then(res => {
  399. _this.resetSearchForm(true)
  400. _this.$refs.promotable.resetCurForm()
  401. if (res.status == 200) {
  402. _this.$message.success(res.message)
  403. }
  404. _this.spinning = false
  405. })
  406. } else {
  407. record.qty = record.qtyBackups
  408. }
  409. },
  410. chooseResetSearchForm () {
  411. this.queryParam.productCode = ''
  412. this.queryParam.productName = ''
  413. this.$refs.table.refresh(true)
  414. },
  415. // 重置
  416. resetSearchForm (flag) {
  417. this.queryParam.productCode = ''
  418. this.queryParam.productName = ''
  419. this.$refs.table.refresh(!!flag)
  420. this.getPromoacActiveList()
  421. this.getOrderDetail(false)
  422. this.$refs.table.clearSelected() // 清空表格选中项
  423. },
  424. // 返回
  425. handleBack () {
  426. this.$router.push({ path: '/salesManagement/salesQuery/list', query: { closeLastOldTab: true } })
  427. },
  428. // 整单删除
  429. delSalerDetailAll () {
  430. const _this = this
  431. this.$confirm({
  432. title: '提示',
  433. content: '确认要整单删除吗?',
  434. centered: true,
  435. closable: true,
  436. onOk () {
  437. _this.delLoading = true
  438. _this.spinning = true
  439. salesDetailDelAll({ salesBillSn: _this.salesBillSn }).then(res => {
  440. if (res.status == 200) {
  441. _this.resetSearchForm()
  442. _this.$refs.promotable.resetCurForm()
  443. _this.$message.success(res.message)
  444. }
  445. _this.delLoading = false
  446. _this.spinning = false
  447. })
  448. }
  449. })
  450. },
  451. // 删除产品
  452. handleDel (row) {
  453. const _this = this
  454. this.$confirm({
  455. title: '提示',
  456. content: '确认要删除吗?',
  457. centered: true,
  458. closable: true,
  459. onOk () {
  460. _this.delLoading = true
  461. _this.spinning = true
  462. salesDetailDel({ salesBillDetailSn: row.salesBillDetailSn, salesBillSn: _this.salesBillSn }).then(res => {
  463. if (res.status == 200) {
  464. _this.resetSearchForm(true)
  465. _this.$refs.promotable.resetCurForm()
  466. _this.$message.success(res.message)
  467. }
  468. _this.delLoading = false
  469. _this.spinning = false
  470. })
  471. }
  472. })
  473. },
  474. // 添加产品
  475. insterProduct (row, promotionFlag) {
  476. console.log(row)
  477. // 防止多次添加产品
  478. if (this.isInster) { return }
  479. const _this = this
  480. _this.saveNewProduct(row, promotionFlag)
  481. },
  482. // 保存添加的产品到销售列表
  483. saveNewProduct (row, promotionFlag) {
  484. this.$message.loading('正在添加产品...', 1)
  485. this.isInster = true
  486. this.spinning = true
  487. salesDetailInsert({
  488. packQty: row.productPackQty,
  489. productSn: row.productSn,
  490. showCost: row.lastStockCost,
  491. price: row.productPrice,
  492. origPrice: row.productPrice,
  493. promotionGiftsAmount: 0,
  494. usePromotionGiftsAmount: 0,
  495. qty: row.salesNums,
  496. salesBillSn: this.detailData.salesBillSn,
  497. salesBillNo: this.detailData.salesBillNo,
  498. purchaseBillSn: this.detailData.purchaseBillSn,
  499. purchaseBillNo: this.detailData.purchaseBillNo,
  500. stockSn: row.stockSn,
  501. promotableFlag: row.isJoinActivityProduct || 0, // 可促销标记 有活动的传1,没活动的传0
  502. promotionFlag: promotionFlag // 促销标记 正品传0,促销品传1
  503. }).then(res => {
  504. if (res.status == 200) {
  505. this.resetSearchForm()
  506. this.$message.success('产品添加成功', 2.5)
  507. this.spinning = false
  508. } else {
  509. this.spinning = false
  510. }
  511. this.isInster = false
  512. }).catch(err => {
  513. this.isInster = false
  514. })
  515. },
  516. // 销售单详情
  517. getOrderDetail (flag) {
  518. salesDetailBySn({ salesBillSn: this.$route.params.sn }).then(res => {
  519. if (res.status == 200) {
  520. this.detailData = res.data
  521. if (flag) {
  522. this.$refs.partQuery.pageInit(this.detailData && this.detailData.buyerSn || '', this.warehouseSn)
  523. }
  524. }
  525. })
  526. },
  527. // 提交销售单
  528. handleSubmit () {
  529. this.spinning = true
  530. salesWriteSubmit({ salesBillSn: this.salesBillSn }).then(res => {
  531. if (res.status == 200) {
  532. this.handleBack()
  533. this.$message.success(res.message)
  534. this.spinning = false
  535. } else {
  536. this.spinning = false
  537. }
  538. })
  539. },
  540. // 获取促销活动
  541. getPromoacActiveList () {
  542. const _this = this
  543. getPromoacActiveList({ salesBillSn: this.salesBillSn }).then(res => {
  544. if (res.status == 200) {
  545. _this.activeName = ''
  546. res.data.map(item => {
  547. _this.activeName += item.name + '、'
  548. })
  549. _this.activeName = _this.activeName.slice(0, _this.activeName.length - 1)
  550. }
  551. })
  552. },
  553. // 选择促销品
  554. handleSelCx (row) {
  555. // this.nowData = row
  556. this.newActive = true
  557. this.$refs.activeProduct.getData(row, this.detailData && this.detailData.buyerSn || '', this.salesBillSn)
  558. },
  559. // 批量添加促销品
  560. addNewActive (list) {
  561. const temp = []
  562. list.map(item => {
  563. temp.push(Object.assign(item, {
  564. salesBillSn: this.detailData.salesBillSn,
  565. salesBillNo: this.detailData.salesBillNo,
  566. purchaseBillSn: this.detailData.purchaseBillSn,
  567. purchaseBillNo: this.detailData.purchaseBillNo
  568. }))
  569. })
  570. this.isInster == true
  571. this.spinning = true
  572. addPromoGoods(temp).then(res => {
  573. if (res.status == 200) {
  574. this.$refs.promotable.getData(this.salesBillSn)
  575. this.getOrderDetail(false)
  576. this.newActive = false
  577. this.isInster == false
  578. this.spinning = false
  579. } else {
  580. this.spinning = false
  581. }
  582. })
  583. },
  584. closeActive () {
  585. this.nowData = null
  586. this.newActive = false
  587. },
  588. closeGuideModel () {
  589. this.openGuideModal = false
  590. },
  591. // 导入产品
  592. hanldeOk (obj) {
  593. salesBatchInsert(obj).then(res => {
  594. if (res.status == 200) {
  595. this.$refs.table.refresh(true)
  596. this.getOrderDetail(false)
  597. }
  598. })
  599. },
  600. pageInit () {
  601. this.getOrderDetail(true)
  602. this.$refs.table.refresh(true)
  603. this.salesBillSn = this.$route.params.sn
  604. this.warehouseSn = this.$route.params.sn ? this.$route.params.wSn : ''
  605. // 获取促销活动
  606. this.getPromoacActiveList()
  607. }
  608. },
  609. mounted () {
  610. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  611. this.pageInit()
  612. }
  613. },
  614. activated () {
  615. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  616. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  617. this.pageInit()
  618. }
  619. },
  620. beforeRouteEnter (to, from, next) {
  621. next(vm => {})
  622. }
  623. }
  624. </script>
  625. <style lang="less">
  626. .salesEdit-wrap{
  627. position: relative;
  628. height: 100%;
  629. padding-bottom: 51px;
  630. box-sizing: border-box;
  631. >.ant-spin-nested-loading{
  632. overflow-y: scroll;
  633. height: 100%;
  634. }
  635. .salesEdit-cont{
  636. margin-top: 10px;
  637. }
  638. .p-title{
  639. font-weight: bold;
  640. font-size: 14px;
  641. }
  642. .p-notes{
  643. font-size: 14px;
  644. span{
  645. color: #FF9900;
  646. }
  647. }
  648. .redStyle{
  649. font-weight: bold;
  650. color: red;
  651. }
  652. .ellipsisCon{
  653. display: flex;
  654. justify-content: space-between;
  655. align-items: center;
  656. .ellipsisText{
  657. width: 100%;
  658. overflow: hidden;
  659. text-overflow: ellipsis;
  660. display: box;
  661. display: -webkit-box;
  662. -webkit-line-clamp: 1;
  663. -webkit-box-orient: vertical;
  664. }
  665. }
  666. .total-bar{
  667. display: flex;
  668. align-items: center;
  669. justify-content: space-between;
  670. > div{
  671. &:last-child{
  672. display: flex;
  673. align-items: center;
  674. justify-content: space-between;
  675. > div{
  676. padding: 0 10px;
  677. }
  678. }
  679. }
  680. }
  681. .redBg-row{
  682. background-color: #f5cdc8;
  683. }
  684. }
  685. </style>