@pisell/pisellos 0.0.192 → 1.0.0
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.js +12 -17
- package/dist/modules/Cart/index.js +1 -2
- package/dist/modules/Cart/utils/cartProduct.d.ts +0 -3
- package/dist/modules/Cart/utils/cartProduct.js +25 -60
- package/dist/modules/Cart/utils/changePrice.js +4 -22
- package/dist/modules/Date/index.js +12 -25
- package/dist/modules/Date/types.d.ts +0 -2
- package/dist/modules/Discount/index.js +3 -2
- package/dist/modules/Rules/index.js +53 -64
- package/dist/modules/Rules/types.d.ts +2 -2
- package/dist/modules/Schedule/utils.js +0 -4
- package/dist/solution/BookingByStep/index.d.ts +0 -1
- package/dist/solution/BookingByStep/index.js +16 -53
- package/dist/solution/BookingByStep/utils/resources.js +4 -13
- package/dist/solution/ShopDiscount/index.js +21 -36
- package/lib/modules/AccountList/index.js +0 -4
- package/lib/modules/Cart/index.js +1 -2
- package/lib/modules/Cart/utils/cartProduct.d.ts +0 -3
- package/lib/modules/Cart/utils/cartProduct.js +16 -48
- package/lib/modules/Cart/utils/changePrice.js +3 -20
- package/lib/modules/Date/index.js +26 -31
- package/lib/modules/Date/types.d.ts +0 -2
- package/lib/modules/Discount/index.js +1 -0
- package/lib/modules/Rules/index.js +35 -35
- package/lib/modules/Rules/types.d.ts +2 -2
- package/lib/modules/Schedule/utils.js +1 -4
- package/lib/solution/BookingByStep/index.d.ts +0 -1
- package/lib/solution/BookingByStep/index.js +13 -29
- package/lib/solution/BookingByStep/utils/resources.js +4 -13
- package/lib/solution/ShopDiscount/index.js +8 -13
- package/package.json +2 -2
|
@@ -303,7 +303,7 @@ export var AccountListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
303
303
|
key: "removeAccount",
|
|
304
304
|
value: function () {
|
|
305
305
|
var _removeAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(id) {
|
|
306
|
-
var
|
|
306
|
+
var index;
|
|
307
307
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
308
308
|
while (1) switch (_context6.prev = _context6.next) {
|
|
309
309
|
case 0:
|
|
@@ -324,31 +324,26 @@ export var AccountListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
324
324
|
this.store.accountList = this.store.accountList.filter(function (account) {
|
|
325
325
|
return account.id !== id;
|
|
326
326
|
});
|
|
327
|
-
|
|
328
|
-
// 检测 如果被删除的是活跃账号,则默认把第一个账号设置为 activeAccount
|
|
329
|
-
if (!this.getActiveAccount() || ((_this$getActiveAccoun = this.getActiveAccount()) === null || _this$getActiveAccoun === void 0 ? void 0 : _this$getActiveAccoun.getId()) === id || this.store.accounts.length === 1) {
|
|
330
|
-
this.setActiveAccount(this.store.accounts[0].getId());
|
|
331
|
-
}
|
|
332
|
-
_context6.next = 12;
|
|
327
|
+
_context6.next = 11;
|
|
333
328
|
return this.core.effects.emit(AccountListHooks.OnAccountListUpdate, this.store);
|
|
334
|
-
case
|
|
335
|
-
_context6.next =
|
|
329
|
+
case 11:
|
|
330
|
+
_context6.next = 18;
|
|
336
331
|
break;
|
|
337
|
-
case
|
|
338
|
-
_context6.prev =
|
|
332
|
+
case 13:
|
|
333
|
+
_context6.prev = 13;
|
|
339
334
|
_context6.t0 = _context6["catch"](0);
|
|
340
335
|
this.store.error = _context6.t0 instanceof Error ? _context6.t0.message : 'Failed to remove account';
|
|
341
|
-
_context6.next =
|
|
336
|
+
_context6.next = 18;
|
|
342
337
|
return this.core.effects.emit(AccountListHooks.OnAccountListError, this.store.error);
|
|
343
|
-
case
|
|
344
|
-
_context6.prev =
|
|
338
|
+
case 18:
|
|
339
|
+
_context6.prev = 18;
|
|
345
340
|
this.store.isLoading = false;
|
|
346
|
-
return _context6.finish(
|
|
347
|
-
case
|
|
341
|
+
return _context6.finish(18);
|
|
342
|
+
case 21:
|
|
348
343
|
case "end":
|
|
349
344
|
return _context6.stop();
|
|
350
345
|
}
|
|
351
|
-
}, _callee6, this, [[0,
|
|
346
|
+
}, _callee6, this, [[0, 13, 18, 21]]);
|
|
352
347
|
}));
|
|
353
348
|
function removeAccount(_x9) {
|
|
354
349
|
return _removeAccount.apply(this, arguments);
|
|
@@ -256,8 +256,7 @@ export var CartModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
256
256
|
bundle: bundle,
|
|
257
257
|
options: options,
|
|
258
258
|
product_variant_id: newProduct.product_variant_id,
|
|
259
|
-
quantity: quantity
|
|
260
|
-
discounts: discounts
|
|
259
|
+
quantity: quantity
|
|
261
260
|
});
|
|
262
261
|
}
|
|
263
262
|
if (discounts) {
|
|
@@ -20,7 +20,6 @@ export declare const formatProductToCartItem: (params: {
|
|
|
20
20
|
options?: any;
|
|
21
21
|
product_variant_id?: number;
|
|
22
22
|
quantity?: number;
|
|
23
|
-
discounts?: any[];
|
|
24
23
|
}) => CartItem;
|
|
25
24
|
export declare const formatProductToCartItemOrigin: (params: {
|
|
26
25
|
cartItem: CartItem;
|
|
@@ -41,7 +40,6 @@ export declare const getProductTotalPrice: (params: {
|
|
|
41
40
|
bundle?: any;
|
|
42
41
|
options?: any;
|
|
43
42
|
num?: number;
|
|
44
|
-
discounts?: any[];
|
|
45
43
|
}) => number;
|
|
46
44
|
/**
|
|
47
45
|
* 获取商品原始总价
|
|
@@ -54,7 +52,6 @@ export declare const getProductOriginTotalPrice: (params: {
|
|
|
54
52
|
bundle?: any;
|
|
55
53
|
options?: any;
|
|
56
54
|
num?: number;
|
|
57
|
-
discounts?: any[];
|
|
58
55
|
}) => number | undefined;
|
|
59
56
|
/**
|
|
60
57
|
* 格式化套餐规格信息
|
|
@@ -22,17 +22,13 @@ import { isNormalProduct } from "../../Product/utils";
|
|
|
22
22
|
export var handleVariantProduct = function handleVariantProduct(product) {
|
|
23
23
|
// 判断组合商品,然后直接修改 product 里的价格和 is_charge_tax
|
|
24
24
|
if (product !== null && product !== void 0 && product.product_variant_id) {
|
|
25
|
-
var _product$variant;
|
|
26
25
|
// 还需要判断 能从 variant 里找到对应的组合规格信息,才可以替换
|
|
27
|
-
var targetVariant = product
|
|
26
|
+
var targetVariant = product.variant.find(function (n) {
|
|
28
27
|
return n.id === product.product_variant_id;
|
|
29
28
|
});
|
|
30
29
|
if (targetVariant) {
|
|
31
30
|
product.price = targetVariant.price;
|
|
32
|
-
|
|
33
|
-
if (Number(targetVariant.original_price) > 0) {
|
|
34
|
-
product.original_price = targetVariant.original_price;
|
|
35
|
-
}
|
|
31
|
+
product.original_price = targetVariant.original_price;
|
|
36
32
|
product.is_charge_tax = targetVariant.is_charge_tax;
|
|
37
33
|
}
|
|
38
34
|
}
|
|
@@ -46,15 +42,13 @@ export var handleVariantProduct = function handleVariantProduct(product) {
|
|
|
46
42
|
*/
|
|
47
43
|
export var formatProductToCartItem = function formatProductToCartItem(params) {
|
|
48
44
|
var _product$custom_depos;
|
|
49
|
-
console.log('formatProductToCartItem>>>>>>', params);
|
|
50
45
|
var cartItem = params.cartItem,
|
|
51
46
|
product = params.product,
|
|
52
47
|
bundle = params.bundle,
|
|
53
48
|
options = params.options,
|
|
54
49
|
product_variant_id = params.product_variant_id,
|
|
55
50
|
_params$quantity = params.quantity,
|
|
56
|
-
quantity = _params$quantity === void 0 ? 1 : _params$quantity
|
|
57
|
-
discounts = params.discounts;
|
|
51
|
+
quantity = _params$quantity === void 0 ? 1 : _params$quantity;
|
|
58
52
|
var num = quantity; // 当前按照单个商品加入购物车
|
|
59
53
|
if (product) {
|
|
60
54
|
cartItem.id = product === null || product === void 0 ? void 0 : product.id;
|
|
@@ -65,16 +59,14 @@ export var formatProductToCartItem = function formatProductToCartItem(params) {
|
|
|
65
59
|
product: product,
|
|
66
60
|
bundle: bundle,
|
|
67
61
|
options: options,
|
|
68
|
-
num: num
|
|
69
|
-
discounts: discounts
|
|
62
|
+
num: num
|
|
70
63
|
});
|
|
71
64
|
cartItem.summaryTotal = cartItem.total * (num || 1);
|
|
72
65
|
cartItem.origin_total = getProductOriginTotalPrice({
|
|
73
66
|
product: product,
|
|
74
67
|
bundle: bundle,
|
|
75
68
|
options: options,
|
|
76
|
-
num: num
|
|
77
|
-
discounts: discounts
|
|
69
|
+
num: num
|
|
78
70
|
});
|
|
79
71
|
cartItem.image = product === null || product === void 0 ? void 0 : product.cover;
|
|
80
72
|
cartItem.like_status = 'common';
|
|
@@ -90,17 +82,17 @@ export var formatProductToCartItem = function formatProductToCartItem(params) {
|
|
|
90
82
|
}
|
|
91
83
|
// 拼装出 product_option_string
|
|
92
84
|
if (product_variant_id) {
|
|
93
|
-
var _product$
|
|
94
|
-
var sku_key =
|
|
85
|
+
var _product$variant$find;
|
|
86
|
+
var sku_key = (_product$variant$find = product.variant.find(function (n) {
|
|
95
87
|
return n.id === product_variant_id;
|
|
96
|
-
})) === null || _product$
|
|
88
|
+
})) === null || _product$variant$find === void 0 ? void 0 : _product$variant$find.sku_key;
|
|
97
89
|
if (sku_key) {
|
|
98
90
|
var sku_key_arr = sku_key.split('_');
|
|
99
91
|
var product_option_string = [];
|
|
100
92
|
sku_key_arr.forEach(function (item) {
|
|
101
|
-
var
|
|
93
|
+
var _targetVariantGroup$v;
|
|
102
94
|
var keyMap = item.split(':');
|
|
103
|
-
var targetVariantGroup = product
|
|
95
|
+
var targetVariantGroup = product.variant_group.find(function (n) {
|
|
104
96
|
return String(n.position_id) === keyMap[0];
|
|
105
97
|
});
|
|
106
98
|
var targetVariantItem = targetVariantGroup === null || targetVariantGroup === void 0 || (_targetVariantGroup$v = targetVariantGroup.variant_item) === null || _targetVariantGroup$v === void 0 ? void 0 : _targetVariantGroup$v.find(function (n) {
|
|
@@ -169,8 +161,7 @@ export var formatProductToCartItemOrigin = function formatProductToCartItemOrigi
|
|
|
169
161
|
export var getProductTotalPrice = function getProductTotalPrice(params) {
|
|
170
162
|
var product = params.product,
|
|
171
163
|
bundle = params.bundle,
|
|
172
|
-
options = params.options
|
|
173
|
-
discounts = params.discounts;
|
|
164
|
+
options = params.options;
|
|
174
165
|
// const num = params.num || 1;
|
|
175
166
|
var price = Number(product.price);
|
|
176
167
|
if (bundle !== null && bundle !== void 0 && bundle.length) {
|
|
@@ -185,18 +176,6 @@ export var getProductTotalPrice = function getProductTotalPrice(params) {
|
|
|
185
176
|
return accumulator + Number(currentValue.price) * Number(currentValue.num);
|
|
186
177
|
}, price);
|
|
187
178
|
}
|
|
188
|
-
|
|
189
|
-
// 如果商品有折扣,则计算折扣
|
|
190
|
-
if (discounts !== null && discounts !== void 0 && discounts.length) {
|
|
191
|
-
discounts.forEach(function (currentValue) {
|
|
192
|
-
// 不是商品券则代表折扣卡,计算打折后的价格
|
|
193
|
-
// 一个商品折扣卡只能存在于一张
|
|
194
|
-
if (currentValue.type !== 'good_pass') {
|
|
195
|
-
var discountPrice = new Decimal(100).minus(currentValue.discount.percent || 0).div(100).mul(new Decimal(price || 0)).toFixed(2);
|
|
196
|
-
price = Number(discountPrice);
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
179
|
return price;
|
|
201
180
|
};
|
|
202
181
|
|
|
@@ -209,11 +188,19 @@ export var getProductTotalPrice = function getProductTotalPrice(params) {
|
|
|
209
188
|
export var getProductOriginTotalPrice = function getProductOriginTotalPrice(params) {
|
|
210
189
|
var product = params.product,
|
|
211
190
|
bundle = params.bundle,
|
|
212
|
-
options = params.options
|
|
213
|
-
discounts = params.discounts;
|
|
191
|
+
options = params.options;
|
|
214
192
|
var num = (params === null || params === void 0 ? void 0 : params.num) || 1;
|
|
215
193
|
var price = Number(product.original_price);
|
|
216
|
-
|
|
194
|
+
|
|
195
|
+
// if (product.discount_list?.length) {
|
|
196
|
+
// price = product.discount_list.reduce((accumulator: any, currentValue: any) => {
|
|
197
|
+
// return (
|
|
198
|
+
// accumulator + Number(currentValue.price) * Number(currentValue.num)
|
|
199
|
+
// );
|
|
200
|
+
// }, price);
|
|
201
|
+
// }
|
|
202
|
+
|
|
203
|
+
if (isNaN(price) || price === 0) {
|
|
217
204
|
return undefined;
|
|
218
205
|
}
|
|
219
206
|
if (bundle !== null && bundle !== void 0 && bundle.length) {
|
|
@@ -346,38 +333,16 @@ export var getProductDeposit = function getProductDeposit(params) {
|
|
|
346
333
|
productHasDeposit = true;
|
|
347
334
|
}
|
|
348
335
|
} else {
|
|
349
|
-
// 组合规格商品
|
|
350
|
-
if (product !== null && product !== void 0 && product.product_variant_id) {
|
|
351
|
-
var _product$variant3;
|
|
352
|
-
var variantProduct = product === null || product === void 0 || (_product$variant3 = product.variant) === null || _product$variant3 === void 0 ? void 0 : _product$variant3.find(function (item) {
|
|
353
|
-
return (item === null || item === void 0 ? void 0 : item.id) === (product === null || product === void 0 ? void 0 : product.product_variant_id);
|
|
354
|
-
});
|
|
355
|
-
if (variantProduct) {
|
|
356
|
-
var depositData = variantProduct === null || variantProduct === void 0 ? void 0 : variantProduct.custom_deposit_data;
|
|
357
|
-
var _handleProductDeposit2 = handleProductDeposit({
|
|
358
|
-
depositData: depositData,
|
|
359
|
-
total: (cartItem === null || cartItem === void 0 ? void 0 : cartItem.total) || 0,
|
|
360
|
-
num: num
|
|
361
|
-
}),
|
|
362
|
-
_depositTotal = _handleProductDeposit2.depositTotal,
|
|
363
|
-
_result = _handleProductDeposit2.result;
|
|
364
|
-
if (_result) {
|
|
365
|
-
total = _depositTotal;
|
|
366
|
-
protocolIds.push.apply(protocolIds, _toConsumableArray((depositData === null || depositData === void 0 ? void 0 : depositData.self_deposit_policy_ids) || []));
|
|
367
|
-
productHasDeposit = true;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
336
|
if (bundle !== null && bundle !== void 0 && bundle.length) {
|
|
372
337
|
total = bundle.reduce(function (accumulator, currBundleProduct) {
|
|
373
338
|
var depositData = currBundleProduct === null || currBundleProduct === void 0 ? void 0 : currBundleProduct.custom_deposit_data;
|
|
374
|
-
var
|
|
339
|
+
var _handleProductDeposit2 = handleProductDeposit({
|
|
375
340
|
depositData: depositData,
|
|
376
341
|
total: currBundleProduct === null || currBundleProduct === void 0 ? void 0 : currBundleProduct.price,
|
|
377
342
|
num: (currBundleProduct === null || currBundleProduct === void 0 ? void 0 : currBundleProduct.num) || 1
|
|
378
343
|
}),
|
|
379
|
-
depositTotal =
|
|
380
|
-
result =
|
|
344
|
+
depositTotal = _handleProductDeposit2.depositTotal,
|
|
345
|
+
result = _handleProductDeposit2.result;
|
|
381
346
|
if (result) {
|
|
382
347
|
protocolIds.push.apply(protocolIds, _toConsumableArray((depositData === null || depositData === void 0 ? void 0 : depositData.self_deposit_policy_ids) || []));
|
|
383
348
|
productHasDeposit = true;
|
|
@@ -23,8 +23,8 @@ function _updateAllCartItemPrice() {
|
|
|
23
23
|
_iterator = _createForOfIteratorHelper(cartItems);
|
|
24
24
|
_context2.prev = 1;
|
|
25
25
|
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
26
|
-
var
|
|
27
|
-
var item, targetProduct, cartProduct, productInfo, bundle
|
|
26
|
+
var _bundle;
|
|
27
|
+
var item, targetProduct, cartProduct, productInfo, bundle;
|
|
28
28
|
return _regeneratorRuntime().wrap(function _loop$(_context) {
|
|
29
29
|
while (1) switch (_context.prev = _context.next) {
|
|
30
30
|
case 0:
|
|
@@ -40,7 +40,6 @@ function _updateAllCartItemPrice() {
|
|
|
40
40
|
bundle = item._bundleOrigin;
|
|
41
41
|
productInfo.price = targetProduct === null || targetProduct === void 0 ? void 0 : targetProduct.price;
|
|
42
42
|
productInfo.base_price = targetProduct === null || targetProduct === void 0 ? void 0 : targetProduct.base_price;
|
|
43
|
-
productInfo.product_variant_id = (_item$_productOrigin = item._productOrigin) === null || _item$_productOrigin === void 0 ? void 0 : _item$_productOrigin.product_variant_id;
|
|
44
43
|
bundle = (_bundle = bundle) === null || _bundle === void 0 ? void 0 : _bundle.map(function (n) {
|
|
45
44
|
var _targetProduct$bundle;
|
|
46
45
|
// 更新 bundle 的价格
|
|
@@ -63,29 +62,12 @@ function _updateAllCartItemPrice() {
|
|
|
63
62
|
}
|
|
64
63
|
return n;
|
|
65
64
|
});
|
|
66
|
-
// 如果有返回variant,则把对应variant的数据也补充进去
|
|
67
|
-
if (targetProduct !== null && targetProduct !== void 0 && targetProduct.variant) {
|
|
68
|
-
productInfo.variant = (_productInfo$variant = productInfo.variant) === null || _productInfo$variant === void 0 ? void 0 : _productInfo$variant.map(function (n) {
|
|
69
|
-
var _targetProduct$varian;
|
|
70
|
-
var targetVariant = (_targetProduct$varian = targetProduct.variant) === null || _targetProduct$varian === void 0 ? void 0 : _targetProduct$varian.find(function (m) {
|
|
71
|
-
return m.id === n.id;
|
|
72
|
-
});
|
|
73
|
-
if (targetVariant) {
|
|
74
|
-
return _objectSpread(_objectSpread({}, n), {}, {
|
|
75
|
-
price: targetVariant.price,
|
|
76
|
-
base_price: targetVariant.base_price
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
return n;
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
65
|
updateCart({
|
|
83
66
|
_id: item._id,
|
|
84
67
|
product: productInfo,
|
|
85
|
-
bundle: bundle
|
|
86
|
-
options: item._optionsOrigin
|
|
68
|
+
bundle: bundle
|
|
87
69
|
});
|
|
88
|
-
case
|
|
70
|
+
case 11:
|
|
89
71
|
case "end":
|
|
90
72
|
return _context.stop();
|
|
91
73
|
}
|
|
@@ -93,14 +93,11 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
93
93
|
key: "getResourceDates",
|
|
94
94
|
value: function () {
|
|
95
95
|
var _getResourceDates = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
96
|
-
var _params$query
|
|
96
|
+
var _params$query;
|
|
97
|
+
var currentDateList, currentDateListMap, resourceIds, hasResource, dates;
|
|
97
98
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
98
99
|
while (1) switch (_context2.prev = _context2.next) {
|
|
99
100
|
case 0:
|
|
100
|
-
if (!params.useCache) {
|
|
101
|
-
_context2.next = 7;
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
101
|
// 发请求之前,做一道检测,看 dateList 里是否有对应日期,且对应日期里是否都有对应 resource_ids 的资源
|
|
105
102
|
currentDateList = this.getDateList() || [];
|
|
106
103
|
currentDateListMap = new Map(currentDateList.map(function (item) {
|
|
@@ -115,18 +112,18 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
115
112
|
});
|
|
116
113
|
});
|
|
117
114
|
if (!hasResource) {
|
|
118
|
-
_context2.next =
|
|
115
|
+
_context2.next = 6;
|
|
119
116
|
break;
|
|
120
117
|
}
|
|
121
118
|
return _context2.abrupt("return", currentDateList);
|
|
122
|
-
case
|
|
123
|
-
_context2.next =
|
|
119
|
+
case 6:
|
|
120
|
+
_context2.next = 8;
|
|
124
121
|
return this.getResourceAvailableTimeList(params);
|
|
125
|
-
case
|
|
122
|
+
case 8:
|
|
126
123
|
dates = _context2.sent;
|
|
127
124
|
this.setDateList(dates);
|
|
128
125
|
return _context2.abrupt("return", dates);
|
|
129
|
-
case
|
|
126
|
+
case 11:
|
|
130
127
|
case "end":
|
|
131
128
|
return _context2.stop();
|
|
132
129
|
}
|
|
@@ -154,7 +151,7 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
154
151
|
return n.date === item.date;
|
|
155
152
|
});
|
|
156
153
|
if (currentItemIndex !== -1) {
|
|
157
|
-
var _item$resource
|
|
154
|
+
var _item$resource;
|
|
158
155
|
var currentItem = currentDateList[currentItemIndex];
|
|
159
156
|
// 看那一天的数据有没有相同的,把不同的资源合并进去即可
|
|
160
157
|
var newResource = (_item$resource = item.resource) === null || _item$resource === void 0 ? void 0 : _item$resource.filter(function (n) {
|
|
@@ -163,16 +160,6 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
163
160
|
return m.id === n.id;
|
|
164
161
|
}));
|
|
165
162
|
});
|
|
166
|
-
// 如果有相同的资源,则使用 item 中的新的resource.times,而不是 currentItem 中的
|
|
167
|
-
(_currentItem$resource3 = currentItem.resource) === null || _currentItem$resource3 === void 0 || _currentItem$resource3.forEach(function (n) {
|
|
168
|
-
var _item$resource2;
|
|
169
|
-
var newResource = (_item$resource2 = item.resource) === null || _item$resource2 === void 0 ? void 0 : _item$resource2.find(function (m) {
|
|
170
|
-
return m.id === n.id;
|
|
171
|
-
});
|
|
172
|
-
if (newResource) {
|
|
173
|
-
n.times = newResource.times;
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
163
|
currentItem.resource = [].concat(_toConsumableArray(currentItem.resource || []), _toConsumableArray(newResource || []));
|
|
177
164
|
currentDateList[currentItemIndex] = currentItem;
|
|
178
165
|
} else {
|
|
@@ -185,11 +172,11 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
185
172
|
key: "fetchResourceDates",
|
|
186
173
|
value: function () {
|
|
187
174
|
var _fetchResourceDates = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
188
|
-
var url, query,
|
|
175
|
+
var url, query, fetchUrl, _ref, start_date, end_date, resource_ids, res;
|
|
189
176
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
190
177
|
while (1) switch (_context3.prev = _context3.next) {
|
|
191
178
|
case 0:
|
|
192
|
-
url = params.url, query = params.query
|
|
179
|
+
url = params.url, query = params.query;
|
|
193
180
|
fetchUrl = url || '/schedule/resource/list';
|
|
194
181
|
_ref = query || {}, start_date = _ref.start_date, end_date = _ref.end_date, resource_ids = _ref.resource_ids;
|
|
195
182
|
_context3.prev = 3;
|
|
@@ -198,9 +185,9 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
198
185
|
start_date: start_date,
|
|
199
186
|
end_date: end_date,
|
|
200
187
|
resource_ids: resource_ids,
|
|
201
|
-
front_end_cache_id:
|
|
188
|
+
front_end_cache_id: this.cacheId
|
|
202
189
|
}, {
|
|
203
|
-
useCache:
|
|
190
|
+
useCache: true
|
|
204
191
|
});
|
|
205
192
|
case 6:
|
|
206
193
|
res = _context3.sent;
|
|
@@ -129,9 +129,10 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
129
129
|
return this.request.post("/order/prepare/config", params);
|
|
130
130
|
case 2:
|
|
131
131
|
prepareConfig = _context3.sent;
|
|
132
|
-
goodPassList = this.filterEnabledDiscountList([].concat(_toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data = prepareConfig.data) === null || _prepareConfig$data === void 0 ? void 0 : _prepareConfig$data.good_pass_list) || []), _toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data2 = prepareConfig.data) === null || _prepareConfig$data2 === void 0 ? void 0 : _prepareConfig$data2.discount_card_list) || []))) || [];
|
|
132
|
+
goodPassList = this.filterEnabledDiscountList([].concat(_toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data = prepareConfig.data) === null || _prepareConfig$data === void 0 ? void 0 : _prepareConfig$data.good_pass_list) || []), _toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data2 = prepareConfig.data) === null || _prepareConfig$data2 === void 0 ? void 0 : _prepareConfig$data2.discount_card_list) || []))) || [];
|
|
133
|
+
this.setDiscountList(goodPassList);
|
|
133
134
|
return _context3.abrupt("return", goodPassList);
|
|
134
|
-
case
|
|
135
|
+
case 6:
|
|
135
136
|
case "end":
|
|
136
137
|
return _context3.stop();
|
|
137
138
|
}
|