edit.vue 24 KB

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