feat(user): 新增收货地址管理及售后申请页面
- 新增地址类型定义,增强前端地址数据结构 - 新增地址编辑页面,支持地址智能识别和定位选点功能 - 地址编辑支持省市区选择及默认地址设置 - 新增地址列表页面,支持地址展示、删除、编辑和选择功能 - 实现售后申请页面,支持选择售后类型和退款原因 - 售后申请支持商品选择、退款金额计算和凭证上传 - 新增售后详情页面,支持售后状态展示及申请取消 - 优化页面加载和用户交互体验,增加错误提示和权限处理
This commit is contained in:
155
src_bak/api/shop/shopDealerApply/index.ts
Normal file
155
src_bak/api/shop/shopDealerApply/index.ts
Normal file
@@ -0,0 +1,155 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { ShopDealerApply, ShopDealerApplyParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询分销商申请记录表
|
||||
*/
|
||||
export async function pageShopDealerApply(params: ShopDealerApplyParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ShopDealerApply>>>(
|
||||
'/shop/shop-dealer-apply/page',
|
||||
params
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分销商申请记录表列表
|
||||
*/
|
||||
export async function listShopDealerApply(params?: ShopDealerApplyParam) {
|
||||
const res = await request.get<ApiResult<ShopDealerApply[]>>(
|
||||
'/shop/shop-dealer-apply',
|
||||
params
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加分销商申请记录表
|
||||
*/
|
||||
export async function addShopDealerApply(data: ShopDealerApply) {
|
||||
try {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/shop/shop-dealer-apply',
|
||||
data
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message || '提交成功';
|
||||
}
|
||||
// 直接抛出包含服务器错误信息的错误
|
||||
const error = new Error(res.message || '提交失败');
|
||||
(error as any).code = res.code;
|
||||
(error as any).data = res.data;
|
||||
throw error;
|
||||
} catch (error: any) {
|
||||
// 如果已经是我们处理过的错误,直接抛出
|
||||
if (error.message && error.code !== undefined) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
// 处理网络错误或其他异常
|
||||
console.error('添加分销商申请失败:', error);
|
||||
|
||||
// 尝试从响应中提取错误信息
|
||||
if (error.response?.data) {
|
||||
const responseData = error.response.data;
|
||||
if (responseData.message) {
|
||||
const newError = new Error(responseData.message);
|
||||
(newError as any).code = responseData.code;
|
||||
throw newError;
|
||||
}
|
||||
}
|
||||
|
||||
// 默认错误处理
|
||||
throw new Error(error.message || '网络错误,请重试');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改分销商申请记录表
|
||||
*/
|
||||
export async function updateShopDealerApply(data: ShopDealerApply) {
|
||||
try {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/shop/shop-dealer-apply',
|
||||
data
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message || '修改成功';
|
||||
}
|
||||
// 直接抛出包含服务器错误信息的错误
|
||||
const error = new Error(res.message || '修改失败');
|
||||
(error as any).code = res.code;
|
||||
(error as any).data = res.data;
|
||||
throw error;
|
||||
} catch (error: any) {
|
||||
// 如果已经是我们处理过的错误,直接抛出
|
||||
if (error.message && error.code !== undefined) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
// 处理网络错误或其他异常
|
||||
console.error('修改分销商申请失败:', error);
|
||||
|
||||
// 尝试从响应中提取错误信息
|
||||
if (error.response?.data) {
|
||||
const responseData = error.response.data;
|
||||
if (responseData.message) {
|
||||
const newError = new Error(responseData.message);
|
||||
(newError as any).code = responseData.code;
|
||||
throw newError;
|
||||
}
|
||||
}
|
||||
|
||||
// 默认错误处理
|
||||
throw new Error(error.message || '网络错误,请重试');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分销商申请记录表
|
||||
*/
|
||||
export async function removeShopDealerApply(id?: number) {
|
||||
const res = await request.del<ApiResult<unknown>>(
|
||||
'/shop/shop-dealer-apply/' + id
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除分销商申请记录表
|
||||
*/
|
||||
export async function removeBatchShopDealerApply(data: (number | undefined)[]) {
|
||||
const res = await request.del<ApiResult<unknown>>(
|
||||
'/shop/shop-dealer-apply/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询分销商申请记录表
|
||||
*/
|
||||
export async function getShopDealerApply(id: number) {
|
||||
const res = await request.get<ApiResult<ShopDealerApply>>(
|
||||
'/shop/shop-dealer-apply/' + id
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
43
src_bak/api/shop/shopDealerApply/model/index.ts
Normal file
43
src_bak/api/shop/shopDealerApply/model/index.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import type { PageParam } from '@/api/index';
|
||||
|
||||
/**
|
||||
* 分销商申请记录表
|
||||
*/
|
||||
export interface ShopDealerApply {
|
||||
// 主键ID
|
||||
applyId?: number;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 姓名
|
||||
realName?: string;
|
||||
// 手机号
|
||||
mobile?: string;
|
||||
// 推荐人用户ID
|
||||
refereeId?: number;
|
||||
// 申请方式(10需后台审核 20无需审核)
|
||||
applyType?: number;
|
||||
// 申请时间
|
||||
applyTime?: number;
|
||||
// 审核状态 (10待审核 20审核通过 30驳回)
|
||||
applyStatus?: number;
|
||||
// 审核时间
|
||||
auditTime?: number;
|
||||
// 驳回原因
|
||||
rejectReason?: string;
|
||||
// 商城ID
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分销商申请记录表搜索条件
|
||||
*/
|
||||
export interface ShopDealerApplyParam extends PageParam {
|
||||
applyId?: number;
|
||||
mobile?: string;
|
||||
userId?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user