address-api.js
2.95 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
/**
* address api
* @author: yyq<yanqing.yang@yoho.cn>
* @date: 2016/09/27
*/
'use strict';
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
/**
* 获取用户收货地址列表
* @param uid [number] uid
*/
getAddressListAsync(uid) {
let options = {
method: 'app.address.gethidden',
uid: uid
};
return this.get({data: options, param: {
code: 200
}});
}
/**
* 省市区列表
* @param id [number] 省市区id
*/
getAreaListAsync(id) {
let options = {
method: 'app.address.provinces',
id: id || 0
};
return this.get({data: options});
}
/**
* 地址删除
* @param uid [number] uid
* @param id [string] address id
*/
delAddressAsync(uid, id) {
let options = {
method: 'app.address.del',
uid: uid,
id: id
};
return this.get({data: options});
}
/**
* 新增地址api
* @param uid [Number]
* @param consignee [String] 收货人
* @param areaCode [Number] 区号
* @param address [String] 地址
* @param mobile [String] 手机号
* @param phone [String] 电话号码
* @param zipCode [String] 邮编
* @param email [String] 邮箱
*/
addAddressAsync(uid, consignee, areaCode, address, mobile, phone, zipCode, email) {
let options = {
method: 'app.address.add',
uid: uid,
consignee: consignee,
area_code: areaCode,
address: address,
mobile: mobile,
phone: phone,
zip_code: zipCode,
email: email
};
return this.get({data: options});
}
/**
* 更新地址地址api
* @param uid [Number]
* @param id [Number] 地址id
* @param consignee [String] 收货人
* @param areaCode [Number] 区号
* @param address [String] 地址
* @param mobile [String] 手机号
* @param phone [String] 电话号码
* @param zipCode [String] 邮编
* @param email [String] 邮箱
*/
updateAddressAsync(uid, id, consignee, areaCode, address, mobile, phone, zipCode, email) {
let options = {
method: 'app.address.update',
uid: uid,
id: id,
consignee: consignee,
area_code: areaCode,
address: address,
mobile: mobile,
phone: phone,
zip_code: zipCode,
email: email
};
return this.get({data: options});
}
/**
* 设置默认地址
* @param uid [Number]
* @param id [Number] 地址id
*/
setDefaultAddressAsync(uid, id) {
let options = {
method: 'app.address.setdefault',
uid: uid,
id: id
};
return this.get({data: options});
}
};