detail.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  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" v-if="!bizSn">
  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_salesTypePrint')"
  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_salesDetailExport')"
  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_salesTypeExport')"
  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. <div>
  89. <a-button v-if="detailData && (detailData.billStatus == 'WAIT_AUDIT' || detailData.billStatus == 'HQ_CHANGE')" type="link" @click="openStockOut">缺货明细</a-button>
  90. <a-checkbox v-model="isCityPrice" v-if="$hasPermissions('B_isShowPrice')"><span style="display: inline-block;margin-top: 1px;">市级价</span></a-checkbox>
  91. </div>
  92. </div>
  93. </div>
  94. </a-alert>
  95. <!-- 列表 -->
  96. <s-table
  97. class="sTable"
  98. ref="table"
  99. size="small"
  100. :rowKey="(record) => record.id"
  101. :columns="columns"
  102. :data="loadData"
  103. :defaultLoadData="false"
  104. :showPagination="false"
  105. bordered>
  106. <!-- 产品编码 -->
  107. <template slot="productCode" slot-scope="text, record">
  108. <div v-if="(record.promotionFlag == 1) || (Number(record.stockQty) < Number(record.unpushedQty)) && (detailData&&(detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')&&$hasPermissions('B_salesAudit'))">
  109. <span>{{ text }}</span>
  110. <a-badge count="促" :number-style="{ backgroundColor: '#f90' }" v-if="record.promotionFlag == 1"></a-badge>
  111. <!-- 可审核时才可显示“缺”货产品 -->
  112. <a-badge count="缺" v-if="(Number(record.stockQty) < Number(record.unpushedQty)) && (detailData&&(detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')&&$hasPermissions('B_salesAudit'))">
  113. </a-badge>
  114. </div>
  115. <span v-if="!(record.promotionFlag == 1 || ((Number(record.stockQty) < Number(record.unpushedQty)) && (detailData&&(detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')&&$hasPermissions('B_salesAudit'))))">{{ text }}</span>
  116. </template>
  117. <!-- 当前库存 -->
  118. <template slot="stockQty" slot-scope="text, record">
  119. <div v-if="record.stockQty || record.stockQty==0">
  120. <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>
  121. <p style="margin: 0;" v-else>{{ record.stockQty }}</p>
  122. </div>
  123. <span v-else>--</span>
  124. </template>
  125. </s-table>
  126. </a-card>
  127. </a-spin>
  128. <div class="affix-cont">
  129. <a-button
  130. size="large"
  131. style="width: 100px;"
  132. :disabled="spinning"
  133. type="primary"
  134. class="button-info"
  135. id="salesDetail-audit-btn"
  136. v-if="detailData&&detailData.billStatus == 'WAIT_AUDIT'&&$hasPermissions('B_salesAudit')"
  137. @click="handleAudit()"
  138. >
  139. 审核
  140. </a-button>
  141. <a-button
  142. type="default"
  143. :disabled="spinning"
  144. class="button-info"
  145. size="large"
  146. style="width: 100px;margin: 0 20px;"
  147. id="salesDetail-edit-btn"
  148. v-if="detailData&&detailData.salesBillSource != 'PURCHASE' && (detailData.billStatus == 'WAIT_SUBMIT' || detailData.billStatus == 'WAIT_AUDIT' || detailData.billStatus == 'AUDIT_REJECT')&&$hasPermissions('B_salesEdit')"
  149. @click="handleEdit()"
  150. >
  151. 编辑
  152. </a-button>
  153. <a-button
  154. size="large"
  155. style="width: 100px;margin: 0 20px;"
  156. :disabled="spinning"
  157. type="default"
  158. class="button-info"
  159. id="salesDetail-edit-btn"
  160. v-if="detailData&&detailData.salesBillSource == 'PURCHASE' && (detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')&&$hasPermissions('B_salesEdit')"
  161. @click="handleEdit()"
  162. >
  163. 改单
  164. </a-button>
  165. <a-button
  166. size="large"
  167. style="width: 100px;"
  168. :disabled="spinning"
  169. type="primary"
  170. class="button-success"
  171. id="salesDetail-batchAudit-btn"
  172. v-if="detailData&&detailData.billStatus == 'WAIT_AUDIT'&&$hasPermissions('B_salesAudit')"
  173. @click="handleAudit('batch')"
  174. >
  175. 一键审核
  176. </a-button>
  177. </div>
  178. <!-- 打印导出 -->
  179. <print-modal :openModal="openModal" :itemData="detailData" :nowType="nowType" @ok="handleOk" @close="openModal=false" />
  180. <!-- 审核 -->
  181. <auditModal
  182. :openModal="visibleAudit"
  183. :content="auditText"
  184. :spinning="spinningAudit"
  185. @close="visibleAudit=false"
  186. @ok="auditOrder('AUDIT_PASS')"
  187. @fail="auditOrder('AUDIT_REJECT')" />
  188. <!-- 审核加下推 -->
  189. <dsModal ref="dsModal" title="销售单一键审核" :openModal="showDsModal" @close="showDsModal=false" @ok="handleOnceAudit" />
  190. <!-- 缺货明细 -->
  191. <stockOutDetail :openModal="showStockOut" :detailData="detailData" :salesBillSn="$route.params.sn || bizSn" @close="showStockOut=false"></stockOutDetail>
  192. </div>
  193. </template>
  194. <script>
  195. import { printFun, exportExcel } from '@/libs/JGPrint.js'
  196. import { commonMixin } from '@/utils/mixin'
  197. import moment from 'moment'
  198. import { STable, VSelect } from '@/components'
  199. import printModal from './printModal.vue'
  200. import auditModal from '@/views/common/auditModal.vue'
  201. import dsModal from '@/views/salesManagement/waitDispatch/dsModal.vue'
  202. import stockOutDetail from './stockOutDetailModal.vue'
  203. import { salesDetailBySn, salesDetailPrint, salesDetailExcel, salesDetailTypeExcel, salesWriteAudit, salesWriteAuditPush } from '@/api/sales'
  204. import { salesDetailAllList, salesDetailAllStockList } from '@/api/salesDetail'
  205. export default {
  206. name: 'SalesDetail',
  207. mixins: [commonMixin],
  208. components: { STable, VSelect, printModal, auditModal, dsModal, stockOutDetail },
  209. props: {
  210. bizSn: { // 有值则为弹框,无值则为页面
  211. type: [Number, String],
  212. default: ''
  213. }
  214. },
  215. data () {
  216. return {
  217. spinning: false,
  218. disabled: false,
  219. showDsModal: false,
  220. showStockOut: false,
  221. // 加载数据方法 必须为 Promise 对象
  222. loadData: parameter => {
  223. this.disabled = true
  224. const params = Object.assign(parameter, { salesBillSn: this.bizSn || this.$route.params.sn })
  225. let url = salesDetailAllList
  226. if (this.detailData && (this.detailData.billStatus == 'WAIT_AUDIT' || this.detailData.billStatus == 'HQ_CHANGE') && this.$hasPermissions('B_salesAudit')) { // 审核,需用到库存
  227. url = salesDetailAllStockList
  228. } else { // 非审核
  229. url = salesDetailAllList
  230. }
  231. return url(params).then(res => {
  232. let data
  233. if (res.status == 200) {
  234. data = res.data
  235. const no = 0
  236. this.outStockStr = ''
  237. let str = ''
  238. for (var i = 0; i < data.length; i++) {
  239. data[i].no = no + i + 1
  240. const productCode = (data[i].productEntity && data[i].productEntity.code) || (data[i].dealerProductEntity && data[i].dealerProductEntity.code)
  241. const productName = (data[i].productEntity && data[i].productEntity.name) || (data[i].dealerProductEntity && data[i].dealerProductEntity.name)
  242. const productOrigCode = (data[i].productEntity && data[i].productEntity.origCode) || (data[i].dealerProductEntity && data[i].dealerProductEntity.origCode)
  243. const productOrigUnit = (data[i].productEntity && data[i].productEntity.unit) || (data[i].dealerProductEntity && data[i].dealerProductEntity.unit)
  244. data[i].productCode = productCode || '--'
  245. data[i].productName = productName || '--'
  246. data[i].productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
  247. data[i].productOrigUnit = productOrigUnit || '--'
  248. if (data[i].unpushedQty && (Number(data[i].stockQty) < Number(data[i].unpushedQty))) {
  249. str += data[i].productCode + '、'
  250. }
  251. }
  252. if (str.length > 0) {
  253. str = str.substr(0, str.length - 1)
  254. this.outStockStr = '产品编号为:' + str + '的产品库存不足;'
  255. }
  256. this.localDataSource = data
  257. this.disabled = false
  258. }
  259. return data
  260. })
  261. },
  262. localDataSource: [],
  263. openModal: false,
  264. detailData: null, // 详情数据
  265. nowType: null,
  266. isCityPrice: false, // 是否显示市级价
  267. visibleAudit: false,
  268. auditInfo: null,
  269. spinningAudit: false,
  270. outStockStr: '', // 缺货产品信息说明
  271. auditText: null,
  272. fromRouter: null
  273. }
  274. },
  275. computed: {
  276. shippingAddress () {
  277. const shippingAddrProvinceName = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddrProvinceName ? this.detailData.salesBillExtEntity.shippingAddrProvinceName : ''
  278. const shippingAddrCityName = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddrCityName ? this.detailData.salesBillExtEntity.shippingAddrCityName : ''
  279. const shippingAddrCountyName = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddrCountyName ? this.detailData.salesBillExtEntity.shippingAddrCountyName : ''
  280. const shippingAddr = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddr ? this.detailData.salesBillExtEntity.shippingAddr : ''
  281. if (!shippingAddrProvinceName && !shippingAddrCityName && !shippingAddrCountyName && !shippingAddr) {
  282. return '--'
  283. } else {
  284. return shippingAddrProvinceName + shippingAddrCityName + shippingAddrCountyName + shippingAddr
  285. }
  286. },
  287. columns () {
  288. const arr = [
  289. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  290. { title: '产品编码', dataIndex: 'productCode', width: '13%', scopedSlots: { customRender: 'productCode' }, align: 'center' },
  291. { title: '产品名称', dataIndex: 'productName', width: '13%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  292. { title: '原厂编码', dataIndex: 'productOrigCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  293. // { title: '成本价', dataIndex: 'showCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  294. // { title: '省级价', dataIndex: 'provincePrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  295. // { title: '市级价', dataIndex: 'cityPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  296. // { title: '销售价', dataIndex: 'price', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  297. { title: '单位', dataIndex: 'productOrigUnit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  298. { title: '销售数量', dataIndex: 'qty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  299. // { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '6%', align: 'center' },
  300. { title: '待下推数', dataIndex: 'unpushedQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  301. { title: '已下推数', dataIndex: 'pushedQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  302. { title: '已取消数', dataIndex: 'cancelQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  303. ]
  304. if (this.$hasPermissions('B_isShowCost')) { // 成本价权限
  305. arr.splice(4, 0, { title: '成本价', dataIndex: 'showCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  306. }
  307. if (this.$hasPermissions('B_isShowPrice')) { // 售价权限
  308. const ind = this.$hasPermissions('B_isShowCost') ? 5 : 4
  309. arr.splice(ind, 0, { title: '省级价', dataIndex: 'provincePrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  310. if (this.isCityPrice) {
  311. arr.splice(ind + 1, 0, { title: '市级价', dataIndex: 'cityPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  312. arr.splice(ind + 2, 0, { title: '销售价', dataIndex: 'price', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  313. } else {
  314. arr.splice(ind + 1, 0, { title: '销售价', dataIndex: 'price', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  315. }
  316. }
  317. if (this.detailData && (this.detailData.billStatus == 'WAIT_AUDIT' || this.detailData.billStatus == 'HQ_CHANGE') && this.$hasPermissions('B_salesAudit')) { // 审核,需用到库存
  318. arr.splice(arr.length - 3, 0, { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '6%', align: 'center' })
  319. }
  320. return arr
  321. }
  322. },
  323. methods: {
  324. // 返回
  325. handleBack () {
  326. this.$router.push({ name: 'salesQueryList' })
  327. },
  328. // 编辑
  329. handleEdit () {
  330. const row = this.detailData
  331. this.$router.push({ name: 'salesEdit', params: { sn: row.salesBillSn } })
  332. },
  333. // 打开缺货明细
  334. openStockOut () {
  335. if (this.outStockStr != '') {
  336. this.showStockOut = true
  337. } else {
  338. this.$info({
  339. title: '提示',
  340. content: '此销售单暂无缺货产品!',
  341. centered: true
  342. })
  343. }
  344. },
  345. // 详情
  346. getDetail () {
  347. salesDetailBySn({ salesBillSn: this.bizSn || this.$route.params.sn }).then(res => {
  348. if (res.status == 200) {
  349. this.detailData = res.data || null
  350. this.$refs.table.refresh(true)
  351. } else {
  352. this.detailData = null
  353. }
  354. })
  355. },
  356. // 打开审核/一键审核弹框
  357. handleAudit (isBatch) {
  358. if (isBatch) { // 一键审核
  359. this.showDsModal = true
  360. this.$refs.dsModal.setDetail(this.detailData)
  361. } else {
  362. this.auditText = null
  363. this.visibleAudit = true
  364. }
  365. },
  366. // 一键审核
  367. handleOnceAudit (data) {
  368. const params = {
  369. salesBillSn: this.bizSn || this.$route.params.sn,
  370. billStatus: 'AUDIT_PASS',
  371. dispatchBill: data
  372. }
  373. this.spinningAudit = true
  374. this.spinning = true
  375. salesWriteAuditPush(params).then(res => {
  376. if (res.status == 200) {
  377. this.$message.success(res.message)
  378. this.spinningAudit = false
  379. this.spinning = false
  380. // 关闭详情跳列表
  381. this.handleBack()
  382. }
  383. })
  384. },
  385. // 审核
  386. auditOrder (billStatus) {
  387. this.spinningAudit = true
  388. salesWriteAudit({
  389. salesBillSn: this.bizSn || this.$route.params.sn,
  390. billStatus: billStatus
  391. }).then(res => {
  392. if (res.status == 200) {
  393. this.visibleAudit = false
  394. this.$message.success(res.message)
  395. this.spinningAudit = false
  396. if (billStatus == 'AUDIT_PASS' && !this.auditText) {
  397. this.$router.push({ name: 'waitDispatch', params: { salesBillSn: this.bizSn || this.$route.params.sn, dispatchBillSn: res.data.dispatchBillSn } })
  398. } else {
  399. // 关闭详情跳列表
  400. this.handleBack()
  401. }
  402. } else {
  403. this.visibleAudit = false
  404. this.spinningAudit = false
  405. }
  406. })
  407. },
  408. // 打印导出
  409. handlePrint (type) {
  410. const _this = this
  411. // 销售分类导出
  412. if (type == 'typeExport') {
  413. const params = {
  414. salesBillSn: this.bizSn || this.$route.params.sn,
  415. showCostFlag: this.$hasPermissions('B_isShowCost')
  416. }
  417. _this.spinning = true
  418. exportExcel(salesDetailTypeExcel, params, '销售分类' + moment().format('YYYYMMDDHHmmss'), () => { _this.spinning = false })
  419. } else {
  420. this.nowType = type
  421. this.openModal = true
  422. }
  423. },
  424. // 确定打印或预览
  425. handleOk (objs) {
  426. const _this = this
  427. const params = JSON.parse(JSON.stringify(objs))
  428. delete params.type
  429. _this.spinning = true
  430. if (this.nowType == 'export') { // 导出
  431. exportExcel(salesDetailExcel, params, '销售' + moment().format('YYYYMMDDHHmmss'), () => { _this.spinning = false })
  432. } else { // 打印
  433. const taskName = this.nowType == 'SALES_BILL' ? '销售单' : '销售分类'
  434. printFun(salesDetailPrint, params, objs.type, taskName, () => { _this.spinning = false })
  435. }
  436. }
  437. },
  438. mounted () {
  439. if (!this.$store.state.app.isNewTab || this.bizSn) { // 页签刷新时调用
  440. this.getDetail()
  441. }
  442. },
  443. activated () {
  444. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  445. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  446. this.getDetail()
  447. }
  448. },
  449. beforeRouteEnter (to, from, next) {
  450. next(vm => {
  451. vm.fromRouter = from
  452. })
  453. }
  454. }
  455. </script>
  456. <style lang="less">
  457. .salesDetail-wrap{
  458. position: relative;
  459. height: 100%;
  460. padding-bottom: 51px;
  461. box-sizing: border-box;
  462. >.ant-spin-nested-loading{
  463. overflow-y: auto;
  464. height: 100%;
  465. }
  466. .salesDetail-cont{
  467. margin-bottom: 10px;
  468. }
  469. .flexBox{
  470. display: flex;
  471. justify-content: space-between;
  472. align-items: center;
  473. }
  474. .footer-cont{
  475. margin-top: 5px;
  476. text-align: center;
  477. }
  478. .redStyle{
  479. font-weight: bold;
  480. color: red;
  481. }
  482. }
  483. </style>