2021-05-13 11:03:32 +08:00
|
|
|
/**
|
|
|
|
* 收货地址相关API
|
|
|
|
*/
|
|
|
|
|
|
|
|
import { http, Method } from "@/utils/request.js";
|
|
|
|
|
|
|
|
import api from "@/config/api.js";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取收货地址列表
|
|
|
|
* @returns {AxiosPromise}
|
|
|
|
*/
|
|
|
|
export function getAddressList(pageNumber, pageSize) {
|
|
|
|
return http.request({
|
2022-02-10 18:57:17 +08:00
|
|
|
url: "/member/address",
|
2021-05-13 11:03:32 +08:00
|
|
|
method: Method.GET,
|
|
|
|
needToken: true,
|
|
|
|
params: { pageNumber, pageSize },
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-08-12 16:48:06 +08:00
|
|
|
|
2021-05-13 11:03:32 +08:00
|
|
|
/**
|
|
|
|
* 获取物流公司
|
|
|
|
*/
|
|
|
|
export function getLogistics() {
|
|
|
|
return http.request({
|
2022-06-17 17:24:00 +08:00
|
|
|
url: "/other/logistics",
|
2021-05-13 11:03:32 +08:00
|
|
|
method: Method.GET,
|
|
|
|
needToken: true,
|
|
|
|
params: { pageNumber: 1, pageSize: 200, disabled: "OPEN" },
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 通过cityCode获取地区代码
|
|
|
|
*/
|
|
|
|
export function getAddressCode(cityCode, townName) {
|
|
|
|
return http.request({
|
2022-02-10 18:57:17 +08:00
|
|
|
url: api.common + "/common/region/region",
|
2021-05-13 11:03:32 +08:00
|
|
|
method: Method.GET,
|
|
|
|
needToken: true,
|
|
|
|
params: { cityCode, townName },
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 添加收货地址
|
|
|
|
* @param params 地址参数
|
|
|
|
* @returns {AxiosPromise}
|
|
|
|
*/
|
|
|
|
export function addAddress(data) {
|
|
|
|
return http.request({
|
2022-02-10 18:57:17 +08:00
|
|
|
url: "/member/address",
|
2021-05-13 11:03:32 +08:00
|
|
|
method: Method.POST,
|
|
|
|
needToken: true,
|
|
|
|
header: { "content-type": "application/x-www-form-urlencoded" },
|
|
|
|
data: data,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 编辑地址
|
|
|
|
* @param id 地址ID
|
|
|
|
* @param params 地址参数
|
|
|
|
* @returns {AxiosPromise}
|
|
|
|
*/
|
|
|
|
export function editAddress(params) {
|
|
|
|
return http.request({
|
2022-02-10 18:57:17 +08:00
|
|
|
url: `/member/address`,
|
2021-05-13 11:03:32 +08:00
|
|
|
method: Method.PUT,
|
|
|
|
needToken: true,
|
|
|
|
header: { "content-type": "application/x-www-form-urlencoded" },
|
|
|
|
data: params,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 删除收货地址
|
|
|
|
* @param id
|
|
|
|
*/
|
|
|
|
export function deleteAddress(id) {
|
|
|
|
return http.request({
|
2022-02-10 18:57:17 +08:00
|
|
|
url: `/member/address/delById/${id}`,
|
2021-05-13 11:03:32 +08:00
|
|
|
method: Method.DELETE,
|
|
|
|
needToken: true,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 根据ID获取会员收件地址
|
|
|
|
* @param id
|
|
|
|
*/
|
|
|
|
export function getAddressDetail(id) {
|
|
|
|
return http.request({
|
2022-02-10 18:57:17 +08:00
|
|
|
url: `/member/address/get/${id}`,
|
2021-05-13 11:03:32 +08:00
|
|
|
method: Method.GET,
|
|
|
|
loading: false,
|
|
|
|
needToken: true,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
export function getAddressDefault() {
|
|
|
|
return http.request({
|
2022-02-10 18:57:17 +08:00
|
|
|
url: `/member/address/get/default`,
|
2021-05-13 11:03:32 +08:00
|
|
|
method: Method.GET,
|
|
|
|
loading: false,
|
|
|
|
needToken: true,
|
|
|
|
});
|
|
|
|
}
|