feat(user): 新增收货地址管理及售后申请页面

- 新增地址类型定义,增强前端地址数据结构
- 新增地址编辑页面,支持地址智能识别和定位选点功能
- 地址编辑支持省市区选择及默认地址设置
- 新增地址列表页面,支持地址展示、删除、编辑和选择功能
- 实现售后申请页面,支持选择售后类型和退款原因
- 售后申请支持商品选择、退款金额计算和凭证上传
- 新增售后详情页面,支持售后状态展示及申请取消
- 优化页面加载和用户交互体验,增加错误提示和权限处理
This commit is contained in:
2026-07-01 12:11:56 +08:00
parent bf6ed504cc
commit 1fa58040f3
636 changed files with 58878 additions and 716 deletions

View File

@@ -0,0 +1,166 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { ShopInvoiceTitle, ShopInvoiceTitleParam, ShopInvoiceRecord, ShopInvoiceRecordParam, InvoiceApplyRequest } from './model';
/**
* 分页查询发票抬头
*/
export async function pageShopInvoiceTitle(params: ShopInvoiceTitleParam) {
const res = await request.get<ApiResult<PageResult<ShopInvoiceTitle>>>(
'/shop/shop-invoice-title/page',
params
);
if (res.code === 0) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 查询发票抬头列表
*/
export async function listShopInvoiceTitle(params?: ShopInvoiceTitleParam) {
const res = await request.get<ApiResult<ShopInvoiceTitle[]>>(
'/shop/shop-invoice-title',
params
);
if (res.code === 0 && res.data) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 添加发票抬头
*/
export async function addShopInvoiceTitle(data: ShopInvoiceTitle) {
const res = await request.post<ApiResult<unknown>>(
'/shop/shop-invoice-title',
data
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 修改发票抬头
*/
export async function updateShopInvoiceTitle(data: ShopInvoiceTitle) {
const res = await request.put<ApiResult<unknown>>(
'/shop/shop-invoice-title',
data
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 删除发票抬头
*/
export async function removeShopInvoiceTitle(id?: number) {
const res = await request.del<ApiResult<unknown>>(
'/shop/shop-invoice-title/' + id
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 根据id查询发票抬头
*/
export async function getShopInvoiceTitle(id: number) {
const res = await request.get<ApiResult<ShopInvoiceTitle>>(
'/shop/shop-invoice-title/' + id
);
if (res.code === 0 && res.data) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 设置默认发票抬头
*/
export async function setDefaultInvoiceTitle(id: number) {
const res = await request.put<ApiResult<unknown>>(
'/shop/shop-invoice-title/set-default/' + id
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 分页查询发票记录
*/
export async function pageShopInvoiceRecord(params: ShopInvoiceRecordParam) {
const res = await request.get<ApiResult<PageResult<ShopInvoiceRecord>>>(
'/shop/shop-invoice-record/page',
params
);
if (res.code === 0) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 查询发票记录列表
*/
export async function listShopInvoiceRecord(params?: ShopInvoiceRecordParam) {
const res = await request.get<ApiResult<ShopInvoiceRecord[]>>(
'/shop/shop-invoice-record',
params
);
if (res.code === 0 && res.data) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 申请发票
*/
export async function applyInvoice(data: InvoiceApplyRequest) {
const res = await request.post<ApiResult<unknown>>(
'/shop/shop-invoice-record/apply',
data
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 根据id查询发票记录
*/
export async function getShopInvoiceRecord(id: number) {
const res = await request.get<ApiResult<ShopInvoiceRecord>>(
'/shop/shop-invoice-record/' + id
);
if (res.code === 0 && res.data) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 获取用户可开票订单列表
*/
export async function listInvoiceableOrders() {
const res = await request.get<ApiResult<ShopInvoiceRecord[]>>(
'/shop/shop-invoice-record/invoiceable-orders'
);
if (res.code === 0 && res.data) {
return res.data;
}
return Promise.reject(new Error(res.message));
}

View File

@@ -0,0 +1,155 @@
/**
* 发票抬头表
*/
export interface ShopInvoiceTitle {
/** 主键ID */
id?: number;
/** 用户ID */
userId?: number;
/** 抬头类型: personal-个人, company-企业 */
type?: 'personal' | 'company';
/** 发票抬头名称 */
name?: string;
/** 税号(企业必填) */
taxNumber?: string;
/** 注册地址 */
address?: string;
/** 注册电话 */
phone?: string;
/** 开户银行 */
bankName?: string;
/** 银行账号 */
bankAccount?: string;
/** 接收邮箱 */
email?: string;
/** 是否默认: 0-否, 1-是 */
isDefault?: number;
/** 商城ID */
tenantId?: number;
/** 创建时间 */
createTime?: string;
/** 修改时间 */
updateTime?: string;
}
/**
* 发票抬头查询参数
*/
export interface ShopInvoiceTitleParam {
/** 主键ID */
id?: number;
/** 用户ID */
userId?: number;
/** 抬头类型 */
type?: string;
/** 是否默认 */
isDefault?: number;
/** 第几页 */
page?: number;
/** 每页多少条 */
limit?: number;
/** 排序字段 */
sort?: string;
/** 排序方式 */
order?: string;
}
/**
* 发票申请记录
*/
export interface ShopInvoiceRecord {
/** 主键ID */
id?: number;
/** 用户ID */
userId?: number;
/** 用户昵称 */
userNickName?: string;
/** 订单ID */
orderId?: number;
/** 订单编号 */
orderNo?: string;
/** 发票抬头ID */
titleId?: number;
/** 发票类型: normal-普通发票, vat-增值税发票 */
invoiceType?: 'normal' | 'vat';
/** 发票抬头 */
titleName?: string;
/** 税号 */
taxNumber?: string;
/** 发票金额 */
amount?: number;
/** 发票状态: 0-待处理, 1-开票中, 2-已开票, 3-开票失败 */
status?: number;
/** 发票流水号 */
invoiceNo?: string;
/** 发票URL */
invoiceUrl?: string;
/** 申请时间 */
applyTime?: string;
/** 开票时间 */
invoiceTime?: string;
/** 商城ID */
tenantId?: number;
/** 创建时间 */
createTime?: string;
/** 修改时间 */
updateTime?: string;
}
/**
* 发票申请参数
*/
export interface ShopInvoiceRecordParam {
/** 主键ID */
id?: number;
/** 用户ID */
userId?: number;
/** 订单ID */
orderId?: number;
/** 发票抬头ID */
titleId?: number;
/** 发票类型 */
invoiceType?: string;
/** 发票状态 */
status?: number;
/** 第几页 */
page?: number;
/** 每页多少条 */
limit?: number;
/** 排序字段 */
sort?: string;
/** 排序方式 */
order?: string;
/** 起始时间 */
createTimeStart?: string;
/** 结束时间 */
createTimeEnd?: string;
}
/**
* 发票申请请求
*/
export interface InvoiceApplyRequest {
/** 订单ID */
orderId: number;
/** 发票抬头ID */
titleId: number;
/** 发票类型 */
invoiceType?: 'normal' | 'vat';
/** 接收邮箱(电子发票) */
email?: string;
}
/**
* 发票状态枚举
*/
export enum InvoiceStatusEnum {
/** 待处理 */
PENDING = 0,
/** 开票中 */
PROCESSING = 1,
/** 已开票 */
COMPLETED = 2,
/** 开票失败 */
FAILED = 3,
}