feat(address): 新增收货地址与售后申请功能
- 新增地址编辑页面,支持地址智能识别、地图选点、地区选择和默认地址设置 - 实现地址列表页面,支持地址查看、删除、设为默认及选择返回结算页 - 新增售后申请页面,支持退款类型选择、商品选择、原因填写、图片上传和提交审核 - 修复 passport 分包配置,移除不存在分包并补充缺失声明,避免 Taro 编译报错 - 新增地址类型定义,增强前端地址数据结构类型安全 - 优化页面交互体验,完善表单校验及错误提示逻辑 - 统一代码格式与命名规范,保持代码风格一致性
This commit is contained in:
8
src/types/address.ts
Normal file
8
src/types/address.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { ShopUserAddress } from '@/api/shop/shopUserAddress/model'
|
||||
|
||||
export type { ShopUserAddress }
|
||||
|
||||
/** 地址 (前端增强) */
|
||||
export type Address = ShopUserAddress & {
|
||||
fullAddress?: string
|
||||
}
|
||||
17
src/types/coupon.ts
Normal file
17
src/types/coupon.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { ShopCoupon } from '@/api/shop/shopCoupon/model'
|
||||
|
||||
export type { ShopCoupon }
|
||||
|
||||
/** 优惠券状态枚举 */
|
||||
export enum CouponStatus {
|
||||
Unused = 0,
|
||||
Used = 1,
|
||||
Expired = 2,
|
||||
}
|
||||
|
||||
/** 优惠券状态文本 */
|
||||
export const CouponStatusText: Record<CouponStatus, string> = {
|
||||
[CouponStatus.Unused]: '未使用',
|
||||
[CouponStatus.Used]: '已使用',
|
||||
[CouponStatus.Expired]: '已过期',
|
||||
}
|
||||
57
src/types/global.d.ts
vendored
Normal file
57
src/types/global.d.ts
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
// 全局类型定义
|
||||
|
||||
declare namespace NodeJS {
|
||||
interface ProcessEnv {
|
||||
NODE_ENV: 'development' | 'production'
|
||||
TARO_ENV: 'weapp' | 'h5' | 'rn' | 'alipay' | 'swan' | 'tt' | 'qq' | 'jd' | 'quickapp'
|
||||
}
|
||||
}
|
||||
|
||||
// 全局变量声明
|
||||
declare const __DEV__: boolean
|
||||
|
||||
// 模块声明
|
||||
declare module '*.png' {
|
||||
const value: string
|
||||
export default value
|
||||
}
|
||||
|
||||
declare module '*.jpg' {
|
||||
const value: string
|
||||
export default value
|
||||
}
|
||||
|
||||
declare module '*.jpeg' {
|
||||
const value: string
|
||||
export default value
|
||||
}
|
||||
|
||||
declare module '*.gif' {
|
||||
const value: string
|
||||
export default value
|
||||
}
|
||||
|
||||
declare module '*.svg' {
|
||||
const value: string
|
||||
export default value
|
||||
}
|
||||
|
||||
declare module '*.scss' {
|
||||
const value: { [className: string]: string }
|
||||
export default value
|
||||
}
|
||||
|
||||
declare module '*.sass' {
|
||||
const value: { [className: string]: string }
|
||||
export default value
|
||||
}
|
||||
|
||||
// Taro 类型扩展
|
||||
declare namespace Taro {
|
||||
interface ShowToastOption {
|
||||
title: string
|
||||
icon?: 'success' | 'loading' | 'none'
|
||||
duration?: number
|
||||
mask?: boolean
|
||||
}
|
||||
}
|
||||
5
src/types/index.ts
Normal file
5
src/types/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from './product'
|
||||
export * from './order'
|
||||
export * from './member'
|
||||
export * from './address'
|
||||
export * from './coupon'
|
||||
27
src/types/member.ts
Normal file
27
src/types/member.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/** 用户信息 (前端使用的增强版) */
|
||||
export interface UserInfo {
|
||||
userId?: number
|
||||
nickname?: string
|
||||
avatar?: string
|
||||
phone?: string
|
||||
gender?: number
|
||||
birthday?: string
|
||||
balance?: string
|
||||
points?: number
|
||||
memberLevelId?: number
|
||||
memberLevelName?: string
|
||||
memberExpireTime?: string
|
||||
displayId?: string
|
||||
status?: number
|
||||
}
|
||||
|
||||
/** 会员等级 */
|
||||
export interface MemberGrade {
|
||||
levelId: number
|
||||
levelName: string
|
||||
price: string
|
||||
discountRate: string
|
||||
commissionRate: string
|
||||
description?: string
|
||||
privileges?: string
|
||||
}
|
||||
83
src/types/order.ts
Normal file
83
src/types/order.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
import type { ShopOrder, ShopOrderGoods } from '@/api/shop/shopOrder/model'
|
||||
|
||||
export type { ShopOrder, ShopOrderGoods, OrderCreateRequest } from '@/api/shop/shopOrder/model'
|
||||
|
||||
/**
|
||||
* 订单终态(orderStatus 字段)
|
||||
* 0 = 正常订单的初始值(非终态),在详情/卡片页应根据 payStatus + deliveryStatus 联合判断
|
||||
* 1 = 已完成(终态)
|
||||
* 2 = 已取消(终态)
|
||||
* 3 = 取消中
|
||||
* 4 = 退款申请中(用户申请)
|
||||
* 5 = 退款被拒绝
|
||||
* 6 = 退款成功(终态)
|
||||
* 7 = 客户端申请退款
|
||||
*/
|
||||
export enum OrderStatus {
|
||||
Active = 0, // 正常订单初始值(已付款待发货阶段,非终态)
|
||||
Completed = 1, // 已完成
|
||||
Cancelled = 2, // 已取消
|
||||
Cancelling = 3, // 取消中
|
||||
RefundApply = 4, // 退款申请中
|
||||
RefundRejected = 5, // 退款被拒绝
|
||||
RefundSuccess = 6, // 退款成功
|
||||
ClientRefundApply = 7, // 客户端申请退款
|
||||
}
|
||||
|
||||
/** orderStatus 状态文本映射(仅作原始值展示,不建议直接用于 UI) */
|
||||
export const OrderStatusText: Record<number, string> = {
|
||||
[OrderStatus.Active]: '已付款待发货',
|
||||
[OrderStatus.Completed]: '已完成',
|
||||
[OrderStatus.Cancelled]: '已取消',
|
||||
[OrderStatus.Cancelling]: '取消中',
|
||||
[OrderStatus.RefundApply]: '退款申请中',
|
||||
[OrderStatus.RefundRejected]: '退款被拒绝',
|
||||
[OrderStatus.RefundSuccess]: '已退款',
|
||||
[OrderStatus.ClientRefundApply]: '申请退款',
|
||||
}
|
||||
|
||||
/** orderStatus 状态颜色映射 */
|
||||
export const OrderStatusColor: Record<number, string> = {
|
||||
[OrderStatus.Active]: '#4b9cf5', // 待发货
|
||||
[OrderStatus.Completed]: '#0e932e',
|
||||
[OrderStatus.Cancelled]: '#999',
|
||||
[OrderStatus.Cancelling]: '#ff7d00',
|
||||
[OrderStatus.RefundApply]: '#ee0a24',
|
||||
[OrderStatus.RefundRejected]: '#ee0a24',
|
||||
[OrderStatus.RefundSuccess]: '#0e932e',
|
||||
[OrderStatus.ClientRefundApply]: '#ee0a24',
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页 Tab 筛选状态(对应后端 statusFilter 字段)
|
||||
* -1全部 0待支付 1待发货 2待核销 3待收货 4待评价 5已完成 6已退款 7已删除
|
||||
*/
|
||||
export enum OrderListStatus {
|
||||
All = -1, // 全部
|
||||
Unpaid = 0, // 待支付(payStatus=0)
|
||||
Unshipped = 1, // 待发货(payStatus=1, deliveryStatus=10)
|
||||
Unverify = 2, // 待核销
|
||||
Shipped = 3, // 待收货(payStatus=1, deliveryStatus=20)
|
||||
Unreview = 4, // 待评价
|
||||
Completed = 5, // 已完成
|
||||
Refunded = 6, // 已退款
|
||||
Deleted = 7, // 已删除
|
||||
}
|
||||
|
||||
/** 列表 Tab 文案 */
|
||||
export const OrderListTabText: Record<number, string> = {
|
||||
[OrderListStatus.All]: '全部',
|
||||
[OrderListStatus.Unpaid]: '待付款',
|
||||
[OrderListStatus.Unshipped]: '待发货',
|
||||
[OrderListStatus.Shipped]: '待收货',
|
||||
[OrderListStatus.Completed]: '已完成',
|
||||
}
|
||||
|
||||
/** 退款申请参数 */
|
||||
export interface RefundApply {
|
||||
orderId: number
|
||||
reason: string
|
||||
money?: string
|
||||
description?: string
|
||||
images?: string[]
|
||||
}
|
||||
36
src/types/product.ts
Normal file
36
src/types/product.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import type { ShopGoods, ShopGoodsSku } from '@/api/shop/shopGoods/model'
|
||||
import type { ShopGoodsCategory } from '@/api/shop/shopGoodsCategory/model'
|
||||
|
||||
export type { ShopGoods, ShopGoodsSku, ShopGoodsCategory }
|
||||
|
||||
/** 商品列表项 (简化版,用于列表展示) */
|
||||
export interface ProductListItem {
|
||||
goodsId: number
|
||||
name: string
|
||||
image: string
|
||||
price: string
|
||||
salePrice: string
|
||||
stock: number
|
||||
sales?: number
|
||||
isNew?: number
|
||||
}
|
||||
|
||||
/** 商品详情 (包含完整 SKU 和规格) */
|
||||
export type ProductDetail = ShopGoods
|
||||
|
||||
/** 规格选择状态 */
|
||||
export interface SpecSelection {
|
||||
specId: number
|
||||
specValueId: number
|
||||
}
|
||||
|
||||
/** 购物车商品项 */
|
||||
export interface CartItem {
|
||||
id?: number
|
||||
goodsId: number
|
||||
skuId?: number
|
||||
quantity: number
|
||||
product?: ShopGoods
|
||||
sku?: ShopGoodsSku
|
||||
checked?: boolean
|
||||
}
|
||||
Reference in New Issue
Block a user