@pisell/pisellos 0.0.364 → 0.0.365
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/Discount/index.d.ts +1 -1
- package/dist/modules/Discount/types.d.ts +2 -0
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Rules/index.d.ts +8 -2
- package/dist/modules/Rules/index.js +27 -21
- package/dist/modules/Rules/types.d.ts +3 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/ShopDiscount/index.d.ts +3 -0
- package/dist/solution/ShopDiscount/index.js +14 -4
- package/dist/solution/ShopDiscount/types.d.ts +5 -0
- package/lib/modules/Discount/index.d.ts +1 -1
- package/lib/modules/Discount/types.d.ts +2 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Rules/index.d.ts +8 -2
- package/lib/modules/Rules/index.js +21 -19
- package/lib/modules/Rules/types.d.ts +3 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +6 -0
- package/lib/solution/ShopDiscount/index.d.ts +3 -0
- package/lib/solution/ShopDiscount/index.js +11 -4
- package/lib/solution/ShopDiscount/types.d.ts +5 -0
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
|
|
|
21
21
|
with_good_pass: 0 | 1;
|
|
22
22
|
with_discount_card: 0 | 1;
|
|
23
23
|
customer_id: number;
|
|
24
|
-
|
|
24
|
+
with_wallet_pass_holder: 0 | 1;
|
|
25
25
|
}): Promise<Discount[]>;
|
|
26
26
|
batchSearch(code: string, customerId?: number): Promise<Discount[]>;
|
|
27
27
|
filterEnabledDiscountList(discountList: Discount[]): Discount[];
|
|
@@ -25,6 +25,8 @@ interface Limitedrelationproductdata {
|
|
|
25
25
|
product_ids: number[];
|
|
26
26
|
product_collection_id: number[];
|
|
27
27
|
package_sub_item_usage_rules?: PackageSubItemUsageRules;
|
|
28
|
+
filter: 0 | 1;
|
|
29
|
+
exclude_product_ids: number[];
|
|
28
30
|
}
|
|
29
31
|
interface ApplicableProductDetails {
|
|
30
32
|
amount: string;
|
|
@@ -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
|
}
|
|
@@ -16,20 +16,26 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
16
16
|
getRulesList(): Rules[];
|
|
17
17
|
getWalletPassEvaluator(): import("../..").WalletPassEvaluator | undefined;
|
|
18
18
|
private checkHolderMatch;
|
|
19
|
-
isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, orderTotalAmount, }: {
|
|
19
|
+
isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, orderTotalAmount, holders, }: {
|
|
20
20
|
oldDiscountList: Discount[];
|
|
21
21
|
newDiscountList: Discount[];
|
|
22
22
|
productList: any[];
|
|
23
23
|
orderTotalAmount: number;
|
|
24
|
+
holders: {
|
|
25
|
+
form_record_id: number;
|
|
26
|
+
}[];
|
|
24
27
|
}): {
|
|
25
28
|
isAvailable: boolean;
|
|
26
29
|
discountList: Discount[];
|
|
27
30
|
productList: any[];
|
|
28
31
|
};
|
|
29
|
-
calcDiscount({ discountList, productList, orderTotalAmount }: {
|
|
32
|
+
calcDiscount({ discountList, productList, orderTotalAmount, holders, }: {
|
|
30
33
|
discountList: Discount[];
|
|
31
34
|
productList: any[];
|
|
32
35
|
orderTotalAmount: number;
|
|
36
|
+
holders: {
|
|
37
|
+
form_record_id: number;
|
|
38
|
+
}[];
|
|
33
39
|
}, options?: {
|
|
34
40
|
isSelected?: boolean;
|
|
35
41
|
discountId?: number;
|
|
@@ -103,21 +103,17 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
103
103
|
// 检查 holder 是否匹配
|
|
104
104
|
}, {
|
|
105
105
|
key: "checkHolderMatch",
|
|
106
|
-
value: function checkHolderMatch(discount, product) {
|
|
107
|
-
var
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
isHolderMatch = _holderId === (discountHolder === null || discountHolder === void 0 ? void 0 : discountHolder.holder_id);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return isHolderMatch;
|
|
106
|
+
value: function checkHolderMatch(discount, product, holders) {
|
|
107
|
+
var _discount$holder;
|
|
108
|
+
// 非表单类型 holder 视为匹配
|
|
109
|
+
if (((_discount$holder = discount.holder) === null || _discount$holder === void 0 ? void 0 : _discount$holder.holder_type) !== 'form') return true;
|
|
110
|
+
// 卡券 holder 缺失视为不匹配
|
|
111
|
+
if (!discount.holder.holder_id) return false;
|
|
112
|
+
|
|
113
|
+
// 主预约holder, 目前(20251124)默认只考虑单个holder的情况
|
|
114
|
+
var orderHolderId = Array.isArray(holders) && holders.length > 0 ? holders[0].form_record_id : undefined;
|
|
115
|
+
var productHolderId = Array.isArray(product.holder_id) ? product.holder_id[0] : product.holder_id;
|
|
116
|
+
return (productHolderId || orderHolderId) === discount.holder.holder_id;
|
|
121
117
|
}
|
|
122
118
|
|
|
123
119
|
// 判断discountList 是否可以对当前productList生效
|
|
@@ -128,7 +124,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
128
124
|
var oldDiscountList = _ref.oldDiscountList,
|
|
129
125
|
newDiscountList = _ref.newDiscountList,
|
|
130
126
|
productList = _ref.productList,
|
|
131
|
-
orderTotalAmount = _ref.orderTotalAmount
|
|
127
|
+
orderTotalAmount = _ref.orderTotalAmount,
|
|
128
|
+
holders = _ref.holders;
|
|
132
129
|
// 首先检查是否有新的优惠券可应用
|
|
133
130
|
if (!newDiscountList || newDiscountList.length === 0) {
|
|
134
131
|
return {
|
|
@@ -159,7 +156,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
159
156
|
var result = this.calcDiscount({
|
|
160
157
|
discountList: mergedDiscountList,
|
|
161
158
|
productList: _toConsumableArray(productList),
|
|
162
|
-
orderTotalAmount: orderTotalAmount
|
|
159
|
+
orderTotalAmount: orderTotalAmount,
|
|
160
|
+
holders: holders
|
|
163
161
|
}, {
|
|
164
162
|
scan: true
|
|
165
163
|
});
|
|
@@ -197,7 +195,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
197
195
|
var _this3 = this;
|
|
198
196
|
var discountList = _ref2.discountList,
|
|
199
197
|
productList = _ref2.productList,
|
|
200
|
-
orderTotalAmount = _ref2.orderTotalAmount
|
|
198
|
+
orderTotalAmount = _ref2.orderTotalAmount,
|
|
199
|
+
holders = _ref2.holders;
|
|
201
200
|
// 识别出来是不是在编辑的界面里又新增了商品
|
|
202
201
|
// 这种情况下,如果有可用的优惠券,也会自动勾选上
|
|
203
202
|
var isEditModeAddNewProduct = productList.find(function (n) {
|
|
@@ -487,11 +486,13 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
487
486
|
var _product, _product2, _product3, _product4, _flatItem$bundleItem, _discount$config;
|
|
488
487
|
var limitedData = discount === null || discount === void 0 ? void 0 : discount.limited_relation_product_data;
|
|
489
488
|
// 拿到discount配置的holder信息 product信息 product.holder 加在 isLimitedProduct
|
|
490
|
-
var isHolderMatch = _this3.checkHolderMatch(discount,
|
|
489
|
+
var isHolderMatch = _this3.checkHolderMatch(discount, {
|
|
490
|
+
holder_id: originProduct._extend.holder_id
|
|
491
|
+
}, holders);
|
|
491
492
|
var timeLimit = true;
|
|
492
493
|
timeLimit = !!filterDiscountListByBookingTime([discount], (((_product = product) === null || _product === void 0 ? void 0 : _product.startDate) || dayjs()).format('YYYY-MM-DD HH:mm:ss')).length;
|
|
493
494
|
// 是符合折扣的商品
|
|
494
|
-
var isLimitedProduct = (limitedData.type === 'product_all' || limitedData.product_ids && limitedData.product_ids.includes(product.id)) && isHolderMatch;
|
|
495
|
+
var isLimitedProduct = (limitedData.type === 'product_all' && limitedData.filter !== 1 || limitedData.type === 'product_all' && limitedData.filter === 1 && !limitedData.exclude_product_ids.includes(product.id) || limitedData.product_ids && limitedData.product_ids.includes(product.id)) && isHolderMatch;
|
|
495
496
|
|
|
496
497
|
// 编辑的商品 使用了优惠券不可用
|
|
497
498
|
var isAvailableProduct = flatItem.type === 'main' ? !((_product2 = product) !== null && _product2 !== void 0 && _product2.booking_id && (_product3 = product) !== null && _product3 !== void 0 && (_product3 = _product3.discount_list) !== null && _product3 !== void 0 && _product3.length && (_product4 = product) !== null && _product4 !== void 0 && (_product4 = _product4.discount_list) !== null && _product4 !== void 0 && _product4.every(function (discount) {
|
|
@@ -613,12 +614,17 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
613
614
|
return false;
|
|
614
615
|
}
|
|
615
616
|
// 拿到discount配置的holder信息 product信息 product.holder 不可用return false
|
|
616
|
-
var isHolderMatch = _this3.checkHolderMatch(discount,
|
|
617
|
+
var isHolderMatch = _this3.checkHolderMatch(discount, {
|
|
618
|
+
holder_id: originProduct._extend.holder_id
|
|
619
|
+
}, holders);
|
|
617
620
|
// 如果 holder 不匹配,则不适用
|
|
618
621
|
if (!isHolderMatch) return false;
|
|
619
622
|
|
|
620
623
|
// 判断优惠券是否适用于该商品
|
|
621
624
|
if (limitedData.type === 'product_all') {
|
|
625
|
+
if (limitedData.filter === 1 && limitedData.exclude_product_ids.includes(product.id)) {
|
|
626
|
+
return false;
|
|
627
|
+
}
|
|
622
628
|
// 检查 package_sub_item_usage_rules
|
|
623
629
|
if (!_this3.checkPackageSubItemUsageRules(discount, flatItem)) {
|
|
624
630
|
return false;
|
|
@@ -308,7 +308,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
308
308
|
date: string;
|
|
309
309
|
status: string;
|
|
310
310
|
week: string;
|
|
311
|
-
weekNum: 0 | 2 | 1 |
|
|
311
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
|
|
312
312
|
}[]>;
|
|
313
313
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
314
314
|
private getScheduleDataByIds;
|
|
@@ -115,7 +115,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
115
115
|
* 获取当前的客户搜索条件
|
|
116
116
|
* @returns 当前搜索条件
|
|
117
117
|
*/
|
|
118
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
118
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
119
119
|
/**
|
|
120
120
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
121
121
|
* @returns 客户状态
|
|
@@ -22,6 +22,9 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
22
22
|
private filterDiscountListByBookingTime;
|
|
23
23
|
setCustomer(customer: Customer): Promise<void>;
|
|
24
24
|
setOriginTotalAmount(amount: number): void;
|
|
25
|
+
setHolders(holders: {
|
|
26
|
+
form_record_id: number;
|
|
27
|
+
}[]): void;
|
|
25
28
|
calcDiscount(productList: Record<string, any>[], options?: SetDiscountSelectedParams): {
|
|
26
29
|
productList: Record<string, any>[];
|
|
27
30
|
discountList: Discount[];
|
|
@@ -54,7 +54,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
54
54
|
originalDiscountList: [],
|
|
55
55
|
currentBookingTime: "",
|
|
56
56
|
filteredDiscountList: [],
|
|
57
|
-
orderTotalAmount: 0
|
|
57
|
+
orderTotalAmount: 0,
|
|
58
|
+
holders: []
|
|
58
59
|
};
|
|
59
60
|
return _this;
|
|
60
61
|
}
|
|
@@ -293,6 +294,13 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
293
294
|
this.store.orderTotalAmount = amount;
|
|
294
295
|
}
|
|
295
296
|
|
|
297
|
+
// 设置holders
|
|
298
|
+
}, {
|
|
299
|
+
key: "setHolders",
|
|
300
|
+
value: function setHolders(holders) {
|
|
301
|
+
this.store.holders = holders;
|
|
302
|
+
}
|
|
303
|
+
|
|
296
304
|
// 计算优惠券
|
|
297
305
|
}, {
|
|
298
306
|
key: "calcDiscount",
|
|
@@ -308,7 +316,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
308
316
|
var _ref = rulesModule.calcDiscount({
|
|
309
317
|
productList: productList,
|
|
310
318
|
discountList: this.getDiscountList(),
|
|
311
|
-
orderTotalAmount: this.store.orderTotalAmount || 0
|
|
319
|
+
orderTotalAmount: this.store.orderTotalAmount || 0,
|
|
320
|
+
holders: this.store.holders || []
|
|
312
321
|
}, options) || {
|
|
313
322
|
productList: productList,
|
|
314
323
|
discountList: this.getDiscountList()
|
|
@@ -447,7 +456,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
447
456
|
productList: this.store.productList || [],
|
|
448
457
|
oldDiscountList: this.getDiscountList(),
|
|
449
458
|
newDiscountList: withScanList,
|
|
450
|
-
orderTotalAmount: this.store.orderTotalAmount || 0
|
|
459
|
+
orderTotalAmount: this.store.orderTotalAmount || 0,
|
|
460
|
+
holders: this.store.holders || []
|
|
451
461
|
}) || {
|
|
452
462
|
isAvailable: false,
|
|
453
463
|
productList: this.store.productList || [],
|
|
@@ -730,7 +740,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
730
740
|
action: 'create',
|
|
731
741
|
with_good_pass: 1,
|
|
732
742
|
with_discount_card: 1,
|
|
733
|
-
|
|
743
|
+
with_wallet_pass_holder: 1
|
|
734
744
|
});
|
|
735
745
|
case 4:
|
|
736
746
|
goodPassList = _context9.sent;
|
|
@@ -27,6 +27,11 @@ export interface ShopDiscountState {
|
|
|
27
27
|
currentBookingTime: string | null;
|
|
28
28
|
filteredDiscountList: Discount[];
|
|
29
29
|
orderTotalAmount?: number;
|
|
30
|
+
holders?: {
|
|
31
|
+
form_record_id: number;
|
|
32
|
+
form_id?: number;
|
|
33
|
+
main_field?: string;
|
|
34
|
+
}[];
|
|
30
35
|
}
|
|
31
36
|
export interface SetDiscountSelectedParams {
|
|
32
37
|
discountId: number;
|
|
@@ -21,7 +21,7 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
|
|
|
21
21
|
with_good_pass: 0 | 1;
|
|
22
22
|
with_discount_card: 0 | 1;
|
|
23
23
|
customer_id: number;
|
|
24
|
-
|
|
24
|
+
with_wallet_pass_holder: 0 | 1;
|
|
25
25
|
}): Promise<Discount[]>;
|
|
26
26
|
batchSearch(code: string, customerId?: number): Promise<Discount[]>;
|
|
27
27
|
filterEnabledDiscountList(discountList: Discount[]): Discount[];
|
|
@@ -25,6 +25,8 @@ interface Limitedrelationproductdata {
|
|
|
25
25
|
product_ids: number[];
|
|
26
26
|
product_collection_id: number[];
|
|
27
27
|
package_sub_item_usage_rules?: PackageSubItemUsageRules;
|
|
28
|
+
filter: 0 | 1;
|
|
29
|
+
exclude_product_ids: number[];
|
|
28
30
|
}
|
|
29
31
|
interface ApplicableProductDetails {
|
|
30
32
|
amount: string;
|
|
@@ -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
|
}
|
|
@@ -16,20 +16,26 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
16
16
|
getRulesList(): Rules[];
|
|
17
17
|
getWalletPassEvaluator(): import("../..").WalletPassEvaluator | undefined;
|
|
18
18
|
private checkHolderMatch;
|
|
19
|
-
isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, orderTotalAmount, }: {
|
|
19
|
+
isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, orderTotalAmount, holders, }: {
|
|
20
20
|
oldDiscountList: Discount[];
|
|
21
21
|
newDiscountList: Discount[];
|
|
22
22
|
productList: any[];
|
|
23
23
|
orderTotalAmount: number;
|
|
24
|
+
holders: {
|
|
25
|
+
form_record_id: number;
|
|
26
|
+
}[];
|
|
24
27
|
}): {
|
|
25
28
|
isAvailable: boolean;
|
|
26
29
|
discountList: Discount[];
|
|
27
30
|
productList: any[];
|
|
28
31
|
};
|
|
29
|
-
calcDiscount({ discountList, productList, orderTotalAmount }: {
|
|
32
|
+
calcDiscount({ discountList, productList, orderTotalAmount, holders, }: {
|
|
30
33
|
discountList: Discount[];
|
|
31
34
|
productList: any[];
|
|
32
35
|
orderTotalAmount: number;
|
|
36
|
+
holders: {
|
|
37
|
+
form_record_id: number;
|
|
38
|
+
}[];
|
|
33
39
|
}, options?: {
|
|
34
40
|
isSelected?: boolean;
|
|
35
41
|
discountId?: number;
|
|
@@ -63,26 +63,23 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
63
63
|
return (_b = (_a = this.window).getWalletPassEvaluator) == null ? void 0 : _b.call(_a);
|
|
64
64
|
}
|
|
65
65
|
// 检查 holder 是否匹配
|
|
66
|
-
checkHolderMatch(discount, product) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
isHolderMatch = _holderId === (discountHolder == null ? void 0 : discountHolder.holder_id);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return isHolderMatch;
|
|
66
|
+
checkHolderMatch(discount, product, holders) {
|
|
67
|
+
var _a;
|
|
68
|
+
if (((_a = discount.holder) == null ? void 0 : _a.holder_type) !== "form")
|
|
69
|
+
return true;
|
|
70
|
+
if (!discount.holder.holder_id)
|
|
71
|
+
return false;
|
|
72
|
+
const orderHolderId = Array.isArray(holders) && holders.length > 0 ? holders[0].form_record_id : void 0;
|
|
73
|
+
const productHolderId = Array.isArray(product.holder_id) ? product.holder_id[0] : product.holder_id;
|
|
74
|
+
return (productHolderId || orderHolderId) === discount.holder.holder_id;
|
|
79
75
|
}
|
|
80
76
|
// 判断discountList 是否可以对当前productList生效
|
|
81
77
|
isDiscountListAvailable({
|
|
82
78
|
oldDiscountList,
|
|
83
79
|
newDiscountList,
|
|
84
80
|
productList,
|
|
85
|
-
orderTotalAmount
|
|
81
|
+
orderTotalAmount,
|
|
82
|
+
holders
|
|
86
83
|
}) {
|
|
87
84
|
if (!newDiscountList || newDiscountList.length === 0) {
|
|
88
85
|
return {
|
|
@@ -113,7 +110,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
113
110
|
{
|
|
114
111
|
discountList: mergedDiscountList,
|
|
115
112
|
productList: [...productList],
|
|
116
|
-
orderTotalAmount
|
|
113
|
+
orderTotalAmount,
|
|
114
|
+
holders
|
|
117
115
|
},
|
|
118
116
|
{
|
|
119
117
|
scan: true
|
|
@@ -144,7 +142,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
144
142
|
calcDiscount({
|
|
145
143
|
discountList,
|
|
146
144
|
productList,
|
|
147
|
-
orderTotalAmount
|
|
145
|
+
orderTotalAmount,
|
|
146
|
+
holders
|
|
148
147
|
}, options) {
|
|
149
148
|
const isEditModeAddNewProduct = productList.find((n) => n.booking_id) && productList.find((n) => !n.booking_id);
|
|
150
149
|
const editModeDiscount = [];
|
|
@@ -337,10 +336,10 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
337
336
|
addModeDiscount.forEach((discount) => {
|
|
338
337
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
339
338
|
const limitedData = discount == null ? void 0 : discount.limited_relation_product_data;
|
|
340
|
-
const isHolderMatch = this.checkHolderMatch(discount,
|
|
339
|
+
const isHolderMatch = this.checkHolderMatch(discount, { holder_id: originProduct._extend.holder_id }, holders);
|
|
341
340
|
let timeLimit = true;
|
|
342
341
|
timeLimit = !!(0, import_utils.filterDiscountListByBookingTime)([discount], ((product == null ? void 0 : product.startDate) || (0, import_dayjs.default)()).format("YYYY-MM-DD HH:mm:ss")).length;
|
|
343
|
-
const isLimitedProduct = (limitedData.type === "product_all" || limitedData.product_ids && limitedData.product_ids.includes(product.id)) && isHolderMatch;
|
|
342
|
+
const isLimitedProduct = (limitedData.type === "product_all" && limitedData.filter !== 1 || limitedData.type === "product_all" && limitedData.filter === 1 && !limitedData.exclude_product_ids.includes(product.id) || limitedData.product_ids && limitedData.product_ids.includes(product.id)) && isHolderMatch;
|
|
344
343
|
const isAvailableProduct = flatItem.type === "main" ? !((product == null ? void 0 : product.booking_id) && ((_a = product == null ? void 0 : product.discount_list) == null ? void 0 : _a.length) && ((_b = product == null ? void 0 : product.discount_list) == null ? void 0 : _b.every(
|
|
345
344
|
(discount2) => discount2.id && [
|
|
346
345
|
"good_pass",
|
|
@@ -444,10 +443,13 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
444
443
|
if (!timeLimit) {
|
|
445
444
|
return false;
|
|
446
445
|
}
|
|
447
|
-
const isHolderMatch = this.checkHolderMatch(discount,
|
|
446
|
+
const isHolderMatch = this.checkHolderMatch(discount, { holder_id: originProduct._extend.holder_id }, holders);
|
|
448
447
|
if (!isHolderMatch)
|
|
449
448
|
return false;
|
|
450
449
|
if (limitedData.type === "product_all") {
|
|
450
|
+
if (limitedData.filter === 1 && limitedData.exclude_product_ids.includes(product.id)) {
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
451
453
|
if (!this.checkPackageSubItemUsageRules(discount, flatItem)) {
|
|
452
454
|
return false;
|
|
453
455
|
}
|
|
@@ -308,7 +308,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
308
308
|
date: string;
|
|
309
309
|
status: string;
|
|
310
310
|
week: string;
|
|
311
|
-
weekNum: 0 | 2 | 1 |
|
|
311
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
|
|
312
312
|
}[]>;
|
|
313
313
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
314
314
|
private getScheduleDataByIds;
|
|
@@ -115,7 +115,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
115
115
|
* 获取当前的客户搜索条件
|
|
116
116
|
* @returns 当前搜索条件
|
|
117
117
|
*/
|
|
118
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
118
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
119
119
|
/**
|
|
120
120
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
121
121
|
* @returns 客户状态
|
|
@@ -122,6 +122,12 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
122
122
|
throw error;
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* 初始化外设扫码结果监听
|
|
127
|
+
*/
|
|
128
|
+
initPeripheralsListener() {
|
|
129
|
+
this.scan.initPeripheralsListener();
|
|
130
|
+
}
|
|
125
131
|
/**
|
|
126
132
|
* 获取商品列表(不加载到模块中)
|
|
127
133
|
* @returns 商品列表
|
|
@@ -22,6 +22,9 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
22
22
|
private filterDiscountListByBookingTime;
|
|
23
23
|
setCustomer(customer: Customer): Promise<void>;
|
|
24
24
|
setOriginTotalAmount(amount: number): void;
|
|
25
|
+
setHolders(holders: {
|
|
26
|
+
form_record_id: number;
|
|
27
|
+
}[]): void;
|
|
25
28
|
calcDiscount(productList: Record<string, any>[], options?: SetDiscountSelectedParams): {
|
|
26
29
|
productList: Record<string, any>[];
|
|
27
30
|
discountList: Discount[];
|
|
@@ -54,7 +54,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
54
54
|
originalDiscountList: [],
|
|
55
55
|
currentBookingTime: "",
|
|
56
56
|
filteredDiscountList: [],
|
|
57
|
-
orderTotalAmount: 0
|
|
57
|
+
orderTotalAmount: 0,
|
|
58
|
+
holders: []
|
|
58
59
|
};
|
|
59
60
|
}
|
|
60
61
|
// =========== 生命周期方法 ===========
|
|
@@ -195,6 +196,10 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
195
196
|
setOriginTotalAmount(amount) {
|
|
196
197
|
this.store.orderTotalAmount = amount;
|
|
197
198
|
}
|
|
199
|
+
// 设置holders
|
|
200
|
+
setHolders(holders) {
|
|
201
|
+
this.store.holders = holders;
|
|
202
|
+
}
|
|
198
203
|
// 计算优惠券
|
|
199
204
|
calcDiscount(productList, options) {
|
|
200
205
|
this.store.productList = productList;
|
|
@@ -206,7 +211,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
206
211
|
{
|
|
207
212
|
productList,
|
|
208
213
|
discountList: this.getDiscountList(),
|
|
209
|
-
orderTotalAmount: this.store.orderTotalAmount || 0
|
|
214
|
+
orderTotalAmount: this.store.orderTotalAmount || 0,
|
|
215
|
+
holders: this.store.holders || []
|
|
210
216
|
},
|
|
211
217
|
options
|
|
212
218
|
) || { productList, discountList: this.getDiscountList() };
|
|
@@ -296,7 +302,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
296
302
|
productList: this.store.productList || [],
|
|
297
303
|
oldDiscountList: this.getDiscountList(),
|
|
298
304
|
newDiscountList: withScanList,
|
|
299
|
-
orderTotalAmount: this.store.orderTotalAmount || 0
|
|
305
|
+
orderTotalAmount: this.store.orderTotalAmount || 0,
|
|
306
|
+
holders: this.store.holders || []
|
|
300
307
|
}) || {
|
|
301
308
|
isAvailable: false,
|
|
302
309
|
productList: this.store.productList || [],
|
|
@@ -482,7 +489,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
482
489
|
action: "create",
|
|
483
490
|
with_good_pass: 1,
|
|
484
491
|
with_discount_card: 1,
|
|
485
|
-
|
|
492
|
+
with_wallet_pass_holder: 1
|
|
486
493
|
}));
|
|
487
494
|
const scanDiscount = (_c = this.getDiscountList()) == null ? void 0 : _c.filter(
|
|
488
495
|
(item) => item.isScan
|
|
@@ -27,6 +27,11 @@ export interface ShopDiscountState {
|
|
|
27
27
|
currentBookingTime: string | null;
|
|
28
28
|
filteredDiscountList: Discount[];
|
|
29
29
|
orderTotalAmount?: number;
|
|
30
|
+
holders?: {
|
|
31
|
+
form_record_id: number;
|
|
32
|
+
form_id?: number;
|
|
33
|
+
main_field?: string;
|
|
34
|
+
}[];
|
|
30
35
|
}
|
|
31
36
|
export interface SetDiscountSelectedParams {
|
|
32
37
|
discountId: number;
|