feat(app): 初始化项目配置和页面结构
- 添加 .dockerignore 和 .env.example 配置文件 - 添加 .gitignore 忽略规则配置 - 创建服务端代理API路由(_file、_modules、_server) - 集成 Ant Design Vue 组件库并配置SSR样式提取 - 定义API响应类型封装 - 创建基础布局组件(blank、console) - 实现应用中心页面和组件(AppsCenter) - 添加文章列表测试页面 - 配置控制台导航菜单结构 - 实现控制台头部组件 - 创建联系页面表单
This commit is contained in:
106
app/api/shop/shopUserAddress/index.ts
Normal file
106
app/api/shop/shopUserAddress/index.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { ShopUserAddress, ShopUserAddressParam } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询收货地址
|
||||
*/
|
||||
export async function pageShopUserAddress(params: ShopUserAddressParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ShopUserAddress>>>(
|
||||
MODULES_API_URL + '/shop/shop-user-address/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询收货地址列表
|
||||
*/
|
||||
export async function listShopUserAddress(params?: ShopUserAddressParam) {
|
||||
const res = await request.get<ApiResult<ShopUserAddress[]>>(
|
||||
MODULES_API_URL + '/shop/shop-user-address',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加收货地址
|
||||
*/
|
||||
export async function addShopUserAddress(data: ShopUserAddress) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-user-address',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改收货地址
|
||||
*/
|
||||
export async function updateShopUserAddress(data: ShopUserAddress) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-user-address',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除收货地址
|
||||
*/
|
||||
export async function removeShopUserAddress(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-user-address/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除收货地址
|
||||
*/
|
||||
export async function removeBatchShopUserAddress(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-user-address/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询收货地址
|
||||
*/
|
||||
export async function getShopUserAddress(id: number) {
|
||||
const res = await request.get<ApiResult<ShopUserAddress>>(
|
||||
MODULES_API_URL + '/shop/shop-user-address/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
49
app/api/shop/shopUserAddress/model/index.ts
Normal file
49
app/api/shop/shopUserAddress/model/index.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 收货地址
|
||||
*/
|
||||
export interface ShopUserAddress {
|
||||
// 主键ID
|
||||
id?: number;
|
||||
// 姓名
|
||||
name?: string;
|
||||
// 手机号码
|
||||
phone?: string;
|
||||
// 所在国家
|
||||
country?: string;
|
||||
// 所在省份
|
||||
province?: string;
|
||||
// 所在城市
|
||||
city?: string;
|
||||
// 所在辖区
|
||||
region?: string;
|
||||
// 收货地址
|
||||
address?: string;
|
||||
// 收货地址
|
||||
fullAddress?: string;
|
||||
//
|
||||
lat?: string;
|
||||
//
|
||||
lng?: string;
|
||||
// 1先生 2女士
|
||||
gender?: number;
|
||||
// 家、公司、学校
|
||||
type?: string;
|
||||
// 默认收货地址
|
||||
isDefault?: string;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 注册时间
|
||||
createTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 收货地址搜索条件
|
||||
*/
|
||||
export interface ShopUserAddressParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user