gaoluyang
2026-06-24 712aa51536236d43e87273e4ce45ac5691dffad8
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
import type { DescriptionItemSchema } from '#/components/description';
 
import { h } from 'vue';
 
import { DICT_TYPE } from '..\..\..\..\..\packages\constants\src';
import { fenToYuan, formatDate } from '..\..\..\..\..\packages\utils\src';
 
import { Image } from 'ant-design-vue';
 
import { DictTag } from '#/components/dict-tag';
 
/** 订单信息 schema */
export function useOrderInfoSchema(): DescriptionItemSchema[] {
  return [
    {
      field: 'orderNo',
      label: '订单号',
    },
    {
      field: 'order.deliveryType',
      label: '配送方式',
      render: (val) =>
        h(DictTag, {
          type: DICT_TYPE.TRADE_DELIVERY_TYPE,
          value: val,
        }),
    },
    {
      field: 'order.type',
      label: '订单类型',
      render: (val) =>
        h(DictTag, {
          type: DICT_TYPE.TRADE_ORDER_TYPE,
          value: val,
        }),
    },
    {
      field: 'order.receiverName',
      label: '收货人',
    },
    {
      field: 'order.userRemark',
      label: '买家留言',
    },
    {
      field: 'order.terminal',
      label: '订单来源',
      render: (val) =>
        h(DictTag, {
          type: DICT_TYPE.TERMINAL,
          value: val,
        }),
    },
    {
      field: 'order.receiverMobile',
      label: '联系电话',
    },
    {
      field: 'order.remark',
      label: '商家备注',
    },
    {
      field: 'order.payOrderId',
      label: '支付单号',
    },
    {
      field: 'order.payChannelCode',
      label: '付款方式',
      render: (val) =>
        h(DictTag, {
          type: DICT_TYPE.PAY_CHANNEL_CODE,
          value: val,
        }),
    },
    {
      field: 'user.nickname',
      label: '买家',
    },
  ];
}
 
/** 售后信息 schema */
export function useAfterSaleInfoSchema(): DescriptionItemSchema[] {
  return [
    {
      field: 'no',
      label: '退款编号',
    },
    {
      field: 'auditTime',
      label: '申请时间',
      render: (val) => formatDate(val) as string,
    },
    {
      field: 'type',
      label: '售后类型',
      render: (val) =>
        h(DictTag, {
          type: DICT_TYPE.TRADE_AFTER_SALE_TYPE,
          value: val,
        }),
    },
    {
      field: 'way',
      label: '售后方式',
      render: (val) =>
        h(DictTag, {
          type: DICT_TYPE.TRADE_AFTER_SALE_WAY,
          value: val,
        }),
    },
    {
      field: 'refundPrice',
      label: '退款金额',
      render: (val) => fenToYuan(val ?? 0),
    },
    {
      field: 'applyReason',
      label: '退款原因',
    },
    {
      field: 'applyDescription',
      label: '补充描述',
    },
    {
      field: 'applyPicUrls',
      label: '凭证图片',
      render: (val) => {
        const images = val || [];
        return h(
          'div',
          { class: 'flex gap-10px' },
          images.map((url: string, index: number) =>
            h(Image, {
              key: index,
              src: url,
              width: 60,
              height: 60,
            }),
          ),
        );
      },
    },
  ];
}
 
/** 退款状态 schema */
export function useRefundStatusSchema(): DescriptionItemSchema[] {
  return [
    {
      field: 'status',
      label: '退款状态',
      render: (val) =>
        h(DictTag, {
          type: DICT_TYPE.TRADE_AFTER_SALE_STATUS,
          value: val,
        }),
    },
    {
      field: 'reminder',
      label: '提醒',
      render: () =>
        h('div', { class: 'text-red-500 mb-10px' }, [
          h('div', '如果未发货,请点击同意退款给买家。'),
          h('div', '如果实际已发货,请主动与买家联系。'),
          h('div', '如果订单整体退款后,优惠券和余额会退还给买家.'),
        ]),
    },
  ];
}
 
/** 商品信息 columns */
export function useProductColumns() {
  return [
    {
      field: 'spuName',
      title: '商品信息',
      minWidth: 300,
      slots: { default: 'spuName' },
    },
    {
      field: 'price',
      title: '商品原价',
      minWidth: 150,
      formatter: 'formatFenToYuanAmount',
    },
    {
      field: 'count',
      title: '数量',
      minWidth: 100,
    },
    {
      field: 'payPrice',
      title: '合计',
      minWidth: 150,
      formatter: 'formatFenToYuanAmount',
    },
  ];
}
 
/** 操作日志 columns */
export function useOperateLogSchema() {
  return [
    {
      field: 'createTime',
      title: '操作时间',
      width: 180,
      formatter: 'formatDateTime',
    },
    {
      field: 'userType',
      title: '操作人',
      width: 100,
      slots: { default: 'userType' },
    },
    {
      field: 'content',
      title: '操作内容',
    },
  ];
}