detail.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <div v-if="showPage" class="shelfOrderDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="shelfOrderDetail-cont" :style="{ padding: !outBizSn ? '16px 24px' : '0px 24px' }">
  5. <template slot="subTitle" v-if="!outBizSn">
  6. <a href="javascript:;" @click="handleBack"><a-icon type="left"></a-icon> 返回列表</a>
  7. </template>
  8. </a-page-header>
  9. <!-- 基础信息 -->
  10. <a-card size="small" :bordered="false" class="shelfOrderDetail-cont">
  11. <a-collapse :activeKey="['1']">
  12. <a-collapse-panel key="1" header="基础信息">
  13. <a-descriptions size="small" :column="3">
  14. <a-descriptions-item label="订单编号">{{ detailData&&detailData.orderBillNo || '--' }}</a-descriptions-item>
  15. <a-descriptions-item label="货架名称">{{ detailData&&detailData.shelfName || '--' }}</a-descriptions-item>
  16. <a-descriptions-item label="下单时间">{{ detailData&&detailData.orderDate || '--' }}</a-descriptions-item>
  17. <a-descriptions-item label="下单人员">{{ detailData&&detailData.orderPersonName || '--' }}</a-descriptions-item>
  18. <a-descriptions-item label="订单状态"> {{ detailData&&detailData.billStateDictValue || '--' }}</a-descriptions-item>
  19. <a-descriptions-item label="VIN">{{ detailData&&detailData.vin || '--' }}</a-descriptions-item>
  20. <a-descriptions-item label="车型">{{ detailData&&detailData.vehicleModel || '--' }}</a-descriptions-item>
  21. </a-descriptions>
  22. </a-collapse-panel>
  23. </a-collapse>
  24. </a-card>
  25. <a-card size="small" :bordered="false" class="pages-wrap">
  26. <!-- alert -->
  27. <a-alert type="info" style="margin-bottom: 10px;">
  28. <div style="display: flex;align-items: center;justify-content: space-between;" slot="message">
  29. <div>
  30. 总款数:<strong>{{ countDetail&&(countDetail.productCategory || countDetail.productCategory==0) ? countDetail.productCategory : '--' }}</strong>;
  31. 总数量:<strong>{{ countDetail&&(countDetail.totalQty || countDetail.totalQty==0) ? countDetail.totalQty : '--' }}</strong>;
  32. 总结算金额:<strong>{{ countDetail&&(countDetail.settleAmount || countDetail.settleAmount==0) ? countDetail.settleAmount : '--' }}</strong>;
  33. </div>
  34. </div>
  35. </a-alert>
  36. <!-- 列表 -->
  37. <a-table
  38. class="sTable"
  39. ref="table"
  40. size="small"
  41. :rowKey="(record) => record.id"
  42. :columns="columns"
  43. :data-source="detailList"
  44. :pagination="false"
  45. bordered>
  46. </a-table>
  47. </a-card>
  48. </a-spin>
  49. </div>
  50. </template>
  51. <script>
  52. import { commonMixin } from '@/utils/mixin'
  53. import { STable, VSelect } from '@/components'
  54. import { orderBillQueryPage, orderBillDetailCount } from '@/api/shelf'
  55. export default {
  56. name: 'SalesDetail',
  57. components: { STable, VSelect },
  58. mixins: [commonMixin],
  59. props: {
  60. outBizSn: { // 有值则为弹框,无值则为页面
  61. type: [Number, String],
  62. default: ''
  63. }
  64. },
  65. data () {
  66. return {
  67. showPage: false,
  68. spinning: false,
  69. disabled: false,
  70. detailList: [],
  71. detailData: null, // 详情数据
  72. countDetail: null
  73. }
  74. },
  75. computed: {
  76. columns () {
  77. const arr = [
  78. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  79. { title: '货位号', dataIndex: 'shelfPlaceCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  80. { title: '产品编码', dataIndex: 'productCode', width: '15%', scopedSlots: { customRender: 'productCode' }, align: 'center' },
  81. { title: '产品名称', dataIndex: 'productName', width: '40%', align: 'center', customRender: function (text) { return text || '--' } },
  82. { title: '结算价', dataIndex: 'settlePrice', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  83. { title: '下单数量', dataIndex: 'totalQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  84. { title: '结算金额小计', dataIndex: 'settleAmount', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  85. ]
  86. return arr
  87. }
  88. },
  89. methods: {
  90. // 返回
  91. handleBack () {
  92. this.$router.push({ name: 'shelfOrderList' })
  93. },
  94. getDetail () {
  95. this.spinning = true
  96. orderBillQueryPage({ pageNo: 1, pageSize: 1, orderBillSn: this.outBizSn || this.$route.params.sn }).then(res => {
  97. this.spinning = false
  98. this.detailData = res.data.list && res.data.list[0]
  99. this.detailList = this.detailData.orderBillDetailApiEntityList
  100. })
  101. orderBillDetailCount({ orderBillSn: this.outBizSn || this.$route.params.sn }).then(res => {
  102. this.countDetail = res.data || null
  103. })
  104. },
  105. pageInit () {
  106. const vm = this
  107. vm.$nextTick(() => {
  108. vm.spinning = false
  109. vm.disabled = false
  110. vm.getDetail()
  111. })
  112. }
  113. },
  114. mounted () {
  115. this.showPage = true
  116. if (!this.$store.state.app.isNewTab || this.outBizSn) { // 页签刷新 或 为弹框时调用
  117. this.pageInit()
  118. }
  119. },
  120. activated () {
  121. this.showPage = true
  122. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  123. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  124. this.pageInit()
  125. }
  126. },
  127. beforeRouteEnter (to, from, next) {
  128. next(vm => {})
  129. }
  130. }
  131. </script>
  132. <style lang="less">
  133. .shelfOrderDetail-wrap{
  134. .shelfOrderDetail-cont{
  135. margin-bottom: 10px;
  136. }
  137. }
  138. </style>