detailModal.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <a-modal
  3. centered
  4. class="confirmationDetail-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. title="详情"
  8. v-model="isShow"
  9. @cancle="isShow=false"
  10. :width="960">
  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.totalQty || '--' }}</a-descriptions-item>
  25. <a-descriptions-item label="坏件数量">{{ detailData&&detailData.totalBadQty || '--' }}</a-descriptions-item>
  26. <a-descriptions-item label="返库数量">{{ detailData&&detailData.totalBackStockQty || '--' }}</a-descriptions-item>
  27. <a-descriptions-item label="退货金额">{{ detailData&&detailData.totalAmount || '--' }}</a-descriptions-item>
  28. </a-descriptions>
  29. </a-collapse-panel>
  30. </a-collapse>
  31. </a-card>
  32. <a-card size="small" :bordered="false" class="outboundOrderDetail-cont">
  33. <s-table
  34. class="sTable"
  35. ref="table"
  36. size="small"
  37. :rowKey="(record) => record.id"
  38. :columns="columns"
  39. :data="loadData"
  40. :scroll="{ x: 1680 }"
  41. :defaultLoadData="false"
  42. bordered>
  43. </s-table>
  44. </a-card>
  45. <div class="btn-cont"><a-button id="confirmationDetail-modal-back" @click="isShow = false">返回列表</a-button></div>
  46. </div>
  47. </a-modal>
  48. </template>
  49. <script>
  50. import { STable } from '@/components'
  51. import { salesReturnFinancialDetailList, salesReturnDetail } from '@/api/salesReturn'
  52. export default {
  53. name: 'ConfirmationDetailModal',
  54. components: { STable },
  55. props: {
  56. openModal: { // 弹框显示状态
  57. type: Boolean,
  58. default: false
  59. },
  60. itemSn: {
  61. type: [Number, String],
  62. default: ''
  63. }
  64. },
  65. data () {
  66. return {
  67. isShow: this.openModal, // 是否打开弹框
  68. detailsData: null, // 详情数据
  69. columns: [
  70. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  71. { title: '采购单号', dataIndex: 'purchaseBillNo', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  72. { title: '产品编码', dataIndex: 'productEntity.code', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  73. { title: '产品名称', dataIndex: 'productEntity.name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  74. { title: '售价', dataIndex: 'price', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  75. { title: '退货数量', dataIndex: 'qty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  76. { title: '坏件数量', dataIndex: 'badQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  77. { title: '返库数量', dataIndex: 'backStockQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  78. { title: '单位', dataIndex: 'productEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  79. { title: '退货金额小计', dataIndex: 'totalAmount', width: 140, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  80. { title: '退货原因', dataIndex: 'remark', width: 200, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
  81. ],
  82. // 加载数据方法 必须为 Promise 对象
  83. loadData: parameter => {
  84. return salesReturnFinancialDetailList(Object.assign(parameter, { salesReturnBillSn: this.itemSn })).then(res => {
  85. const data = res.data
  86. const no = (data.pageNo - 1) * data.pageSize
  87. for (var i = 0; i < data.list.length; i++) {
  88. data.list[i].no = no + i + 1
  89. }
  90. this.disabled = false
  91. return data
  92. })
  93. },
  94. detailData: null // 详情数据
  95. }
  96. },
  97. methods: {
  98. getDetail () {
  99. salesReturnDetail({ sn: this.itemSn }).then(res => {
  100. if (res.status == 200) {
  101. this.detailData = res.data
  102. } else {
  103. this.detailData = null
  104. }
  105. })
  106. }
  107. },
  108. watch: {
  109. // 父页面传过来的弹框状态
  110. openModal (newValue, oldValue) {
  111. this.isShow = newValue
  112. },
  113. // 重定义的弹框状态
  114. isShow (newValue, oldValue) {
  115. if (!newValue) {
  116. this.$emit('close')
  117. }
  118. },
  119. itemSn (newValue, oldValue) {
  120. if (this.isShow && newValue) {
  121. const _this = this
  122. _this.getDetail()
  123. setTimeout(() => {
  124. _this.$refs.table.refresh(true)
  125. }, 200)
  126. }
  127. }
  128. }
  129. }
  130. </script>
  131. <style lang="less">
  132. .confirmationDetail-modal{
  133. .ant-modal-body {
  134. padding: 10px 10px 20px;
  135. }
  136. .btn-cont {
  137. text-align: center;
  138. margin: 5px 0 10px;
  139. }
  140. }
  141. </style>