@pisell/pisellos 3.0.6 → 3.0.8
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/Date/index.js +2 -0
- package/dist/modules/Rules/index.js +50 -50
- package/dist/solution/BookingByStep/index.js +13 -0
- package/dist/solution/ShopDiscount/index.js +13 -8
- package/dist/solution/ShopDiscount/types.d.ts +1 -0
- package/dist/solution/ShopDiscount/types.js +1 -0
- package/lib/modules/Date/index.js +2 -0
- package/lib/modules/Rules/index.js +49 -49
- package/lib/solution/BookingByStep/index.js +11 -0
- package/lib/solution/ShopDiscount/index.js +4 -0
- package/lib/solution/ShopDiscount/types.d.ts +1 -0
- package/lib/solution/ShopDiscount/types.js +1 -0
- package/package.json +1 -1
|
@@ -305,59 +305,59 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
305
305
|
}), {}, {
|
|
306
306
|
discount_list: []
|
|
307
307
|
})));
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
if (applicableDiscounts.length && product.booking_id && typeof selectedDiscount.isManualSelect === 'undefined') {
|
|
311
|
-
return;
|
|
312
308
|
}
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
if (applicableDiscounts.length && product.booking_id && typeof selectedDiscount.isManualSelect === 'undefined') {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
313
314
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
appliedProducts.push(discountDetail);
|
|
330
|
-
appliedDiscountProducts.set(selectedDiscount.id, appliedProducts);
|
|
331
|
-
|
|
332
|
-
// 记录应用了优惠券的商品
|
|
333
|
-
// 后续更新价格改为 getProductTotalPrice getProductOriginTotalPrice逻辑
|
|
334
|
-
if (product.isClient) {
|
|
335
|
-
processedProductsMap.set(product._id, _this3.hooks.setProduct(originProduct, {
|
|
336
|
-
discount_list: [discountDetail],
|
|
337
|
-
price: 0,
|
|
338
|
-
origin_total: getProductOriginTotalPrice({
|
|
339
|
-
product: {
|
|
340
|
-
original_price: product.original_price
|
|
341
|
-
},
|
|
342
|
-
bundle: product.bundle,
|
|
343
|
-
options: product.options
|
|
344
|
-
}),
|
|
345
|
-
total: getProductTotalPrice({
|
|
346
|
-
product: {
|
|
347
|
-
price: '0'
|
|
348
|
-
},
|
|
349
|
-
bundle: product.bundle,
|
|
350
|
-
options: product.options
|
|
351
|
-
})
|
|
352
|
-
}));
|
|
353
|
-
} else {
|
|
354
|
-
processedProductsMap.set(product._id, _this3.hooks.setProduct(originProduct, {
|
|
355
|
-
discount_list: [discountDetail],
|
|
356
|
-
price: 0,
|
|
357
|
-
total: (product.origin_total || product.total) - product.price,
|
|
358
|
-
origin_total: product.origin_total || product.total
|
|
359
|
-
}));
|
|
315
|
+
// 标记优惠券为已使用
|
|
316
|
+
usedDiscounts.set(selectedDiscount.id, true);
|
|
317
|
+
|
|
318
|
+
// 记录实际应用了优惠券的商品信息
|
|
319
|
+
var appliedProducts = appliedDiscountProducts.get(selectedDiscount.id) || [];
|
|
320
|
+
var discountDetail = {
|
|
321
|
+
amount: product.price,
|
|
322
|
+
type: selectedDiscount.tag,
|
|
323
|
+
discount: {
|
|
324
|
+
resource_id: selectedDiscount.id,
|
|
325
|
+
title: selectedDiscount.format_title,
|
|
326
|
+
original_amount: product.origin_total,
|
|
327
|
+
product_id: selectedDiscount.product_id
|
|
360
328
|
}
|
|
329
|
+
};
|
|
330
|
+
appliedProducts.push(discountDetail);
|
|
331
|
+
appliedDiscountProducts.set(selectedDiscount.id, appliedProducts);
|
|
332
|
+
|
|
333
|
+
// 记录应用了优惠券的商品
|
|
334
|
+
// 后续更新价格改为 getProductTotalPrice getProductOriginTotalPrice逻辑
|
|
335
|
+
if (product.isClient) {
|
|
336
|
+
processedProductsMap.set(product._id, _this3.hooks.setProduct(originProduct, {
|
|
337
|
+
discount_list: [discountDetail],
|
|
338
|
+
price: 0,
|
|
339
|
+
origin_total: getProductOriginTotalPrice({
|
|
340
|
+
product: {
|
|
341
|
+
original_price: product.original_price
|
|
342
|
+
},
|
|
343
|
+
bundle: product.bundle,
|
|
344
|
+
options: product.options
|
|
345
|
+
}),
|
|
346
|
+
total: getProductTotalPrice({
|
|
347
|
+
product: {
|
|
348
|
+
price: '0'
|
|
349
|
+
},
|
|
350
|
+
bundle: product.bundle,
|
|
351
|
+
options: product.options
|
|
352
|
+
})
|
|
353
|
+
}));
|
|
354
|
+
} else {
|
|
355
|
+
processedProductsMap.set(product._id, _this3.hooks.setProduct(originProduct, {
|
|
356
|
+
discount_list: [discountDetail],
|
|
357
|
+
price: 0,
|
|
358
|
+
total: (product.origin_total || product.total) - product.price,
|
|
359
|
+
origin_total: product.origin_total || product.total
|
|
360
|
+
}));
|
|
361
361
|
}
|
|
362
362
|
});
|
|
363
363
|
|
|
@@ -1216,6 +1216,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1216
1216
|
return canUseTime;
|
|
1217
1217
|
});
|
|
1218
1218
|
});
|
|
1219
|
+
} else {
|
|
1220
|
+
productResources.forEach(function (item) {
|
|
1221
|
+
// 如果资源的 capacity 已经小于了当前需要的 capacity ,则需要把资源给过滤掉
|
|
1222
|
+
item.renderList = item.renderList.filter(function (n) {
|
|
1223
|
+
var recordCount = n.capacity || 0;
|
|
1224
|
+
return recordCount >= currentCapacity;
|
|
1225
|
+
});
|
|
1226
|
+
});
|
|
1219
1227
|
}
|
|
1220
1228
|
arr.push({
|
|
1221
1229
|
id: cartItem.id,
|
|
@@ -1510,6 +1518,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1510
1518
|
_resources.forEach(function (n) {
|
|
1511
1519
|
var _n$renderList;
|
|
1512
1520
|
if ((_n$renderList = n.renderList) !== null && _n$renderList !== void 0 && _n$renderList.length) {
|
|
1521
|
+
// 过滤掉 capacity 小于 currentCapacity 的资源
|
|
1522
|
+
n.renderList = n.renderList.filter(function (m) {
|
|
1523
|
+
var recordCount = m.capacity || 0;
|
|
1524
|
+
return recordCount >= currentCapacity;
|
|
1525
|
+
});
|
|
1513
1526
|
currentResourcesRenderList.push.apply(currentResourcesRenderList, _toConsumableArray(n.renderList || []));
|
|
1514
1527
|
}
|
|
1515
1528
|
});
|
|
@@ -483,21 +483,26 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
483
483
|
});
|
|
484
484
|
case 3:
|
|
485
485
|
result = _context7.sent;
|
|
486
|
-
if (result !== null && result !== void 0 && result.data) {
|
|
487
|
-
|
|
488
|
-
|
|
486
|
+
if (!(result !== null && result !== void 0 && result.data)) {
|
|
487
|
+
_context7.next = 9;
|
|
488
|
+
break;
|
|
489
489
|
}
|
|
490
|
-
|
|
490
|
+
_result$data = result.data, wallet_pass_list = _result$data.wallet_pass_list, customer = _objectWithoutProperties(_result$data, _excluded);
|
|
491
|
+
this.setCustomer(customer);
|
|
492
|
+
_context7.next = 9;
|
|
493
|
+
return this.core.effects.emit(ShopDiscountHooks.onScanCustomerChange, customer);
|
|
494
|
+
case 9:
|
|
495
|
+
_context7.next = 14;
|
|
491
496
|
break;
|
|
492
|
-
case
|
|
493
|
-
_context7.prev =
|
|
497
|
+
case 11:
|
|
498
|
+
_context7.prev = 11;
|
|
494
499
|
_context7.t0 = _context7["catch"](0);
|
|
495
500
|
console.error('[ShopDiscount] 获取客户钱包信息出错:', _context7.t0);
|
|
496
|
-
case
|
|
501
|
+
case 14:
|
|
497
502
|
case "end":
|
|
498
503
|
return _context7.stop();
|
|
499
504
|
}
|
|
500
|
-
}, _callee7, this, [[0,
|
|
505
|
+
}, _callee7, this, [[0, 11]]);
|
|
501
506
|
}));
|
|
502
507
|
function getCustomerWallet(_x6) {
|
|
503
508
|
return _getCustomerWallet.apply(this, arguments);
|
|
@@ -5,6 +5,7 @@ export declare enum ShopDiscountHooks {
|
|
|
5
5
|
onDestroy = "shopDiscount:onDestroy",
|
|
6
6
|
onLoadDiscountList = "shopDiscount:onLoadDiscountList",
|
|
7
7
|
onCustomerChange = "shopDiscount:onCustomerChange",
|
|
8
|
+
onScanCustomerChange = "shopDiscount:onScanCustomerChange",
|
|
8
9
|
onDiscountListChange = "shopDiscount:onDiscountListChange",
|
|
9
10
|
onRulesListChange = "shopDiscount:onRulesListChange",
|
|
10
11
|
onLoadPrepareCalcResult = "shopDiscount:onLoadPrepareCalcResult"
|
|
@@ -3,6 +3,7 @@ export var ShopDiscountHooks = /*#__PURE__*/function (ShopDiscountHooks) {
|
|
|
3
3
|
ShopDiscountHooks["onDestroy"] = "shopDiscount:onDestroy";
|
|
4
4
|
ShopDiscountHooks["onLoadDiscountList"] = "shopDiscount:onLoadDiscountList";
|
|
5
5
|
ShopDiscountHooks["onCustomerChange"] = "shopDiscount:onCustomerChange";
|
|
6
|
+
ShopDiscountHooks["onScanCustomerChange"] = "shopDiscount:onScanCustomerChange";
|
|
6
7
|
ShopDiscountHooks["onDiscountListChange"] = "shopDiscount:onDiscountListChange";
|
|
7
8
|
ShopDiscountHooks["onRulesListChange"] = "shopDiscount:onRulesListChange";
|
|
8
9
|
ShopDiscountHooks["onLoadPrepareCalcResult"] = "shopDiscount:onLoadPrepareCalcResult";
|
|
@@ -83,6 +83,8 @@ var DateModule = class extends import_BaseModule.BaseModule {
|
|
|
83
83
|
end_date,
|
|
84
84
|
resource_ids,
|
|
85
85
|
front_end_cache_id: this.cacheId
|
|
86
|
+
}, {
|
|
87
|
+
useCache: true
|
|
86
88
|
});
|
|
87
89
|
if (!((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.length)) {
|
|
88
90
|
return (0, import_utils.disableAllDates)(dates);
|
|
@@ -210,58 +210,58 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
210
210
|
discount_list: []
|
|
211
211
|
})
|
|
212
212
|
);
|
|
213
|
-
return;
|
|
214
213
|
}
|
|
215
|
-
|
|
216
|
-
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
if (applicableDiscounts.length && product.booking_id && typeof selectedDiscount.isManualSelect === "undefined") {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
usedDiscounts.set(selectedDiscount.id, true);
|
|
220
|
+
const appliedProducts = appliedDiscountProducts.get(selectedDiscount.id) || [];
|
|
221
|
+
const discountDetail = {
|
|
222
|
+
amount: product.price,
|
|
223
|
+
type: selectedDiscount.tag,
|
|
224
|
+
discount: {
|
|
225
|
+
resource_id: selectedDiscount.id,
|
|
226
|
+
title: selectedDiscount.format_title,
|
|
227
|
+
original_amount: product.origin_total,
|
|
228
|
+
product_id: selectedDiscount.product_id
|
|
217
229
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
original_price: product.original_price
|
|
241
|
-
},
|
|
242
|
-
bundle: product.bundle,
|
|
243
|
-
options: product.options
|
|
244
|
-
}),
|
|
245
|
-
total: (0, import_utils2.getProductTotalPrice)({
|
|
246
|
-
product: {
|
|
247
|
-
price: "0"
|
|
248
|
-
},
|
|
249
|
-
bundle: product.bundle,
|
|
250
|
-
options: product.options
|
|
251
|
-
})
|
|
252
|
-
})
|
|
253
|
-
);
|
|
254
|
-
} else {
|
|
255
|
-
processedProductsMap.set(
|
|
256
|
-
product._id,
|
|
257
|
-
this.hooks.setProduct(originProduct, {
|
|
258
|
-
discount_list: [discountDetail],
|
|
259
|
-
price: 0,
|
|
260
|
-
total: (product.origin_total || product.total) - product.price,
|
|
261
|
-
origin_total: product.origin_total || product.total
|
|
230
|
+
};
|
|
231
|
+
appliedProducts.push(discountDetail);
|
|
232
|
+
appliedDiscountProducts.set(selectedDiscount.id, appliedProducts);
|
|
233
|
+
if (product.isClient) {
|
|
234
|
+
processedProductsMap.set(
|
|
235
|
+
product._id,
|
|
236
|
+
this.hooks.setProduct(originProduct, {
|
|
237
|
+
discount_list: [discountDetail],
|
|
238
|
+
price: 0,
|
|
239
|
+
origin_total: (0, import_utils2.getProductOriginTotalPrice)({
|
|
240
|
+
product: {
|
|
241
|
+
original_price: product.original_price
|
|
242
|
+
},
|
|
243
|
+
bundle: product.bundle,
|
|
244
|
+
options: product.options
|
|
245
|
+
}),
|
|
246
|
+
total: (0, import_utils2.getProductTotalPrice)({
|
|
247
|
+
product: {
|
|
248
|
+
price: "0"
|
|
249
|
+
},
|
|
250
|
+
bundle: product.bundle,
|
|
251
|
+
options: product.options
|
|
262
252
|
})
|
|
263
|
-
)
|
|
264
|
-
|
|
253
|
+
})
|
|
254
|
+
);
|
|
255
|
+
} else {
|
|
256
|
+
processedProductsMap.set(
|
|
257
|
+
product._id,
|
|
258
|
+
this.hooks.setProduct(originProduct, {
|
|
259
|
+
discount_list: [discountDetail],
|
|
260
|
+
price: 0,
|
|
261
|
+
total: (product.origin_total || product.total) - product.price,
|
|
262
|
+
origin_total: product.origin_total || product.total
|
|
263
|
+
})
|
|
264
|
+
);
|
|
265
265
|
}
|
|
266
266
|
});
|
|
267
267
|
const processedProductList = productList.map((originProduct) => {
|
|
@@ -667,6 +667,13 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
667
667
|
return canUseTime;
|
|
668
668
|
});
|
|
669
669
|
});
|
|
670
|
+
} else {
|
|
671
|
+
productResources.forEach((item) => {
|
|
672
|
+
item.renderList = item.renderList.filter((n) => {
|
|
673
|
+
const recordCount = n.capacity || 0;
|
|
674
|
+
return recordCount >= currentCapacity;
|
|
675
|
+
});
|
|
676
|
+
});
|
|
670
677
|
}
|
|
671
678
|
arr.push({
|
|
672
679
|
id: cartItem.id,
|
|
@@ -918,6 +925,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
918
925
|
resources2.forEach((n) => {
|
|
919
926
|
var _a3;
|
|
920
927
|
if ((_a3 = n.renderList) == null ? void 0 : _a3.length) {
|
|
928
|
+
n.renderList = n.renderList.filter((m) => {
|
|
929
|
+
const recordCount = m.capacity || 0;
|
|
930
|
+
return recordCount >= currentCapacity;
|
|
931
|
+
});
|
|
921
932
|
currentResourcesRenderList.push(...n.renderList || []);
|
|
922
933
|
}
|
|
923
934
|
});
|
|
@@ -313,6 +313,10 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
313
313
|
if (result == null ? void 0 : result.data) {
|
|
314
314
|
const { wallet_pass_list, ...customer } = result.data;
|
|
315
315
|
this.setCustomer(customer);
|
|
316
|
+
await this.core.effects.emit(
|
|
317
|
+
import_types.ShopDiscountHooks.onScanCustomerChange,
|
|
318
|
+
customer
|
|
319
|
+
);
|
|
316
320
|
}
|
|
317
321
|
} catch (error) {
|
|
318
322
|
console.error("[ShopDiscount] 获取客户钱包信息出错:", error);
|
|
@@ -5,6 +5,7 @@ export declare enum ShopDiscountHooks {
|
|
|
5
5
|
onDestroy = "shopDiscount:onDestroy",
|
|
6
6
|
onLoadDiscountList = "shopDiscount:onLoadDiscountList",
|
|
7
7
|
onCustomerChange = "shopDiscount:onCustomerChange",
|
|
8
|
+
onScanCustomerChange = "shopDiscount:onScanCustomerChange",
|
|
8
9
|
onDiscountListChange = "shopDiscount:onDiscountListChange",
|
|
9
10
|
onRulesListChange = "shopDiscount:onRulesListChange",
|
|
10
11
|
onLoadPrepareCalcResult = "shopDiscount:onLoadPrepareCalcResult"
|
|
@@ -27,6 +27,7 @@ var ShopDiscountHooks = /* @__PURE__ */ ((ShopDiscountHooks2) => {
|
|
|
27
27
|
ShopDiscountHooks2["onDestroy"] = "shopDiscount:onDestroy";
|
|
28
28
|
ShopDiscountHooks2["onLoadDiscountList"] = "shopDiscount:onLoadDiscountList";
|
|
29
29
|
ShopDiscountHooks2["onCustomerChange"] = "shopDiscount:onCustomerChange";
|
|
30
|
+
ShopDiscountHooks2["onScanCustomerChange"] = "shopDiscount:onScanCustomerChange";
|
|
30
31
|
ShopDiscountHooks2["onDiscountListChange"] = "shopDiscount:onDiscountListChange";
|
|
31
32
|
ShopDiscountHooks2["onRulesListChange"] = "shopDiscount:onRulesListChange";
|
|
32
33
|
ShopDiscountHooks2["onLoadPrepareCalcResult"] = "shopDiscount:onLoadPrepareCalcResult";
|