|
@@ -117,122 +117,84 @@ const _getOrderData = (params) => { |
|
@@ -117,122 +117,84 @@ const _getOrderData = (params) => { |
117
|
* @private
|
117
|
* @private
|
118
|
*/
|
118
|
*/
|
119
|
const _getOrderStatus = (order, showLogistics) => {
|
119
|
const _getOrderStatus = (order, showLogistics) => {
|
120
|
- let result = {};
|
120
|
+ let orderBtn = [];
|
121
|
|
121
|
|
122
|
- result.useLimitCode = order.use_limit_code === 'Y';
|
|
|
123
|
- if (order.is_cancel === 'Y') {
|
|
|
124
|
- return Object.assign(result, {
|
|
|
125
|
- canceled: true
|
|
|
126
|
- });
|
122
|
+ if (!order) {
|
|
|
123
|
+ return {};
|
127
|
}
|
124
|
}
|
128
|
|
125
|
|
129
|
- // 先判断订单付款方式,根据不同的付款方式计算订单状态。(注:货到付款没有待付款状态)
|
|
|
130
|
- // 支付方式为非货到付款时,计算订单状态。
|
|
|
131
|
- if (parseInt(order.payment_type, 10) !== 2) {
|
|
|
132
|
- switch (order.status) {
|
|
|
133
|
- case -1:
|
126
|
+ if (parseInt(order.attribute, 10) === 9) {
|
|
|
127
|
+ /* 预售商品,不能进行任何操作 */
|
|
|
128
|
+ orderBtn.push({
|
|
|
129
|
+ isAdvance: true
|
|
|
130
|
+ });
|
|
|
131
|
+ return {orderBtn: orderBtn};
|
|
|
132
|
+ }
|
134
|
|
133
|
|
135
|
- /* 预售商品,不能进行任何操作 */
|
|
|
136
|
- Object.assign(result, {
|
|
|
137
|
- isAdvance: true
|
134
|
+ _.each(order.links, function(val) {
|
|
|
135
|
+ switch (val) {
|
|
|
136
|
+ case 'refundApply':// 申请退款
|
|
|
137
|
+ orderBtn.push({
|
|
|
138
|
+ refundApply: true
|
138
|
});
|
139
|
});
|
139
|
break;
|
140
|
break;
|
140
|
- case 0:
|
|
|
141
|
-
|
|
|
142
|
- /* 待付款 */
|
|
|
143
|
- Object.assign(result, {
|
|
|
144
|
- unpaid: true,
|
|
|
145
|
- payUrl: helpers.urlFormat('/home/orders/paynew', {order_code: order.order_code})
|
141
|
+ case 'modifyAddress':// 修改收货地址
|
|
|
142
|
+ orderBtn.push({
|
|
|
143
|
+ modifyAddress: true,
|
|
|
144
|
+ link: helpers.urlFormat('/home/orders/addressModify', {
|
|
|
145
|
+ orderCode: order.order_code,
|
|
|
146
|
+ areaCode: _.get(order, 'delivery_address.area_code', ''),
|
|
|
147
|
+ provinceAreaCode: order.is_support_change_province !== 'Y' &&
|
|
|
148
|
+ !_.get(order, 'delivery_address.province_area_code', false) ?
|
|
|
149
|
+ _.get(order, 'delivery_address.province_area_code', '') : ''// 如果不允许修改省
|
|
|
150
|
+ })
|
146
|
});
|
151
|
});
|
147
|
break;
|
152
|
break;
|
148
|
- case 1:
|
|
|
149
|
- case 2:
|
|
|
150
|
- case 3:
|
|
|
151
|
-
|
|
|
152
|
- /* 已付款状态不给查看物流 URL */
|
|
|
153
|
- Object.assign(result, {
|
|
|
154
|
- unreceived: true
|
153
|
+ case 'buyNow':// 立即付款
|
|
|
154
|
+ orderBtn.push({
|
|
|
155
|
+ buyNow: true,
|
|
|
156
|
+ link: helpers.urlFormat('/home/orders/paynew', {order_code: order.order_code}),
|
155
|
});
|
157
|
});
|
156
|
break;
|
158
|
break;
|
157
|
- case 4:
|
|
|
158
|
- case 5:
|
|
|
159
|
-
|
|
|
160
|
- /* 已发货状态,给查看物流或二维码URL */
|
|
|
161
|
- Object.assign(result, {
|
|
|
162
|
- unreceived: true
|
159
|
+ case 'closeOrder':// 取消订单
|
|
|
160
|
+ orderBtn.push({
|
|
|
161
|
+ closeOrder: true
|
163
|
});
|
162
|
});
|
164
|
-
|
|
|
165
|
- /* 是否门票 */
|
|
|
166
|
- if (order.virtual_type && parseInt(order.virtual_type, 10) === 3) {
|
|
|
167
|
- Object.assign(result, {
|
|
|
168
|
- qrcode: helpers.urlFormat(`/home/QRcode/${order.order_code}`)
|
|
|
169
|
- });
|
|
|
170
|
- } else {
|
|
|
171
|
- Object.assign(result, _assignExpressInfo(showLogistics, order));
|
|
|
172
|
- }
|
|
|
173
|
break;
|
163
|
break;
|
174
|
- case 6:
|
|
|
175
|
-
|
|
|
176
|
- /* 已成功订单,给查看物流或二维码URL */
|
|
|
177
|
- Object.assign(result, {
|
|
|
178
|
- completed: true
|
|
|
179
|
- });
|
|
|
180
|
-
|
|
|
181
|
- /* 是否门票 */
|
|
|
182
|
- if (order.virtual_type && parseInt(order.virtual_type, 10) === 3) {
|
|
|
183
|
- Object.assign(result, {
|
|
|
184
|
- qrcode: helpers.urlFormat(`/home/QRcode/${order.order_code}`)
|
|
|
185
|
- });
|
|
|
186
|
- } else {
|
|
|
187
|
- Object.assign(result, _assignExpressInfo(showLogistics, order));
|
|
|
188
|
- }
|
164
|
+ case 'confirm':// 订单确认
|
189
|
break;
|
165
|
break;
|
190
|
- default:
|
166
|
+ case 'getExpress':// 查看物流
|
|
|
167
|
+ orderBtn.push(Object.assign(
|
|
|
168
|
+ {getExpress: true},
|
|
|
169
|
+ _assignExpressInfo(showLogistics, order)
|
|
|
170
|
+ ));
|
191
|
break;
|
171
|
break;
|
192
|
- }
|
|
|
193
|
- } else {
|
|
|
194
|
-
|
|
|
195
|
- /* 订单为货到付款订单时,计算订单状态。(货到付款没有待付款状态) */
|
|
|
196
|
- switch (order.status) {
|
|
|
197
|
- case 0:
|
|
|
198
|
-
|
|
|
199
|
- /* 备货中 */
|
|
|
200
|
- Object.assign(result, {
|
|
|
201
|
- unpaid: true
|
|
|
202
|
- });
|
172
|
+ case 'shareOrder':// 晒单评价
|
203
|
break;
|
173
|
break;
|
204
|
- case 1:
|
|
|
205
|
- case 2:
|
|
|
206
|
- case 3:
|
|
|
207
|
-
|
|
|
208
|
- /* 已付款状态不给查看物流URL */
|
|
|
209
|
- Object.assign(result, {
|
|
|
210
|
- unreceived: true
|
174
|
+ case 'delOrder':// 删除订单
|
|
|
175
|
+ orderBtn.push({
|
|
|
176
|
+ delOrder: true,
|
211
|
});
|
177
|
});
|
212
|
break;
|
178
|
break;
|
213
|
- case 4:
|
|
|
214
|
- case 5:
|
|
|
215
|
-
|
|
|
216
|
- /* 待收货状态,给查看物流 url */
|
|
|
217
|
- Object.assign(result, {
|
|
|
218
|
- unreceived: true
|
179
|
+ case 'lookQrcode':// 查看二维码
|
|
|
180
|
+ orderBtn.push({
|
|
|
181
|
+ lookQrcode: true,
|
|
|
182
|
+ link: helpers.urlFormat(`/home/QRcode/${order.order_code}`),
|
219
|
});
|
183
|
});
|
220
|
- Object.assign(result, _assignExpressInfo(showLogistics, order));
|
|
|
221
|
break;
|
184
|
break;
|
222
|
- case 6:
|
|
|
223
|
-
|
|
|
224
|
- /* 待收货状态,给查看物流 url */
|
|
|
225
|
- Object.assign(result, {
|
|
|
226
|
- completed: true
|
185
|
+ case 'afterService':// 售后服务
|
|
|
186
|
+ break;
|
|
|
187
|
+ case 'readd':// 再次购买
|
|
|
188
|
+ orderBtn.push({
|
|
|
189
|
+ readd: true
|
227
|
});
|
190
|
});
|
228
|
- Object.assign(result, _assignExpressInfo(showLogistics, order));
|
|
|
229
|
break;
|
191
|
break;
|
230
|
default:
|
192
|
default:
|
231
|
break;
|
193
|
break;
|
232
|
}
|
194
|
}
|
233
|
- }
|
195
|
+ });
|
234
|
|
196
|
|
235
|
- return result;
|
197
|
+ return {orderBtn: orderBtn};
|
236
|
};
|
198
|
};
|
237
|
|
199
|
|
238
|
/**
|
200
|
/**
|
|
@@ -319,29 +281,6 @@ const getOrders = (params) => { |
|
@@ -319,29 +281,6 @@ const getOrders = (params) => { |
319
|
/* 是否是虚拟商品 */
|
281
|
/* 是否是虚拟商品 */
|
320
|
let isTickets = order.virtual_type && parseInt(order.virtual_type, 10) === 3;
|
282
|
let isTickets = order.virtual_type && parseInt(order.virtual_type, 10) === 3;
|
321
|
|
283
|
|
322
|
- /* 修改地址按钮控制 */
|
|
|
323
|
- let modifyAddress = {
|
|
|
324
|
- modifyAddress: false,
|
|
|
325
|
- modifyAddressUrl: ''
|
|
|
326
|
- };
|
|
|
327
|
-
|
|
|
328
|
- if (_.find(value.links, o => {
|
|
|
329
|
- return o === 'modifyAddress';
|
|
|
330
|
- })) {
|
|
|
331
|
- modifyAddress.modifyAddress = true;
|
|
|
332
|
- modifyAddress.modifyAddressUrl = helpers.urlFormat('/home/orders/addressModify', {
|
|
|
333
|
- orderCode: value.order_code,
|
|
|
334
|
- areaCode: _.get(value, 'delivery_address.area_code', '')
|
|
|
335
|
- });
|
|
|
336
|
-
|
|
|
337
|
- // 如果不允许修改省
|
|
|
338
|
- if (value.is_support_change_province !== 'Y' &&
|
|
|
339
|
- !_.get(value, 'delivery_address.province_area_code', false)) {
|
|
|
340
|
- modifyAddress.modifyAddressUrl += '&provinceAreaCode=' +
|
|
|
341
|
- _.get(value, 'delivery_address.province_area_code', '');
|
|
|
342
|
- }
|
|
|
343
|
- }
|
|
|
344
|
-
|
|
|
345
|
Object.assign(perOrder, {
|
284
|
Object.assign(perOrder, {
|
346
|
orderNum: value.order_code,
|
285
|
orderNum: value.order_code,
|
347
|
orderStatus: value.status_str,
|
286
|
orderStatus: value.status_str,
|
|
@@ -349,9 +288,7 @@ const getOrders = (params) => { |
|
@@ -349,9 +288,7 @@ const getOrders = (params) => { |
349
|
goods: _formatOrderGoods(value.order_goods, count, false, isTickets),
|
288
|
goods: _formatOrderGoods(value.order_goods, count, false, isTickets),
|
350
|
detailUrl: helpers.urlFormat('/home/orderdetail', {order_code: value.order_code}),
|
289
|
detailUrl: helpers.urlFormat('/home/orderdetail', {order_code: value.order_code}),
|
351
|
count: value.buy_total,
|
290
|
count: value.buy_total,
|
352
|
- isVirtual: isTickets,
|
|
|
353
|
- isDepositAdvance: value.attribute * 1 === 9, // 定金预售
|
|
|
354
|
- modifyAddress: modifyAddress
|
291
|
+ isVirtual: isTickets
|
355
|
});
|
292
|
});
|
356
|
|
293
|
|
357
|
/* 如果运费大于0,会显示运费 */
|
294
|
/* 如果运费大于0,会显示运费 */
|