fix(payment): 调整货到付款支付方式及状态逻辑
- 将支付方式默认值修改为8表示货到付款 - 删除前端创建订单时对payStatus和payTime的传递,改为后端自动处理 - 更新订单详情页支付方式映射,新增多种支付方式及货到付款标识 - 修改订单状态展示逻辑,针对货到付款订单调整状态标签和流程判断 - 优化订单列表卡片状态显示,支持货到付款的特殊显示需求 - 更新订单模型注释,统一支付方式编码及对应说明
This commit is contained in:
@@ -125,7 +125,7 @@ const CheckoutPage: React.FC = () => {
|
||||
const [rushBuyProducts, setRushBuyProducts] = useState<ShopGoods[]>([])
|
||||
|
||||
// 支付方式相关状态
|
||||
const [payType, setPayType] = useState<number>(0) // 0: 货到付款
|
||||
const [payType, setPayType] = useState<number>(8) // 8: 货到付款
|
||||
|
||||
// 从本地存储获取立即购买的数据
|
||||
const buyNowItems = useMemo(() => {
|
||||
@@ -263,19 +263,11 @@ const CheckoutPage: React.FC = () => {
|
||||
specInfo: item.skuSpec || item.sku?.sku || item.product?.specName,
|
||||
}))
|
||||
|
||||
// 格式化当前时间:yyyy-MM-dd HH:mm:ss(与后端 LocalDateTime 兼容)
|
||||
const now = new Date()
|
||||
const pad = (n: number) => n.toString().padStart(2, '0')
|
||||
const payTime = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`
|
||||
|
||||
// 创建订单
|
||||
// 货到付款:直接设置 payStatus=true + payTime,防止后端定时任务自动删除未付款订单
|
||||
// 货到付款:后端会自动设置 payStatus=true,无需前端传递 payStatus/payTime
|
||||
const orderParams: OrderCreateRequest = {
|
||||
goodsItems,
|
||||
addressId: defaultAddress.id,
|
||||
payType,
|
||||
payStatus: true,
|
||||
payTime,
|
||||
couponId: selectedCoupon?.id ? Number(selectedCoupon.id) : undefined,
|
||||
comments: remarks,
|
||||
deliveryType: 0, // 快递配送
|
||||
|
||||
Reference in New Issue
Block a user