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
| import type { VbenFormSchema } from '#/adapter/form';
| import type { VxeGridPropTypes } from '#/adapter/vxe-table';
| import type { MallDeliveryPickUpStoreApi } from '#/api/mall/trade/delivery/pickUpStore';
|
| import { ref } from 'vue';
|
| import { DICT_TYPE } from '..\..\..\..\..\packages\constants\src';
| import { useUserStore } from '..\..\..\..\..\packages\stores\src';
|
| import { getSimpleDeliveryPickUpStoreList } from '#/api/mall/trade/delivery/pickUpStore';
| import { getRangePickerDefaultProps } from '#/utils';
|
| /** 关联数据 */
| const userStore = useUserStore();
| const pickUpStoreList = ref<MallDeliveryPickUpStoreApi.DeliveryPickUpStore[]>(
| [],
| );
| getSimpleDeliveryPickUpStoreList().then((res) => {
| pickUpStoreList.value = res;
| // 移除自己无法核销的门店
| const userId = userStore?.userInfo?.id;
| pickUpStoreList.value = pickUpStoreList.value.filter((item) =>
| item.verifyUserIds?.includes(userId),
| );
| });
|
| /** 列表的搜索表单 */
| export function useGridFormSchema(): VbenFormSchema[] {
| return [
| {
| fieldName: 'createTime',
| label: '创建时间',
| component: 'RangePicker',
| componentProps: {
| ...getRangePickerDefaultProps(),
| allowClear: true,
| },
| },
| {
| fieldName: 'pickUpStoreIds',
| label: '自提门店',
| component: 'Select',
| componentProps: {
| options: pickUpStoreList,
| labelField: 'name',
| valueField: 'id',
| placeholder: '请选择自提门店',
| },
| defaultValue: pickUpStoreList.value[0]?.id,
| },
| {
| fieldName: 'no',
| label: '订单号',
| component: 'Input',
| componentProps: {
| placeholder: '请输入订单号',
| allowClear: true,
| },
| },
| {
| fieldName: 'userId',
| label: '用户 UID',
| component: 'Input',
| componentProps: {
| placeholder: '请输入用户 UID',
| allowClear: true,
| },
| },
| {
| fieldName: 'userNickname',
| label: '用户昵称',
| component: 'Input',
| componentProps: {
| placeholder: '请输入用户昵称',
| allowClear: true,
| },
| },
| {
| fieldName: 'userMobile',
| label: '用户电话',
| component: 'Input',
| componentProps: {
| placeholder: '请输入用户电话',
| allowClear: true,
| },
| },
| ];
| }
|
| /** 表格列配置 */
| export function useGridColumns(): VxeGridPropTypes.Columns {
| return [
| {
| field: 'no',
| title: '订单号',
| fixed: 'left',
| minWidth: 180,
| },
| {
| field: 'user.nickname',
| title: '用户信息',
| minWidth: 100,
| },
| {
| field: 'brokerageUser.nickname',
| title: '推荐人信息',
| minWidth: 100,
| },
| {
| field: 'spuName',
| title: '商品信息',
| minWidth: 300,
| slots: { default: 'spuName' },
| },
| {
| field: 'payPrice',
| title: '实付金额(元)',
| formatter: 'formatAmount2',
| minWidth: 180,
| },
| {
| field: 'storeStaffName',
| title: '核销员',
| minWidth: 160,
| },
| {
| field: 'pickUpStoreId',
| title: '核销门店',
| minWidth: 160,
| formatter: ({ row }) => {
| return (
| pickUpStoreList.value.find((item) => item.id === row.pickUpStoreId)
| ?.name || ''
| );
| },
| },
| {
| field: 'payStatus',
| title: '支付状态',
| cellRender: {
| name: 'CellDict',
| props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING },
| },
| minWidth: 80,
| },
| {
| field: 'status',
| title: '订单状态',
| cellRender: {
| name: 'CellDict',
| props: { type: DICT_TYPE.TRADE_ORDER_STATUS },
| },
| minWidth: 80,
| },
| {
| field: 'createTime',
| title: '下单时间',
| formatter: 'formatDateTime',
| minWidth: 160,
| },
| ];
| }
|
|