- 添加获取默认地址

pull/1/head
sin 2019-04-10 22:27:03 +08:00
parent 90416d5431
commit efe80aeeec
3 changed files with 59 additions and 42 deletions

View File

@ -16,45 +16,6 @@ export function DelFavorite(id){
})
}
export function GetAddressList(){
return request({
url: '/user-api/users/address/list',
method: 'get',
})
}
export function GetAddressById(id){
return request({
url: '/user-api/users/address/address',
method: 'get',
params: { id }
})
}
export function UpdateAddress(data){
return request({
url: '/user-api/users/address/update',
method: 'PUT',
params: data
})
}
export function SaveAddress(data){
return request({
url: '/user-api/users/address/add',
method: 'POST',
params: data
})
}
export function DelAddress(data){
return request({
url: '/user-api/users/address/remove',
method: 'DELETE',
params: data
})
}
export function GetCoupon(data){
return request({
url: '/User/GetCoupon',
@ -108,3 +69,53 @@ export function doPassportMobileSendRegisterCode(mobile) {
}
});
}
// -------------------------- address
export function GetAddressList(){
return request({
url: '/user-api/users/address/list',
method: 'get',
})
}
export function GetAddressById(id){
return request({
url: '/user-api/users/address/address',
method: 'get',
params: { id }
})
}
export function GetDefaultAddress(){
return request({
url: '/user-api/users/address/default_address',
method: 'get',
})
}
export function UpdateAddress(data){
return request({
url: '/user-api/users/address/update',
method: 'PUT',
params: data
})
}
export function SaveAddress(data){
return request({
url: '/user-api/users/address/add',
method: 'POST',
params: data
})
}
export function DelAddress(data){
return request({
url: '/user-api/users/address/remove',
method: 'DELETE',
params: data
})
}

View File

@ -57,6 +57,7 @@
<script>
import {createOrder} from '../../api/order';
import {GetDefaultAddress} from '../../api/user';
import orderStore from '../../store/order'
import eventBus from '../eventBus';
@ -132,8 +133,13 @@
}
this.addressData = this.$store.state.addressData;
},
activated() {
created() {
GetDefaultAddress().then((result) => {
if (result) {
this.type = 'add1'
this.addressData = result
}
})
},
store: orderStore,
};

View File

@ -42,7 +42,7 @@
country: data.country,
mobile: data.tel,
name: data.name,
hasDefault: data.isDefault,
hasDefault: data.isDefault ? 2 : 1,
};
if (data.id) {