@pisell/pisellos 0.0.74 → 0.0.76
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/Step/index.d.ts +16 -0
- package/dist/modules/Step/index.js +54 -5
- package/dist/modules/Step/tyeps.d.ts +2 -0
- package/dist/solution/BookingByStep/index.d.ts +5 -1
- package/dist/solution/BookingByStep/index.js +11 -1
- package/lib/modules/Step/index.d.ts +16 -0
- package/lib/modules/Step/index.js +44 -5
- package/lib/modules/Step/tyeps.d.ts +2 -0
- package/lib/solution/BookingByStep/index.d.ts +5 -1
- package/lib/solution/BookingByStep/index.js +13 -3
- package/package.json +1 -1
|
@@ -16,8 +16,18 @@ export declare class StepModule extends BaseModule implements Module, IStepModul
|
|
|
16
16
|
getStepList(): IStep[];
|
|
17
17
|
getCurrentStep(): IStep;
|
|
18
18
|
getCurrentStepIndex(): number;
|
|
19
|
+
/**
|
|
20
|
+
* 上一个步骤
|
|
21
|
+
*/
|
|
19
22
|
prevStep(): void;
|
|
23
|
+
/**
|
|
24
|
+
* 下一个步骤
|
|
25
|
+
*/
|
|
20
26
|
nextStep(): void;
|
|
27
|
+
/**
|
|
28
|
+
* 跳转到指定步骤
|
|
29
|
+
* @param stepIndex 步骤的 index
|
|
30
|
+
*/
|
|
21
31
|
gotoStep(stepIndex: number): void;
|
|
22
32
|
/**
|
|
23
33
|
* 添加步骤
|
|
@@ -30,5 +40,11 @@ export declare class StepModule extends BaseModule implements Module, IStepModul
|
|
|
30
40
|
* @param key 步骤的 key
|
|
31
41
|
*/
|
|
32
42
|
removeStep(key: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* 更新步骤
|
|
45
|
+
* @param key 步骤的 key
|
|
46
|
+
* @param step 步骤
|
|
47
|
+
*/
|
|
48
|
+
updateStep(key: string, step: IStep): void;
|
|
33
49
|
storeChange(): void;
|
|
34
50
|
}
|
|
@@ -84,7 +84,8 @@ export var StepModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
84
84
|
}, {
|
|
85
85
|
key: "setCurrentStep",
|
|
86
86
|
value: function setCurrentStep(stepIndex) {
|
|
87
|
-
|
|
87
|
+
var _this$store$stepList;
|
|
88
|
+
if (stepIndex < 0 || stepIndex >= ((_this$store$stepList = this.store.stepList) === null || _this$store$stepList === void 0 ? void 0 : _this$store$stepList.length)) {
|
|
88
89
|
return;
|
|
89
90
|
}
|
|
90
91
|
this.store.currentStepIndex = stepIndex;
|
|
@@ -105,20 +106,45 @@ export var StepModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
105
106
|
value: function getCurrentStepIndex() {
|
|
106
107
|
return this.store.currentStepIndex;
|
|
107
108
|
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 上一个步骤
|
|
112
|
+
*/
|
|
108
113
|
}, {
|
|
109
114
|
key: "prevStep",
|
|
110
115
|
value: function prevStep() {
|
|
111
|
-
|
|
112
|
-
|
|
116
|
+
// 如果上一个步骤是跳过,则继续往前找,直到找到一个不是跳过的步骤
|
|
117
|
+
var prevStepIndex = this.store.currentStepIndex - 1;
|
|
118
|
+
while ((_this$store$stepList$ = this.store.stepList[prevStepIndex]) !== null && _this$store$stepList$ !== void 0 && _this$store$stepList$.isSkip) {
|
|
119
|
+
var _this$store$stepList$;
|
|
120
|
+
prevStepIndex--;
|
|
121
|
+
}
|
|
122
|
+
if (prevStepIndex >= 0) {
|
|
123
|
+
this.setCurrentStep(prevStepIndex);
|
|
113
124
|
}
|
|
114
125
|
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* 下一个步骤
|
|
129
|
+
*/
|
|
115
130
|
}, {
|
|
116
131
|
key: "nextStep",
|
|
117
132
|
value: function nextStep() {
|
|
118
|
-
|
|
119
|
-
|
|
133
|
+
// 如果下一个步骤是跳过,则继续往后找,直到找到一个不是跳过的步骤
|
|
134
|
+
var nextStepIndex = this.store.currentStepIndex + 1;
|
|
135
|
+
while ((_this$store$stepList$2 = this.store.stepList[nextStepIndex]) !== null && _this$store$stepList$2 !== void 0 && _this$store$stepList$2.isSkip) {
|
|
136
|
+
var _this$store$stepList$2;
|
|
137
|
+
nextStepIndex++;
|
|
138
|
+
}
|
|
139
|
+
if (nextStepIndex < this.store.stepList.length) {
|
|
140
|
+
this.setCurrentStep(nextStepIndex);
|
|
120
141
|
}
|
|
121
142
|
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* 跳转到指定步骤
|
|
146
|
+
* @param stepIndex 步骤的 index
|
|
147
|
+
*/
|
|
122
148
|
}, {
|
|
123
149
|
key: "gotoStep",
|
|
124
150
|
value: function gotoStep(stepIndex) {
|
|
@@ -170,6 +196,29 @@ export var StepModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
170
196
|
});
|
|
171
197
|
this.store.stepList = _toConsumableArray(newStepList);
|
|
172
198
|
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* 更新步骤
|
|
202
|
+
* @param key 步骤的 key
|
|
203
|
+
* @param step 步骤
|
|
204
|
+
*/
|
|
205
|
+
}, {
|
|
206
|
+
key: "updateStep",
|
|
207
|
+
value: function updateStep(key, step) {
|
|
208
|
+
var _this$store$stepList2, _this$store$currentSt;
|
|
209
|
+
var newStepList = (_this$store$stepList2 = this.store.stepList) === null || _this$store$stepList2 === void 0 ? void 0 : _this$store$stepList2.map(function (n) {
|
|
210
|
+
if (n.key === key) {
|
|
211
|
+
return step;
|
|
212
|
+
}
|
|
213
|
+
return n;
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
// 如果更新的是当前步骤,则更新当前步骤
|
|
217
|
+
if (key === ((_this$store$currentSt = this.store.currentStep) === null || _this$store$currentSt === void 0 ? void 0 : _this$store$currentSt.key)) {
|
|
218
|
+
this.store.currentStep = step;
|
|
219
|
+
}
|
|
220
|
+
this.store.stepList = _toConsumableArray(newStepList || []);
|
|
221
|
+
}
|
|
173
222
|
}, {
|
|
174
223
|
key: "storeChange",
|
|
175
224
|
value: function storeChange() {
|
|
@@ -38,6 +38,10 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
38
38
|
* 删除step
|
|
39
39
|
*/
|
|
40
40
|
removeStep(key: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* 更新step
|
|
43
|
+
*/
|
|
44
|
+
updateStep(key: string, step: IStep): void;
|
|
41
45
|
loadProducts({ category_ids, product_ids, collection, schedule_ids, schedule_date, }: {
|
|
42
46
|
category_ids?: number[];
|
|
43
47
|
product_ids?: number[];
|
|
@@ -51,7 +55,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
51
55
|
category_ids?: number[];
|
|
52
56
|
}): Promise<any>;
|
|
53
57
|
loadAllSchedule(): Promise<void>;
|
|
54
|
-
loadScheduleAvailableDate({ startDate, endDate, custom_page_id, channel }: {
|
|
58
|
+
loadScheduleAvailableDate({ startDate, endDate, custom_page_id, channel, }: {
|
|
55
59
|
startDate: string;
|
|
56
60
|
endDate: string;
|
|
57
61
|
custom_page_id?: number;
|
|
@@ -182,6 +182,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
182
182
|
value: function removeStep(key) {
|
|
183
183
|
this.store.step.removeStep(key);
|
|
184
184
|
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* 更新step
|
|
188
|
+
*/
|
|
189
|
+
}, {
|
|
190
|
+
key: "updateStep",
|
|
191
|
+
value: function updateStep(key, step) {
|
|
192
|
+
this.store.step.updateStep(key, step);
|
|
193
|
+
}
|
|
194
|
+
|
|
185
195
|
// 获取购物车里 temp.xxx的方法
|
|
186
196
|
// async getStoreCart(key?: string) {
|
|
187
197
|
// return this.store.cart.getTemp(key);
|
|
@@ -296,7 +306,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
296
306
|
while (1) switch (_context4.prev = _context4.next) {
|
|
297
307
|
case 0:
|
|
298
308
|
_context4.next = 2;
|
|
299
|
-
return this.request.get("/schedule");
|
|
309
|
+
return this.request.get("/schedule?num=999");
|
|
300
310
|
case 2:
|
|
301
311
|
scheduleList = _context4.sent;
|
|
302
312
|
this.store.schedule.setScheduleList(((_scheduleList$data = scheduleList.data) === null || _scheduleList$data === void 0 ? void 0 : _scheduleList$data.list) || []);
|
|
@@ -16,8 +16,18 @@ export declare class StepModule extends BaseModule implements Module, IStepModul
|
|
|
16
16
|
getStepList(): IStep[];
|
|
17
17
|
getCurrentStep(): IStep;
|
|
18
18
|
getCurrentStepIndex(): number;
|
|
19
|
+
/**
|
|
20
|
+
* 上一个步骤
|
|
21
|
+
*/
|
|
19
22
|
prevStep(): void;
|
|
23
|
+
/**
|
|
24
|
+
* 下一个步骤
|
|
25
|
+
*/
|
|
20
26
|
nextStep(): void;
|
|
27
|
+
/**
|
|
28
|
+
* 跳转到指定步骤
|
|
29
|
+
* @param stepIndex 步骤的 index
|
|
30
|
+
*/
|
|
21
31
|
gotoStep(stepIndex: number): void;
|
|
22
32
|
/**
|
|
23
33
|
* 添加步骤
|
|
@@ -30,5 +40,11 @@ export declare class StepModule extends BaseModule implements Module, IStepModul
|
|
|
30
40
|
* @param key 步骤的 key
|
|
31
41
|
*/
|
|
32
42
|
removeStep(key: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* 更新步骤
|
|
45
|
+
* @param key 步骤的 key
|
|
46
|
+
* @param step 步骤
|
|
47
|
+
*/
|
|
48
|
+
updateStep(key: string, step: IStep): void;
|
|
33
49
|
storeChange(): void;
|
|
34
50
|
}
|
|
@@ -55,7 +55,8 @@ var StepModule = class extends import_BaseModule.BaseModule {
|
|
|
55
55
|
this.store.stepList = stepList;
|
|
56
56
|
}
|
|
57
57
|
setCurrentStep(stepIndex) {
|
|
58
|
-
|
|
58
|
+
var _a;
|
|
59
|
+
if (stepIndex < 0 || stepIndex >= ((_a = this.store.stepList) == null ? void 0 : _a.length)) {
|
|
59
60
|
return;
|
|
60
61
|
}
|
|
61
62
|
this.store.currentStepIndex = stepIndex;
|
|
@@ -70,16 +71,36 @@ var StepModule = class extends import_BaseModule.BaseModule {
|
|
|
70
71
|
getCurrentStepIndex() {
|
|
71
72
|
return this.store.currentStepIndex;
|
|
72
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* 上一个步骤
|
|
76
|
+
*/
|
|
73
77
|
prevStep() {
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
var _a;
|
|
79
|
+
let prevStepIndex = this.store.currentStepIndex - 1;
|
|
80
|
+
while ((_a = this.store.stepList[prevStepIndex]) == null ? void 0 : _a.isSkip) {
|
|
81
|
+
prevStepIndex--;
|
|
82
|
+
}
|
|
83
|
+
if (prevStepIndex >= 0) {
|
|
84
|
+
this.setCurrentStep(prevStepIndex);
|
|
76
85
|
}
|
|
77
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* 下一个步骤
|
|
89
|
+
*/
|
|
78
90
|
nextStep() {
|
|
79
|
-
|
|
80
|
-
|
|
91
|
+
var _a;
|
|
92
|
+
let nextStepIndex = this.store.currentStepIndex + 1;
|
|
93
|
+
while ((_a = this.store.stepList[nextStepIndex]) == null ? void 0 : _a.isSkip) {
|
|
94
|
+
nextStepIndex++;
|
|
95
|
+
}
|
|
96
|
+
if (nextStepIndex < this.store.stepList.length) {
|
|
97
|
+
this.setCurrentStep(nextStepIndex);
|
|
81
98
|
}
|
|
82
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* 跳转到指定步骤
|
|
102
|
+
* @param stepIndex 步骤的 index
|
|
103
|
+
*/
|
|
83
104
|
gotoStep(stepIndex) {
|
|
84
105
|
this.setCurrentStep(stepIndex);
|
|
85
106
|
}
|
|
@@ -115,6 +136,24 @@ var StepModule = class extends import_BaseModule.BaseModule {
|
|
|
115
136
|
const newStepList = this.store.stepList.filter((n) => n.key !== key);
|
|
116
137
|
this.store.stepList = [...newStepList];
|
|
117
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* 更新步骤
|
|
141
|
+
* @param key 步骤的 key
|
|
142
|
+
* @param step 步骤
|
|
143
|
+
*/
|
|
144
|
+
updateStep(key, step) {
|
|
145
|
+
var _a, _b;
|
|
146
|
+
const newStepList = (_a = this.store.stepList) == null ? void 0 : _a.map((n) => {
|
|
147
|
+
if (n.key === key) {
|
|
148
|
+
return step;
|
|
149
|
+
}
|
|
150
|
+
return n;
|
|
151
|
+
});
|
|
152
|
+
if (key === ((_b = this.store.currentStep) == null ? void 0 : _b.key)) {
|
|
153
|
+
this.store.currentStep = step;
|
|
154
|
+
}
|
|
155
|
+
this.store.stepList = [...newStepList || []];
|
|
156
|
+
}
|
|
118
157
|
storeChange() {
|
|
119
158
|
if (this.openCache) {
|
|
120
159
|
this.checkSaveCache({
|
|
@@ -38,6 +38,10 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
38
38
|
* 删除step
|
|
39
39
|
*/
|
|
40
40
|
removeStep(key: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* 更新step
|
|
43
|
+
*/
|
|
44
|
+
updateStep(key: string, step: IStep): void;
|
|
41
45
|
loadProducts({ category_ids, product_ids, collection, schedule_ids, schedule_date, }: {
|
|
42
46
|
category_ids?: number[];
|
|
43
47
|
product_ids?: number[];
|
|
@@ -51,7 +55,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
51
55
|
category_ids?: number[];
|
|
52
56
|
}): Promise<any>;
|
|
53
57
|
loadAllSchedule(): Promise<void>;
|
|
54
|
-
loadScheduleAvailableDate({ startDate, endDate, custom_page_id, channel }: {
|
|
58
|
+
loadScheduleAvailableDate({ startDate, endDate, custom_page_id, channel, }: {
|
|
55
59
|
startDate: string;
|
|
56
60
|
endDate: string;
|
|
57
61
|
custom_page_id?: number;
|
|
@@ -142,6 +142,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
142
142
|
removeStep(key) {
|
|
143
143
|
this.store.step.removeStep(key);
|
|
144
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* 更新step
|
|
147
|
+
*/
|
|
148
|
+
updateStep(key, step) {
|
|
149
|
+
this.store.step.updateStep(key, step);
|
|
150
|
+
}
|
|
145
151
|
// 获取购物车里 temp.xxx的方法
|
|
146
152
|
// async getStoreCart(key?: string) {
|
|
147
153
|
// return this.store.cart.getTemp(key);
|
|
@@ -203,7 +209,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
203
209
|
// 加载当前店铺下所有 schedule
|
|
204
210
|
async loadAllSchedule() {
|
|
205
211
|
var _a;
|
|
206
|
-
const scheduleList = await this.request.get(`/schedule`);
|
|
212
|
+
const scheduleList = await this.request.get(`/schedule?num=999`);
|
|
207
213
|
this.store.schedule.setScheduleList(((_a = scheduleList.data) == null ? void 0 : _a.list) || []);
|
|
208
214
|
}
|
|
209
215
|
// ui 层提供日期的起始范围,返回一个起始范围内日期的可用情况
|
|
@@ -934,7 +940,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
934
940
|
} else {
|
|
935
941
|
const allCartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
|
|
936
942
|
let selectedResources = [];
|
|
937
|
-
const resources2 = (0, import_lodash_es.cloneDeep)(
|
|
943
|
+
const resources2 = (0, import_lodash_es.cloneDeep)(
|
|
944
|
+
((_k = (_j = item._productOrigin) == null ? void 0 : _j.product_resource) == null ? void 0 : _k.resources) || []
|
|
945
|
+
);
|
|
938
946
|
const currentResourcesRenderList = [];
|
|
939
947
|
resources2.forEach((n) => {
|
|
940
948
|
var _a3;
|
|
@@ -1030,7 +1038,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1030
1038
|
if (item.resource_id) {
|
|
1031
1039
|
resourceIds.push(item.resource_id);
|
|
1032
1040
|
}
|
|
1033
|
-
resourcesTypeId = (_g = (_f2 = (_e2 = (_d2 = item == null ? void 0 : item._productOrigin) == null ? void 0 : _d2.product_resource) == null ? void 0 : _e2.resources) == null ? void 0 : _f2.find(
|
|
1041
|
+
resourcesTypeId = (_g = (_f2 = (_e2 = (_d2 = item == null ? void 0 : item._productOrigin) == null ? void 0 : _d2.product_resource) == null ? void 0 : _e2.resources) == null ? void 0 : _f2.find(
|
|
1042
|
+
(n) => n.code === resources_code
|
|
1043
|
+
)) == null ? void 0 : _g.id;
|
|
1034
1044
|
});
|
|
1035
1045
|
if ((_b = (_a = dateRange == null ? void 0 : dateRange[0]) == null ? void 0 : _a.resource) == null ? void 0 : _b.length) {
|
|
1036
1046
|
dateRange[0].resource.forEach((n) => {
|