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,260 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import {ShopGift, ShopGiftParam, GiftRedeemParam, GiftUseParam, QRCodeParam} from './model';
/**
* 分页查询礼品卡
*/
export async function pageShopGift(params: ShopGiftParam) {
const res = await request.get<ApiResult<PageResult<ShopGift>>>(
'/shop/shop-gift/page',
params
);
if (res.code === 0) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 查询礼品卡列表
*/
export async function listShopGift(params?: ShopGiftParam) {
const res = await request.get<ApiResult<ShopGift[]>>(
'/shop/shop-gift',
params
);
if (res.code === 0 && res.data) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 添加礼品卡
*/
export async function addShopGift(data: ShopGift) {
const res = await request.post<ApiResult<unknown>>(
'/shop/shop-gift',
data
);
if (res.code === 0) {
return res.message;
}
}
/**
* 生成礼品卡
*/
export async function makeShopGift(data: ShopGift) {
const res = await request.post<ApiResult<unknown>>(
'/shop/shop-gift/make',
data
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 修改礼品卡
*/
export async function updateShopGift(data: ShopGift) {
const res = await request.put<ApiResult<unknown>>(
'/shop/shop-gift',
data
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 删除礼品卡
*/
export async function removeShopGift(id?: number) {
const res = await request.del<ApiResult<unknown>>(
'/shop/shop-gift/' + id
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 批量删除礼品卡
*/
export async function removeBatchShopGift(data: (number | undefined)[]) {
const res = await request.del<ApiResult<unknown>>(
'/shop/shop-gift/batch',
{
data
}
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 根据id查询礼品卡
*/
export async function getShopGift(id: number) {
const res = await request.get<ApiResult<ShopGift>>(
'/shop/shop-gift/' + id
);
if (res.code === 0 && res.data) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 根据code查询礼品卡
* @param code
*/
export async function getShopGiftByCode(code: string) {
const res = await request.get<ApiResult<ShopGift>>(
'/shop/shop-gift/by-code/' + code
);
if (res.code === 0 && res.data) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 兑换礼品卡
*/
export async function redeemGift(params: GiftRedeemParam) {
const res = await request.post<ApiResult<ShopGift>>(
'/shop/shop-gift/redeem',
params
);
if (res.code === 0) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 使用礼品卡
*/
export async function useGift(params: GiftUseParam) {
const res = await request.post<ApiResult<unknown>>(
'/shop/shop-gift/use',
params
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 获取用户的礼品卡列表
*/
export async function getUserGifts(params: ShopGiftParam) {
const res = await request.get<ApiResult<PageResult<ShopGift>>>(
'/shop/shop-gift/page',
params
);
if (res.code === 0) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 验证礼品卡兑换码
*/
export async function validateGiftCode(code: string) {
const res = await request.get<ApiResult<ShopGift>>(
`/shop/shop-gift/validate/${code}`
);
if (res.code === 0) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
export async function exportShopGift(ids?: number[]) {
const res = await request.post<ApiResult<unknown>>(
'/shop/shop-gift/export',
ids
);
if (res.code === 0) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 生成礼品卡核销码(可用)
*/
export async function generateVerificationCode(data: QRCodeParam) {
const res = await request.post<ApiResult<unknown>>(
'/qr-code/create-encrypted-qr-code',
data
);
if (res.code === 0) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 验证核销码
*/
export async function verifyGiftCard(params: { verificationCode?: string; giftCode?: string }) {
const res = await request.post<ApiResult<ShopGift>>(
'/shop/shop-gift/verify',
params
);
if (res.code === 0) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 完成礼品卡核销
*/
export async function completeVerification(params: {
giftId: number;
verificationCode: string;
storeId?: number;
storeName?: string;
operatorId?: number;
operatorName?: string;
}) {
const res = await request.post<ApiResult<unknown>>(
'/shop/shop-gift/complete-verification',
params
);
if (res.code === 0) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 解密二维码数据
*/
export async function decryptQrData(params: { token: string; encryptedData: string }) {
const res = await request.post<ApiResult<string>>(
'/qr-code/decrypt-qr-data',
params
);
if (res.code === 0) {
return res.data;
}
return Promise.reject(new Error(res.message));
}

View File

@@ -0,0 +1,127 @@
import type { PageParam } from '@/api';
/**
* 水票
*/
export interface ShopGift {
// 礼品卡ID
id?: number;
// 礼品卡名称
name?: string;
// 礼品卡描述
description?: string;
// 礼品卡兑换码
code?: string;
// 关联商品ID
goodsId?: number;
// 商品名称
goodsName?: string;
// 商品图片
goodsImage?: string;
// 礼品卡面值
faceValue?: string;
// 礼品卡类型 (10实物礼品卡 20虚拟礼品卡 30服务礼品卡)
type?: number;
// 领取时间
takeTime?: string;
// 过期时间
expireTime?: string;
// 有效期天数
validDays?: number;
// 操作人
operatorUserId?: number;
// 操作人名称
operatorUserName?: string;
// 是否展示
isShow?: string;
// 状态 (0未使用 1已使用 2已过期 3已失效)
status?: number;
// 备注
comments?: string;
// 使用说明
instructions?: string;
// 排序号
sortNumber?: number;
// 拥有者用户ID
userId?: number;
// 发放者用户ID
issuerUserId?: number;
// 是否删除, 0否, 1是
deleted?: number;
// 租户id
tenantId?: number;
// 创建时间
createTime?: string;
// 修改时间
updateTime?: string;
// 数量
num?: number;
// 已发放数量
issuedCount?: number;
// 总发放数量
totalCount?: number;
// 使用门店/地址
useLocation?: string;
// 客服联系方式
contactInfo?: string;
// 核销时间
verificationTime?: string;
}
/**
* 礼品卡搜索条件
*/
export interface ShopGiftParam extends PageParam {
id?: number;
keywords?: string;
code?: string;
// 礼品卡类型筛选
type?: number;
// 状态筛选 (0未使用 1已使用 2失效)
status?: number;
// 用户ID筛选
userId?: number;
// 商品ID筛选
goodsId?: number;
// 是否过期筛选
isExpired?: boolean;
// 排序字段
sortBy?: 'createTime' | 'expireTime' | 'faceValue' | 'takeTime';
// 排序方向
sortOrder?: 'asc' | 'desc';
}
/**
* 礼品卡兑换参数
*/
export interface GiftRedeemParam {
// 兑换码
code: string;
// 用户ID
userId?: number;
}
/**
* 礼品卡使用参数
*/
export interface GiftUseParam {
// 礼品卡ID
giftId?: number;
// 使用地址/门店
useLocation?: string;
// 使用备注
useNote?: string;
}
export interface QRCodeParam {
// 二维码数据
data?: string;
// 二维码尺寸
width?: number;
// 二维码高度
height?: number;
// 二维码过期时间
expireMinutes?: number;
// 业务类型
businessType?: string;
}