@pisell/private-materials 6.6.95 → 6.6.97
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.js +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/components/booking/addons/model.d.ts +10 -1
- package/es/components/booking/components/footer/utils.js +13 -0
- package/es/components/booking/components/voucher/index.js +42 -3
- package/es/components/booking/dashboard/index.js +15 -14
- package/es/components/booking/forms/model.d.ts +10 -1
- package/es/components/booking/info/model.d.ts +10 -1
- package/es/components/booking/info2/service/editService/index.js +31 -11
- package/es/components/booking/info2/service/editService/utils.d.ts +3 -0
- package/es/components/booking/info2/service/editService/utils.js +128 -19
- package/es/components/booking/model.d.ts +9 -1
- package/es/components/booking/notes/model.d.ts +10 -1
- package/es/components/booking/payments/model.d.ts +10 -1
- package/es/components/booking/utils.d.ts +2 -2
- package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/es/components/eftposPay/hooks.d.ts +2 -2
- package/es/components/eftposPay/store/index.d.ts +5 -5
- package/es/components/pay/toC/model.d.ts +9 -1
- package/es/components/schedules/model.d.ts +9 -1
- package/es/components/ticketBooking/utils/index.js +4 -4
- package/es/plus/clinetSearch/Add/index.js +2 -4
- package/es/plus/productSelect/ProductCard/SkuCard/components/Capacity/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/CardMask/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Countdown/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Duration/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Resource/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Stock/index.d.ts +1 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/Time/index.d.ts +1 -1
- package/lib/components/booking/addons/model.d.ts +10 -1
- package/lib/components/booking/components/footer/utils.js +8 -1
- package/lib/components/booking/components/voucher/index.js +43 -3
- package/lib/components/booking/dashboard/index.js +14 -14
- package/lib/components/booking/forms/model.d.ts +10 -1
- package/lib/components/booking/info/model.d.ts +10 -1
- package/lib/components/booking/info2/service/editService/index.js +38 -12
- package/lib/components/booking/info2/service/editService/utils.d.ts +3 -0
- package/lib/components/booking/info2/service/editService/utils.js +94 -12
- package/lib/components/booking/model.d.ts +9 -1
- package/lib/components/booking/notes/model.d.ts +10 -1
- package/lib/components/booking/payments/model.d.ts +10 -1
- package/lib/components/booking/utils.d.ts +2 -2
- package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/lib/components/eftposPay/hooks.d.ts +2 -2
- package/lib/components/eftposPay/store/index.d.ts +5 -5
- package/lib/components/pay/toC/model.d.ts +9 -1
- package/lib/components/schedules/model.d.ts +9 -1
- package/lib/components/ticketBooking/utils/index.js +2 -2
- package/lib/plus/clinetSearch/Add/index.js +0 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Capacity/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/CardMask/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Countdown/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Duration/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Resource/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Stock/index.d.ts +1 -1
- package/lib/plus/productSelect/ProductCard/SkuCard/components/Time/index.d.ts +1 -1
- package/package.json +4 -4
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export interface FormState {
|
|
2
3
|
platform: 'pc' | 'h5' | '' | undefined;
|
|
3
4
|
order: any;
|
|
@@ -29,4 +30,11 @@ export interface PayGroup {
|
|
|
29
30
|
_order: any;
|
|
30
31
|
front_order_uuid?: string;
|
|
31
32
|
}
|
|
32
|
-
export declare const Provider: any, Context:
|
|
33
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
34
|
+
state: FormState;
|
|
35
|
+
} & {
|
|
36
|
+
dispatch: (params: {
|
|
37
|
+
type: string;
|
|
38
|
+
payload: any;
|
|
39
|
+
}) => void;
|
|
40
|
+
}>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { CalendarDataItem, ScheduleItem } from "./type";
|
|
2
3
|
import dayjs from "dayjs";
|
|
3
4
|
export interface FormState {
|
|
@@ -68,4 +69,11 @@ export interface FormState {
|
|
|
68
69
|
};
|
|
69
70
|
setGlobalState: Function | null;
|
|
70
71
|
}
|
|
71
|
-
export declare const Provider: any, Context:
|
|
72
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
73
|
+
state: FormState;
|
|
74
|
+
} & {
|
|
75
|
+
dispatch: (params: {
|
|
76
|
+
type: string;
|
|
77
|
+
payload: any;
|
|
78
|
+
}) => void;
|
|
79
|
+
}>;
|
|
@@ -161,18 +161,18 @@ export var addService = function addService(list, addItem, state, isMultiDay) {
|
|
|
161
161
|
var isSetCount = false;
|
|
162
162
|
value = list.map(function (item) {
|
|
163
163
|
var _item$_extend;
|
|
164
|
-
//
|
|
164
|
+
// 商品券或多次卡已分配到具体商品行,新增数量需另起一行计算。
|
|
165
165
|
var isGoodPassDiscountProduct = (item.discount_list || []).some(function (item) {
|
|
166
|
-
return item.
|
|
166
|
+
return ['good_pass', 'entitlement_pass'].includes(item.tag || item.type);
|
|
167
167
|
});
|
|
168
168
|
var isEdit = item === null || item === void 0 ? void 0 : item.edit;
|
|
169
|
-
//
|
|
169
|
+
// 子商品是否有商品券或多次卡折扣
|
|
170
170
|
var bundleDiscountList = [];
|
|
171
171
|
((item === null || item === void 0 || (_item$_extend = item._extend) === null || _item$_extend === void 0 || (_item$_extend = _item$_extend.other) === null || _item$_extend === void 0 ? void 0 : _item$_extend.bundle) || []).forEach(function (item) {
|
|
172
172
|
bundleDiscountList.push.apply(bundleDiscountList, _toConsumableArray((item === null || item === void 0 ? void 0 : item.discount_list) || []));
|
|
173
173
|
});
|
|
174
174
|
var isGoodPassBundleProduct = bundleDiscountList.some(function (item) {
|
|
175
|
-
return item.
|
|
175
|
+
return ['good_pass', 'entitlement_pass'].includes(item.tag || item.type);
|
|
176
176
|
});
|
|
177
177
|
if (isSameProduct(item, addItem) && !isSetCount && !isGoodPassDiscountProduct && !isEdit && !isGoodPassBundleProduct) {
|
|
178
178
|
var _item$_extend2, _addItem$_extend, _item$_extend3;
|
|
@@ -67,9 +67,7 @@ var AddClient = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
67
67
|
message.info(locales.getText('pisell2.text.add-client.confirm'));
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
_addClient.run(
|
|
71
|
-
sync_voucher_issuance: true
|
|
72
|
-
} : {}), {}, {
|
|
70
|
+
_addClient.run({
|
|
73
71
|
customer: _objectSpread(_objectSpread({
|
|
74
72
|
accepts_marketing: 0,
|
|
75
73
|
register_channel: 'pos',
|
|
@@ -97,7 +95,7 @@ var AddClient = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
97
95
|
country_calling_code: '+61'
|
|
98
96
|
},
|
|
99
97
|
tags: []
|
|
100
|
-
})
|
|
98
|
+
});
|
|
101
99
|
};
|
|
102
100
|
var renderContent = function renderContent() {
|
|
103
101
|
return /*#__PURE__*/React.createElement(Form, {
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import { ProductCardConfig } from '../../type';
|
|
3
3
|
declare const Capacity: ({ props }: {
|
|
4
4
|
props: ProductCardConfig;
|
|
5
|
-
}) => string | number | true |
|
|
5
|
+
}) => string | number | true | JSX.Element | React.ReactFragment | null;
|
|
6
6
|
export default Capacity;
|
|
@@ -3,5 +3,5 @@ import { SkuStatusOverlayConfig } from '../../type';
|
|
|
3
3
|
import './index.less';
|
|
4
4
|
declare const CardMask: ({ props }: {
|
|
5
5
|
props: SkuStatusOverlayConfig;
|
|
6
|
-
}) => string | number | true |
|
|
6
|
+
}) => string | number | true | JSX.Element | React.ReactFragment | null;
|
|
7
7
|
export default CardMask;
|
|
@@ -3,5 +3,5 @@ import { ProductCardConfig } from '../../type';
|
|
|
3
3
|
import './index.less';
|
|
4
4
|
declare const Countdown: ({ props }: {
|
|
5
5
|
props: ProductCardConfig;
|
|
6
|
-
}) => string | number | true |
|
|
6
|
+
}) => string | number | true | JSX.Element | React.ReactFragment | null;
|
|
7
7
|
export default Countdown;
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import { ProductCardConfig } from '../../type';
|
|
3
3
|
declare const Duration: ({ props }: {
|
|
4
4
|
props: ProductCardConfig;
|
|
5
|
-
}) => string | number | true |
|
|
5
|
+
}) => string | number | true | JSX.Element | React.ReactFragment | null;
|
|
6
6
|
export default Duration;
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import { ProductCardConfig } from '../../type';
|
|
3
3
|
declare const Resource: ({ props }: {
|
|
4
4
|
props: ProductCardConfig;
|
|
5
|
-
}) => string | number | true |
|
|
5
|
+
}) => string | number | true | JSX.Element | React.ReactFragment | null;
|
|
6
6
|
export default Resource;
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import { ProductCardConfig } from '../../type';
|
|
3
3
|
declare const Stock: ({ props }: {
|
|
4
4
|
props: ProductCardConfig;
|
|
5
|
-
}) => string | number | true |
|
|
5
|
+
}) => string | number | true | JSX.Element | React.ReactFragment | null;
|
|
6
6
|
export default Stock;
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import { ProductCardConfig } from '../../type';
|
|
3
3
|
declare const Time: ({ props }: {
|
|
4
4
|
props: ProductCardConfig;
|
|
5
|
-
}) => string | number | true |
|
|
5
|
+
}) => string | number | true | JSX.Element | React.ReactFragment | null;
|
|
6
6
|
export default Time;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormState } from "../model";
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
|
+
state: FormState;
|
|
5
|
+
} & {
|
|
6
|
+
dispatch: (params: {
|
|
7
|
+
type: string;
|
|
8
|
+
payload: any;
|
|
9
|
+
}) => void;
|
|
10
|
+
}>;
|
|
@@ -400,7 +400,14 @@ var formatProducts = (item, quantity) => {
|
|
|
400
400
|
});
|
|
401
401
|
const notManualDiscount = discount_list.filter(
|
|
402
402
|
(item2) => item2.type !== "product"
|
|
403
|
-
)
|
|
403
|
+
).map((discount) => {
|
|
404
|
+
var _a2, _b2;
|
|
405
|
+
if (quantity === void 0 || (discount.tag || discount.type) !== "entitlement_pass" || ((_a2 = discount.metadata) == null ? void 0 : _a2.custom_product_bundle_map_id)) {
|
|
406
|
+
return discount;
|
|
407
|
+
}
|
|
408
|
+
const num = Math.min(Number(((_b2 = discount.metadata) == null ? void 0 : _b2.num) ?? item._extend.quantity), quantity);
|
|
409
|
+
return { ...discount, _num: num, metadata: { ...discount.metadata, num } };
|
|
410
|
+
});
|
|
404
411
|
if (item.isCustomItem) {
|
|
405
412
|
item.product_id = 0;
|
|
406
413
|
}
|
|
@@ -87,6 +87,14 @@ var VoucherCard = (props) => {
|
|
|
87
87
|
const { selectCustomer } = (0, import_pisellos.useCustomer)({
|
|
88
88
|
changeCustomerToGlobalState
|
|
89
89
|
});
|
|
90
|
+
(0, import_react.useEffect)(() => {
|
|
91
|
+
var _a2;
|
|
92
|
+
(_a2 = shopDiscount == null ? void 0 : shopDiscount.setEntitlementPassEnabled) == null ? void 0 : _a2.call(shopDiscount, isBooking4Shop);
|
|
93
|
+
return () => {
|
|
94
|
+
var _a3;
|
|
95
|
+
return (_a3 = shopDiscount == null ? void 0 : shopDiscount.setEntitlementPassEnabled) == null ? void 0 : _a3.call(shopDiscount, false);
|
|
96
|
+
};
|
|
97
|
+
}, [shopDiscount, isBooking4Shop]);
|
|
90
98
|
(0, import_ahooks.useDebounceEffect)(
|
|
91
99
|
() => {
|
|
92
100
|
if (isBooking4Shop) {
|
|
@@ -332,12 +340,44 @@ var VoucherCard = (props) => {
|
|
|
332
340
|
};
|
|
333
341
|
const availableData = (0, import_react.useMemo)(() => {
|
|
334
342
|
if (!isBooking4Shop) return [];
|
|
335
|
-
return discountList.filter((item) => !!item.isAvailable).
|
|
336
|
-
|
|
343
|
+
return discountList.filter((item) => !!item.isAvailable).flatMap((discount) => {
|
|
344
|
+
var _a2, _b2, _c2;
|
|
345
|
+
const currentRow = {
|
|
337
346
|
...discount,
|
|
338
|
-
|
|
347
|
+
// 原卡片仍读取 isSelected,历史扣次不代表本次勾选。
|
|
348
|
+
isSelected: discount.tag === "entitlement_pass" && !discount.isDisabled ? !!discount.isSelected && (((_a2 = discount.appliedProductDetails) == null ? void 0 : _a2.length) || 0) > (((_b2 = discount.committedAppliedProductDetails) == null ? void 0 : _b2.length) || 0) : discount.isSelected,
|
|
349
|
+
isDisabled: discount.isDisabled || (discount.tag === "entitlement_pass" ? !discount.isAvailable : discount.isDisabledForProductUsed) || disabled,
|
|
339
350
|
savedAmount: shopDiscount.calcDiscountApplicableProductTotalPrice(discount)
|
|
340
351
|
};
|
|
352
|
+
const committedDetails = discount.tag === "entitlement_pass" ? discount.committedAppliedProductDetails || [] : [];
|
|
353
|
+
if (!committedDetails.length) return [currentRow];
|
|
354
|
+
const historyRow = {
|
|
355
|
+
...discount,
|
|
356
|
+
displayKey: `${discount.id}-last-settlement`,
|
|
357
|
+
isEditMode: true,
|
|
358
|
+
isSelected: true,
|
|
359
|
+
isDisabled: true,
|
|
360
|
+
appliedProductDetails: committedDetails,
|
|
361
|
+
savedAmount: shopDiscount.calcDiscountApplicableProductTotalPrice({
|
|
362
|
+
...discount,
|
|
363
|
+
savedAmount: 0,
|
|
364
|
+
appliedProductDetails: committedDetails
|
|
365
|
+
})
|
|
366
|
+
};
|
|
367
|
+
const currentDetails = (discount.appliedProductDetails || []).slice(committedDetails.length);
|
|
368
|
+
const canApplyToNewProducts = !discount.isDisabled && (((_c2 = discount.applicableProductDetails) == null ? void 0 : _c2.length) || 0) > 0;
|
|
369
|
+
if (!currentDetails.length && !canApplyToNewProducts) return [historyRow];
|
|
370
|
+
return [historyRow, {
|
|
371
|
+
...currentRow,
|
|
372
|
+
displayKey: `${discount.id}-current`,
|
|
373
|
+
isEditMode: false,
|
|
374
|
+
appliedProductDetails: currentDetails,
|
|
375
|
+
savedAmount: shopDiscount.calcDiscountApplicableProductTotalPrice({
|
|
376
|
+
...discount,
|
|
377
|
+
savedAmount: 0,
|
|
378
|
+
appliedProductDetails: currentDetails
|
|
379
|
+
})
|
|
380
|
+
}];
|
|
341
381
|
});
|
|
342
382
|
}, [discountList, isBooking4Shop, disabled]);
|
|
343
383
|
if (!isBooking4Shop) return null;
|
|
@@ -142,22 +142,22 @@ var BookingDashboard = (0, import_react.forwardRef)((props, ref) => {
|
|
|
142
142
|
statistics_time: statisticsTime
|
|
143
143
|
});
|
|
144
144
|
setStatisticData(res);
|
|
145
|
-
calcBookingDataCount();
|
|
145
|
+
calcBookingDataCount(res);
|
|
146
146
|
};
|
|
147
|
-
const calcBookingDataCount = () => {
|
|
147
|
+
const calcBookingDataCount = (currentStatisticData = statisticData) => {
|
|
148
148
|
var _a2, _b2, _c, _d, _e, _f, _g, _h;
|
|
149
|
-
let groupsOnSiteNow =
|
|
150
|
-
let peopleOnSiteNow =
|
|
151
|
-
let totalVisitorsToday = ((_a2 =
|
|
152
|
-
let totalVisitorsTodayChildren = ((_b2 =
|
|
153
|
-
let ongoing = ((_c =
|
|
154
|
-
let ongoingChildren = ((_d =
|
|
155
|
-
let upcoming = ((_e =
|
|
156
|
-
let upcomingChildren = ((_f =
|
|
157
|
-
let overdue =
|
|
158
|
-
let completed = ((_g =
|
|
159
|
-
let completedChildren = ((_h =
|
|
160
|
-
let departed =
|
|
149
|
+
let groupsOnSiteNow = currentStatisticData.groups_today_num || 0;
|
|
150
|
+
let peopleOnSiteNow = currentStatisticData.people_on_site_now_num || (hasTurnstileApp ? 0 : "-");
|
|
151
|
+
let totalVisitorsToday = ((_a2 = currentStatisticData.total_visitors_today) == null ? void 0 : _a2.num) || 0;
|
|
152
|
+
let totalVisitorsTodayChildren = ((_b2 = currentStatisticData.total_visitors_today) == null ? void 0 : _b2.statistics) || [];
|
|
153
|
+
let ongoing = ((_c = currentStatisticData.ongoing_visitors) == null ? void 0 : _c.num) || 0;
|
|
154
|
+
let ongoingChildren = ((_d = currentStatisticData.ongoing_visitors) == null ? void 0 : _d.statistics) || [];
|
|
155
|
+
let upcoming = ((_e = currentStatisticData.upcoming_visitors) == null ? void 0 : _e.num) || 0;
|
|
156
|
+
let upcomingChildren = ((_f = currentStatisticData.upcoming_visitors) == null ? void 0 : _f.statistics) || [];
|
|
157
|
+
let overdue = currentStatisticData.overdue_visitors_num || (hasTurnstileApp ? 0 : "-");
|
|
158
|
+
let completed = ((_g = currentStatisticData.completed_visitors) == null ? void 0 : _g.num) || 0;
|
|
159
|
+
let completedChildren = ((_h = currentStatisticData.completed_visitors) == null ? void 0 : _h.statistics) || [];
|
|
160
|
+
let departed = currentStatisticData.departed_visitors_num || (hasTurnstileApp ? 0 : "-");
|
|
161
161
|
onDataChange == null ? void 0 : onDataChange(
|
|
162
162
|
{
|
|
163
163
|
groupsOnSiteNow,
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormState } from "../model";
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
|
+
state: FormState;
|
|
5
|
+
} & {
|
|
6
|
+
dispatch: (params: {
|
|
7
|
+
type: string;
|
|
8
|
+
payload: any;
|
|
9
|
+
}) => void;
|
|
10
|
+
}>;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormState } from '../model';
|
|
1
3
|
export declare const walkInData: {
|
|
2
4
|
id: number;
|
|
3
5
|
nickname: string;
|
|
4
6
|
};
|
|
5
|
-
export declare const Provider: any, Context:
|
|
7
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
8
|
+
state: FormState;
|
|
9
|
+
} & {
|
|
10
|
+
dispatch: (params: {
|
|
11
|
+
type: string;
|
|
12
|
+
payload: any;
|
|
13
|
+
}) => void;
|
|
14
|
+
}>;
|
|
@@ -92,6 +92,9 @@ var Info = (_, ref) => {
|
|
|
92
92
|
const resourcesRef = (0, import_react.useRef)(null);
|
|
93
93
|
const isChangeTotal = (0, import_react.useRef)(false);
|
|
94
94
|
const shouldReallocateBundlePriceRef = (0, import_react.useRef)(false);
|
|
95
|
+
const isEntitlementPrice = (0, import_utils8.hasEntitlementDiscount)(
|
|
96
|
+
state.service.cacheItem
|
|
97
|
+
);
|
|
95
98
|
const [noteModalOpen, setNoteModalOpen] = (0, import_react.useState)(false);
|
|
96
99
|
const [open, setOpen] = (0, import_react.useState)(false);
|
|
97
100
|
const [currentTab, setCurrentTab] = (0, import_react.useState)("batch_edit");
|
|
@@ -247,7 +250,7 @@ var Info = (_, ref) => {
|
|
|
247
250
|
}
|
|
248
251
|
};
|
|
249
252
|
const onFinish = (values, cacheItem) => {
|
|
250
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2;
|
|
253
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2;
|
|
251
254
|
let isSuccess = (_a2 = resourcesRef.current) == null ? void 0 : _a2.check();
|
|
252
255
|
if (isShowTimeAndResource && !isSuccess) {
|
|
253
256
|
return;
|
|
@@ -281,7 +284,8 @@ var Info = (_, ref) => {
|
|
|
281
284
|
_extend.startDate = startDate;
|
|
282
285
|
_extend.endDate = endDate;
|
|
283
286
|
}
|
|
284
|
-
const
|
|
287
|
+
const isManualPriceChange = isChangeTotal.current && !(0, import_utils8.hasEntitlementDiscount)(_item);
|
|
288
|
+
const shouldReallocatePrice = isManualPriceChange || shouldReallocateBundlePriceRef.current;
|
|
285
289
|
if (shouldReallocatePrice) {
|
|
286
290
|
const discountRatio = new import_decimal.default(values.total).div(_item._extend.origin_total);
|
|
287
291
|
const bundles2 = ((_c2 = _extend == null ? void 0 : _extend.other) == null ? void 0 : _c2.bundle) || [];
|
|
@@ -306,7 +310,9 @@ var Info = (_, ref) => {
|
|
|
306
310
|
_item._time = (/* @__PURE__ */ new Date()).getTime();
|
|
307
311
|
_item._serviceKey = (0, import_utils3.genServiceKey)(_item);
|
|
308
312
|
_item._holderKey = (0, import_utils3.genHolderKey)(_item);
|
|
309
|
-
|
|
313
|
+
const previousItem = _list.find((item) => item._id === _item._id) ?? _list.find((item) => isSameBookingServiceItem(item, _item));
|
|
314
|
+
const isEntitlementQuantityChange = (0, import_utils8.hasEntitlementDiscount)(previousItem) && Number(_item._extend.quantity || 1) !== Number(((_e2 = previousItem == null ? void 0 : previousItem._extend) == null ? void 0 : _e2.quantity) || 1);
|
|
315
|
+
if (!isEntitlementQuantityChange && (((_g2 = (_f2 = _item._extend) == null ? void 0 : _f2.holder_id) == null ? void 0 : _g2.length) > 1 || ((_h2 = _item._extend) == null ? void 0 : _h2.quantity) > 1 && ((_j2 = (_i2 = _item._extend) == null ? void 0 : _i2.holder_id) == null ? void 0 : _j2.length) >= 1)) {
|
|
310
316
|
let holder_ids = _item._extend.holder_id;
|
|
311
317
|
_item._extend.holder_id = holder_ids[0];
|
|
312
318
|
holder_ids = holder_ids.slice(1);
|
|
@@ -325,8 +331,8 @@ var Info = (_, ref) => {
|
|
|
325
331
|
}
|
|
326
332
|
}
|
|
327
333
|
let _id = _item == null ? void 0 : _item._id;
|
|
328
|
-
let groupId = (
|
|
329
|
-
const origin_total = (
|
|
334
|
+
let groupId = (_k2 = _item == null ? void 0 : _item._extend) == null ? void 0 : _k2.groupId;
|
|
335
|
+
const origin_total = (_o2 = (_n2 = (_m2 = (_l2 = _item._extend) == null ? void 0 : _l2.items) == null ? void 0 : _m2[0]) == null ? void 0 : _n2._extend) == null ? void 0 : _o2.origin_total;
|
|
330
336
|
if (groupId) {
|
|
331
337
|
if (shouldReallocatePrice) {
|
|
332
338
|
_item = deleteDiscountList(_item, true);
|
|
@@ -339,7 +345,7 @@ var Info = (_, ref) => {
|
|
|
339
345
|
} else {
|
|
340
346
|
_item = (0, import_utils8.setProductPrice)(_item, {
|
|
341
347
|
newTotal: values.total,
|
|
342
|
-
origin_total: origin_total ?? ((
|
|
348
|
+
origin_total: origin_total ?? ((_p2 = _item._extend) == null ? void 0 : _p2.origin_total)
|
|
343
349
|
});
|
|
344
350
|
const matchById = _list.some((d) => d._id === _id);
|
|
345
351
|
const matchByBooking = !matchById && _list.some((d) => isSameBookingServiceItem(d, _item));
|
|
@@ -348,13 +354,32 @@ var Info = (_, ref) => {
|
|
|
348
354
|
_item = deleteDiscountList(_item, true);
|
|
349
355
|
}
|
|
350
356
|
if (matchById) {
|
|
351
|
-
_list = _list.
|
|
357
|
+
_list = _list.flatMap((d) => {
|
|
358
|
+
if (d._id !== _id) return [d];
|
|
359
|
+
return (0, import_utils8.updateEntitlementQuantity)(
|
|
360
|
+
d,
|
|
361
|
+
{ ..._item, new: 0 }
|
|
362
|
+
).map((item) => ({
|
|
363
|
+
...item,
|
|
364
|
+
_serviceKey: (0, import_utils3.genServiceKey)(item),
|
|
365
|
+
_holderKey: (0, import_utils3.genHolderKey)(item)
|
|
366
|
+
}));
|
|
367
|
+
});
|
|
352
368
|
} else {
|
|
353
369
|
let replaced = false;
|
|
354
370
|
_list = _list.reduce((acc, d) => {
|
|
355
371
|
if (isSameBookingServiceItem(d, _item)) {
|
|
356
372
|
if (!replaced) {
|
|
357
|
-
acc.push(
|
|
373
|
+
acc.push(
|
|
374
|
+
...(0, import_utils8.updateEntitlementQuantity)(
|
|
375
|
+
d,
|
|
376
|
+
{ ..._item, new: 0, _id: d._id }
|
|
377
|
+
).map((item) => ({
|
|
378
|
+
...item,
|
|
379
|
+
_serviceKey: (0, import_utils3.genServiceKey)(item),
|
|
380
|
+
_holderKey: (0, import_utils3.genHolderKey)(item)
|
|
381
|
+
}))
|
|
382
|
+
);
|
|
358
383
|
replaced = true;
|
|
359
384
|
}
|
|
360
385
|
} else {
|
|
@@ -371,7 +396,7 @@ var Info = (_, ref) => {
|
|
|
371
396
|
(0, import_utils6.deleteCacheParams)();
|
|
372
397
|
console.log("_onFinish", _list);
|
|
373
398
|
form.resetFields();
|
|
374
|
-
if (!!((
|
|
399
|
+
if (!!((_q2 = state.service.cacheItem) == null ? void 0 : _q2.new)) {
|
|
375
400
|
window.dispatchEvent(
|
|
376
401
|
new CustomEvent("onAddNewService", {
|
|
377
402
|
detail: {
|
|
@@ -380,7 +405,7 @@ var Info = (_, ref) => {
|
|
|
380
405
|
})
|
|
381
406
|
);
|
|
382
407
|
}
|
|
383
|
-
(
|
|
408
|
+
(_r2 = window.closeBookingEditModal) == null ? void 0 : _r2.call(window);
|
|
384
409
|
_list.sort((a, b) => {
|
|
385
410
|
var _a3, _b3;
|
|
386
411
|
const aHasHolderId = ((_a3 = a._extend) == null ? void 0 : _a3.holder_id) && (Array.isArray(a._extend.holder_id) ? a._extend.holder_id.length > 0 : true);
|
|
@@ -750,7 +775,7 @@ var Info = (_, ref) => {
|
|
|
750
775
|
precision: 2,
|
|
751
776
|
prefix: state.amountSymbol,
|
|
752
777
|
onChange: handleTotalChange,
|
|
753
|
-
disabled: state.channelDisabledEdit,
|
|
778
|
+
disabled: state.channelDisabledEdit || isEntitlementPrice,
|
|
754
779
|
originalValue: ((_f2 = (_e2 = state.service.cacheItem) == null ? void 0 : _e2._extend) == null ? void 0 : _f2.origin_total) || 0,
|
|
755
780
|
placeholder: ((_h2 = (_g2 = state.service.cacheItem) == null ? void 0 : _g2._extend) == null ? void 0 : _h2.origin_total) || "0",
|
|
756
781
|
size: "large",
|
|
@@ -767,7 +792,8 @@ var Info = (_, ref) => {
|
|
|
767
792
|
useTotal,
|
|
768
793
|
(_u = (_t = state.service.cacheItem) == null ? void 0 : _t._extend) == null ? void 0 : _u.origin_total,
|
|
769
794
|
state.amountSymbol,
|
|
770
|
-
state.channelDisabledEdit
|
|
795
|
+
state.channelDisabledEdit,
|
|
796
|
+
isEntitlementPrice
|
|
771
797
|
]);
|
|
772
798
|
const reason = (0, import_react.useMemo)(() => {
|
|
773
799
|
return isReason ? /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 24 }, /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
判断是否需要进入编辑服务页
|
|
9
9
|
*/
|
|
10
|
+
export declare const hasEntitlementDiscount: (item: any) => boolean;
|
|
11
|
+
/** 已提交部分保留原扣次;增加的数量作为新商品交给 OS 重新计算。 */
|
|
12
|
+
export declare const updateEntitlementQuantity: (previous: any, next: any) => any[];
|
|
10
13
|
export declare const getAutoAllocationStorage: (id: string | number) => any;
|
|
11
14
|
export declare const setAutoAllocationStorage: (data: {
|
|
12
15
|
[key: string]: boolean;
|
|
@@ -31,20 +31,100 @@ var utils_exports = {};
|
|
|
31
31
|
__export(utils_exports, {
|
|
32
32
|
getAutoAllocationStorage: () => getAutoAllocationStorage,
|
|
33
33
|
getProductAllDiscountList: () => getProductAllDiscountList,
|
|
34
|
+
hasEntitlementDiscount: () => hasEntitlementDiscount,
|
|
34
35
|
mergeBundleWithOriginalPrice: () => mergeBundleWithOriginalPrice,
|
|
35
36
|
setAutoAllocationStorage: () => setAutoAllocationStorage,
|
|
36
|
-
setProductPrice: () => setProductPrice
|
|
37
|
+
setProductPrice: () => setProductPrice,
|
|
38
|
+
updateEntitlementQuantity: () => updateEntitlementQuantity
|
|
37
39
|
});
|
|
38
40
|
module.exports = __toCommonJS(utils_exports);
|
|
39
41
|
var import_utils = require("@pisell/utils");
|
|
40
|
-
var import_utils2 = require("@pisell/utils");
|
|
41
42
|
var import_decimal = __toESM(require("decimal.js"));
|
|
42
|
-
var
|
|
43
|
+
var import_lodash = require("lodash");
|
|
44
|
+
var import_utils2 = require("../../../components/footer/utils");
|
|
45
|
+
var import_utils3 = require("../../../utils");
|
|
46
|
+
var isEntitlementDiscount = (discount) => ((discount == null ? void 0 : discount.tag) || (discount == null ? void 0 : discount.type)) === "entitlement_pass";
|
|
47
|
+
var getServiceDiscounts = (item) => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
return [
|
|
50
|
+
...(item == null ? void 0 : item.discount_list) || [],
|
|
51
|
+
...(((_b = (_a = item == null ? void 0 : item._extend) == null ? void 0 : _a.other) == null ? void 0 : _b.bundle) || []).flatMap((bundle) => bundle.discount_list || [])
|
|
52
|
+
];
|
|
53
|
+
};
|
|
54
|
+
var hasEntitlementDiscount = (item) => getServiceDiscounts(item).some(isEntitlementDiscount);
|
|
55
|
+
var updateEntitlementQuantity = (previous, next) => {
|
|
56
|
+
var _a, _b, _c, _d;
|
|
57
|
+
const discounts = getServiceDiscounts(previous);
|
|
58
|
+
const persisted = [previous == null ? void 0 : previous.booking_id, previous == null ? void 0 : previous.order_detail_id, (_a = previous == null ? void 0 : previous._extend) == null ? void 0 : _a.order_detail_id].some((value) => Number(value) > 0) || discounts.some((discount) => isEntitlementDiscount(discount) && discount.id);
|
|
59
|
+
const previousQuantity = Number(((_b = previous == null ? void 0 : previous._extend) == null ? void 0 : _b.quantity) || 1);
|
|
60
|
+
const nextQuantity = Number(next._extend.quantity || 1);
|
|
61
|
+
if (!persisted || !hasEntitlementDiscount(previous) || nextQuantity === previousQuantity) {
|
|
62
|
+
return [next];
|
|
63
|
+
}
|
|
64
|
+
if (nextQuantity < previousQuantity) {
|
|
65
|
+
return [{
|
|
66
|
+
...previous,
|
|
67
|
+
_extend: {
|
|
68
|
+
...previous._extend,
|
|
69
|
+
quantity: nextQuantity,
|
|
70
|
+
...Array.isArray(next._extend.holder_id) ? { holder_id: next._extend.holder_id.slice(0, nextQuantity) } : {},
|
|
71
|
+
other: { ...previous._extend.other, quantity: nextQuantity }
|
|
72
|
+
},
|
|
73
|
+
discount_list: (previous.discount_list || []).map((discount) => {
|
|
74
|
+
var _a2, _b2;
|
|
75
|
+
if (!isEntitlementDiscount(discount) || ((_a2 = discount.metadata) == null ? void 0 : _a2.custom_product_bundle_map_id)) return discount;
|
|
76
|
+
const num = Math.min(Number(((_b2 = discount.metadata) == null ? void 0 : _b2.num) ?? previousQuantity), nextQuantity);
|
|
77
|
+
return { ...discount, _num: num, metadata: { ...discount.metadata, num } };
|
|
78
|
+
})
|
|
79
|
+
}];
|
|
80
|
+
}
|
|
81
|
+
const appended = (0, import_lodash.cloneDeep)(next);
|
|
82
|
+
const uid = (0, import_utils.getUniqueId)();
|
|
83
|
+
appended._id = uid;
|
|
84
|
+
appended.booking_id = 0;
|
|
85
|
+
appended.order_detail_id = 0;
|
|
86
|
+
appended.new = 0;
|
|
87
|
+
appended.discount_list = [];
|
|
88
|
+
appended.discount_amount = 0;
|
|
89
|
+
appended.metadata = { ...appended.metadata, unique_identification_number: uid };
|
|
90
|
+
delete appended.metadata.entitlement_source_identity;
|
|
91
|
+
delete appended.metadata.entitlement_source_product_uid;
|
|
92
|
+
if (appended._origin) delete appended._origin.booking_id;
|
|
93
|
+
const extend = appended._extend;
|
|
94
|
+
extend.order_detail_id = 0;
|
|
95
|
+
extend.unique_identification_number = uid;
|
|
96
|
+
extend.quantity = nextQuantity - previousQuantity;
|
|
97
|
+
if (Array.isArray(extend.holder_id)) {
|
|
98
|
+
const holders = extend.holder_id.slice(previousQuantity, nextQuantity);
|
|
99
|
+
extend.holder_id = holders.length ? holders : void 0;
|
|
100
|
+
}
|
|
101
|
+
extend.other = { ...extend.other, quantity: extend.quantity };
|
|
102
|
+
extend.other.bundle = (extend.other.bundle || []).map((bundle) => {
|
|
103
|
+
var _a2, _b2, _c2;
|
|
104
|
+
const price = bundle.original_price ?? ((_c2 = (_b2 = (_a2 = bundle.discount_list) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.discount) == null ? void 0 : _c2.original_amount) ?? bundle.product_price ?? bundle.price;
|
|
105
|
+
const bundleUid = (0, import_utils.getUniqueId)();
|
|
106
|
+
const metadata = { ...bundle.metadata, custom_product_bundle_map_id: bundleUid, unique_identification_number: bundleUid };
|
|
107
|
+
delete metadata.entitlement_source_identity;
|
|
108
|
+
return { ...bundle, _id: bundleUid, price, bundle_selling_price: price, discount_list: [], metadata };
|
|
109
|
+
});
|
|
110
|
+
const mainDiscount = (next.discount_list || []).find((discount) => {
|
|
111
|
+
var _a2, _b2;
|
|
112
|
+
return !((_a2 = discount.metadata) == null ? void 0 : _a2.custom_product_bundle_map_id) && ((_b2 = discount.discount) == null ? void 0 : _b2.original_amount) != null;
|
|
113
|
+
});
|
|
114
|
+
if (mainDiscount && ((_d = (_c = previous == null ? void 0 : previous._extend) == null ? void 0 : _c.other) == null ? void 0 : _d.product_variant_id) === extend.other.product_variant_id) {
|
|
115
|
+
extend.price = Number(mainDiscount.discount.original_amount);
|
|
116
|
+
if (extend.other.product_variant_id) extend.other.price = extend.price;
|
|
117
|
+
}
|
|
118
|
+
extend.main_product_selling_price = (0, import_utils3.getMainPrice)(appended);
|
|
119
|
+
extend.total = (0, import_utils3.getProductTotalPrice)(appended);
|
|
120
|
+
extend.origin_total = extend.total;
|
|
121
|
+
return [previous, appended];
|
|
122
|
+
};
|
|
43
123
|
var getAutoAllocationStorage = (id) => {
|
|
44
124
|
const value = localStorage.getItem("resource-auto-allocation");
|
|
45
125
|
if (value) {
|
|
46
126
|
const valueObj = JSON.parse(value);
|
|
47
|
-
return (0,
|
|
127
|
+
return (0, import_utils.isBoolean)(valueObj[id]) ? valueObj[id] : true;
|
|
48
128
|
}
|
|
49
129
|
return true;
|
|
50
130
|
};
|
|
@@ -58,8 +138,8 @@ var setAutoAllocationStorage = (data) => {
|
|
|
58
138
|
}
|
|
59
139
|
};
|
|
60
140
|
var setProductPrice = (cacheItem, { newTotal, origin_total }) => {
|
|
61
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
62
|
-
if ((
|
|
141
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
142
|
+
if (hasEntitlementDiscount(cacheItem) || ((cacheItem == null ? void 0 : cacheItem.discount_list) || []).some((item) => ["good_pass", "discount_card", "product_discount_card"].includes(
|
|
63
143
|
item.type
|
|
64
144
|
))) {
|
|
65
145
|
return cacheItem;
|
|
@@ -69,16 +149,16 @@ var setProductPrice = (cacheItem, { newTotal, origin_total }) => {
|
|
|
69
149
|
}
|
|
70
150
|
const discountRatio = new import_decimal.default(newTotal).div(new import_decimal.default(origin_total));
|
|
71
151
|
let subTotal = new import_decimal.default(0);
|
|
72
|
-
if (((
|
|
73
|
-
(
|
|
152
|
+
if (((_a = cacheItem._extend.other) == null ? void 0 : _a.bundle) && (0, import_utils.isArr)((_b = cacheItem._extend.other) == null ? void 0 : _b.bundle)) {
|
|
153
|
+
(_d = (_c = cacheItem._extend.other) == null ? void 0 : _c.bundle) == null ? void 0 : _d.forEach((bundle) => {
|
|
74
154
|
const newPrice = new import_decimal.default(bundle.original_price || bundle.price).mul(discountRatio).toDecimalPlaces(2, import_decimal.default.ROUND_DOWN).toNumber();
|
|
75
155
|
const quantity = bundle.num ?? bundle.quantity ?? 1;
|
|
76
156
|
subTotal = subTotal.add(new import_decimal.default(newPrice).mul(quantity));
|
|
77
157
|
bundle.price = newPrice;
|
|
78
158
|
});
|
|
79
159
|
}
|
|
80
|
-
if (((
|
|
81
|
-
(
|
|
160
|
+
if (((_e = cacheItem._extend.other) == null ? void 0 : _e.option) && (0, import_utils.isArr)((_f = cacheItem._extend.other) == null ? void 0 : _f.option)) {
|
|
161
|
+
(_h = (_g = cacheItem._extend.other) == null ? void 0 : _g.option) == null ? void 0 : _h.forEach((option) => {
|
|
82
162
|
const newPrice = new import_decimal.default(option.price).mul(discountRatio).toDecimalPlaces(2, import_decimal.default.ROUND_DOWN).toNumber();
|
|
83
163
|
const quantity = option.num ?? option.quantity ?? 1;
|
|
84
164
|
subTotal = subTotal.add(new import_decimal.default(newPrice).mul(quantity));
|
|
@@ -91,7 +171,7 @@ var setProductPrice = (cacheItem, { newTotal, origin_total }) => {
|
|
|
91
171
|
var getProductAllDiscountList = (cacheItem) => {
|
|
92
172
|
var _a, _b;
|
|
93
173
|
const discountList = [...cacheItem.discount_list || []];
|
|
94
|
-
const bundleDiscountList = (0,
|
|
174
|
+
const bundleDiscountList = (0, import_utils2.getBundleDiscountList)(((_b = (_a = cacheItem._extend) == null ? void 0 : _a.other) == null ? void 0 : _b.bundle) || []) || [];
|
|
95
175
|
discountList.push(...bundleDiscountList);
|
|
96
176
|
return discountList;
|
|
97
177
|
};
|
|
@@ -113,7 +193,9 @@ var mergeBundleWithOriginalPrice = (other, originalOther) => {
|
|
|
113
193
|
0 && (module.exports = {
|
|
114
194
|
getAutoAllocationStorage,
|
|
115
195
|
getProductAllDiscountList,
|
|
196
|
+
hasEntitlementDiscount,
|
|
116
197
|
mergeBundleWithOriginalPrice,
|
|
117
198
|
setAutoAllocationStorage,
|
|
118
|
-
setProductPrice
|
|
199
|
+
setProductPrice,
|
|
200
|
+
updateEntitlementQuantity
|
|
119
201
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export interface FormState {
|
|
2
3
|
amountSymbol: string;
|
|
3
4
|
apis: {
|
|
@@ -109,4 +110,11 @@ export declare const walkInData: {
|
|
|
109
110
|
id: number;
|
|
110
111
|
nickname: string;
|
|
111
112
|
};
|
|
112
|
-
export declare const Provider: any, Context:
|
|
113
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
114
|
+
state: FormState;
|
|
115
|
+
} & {
|
|
116
|
+
dispatch: (params: {
|
|
117
|
+
type: string;
|
|
118
|
+
payload: any;
|
|
119
|
+
}) => void;
|
|
120
|
+
}>;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormState } from "../model";
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
|
+
state: FormState;
|
|
5
|
+
} & {
|
|
6
|
+
dispatch: (params: {
|
|
7
|
+
type: string;
|
|
8
|
+
payload: any;
|
|
9
|
+
}) => void;
|
|
10
|
+
}>;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormState } from "../model";
|
|
3
|
+
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
|
+
state: FormState;
|
|
5
|
+
} & {
|
|
6
|
+
dispatch: (params: {
|
|
7
|
+
type: string;
|
|
8
|
+
payload: any;
|
|
9
|
+
}) => void;
|
|
10
|
+
}>;
|