detail.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <template>
  2. <div class="salesDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="salesDetail-cont">
  5. <template slot="subTitle">
  6. <a href="javascript:;" @click="handleBack"><a-icon type="left"></a-icon> 返回列表</a>
  7. </template>
  8. <template slot="extra">
  9. <a-button
  10. key="1"
  11. type="primary"
  12. class="button-info"
  13. id="salesDetail-xs-print-btn"
  14. v-if="$hasPermissions('B_salesPrint')"
  15. :disabled="localDataSource.length==0"
  16. @click="handlePrint('SALES_BILL')">销售打印</a-button>
  17. <a-button
  18. key="2"
  19. type="default"
  20. class="button-info"
  21. id="salesDetail-xsfl-print-btn"
  22. v-if="$hasPermissions('B_salesPrint')"
  23. :disabled="localDataSource.length==0"
  24. @click="handlePrint('SALES_BILL_TYPE')">销售分类打印</a-button>
  25. <a-divider type="vertical" />
  26. <a-button
  27. key="3"
  28. type="primary"
  29. class="button-info"
  30. id="salesDetail-export-btn"
  31. v-if="$hasPermissions('B_salesExport')"
  32. :disabled="localDataSource.length==0"
  33. @click="handlePrint('export')">导出Excel</a-button>
  34. <a-button
  35. key="4"
  36. type="default"
  37. class="button-info"
  38. id="salesDetail-export-btn"
  39. v-if="$hasPermissions('B_salesExport')"
  40. :disabled="localDataSource.length==0"
  41. @click="handlePrint('typeExport')">销售分类导出</a-button>
  42. </template>
  43. </a-page-header>
  44. <!-- 基础信息 -->
  45. <a-card size="small" :bordered="false" class="salesDetail-cont">
  46. <a-collapse :activeKey="['1']">
  47. <a-collapse-panel key="1" header="基础信息">
  48. <a-descriptions size="small" :column="3">
  49. <a-descriptions-item label="销售单号" :span="2">
  50. {{ detailData&&detailData.salesBillNo || '--' }}
  51. <span v-if="detailData&&detailData.salesBillNoSource">(原:{{ detailData&&detailData.salesBillNoSource || '--' }})</span>
  52. </a-descriptions-item>
  53. <a-descriptions-item label="客户名称">{{ detailData&&detailData.buyerName || '--' }}</a-descriptions-item>
  54. <a-descriptions-item label="收货地址" :span="2">{{ shippingAddress }}</a-descriptions-item>
  55. <a-descriptions-item label="收款方式">{{ detailData&&detailData.settleStyleSnDictValue || '--' }}</a-descriptions-item>
  56. <a-descriptions-item label="收货人">{{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.consigneeName || '--' }}</a-descriptions-item>
  57. <a-descriptions-item label="收货电话">{{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.consigneeTel || '--' }}</a-descriptions-item>
  58. <a-descriptions-item label="审核时间">{{ detailData&&detailData.auditDate || '--' }}</a-descriptions-item>
  59. <a-descriptions-item label="业务状态">{{ detailData&&detailData.billStatusDictValue || '--' }}</a-descriptions-item>
  60. <a-descriptions-item label="财务状态">{{ detailData&&detailData.financialStatusDictValue || '--' }}</a-descriptions-item>
  61. <a-descriptions-item label="备注" :span="3">{{ detailData&&detailData.remarks || '--' }}</a-descriptions-item>
  62. </a-descriptions>
  63. </a-collapse-panel>
  64. </a-collapse>
  65. </a-card>
  66. <a-card size="small" :bordered="false" class="pages-wrap">
  67. <!-- alert -->
  68. <a-alert type="info" style="margin-bottom: 10px;">
  69. <div slot="message">
  70. <div style="display: flex;justify-content: space-between;align-items: center;">
  71. <div>
  72. 总销售数量:<strong>{{ detailData&&(detailData.totalQty || detailData.totalQty==0) ? detailData.totalQty : '--' }}</strong>;
  73. 已取消数量:<strong>{{ detailData&&(detailData.totalCancelQty || detailData.totalCancelQty==0) ? detailData.totalCancelQty : '--' }}</strong>;
  74. 已下推数量:<strong>{{ detailData&&(detailData.totalPushedQty || detailData.totalPushedQty==0) ? detailData.totalPushedQty : '--' }}</strong>;
  75. 待下推数量:<strong>{{ detailData&&(detailData.totalUnpushedQty || detailData.totalUnpushedQty==0) ? detailData.totalUnpushedQty : '--' }}</strong>;
  76. 已发货数量:<strong>{{ detailData&&(detailData.totalDispatchQty || detailData.totalDispatchQty==0) ? detailData.totalDispatchQty : '--' }}</strong>;
  77. 待发货数量:<strong>{{ detailData&&(detailData.totalUndispatchQty || detailData.totalUndispatchQty==0) ? detailData.totalUndispatchQty : '--' }}</strong>;<br/>
  78. <span v-if="$hasPermissions('B_isShowPrice')">总售价:<strong>{{ detailData&&(detailData.totalAmount || detailData.totalAmount==0) ? detailData.totalAmount : '--' }}</strong>;</span>
  79. <span v-if="$hasPermissions('B_isShowCost')">总成本:<strong>{{ detailData&&(detailData.totalCost || detailData.totalCost==0) ? detailData.totalCost : '--' }}</strong>;</span>
  80. <span v-if="$hasPermissions('B_isShowCost')">总毛利:<strong>{{ detailData&&(detailData.grossProfit || detailData.grossProfit==0) ? detailData.grossProfit : '--' }}</strong>;</span>
  81. <span v-if="$hasPermissions('B_isShowPrice')">已取消金额:<strong>{{ detailData&&(detailData.totalCancelAmount || detailData.totalCancelAmount==0) ? detailData.totalCancelAmount : '--' }}</strong>;</span>
  82. <span v-if="$hasPermissions('B_isShowPrice')">已下推金额:<strong>{{ detailData&&(detailData.totalPushedAmount || detailData.totalPushedAmount==0) ? detailData.totalPushedAmount : '--' }}</strong>;</span>
  83. <span v-if="$hasPermissions('B_isShowPrice')">待下推金额:<strong>{{ detailData&&(detailData.totalUnpushedAmount || detailData.totalUnpushedAmount==0) ? detailData.totalUnpushedAmount : '--' }}</strong>;</span>
  84. <span v-if="$hasPermissions('B_isShowPrice')">已发货金额:<strong>{{ detailData&&(detailData.totalDispatchAmount || detailData.totalDispatchAmount==0) ? detailData.totalDispatchAmount : '--' }}</strong>;</span>
  85. <span v-if="$hasPermissions('B_isShowPrice')">待发货金额:<strong>{{ detailData&&(detailData.totalUndispatchAmount || detailData.totalUndispatchAmount==0) ? detailData.totalUndispatchAmount : '--' }}</strong>;</span>
  86. <span v-if="isCityPrice">市级总售价:<strong>{{ detailData&&(detailData.totalCityAmount || detailData.totalCityAmount==0) ? detailData.totalCityAmount : '--' }}</strong>;</span>
  87. </div>
  88. <a-checkbox v-model="isCityPrice" v-if="$hasPermissions('B_isShowPrice')"><span style="display: inline-block;margin-top: 1px;">市级价</span></a-checkbox>
  89. </div>
  90. </div>
  91. </a-alert>
  92. <!-- 列表 -->
  93. <s-table
  94. class="sTable"
  95. ref="table"
  96. size="small"
  97. :rowKey="(record) => record.id"
  98. :columns="columns"
  99. :data="loadData"
  100. :defaultLoadData="false"
  101. :showPagination="false"
  102. bordered>
  103. <!-- 产品编码 -->
  104. <template slot="productCode" slot-scope="text, record">
  105. <div v-if="(record.promotionFlag == 1) || (Number(record.stockQty) < Number(record.unpushedQty)) && (detailData&&detailData.billStatus == 'WAIT_AUDIT'&&$hasPermissions('B_salesAudit'))" class="flexBox">
  106. <div>{{ text }}</div>
  107. <a-badge count="促" :number-style="{ backgroundColor: '#f90' }" v-if="record.promotionFlag == 1">
  108. </a-badge>
  109. <!-- 可审核时才可显示“缺”货产品 -->
  110. <a-badge count="缺" v-if="(Number(record.stockQty) < Number(record.unpushedQty)) && (detailData&&detailData.billStatus == 'WAIT_AUDIT'&&$hasPermissions('B_salesAudit'))">
  111. </a-badge>
  112. </div>
  113. <span v-if="!(record.promotionFlag == 1 || ((Number(record.stockQty) < Number(record.unpushedQty)) && (detailData&&detailData.billStatus == 'WAIT_AUDIT'&&$hasPermissions('B_salesAudit'))))">{{ text }}</span>
  114. </template>
  115. <!-- 当前库存 -->
  116. <template slot="stockQty" slot-scope="text, record">
  117. <div v-if="record.stockQty || record.stockQty==0">
  118. <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>
  119. <p style="margin: 0;" v-else>{{ record.stockQty }}</p>
  120. </div>
  121. <span v-else>--</span>
  122. </template>
  123. </s-table>
  124. </a-card>
  125. </a-spin>
  126. <div class="affix-cont">
  127. <a-button
  128. size="large"
  129. style="width: 100px;"
  130. :disabled="spinning"
  131. type="primary"
  132. class="button-info"
  133. id="salesDetail-audit-btn"
  134. v-if="detailData&&detailData.billStatus == 'WAIT_AUDIT'&&$hasPermissions('B_salesAudit')"
  135. @click="handleAudit()"
  136. >
  137. 审核
  138. </a-button>
  139. <a-button
  140. type="default"
  141. :disabled="spinning"
  142. class="button-info"
  143. size="large"
  144. style="width: 100px;margin: 0 20px;"
  145. id="salesDetail-edit-btn"
  146. v-if="detailData&&detailData.salesBillSource != 'PURCHASE' && (detailData.billStatus == 'WAIT_SUBMIT' || detailData.billStatus == 'WAIT_AUDIT' || detailData.billStatus == 'AUDIT_REJECT')&&$hasPermissions('B_salesEdit')"
  147. @click="handleEdit()"
  148. >
  149. 编辑
  150. </a-button>
  151. <a-button
  152. size="large"
  153. style="width: 100px;margin: 0 20px;"
  154. :disabled="spinning"
  155. type="default"
  156. class="button-info"
  157. id="salesDetail-edit-btn"
  158. v-if="detailData&&detailData.salesBillSource == 'PURCHASE' && (detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')&&$hasPermissions('B_salesEdit')"
  159. @click="handleEdit()"
  160. >
  161. 改单
  162. </a-button>
  163. <a-button
  164. size="large"
  165. style="width: 100px;"
  166. :disabled="spinning"
  167. type="primary"
  168. class="button-success"
  169. id="salesDetail-batchAudit-btn"
  170. v-if="detailData&&detailData.billStatus == 'WAIT_AUDIT'&&$hasPermissions('B_salesAudit')"
  171. @click="handleAudit('batch')"
  172. >
  173. 一键审核
  174. </a-button>
  175. </div>
  176. <!-- 打印导出 -->
  177. <print-modal :openModal="openModal" :itemData="detailData" :nowType="nowType" @ok="handleOk" @close="openModal=false" />
  178. <!-- 审核 -->
  179. <auditModal
  180. :openModal="visibleAudit"
  181. :content="auditText"
  182. :spinning="spinningAudit"
  183. @close="visibleAudit=false"
  184. @ok="auditOrder('AUDIT_PASS')"
  185. @fail="auditOrder('AUDIT_REJECT')" />
  186. <!-- 打印 -->
  187. <div id="print"></div>
  188. </div>
  189. </template>
  190. <script>
  191. import { printFun, exportExcel } from '@/libs/JGPrint.js'
  192. import { commonMixin } from '@/utils/mixin'
  193. import moment from 'moment'
  194. import { STable, VSelect } from '@/components'
  195. import printModal from './printModal.vue'
  196. import auditModal from '@/views/common/auditModal.vue'
  197. import { findBySalesBillSn } from '@/api/dispatch'
  198. import { salesDetailBySn, salesDetailPrint, salesDetailExcel, salesDetailTypeExcel, salesWriteAudit, salesWriteAuditPush } from '@/api/sales'
  199. import { salesDetailAllList, salesDetailAllStockList } from '@/api/salesDetail'
  200. export default {
  201. name: 'SalesDetail',
  202. mixins: [commonMixin],
  203. components: { STable, VSelect, printModal, auditModal },
  204. data () {
  205. return {
  206. spinning: false,
  207. disabled: false,
  208. // 加载数据方法 必须为 Promise 对象
  209. loadData: parameter => {
  210. this.disabled = true
  211. const params = Object.assign(parameter, { salesBillSn: this.$route.params.sn })
  212. let url = salesDetailAllList
  213. if (this.detailData && this.detailData.billStatus == 'WAIT_AUDIT' && this.$hasPermissions('B_salesAudit')) { // 审核,需用到库存
  214. url = salesDetailAllStockList
  215. } else { // 非审核
  216. url = salesDetailAllList
  217. }
  218. return url(params).then(res => {
  219. let data
  220. if (res.status == 200) {
  221. data = res.data
  222. const no = 0
  223. this.outStockStr = ''
  224. let str = ''
  225. for (var i = 0; i < data.length; i++) {
  226. data[i].no = no + i + 1
  227. const productCode = (data[i].productEntity && data[i].productEntity.code) || (data[i].dealerProductEntity && data[i].dealerProductEntity.code)
  228. const productName = (data[i].productEntity && data[i].productEntity.name) || (data[i].dealerProductEntity && data[i].dealerProductEntity.name)
  229. const productOrigCode = (data[i].productEntity && data[i].productEntity.origCode) || (data[i].dealerProductEntity && data[i].dealerProductEntity.origCode)
  230. const productOrigUnit = (data[i].productEntity && data[i].productEntity.unit) || (data[i].dealerProductEntity && data[i].dealerProductEntity.unit)
  231. data[i].productCode = productCode || '--'
  232. data[i].productName = productName || '--'
  233. data[i].productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
  234. data[i].productOrigUnit = productOrigUnit || '--'
  235. if (data[i].unpushedQty && (Number(data[i].stockQty) < Number(data[i].unpushedQty))) {
  236. str += data[i].productCode + '、'
  237. }
  238. }
  239. if (str.length > 0) {
  240. str = str.substr(0, str.length - 1)
  241. this.outStockStr = '产品编号为:' + str + '的产品库存不足;'
  242. }
  243. this.localDataSource = data
  244. this.disabled = false
  245. }
  246. return data
  247. })
  248. },
  249. localDataSource: [],
  250. openModal: false,
  251. detailData: null, // 详情数据
  252. nowType: null,
  253. isCityPrice: false, // 是否显示市级价
  254. visibleAudit: false,
  255. auditInfo: null,
  256. spinningAudit: false,
  257. outStockStr: '', // 缺货产品信息说明
  258. auditText: null
  259. }
  260. },
  261. computed: {
  262. shippingAddress () {
  263. const shippingAddrProvinceName = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddrProvinceName ? this.detailData.salesBillExtEntity.shippingAddrProvinceName : ''
  264. const shippingAddrCityName = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddrCityName ? this.detailData.salesBillExtEntity.shippingAddrCityName : ''
  265. const shippingAddrCountyName = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddrCountyName ? this.detailData.salesBillExtEntity.shippingAddrCountyName : ''
  266. const shippingAddr = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddr ? this.detailData.salesBillExtEntity.shippingAddr : ''
  267. if (!shippingAddrProvinceName && !shippingAddrCityName && !shippingAddrCountyName && !shippingAddr) {
  268. return '--'
  269. } else {
  270. return shippingAddrProvinceName + shippingAddrCityName + shippingAddrCountyName + shippingAddr
  271. }
  272. },
  273. columns () {
  274. const arr = [
  275. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  276. { title: '产品编码', dataIndex: 'productCode', width: '13%', scopedSlots: { customRender: 'productCode' }, align: 'left' },
  277. { title: '产品名称', dataIndex: 'productName', width: '13%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  278. { title: '原厂编码', dataIndex: 'productOrigCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  279. // { title: '成本价', dataIndex: 'showCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  280. // { title: '省级价', dataIndex: 'provincePrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  281. // { title: '市级价', dataIndex: 'cityPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  282. // { title: '销售价', dataIndex: 'price', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  283. { title: '单位', dataIndex: 'productOrigUnit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  284. { title: '销售数量', dataIndex: 'qty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  285. // { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '6%', align: 'center' },
  286. { title: '待下推数', dataIndex: 'unpushedQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  287. { title: '已下推数', dataIndex: 'pushedQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  288. { title: '已取消数', dataIndex: 'cancelQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  289. ]
  290. if (this.$hasPermissions('B_isShowCost')) { // 成本价权限
  291. arr.splice(4, 0, { title: '成本价', dataIndex: 'showCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  292. }
  293. if (this.$hasPermissions('B_isShowPrice')) { // 售价权限
  294. const ind = this.$hasPermissions('B_isShowCost') ? 5 : 4
  295. arr.splice(ind, 0, { title: '省级价', dataIndex: 'provincePrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  296. if (this.isCityPrice) {
  297. arr.splice(ind + 1, 0, { title: '市级价', dataIndex: 'cityPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  298. arr.splice(ind + 2, 0, { title: '销售价', dataIndex: 'price', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  299. } else {
  300. arr.splice(ind + 1, 0, { title: '销售价', dataIndex: 'price', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  301. }
  302. }
  303. if (this.detailData && this.detailData.billStatus == 'WAIT_AUDIT' && this.$hasPermissions('B_salesAudit')) { // 审核,需用到库存
  304. arr.splice(arr.length - 3, 0, { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '6%', align: 'center' })
  305. }
  306. return arr
  307. }
  308. },
  309. methods: {
  310. // 返回
  311. handleBack () {
  312. if (this.$route.params.type == 'pushOrder') { // 下推
  313. this.$router.push({ path: '/salesManagement/pushOrderManagement/list', query: { closeLastOldTab: true } })
  314. } else if (this.$route.params.type == 'financialCollection') { // 财务收款
  315. this.$router.push({ path: '/financialManagement/financialCollection/list', query: { closeLastOldTab: true } })
  316. } else if (this.$route.params.type == 'salesCollection') { // 销售收款
  317. this.$router.push({ path: '/salesManagement/salesCollection/list', query: { closeLastOldTab: true } })
  318. } else {
  319. this.$router.push({ path: '/salesManagement/salesQuery/list', query: { closeLastOldTab: true } })
  320. }
  321. },
  322. // 编辑
  323. handleEdit () {
  324. const row = this.detailData
  325. this.$router.push({ name: 'salesEdit', params: { sn: row.salesBillSn } })
  326. },
  327. // 详情
  328. getDetail () {
  329. salesDetailBySn({ salesBillSn: this.$route.params.sn }).then(res => {
  330. if (res.status == 200) {
  331. this.detailData = res.data || null
  332. this.$refs.table.refresh(true)
  333. } else {
  334. this.detailData = null
  335. }
  336. })
  337. },
  338. // 审核/批量审核
  339. handleAudit (isBatch) {
  340. if (isBatch) {
  341. this.auditText = this.outStockStr + '是否审核通过?'
  342. } else {
  343. this.auditText = null
  344. }
  345. this.visibleAudit = true
  346. },
  347. // 审核
  348. auditOrder (billStatus) {
  349. this.spinningAudit = true
  350. let url = salesWriteAudit
  351. if (this.auditText) { // 批量
  352. url = salesWriteAuditPush
  353. }
  354. url({
  355. salesBillSn: this.$route.params.sn,
  356. billStatus: billStatus
  357. }).then(res => {
  358. if (res.status == 200) {
  359. this.visibleAudit = false
  360. this.$message.success(res.message)
  361. this.spinningAudit = false
  362. if (billStatus == 'AUDIT_PASS' && !this.auditText) {
  363. this.handleDispatch({ salesBillSn: this.$route.params.sn })
  364. } else {
  365. // 关闭详情跳列表
  366. this.handleBack()
  367. }
  368. } else {
  369. this.visibleAudit = false
  370. this.spinningAudit = false
  371. }
  372. })
  373. },
  374. // 下推
  375. handleDispatch (row) {
  376. this.spinning = true
  377. findBySalesBillSn({ salesBillSn: row.salesBillSn }).then(res => {
  378. this.spinning = false
  379. if (res.status == 200) {
  380. this.$router.push({ name: 'waitDispatch', params: { salesBillSn: row.salesBillSn, dispatchBillSn: res.data.dispatchBillSn } })
  381. }
  382. })
  383. },
  384. // 打印导出
  385. handlePrint (type) {
  386. const _this = this
  387. // 销售分类导出
  388. if (type == 'typeExport') {
  389. const params = {
  390. salesBillSn: this.$route.params.sn,
  391. showCostFlag: this.$hasPermissions('B_isShowCost')
  392. }
  393. _this.spinning = true
  394. exportExcel(salesDetailTypeExcel, params, '销售分类' + moment().format('YYYYMMDDHHmmss'), () => { _this.spinning = false })
  395. } else {
  396. this.nowType = type
  397. this.openModal = true
  398. }
  399. },
  400. // 确定打印或预览
  401. handleOk (objs) {
  402. const _this = this
  403. const params = JSON.parse(JSON.stringify(objs))
  404. delete params.type
  405. _this.spinning = true
  406. if (this.nowType == 'export') { // 导出
  407. exportExcel(salesDetailExcel, params, '销售' + moment().format('YYYYMMDDHHmmss'), () => { _this.spinning = false })
  408. } else { // 打印
  409. const taskName = this.nowType == 'SALES_BILL' ? '销售单' : '销售分类'
  410. printFun(salesDetailPrint, params, objs.type, taskName, () => { _this.spinning = false })
  411. }
  412. }
  413. },
  414. mounted () {
  415. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  416. this.getDetail()
  417. }
  418. },
  419. activated () {
  420. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  421. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  422. this.getDetail()
  423. }
  424. },
  425. beforeRouteEnter (to, from, next) {
  426. next(vm => {})
  427. }
  428. }
  429. </script>
  430. <style lang="less">
  431. .salesDetail-wrap{
  432. position: relative;
  433. height: 100%;
  434. padding-bottom: 51px;
  435. box-sizing: border-box;
  436. >.ant-spin-nested-loading{
  437. overflow-y: auto;
  438. height: 100%;
  439. }
  440. .salesDetail-cont{
  441. margin-bottom: 10px;
  442. }
  443. .flexBox{
  444. display: flex;
  445. justify-content: space-between;
  446. align-items: center;
  447. }
  448. .footer-cont{
  449. margin-top: 5px;
  450. text-align: center;
  451. }
  452. .redStyle{
  453. font-weight: bold;
  454. color: red;
  455. }
  456. }
  457. </style>