refund.js
2.39 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
/**
* 退换货 Model
* @type {Object}
*/
const api = global.yoho.API;
const refund = {
getOrderData(uid, orderId) {
return api.get('', {
method: 'app.refund.goodsList',
uid: uid,
order_code: orderId
}, {
cache: true,
code: 200
}).then(global.yoho.camelCase);
},
submitRefundData(uid, params) {
console.log(Object.assign({
method: 'app.refund.submit',
uid: uid,
}, params));
return api.post('', Object.assign({
method: 'app.refund.submit',
uid: uid,
}, params)).then(global.yoho.camelCase);
},
getExpressCompany() {
return api.get('', {
method: 'app.express.getExpressCompany'
}, {
code: 200
});
},
setexpress(applyid, uid, data) {
const method = data.type === 'refund' ? 'app.refund.setexpress' : 'app.change.setexpress';
return api.get('', {
method: method,
id: applyid,
uid: uid,
express_company: data.expressCompany,
express_number: data.expressNumber,
express_id: data.expressId
});
},
getChangeDetail(id, uid) {
return api.get('', {
method: 'app.change.detail',
id: id,
uid: uid,
}, {
code: 200
}).then(global.yoho.camelCase);
},
getRefundDetail(id, uid) {
return api.get('', {
method: 'app.refund.detail',
id: id,
uid: uid,
}, {
code: 200
}).then(global.yoho.camelCase);
},
/**
* 获取退换货列表
* @param param
* method
* uid
* page
* limit
* app_type
* @returns {Promise.<T>|*}
*/
getRefundOrders(param) {
param = Object.assign({
method: 'app.refund.getList'
}, param);
return api.get('', param, {
code: 200
}).then(global.yoho.camelCase);
},
/**
* 取消退货申请
*
* @param uid 用户id
* @param id 退货id
*/
cancelRefundApply(uid, id) {
return api.post('', {
uid: uid,
id: id,
method: 'app.refund.cancel'
}).then(global.yoho.camelCase);
}
};
module.exports = refund;