detailModal.vue 6.6 KB

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