@pisell/pisellos 0.10.39 → 0.10.40
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/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/BookingContext/index.js +4 -4
- package/dist/solution/BaseSales/index.js +62 -42
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/UnifiedBookingSales/index.d.ts +2 -2
- package/dist/solution/UnifiedBookingSales/index.js +10 -10
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/BookingContext/index.js +3 -3
- package/lib/solution/BaseSales/index.js +16 -2
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/UnifiedBookingSales/index.d.ts +2 -2
- package/lib/solution/UnifiedBookingSales/index.js +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// 导出评估器
|
|
2
|
+
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
+
|
|
4
|
+
// 导出适配器
|
|
5
|
+
export { PromotionAdapter } from "./adapter";
|
|
6
|
+
export { default } from "./adapter";
|
|
7
|
+
|
|
8
|
+
// 导出策略配置示例常量
|
|
9
|
+
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
|
|
@@ -26,7 +26,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
26
26
|
import dayjs from 'dayjs';
|
|
27
27
|
import { BaseModule } from "../BaseModule";
|
|
28
28
|
import { RequestModeENUM } from "../../plugins/request";
|
|
29
|
-
import {
|
|
29
|
+
import { isCustomerUserPlatform } from "../../utils/platform";
|
|
30
30
|
import { BookingContextEvent } from "./types";
|
|
31
31
|
import { formatResourceListAndMap } from "./utils/formatResourceList";
|
|
32
32
|
export * from "./types";
|
|
@@ -158,9 +158,9 @@ export function buildBookingConfigQueryKey() {
|
|
|
158
158
|
}
|
|
159
159
|
function resolveBookingConfigRequest(platform) {
|
|
160
160
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
161
|
-
var
|
|
162
|
-
var endpoint =
|
|
163
|
-
var query =
|
|
161
|
+
var isCustomerPlatform = isCustomerUserPlatform(platform);
|
|
162
|
+
var endpoint = isCustomerPlatform ? H5_BOOKING_CONFIG_ENDPOINT : BOOKING_CONFIG_ENDPOINT;
|
|
163
|
+
var query = isCustomerPlatform ? {
|
|
164
164
|
item_type: params.item_type || DEFAULT_BOOKING_CONFIG_PARAMS.item_type
|
|
165
165
|
} : _objectSpread(_objectSpread({}, DEFAULT_BOOKING_CONFIG_PARAMS), params);
|
|
166
166
|
var keys = Object.keys(query).sort();
|
|
@@ -5083,8 +5083,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5083
5083
|
key: "confirmWalletPayment",
|
|
5084
5084
|
value: (function () {
|
|
5085
5085
|
var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50() {
|
|
5086
|
-
var _this$store$order$get3, _this$store$order14, _this$store$order$
|
|
5087
|
-
var beforePayments, pendingWalletAmount, amountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
|
|
5086
|
+
var _this$store$order$get3, _this$store$order14, _this$store$order$get5, _this$store$order$get6, _this$store$order16;
|
|
5087
|
+
var beforePayments, pendingWalletAmount, amountSnapshot, _this$store$order$get4, _this$store$order15, _submitResult, _latestAmountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
|
|
5088
5088
|
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
5089
5089
|
while (1) switch (_context50.prev = _context50.next) {
|
|
5090
5090
|
case 0:
|
|
@@ -5096,83 +5096,103 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5096
5096
|
case 2:
|
|
5097
5097
|
beforePayments = cloneDeep(this.store.order.getOrderPayments());
|
|
5098
5098
|
pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
|
|
5099
|
+
amountSnapshot = (_this$store$order$get3 = (_this$store$order14 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order14);
|
|
5099
5100
|
if (!pendingWalletAmount.lte(0)) {
|
|
5100
|
-
_context50.next =
|
|
5101
|
+
_context50.next = 14;
|
|
5101
5102
|
break;
|
|
5102
5103
|
}
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5104
|
+
this.logWarning('confirmWalletPayment: 未发现待确认 Wallet 支付,跳过 Wallet 确认并按普通订单提交', {
|
|
5105
|
+
amountGap: amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap
|
|
5106
|
+
});
|
|
5107
|
+
_context50.next = 9;
|
|
5108
|
+
return this.submitSalesOrder({
|
|
5109
|
+
smallTicketDataFlag: 1
|
|
5110
|
+
});
|
|
5111
|
+
case 9:
|
|
5112
|
+
_submitResult = _context50.sent;
|
|
5113
|
+
if (!isRejectedSalesSubmitResult(_submitResult)) {
|
|
5114
|
+
_context50.next = 12;
|
|
5115
|
+
break;
|
|
5116
|
+
}
|
|
5117
|
+
throw new Error(getSalesSubmitErrorMessage(_submitResult, '订单提交失败'));
|
|
5118
|
+
case 12:
|
|
5119
|
+
_latestAmountSnapshot = (_this$store$order$get4 = (_this$store$order15 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.call(_this$store$order15);
|
|
5120
|
+
return _context50.abrupt("return", {
|
|
5121
|
+
submitResult: _submitResult,
|
|
5122
|
+
payments: this.store.order.getOrderPayments(),
|
|
5123
|
+
isOrderFullyPaid: new Decimal((_latestAmountSnapshot === null || _latestAmountSnapshot === void 0 ? void 0 : _latestAmountSnapshot.amountGap) || 0).lte(0)
|
|
5124
|
+
});
|
|
5125
|
+
case 14:
|
|
5106
5126
|
effectiveAmountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
|
|
5107
5127
|
if (!effectiveAmountDue.gt(0.01)) {
|
|
5108
|
-
_context50.next =
|
|
5128
|
+
_context50.next = 17;
|
|
5109
5129
|
break;
|
|
5110
5130
|
}
|
|
5111
5131
|
throw new Error('Wallet 支付尚未覆盖全部待支付金额');
|
|
5112
|
-
case
|
|
5113
|
-
beforePaymentStatus = (_this$store$order$
|
|
5114
|
-
_context50.prev =
|
|
5115
|
-
_context50.next =
|
|
5132
|
+
case 17:
|
|
5133
|
+
beforePaymentStatus = (_this$store$order$get5 = this.store.order.getTempOrder()) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.payment_status;
|
|
5134
|
+
_context50.prev = 18;
|
|
5135
|
+
_context50.next = 21;
|
|
5116
5136
|
return this.submitSalesOrder({
|
|
5117
5137
|
smallTicketDataFlag: 1,
|
|
5118
5138
|
confirmPendingVoucherPayments: true
|
|
5119
5139
|
});
|
|
5120
|
-
case
|
|
5140
|
+
case 21:
|
|
5121
5141
|
submitResult = _context50.sent;
|
|
5122
5142
|
if (!isRejectedSalesSubmitResult(submitResult)) {
|
|
5123
|
-
_context50.next =
|
|
5143
|
+
_context50.next = 24;
|
|
5124
5144
|
break;
|
|
5125
5145
|
}
|
|
5126
5146
|
throw new Error(getSalesSubmitErrorMessage(submitResult, 'Wallet 支付确认失败'));
|
|
5127
|
-
case
|
|
5128
|
-
_context50.next =
|
|
5147
|
+
case 24:
|
|
5148
|
+
_context50.next = 34;
|
|
5129
5149
|
break;
|
|
5130
|
-
case
|
|
5131
|
-
_context50.prev =
|
|
5132
|
-
_context50.t0 = _context50["catch"](
|
|
5150
|
+
case 26:
|
|
5151
|
+
_context50.prev = 26;
|
|
5152
|
+
_context50.t0 = _context50["catch"](18);
|
|
5133
5153
|
this.store.order.setOrderPayments(beforePayments);
|
|
5134
5154
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
5135
5155
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
5136
5156
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
5137
5157
|
this.store.order.persistTempOrder();
|
|
5138
5158
|
}
|
|
5139
|
-
_context50.next =
|
|
5159
|
+
_context50.next = 33;
|
|
5140
5160
|
return this.store.order.recalculateSummary({
|
|
5141
5161
|
createIfMissing: true
|
|
5142
5162
|
});
|
|
5143
|
-
case
|
|
5163
|
+
case 33:
|
|
5144
5164
|
throw _context50.t0;
|
|
5145
|
-
case
|
|
5165
|
+
case 34:
|
|
5146
5166
|
if (!this.store.payment) {
|
|
5147
|
-
_context50.next =
|
|
5167
|
+
_context50.next = 45;
|
|
5148
5168
|
break;
|
|
5149
5169
|
}
|
|
5150
|
-
_context50.prev =
|
|
5170
|
+
_context50.prev = 35;
|
|
5151
5171
|
committed = this.getCommittedWalletAssets();
|
|
5152
5172
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
5153
|
-
_context50.next =
|
|
5173
|
+
_context50.next = 40;
|
|
5154
5174
|
return this.publishWalletAssetsState(walletState);
|
|
5155
|
-
case
|
|
5156
|
-
_context50.next =
|
|
5175
|
+
case 40:
|
|
5176
|
+
_context50.next = 45;
|
|
5157
5177
|
break;
|
|
5158
|
-
case
|
|
5159
|
-
_context50.prev =
|
|
5160
|
-
_context50.t1 = _context50["catch"](
|
|
5178
|
+
case 42:
|
|
5179
|
+
_context50.prev = 42;
|
|
5180
|
+
_context50.t1 = _context50["catch"](35);
|
|
5161
5181
|
this.logWarning('confirmWalletPayment: Wallet committed 状态同步失败', {
|
|
5162
5182
|
error: _context50.t1 instanceof Error ? _context50.t1.message : String(_context50.t1)
|
|
5163
5183
|
});
|
|
5164
|
-
case
|
|
5165
|
-
latestAmountSnapshot = (_this$store$order$
|
|
5184
|
+
case 45:
|
|
5185
|
+
latestAmountSnapshot = (_this$store$order$get6 = (_this$store$order16 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get6 === void 0 ? void 0 : _this$store$order$get6.call(_this$store$order16);
|
|
5166
5186
|
return _context50.abrupt("return", {
|
|
5167
5187
|
submitResult: submitResult,
|
|
5168
5188
|
payments: this.store.order.getOrderPayments(),
|
|
5169
5189
|
isOrderFullyPaid: new Decimal((latestAmountSnapshot === null || latestAmountSnapshot === void 0 ? void 0 : latestAmountSnapshot.amountGap) || 0).lte(0)
|
|
5170
5190
|
});
|
|
5171
|
-
case
|
|
5191
|
+
case 47:
|
|
5172
5192
|
case "end":
|
|
5173
5193
|
return _context50.stop();
|
|
5174
5194
|
}
|
|
5175
|
-
}, _callee50, this, [[
|
|
5195
|
+
}, _callee50, this, [[18, 26], [35, 42]]);
|
|
5176
5196
|
}));
|
|
5177
5197
|
function confirmWalletPayment() {
|
|
5178
5198
|
return _confirmWalletPayment.apply(this, arguments);
|
|
@@ -5188,7 +5208,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5188
5208
|
key: "payCash",
|
|
5189
5209
|
value: (function () {
|
|
5190
5210
|
var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
|
|
5191
|
-
var _this$store$order$
|
|
5211
|
+
var _this$store$order$get7, _params$actualPaidAmo, _this$otherParams35, _this$window, _this$window$postMess;
|
|
5192
5212
|
var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, paymentTimestamp, actualPaidAmount, changeAmount, shopWalletPassId, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
5193
5213
|
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
5194
5214
|
while (1) switch (_context51.prev = _context51.next) {
|
|
@@ -5232,7 +5252,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5232
5252
|
throw new Error('现金支付金额超过当前待支付金额');
|
|
5233
5253
|
case 17:
|
|
5234
5254
|
beforePayments = cloneDeep(this.store.order.getOrderPayments());
|
|
5235
|
-
beforePaymentStatus = (_this$store$order$
|
|
5255
|
+
beforePaymentStatus = (_this$store$order$get7 = this.store.order.getTempOrder()) === null || _this$store$order$get7 === void 0 ? void 0 : _this$store$order$get7.payment_status;
|
|
5236
5256
|
uniquePaymentNumber = createUuidV4();
|
|
5237
5257
|
paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
5238
5258
|
actualPaidAmount = Number((_params$actualPaidAmo = params.actualPaidAmount) !== null && _params$actualPaidAmo !== void 0 ? _params$actualPaidAmo : amount);
|
|
@@ -5343,7 +5363,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5343
5363
|
key: "commitPaymentMethodPayment",
|
|
5344
5364
|
value: (function () {
|
|
5345
5365
|
var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(params) {
|
|
5346
|
-
var _this$store$order$
|
|
5366
|
+
var _this$store$order$get8, _this$store$order17, _this$store$order$get9, _params$metadata, _params$originAmount;
|
|
5347
5367
|
var amount, paymentMethods, findPaymentMethod, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, beforePayments, beforePaymentStatus, paymentTimestamp, metadata, serviceCharge, serviceFee, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
5348
5368
|
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
5349
5369
|
while (1) switch (_context52.prev = _context52.next) {
|
|
@@ -5387,7 +5407,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5387
5407
|
}
|
|
5388
5408
|
throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(params.paymentMethodCode || params.paymentMethodId || ''));
|
|
5389
5409
|
case 15:
|
|
5390
|
-
amountSnapshot = (_this$store$order$
|
|
5410
|
+
amountSnapshot = (_this$store$order$get8 = (_this$store$order17 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get8 === void 0 ? void 0 : _this$store$order$get8.call(_this$store$order17);
|
|
5391
5411
|
pendingWalletAmount = this.getPendingWalletPaymentAmount();
|
|
5392
5412
|
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
|
|
5393
5413
|
if (!amountDue.lte(0)) {
|
|
@@ -5403,7 +5423,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5403
5423
|
throw new Error('支付金额超过当前待支付金额');
|
|
5404
5424
|
case 22:
|
|
5405
5425
|
beforePayments = cloneDeep(this.store.order.getOrderPayments());
|
|
5406
|
-
beforePaymentStatus = (_this$store$order$
|
|
5426
|
+
beforePaymentStatus = (_this$store$order$get9 = this.store.order.getTempOrder()) === null || _this$store$order$get9 === void 0 ? void 0 : _this$store$order$get9.payment_status;
|
|
5407
5427
|
paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
5408
5428
|
metadata = _objectSpread(_objectSpread({}, params.metadata || {}), {}, {
|
|
5409
5429
|
unique_payment_number: ((_params$metadata = params.metadata) === null || _params$metadata === void 0 ? void 0 : _params$metadata.unique_payment_number) || createUuidV4()
|
|
@@ -6188,16 +6208,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6188
6208
|
}, {
|
|
6189
6209
|
key: "getUnfulfilledPromotions",
|
|
6190
6210
|
value: function getUnfulfilledPromotions() {
|
|
6191
|
-
var _this$store$
|
|
6192
|
-
return ((_this$store$
|
|
6211
|
+
var _this$store$order18;
|
|
6212
|
+
return ((_this$store$order18 = this.store.order) === null || _this$store$order18 === void 0 ? void 0 : _this$store$order18.getUnfulfilledPromotions()) || [];
|
|
6193
6213
|
}
|
|
6194
6214
|
|
|
6195
6215
|
/** 最近一次促销计算输出的赠品操作 diff。 */
|
|
6196
6216
|
}, {
|
|
6197
6217
|
key: "getLastGiftActions",
|
|
6198
6218
|
value: function getLastGiftActions() {
|
|
6199
|
-
var _this$store$
|
|
6200
|
-
return ((_this$store$
|
|
6219
|
+
var _this$store$order19;
|
|
6220
|
+
return ((_this$store$order19 = this.store.order) === null || _this$store$order19 === void 0 ? void 0 : _this$store$order19.getLastGiftActions()) || null;
|
|
6201
6221
|
}
|
|
6202
6222
|
|
|
6203
6223
|
// 获取商品列表
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 | 1 | 2 |
|
|
329
|
+
weekNum: 0 | 1 | 2 | 5 | 6 | 3 | 4;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -345,7 +345,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
345
345
|
count: number;
|
|
346
346
|
left: number;
|
|
347
347
|
summaryCount: number;
|
|
348
|
-
status: "
|
|
348
|
+
status: "sold_out" | "lots_of_space" | "filling_up_fast";
|
|
349
349
|
}[];
|
|
350
350
|
/**
|
|
351
351
|
* 找到多个资源的公共可用时间段
|
|
@@ -123,8 +123,8 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
123
123
|
*/
|
|
124
124
|
clearSessionStorageOrderSnapshot(): void;
|
|
125
125
|
/**
|
|
126
|
-
* H5/Kiosk
|
|
127
|
-
*
|
|
126
|
+
* PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
127
|
+
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|
|
128
128
|
*/
|
|
129
129
|
protected shouldUseCheckoutSyncTask(): boolean;
|
|
130
130
|
/** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
|
|
@@ -44,7 +44,7 @@ import { UnifiedBookingSalesHooks } from "./types";
|
|
|
44
44
|
import { AvailabilityRemoteOccupancyCache } from "./remoteOccupancyCache";
|
|
45
45
|
import { BookingTicket } from "../BookingTicket";
|
|
46
46
|
import { addLocalCalendarDays, captureRuntimeOffsetMinutes, formatLocalDate, formatLocalDateTime, formatLocalTime, localDateTimeToScalar, localDateToScalar, localDateToScalarStart, parseLocalDate, parseLocalDateTime } from "../../modules/ResourcePlanner/localClock";
|
|
47
|
-
import { isCustomerUserPlatform
|
|
47
|
+
import { isCustomerUserPlatform } from "../../utils/platform";
|
|
48
48
|
export * from "./types";
|
|
49
49
|
export { AvailabilityError } from "../../modules/ResourcePlanner";
|
|
50
50
|
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'basic', 'checkout', 'availability', 'documents'];
|
|
@@ -1830,17 +1830,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1830
1830
|
}
|
|
1831
1831
|
|
|
1832
1832
|
/**
|
|
1833
|
-
* H5/Kiosk
|
|
1834
|
-
*
|
|
1833
|
+
* PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
1834
|
+
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|
|
1835
1835
|
*/
|
|
1836
1836
|
}, {
|
|
1837
1837
|
key: "shouldUseCheckoutSyncTask",
|
|
1838
1838
|
value: function shouldUseCheckoutSyncTask() {
|
|
1839
|
-
var _this$otherParams13, _this$otherParams14;
|
|
1839
|
+
var _this$otherParams13, _this$otherParams$pla, _this$otherParams14;
|
|
1840
1840
|
var configured = (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.checkoutSyncTaskEnabled;
|
|
1841
1841
|
if (configured === true) return true;
|
|
1842
|
-
var platform =
|
|
1843
|
-
return platform
|
|
1842
|
+
var platform = String((_this$otherParams$pla = (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.platform) !== null && _this$otherParams$pla !== void 0 ? _this$otherParams$pla : '').trim().toLowerCase();
|
|
1843
|
+
return !isCustomerUserPlatform(platform) && platform !== 'kiosk';
|
|
1844
1844
|
}
|
|
1845
1845
|
|
|
1846
1846
|
/** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
|
|
@@ -4282,7 +4282,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4282
4282
|
key: "getProductTimeRanges",
|
|
4283
4283
|
value: (function () {
|
|
4284
4284
|
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(contextId) {
|
|
4285
|
-
var _this$otherParams$
|
|
4285
|
+
var _this$otherParams$pla2,
|
|
4286
4286
|
_this$otherParams20,
|
|
4287
4287
|
_this9 = this;
|
|
4288
4288
|
var request,
|
|
@@ -4304,7 +4304,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4304
4304
|
context = _yield$this$ensureAva.context;
|
|
4305
4305
|
projectionEntry = _yield$this$ensureAva.projectionEntry;
|
|
4306
4306
|
contextVersion = context.activeVersion;
|
|
4307
|
-
isPosAvailabilityRequest = String((_this$otherParams$
|
|
4307
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla2 = (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
|
|
4308
4308
|
allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
|
|
4309
4309
|
return Array.isArray(startTimes) && startTimes.length > 0;
|
|
4310
4310
|
});
|
|
@@ -4456,7 +4456,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4456
4456
|
key: "commitAvailabilitySelection",
|
|
4457
4457
|
value: (function () {
|
|
4458
4458
|
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(contextId, params) {
|
|
4459
|
-
var normalizedContextId, _params$bookingCount, _ref46, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$
|
|
4459
|
+
var normalizedContextId, _params$bookingCount, _ref46, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla3, _this$otherParams21, _ref47, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref48, _ref49, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref50, _transformed$product_4, _this$getTempOrder4, _this$getTempOrder5, _this$getTempOrder6, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, nextContext, result;
|
|
4460
4460
|
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
4461
4461
|
while (1) switch (_context39.prev = _context39.next) {
|
|
4462
4462
|
case 0:
|
|
@@ -4686,7 +4686,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4686
4686
|
this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
4687
4687
|
candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
|
|
4688
4688
|
candidateStartTime = getCandidateStartTime(params.candidate);
|
|
4689
|
-
allowPosAvailabilityOverride = String((_this$otherParams$
|
|
4689
|
+
allowPosAvailabilityOverride = String((_this$otherParams$pla3 = (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.platform) !== null && _this$otherParams$pla3 !== void 0 ? _this$otherParams$pla3 : '').trim().toLowerCase() === 'pos';
|
|
4690
4690
|
refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread({
|
|
4691
4691
|
productIds: [params.candidate.productId],
|
|
4692
4692
|
dateRange: {
|
|
@@ -1 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "BUY_X_GET_Y_FREE_STRATEGY", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _examples.BUY_X_GET_Y_FREE_STRATEGY;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "ITEM_REWARD_STRATEGY", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _examples.ITEM_REWARD_STRATEGY;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "PromotionAdapter", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _adapter.PromotionAdapter;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "PromotionEvaluator", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _evaluator.PromotionEvaluator;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "X_ITEMS_FOR_Y_PRICE_STRATEGY", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _examples.X_ITEMS_FOR_Y_PRICE_STRATEGY;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "default", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _adapter.default;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
var _evaluator = require("./evaluator");
|
|
43
|
+
var _adapter = _interopRequireWildcard(require("./adapter"));
|
|
44
|
+
var _examples = require("./examples");
|
|
45
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
46
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -171,9 +171,9 @@ function buildBookingConfigQueryKey(params = {}) {
|
|
|
171
171
|
return JSON.stringify(sorted);
|
|
172
172
|
}
|
|
173
173
|
function resolveBookingConfigRequest(platform, params = {}) {
|
|
174
|
-
const
|
|
175
|
-
const endpoint =
|
|
176
|
-
const query =
|
|
174
|
+
const isCustomerPlatform = (0, _platform.isCustomerUserPlatform)(platform);
|
|
175
|
+
const endpoint = isCustomerPlatform ? H5_BOOKING_CONFIG_ENDPOINT : BOOKING_CONFIG_ENDPOINT;
|
|
176
|
+
const query = isCustomerPlatform ? {
|
|
177
177
|
item_type: params.item_type || DEFAULT_BOOKING_CONFIG_PARAMS.item_type
|
|
178
178
|
} : {
|
|
179
179
|
...DEFAULT_BOOKING_CONFIG_PARAMS,
|
|
@@ -3165,10 +3165,24 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
3165
3165
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
3166
3166
|
const beforePayments = (0, _lodashEs.cloneDeep)(this.store.order.getOrderPayments());
|
|
3167
3167
|
const pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
|
|
3168
|
+
const amountSnapshot = this.store.order.getOrderAmountSnapshot?.();
|
|
3168
3169
|
if (pendingWalletAmount.lte(0)) {
|
|
3169
|
-
|
|
3170
|
+
this.logWarning('confirmWalletPayment: 未发现待确认 Wallet 支付,跳过 Wallet 确认并按普通订单提交', {
|
|
3171
|
+
amountGap: amountSnapshot?.amountGap
|
|
3172
|
+
});
|
|
3173
|
+
const submitResult = await this.submitSalesOrder({
|
|
3174
|
+
smallTicketDataFlag: 1
|
|
3175
|
+
});
|
|
3176
|
+
if (isRejectedSalesSubmitResult(submitResult)) {
|
|
3177
|
+
throw new Error(getSalesSubmitErrorMessage(submitResult, '订单提交失败'));
|
|
3178
|
+
}
|
|
3179
|
+
const latestAmountSnapshot = this.store.order.getOrderAmountSnapshot?.();
|
|
3180
|
+
return {
|
|
3181
|
+
submitResult,
|
|
3182
|
+
payments: this.store.order.getOrderPayments(),
|
|
3183
|
+
isOrderFullyPaid: new _decimal.default(latestAmountSnapshot?.amountGap || 0).lte(0)
|
|
3184
|
+
};
|
|
3170
3185
|
}
|
|
3171
|
-
const amountSnapshot = this.store.order.getOrderAmountSnapshot?.();
|
|
3172
3186
|
const effectiveAmountDue = _decimal.default.max(new _decimal.default(amountSnapshot?.amountGap || 0).minus(pendingWalletAmount), 0);
|
|
3173
3187
|
if (effectiveAmountDue.gt(0.01)) {
|
|
3174
3188
|
throw new Error('Wallet 支付尚未覆盖全部待支付金额');
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 | 1 | 2 |
|
|
329
|
+
weekNum: 0 | 1 | 2 | 5 | 6 | 3 | 4;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -345,7 +345,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
345
345
|
count: number;
|
|
346
346
|
left: number;
|
|
347
347
|
summaryCount: number;
|
|
348
|
-
status: "
|
|
348
|
+
status: "sold_out" | "lots_of_space" | "filling_up_fast";
|
|
349
349
|
}[];
|
|
350
350
|
/**
|
|
351
351
|
* 找到多个资源的公共可用时间段
|
|
@@ -123,8 +123,8 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
123
123
|
*/
|
|
124
124
|
clearSessionStorageOrderSnapshot(): void;
|
|
125
125
|
/**
|
|
126
|
-
* H5/Kiosk
|
|
127
|
-
*
|
|
126
|
+
* PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
127
|
+
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|
|
128
128
|
*/
|
|
129
129
|
protected shouldUseCheckoutSyncTask(): boolean;
|
|
130
130
|
/** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
|
|
@@ -1522,14 +1522,14 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1522
1522
|
}
|
|
1523
1523
|
|
|
1524
1524
|
/**
|
|
1525
|
-
* H5/Kiosk
|
|
1526
|
-
*
|
|
1525
|
+
* PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
1526
|
+
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|
|
1527
1527
|
*/
|
|
1528
1528
|
shouldUseCheckoutSyncTask() {
|
|
1529
1529
|
const configured = this.otherParams?.checkoutSyncTaskEnabled;
|
|
1530
1530
|
if (configured === true) return true;
|
|
1531
|
-
const platform = (
|
|
1532
|
-
return platform
|
|
1531
|
+
const platform = String(this.otherParams?.platform ?? '').trim().toLowerCase();
|
|
1532
|
+
return !(0, _platform.isCustomerUserPlatform)(platform) && platform !== 'kiosk';
|
|
1533
1533
|
}
|
|
1534
1534
|
|
|
1535
1535
|
/** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
|