...
|
...
|
@@ -9,7 +9,6 @@ |
|
|
const api = global.yoho.API;
|
|
|
const _ = require('lodash');
|
|
|
const camelCase = global.yoho.camelCase;
|
|
|
const crypto = global.yoho.crypto;
|
|
|
|
|
|
module.exports = class extends global.yoho.BaseModel {
|
|
|
constructor(ctx) {
|
...
|
...
|
@@ -55,7 +54,7 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
return this.get({
|
|
|
data: {
|
|
|
method: params.id ? 'app.address.update' : 'app.address.add',
|
|
|
id: params.id ? _.parseInt(params.id) : null,
|
|
|
id: params.id,
|
|
|
address: params.address,
|
|
|
area_code: params.area_code,
|
|
|
consignee: params.consignee,
|
...
|
...
|
@@ -76,8 +75,8 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.address.setdefault',
|
|
|
uid: params.id,
|
|
|
id: _.parseInt(params.id)
|
|
|
uid: params.uid,
|
|
|
id: params.id
|
|
|
}
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -91,7 +90,7 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.address.del',
|
|
|
id: _.parseInt(params.id),
|
|
|
id: params.id,
|
|
|
uid: params.uid
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -116,10 +115,7 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
if (selfAddress.data) {
|
|
|
|
|
|
/* 加密地址 ID */
|
|
|
_.forEach(selfAddress.data, (value, key) => {
|
|
|
selfAddress.data[key].address_id =
|
|
|
encodeURIComponent(crypto.encryption(null, selfAddress.data[key].address_id));
|
|
|
|
|
|
_.forEach(selfAddress.data, (value) => {
|
|
|
if (value.area.length > 11) {
|
|
|
value.showArea = value.area.substr(0, 5) + '...' + value.area.substr(-5);
|
|
|
} else {
|
...
|
...
|
@@ -160,10 +156,6 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
* @param params
|
|
|
*/
|
|
|
saveAddress(params) {
|
|
|
if (params.id) {
|
|
|
params.id = _.parseInt(crypto.decrypt(null, decodeURIComponent(params.id)));
|
|
|
}
|
|
|
|
|
|
return this._saveAddressData(params).then(result => {
|
|
|
return result;
|
|
|
});
|
...
|
...
|
@@ -174,9 +166,6 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
* @param params
|
|
|
*/
|
|
|
setDefaultAddress(params) {
|
|
|
if (params.id) {
|
|
|
params.id = _.parseInt(crypto.encryption(null, params.id));
|
|
|
}
|
|
|
return this._setDefaultAddress(params).then(result => {
|
|
|
return result;
|
|
|
});
|
...
|
...
|
@@ -187,9 +176,6 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
* @param params
|
|
|
*/
|
|
|
delAddress(params) {
|
|
|
if (params.id) {
|
|
|
params.id = _.parseInt(crypto.decrypt(null, params.id));
|
|
|
}
|
|
|
return this._delAddressData(params).then(result => {
|
|
|
return result;
|
|
|
});
|
...
|
...
|
@@ -234,7 +220,7 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
method: 'app.SpaceOrders.updateDeliveryAddress',
|
|
|
uid: uid,
|
|
|
order_code: orderCode,
|
|
|
address_id: _.parseInt(crypto.decrypt(null, addressId))
|
|
|
address_id: addressId
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
return result;
|
...
|
...
|
|