order-constants.js
3.5 KB
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
// 订单来源, 接口对应查询参数: tabType
export const ownType = {
BUY: 'buy', // 买家
SELL: 'sell', // 卖家
};
// 卖家订单状态, 接口对应查询参数: type
export const sellerOrderStatus = {
IN_SALE: 1, // 出售中
TO_BE_DELIVERED: 2, // 待发货
SHIPPED: 3, // 已发货
DONE: 5, // 交易完成
FAILED: 6, // 交易失败
};
// 买家订单状态,接口对应查询参数: type
export const buyerOrderStatus = {
ALL: 1, // 全部
UNPAID: 2, // 未付款
TO_BE_DELIVERED: 3, // 待发货
PENDING_RECEIPT: 4, // 待收货
DONE: 5, // 交易成功
FAILED: 6, // 交易失败
};
// 卖家订单状态, 接口对应查询参数: type
export const sellerOrderStatusList = [
{
value: 2,
text: '待发货',
},
{
value: 3,
text: '已发货',
},
{
value: 5,
text: '交易成功',
},
{
value: 6,
text: '交易失败',
},
];
// 买家订单状态,接口对应查询参数: type
export const buyerOrderStatusList = [
{
value: 1,
text: '全部',
},
{
value: 7,
text: '求购',
},
{
value: 2,
text: '待付款',
},
{
value: 3,
text: '待发货',
},
{
value: 4,
text: '待收货',
},
];
/**
* helper: 生成状态key
* @param type ownType buy|sell
* @param status sellerOrderStatus|buyerOrderStatus
* @returns {string}
*/
export function orderStatusKey(type, status) {
return `${type}-${status}`;
}
/**
* 根据owner计算status状态,如果status未设置,取对应订单类型的第一个状态
* @param owner
* @param status
* @returns {number}
*/
export function getOrderStatus(owner, status) {
status = parseInt(status, 10);
if (isNaN(status)) {
status = (owner === 'buy' ? buyerOrderStatusList : sellerOrderStatusList)[0].value;
}
return status;
}
// 订单操作
// ts IOrderAction[]
export const orderActionsMap = {
DEL_ORDER: {
code: 'del_order',
name: 'DEL_ORDER',
text: '删除',
},
BUY_AGAIN: { code: 'buy_again', name: 'BUY_AGAIN', text: '再次购买' },
SHOW_DETAIL: {
code: 'show_detail',
name: 'SHOW_DETAIL',
text: '查看详情',
},
SHOW_EXPRESS: {
code: 'show_express',
name: 'SHOW_EXPRESS',
text: '查看物流',
},
SOLD_AGAIN: {
code: 'sold_again',
name: 'SOLD_AGAIN',
text: '再次出售',
},
NOT_SOLD: {
code: 'not_sold',
confirmTips: '您确定不卖此商品吗?',
name: 'NOT_SOLD',
text: '不卖了',
},
PAY_EARNESTMONEY: {
code: 'pay_earnestMoney',
name: 'PAY_EARNESTMONEY',
text: '支付保证金',
},
CANCEL_ORDER: {
code: 'cancel_order',
name: 'CANCEL_ORDER',
text: '取消订单',
},
NOT_ENTRY_CHANGE_PRICE: {
code: 'not_entry_change_price',
name: 'NOT_ENTRY_CHANGE_PRICE',
text: '调价',
},
STORAGE_MANAGE: {
code: 'storage_manage',
name: 'STORAGE_MANAGE',
text: '管理库存',
},
// Todo
NOW_BUY: {
code: 'now_buy',
name: 'NOW_BUY',
text: '立即支付',
},
CONFIRM_DELIVERY: {
code: 'confirm_delivery',
name: 'CONFIRM_DELIVERY',
text: '确认收货',
},
PAY_DEPOSIT: { code: 'pay_deposit', name: 'PAY_DEPOSIT', text: '支付定金' },
DELIVER_GOODS: {
code: 'deliver_goods',
name: 'DELIVER_GOODS',
text: '我要发货',
},
MODIFY_ADDRESS: {
code: 'modify_address',
name: 'MODIFY_ADDRESS',
text: '修改地址',
},
CHANGE_BID_PRICE: {
code: 'change_bid_price',
name: 'CHANGE_BID_PRICE',
text: '调价',
},
};