@pisell/private-materials 6.6.60 → 6.6.61
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +2 -2
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +10 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +10 -10
- package/es/components/booking/components/footer/amount.js +3 -4
- package/es/components/booking/components/footer/utils.js +82 -85
- package/es/components/booking/components/voucher/index.js +1 -1
- package/es/components/booking/dashboard/index.d.ts +5 -0
- package/es/components/booking/dashboard/index.js +9 -6
- package/es/components/booking/info/service2/Group/utils.js +30 -1
- package/es/components/booking/info2/service/editService/index.js +6 -49
- package/es/components/booking/info2/service/editService/utils.d.ts +0 -1
- package/es/components/booking/info2/service/editService/utils.js +0 -16
- package/es/components/booking/payments/index.js +1 -1
- package/es/components/checkout/hooks/useWalletPass.js +23 -15
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +2 -2
- package/es/components/index.d.ts +2 -1
- package/es/components/index.js +2 -1
- package/es/components/pisellCashCounting/PisellCashCounting.d.ts +5 -0
- package/es/components/pisellCashCounting/PisellCashCounting.js +121 -0
- package/es/components/pisellCashCounting/PisellCashCounting.less +263 -0
- package/es/components/pisellCashCounting/components/CashCountingModal/index.d.ts +20 -0
- package/es/components/pisellCashCounting/components/CashCountingModal/index.js +250 -0
- package/es/components/pisellCashCounting/components/CashCountingModal/index.less +279 -0
- package/es/components/pisellCashCounting/hooks.d.ts +21 -0
- package/es/components/pisellCashCounting/hooks.js +193 -0
- package/es/components/pisellCashCounting/index.d.ts +2 -0
- package/es/components/pisellCashCounting/index.js +1 -0
- package/es/components/pisellCashCounting/locales.d.ts +118 -0
- package/es/components/pisellCashCounting/locales.js +117 -0
- package/es/components/pisellCashCounting/types.d.ts +85 -0
- package/es/components/pisellCashCounting/types.js +1 -0
- package/es/components/pisellCashCounting/utils.d.ts +10 -0
- package/es/components/pisellCashCounting/utils.js +40 -0
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +0 -1
- package/es/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.d.ts +2 -0
- package/es/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.js +5 -2
- package/es/components/ticketBooking/components/bookingDataPanel/index.d.ts +2 -0
- package/es/components/ticketBooking/components/bookingDataPanel/index.js +5 -2
- package/es/components/ticketBooking/components/bookingDataPanel/pisellFloatingPanel/index.js +2 -1
- package/es/components/ticketBooking/components/ticketBooking/index.js +156 -37
- package/es/components/ticketBooking/index.js +7 -1
- package/es/hooks/useResponsive.d.ts +8 -0
- package/es/hooks/useResponsive.js +43 -0
- package/es/hooks/useThemeTokens.d.ts +7 -0
- package/es/hooks/useThemeTokens.js +20 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/pro/Login2.0/components/phoneValidation.js +65 -58
- package/es/pro/NumericStepper/index.d.ts +75 -0
- package/es/pro/NumericStepper/index.js +301 -0
- package/es/pro/NumericStepper/index.less +364 -0
- package/es/pro/keyboards/index.d.ts +2 -0
- package/es/pro/keyboards/index.js +1 -0
- package/es/pro/keyboards/locales.d.ts +38 -0
- package/es/pro/keyboards/locales.js +57 -0
- package/es/pro/keyboards/numberKeyboard/index.d.ts +16 -0
- package/es/pro/keyboards/numberKeyboard/index.js +523 -0
- package/es/pro/keyboards/numberKeyboard/index.less +59 -0
- package/es/pro/keyboards/numberKeyboard/types.d.ts +63 -0
- package/es/pro/keyboards/numberKeyboard/types.js +1 -0
- package/es/pro/pisellPriceKeyboardModal/PisellPriceKeyboardModal.js +3 -1
- package/es/pro/pisellPriceKeyboardModal/types.d.ts +2 -0
- package/lib/components/booking/components/footer/amount.js +3 -3
- package/lib/components/booking/components/footer/utils.js +11 -15
- package/lib/components/booking/components/voucher/index.js +1 -1
- package/lib/components/booking/dashboard/index.d.ts +5 -0
- package/lib/components/booking/dashboard/index.js +6 -5
- package/lib/components/booking/info/service2/Group/utils.js +42 -3
- package/lib/components/booking/info2/service/editService/index.js +5 -39
- package/lib/components/booking/info2/service/editService/utils.d.ts +0 -1
- package/lib/components/booking/info2/service/editService/utils.js +0 -16
- package/lib/components/booking/payments/index.js +1 -1
- package/lib/components/checkout/hooks/useWalletPass.js +23 -16
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +2 -2
- package/lib/components/index.d.ts +2 -1
- package/lib/components/index.js +3 -0
- package/lib/components/pisellCashCounting/PisellCashCounting.d.ts +5 -0
- package/lib/components/pisellCashCounting/PisellCashCounting.js +168 -0
- package/lib/components/pisellCashCounting/PisellCashCounting.less +263 -0
- package/lib/components/pisellCashCounting/components/CashCountingModal/index.d.ts +20 -0
- package/lib/components/pisellCashCounting/components/CashCountingModal/index.js +171 -0
- package/lib/components/pisellCashCounting/components/CashCountingModal/index.less +279 -0
- package/lib/components/pisellCashCounting/hooks.d.ts +21 -0
- package/lib/components/pisellCashCounting/hooks.js +189 -0
- package/lib/components/pisellCashCounting/index.d.ts +2 -0
- package/lib/components/pisellCashCounting/index.js +35 -0
- package/lib/components/pisellCashCounting/locales.d.ts +118 -0
- package/lib/components/pisellCashCounting/locales.js +141 -0
- package/lib/components/pisellCashCounting/types.d.ts +85 -0
- package/lib/components/pisellCashCounting/types.js +17 -0
- package/lib/components/pisellCashCounting/utils.d.ts +10 -0
- package/lib/components/pisellCashCounting/utils.js +59 -0
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +0 -1
- package/lib/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.d.ts +2 -0
- package/lib/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.js +3 -2
- package/lib/components/ticketBooking/components/bookingDataPanel/index.d.ts +2 -0
- package/lib/components/ticketBooking/components/bookingDataPanel/index.js +10 -3
- package/lib/components/ticketBooking/components/bookingDataPanel/pisellFloatingPanel/index.js +10 -1
- package/lib/components/ticketBooking/components/ticketBooking/index.js +114 -14
- package/lib/components/ticketBooking/index.js +11 -1
- package/lib/hooks/useResponsive.d.ts +8 -0
- package/lib/hooks/useResponsive.js +48 -0
- package/lib/hooks/useThemeTokens.d.ts +7 -0
- package/lib/hooks/useThemeTokens.js +40 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/pro/Login2.0/components/phoneValidation.js +4 -2
- package/lib/pro/NumericStepper/index.d.ts +75 -0
- package/lib/pro/NumericStepper/index.js +338 -0
- package/lib/pro/NumericStepper/index.less +364 -0
- package/lib/pro/keyboards/index.d.ts +2 -0
- package/lib/pro/keyboards/index.js +39 -0
- package/lib/pro/keyboards/locales.d.ts +38 -0
- package/lib/pro/keyboards/locales.js +61 -0
- package/lib/pro/keyboards/numberKeyboard/index.d.ts +16 -0
- package/lib/pro/keyboards/numberKeyboard/index.js +400 -0
- package/lib/pro/keyboards/numberKeyboard/index.less +59 -0
- package/lib/pro/keyboards/numberKeyboard/types.d.ts +63 -0
- package/lib/pro/keyboards/numberKeyboard/types.js +17 -0
- package/lib/pro/pisellPriceKeyboardModal/PisellPriceKeyboardModal.js +3 -1
- package/lib/pro/pisellPriceKeyboardModal/types.d.ts +2 -0
- package/lowcode/pisell-cash-counting/meta.ts +167 -0
- package/lowcode/pisell-cash-counting/snippets.ts +13 -0
- package/package.json +4 -4
|
@@ -519,8 +519,7 @@ var processItemsTax = function processItemsTax(items, state, options) {
|
|
|
519
519
|
}
|
|
520
520
|
return {
|
|
521
521
|
originTax: expectedOriginTax,
|
|
522
|
-
tax: expectedTax
|
|
523
|
-
taxDecimal: preciseTax
|
|
522
|
+
tax: expectedTax
|
|
524
523
|
};
|
|
525
524
|
};
|
|
526
525
|
|
|
@@ -652,7 +651,7 @@ var getTax = function getTax(state, options) {
|
|
|
652
651
|
computed: computed
|
|
653
652
|
});
|
|
654
653
|
totalOriginTax = totalOriginTax.plus(serviceResult.originTax);
|
|
655
|
-
totalTax = totalTax.plus(serviceResult.
|
|
654
|
+
totalTax = totalTax.plus(serviceResult.tax);
|
|
656
655
|
}
|
|
657
656
|
|
|
658
657
|
// 处理附加商品
|
|
@@ -663,7 +662,7 @@ var getTax = function getTax(state, options) {
|
|
|
663
662
|
computed: computed
|
|
664
663
|
});
|
|
665
664
|
totalOriginTax = totalOriginTax.plus(addonsResult.originTax);
|
|
666
|
-
totalTax = totalTax.plus(addonsResult.
|
|
665
|
+
totalTax = totalTax.plus(addonsResult.tax);
|
|
667
666
|
}
|
|
668
667
|
}
|
|
669
668
|
return {
|
|
@@ -108,7 +108,6 @@ export var formatProductBundle = function formatProductBundle(bundle) {
|
|
|
108
108
|
}
|
|
109
109
|
} catch (error) {}
|
|
110
110
|
return bundle.map(function (d) {
|
|
111
|
-
var _d$metadata;
|
|
112
111
|
var option = formatProductOption(d.option);
|
|
113
112
|
var option_price = option.reduce(function (temp, item) {
|
|
114
113
|
return temp + Number(item.num) * item.custom_add_price;
|
|
@@ -136,7 +135,7 @@ export var formatProductBundle = function formatProductBundle(bundle) {
|
|
|
136
135
|
"bundle_selling_price": Math.abs(d === null || d === void 0 ? void 0 : d.price),
|
|
137
136
|
// "bundle_sum_price": d?.original_price || d?.original_total,
|
|
138
137
|
"metadata": {
|
|
139
|
-
custom_product_bundle_map_id:
|
|
138
|
+
custom_product_bundle_map_id: d._id,
|
|
140
139
|
// 子商品单数量附加费
|
|
141
140
|
"surcharge_fee": d.surcharge_fee,
|
|
142
141
|
// 可选,附加费均摊舍入金额
|
|
@@ -288,9 +287,13 @@ var formatHolders = function formatHolders(state, item, values) {
|
|
|
288
287
|
* @Date: 2024-12-23 12:05
|
|
289
288
|
*/
|
|
290
289
|
export var formatProductPrice = function formatProductPrice(item) {
|
|
291
|
-
var _item$_extend6, _item$price, _item$_extend7, _item$variant;
|
|
290
|
+
var _item$_extend6, _item$price, _item$_extend7, _item$_extend8, _item$_extend9, _item$variant;
|
|
292
291
|
var other = (_item$_extend6 = item._extend) === null || _item$_extend6 === void 0 ? void 0 : _item$_extend6.other;
|
|
293
292
|
var price = Number((_item$price = item === null || item === void 0 ? void 0 : item.price) !== null && _item$price !== void 0 ? _item$price : item === null || item === void 0 || (_item$_extend7 = item._extend) === null || _item$_extend7 === void 0 ? void 0 : _item$_extend7.price);
|
|
293
|
+
if (isString((_item$_extend8 = item._extend) === null || _item$_extend8 === void 0 ? void 0 : _item$_extend8.priceOverride) || isNumber((_item$_extend9 = item._extend) === null || _item$_extend9 === void 0 ? void 0 : _item$_extend9.priceOverride)) {
|
|
294
|
+
var _item$_extend10;
|
|
295
|
+
price = Number(item === null || item === void 0 || (_item$_extend10 = item._extend) === null || _item$_extend10 === void 0 ? void 0 : _item$_extend10.price);
|
|
296
|
+
}
|
|
294
297
|
|
|
295
298
|
// 组合规格: 根据当前选择的组合规格id 和商品的组合规格列表 获取当前商品的价格
|
|
296
299
|
if ((other === null || other === void 0 ? void 0 : other.product_variant_id) > 0 && (item === null || item === void 0 || (_item$variant = item.variant) === null || _item$variant === void 0 ? void 0 : _item$variant.length) > 0) {
|
|
@@ -318,8 +321,8 @@ export var formatProductPrice = function formatProductPrice(item) {
|
|
|
318
321
|
* @returns
|
|
319
322
|
*/
|
|
320
323
|
export var formatOriginalPrice = function formatOriginalPrice(item) {
|
|
321
|
-
var _item$
|
|
322
|
-
return Number((_item$
|
|
324
|
+
var _item$_extend11;
|
|
325
|
+
return Number((_item$_extend11 = item._extend) === null || _item$_extend11 === void 0 ? void 0 : _item$_extend11.origin_total);
|
|
323
326
|
};
|
|
324
327
|
|
|
325
328
|
/**
|
|
@@ -328,12 +331,12 @@ export var formatOriginalPrice = function formatOriginalPrice(item) {
|
|
|
328
331
|
* @returns
|
|
329
332
|
*/
|
|
330
333
|
var getBundleProductDiscountDifference = function getBundleProductDiscountDifference(item) {
|
|
331
|
-
var _item$
|
|
332
|
-
if (!((_item$
|
|
334
|
+
var _item$_extend12, _item$_extend13, _item$_extend14;
|
|
335
|
+
if (!((_item$_extend12 = item._extend) !== null && _item$_extend12 !== void 0 && (_item$_extend12 = _item$_extend12.other) !== null && _item$_extend12 !== void 0 && _item$_extend12.bundle) || !isArr((_item$_extend13 = item._extend) === null || _item$_extend13 === void 0 || (_item$_extend13 = _item$_extend13.other) === null || _item$_extend13 === void 0 ? void 0 : _item$_extend13.bundle)) {
|
|
333
336
|
return new Decimal(0).toNumber();
|
|
334
337
|
}
|
|
335
338
|
var discountDifference = new Decimal(0);
|
|
336
|
-
getBundleDiscountList(((_item$
|
|
339
|
+
getBundleDiscountList(((_item$_extend14 = item._extend) === null || _item$_extend14 === void 0 || (_item$_extend14 = _item$_extend14.other) === null || _item$_extend14 === void 0 ? void 0 : _item$_extend14.bundle) || []).forEach(function (cur) {
|
|
337
340
|
var _cur$metadata2;
|
|
338
341
|
discountDifference = discountDifference.add(new Decimal(((_cur$metadata2 = cur.metadata) === null || _cur$metadata2 === void 0 ? void 0 : _cur$metadata2.product_discount_difference) || 0));
|
|
339
342
|
});
|
|
@@ -346,28 +349,28 @@ var getBundleProductDiscountDifference = function getBundleProductDiscountDiffer
|
|
|
346
349
|
* @returns
|
|
347
350
|
*/
|
|
348
351
|
export var formatSellingPrice = function formatSellingPrice(item) {
|
|
349
|
-
var _item$
|
|
350
|
-
return Number((_item$
|
|
352
|
+
var _item$_extend15;
|
|
353
|
+
return Number((_item$_extend15 = item._extend) === null || _item$_extend15 === void 0 ? void 0 : _item$_extend15.total);
|
|
351
354
|
};
|
|
352
355
|
var formatMetaData = function formatMetaData(item, isMultiDayPrices) {
|
|
353
|
-
var _item$
|
|
356
|
+
var _item$_extend16, _item$_extend$holder_, _item$_extend17, _item$_extend18, _item$_extend20;
|
|
354
357
|
var metadata = {};
|
|
355
|
-
if ((_item$
|
|
358
|
+
if ((_item$_extend16 = item._extend) !== null && _item$_extend16 !== void 0 && _item$_extend16.capacity) {
|
|
356
359
|
metadata.capacity = item._extend.capacity;
|
|
357
360
|
}
|
|
358
361
|
if (item._extend.groupId) {
|
|
359
362
|
metadata.groupId = item._extend.groupId;
|
|
360
363
|
}
|
|
361
364
|
// if (item._extend?.holder_id) {
|
|
362
|
-
metadata.holder_id = (_item$_extend$holder_ = (_item$
|
|
365
|
+
metadata.holder_id = (_item$_extend$holder_ = (_item$_extend17 = item._extend) === null || _item$_extend17 === void 0 ? void 0 : _item$_extend17.holder_id) !== null && _item$_extend$holder_ !== void 0 ? _item$_extend$holder_ : null;
|
|
363
366
|
// }
|
|
364
|
-
if (isMultiDayPrices && (_item$
|
|
365
|
-
var _item$
|
|
366
|
-
metadata.multiDayPrices = (_item$
|
|
367
|
+
if (isMultiDayPrices && (_item$_extend18 = item._extend) !== null && _item$_extend18 !== void 0 && _item$_extend18.multiDayPrices) {
|
|
368
|
+
var _item$_extend19;
|
|
369
|
+
metadata.multiDayPrices = (_item$_extend19 = item._extend) === null || _item$_extend19 === void 0 ? void 0 : _item$_extend19.multiDayPrices;
|
|
367
370
|
}
|
|
368
|
-
if ((_item$
|
|
369
|
-
var _item$
|
|
370
|
-
metadata.unique_identification_number = (_item$
|
|
371
|
+
if ((_item$_extend20 = item._extend) !== null && _item$_extend20 !== void 0 && _item$_extend20.unique_identification_number) {
|
|
372
|
+
var _item$_extend21;
|
|
373
|
+
metadata.unique_identification_number = (_item$_extend21 = item._extend) === null || _item$_extend21 === void 0 ? void 0 : _item$_extend21.unique_identification_number;
|
|
371
374
|
}
|
|
372
375
|
if (item.discount_list && isArr(item.discount_list)) {
|
|
373
376
|
metadata.product_discount_difference = item.discount_list.filter(function (item) {
|
|
@@ -381,37 +384,37 @@ var formatMetaData = function formatMetaData(item, isMultiDayPrices) {
|
|
|
381
384
|
return metadata;
|
|
382
385
|
};
|
|
383
386
|
var formatProductMetadata = function formatProductMetadata(item) {
|
|
384
|
-
var _item$
|
|
387
|
+
var _item$_extend22, _item$_extend24, _item$_extend26, _item$_extend28, _item$_extend30, _item$_extend32;
|
|
385
388
|
var metadata = {};
|
|
386
389
|
|
|
387
390
|
// 主商品+非原价(加减价)子商品附加费
|
|
388
|
-
if ((_item$
|
|
389
|
-
var _item$
|
|
390
|
-
metadata.main_product_attached_bundle_surcharge_fee = (_item$
|
|
391
|
+
if ((_item$_extend22 = item._extend) !== null && _item$_extend22 !== void 0 && _item$_extend22.surcharge_fee) {
|
|
392
|
+
var _item$_extend23;
|
|
393
|
+
metadata.main_product_attached_bundle_surcharge_fee = (_item$_extend23 = item._extend) === null || _item$_extend23 === void 0 ? void 0 : _item$_extend23.surcharge_fee;
|
|
391
394
|
}
|
|
392
395
|
|
|
393
396
|
// 主商品+非原价(加减价)子商品税费
|
|
394
|
-
if ((_item$
|
|
395
|
-
var _item$
|
|
396
|
-
metadata.main_product_attached_bundle_tax_fee = (_item$
|
|
397
|
+
if ((_item$_extend24 = item._extend) !== null && _item$_extend24 !== void 0 && _item$_extend24.main_product_attached_bundle_tax_fee) {
|
|
398
|
+
var _item$_extend25;
|
|
399
|
+
metadata.main_product_attached_bundle_tax_fee = (_item$_extend25 = item._extend) === null || _item$_extend25 === void 0 ? void 0 : _item$_extend25.main_product_attached_bundle_tax_fee;
|
|
397
400
|
}
|
|
398
401
|
|
|
399
402
|
// 可选,附加费均摊舍入金额
|
|
400
|
-
if ((_item$
|
|
401
|
-
var _item$
|
|
402
|
-
metadata.surcharge_rounding_remainder = (_item$
|
|
403
|
+
if ((_item$_extend26 = item._extend) !== null && _item$_extend26 !== void 0 && _item$_extend26.surcharge_rounding_remainder) {
|
|
404
|
+
var _item$_extend27;
|
|
405
|
+
metadata.surcharge_rounding_remainder = (_item$_extend27 = item._extend) === null || _item$_extend27 === void 0 ? void 0 : _item$_extend27.surcharge_rounding_remainder;
|
|
403
406
|
}
|
|
404
407
|
|
|
405
408
|
// 可选,税费均摊舍入金额(折后税费)
|
|
406
|
-
if ((_item$
|
|
407
|
-
var _item$
|
|
408
|
-
metadata.tax_fee_rounding_remainder = (_item$
|
|
409
|
+
if ((_item$_extend28 = item._extend) !== null && _item$_extend28 !== void 0 && _item$_extend28.tax_fee_rounding_remainder) {
|
|
410
|
+
var _item$_extend29;
|
|
411
|
+
metadata.tax_fee_rounding_remainder = (_item$_extend29 = item._extend) === null || _item$_extend29 === void 0 ? void 0 : _item$_extend29.tax_fee_rounding_remainder;
|
|
409
412
|
}
|
|
410
413
|
|
|
411
414
|
// 使用的附加费id列表
|
|
412
|
-
if ((_item$
|
|
413
|
-
var _item$
|
|
414
|
-
metadata.relation_surcharge_ids = (_item$
|
|
415
|
+
if ((_item$_extend30 = item._extend) !== null && _item$_extend30 !== void 0 && _item$_extend30.relation_surcharge_ids) {
|
|
416
|
+
var _item$_extend31;
|
|
417
|
+
metadata.relation_surcharge_ids = (_item$_extend31 = item._extend) === null || _item$_extend31 === void 0 ? void 0 : _item$_extend31.relation_surcharge_ids;
|
|
415
418
|
}
|
|
416
419
|
if (item.discount_list && isArr(item.discount_list)) {
|
|
417
420
|
metadata.product_discount_difference = item.discount_list.filter(function (item) {
|
|
@@ -424,17 +427,17 @@ var formatProductMetadata = function formatProductMetadata(item) {
|
|
|
424
427
|
}
|
|
425
428
|
|
|
426
429
|
// 如果 _extend 有unique_identification_number,往 metadata 里补充一个
|
|
427
|
-
if ((_item$
|
|
428
|
-
var _item$
|
|
429
|
-
metadata.unique_identification_number = (_item$
|
|
430
|
+
if ((_item$_extend32 = item._extend) !== null && _item$_extend32 !== void 0 && _item$_extend32.unique_identification_number) {
|
|
431
|
+
var _item$_extend33;
|
|
432
|
+
metadata.unique_identification_number = (_item$_extend33 = item._extend) === null || _item$_extend33 === void 0 ? void 0 : _item$_extend33.unique_identification_number;
|
|
430
433
|
}
|
|
431
434
|
return metadata;
|
|
432
435
|
};
|
|
433
436
|
// 获取商品价格 包含组合规格
|
|
434
437
|
export var getSourceProductPrice = function getSourceProductPrice(item) {
|
|
435
|
-
var _item$
|
|
436
|
-
var other = (_item$
|
|
437
|
-
var price = Number((_item$price2 = item === null || item === void 0 ? void 0 : item.price) !== null && _item$price2 !== void 0 ? _item$price2 : (_item$
|
|
438
|
+
var _item$_extend34, _item$price2, _item$_extend35, _item$variant2;
|
|
439
|
+
var other = (_item$_extend34 = item._extend) === null || _item$_extend34 === void 0 ? void 0 : _item$_extend34.other;
|
|
440
|
+
var price = Number((_item$price2 = item === null || item === void 0 ? void 0 : item.price) !== null && _item$price2 !== void 0 ? _item$price2 : (_item$_extend35 = item._extend) === null || _item$_extend35 === void 0 ? void 0 : _item$_extend35.price);
|
|
438
441
|
|
|
439
442
|
// 组合规格: 根据当前选择的组合规格id 和商品的组合规格列表 获取当前商品的价格
|
|
440
443
|
if ((other === null || other === void 0 ? void 0 : other.product_variant_id) > 0 && (item === null || item === void 0 || (_item$variant2 = item.variant) === null || _item$variant2 === void 0 ? void 0 : _item$variant2.length) > 0) {
|
|
@@ -450,8 +453,8 @@ export var getSourceProductPrice = function getSourceProductPrice(item) {
|
|
|
450
453
|
|
|
451
454
|
// 获取主商品价格 要增加option
|
|
452
455
|
export var getMainProductSellingPrice = function getMainProductSellingPrice(item) {
|
|
453
|
-
var _item$
|
|
454
|
-
if (!isNumber((_item$
|
|
456
|
+
var _item$_extend36, _item$_extend37, _item$_extend$other, _item$_extend$other2, _item$_extend38;
|
|
457
|
+
if (!isNumber((_item$_extend36 = item._extend) === null || _item$_extend36 === void 0 ? void 0 : _item$_extend36.main_product_selling_price) && !isString((_item$_extend37 = item._extend) === null || _item$_extend37 === void 0 ? void 0 : _item$_extend37.main_product_selling_price)) {
|
|
455
458
|
return undefined;
|
|
456
459
|
}
|
|
457
460
|
var optionPrice = new Decimal(0);
|
|
@@ -467,7 +470,7 @@ export var getMainProductSellingPrice = function getMainProductSellingPrice(item
|
|
|
467
470
|
optionPrice = optionPrice.sub(getOptionDiscountAmount((item === null || item === void 0 ? void 0 : item.discount_list) || []));
|
|
468
471
|
}
|
|
469
472
|
}
|
|
470
|
-
return new Decimal((_item$
|
|
473
|
+
return new Decimal((_item$_extend38 = item._extend) === null || _item$_extend38 === void 0 ? void 0 : _item$_extend38.main_product_selling_price).add(optionPrice).toNumber();
|
|
471
474
|
};
|
|
472
475
|
|
|
473
476
|
/**
|
|
@@ -478,12 +481,12 @@ export var getMainProductSellingPrice = function getMainProductSellingPrice(item
|
|
|
478
481
|
* @Author: WangHan
|
|
479
482
|
* @Date: 2024-12-07 14:21
|
|
480
483
|
*/
|
|
481
|
-
var formatProducts = function formatProducts(item, quantity
|
|
482
|
-
var _item$
|
|
484
|
+
var formatProducts = function formatProducts(item, quantity) {
|
|
485
|
+
var _item$_extend39, _getMainProductSellin, _item$_extend40, _item$_extend41, _item$_extend42, _item$_extend43;
|
|
483
486
|
var total = Number(item._extend.total);
|
|
484
487
|
var origin_total = Number(item._extend.origin_total);
|
|
485
488
|
var discount_amount = origin_total - total;
|
|
486
|
-
var bundleDiscountList = getBundleDiscountList(((_item$
|
|
489
|
+
var bundleDiscountList = getBundleDiscountList(((_item$_extend39 = item._extend) === null || _item$_extend39 === void 0 || (_item$_extend39 = _item$_extend39.other) === null || _item$_extend39 === void 0 ? void 0 : _item$_extend39.bundle) || []);
|
|
487
490
|
var discount_list = _toConsumableArray((item === null || item === void 0 ? void 0 : item.discount_list) || []);
|
|
488
491
|
discount_list.push.apply(discount_list, _toConsumableArray(bundleDiscountList));
|
|
489
492
|
|
|
@@ -493,9 +496,6 @@ var formatProducts = function formatProducts(item, quantity, options) {
|
|
|
493
496
|
d.metadata = _objectSpread(_objectSpread({}, d.metadata), {}, {
|
|
494
497
|
unique_identification_number: "".concat(item._extend.unique_identification_number, "_").concat(d.discount.resource_id)
|
|
495
498
|
});
|
|
496
|
-
if (options !== null && options !== void 0 && options.isServiceEdit && options !== null && options !== void 0 && options.isMultiDay) {
|
|
497
|
-
delete d.id;
|
|
498
|
-
}
|
|
499
499
|
});
|
|
500
500
|
|
|
501
501
|
// 非手动折扣
|
|
@@ -515,15 +515,15 @@ var formatProducts = function formatProducts(item, quantity, options) {
|
|
|
515
515
|
"discount_amount": notManualDiscount.length > 0 ? 0 : discount_amount,
|
|
516
516
|
"product_discount_reason": item._extend.discount_reason || '',
|
|
517
517
|
"is_charge_tax": item.is_charge_tax,
|
|
518
|
-
"note": ((_item$
|
|
518
|
+
"note": ((_item$_extend40 = item._extend) === null || _item$_extend40 === void 0 ? void 0 : _item$_extend40.note) || '',
|
|
519
519
|
"discountway": item._extend.discountway || "num",
|
|
520
520
|
"discount_per": item._extend.discount_per,
|
|
521
521
|
"discount_type": item._extend.discount_type || discount_type,
|
|
522
522
|
"order_detail_id": item._extend.order_detail_id || 0,
|
|
523
|
-
"product_bundle": formatProductBundle((_item$
|
|
523
|
+
"product_bundle": formatProductBundle((_item$_extend41 = item._extend) === null || _item$_extend41 === void 0 || (_item$_extend41 = _item$_extend41.other) === null || _item$_extend41 === void 0 ? void 0 : _item$_extend41.bundle),
|
|
524
524
|
"bundle_edit": item._extend.bundle_edit || bundleDiscountList.length ? 1 : 0,
|
|
525
|
-
"product_option_item": formatProductOption((_item$
|
|
526
|
-
"product_variant_id": ((_item$
|
|
525
|
+
"product_option_item": formatProductOption((_item$_extend42 = item._extend) === null || _item$_extend42 === void 0 || (_item$_extend42 = _item$_extend42.other) === null || _item$_extend42 === void 0 ? void 0 : _item$_extend42.option),
|
|
526
|
+
"product_variant_id": ((_item$_extend43 = item._extend) === null || _item$_extend43 === void 0 || (_item$_extend43 = _item$_extend43.other) === null || _item$_extend43 === void 0 ? void 0 : _item$_extend43.product_variant_id) || 0,
|
|
527
527
|
"discount_list": notManualDiscount,
|
|
528
528
|
metadata: formatProductMetadata(item),
|
|
529
529
|
// checkout 需求新增字段
|
|
@@ -548,8 +548,8 @@ var formatDayRelationProducts = function formatDayRelationProducts(data, booking
|
|
|
548
548
|
|
|
549
549
|
// 过滤出卡片中的普通商品
|
|
550
550
|
var relation_products = list === null || list === void 0 ? void 0 : list.filter(function (item) {
|
|
551
|
-
var _item$
|
|
552
|
-
var holderId = (_item$
|
|
551
|
+
var _item$_extend44;
|
|
552
|
+
var holderId = (_item$_extend44 = item._extend) === null || _item$_extend44 === void 0 ? void 0 : _item$_extend44.holder_id;
|
|
553
553
|
var bookingHolderId = booking_item._extend.holder_id;
|
|
554
554
|
var isDayBookingProduct = appointmentTypes.includes(item.extension_type);
|
|
555
555
|
return holderId && holderId === bookingHolderId && !isDayBookingProduct;
|
|
@@ -575,15 +575,15 @@ var formatAppointmentProductLists = function formatAppointmentProductLists(data)
|
|
|
575
575
|
|
|
576
576
|
// 找出预约商品
|
|
577
577
|
list = list.filter(function (item) {
|
|
578
|
-
var _item$
|
|
579
|
-
return ((_item$
|
|
578
|
+
var _item$_extend45;
|
|
579
|
+
return ((_item$_extend45 = item._extend) === null || _item$_extend45 === void 0 ? void 0 : _item$_extend45.holder_id) && !isNormalProductByDurationSchedule(item);
|
|
580
580
|
});
|
|
581
581
|
|
|
582
582
|
// 对预约商品列表根据holder_id进行分组
|
|
583
583
|
var groupMap = new Map();
|
|
584
584
|
list.forEach(function (item) {
|
|
585
|
-
var _item$
|
|
586
|
-
var key = (_item$
|
|
585
|
+
var _item$_extend46;
|
|
586
|
+
var key = (_item$_extend46 = item._extend) === null || _item$_extend46 === void 0 ? void 0 : _item$_extend46.holder_id; // 分组键
|
|
587
587
|
if (!groupMap.has(key)) {
|
|
588
588
|
groupMap.set(key, []);
|
|
589
589
|
}
|
|
@@ -619,8 +619,8 @@ var getHolderByIndex = function getHolderByIndex(holder, index) {
|
|
|
619
619
|
export var getHasMultiDayProduct = function getHasMultiDayProduct(data) {
|
|
620
620
|
var list = data.service.value;
|
|
621
621
|
var isHas = list.some(function (item) {
|
|
622
|
-
var _item$
|
|
623
|
-
return (_item$
|
|
622
|
+
var _item$_extend47;
|
|
623
|
+
return (_item$_extend47 = item._extend) === null || _item$_extend47 === void 0 ? void 0 : _item$_extend47.groupId;
|
|
624
624
|
});
|
|
625
625
|
return isHas;
|
|
626
626
|
};
|
|
@@ -660,7 +660,7 @@ var formatBookings = function formatBookings(data, values) {
|
|
|
660
660
|
var bookings = [];
|
|
661
661
|
var obj = {};
|
|
662
662
|
list.forEach(function (item) {
|
|
663
|
-
var _item$
|
|
663
|
+
var _item$_extend48, _item$_extend53, _item$_extend54;
|
|
664
664
|
// 自定义商品直接使用 _extend 中的数据,并将 id 转换为 0 提交给后端
|
|
665
665
|
if (item.isCustomItem) {
|
|
666
666
|
bookings.push(_objectSpread(_objectSpread({}, item._extend), {}, {
|
|
@@ -670,7 +670,7 @@ var formatBookings = function formatBookings(data, values) {
|
|
|
670
670
|
}
|
|
671
671
|
|
|
672
672
|
// 当前商品是跨日预约商品
|
|
673
|
-
var isMultiDay = (_item$
|
|
673
|
+
var isMultiDay = (_item$_extend48 = item._extend) === null || _item$_extend48 === void 0 ? void 0 : _item$_extend48.groupId;
|
|
674
674
|
var start_date = item._extend.startDate.format('YYYY-MM-DD');
|
|
675
675
|
var end_date = item._extend.endDate.format('YYYY-MM-DD');
|
|
676
676
|
var end_time = item._extend.endDate.format('HH:mm');
|
|
@@ -684,9 +684,9 @@ var formatBookings = function formatBookings(data, values) {
|
|
|
684
684
|
|
|
685
685
|
// 跨日预约下的普通商品
|
|
686
686
|
if (isDay) {
|
|
687
|
-
var _item$
|
|
688
|
-
var startDate = ((_item$
|
|
689
|
-
var endDate = ((_item$
|
|
687
|
+
var _item$_extend49, _item$_extend50, _item$_extend51, _item$_extend52;
|
|
688
|
+
var startDate = ((_item$_extend49 = item._extend) === null || _item$_extend49 === void 0 ? void 0 : _item$_extend49.startDate) || ((_item$_extend50 = item._extend) === null || _item$_extend50 === void 0 ? void 0 : _item$_extend50.start_date);
|
|
689
|
+
var endDate = ((_item$_extend51 = item._extend) === null || _item$_extend51 === void 0 ? void 0 : _item$_extend51.endDate) || ((_item$_extend52 = item._extend) === null || _item$_extend52 === void 0 ? void 0 : _item$_extend52.end_date);
|
|
690
690
|
var _formatDayTime = formatDayTime({
|
|
691
691
|
startDate: startDate,
|
|
692
692
|
endDate: endDate
|
|
@@ -712,16 +712,13 @@ var formatBookings = function formatBookings(data, values) {
|
|
|
712
712
|
// 跨日预约处理: 跨日预约所有数据都在list中, 每一组预约通过groupId进行分组
|
|
713
713
|
// 通过obj 记录下每个GroupId第一次出现的时机, 第一次出现需要设置 metadata.multiDayPrices
|
|
714
714
|
// 后续出现不需要设置 metadata.multiDayPrices. 节省体积
|
|
715
|
-
var isSetGroupId = obj[item === null || item === void 0 || (_item$
|
|
716
|
-
if (!((_item$
|
|
715
|
+
var isSetGroupId = obj[item === null || item === void 0 || (_item$_extend53 = item._extend) === null || _item$_extend53 === void 0 ? void 0 : _item$_extend53.groupId];
|
|
716
|
+
if (!((_item$_extend54 = item._extend) !== null && _item$_extend54 !== void 0 && _item$_extend54.unique_identification_number)) {
|
|
717
717
|
var unique_identification_number = getUniqueId();
|
|
718
718
|
item._extend.unique_identification_number = unique_identification_number;
|
|
719
719
|
}
|
|
720
720
|
var booking = _objectSpread(_objectSpread({
|
|
721
|
-
product: formatProducts(item,
|
|
722
|
-
isServiceEdit: data.service.edit,
|
|
723
|
-
isMultiDay: isMultiDay
|
|
724
|
-
}),
|
|
721
|
+
product: formatProducts(item),
|
|
725
722
|
relation_products: formatRelationDetails(item._extend.relation_details),
|
|
726
723
|
id: item.booking_id || 0,
|
|
727
724
|
relation_id: item._extend.relation_id || 0,
|
|
@@ -795,16 +792,16 @@ var formatRelationProducts = function formatRelationProducts(data, type) {
|
|
|
795
792
|
var list = ((_data$service = data.service) === null || _data$service === void 0 ? void 0 : _data$service.value) || [];
|
|
796
793
|
// open items 下的商品
|
|
797
794
|
list = list.filter(function (item) {
|
|
798
|
-
var _item$
|
|
795
|
+
var _item$_extend55;
|
|
799
796
|
return (
|
|
800
797
|
// 跨日预约把普通商品加在relationProducts 活动预约按之前逻辑
|
|
801
|
-
type === 'day' ? isNormalProductByDurationSchedule(item) : ((_item$
|
|
798
|
+
type === 'day' ? isNormalProductByDurationSchedule(item) : ((_item$_extend55 = item._extend) === null || _item$_extend55 === void 0 ? void 0 : _item$_extend55.holder_id) && appointmentTypes.includes(item.extension_type)
|
|
802
799
|
);
|
|
803
800
|
});
|
|
804
801
|
var relationProducts = [];
|
|
805
802
|
relationProducts = list.map(function (item) {
|
|
806
|
-
var _item$
|
|
807
|
-
if (!((_item$
|
|
803
|
+
var _item$_extend56;
|
|
804
|
+
if (!((_item$_extend56 = item._extend) !== null && _item$_extend56 !== void 0 && _item$_extend56.unique_identification_number)) {
|
|
808
805
|
var unique_identification_number = getUniqueId();
|
|
809
806
|
item._extend.unique_identification_number = unique_identification_number;
|
|
810
807
|
}
|
|
@@ -823,8 +820,8 @@ var formatNormalProducts = function formatNormalProducts(data) {
|
|
|
823
820
|
});
|
|
824
821
|
var relationProducts = [];
|
|
825
822
|
relationProducts = list.map(function (item) {
|
|
826
|
-
var _item$
|
|
827
|
-
if (!((_item$
|
|
823
|
+
var _item$_extend57;
|
|
824
|
+
if (!((_item$_extend57 = item._extend) !== null && _item$_extend57 !== void 0 && _item$_extend57.unique_identification_number)) {
|
|
828
825
|
var unique_identification_number = getUniqueId();
|
|
829
826
|
item._extend.unique_identification_number = unique_identification_number;
|
|
830
827
|
}
|
|
@@ -949,19 +946,19 @@ export var checkHolderIsError = function checkHolderIsError(state) {
|
|
|
949
946
|
var _state$client;
|
|
950
947
|
var errorRowKey = '';
|
|
951
948
|
var holderError = state.service.value.some(function (item) {
|
|
952
|
-
var _item$_extend$holder_2, _item$
|
|
949
|
+
var _item$_extend$holder_2, _item$_extend59;
|
|
953
950
|
// 普通商品不需要检测holder
|
|
954
951
|
if (isNormalProductByDurationSchedule(item)) {
|
|
955
952
|
return false;
|
|
956
953
|
}
|
|
957
954
|
if (item._extend.quantity === 1 && (!item._extend.holder_id || ((_item$_extend$holder_2 = item._extend.holder_id) === null || _item$_extend$holder_2 === void 0 ? void 0 : _item$_extend$holder_2.length) === 0)) {
|
|
958
|
-
var _item$
|
|
959
|
-
errorRowKey = genRowKey(item === null || item === void 0 || (_item$
|
|
955
|
+
var _item$_extend58;
|
|
956
|
+
errorRowKey = genRowKey(item === null || item === void 0 || (_item$_extend58 = item._extend) === null || _item$_extend58 === void 0 || (_item$_extend58 = _item$_extend58.other) === null || _item$_extend58 === void 0 ? void 0 : _item$_extend58.rowKey);
|
|
960
957
|
return true;
|
|
961
958
|
}
|
|
962
|
-
if (item._extend.quantity > 1 && ((_item$
|
|
963
|
-
var _item$
|
|
964
|
-
errorRowKey = genRowKey(item === null || item === void 0 || (_item$
|
|
959
|
+
if (item._extend.quantity > 1 && ((_item$_extend59 = item._extend) === null || _item$_extend59 === void 0 || (_item$_extend59 = _item$_extend59.holder_id) === null || _item$_extend59 === void 0 ? void 0 : _item$_extend59.length) !== item._extend.quantity) {
|
|
960
|
+
var _item$_extend60;
|
|
961
|
+
errorRowKey = genRowKey(item === null || item === void 0 || (_item$_extend60 = item._extend) === null || _item$_extend60 === void 0 || (_item$_extend60 = _item$_extend60.other) === null || _item$_extend60 === void 0 ? void 0 : _item$_extend60.rowKey);
|
|
965
962
|
return true;
|
|
966
963
|
}
|
|
967
964
|
return false;
|
|
@@ -128,7 +128,7 @@ var VoucherCard = function VoucherCard(props) {
|
|
|
128
128
|
var val = (_ref = state.service.value || []) === null || _ref === void 0 ? void 0 : _ref.map(function (value) {
|
|
129
129
|
var _value$_extend, _value$_extend2, _value$_extend3;
|
|
130
130
|
return {
|
|
131
|
-
|
|
131
|
+
booking_id: value.booking_id,
|
|
132
132
|
id: value.id,
|
|
133
133
|
price: value.price,
|
|
134
134
|
total: value === null || value === void 0 || (_value$_extend = value._extend) === null || _value$_extend === void 0 ? void 0 : _value$_extend.total,
|
|
@@ -5,6 +5,11 @@ export interface BookingDashboardProps extends React.HTMLAttributes<HTMLDivEleme
|
|
|
5
5
|
valueColor?: string;
|
|
6
6
|
otherParams?: Record<string, any>;
|
|
7
7
|
refreshKey?: string;
|
|
8
|
+
/**
|
|
9
|
+
* 组件是否可见。为 false 时会暂停内部的定时刷新 interval,避免后台无意义地拉数据。
|
|
10
|
+
* 默认 true,保持原有行为向后兼容。
|
|
11
|
+
*/
|
|
12
|
+
isVisible?: boolean;
|
|
8
13
|
onDataChange?: (data: {
|
|
9
14
|
groupsOnSiteNow: string | number;
|
|
10
15
|
peopleOnSiteNow: string | number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["otherParams", "backgroundColors", "labelColor", "valueColor", "refreshKey", "onDataChange"];
|
|
2
|
+
var _excluded = ["otherParams", "backgroundColors", "labelColor", "valueColor", "refreshKey", "isVisible", "onDataChange"];
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
5
5
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
@@ -51,6 +51,8 @@ var BookingDashboard = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
51
51
|
labelColor = props.labelColor,
|
|
52
52
|
valueColor = props.valueColor,
|
|
53
53
|
refreshKey = props.refreshKey,
|
|
54
|
+
_props$isVisible = props.isVisible,
|
|
55
|
+
isVisible = _props$isVisible === void 0 ? true : _props$isVisible,
|
|
54
56
|
onDataChange = props.onDataChange,
|
|
55
57
|
others = _objectWithoutProperties(props, _excluded);
|
|
56
58
|
var context = useEngineContext();
|
|
@@ -169,7 +171,7 @@ var BookingDashboard = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
169
171
|
};
|
|
170
172
|
}();
|
|
171
173
|
var calcBookingDataCount = function calcBookingDataCount() {
|
|
172
|
-
var _statisticData$total_, _statisticData$total_2, _statisticData$ongoin, _statisticData$ongoin2, _statisticData$upcomi, _statisticData$upcomi2;
|
|
174
|
+
var _statisticData$total_, _statisticData$total_2, _statisticData$ongoin, _statisticData$ongoin2, _statisticData$upcomi, _statisticData$upcomi2, _statisticData$comple, _statisticData$comple2;
|
|
173
175
|
// 当前在场团体
|
|
174
176
|
var groupsOnSiteNow = statisticData.groups_today_num || 0;
|
|
175
177
|
// 当前在场人数
|
|
@@ -189,9 +191,9 @@ var BookingDashboard = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
189
191
|
// 超时的游客
|
|
190
192
|
var overdue = statisticData.overdue_visitors_num || (hasTurnstileApp ? 0 : '-');
|
|
191
193
|
// 已完成的游客
|
|
192
|
-
var completed = statisticData.completed_visitors.num || 0;
|
|
194
|
+
var completed = ((_statisticData$comple = statisticData.completed_visitors) === null || _statisticData$comple === void 0 ? void 0 : _statisticData$comple.num) || 0;
|
|
193
195
|
// 已完成的游客二级数据
|
|
194
|
-
var completedChildren = statisticData.completed_visitors.statistics || [];
|
|
196
|
+
var completedChildren = ((_statisticData$comple2 = statisticData.completed_visitors) === null || _statisticData$comple2 === void 0 ? void 0 : _statisticData$comple2.statistics) || [];
|
|
195
197
|
// 已离场的游客
|
|
196
198
|
var departed = statisticData.departed_visitors_num || (hasTurnstileApp ? 0 : '-');
|
|
197
199
|
onDataChange === null || onDataChange === void 0 || onDataChange({
|
|
@@ -259,6 +261,8 @@ var BookingDashboard = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
259
261
|
}]);
|
|
260
262
|
};
|
|
261
263
|
useEffect(function () {
|
|
264
|
+
// 不可见时不拉数据、不启动 interval,避免后台浪费内存和请求
|
|
265
|
+
if (!isVisible) return;
|
|
262
266
|
getData();
|
|
263
267
|
|
|
264
268
|
// 每分钟更新一次数据
|
|
@@ -268,11 +272,10 @@ var BookingDashboard = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
268
272
|
return function () {
|
|
269
273
|
clearInterval(timer);
|
|
270
274
|
};
|
|
271
|
-
}, [JSON.stringify(otherParams), refreshKey]);
|
|
275
|
+
}, [JSON.stringify(otherParams), refreshKey, isVisible]);
|
|
272
276
|
useImperativeHandle(ref, function () {
|
|
273
277
|
return {
|
|
274
278
|
refresh: function refresh() {
|
|
275
|
-
debugger;
|
|
276
279
|
getData();
|
|
277
280
|
}
|
|
278
281
|
};
|
|
@@ -7,7 +7,9 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
7
7
|
import { getUniqueId } from "@pisell/utils";
|
|
8
8
|
import { getProductTotalPrice } from "../../../utils";
|
|
9
9
|
import { distributeDiscountOrIncrease } from "../../service/serviceManager/distributeDiscount";
|
|
10
|
+
import { setProductPrice } from "../../../info2/service/editService/utils";
|
|
10
11
|
import { genServiceKey } from "../../../../ticketBooking/utils";
|
|
12
|
+
import Decimal from "decimal.js";
|
|
11
13
|
|
|
12
14
|
// 创建group
|
|
13
15
|
|
|
@@ -121,7 +123,34 @@ export var createBookingItemsByGroup = function createBookingItemsByGroup(item,
|
|
|
121
123
|
// 折扣金额 转成负数
|
|
122
124
|
var discountAmount = (groupOriginTotalPrice - groupTotalPrice) * -1;
|
|
123
125
|
if (discountAmount !== 0) {
|
|
124
|
-
|
|
126
|
+
if (groupOriginTotalPrice !== 0) {
|
|
127
|
+
bookings = distributeDiscountOrIncrease(bookings, discountAmount, groupOriginTotalPrice);
|
|
128
|
+
bookings = bookings.map(function (booking) {
|
|
129
|
+
var _booking$_extend, _booking$_extend2;
|
|
130
|
+
return setProductPrice(booking, {
|
|
131
|
+
newTotal: booking === null || booking === void 0 || (_booking$_extend = booking._extend) === null || _booking$_extend === void 0 ? void 0 : _booking$_extend.total,
|
|
132
|
+
origin_total: booking === null || booking === void 0 || (_booking$_extend2 = booking._extend) === null || _booking$_extend2 === void 0 ? void 0 : _booking$_extend2.origin_total
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
} else {
|
|
136
|
+
// 原价为 0 无法按比例分摊(会除零),按 booking 数量均摊手动改价后的 groupTotalPrice
|
|
137
|
+
// 最后一个 booking 吸收两位小数的精度误差,确保总和等于 groupTotalPrice
|
|
138
|
+
var count = bookings.length;
|
|
139
|
+
var avgTotal = new Decimal(groupTotalPrice).div(count).toDecimalPlaces(2, Decimal.ROUND_HALF_UP);
|
|
140
|
+
var assignedSum = new Decimal(0);
|
|
141
|
+
bookings = bookings.map(function (booking, i) {
|
|
142
|
+
var newTotal = i === count - 1 ? new Decimal(groupTotalPrice).sub(assignedSum).toNumber() : avgTotal.toNumber();
|
|
143
|
+
if (i !== count - 1) {
|
|
144
|
+
assignedSum = assignedSum.add(avgTotal);
|
|
145
|
+
}
|
|
146
|
+
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
147
|
+
_extend: _objectSpread(_objectSpread({}, booking._extend), {}, {
|
|
148
|
+
total: newTotal,
|
|
149
|
+
price: newTotal
|
|
150
|
+
})
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
125
154
|
}
|
|
126
155
|
}
|
|
127
156
|
console.log('bookings', bookings);
|