陶杰
2024-08-22 973662aeae3e7c788c14671d17c5962395141770
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<template>
  <div class="base-page-wrapper order-detail">
    <el-bus-title title="订单信息" size="small"></el-bus-title>
    <el-bus-form
      ref="form"
      label-width="auto"
      :content="formContent"
      readonly
    ></el-bus-form>
    <el-bus-title title="商品信息" size="small"></el-bus-title>
    <el-table :data="goodsList">
      <el-table-column label="商品名称" prop="flowerName"></el-table-column>
      <el-table-column label="商品分类" prop="flowerCategory"></el-table-column>
      <el-table-column label="级别" prop="flowerLevelStr"></el-table-column>
      <el-table-column label="颜色" prop="flowerColor"></el-table-column>
      <el-table-column label="规格" prop="flowerUnit"></el-table-column>
      <el-table-column label="数量" prop="num"></el-table-column>
      <el-table-column label="单价" prop="price"></el-table-column>
      <el-table-column label="供应商" prop="supplierName"></el-table-column>
    </el-table>
    <template v-if="afterSaleList && afterSaleList.length > 0">
      <el-bus-title title="售后信息" size="small" class="mt-20"></el-bus-title>
      <el-table :data="afterSaleList">
        <el-table-column label="原因" prop="reason"></el-table-column>
        <el-table-column label="售后时间" prop="createTime"></el-table-column>
        <el-table-column label="处理时间" prop="auditTime"></el-table-column>
        <el-table-column label="处理状态" prop="statusStr"></el-table-column>
        <el-table-column
          label="处理结果"
          prop="auditStatusStr"
        ></el-table-column>
        <el-table-column label="操作">
          <template #default="{ row }">
            <el-button type="text" @click="toDetail(row.id)"
              >查看详情</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </template>
    <div class="text-center mt-20">
      <el-button class="min-w-100" @click="goBack">返回</el-button>
    </div>
  </div>
</template>
 
<script>
export default {
  data() {
    return {
      formContent: [
        {
          type: 'row',
          items: [
            { label: '订单号:', id: 'orderNo', type: 'input' },
            { label: '用户账号:', id: 'createName', type: 'input' },
            { label: '收货人:', id: 'customer', type: 'input' },
            { label: '收货人电话:', id: 'customerTel', type: 'input' },
            { label: '收货地址:', id: 'customerWholeAddress', type: 'input' },
            { label: '下单时间:', id: 'createTime', type: 'input' },
            { label: '支付时间:', id: 'paymentTime', type: 'input' },
            { label: '商品金额:', id: 'flowerAmount', type: 'input' },
            { label: '打包费:', id: 'packingFee', type: 'input' },
            { label: '运费:', id: 'transportFee', type: 'input' },
            { label: '订单金额:', id: 'totalAmount', type: 'input' },
            { label: '订单状态:', id: 'statusBackendStr', type: 'input' },
            { label: '库区:', id: 'warehouseName', type: 'input' },
            { label: '库位:', id: 'warehouseLocationCode', type: 'input' },
          ],
        },
      ],
      goodsList: [],
      afterSaleList: [],
    }
  },
  head() {
    return {
      title: '订单详情',
    }
  },
  mounted() {
    this.getDetail()
    this.getGoodsList()
    this.getAfterSaleList()
  },
  methods: {
    goBack() {
      this.$router.back()
    },
    async getDetail() {
      const { code, data } = await this.$elBusHttp.request(
        'flower/api/partner/order/list/view',
        { params: { id: this.$route.params.id } }
      )
      if (code === 0) {
        data.customerWholeAddress = `${data.customerProvince || ''}${
          data.customerCity || ''
        }${data.customerRegion || ''}${data.customerAddress || ''}`
        this.$refs.form.updateForm(data)
      }
    },
    async getGoodsList() {
      const { code, data } = await this.$elBusHttp.request(
        'flower/api/partner/order/item/list',
        { params: { id: this.$route.params.id } }
      )
      if (code === 0) {
        this.goodsList = data || []
      }
    },
    async getAfterSaleList() {
      const { code, data } = await this.$elBusHttp.request(
        'flower/api/partner/sales/list',
        { params: { orderId: this.$route.params.id, current: 1, size: 2000 } }
      )
      if (code === 0) {
        this.afterSaleList = data.records || []
      }
    },
    toDetail(id) {
      this.$router.push(`/order/after-sale/view/${id}`)
    },
  },
}
</script>
 
<style lang="scss" scoped>
.order-detail {
  .el-bus-title {
    margin-bottom: 10px;
  }
}
</style>