@pisell/pisellos 0.0.24 → 0.0.26
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 +1 -0
- package/dist/modules/AccountList/index.js +58 -31
- package/dist/modules/BaseModule.d.ts +1 -1
- package/dist/modules/BaseModule.js +2 -2
- package/dist/modules/Cart/index.js +9 -7
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +16 -16
- package/dist/solution/ShopDiscount/index.js +1 -1
- package/lib/modules/AccountList/index.d.ts +1 -0
- package/lib/modules/AccountList/index.js +10 -1
- package/lib/modules/BaseModule.d.ts +1 -1
- package/lib/modules/BaseModule.js +1 -1
- package/lib/modules/Cart/index.js +2 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +9 -10
- package/lib/solution/ShopDiscount/index.js +1 -0
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ export declare class AccountListModule extends BaseModule implements Module {
|
|
|
12
12
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
13
13
|
addAccount(account: Account): Promise<void>;
|
|
14
14
|
updateAccount(id: string, updates: Account): Promise<void>;
|
|
15
|
+
updateAccountListById(id: string | number, updates: Account): Promise<void>;
|
|
15
16
|
removeAccount(id: string): Promise<void>;
|
|
16
17
|
getAccounts(): AccountModule[];
|
|
17
18
|
getAccount(id: string): AccountModule | null;
|
|
@@ -200,52 +200,79 @@ export var AccountListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
200
200
|
return updateAccount;
|
|
201
201
|
}()
|
|
202
202
|
}, {
|
|
203
|
-
key: "
|
|
203
|
+
key: "updateAccountListById",
|
|
204
204
|
value: function () {
|
|
205
|
-
var
|
|
206
|
-
var index;
|
|
205
|
+
var _updateAccountListById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(id, updates) {
|
|
207
206
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
208
207
|
while (1) switch (_context4.prev = _context4.next) {
|
|
209
208
|
case 0:
|
|
210
|
-
|
|
209
|
+
this.store.accountList = this.store.accountList.map(function (account) {
|
|
210
|
+
if (account.id === id) {
|
|
211
|
+
return updates;
|
|
212
|
+
}
|
|
213
|
+
return account;
|
|
214
|
+
});
|
|
215
|
+
this.core.effects.emit("".concat(this.name, ":changed"), {
|
|
216
|
+
value: this.store.accountList
|
|
217
|
+
});
|
|
218
|
+
case 2:
|
|
219
|
+
case "end":
|
|
220
|
+
return _context4.stop();
|
|
221
|
+
}
|
|
222
|
+
}, _callee4, this);
|
|
223
|
+
}));
|
|
224
|
+
function updateAccountListById(_x6, _x7) {
|
|
225
|
+
return _updateAccountListById.apply(this, arguments);
|
|
226
|
+
}
|
|
227
|
+
return updateAccountListById;
|
|
228
|
+
}()
|
|
229
|
+
}, {
|
|
230
|
+
key: "removeAccount",
|
|
231
|
+
value: function () {
|
|
232
|
+
var _removeAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(id) {
|
|
233
|
+
var index;
|
|
234
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
235
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
236
|
+
case 0:
|
|
237
|
+
_context5.prev = 0;
|
|
211
238
|
this.store.isLoading = true;
|
|
212
239
|
this.store.error = null;
|
|
213
240
|
index = this.store.accounts.findIndex(function (a) {
|
|
214
241
|
return a.getId() === id;
|
|
215
242
|
});
|
|
216
243
|
if (!(index === -1)) {
|
|
217
|
-
|
|
244
|
+
_context5.next = 6;
|
|
218
245
|
break;
|
|
219
246
|
}
|
|
220
247
|
throw new Error("Account with id ".concat(id, " not found"));
|
|
221
248
|
case 6:
|
|
222
|
-
this.store.accounts[index].
|
|
249
|
+
this.store.accounts[index].destroy();
|
|
223
250
|
this.store.accounts = [].concat(_toConsumableArray((this.store.accounts || []).slice(0, index)), _toConsumableArray((this.store.accounts || []).slice(index + 1)));
|
|
224
251
|
this.store.accountList = this.store.accountList.filter(function (account) {
|
|
225
252
|
return account.id !== id;
|
|
226
253
|
});
|
|
227
|
-
|
|
254
|
+
_context5.next = 11;
|
|
228
255
|
return this.core.effects.emit(AccountListHooks.OnAccountListUpdate, this.store);
|
|
229
256
|
case 11:
|
|
230
|
-
|
|
257
|
+
_context5.next = 18;
|
|
231
258
|
break;
|
|
232
259
|
case 13:
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
this.store.error =
|
|
236
|
-
|
|
260
|
+
_context5.prev = 13;
|
|
261
|
+
_context5.t0 = _context5["catch"](0);
|
|
262
|
+
this.store.error = _context5.t0 instanceof Error ? _context5.t0.message : 'Failed to remove account';
|
|
263
|
+
_context5.next = 18;
|
|
237
264
|
return this.core.effects.emit(AccountListHooks.OnAccountListError, this.store.error);
|
|
238
265
|
case 18:
|
|
239
|
-
|
|
266
|
+
_context5.prev = 18;
|
|
240
267
|
this.store.isLoading = false;
|
|
241
|
-
return
|
|
268
|
+
return _context5.finish(18);
|
|
242
269
|
case 21:
|
|
243
270
|
case "end":
|
|
244
|
-
return
|
|
271
|
+
return _context5.stop();
|
|
245
272
|
}
|
|
246
|
-
},
|
|
273
|
+
}, _callee5, this, [[0, 13, 18, 21]]);
|
|
247
274
|
}));
|
|
248
|
-
function removeAccount(
|
|
275
|
+
function removeAccount(_x8) {
|
|
249
276
|
return _removeAccount.apply(this, arguments);
|
|
250
277
|
}
|
|
251
278
|
return removeAccount;
|
|
@@ -265,34 +292,34 @@ export var AccountListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
265
292
|
}, {
|
|
266
293
|
key: "clearAccounts",
|
|
267
294
|
value: function () {
|
|
268
|
-
var _clearAccounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
269
|
-
return _regeneratorRuntime().wrap(function
|
|
270
|
-
while (1) switch (
|
|
295
|
+
var _clearAccounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
296
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
297
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
271
298
|
case 0:
|
|
272
|
-
|
|
299
|
+
_context6.prev = 0;
|
|
273
300
|
this.store.isLoading = true;
|
|
274
301
|
this.store.error = null;
|
|
275
302
|
this.store.accounts = [];
|
|
276
|
-
|
|
303
|
+
_context6.next = 6;
|
|
277
304
|
return this.core.effects.emit(AccountListHooks.OnAccountListUpdate, this.store);
|
|
278
305
|
case 6:
|
|
279
|
-
|
|
306
|
+
_context6.next = 13;
|
|
280
307
|
break;
|
|
281
308
|
case 8:
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
this.store.error =
|
|
285
|
-
|
|
309
|
+
_context6.prev = 8;
|
|
310
|
+
_context6.t0 = _context6["catch"](0);
|
|
311
|
+
this.store.error = _context6.t0 instanceof Error ? _context6.t0.message : 'Failed to clear accounts';
|
|
312
|
+
_context6.next = 13;
|
|
286
313
|
return this.core.effects.emit(AccountListHooks.OnAccountListError, this.store.error);
|
|
287
314
|
case 13:
|
|
288
|
-
|
|
315
|
+
_context6.prev = 13;
|
|
289
316
|
this.store.isLoading = false;
|
|
290
|
-
return
|
|
317
|
+
return _context6.finish(13);
|
|
291
318
|
case 16:
|
|
292
319
|
case "end":
|
|
293
|
-
return
|
|
320
|
+
return _context6.stop();
|
|
294
321
|
}
|
|
295
|
-
},
|
|
322
|
+
}, _callee6, this, [[0, 8, 13, 16]]);
|
|
296
323
|
}));
|
|
297
324
|
function clearAccounts() {
|
|
298
325
|
return _clearAccounts.apply(this, arguments);
|
|
@@ -7,7 +7,7 @@ export declare class BaseModule {
|
|
|
7
7
|
isSolution: boolean;
|
|
8
8
|
protected core: PisellCore;
|
|
9
9
|
constructor(name?: string, version?: string);
|
|
10
|
-
|
|
10
|
+
destroy(): void;
|
|
11
11
|
checkSaveCache({ cacheId, fatherModule, store, cacheKey }: {
|
|
12
12
|
cacheId: string | undefined;
|
|
13
13
|
fatherModule: string | undefined;
|
|
@@ -18,8 +18,8 @@ export var BaseModule = /*#__PURE__*/function () {
|
|
|
18
18
|
this.version = version || this.defaultVersion;
|
|
19
19
|
}
|
|
20
20
|
_createClass(BaseModule, [{
|
|
21
|
-
key: "
|
|
22
|
-
value: function
|
|
21
|
+
key: "destroy",
|
|
22
|
+
value: function destroy() {
|
|
23
23
|
this.core.effects.offByModuleDestroy(this.name);
|
|
24
24
|
this.core.unregisterModule(this);
|
|
25
25
|
}
|
|
@@ -61,6 +61,7 @@ export var CartModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
61
61
|
case 0:
|
|
62
62
|
this.core = core;
|
|
63
63
|
this.store = options.store;
|
|
64
|
+
debugger;
|
|
64
65
|
if (Array.isArray((_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.list)) {
|
|
65
66
|
this.store.list = options.initialState.list;
|
|
66
67
|
this.core.effects.emit("".concat(this.name, ":changed"), this.store.list);
|
|
@@ -79,20 +80,20 @@ export var CartModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
79
80
|
this.request = core.getPlugin("request");
|
|
80
81
|
this.window = core.getPlugin("window");
|
|
81
82
|
if (this.request) {
|
|
82
|
-
_context.next =
|
|
83
|
+
_context.next = 10;
|
|
83
84
|
break;
|
|
84
85
|
}
|
|
85
86
|
throw new Error("购物车模块需要 request 插件支持");
|
|
86
|
-
case
|
|
87
|
+
case 10:
|
|
87
88
|
if (this.window) {
|
|
88
|
-
_context.next =
|
|
89
|
+
_context.next = 12;
|
|
89
90
|
break;
|
|
90
91
|
}
|
|
91
92
|
throw new Error("购物车模块需要 window 插件支持");
|
|
92
|
-
case
|
|
93
|
+
case 12:
|
|
93
94
|
// this.store.temp = {};
|
|
94
95
|
console.log("[CartModule] 初始化完成");
|
|
95
|
-
case
|
|
96
|
+
case 13:
|
|
96
97
|
case "end":
|
|
97
98
|
return _context.stop();
|
|
98
99
|
}
|
|
@@ -115,6 +116,7 @@ export var CartModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
115
116
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
116
117
|
while (1) switch (_context2.prev = _context2.next) {
|
|
117
118
|
case 0:
|
|
119
|
+
debugger;
|
|
118
120
|
account = params.account, product = params.product, bundle = params.bundle, options = params.options; // 生成一个唯一的 ID
|
|
119
121
|
cartItem = {
|
|
120
122
|
_id: getUniqueId(),
|
|
@@ -141,9 +143,9 @@ export var CartModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
141
143
|
this.store.list = items;
|
|
142
144
|
|
|
143
145
|
// 触发事件
|
|
144
|
-
_context2.next =
|
|
146
|
+
_context2.next = 9;
|
|
145
147
|
return this.core.effects.emit("".concat(this.name, ":onAddItem"), cartItem);
|
|
146
|
-
case
|
|
148
|
+
case 9:
|
|
147
149
|
case "end":
|
|
148
150
|
return _context2.stop();
|
|
149
151
|
}
|
|
@@ -78,7 +78,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
78
78
|
* 从购物车中按类别删除信息
|
|
79
79
|
*/
|
|
80
80
|
deleteCartItemInfo(types: "resource" | "time"): void;
|
|
81
|
-
|
|
81
|
+
destroy(): void;
|
|
82
82
|
getResourcesList(): any[];
|
|
83
83
|
getResourcesListByCartItem(id: string | number): {
|
|
84
84
|
id: number | undefined;
|
|
@@ -75,6 +75,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
75
75
|
}
|
|
76
76
|
throw new Error("bookingByStep解决方案需要 request 插件支持");
|
|
77
77
|
case 9:
|
|
78
|
+
debugger;
|
|
79
|
+
|
|
78
80
|
// 如果有传 cacheid,默认需要收集上面这些模块里用户操作选中的数据
|
|
79
81
|
// 并且在上面 registerModule 的时候,读取 sessionStroage 里的数据,塞进默认值
|
|
80
82
|
targetCacheData = {};
|
|
@@ -105,7 +107,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
105
107
|
}
|
|
106
108
|
});
|
|
107
109
|
this.core.effects.emit(BookingByStepHooks.onInited, {});
|
|
108
|
-
case
|
|
110
|
+
case 15:
|
|
109
111
|
case "end":
|
|
110
112
|
return _context.stop();
|
|
111
113
|
}
|
|
@@ -485,9 +487,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
485
487
|
case 0:
|
|
486
488
|
account = this.store.accountList.getAccount(accountId);
|
|
487
489
|
if (!account) {
|
|
488
|
-
_context11.next =
|
|
490
|
+
_context11.next = 8;
|
|
489
491
|
break;
|
|
490
492
|
}
|
|
493
|
+
this.store.accountList.updateAccountListById(account.getId(), accountInfo);
|
|
491
494
|
account.setAccountInfo(accountInfo);
|
|
492
495
|
// 然后去购物车,把原先关联了 holder_id 为 accountId 的商品,替换为 holder_id = accountInfo.id
|
|
493
496
|
cartItems = this.store.cart.getItems();
|
|
@@ -499,11 +502,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
499
502
|
});
|
|
500
503
|
}
|
|
501
504
|
});
|
|
502
|
-
_context11.next =
|
|
505
|
+
_context11.next = 9;
|
|
503
506
|
break;
|
|
504
|
-
case 7:
|
|
505
|
-
throw new Error("\u6CA1\u6709\u627E\u5230".concat(accountId, "\u8D26\u6237"));
|
|
506
507
|
case 8:
|
|
508
|
+
throw new Error("\u6CA1\u6709\u627E\u5230".concat(accountId, "\u8D26\u6237"));
|
|
509
|
+
case 9:
|
|
507
510
|
case "end":
|
|
508
511
|
return _context11.stop();
|
|
509
512
|
}
|
|
@@ -718,15 +721,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
718
721
|
this.store.cart.deleteCartItemInfo(types);
|
|
719
722
|
}
|
|
720
723
|
}, {
|
|
721
|
-
key: "
|
|
722
|
-
value: function
|
|
724
|
+
key: "destroy",
|
|
725
|
+
value: function destroy() {
|
|
723
726
|
var _this$store$cart, _this$store$step, _this$store$products, _this$store$guests, _this$store$date, _this$store$accountLi;
|
|
724
|
-
(_this$store$cart = this.store.cart) === null || _this$store$cart === void 0 || _this$store$cart.
|
|
725
|
-
(_this$store$step = this.store.step) === null || _this$store$step === void 0 || _this$store$step.
|
|
726
|
-
(_this$store$products = this.store.products) === null || _this$store$products === void 0 || _this$store$products.
|
|
727
|
-
(_this$store$guests = this.store.guests) === null || _this$store$guests === void 0 || _this$store$guests.
|
|
728
|
-
(_this$store$date = this.store.date) === null || _this$store$date === void 0 || _this$store$date.
|
|
729
|
-
(_this$store$accountLi = this.store.accountList) === null || _this$store$accountLi === void 0 || _this$store$accountLi.
|
|
727
|
+
(_this$store$cart = this.store.cart) === null || _this$store$cart === void 0 || _this$store$cart.destroy();
|
|
728
|
+
(_this$store$step = this.store.step) === null || _this$store$step === void 0 || _this$store$step.destroy();
|
|
729
|
+
(_this$store$products = this.store.products) === null || _this$store$products === void 0 || _this$store$products.destroy();
|
|
730
|
+
(_this$store$guests = this.store.guests) === null || _this$store$guests === void 0 || _this$store$guests.destroy();
|
|
731
|
+
(_this$store$date = this.store.date) === null || _this$store$date === void 0 || _this$store$date.destroy();
|
|
732
|
+
(_this$store$accountLi = this.store.accountList) === null || _this$store$accountLi === void 0 || _this$store$accountLi.destroy();
|
|
730
733
|
this.core.effects.offByModuleDestroy(this.name);
|
|
731
734
|
this.core.unregisterModule(this);
|
|
732
735
|
}
|
|
@@ -1023,7 +1026,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1023
1026
|
}
|
|
1024
1027
|
} else {
|
|
1025
1028
|
var _productResources$fin;
|
|
1026
|
-
debugger;
|
|
1027
1029
|
// 如果没有传递 timeSlots,代表是第一种资源,则直接拿商品的 duration,到资源列表里找一个公共可用的
|
|
1028
1030
|
var productResources = getResourcesByProduct(resourcesMap, item, allCartItems);
|
|
1029
1031
|
// 自动选择 productResources 中对应 resources_code 的资源
|
|
@@ -1044,7 +1046,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1044
1046
|
}
|
|
1045
1047
|
});
|
|
1046
1048
|
});
|
|
1047
|
-
debugger;
|
|
1048
1049
|
return {
|
|
1049
1050
|
errorList: errorList
|
|
1050
1051
|
};
|
|
@@ -1087,7 +1088,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1087
1088
|
duration = accountDuration;
|
|
1088
1089
|
}
|
|
1089
1090
|
});
|
|
1090
|
-
debugger;
|
|
1091
1091
|
var timeSlots = getTimeSlicesByResources({
|
|
1092
1092
|
resourceIds: resourceIds,
|
|
1093
1093
|
resourcesMap: resourcesMap,
|
|
@@ -165,7 +165,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
165
165
|
targetCacheData = data[this.options.otherParams.cacheId];
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
-
|
|
168
|
+
debugger;
|
|
169
169
|
// 注册优惠模块
|
|
170
170
|
var discount = new DiscountModule("".concat(this.name, "_discount"));
|
|
171
171
|
this.core.registerModule(discount, {
|
|
@@ -12,6 +12,7 @@ export declare class AccountListModule extends BaseModule implements Module {
|
|
|
12
12
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
13
13
|
addAccount(account: Account): Promise<void>;
|
|
14
14
|
updateAccount(id: string, updates: Account): Promise<void>;
|
|
15
|
+
updateAccountListById(id: string | number, updates: Account): Promise<void>;
|
|
15
16
|
removeAccount(id: string): Promise<void>;
|
|
16
17
|
getAccounts(): AccountModule[];
|
|
17
18
|
getAccount(id: string): AccountModule | null;
|
|
@@ -109,6 +109,15 @@ var AccountListModule = class extends import_BaseModule.BaseModule {
|
|
|
109
109
|
this.store.isLoading = false;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
+
async updateAccountListById(id, updates) {
|
|
113
|
+
this.store.accountList = this.store.accountList.map((account) => {
|
|
114
|
+
if (account.id === id) {
|
|
115
|
+
return updates;
|
|
116
|
+
}
|
|
117
|
+
return account;
|
|
118
|
+
});
|
|
119
|
+
this.core.effects.emit(`${this.name}:changed`, { value: this.store.accountList });
|
|
120
|
+
}
|
|
112
121
|
async removeAccount(id) {
|
|
113
122
|
try {
|
|
114
123
|
this.store.isLoading = true;
|
|
@@ -117,7 +126,7 @@ var AccountListModule = class extends import_BaseModule.BaseModule {
|
|
|
117
126
|
if (index === -1) {
|
|
118
127
|
throw new Error(`Account with id ${id} not found`);
|
|
119
128
|
}
|
|
120
|
-
this.store.accounts[index].
|
|
129
|
+
this.store.accounts[index].destroy();
|
|
121
130
|
this.store.accounts = [
|
|
122
131
|
...(this.store.accounts || []).slice(0, index),
|
|
123
132
|
...(this.store.accounts || []).slice(index + 1)
|
|
@@ -7,7 +7,7 @@ export declare class BaseModule {
|
|
|
7
7
|
isSolution: boolean;
|
|
8
8
|
protected core: PisellCore;
|
|
9
9
|
constructor(name?: string, version?: string);
|
|
10
|
-
|
|
10
|
+
destroy(): void;
|
|
11
11
|
checkSaveCache({ cacheId, fatherModule, store, cacheKey }: {
|
|
12
12
|
cacheId: string | undefined;
|
|
13
13
|
fatherModule: string | undefined;
|
|
@@ -42,6 +42,7 @@ var CartModule = class extends import_BaseModule.BaseModule {
|
|
|
42
42
|
var _a, _b, _c;
|
|
43
43
|
this.core = core;
|
|
44
44
|
this.store = options.store;
|
|
45
|
+
debugger;
|
|
45
46
|
if (Array.isArray((_a = options.initialState) == null ? void 0 : _a.list)) {
|
|
46
47
|
this.store.list = options.initialState.list;
|
|
47
48
|
this.core.effects.emit(`${this.name}:changed`, this.store.list);
|
|
@@ -69,6 +70,7 @@ var CartModule = class extends import_BaseModule.BaseModule {
|
|
|
69
70
|
* 添加商品到购物车
|
|
70
71
|
*/
|
|
71
72
|
async addItem(params) {
|
|
73
|
+
debugger;
|
|
72
74
|
const { account, product, bundle, options } = params;
|
|
73
75
|
let cartItem = {
|
|
74
76
|
_id: (0, import_utils.getUniqueId)(),
|
|
@@ -78,7 +78,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
78
78
|
* 从购物车中按类别删除信息
|
|
79
79
|
*/
|
|
80
80
|
deleteCartItemInfo(types: "resource" | "time"): void;
|
|
81
|
-
|
|
81
|
+
destroy(): void;
|
|
82
82
|
getResourcesList(): any[];
|
|
83
83
|
getResourcesListByCartItem(id: string | number): {
|
|
84
84
|
id: number | undefined;
|
|
@@ -59,6 +59,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
59
59
|
if (!this.request) {
|
|
60
60
|
throw new Error("bookingByStep解决方案需要 request 插件支持");
|
|
61
61
|
}
|
|
62
|
+
debugger;
|
|
62
63
|
let targetCacheData = {};
|
|
63
64
|
if ((_a = this.otherParams) == null ? void 0 : _a.cacheId) {
|
|
64
65
|
const sessionData = this.window.sessionStorage.getItem(this.name);
|
|
@@ -238,6 +239,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
238
239
|
async setLoginAccount(accountId, accountInfo) {
|
|
239
240
|
const account = this.store.accountList.getAccount(accountId);
|
|
240
241
|
if (account) {
|
|
242
|
+
this.store.accountList.updateAccountListById(account.getId(), accountInfo);
|
|
241
243
|
account.setAccountInfo(accountInfo);
|
|
242
244
|
const cartItems = this.store.cart.getItems();
|
|
243
245
|
cartItems.forEach((item) => {
|
|
@@ -335,14 +337,14 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
335
337
|
deleteCartItemInfo(types) {
|
|
336
338
|
this.store.cart.deleteCartItemInfo(types);
|
|
337
339
|
}
|
|
338
|
-
|
|
340
|
+
destroy() {
|
|
339
341
|
var _a, _b, _c, _d, _e, _f;
|
|
340
|
-
(_a = this.store.cart) == null ? void 0 : _a.
|
|
341
|
-
(_b = this.store.step) == null ? void 0 : _b.
|
|
342
|
-
(_c = this.store.products) == null ? void 0 : _c.
|
|
343
|
-
(_d = this.store.guests) == null ? void 0 : _d.
|
|
344
|
-
(_e = this.store.date) == null ? void 0 : _e.
|
|
345
|
-
(_f = this.store.accountList) == null ? void 0 : _f.
|
|
342
|
+
(_a = this.store.cart) == null ? void 0 : _a.destroy();
|
|
343
|
+
(_b = this.store.step) == null ? void 0 : _b.destroy();
|
|
344
|
+
(_c = this.store.products) == null ? void 0 : _c.destroy();
|
|
345
|
+
(_d = this.store.guests) == null ? void 0 : _d.destroy();
|
|
346
|
+
(_e = this.store.date) == null ? void 0 : _e.destroy();
|
|
347
|
+
(_f = this.store.accountList) == null ? void 0 : _f.destroy();
|
|
346
348
|
this.core.effects.offByModuleDestroy(this.name);
|
|
347
349
|
this.core.unregisterModule(this);
|
|
348
350
|
}
|
|
@@ -572,7 +574,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
572
574
|
errorList.push(item._id);
|
|
573
575
|
}
|
|
574
576
|
} else {
|
|
575
|
-
debugger;
|
|
576
577
|
const productResources = (0, import_resources.getResourcesByProduct)(resourcesMap, item, allCartItems);
|
|
577
578
|
const targetRenderList = (_a = productResources.find((n) => n.code === resources_code)) == null ? void 0 : _a.renderList;
|
|
578
579
|
if (targetRenderList && targetRenderList.length > 0) {
|
|
@@ -591,7 +592,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
591
592
|
}
|
|
592
593
|
});
|
|
593
594
|
});
|
|
594
|
-
debugger;
|
|
595
595
|
return { errorList };
|
|
596
596
|
}
|
|
597
597
|
// 从购物车中获取已经分配好第一步资源的所有时间片
|
|
@@ -624,7 +624,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
624
624
|
duration = accountDuration;
|
|
625
625
|
}
|
|
626
626
|
});
|
|
627
|
-
debugger;
|
|
628
627
|
const timeSlots = (0, import_resources.getTimeSlicesByResources)({
|
|
629
628
|
resourceIds,
|
|
630
629
|
resourcesMap,
|
|
@@ -91,6 +91,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
91
91
|
targetCacheData = data[this.options.otherParams.cacheId];
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
+
debugger;
|
|
94
95
|
const discount = new import_Discount.DiscountModule(`${this.name}_discount`);
|
|
95
96
|
this.core.registerModule(discount, {
|
|
96
97
|
initialState: targetCacheData == null ? void 0 : targetCacheData[discount.name],
|