detail.vue 26 KB

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