@pisell/pisellos 2.2.309 → 2.2.310
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/walletPass/evaluator.d.ts +2 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +4 -2
- package/dist/modules/BookingContext/index.js +4 -4
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +58 -19
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +24 -12
- package/dist/modules/Customer/index.js +6 -3
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/availability.d.ts +7 -0
- package/dist/modules/Discount/availability.js +49 -0
- package/dist/modules/Discount/entitlementPass.d.ts +34 -0
- package/dist/modules/Discount/entitlementPass.js +147 -0
- package/dist/modules/Discount/index.d.ts +2 -2
- package/dist/modules/Discount/index.js +37 -151
- package/dist/modules/Discount/types.d.ts +36 -5
- package/dist/modules/OpenData/index.d.ts +1 -1
- package/dist/modules/OpenData/index.js +21 -12
- package/dist/modules/Order/index.d.ts +32 -4
- package/dist/modules/Order/index.js +733 -373
- package/dist/modules/Order/types.d.ts +17 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +16 -12
- package/dist/modules/Order/utils.d.ts +14 -2
- package/dist/modules/Order/utils.js +275 -76
- package/dist/modules/Payment/index.d.ts +0 -5
- package/dist/modules/Payment/index.js +35 -85
- package/dist/modules/Payment/types.d.ts +21 -1
- package/dist/modules/Payment/types.js +2 -0
- package/dist/modules/Payment/walletpass.d.ts +1 -1
- package/dist/modules/Payment/walletpass.js +80 -47
- package/dist/modules/ProductList/index.js +18 -5
- package/dist/modules/Rules/index.d.ts +2 -2
- package/dist/modules/Rules/index.js +480 -186
- package/dist/modules/Rules/types.d.ts +4 -0
- package/dist/server/index.js +8 -5
- package/dist/server/modules/order/index.js +6 -0
- package/dist/server/modules/order/types.d.ts +12 -0
- package/dist/server/modules/payment/index.d.ts +25 -6
- package/dist/server/modules/payment/index.js +660 -133
- package/dist/server/utils/small-ticket.d.ts +8 -5
- package/dist/server/utils/small-ticket.js +1269 -199
- package/dist/solution/BaseSales/index.d.ts +11 -2
- package/dist/solution/BaseSales/index.js +1463 -1173
- package/dist/solution/BaseSales/types.d.ts +7 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +141 -126
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +12 -3
- package/dist/solution/BookingTicket/index.js +663 -542
- package/dist/solution/BookingTicket/types.d.ts +5 -1
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +338 -147
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +19 -6
- package/dist/solution/ShopDiscount/index.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.js +99 -42
- package/dist/solution/ShopDiscount/utils.d.ts +4 -2
- package/dist/solution/ShopDiscount/utils.js +43 -23
- package/dist/solution/UnifiedBookingSales/index.d.ts +2 -2
- package/dist/solution/UnifiedBookingSales/index.js +5 -5
- package/dist/utils/os-private-payload.d.ts +5 -0
- package/dist/utils/os-private-payload.js +17 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -0
- package/lib/modules/BookingContext/index.js +3 -3
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +35 -6
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +13 -6
- package/lib/modules/Customer/index.js +5 -1
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/availability.d.ts +7 -0
- package/lib/modules/Discount/availability.js +43 -0
- package/lib/modules/Discount/entitlementPass.d.ts +34 -0
- package/lib/modules/Discount/entitlementPass.js +141 -0
- package/lib/modules/Discount/index.d.ts +2 -2
- package/lib/modules/Discount/index.js +23 -129
- package/lib/modules/Discount/types.d.ts +36 -5
- package/lib/modules/OpenData/index.d.ts +1 -1
- package/lib/modules/OpenData/index.js +11 -2
- package/lib/modules/Order/index.d.ts +32 -4
- package/lib/modules/Order/index.js +341 -71
- package/lib/modules/Order/types.d.ts +17 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +14 -11
- package/lib/modules/Order/utils.d.ts +14 -2
- package/lib/modules/Order/utils.js +186 -3
- package/lib/modules/Payment/index.d.ts +0 -5
- package/lib/modules/Payment/index.js +3 -28
- package/lib/modules/Payment/types.d.ts +21 -1
- package/lib/modules/Payment/types.js +1 -0
- package/lib/modules/Payment/walletpass.d.ts +1 -1
- package/lib/modules/Payment/walletpass.js +29 -9
- package/lib/modules/ProductList/index.js +14 -1
- package/lib/modules/Rules/index.d.ts +2 -2
- package/lib/modules/Rules/index.js +357 -110
- package/lib/modules/Rules/types.d.ts +4 -0
- package/lib/server/index.js +8 -5
- package/lib/server/modules/order/index.js +6 -0
- package/lib/server/modules/order/types.d.ts +12 -0
- package/lib/server/modules/payment/index.d.ts +25 -6
- package/lib/server/modules/payment/index.js +350 -78
- package/lib/server/utils/small-ticket.d.ts +8 -5
- package/lib/server/utils/small-ticket.js +1009 -121
- package/lib/solution/BaseSales/index.d.ts +11 -2
- package/lib/solution/BaseSales/index.js +164 -30
- package/lib/solution/BaseSales/types.d.ts +7 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -4
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +12 -3
- package/lib/solution/BookingTicket/index.js +103 -41
- package/lib/solution/BookingTicket/types.d.ts +5 -1
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +174 -42
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +11 -3
- package/lib/solution/ShopDiscount/index.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.js +55 -9
- package/lib/solution/ShopDiscount/utils.d.ts +4 -2
- package/lib/solution/ShopDiscount/utils.js +42 -25
- package/lib/solution/UnifiedBookingSales/index.d.ts +2 -2
- package/lib/solution/UnifiedBookingSales/index.js +5 -5
- package/lib/utils/os-private-payload.d.ts +5 -0
- package/lib/utils/os-private-payload.js +22 -0
- package/package.json +1 -1
|
@@ -17,7 +17,8 @@ export var searchWalletPass = /*#__PURE__*/function () {
|
|
|
17
17
|
// 翻译识别码名称 0:不翻译 1:翻译
|
|
18
18
|
relation_product: 1,
|
|
19
19
|
// 组装关联商品: 0不处理 1处理
|
|
20
|
-
|
|
20
|
+
with_franchisor_data: 1,
|
|
21
|
+
with: ['customer', 'franchiseeWalletPass:shop_id,source_shop_id,product_id,use'],
|
|
21
22
|
tags: ['point_card',
|
|
22
23
|
// 积分卡
|
|
23
24
|
'gift_card',
|
|
@@ -28,6 +29,8 @@ export var searchWalletPass = /*#__PURE__*/function () {
|
|
|
28
29
|
// 折扣卡
|
|
29
30
|
'good_pass',
|
|
30
31
|
// 商品券
|
|
32
|
+
'entitlement_pass',
|
|
33
|
+
// 月卡 / 年卡 / 多次使用卡
|
|
31
34
|
'session_ticket',
|
|
32
35
|
// 场次票
|
|
33
36
|
'appointment_ticket' // 预约类门票
|
|
@@ -74,14 +77,15 @@ export var searchWallet = /*#__PURE__*/function () {
|
|
|
74
77
|
case 0:
|
|
75
78
|
params = {
|
|
76
79
|
code: code,
|
|
77
|
-
with_customer: 1
|
|
80
|
+
with_customer: 1,
|
|
81
|
+
with_franchisor_data: 1
|
|
78
82
|
};
|
|
79
83
|
_context2.prev = 1;
|
|
80
84
|
_context2.next = 4;
|
|
81
85
|
return request === null || request === void 0 ? void 0 : request.post('/wallet/detail/search', params);
|
|
82
86
|
case 4:
|
|
83
87
|
res = _context2.sent;
|
|
84
|
-
if (!((res === null || res === void 0 ? void 0 : res.code)
|
|
88
|
+
if (!((res === null || res === void 0 ? void 0 : res.status) === true && (res === null || res === void 0 ? void 0 : res.code) === 200 && !!(res !== null && res !== void 0 && res.data))) {
|
|
85
89
|
_context2.next = 7;
|
|
86
90
|
break;
|
|
87
91
|
}
|
|
@@ -90,7 +94,7 @@ export var searchWallet = /*#__PURE__*/function () {
|
|
|
90
94
|
response: res
|
|
91
95
|
});
|
|
92
96
|
case 7:
|
|
93
|
-
throw new Error('没有找到对应的识别码');
|
|
97
|
+
throw new Error((res === null || res === void 0 ? void 0 : res.message) || '没有找到对应的识别码');
|
|
94
98
|
case 10:
|
|
95
99
|
_context2.prev = 10;
|
|
96
100
|
_context2.t0 = _context2["catch"](1);
|
|
@@ -6,6 +6,12 @@ export interface GlobalScanFormattedResult {
|
|
|
6
6
|
searchType: GlobalScanSearchType;
|
|
7
7
|
data: any;
|
|
8
8
|
scanCode: string;
|
|
9
|
+
/** Wallet / Wallet Pass 来源客户 ID;跨店时必须先解析为当前店客户。 */
|
|
10
|
+
customerId?: string | number;
|
|
11
|
+
/** 仅 Wallet 返回;true 时禁止直接使用响应内的来源客户。 */
|
|
12
|
+
isCrossShopWallet?: boolean;
|
|
13
|
+
/** 总店 Wallet Pass 未共享给当前子店。 */
|
|
14
|
+
isWalletPassUnavailableAtStore?: boolean;
|
|
9
15
|
}
|
|
10
16
|
interface RawScanSearchResult {
|
|
11
17
|
searchType?: GlobalScanSearchType;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
1
7
|
/**
|
|
2
8
|
* 全局扫码搜索结果格式化(对齐 ticketBooking `formatScanGlobal`)。
|
|
3
9
|
*/
|
|
@@ -27,16 +33,23 @@ export function formatGlobalScanResult(raw, scanCode) {
|
|
|
27
33
|
return {
|
|
28
34
|
searchType: searchType,
|
|
29
35
|
data: resultData === null || resultData === void 0 ? void 0 : resultData.customer,
|
|
30
|
-
scanCode: scanCode
|
|
36
|
+
scanCode: scanCode,
|
|
37
|
+
customerId: resultData === null || resultData === void 0 ? void 0 : resultData.customer_id,
|
|
38
|
+
isCrossShopWallet: (resultData === null || resultData === void 0 ? void 0 : resultData.is_cross_shop_wallet) === true || Number(resultData === null || resultData === void 0 ? void 0 : resultData.is_cross_shop_wallet) === 1
|
|
31
39
|
};
|
|
32
40
|
}
|
|
33
41
|
if (searchType === 'walletPass') {
|
|
34
|
-
var
|
|
35
|
-
|
|
42
|
+
var _firstResult$franchis, _ref2, _ref3, _firstResult$customer, _firstResult$holder, _firstResult$customer2, _firstResult$customer3;
|
|
43
|
+
var firstResult = resultData === null || resultData === void 0 ? void 0 : resultData[0];
|
|
44
|
+
var isWalletPassUnavailableAtStore = (firstResult === null || firstResult === void 0 ? void 0 : firstResult.is_franchisor_pass) === 1 && (firstResult === null || firstResult === void 0 || (_firstResult$franchis = firstResult.franchisee_wallet_pass) === null || _firstResult$franchis === void 0 ? void 0 : _firstResult$franchis.use) !== 'enabled';
|
|
45
|
+
return _objectSpread({
|
|
36
46
|
searchType: searchType,
|
|
37
|
-
data:
|
|
38
|
-
scanCode: scanCode
|
|
39
|
-
|
|
47
|
+
data: firstResult === null || firstResult === void 0 ? void 0 : firstResult.customer,
|
|
48
|
+
scanCode: scanCode,
|
|
49
|
+
customerId: (_ref2 = (_ref3 = (_firstResult$customer = firstResult === null || firstResult === void 0 ? void 0 : firstResult.customer_id) !== null && _firstResult$customer !== void 0 ? _firstResult$customer : firstResult === null || firstResult === void 0 || (_firstResult$holder = firstResult.holder) === null || _firstResult$holder === void 0 ? void 0 : _firstResult$holder.customer_id) !== null && _ref3 !== void 0 ? _ref3 : firstResult === null || firstResult === void 0 || (_firstResult$customer2 = firstResult.customer) === null || _firstResult$customer2 === void 0 ? void 0 : _firstResult$customer2.id) !== null && _ref2 !== void 0 ? _ref2 : firstResult === null || firstResult === void 0 || (_firstResult$customer3 = firstResult.customer) === null || _firstResult$customer3 === void 0 ? void 0 : _firstResult$customer3.customer_id
|
|
50
|
+
}, isWalletPassUnavailableAtStore ? {
|
|
51
|
+
isWalletPassUnavailableAtStore: true
|
|
52
|
+
} : {});
|
|
40
53
|
}
|
|
41
54
|
if (searchType === 'product' || searchType === 'local_product') {
|
|
42
55
|
return {
|
|
@@ -43,6 +43,7 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
43
43
|
batchSearchByProductIds(productIds: number[]): Promise<Discount[]>;
|
|
44
44
|
scanCode(code: string, customerId?: number): Promise<{
|
|
45
45
|
isAvailable: boolean;
|
|
46
|
+
isAccepted?: boolean;
|
|
46
47
|
productList: Record<string, any>[];
|
|
47
48
|
discountList: Discount[];
|
|
48
49
|
type: "server" | "clientCalc";
|
|
@@ -62,6 +63,7 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
62
63
|
action?: 'create' | 'edit';
|
|
63
64
|
with_good_pass?: 0 | 1;
|
|
64
65
|
with_discount_card?: 0 | 1;
|
|
66
|
+
with_entitlement_pass?: 0 | 1;
|
|
65
67
|
}): Promise<void>;
|
|
66
68
|
}
|
|
67
69
|
export default ShopDiscountImpl;
|
|
@@ -27,8 +27,10 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
27
27
|
import { BaseModule } from "../../modules/BaseModule";
|
|
28
28
|
import { DiscountModule } from "../../modules/Discount";
|
|
29
29
|
import { RulesModule } from "../../modules/Rules";
|
|
30
|
+
import { isEntitlementPass } from "../../modules/Discount/entitlementPass";
|
|
30
31
|
import { filterDiscountListByBookingTime as _filterDiscountListByBookingTime, isAllNormalProduct } from "./utils";
|
|
31
32
|
import { UnavailableReason } from "../../modules/Rules/types";
|
|
33
|
+
import { getDiscountLifecycleReason } from "../../modules/Discount/availability";
|
|
32
34
|
import Decimal from 'decimal.js';
|
|
33
35
|
import { isBoolean } from 'lodash-es';
|
|
34
36
|
export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
@@ -203,7 +205,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
203
205
|
customerId: customer.id,
|
|
204
206
|
action: 'create',
|
|
205
207
|
with_good_pass: 1,
|
|
206
|
-
with_discount_card: 1
|
|
208
|
+
with_discount_card: 1,
|
|
209
|
+
with_entitlement_pass: 1
|
|
207
210
|
});
|
|
208
211
|
});
|
|
209
212
|
}
|
|
@@ -439,7 +442,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
439
442
|
key: "scanCode",
|
|
440
443
|
value: function () {
|
|
441
444
|
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(code, customerId) {
|
|
442
|
-
var _this$store$discount4, _this$store$bookingSu2, resultDiscountWithReason, resultDiscountList, unavailableReasonKey, rulesModule, withScanList, currentSelectedDiscountList, _ref2, newProductList, newDiscountList, isAvailable, unavailableReason, _this$options$otherPa6;
|
|
445
|
+
var _this$store$discount4, _this$store$bookingSu2, resultDiscountWithReason, resultDiscountList, unavailableReasonKey, rulesModule, withScanList, currentSelectedDiscountList, _ref2, newProductList, newDiscountList, evaluatedDiscountList, isAvailable, unavailableReason, isAccepted, _this$options$otherPa6, scannedIds, retainedScannedDiscounts, _this$store$discount5, retainedDiscounts;
|
|
443
446
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
444
447
|
while (1) switch (_context6.prev = _context6.next) {
|
|
445
448
|
case 0:
|
|
@@ -521,30 +524,65 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
521
524
|
isAvailable: false,
|
|
522
525
|
productList: this.store.productList || [],
|
|
523
526
|
discountList: this.getDiscountList()
|
|
524
|
-
}, newProductList = _ref2.productList, newDiscountList = _ref2.discountList, isAvailable = _ref2.isAvailable, unavailableReason = _ref2.unavailableReason;
|
|
527
|
+
}, newProductList = _ref2.productList, newDiscountList = _ref2.discountList, evaluatedDiscountList = _ref2.evaluatedDiscountList, isAvailable = _ref2.isAvailable, unavailableReason = _ref2.unavailableReason;
|
|
528
|
+
isAccepted = isAvailable;
|
|
525
529
|
if (!isAvailable) {
|
|
526
|
-
_context6.next =
|
|
530
|
+
_context6.next = 28;
|
|
527
531
|
break;
|
|
528
532
|
}
|
|
529
533
|
this.setDiscountList(newDiscountList || []);
|
|
530
534
|
this.store.originalDiscountList = newDiscountList || [];
|
|
531
535
|
this.setProductList(newProductList || []);
|
|
532
536
|
if (!(this.isWalkIn() && resultDiscountList.length && ((_this$options$otherPa6 = this.options.otherParams) === null || _this$options$otherPa6 === void 0 ? void 0 : _this$options$otherPa6.platform) === 'shop' && !((resultDiscountList[0].customer_id || 1) === 1))) {
|
|
533
|
-
_context6.next =
|
|
537
|
+
_context6.next = 26;
|
|
534
538
|
break;
|
|
535
539
|
}
|
|
536
|
-
_context6.next =
|
|
540
|
+
_context6.next = 26;
|
|
537
541
|
return this.getCustomerWallet(resultDiscountList[0].customer_id);
|
|
538
|
-
case
|
|
542
|
+
case 26:
|
|
543
|
+
_context6.next = 38;
|
|
544
|
+
break;
|
|
545
|
+
case 28:
|
|
546
|
+
scannedIds = new Set(withScanList.map(function (discount) {
|
|
547
|
+
return String(discount.id);
|
|
548
|
+
}));
|
|
549
|
+
retainedScannedDiscounts = (evaluatedDiscountList || withScanList).filter(function (discount) {
|
|
550
|
+
return scannedIds.has(String(discount.id)) && !getDiscountLifecycleReason(discount);
|
|
551
|
+
});
|
|
552
|
+
if (!retainedScannedDiscounts.length) {
|
|
553
|
+
_context6.next = 38;
|
|
554
|
+
break;
|
|
555
|
+
}
|
|
556
|
+
retainedDiscounts = new Map(this.getDiscountList().map(function (discount) {
|
|
557
|
+
return [String(discount.id), discount];
|
|
558
|
+
}));
|
|
559
|
+
retainedScannedDiscounts.forEach(function (discount) {
|
|
560
|
+
retainedDiscounts.set(String(discount.id), _objectSpread(_objectSpread({}, discount), {}, {
|
|
561
|
+
isScan: true,
|
|
562
|
+
isAvailable: false,
|
|
563
|
+
isSelected: false,
|
|
564
|
+
reasonCode: discount.reasonCode || 'product_not_applicable',
|
|
565
|
+
appliedProductDetails: [],
|
|
566
|
+
savedAmount: 0
|
|
567
|
+
}));
|
|
568
|
+
});
|
|
569
|
+
this.setDiscountList(_toConsumableArray(retainedDiscounts.values()));
|
|
570
|
+
this.store.originalDiscountList = this.getDiscountList();
|
|
571
|
+
_context6.next = 37;
|
|
572
|
+
return (_this$store$discount5 = this.store.discount) === null || _this$store$discount5 === void 0 ? void 0 : _this$store$discount5.setOriginalDiscountList(this.getDiscountList());
|
|
573
|
+
case 37:
|
|
574
|
+
isAccepted = true;
|
|
575
|
+
case 38:
|
|
539
576
|
return _context6.abrupt("return", {
|
|
540
577
|
type: "clientCalc",
|
|
541
578
|
isAvailable: isAvailable || false,
|
|
579
|
+
isAccepted: Boolean(isAccepted),
|
|
542
580
|
productList: newProductList || this.store.productList || [],
|
|
543
|
-
discountList:
|
|
581
|
+
discountList: this.getDiscountList(),
|
|
544
582
|
unavailableReason: unavailableReason
|
|
545
583
|
});
|
|
546
|
-
case
|
|
547
|
-
_context6.prev =
|
|
584
|
+
case 41:
|
|
585
|
+
_context6.prev = 41;
|
|
548
586
|
_context6.t1 = _context6["catch"](0);
|
|
549
587
|
console.error('[ShopDiscount] 扫码出错:', _context6.t1);
|
|
550
588
|
return _context6.abrupt("return", {
|
|
@@ -554,11 +592,11 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
554
592
|
discountList: this.getDiscountList(),
|
|
555
593
|
unavailableReason: UnavailableReason.Unknown
|
|
556
594
|
});
|
|
557
|
-
case
|
|
595
|
+
case 45:
|
|
558
596
|
case "end":
|
|
559
597
|
return _context6.stop();
|
|
560
598
|
}
|
|
561
|
-
}, _callee6, this, [[0,
|
|
599
|
+
}, _callee6, this, [[0, 41]]);
|
|
562
600
|
}));
|
|
563
601
|
function scanCode(_x5, _x6) {
|
|
564
602
|
return _scanCode.apply(this, arguments);
|
|
@@ -568,8 +606,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
568
606
|
}, {
|
|
569
607
|
key: "calcDiscountApplicableProductTotalPrice",
|
|
570
608
|
value: function calcDiscountApplicableProductTotalPrice(discount) {
|
|
571
|
-
var _this$store$
|
|
572
|
-
return (_this$store$
|
|
609
|
+
var _this$store$discount6;
|
|
610
|
+
return (_this$store$discount6 = this.store.discount) === null || _this$store$discount6 === void 0 ? void 0 : _this$store$discount6.calcDiscountApplicableProductTotalPrice(discount);
|
|
573
611
|
}
|
|
574
612
|
|
|
575
613
|
// =========== 私有辅助方法 ===========
|
|
@@ -614,7 +652,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
614
652
|
key: "setDiscountList",
|
|
615
653
|
value: function setDiscountList(discountList) {
|
|
616
654
|
var _this3 = this,
|
|
617
|
-
_this$store$
|
|
655
|
+
_this$store$discount7;
|
|
618
656
|
var productList = this.store.productList || [];
|
|
619
657
|
var editModeDiscountList = [];
|
|
620
658
|
productList.forEach(function (item) {
|
|
@@ -622,7 +660,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
622
660
|
var _this3$hooks;
|
|
623
661
|
var product = (_this3$hooks = _this3.hooks) === null || _this3$hooks === void 0 ? void 0 : _this3$hooks.getProduct(item);
|
|
624
662
|
(item.discount_list || []).forEach(function (discount) {
|
|
625
|
-
if (discount.id && ['good_pass', 'discount_card'].includes(discount.type)) {
|
|
663
|
+
if (discount.id && ['entitlement_pass', 'good_pass', 'discount_card'].includes(discount.type)) {
|
|
626
664
|
var index = editModeDiscountList.findIndex(function (n) {
|
|
627
665
|
var _discount$discount;
|
|
628
666
|
return n.id === (((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id);
|
|
@@ -697,7 +735,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
697
735
|
item.isDisabledForProductUsed = false;
|
|
698
736
|
}
|
|
699
737
|
});
|
|
700
|
-
(_this$store$
|
|
738
|
+
(_this$store$discount7 = this.store.discount) === null || _this$store$discount7 === void 0 || _this$store$discount7.setDiscountList(newDiscountList);
|
|
701
739
|
this.emitDiscountListChange(newDiscountList);
|
|
702
740
|
return newDiscountList;
|
|
703
741
|
}
|
|
@@ -706,8 +744,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
706
744
|
}, {
|
|
707
745
|
key: "getDiscountList",
|
|
708
746
|
value: function getDiscountList() {
|
|
709
|
-
var _this$store$
|
|
710
|
-
return ((_this$store$
|
|
747
|
+
var _this$store$discount8;
|
|
748
|
+
return ((_this$store$discount8 = this.store.discount) === null || _this$store$discount8 === void 0 ? void 0 : _this$store$discount8.getDiscountList()) || [];
|
|
711
749
|
}
|
|
712
750
|
|
|
713
751
|
// 获取客户钱包信息
|
|
@@ -789,7 +827,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
789
827
|
key: "loadPrepareConfig",
|
|
790
828
|
value: function () {
|
|
791
829
|
var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
|
|
792
|
-
var _this$getCustomer2, _this$store$
|
|
830
|
+
var _this$getCustomer2, _this$store$discount9, _this$getDiscountList, _this$store$discount10, _this$store$productLi2, orderId, customerId, prepareConfigResult, goodPassList, scanDiscount, scanDiscountById, refreshedScanEntitlementIds, newGoodPassList, retainedScanDiscounts, newDiscountList, filteredDiscountList, _result3;
|
|
793
831
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
794
832
|
while (1) switch (_context10.prev = _context10.next) {
|
|
795
833
|
case 0:
|
|
@@ -799,12 +837,14 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
799
837
|
// return
|
|
800
838
|
// }
|
|
801
839
|
_context10.next = 5;
|
|
802
|
-
return (_this$store$
|
|
840
|
+
return (_this$store$discount9 = this.store.discount) === null || _this$store$discount9 === void 0 ? void 0 : _this$store$discount9.loadPrepareConfig(_objectSpread({
|
|
803
841
|
customer_id: customerId,
|
|
804
842
|
action: orderId ? 'edit' : 'create',
|
|
805
843
|
with_good_pass: 1,
|
|
806
844
|
with_discount_card: 1,
|
|
807
845
|
with_wallet_pass_holder: 1,
|
|
846
|
+
with_entitlement_pass: 1,
|
|
847
|
+
filter_order_wallet_pass_usage: 0,
|
|
808
848
|
request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
809
849
|
}, orderId ? {
|
|
810
850
|
order_id: orderId
|
|
@@ -814,44 +854,61 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
814
854
|
goodPassList = (prepareConfigResult === null || prepareConfigResult === void 0 ? void 0 : prepareConfigResult.discountList) || [];
|
|
815
855
|
scanDiscount = (_this$getDiscountList = this.getDiscountList()) === null || _this$getDiscountList === void 0 ? void 0 : _this$getDiscountList.filter(function (item) {
|
|
816
856
|
return item.isScan;
|
|
817
|
-
}); //
|
|
818
|
-
|
|
819
|
-
|
|
857
|
+
}); // 扫码 Entitlement Pass 与客户列表重复时保留扫码选择状态,但刷新实时余额。
|
|
858
|
+
// 其他券继续沿用原来的“保留扫码结果、剔除列表重复项”行为。
|
|
859
|
+
scanDiscountById = new Map(scanDiscount.map(function (discount) {
|
|
860
|
+
return [String(discount.id), discount];
|
|
861
|
+
}));
|
|
862
|
+
refreshedScanEntitlementIds = new Set();
|
|
863
|
+
newGoodPassList = goodPassList.flatMap(function (discount) {
|
|
864
|
+
var key = String(discount.id);
|
|
865
|
+
var scannedDiscount = scanDiscountById.get(key);
|
|
866
|
+
if (!scannedDiscount) return [discount];
|
|
867
|
+
if (isEntitlementPass(scannedDiscount) && isEntitlementPass(discount)) {
|
|
868
|
+
var _scannedDiscount$isSe, _scannedDiscount$isMa;
|
|
869
|
+
refreshedScanEntitlementIds.add(key);
|
|
870
|
+
return [_objectSpread(_objectSpread({}, discount), {}, {
|
|
871
|
+
isScan: true,
|
|
872
|
+
isSelected: (_scannedDiscount$isSe = scannedDiscount.isSelected) !== null && _scannedDiscount$isSe !== void 0 ? _scannedDiscount$isSe : discount.isSelected,
|
|
873
|
+
isManualSelect: (_scannedDiscount$isMa = scannedDiscount.isManualSelect) !== null && _scannedDiscount$isMa !== void 0 ? _scannedDiscount$isMa : discount.isManualSelect
|
|
874
|
+
})];
|
|
875
|
+
}
|
|
876
|
+
return [];
|
|
820
877
|
});
|
|
821
|
-
|
|
822
|
-
return !
|
|
878
|
+
retainedScanDiscounts = scanDiscount.filter(function (discount) {
|
|
879
|
+
return !refreshedScanEntitlementIds.has(String(discount.id));
|
|
823
880
|
});
|
|
824
|
-
newDiscountList = [].concat(_toConsumableArray(
|
|
881
|
+
newDiscountList = [].concat(_toConsumableArray(retainedScanDiscounts), _toConsumableArray(newGoodPassList)); // 存储原始优惠券列表
|
|
825
882
|
this.store.originalDiscountList = newDiscountList;
|
|
826
|
-
_context10.next =
|
|
827
|
-
return (_this$store$
|
|
828
|
-
case
|
|
829
|
-
//
|
|
830
|
-
filteredDiscountList =
|
|
883
|
+
_context10.next = 16;
|
|
884
|
+
return (_this$store$discount10 = this.store.discount) === null || _this$store$discount10 === void 0 ? void 0 : _this$store$discount10.setOriginalDiscountList(newDiscountList);
|
|
885
|
+
case 16:
|
|
886
|
+
// 日程限制交给 Rules 计算可用状态,展示列表保留当前不可用的卡券。
|
|
887
|
+
filteredDiscountList = newDiscountList;
|
|
831
888
|
this.store.filteredDiscountList = filteredDiscountList;
|
|
832
889
|
this.setDiscountList(filteredDiscountList || []);
|
|
833
890
|
if (!((_this$store$productLi2 = this.store.productList) !== null && _this$store$productLi2 !== void 0 && _this$store$productLi2.length)) {
|
|
834
|
-
_context10.next =
|
|
891
|
+
_context10.next = 23;
|
|
835
892
|
break;
|
|
836
893
|
}
|
|
837
894
|
_result3 = this.calcDiscount(this.store.productList);
|
|
838
|
-
_context10.next = 21;
|
|
839
|
-
return this.core.effects.emit("".concat(this.name, ":onLoadPrepareCalcResult"), _result3);
|
|
840
|
-
case 21:
|
|
841
895
|
_context10.next = 23;
|
|
842
|
-
return this.core.effects.emit("".concat(this.name, ":
|
|
896
|
+
return this.core.effects.emit("".concat(this.name, ":onLoadPrepareCalcResult"), _result3);
|
|
843
897
|
case 23:
|
|
844
|
-
_context10.next =
|
|
845
|
-
|
|
898
|
+
_context10.next = 25;
|
|
899
|
+
return this.core.effects.emit("".concat(this.name, ":onLoadDiscountList"), filteredDiscountList);
|
|
846
900
|
case 25:
|
|
847
|
-
_context10.
|
|
901
|
+
_context10.next = 30;
|
|
902
|
+
break;
|
|
903
|
+
case 27:
|
|
904
|
+
_context10.prev = 27;
|
|
848
905
|
_context10.t0 = _context10["catch"](0);
|
|
849
906
|
console.error('[ShopDiscount] 加载准备配置出错:', _context10.t0);
|
|
850
|
-
case
|
|
907
|
+
case 30:
|
|
851
908
|
case "end":
|
|
852
909
|
return _context10.stop();
|
|
853
910
|
}
|
|
854
|
-
}, _callee10, this, [[0,
|
|
911
|
+
}, _callee10, this, [[0, 27]]);
|
|
855
912
|
}));
|
|
856
913
|
function loadPrepareConfig(_x10) {
|
|
857
914
|
return _loadPrepareConfig.apply(this, arguments);
|
|
@@ -59,12 +59,14 @@ export interface ScheduleItem {
|
|
|
59
59
|
}
|
|
60
60
|
export declare const getDateIsInSchedule: (dateTime: string, scheduleList: ScheduleItem[]) => boolean;
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
62
|
+
* 根据商品使用时间过滤优惠券列表(预约开始时间或普通商品的当前时间)
|
|
63
63
|
* @param discountList 优惠券列表
|
|
64
|
-
* @param bookingTime
|
|
64
|
+
* @param bookingTime 使用时间 (格式: YYYY-MM-DD HH:mm:ss),未确定时不提前过滤
|
|
65
65
|
* @returns 过滤后的优惠券列表
|
|
66
66
|
*/
|
|
67
67
|
export declare const filterDiscountListByBookingTime: (discountList: Discount[], bookingTime: string | null) => Discount[];
|
|
68
|
+
/** 与抵扣计算共用时间判断,区分未开始、有效期不匹配和日程限制。 */
|
|
69
|
+
export declare const getDiscountTimeUnavailableReason: (discount: Discount, useTime: string) => 'not_started' | 'time_limit' | 'outside_schedule' | undefined;
|
|
68
70
|
/**
|
|
69
71
|
* 判断是否是订单级别的固定金额折扣卡
|
|
70
72
|
* @param discount 折扣
|
|
@@ -9,6 +9,11 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
9
9
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
10
10
|
import Decimal from "decimal.js";
|
|
11
11
|
import dayjs from "dayjs";
|
|
12
|
+
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
|
|
13
|
+
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
|
|
14
|
+
import { isFullCoveragePass } from "../../modules/Discount/entitlementPass";
|
|
15
|
+
dayjs.extend(isSameOrAfter);
|
|
16
|
+
dayjs.extend(isSameOrBefore);
|
|
12
17
|
export var uniqueById = function uniqueById(arr) {
|
|
13
18
|
var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'id';
|
|
14
19
|
var seen = new Set();
|
|
@@ -41,8 +46,8 @@ export var isAllNormalProduct = function isAllNormalProduct(items) {
|
|
|
41
46
|
*/
|
|
42
47
|
export var getDiscountAmount = function getDiscountAmount(discount, total, price) {
|
|
43
48
|
var _discount$metadata;
|
|
44
|
-
//
|
|
45
|
-
if (discount
|
|
49
|
+
// 商品券和 Entitlement Pass 都是全额抵扣。
|
|
50
|
+
if (isFullCoveragePass(discount)) {
|
|
46
51
|
return new Decimal(price).minus(new Decimal(price || 0)).toNumber();
|
|
47
52
|
}
|
|
48
53
|
|
|
@@ -439,36 +444,51 @@ var isInWeeklyRepeatForDate = function isInWeeklyRepeatForDate(targetDate, start
|
|
|
439
444
|
};
|
|
440
445
|
|
|
441
446
|
/**
|
|
442
|
-
*
|
|
447
|
+
* 根据商品使用时间过滤优惠券列表(预约开始时间或普通商品的当前时间)
|
|
443
448
|
* @param discountList 优惠券列表
|
|
444
|
-
* @param bookingTime
|
|
449
|
+
* @param bookingTime 使用时间 (格式: YYYY-MM-DD HH:mm:ss),未确定时不提前过滤
|
|
445
450
|
* @returns 过滤后的优惠券列表
|
|
446
451
|
*/
|
|
447
452
|
export var filterDiscountListByBookingTime = function filterDiscountListByBookingTime(discountList, bookingTime) {
|
|
448
|
-
if (!bookingTime)
|
|
449
|
-
return discountList;
|
|
450
|
-
}
|
|
453
|
+
if (!bookingTime) return discountList;
|
|
451
454
|
return discountList.filter(function (discount) {
|
|
452
|
-
|
|
455
|
+
return !getDiscountTimeUnavailableReason(discount, bookingTime);
|
|
456
|
+
});
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
/** 与抵扣计算共用时间判断,区分未开始、有效期不匹配和日程限制。 */
|
|
460
|
+
export var getDiscountTimeUnavailableReason = function getDiscountTimeUnavailableReason(discount, useTime) {
|
|
461
|
+
var useTimeDayjs = dayjs(useTime);
|
|
462
|
+
if (!useTimeDayjs.isValid()) return 'time_limit';
|
|
463
|
+
try {
|
|
464
|
+
var _discount$metadata2, _discount$extension_d, _discount$custom_sche2;
|
|
453
465
|
if ((discount === null || discount === void 0 || (_discount$metadata2 = discount.metadata) === null || _discount$metadata2 === void 0 ? void 0 : _discount$metadata2.validity_type) === "custom_schedule_validity") {
|
|
454
466
|
var _discount$custom_sche;
|
|
455
|
-
return getDateIsInSchedule(
|
|
467
|
+
return getDateIsInSchedule(useTime, ((_discount$custom_sche = discount.custom_schedule_snapshot) === null || _discount$custom_sche === void 0 ? void 0 : _discount$custom_sche.data) || []) ? undefined : 'outside_schedule';
|
|
456
468
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
// 判断预约时间是否在过期时间之前(expire_time 为空时为长期有效)
|
|
466
|
-
var isBeforeExpire = discount.expire_time ? bookingTimeDayjs.isSameOrBefore(dayjs(discount.expire_time)) : true;
|
|
467
|
-
return isAfterStart && isBeforeExpire;
|
|
468
|
-
} catch (error) {
|
|
469
|
-
return true;
|
|
469
|
+
var isHasStart = !!discount.start_date && !!discount.start_time;
|
|
470
|
+
var startDate = dayjs("".concat(discount.start_date, " ").concat(discount.start_time));
|
|
471
|
+
|
|
472
|
+
// 开始时刻包含在有效期内。
|
|
473
|
+
if (isHasStart) {
|
|
474
|
+
if (!startDate.isValid()) return 'time_limit';
|
|
475
|
+
if (useTimeDayjs.isBefore(startDate)) return 'not_started';
|
|
470
476
|
}
|
|
471
|
-
|
|
477
|
+
|
|
478
|
+
// 到期时刻不再可用;expire_time 为空时为长期有效。
|
|
479
|
+
var expireTime = discount.expire_time ? dayjs(discount.expire_time) : null;
|
|
480
|
+
var isBeforeExpire = expireTime ? expireTime.isValid() && useTimeDayjs.isBefore(expireTime) : true;
|
|
481
|
+
if (!isBeforeExpire) return 'time_limit';
|
|
482
|
+
var validity = (_discount$extension_d = discount.extension_data) === null || _discount$extension_d === void 0 || (_discount$extension_d = _discount$extension_d.find(function (field) {
|
|
483
|
+
return field.field_key === 'valid_times';
|
|
484
|
+
})) === null || _discount$extension_d === void 0 ? void 0 : _discount$extension_d.value;
|
|
485
|
+
if ((validity === null || validity === void 0 ? void 0 : validity.restrict_use_by_schedule) === true && !getDateIsInSchedule(useTime, ((_discount$custom_sche2 = discount.custom_schedule_snapshot) === null || _discount$custom_sche2 === void 0 ? void 0 : _discount$custom_sche2.data) || [])) {
|
|
486
|
+
return 'outside_schedule';
|
|
487
|
+
}
|
|
488
|
+
return undefined;
|
|
489
|
+
} catch (error) {
|
|
490
|
+
return 'time_limit';
|
|
491
|
+
}
|
|
472
492
|
};
|
|
473
493
|
/**
|
|
474
494
|
* 判断是否是订单级别的固定金额折扣卡
|
|
@@ -127,8 +127,8 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
127
127
|
*/
|
|
128
128
|
clearSessionStorageOrderSnapshot(): void;
|
|
129
129
|
/**
|
|
130
|
-
* H5/Kiosk
|
|
131
|
-
*
|
|
130
|
+
* PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
131
|
+
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|
|
132
132
|
*/
|
|
133
133
|
protected shouldUseCheckoutSyncTask(): boolean;
|
|
134
134
|
/** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
|
|
@@ -166,7 +166,7 @@ export function buildPlannerDiscountResult(params) {
|
|
|
166
166
|
productDiscounts.forEach(function (discount) {
|
|
167
167
|
var _product$product_id, _product$metadata;
|
|
168
168
|
var type = discount.tag || discount.type;
|
|
169
|
-
if (!['good_pass', 'discount_card', 'product_discount_card'].includes(type)) return;
|
|
169
|
+
if (!['entitlement_pass', 'good_pass', 'discount_card', 'product_discount_card'].includes(type)) return;
|
|
170
170
|
var discountId = resolvePlannerDiscountId(discount);
|
|
171
171
|
applications.push({
|
|
172
172
|
discountId: discountId,
|
|
@@ -218,7 +218,7 @@ function isLocalOrderId(orderId) {
|
|
|
218
218
|
function isCustomerBoundDiscount(discount) {
|
|
219
219
|
var _discount$type;
|
|
220
220
|
var type = (_discount$type = discount === null || discount === void 0 ? void 0 : discount.type) !== null && _discount$type !== void 0 ? _discount$type : discount === null || discount === void 0 ? void 0 : discount.tag;
|
|
221
|
-
return type === 'good_pass' || type === 'discount_card' || type === 'product_discount_card';
|
|
221
|
+
return type === 'entitlement_pass' || type === 'good_pass' || type === 'discount_card' || type === 'product_discount_card';
|
|
222
222
|
}
|
|
223
223
|
function filterCustomerBoundDiscounts(discountList) {
|
|
224
224
|
if (!Array.isArray(discountList)) return [];
|
|
@@ -1903,8 +1903,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1903
1903
|
}
|
|
1904
1904
|
|
|
1905
1905
|
/**
|
|
1906
|
-
* H5/Kiosk
|
|
1907
|
-
*
|
|
1906
|
+
* PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
1907
|
+
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|
|
1908
1908
|
*/
|
|
1909
1909
|
}, {
|
|
1910
1910
|
key: "shouldUseCheckoutSyncTask",
|
|
@@ -1913,7 +1913,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1913
1913
|
var configured = (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.checkoutSyncTaskEnabled;
|
|
1914
1914
|
if (configured === true) return true;
|
|
1915
1915
|
var platform = normalizeRuntimePlatform((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.platform);
|
|
1916
|
-
return platform
|
|
1916
|
+
return !isCustomerUserPlatform(platform) && platform !== 'kiosk';
|
|
1917
1917
|
}
|
|
1918
1918
|
|
|
1919
1919
|
/** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
import { cloneDeep } from 'lodash-es';
|
|
3
|
+
var OS_PRIVATE_FIELD_PREFIX = '_os_';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Remove top-level fields reserved for communication with the PisellOS proxy.
|
|
7
|
+
* Nested business payloads are intentionally left untouched.
|
|
8
|
+
*/
|
|
9
|
+
export function stripOsPrivatePayloadFields(data) {
|
|
10
|
+
var next = cloneDeep(data);
|
|
11
|
+
if (!next || _typeof(next) !== 'object' || Array.isArray(next)) return next;
|
|
12
|
+
var record = next;
|
|
13
|
+
Object.keys(record).forEach(function (key) {
|
|
14
|
+
if (key.startsWith(OS_PRIVATE_FIELD_PREFIX)) delete record[key];
|
|
15
|
+
});
|
|
16
|
+
return next;
|
|
17
|
+
}
|
|
@@ -28,6 +28,8 @@ export declare class WalletPassEvaluator {
|
|
|
28
28
|
/** 检查代金券/折扣卡是否可用 并返回config */
|
|
29
29
|
checkVoucherAvailability(input: EvaluatorInput): {
|
|
30
30
|
isAvailable: boolean;
|
|
31
|
+
reason: string | undefined;
|
|
32
|
+
reasonCode: string | undefined;
|
|
31
33
|
config: {
|
|
32
34
|
[x: string]: any;
|
|
33
35
|
};
|
|
@@ -256,6 +256,8 @@ class WalletPassEvaluator {
|
|
|
256
256
|
const isAvailable = results[0]?.isApplicable || false;
|
|
257
257
|
return {
|
|
258
258
|
isAvailable,
|
|
259
|
+
reason: results[0]?.reason,
|
|
260
|
+
reasonCode: results[0]?.reasonCode,
|
|
259
261
|
config: {
|
|
260
262
|
...results[0]?.strategyResult?.config?.metadata?.custom
|
|
261
263
|
}
|
|
@@ -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,
|