replenishmentDetail.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <div v-if="showPage" class="replenishmentDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 基础信息 -->
  5. <a-collapse :activeKey="['1']" v-if="detailData">
  6. <a-collapse-panel key="1" header="基础信息">
  7. <a-descriptions size="small" :column="3">
  8. <a-descriptions-item label="关联客户">
  9. {{ detailData&&detailData.shelfInfo.storeName || '--' }}
  10. </a-descriptions-item>
  11. <a-descriptions-item label="货架名称" :span="2">
  12. {{ detailData&&detailData.shelfInfo.shelfName || '--' }}
  13. </a-descriptions-item>
  14. <a-descriptions-item label="补货单号">{{ detailData && detailData.replenishBillNo || '--' }}</a-descriptions-item>
  15. <a-descriptions-item label="创建时间">{{ detailData && detailData.createDate || '--' }}</a-descriptions-item>
  16. <a-descriptions-item label="补货单状态">{{ detailData&&detailData.billStateDictValue || '--' }}</a-descriptions-item>
  17. </a-descriptions>
  18. </a-collapse-panel>
  19. </a-collapse>
  20. <div class="pages-wrap">
  21. <!-- alert -->
  22. <a-alert type="info" style="margin: 10px 0;">
  23. <div slot="message">
  24. 总款数:<strong>{{ detailData&&(detailData.totalCategory || detailData.totalCategory==0) ? detailData.totalCategory : '--' }}</strong>;
  25. 总数量:<strong>{{ detailData&&(detailData.totalQty || detailData.totalQty==0) ? detailData.totalQty : '--' }}</strong>;
  26. 总成本:<strong>{{ detailData&&(detailData.totalCost || detailData.totalCost==0) ? detailData.totalCost : '--' }}</strong>;
  27. </div>
  28. </a-alert>
  29. <!-- 列表 -->
  30. <s-table
  31. class="sTable"
  32. ref="table"
  33. size="small"
  34. :rowKey="(record) => record.id"
  35. :columns="columns"
  36. :data="loadData"
  37. :scroll="{ y: 400 }"
  38. :showPagination="false"
  39. bordered>
  40. </s-table>
  41. </div>
  42. </a-spin>
  43. </div>
  44. </template>
  45. <script>
  46. import { commonMixin } from '@/utils/mixin'
  47. import { getOperationalPrecision } from '@/libs/tools.js'
  48. import { STable, VSelect } from '@/components'
  49. import { shelfReplenishDetailList, shelfReplenishDetail } from '@/api/shelfReplenish'
  50. export default {
  51. name: 'SalesDetail',
  52. components: { STable, VSelect },
  53. mixins: [commonMixin],
  54. props: {
  55. outBizSn: { // 有值则为弹框,无值则为页面
  56. type: [Number, String],
  57. default: ''
  58. }
  59. },
  60. data () {
  61. return {
  62. showPage: false,
  63. spinning: false,
  64. disabled: false,
  65. // 表头
  66. columns: [
  67. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  68. { title: '产品编码', dataIndex: 'product.code', width: '22%', align: 'center', customRender: function (text) { return text || '--' } },
  69. { title: '产品名称', dataIndex: 'product.name', width: '28%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  70. { title: '补货实发数量', dataIndex: 'confirmQty', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  71. { title: '单位', dataIndex: 'product.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  72. // { title: '成本价', dataIndex: 'product.unit', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  73. // { title: '成本小计', dataIndex: 'product.unit', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  74. { title: '是否急件', dataIndex: 'oosFlag', width: '15%', align: 'center', customRender: function (text) { return text == 1 ? '是' : '否' } }
  75. ],
  76. // 加载数据方法 必须为 Promise 对象
  77. loadData: parameter => {
  78. this.disabled = true
  79. this.spinning = true
  80. return shelfReplenishDetailList({ replenishBillSn: this.nowData && this.nowData.replenishBillSn }).then(res => {
  81. let data
  82. if (res.status == 200) {
  83. data = res.data
  84. for (var i = 0; i < data.length; i++) {
  85. data[i].no = i + 1
  86. data[i].putQty = data[i].confirmQty
  87. }
  88. this.disabled = false
  89. this.listData = data || []
  90. }
  91. this.spinning = false
  92. return data
  93. })
  94. },
  95. localDataSource: [],
  96. detailData: null // 详情数据
  97. }
  98. },
  99. methods: {
  100. // 基本信息
  101. getDetail () {
  102. shelfReplenishDetail({ sn: this.outBizSn || this.$route.params.sn }).then(res => {
  103. if (res.status == 200) {
  104. this.detailData = res.data
  105. } else {
  106. this.detailData = null
  107. }
  108. })
  109. },
  110. pageInit () {
  111. const vm = this
  112. vm.$nextTick(() => {
  113. vm.spinning = false
  114. vm.disabled = false
  115. vm.getDetail()
  116. })
  117. }
  118. },
  119. mounted () {
  120. this.showPage = true
  121. if (!this.$store.state.app.isNewTab || this.outBizSn) { // 页签刷新 或 为弹框时调用
  122. this.pageInit()
  123. }
  124. },
  125. activated () {
  126. this.showPage = true
  127. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  128. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  129. this.pageInit()
  130. }
  131. },
  132. beforeRouteEnter (to, from, next) {
  133. next(vm => {})
  134. }
  135. }
  136. </script>