detailModal.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <a-modal
  3. centered
  4. class="confirmationDetail-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. title="详情"
  8. v-model="isShow"
  9. @cancel="isShow=false"
  10. width="80%">
  11. <div>
  12. <!-- <div style="padding: 0 12px;text-align: right;">
  13. <a-button id="outboundOrderDetail-preview-btn" style="margin-right: 15px;">打印预览</a-button>
  14. <a-button type="primary" id="outboundOrderDetail-print-btn">快速打印</a-button>
  15. </div> -->
  16. <!-- 基础信息 -->
  17. <a-card size="small" :bordered="false" class="outboundOrderDetail-cont">
  18. <a-collapse :activeKey="['1']">
  19. <a-collapse-panel key="1" header="基础信息">
  20. <a-descriptions size="small" :column="3" style="margin-bottom: 10px;">
  21. <a-descriptions-item label="客户名称">{{ detailData&&detailData.buyerName || '--' }}</a-descriptions-item>
  22. <a-descriptions-item label="销退单号">{{ detailData&&detailData.salesReturnBillNo || '--' }}</a-descriptions-item>
  23. <a-descriptions-item label="创建时间">{{ detailData&&detailData.createDate || '--' }}</a-descriptions-item>
  24. <a-descriptions-item label="申请退货数量">{{ detailData&&(detailData.totalInitialQty || detailData.totalInitialQty==0) ? detailData.totalInitialQty : '--' }}</a-descriptions-item>
  25. <a-descriptions-item label="仓库实收数量">{{ detailData&&(detailData.totalReceiveQty || detailData.totalReceiveQty==0) ? detailData.totalReceiveQty : '--' }}</a-descriptions-item>
  26. <a-descriptions-item label="坏件数量">{{ detailData&&(detailData.totalBadQty || detailData.totalBadQty==0) ? detailData.totalBadQty : '--' }}</a-descriptions-item>
  27. <a-descriptions-item label="良品数量">{{ detailData&&(detailData.totalGoodQty || detailData.totalGoodQty==0) ? detailData.totalGoodQty : '--' }}</a-descriptions-item>
  28. <a-descriptions-item label="返库数量">{{ detailData&&(detailData.totalBackStockQty || detailData.totalBackStockQty==0) ? detailData.totalBackStockQty : '--' }}</a-descriptions-item>
  29. <a-descriptions-item label="实际退货金额" v-if="$hasPermissions('B_returnConfirmation_detail_salesPrice')">{{ detailData&&(detailData.totalAmount || detailData.totalAmount==0) ? toThousands(detailData.totalAmount) : '--' }}</a-descriptions-item>
  30. </a-descriptions>
  31. </a-collapse-panel>
  32. </a-collapse>
  33. </a-card>
  34. <a-card size="small" :bordered="false" class="outboundOrderDetail-cont">
  35. <s-table
  36. class="sTable"
  37. ref="table"
  38. size="small"
  39. :rowKey="(record) => record.id"
  40. :scroll="{ y: 400 }"
  41. :columns="columns"
  42. :data="loadData"
  43. :defaultLoadData="false"
  44. bordered>
  45. </s-table>
  46. </a-card>
  47. <div class="btn-cont"><a-button id="confirmationDetail-modal-back" @click="isShow = false">返回列表</a-button></div>
  48. </div>
  49. </a-modal>
  50. </template>
  51. <script>
  52. import { commonMixin } from '@/utils/mixin'
  53. import { STable } from '@/components'
  54. import { salesReturnFinancialDetailList, salesReturnDetail } from '@/api/salesReturn'
  55. export default {
  56. name: 'ConfirmationDetailModal',
  57. mixins: [commonMixin],
  58. components: { STable },
  59. props: {
  60. openModal: { // 弹框显示状态
  61. type: Boolean,
  62. default: false
  63. },
  64. itemSn: {
  65. type: [Number, String],
  66. default: ''
  67. }
  68. },
  69. data () {
  70. return {
  71. isShow: this.openModal, // 是否打开弹框
  72. detailsData: null, // 详情数据
  73. // 加载数据方法 必须为 Promise 对象
  74. loadData: parameter => {
  75. return salesReturnFinancialDetailList(Object.assign(parameter, { salesReturnBillSn: this.itemSn })).then(res => {
  76. let data
  77. if (res.status == 200) {
  78. data = res.data
  79. const no = (data.pageNo - 1) * data.pageSize
  80. for (var i = 0; i < data.list.length; i++) {
  81. data.list[i].no = no + i + 1
  82. }
  83. this.disabled = false
  84. }
  85. return data
  86. })
  87. },
  88. detailData: null // 详情数据
  89. }
  90. },
  91. computed: {
  92. columns () {
  93. const arr = [
  94. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  95. { title: '产品编码', dataIndex: 'productEntity.code', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
  96. { title: '产品名称', dataIndex: 'productEntity.name', width: '14%', align: 'left', customRender: function (text) { return text || '--' } },
  97. { title: '单位', dataIndex: 'productEntity.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  98. { title: '申请退货数量', dataIndex: 'initialQty', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  99. { title: '仓库实收数量', dataIndex: 'receiveQty', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  100. { title: '坏件数量', dataIndex: 'badQty', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  101. { title: '良品数量', dataIndex: 'goodQty', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  102. { title: '返库数量', dataIndex: 'backStockQty', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  103. { title: '退货原因', dataIndex: 'returnReason', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  104. { title: '备注', dataIndex: 'returnReason', width: '8%', align: 'center', customRender: function (text) { return text || '--' } }
  105. ]
  106. if (this.$hasPermissions('B_returnConfirmation_detail_salesPrice')) { // 售价权限
  107. arr.splice(11, 0, { title: '实际退货单价', dataIndex: 'price', align: 'right', width: '6%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  108. arr.splice(12, 0, { title: '实际退货金额', dataIndex: 'totalAmount', align: 'right', width: '6%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  109. arr.splice(13, 0, { title: '实际退货单价说明', dataIndex: 'priceRemark', width: '12%', align: 'center', customRender: function (text) { return text || '--' } })
  110. }
  111. return arr
  112. }
  113. },
  114. methods: {
  115. getDetail () {
  116. salesReturnDetail({ sn: this.itemSn }).then(res => {
  117. if (res.status == 200) {
  118. this.detailData = res.data
  119. } else {
  120. this.detailData = null
  121. }
  122. })
  123. }
  124. },
  125. watch: {
  126. // 父页面传过来的弹框状态
  127. openModal (newValue, oldValue) {
  128. this.isShow = newValue
  129. },
  130. // 重定义的弹框状态
  131. isShow (newValue, oldValue) {
  132. if (!newValue) {
  133. this.$emit('close')
  134. this.detailData = null
  135. this.$refs.table.clearTable()
  136. this.$store.state.app.curActionPermission = ''
  137. } else {
  138. this.$store.state.app.curActionPermission = 'B_returnConfirmation_detail'
  139. this.getDetail()
  140. this.$nextTick(() => {
  141. this.$refs.table.refresh(true)
  142. })
  143. }
  144. }
  145. }
  146. }
  147. </script>
  148. <style lang="less">
  149. .confirmationDetail-modal{
  150. .ant-modal-body {
  151. padding: 10px 10px 20px;
  152. }
  153. .btn-cont {
  154. text-align: center;
  155. margin: 5px 0 10px;
  156. }
  157. }
  158. </style>