detail.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <div class="salesReturnDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="salesReturnDetail-cont">
  5. <template slot="subTitle">
  6. <a href="javascript:;" @click="handleBack">
  7. <a-icon type="left"></a-icon>
  8. 返回列表
  9. </a>
  10. </template>
  11. <!-- 操作区,位于 title 行的行尾 -->
  12. <template slot="extra">
  13. <a-button
  14. key="3"
  15. type="default"
  16. class="button-info"
  17. id="salesReturnEdit-preview-btn"
  18. v-if="$hasPermissions('B_salesReturnPrint')"
  19. :disabled="chooseLoadData.length==0"
  20. @click="handlePrint('preview')">打印预览</a-button>
  21. <a-button
  22. key="2"
  23. type="primary"
  24. class="button-info"
  25. id="salesReturnEdit-print-btn"
  26. v-if="$hasPermissions('B_salesReturnPrint')"
  27. :disabled="chooseLoadData.length==0"
  28. @click="handlePrint('print')">快捷打印</a-button>
  29. <a-divider type="vertical" />
  30. <a-button
  31. key="1"
  32. type="primary"
  33. class="button-warning"
  34. id="salesReturnEdit-export-btn"
  35. v-if="$hasPermissions('B_salesReturnExport')"
  36. :disabled="chooseLoadData.length==0"
  37. @click="handlePrint('export')">导出Excel</a-button>
  38. </template>
  39. </a-page-header>
  40. <!-- 基础信息 -->
  41. <a-card size="small" :bordered="false" class="salesReturnDetail-cont">
  42. <a-collapse :activeKey="['1']">
  43. <a-collapse-panel key="1" header="基础信息">
  44. <a-descriptions size="small" :column="3">
  45. <a-descriptions-item label="单据来源">{{ detailData&&detailData.salesReturnBillSourceDictValue || '--' }}</a-descriptions-item>
  46. <a-descriptions-item label="销售退货单号">{{ detailData&&detailData.salesReturnBillNo || '--' }}</a-descriptions-item>
  47. <a-descriptions-item label="客户名称">{{ detailData&&detailData.buyerName || '--' }}</a-descriptions-item>
  48. <a-descriptions-item label="客户采退申请单号">{{ detailData&&detailData.purchaseReturnApplyNo || '--' }}</a-descriptions-item>
  49. <a-descriptions-item label="是否同步给客户">{{ detailData&&detailData.syncFlag ? ['否', '是'][detailData.syncFlag] : '--' }}</a-descriptions-item>
  50. <a-descriptions-item label="业务状态">{{ detailData&&detailData.billStatusDictValue || '--' }}</a-descriptions-item>
  51. <a-descriptions-item label="创建时间">{{ detailData&&detailData.createDate || '--' }}</a-descriptions-item>
  52. <a-descriptions-item label="审核时间">{{ detailData&&detailData.auditTime || '--' }}</a-descriptions-item>
  53. </a-descriptions>
  54. </a-collapse-panel>
  55. </a-collapse>
  56. </a-card>
  57. <a-card size="small" :bordered="false" class="pages-wrap">
  58. <a-tabs default-active-key="1" @change="callback">
  59. <a-tab-pane key="1" tab="产品明细" force-render>
  60. <!-- 列表 -->
  61. <s-table
  62. class="sTable"
  63. ref="table"
  64. size="small"
  65. :rowKey="record => record.id"
  66. :columns="columns"
  67. :data="loadData"
  68. :defaultLoadData="false"
  69. bordered></s-table>
  70. </a-tab-pane>
  71. <a-tab-pane key="2" tab="审核进度" >
  72. <auditDetail ref="auditDetail" businessType="SALES_RETURN" :itemSn="$route.params.sn"></auditDetail>
  73. </a-tab-pane>
  74. <a-tab-pane key="3" tab="操作记录" force-render>
  75. 操作记录
  76. </a-tab-pane>
  77. </a-tabs>
  78. </a-card>
  79. </a-spin>
  80. <!-- 打印 -->
  81. <div id="print"></div>
  82. </div>
  83. </template>
  84. <script>
  85. import { commonMixin } from '@/utils/mixin'
  86. import { getOperationalPrecision } from '@/libs/tools.js'
  87. import { STable, VSelect } from '@/components'
  88. import { printFun, exportExcel } from '@/libs/JGPrint.js'
  89. import auditDetail from './auditDetail.vue'
  90. import { salesReturnDetail, salesReturnPrint, salesReturnExport } from '@/api/salesReturn'
  91. import { salesReturnDetailList } from '@/api/salesReturnDetail'
  92. export default {
  93. name: 'SalesReturnDetail',
  94. mixins: [commonMixin],
  95. components: { STable, VSelect, auditDetail },
  96. data () {
  97. return {
  98. spinning: false,
  99. disabled: false,
  100. // 加载数据方法 必须为 Promise 对象
  101. loadData: parameter => {
  102. this.disabled = true
  103. const params = Object.assign(parameter, { salesReturnBillSn: this.$route.params.sn })
  104. return salesReturnDetailList(params).then(res => {
  105. let data
  106. if (res.status == 200) {
  107. data = res.data
  108. const no = (data.pageNo - 1) * data.pageSize
  109. for (var i = 0; i < data.list.length; i++) {
  110. data.list[i].no = no + i + 1
  111. // 折后退货金额小计 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
  112. data.list[i].saleReturnSubtotal = getOperationalPrecision(data.list[i].price, data.list[i].qty)
  113. }
  114. this.chooseLoadData = data.list
  115. this.disabled = false
  116. }
  117. return data
  118. })
  119. },
  120. chooseLoadData: [],
  121. detailData: null, // 详情数据
  122. visibleAudit: false,
  123. spinningAudit: false
  124. }
  125. },
  126. computed: {
  127. columns () {
  128. const arr = [
  129. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  130. { title: '产品编码', dataIndex: 'productEntity.code', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
  131. { title: '产品名称', dataIndex: 'productEntity.name', width: '8%', align: 'left', customRender: function (text) { return text || '--' } },
  132. { title: '单位', dataIndex: 'productEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  133. { title: '申请退货数量', dataIndex: 'qty', align: 'center', width: '7%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  134. { title: '仓库实收数量', dataIndex: 'receiveQty', align: 'center', width: '7%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  135. { title: '坏件数量', dataIndex: 'badQty', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  136. { title: '良品数量', dataIndex: 'goodQty', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  137. { title: '返库数量', dataIndex: 'backStockQty', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  138. { title: '退货原因', dataIndex: 'returnReasonDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  139. { title: '参考退货单价', dataIndex: 'initialPrice', align: 'center', width: '7%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  140. { title: '参考退货金额', dataIndex: 'initialAmount', align: 'center', width: '7%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  141. { title: '实际退货单价', dataIndex: 'price', align: 'center', width: '7%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  142. { title: '实际退货金额', dataIndex: 'totalAmount', align: 'center', width: '7%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  143. { title: '实际退货单价说明', dataIndex: 'priceRemark', width: '8%', align: 'center', customRender: function (text) { return text || '--' } }
  144. ]
  145. return arr
  146. }
  147. },
  148. methods: {
  149. // 返回
  150. handleBack () {
  151. this.$router.push({ name: 'salesReturnList', query: { closeLastOldTab: true } })
  152. },
  153. // 详情
  154. getDetail () {
  155. salesReturnDetail({ sn: this.$route.params.sn }).then(res => {
  156. if (res.status == 200) {
  157. this.detailData = res.data
  158. } else {
  159. this.detailData = null
  160. }
  161. })
  162. },
  163. // 打印预览/快捷打印
  164. handlePrint (type) {
  165. const _this = this
  166. const params = { sn: this.$route.params.sn }
  167. _this.spinning = true
  168. // 导出
  169. if (type == 'export') {
  170. exportExcel(salesReturnExport, params, '销售退货', function () {
  171. _this.spinning = false
  172. })
  173. } else {
  174. // 打印或预览
  175. printFun(salesReturnPrint, params, type, '销售退货', () => { _this.spinning = false })
  176. }
  177. }
  178. },
  179. mounted () {
  180. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  181. this.$refs.table.refresh(true)
  182. this.getDetail()
  183. }
  184. },
  185. activated () {
  186. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  187. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  188. this.$refs.table.refresh(true)
  189. this.getDetail()
  190. }
  191. },
  192. beforeRouteEnter (to, from, next) {
  193. next(vm => {})
  194. }
  195. }
  196. </script>
  197. <style lang="less">
  198. .salesReturnDetail-wrap {
  199. .salesReturnDetail-cont {
  200. margin-bottom: 10px;
  201. }
  202. .footer-cont{
  203. margin-top: 5px;
  204. text-align: center;
  205. }
  206. }
  207. </style>