@pisell/pisellos 2.3.231 → 2.3.233
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/Customer/types.d.ts +4 -0
- package/dist/modules/Order/index.d.ts +10 -1
- package/dist/modules/Order/index.js +1350 -1133
- package/dist/modules/Order/types.d.ts +3 -0
- package/dist/modules/Order/utils/bookingUuid.d.ts +4 -0
- package/dist/modules/Order/utils/bookingUuid.js +24 -0
- package/dist/modules/Order/utils/virtualSettlement.d.ts +4 -0
- package/dist/modules/Order/utils/virtualSettlement.js +13 -0
- package/dist/modules/Order/utils.js +11 -6
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/shared/payment/loadPaymentMethods.d.ts +4 -1
- package/dist/shared/payment/loadPaymentMethods.js +35 -2
- package/dist/solution/BaseSales/index.d.ts +1 -0
- package/dist/solution/BaseSales/index.js +516 -423
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/utils/redeemArrival.d.ts +14 -13
- package/dist/solution/Checkout/index.js +104 -69
- package/dist/solution/Checkout/types.d.ts +1 -0
- package/dist/solution/ScanOrder/index.js +10 -2
- package/dist/solution/VenueBooking/index.js +522 -490
- package/dist/utils/platform.d.ts +1 -0
- package/dist/utils/platform.js +4 -0
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/Customer/types.d.ts +4 -0
- package/lib/modules/Order/index.d.ts +10 -1
- package/lib/modules/Order/index.js +141 -20
- package/lib/modules/Order/types.d.ts +3 -0
- package/lib/modules/Order/utils/bookingUuid.d.ts +4 -0
- package/lib/modules/Order/utils/bookingUuid.js +25 -0
- package/lib/modules/Order/utils/virtualSettlement.d.ts +4 -0
- package/lib/modules/Order/utils/virtualSettlement.js +9 -1
- package/lib/modules/Order/utils.js +13 -5
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/shared/payment/loadPaymentMethods.d.ts +4 -1
- package/lib/shared/payment/loadPaymentMethods.js +13 -0
- package/lib/solution/BaseSales/index.d.ts +1 -0
- package/lib/solution/BaseSales/index.js +49 -10
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/utils/redeemArrival.d.ts +14 -13
- package/lib/solution/Checkout/index.js +21 -0
- package/lib/solution/Checkout/types.d.ts +1 -0
- package/lib/solution/ScanOrder/index.js +6 -0
- package/lib/solution/VenueBooking/index.js +6 -1
- package/lib/utils/platform.d.ts +1 -0
- package/lib/utils/platform.js +5 -0
- package/package.json +1 -1
|
@@ -223,6 +223,9 @@ function mergeBaseSalesCollectionItem(kind, currentItem, incomingItem, uidRemaps
|
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
const mergedItem = mergedUid ? (0, _orderCollectionIdentity.setOrderCollectionUid)(kind, incomingItem, mergedUid) : (0, _lodashEs.cloneDeep)(incomingItem);
|
|
226
|
+
if (kind === 'booking' && !mergedItem.uuid && currentItem.uuid !== undefined) {
|
|
227
|
+
mergedItem.uuid = currentItem.uuid;
|
|
228
|
+
}
|
|
226
229
|
const persistentIdField = BASE_SALES_PERSISTENT_ID_FIELD_BY_KIND[kind];
|
|
227
230
|
if (isBaseSalesBlankValue(mergedItem[persistentIdField]) && !isBaseSalesBlankValue(identityMergedItem[persistentIdField])) {
|
|
228
231
|
mergedItem[persistentIdField] = identityMergedItem[persistentIdField];
|
|
@@ -749,6 +752,9 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
749
752
|
if (!effects || typeof effects.on !== 'function') return;
|
|
750
753
|
this.paymentMethodsChangedUnsubscribe = effects.on(PAYMENT_METHODS_CHANGED_EVENT, async payload => {
|
|
751
754
|
if (!Array.isArray(payload?.newMethods)) return;
|
|
755
|
+
if (this.isMultiCurrencySettlementEnabled() && (0, _platform.isPosTerminalPlatform)(this.otherParams?.platform)) {
|
|
756
|
+
this.store.order?.syncPosVirtualCurrencyPaymentMethods(payload.newMethods);
|
|
757
|
+
}
|
|
752
758
|
await this.getPaymentMethodsAsync();
|
|
753
759
|
});
|
|
754
760
|
}
|
|
@@ -2834,8 +2840,7 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
2834
2840
|
currencyFormat: String(tempOrder?.currency_format || 'symbol_first')
|
|
2835
2841
|
};
|
|
2836
2842
|
}
|
|
2837
|
-
async buildVirtualSettlementSubmitData() {
|
|
2838
|
-
const settlement = this.buildVirtualSettlementOrderData();
|
|
2843
|
+
async buildVirtualSettlementSubmitData(settlement, posPaymentMethod) {
|
|
2839
2844
|
if (!settlement || !this.store.order) return null;
|
|
2840
2845
|
const tempOrder = this.store.order.getTempOrder();
|
|
2841
2846
|
const {
|
|
@@ -2846,6 +2851,9 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
2846
2851
|
});
|
|
2847
2852
|
const amount = new _decimal.default(summary?.total_amount || 0).toDecimalPlaces(2);
|
|
2848
2853
|
const customerId = Number(tempOrder?.customer_id || 0);
|
|
2854
|
+
if (posPaymentMethod && amount.gt(0) && !(customerId > 1)) {
|
|
2855
|
+
throw new _virtualSettlement.VirtualCurrencyCustomerRequiredError();
|
|
2856
|
+
}
|
|
2849
2857
|
if (amount.gt(0) && customerId > 0 && customerId !== 1) {
|
|
2850
2858
|
await this.store.order.loadDiscountConfig({
|
|
2851
2859
|
customerId,
|
|
@@ -2862,16 +2870,16 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
2862
2870
|
};
|
|
2863
2871
|
}
|
|
2864
2872
|
if (!asset) {
|
|
2865
|
-
throw new
|
|
2873
|
+
throw new _virtualSettlement.VirtualCurrencyAssetNotFoundError(currencyProductId);
|
|
2866
2874
|
}
|
|
2867
2875
|
const balance = new _decimal.default(asset.balance || 0);
|
|
2868
2876
|
if (balance.lt(amount)) {
|
|
2869
|
-
throw new
|
|
2877
|
+
throw new _virtualSettlement.VirtualCurrencyBalanceError(balance.toFixed(2), amount.toFixed(2));
|
|
2870
2878
|
}
|
|
2871
2879
|
const amountText = amount.toFixed(2);
|
|
2872
2880
|
const paymentNumber = `LOCAL_${(0, _utils.createUuidV4)()}`;
|
|
2873
2881
|
let payment;
|
|
2874
|
-
if (this.store.order.isOnlineStorePlatform()) {
|
|
2882
|
+
if (!posPaymentMethod && this.store.order.isOnlineStorePlatform()) {
|
|
2875
2883
|
payment = {
|
|
2876
2884
|
payment_number: paymentNumber,
|
|
2877
2885
|
amount: amount.toNumber(),
|
|
@@ -2887,8 +2895,7 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
2887
2895
|
wallet_pass_use_value: amountText
|
|
2888
2896
|
};
|
|
2889
2897
|
} else {
|
|
2890
|
-
const
|
|
2891
|
-
const paymentMethod = paymentMethods.find(method => String(method.code || '').toUpperCase() === 'PRODUCTVOUCHER');
|
|
2898
|
+
const paymentMethod = posPaymentMethod ?? (await this.getPaymentMethodsAsync()).find(method => String(method.code || '').toUpperCase() === 'PRODUCTVOUCHER');
|
|
2892
2899
|
if (!paymentMethod) {
|
|
2893
2900
|
throw new Error('PRODUCTVOUCHER payment method is unavailable.');
|
|
2894
2901
|
}
|
|
@@ -2932,8 +2939,21 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
2932
2939
|
freeze: true
|
|
2933
2940
|
});
|
|
2934
2941
|
const isDeferredPayment = params?.paymentExecution === 'deferred';
|
|
2935
|
-
const
|
|
2936
|
-
const
|
|
2942
|
+
const checkoutOrder = this.store.order.getTempOrder();
|
|
2943
|
+
const virtualOrderData = this.buildVirtualSettlementOrderData();
|
|
2944
|
+
const checkoutCustomerId = checkoutOrder?.customer_id;
|
|
2945
|
+
const checkoutSettlementKey = (0, _virtualSettlement.getTempOrderSettlementKey)(checkoutOrder);
|
|
2946
|
+
const posPaymentMethod = virtualOrderData && (0, _platform.isPosTerminalPlatform)(this.otherParams?.platform) ? this.store.order.getPosVirtualCurrencyPaymentMethod(this.getPaymentMethods()) : undefined;
|
|
2947
|
+
const readCheckoutLines = () => checkoutOrder?.products.map(product => [String(product.product_id), String(product.product_variant_id ?? 0), Number(product.num ?? 1)]);
|
|
2948
|
+
const checkoutLines = posPaymentMethod && !isDeferredPayment ? readCheckoutLines() : undefined;
|
|
2949
|
+
const assertCheckoutCartUnchanged = () => {
|
|
2950
|
+
if (posPaymentMethod && (this.store.order?.getTempOrder() !== checkoutOrder || checkoutOrder?.customer_id !== checkoutCustomerId || (0, _virtualSettlement.getTempOrderSettlementKey)(checkoutOrder) !== checkoutSettlementKey || checkoutLines && !(0, _lodashEs.isEqual)(readCheckoutLines(), checkoutLines))) {
|
|
2951
|
+
throw (0, _inventory.salesGuardError)('The cart changed. Please try again.');
|
|
2952
|
+
}
|
|
2953
|
+
};
|
|
2954
|
+
const virtualPaymentSettlement = isDeferredPayment ? null : await this.buildVirtualSettlementSubmitData(virtualOrderData, posPaymentMethod);
|
|
2955
|
+
assertCheckoutCartUnchanged();
|
|
2956
|
+
const virtualSettlement = isDeferredPayment ? virtualOrderData : virtualPaymentSettlement;
|
|
2937
2957
|
// this.store.order.persistTempOrder();
|
|
2938
2958
|
const inferredPaymentStatus = isDeferredPayment ? undefined : this.getSubmitPaymentStatus(params?.paymentStatus);
|
|
2939
2959
|
const smallTicketDataFlag = params?.smallTicketDataFlag ?? this.getDefaultCheckoutSmallTicketDataFlag();
|
|
@@ -2998,6 +3018,15 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
2998
3018
|
...(virtualSettlement ? {
|
|
2999
3019
|
enhancePayload: (payload, ctx) => {
|
|
3000
3020
|
const callerPayload = enhancePayload ? enhancePayload(payload, ctx) : payload;
|
|
3021
|
+
if (posPaymentMethod && virtualPaymentSettlement) {
|
|
3022
|
+
assertCheckoutCartUnchanged();
|
|
3023
|
+
const summary = callerPayload.summary ?? payload.summary;
|
|
3024
|
+
const orderAmount = _decimal.default.max(0, summary?.total_amount ?? 0).toDecimalPlaces(2);
|
|
3025
|
+
const payment = callerPayload.payments?.find(item => item.code === posPaymentMethod.code);
|
|
3026
|
+
if (!orderAmount.eq(payment?.amount ?? 0)) {
|
|
3027
|
+
throw (0, _inventory.salesGuardError)('The cart changed. Please try again.');
|
|
3028
|
+
}
|
|
3029
|
+
}
|
|
3001
3030
|
const currencySettlementConfig = callerPayload.metadata?.currency_settlement_config || {};
|
|
3002
3031
|
return {
|
|
3003
3032
|
...callerPayload,
|
|
@@ -3019,7 +3048,8 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
3019
3048
|
enhancePayload
|
|
3020
3049
|
} : {})
|
|
3021
3050
|
};
|
|
3022
|
-
|
|
3051
|
+
const waitForVirtualPayment = Boolean(posPaymentMethod && virtualPaymentSettlement?.payments.length);
|
|
3052
|
+
return !waitForVirtualPayment && this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams);
|
|
3023
3053
|
}
|
|
3024
3054
|
pendingLocalEftposFinalizations = new Map();
|
|
3025
3055
|
async finalizeLocalEftposPayment(params) {
|
|
@@ -3919,6 +3949,15 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
3919
3949
|
getPaymentMethods() {
|
|
3920
3950
|
return [...this.paymentMethodsCache];
|
|
3921
3951
|
}
|
|
3952
|
+
async hasPosVirtualCurrencyPaymentMethod() {
|
|
3953
|
+
if (!this.store.order) return false;
|
|
3954
|
+
try {
|
|
3955
|
+
await this.store.order.refreshPosVirtualCurrencyPaymentMethod();
|
|
3956
|
+
return true;
|
|
3957
|
+
} catch {
|
|
3958
|
+
return false;
|
|
3959
|
+
}
|
|
3960
|
+
}
|
|
3922
3961
|
findCashPaymentMethod(paymentMethods, paymentMethodId) {
|
|
3923
3962
|
return paymentMethods.find(method => {
|
|
3924
3963
|
if (method?.enabled === false || method?.enable === false) return false;
|
|
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
342
342
|
date: string;
|
|
343
343
|
status: string;
|
|
344
344
|
week: string;
|
|
345
|
-
weekNum: 0 |
|
|
345
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
346
346
|
}[]>;
|
|
347
347
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
348
348
|
private getScheduleDataByIds;
|
|
@@ -389,7 +389,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
389
389
|
};
|
|
390
390
|
setOtherData(key: string, value: any): void;
|
|
391
391
|
getOtherData(key: string): any;
|
|
392
|
-
getProductTypeById(id: number): Promise<"
|
|
392
|
+
getProductTypeById(id: number): Promise<"duration" | "normal" | "session">;
|
|
393
393
|
/**
|
|
394
394
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
395
395
|
*
|
|
@@ -24,32 +24,30 @@ export declare function buildArrivalCheckoutQuery(order: OrderTempOrder, summary
|
|
|
24
24
|
products: import("../../../modules/Order/types").OrderSubmitProduct[];
|
|
25
25
|
notes?: import("../../../modules/Order/types").SalesNote[] | undefined;
|
|
26
26
|
summary?: import("../../../modules/Order/types").OrderSummary | undefined;
|
|
27
|
+
product_tax_fee?: string | undefined;
|
|
27
28
|
small_ticket_data_flag?: number | undefined;
|
|
28
|
-
|
|
29
|
+
status: string;
|
|
29
30
|
metadata: Record<string, any>;
|
|
31
|
+
business_code?: string | undefined;
|
|
32
|
+
customer_id: number | null;
|
|
33
|
+
type: string;
|
|
30
34
|
holder: Record<string, any> | null;
|
|
35
|
+
email: string;
|
|
36
|
+
phone: string;
|
|
31
37
|
note: string;
|
|
32
|
-
|
|
33
|
-
bookings: any[];
|
|
34
|
-
payments: any[];
|
|
35
|
-
contacts_info: Record<string, any> | null;
|
|
36
|
-
order_meta_list?: import("../../../modules/Order/types").OrderMetaList | undefined;
|
|
37
|
-
refunds?: any[] | undefined;
|
|
38
|
+
relation_forms: any[];
|
|
38
39
|
holder_relations?: import("../../../modules/Order/types").OrderHolderRelation[] | undefined;
|
|
40
|
+
country_calling_code: string;
|
|
41
|
+
contacts_info: Record<string, any> | null;
|
|
39
42
|
order_id: number | null;
|
|
40
43
|
external_sale_number: string;
|
|
41
44
|
order_number: string | null;
|
|
42
45
|
shop_order_number: string | null;
|
|
43
46
|
shop_full_order_number: string | null;
|
|
44
|
-
business_code?: string | undefined;
|
|
45
47
|
sales_channel: string;
|
|
46
48
|
order_sales_channel: string;
|
|
47
49
|
shipping_status: string;
|
|
48
|
-
customer_id: number | null;
|
|
49
50
|
customer_name: string;
|
|
50
|
-
country_calling_code: string;
|
|
51
|
-
phone: string;
|
|
52
|
-
email: string;
|
|
53
51
|
is_price_include_tax: number;
|
|
54
52
|
tax_title: string;
|
|
55
53
|
tax_country_code: string;
|
|
@@ -64,8 +62,11 @@ export declare function buildArrivalCheckoutQuery(order: OrderTempOrder, summary
|
|
|
64
62
|
delivery_type?: string | undefined;
|
|
65
63
|
table_number?: Record<string, any> | undefined;
|
|
66
64
|
schedule_date: string;
|
|
65
|
+
bookings: any[];
|
|
66
|
+
payments: any[];
|
|
67
|
+
order_meta_list?: import("../../../modules/Order/types").OrderMetaList | undefined;
|
|
68
|
+
refunds?: any[] | undefined;
|
|
67
69
|
surcharges: any[];
|
|
68
|
-
relation_forms: any[];
|
|
69
70
|
contacts: any[];
|
|
70
71
|
};
|
|
71
72
|
export declare function describeChangedBookings(before: OrderTempOrder['bookings'], after: OrderTempOrder['bookings']): {
|
|
@@ -10,6 +10,8 @@ exports.CheckoutImpl = void 0;
|
|
|
10
10
|
var _BaseModule = require("../../modules/BaseModule");
|
|
11
11
|
var _decimal = _interopRequireDefault(require("decimal.js"));
|
|
12
12
|
var _Order = require("../../modules/Order");
|
|
13
|
+
var _bookingUuid = require("../../modules/Order/utils/bookingUuid");
|
|
14
|
+
var _orderCollectionIdentity = require("../../modules/Order/utils/orderCollectionIdentity");
|
|
13
15
|
var _Payment = require("../../modules/Payment");
|
|
14
16
|
var _types = require("./types");
|
|
15
17
|
Object.keys(_types).forEach(function (key) {
|
|
@@ -458,6 +460,7 @@ class CheckoutImpl extends _BaseModule.BaseModule {
|
|
|
458
460
|
params.orderData.tax_fee = params.totalInfo?.total?.tax;
|
|
459
461
|
|
|
460
462
|
// 保存原始订单数据和小计数据到状态中
|
|
463
|
+
params.orderData.bookings?.forEach(_bookingUuid.assignBookingUuid);
|
|
461
464
|
this.store.localOrderData = params.orderData;
|
|
462
465
|
this.store.cartSummary = params.cartSummary;
|
|
463
466
|
|
|
@@ -590,6 +593,24 @@ class CheckoutImpl extends _BaseModule.BaseModule {
|
|
|
590
593
|
// 保留原有支付项:通过 orderId 找到现有订单(按 id 或 order_id 匹配)
|
|
591
594
|
const allOrders = await this.payment.getOrderListAsync();
|
|
592
595
|
const existingOrder = allOrders.find(o => String(o.id) === String(params.orderId) || String(o.order_id) === String(params.orderId));
|
|
596
|
+
|
|
597
|
+
// POS 再次保存会重建预约行;按已有行标识复用上次保存的 UUID。
|
|
598
|
+
const previousBookings = existingOrder?.order_info?.original_order_data?.bookings;
|
|
599
|
+
const previousUuids = new Map();
|
|
600
|
+
if (Array.isArray(previousBookings)) {
|
|
601
|
+
for (const booking of previousBookings) {
|
|
602
|
+
const uid = (0, _orderCollectionIdentity.getOrderCollectionUid)('booking', booking);
|
|
603
|
+
if (uid && booking.uuid !== undefined) previousUuids.set(uid, booking.uuid);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
for (const booking of params.orderData.bookings || []) {
|
|
607
|
+
const uid = (0, _orderCollectionIdentity.getOrderCollectionUid)('booking', booking);
|
|
608
|
+
if (uid && previousUuids.has(uid)) {
|
|
609
|
+
booking.uuid ?? (booking.uuid = previousUuids.get(uid));
|
|
610
|
+
previousUuids.delete(uid);
|
|
611
|
+
}
|
|
612
|
+
(0, _bookingUuid.assignBookingUuid)(booking);
|
|
613
|
+
}
|
|
593
614
|
if (existingOrder) {
|
|
594
615
|
// 🔧 新增: 如果传入了 existPayment,需要更新支付项列表
|
|
595
616
|
if (params.existPayment && params.existPayment.length > 0) {
|
|
@@ -881,12 +881,18 @@ class ScanOrderImpl extends _BaseSales.BaseSalesImpl {
|
|
|
881
881
|
let bookings = payload.bookings || [];
|
|
882
882
|
let scheduleDate = payload.schedule_date;
|
|
883
883
|
if (!tempOrder.order_id && bookings.length === 0) {
|
|
884
|
+
const extend = tempOrder._extend ?? (tempOrder._extend = {});
|
|
885
|
+
if (!extend.scanOrderBookingUuid) {
|
|
886
|
+
extend.scanOrderBookingUuid = (0, _utils2.createUuidV4)();
|
|
887
|
+
this.store.order?.persistTempOrder?.();
|
|
888
|
+
}
|
|
884
889
|
const bookingStart = this.getShopTime(now);
|
|
885
890
|
const bookingDuration = (0, _utils2.resolveTableOccupancyDuration)(tempOrder);
|
|
886
891
|
// Add elapsed minutes before formatting both ends so DST changes are respected.
|
|
887
892
|
const bookingEnd = this.getShopTime(new Date(now.getTime() + bookingDuration * 60_000));
|
|
888
893
|
scheduleDate = bookingStart.dateTime;
|
|
889
894
|
bookings = [(0, _utils2.normalizeSubmitBooking)({
|
|
895
|
+
uuid: extend.scanOrderBookingUuid,
|
|
890
896
|
relation_id: 0,
|
|
891
897
|
form_id: 0,
|
|
892
898
|
start_time: bookingStart.time,
|
|
@@ -38,6 +38,7 @@ var _smartPricing = require("./utils/smartPricing");
|
|
|
38
38
|
var _slotMerge = require("./utils/slotMerge");
|
|
39
39
|
var _utils3 = require("../../modules/Order/utils");
|
|
40
40
|
var _Order = require("../../modules/Order");
|
|
41
|
+
var _bookingUuid = require("../../modules/Order/utils/bookingUuid");
|
|
41
42
|
var _types4 = require("../RegisterAndLogin/types");
|
|
42
43
|
var _decimal = _interopRequireDefault(require("decimal.js"));
|
|
43
44
|
var _Holder = require("../../modules/Holder");
|
|
@@ -1197,6 +1198,7 @@ class VenueBookingImpl extends _BaseSales.BaseSalesImpl {
|
|
|
1197
1198
|
if (!mapping) return;
|
|
1198
1199
|
const tempOrder = this.store.order.ensureTempOrder();
|
|
1199
1200
|
const matchesCurrent = (meta, pid) => !!meta?.venue_booking && String(meta?.resource_id) === String(resourceId) && Number(pid) === Number(productId);
|
|
1201
|
+
const previousBookings = (tempOrder.bookings || []).filter(row => row.uuid && matchesCurrent(row.metadata, row.metadata?.product_id ?? row.product?.product_id));
|
|
1200
1202
|
tempOrder.products = tempOrder.products.filter(p => !matchesCurrent(p.metadata, p.product_id));
|
|
1201
1203
|
tempOrder.bookings = (tempOrder.bookings || []).filter(b => {
|
|
1202
1204
|
if (!b.metadata?.venue_booking) return true;
|
|
@@ -1332,7 +1334,10 @@ class VenueBookingImpl extends _BaseSales.BaseSalesImpl {
|
|
|
1332
1334
|
productUid,
|
|
1333
1335
|
childResources: childRawResources
|
|
1334
1336
|
});
|
|
1335
|
-
|
|
1337
|
+
// A resized or split interval can reuse its original UUID once.
|
|
1338
|
+
const original = previousBookings.findIndex(row => `${row.start_date} ${String(row.start_time).slice(0, 5)}` < group.endTime && `${row.end_date} ${String(row.end_time).slice(0, 5)}` > group.startTime);
|
|
1339
|
+
if (original >= 0) booking.uuid = previousBookings.splice(original, 1)[0].uuid;
|
|
1340
|
+
tempOrder.bookings.push((0, _bookingUuid.ensureBookingUuid)(booking));
|
|
1336
1341
|
}
|
|
1337
1342
|
|
|
1338
1343
|
// 获取表单信息
|
package/lib/utils/platform.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Normalize the runtime platform passed through solution/module otherParams.
|
|
3
3
|
*/
|
|
4
4
|
export declare function normalizeRuntimePlatform(platform: unknown): string;
|
|
5
|
+
export declare function isPosTerminalPlatform(platform: unknown): boolean;
|
|
5
6
|
/**
|
|
6
7
|
* PC and H5 are authenticated-customer clients rather than staff terminals.
|
|
7
8
|
*/
|
package/lib/utils/platform.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.isCustomerUserPlatform = isCustomerUserPlatform;
|
|
7
|
+
exports.isPosTerminalPlatform = isPosTerminalPlatform;
|
|
7
8
|
exports.isSelfServicePlatform = isSelfServicePlatform;
|
|
8
9
|
exports.normalizeRuntimePlatform = normalizeRuntimePlatform;
|
|
9
10
|
const CUSTOMER_USER_PLATFORMS = new Set(['pc', 'h5']);
|
|
@@ -15,6 +16,10 @@ const SELF_SERVICE_PLATFORMS = new Set(['kiosk', 'vending']);
|
|
|
15
16
|
function normalizeRuntimePlatform(platform) {
|
|
16
17
|
return String(platform ?? '').trim().toLowerCase();
|
|
17
18
|
}
|
|
19
|
+
function isPosTerminalPlatform(platform) {
|
|
20
|
+
const normalized = normalizeRuntimePlatform(platform);
|
|
21
|
+
return normalized === 'pos' || normalized === 'webpos';
|
|
22
|
+
}
|
|
18
23
|
|
|
19
24
|
/**
|
|
20
25
|
* PC and H5 are authenticated-customer clients rather than staff terminals.
|