Files
shop-toy/src/typings/mall.ts
2025-11-30 00:32:09 +08:00

255 lines
6.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 商品相关类型定义
*/
// 商品规格
export interface GoodsSpec {
name: string // 规格名(如:颜色、尺寸)
values: string[] // 规格值(如:红色、蓝色)
}
// 商品信息
export interface Goods {
id: string
shopId: string // 店铺ID
shopName: string // 店铺名称
name: string // 商品名称
cover: string // 封面图
images: string[] // 商品图片
detailImage:string // 详请图片
price: number // 价格
originalPrice: number // 原价
stock: number // 库存
sales: number // 销量
description: string // 商品描述
specs: GoodsSpec[] // 规格
tags: string[] // 标签
categoryId: string // 分类ID
categoryName: string // 分类名称
}
/**
* 分类相关类型定义
*/
export interface Category {
id: string
name: string // 分类名称
icon: string // 分类图标
cover: string // 分类封面
parentId?: string // 父分类ID
children?: Category[] // 子分类
}
/**
* 购物车相关类型定义
*/
export interface CartItem {
id: string
shopId: string
shopName: string
goodsId: string
goodsName: string
cover: string
price: number
selectedSpec: Record<string, string> // 选中的规格
quantity: number
stock: number
checked: boolean // 是否选中
}
/**
* 订单相关类型定义
*/
export interface OrderItem {
goodsId: string
shopId: string
shopName: string
goodsName: string
cover: string
price: number
quantity: number
selectedSpec: Record<string, string>
}
export enum OrderStatus {
PENDING_PAYMENT = 'pending_payment', // 待支付
PENDING_DELIVERY = 'pending_delivery', // 待发货
PENDING_RECEIVE = 'pending_receive', // 待收货
COMPLETED = 'completed', // 已完成
CANCELLED = 'cancelled', // 已取消
}
export interface Order {
id: string
orderNo: string // 订单号
items: OrderItem[]
totalAmount: number // 总金额
actualAmount: number // 实付金额
status: OrderStatus // 订单状态
paymentMethod?: 'online' | 'credit' | 'mixed' // 支付方式
paymentDetails?: { shopId: string, creditAmount: number, onlineAmount: number }[] // 混合支付详情
address: Address // 收货地址
createTime: string
payTime?: string
// 金融相关
merchantId?: string // 关联商户ID
isSettled: boolean // 是否已结
settlementTime?: string // 结算时间
dueDate?: string // 到期日期
}
export interface Address {
id: string
name: string // 收货人
phone: string // 手机号
province: string // 省
city: string // 市
district: string // 区
detail: string // 详细地址
isDefault: boolean // 是否默认
}
/**
* 金融相关类型定义
*/
// 信用额度
export interface CreditLimit {
merchantId: string // 商户ID
merchantName: string // 商户名称商户A、商户B
totalLimit: number // 总额度
usedLimit: number // 已用额度
availableLimit: number // 可用额度
updateTime: string // 更新时间
}
// 应结账款状态
export enum SettlementStatus {
SETTLED = 'settled', // 已结
UNSETTLED = 'unsettled', // 未结
OVERDUE = 'overdue', // 逾期
}
// 应结账款
export interface Settlement {
id: string
orderNo: string // 订单号
merchantId: string // 商户ID
merchantName: string // 商户名称
amount: number // 金额
status: SettlementStatus // 状态(已结/未结)
dueDate: string // 到期日期
settlementDate?: string // 结算日期
relatedOrders: string[] // 关联订单号列表
}
// 消账状态
export enum WriteOffStatus {
PENDING = 'pending', // 待审核
APPROVED = 'approved', // 已通过
REJECTED = 'rejected', // 已拒绝
}
// 提交消账
export interface WriteOff {
id: string
settlementId: string // 应结账款ID
amount: number // 消账金额
proof: string[] // 凭证图片
remark: string // 备注
submitTime: string // 提交时间
status: WriteOffStatus // 状态
}
/**
* 会员相关类型定义
*/
export enum MemberLevel {
NORMAL = 'normal', // 普通会员
SILVER = 'silver', // 银卡会员
GOLD = 'gold', // 金卡会员
PLATINUM = 'platinum', // 白金会员
}
export interface Member {
id: string
userId: string
level: MemberLevel // 会员等级
points: number // 积分
expireDate: string // 到期日期
benefits: string[] // 会员权益
}
/**
* 用户相关类型定义
*/
export interface User {
id: string
username: string
nickname: string
avatar: string
phone: string
// 金融相关
creditLimits: CreditLimit[] // 信用额度列表
// 会员相关
member?: Member // 会员信息
}
/**
* 轮播图相关类型定义
*/
export interface Banner {
id: string
image: string // 图片地址
title: string // 标题
link?: string // 跳转链接
goodsId?: string // 关联商品ID
}
/**
* 助贷申请记录相关类型定义
*/
// 助贷申请状态
export enum LoanApplicationStatus {
PROCESSING = 'PROCESSING', // 处理中
COMPLETED = 'COMPLETED', // 已完成
PENDING = 'PENDING', // 待提交
}
// 进度条数据
export interface LoanApplicationProgress {
show: boolean
steps: string[] // 步骤名称数组
currentStepIndex: number // 当前步骤索引 (从0开始)
stepStatus: string // 当前步骤状态
}
// 提示信息框
export interface LoanApplicationAlertInfo {
show: boolean
type: 'info' | 'warning' // info(蓝), warning(黄)
content: string
}
// 底部按钮配置
export interface LoanApplicationAction {
code: string
text: string
style: string // text-link, primary-blue, primary-green, primary-yellow
}
// 助贷申请记录
export interface LoanApplicationRecord {
applicationId: string // 申请编号
loanType: string // 贷款类型ENTERPRISE, 其他
loanTitle: string // 显示标题
dateLabel: string // 动态标签:申请时间 / 创建时间
dateValue: string // 日期值
status: LoanApplicationStatus // 状态枚举
statusText: string // 状态中文文案
progress?: LoanApplicationProgress // 进度条数据 (仅Processing和Pending状态需要)
alertInfo?: LoanApplicationAlertInfo // 提示信息框 (可空)
actions: LoanApplicationAction[] // 底部按钮配置
}