@pisell/pisellos 0.0.15 → 0.0.17
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/AccountList/index.d.ts +5 -1
- package/dist/modules/AccountList/index.js +92 -39
- package/dist/modules/AccountList/types.d.ts +1 -0
- package/dist/modules/BaseModule.d.ts +6 -0
- package/dist/modules/BaseModule.js +41 -0
- package/dist/modules/Cart/index.d.ts +8 -0
- package/dist/modules/Cart/index.js +45 -6
- package/dist/modules/Cart/utils.js +14 -0
- package/dist/modules/Date/index.d.ts +5 -0
- package/dist/modules/Date/index.js +35 -2
- package/dist/modules/Discount/index.d.ts +4 -0
- package/dist/modules/Discount/index.js +32 -4
- package/dist/modules/Discount/types.d.ts +3 -0
- package/dist/modules/Rules/index.js +8 -5
- package/dist/modules/Step/index.d.ts +4 -0
- package/dist/modules/Step/index.js +29 -1
- package/dist/modules/Summary/index.d.ts +4 -0
- package/dist/modules/Summary/index.js +28 -2
- package/dist/solution/BookingByStep/index.d.ts +13 -2
- package/dist/solution/BookingByStep/index.js +194 -117
- package/dist/solution/BookingByStep/types.js +0 -3
- package/dist/solution/ShopDiscount/index.js +24 -3
- package/lib/modules/AccountList/index.d.ts +5 -1
- package/lib/modules/AccountList/index.js +34 -1
- package/lib/modules/AccountList/types.d.ts +1 -0
- package/lib/modules/BaseModule.d.ts +6 -0
- package/lib/modules/BaseModule.js +37 -0
- package/lib/modules/Cart/index.d.ts +8 -0
- package/lib/modules/Cart/index.js +26 -1
- package/lib/modules/Cart/utils.js +14 -0
- package/lib/modules/Date/index.d.ts +5 -0
- package/lib/modules/Date/index.js +21 -0
- package/lib/modules/Discount/index.d.ts +4 -0
- package/lib/modules/Discount/index.js +19 -0
- package/lib/modules/Discount/types.d.ts +3 -0
- package/lib/modules/Rules/index.js +10 -5
- package/lib/modules/Step/index.d.ts +4 -0
- package/lib/modules/Step/index.js +19 -0
- package/lib/modules/Summary/index.d.ts +4 -0
- package/lib/modules/Summary/index.js +17 -0
- package/lib/solution/BookingByStep/index.d.ts +13 -2
- package/lib/solution/BookingByStep/index.js +74 -7
- package/lib/solution/BookingByStep/types.js +0 -3
- package/lib/solution/ShopDiscount/index.js +21 -3
- package/package.json +1 -1
|
@@ -125,7 +125,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
125
125
|
if (discount_list && discount_list.length > 0) {
|
|
126
126
|
// 检查是否有使用新折扣的情况
|
|
127
127
|
var usedNewDiscount = discount_list.some(function (discount) {
|
|
128
|
-
|
|
128
|
+
var _discount$discount;
|
|
129
|
+
return newDiscountIds.includes(discount === null || discount === void 0 || (_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id);
|
|
129
130
|
});
|
|
130
131
|
if (usedNewDiscount) {
|
|
131
132
|
hasApplicableDiscount = true;
|
|
@@ -207,7 +208,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
207
208
|
var limitedData = discount === null || discount === void 0 ? void 0 : discount.limited_relation_product_data;
|
|
208
209
|
|
|
209
210
|
// 判断优惠券是否适用于该商品
|
|
210
|
-
if (limitedData.type === "product_all" || limitedData.product_ids && limitedData.product_ids.includes(product.id)) {
|
|
211
|
+
if (!(product !== null && product !== void 0 && product.booking_id) && (limitedData.type === "product_all" || limitedData.product_ids && limitedData.product_ids.includes(product.id))) {
|
|
211
212
|
var _discountApplicabilit;
|
|
212
213
|
// 记录此优惠券适用的商品
|
|
213
214
|
(_discountApplicabilit = discountApplicability.get(discount.id)) === null || _discountApplicabilit === void 0 || _discountApplicabilit.push(product.id);
|
|
@@ -217,9 +218,11 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
217
218
|
applicableProducts.push({
|
|
218
219
|
amount: product.price,
|
|
219
220
|
type: discount.tag,
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
221
|
+
discount: {
|
|
222
|
+
resource_id: discount.id,
|
|
223
|
+
title: discount.format_title,
|
|
224
|
+
original_amount: product.origin_total
|
|
225
|
+
}
|
|
223
226
|
});
|
|
224
227
|
discountApplicableProducts.set(discount.id, applicableProducts);
|
|
225
228
|
}
|
|
@@ -5,6 +5,9 @@ export declare class StepModule extends BaseModule implements Module, IStepModul
|
|
|
5
5
|
protected defaultName: string;
|
|
6
6
|
protected defaultVersion: string;
|
|
7
7
|
private store;
|
|
8
|
+
private cacheId;
|
|
9
|
+
private openCache;
|
|
10
|
+
private fatherModule;
|
|
8
11
|
constructor(name?: string, version?: string);
|
|
9
12
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
10
13
|
init(steps: IStep[]): void;
|
|
@@ -16,4 +19,5 @@ export declare class StepModule extends BaseModule implements Module, IStepModul
|
|
|
16
19
|
prevStep(): void;
|
|
17
20
|
nextStep(): void;
|
|
18
21
|
gotoStep(stepIndex: number): void;
|
|
22
|
+
storeChange(): void;
|
|
19
23
|
}
|
|
@@ -26,18 +26,34 @@ export var StepModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
26
26
|
_defineProperty(_assertThisInitialized(_this), "defaultName", "step");
|
|
27
27
|
_defineProperty(_assertThisInitialized(_this), "defaultVersion", "1.0.0");
|
|
28
28
|
_defineProperty(_assertThisInitialized(_this), "store", void 0);
|
|
29
|
+
_defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
|
|
30
|
+
_defineProperty(_assertThisInitialized(_this), "openCache", false);
|
|
31
|
+
_defineProperty(_assertThisInitialized(_this), "fatherModule", void 0);
|
|
29
32
|
return _this;
|
|
30
33
|
}
|
|
31
34
|
_createClass(StepModule, [{
|
|
32
35
|
key: "initialize",
|
|
33
36
|
value: function () {
|
|
34
37
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
38
|
+
var _options$otherParams, _options$otherParams2;
|
|
35
39
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
36
40
|
while (1) switch (_context.prev = _context.next) {
|
|
37
41
|
case 0:
|
|
38
42
|
this.core = core;
|
|
39
43
|
this.store = options.store;
|
|
40
|
-
|
|
44
|
+
if (options.initialState) {
|
|
45
|
+
this.store.stepList = options.initialState.stepList;
|
|
46
|
+
this.store.currentStep = options.initialState.currentStep;
|
|
47
|
+
this.store.currentStepIndex = options.initialState.currentStepIndex;
|
|
48
|
+
}
|
|
49
|
+
if ((_options$otherParams = options.otherParams) !== null && _options$otherParams !== void 0 && _options$otherParams.cacheId) {
|
|
50
|
+
this.openCache = options.otherParams.openCache;
|
|
51
|
+
this.cacheId = options.otherParams.cacheId;
|
|
52
|
+
}
|
|
53
|
+
if ((_options$otherParams2 = options.otherParams) !== null && _options$otherParams2 !== void 0 && _options$otherParams2.fatherModule) {
|
|
54
|
+
this.fatherModule = options.otherParams.fatherModule;
|
|
55
|
+
}
|
|
56
|
+
case 5:
|
|
41
57
|
case "end":
|
|
42
58
|
return _context.stop();
|
|
43
59
|
}
|
|
@@ -102,6 +118,18 @@ export var StepModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
102
118
|
value: function gotoStep(stepIndex) {
|
|
103
119
|
this.setCurrentStep(stepIndex);
|
|
104
120
|
}
|
|
121
|
+
}, {
|
|
122
|
+
key: "storeChange",
|
|
123
|
+
value: function storeChange() {
|
|
124
|
+
if (this.openCache) {
|
|
125
|
+
this.checkSaveCache({
|
|
126
|
+
cacheId: this.cacheId,
|
|
127
|
+
fatherModule: this.fatherModule,
|
|
128
|
+
store: this.store,
|
|
129
|
+
cacheKey: ['currentStepIndex', 'currentStep', 'stepList']
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
105
133
|
}]);
|
|
106
134
|
return StepModule;
|
|
107
135
|
}(BaseModule);
|
|
@@ -7,7 +7,11 @@ export declare class SummaryModule extends BaseModule implements Module, ISummar
|
|
|
7
7
|
protected defaultVersion: string;
|
|
8
8
|
private shopStore;
|
|
9
9
|
private store;
|
|
10
|
+
private cacheId;
|
|
11
|
+
private openCache;
|
|
12
|
+
private fatherModule;
|
|
10
13
|
constructor(name?: string, version?: string);
|
|
11
14
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
12
15
|
getSummary(cartItems: CartItem[]): Promise<ISummaryState["summary"]>;
|
|
16
|
+
storeChange(): void;
|
|
13
17
|
}
|
|
@@ -28,24 +28,38 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
28
28
|
_defineProperty(_assertThisInitialized(_this), "defaultVersion", "1.0.0");
|
|
29
29
|
_defineProperty(_assertThisInitialized(_this), "shopStore", void 0);
|
|
30
30
|
_defineProperty(_assertThisInitialized(_this), "store", void 0);
|
|
31
|
+
_defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
|
|
32
|
+
_defineProperty(_assertThisInitialized(_this), "openCache", false);
|
|
33
|
+
_defineProperty(_assertThisInitialized(_this), "fatherModule", void 0);
|
|
31
34
|
return _this;
|
|
32
35
|
}
|
|
33
36
|
_createClass(SummaryModule, [{
|
|
34
37
|
key: "initialize",
|
|
35
38
|
value: function () {
|
|
36
39
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
40
|
+
var _options$otherParams, _options$otherParams2;
|
|
37
41
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
38
42
|
while (1) switch (_context.prev = _context.next) {
|
|
39
43
|
case 0:
|
|
40
44
|
this.core = core;
|
|
41
45
|
this.store = options.store;
|
|
42
46
|
this.shopStore = this.core.getPlugin("shopStore");
|
|
47
|
+
if (options.initialState) {
|
|
48
|
+
this.store.summary = options.initialState.summary;
|
|
49
|
+
}
|
|
50
|
+
if ((_options$otherParams = options.otherParams) !== null && _options$otherParams !== void 0 && _options$otherParams.cacheId) {
|
|
51
|
+
this.openCache = options.otherParams.openCache;
|
|
52
|
+
this.cacheId = options.otherParams.cacheId;
|
|
53
|
+
}
|
|
54
|
+
if ((_options$otherParams2 = options.otherParams) !== null && _options$otherParams2 !== void 0 && _options$otherParams2.fatherModule) {
|
|
55
|
+
this.fatherModule = options.otherParams.fatherModule;
|
|
56
|
+
}
|
|
43
57
|
if (this.shopStore) {
|
|
44
|
-
_context.next =
|
|
58
|
+
_context.next = 8;
|
|
45
59
|
break;
|
|
46
60
|
}
|
|
47
61
|
throw new Error("SummaryModule 需要 shopStore 插件支持");
|
|
48
|
-
case
|
|
62
|
+
case 8:
|
|
49
63
|
case "end":
|
|
50
64
|
return _context.stop();
|
|
51
65
|
}
|
|
@@ -80,6 +94,18 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
80
94
|
}
|
|
81
95
|
return getSummary;
|
|
82
96
|
}()
|
|
97
|
+
}, {
|
|
98
|
+
key: "storeChange",
|
|
99
|
+
value: function storeChange() {
|
|
100
|
+
if (this.openCache) {
|
|
101
|
+
this.checkSaveCache({
|
|
102
|
+
cacheId: this.cacheId,
|
|
103
|
+
fatherModule: this.fatherModule,
|
|
104
|
+
store: this.store,
|
|
105
|
+
cacheKey: ['summary']
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
83
109
|
}]);
|
|
84
110
|
return SummaryModule;
|
|
85
111
|
}(BaseModule);
|
|
@@ -38,8 +38,9 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
38
38
|
getActiveAccount(): Account | null;
|
|
39
39
|
removeAccount(id: string): void;
|
|
40
40
|
setDateRange(dateRange: ITime[]): Promise<void>;
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
clearDateRange(): void;
|
|
42
|
+
getDateRange(): Promise<ITime[]>;
|
|
43
|
+
getCart(): CartItem[];
|
|
43
44
|
getAvailableDate(params?: {
|
|
44
45
|
products?: ProductData[];
|
|
45
46
|
startDate?: string;
|
|
@@ -79,6 +80,14 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
79
80
|
deleteCartItemInfo(types: "resource" | "time"): void;
|
|
80
81
|
destory(): void;
|
|
81
82
|
getResourcesList(): any[];
|
|
83
|
+
getResourcesListByCartItem(id: string | number): {
|
|
84
|
+
id: number | undefined;
|
|
85
|
+
_id: string;
|
|
86
|
+
product: ProductData | undefined;
|
|
87
|
+
resources: import("./utils/resources").ResourceItem[];
|
|
88
|
+
holder_id: string | number | undefined;
|
|
89
|
+
holder_name: string | undefined;
|
|
90
|
+
} | undefined;
|
|
82
91
|
getResourceTimeSlot({ product, resources, currentResourceId, }: {
|
|
83
92
|
product: ProductData;
|
|
84
93
|
resources: any[];
|
|
@@ -111,4 +120,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
111
120
|
};
|
|
112
121
|
getTimeSlotByAllResources(resources_code: string): any[];
|
|
113
122
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
123
|
+
clearCache(): void;
|
|
124
|
+
clearCacheByModule(module: string): void;
|
|
114
125
|
}
|