@pisell/pisellos 0.10.7 → 0.10.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.js +0 -1
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +287 -101
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +57 -26
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +18 -12
- package/dist/modules/BookingContext/utils/productExtend.js +5 -9
- package/dist/modules/BookingContext/utils/timeSlices.js +24 -3
- package/dist/modules/Customer/index.d.ts +4 -0
- package/dist/modules/Customer/index.js +91 -59
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +2 -0
- package/dist/modules/Discount/index.js +38 -5
- package/dist/modules/Discount/types.d.ts +11 -0
- package/dist/modules/Order/index.d.ts +32 -6
- package/dist/modules/Order/index.js +1165 -819
- package/dist/modules/Order/types.d.ts +32 -4
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +227 -0
- package/dist/modules/Order/utils/virtualSettlement.d.ts +56 -0
- package/dist/modules/Order/utils/virtualSettlement.js +271 -0
- package/dist/modules/Order/utils.js +89 -48
- package/dist/modules/Payment/types.d.ts +2 -0
- package/dist/modules/Payment/utils.js +4 -1
- package/dist/modules/Payment/walletpass.d.ts +11 -0
- package/dist/modules/Payment/walletpass.js +235 -60
- package/dist/modules/Product/types.d.ts +23 -0
- package/dist/modules/ProductList/index.d.ts +15 -2
- package/dist/modules/ProductList/index.js +92 -13
- package/dist/modules/Rules/index.js +125 -52
- package/dist/modules/SalesSummary/index.d.ts +1 -0
- package/dist/modules/SalesSummary/index.js +4 -3
- package/dist/modules/SalesSummary/types.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.js +28 -2
- package/dist/server/index.d.ts +15 -0
- package/dist/server/index.js +894 -781
- package/dist/server/modules/order/index.d.ts +2 -0
- package/dist/server/modules/order/index.js +261 -96
- package/dist/server/modules/order/types.d.ts +1 -1
- package/dist/server/utils/small-ticket.js +2 -1
- package/dist/solution/BaseSales/index.d.ts +41 -7
- package/dist/solution/BaseSales/index.js +1405 -974
- package/dist/solution/BaseSales/utils/cartPromotion.js +26 -3
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +79 -13
- package/dist/solution/BaseSales/utils.js +31 -20
- package/dist/solution/BookingByStep/index.d.ts +3 -3
- package/dist/solution/BookingTicket/index.d.ts +5 -1
- package/dist/solution/BookingTicket/index.js +221 -162
- package/dist/solution/BookingTicket/types.d.ts +3 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +2 -1
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +16 -2
- package/dist/solution/ScanOrder/index.js +25 -64
- package/dist/solution/ScanOrder/utils.js +31 -20
- package/dist/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/dist/solution/UnifiedBookingSales/index.js +51 -39
- package/lib/core/index.js +0 -1
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +170 -7
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/lib/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +62 -11
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +6 -1
- package/lib/modules/BookingContext/utils/productExtend.js +4 -3
- package/lib/modules/BookingContext/utils/timeSlices.js +18 -3
- package/lib/modules/Customer/index.d.ts +4 -0
- package/lib/modules/Customer/index.js +11 -0
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +2 -0
- package/lib/modules/Discount/index.js +37 -3
- package/lib/modules/Discount/types.d.ts +11 -0
- package/lib/modules/Order/index.d.ts +32 -6
- package/lib/modules/Order/index.js +518 -148
- package/lib/modules/Order/types.d.ts +32 -4
- package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +170 -0
- package/lib/modules/Order/utils/virtualSettlement.d.ts +56 -0
- package/lib/modules/Order/utils/virtualSettlement.js +300 -0
- package/lib/modules/Order/utils.js +65 -21
- package/lib/modules/Payment/types.d.ts +2 -0
- package/lib/modules/Payment/utils.js +5 -1
- package/lib/modules/Payment/walletpass.d.ts +11 -0
- package/lib/modules/Payment/walletpass.js +198 -17
- package/lib/modules/Product/types.d.ts +23 -0
- package/lib/modules/ProductList/index.d.ts +15 -2
- package/lib/modules/ProductList/index.js +85 -3
- package/lib/modules/Rules/index.js +100 -20
- package/lib/modules/SalesSummary/index.d.ts +1 -0
- package/lib/modules/SalesSummary/index.js +10 -2
- package/lib/modules/SalesSummary/types.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.js +30 -2
- package/lib/server/index.d.ts +15 -0
- package/lib/server/index.js +105 -14
- package/lib/server/modules/order/index.d.ts +2 -0
- package/lib/server/modules/order/index.js +75 -5
- package/lib/server/modules/order/types.d.ts +1 -1
- package/lib/server/utils/small-ticket.js +1 -1
- package/lib/solution/BaseSales/index.d.ts +41 -7
- package/lib/solution/BaseSales/index.js +325 -39
- package/lib/solution/BaseSales/utils/cartPromotion.js +26 -2
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +62 -12
- package/lib/solution/BaseSales/utils.js +29 -18
- package/lib/solution/BookingByStep/index.d.ts +3 -3
- package/lib/solution/BookingTicket/index.d.ts +5 -1
- package/lib/solution/BookingTicket/index.js +31 -6
- package/lib/solution/BookingTicket/types.d.ts +3 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +2 -1
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +15 -3
- package/lib/solution/ScanOrder/index.js +17 -54
- package/lib/solution/ScanOrder/utils.js +29 -18
- package/lib/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/lib/solution/UnifiedBookingSales/index.js +35 -26
- package/package.json +1 -1
|
@@ -568,7 +568,7 @@ export interface OrderChangedPayload {
|
|
|
568
568
|
/** 触发来源,便于订阅者区分 pubsub / 远端覆盖 / 清空等场景 */
|
|
569
569
|
source?: string;
|
|
570
570
|
}
|
|
571
|
-
export type RemoteProductMembershipChangeSource = 'pubsub.bodyUpsert' | 'pubsub.httpRefresh';
|
|
571
|
+
export type RemoteProductMembershipChangeSource = 'pubsub.bodyUpsert' | 'pubsub.httpRefresh' | 'manual.editOpenRemoteCheck';
|
|
572
572
|
/**
|
|
573
573
|
* 远端订单快照相对本地订单产生商品成员增删时的广播载荷。
|
|
574
574
|
* 只表达商品行成员关系变化,不包含数量、价格、备注等字段级修改。
|
|
@@ -619,7 +619,8 @@ function formatBundlePrice(bundle, currencySymbol) {
|
|
|
619
619
|
var _ref33, _ref34, _bundle$bundle_sellin;
|
|
620
620
|
var value = (_ref33 = (_ref34 = (_bundle$bundle_sellin = bundle.bundle_selling_price) !== null && _bundle$bundle_sellin !== void 0 ? _bundle$bundle_sellin : bundle.bundle_sum_price) !== null && _ref34 !== void 0 ? _ref34 : bundle.price) !== null && _ref33 !== void 0 ? _ref33 : 0;
|
|
621
621
|
var amount = new Decimal(toMoneyNumber(value));
|
|
622
|
-
|
|
622
|
+
// 套餐价格协议:只有 markdown 是减价;加价与商品原价都保持正数。
|
|
623
|
+
var isNegative = bundle.price_type === 'markdown';
|
|
623
624
|
if (isNegative) return "-".concat(currencySymbol).concat(amount.abs().toFixed(2));
|
|
624
625
|
return formatMoney(amount, currencySymbol);
|
|
625
626
|
}
|
|
@@ -2,9 +2,9 @@ import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
|
2
2
|
import { BaseModule } from '../../modules/BaseModule';
|
|
3
3
|
import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentStatus, BaseSalesUpdateOrderProductQuantityParams, BaseSalesCalculateProductBookingPriceParams, BaseSalesPriceRecalculationContextChange, BaseSalesProductBookingPriceResult, BaseSalesQuotationCustomerScopeInfo, BaseSalesScanCodeResult, BaseSalesCashPaymentConfig, BaseSalesPayCashParams, BaseSalesPayCashResult, BaseSalesCommitPaymentMethodParams, BaseSalesCommitPaymentMethodResult, BaseSalesConfirmWalletPaymentResult } from './types';
|
|
4
4
|
import { OrderModule } from '../../modules/Order';
|
|
5
|
-
import type { AddProductBookingInput, LoadSalesDetailParams, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from '../../modules/Order/types';
|
|
5
|
+
import type { AddProductBookingInput, AddProductToOrderOptions, LoadSalesDetailParams, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, ReplaceTempOrderOptions } from '../../modules/Order/types';
|
|
6
6
|
import type { SubmitPayloadEnhancer } from '../../modules/Order/utils';
|
|
7
|
-
import type { Discount } from '../../modules/Discount/types';
|
|
7
|
+
import type { Discount, VirtualCurrencyAsset } from '../../modules/Discount/types';
|
|
8
8
|
import { RequestPlugin, WindowPlugin } from '../../plugins';
|
|
9
9
|
export * from './types';
|
|
10
10
|
import { ProductList } from '../../modules/ProductList';
|
|
@@ -109,6 +109,25 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
109
109
|
private applyQuotationScheduleResolver;
|
|
110
110
|
private loadQuotationForPriceQuery;
|
|
111
111
|
private getPriceQueryProductId;
|
|
112
|
+
/**
|
|
113
|
+
* Change Time / customer reprice 必须沿用商品列表的渠道口径。
|
|
114
|
+
* SalesSdk Provider 通常将渠道存为 platform,因此不能只读取 otherParams.channel。
|
|
115
|
+
*/
|
|
116
|
+
private getPriceQueryChannel;
|
|
117
|
+
/**
|
|
118
|
+
* /product/query 的智能定价评估只读取 strategy_context;
|
|
119
|
+
* application_code 仅作为接口兼容字段,不能替代 channel / business_code。
|
|
120
|
+
*/
|
|
121
|
+
private getPriceQueryStrategyContext;
|
|
122
|
+
/**
|
|
123
|
+
* 子类可在商品重报价前准备客户维度的策略上下文,例如等待 Wallet/优惠资产加载。
|
|
124
|
+
*/
|
|
125
|
+
protected prepareProductPriceQueryContext(_customerId?: number | string): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* 默认保留 BaseSales 的 legacy quotation 行为;已由 /product/query 统一完成
|
|
128
|
+
* 智能定价与报价合并的业务可在子类中覆盖,避免二次覆盖权威价格。
|
|
129
|
+
*/
|
|
130
|
+
protected preferAuthoritativeProductQueryPrice(): boolean;
|
|
112
131
|
private getPriceQuerySchedule;
|
|
113
132
|
private loadProductsForPriceQuery;
|
|
114
133
|
private loadProductForPriceQuery;
|
|
@@ -156,6 +175,9 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
156
175
|
protected setPaymentNumberDevicePrefix(prefix: unknown): void;
|
|
157
176
|
private getPaymentNumberDevicePrefixSync;
|
|
158
177
|
private getPaymentNumberDevicePrefixAsync;
|
|
178
|
+
private isMultiCurrencySettlementEnabled;
|
|
179
|
+
private isActiveVirtualSettlementOrder;
|
|
180
|
+
private isHistoricalVirtualSettlementOrder;
|
|
159
181
|
private syncAppDataToTempOrder;
|
|
160
182
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
161
183
|
destroy(): Promise<void>;
|
|
@@ -182,7 +204,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
182
204
|
/** 获取附加费用(运费/服务费/税费等)。 */
|
|
183
205
|
getSurcharges(): ISalesSurcharge[];
|
|
184
206
|
getTempOrder(): OrderTempOrder | null;
|
|
185
|
-
replaceTempOrder(tempOrder: OrderTempOrder): Promise<OrderTempOrder>;
|
|
207
|
+
replaceTempOrder(tempOrder: OrderTempOrder, options?: ReplaceTempOrderOptions): Promise<OrderTempOrder>;
|
|
186
208
|
getOrderIdentity(): import("../../modules/Order/types").OrderIdentitySnapshot | null;
|
|
187
209
|
getOrderSnapshot(): import("../../modules/Order/types").OrderSnapshot | null;
|
|
188
210
|
getOrderSyncState(): import("../../modules/Order/types").OrderSyncState;
|
|
@@ -208,6 +230,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
208
230
|
* 同步清空内存中的 salesDetail 商品/预约视图,避免编辑态仍读到旧 bookings。
|
|
209
231
|
*/
|
|
210
232
|
clearOrderCartLines(): Promise<OrderTempOrder>;
|
|
233
|
+
/** 切换法币 / WalletPass 单位时清空商品、折扣与支付状态,保留客户。 */
|
|
234
|
+
clearOrderForSettlementSwitch(): Promise<OrderTempOrder>;
|
|
211
235
|
getOrderProducts(): import("../../modules/Order/types").OrderProduct[];
|
|
212
236
|
getSummary(): Promise<OrderSummary>;
|
|
213
237
|
private getHistoricalProductDiscountList;
|
|
@@ -218,12 +242,15 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
218
242
|
loadDiscountConfig(params?: {
|
|
219
243
|
customerId?: number;
|
|
220
244
|
action?: 'create' | 'edit';
|
|
245
|
+
force?: boolean;
|
|
221
246
|
}): Promise<{
|
|
222
247
|
productList: Record<string, any>[];
|
|
223
248
|
discountList: Discount[];
|
|
224
249
|
availableWalletIds: number[];
|
|
250
|
+
virtualCurrencyList: VirtualCurrencyAsset[];
|
|
225
251
|
}>;
|
|
226
252
|
getAvailableWalletIds(): number[];
|
|
253
|
+
getVirtualCurrencyList(): VirtualCurrencyAsset[];
|
|
227
254
|
bestDiscount(cb?: (result: any) => void): Promise<{
|
|
228
255
|
productList: Record<string, any>[];
|
|
229
256
|
discountList: Discount[];
|
|
@@ -255,6 +282,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
255
282
|
confirmPendingVoucherPayments?: boolean;
|
|
256
283
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
257
284
|
}): Promise<T>;
|
|
285
|
+
private buildVirtualSettlementSubmitData;
|
|
258
286
|
/**
|
|
259
287
|
* 提交当前 Sales 订单。
|
|
260
288
|
*
|
|
@@ -354,6 +382,11 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
354
382
|
selected: boolean;
|
|
355
383
|
source?: WalletAssetSelectionSource;
|
|
356
384
|
}): Promise<WalletAssetsState>;
|
|
385
|
+
/** 更新已选钱包资产的手动使用金额,并同步 pending payment。 */
|
|
386
|
+
updateWalletAssetAmount(params: {
|
|
387
|
+
assetId: WalletAssetId;
|
|
388
|
+
amount: number;
|
|
389
|
+
}): Promise<WalletAssetsState>;
|
|
357
390
|
/** 扫码精确查券;仅可用资产会被自动选中。 */
|
|
358
391
|
scanWalletAsset(code: string): Promise<ScanWalletAssetResult>;
|
|
359
392
|
/** 清空全部未确认钱包选择,已支付钱包项由 Order 模块继续保留。 */
|
|
@@ -421,9 +454,10 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
421
454
|
transformBaseProductToOrderProduct(params: TransformBaseProductToOrderProductParams): import("./utils/transformBaseProductToOrderProduct").BaseProductOrderProductInput | null;
|
|
422
455
|
calculateProductBookingPrice(params: BaseSalesCalculateProductBookingPriceParams): Promise<BaseSalesProductBookingPriceResult>;
|
|
423
456
|
getQuotationCustomerScopeInfo(): BaseSalesQuotationCustomerScopeInfo;
|
|
457
|
+
private hasSmartPricingStrategies;
|
|
424
458
|
shouldRecalculateProductBookingPricesForContextChange(params: BaseSalesPriceRecalculationContextChange): boolean;
|
|
425
459
|
calculateProductBookingPrices(paramsList: BaseSalesCalculateProductBookingPriceParams[]): Promise<BaseSalesProductBookingPriceResult[]>;
|
|
426
|
-
addProductToOrder(product: Partial<BaseSalesOrderProduct> & BaseSalesOrderProductIdentity, booking?: AddProductBookingInput): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
460
|
+
addProductToOrder(product: Partial<BaseSalesOrderProduct> & BaseSalesOrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
427
461
|
updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
428
462
|
updateOrderProducts(paramsList: UpdateOrderProductParams[]): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
429
463
|
updateOrderProductQuantity(params: BaseSalesUpdateOrderProductQuantityParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
@@ -439,8 +473,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
439
473
|
* @example
|
|
440
474
|
* await baseSales.removeProductsFromOrder([identityA, identityB]);
|
|
441
475
|
*/
|
|
442
|
-
removeProductsFromOrder(identities: BaseSalesOrderProductIdentity[]): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
443
|
-
removeProductFromOrder(identity: BaseSalesOrderProductIdentity): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
476
|
+
removeProductsFromOrder(identities: BaseSalesOrderProductIdentity[], options?: RemoveProductsFromOrderOptions): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
477
|
+
removeProductFromOrder(identity: BaseSalesOrderProductIdentity, options?: RemoveProductsFromOrderOptions): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
444
478
|
/**
|
|
445
479
|
* 注入促销评估器到底层 OrderModule。
|
|
446
480
|
*
|
|
@@ -470,7 +504,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
470
504
|
getUnfulfilledPromotions(): OrderUnfulfilledPromotion[];
|
|
471
505
|
/** 最近一次促销计算输出的赠品操作 diff。 */
|
|
472
506
|
getLastGiftActions(): OrderLastGiftActions | null;
|
|
473
|
-
getProductList(): Promise<
|
|
507
|
+
getProductList(): Promise<import("../..").ProductData[] | undefined>;
|
|
474
508
|
getOtherParams(): Record<string, any>;
|
|
475
509
|
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
476
510
|
cover?: boolean;
|