forked from gxwebsoft/mp-10550
feat(shop): 添加套票活动功能并优化购买数量控制
- 在仓库模型中添加状态字段 - 实现套票活动最低购买量的灵活配置,优先取模板配置值 - 优化数量输入逻辑,支持套票活动下的默认数量设置 - 改进优惠券加载逻辑,使用初始数量对应总价进行推荐 - 修复商品信息加载顺序,确保套票模板数据正确应用 - 更新支付工具类中的仓库类型引用 - 调整数量输入组件的最小值和禁用状态逻辑
This commit is contained in:
@@ -3,7 +3,7 @@ import { createOrder, WxPayResult } from '@/api/shop/shopOrder';
|
||||
import { OrderCreateRequest } from '@/api/shop/shopOrder/model';
|
||||
import { getSelectedStoreFromStorage, getSelectedStoreIdFromStorage } from '@/utils/storeSelection';
|
||||
import type { ShopStoreRider } from '@/api/shop/shopStoreRider/model';
|
||||
import type { ShopWarehouse } from '@/api/shop/shopWarehouse/model';
|
||||
import type { ShopStoreWarehouse } from '@/api/shop/shopStoreWarehouse/model';
|
||||
import request from '@/utils/request';
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@ export interface PaymentCallback {
|
||||
export class PaymentHandler {
|
||||
// 简单缓存,避免频繁请求(小程序单次运行生命周期内有效)
|
||||
private static storeRidersCache = new Map<number, ShopStoreRider[]>();
|
||||
private static warehousesCache: ShopWarehouse[] | null = null;
|
||||
private static warehousesCache: ShopStoreWarehouse[] | null = null;
|
||||
|
||||
/**
|
||||
* 执行支付
|
||||
@@ -220,10 +220,10 @@ export class PaymentHandler {
|
||||
return sorted[0]?.userId;
|
||||
}
|
||||
|
||||
private static async getWarehouses(): Promise<ShopWarehouse[]> {
|
||||
private static async getWarehouses(): Promise<ShopStoreWarehouse[]> {
|
||||
if (this.warehousesCache) return this.warehousesCache;
|
||||
const list = await this.listByCompatEndpoint<ShopWarehouse>(
|
||||
['/shop/shop-warehouse'],
|
||||
const list = await this.listByCompatEndpoint<ShopStoreWarehouse>(
|
||||
['/shop/shop-store-warehouse'],
|
||||
{}
|
||||
);
|
||||
const usable = (list || []).filter(w => w?.isDelete !== 1 && (w.status === undefined || w.status === 1));
|
||||
|
||||
Reference in New Issue
Block a user