@pisell/private-materials 6.6.52 → 6.6.54
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/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/components/appointmentBooking/components/Voucher/index.js +7 -22
- package/es/components/booking/addons/index.js +2 -3
- package/es/components/booking/components/footer/amount.js +5 -4
- package/es/components/booking/components/footer/index.js +0 -7
- package/es/components/booking/components/footer/utils.d.ts +1 -1
- package/es/components/booking/components/footer/utils.js +15 -10
- package/es/components/booking/components/voucher/index.js +1 -7
- package/es/components/booking/components/voucher/index.less +1 -4
- package/es/components/booking/components/voucherModal/index.less +0 -1
- package/es/components/booking/info/service2/utils.js +46 -42
- package/es/components/booking/info2/service/editService/index.js +8 -10
- package/es/components/booking/info2/service/editService/utils.d.ts +1 -0
- package/es/components/booking/info2/service/editService/utils.js +16 -0
- package/es/components/booking/payments/index.js +1 -1
- package/es/components/checkout/components/WalletPassModule/index.js +0 -1
- package/es/components/checkout/components/WalletPassModule/utils.d.ts +0 -1
- package/es/components/checkout/components/WalletPassModule/utils.js +3 -17
- package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/es/components/checkout/hooks/useWalletPass.js +192 -316
- package/es/components/pay/toC/PaymentMethods/WalletPass/index.d.ts +0 -5
- package/es/components/pay/toC/PaymentMethods/WalletPass/index.js +145 -166
- package/es/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +0 -6
- package/es/components/pay/toC/PaymentMethods/WalletPass/utils.js +3 -3
- package/es/components/pay/toC/WalletPassBlock/index.js +1 -3
- package/es/components/pay/toC/index.js +27 -66
- package/es/components/pay/toC/model.d.ts +0 -1
- package/es/components/pay/toC/serve.d.ts +0 -18
- package/es/components/pay/toC/serve.js +1 -29
- package/es/components/pay/toC/utils.d.ts +2 -2
- package/es/components/pay/toC/utils.js +0 -4
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +4 -7
- package/lib/components/appointmentBooking/components/Voucher/index.js +2 -10
- package/lib/components/booking/addons/index.js +2 -3
- package/lib/components/booking/components/footer/amount.js +4 -4
- package/lib/components/booking/components/footer/index.js +0 -9
- package/lib/components/booking/components/footer/utils.d.ts +1 -1
- package/lib/components/booking/components/footer/utils.js +15 -10
- package/lib/components/booking/components/voucher/index.js +1 -7
- package/lib/components/booking/components/voucher/index.less +1 -4
- package/lib/components/booking/components/voucherModal/index.less +0 -1
- package/lib/components/booking/info/service2/utils.js +15 -13
- package/lib/components/booking/info2/service/editService/index.js +21 -24
- package/lib/components/booking/info2/service/editService/utils.d.ts +1 -0
- package/lib/components/booking/info2/service/editService/utils.js +16 -0
- package/lib/components/booking/payments/index.js +1 -1
- package/lib/components/checkout/components/WalletPassModule/index.js +0 -1
- package/lib/components/checkout/components/WalletPassModule/utils.d.ts +0 -1
- package/lib/components/checkout/components/WalletPassModule/utils.js +2 -18
- package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/lib/components/checkout/hooks/useWalletPass.js +108 -157
- package/lib/components/pay/toC/PaymentMethods/WalletPass/index.d.ts +0 -5
- package/lib/components/pay/toC/PaymentMethods/WalletPass/index.js +103 -90
- package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +0 -6
- package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.js +2 -2
- package/lib/components/pay/toC/WalletPassBlock/index.js +1 -3
- package/lib/components/pay/toC/index.js +11 -52
- package/lib/components/pay/toC/model.d.ts +0 -1
- package/lib/components/pay/toC/serve.d.ts +0 -18
- package/lib/components/pay/toC/serve.js +0 -6
- package/lib/components/pay/toC/utils.d.ts +2 -2
- package/lib/components/pay/toC/utils.js +0 -4
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +7 -11
- package/package.json +4 -4
|
@@ -28,8 +28,6 @@ import { PisellInput, PisellGoodPassCard, PisellText, PisellToast } from '@pisel
|
|
|
28
28
|
import { useAppointmentBooking, useShopDiscount, useAppointmentBookingLogin, useAppointmentBookingAccount } from "../../hooks";
|
|
29
29
|
import "../../../booking/components/voucher/index.less";
|
|
30
30
|
import "./index.less";
|
|
31
|
-
import { useAppointmentBookingContext } from "../../context";
|
|
32
|
-
import { useDebounceFn } from 'ahooks';
|
|
33
31
|
var ShopDiscountHooks = {
|
|
34
32
|
onInited: 'shopDiscount:onInited',
|
|
35
33
|
onDestroy: 'shopDiscount:onDestroy',
|
|
@@ -71,19 +69,11 @@ var VoucherCard = function VoucherCard(props) {
|
|
|
71
69
|
openLoginModal = _useAppointmentBookin.openLoginModal;
|
|
72
70
|
var _useAppointmentBookin2 = useAppointmentBookingAccount(),
|
|
73
71
|
accountLists = _useAppointmentBookin2.accountLists;
|
|
74
|
-
var _useAppointmentBookin3 = useAppointmentBookingContext(),
|
|
75
|
-
summary = _useAppointmentBookin3.summary;
|
|
76
|
-
var originTotal = summary.originTotal,
|
|
77
|
-
total = summary.total;
|
|
78
72
|
var cart = appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$s = appointmentBooking.store) === null || _appointmentBooking$s === void 0 ? void 0 : _appointmentBooking$s.cart;
|
|
79
73
|
var isUserLoggedIn = useMemo(function () {
|
|
80
74
|
var _utils$token, _utils$token$get;
|
|
81
75
|
return !!(utils !== null && utils !== void 0 && (_utils$token = utils.token) !== null && _utils$token !== void 0 && (_utils$token$get = _utils$token.get) !== null && _utils$token$get !== void 0 && _utils$token$get.call(_utils$token)) || false;
|
|
82
76
|
}, [store]);
|
|
83
|
-
useEffect(function () {
|
|
84
|
-
var shopDiscount = pisellos.getModule('shopDiscount');
|
|
85
|
-
shopDiscount.setOriginTotalAmount(originTotal);
|
|
86
|
-
}, [originTotal]);
|
|
87
77
|
var availableData = useMemo(function () {
|
|
88
78
|
return discountList.filter(function (item) {
|
|
89
79
|
return !!item.isAvailable;
|
|
@@ -120,18 +110,13 @@ var VoucherCard = function VoucherCard(props) {
|
|
|
120
110
|
});
|
|
121
111
|
appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$b = appointmentBooking.batchUpdateCart) === null || _appointmentBooking$b === void 0 || _appointmentBooking$b.call(appointmentBooking, items);
|
|
122
112
|
};
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
batchUpdateCart(val.productList);
|
|
131
|
-
}, {
|
|
132
|
-
wait: 200
|
|
133
|
-
}),
|
|
134
|
-
onCartChange = _useDebounceFn.run;
|
|
113
|
+
var onCartChange = function onCartChange() {
|
|
114
|
+
var _shopDiscount$setBook, _appointmentBooking$o;
|
|
115
|
+
var products = cart === null || cart === void 0 ? void 0 : cart.getItems();
|
|
116
|
+
shopDiscount === null || shopDiscount === void 0 || (_shopDiscount$setBook = shopDiscount.setBookingSubject) === null || _shopDiscount$setBook === void 0 || _shopDiscount$setBook.call(shopDiscount, appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$o = appointmentBooking.otherParams) === null || _appointmentBooking$o === void 0 || (_appointmentBooking$o = _appointmentBooking$o.bookingSetting) === null || _appointmentBooking$o === void 0 ? void 0 : _appointmentBooking$o.bookingSubject);
|
|
117
|
+
var val = shopDiscount.calcDiscount(products);
|
|
118
|
+
batchUpdateCart(val.productList);
|
|
119
|
+
};
|
|
135
120
|
var stringifiedHolders = useMemo(function () {
|
|
136
121
|
var _ret;
|
|
137
122
|
try {
|
|
@@ -60,15 +60,14 @@ export var formatProducts = function formatProducts(values) {
|
|
|
60
60
|
discountway: 'num',
|
|
61
61
|
discount_type: 'discount',
|
|
62
62
|
bundle_edit: (_item$_extend2 = item._extend) === null || _item$_extend2 === void 0 ? void 0 : _item$_extend2.bundle_edit,
|
|
63
|
-
product_bundle: formatProductBundle((_item$_extend3 = item._extend) === null || _item$_extend3 === void 0 || (_item$_extend3 = _item$_extend3.other) === null || _item$_extend3 === void 0 ? void 0 : _item$_extend3.bundle
|
|
63
|
+
product_bundle: formatProductBundle((_item$_extend3 = item._extend) === null || _item$_extend3 === void 0 || (_item$_extend3 = _item$_extend3.other) === null || _item$_extend3 === void 0 ? void 0 : _item$_extend3.bundle),
|
|
64
64
|
"product_option_item": formatProductOption((_item$_extend4 = item._extend) === null || _item$_extend4 === void 0 || (_item$_extend4 = _item$_extend4.other) === null || _item$_extend4 === void 0 ? void 0 : _item$_extend4.option),
|
|
65
65
|
"product_variant_id": ((_item$_extend5 = item._extend) === null || _item$_extend5 === void 0 || (_item$_extend5 = _item$_extend5.other) === null || _item$_extend5 === void 0 ? void 0 : _item$_extend5.product_variant_id) || 0,
|
|
66
66
|
"source_product_price": getSourceProductPrice(item),
|
|
67
67
|
"main_product_selling_price": (_getMainProductSellin = getMainProductSellingPrice(item)) !== null && _getMainProductSellin !== void 0 ? _getMainProductSellin : formatProductPrice(item),
|
|
68
68
|
"calculated_original_price": formatOriginalPrice(item),
|
|
69
69
|
"calculated_selling_price": formatSellingPrice(item),
|
|
70
|
-
"tax_fee": item._extend.tax_fee
|
|
71
|
-
is_price_include_tax: item.is_price_include_tax
|
|
70
|
+
"tax_fee": item._extend.tax_fee
|
|
72
71
|
};
|
|
73
72
|
});
|
|
74
73
|
return arr;
|
|
@@ -519,7 +519,8 @@ var processItemsTax = function processItemsTax(items, state, options) {
|
|
|
519
519
|
}
|
|
520
520
|
return {
|
|
521
521
|
originTax: expectedOriginTax,
|
|
522
|
-
tax: expectedTax
|
|
522
|
+
tax: expectedTax,
|
|
523
|
+
taxDecimal: preciseTax
|
|
523
524
|
};
|
|
524
525
|
};
|
|
525
526
|
|
|
@@ -651,7 +652,7 @@ var getTax = function getTax(state, options) {
|
|
|
651
652
|
computed: computed
|
|
652
653
|
});
|
|
653
654
|
totalOriginTax = totalOriginTax.plus(serviceResult.originTax);
|
|
654
|
-
totalTax = totalTax.plus(serviceResult.
|
|
655
|
+
totalTax = totalTax.plus(serviceResult.taxDecimal);
|
|
655
656
|
}
|
|
656
657
|
|
|
657
658
|
// 处理附加商品
|
|
@@ -662,7 +663,7 @@ var getTax = function getTax(state, options) {
|
|
|
662
663
|
computed: computed
|
|
663
664
|
});
|
|
664
665
|
totalOriginTax = totalOriginTax.plus(addonsResult.originTax);
|
|
665
|
-
totalTax = totalTax.plus(addonsResult.
|
|
666
|
+
totalTax = totalTax.plus(addonsResult.taxDecimal);
|
|
666
667
|
}
|
|
667
668
|
}
|
|
668
669
|
return {
|
|
@@ -843,7 +844,7 @@ var getMainProductTotal = function getMainProductTotal(item) {
|
|
|
843
844
|
// 子商品价格
|
|
844
845
|
var bundleItemPrice = new Decimal((_ref5 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref5 !== void 0 ? _ref5 : 0);
|
|
845
846
|
// todo: 套餐子商品后不需要处理 子商品价格 - 子商品折扣金额
|
|
846
|
-
var bundleItemTotal = bundleItemPrice;
|
|
847
|
+
var bundleItemTotal = bundleItemPrice.minus(discountAmount);
|
|
847
848
|
total = total.add(bundleItemTotal);
|
|
848
849
|
}
|
|
849
850
|
}
|
|
@@ -338,13 +338,6 @@ var Footer = function Footer(props) {
|
|
|
338
338
|
ScheduleModule: ScheduleModule
|
|
339
339
|
}, getDataFromHost()));
|
|
340
340
|
}, [state, isEdit]);
|
|
341
|
-
useEffect(function () {
|
|
342
|
-
window.dispatchEvent(new CustomEvent('onOriginExpectAmountWithoutDiscountChange', {
|
|
343
|
-
detail: {
|
|
344
|
-
originExpectAmountWithoutDiscount: total === null || total === void 0 ? void 0 : total.originExpectAmountWithoutDiscount
|
|
345
|
-
}
|
|
346
|
-
}));
|
|
347
|
-
}, [total === null || total === void 0 ? void 0 : total.originExpectAmountWithoutDiscount]);
|
|
348
341
|
useDebounceEffect(function () {
|
|
349
342
|
var _state$service4;
|
|
350
343
|
if (state !== null && state !== void 0 && (_state$service4 = state.service) !== null && _state$service4 !== void 0 && _state$service4.addTimeModal) {
|
|
@@ -15,7 +15,7 @@ export declare const formatProductOption: (option: any) => any;
|
|
|
15
15
|
* @Author: zhiwei.Wang
|
|
16
16
|
* @Date: 2024-02-19 09:26
|
|
17
17
|
*/
|
|
18
|
-
export declare const formatProductBundle: (bundle: any
|
|
18
|
+
export declare const formatProductBundle: (bundle: any) => any;
|
|
19
19
|
/**
|
|
20
20
|
* 获取子商品折扣信息
|
|
21
21
|
* @param item
|
|
@@ -93,7 +93,7 @@ var log = function log(data) {
|
|
|
93
93
|
* @Author: zhiwei.Wang
|
|
94
94
|
* @Date: 2024-02-19 09:26
|
|
95
95
|
*/
|
|
96
|
-
export var formatProductBundle = function formatProductBundle(bundle
|
|
96
|
+
export var formatProductBundle = function formatProductBundle(bundle) {
|
|
97
97
|
if (!bundle) {
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
@@ -108,6 +108,7 @@ export var formatProductBundle = function formatProductBundle(bundle, is_price_i
|
|
|
108
108
|
}
|
|
109
109
|
} catch (error) {}
|
|
110
110
|
return bundle.map(function (d) {
|
|
111
|
+
var _d$metadata;
|
|
111
112
|
var option = formatProductOption(d.option);
|
|
112
113
|
var option_price = option.reduce(function (temp, item) {
|
|
113
114
|
return temp + Number(item.num) * item.custom_add_price;
|
|
@@ -134,9 +135,8 @@ export var formatProductBundle = function formatProductBundle(bundle, is_price_i
|
|
|
134
135
|
"option": option,
|
|
135
136
|
"bundle_selling_price": Math.abs(d === null || d === void 0 ? void 0 : d.price),
|
|
136
137
|
// "bundle_sum_price": d?.original_price || d?.original_total,
|
|
137
|
-
is_price_include_tax: is_price_include_tax,
|
|
138
138
|
"metadata": {
|
|
139
|
-
custom_product_bundle_map_id: d._id,
|
|
139
|
+
custom_product_bundle_map_id: (d === null || d === void 0 || (_d$metadata = d.metadata) === null || _d$metadata === void 0 ? void 0 : _d$metadata.custom_product_bundle_map_id) || d._id,
|
|
140
140
|
// 子商品单数量附加费
|
|
141
141
|
"surcharge_fee": d.surcharge_fee,
|
|
142
142
|
// 可选,附加费均摊舍入金额
|
|
@@ -324,8 +324,8 @@ export var formatOriginalPrice = function formatOriginalPrice(item) {
|
|
|
324
324
|
|
|
325
325
|
/**
|
|
326
326
|
* 获取套餐子商品折扣差价
|
|
327
|
-
* @param item
|
|
328
|
-
* @returns
|
|
327
|
+
* @param item
|
|
328
|
+
* @returns
|
|
329
329
|
*/
|
|
330
330
|
var getBundleProductDiscountDifference = function getBundleProductDiscountDifference(item) {
|
|
331
331
|
var _item$_extend9, _item$_extend10, _item$_extend11;
|
|
@@ -478,7 +478,7 @@ export var getMainProductSellingPrice = function getMainProductSellingPrice(item
|
|
|
478
478
|
* @Author: WangHan
|
|
479
479
|
* @Date: 2024-12-07 14:21
|
|
480
480
|
*/
|
|
481
|
-
var formatProducts = function formatProducts(item, quantity) {
|
|
481
|
+
var formatProducts = function formatProducts(item, quantity, options) {
|
|
482
482
|
var _item$_extend36, _getMainProductSellin, _item$_extend37, _item$_extend38, _item$_extend39, _item$_extend40;
|
|
483
483
|
var total = Number(item._extend.total);
|
|
484
484
|
var origin_total = Number(item._extend.origin_total);
|
|
@@ -493,6 +493,9 @@ var formatProducts = function formatProducts(item, quantity) {
|
|
|
493
493
|
d.metadata = _objectSpread(_objectSpread({}, d.metadata), {}, {
|
|
494
494
|
unique_identification_number: "".concat(item._extend.unique_identification_number, "_").concat(d.discount.resource_id)
|
|
495
495
|
});
|
|
496
|
+
if (options !== null && options !== void 0 && options.isServiceEdit && options !== null && options !== void 0 && options.isMultiDay) {
|
|
497
|
+
delete d.id;
|
|
498
|
+
}
|
|
496
499
|
});
|
|
497
500
|
|
|
498
501
|
// 非手动折扣
|
|
@@ -517,7 +520,7 @@ var formatProducts = function formatProducts(item, quantity) {
|
|
|
517
520
|
"discount_per": item._extend.discount_per,
|
|
518
521
|
"discount_type": item._extend.discount_type || discount_type,
|
|
519
522
|
"order_detail_id": item._extend.order_detail_id || 0,
|
|
520
|
-
"product_bundle": formatProductBundle((_item$_extend38 = item._extend) === null || _item$_extend38 === void 0 || (_item$_extend38 = _item$_extend38.other) === null || _item$_extend38 === void 0 ? void 0 : _item$_extend38.bundle
|
|
523
|
+
"product_bundle": formatProductBundle((_item$_extend38 = item._extend) === null || _item$_extend38 === void 0 || (_item$_extend38 = _item$_extend38.other) === null || _item$_extend38 === void 0 ? void 0 : _item$_extend38.bundle),
|
|
521
524
|
"bundle_edit": item._extend.bundle_edit || bundleDiscountList.length ? 1 : 0,
|
|
522
525
|
"product_option_item": formatProductOption((_item$_extend39 = item._extend) === null || _item$_extend39 === void 0 || (_item$_extend39 = _item$_extend39.other) === null || _item$_extend39 === void 0 ? void 0 : _item$_extend39.option),
|
|
523
526
|
"product_variant_id": ((_item$_extend40 = item._extend) === null || _item$_extend40 === void 0 || (_item$_extend40 = _item$_extend40.other) === null || _item$_extend40 === void 0 ? void 0 : _item$_extend40.product_variant_id) || 0,
|
|
@@ -527,8 +530,7 @@ var formatProducts = function formatProducts(item, quantity) {
|
|
|
527
530
|
"calculated_original_price": formatOriginalPrice(item),
|
|
528
531
|
"calculated_selling_price": formatSellingPrice(item),
|
|
529
532
|
"tax_fee": item._extend.tax_fee,
|
|
530
|
-
"custom_deposit_data": item.custom_deposit_data
|
|
531
|
-
is_price_include_tax: item.is_price_include_tax
|
|
533
|
+
"custom_deposit_data": item.custom_deposit_data
|
|
532
534
|
};
|
|
533
535
|
};
|
|
534
536
|
|
|
@@ -716,7 +718,10 @@ var formatBookings = function formatBookings(data, values) {
|
|
|
716
718
|
item._extend.unique_identification_number = unique_identification_number;
|
|
717
719
|
}
|
|
718
720
|
var booking = _objectSpread(_objectSpread({
|
|
719
|
-
product: formatProducts(item
|
|
721
|
+
product: formatProducts(item, undefined, {
|
|
722
|
+
isServiceEdit: data.service.edit,
|
|
723
|
+
isMultiDay: isMultiDay
|
|
724
|
+
}),
|
|
720
725
|
relation_products: formatRelationDetails(item._extend.relation_details),
|
|
721
726
|
id: item.booking_id || 0,
|
|
722
727
|
relation_id: item._extend.relation_id || 0,
|
|
@@ -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
|
-
booking_id: value.booking_id,
|
|
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,
|
|
@@ -152,17 +152,11 @@ var VoucherCard = function VoucherCard(props) {
|
|
|
152
152
|
}
|
|
153
153
|
onScanCode(e.detail.code);
|
|
154
154
|
});
|
|
155
|
-
var onOriginExpectAmountWithoutDiscountChange = useMemoizedFn(function (e) {
|
|
156
|
-
var _shopDiscount$setOrig;
|
|
157
|
-
shopDiscount === null || shopDiscount === void 0 || (_shopDiscount$setOrig = shopDiscount.setOriginTotalAmount) === null || _shopDiscount$setOrig === void 0 || _shopDiscount$setOrig.call(shopDiscount, e.detail.originExpectAmountWithoutDiscount);
|
|
158
|
-
});
|
|
159
155
|
useEffect(function () {
|
|
160
156
|
var wrappedOnScanWallPassCode = executeIfActive(onScanWallPassCode);
|
|
161
157
|
window.addEventListener('onScanWallPassCode', wrappedOnScanWallPassCode);
|
|
162
|
-
window.addEventListener('onOriginExpectAmountWithoutDiscountChange', onOriginExpectAmountWithoutDiscountChange);
|
|
163
158
|
return function () {
|
|
164
159
|
window.removeEventListener('onScanWallPassCode', wrappedOnScanWallPassCode);
|
|
165
|
-
window.removeEventListener('onOriginExpectAmountWithoutDiscountChange', onOriginExpectAmountWithoutDiscountChange);
|
|
166
160
|
};
|
|
167
161
|
}, []);
|
|
168
162
|
var addonsMemo = useMemo(function () {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
.pisell-lowcode__booking-footer-voucher-container {
|
|
2
2
|
margin-bottom: 8px;
|
|
3
|
-
width: 100%;
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-direction: column;
|
|
6
3
|
.voucher-title {
|
|
7
4
|
display: flex;
|
|
8
5
|
align-items: center;
|
|
@@ -50,9 +47,9 @@
|
|
|
50
47
|
width: 100%;
|
|
51
48
|
transition: 0.2s;
|
|
52
49
|
max-height: 0;
|
|
50
|
+
overflow: hidden;
|
|
53
51
|
display: flex;
|
|
54
52
|
flex-direction: column;
|
|
55
|
-
overflow: auto;
|
|
56
53
|
|
|
57
54
|
&.show {
|
|
58
55
|
max-height: unset;
|
|
@@ -215,12 +215,14 @@ export var handleChangeHolder = function handleChangeHolder(products, currentIte
|
|
|
215
215
|
var handleAddHolder = function handleAddHolder() {};
|
|
216
216
|
var handleLike = function handleLike(products, currentItem, other) {
|
|
217
217
|
return products.map(function (item) {
|
|
218
|
+
var _item$_extend3, _item$_extend4;
|
|
219
|
+
var isSameGroup = (item === null || item === void 0 || (_item$_extend3 = item._extend) === null || _item$_extend3 === void 0 ? void 0 : _item$_extend3.groupId) && ((_item$_extend4 = item._extend) === null || _item$_extend4 === void 0 ? void 0 : _item$_extend4.groupId) === (currentItem === null || currentItem === void 0 ? void 0 : currentItem.serviceId);
|
|
218
220
|
if (currentItem.isParallelResource) {
|
|
219
|
-
if (item._id === currentItem.serviceId) {
|
|
220
|
-
var _item$
|
|
221
|
+
if (item._id === currentItem.serviceId || isSameGroup) {
|
|
222
|
+
var _item$_extend5, _item$_extend6;
|
|
221
223
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
222
224
|
_extend: _objectSpread(_objectSpread({}, item._extend), {}, {
|
|
223
|
-
resource: _objectSpread(_objectSpread({}, (_item$
|
|
225
|
+
resource: _objectSpread(_objectSpread({}, (_item$_extend5 = item._extend) === null || _item$_extend5 === void 0 ? void 0 : _item$_extend5.resource), {}, _defineProperty({}, currentItem.resourceId, (_item$_extend6 = item._extend) === null || _item$_extend6 === void 0 ? void 0 : _item$_extend6.resource[currentItem.resourceId].map(function (item) {
|
|
224
226
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
225
227
|
like_status: other.like_status
|
|
226
228
|
});
|
|
@@ -230,7 +232,7 @@ var handleLike = function handleLike(products, currentItem, other) {
|
|
|
230
232
|
}
|
|
231
233
|
return item;
|
|
232
234
|
} else {
|
|
233
|
-
if (item._id === currentItem._id) {
|
|
235
|
+
if (item._id === currentItem._id || isSameGroup) {
|
|
234
236
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
235
237
|
_extend: _objectSpread(_objectSpread({}, item._extend), {}, {
|
|
236
238
|
like_status: other.like_status
|
|
@@ -245,14 +247,16 @@ var handleLike = function handleLike(products, currentItem, other) {
|
|
|
245
247
|
// 更新资源
|
|
246
248
|
var handleChangeResource = function handleChangeResource(products, currentItem, other, state) {
|
|
247
249
|
return products.map(function (item) {
|
|
250
|
+
var _item$_extend7, _item$_extend8, _currentItem$_origin2;
|
|
248
251
|
var _ref = other || {},
|
|
249
252
|
props = _ref.props,
|
|
250
253
|
value = _ref.value;
|
|
251
254
|
var _ref2 = props || {},
|
|
252
255
|
isParallelResource = _ref2.isParallelResource,
|
|
253
256
|
resourceId = _ref2.resourceId;
|
|
257
|
+
var isSameGroup = (item === null || item === void 0 || (_item$_extend7 = item._extend) === null || _item$_extend7 === void 0 ? void 0 : _item$_extend7.groupId) && ((_item$_extend8 = item._extend) === null || _item$_extend8 === void 0 ? void 0 : _item$_extend8.groupId) === (currentItem === null || currentItem === void 0 || (_currentItem$_origin2 = currentItem._origin) === null || _currentItem$_origin2 === void 0 || (_currentItem$_origin2 = _currentItem$_origin2._extend) === null || _currentItem$_origin2 === void 0 ? void 0 : _currentItem$_origin2.groupId);
|
|
254
258
|
if (isParallelResource) {
|
|
255
|
-
if (item._id === currentItem._id) {
|
|
259
|
+
if (item._id === currentItem._id || isSameGroup) {
|
|
256
260
|
var hasDataItem = getProductExtend({
|
|
257
261
|
cacheItem: _objectSpread(_objectSpread({}, item), {}, {
|
|
258
262
|
new: 0
|
|
@@ -286,7 +290,7 @@ var handleChangeResource = function handleChangeResource(products, currentItem,
|
|
|
286
290
|
}
|
|
287
291
|
return item;
|
|
288
292
|
} else {
|
|
289
|
-
if (item._id === currentItem._id) {
|
|
293
|
+
if (item._id === currentItem._id || isSameGroup) {
|
|
290
294
|
var _resourceItem$_extend;
|
|
291
295
|
var resourceItem = currentResource(state, other.id, item);
|
|
292
296
|
var _ref3 = (resourceItem === null || resourceItem === void 0 || (_resourceItem$_extend = resourceItem._extend) === null || _resourceItem$_extend === void 0 ? void 0 : _resourceItem$_extend.usableTime) || {},
|
|
@@ -345,8 +349,8 @@ export var updateServices = function updateServices(state, currentItem, type, ot
|
|
|
345
349
|
if (type === 'delete_holders') {
|
|
346
350
|
var _products2;
|
|
347
351
|
products = (_products2 = products) === null || _products2 === void 0 ? void 0 : _products2.filter(function (item) {
|
|
348
|
-
var _item$
|
|
349
|
-
return (item === null || item === void 0 || (_item$
|
|
352
|
+
var _item$_extend9;
|
|
353
|
+
return (item === null || item === void 0 || (_item$_extend9 = item._extend) === null || _item$_extend9 === void 0 ? void 0 : _item$_extend9.holder_id) !== other;
|
|
350
354
|
});
|
|
351
355
|
}
|
|
352
356
|
|
|
@@ -560,7 +564,7 @@ export var genRowKey = function genRowKey(key) {
|
|
|
560
564
|
return "rowKey-".concat(key);
|
|
561
565
|
};
|
|
562
566
|
var getGeneralParams = function getGeneralParams(item, state, isParallelResource) {
|
|
563
|
-
var _state$bookingConfig4, _state$bookingConfig5, _formData$, _item$
|
|
567
|
+
var _state$bookingConfig4, _state$bookingConfig5, _formData$, _item$_extend11, _item$_extend12, _item$_extend13, _item$_extend14, _item$_extend15;
|
|
564
568
|
var pet = state.pet,
|
|
565
569
|
service = state.service;
|
|
566
570
|
var _ref8 = pet || {},
|
|
@@ -603,7 +607,7 @@ var getGeneralParams = function getGeneralParams(item, state, isParallelResource
|
|
|
603
607
|
};
|
|
604
608
|
});
|
|
605
609
|
} else {
|
|
606
|
-
var _item$
|
|
610
|
+
var _item$_extend10;
|
|
607
611
|
var _ref10 = service || {},
|
|
608
612
|
resourcesOrigin = _ref10.resourcesOrigin;
|
|
609
613
|
var resource = formatResources({
|
|
@@ -614,7 +618,7 @@ var getGeneralParams = function getGeneralParams(item, state, isParallelResource
|
|
|
614
618
|
multiResources = [{
|
|
615
619
|
_id: item._id,
|
|
616
620
|
id: item._extend.resource,
|
|
617
|
-
status: ((_item$
|
|
621
|
+
status: ((_item$_extend10 = item._extend) === null || _item$_extend10 === void 0 ? void 0 : _item$_extend10.like_status) || 'common',
|
|
618
622
|
lists: mapListItems(resource)
|
|
619
623
|
}];
|
|
620
624
|
}
|
|
@@ -639,10 +643,10 @@ var getGeneralParams = function getGeneralParams(item, state, isParallelResource
|
|
|
639
643
|
holderMode: (item === null || item === void 0 ? void 0 : item._extend.quantity) > 1 ? 'multiple' : undefined,
|
|
640
644
|
isErrorHolder: getIsSubjectRequire(state),
|
|
641
645
|
addHolderButtonText: (formData === null || formData === void 0 || (_formData$ = formData[0]) === null || _formData$ === void 0 || (_formData$ = _formData$.form) === null || _formData$ === void 0 ? void 0 : _formData$.title) || "",
|
|
642
|
-
holder_id: item === null || item === void 0 || (_item$
|
|
643
|
-
start_date: !isNormalProduct ? item === null || item === void 0 || (_item$
|
|
644
|
-
end_date: !isNormalProduct ? (item === null || item === void 0 || (_item$
|
|
645
|
-
rowKey: genRowKey(item === null || item === void 0 || (_item$
|
|
646
|
+
holder_id: item === null || item === void 0 || (_item$_extend11 = item._extend) === null || _item$_extend11 === void 0 ? void 0 : _item$_extend11.holder_id,
|
|
647
|
+
start_date: !isNormalProduct ? item === null || item === void 0 || (_item$_extend12 = item._extend) === null || _item$_extend12 === void 0 ? void 0 : _item$_extend12.startDate : "",
|
|
648
|
+
end_date: !isNormalProduct ? (item === null || item === void 0 || (_item$_extend13 = item._extend) === null || _item$_extend13 === void 0 ? void 0 : _item$_extend13.endDate) || (item === null || item === void 0 || (_item$_extend14 = item._extend) === null || _item$_extend14 === void 0 ? void 0 : _item$_extend14.end_date) : "",
|
|
649
|
+
rowKey: genRowKey(item === null || item === void 0 || (_item$_extend15 = item._extend) === null || _item$_extend15 === void 0 || (_item$_extend15 = _item$_extend15.other) === null || _item$_extend15 === void 0 ? void 0 : _item$_extend15.rowKey)
|
|
646
650
|
}, parallelResourceOtherParams);
|
|
647
651
|
};
|
|
648
652
|
var calcAddTimeTotalPrice = function calcAddTimeTotalPrice(total, addTimeProducts) {
|
|
@@ -663,18 +667,18 @@ export var formatProducts = function formatProducts(lists, state) {
|
|
|
663
667
|
var isParallelResource = arguments.length > 4 ? arguments[4] : undefined;
|
|
664
668
|
if (!(lists !== null && lists !== void 0 && lists.length)) return [];
|
|
665
669
|
var formItem = function formItem(item) {
|
|
666
|
-
var _item$
|
|
670
|
+
var _item$_extend16, _item$_extend17, _item$_extend18, _item$_extend20, _item$_extend21, _item$_extend22, _item$_extend23, _item$_extend24, _item$_extend25, _item$_extend26, _item$_extend27, _item$_extend28, _item$_extend29, _resourceItem, _item$_extend30, _item$_extend31, _item$_extend32, _item$_extend33, _item$_extend34;
|
|
667
671
|
var _isDayBookingProduct = isDayBookingProduct(item, state);
|
|
668
|
-
var clientTitle = getHolderName(state, item === null || item === void 0 || (_item$
|
|
669
|
-
var options = formatOptions(item === null || item === void 0 || (_item$
|
|
670
|
-
var bundle = formatBundle(item === null || item === void 0 || (_item$
|
|
672
|
+
var clientTitle = getHolderName(state, item === null || item === void 0 || (_item$_extend16 = item._extend) === null || _item$_extend16 === void 0 ? void 0 : _item$_extend16.holder_id);
|
|
673
|
+
var options = formatOptions(item === null || item === void 0 || (_item$_extend17 = item._extend) === null || _item$_extend17 === void 0 || (_item$_extend17 = _item$_extend17.other) === null || _item$_extend17 === void 0 ? void 0 : _item$_extend17.option);
|
|
674
|
+
var bundle = formatBundle(item === null || item === void 0 || (_item$_extend18 = item._extend) === null || _item$_extend18 === void 0 || (_item$_extend18 = _item$_extend18.other) === null || _item$_extend18 === void 0 ? void 0 : _item$_extend18.bundle);
|
|
671
675
|
// 是否是普通商品
|
|
672
676
|
var isNormalProduct = !appointmentTypes.includes(item === null || item === void 0 ? void 0 : item.extension_type) || (state === null || state === void 0 ? void 0 : state.renderType) === 'eventBooking';
|
|
673
677
|
var resourceItem = {};
|
|
674
678
|
var errorMessage = '';
|
|
675
679
|
if (_isDayBookingProduct || isGeneral) {
|
|
676
|
-
var _item$
|
|
677
|
-
resourceItem = getResourceItem(item === null || item === void 0 || (_item$
|
|
680
|
+
var _item$_extend19;
|
|
681
|
+
resourceItem = getResourceItem(item === null || item === void 0 || (_item$_extend19 = item._extend) === null || _item$_extend19 === void 0 ? void 0 : _item$_extend19.resource, state);
|
|
678
682
|
errorMessage = getErrorMessage(item, resourceItem, isDayBooking(state));
|
|
679
683
|
}
|
|
680
684
|
var generalParams = isGeneral ? getGeneralParams(item, state, !!isParallelResource) : {};
|
|
@@ -684,26 +688,26 @@ export var formatProducts = function formatProducts(lists, state) {
|
|
|
684
688
|
name: item === null || item === void 0 ? void 0 : item.title,
|
|
685
689
|
title: item === null || item === void 0 ? void 0 : item.title,
|
|
686
690
|
// 购物车显示需要 title 字段
|
|
687
|
-
price: item === null || item === void 0 || (_item$
|
|
691
|
+
price: item === null || item === void 0 || (_item$_extend20 = item._extend) === null || _item$_extend20 === void 0 ? void 0 : _item$_extend20.price,
|
|
688
692
|
totalDifference: getProductDiscountProductDiscountDifference(item),
|
|
689
|
-
total: calcAddTimeTotalPrice(item === null || item === void 0 || (_item$
|
|
690
|
-
origin_total: calcAddTimeTotalPrice(item === null || item === void 0 || (_item$
|
|
693
|
+
total: calcAddTimeTotalPrice(item === null || item === void 0 || (_item$_extend21 = item._extend) === null || _item$_extend21 === void 0 ? void 0 : _item$_extend21.total, item === null || item === void 0 || (_item$_extend22 = item._extend) === null || _item$_extend22 === void 0 ? void 0 : _item$_extend22.relation_details),
|
|
694
|
+
origin_total: calcAddTimeTotalPrice(item === null || item === void 0 || (_item$_extend23 = item._extend) === null || _item$_extend23 === void 0 ? void 0 : _item$_extend23.origin_total, item === null || item === void 0 || (_item$_extend24 = item._extend) === null || _item$_extend24 === void 0 ? void 0 : _item$_extend24.relation_details),
|
|
691
695
|
num: item === null || item === void 0 ? void 0 : item._extend.quantity,
|
|
692
696
|
image: item === null || item === void 0 ? void 0 : item.cover,
|
|
693
697
|
isShowNote: true,
|
|
694
|
-
note: (item === null || item === void 0 ? void 0 : item.note) || (item === null || item === void 0 || (_item$
|
|
695
|
-
like_status: item === null || item === void 0 || (_item$
|
|
698
|
+
note: (item === null || item === void 0 ? void 0 : item.note) || (item === null || item === void 0 || (_item$_extend25 = item._extend) === null || _item$_extend25 === void 0 ? void 0 : _item$_extend25.note),
|
|
699
|
+
like_status: item === null || item === void 0 || (_item$_extend26 = item._extend) === null || _item$_extend26 === void 0 ? void 0 : _item$_extend26.like_status,
|
|
696
700
|
bundle: bundle,
|
|
697
701
|
options: options,
|
|
698
702
|
errorMessage: errorMessage,
|
|
699
|
-
product_option_string: item === null || item === void 0 || (_item$
|
|
700
|
-
discount_reason: item === null || item === void 0 || (_item$
|
|
701
|
-
resource_id: isNormalProduct ? 0 : item === null || item === void 0 || (_item$
|
|
703
|
+
product_option_string: item === null || item === void 0 || (_item$_extend27 = item._extend) === null || _item$_extend27 === void 0 || (_item$_extend27 = _item$_extend27.other) === null || _item$_extend27 === void 0 ? void 0 : _item$_extend27.product_option_string,
|
|
704
|
+
discount_reason: item === null || item === void 0 || (_item$_extend28 = item._extend) === null || _item$_extend28 === void 0 ? void 0 : _item$_extend28.discount_reason,
|
|
705
|
+
resource_id: isNormalProduct ? 0 : item === null || item === void 0 || (_item$_extend29 = item._extend) === null || _item$_extend29 === void 0 ? void 0 : _item$_extend29.resource,
|
|
702
706
|
relation_form_name: isNormalProduct ? '' : ((_resourceItem = resourceItem) === null || _resourceItem === void 0 ? void 0 : _resourceItem.labelText) || item.relation_form_name,
|
|
703
707
|
holder_title: clientTitle,
|
|
704
|
-
start_date: !isNormalProduct ? item === null || item === void 0 || (_item$
|
|
705
|
-
end_date: !isNormalProduct ? item === null || item === void 0 || (_item$
|
|
706
|
-
holder_id: (item === null || item === void 0 || (_item$
|
|
708
|
+
start_date: !isNormalProduct ? item === null || item === void 0 || (_item$_extend30 = item._extend) === null || _item$_extend30 === void 0 ? void 0 : _item$_extend30.start_date : '',
|
|
709
|
+
end_date: !isNormalProduct ? item === null || item === void 0 || (_item$_extend31 = item._extend) === null || _item$_extend31 === void 0 ? void 0 : _item$_extend31.end_date : '',
|
|
710
|
+
holder_id: (item === null || item === void 0 || (_item$_extend32 = item._extend) === null || _item$_extend32 === void 0 ? void 0 : _item$_extend32.holder_id) || 0,
|
|
707
711
|
isNormalProduct: isNormalProduct,
|
|
708
712
|
isCustomItem: item === null || item === void 0 ? void 0 : item.isCustomItem,
|
|
709
713
|
// 添加自定义商品标识
|
|
@@ -711,8 +715,8 @@ export var formatProducts = function formatProducts(lists, state) {
|
|
|
711
715
|
// 是否适用优惠券/折扣
|
|
712
716
|
locale: state.locale,
|
|
713
717
|
symbol: state.amountSymbol,
|
|
714
|
-
relation_products: (item === null || item === void 0 || (_item$
|
|
715
|
-
items: isEventBooking(state) ? [] : formItems((item === null || item === void 0 || (_item$
|
|
718
|
+
relation_products: (item === null || item === void 0 || (_item$_extend33 = item._extend) === null || _item$_extend33 === void 0 ? void 0 : _item$_extend33.relation_details) || [],
|
|
719
|
+
items: isEventBooking(state) ? [] : formItems((item === null || item === void 0 || (_item$_extend34 = item._extend) === null || _item$_extend34 === void 0 ? void 0 : _item$_extend34.items) || [])
|
|
716
720
|
}, generalParams), {}, {
|
|
717
721
|
_origin: item
|
|
718
722
|
});
|
|
@@ -726,15 +730,15 @@ export var formatProducts = function formatProducts(lists, state) {
|
|
|
726
730
|
|
|
727
731
|
// 将商品分为组商品和非组商品,并记录索引
|
|
728
732
|
lists.forEach(function (item, index) {
|
|
729
|
-
var _item$
|
|
730
|
-
if (!(item !== null && item !== void 0 && (_item$
|
|
733
|
+
var _item$_extend35;
|
|
734
|
+
if (!(item !== null && item !== void 0 && (_item$_extend35 = item._extend) !== null && _item$_extend35 !== void 0 && _item$_extend35.groupId)) {
|
|
731
735
|
normalItemsWithIndex.push({
|
|
732
736
|
item: item,
|
|
733
737
|
index: index
|
|
734
738
|
});
|
|
735
739
|
} else {
|
|
736
|
-
var _item$
|
|
737
|
-
var groupId = item === null || item === void 0 || (_item$
|
|
740
|
+
var _item$_extend36;
|
|
741
|
+
var groupId = item === null || item === void 0 || (_item$_extend36 = item._extend) === null || _item$_extend36 === void 0 ? void 0 : _item$_extend36.groupId;
|
|
738
742
|
groupItemsWithIndex.push({
|
|
739
743
|
item: item,
|
|
740
744
|
index: index
|
|
@@ -748,9 +752,9 @@ export var formatProducts = function formatProducts(lists, state) {
|
|
|
748
752
|
|
|
749
753
|
// 根据item._extend.groupId 进行分组
|
|
750
754
|
var groups = groupItemsWithIndex.reduce(function (prev, _ref11) {
|
|
751
|
-
var _item$
|
|
755
|
+
var _item$_extend37;
|
|
752
756
|
var item = _ref11.item;
|
|
753
|
-
var groupId = item === null || item === void 0 || (_item$
|
|
757
|
+
var groupId = item === null || item === void 0 || (_item$_extend37 = item._extend) === null || _item$_extend37 === void 0 ? void 0 : _item$_extend37.groupId;
|
|
754
758
|
if (!prev[groupId]) {
|
|
755
759
|
prev[groupId] = [];
|
|
756
760
|
}
|
|
@@ -947,8 +951,8 @@ export var isHasDayAppointmentProduct = function isHasDayAppointmentProduct(stat
|
|
|
947
951
|
// 如果该购物车中没选择任何商品,则不需要验证,所以直接用1来填充
|
|
948
952
|
// services: !holderProducts?.length ? [1] : holderProducts?.filter((d: any) => appointmentTypes.includes(d.extension_type))
|
|
949
953
|
services: services.filter(function (item) {
|
|
950
|
-
var _item$
|
|
951
|
-
return ((_item$
|
|
954
|
+
var _item$_extend38;
|
|
955
|
+
return ((_item$_extend38 = item._extend) === null || _item$_extend38 === void 0 ? void 0 : _item$_extend38.holder_id) == d.form_record_id && checkType(item.extension_type);
|
|
952
956
|
})
|
|
953
957
|
});
|
|
954
958
|
});
|
|
@@ -41,20 +41,19 @@ import { editSessionProduct } from "../../../info/utils";
|
|
|
41
41
|
import { deleteCacheParams, getDays, getProductOriginTotalPrice, getProductTotalPrice, getServiceTimes, isSessionProduct, isWalkIn } from "../../../utils";
|
|
42
42
|
import { getErrorList, getIsNoSpecAndPackage } from "../../utilsByBooking";
|
|
43
43
|
import { formatResources, getDurationProps, getFlexibleOption, getMultiDay, getTimeObj, setDefaultCapacitys } from "../addService/utils";
|
|
44
|
-
import { getProductAllDiscountList,
|
|
44
|
+
import { getProductAllDiscountList, mergeBundles, setProductPrice, mergeBundleWithOriginalPrice } from "./utils";
|
|
45
45
|
import NoteModal from "../../../../../plus/noteModal";
|
|
46
46
|
import { DiscountKeyboard } from "../../../../../pro/priceKeyboard";
|
|
47
47
|
import EditTabs from "../../../info/service/editService/EditTabs";
|
|
48
48
|
import BookingList from "../../../info/service/editService/BookingList";
|
|
49
49
|
import dayjs from "dayjs";
|
|
50
50
|
import { createBookingItemsByGroup, getGroupTotalPrice } from "../../../info/service2/Group/utils";
|
|
51
|
-
import useEngineContext from "../../../../../hooks/useEngineContext";
|
|
52
51
|
import { useShopDiscountModule } from "../../../../ticketBooking/hooks/pisellos/useShopDiscountModule";
|
|
53
52
|
import DiscountChangeModal from "./DiscountChangeModal";
|
|
54
53
|
import Decimal from "decimal.js";
|
|
55
54
|
var submitLock = false;
|
|
56
55
|
var Info = function Info(_, ref) {
|
|
57
|
-
var
|
|
56
|
+
var _state$service4, _state$bookingConfig2, _state$bookingConfig3, _state$service$cacheI5, _state$service$cacheI7, _state$service6, _window$BaseMaterials, _state$service8, _state$service$cacheI12, _state$bookingConfig5, _state$service$cacheI13, _state$service$cacheI14, _state$service9, _state$service$resour2, _state$service$cacheI16, _state$service$cacheI17, _state$client2;
|
|
58
57
|
var _Form$useForm = Form.useForm(),
|
|
59
58
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
60
59
|
form = _Form$useForm2[0];
|
|
@@ -90,9 +89,6 @@ var Info = function Info(_, ref) {
|
|
|
90
89
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
91
90
|
currentTab = _useState8[0],
|
|
92
91
|
setCurrentTab = _useState8[1];
|
|
93
|
-
var context = useEngineContext();
|
|
94
|
-
var _context$appHelper$ut = (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils,
|
|
95
|
-
getData = _context$appHelper$ut.getData;
|
|
96
92
|
var valuesRef = useRef({});
|
|
97
93
|
var noInOriginalDiscountIdsRef = useRef([]);
|
|
98
94
|
|
|
@@ -327,9 +323,7 @@ var Info = function Info(_, ref) {
|
|
|
327
323
|
submitLock = false;
|
|
328
324
|
}, 1500);
|
|
329
325
|
var _list = _toConsumableArray(state.service.value);
|
|
330
|
-
var _item = _objectSpread(_objectSpread({
|
|
331
|
-
is_price_include_tax: getData('is_price_include_tax')
|
|
332
|
-
}, cacheItem !== null && cacheItem !== void 0 ? cacheItem : state.service.cacheItem), {}, {
|
|
326
|
+
var _item = _objectSpread(_objectSpread({}, cacheItem !== null && cacheItem !== void 0 ? cacheItem : state.service.cacheItem), {}, {
|
|
333
327
|
autoClose: false
|
|
334
328
|
});
|
|
335
329
|
var _extend = _objectSpread(_objectSpread({}, _item._extend), {}, {
|
|
@@ -693,7 +687,9 @@ var Info = function Info(_, ref) {
|
|
|
693
687
|
},
|
|
694
688
|
isOS: isSession,
|
|
695
689
|
customer_id: (_state$client = state.client) === null || _state$client === void 0 || (_state$client = _state$client.value) === null || _state$client === void 0 ? void 0 : _state$client.id,
|
|
696
|
-
value: _objectSpread(_objectSpread(_objectSpread({}, item._extend.other),
|
|
690
|
+
value: _objectSpread(_objectSpread(_objectSpread({}, item._extend.other), {}, {
|
|
691
|
+
bundle: mergeBundles(item._extend.other)
|
|
692
|
+
}, sessionValue), {}, {
|
|
697
693
|
quantity: values.quantity || item._extend.quantity
|
|
698
694
|
})
|
|
699
695
|
},
|
|
@@ -1229,6 +1225,8 @@ var Info = function Info(_, ref) {
|
|
|
1229
1225
|
var _cacheItem$_extend$ot, _cacheItem$_extend$ot2;
|
|
1230
1226
|
delete cacheItem.discount_list;
|
|
1231
1227
|
(_cacheItem$_extend$ot = cacheItem._extend.other) === null || _cacheItem$_extend$ot === void 0 || (_cacheItem$_extend$ot = _cacheItem$_extend$ot.bundle) === null || _cacheItem$_extend$ot === void 0 || (_cacheItem$_extend$ot2 = _cacheItem$_extend$ot.forEach) === null || _cacheItem$_extend$ot2 === void 0 || _cacheItem$_extend$ot2.call(_cacheItem$_extend$ot, function (bundle) {
|
|
1228
|
+
var _bundle$metadata;
|
|
1229
|
+
bundle === null || bundle === void 0 || (_bundle$metadata = bundle.metadata) === null || _bundle$metadata === void 0 || delete _bundle$metadata.custom_product_bundle_map_id;
|
|
1232
1230
|
bundle === null || bundle === void 0 || delete bundle.discount_list;
|
|
1233
1231
|
bundle === null || bundle === void 0 || delete bundle.booking_id;
|
|
1234
1232
|
bundle === null || bundle === void 0 || delete bundle.bundle_selling_price;
|
|
@@ -32,6 +32,7 @@ export declare const setProductPrice: (cacheItem: any, { newTotal, origin_total
|
|
|
32
32
|
* @returns 折扣列表
|
|
33
33
|
*/
|
|
34
34
|
export declare const getProductAllDiscountList: (cacheItem: any) => any;
|
|
35
|
+
export declare const mergeBundles: (other: any) => any[];
|
|
35
36
|
/**
|
|
36
37
|
* 合并 bundle 数据,基于 id 和 product_id 匹配,price 优先使用 originalOther 中的值
|
|
37
38
|
* @param other - callback 返回的新数据
|
|
@@ -149,6 +149,22 @@ export var getProductAllDiscountList = function getProductAllDiscountList(cacheI
|
|
|
149
149
|
(_discountList = discountList).push.apply(_discountList, _toConsumableArray(bundleDiscountList));
|
|
150
150
|
return discountList;
|
|
151
151
|
};
|
|
152
|
+
export var mergeBundles = function mergeBundles(other) {
|
|
153
|
+
var bundle = (other === null || other === void 0 ? void 0 : other.bundle) || [];
|
|
154
|
+
var newBundle = [];
|
|
155
|
+
bundle.forEach(function (item) {
|
|
156
|
+
var newItem = newBundle.find(function (newItem) {
|
|
157
|
+
return newItem.id === item.id;
|
|
158
|
+
});
|
|
159
|
+
if (newItem) {
|
|
160
|
+
newItem.num += item.num || 1;
|
|
161
|
+
newItem.quantity += item.quantity || 1;
|
|
162
|
+
} else {
|
|
163
|
+
newBundle.push(_objectSpread({}, item));
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
return newBundle;
|
|
167
|
+
};
|
|
152
168
|
|
|
153
169
|
/**
|
|
154
170
|
* 合并 bundle 数据,基于 id 和 product_id 匹配,price 优先使用 originalOther 中的值
|
|
@@ -189,7 +189,7 @@ var Payments = Provider(function (props) {
|
|
|
189
189
|
className: "payment-list-item-surcharge"
|
|
190
190
|
}, "(", locales.getText("pisell2.text.surcharge"), " ", formatAmount(item.service_fee, 2, (state === null || state === void 0 ? void 0 : state.amountSymbol) || "$"), ")") : null, /*#__PURE__*/React.createElement("div", {
|
|
191
191
|
className: "payment-list-item-date"
|
|
192
|
-
}, dayjs(item.payment_time).format("HH:mm YYYY/MM/DD"), /*#__PURE__*/React.createElement("span", {
|
|
192
|
+
}, dayjs(item.payment_time || item.created_at).format("HH:mm YYYY/MM/DD"), /*#__PURE__*/React.createElement("span", {
|
|
193
193
|
className: "payment-list-item-platform-type"
|
|
194
194
|
}, item.platform && locales.getText("pisell2.text.platform.type")(item.platform))))))));
|
|
195
195
|
}
|