@pisell/pisellos 2.2.266 → 2.2.267
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/adapter.d.ts +0 -4
- package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
- package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/dist/model/strategy/adapter/promotion/examples.js +0 -99
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/dist/model/strategy/adapter/promotion/type.js +0 -45
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
- package/dist/modules/Order/index.d.ts +8 -27
- package/dist/modules/Order/index.js +493 -753
- package/dist/modules/Order/types.d.ts +1 -33
- package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
- package/dist/modules/Order/utils.js +6 -10
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +50 -79
- package/dist/modules/Payment/types.d.ts +27 -29
- package/dist/modules/Payment/types.js +3 -5
- package/dist/modules/Rules/index.d.ts +0 -1
- package/dist/modules/Rules/index.js +14 -34
- package/dist/server/index.d.ts +0 -16
- package/dist/server/index.js +1036 -1933
- package/dist/server/modules/order/index.d.ts +4 -49
- package/dist/server/modules/order/index.js +695 -1574
- package/dist/server/modules/order/types.d.ts +3 -11
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +11 -55
- package/dist/solution/BaseSales/index.js +396 -711
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +36 -93
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +29 -35
- package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
- package/dist/solution/Sales/index.d.ts +0 -1
- package/dist/solution/Sales/index.js +2 -10
- package/dist/solution/ScanOrder/index.js +20 -31
- package/dist/solution/VenueBooking/index.js +19 -30
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
- package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/lib/model/strategy/adapter/promotion/examples.js +0 -91
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/lib/model/strategy/adapter/promotion/type.js +0 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/lib/modules/Order/index.d.ts +8 -27
- package/lib/modules/Order/index.js +72 -193
- package/lib/modules/Order/types.d.ts +1 -33
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
- package/lib/modules/Order/utils.js +4 -11
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +13 -34
- package/lib/modules/Payment/types.d.ts +27 -29
- package/lib/modules/Payment/types.js +3 -3
- package/lib/modules/Rules/index.d.ts +0 -1
- package/lib/modules/Rules/index.js +4 -23
- package/lib/server/index.d.ts +0 -16
- package/lib/server/index.js +18 -670
- package/lib/server/modules/order/index.d.ts +4 -49
- package/lib/server/modules/order/index.js +66 -657
- package/lib/server/modules/order/types.d.ts +3 -11
- package/lib/solution/BaseSales/index.d.ts +11 -55
- package/lib/solution/BaseSales/index.js +35 -235
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +17 -65
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +3 -6
- package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
- package/lib/solution/Sales/index.d.ts +0 -1
- package/lib/solution/Sales/index.js +3 -5
- package/lib/solution/ScanOrder/index.js +0 -8
- package/lib/solution/VenueBooking/index.js +0 -8
- package/package.json +2 -2
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/payment-utils.js +0 -225
- package/dist/utils/payment-number.d.ts +0 -9
- package/dist/utils/payment-number.js +0 -69
- package/lib/modules/Order/payment-utils.d.ts +0 -26
- package/lib/modules/Order/payment-utils.js +0 -224
- package/lib/utils/payment-number.d.ts +0 -9
- package/lib/utils/payment-number.js +0 -64
|
@@ -31,9 +31,6 @@ var import_cash = require("./cash");
|
|
|
31
31
|
var import_eftpos = require("./eftpos");
|
|
32
32
|
var import_walletpass = require("./walletpass");
|
|
33
33
|
var import_decimal = require("decimal.js");
|
|
34
|
-
var import_payment_utils = require("../Order/payment-utils");
|
|
35
|
-
var import_utils2 = require("../Order/utils");
|
|
36
|
-
var import_payment_number = require("../../utils/payment-number");
|
|
37
34
|
__reExport(Payment_exports, require("./types"), module.exports);
|
|
38
35
|
function formatAmount(amount) {
|
|
39
36
|
try {
|
|
@@ -115,15 +112,15 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
115
112
|
this.store = options.store;
|
|
116
113
|
this.otherParams = options.otherParams || {};
|
|
117
114
|
this.request = core.getPlugin("request");
|
|
118
|
-
|
|
115
|
+
const appPlugin = core.getPlugin("app");
|
|
119
116
|
this.window = core.getPlugin("window");
|
|
120
117
|
if (!this.request) {
|
|
121
118
|
throw new Error("支付模块需要 request 插件支持");
|
|
122
119
|
}
|
|
123
|
-
if (!
|
|
120
|
+
if (!appPlugin) {
|
|
124
121
|
throw new Error("支付模块需要 app 插件支持");
|
|
125
122
|
}
|
|
126
|
-
this.app =
|
|
123
|
+
this.app = appPlugin.getApp();
|
|
127
124
|
this.dbManager = this.app.dbManager;
|
|
128
125
|
this.logger = this.app.logger;
|
|
129
126
|
this.registerNetworkHandlers();
|
|
@@ -139,14 +136,6 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
139
136
|
updateOtherParams(params) {
|
|
140
137
|
this.otherParams = params || {};
|
|
141
138
|
}
|
|
142
|
-
getPaymentNumberAppData(key) {
|
|
143
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
144
|
-
const getData = (_b = (_a = this.appPlugin) == null ? void 0 : _a.getData) == null ? void 0 : _b.call(_a);
|
|
145
|
-
if (typeof getData === "function")
|
|
146
|
-
return getData(key);
|
|
147
|
-
const coreData = (_g = (_e = (_d = (_c = this.app) == null ? void 0 : _c.models) == null ? void 0 : _d.getStore) == null ? void 0 : (_f = _e.call(_d)).getDataByModel) == null ? void 0 : _g.call(_f, "core", "core");
|
|
148
|
-
return coreData == null ? void 0 : coreData[key];
|
|
149
|
-
}
|
|
150
139
|
/**
|
|
151
140
|
* 记录信息日志
|
|
152
141
|
*/
|
|
@@ -532,20 +521,15 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
532
521
|
});
|
|
533
522
|
throw new Error(warningMessage);
|
|
534
523
|
}
|
|
535
|
-
|
|
524
|
+
let paymentUuid;
|
|
525
|
+
if ((_a = paymentItem.metadata) == null ? void 0 : _a.unique_payment_number) {
|
|
526
|
+
paymentUuid = paymentItem.metadata.unique_payment_number;
|
|
527
|
+
} else {
|
|
528
|
+
paymentUuid = (0, import_utils.getUniqueId)("payment_");
|
|
529
|
+
}
|
|
536
530
|
const currentTime = formatDateTime(/* @__PURE__ */ new Date());
|
|
537
|
-
const hasPaymentNumber = String(paymentItem.payment_number || "").trim() !== "";
|
|
538
|
-
const paymentNumberDevicePrefix = hasPaymentNumber ? "LOCAL" : await (0, import_payment_number.resolvePaymentNumberDevicePrefix)(
|
|
539
|
-
(key) => this.getPaymentNumberAppData(key)
|
|
540
|
-
);
|
|
541
|
-
const paymentNumber = (0, import_payment_utils.ensureOrderPaymentNumber)(
|
|
542
|
-
paymentItem,
|
|
543
|
-
paymentNumberDevicePrefix,
|
|
544
|
-
import_utils2.createUuidV4
|
|
545
|
-
).payment_number;
|
|
546
531
|
const newPaymentItem = {
|
|
547
532
|
uuid: paymentUuid,
|
|
548
|
-
payment_number: paymentNumber,
|
|
549
533
|
custom_payment_id: normalizeCustomPaymentId(paymentItem),
|
|
550
534
|
name: paymentItem.name,
|
|
551
535
|
code: paymentItem.code,
|
|
@@ -565,8 +549,10 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
565
549
|
updated_at: currentTime,
|
|
566
550
|
// 更新时间
|
|
567
551
|
metadata: {
|
|
568
|
-
...paymentItem.metadata
|
|
552
|
+
...paymentItem.metadata,
|
|
569
553
|
// 保留传入的所有 metadata 字段
|
|
554
|
+
unique_payment_number: paymentUuid
|
|
555
|
+
// 设置唯一支付号为支付项的 uuid
|
|
570
556
|
}
|
|
571
557
|
};
|
|
572
558
|
order.payment.push(newPaymentItem);
|
|
@@ -781,12 +767,6 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
781
767
|
if ("amount" in formattedParams && formattedParams.amount !== void 0) {
|
|
782
768
|
formattedParams.amount = formatAmount(formattedParams.amount);
|
|
783
769
|
}
|
|
784
|
-
if (formattedParams.metadata && typeof formattedParams.metadata === "object") {
|
|
785
|
-
formattedParams.metadata = {
|
|
786
|
-
...paymentItem.metadata || {},
|
|
787
|
-
...formattedParams.metadata
|
|
788
|
-
};
|
|
789
|
-
}
|
|
790
770
|
Object.assign(paymentItem, formattedParams);
|
|
791
771
|
this.recalculateOrderAmount(order);
|
|
792
772
|
await this.dbManager.update("order", order);
|
|
@@ -844,7 +824,6 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
844
824
|
const paymentData = {
|
|
845
825
|
payments: order.payment.map((payment) => ({
|
|
846
826
|
uuid: payment.uuid,
|
|
847
|
-
payment_number: payment.payment_number,
|
|
848
827
|
amount: payment.amount,
|
|
849
828
|
code: payment.code,
|
|
850
829
|
custom_payment_id: payment.custom_payment_id,
|
|
@@ -1088,7 +1067,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
1088
1067
|
roundedValue = this.standardRound(baseValue, true);
|
|
1089
1068
|
break;
|
|
1090
1069
|
case import_types.RoundingRule.StandardDown:
|
|
1091
|
-
case "
|
|
1070
|
+
case "standard_rounding_midpoint_down":
|
|
1092
1071
|
roundedValue = this.standardRound(baseValue, false);
|
|
1093
1072
|
break;
|
|
1094
1073
|
case import_types.RoundingRule.AlwaysUp:
|
|
@@ -40,11 +40,11 @@ export declare enum RoundingRule {
|
|
|
40
40
|
/** 标准舍入(中点向上) */
|
|
41
41
|
Standard = "standard_rounding",
|
|
42
42
|
/** 标准舍入(中点向下) */
|
|
43
|
-
StandardDown = "
|
|
43
|
+
StandardDown = "standard_rounding_midpoint_down",
|
|
44
44
|
/** 总是向上舍入 */
|
|
45
|
-
AlwaysUp = "
|
|
45
|
+
AlwaysUp = "round_up",
|
|
46
46
|
/** 总是向下舍入 */
|
|
47
|
-
AlwaysDown = "
|
|
47
|
+
AlwaysDown = "round_down"
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* 舍入结果
|
|
@@ -87,30 +87,12 @@ export interface PaymentMethod {
|
|
|
87
87
|
/** 其他配置信息 */
|
|
88
88
|
[key: string]: any;
|
|
89
89
|
}
|
|
90
|
-
/** 支付项扩展元数据 */
|
|
91
|
-
export interface PaymentItemMetadata {
|
|
92
|
-
/** 钱箱 ID */
|
|
93
|
-
shop_wallet_pass_id?: string;
|
|
94
|
-
/** 三方支付交易流水号 */
|
|
95
|
-
unique_payment_number?: string;
|
|
96
|
-
/** 刷卡机设备快照;PaymentModule 不解析内部字段 */
|
|
97
|
-
card_reader_snapshot?: Record<string, unknown>;
|
|
98
|
-
/** rounding 规则 */
|
|
99
|
-
rounding_rule?: any;
|
|
100
|
-
/** 实付金额(现金支付时的实际给出金额) */
|
|
101
|
-
actual_paid_amount?: number;
|
|
102
|
-
/** 找零金额(现金支付时的找零金额) */
|
|
103
|
-
change_given_amount?: number;
|
|
104
|
-
[key: string]: unknown;
|
|
105
|
-
}
|
|
106
90
|
/**
|
|
107
91
|
* 支付项
|
|
108
92
|
*/
|
|
109
93
|
export interface PaymentItem {
|
|
110
94
|
/** 当前支付项的唯一 ID */
|
|
111
95
|
uuid: string;
|
|
112
|
-
/** 支付项稳定唯一号 */
|
|
113
|
-
payment_number?: string;
|
|
114
96
|
/** 当前支付方式付出去多少钱 */
|
|
115
97
|
amount: string;
|
|
116
98
|
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
|
@@ -128,7 +110,18 @@ export interface PaymentItem {
|
|
|
128
110
|
/** Wallet Pass 本次使用值 */
|
|
129
111
|
wallet_pass_use_value?: string | number | null;
|
|
130
112
|
/** 拓展参数字段 */
|
|
131
|
-
metadata?:
|
|
113
|
+
metadata?: {
|
|
114
|
+
/** 钱箱 ID */
|
|
115
|
+
shop_wallet_pass_id?: string;
|
|
116
|
+
/** 唯一支付号 */
|
|
117
|
+
unique_payment_number?: string;
|
|
118
|
+
/** rouding规则 */
|
|
119
|
+
rounding_rule?: any;
|
|
120
|
+
/** 实付金额(现金支付时的实际给出金额) */
|
|
121
|
+
actual_paid_amount?: number;
|
|
122
|
+
/** 找零金额(现金支付时的找零金额) */
|
|
123
|
+
change_given_amount?: number;
|
|
124
|
+
};
|
|
132
125
|
/** rouding金额 */
|
|
133
126
|
rounding_amount?: string;
|
|
134
127
|
/** 三方支付手续费 */
|
|
@@ -235,10 +228,6 @@ export interface UpdateOrderParams {
|
|
|
235
228
|
* 支付项输入类型(允许 amount 为数字)
|
|
236
229
|
*/
|
|
237
230
|
export interface PaymentItemInput {
|
|
238
|
-
/** 调用方已有的支付项运行态 UUID;存在时复用为 payment_number 的唯一号段 */
|
|
239
|
-
uuid?: string;
|
|
240
|
-
/** 支付项稳定唯一号 */
|
|
241
|
-
payment_number?: string;
|
|
242
231
|
/** 当前支付方式付出去多少钱 */
|
|
243
232
|
amount: string | number;
|
|
244
233
|
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
|
@@ -267,7 +256,18 @@ export interface PaymentItemInput {
|
|
|
267
256
|
/** 订单支付类型 */
|
|
268
257
|
order_payment_type?: 'normal' | 'deposit';
|
|
269
258
|
/** 扩展参数字段 */
|
|
270
|
-
metadata?:
|
|
259
|
+
metadata?: {
|
|
260
|
+
/** 钱箱 ID */
|
|
261
|
+
shop_wallet_pass_id?: string;
|
|
262
|
+
/** 唯一支付号 */
|
|
263
|
+
unique_payment_number?: string;
|
|
264
|
+
/** rounding规则 */
|
|
265
|
+
rounding_rule?: any;
|
|
266
|
+
/** 实付金额(现金支付时的实际给出金额) */
|
|
267
|
+
actual_paid_amount?: number;
|
|
268
|
+
/** 找零金额(现金支付时的找零金额) */
|
|
269
|
+
change_given_amount?: number;
|
|
270
|
+
};
|
|
271
271
|
/** 支付项创建时间 (格式: YYYY-MM-DD HH:mm:ss, 可选,不传则自动生成) */
|
|
272
272
|
created_at?: string;
|
|
273
273
|
/** 支付项更新时间 (格式: YYYY-MM-DD HH:mm:ss, 可选,不传则自动生成) */
|
|
@@ -302,8 +302,6 @@ export interface PaymentUpdateFields {
|
|
|
302
302
|
voucher_id?: string;
|
|
303
303
|
/** 该支付项是否已经同步给后端服务器(只有网络请求成功后才为true) */
|
|
304
304
|
isSynced?: boolean;
|
|
305
|
-
/** 支付项扩展元数据;更新时与原 metadata 浅合并 */
|
|
306
|
-
metadata?: PaymentItemMetadata;
|
|
307
305
|
/** 同步错误信息(业务错误时记录错误信息,用于区分"未同步"和"同步失败") */
|
|
308
306
|
syncError?: {
|
|
309
307
|
error: string;
|
|
@@ -51,9 +51,9 @@ var TaskRunStatus = /* @__PURE__ */ ((TaskRunStatus2) => {
|
|
|
51
51
|
})(TaskRunStatus || {});
|
|
52
52
|
var RoundingRule = /* @__PURE__ */ ((RoundingRule2) => {
|
|
53
53
|
RoundingRule2["Standard"] = "standard_rounding";
|
|
54
|
-
RoundingRule2["StandardDown"] = "
|
|
55
|
-
RoundingRule2["AlwaysUp"] = "
|
|
56
|
-
RoundingRule2["AlwaysDown"] = "
|
|
54
|
+
RoundingRule2["StandardDown"] = "standard_rounding_midpoint_down";
|
|
55
|
+
RoundingRule2["AlwaysUp"] = "round_up";
|
|
56
|
+
RoundingRule2["AlwaysDown"] = "round_down";
|
|
57
57
|
return RoundingRule2;
|
|
58
58
|
})(RoundingRule || {});
|
|
59
59
|
var RoundingInterval = /* @__PURE__ */ ((RoundingInterval2) => {
|
|
@@ -35,7 +35,6 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
35
35
|
excludeDiscountListByType(discountList: Discount[], type: string): Discount[];
|
|
36
36
|
/** 手动改价场景:去掉 promotion,保留 type=product 等行内折扣 */
|
|
37
37
|
resolveDiscountListForManualOverride(discountList: Discount[]): Discount[];
|
|
38
|
-
private isItemRewardProductDiscount;
|
|
39
38
|
private getUnavailableReason;
|
|
40
39
|
calcDiscount({ discountList, productList, holders, isFormSubject, orderTotalAmount }: {
|
|
41
40
|
discountList: Discount[];
|
|
@@ -167,16 +167,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
167
167
|
resolveDiscountListForManualOverride(discountList) {
|
|
168
168
|
return this.excludeDiscountListByType(discountList, "promotion");
|
|
169
169
|
}
|
|
170
|
-
isItemRewardProductDiscount(product) {
|
|
171
|
-
var _a;
|
|
172
|
-
const discountList = Array.isArray(product == null ? void 0 : product.discount_list) ? product.discount_list : [];
|
|
173
|
-
return ((_a = product == null ? void 0 : product._promotion) == null ? void 0 : _a.actionType) === "ITEM_REWARD" && discountList.some(
|
|
174
|
-
(item) => {
|
|
175
|
-
var _a2, _b;
|
|
176
|
-
return (item == null ? void 0 : item.type) === "product" && ((_a2 = item == null ? void 0 : item.metadata) == null ? void 0 : _a2.source) === "promotion" && ((_b = item == null ? void 0 : item.metadata) == null ? void 0 : _b.actionType) === "ITEM_REWARD";
|
|
177
|
-
}
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
170
|
// 获取券不可用的原因
|
|
181
171
|
getUnavailableReason(discountList, productList) {
|
|
182
172
|
var _a;
|
|
@@ -510,9 +500,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
510
500
|
startDate: (_a2 = flatItem.parentProduct) == null ? void 0 : _a2.startDate
|
|
511
501
|
};
|
|
512
502
|
}
|
|
513
|
-
if (this.isItemRewardProductDiscount(product)) {
|
|
514
|
-
return false;
|
|
515
|
-
}
|
|
516
503
|
const isAvailableProduct = flatItem.type === "main" ? !((product == null ? void 0 : product.booking_id) && ((_b = product == null ? void 0 : product.discount_list) == null ? void 0 : _b.length) && ((_c = product == null ? void 0 : product.discount_list) == null ? void 0 : _c.every((d) => d.id && ["good_pass", "discount_card", "product_discount_card"].includes(d.tag || d.type)))) : !((flatItem == null ? void 0 : flatItem.booking_id) && !!((_e = (_d = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _d.discount_list) == null ? void 0 : _e.length) && ((_g = (_f = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _f.discount_list) == null ? void 0 : _g.every((d) => d.id)));
|
|
517
504
|
if (!isAvailableProduct) {
|
|
518
505
|
return false;
|
|
@@ -638,7 +625,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
638
625
|
};
|
|
639
626
|
originProduct = flatItem.originProduct;
|
|
640
627
|
}
|
|
641
|
-
const isItemRewardProductDiscount = this.isItemRewardProductDiscount(product);
|
|
642
628
|
addModeDiscount.forEach((discount) => {
|
|
643
629
|
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
644
630
|
const limitedData = discount == null ? void 0 : discount.limited_relation_product_data;
|
|
@@ -662,7 +648,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
662
648
|
].includes(discount2.tag || discount2.type)
|
|
663
649
|
))) : !((flatItem == null ? void 0 : flatItem.booking_id) && !!((_d = (_c = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _c.discount_list) == null ? void 0 : _d.length) && ((_f = (_e = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _e.discount_list) == null ? void 0 : _f.every((discount2) => discount2.id)));
|
|
664
650
|
const isBundleAvailable = this.checkPackageSubItemUsageRules(discount, flatItem);
|
|
665
|
-
if (isAvailableProduct &&
|
|
651
|
+
if (isAvailableProduct && isLimitedProduct && timeLimit && isBundleAvailable && ((_g = discount.config) == null ? void 0 : _g.isAvailable)) {
|
|
666
652
|
(_h = discountApplicability.get(discount.id)) == null ? void 0 : _h.push(product.id);
|
|
667
653
|
const applicableProducts = discountApplicableProducts.get(discount.id) || [];
|
|
668
654
|
const discountType = discount.tag || discount.type;
|
|
@@ -785,8 +771,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
785
771
|
}
|
|
786
772
|
const applicableDiscounts = sortedDiscountList.filter((discount) => {
|
|
787
773
|
var _a3, _b2, _c2, _d2;
|
|
788
|
-
if (this.isItemRewardProductDiscount(product))
|
|
789
|
-
return false;
|
|
790
774
|
const discountType = discount.tag || discount.type;
|
|
791
775
|
const currentOriginUid = getOriginProductUid(originProduct);
|
|
792
776
|
const isReapplyEditModeDiscountForProduct = discount.isEditMode && reapplyBookingDiscountProductUids.size > 0 && currentOriginUid && reapplyBookingDiscountProductUids.has(String(currentOriginUid)) && discount.isSelected === true;
|
|
@@ -861,7 +845,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
861
845
|
);
|
|
862
846
|
const selectedDiscount = selectedDiscountCard || applicableDiscounts[0];
|
|
863
847
|
let isManualDiscount = false;
|
|
864
|
-
let isItemRewardProductDiscount = false;
|
|
865
848
|
if (flatItem.type === "main") {
|
|
866
849
|
isManualDiscount = typeof product.isManualDiscount === "boolean" ? product.isManualDiscount : ((_g = product.discount_list) == null ? void 0 : _g.some((item) => item.type === "product")) || product.total != product.origin_total && (product.bundle || []).every(
|
|
867
850
|
(item) => {
|
|
@@ -872,8 +855,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
872
855
|
_i,
|
|
873
856
|
(item) => item.type === "product"
|
|
874
857
|
)));
|
|
875
|
-
|
|
876
|
-
if (product.inPromotion && !isItemRewardProductDiscount) {
|
|
858
|
+
if (product.inPromotion) {
|
|
877
859
|
isManualDiscount = false;
|
|
878
860
|
}
|
|
879
861
|
} else {
|
|
@@ -987,7 +969,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
987
969
|
} else {
|
|
988
970
|
let total = product.inPromotion ? ((_w = product == null ? void 0 : product._promotion) == null ? void 0 : _w.finalPrice) ?? product.origin_total ?? product.total : product.origin_total ?? product.total;
|
|
989
971
|
let main_product_selling_price = product.price;
|
|
990
|
-
if ((product.discount_list || []).some((item) => item.type === "promotion") ||
|
|
972
|
+
if ((product.discount_list || []).some((item) => item.type === "promotion") || (0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
|
|
991
973
|
total = product.total ?? product.origin_total;
|
|
992
974
|
main_product_selling_price = product.main_product_selling_price ?? main_product_selling_price;
|
|
993
975
|
}
|
|
@@ -995,8 +977,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
995
977
|
this.hooks.setProduct(originProduct, {
|
|
996
978
|
...isManualDiscount ? {
|
|
997
979
|
price: product.price,
|
|
998
|
-
main_product_selling_price:
|
|
999
|
-
...isItemRewardProductDiscount ? { total } : {}
|
|
980
|
+
main_product_selling_price: product.price
|
|
1000
981
|
} : {
|
|
1001
982
|
_id: product._id.split("___")[0] + "___" + index,
|
|
1002
983
|
total,
|
package/lib/server/index.d.ts
CHANGED
|
@@ -57,7 +57,6 @@ declare class Server {
|
|
|
57
57
|
private readonly BOOKING_REMOTE_CACHE_MAX_ENTRIES;
|
|
58
58
|
private salesSearchSubscribers;
|
|
59
59
|
private deviceTaskActionsRegistered;
|
|
60
|
-
private localPaymentUpdateQueues;
|
|
61
60
|
private floorPlanQuerySubscribers;
|
|
62
61
|
private moduleRegistry;
|
|
63
62
|
constructor(core: PisellCore);
|
|
@@ -121,8 +120,6 @@ declare class Server {
|
|
|
121
120
|
private handleSyncSalesTask;
|
|
122
121
|
private runCheckoutSync;
|
|
123
122
|
private omitCheckoutSyncMode;
|
|
124
|
-
private buildRemoteCheckoutData;
|
|
125
|
-
private mergeCheckoutSyncPayments;
|
|
126
123
|
private persistSyncedCheckoutOrder;
|
|
127
124
|
/**
|
|
128
125
|
* 将普通层 QuotationModule 的报价单计算能力桥接到 Server Products 模块。
|
|
@@ -456,18 +453,6 @@ declare class Server {
|
|
|
456
453
|
*/
|
|
457
454
|
private handleUpdateLocalOrder;
|
|
458
455
|
private handleOrderSalesCheckout;
|
|
459
|
-
private handleOrderSalesDraft;
|
|
460
|
-
private createLocalPaymentOperationId;
|
|
461
|
-
private buildLocalPaymentOrderLogContext;
|
|
462
|
-
private isValidLocalPaymentDecimal;
|
|
463
|
-
private getInvalidLocalPaymentSurchargeFields;
|
|
464
|
-
private buildLocalPaymentSurchargeUpdate;
|
|
465
|
-
private handleGetLocalPayment;
|
|
466
|
-
private handleUpdateLocalPayment;
|
|
467
|
-
private runLocalPaymentUpdateInQueue;
|
|
468
|
-
private processLocalPaymentUpdate;
|
|
469
|
-
private processSuccessfulLocalPayment;
|
|
470
|
-
private sanitizeLocalRecoveryOrder;
|
|
471
456
|
private handleOrderCheckout;
|
|
472
457
|
private getDeviceTaskPlugin;
|
|
473
458
|
private getIdGeneratorPlugin;
|
|
@@ -495,7 +480,6 @@ declare class Server {
|
|
|
495
480
|
private syncMachinecodeRedeemStatusToLocalOrder;
|
|
496
481
|
private handleOrderCheckoutSubmit;
|
|
497
482
|
private handleSyncCheckoutSubmit;
|
|
498
|
-
private handleOrderDraftSubmit;
|
|
499
483
|
private handlePendingSyncCheckoutOrder;
|
|
500
484
|
private buildPendingSyncCheckoutOrder;
|
|
501
485
|
private shouldBuildSmallTicketData;
|