detail.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  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) ? toThousands(detailData.totalAmount) : '--' }}</strong>;</span>
  79. <span v-if="$hasPermissions('B_isShowCost')">总成本:<strong>{{ detailData&&(detailData.totalCost || detailData.totalCost==0) ? toThousands(detailData.totalCost) : '--' }}</strong>;</span>
  80. <span v-if="$hasPermissions('B_isShowCost')">总毛利:<strong>{{ detailData&&(detailData.grossProfit || detailData.grossProfit==0) ? toThousands(detailData.grossProfit) : '--' }}</strong>;</span>
  81. <span v-if="$hasPermissions('B_isShowPrice')">已取消金额:<strong>{{ detailData&&(detailData.totalCancelAmount || detailData.totalCancelAmount==0) ? toThousands(detailData.totalCancelAmount) : '--' }}</strong>;</span>
  82. <span v-if="$hasPermissions('B_isShowPrice')">已下推金额:<strong>{{ detailData&&(detailData.totalPushedAmount || detailData.totalPushedAmount==0) ? toThousands(detailData.totalPushedAmount) : '--' }}</strong>;</span>
  83. <span v-if="$hasPermissions('B_isShowPrice')">待下推金额:<strong>{{ detailData&&(detailData.totalUnpushedAmount || detailData.totalUnpushedAmount==0) ? toThousands(detailData.totalUnpushedAmount) : '--' }}</strong>;</span>
  84. <span v-if="$hasPermissions('B_isShowPrice')">已发货金额:<strong>{{ detailData&&(detailData.totalDispatchAmount || detailData.totalDispatchAmount==0) ? toThousands(detailData.totalDispatchAmount) : '--' }}</strong>;</span>
  85. <span v-if="$hasPermissions('B_isShowPrice')">待发货金额:<strong>{{ detailData&&(detailData.totalUndispatchAmount || detailData.totalUndispatchAmount==0) ? toThousands(detailData.totalUndispatchAmount) : '--' }}</strong>;</span>
  86. <span v-if="isCityPrice">市级总售价:<strong>{{ detailData&&(detailData.totalCityAmount || detailData.totalCityAmount==0) ? toThousands(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 _this = this
  289. const arr = [
  290. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  291. { title: '产品编码', dataIndex: 'productCode', width: '13%', scopedSlots: { customRender: 'productCode' }, align: 'center' },
  292. { title: '产品名称', dataIndex: 'productName', width: '13%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  293. { title: '原厂编码', dataIndex: 'productOrigCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  294. // { title: '成本价', dataIndex: 'showCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  295. // { title: '省级价', dataIndex: 'provincePrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  296. // { title: '市级价', dataIndex: 'cityPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  297. // { title: '销售价', dataIndex: 'price', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  298. { title: '单位', dataIndex: 'productOrigUnit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  299. { title: '销售数量', dataIndex: 'qty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  300. // { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '6%', align: 'center' },
  301. { title: '待下推数', dataIndex: 'unpushedQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  302. { title: '已下推数', dataIndex: 'pushedQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  303. { title: '已取消数', dataIndex: 'cancelQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  304. ]
  305. if (this.$hasPermissions('B_isShowCost')) { // 成本价权限
  306. arr.splice(4, 0, { title: '成本价', dataIndex: 'showCost', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  307. }
  308. if (this.$hasPermissions('B_isShowPrice')) { // 售价权限
  309. const ind = this.$hasPermissions('B_isShowCost') ? 5 : 4
  310. arr.splice(ind, 0, { title: '省级价', dataIndex: 'provincePrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  311. if (this.isCityPrice) {
  312. arr.splice(ind + 1, 0, { title: '市级价', dataIndex: 'cityPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  313. arr.splice(ind + 2, 0, { title: '销售价', dataIndex: 'price', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  314. } else {
  315. arr.splice(ind + 1, 0, { title: '销售价', dataIndex: 'price', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  316. }
  317. }
  318. if (this.detailData && (this.detailData.billStatus == 'WAIT_AUDIT' || this.detailData.billStatus == 'HQ_CHANGE') && this.$hasPermissions('B_salesAudit')) { // 审核,需用到库存
  319. arr.splice(arr.length - 3, 0, { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '6%', align: 'center' })
  320. }
  321. return arr
  322. }
  323. },
  324. methods: {
  325. // 返回
  326. handleBack () {
  327. this.$router.push({ name: 'salesQueryList' })
  328. },
  329. // 编辑
  330. handleEdit () {
  331. const row = this.detailData
  332. this.$router.push({ name: 'salesEdit', params: { sn: row.salesBillSn } })
  333. },
  334. // 打开缺货明细
  335. openStockOut () {
  336. if (this.outStockStr != '') {
  337. this.showStockOut = true
  338. } else {
  339. this.$info({
  340. title: '提示',
  341. content: '此销售单暂无缺货产品!',
  342. centered: true
  343. })
  344. }
  345. },
  346. // 详情
  347. getDetail () {
  348. salesDetailBySn({ salesBillSn: this.bizSn || this.$route.params.sn }).then(res => {
  349. if (res.status == 200) {
  350. this.detailData = res.data || null
  351. this.$refs.table.refresh(true)
  352. } else {
  353. this.detailData = null
  354. }
  355. })
  356. },
  357. // 打开审核/一键审核弹框
  358. handleAudit (isBatch) {
  359. if (isBatch) { // 一键审核
  360. this.showDsModal = true
  361. this.$refs.dsModal.setDetail(this.detailData)
  362. } else {
  363. this.auditText = null
  364. this.visibleAudit = true
  365. }
  366. },
  367. // 一键审核
  368. handleOnceAudit (data) {
  369. const params = {
  370. salesBillSn: this.bizSn || this.$route.params.sn,
  371. billStatus: 'AUDIT_PASS',
  372. dispatchBill: data
  373. }
  374. this.spinningAudit = true
  375. this.spinning = true
  376. salesWriteAuditPush(params).then(res => {
  377. if (res.status == 200) {
  378. this.$message.success(res.message)
  379. this.spinningAudit = false
  380. this.spinning = false
  381. // 关闭详情跳列表
  382. this.handleBack()
  383. }
  384. })
  385. },
  386. // 审核
  387. auditOrder (billStatus) {
  388. this.spinningAudit = true
  389. salesWriteAudit({
  390. salesBillSn: this.bizSn || this.$route.params.sn,
  391. billStatus: billStatus
  392. }).then(res => {
  393. if (res.status == 200) {
  394. this.visibleAudit = false
  395. this.$message.success(res.message)
  396. this.spinningAudit = false
  397. if (billStatus == 'AUDIT_PASS' && !this.auditText) {
  398. this.$router.push({ name: 'waitDispatch', params: { salesBillSn: this.bizSn || this.$route.params.sn, dispatchBillSn: res.data.dispatchBillSn } })
  399. } else {
  400. // 关闭详情跳列表
  401. this.handleBack()
  402. }
  403. } else {
  404. this.visibleAudit = false
  405. this.spinningAudit = false
  406. }
  407. })
  408. },
  409. // 打印导出
  410. handlePrint (type) {
  411. const _this = this
  412. // 销售分类导出
  413. if (type == 'typeExport') {
  414. const params = {
  415. salesBillSn: this.bizSn || this.$route.params.sn,
  416. showCostFlag: this.$hasPermissions('B_isShowCost')
  417. }
  418. _this.spinning = true
  419. exportExcel(salesDetailTypeExcel, params, '销售分类' + moment().format('YYYYMMDDHHmmss'), () => { _this.spinning = false })
  420. } else {
  421. this.nowType = type
  422. this.openModal = true
  423. }
  424. },
  425. // 确定打印或预览
  426. handleOk (objs) {
  427. const _this = this
  428. const params = JSON.parse(JSON.stringify(objs))
  429. delete params.type
  430. _this.spinning = true
  431. if (this.nowType == 'export') { // 导出
  432. exportExcel(salesDetailExcel, params, '销售' + moment().format('YYYYMMDDHHmmss'), () => { _this.spinning = false })
  433. } else { // 打印
  434. const taskName = this.nowType == 'SALES_BILL' ? '销售单' : '销售分类'
  435. printFun(salesDetailPrint, params, objs.type, taskName, () => { _this.spinning = false })
  436. }
  437. }
  438. },
  439. mounted () {
  440. if (!this.$store.state.app.isNewTab || this.bizSn) { // 页签刷新时调用
  441. this.getDetail()
  442. }
  443. },
  444. activated () {
  445. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  446. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  447. this.getDetail()
  448. }
  449. },
  450. beforeRouteEnter (to, from, next) {
  451. next(vm => {
  452. vm.fromRouter = from
  453. })
  454. }
  455. }
  456. </script>
  457. <style lang="less">
  458. .salesDetail-wrap{
  459. position: relative;
  460. height: 100%;
  461. padding-bottom: 51px;
  462. box-sizing: border-box;
  463. >.ant-spin-nested-loading{
  464. overflow-y: auto;
  465. height: 100%;
  466. }
  467. .salesDetail-cont{
  468. margin-bottom: 10px;
  469. }
  470. .flexBox{
  471. display: flex;
  472. justify-content: space-between;
  473. align-items: center;
  474. }
  475. .footer-cont{
  476. margin-top: 5px;
  477. text-align: center;
  478. }
  479. .redStyle{
  480. font-weight: bold;
  481. color: red;
  482. }
  483. }
  484. </style>