Initial commit of akmon project
This commit is contained in:
365
types/mall-types.uts
Normal file
365
types/mall-types.uts
Normal file
@@ -0,0 +1,365 @@
|
||||
// 电商商城系统类型定义 - UTS Android 兼容
|
||||
|
||||
// 用户类型
|
||||
export type UserType = {
|
||||
id: string
|
||||
phone: string
|
||||
email: string | null
|
||||
nickname: string | null
|
||||
avatar_url: string | null
|
||||
gender: number
|
||||
user_type: number
|
||||
status: number
|
||||
created_at: string
|
||||
}
|
||||
|
||||
// 商城用户扩展信息类型
|
||||
export type MallUserProfileType = {
|
||||
id: string
|
||||
user_id: string
|
||||
user_type: number
|
||||
status: number
|
||||
real_name: string | null
|
||||
id_card: string | null
|
||||
credit_score: number
|
||||
mall_role: string
|
||||
verification_status: number
|
||||
verification_data: UTSJSONObject | null
|
||||
business_license: string | null
|
||||
shop_category: string | null
|
||||
service_areas: UTSJSONObject | null
|
||||
emergency_contact: string | null
|
||||
preferences: UTSJSONObject | null
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
// 用户地址类型
|
||||
export type UserAddressType = {
|
||||
id: string
|
||||
user_id: string
|
||||
receiver_name: string
|
||||
receiver_phone: string
|
||||
province: string
|
||||
city: string
|
||||
district: string
|
||||
address_detail: string
|
||||
postal_code: string | null
|
||||
is_default: boolean
|
||||
label: string | null
|
||||
coordinates: string | null
|
||||
delivery_instructions: string | null
|
||||
business_hours: string | null
|
||||
status: number
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
// 商家类型
|
||||
export type MerchantType = {
|
||||
id: string
|
||||
user_id: string
|
||||
shop_name: string
|
||||
shop_logo: string | null
|
||||
shop_banner: string | null
|
||||
shop_description: string | null
|
||||
contact_name: string
|
||||
contact_phone: string
|
||||
shop_status: number
|
||||
rating: number
|
||||
total_sales: number
|
||||
created_at: string
|
||||
}
|
||||
|
||||
// 商品类型
|
||||
export type ProductType = {
|
||||
id: string
|
||||
merchant_id: string
|
||||
category_id: string
|
||||
name: string
|
||||
description: string | null
|
||||
images: Array<string>
|
||||
price: number
|
||||
original_price: number | null
|
||||
stock: number
|
||||
sales: number
|
||||
status: number
|
||||
created_at: string
|
||||
}
|
||||
|
||||
// 商品SKU类型
|
||||
export type ProductSkuType = {
|
||||
id: string
|
||||
product_id: string
|
||||
sku_code: string
|
||||
specifications: UTSJSONObject | null
|
||||
price: number
|
||||
stock: number
|
||||
image_url: string | null
|
||||
status: number
|
||||
}
|
||||
|
||||
// 购物车类型
|
||||
export type CartItemType = {
|
||||
id: string
|
||||
user_id: string
|
||||
product_id: string
|
||||
sku_id: string
|
||||
quantity: number
|
||||
selected: boolean
|
||||
product: ProductType | null
|
||||
sku: ProductSkuType | null
|
||||
}
|
||||
|
||||
// 订单类型
|
||||
export type OrderType = {
|
||||
id: string
|
||||
order_no: string
|
||||
user_id: string
|
||||
merchant_id: string
|
||||
status: number
|
||||
total_amount: number
|
||||
discount_amount: number
|
||||
delivery_fee: number
|
||||
actual_amount: number
|
||||
payment_method: number | null
|
||||
payment_status: number
|
||||
delivery_address: UTSJSONObject
|
||||
created_at: string
|
||||
}
|
||||
|
||||
// 订单商品类型
|
||||
export type OrderItemType = {
|
||||
id: string
|
||||
order_id: string
|
||||
product_id: string
|
||||
sku_id: string
|
||||
product_name: string
|
||||
sku_specifications: UTSJSONObject | null
|
||||
price: number
|
||||
quantity: number
|
||||
total_amount: number
|
||||
}
|
||||
|
||||
// 配送员类型
|
||||
export type DeliveryDriverType = {
|
||||
id: string
|
||||
user_id: string
|
||||
real_name: string
|
||||
id_card: string
|
||||
driver_license: string | null
|
||||
vehicle_type: number
|
||||
vehicle_number: string | null
|
||||
work_status: number
|
||||
current_location: UTSJSONObject | null
|
||||
service_areas: Array<string>
|
||||
rating: number
|
||||
total_orders: number
|
||||
auth_status: number
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
// 配送任务类型
|
||||
export type DeliveryTaskType = {
|
||||
id: string
|
||||
order_id: string
|
||||
driver_id: string | null
|
||||
pickup_address: UTSJSONObject
|
||||
delivery_address: UTSJSONObject
|
||||
distance: number | null
|
||||
estimated_time: number | null
|
||||
delivery_fee: number
|
||||
status: number
|
||||
pickup_time: string | null
|
||||
delivered_time: string | null
|
||||
delivery_code: string | null
|
||||
remark: string | null
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
// 优惠券模板类型
|
||||
export type CouponTemplateType = {
|
||||
id: string
|
||||
name: string
|
||||
description: string | null
|
||||
coupon_type: number
|
||||
discount_type: number
|
||||
discount_value: number
|
||||
min_order_amount: number
|
||||
max_discount_amount: number | null
|
||||
total_quantity: number | null
|
||||
per_user_limit: number
|
||||
usage_limit: number
|
||||
merchant_id: string | null
|
||||
category_ids: Array<string>
|
||||
product_ids: Array<string>
|
||||
user_type_limit: number | null
|
||||
start_time: string
|
||||
end_time: string
|
||||
status: number
|
||||
created_at: string
|
||||
}
|
||||
|
||||
// 用户优惠券类型
|
||||
export type UserCouponType = {
|
||||
id: string
|
||||
user_id: string
|
||||
template_id: string
|
||||
coupon_code: string
|
||||
status: number
|
||||
used_at: string | null
|
||||
order_id: string | null
|
||||
received_at: string
|
||||
expire_at: string
|
||||
}
|
||||
|
||||
// 分页数据类型
|
||||
export type PageDataType<T> = {
|
||||
data: Array<T>
|
||||
total: number
|
||||
page: number
|
||||
pageSize: number
|
||||
hasMore: boolean
|
||||
}
|
||||
|
||||
// API响应类型
|
||||
export type ApiResponseType<T> = {
|
||||
success: boolean
|
||||
data: T | null
|
||||
message: string
|
||||
code: number
|
||||
}
|
||||
|
||||
// 订单状态枚举
|
||||
export const ORDER_STATUS = {
|
||||
PENDING_PAYMENT: 1,
|
||||
PAID: 2,
|
||||
SHIPPED: 3,
|
||||
DELIVERED: 4,
|
||||
COMPLETED: 5,
|
||||
CANCELLED: 6,
|
||||
REFUNDING: 7,
|
||||
REFUNDED: 8
|
||||
} as const
|
||||
|
||||
// 优惠券类型枚举
|
||||
export const COUPON_TYPE = {
|
||||
DISCOUNT_AMOUNT: 1, // 满减券
|
||||
DISCOUNT_PERCENT: 2, // 折扣券
|
||||
FREE_SHIPPING: 3, // 免运费券
|
||||
NEWBIE: 4, // 新人券
|
||||
MEMBER: 5, // 会员券
|
||||
CATEGORY: 6, // 品类券
|
||||
MERCHANT: 7, // 商家券
|
||||
LIMITED_TIME: 8 // 限时券
|
||||
} as const
|
||||
|
||||
// 支付方式枚举
|
||||
export const PAYMENT_METHOD = {
|
||||
WECHAT: 1,
|
||||
ALIPAY: 2,
|
||||
UNIONPAY: 3,
|
||||
BALANCE: 4
|
||||
} as const
|
||||
|
||||
// 配送状态枚举
|
||||
export const DELIVERY_STATUS = {
|
||||
PENDING: 1,
|
||||
ASSIGNED: 2,
|
||||
PICKED_UP: 3,
|
||||
IN_TRANSIT: 4,
|
||||
DELIVERED: 5,
|
||||
FAILED: 6
|
||||
} as const
|
||||
|
||||
// 用户类型枚举
|
||||
export const MALL_USER_TYPE = {
|
||||
CONSUMER: 1, // 消费者
|
||||
MERCHANT: 2, // 商家
|
||||
DELIVERY: 3, // 配送员
|
||||
SERVICE: 4, // 客服
|
||||
ADMIN: 5 // 管理员
|
||||
} as const
|
||||
|
||||
// 用户状态枚举
|
||||
export const USER_STATUS = {
|
||||
NORMAL: 1, // 正常
|
||||
FROZEN: 2, // 冻结
|
||||
CANCELLED: 3, // 注销
|
||||
PENDING: 4 // 待审核
|
||||
} as const
|
||||
|
||||
// 认证状态枚举
|
||||
export const VERIFICATION_STATUS = {
|
||||
UNVERIFIED: 0, // 未认证
|
||||
VERIFIED: 1, // 已认证
|
||||
FAILED: 2 // 认证失败
|
||||
} as const
|
||||
|
||||
// 地址标签枚举
|
||||
export const ADDRESS_LABEL = {
|
||||
HOME: 'home', // 家
|
||||
OFFICE: 'office', // 公司
|
||||
SCHOOL: 'school', // 学校
|
||||
OTHER: 'other' // 其他
|
||||
} as const
|
||||
|
||||
// 收藏类型枚举
|
||||
export const FAVORITE_TYPE = {
|
||||
PRODUCT: 'product', // 商品
|
||||
SHOP: 'shop' // 店铺
|
||||
} as const
|
||||
|
||||
// =========================
|
||||
// 订阅相关类型与枚举
|
||||
// =========================
|
||||
|
||||
// 订阅周期枚举
|
||||
export const SUBSCRIPTION_PERIOD = {
|
||||
MONTHLY: 'monthly',
|
||||
YEARLY: 'yearly'
|
||||
} as const
|
||||
|
||||
// 订阅状态枚举
|
||||
export const SUBSCRIPTION_STATUS = {
|
||||
TRIAL: 'trial',
|
||||
ACTIVE: 'active',
|
||||
PAST_DUE: 'past_due',
|
||||
CANCELED: 'canceled',
|
||||
EXPIRED: 'expired'
|
||||
} as const
|
||||
|
||||
// 软件订阅方案类型
|
||||
export type SubscriptionPlanType = {
|
||||
id: string
|
||||
plan_code: string
|
||||
name: string
|
||||
description: string | null
|
||||
features: UTSJSONObject | null // { featureKey: description }
|
||||
price: number // 单位:元(或分,取决于后端;前端以显示为准)
|
||||
currency: string | null // 'CNY' | 'USD' ...
|
||||
billing_period: keyof typeof SUBSCRIPTION_PERIOD | string // 'monthly' | 'yearly'
|
||||
trial_days: number | null
|
||||
is_active: boolean
|
||||
sort_order?: number | null
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
}
|
||||
|
||||
// 用户订阅记录类型
|
||||
export type UserSubscriptionType = {
|
||||
id: string
|
||||
user_id: string
|
||||
plan_id: string
|
||||
status: keyof typeof SUBSCRIPTION_STATUS | string
|
||||
start_date: string
|
||||
end_date: string | null
|
||||
next_billing_date: string | null
|
||||
auto_renew: boolean
|
||||
cancel_at_period_end?: boolean | null
|
||||
metadata?: UTSJSONObject | null
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
}
|
||||
Reference in New Issue
Block a user