@pisell/pisellos 0.0.387 → 0.0.388
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/Rules/index.d.ts +4 -2
- package/dist/modules/Rules/index.js +8 -5
- package/dist/modules/Rules/types.d.ts +1 -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 +4 -0
- package/dist/solution/ShopDiscount/index.js +13 -4
- package/dist/solution/ShopDiscount/types.d.ts +4 -0
- package/lib/modules/Rules/index.d.ts +4 -2
- package/lib/modules/Rules/index.js +8 -5
- package/lib/modules/Rules/types.d.ts +1 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/ShopDiscount/index.d.ts +4 -0
- package/lib/solution/ShopDiscount/index.js +12 -5
- package/lib/solution/ShopDiscount/types.d.ts +4 -0
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ 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, holders, }: {
|
|
19
|
+
isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, orderTotalAmount, holders, isFormSubject, }: {
|
|
20
20
|
oldDiscountList: Discount[];
|
|
21
21
|
newDiscountList: Discount[];
|
|
22
22
|
productList: any[];
|
|
@@ -24,18 +24,20 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
24
24
|
holders: {
|
|
25
25
|
form_record_id: number;
|
|
26
26
|
}[];
|
|
27
|
+
isFormSubject: boolean;
|
|
27
28
|
}): {
|
|
28
29
|
isAvailable: boolean;
|
|
29
30
|
discountList: Discount[];
|
|
30
31
|
productList: any[];
|
|
31
32
|
};
|
|
32
|
-
calcDiscount({ discountList, productList, orderTotalAmount, holders, }: {
|
|
33
|
+
calcDiscount({ discountList, productList, orderTotalAmount, holders, isFormSubject, }: {
|
|
33
34
|
discountList: Discount[];
|
|
34
35
|
productList: any[];
|
|
35
36
|
orderTotalAmount: number;
|
|
36
37
|
holders: {
|
|
37
38
|
form_record_id: number;
|
|
38
39
|
}[];
|
|
40
|
+
isFormSubject: boolean;
|
|
39
41
|
}, options?: {
|
|
40
42
|
isSelected?: boolean;
|
|
41
43
|
discountId?: number;
|
|
@@ -130,7 +130,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
130
130
|
newDiscountList = _ref.newDiscountList,
|
|
131
131
|
productList = _ref.productList,
|
|
132
132
|
orderTotalAmount = _ref.orderTotalAmount,
|
|
133
|
-
holders = _ref.holders
|
|
133
|
+
holders = _ref.holders,
|
|
134
|
+
isFormSubject = _ref.isFormSubject;
|
|
134
135
|
// 首先检查是否有新的优惠券可应用
|
|
135
136
|
if (!newDiscountList || newDiscountList.length === 0) {
|
|
136
137
|
return {
|
|
@@ -162,7 +163,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
162
163
|
discountList: mergedDiscountList,
|
|
163
164
|
productList: _toConsumableArray(productList),
|
|
164
165
|
orderTotalAmount: orderTotalAmount,
|
|
165
|
-
holders: holders
|
|
166
|
+
holders: holders,
|
|
167
|
+
isFormSubject: isFormSubject
|
|
166
168
|
}, {
|
|
167
169
|
scan: true
|
|
168
170
|
});
|
|
@@ -201,7 +203,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
201
203
|
var discountList = _ref2.discountList,
|
|
202
204
|
productList = _ref2.productList,
|
|
203
205
|
orderTotalAmount = _ref2.orderTotalAmount,
|
|
204
|
-
holders = _ref2.holders
|
|
206
|
+
holders = _ref2.holders,
|
|
207
|
+
isFormSubject = _ref2.isFormSubject;
|
|
205
208
|
// 识别出来是不是在编辑的界面里又新增了商品
|
|
206
209
|
// 这种情况下,如果有可用的优惠券,也会自动勾选上
|
|
207
210
|
var isEditModeAddNewProduct = productList.find(function (n) {
|
|
@@ -498,7 +501,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
498
501
|
// 拿到discount配置的holder信息 product信息 product.holder 加在 isLimitedProduct
|
|
499
502
|
var _tempVar = (flatItem === null || flatItem === void 0 ? void 0 : flatItem.type) === 'bundle' ? flatItem === null || flatItem === void 0 ? void 0 : flatItem.parentProduct : flatItem === null || flatItem === void 0 ? void 0 : flatItem.product;
|
|
500
503
|
var isHolderMatch = _this3.checkHolderMatch(discount, {
|
|
501
|
-
isNeedHolder: _tempVar
|
|
504
|
+
isNeedHolder: isFormSubject && !(_tempVar !== null && _tempVar !== void 0 && _tempVar.isNormalProduct),
|
|
502
505
|
holder_id: (_tempVar === null || _tempVar === void 0 ? void 0 : _tempVar.holder_id) || product.holder_id
|
|
503
506
|
}, holders);
|
|
504
507
|
var timeLimit = true;
|
|
@@ -645,7 +648,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
645
648
|
// 拿到discount配置的holder信息 product信息 product.holder 不可用return false
|
|
646
649
|
var _tempVar = (flatItem === null || flatItem === void 0 ? void 0 : flatItem.type) === 'bundle' ? flatItem === null || flatItem === void 0 ? void 0 : flatItem.parentProduct : flatItem === null || flatItem === void 0 ? void 0 : flatItem.product;
|
|
647
650
|
var isHolderMatch = _this3.checkHolderMatch(discount, {
|
|
648
|
-
isNeedHolder: _tempVar
|
|
651
|
+
isNeedHolder: isFormSubject && !(_tempVar !== null && _tempVar !== void 0 && _tempVar.isNormalProduct),
|
|
649
652
|
holder_id: (_tempVar === null || _tempVar === void 0 ? void 0 : _tempVar.holder_id) || product.holder_id
|
|
650
653
|
}, holders);
|
|
651
654
|
// 如果 holder 不匹配,则不适用
|
|
@@ -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 | 3 |
|
|
311
|
+
weekNum: 0 | 2 | 1 | 3 | 5 | 4 | 6;
|
|
312
312
|
}[]>;
|
|
313
313
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
314
314
|
private getScheduleDataByIds;
|
|
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
123
123
|
* 获取当前的客户搜索条件
|
|
124
124
|
* @returns 当前搜索条件
|
|
125
125
|
*/
|
|
126
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
126
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
127
127
|
/**
|
|
128
128
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
129
129
|
* @returns 客户状态
|
|
@@ -25,6 +25,10 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
25
25
|
setHolders(holders: {
|
|
26
26
|
form_record_id: number;
|
|
27
27
|
}[]): void;
|
|
28
|
+
setBookingSubject(bookingSubject: {
|
|
29
|
+
type?: 'form' | 'customer';
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}): void;
|
|
28
32
|
calcDiscount(productList: Record<string, any>[], options?: SetDiscountSelectedParams): {
|
|
29
33
|
productList: Record<string, any>[];
|
|
30
34
|
discountList: Discount[];
|
|
@@ -55,7 +55,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
55
55
|
currentBookingTime: "",
|
|
56
56
|
filteredDiscountList: [],
|
|
57
57
|
orderTotalAmount: 0,
|
|
58
|
-
holders: []
|
|
58
|
+
holders: [],
|
|
59
|
+
bookingSubject: undefined
|
|
59
60
|
};
|
|
60
61
|
return _this;
|
|
61
62
|
}
|
|
@@ -300,11 +301,17 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
300
301
|
value: function setHolders(holders) {
|
|
301
302
|
this.store.holders = holders;
|
|
302
303
|
}
|
|
304
|
+
}, {
|
|
305
|
+
key: "setBookingSubject",
|
|
306
|
+
value: function setBookingSubject(bookingSubject) {
|
|
307
|
+
this.store.bookingSubject = bookingSubject;
|
|
308
|
+
}
|
|
303
309
|
|
|
304
310
|
// 计算优惠券
|
|
305
311
|
}, {
|
|
306
312
|
key: "calcDiscount",
|
|
307
313
|
value: function calcDiscount(productList, options) {
|
|
314
|
+
var _this$store$bookingSu;
|
|
308
315
|
this.store.productList = productList;
|
|
309
316
|
var rulesModule = this.core.getModule("".concat(this.name, "_rules"));
|
|
310
317
|
if (!rulesModule) {
|
|
@@ -317,7 +324,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
317
324
|
productList: productList,
|
|
318
325
|
discountList: this.getDiscountList(),
|
|
319
326
|
orderTotalAmount: this.store.orderTotalAmount || 0,
|
|
320
|
-
holders: this.store.holders || []
|
|
327
|
+
holders: this.store.holders || [],
|
|
328
|
+
isFormSubject: ((_this$store$bookingSu = this.store.bookingSubject) === null || _this$store$bookingSu === void 0 ? void 0 : _this$store$bookingSu.type) === 'form'
|
|
321
329
|
}, options) || {
|
|
322
330
|
productList: productList,
|
|
323
331
|
discountList: this.getDiscountList()
|
|
@@ -390,7 +398,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
390
398
|
key: "scanCode",
|
|
391
399
|
value: function () {
|
|
392
400
|
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(code, customerId) {
|
|
393
|
-
var _this$store$discount3, resultDiscountList, rulesModule, withScanList, currentSelectedDiscountList, _ref2, newProductList, newDiscountList, isAvailable, _this$options$otherPa6;
|
|
401
|
+
var _this$store$discount3, _this$store$bookingSu2, resultDiscountList, rulesModule, withScanList, currentSelectedDiscountList, _ref2, newProductList, newDiscountList, isAvailable, _this$options$otherPa6;
|
|
394
402
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
395
403
|
while (1) switch (_context5.prev = _context5.next) {
|
|
396
404
|
case 0:
|
|
@@ -457,7 +465,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
457
465
|
oldDiscountList: this.getDiscountList(),
|
|
458
466
|
newDiscountList: withScanList,
|
|
459
467
|
orderTotalAmount: this.store.orderTotalAmount || 0,
|
|
460
|
-
holders: this.store.holders || []
|
|
468
|
+
holders: this.store.holders || [],
|
|
469
|
+
isFormSubject: ((_this$store$bookingSu2 = this.store.bookingSubject) === null || _this$store$bookingSu2 === void 0 ? void 0 : _this$store$bookingSu2.type) === 'form'
|
|
461
470
|
}) || {
|
|
462
471
|
isAvailable: false,
|
|
463
472
|
productList: this.store.productList || [],
|
|
@@ -16,7 +16,7 @@ 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, holders, }: {
|
|
19
|
+
isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, orderTotalAmount, holders, isFormSubject, }: {
|
|
20
20
|
oldDiscountList: Discount[];
|
|
21
21
|
newDiscountList: Discount[];
|
|
22
22
|
productList: any[];
|
|
@@ -24,18 +24,20 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
24
24
|
holders: {
|
|
25
25
|
form_record_id: number;
|
|
26
26
|
}[];
|
|
27
|
+
isFormSubject: boolean;
|
|
27
28
|
}): {
|
|
28
29
|
isAvailable: boolean;
|
|
29
30
|
discountList: Discount[];
|
|
30
31
|
productList: any[];
|
|
31
32
|
};
|
|
32
|
-
calcDiscount({ discountList, productList, orderTotalAmount, holders, }: {
|
|
33
|
+
calcDiscount({ discountList, productList, orderTotalAmount, holders, isFormSubject, }: {
|
|
33
34
|
discountList: Discount[];
|
|
34
35
|
productList: any[];
|
|
35
36
|
orderTotalAmount: number;
|
|
36
37
|
holders: {
|
|
37
38
|
form_record_id: number;
|
|
38
39
|
}[];
|
|
40
|
+
isFormSubject: boolean;
|
|
39
41
|
}, options?: {
|
|
40
42
|
isSelected?: boolean;
|
|
41
43
|
discountId?: number;
|
|
@@ -81,7 +81,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
81
81
|
newDiscountList,
|
|
82
82
|
productList,
|
|
83
83
|
orderTotalAmount,
|
|
84
|
-
holders
|
|
84
|
+
holders,
|
|
85
|
+
isFormSubject
|
|
85
86
|
}) {
|
|
86
87
|
if (!newDiscountList || newDiscountList.length === 0) {
|
|
87
88
|
return {
|
|
@@ -113,7 +114,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
113
114
|
discountList: mergedDiscountList,
|
|
114
115
|
productList: [...productList],
|
|
115
116
|
orderTotalAmount,
|
|
116
|
-
holders
|
|
117
|
+
holders,
|
|
118
|
+
isFormSubject
|
|
117
119
|
},
|
|
118
120
|
{
|
|
119
121
|
scan: true
|
|
@@ -145,7 +147,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
145
147
|
discountList,
|
|
146
148
|
productList,
|
|
147
149
|
orderTotalAmount,
|
|
148
|
-
holders
|
|
150
|
+
holders,
|
|
151
|
+
isFormSubject
|
|
149
152
|
}, options) {
|
|
150
153
|
const isEditModeAddNewProduct = productList.find((n) => n.booking_id) && productList.find((n) => !n.booking_id);
|
|
151
154
|
const editModeDiscount = [];
|
|
@@ -345,7 +348,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
345
348
|
const isHolderMatch = this.checkHolderMatch(
|
|
346
349
|
discount,
|
|
347
350
|
{
|
|
348
|
-
isNeedHolder: _tempVar == null ? void 0 : _tempVar.
|
|
351
|
+
isNeedHolder: isFormSubject && !(_tempVar == null ? void 0 : _tempVar.isNormalProduct),
|
|
349
352
|
holder_id: (_tempVar == null ? void 0 : _tempVar.holder_id) || product.holder_id
|
|
350
353
|
},
|
|
351
354
|
holders
|
|
@@ -472,7 +475,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
472
475
|
const isHolderMatch = this.checkHolderMatch(
|
|
473
476
|
discount,
|
|
474
477
|
{
|
|
475
|
-
isNeedHolder: _tempVar == null ? void 0 : _tempVar.
|
|
478
|
+
isNeedHolder: isFormSubject && !(_tempVar == null ? void 0 : _tempVar.isNormalProduct),
|
|
476
479
|
holder_id: (_tempVar == null ? void 0 : _tempVar.holder_id) || product.holder_id
|
|
477
480
|
},
|
|
478
481
|
holders
|
|
@@ -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 | 3 |
|
|
311
|
+
weekNum: 0 | 2 | 1 | 3 | 5 | 4 | 6;
|
|
312
312
|
}[]>;
|
|
313
313
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
314
314
|
private getScheduleDataByIds;
|
|
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
123
123
|
* 获取当前的客户搜索条件
|
|
124
124
|
* @returns 当前搜索条件
|
|
125
125
|
*/
|
|
126
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
126
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
127
127
|
/**
|
|
128
128
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
129
129
|
* @returns 客户状态
|
|
@@ -25,6 +25,10 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
25
25
|
setHolders(holders: {
|
|
26
26
|
form_record_id: number;
|
|
27
27
|
}[]): void;
|
|
28
|
+
setBookingSubject(bookingSubject: {
|
|
29
|
+
type?: 'form' | 'customer';
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}): void;
|
|
28
32
|
calcDiscount(productList: Record<string, any>[], options?: SetDiscountSelectedParams): {
|
|
29
33
|
productList: Record<string, any>[];
|
|
30
34
|
discountList: Discount[];
|
|
@@ -55,7 +55,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
55
55
|
currentBookingTime: "",
|
|
56
56
|
filteredDiscountList: [],
|
|
57
57
|
orderTotalAmount: 0,
|
|
58
|
-
holders: []
|
|
58
|
+
holders: [],
|
|
59
|
+
bookingSubject: void 0
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
62
|
// =========== 生命周期方法 ===========
|
|
@@ -200,8 +201,12 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
200
201
|
setHolders(holders) {
|
|
201
202
|
this.store.holders = holders;
|
|
202
203
|
}
|
|
204
|
+
setBookingSubject(bookingSubject) {
|
|
205
|
+
this.store.bookingSubject = bookingSubject;
|
|
206
|
+
}
|
|
203
207
|
// 计算优惠券
|
|
204
208
|
calcDiscount(productList, options) {
|
|
209
|
+
var _a;
|
|
205
210
|
this.store.productList = productList;
|
|
206
211
|
const rulesModule = this.core.getModule(`${this.name}_rules`);
|
|
207
212
|
if (!rulesModule) {
|
|
@@ -212,7 +217,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
212
217
|
productList,
|
|
213
218
|
discountList: this.getDiscountList(),
|
|
214
219
|
orderTotalAmount: this.store.orderTotalAmount || 0,
|
|
215
|
-
holders: this.store.holders || []
|
|
220
|
+
holders: this.store.holders || [],
|
|
221
|
+
isFormSubject: ((_a = this.store.bookingSubject) == null ? void 0 : _a.type) === "form"
|
|
216
222
|
},
|
|
217
223
|
options
|
|
218
224
|
) || { productList, discountList: this.getDiscountList() };
|
|
@@ -259,7 +265,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
259
265
|
}
|
|
260
266
|
// 扫码输入code
|
|
261
267
|
async scanCode(code, customerId) {
|
|
262
|
-
var _a, _b;
|
|
268
|
+
var _a, _b, _c;
|
|
263
269
|
try {
|
|
264
270
|
const resultDiscountList = await ((_a = this.store.discount) == null ? void 0 : _a.batchSearch(code, customerId)) || [];
|
|
265
271
|
const rulesModule = this.store.rules;
|
|
@@ -303,7 +309,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
303
309
|
oldDiscountList: this.getDiscountList(),
|
|
304
310
|
newDiscountList: withScanList,
|
|
305
311
|
orderTotalAmount: this.store.orderTotalAmount || 0,
|
|
306
|
-
holders: this.store.holders || []
|
|
312
|
+
holders: this.store.holders || [],
|
|
313
|
+
isFormSubject: ((_b = this.store.bookingSubject) == null ? void 0 : _b.type) === "form"
|
|
307
314
|
}) || {
|
|
308
315
|
isAvailable: false,
|
|
309
316
|
productList: this.store.productList || [],
|
|
@@ -313,7 +320,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
313
320
|
this.setDiscountList(newDiscountList || []);
|
|
314
321
|
this.store.originalDiscountList = newDiscountList || [];
|
|
315
322
|
this.setProductList(newProductList || []);
|
|
316
|
-
if (this.isWalkIn() && resultDiscountList.length && ((
|
|
323
|
+
if (this.isWalkIn() && resultDiscountList.length && ((_c = this.options.otherParams) == null ? void 0 : _c.platform) === "shop") {
|
|
317
324
|
await this.getCustomerWallet(
|
|
318
325
|
resultDiscountList[0].customer_id
|
|
319
326
|
);
|