@pisell/private-materials 3.4.72 → 3.4.73
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/Sales/Cart/index.d.ts +1 -1
- package/es/components/Sales/Cart/index.js +18 -3
- package/es/components/Sales/Checkout/utils.js +57 -1
- package/es/components/Sales/Summary/index.d.ts +2 -0
- package/es/components/Sales/Summary/index.js +7 -2
- package/es/components/Sales/Summary/utils.d.ts +10 -3
- package/es/components/Sales/Summary/utils.js +57 -10
- package/es/components/appointmentBooking/components/Cart/Item/Total.d.ts +0 -1
- package/es/components/appointmentBooking/components/Cart/Item/index.js +62 -4
- package/es/components/appointmentBooking/components/Cart/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Deposit/index.d.ts +5 -2
- package/es/components/appointmentBooking/components/Deposit/index.js +9 -4
- package/es/components/appointmentBooking/components/Footer/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +0 -1
- package/es/components/booking/forms/footer.d.ts +0 -1
- package/es/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
- package/es/components/booking/hooks/useClearCart.d.ts +0 -1
- package/es/components/booking/info/dateRange/index.d.ts +0 -1
- package/es/components/eftposPay/app.d.ts +1 -1
- package/es/components/eftposPay/windcave/windcave.d.ts +1 -0
- package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +4 -2
- package/es/components/eventBooking/components/Provider/Cart/Deposit/index.js +4 -1
- package/es/components/eventBooking/components/Provider/Cart/Item/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Cart/Item/index.js +79 -6
- package/es/components/eventBooking/components/Provider/Cart/Item/index.less +7 -6
- package/es/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Cart/index.js +2 -7
- package/es/components/eventBooking/components/Provider/Content/index.less +1 -1
- package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Event/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Footer/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Information/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Resource/index.d.ts +0 -1
- package/es/components/eventBooking/components/Voucher/index.js +1 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +0 -1
- package/es/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +0 -1
- package/es/components/index.d.ts +1 -2
- package/es/components/index.js +1 -2
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +0 -1
- package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
- package/es/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +0 -1
- package/es/components/shoppingCart/hooks/useAddService.d.ts +0 -1
- package/es/components/shoppingCart/hooks/useClearCart.d.ts +0 -1
- package/es/components/subTotal/index.d.ts +2 -0
- package/es/components/subTotal/index.js +42 -20
- package/es/components/workSpaceList/components/Modal/index.d.ts +0 -1
- package/es/plus/orderList/components/HandleActions.d.ts +0 -1
- package/es/plus/orderList/components/QuickFilter.d.ts +0 -1
- package/es/plus/orderList/components/Reset.d.ts +0 -1
- package/es/plus/orderList/components/Toolbar.d.ts +0 -1
- package/es/plus/saasRegister/components/VertifyEmail.d.ts +0 -1
- package/es/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
- package/es/plus/skuOptionsSelection/components/OptionsCard/index.d.ts +0 -1
- package/es/plus/walletPassGallery/components/passList/index.d.ts +0 -1
- package/es/plus/walletPassGallery/components/timelineSection/index.d.ts +0 -1
- package/lib/components/Sales/Cart/index.d.ts +1 -1
- package/lib/components/Sales/Cart/index.js +20 -7
- package/lib/components/Sales/Checkout/utils.js +64 -1
- package/lib/components/Sales/Summary/index.d.ts +2 -0
- package/lib/components/Sales/Summary/index.js +8 -2
- package/lib/components/Sales/Summary/utils.d.ts +10 -3
- package/lib/components/Sales/Summary/utils.js +38 -13
- package/lib/components/appointmentBooking/components/Cart/Item/Total.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Cart/Item/index.js +52 -4
- package/lib/components/appointmentBooking/components/Cart/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Deposit/index.d.ts +5 -2
- package/lib/components/appointmentBooking/components/Deposit/index.js +7 -4
- package/lib/components/appointmentBooking/components/Footer/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +0 -1
- package/lib/components/booking/forms/footer.d.ts +0 -1
- package/lib/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
- package/lib/components/booking/hooks/useClearCart.d.ts +0 -1
- package/lib/components/booking/info/dateRange/index.d.ts +0 -1
- package/lib/components/eftposPay/app.d.ts +1 -1
- package/lib/components/eftposPay/windcave/windcave.d.ts +1 -0
- package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +4 -2
- package/lib/components/eventBooking/components/Provider/Cart/Deposit/index.js +3 -1
- package/lib/components/eventBooking/components/Provider/Cart/Item/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Cart/Item/index.js +77 -5
- package/lib/components/eventBooking/components/Provider/Cart/Item/index.less +7 -6
- package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Cart/index.js +2 -2
- package/lib/components/eventBooking/components/Provider/Content/index.less +1 -1
- package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Event/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Footer/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Information/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Resource/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Voucher/index.js +1 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +0 -1
- package/lib/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +0 -1
- package/lib/components/index.d.ts +1 -2
- package/lib/components/index.js +0 -3
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +0 -1
- package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
- package/lib/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +0 -1
- package/lib/components/shoppingCart/hooks/useAddService.d.ts +0 -1
- package/lib/components/shoppingCart/hooks/useClearCart.d.ts +0 -1
- package/lib/components/subTotal/index.d.ts +2 -0
- package/lib/components/subTotal/index.js +34 -20
- package/lib/components/workSpaceList/components/Modal/index.d.ts +0 -1
- package/lib/plus/orderList/components/HandleActions.d.ts +0 -1
- package/lib/plus/orderList/components/QuickFilter.d.ts +0 -1
- package/lib/plus/orderList/components/Reset.d.ts +0 -1
- package/lib/plus/orderList/components/Toolbar.d.ts +0 -1
- package/lib/plus/saasRegister/components/VertifyEmail.d.ts +0 -1
- package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
- package/lib/plus/skuOptionsSelection/components/OptionsCard/index.d.ts +0 -1
- package/lib/plus/walletPassGallery/components/passList/index.d.ts +0 -1
- package/lib/plus/walletPassGallery/components/timelineSection/index.d.ts +0 -1
- package/package.json +2 -2
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
18
|
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
17
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
28
|
|
|
19
29
|
// src/components/Sales/Checkout/utils.ts
|
|
@@ -25,6 +35,7 @@ __export(utils_exports, {
|
|
|
25
35
|
getFormParams: () => getFormParams
|
|
26
36
|
});
|
|
27
37
|
module.exports = __toCommonJS(utils_exports);
|
|
38
|
+
var import_decimal = __toESM(require("decimal.js"));
|
|
28
39
|
var formatProductOption = (option) => {
|
|
29
40
|
if (!option) {
|
|
30
41
|
return [];
|
|
@@ -57,10 +68,62 @@ var formatProductBundle = (bundle) => {
|
|
|
57
68
|
var formatBookings = (list) => {
|
|
58
69
|
let bookings = [];
|
|
59
70
|
bookings = list.map((item) => {
|
|
60
|
-
|
|
71
|
+
var _a, _b, _c;
|
|
72
|
+
const newOriginData = { ...item._originData || {} };
|
|
73
|
+
const product = (newOriginData == null ? void 0 : newOriginData.product) || {};
|
|
74
|
+
const discount_list = product == null ? void 0 : product.discount_list;
|
|
75
|
+
const main_product_discount = discount_list == null ? void 0 : discount_list.filter(
|
|
76
|
+
(d) => {
|
|
77
|
+
var _a2;
|
|
78
|
+
return !((_a2 = d.metadata) == null ? void 0 : _a2.custom_product_bundle_map_id);
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
if (main_product_discount == null ? void 0 : main_product_discount.length) {
|
|
82
|
+
product.metadata = {
|
|
83
|
+
product_discount_difference: handleProductDiscountDifference([
|
|
84
|
+
main_product_discount
|
|
85
|
+
])
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
console.log("main_product_discount", main_product_discount);
|
|
89
|
+
if ((_a = product == null ? void 0 : product.product_bundle) == null ? void 0 : _a.length) {
|
|
90
|
+
product.product_bundle = (_c = (_b = product == null ? void 0 : product.product_bundle) == null ? void 0 : _b.map) == null ? void 0 : _c.call(_b, (v) => {
|
|
91
|
+
var _a2, _b2, _c2, _d;
|
|
92
|
+
const bundle_item_discount = [];
|
|
93
|
+
(_b2 = (_a2 = item == null ? void 0 : item.selectedBundle) == null ? void 0 : _a2.forEach) == null ? void 0 : _b2.call(_a2, (s) => {
|
|
94
|
+
if ((s == null ? void 0 : s.id) === (v == null ? void 0 : v.bundle_id) && (s == null ? void 0 : s.group_id) === (v == null ? void 0 : v.bundle_group_id) && (s == null ? void 0 : s._bundle_product_id) === (v == null ? void 0 : v.bundle_product_id)) {
|
|
95
|
+
bundle_item_discount.push(...(s == null ? void 0 : s.discount_list) || []);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
console.log("bundle_item_discount", bundle_item_discount);
|
|
99
|
+
const newBundleItem = { ...v || {} };
|
|
100
|
+
if (bundle_item_discount == null ? void 0 : bundle_item_discount.length) {
|
|
101
|
+
newBundleItem.metadata = {
|
|
102
|
+
custom_product_bundle_map_id: (_d = (_c2 = bundle_item_discount == null ? void 0 : bundle_item_discount[0]) == null ? void 0 : _c2.metadata) == null ? void 0 : _d.custom_product_bundle_map_id,
|
|
103
|
+
product_discount_difference: handleProductDiscountDifference(bundle_item_discount)
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
return newBundleItem;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
newOriginData.product = product;
|
|
110
|
+
return newOriginData;
|
|
61
111
|
});
|
|
112
|
+
console.log("bookings>>>>", bookings);
|
|
62
113
|
return bookings;
|
|
63
114
|
};
|
|
115
|
+
var handleProductDiscountDifference = (discount_list) => {
|
|
116
|
+
const product_discount_difference = discount_list == null ? void 0 : discount_list.reduce(
|
|
117
|
+
(pre, cur) => {
|
|
118
|
+
var _a;
|
|
119
|
+
return pre.plus(
|
|
120
|
+
new import_decimal.default(((_a = cur == null ? void 0 : cur.metadata) == null ? void 0 : _a.product_discount_difference) || 0)
|
|
121
|
+
);
|
|
122
|
+
},
|
|
123
|
+
new import_decimal.default(0)
|
|
124
|
+
);
|
|
125
|
+
return product_discount_difference.toNumber();
|
|
126
|
+
};
|
|
64
127
|
var formatValues = (params) => {
|
|
65
128
|
var _a, _b;
|
|
66
129
|
const { state, otherValue, platform, excludeDisabled, extra } = params;
|
|
@@ -40,6 +40,7 @@ var import_Cart = require("../Cart");
|
|
|
40
40
|
var import_utils = require("./utils");
|
|
41
41
|
var import_Init = require("../Init");
|
|
42
42
|
var import_serve = require("./serve");
|
|
43
|
+
var import_useEngineContext = require("../../../hooks/useEngineContext");
|
|
43
44
|
var defaultState = {};
|
|
44
45
|
var SummaryContext = (0, import_react.createContext)(
|
|
45
46
|
void 0
|
|
@@ -47,15 +48,18 @@ var SummaryContext = (0, import_react.createContext)(
|
|
|
47
48
|
var SummaryProvider = ({
|
|
48
49
|
children
|
|
49
50
|
}) => {
|
|
51
|
+
const pisellos = (0, import_useEngineContext.usePisellOS)();
|
|
50
52
|
const { cartData } = (0, import_Cart.useCart)();
|
|
51
53
|
const { initData } = (0, import_Init.useInit)();
|
|
52
54
|
const [isAgreeDepositPolicy, setIsAgreeDepositPolicy] = (0, import_react.useState)(false);
|
|
55
|
+
const summaryModule = pisellos.getModule("summary");
|
|
53
56
|
const summaryData = (0, import_react.useMemo)(() => {
|
|
54
57
|
return (0, import_utils.calculatePriceDetails)(
|
|
55
58
|
(initData == null ? void 0 : initData.shop) || {},
|
|
56
|
-
cartData.cartItems
|
|
59
|
+
cartData.cartItems,
|
|
60
|
+
summaryModule
|
|
57
61
|
);
|
|
58
|
-
}, [cartData.cartItems, initData == null ? void 0 : initData.shop]);
|
|
62
|
+
}, [cartData.cartItems, initData == null ? void 0 : initData.shop, summaryModule]);
|
|
59
63
|
const contextValue = {
|
|
60
64
|
// 商品总价
|
|
61
65
|
subtotal: summaryData.subtotal,
|
|
@@ -64,6 +68,8 @@ var SummaryProvider = ({
|
|
|
64
68
|
taxTitle: summaryData.taxTitle,
|
|
65
69
|
totalTaxFee: summaryData.totalTaxFee,
|
|
66
70
|
isPriceIncludeTax: summaryData.isPriceIncludeTax,
|
|
71
|
+
taxRate: summaryData.taxRate,
|
|
72
|
+
surcharge: summaryData.surcharge,
|
|
67
73
|
deposit: summaryData.deposit,
|
|
68
74
|
isAgreeDepositPolicy,
|
|
69
75
|
setIsAgreeDepositPolicy,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import Decimal from 'decimal.js';
|
|
2
1
|
interface CartItem {
|
|
3
2
|
price: number | string;
|
|
4
3
|
quantity?: number;
|
|
@@ -10,6 +9,8 @@ interface PriceDetail {
|
|
|
10
9
|
taxTitle?: string;
|
|
11
10
|
totalTaxFee?: string;
|
|
12
11
|
isPriceIncludeTax?: 0 | 1;
|
|
12
|
+
taxRate?: number;
|
|
13
|
+
surcharge?: any;
|
|
13
14
|
deposit?: {
|
|
14
15
|
total: string;
|
|
15
16
|
protocols: any[];
|
|
@@ -22,6 +23,12 @@ interface PriceDetail {
|
|
|
22
23
|
* @returns 商品总价字符串,保留2位小数
|
|
23
24
|
*/
|
|
24
25
|
export declare const calculateSubtotal: (items: CartItem[]) => string;
|
|
26
|
+
/**
|
|
27
|
+
* @description: 将购物车数据格式化成summaryModule需要的格式
|
|
28
|
+
* @param {any} items 购物车数据
|
|
29
|
+
* @return {*}
|
|
30
|
+
*/
|
|
31
|
+
export declare const formatCartsToSummaryModule: (items: any[]) => any[];
|
|
25
32
|
/**
|
|
26
33
|
* @title: 单个商品的税费
|
|
27
34
|
* @description:
|
|
@@ -30,14 +37,14 @@ export declare const calculateSubtotal: (items: CartItem[]) => string;
|
|
|
30
37
|
* @return {*}
|
|
31
38
|
* @Author: xiangfeng.xue
|
|
32
39
|
*/
|
|
33
|
-
export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) =>
|
|
40
|
+
export declare const calculateTaxFee: (shopInfo: any, items: CartItem[], summaryModule: any) => any;
|
|
34
41
|
/**
|
|
35
42
|
* 计算所有价格明细
|
|
36
43
|
* @param items - 购物车商品数组
|
|
37
44
|
* @param options - 其他费用配置
|
|
38
45
|
* @returns 价格明细对象
|
|
39
46
|
*/
|
|
40
|
-
export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[]) => PriceDetail;
|
|
47
|
+
export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[], summaryModule: any) => PriceDetail;
|
|
41
48
|
/**
|
|
42
49
|
* @title: 计算定金
|
|
43
50
|
* @param items - 购物车商品数组
|
|
@@ -32,7 +32,8 @@ __export(utils_exports, {
|
|
|
32
32
|
calculateDeposit: () => calculateDeposit,
|
|
33
33
|
calculatePriceDetails: () => calculatePriceDetails,
|
|
34
34
|
calculateSubtotal: () => calculateSubtotal,
|
|
35
|
-
calculateTaxFee: () => calculateTaxFee
|
|
35
|
+
calculateTaxFee: () => calculateTaxFee,
|
|
36
|
+
formatCartsToSummaryModule: () => formatCartsToSummaryModule
|
|
36
37
|
});
|
|
37
38
|
module.exports = __toCommonJS(utils_exports);
|
|
38
39
|
var import_decimal = __toESM(require("decimal.js"));
|
|
@@ -45,25 +46,46 @@ var calculateSubtotal = (items) => {
|
|
|
45
46
|
}, new import_decimal.default(0));
|
|
46
47
|
return subtotal.toFixed(2);
|
|
47
48
|
};
|
|
48
|
-
var
|
|
49
|
+
var formatCartsToSummaryModule = (items) => {
|
|
50
|
+
if (!Array.isArray(items) || !(items == null ? void 0 : items.length)) return [];
|
|
51
|
+
return items.map((item) => {
|
|
52
|
+
const { selectedBundle, selectedOptions, ...rest } = item;
|
|
53
|
+
return {
|
|
54
|
+
...rest,
|
|
55
|
+
bundle: selectedBundle || [],
|
|
56
|
+
option: selectedOptions || []
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
var calculateTaxFee = (shopInfo, items, summaryModule) => {
|
|
49
61
|
if (!(items == null ? void 0 : items.length)) {
|
|
50
62
|
return "0.00";
|
|
51
63
|
}
|
|
52
64
|
const { is_price_include_tax, tax_rate } = shopInfo || {};
|
|
53
65
|
console.log("shopInfo>>>", is_price_include_tax, tax_rate);
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
const subtotal = new import_decimal.default(calculateSubtotal(items));
|
|
67
|
+
const totalTax = summaryModule.getTaxforUtils(
|
|
68
|
+
items,
|
|
69
|
+
{
|
|
70
|
+
tax_rate: Number(tax_rate),
|
|
71
|
+
is_price_include_tax: Number(is_price_include_tax || 0)
|
|
72
|
+
},
|
|
73
|
+
subtotal
|
|
74
|
+
);
|
|
75
|
+
const totalTaxFee = totalTax == null ? void 0 : totalTax.tax;
|
|
60
76
|
return totalTaxFee;
|
|
61
77
|
};
|
|
62
|
-
var calculatePriceDetails = (shopInfo, items) => {
|
|
78
|
+
var calculatePriceDetails = (shopInfo, items, summaryModule) => {
|
|
63
79
|
const subtotal = new import_decimal.default(calculateSubtotal(items));
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
const
|
|
80
|
+
const _carts = formatCartsToSummaryModule(items);
|
|
81
|
+
const surcharge = summaryModule.getSurchargeforUtils(_carts);
|
|
82
|
+
const surchargeFee = new import_decimal.default((surcharge == null ? void 0 : surcharge.surchargeAmount) || 0);
|
|
83
|
+
const totalTaxFee = new import_decimal.default(
|
|
84
|
+
calculateTaxFee(shopInfo, _carts, summaryModule)
|
|
85
|
+
);
|
|
86
|
+
const taxRate = new import_decimal.default((shopInfo == null ? void 0 : shopInfo.tax_rate) || 0).div(100);
|
|
87
|
+
let total = (shopInfo == null ? void 0 : shopInfo.is_price_include_tax) ? subtotal : subtotal.plus(totalTaxFee);
|
|
88
|
+
total = total.plus(surchargeFee);
|
|
67
89
|
const deposit = calculateDeposit(items);
|
|
68
90
|
return {
|
|
69
91
|
subtotal: subtotal.toFixed(2),
|
|
@@ -71,6 +93,8 @@ var calculatePriceDetails = (shopInfo, items) => {
|
|
|
71
93
|
taxTitle: shopInfo == null ? void 0 : shopInfo.tax_title,
|
|
72
94
|
totalTaxFee: totalTaxFee.toFixed(2),
|
|
73
95
|
isPriceIncludeTax: shopInfo == null ? void 0 : shopInfo.is_price_include_tax,
|
|
96
|
+
taxRate: taxRate.toNumber(),
|
|
97
|
+
surcharge,
|
|
74
98
|
deposit
|
|
75
99
|
};
|
|
76
100
|
};
|
|
@@ -104,5 +128,6 @@ var calculateDeposit = (items) => {
|
|
|
104
128
|
calculateDeposit,
|
|
105
129
|
calculatePriceDetails,
|
|
106
130
|
calculateSubtotal,
|
|
107
|
-
calculateTaxFee
|
|
131
|
+
calculateTaxFee,
|
|
132
|
+
formatCartsToSummaryModule
|
|
108
133
|
});
|
|
@@ -36,12 +36,12 @@ var import_react = __toESM(require("react"));
|
|
|
36
36
|
var import_utils = require("@pisell/utils");
|
|
37
37
|
var import_shoppingCart = __toESM(require("../../../../shoppingCart"));
|
|
38
38
|
var import_ContinueButton = __toESM(require("../ContinueButton"));
|
|
39
|
+
var import__ = require("../../../../../index");
|
|
39
40
|
var import_hooks = require("../../../hooks");
|
|
40
41
|
var import_context = require("../../../context");
|
|
41
42
|
var import_hooks2 = require("../../../hooks");
|
|
42
43
|
var import_utils2 = require("../../../utils");
|
|
43
44
|
var import_Voucher = __toESM(require("../../Voucher"));
|
|
44
|
-
var import_Total = __toESM(require("./Total"));
|
|
45
45
|
var import_Deposit = __toESM(require("../../Deposit"));
|
|
46
46
|
var import_utils3 = require("../utils");
|
|
47
47
|
var import_index = require("./index.less");
|
|
@@ -64,8 +64,8 @@ var CartItem = ({ onNext, renderContactInfo }) => {
|
|
|
64
64
|
const { isFormSubject, bookingSubject, isRetailTemplate } = (0, import_hooks2.useAppointmentBookingSetting)();
|
|
65
65
|
const { isLogin } = (0, import_hooks2.useAppointmentBookingLogin)();
|
|
66
66
|
const utils = (0, import_hooks2.contextUtils)();
|
|
67
|
-
const { businessUtils } = utils;
|
|
68
|
-
const { deposit } = summary;
|
|
67
|
+
const { businessUtils, translation } = utils;
|
|
68
|
+
const { taxTitle, totalTaxFee, isPriceIncludeTax, total, deposit } = summary;
|
|
69
69
|
const currentUser = (0, import_react.useMemo)(() => {
|
|
70
70
|
return (0, import_utils2.formatCurrentUser)(utils) || {};
|
|
71
71
|
}, []);
|
|
@@ -178,6 +178,47 @@ var CartItem = ({ onNext, renderContactInfo }) => {
|
|
|
178
178
|
return carts;
|
|
179
179
|
}
|
|
180
180
|
}, [carts, currentSelectedResources, currentStepParams == null ? void 0 : currentStepParams.key, isErrorHolder]);
|
|
181
|
+
const subTotalList = (0, import_react.useMemo)(() => {
|
|
182
|
+
const hideDeposit = (carts == null ? void 0 : carts.length) === 0 || !(deposit == null ? void 0 : deposit.hasDeposit);
|
|
183
|
+
const surcharge = ((summary == null ? void 0 : summary.surcharge) || []).map(
|
|
184
|
+
(d, index) => {
|
|
185
|
+
return {
|
|
186
|
+
key: `custom_surcharge_${index}`,
|
|
187
|
+
label: translation(d == null ? void 0 : d.name),
|
|
188
|
+
value: d.amount
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
return [
|
|
193
|
+
{
|
|
194
|
+
key: "deposit",
|
|
195
|
+
value: deposit == null ? void 0 : deposit.total,
|
|
196
|
+
label: import_utils.locales.getText("pisell2.appointment.deposit"),
|
|
197
|
+
hidden: hideDeposit
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
key: "sub_total",
|
|
201
|
+
value: summary == null ? void 0 : summary.subtotal
|
|
202
|
+
},
|
|
203
|
+
...surcharge,
|
|
204
|
+
{
|
|
205
|
+
key: "tax",
|
|
206
|
+
value: totalTaxFee,
|
|
207
|
+
hidden: Number(totalTaxFee) <= 0,
|
|
208
|
+
tax: {
|
|
209
|
+
rate: Number((summary == null ? void 0 : summary.taxRate) / 100),
|
|
210
|
+
is_price_include_tax: isPriceIncludeTax,
|
|
211
|
+
title: taxTitle
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
key: "custom_total",
|
|
216
|
+
value: total,
|
|
217
|
+
label: import_utils.locales.getText("pisell2.event.total"),
|
|
218
|
+
bold: !!hideDeposit
|
|
219
|
+
}
|
|
220
|
+
];
|
|
221
|
+
}, [total, summary, carts == null ? void 0 : carts.length]);
|
|
181
222
|
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
182
223
|
"div",
|
|
183
224
|
{
|
|
@@ -209,7 +250,14 @@ var CartItem = ({ onNext, renderContactInfo }) => {
|
|
|
209
250
|
onChange: (e, type, key) => handleClickCard(e, type, key)
|
|
210
251
|
}
|
|
211
252
|
)),
|
|
212
|
-
/* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-footer" }, hasGoodPassApp || hasDiscountCardApp ? /* @__PURE__ */ import_react.default.createElement(import_Voucher.default, { currentUser, products: carts }) : null, /* @__PURE__ */ import_react.default.createElement(
|
|
253
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-footer" }, hasGoodPassApp || hasDiscountCardApp ? /* @__PURE__ */ import_react.default.createElement(import_Voucher.default, { currentUser, products: carts }) : null, /* @__PURE__ */ import_react.default.createElement(
|
|
254
|
+
import__.SubTotal,
|
|
255
|
+
{
|
|
256
|
+
list: subTotalList,
|
|
257
|
+
style: { padding: 0 },
|
|
258
|
+
children: !!((carts == null ? void 0 : carts.length) > 0 && (deposit == null ? void 0 : deposit.hasDeposit)) ? /* @__PURE__ */ import_react.default.createElement(import_Deposit.default, { showTitle: false }) : null
|
|
259
|
+
}
|
|
260
|
+
), /* @__PURE__ */ import_react.default.createElement(import_ContinueButton.default, { onNext }))
|
|
213
261
|
));
|
|
214
262
|
};
|
|
215
263
|
var Item_default = CartItem;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import './index.less';
|
|
2
|
+
interface DepositProps {
|
|
3
|
+
showTitle?: boolean;
|
|
4
|
+
}
|
|
3
5
|
export declare const DepositContent: (props: {
|
|
4
6
|
isAgreeDepositPolicy: boolean;
|
|
5
7
|
setIsAgreeDepositPolicy: (value: boolean) => void;
|
|
6
8
|
deposit: any;
|
|
7
9
|
depositProtocolRequest?: any;
|
|
10
|
+
showTitle?: boolean | undefined;
|
|
8
11
|
}) => JSX.Element;
|
|
9
|
-
declare const Deposit: () => JSX.Element;
|
|
12
|
+
declare const Deposit: (props: DepositProps) => JSX.Element;
|
|
10
13
|
export default Deposit;
|
|
@@ -44,16 +44,17 @@ var DepositContent = (props) => {
|
|
|
44
44
|
isAgreeDepositPolicy,
|
|
45
45
|
setIsAgreeDepositPolicy,
|
|
46
46
|
deposit,
|
|
47
|
-
depositProtocolRequest
|
|
47
|
+
depositProtocolRequest,
|
|
48
|
+
showTitle = true
|
|
48
49
|
} = props;
|
|
49
|
-
return /* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-deposit-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-deposit-top" }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell2.appointment.deposit")), /* @__PURE__ */ import_react.default.createElement(
|
|
50
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-deposit-wrap" }, showTitle ? /* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-deposit-top" }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell2.appointment.deposit")), /* @__PURE__ */ import_react.default.createElement(
|
|
50
51
|
import_materials.PisellText.Amount,
|
|
51
52
|
{
|
|
52
53
|
value: deposit == null ? void 0 : deposit.total,
|
|
53
54
|
showCurrencySymbol: true,
|
|
54
55
|
className: "amount"
|
|
55
56
|
}
|
|
56
|
-
)), /* @__PURE__ */ import_react.default.createElement(
|
|
57
|
+
)) : null, /* @__PURE__ */ import_react.default.createElement(
|
|
57
58
|
import_deposit.default,
|
|
58
59
|
{
|
|
59
60
|
total: deposit == null ? void 0 : deposit.total,
|
|
@@ -64,7 +65,8 @@ var DepositContent = (props) => {
|
|
|
64
65
|
}
|
|
65
66
|
));
|
|
66
67
|
};
|
|
67
|
-
var Deposit = () => {
|
|
68
|
+
var Deposit = (props) => {
|
|
69
|
+
const { showTitle = true } = props;
|
|
68
70
|
const {
|
|
69
71
|
setIsAgreeDepositPolicy,
|
|
70
72
|
isAgreeDepositPolicy,
|
|
@@ -79,6 +81,7 @@ var Deposit = () => {
|
|
|
79
81
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
80
82
|
DepositContent,
|
|
81
83
|
{
|
|
84
|
+
showTitle,
|
|
82
85
|
isAgreeDepositPolicy: !!isAgreeDepositPolicy,
|
|
83
86
|
setIsAgreeDepositPolicy,
|
|
84
87
|
deposit,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PosProps, RouteType } from './const';
|
|
2
|
-
declare const App: ({ action, api, device_number, terminal, tyroUrl, tyroVersion, onChangeParams, isMobile, channel, formatAmount, ...props }: Omit<PosProps, "
|
|
2
|
+
declare const App: ({ action, api, device_number, terminal, tyroUrl, tyroVersion, onChangeParams, isMobile, channel, formatAmount, ...props }: Omit<PosProps, "mode" | "type" | "getApi"> & {
|
|
3
3
|
action: RouteType;
|
|
4
4
|
device_number: string | number;
|
|
5
5
|
api: ReturnType<PosProps['getApi']>;
|
|
@@ -35,7 +35,8 @@ module.exports = __toCommonJS(Deposit_exports);
|
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_Sales = require("../../../../../Sales");
|
|
37
37
|
var import_Deposit = require("../../../../../appointmentBooking/components/Deposit");
|
|
38
|
-
var Deposit = () => {
|
|
38
|
+
var Deposit = (props) => {
|
|
39
|
+
const { showTitle = true } = props;
|
|
39
40
|
const {
|
|
40
41
|
deposit,
|
|
41
42
|
isAgreeDepositPolicy,
|
|
@@ -45,6 +46,7 @@ var Deposit = () => {
|
|
|
45
46
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
46
47
|
import_Deposit.DepositContent,
|
|
47
48
|
{
|
|
49
|
+
showTitle,
|
|
48
50
|
isAgreeDepositPolicy: !!isAgreeDepositPolicy,
|
|
49
51
|
setIsAgreeDepositPolicy,
|
|
50
52
|
deposit,
|
|
@@ -38,12 +38,13 @@ var import_shoppingCart = __toESM(require("../../../../../shoppingCart"));
|
|
|
38
38
|
var import_Sales = require("../../../../../Sales");
|
|
39
39
|
var import_SelectHolderModal = __toESM(require("../../SelectHolderModal"));
|
|
40
40
|
var import_ContinueButton = __toESM(require("../ContinueButton"));
|
|
41
|
-
var
|
|
41
|
+
var import__ = require("../../../../../index");
|
|
42
|
+
var import_useEngineContext = __toESM(require("../../../../../../hooks/useEngineContext"));
|
|
42
43
|
var import_Deposit = __toESM(require("../Deposit"));
|
|
43
44
|
var import_Voucher = __toESM(require("../../../Voucher"));
|
|
44
45
|
var import_index = require("./index.less");
|
|
45
46
|
var CartItem = () => {
|
|
46
|
-
var _a;
|
|
47
|
+
var _a, _b;
|
|
47
48
|
const { open, holderData, selectedHolderIds } = (0, import_Sales.useHolder)();
|
|
48
49
|
const {
|
|
49
50
|
deleteCartItem,
|
|
@@ -51,13 +52,23 @@ var CartItem = () => {
|
|
|
51
52
|
cartData,
|
|
52
53
|
addNoteToCartItem
|
|
53
54
|
} = (0, import_Sales.useCart)();
|
|
54
|
-
const {
|
|
55
|
+
const {
|
|
56
|
+
taxTitle,
|
|
57
|
+
taxRate,
|
|
58
|
+
totalTaxFee,
|
|
59
|
+
isPriceIncludeTax,
|
|
60
|
+
total,
|
|
61
|
+
deposit,
|
|
62
|
+
subtotal,
|
|
63
|
+
surcharge
|
|
64
|
+
} = (0, import_Sales.useSummary)();
|
|
55
65
|
const { isLastStep } = (0, import_Sales.useStep)();
|
|
66
|
+
const context = (0, import_useEngineContext.default)();
|
|
67
|
+
const { translation } = ((_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.utils) || {};
|
|
56
68
|
const handleClickCard = (e, type, key) => {
|
|
57
69
|
if (type === "note") {
|
|
58
70
|
return addNoteToCartItem(e);
|
|
59
71
|
}
|
|
60
|
-
console.log(e, type, key, "wh9988767");
|
|
61
72
|
if (type === "delete") {
|
|
62
73
|
return deleteCartItem(e);
|
|
63
74
|
}
|
|
@@ -65,6 +76,60 @@ var CartItem = () => {
|
|
|
65
76
|
return deleteCartItemByHolder(key);
|
|
66
77
|
}
|
|
67
78
|
};
|
|
79
|
+
const showDeposit = (0, import_react.useMemo)(() => {
|
|
80
|
+
var _a2;
|
|
81
|
+
return ((_a2 = cartData == null ? void 0 : cartData.cartItems) == null ? void 0 : _a2.length) > 0 && (deposit == null ? void 0 : deposit.hasDeposit);
|
|
82
|
+
}, [(_b = cartData == null ? void 0 : cartData.cartItems) == null ? void 0 : _b.length, deposit == null ? void 0 : deposit.hasDeposit]);
|
|
83
|
+
const subTotalList = (0, import_react.useMemo)(() => {
|
|
84
|
+
const surchargeList = ((surcharge == null ? void 0 : surcharge.surchargeList) || []).map(
|
|
85
|
+
(d, index) => {
|
|
86
|
+
return {
|
|
87
|
+
key: `custom_surcharge_${index}`,
|
|
88
|
+
label: translation(d == null ? void 0 : d.name),
|
|
89
|
+
value: d.amount
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
return [
|
|
94
|
+
{
|
|
95
|
+
key: "deposit",
|
|
96
|
+
value: deposit == null ? void 0 : deposit.total,
|
|
97
|
+
label: import_utils.locales.getText("pisell2.appointment.deposit"),
|
|
98
|
+
hidden: !showDeposit
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
key: "sub_total",
|
|
102
|
+
value: subtotal
|
|
103
|
+
},
|
|
104
|
+
...surchargeList,
|
|
105
|
+
{
|
|
106
|
+
key: "tax",
|
|
107
|
+
value: totalTaxFee,
|
|
108
|
+
hidden: Number(totalTaxFee) <= 0,
|
|
109
|
+
tax: {
|
|
110
|
+
rate: taxRate,
|
|
111
|
+
is_price_include_tax: isPriceIncludeTax,
|
|
112
|
+
title: taxTitle
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
key: "custom_total",
|
|
117
|
+
value: total,
|
|
118
|
+
label: import_utils.locales.getText("pisell2.event.total"),
|
|
119
|
+
bold: !showDeposit
|
|
120
|
+
}
|
|
121
|
+
];
|
|
122
|
+
}, [
|
|
123
|
+
total,
|
|
124
|
+
subtotal,
|
|
125
|
+
surcharge == null ? void 0 : surcharge.surchargeList,
|
|
126
|
+
deposit == null ? void 0 : deposit.total,
|
|
127
|
+
taxRate,
|
|
128
|
+
isPriceIncludeTax,
|
|
129
|
+
totalTaxFee,
|
|
130
|
+
taxTitle,
|
|
131
|
+
showDeposit
|
|
132
|
+
]);
|
|
68
133
|
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
69
134
|
"div",
|
|
70
135
|
{
|
|
@@ -89,7 +154,14 @@ var CartItem = () => {
|
|
|
89
154
|
onChange: (e, type, key) => handleClickCard(e, type, key)
|
|
90
155
|
}
|
|
91
156
|
)),
|
|
92
|
-
/* @__PURE__ */ import_react.default.createElement("div", { className: "event-footer" }, /* @__PURE__ */ import_react.default.createElement(import_Voucher.default, null), /* @__PURE__ */ import_react.default.createElement(
|
|
157
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "event-footer" }, /* @__PURE__ */ import_react.default.createElement(import_Voucher.default, null), /* @__PURE__ */ import_react.default.createElement(
|
|
158
|
+
import__.SubTotal,
|
|
159
|
+
{
|
|
160
|
+
list: subTotalList,
|
|
161
|
+
style: { padding: 0 },
|
|
162
|
+
children: showDeposit ? /* @__PURE__ */ import_react.default.createElement(import_Deposit.default, { showTitle: false }) : null
|
|
163
|
+
}
|
|
164
|
+
), /* @__PURE__ */ import_react.default.createElement(import_ContinueButton.default, null))
|
|
93
165
|
), /* @__PURE__ */ import_react.default.createElement(import_SelectHolderModal.default, { open }));
|
|
94
166
|
};
|
|
95
167
|
var Item_default = CartItem;
|