feat(user): 新增收货地址管理及售后申请页面
- 新增地址类型定义,增强前端地址数据结构 - 新增地址编辑页面,支持地址智能识别和定位选点功能 - 地址编辑支持省市区选择及默认地址设置 - 新增地址列表页面,支持地址展示、删除、编辑和选择功能 - 实现售后申请页面,支持选择售后类型和退款原因 - 售后申请支持商品选择、退款金额计算和凭证上传 - 新增售后详情页面,支持售后状态展示及申请取消 - 优化页面加载和用户交互体验,增加错误提示和权限处理
This commit is contained in:
89
src_bak/api/shop/shopActivity/model/index.ts
Normal file
89
src_bak/api/shop/shopActivity/model/index.ts
Normal file
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* 活动模型
|
||||
*/
|
||||
|
||||
// 活动类型(前端语义化)
|
||||
export type ActivityType = 'discount' | 'full_reduction' | 'seckill' | 'group_buy' | 'flash_sale'
|
||||
|
||||
// 活动状态(前端语义化)
|
||||
export type ActivityStatus = 'upcoming' | 'ongoing' | 'ended' | 'cancelled'
|
||||
|
||||
// 活动数据(与后端字段对齐)
|
||||
export interface ShopActivity {
|
||||
id: number
|
||||
name: string
|
||||
image: string
|
||||
banner?: string
|
||||
startTime: string
|
||||
endTime: string
|
||||
/** 后端返回整数: 0=未开始 1=进行中 2=已结束,前端通过 normalizeActivity 转为语义化字符串 */
|
||||
status: ActivityStatus | number
|
||||
/** 后端返回整数: 1=满减 2=折扣 3=秒杀 4=拼团 */
|
||||
type: ActivityType | number
|
||||
typeName?: string
|
||||
description: string
|
||||
participants?: number
|
||||
maxParticipants?: number
|
||||
discountRate?: number
|
||||
reductionAmount?: number
|
||||
minAmount?: number
|
||||
rules?: string
|
||||
tenantId?: number
|
||||
createTime: string
|
||||
updateTime?: string
|
||||
}
|
||||
|
||||
// 活动查询参数
|
||||
export interface ShopActivityParam {
|
||||
page?: number
|
||||
limit?: number
|
||||
status?: number | ActivityStatus
|
||||
type?: number | ActivityType
|
||||
keywords?: string
|
||||
}
|
||||
|
||||
// 活动报名参数
|
||||
export interface ActivitySignUpParams {
|
||||
activityId: number
|
||||
userId?: number
|
||||
contactPhone?: string
|
||||
remark?: string
|
||||
}
|
||||
|
||||
// 活动统计
|
||||
export interface ActivityStats {
|
||||
total: number
|
||||
ongoing: number
|
||||
upcoming: number
|
||||
ended: number
|
||||
totalParticipants: number
|
||||
}
|
||||
|
||||
// 后端整数状态 → 前端语义化状态
|
||||
export function normalizeActivityStatus(status: number | ActivityStatus): ActivityStatus {
|
||||
if (typeof status === 'string') return status
|
||||
const map: Record<number, ActivityStatus> = { 0: 'upcoming', 1: 'ongoing', 2: 'ended' }
|
||||
return map[status] ?? 'ended'
|
||||
}
|
||||
|
||||
// 后端整数类型 → 前端语义化类型
|
||||
export function normalizeActivityType(type: number | ActivityType): ActivityType {
|
||||
if (typeof type === 'string') return type
|
||||
const map: Record<number, ActivityType> = {
|
||||
1: 'full_reduction',
|
||||
2: 'discount',
|
||||
3: 'seckill',
|
||||
4: 'group_buy',
|
||||
}
|
||||
return map[type] ?? 'discount'
|
||||
}
|
||||
|
||||
// 规范化活动对象(处理后端整数字段)
|
||||
export function normalizeActivity(a: ShopActivity): ShopActivity & { status: ActivityStatus; type: ActivityType } {
|
||||
return {
|
||||
...a,
|
||||
participants: a.participants ?? 0,
|
||||
status: normalizeActivityStatus(a.status as number),
|
||||
type: normalizeActivityType(a.type as number),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user