@pisell/pisellos 0.0.75 → 0.0.77
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 +14 -0
- 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 +15 -2
- 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);
|
|
@@ -1762,6 +1772,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1762
1772
|
});
|
|
1763
1773
|
});
|
|
1764
1774
|
var newScheduleArr = Object.values(newSchedule);
|
|
1775
|
+
// newScheduleArr 需要做个排序,按日期从小到大
|
|
1776
|
+
newScheduleArr.sort(function (a, b) {
|
|
1777
|
+
return dayjs(a.date).diff(dayjs(b.date));
|
|
1778
|
+
});
|
|
1765
1779
|
return newScheduleArr;
|
|
1766
1780
|
}
|
|
1767
1781
|
// 打开某个商品详情的弹窗,OS 层这边会记录当前选中的商品,适用于 session 类商品预约
|
|
@@ -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);
|
|
@@ -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) => {
|
|
@@ -1146,6 +1156,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1146
1156
|
});
|
|
1147
1157
|
});
|
|
1148
1158
|
const newScheduleArr = Object.values(newSchedule);
|
|
1159
|
+
newScheduleArr.sort((a, b) => {
|
|
1160
|
+
return (0, import_dayjs.default)(a.date).diff((0, import_dayjs.default)(b.date));
|
|
1161
|
+
});
|
|
1149
1162
|
return newScheduleArr;
|
|
1150
1163
|
}
|
|
1151
1164
|
// 打开某个商品详情的弹窗,OS 层这边会记录当前选中的商品,适用于 session 类商品预约
|