@pisell/pisellos 2.2.8 → 2.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/Cart/utils/cartProduct.js +41 -26
- package/dist/modules/Customer/index.js +1 -1
- package/dist/modules/Discount/index.d.ts +3 -0
- package/dist/modules/Discount/index.js +70 -37
- package/dist/modules/Discount/types.d.ts +16 -0
- package/dist/modules/Order/index.js +4 -1
- package/dist/modules/Order/utils.d.ts +1 -0
- package/dist/modules/Order/utils.js +9 -0
- package/dist/modules/Payment/cash.js +1 -1
- package/dist/modules/Payment/eftpos.js +1 -1
- package/dist/modules/Payment/index.js +101 -31
- package/dist/modules/Payment/types.d.ts +22 -2
- package/dist/modules/Payment/walletpass.js +8 -3
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +8 -9
- package/dist/modules/Rules/index.d.ts +16 -2
- package/dist/modules/Rules/index.js +1102 -200
- package/dist/modules/Rules/types.d.ts +8 -1
- package/dist/solution/BookingByStep/index.js +30 -8
- package/dist/solution/BookingByStep/utils/products.d.ts +6 -0
- package/dist/solution/BookingByStep/utils/products.js +10 -0
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Checkout/index.d.ts +2 -0
- package/dist/solution/Checkout/index.js +277 -88
- package/dist/solution/Checkout/types.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.d.ts +5 -0
- package/dist/solution/ShopDiscount/index.js +96 -24
- package/dist/solution/ShopDiscount/types.d.ts +9 -1
- package/dist/solution/ShopDiscount/utils.d.ts +55 -0
- package/dist/solution/ShopDiscount/utils.js +432 -3
- package/lib/modules/Cart/utils/cartProduct.js +35 -22
- package/lib/modules/Customer/index.js +1 -1
- package/lib/modules/Discount/index.d.ts +3 -0
- package/lib/modules/Discount/index.js +20 -5
- package/lib/modules/Discount/types.d.ts +16 -0
- package/lib/modules/Order/index.js +2 -0
- package/lib/modules/Order/utils.d.ts +1 -0
- package/lib/modules/Order/utils.js +11 -0
- package/lib/modules/Payment/cash.js +1 -1
- package/lib/modules/Payment/eftpos.js +1 -1
- package/lib/modules/Payment/index.js +71 -11
- package/lib/modules/Payment/types.d.ts +22 -2
- package/lib/modules/Payment/walletpass.js +15 -4
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +0 -7
- package/lib/modules/Rules/index.d.ts +16 -2
- package/lib/modules/Rules/index.js +857 -184
- package/lib/modules/Rules/types.d.ts +8 -1
- package/lib/solution/BookingByStep/index.js +19 -2
- package/lib/solution/BookingByStep/utils/products.d.ts +6 -0
- package/lib/solution/BookingByStep/utils/products.js +8 -2
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Checkout/index.d.ts +2 -0
- package/lib/solution/Checkout/index.js +185 -25
- package/lib/solution/Checkout/types.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.d.ts +5 -0
- package/lib/solution/ShopDiscount/index.js +67 -13
- package/lib/solution/ShopDiscount/types.d.ts +9 -1
- package/lib/solution/ShopDiscount/utils.d.ts +55 -0
- package/lib/solution/ShopDiscount/utils.js +266 -3
- package/package.json +2 -2
|
@@ -15,11 +15,16 @@ interface Formattitle {
|
|
|
15
15
|
'zh-CN'?: any;
|
|
16
16
|
'zh-HK'?: any;
|
|
17
17
|
}
|
|
18
|
+
interface PackageSubItemUsageRules {
|
|
19
|
+
type: 'universal_discount' | 'package_exclusive' | 'single_item_promo' | 'custom_usage_rules';
|
|
20
|
+
rules: ("original_price" | "markup_price")[];
|
|
21
|
+
}
|
|
18
22
|
interface Limitedrelationproductdata {
|
|
19
23
|
id: number;
|
|
20
24
|
type: 'product_all' | 'products' | 'product_collection';
|
|
21
25
|
product_ids: number[];
|
|
22
26
|
product_collection_id: number[];
|
|
27
|
+
package_sub_item_usage_rules?: PackageSubItemUsageRules;
|
|
23
28
|
}
|
|
24
29
|
interface ApplicableProductDetails {
|
|
25
30
|
amount: string;
|
|
@@ -29,12 +34,14 @@ interface ApplicableProductDetails {
|
|
|
29
34
|
original_amount: string;
|
|
30
35
|
num: number;
|
|
31
36
|
discount?: {
|
|
37
|
+
fixed_amount?: number;
|
|
32
38
|
product_id?: number;
|
|
33
39
|
original_amount?: string;
|
|
34
40
|
percent?: string;
|
|
35
41
|
resource_id?: number;
|
|
36
42
|
title?: string;
|
|
37
43
|
};
|
|
44
|
+
_num: number;
|
|
38
45
|
}
|
|
39
46
|
interface UsageCreditsValue {
|
|
40
47
|
total_credits: number;
|
|
@@ -72,6 +79,8 @@ export interface Discount {
|
|
|
72
79
|
format_title: Formattitle;
|
|
73
80
|
metadata?: {
|
|
74
81
|
discount_card_type?: 'fixed_amount' | 'percent';
|
|
82
|
+
custom_product_bundle_map_id?: string;
|
|
83
|
+
validity_type?: "custom_schedule_validity" | "fixed_validity";
|
|
75
84
|
};
|
|
76
85
|
product: Product;
|
|
77
86
|
type: "product" | 'good_pass';
|
|
@@ -98,9 +107,16 @@ export interface Discount {
|
|
|
98
107
|
week_order_behavior_count?: number;
|
|
99
108
|
month_order_behavior_count?: number;
|
|
100
109
|
customer_order_behavior_count?: number;
|
|
110
|
+
custom_schedule_snapshot?: {
|
|
111
|
+
data: any[];
|
|
112
|
+
};
|
|
113
|
+
num?: number;
|
|
114
|
+
start_date?: string;
|
|
115
|
+
start_time?: string;
|
|
101
116
|
}
|
|
102
117
|
export interface DiscountState {
|
|
103
118
|
discountList: Discount[];
|
|
119
|
+
originalDiscountList?: Discount[];
|
|
104
120
|
}
|
|
105
121
|
export interface DiscountModuleAPI {
|
|
106
122
|
setDiscountList: (discountList: Discount[]) => Promise<void>;
|
|
@@ -115,6 +115,8 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
115
115
|
item._origin.duration = duration;
|
|
116
116
|
item._origin.sub_type = durationType;
|
|
117
117
|
}
|
|
118
|
+
const discountList = (0, import_utils.getAllDiscountList)(item);
|
|
119
|
+
item._origin.product.discount_list = discountList;
|
|
118
120
|
if ((0, import_utils2.isNormalProduct)(item._origin)) {
|
|
119
121
|
order.relation_products.push(item._origin.product);
|
|
120
122
|
const relationForms = item._origin.relation_forms || [];
|
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var utils_exports = {};
|
|
31
31
|
__export(utils_exports, {
|
|
32
32
|
generateDuration: () => generateDuration,
|
|
33
|
+
getAllDiscountList: () => getAllDiscountList,
|
|
33
34
|
mergeRelationForms: () => mergeRelationForms
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(utils_exports);
|
|
@@ -55,8 +56,18 @@ var mergeRelationForms = (relationForms) => {
|
|
|
55
56
|
}, {})
|
|
56
57
|
).filter((item) => item.form_record_ids.length > 0);
|
|
57
58
|
};
|
|
59
|
+
var getAllDiscountList = (cartItem) => {
|
|
60
|
+
var _a, _b, _c, _d;
|
|
61
|
+
let discountList = ((_b = (_a = cartItem == null ? void 0 : cartItem._origin) == null ? void 0 : _a.product) == null ? void 0 : _b.discount_list) || [];
|
|
62
|
+
(((_d = (_c = cartItem == null ? void 0 : cartItem._origin) == null ? void 0 : _c.product) == null ? void 0 : _d.product_bundle) || []).forEach((item) => {
|
|
63
|
+
discountList = [...discountList, ...item.discount_list || []];
|
|
64
|
+
item.discount_list = void 0;
|
|
65
|
+
});
|
|
66
|
+
return discountList;
|
|
67
|
+
};
|
|
58
68
|
// Annotate the CommonJS export names for ESM import in node:
|
|
59
69
|
0 && (module.exports = {
|
|
60
70
|
generateDuration,
|
|
71
|
+
getAllDiscountList,
|
|
61
72
|
mergeRelationForms
|
|
62
73
|
});
|
|
@@ -41,6 +41,15 @@ function formatAmount(amount) {
|
|
|
41
41
|
return "0.00";
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
function formatDateTime(date) {
|
|
45
|
+
const year = date.getFullYear();
|
|
46
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
47
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
48
|
+
const hours = String(date.getHours()).padStart(2, "0");
|
|
49
|
+
const minutes = String(date.getMinutes()).padStart(2, "0");
|
|
50
|
+
const seconds = String(date.getSeconds()).padStart(2, "0");
|
|
51
|
+
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
52
|
+
}
|
|
44
53
|
function generateRequestUniqueId() {
|
|
45
54
|
const now = /* @__PURE__ */ new Date();
|
|
46
55
|
const year = now.getFullYear();
|
|
@@ -308,7 +317,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
308
317
|
*/
|
|
309
318
|
async getPaymentOrderByUuidAsync(orderUuid) {
|
|
310
319
|
try {
|
|
311
|
-
return await this.dbManager.get("order", orderUuid);
|
|
320
|
+
return await this.dbManager.get("order", orderUuid, true);
|
|
312
321
|
} catch (error) {
|
|
313
322
|
console.error("[PaymentModule] 获取支付订单失败", error);
|
|
314
323
|
return null;
|
|
@@ -337,8 +346,35 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
337
346
|
is_deposit: params.is_deposit || 0,
|
|
338
347
|
deposit_amount: params.deposit_amount || "0.00"
|
|
339
348
|
};
|
|
349
|
+
if (params.existPayment && params.existPayment.length > 0) {
|
|
350
|
+
const currentTime = formatDateTime(/* @__PURE__ */ new Date());
|
|
351
|
+
newOrder.payment = params.existPayment.map((payment) => ({
|
|
352
|
+
...payment,
|
|
353
|
+
isSynced: true,
|
|
354
|
+
// 标记为已同步
|
|
355
|
+
status: payment.status || "active",
|
|
356
|
+
// 如果云端支付项已有时间戳,则保留;否则使用当前时间
|
|
357
|
+
created_at: payment.created_at || currentTime,
|
|
358
|
+
updated_at: payment.updated_at || currentTime
|
|
359
|
+
}));
|
|
360
|
+
this.recalculateOrderAmount(newOrder);
|
|
361
|
+
this.logInfo("创建订单时包含云端支付项", {
|
|
362
|
+
orderId: params.order_id,
|
|
363
|
+
existPaymentCount: params.existPayment.length,
|
|
364
|
+
totalAmount: newOrder.total_amount,
|
|
365
|
+
expectAmount: newOrder.expect_amount,
|
|
366
|
+
paymentDetails: params.existPayment.map((p) => ({
|
|
367
|
+
uuid: p.uuid,
|
|
368
|
+
code: p.code,
|
|
369
|
+
amount: p.amount,
|
|
370
|
+
status: p.status,
|
|
371
|
+
created_at: p.created_at,
|
|
372
|
+
updated_at: p.updated_at
|
|
373
|
+
}))
|
|
374
|
+
});
|
|
375
|
+
}
|
|
340
376
|
const dbAddStartTime = Date.now();
|
|
341
|
-
await this.dbManager.add("order", newOrder);
|
|
377
|
+
await this.dbManager.add("order", newOrder, true);
|
|
342
378
|
const dbAddDuration = Date.now() - dbAddStartTime;
|
|
343
379
|
this.logInfo("Database add operation completed", {
|
|
344
380
|
operation: "dbManager.add",
|
|
@@ -502,7 +538,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
502
538
|
* 为某个订单添加支付项(新方法)
|
|
503
539
|
*/
|
|
504
540
|
async addPaymentItemAsync(orderUuid, paymentItem) {
|
|
505
|
-
var _a, _b, _c;
|
|
541
|
+
var _a, _b, _c, _d;
|
|
506
542
|
this.logInfo("Starting addPaymentItemAsync", {
|
|
507
543
|
orderUuid,
|
|
508
544
|
paymentAmount: paymentItem.amount,
|
|
@@ -510,7 +546,14 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
510
546
|
orderPaymentType: paymentItem.order_payment_type
|
|
511
547
|
});
|
|
512
548
|
try {
|
|
549
|
+
this.logInfo("准备获取订单", {
|
|
550
|
+
orderUuid
|
|
551
|
+
});
|
|
513
552
|
const order = await this.getPaymentOrderByUuidAsync(orderUuid);
|
|
553
|
+
this.logInfo("获取订单信息成功", {
|
|
554
|
+
orderUuid,
|
|
555
|
+
order
|
|
556
|
+
});
|
|
514
557
|
if (!order) {
|
|
515
558
|
throw new Error(`Order not found: ${orderUuid}`);
|
|
516
559
|
}
|
|
@@ -538,10 +581,16 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
538
581
|
});
|
|
539
582
|
throw new Error(warningMessage);
|
|
540
583
|
}
|
|
541
|
-
|
|
584
|
+
let paymentUuid;
|
|
585
|
+
if ((_a = paymentItem.metadata) == null ? void 0 : _a.unique_payment_number) {
|
|
586
|
+
paymentUuid = paymentItem.metadata.unique_payment_number;
|
|
587
|
+
} else {
|
|
588
|
+
paymentUuid = (0, import_utils.getUniqueId)("payment_");
|
|
589
|
+
}
|
|
590
|
+
const currentTime = formatDateTime(/* @__PURE__ */ new Date());
|
|
542
591
|
const newPaymentItem = {
|
|
543
592
|
uuid: paymentUuid,
|
|
544
|
-
|
|
593
|
+
custom_payment_id: paymentItem.custom_payment_id || 0,
|
|
545
594
|
name: paymentItem.name,
|
|
546
595
|
code: paymentItem.code,
|
|
547
596
|
type: paymentItem.type,
|
|
@@ -553,6 +602,10 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
553
602
|
// 新支付项默认为活跃状态
|
|
554
603
|
order_payment_type: paymentItem.order_payment_type || "normal",
|
|
555
604
|
// 默认为正常支付
|
|
605
|
+
created_at: currentTime,
|
|
606
|
+
// 创建时间
|
|
607
|
+
updated_at: currentTime,
|
|
608
|
+
// 更新时间
|
|
556
609
|
metadata: {
|
|
557
610
|
...paymentItem.metadata,
|
|
558
611
|
// 保留传入的所有 metadata 字段
|
|
@@ -562,23 +615,30 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
562
615
|
};
|
|
563
616
|
order.payment.push(newPaymentItem);
|
|
564
617
|
this.recalculateOrderAmount(order);
|
|
565
|
-
|
|
566
|
-
|
|
618
|
+
this.logInfo("开始更新订单支付项", {
|
|
619
|
+
orderUuid,
|
|
620
|
+
order
|
|
621
|
+
});
|
|
622
|
+
await this.dbManager.update("order", order, true);
|
|
623
|
+
this.logInfo("更新订单支付项完成", {
|
|
624
|
+
orderUuid
|
|
625
|
+
});
|
|
626
|
+
this.core.effects.emit(`${this.name}:onPaymentAdded`, {
|
|
567
627
|
orderUuid,
|
|
568
628
|
payment: newPaymentItem
|
|
569
629
|
});
|
|
570
630
|
this.logInfo("addPaymentItemAsync completed successfully", {
|
|
571
631
|
orderUuid,
|
|
572
632
|
paymentUuid: newPaymentItem.uuid,
|
|
573
|
-
uniquePaymentNumber: (
|
|
633
|
+
uniquePaymentNumber: (_b = newPaymentItem.metadata) == null ? void 0 : _b.unique_payment_number,
|
|
574
634
|
newExpectAmount: order.expect_amount,
|
|
575
635
|
paymentAmount: newPaymentItem.amount,
|
|
576
636
|
paymentCode: newPaymentItem.code,
|
|
577
637
|
orderPaymentType: newPaymentItem.order_payment_type,
|
|
578
638
|
metadataFields: Object.keys(newPaymentItem.metadata || {}),
|
|
579
639
|
// 现金支付找零信息
|
|
580
|
-
actualPaidAmount: (
|
|
581
|
-
changeGivenAmount: (
|
|
640
|
+
actualPaidAmount: (_c = newPaymentItem.metadata) == null ? void 0 : _c.actual_paid_amount,
|
|
641
|
+
changeGivenAmount: (_d = newPaymentItem.metadata) == null ? void 0 : _d.change_given_amount
|
|
582
642
|
});
|
|
583
643
|
} catch (error) {
|
|
584
644
|
console.error("[PaymentModule] 添加支付项失败", error);
|
|
@@ -797,7 +857,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
797
857
|
uuid: payment.uuid,
|
|
798
858
|
amount: payment.amount,
|
|
799
859
|
code: payment.code,
|
|
800
|
-
|
|
860
|
+
custom_payment_id: payment.custom_payment_id,
|
|
801
861
|
name: payment.name,
|
|
802
862
|
type: payment.type,
|
|
803
863
|
voucher_id: payment.voucher_id,
|
|
@@ -96,7 +96,7 @@ export interface PaymentItem {
|
|
|
96
96
|
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
|
97
97
|
code: string;
|
|
98
98
|
/** 支付类型id,跟支付列表上对应的支付方式保持一致 */
|
|
99
|
-
|
|
99
|
+
custom_payment_id: number;
|
|
100
100
|
/** 支付类型名称,跟支付列表上对应的支付方式保持一致 */
|
|
101
101
|
name: string;
|
|
102
102
|
/** 支付类型type,跟支付列表上对应的支付方式保持一致 */
|
|
@@ -138,6 +138,10 @@ export interface PaymentItem {
|
|
|
138
138
|
statusCode?: number;
|
|
139
139
|
timestamp: number;
|
|
140
140
|
};
|
|
141
|
+
/** 支付项创建时间 (格式: YYYY-MM-DD HH:mm:ss) */
|
|
142
|
+
created_at?: string;
|
|
143
|
+
/** 支付项更新时间 (格式: YYYY-MM-DD HH:mm:ss) */
|
|
144
|
+
updated_at?: string;
|
|
141
145
|
}
|
|
142
146
|
/**
|
|
143
147
|
* 订单信息
|
|
@@ -200,6 +204,8 @@ export interface PushOrderParams {
|
|
|
200
204
|
deposit_amount?: string;
|
|
201
205
|
/** 原始订单数据(可选,由 Checkout 模块传入) */
|
|
202
206
|
order_info?: any;
|
|
207
|
+
/** 云端已存在的支付项(可选,用于处理订单在其他设备或云端生成的场景) */
|
|
208
|
+
existPayment?: PaymentItem[];
|
|
203
209
|
}
|
|
204
210
|
/**
|
|
205
211
|
* 更新订单参数
|
|
@@ -219,7 +225,7 @@ export interface PaymentItemInput {
|
|
|
219
225
|
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
|
220
226
|
code: string;
|
|
221
227
|
/** 支付类型id,跟支付列表上对应的支付方式保持一致 */
|
|
222
|
-
|
|
228
|
+
custom_payment_id: number;
|
|
223
229
|
/** 支付类型名称,跟支付列表上对应的支付方式保持一致 */
|
|
224
230
|
name: string;
|
|
225
231
|
/** 支付类型type,跟支付列表上对应的支付方式保持一致 */
|
|
@@ -248,6 +254,10 @@ export interface PaymentItemInput {
|
|
|
248
254
|
/** 找零金额(现金支付时的找零金额) */
|
|
249
255
|
change_given_amount?: number;
|
|
250
256
|
};
|
|
257
|
+
/** 支付项创建时间 (格式: YYYY-MM-DD HH:mm:ss, 可选,不传则自动生成) */
|
|
258
|
+
created_at?: string;
|
|
259
|
+
/** 支付项更新时间 (格式: YYYY-MM-DD HH:mm:ss, 可选,不传则自动生成) */
|
|
260
|
+
updated_at?: string;
|
|
251
261
|
}
|
|
252
262
|
/**
|
|
253
263
|
* 推送支付项参数
|
|
@@ -598,6 +608,8 @@ export interface WalletDeductionRecommendParams {
|
|
|
598
608
|
expect_columns?: string[];
|
|
599
609
|
/** 客户id */
|
|
600
610
|
customer_id?: number;
|
|
611
|
+
/** 客户holder_id */
|
|
612
|
+
holder_id?: number;
|
|
601
613
|
/** 订单总计金额 */
|
|
602
614
|
order_expect_amount: number;
|
|
603
615
|
/** 订单小计金额 */
|
|
@@ -616,6 +628,8 @@ export interface WalletDeductionRecommendParams {
|
|
|
616
628
|
quantity: number;
|
|
617
629
|
/** 商品使用了所有优惠后的最终价格 */
|
|
618
630
|
selling_price: number;
|
|
631
|
+
/** 客户holder_id */
|
|
632
|
+
holder_id?: number;
|
|
619
633
|
}[];
|
|
620
634
|
/** 预备支付 */
|
|
621
635
|
prepare_payments?: {
|
|
@@ -633,6 +647,10 @@ export interface WalletDeductionRecommendParams {
|
|
|
633
647
|
export interface WalletInitBusinessData {
|
|
634
648
|
/** 客户ID(可选) */
|
|
635
649
|
customer_id?: number;
|
|
650
|
+
/** 客户 holder */
|
|
651
|
+
holder?: {
|
|
652
|
+
form_record: number[];
|
|
653
|
+
};
|
|
636
654
|
/** 金额信息 */
|
|
637
655
|
amountInfo: {
|
|
638
656
|
totalAmount: string;
|
|
@@ -648,10 +666,12 @@ export interface WalletInitBusinessData {
|
|
|
648
666
|
product_variant_id: string;
|
|
649
667
|
quantity: number;
|
|
650
668
|
selling_price: number;
|
|
669
|
+
holder_id?: number;
|
|
651
670
|
}[];
|
|
652
671
|
order_wait_pay_amount?: number;
|
|
653
672
|
/** 订单ID */
|
|
654
673
|
payment_order_id?: string;
|
|
674
|
+
is_price_include_tax: number;
|
|
655
675
|
}
|
|
656
676
|
/**
|
|
657
677
|
* 查询用户识别码列表请求参数
|
|
@@ -50,14 +50,24 @@ var WalletPassPaymentImpl = class {
|
|
|
50
50
|
* 根据业务数据生成标准的钱包API参数,并存储在模块中
|
|
51
51
|
*/
|
|
52
52
|
generateWalletParams(businessData) {
|
|
53
|
-
var _a;
|
|
54
|
-
const {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
const {
|
|
55
|
+
customer_id,
|
|
56
|
+
holder,
|
|
57
|
+
amountInfo,
|
|
58
|
+
products,
|
|
59
|
+
order_wait_pay_amount,
|
|
60
|
+
payment_order_id,
|
|
61
|
+
is_price_include_tax
|
|
62
|
+
} = businessData;
|
|
55
63
|
const totalAmount = Number(amountInfo.totalAmount);
|
|
56
64
|
const subTotal = Number(amountInfo.subTotal);
|
|
57
65
|
const walletParams = {
|
|
66
|
+
is_price_include_tax,
|
|
58
67
|
sale_channel: "pos",
|
|
59
68
|
customer_id: customer_id || 0,
|
|
60
69
|
// 提供默认值,确保类型为 number
|
|
70
|
+
holder_id: ((_a = holder == null ? void 0 : holder.form_record) == null ? void 0 : _a[0]) || void 0,
|
|
61
71
|
order_expect_amount: totalAmount,
|
|
62
72
|
// 订单小计金额
|
|
63
73
|
order_product_amount: subTotal,
|
|
@@ -71,10 +81,11 @@ var WalletPassPaymentImpl = class {
|
|
|
71
81
|
this.walletParams = walletParams;
|
|
72
82
|
this.paymentModule.logInfo("[WalletPass] 钱包默认参数已生成并存储", {
|
|
73
83
|
customer_id: walletParams.customer_id,
|
|
84
|
+
holder_id: walletParams.holder_id,
|
|
74
85
|
order_expect_amount: walletParams.order_expect_amount,
|
|
75
86
|
order_product_amount: walletParams.order_product_amount,
|
|
76
87
|
order_wait_pay_amount: walletParams.order_wait_pay_amount,
|
|
77
|
-
products_count: ((
|
|
88
|
+
products_count: ((_b = walletParams.products) == null ? void 0 : _b.length) || 0
|
|
78
89
|
});
|
|
79
90
|
return walletParams;
|
|
80
91
|
}
|
|
@@ -387,7 +398,7 @@ var WalletPassPaymentImpl = class {
|
|
|
387
398
|
const paymentItem = {
|
|
388
399
|
amount: amount.toString(),
|
|
389
400
|
code: walletMethod.code,
|
|
390
|
-
|
|
401
|
+
custom_payment_id: walletMethod.id,
|
|
391
402
|
name: walletMethod.name,
|
|
392
403
|
type: walletMethod.type,
|
|
393
404
|
voucher_id: voucherId || ""
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "duration" | "session" | "normal";
|
|
53
53
|
}
|
|
@@ -103,13 +103,6 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
103
103
|
{ osServer: true }
|
|
104
104
|
);
|
|
105
105
|
const sortedList = (productsData.data.list || []).slice().sort((a, b) => Number(b.sort) - Number(a.sort));
|
|
106
|
-
if (sortedList.length) {
|
|
107
|
-
sortedList.forEach((n) => {
|
|
108
|
-
if (n.is_eject !== 1 && n["schedule.ids"] && n["schedule.ids"].length) {
|
|
109
|
-
n.is_eject = 1;
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
106
|
this.addProduct(sortedList);
|
|
114
107
|
return sortedList;
|
|
115
108
|
}
|
|
@@ -12,24 +12,38 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
12
12
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
13
13
|
setRulesList(rulesList: Rules[]): Promise<void>;
|
|
14
14
|
getRulesList(): Rules[];
|
|
15
|
-
|
|
15
|
+
private checkHolderMatch;
|
|
16
|
+
isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, holders, }: {
|
|
16
17
|
oldDiscountList: Discount[];
|
|
17
18
|
newDiscountList: Discount[];
|
|
18
19
|
productList: any[];
|
|
20
|
+
holders: {
|
|
21
|
+
form_record_id: number;
|
|
22
|
+
}[];
|
|
19
23
|
}): {
|
|
20
24
|
isAvailable: boolean;
|
|
21
25
|
discountList: Discount[];
|
|
22
26
|
productList: any[];
|
|
23
27
|
};
|
|
24
|
-
calcDiscount({ discountList, productList, }: {
|
|
28
|
+
calcDiscount({ discountList, productList, holders, }: {
|
|
25
29
|
discountList: Discount[];
|
|
26
30
|
productList: any[];
|
|
31
|
+
holders: {
|
|
32
|
+
form_record_id: number;
|
|
33
|
+
}[];
|
|
27
34
|
}, options?: {
|
|
28
35
|
isSelected?: boolean;
|
|
29
36
|
discountId?: number;
|
|
30
37
|
selectedList?: SetDiscountSelectedParams[];
|
|
31
38
|
scan?: boolean;
|
|
32
39
|
}): DiscountResult;
|
|
40
|
+
/**
|
|
41
|
+
* 检查优惠是否符合 PackageSubItemUsageRules 配置
|
|
42
|
+
* @param discount 优惠券
|
|
43
|
+
* @param flatItem 扁平化后的商品项(可能是主商品或bundle子商品)
|
|
44
|
+
* @returns 是否可用
|
|
45
|
+
*/
|
|
46
|
+
private checkPackageSubItemUsageRules;
|
|
33
47
|
destroy(): Promise<void>;
|
|
34
48
|
clear(): Promise<void>;
|
|
35
49
|
}
|