detail.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <div class="purchaseReturnDetail-wrap">
  3. <a-page-header :ghost="false" :backIcon="false" class="purchaseReturnDetail-cont" >
  4. <!-- 自定义的二级文字标题 -->
  5. <template slot="subTitle">
  6. <a id="purchaseReturnDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  7. <a-button
  8. v-if="isEdit"
  9. type="primary"
  10. size="small"
  11. style="background-color: #1890ff;margin-left: 20px;border: #1890ff;"
  12. id="purchaseReturnDetail-edit-btn"
  13. @click.stop="handleEdit">编辑</a-button>
  14. </template>
  15. <!-- 操作区,位于 title 行的行尾 -->
  16. <template slot="extra">
  17. <a-button key="2" id="purchaseReturnDetail-preview-btn">打印预览</a-button>
  18. <a-button key="1" type="primary" id="purchaseReturnDetail-print-btn">快速打印</a-button>
  19. </template>
  20. </a-page-header>
  21. <!-- 基础信息 -->
  22. <a-card size="small" :bordered="false" class="purchaseReturnDetail-cont">
  23. <a-collapse :activeKey="['1']">
  24. <a-collapse-panel key="1" header="基础信息">
  25. <a-descriptions :column="3" v-if="basicInfoData">
  26. <a-descriptions-item label="客户名称">{{ basicInfoData.supplierName || '--' }}</a-descriptions-item>
  27. <a-descriptions-item label="采退单号">{{ basicInfoData.purchaseReturnNo || '--' }}</a-descriptions-item>
  28. <a-descriptions-item label="创建时间">{{ basicInfoData.createDate || '--' }}</a-descriptions-item>
  29. <a-descriptions-item label="退货数量">{{ basicInfoData.totalQty || basicInfoData.totalQty==0 ? basicInfoData.totalQty : '--' }}</a-descriptions-item>
  30. <a-descriptions-item label="坏件数量">{{ basicInfoData.totalBadQty || basicInfoData.totalBadQty == 0 ? basicInfoData.totalBadQty : '--' }}</a-descriptions-item>
  31. <a-descriptions-item label="返库数量">{{ basicInfoData.totalBackStockQty || basicInfoData.totalBackStockQty == 0 ? basicInfoData.totalBackStockQty : '--' }}</a-descriptions-item>
  32. <a-descriptions-item label="退货金额">{{ basicInfoData.totalAmount || basicInfoData.totalAmount == 0 ? basicInfoData.totalAmount : '--' }}</a-descriptions-item>
  33. </a-descriptions>
  34. </a-collapse-panel>
  35. </a-collapse>
  36. </a-card>
  37. <!-- 产品详情 -->
  38. <a-card size="small" :bordered="false" class="purchaseReturnDetail-cont">
  39. <a-collapse :activeKey="['1']">
  40. <a-collapse-panel key="1" header="产品详情">
  41. <!-- 列表 -->
  42. <s-table
  43. class="sTable"
  44. ref="table"
  45. size="small"
  46. :rowKey="(record) => record.id"
  47. :columns="columns"
  48. :data="loadData"
  49. :scroll="{ x: 1490 }"
  50. bordered>
  51. </s-table>
  52. </a-collapse-panel>
  53. </a-collapse>
  54. </a-card>
  55. </div>
  56. </template>
  57. <script>
  58. import { STable, VSelect } from '@/components'
  59. import { getOperationalPrecision } from '@/libs/tools.js'
  60. import { purchaseReturnDetailSn, purchaseReturnDetailList } from '@/api/purchaseReturn'
  61. export default {
  62. components: { STable, VSelect },
  63. data () {
  64. return {
  65. // 表头
  66. columns: [
  67. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  68. { title: '采购单号', dataIndex: 'purchaseBillNo', width: 200, align: 'center' },
  69. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
  70. { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  71. { title: '售价', dataIndex: 'cost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  72. { title: '退货数量', dataIndex: 'qty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  73. { title: '坏件数量', dataIndex: 'badQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  74. { title: '返库数量', dataIndex: 'backStockQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  75. { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  76. { title: '退货金额小计', dataIndex: 'purchaseReturnAmount', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  77. { title: '退货原因', dataIndex: 'remarks', width: 200, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
  78. ],
  79. // 加载数据方法 必须为 Promise 对象
  80. loadData: parameter => {
  81. this.disabled = true
  82. return purchaseReturnDetailList(Object.assign(parameter, { purchaseReturnSn: this.$route.params.sn })).then(res => {
  83. const data = res.data
  84. const no = (data.pageNo - 1) * data.pageSize
  85. for (var i = 0; i < data.list.length; i++) {
  86. data.list[i].no = no + i + 1
  87. // 采购金额 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
  88. data.list[i].purchaseReturnAmount = getOperationalPrecision(data.list[i].cost, data.list[i].qty)
  89. }
  90. this.disabled = false
  91. return data
  92. })
  93. },
  94. basicInfoData: null // 基本信息
  95. }
  96. },
  97. computed: {
  98. isEdit () {
  99. return this.basicInfoData && this.basicInfoData.state == 'WAIT'
  100. }
  101. },
  102. methods: {
  103. // 返回列表
  104. handleBack () {
  105. this.$router.push({ path: '/purchasingManagement/purchaseReturn/list' })
  106. },
  107. // 基本信息
  108. getDetail () {
  109. purchaseReturnDetailSn({ sn: this.$route.params.sn }).then(res => {
  110. if (res.status == 200) {
  111. this.basicInfoData = res.data
  112. } else {
  113. this.basicInfoData = null
  114. }
  115. })
  116. },
  117. // 编辑
  118. handleEdit () {
  119. this.$router.push({ path: `/purchasingManagement/purchaseReturn/edit/${this.basicInfoData.id}/${this.basicInfoData.purchaseReturnSn}` })
  120. }
  121. },
  122. beforeRouteEnter (to, from, next) {
  123. next(vm => {
  124. vm.getDetail()
  125. })
  126. }
  127. }
  128. </script>
  129. <style lang="less">
  130. .purchaseReturnDetail-cont{
  131. margin-bottom: 15px;
  132. .timeline-box{
  133. margin-top: 30px;
  134. .auxiliary-txt{
  135. color: #808695;
  136. }
  137. }
  138. }
  139. </style>