@pisell/pisellos 2.3.153 → 2.3.155
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/modules/Order/index.d.ts +1 -1
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/solution/BaseSales/index.js +39 -12
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +2 -0
- package/dist/solution/UnifiedBookingSales/index.js +739 -644
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/solution/BaseSales/index.js +24 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +2 -0
- package/lib/solution/UnifiedBookingSales/index.js +36 -0
- package/package.json +1 -1
|
@@ -595,7 +595,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
595
595
|
generateIdempotencyToken(): string;
|
|
596
596
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
597
597
|
createOrder(params: CommitOrderParams['query']): {
|
|
598
|
-
type: "
|
|
598
|
+
type: "appointment_booking" | "virtual";
|
|
599
599
|
platform: string;
|
|
600
600
|
sales_channel: string;
|
|
601
601
|
order_sales_channel: string;
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "duration" | "normal" | "session";
|
|
53
53
|
}
|
|
@@ -1043,7 +1043,30 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
1043
1043
|
customerId: params.customerId,
|
|
1044
1044
|
channel: params.channel
|
|
1045
1045
|
});
|
|
1046
|
-
|
|
1046
|
+
const shouldAlignSelectedVariantPrice = handledByOsServer && this.preferAuthoritativeProductQueryPrice();
|
|
1047
|
+
return productIds.map((productId, index) => {
|
|
1048
|
+
const authoritativeProduct = productId === null ? null : productsById.get(productId) || null;
|
|
1049
|
+
if (!shouldAlignSelectedVariantPrice || !authoritativeProduct) return authoritativeProduct;
|
|
1050
|
+
const selectedProduct = selectedProducts[index];
|
|
1051
|
+
const selectedVariantId = this.getSelectedProductVariantId(selectedProduct);
|
|
1052
|
+
if (!selectedVariantId || this.getSelectedProductVariantId(authoritativeProduct) === selectedVariantId) {
|
|
1053
|
+
return authoritativeProduct;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
// OS 返回的是目录商品;已命中的智能价格不能被规格基础价覆盖。
|
|
1057
|
+
const appliedFields = authoritativeProduct._dataVariant?.appliedFields;
|
|
1058
|
+
if (Array.isArray(appliedFields) && ['price', 'selling_price', 'original_price', 'base_price'].some(field => appliedFields.includes(field))) {
|
|
1059
|
+
return authoritativeProduct;
|
|
1060
|
+
}
|
|
1061
|
+
const selectedVariant = Array.isArray(authoritativeProduct.variant) ? authoritativeProduct.variant.find(variant => Number(variant?.id) === selectedVariantId) : undefined;
|
|
1062
|
+
const selectedPrice = [selectedVariant?.price, selectedVariant?.selling_price, selectedVariant?.base_price, params.priceQueries[index].fallback_price, selectedProduct.price, selectedProduct.selling_price, selectedProduct.original_price].find(value => (typeof value === 'number' || typeof value === 'string' && value.trim() !== '') && Number.isFinite(Number(value)));
|
|
1063
|
+
|
|
1064
|
+
// 每行独立保留所选规格价格(含 0 元),避免同商品多规格共用目录对象串价。
|
|
1065
|
+
return selectedPrice === undefined ? authoritativeProduct : {
|
|
1066
|
+
...authoritativeProduct,
|
|
1067
|
+
price: selectedPrice
|
|
1068
|
+
};
|
|
1069
|
+
});
|
|
1047
1070
|
}
|
|
1048
1071
|
const queryPayload = this.buildPriceQueryPayload({
|
|
1049
1072
|
ids,
|
|
@@ -328,7 +328,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
328
328
|
date: string;
|
|
329
329
|
status: string;
|
|
330
330
|
week: string;
|
|
331
|
-
weekNum: 0 |
|
|
331
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
332
332
|
}[]>;
|
|
333
333
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
334
334
|
private getScheduleDataByIds;
|
|
@@ -375,7 +375,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
375
375
|
};
|
|
376
376
|
setOtherData(key: string, value: any): void;
|
|
377
377
|
getOtherData(key: string): any;
|
|
378
|
-
getProductTypeById(id: number): Promise<"
|
|
378
|
+
getProductTypeById(id: number): Promise<"duration" | "normal" | "session">;
|
|
379
379
|
/**
|
|
380
380
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
381
381
|
*
|
|
@@ -347,7 +347,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
347
347
|
* 获取当前的客户搜索条件
|
|
348
348
|
* @returns 当前搜索条件
|
|
349
349
|
*/
|
|
350
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
350
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
351
351
|
/**
|
|
352
352
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
353
353
|
* @returns 客户状态
|
|
@@ -147,6 +147,8 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
147
147
|
* 用于支付跳转等终态场景,避免浏览器返回时恢复已提交订单。
|
|
148
148
|
*/
|
|
149
149
|
clearSessionStorageOrderSnapshot(): void;
|
|
150
|
+
/** 在 Kiosk 拉起支付设备前补齐订单号,同一订单重试复用已分配的号码。 */
|
|
151
|
+
ensureLocalOrderNumbersForCheckout(): Promise<void>;
|
|
150
152
|
/**
|
|
151
153
|
* PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
152
154
|
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|
|
@@ -1691,6 +1691,42 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1691
1691
|
this.store.order?.clearSessionStoragePersistedTempOrder?.();
|
|
1692
1692
|
}
|
|
1693
1693
|
|
|
1694
|
+
/** 在 Kiosk 拉起支付设备前补齐订单号,同一订单重试复用已分配的号码。 */
|
|
1695
|
+
async ensureLocalOrderNumbersForCheckout() {
|
|
1696
|
+
if ((0, _platform.normalizeRuntimePlatform)(this.otherParams?.platform) !== 'kiosk') return;
|
|
1697
|
+
const order = this.store.order;
|
|
1698
|
+
const tempOrder = order?.getTempOrder();
|
|
1699
|
+
if (!tempOrder) throw new Error('当前订单不存在,无法生成订单编号');
|
|
1700
|
+
if (tempOrder.shop_order_number && tempOrder.shop_full_order_number) return;
|
|
1701
|
+
const biz = this.getBookingTicketBusinessCode();
|
|
1702
|
+
if (!biz) throw new Error('当前订单缺少业务类型,无法生成订单编号');
|
|
1703
|
+
const idGenerator = this.appPlugin?.getApp?.()?.getPlugin?.('idGenerator');
|
|
1704
|
+
if (!tempOrder.shop_order_number && typeof idGenerator?.generateShopOrderNumber !== 'function' || !tempOrder.shop_full_order_number && typeof idGenerator?.generateReceiptId !== 'function') {
|
|
1705
|
+
throw new Error('订单编号生成器不可用,请重启应用后重试');
|
|
1706
|
+
}
|
|
1707
|
+
try {
|
|
1708
|
+
if (!tempOrder.shop_order_number) {
|
|
1709
|
+
tempOrder.shop_order_number = await idGenerator.generateShopOrderNumber({
|
|
1710
|
+
biz
|
|
1711
|
+
});
|
|
1712
|
+
}
|
|
1713
|
+
if (!tempOrder.shop_full_order_number) {
|
|
1714
|
+
tempOrder.shop_full_order_number = await idGenerator.generateReceiptId({
|
|
1715
|
+
biz
|
|
1716
|
+
});
|
|
1717
|
+
}
|
|
1718
|
+
if (order.getTempOrder() !== tempOrder) {
|
|
1719
|
+
throw new Error('当前订单已切换,请重新发起支付');
|
|
1720
|
+
}
|
|
1721
|
+
if (!tempOrder.shop_order_number || !tempOrder.shop_full_order_number) {
|
|
1722
|
+
throw new Error('订单编号生成失败,请重试');
|
|
1723
|
+
}
|
|
1724
|
+
} finally {
|
|
1725
|
+
// 部分生成成功时也保留号码,后续只补仍然缺失的字段。
|
|
1726
|
+
if (order.getTempOrder() === tempOrder) order.persistTempOrder();
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1694
1730
|
/**
|
|
1695
1731
|
* PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
1696
1732
|
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|