@pisell/private-materials 6.4.70 → 6.4.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +7 -7
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +7 -7
- package/es/components/booking/addons/model.d.ts +1 -10
- package/es/components/booking/components/footer/amount.js +25 -8
- package/es/components/booking/components/footer/utils.d.ts +7 -0
- package/es/components/booking/components/footer/utils.js +46 -22
- package/es/components/booking/forms/model.d.ts +1 -10
- package/es/components/booking/hooks/useQuotation.js +69 -21
- package/es/components/booking/info/model.d.ts +1 -10
- package/es/components/booking/info/service/Lists.js +1 -1
- package/es/components/booking/info/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info/service/serve.d.ts +14 -0
- package/es/components/booking/info/service/serve.js +22 -1
- package/es/components/booking/info/service2/Group/utils.js +2 -0
- package/es/components/booking/info/service2/utils.d.ts +1 -33
- package/es/components/booking/info/service2/utils.js +75 -29
- package/es/components/booking/info/utils.js +5 -0
- package/es/components/booking/info2/service/addService/index.js +146 -89
- package/es/components/booking/info2/service/addService/utils.d.ts +9 -1
- package/es/components/booking/info2/service/addService/utils.js +78 -9
- package/es/components/booking/info2/service/editService/index.js +235 -55
- package/es/components/booking/info2/utilsByBooking.js +14 -5
- package/es/components/booking/model.d.ts +1 -9
- package/es/components/booking/notes/model.d.ts +1 -10
- package/es/components/booking/payments/model.d.ts +1 -10
- package/es/components/booking/utils.d.ts +9 -1
- package/es/components/booking/utils.js +23 -0
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +2 -2
- package/es/components/pay/toC/model.d.ts +1 -9
- package/es/components/schedules/model.d.ts +1 -9
- package/es/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.d.ts +18 -0
- package/es/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.js +119 -0
- package/es/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.less +0 -0
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +283 -138
- package/es/components/ticketBooking/components/ticketBooking/index.js +14 -11
- package/es/components/ticketBooking/hooks/pisellos/useProducts.js +106 -32
- package/es/components/ticketBooking/utils/index.d.ts +6 -1
- package/es/components/ticketBooking/utils/index.js +21 -3
- package/es/components/wallet/Detail/model.d.ts +1 -13
- package/es/components/wallet/DiscountCard/model.d.ts +1 -14
- package/es/components/wallet/PointCard/model.d.ts +1 -13
- package/es/components/wallet/RechargeableCard/model.d.ts +1 -29
- package/es/components/wallet/Voucher/model.d.ts +1 -13
- package/es/components/wallet/model.d.ts +1 -9
- package/es/pro/multiDayTimeSelect/MultiDayTimeSelect.d.ts +9 -0
- package/es/pro/multiDayTimeSelect/MultiDayTimeSelect.js +355 -0
- package/es/pro/multiDayTimeSelect/MultiDayTimeSelect.less +8 -0
- package/es/pro/multiDayTimeSelect/index.d.ts +3 -0
- package/es/pro/multiDayTimeSelect/index.js +1 -0
- package/es/pro/multiDayTimeSelect/types.d.ts +28 -0
- package/es/pro/multiDayTimeSelect/types.js +1 -0
- package/lib/components/booking/addons/model.d.ts +1 -10
- package/lib/components/booking/components/footer/amount.js +23 -6
- package/lib/components/booking/components/footer/utils.d.ts +7 -0
- package/lib/components/booking/components/footer/utils.js +23 -11
- package/lib/components/booking/forms/model.d.ts +1 -10
- package/lib/components/booking/hooks/useQuotation.js +45 -13
- package/lib/components/booking/info/model.d.ts +1 -10
- package/lib/components/booking/info/service/Lists.js +1 -1
- package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info/service/serve.d.ts +14 -0
- package/lib/components/booking/info/service/serve.js +5 -0
- package/lib/components/booking/info/service2/Group/utils.js +2 -0
- package/lib/components/booking/info/service2/utils.d.ts +1 -33
- package/lib/components/booking/info/service2/utils.js +24 -10
- package/lib/components/booking/info/utils.js +4 -0
- package/lib/components/booking/info2/service/addService/index.js +22 -3
- package/lib/components/booking/info2/service/addService/utils.d.ts +9 -1
- package/lib/components/booking/info2/service/addService/utils.js +47 -9
- package/lib/components/booking/info2/service/editService/index.js +191 -31
- package/lib/components/booking/info2/utilsByBooking.js +19 -8
- package/lib/components/booking/model.d.ts +1 -9
- package/lib/components/booking/notes/model.d.ts +1 -10
- package/lib/components/booking/payments/model.d.ts +1 -10
- package/lib/components/booking/utils.d.ts +9 -1
- package/lib/components/booking/utils.js +15 -0
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +2 -2
- package/lib/components/pay/toC/model.d.ts +1 -9
- package/lib/components/schedules/model.d.ts +1 -9
- package/lib/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.d.ts +18 -0
- package/lib/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.js +118 -0
- package/lib/components/ticketBooking/components/addServiceVariant/MultiDayTimeSelectModal.less +0 -0
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +185 -119
- package/lib/components/ticketBooking/components/ticketBooking/index.js +0 -16
- package/lib/components/ticketBooking/hooks/pisellos/useProducts.js +54 -9
- package/lib/components/ticketBooking/utils/index.d.ts +6 -1
- package/lib/components/ticketBooking/utils/index.js +11 -1
- package/lib/components/wallet/Detail/model.d.ts +1 -13
- package/lib/components/wallet/DiscountCard/model.d.ts +1 -14
- package/lib/components/wallet/PointCard/model.d.ts +1 -13
- package/lib/components/wallet/RechargeableCard/model.d.ts +1 -29
- package/lib/components/wallet/Voucher/model.d.ts +1 -13
- package/lib/components/wallet/model.d.ts +1 -9
- package/lib/pro/multiDayTimeSelect/MultiDayTimeSelect.d.ts +9 -0
- package/lib/pro/multiDayTimeSelect/MultiDayTimeSelect.js +304 -0
- package/lib/pro/multiDayTimeSelect/MultiDayTimeSelect.less +8 -0
- package/lib/pro/multiDayTimeSelect/index.d.ts +3 -0
- package/lib/pro/multiDayTimeSelect/index.js +35 -0
- package/lib/pro/multiDayTimeSelect/types.d.ts +28 -0
- package/lib/pro/multiDayTimeSelect/types.js +17 -0
- package/package.json +4 -4
|
@@ -40,6 +40,7 @@ var import_utils2 = require("@pisell/utils");
|
|
|
40
40
|
var import_materials = require("@pisell/materials");
|
|
41
41
|
var import_serve = require("../info/service/serve");
|
|
42
42
|
var import_decimal = __toESM(require("decimal.js"));
|
|
43
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
43
44
|
var formatBundleItemMap = (product) => {
|
|
44
45
|
return product.bundle_group.reduce((pre, cur) => {
|
|
45
46
|
const curObj = {};
|
|
@@ -70,15 +71,19 @@ var setNewCartValue = (cartValue, newProducts) => {
|
|
|
70
71
|
let isBundleChange = false;
|
|
71
72
|
let isNotFoundBundle = false;
|
|
72
73
|
const notFoundProducts = [];
|
|
74
|
+
const multiDayPricesCache = /* @__PURE__ */ new Map();
|
|
73
75
|
const value = cartValue.map((item) => {
|
|
74
|
-
var _a, _b, _c, _d;
|
|
75
|
-
const
|
|
76
|
+
var _a, _b, _c, _d, _e, _f;
|
|
77
|
+
const itemScheduleDate = ((_a = item._extend) == null ? void 0 : _a.startDate) ? (0, import_dayjs.default)(item._extend.startDate).format("YYYY-MM-DD") : "";
|
|
78
|
+
const newProduct = newProducts.find(
|
|
79
|
+
(newItem2) => newItem2.id === item.product_id && newItem2.schedule_date === itemScheduleDate
|
|
80
|
+
);
|
|
76
81
|
if (!newProduct) {
|
|
77
82
|
return item;
|
|
78
83
|
}
|
|
79
84
|
let isChangePrice = newProduct.price != item.price;
|
|
80
85
|
const bundleItemMap = formatBundleItemMap(newProduct);
|
|
81
|
-
const newBundle = (((
|
|
86
|
+
const newBundle = (((_c = (_b = item._extend) == null ? void 0 : _b.other) == null ? void 0 : _c.bundle) || []).map((bundle) => {
|
|
82
87
|
if (!bundleItemMap[bundle.id]) {
|
|
83
88
|
isNotFoundBundle = true;
|
|
84
89
|
if (!notFoundProducts.some((p) => p._id === bundle._id)) {
|
|
@@ -102,6 +107,24 @@ var setNewCartValue = (cartValue, newProducts) => {
|
|
|
102
107
|
// product_price: bundleItemMap[item.id].product_price,
|
|
103
108
|
};
|
|
104
109
|
});
|
|
110
|
+
if ((_d = item._extend) == null ? void 0 : _d.groupId) {
|
|
111
|
+
if (!multiDayPricesCache.has(item._extend.groupId)) {
|
|
112
|
+
const productPrices = newProducts.filter((p) => p.id === item.product_id);
|
|
113
|
+
const multiDayPrices = {};
|
|
114
|
+
productPrices.forEach((priceItem) => {
|
|
115
|
+
multiDayPrices[priceItem.schedule_date] = {
|
|
116
|
+
total: Number(priceItem.price),
|
|
117
|
+
origin_total: Number(priceItem.price),
|
|
118
|
+
num: 1,
|
|
119
|
+
quotation_id: priceItem.quotation_id || 0,
|
|
120
|
+
start_date: priceItem.schedule_date,
|
|
121
|
+
end_date: (0, import_dayjs.default)(priceItem.schedule_date).add(1, "day").format("YYYY-MM-DD")
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
multiDayPricesCache.set(item._extend.groupId, multiDayPrices);
|
|
125
|
+
}
|
|
126
|
+
item._extend.multiDayPrices = multiDayPricesCache.get(item._extend.groupId);
|
|
127
|
+
}
|
|
105
128
|
if (!isChangePrice) {
|
|
106
129
|
return item;
|
|
107
130
|
} else {
|
|
@@ -119,7 +142,7 @@ var setNewCartValue = (cartValue, newProducts) => {
|
|
|
119
142
|
bundle_edit: isBundleChange ? 1 : item._extend.bundle_edit,
|
|
120
143
|
other: {
|
|
121
144
|
...item._extend.other,
|
|
122
|
-
option: (
|
|
145
|
+
option: (_f = (_e = item._extend) == null ? void 0 : _e.other) == null ? void 0 : _f.option,
|
|
123
146
|
bundle: newBundle
|
|
124
147
|
}
|
|
125
148
|
}
|
|
@@ -145,22 +168,31 @@ var useQuotation = (state, dispatch) => {
|
|
|
145
168
|
cartValueRef.current = state.service.value;
|
|
146
169
|
const getCartQuotation = async (params) => {
|
|
147
170
|
if (!cartValueRef.current.length) return;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
171
|
+
if (!(params == null ? void 0 : params.customer_id)) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const queryData = cartValueRef.current.filter((item) => !item.isCustomItem).map((item) => {
|
|
175
|
+
var _a2;
|
|
176
|
+
return {
|
|
177
|
+
product_id: item.product_id,
|
|
178
|
+
schedule_date: ((_a2 = item._extend) == null ? void 0 : _a2.startDate) ? (0, import_dayjs.default)(item._extend.startDate).format("YYYY-MM-DD") : params == null ? void 0 : params.schedule_date
|
|
179
|
+
// 如果没有商品日期,使用传入的默认日期
|
|
180
|
+
};
|
|
181
|
+
});
|
|
182
|
+
if (!queryData.length) return;
|
|
183
|
+
const data = await (0, import_serve.getNormalAndMultiDayProductPrice)({
|
|
184
|
+
customer_id: params == null ? void 0 : params.customer_id,
|
|
185
|
+
data: queryData
|
|
154
186
|
});
|
|
155
|
-
return data;
|
|
187
|
+
return data.data;
|
|
156
188
|
};
|
|
157
189
|
const currentDate = (0, import_react.useMemo)(() => {
|
|
158
190
|
return state.date.value.format("YYYY-MM-DD");
|
|
159
191
|
}, [state.date.value]);
|
|
160
192
|
const updateCartQuotation = async (params) => {
|
|
161
193
|
const data = await getCartQuotation(params);
|
|
162
|
-
if (!
|
|
163
|
-
const { isChange, value: newCartValue, isNotFoundBundle, notFoundProducts } = setNewCartValue(cartValueRef.current, data
|
|
194
|
+
if (!data || !data.length) return;
|
|
195
|
+
const { isChange, value: newCartValue, isNotFoundBundle, notFoundProducts } = setNewCartValue(cartValueRef.current, data);
|
|
164
196
|
if (isNotFoundBundle) {
|
|
165
197
|
setProducts(notFoundProducts);
|
|
166
198
|
setOpen(true);
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { FormState } from '../model';
|
|
3
1
|
export declare const walkInData: {
|
|
4
2
|
id: number;
|
|
5
3
|
nickname: string;
|
|
6
4
|
};
|
|
7
|
-
export declare const Provider:
|
|
8
|
-
state: FormState;
|
|
9
|
-
} & {
|
|
10
|
-
dispatch: (params: {
|
|
11
|
-
type: string;
|
|
12
|
-
payload: any;
|
|
13
|
-
}) => void;
|
|
14
|
-
}>;
|
|
5
|
+
export declare const Provider: any, Context: any;
|
|
@@ -109,7 +109,7 @@ var Lists = ({ onEdit, onChange, onAction, isParallelResource }) => {
|
|
|
109
109
|
const p = (0, import_utils.formatProducts)(
|
|
110
110
|
((_a2 = state == null ? void 0 : state.service) == null ? void 0 : _a2.value) || [],
|
|
111
111
|
state,
|
|
112
|
-
|
|
112
|
+
true,
|
|
113
113
|
true,
|
|
114
114
|
isParallelResource
|
|
115
115
|
);
|
|
@@ -18,3 +18,17 @@ export declare const getProductPrice: (params: {
|
|
|
18
18
|
customer_id: number;
|
|
19
19
|
schedule_date: string;
|
|
20
20
|
}) => Promise<any>;
|
|
21
|
+
declare type MultiDayProductPriceParams = {
|
|
22
|
+
customer_id: number;
|
|
23
|
+
data: {
|
|
24
|
+
product_id: number;
|
|
25
|
+
schedule_date: string;
|
|
26
|
+
}[];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* 获取普通商品和跨日预约的价格
|
|
30
|
+
* @param params
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
export declare const getNormalAndMultiDayProductPrice: (params: MultiDayProductPriceParams) => Promise<any>;
|
|
34
|
+
export {};
|
|
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
// src/components/booking/info/service/serve.ts
|
|
20
20
|
var serve_exports = {};
|
|
21
21
|
__export(serve_exports, {
|
|
22
|
+
getNormalAndMultiDayProductPrice: () => getNormalAndMultiDayProductPrice,
|
|
22
23
|
getProductDetail: () => getProductDetail,
|
|
23
24
|
getProductPrice: () => getProductPrice,
|
|
24
25
|
postMultiDay: () => postMultiDay
|
|
@@ -30,8 +31,12 @@ var postMultiDay = async (id, params) => import_utils.request.getRequest().post(
|
|
|
30
31
|
useCache: true
|
|
31
32
|
});
|
|
32
33
|
var getProductPrice = async (params) => import_utils.request.getRequest().post(`/shop/product/query/price`, params);
|
|
34
|
+
var getNormalAndMultiDayProductPrice = async (params) => {
|
|
35
|
+
return import_utils.request.getRequest().post(`/shop/product/query/shelf/price`, params);
|
|
36
|
+
};
|
|
33
37
|
// Annotate the CommonJS export names for ESM import in node:
|
|
34
38
|
0 && (module.exports = {
|
|
39
|
+
getNormalAndMultiDayProductPrice,
|
|
35
40
|
getProductDetail,
|
|
36
41
|
getProductPrice,
|
|
37
42
|
postMultiDay
|
|
@@ -31,6 +31,7 @@ module.exports = __toCommonJS(utils_exports);
|
|
|
31
31
|
var import_utils = require("@pisell/utils");
|
|
32
32
|
var import_utils2 = require("../../../utils");
|
|
33
33
|
var import_distributeDiscount = require("../../service/serviceManager/distributeDiscount");
|
|
34
|
+
var import_utils3 = require("../../../../ticketBooking/utils");
|
|
34
35
|
var getGroupTotalPrice = (items) => {
|
|
35
36
|
return items.reduce((prev, next) => {
|
|
36
37
|
prev.duration += next._extend.duration;
|
|
@@ -98,6 +99,7 @@ var createBookingItemsByGroup = (item, isBatchEdit) => {
|
|
|
98
99
|
cacheItem._extend.total = totalPrice;
|
|
99
100
|
cacheItem._extend.origin_total = totalPrice;
|
|
100
101
|
cacheItem._extend.items = void 0;
|
|
102
|
+
cacheItem._serviceKey = (0, import_utils3.genServiceKey)(cacheItem);
|
|
101
103
|
bookings.push(cacheItem);
|
|
102
104
|
}
|
|
103
105
|
if (isBatchEdit) {
|
|
@@ -67,39 +67,7 @@ export declare const genRowKey: (key: string) => string;
|
|
|
67
67
|
* @Author: WangHan
|
|
68
68
|
* @Date: 2024-11-29 17:36
|
|
69
69
|
*/
|
|
70
|
-
export declare const formatProducts: (lists: any[], state: any, isRenderGroup?: boolean, isGeneral?: boolean, isParallelResource?: boolean) =>
|
|
71
|
-
_origin: any;
|
|
72
|
-
id: any;
|
|
73
|
-
_id: any;
|
|
74
|
-
name: any;
|
|
75
|
-
title: any;
|
|
76
|
-
price: any;
|
|
77
|
-
total: number;
|
|
78
|
-
origin_total: number;
|
|
79
|
-
num: any;
|
|
80
|
-
image: any;
|
|
81
|
-
isShowNote: boolean;
|
|
82
|
-
note: any;
|
|
83
|
-
like_status: any;
|
|
84
|
-
bundle: any;
|
|
85
|
-
options: any;
|
|
86
|
-
errorMessage: string;
|
|
87
|
-
product_option_string: any;
|
|
88
|
-
discount_reason: any;
|
|
89
|
-
resource_id: any;
|
|
90
|
-
relation_form_name: any;
|
|
91
|
-
holder_title: any;
|
|
92
|
-
start_date: any;
|
|
93
|
-
end_date: any;
|
|
94
|
-
holder_id: any;
|
|
95
|
-
isNormalProduct: boolean;
|
|
96
|
-
isCustomItem: any;
|
|
97
|
-
vouchersApplicable: any;
|
|
98
|
-
locale: any;
|
|
99
|
-
symbol: any;
|
|
100
|
-
relation_products: any;
|
|
101
|
-
items: any[];
|
|
102
|
-
}[];
|
|
70
|
+
export declare const formatProducts: (lists: any[], state: any, isRenderGroup?: boolean, isGeneral?: boolean, isParallelResource?: boolean) => any[];
|
|
103
71
|
/**
|
|
104
72
|
* @title: 禁用日期
|
|
105
73
|
* @description:
|
|
@@ -518,10 +518,11 @@ var getGeneralParams = (item, state, isParallelResource) => {
|
|
|
518
518
|
];
|
|
519
519
|
}
|
|
520
520
|
const isNormalProduct = isNormalProductByDurationSchedule(item);
|
|
521
|
+
const isMultiDay = (0, import_utils6.isMultiDayProduct)(item);
|
|
521
522
|
return {
|
|
522
523
|
format: ["HH:mm", "HH:mm"],
|
|
523
524
|
show_time: true,
|
|
524
|
-
duration_type: "minutes",
|
|
525
|
+
duration_type: isMultiDay ? "days" : "minutes",
|
|
525
526
|
// 当前可选择holder列表
|
|
526
527
|
holders: formatHolders(holders),
|
|
527
528
|
isShowChangeHolder: !isNormalProduct,
|
|
@@ -546,8 +547,6 @@ var calcAddTimeTotalPrice = (total, addTimeProducts) => {
|
|
|
546
547
|
};
|
|
547
548
|
var formatProducts = (lists, state, isRenderGroup = true, isGeneral, isParallelResource) => {
|
|
548
549
|
if (!(lists == null ? void 0 : lists.length)) return [];
|
|
549
|
-
const normalList = [];
|
|
550
|
-
const groupList = [];
|
|
551
550
|
const formItem = (item) => {
|
|
552
551
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
553
552
|
const _isDayBookingProduct = isDayBookingProduct(item, state);
|
|
@@ -600,17 +599,23 @@ var formatProducts = (lists, state, isRenderGroup = true, isGeneral, isParallelR
|
|
|
600
599
|
_origin: item
|
|
601
600
|
};
|
|
602
601
|
};
|
|
603
|
-
console.log(normalList, "normalList");
|
|
604
602
|
if (isRenderGroup) {
|
|
605
|
-
|
|
606
|
-
|
|
603
|
+
const normalItemsWithIndex = [];
|
|
604
|
+
const groupItemsWithIndex = [];
|
|
605
|
+
const groupFirstIndexMap = {};
|
|
606
|
+
lists.forEach((item, index) => {
|
|
607
|
+
var _a, _b;
|
|
607
608
|
if (!((_a = item == null ? void 0 : item._extend) == null ? void 0 : _a.groupId)) {
|
|
608
|
-
|
|
609
|
+
normalItemsWithIndex.push({ item, index });
|
|
609
610
|
} else {
|
|
610
|
-
|
|
611
|
+
const groupId = (_b = item == null ? void 0 : item._extend) == null ? void 0 : _b.groupId;
|
|
612
|
+
groupItemsWithIndex.push({ item, index });
|
|
613
|
+
if (groupFirstIndexMap[groupId] === void 0) {
|
|
614
|
+
groupFirstIndexMap[groupId] = index;
|
|
615
|
+
}
|
|
611
616
|
}
|
|
612
617
|
});
|
|
613
|
-
|
|
618
|
+
const groups = groupItemsWithIndex.reduce((prev, { item }) => {
|
|
614
619
|
var _a;
|
|
615
620
|
const groupId = (_a = item == null ? void 0 : item._extend) == null ? void 0 : _a.groupId;
|
|
616
621
|
if (!prev[groupId]) {
|
|
@@ -619,7 +624,16 @@ var formatProducts = (lists, state, isRenderGroup = true, isGeneral, isParallelR
|
|
|
619
624
|
prev[groupId].push(item);
|
|
620
625
|
return prev;
|
|
621
626
|
}, {});
|
|
622
|
-
|
|
627
|
+
const mergedGroupItems = Object.entries(groups).map(([groupId, items]) => ({
|
|
628
|
+
item: formItem((0, import_utils3.concatBookings)(items)),
|
|
629
|
+
index: groupFirstIndexMap[groupId]
|
|
630
|
+
}));
|
|
631
|
+
const formattedNormalItems = normalItemsWithIndex.map(({ item, index }) => ({
|
|
632
|
+
item: formItem(item),
|
|
633
|
+
index
|
|
634
|
+
}));
|
|
635
|
+
const allItems = [...mergedGroupItems, ...formattedNormalItems].sort((a, b) => a.index - b.index);
|
|
636
|
+
return allItems.map(({ item }) => item);
|
|
623
637
|
} else {
|
|
624
638
|
return lists == null ? void 0 : lists.map((item) => formItem(item));
|
|
625
639
|
}
|
|
@@ -45,6 +45,7 @@ module.exports = __toCommonJS(utils_exports);
|
|
|
45
45
|
var import_dayjs = __toESM(require("dayjs"));
|
|
46
46
|
var import_utils = require("../utils");
|
|
47
47
|
var import_utils2 = require("../info2/service/addTimeModal/utils");
|
|
48
|
+
var import_utils3 = require("../info2/service/addService/utils");
|
|
48
49
|
var getIsBundleOrCombination = (productDetail) => {
|
|
49
50
|
var _a;
|
|
50
51
|
if ((_a = productDetail == null ? void 0 : productDetail.bundle_group) == null ? void 0 : _a.length) {
|
|
@@ -195,6 +196,9 @@ var isOpenAddTime = (state) => {
|
|
|
195
196
|
return true;
|
|
196
197
|
};
|
|
197
198
|
var isShowAddTime = (state, currentService) => {
|
|
199
|
+
if ((0, import_utils3.isMultiDayProduct)(currentService)) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
198
202
|
if (!isOpenAddTime(state)) {
|
|
199
203
|
return false;
|
|
200
204
|
}
|
|
@@ -49,6 +49,7 @@ var import_utils4 = require("@pisell/utils");
|
|
|
49
49
|
var import_ahooks = require("ahooks");
|
|
50
50
|
var import_utils5 = require("../../../info/service2/utils");
|
|
51
51
|
var import_utils6 = require("../../../../ticketBooking/utils");
|
|
52
|
+
var import_utils7 = require("../../../info/service2/Group/utils");
|
|
52
53
|
var shopList = [
|
|
53
54
|
2886,
|
|
54
55
|
4422,
|
|
@@ -223,7 +224,7 @@ var Info = (props) => {
|
|
|
223
224
|
isOS: isSession,
|
|
224
225
|
customer_id: (_c2 = (_b2 = state.client) == null ? void 0 : _b2.value) == null ? void 0 : _c2.id
|
|
225
226
|
},
|
|
226
|
-
callback: (e, extension_type, detail) => {
|
|
227
|
+
callback: async (e, extension_type, detail) => {
|
|
227
228
|
var _a3, _b3;
|
|
228
229
|
if (lock) {
|
|
229
230
|
return;
|
|
@@ -249,7 +250,10 @@ var Info = (props) => {
|
|
|
249
250
|
},
|
|
250
251
|
new: 1
|
|
251
252
|
};
|
|
252
|
-
|
|
253
|
+
const isMultiDay = (0, import_utils2.isMultiDayProduct)(cacheItem);
|
|
254
|
+
if (isMultiDay) {
|
|
255
|
+
cacheItem._extend.end_date = state.date.value.add(1, "day");
|
|
256
|
+
}
|
|
253
257
|
let _total = (0, import_utils3.getProductTotalPrice)(cacheItem);
|
|
254
258
|
cacheItem._extend.total = _total;
|
|
255
259
|
cacheItem._extend.origin_total = _total;
|
|
@@ -262,7 +266,19 @@ var Info = (props) => {
|
|
|
262
266
|
cacheItem.currentDefaultTime = state.date.value.format("HH:mm");
|
|
263
267
|
}
|
|
264
268
|
cacheItem = (0, import_utils2.getProductExtend)({ cacheItem, state });
|
|
265
|
-
|
|
269
|
+
const getMultiDayCacheItem = async (isConcatBookings) => {
|
|
270
|
+
cacheItem = await (0, import_utils2.getMultiDay)({
|
|
271
|
+
start_date: cacheItem._extend.start_date,
|
|
272
|
+
end_date: cacheItem._extend.end_date,
|
|
273
|
+
state,
|
|
274
|
+
cacheItem
|
|
275
|
+
});
|
|
276
|
+
cacheItem = (0, import_utils7.createBookingItemsByGroup)(cacheItem);
|
|
277
|
+
if (isConcatBookings) {
|
|
278
|
+
cacheItem = (0, import_utils7.concatBookings)(cacheItem);
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
if (state.renderType === "eventBooking" || isMultiDay) {
|
|
266
282
|
cacheItem.autoClose = false;
|
|
267
283
|
}
|
|
268
284
|
if (cacheItem.autoClose) {
|
|
@@ -289,6 +305,9 @@ var Info = (props) => {
|
|
|
289
305
|
});
|
|
290
306
|
} else {
|
|
291
307
|
(_b3 = window.openBookingEditModal) == null ? void 0 : _b3.call(window);
|
|
308
|
+
if (isMultiDay) {
|
|
309
|
+
await getMultiDayCacheItem(true);
|
|
310
|
+
}
|
|
292
311
|
dispatch({
|
|
293
312
|
type: "setService",
|
|
294
313
|
payload: {
|
|
@@ -7,7 +7,7 @@ export declare const getDurationProps: ({ cacheItem, useStartTime, currentResour
|
|
|
7
7
|
type: string;
|
|
8
8
|
value: number;
|
|
9
9
|
};
|
|
10
|
-
locale:
|
|
10
|
+
locale: any;
|
|
11
11
|
slice: any;
|
|
12
12
|
selectProps: {
|
|
13
13
|
size: string;
|
|
@@ -79,6 +79,14 @@ export declare const setDefaultCapacitys: ({ capacitys, cacheItem }: any) => any
|
|
|
79
79
|
* @Date: 2024-09-19 20:23
|
|
80
80
|
*/
|
|
81
81
|
export declare const getResourceByIds: (resourcesOriginMap: any, cacheItem: any, extraParams?: any) => any[];
|
|
82
|
+
/**
|
|
83
|
+
* @title: 是否是跨日商品
|
|
84
|
+
* @description:
|
|
85
|
+
* @param {any} cacheItem
|
|
86
|
+
* @return {*}
|
|
87
|
+
*/
|
|
88
|
+
export declare const isMultiDayProduct: (product: any) => boolean;
|
|
89
|
+
export declare const getMultiDay: ({ start_date, end_date, state, cacheItem, }: any) => Promise<any>;
|
|
82
90
|
/**
|
|
83
91
|
* @title: 预生成服务的 extend
|
|
84
92
|
* @description:
|
|
@@ -32,11 +32,13 @@ __export(utils_exports, {
|
|
|
32
32
|
formatResources: () => formatResources,
|
|
33
33
|
getDurationProps: () => getDurationProps,
|
|
34
34
|
getFlexibleOption: () => getFlexibleOption,
|
|
35
|
+
getMultiDay: () => getMultiDay,
|
|
35
36
|
getProductExtend: () => getProductExtend,
|
|
36
37
|
getResourceByIds: () => getResourceByIds,
|
|
37
38
|
getTimeObj: () => getTimeObj,
|
|
38
39
|
getTimeSlices: () => getTimeSlices,
|
|
39
40
|
getUsableTime: () => getUsableTime,
|
|
41
|
+
isMultiDayProduct: () => isMultiDayProduct,
|
|
40
42
|
setDefaultCapacitys: () => setDefaultCapacitys,
|
|
41
43
|
setDefaultResource: () => setDefaultResource,
|
|
42
44
|
transServiceList: () => transServiceList
|
|
@@ -51,6 +53,8 @@ var import_AlertTriangle = __toESM(require("@pisell/icon/es/AlertTriangle"));
|
|
|
51
53
|
var import_utils3 = require("../editService/utils");
|
|
52
54
|
var import_mock = require("../../../mock");
|
|
53
55
|
var import_lodash = require("lodash");
|
|
56
|
+
var import_utils4 = require("../../../info/service2/utils");
|
|
57
|
+
var import_utils5 = require("../../../info/utils");
|
|
54
58
|
var getUsableTime = (cacheItem) => {
|
|
55
59
|
try {
|
|
56
60
|
let items = [];
|
|
@@ -138,6 +142,7 @@ var getTimeObj = ({
|
|
|
138
142
|
durationProps
|
|
139
143
|
}) => {
|
|
140
144
|
var _a, _b, _c;
|
|
145
|
+
const isMultiDay = isMultiDayProduct(cacheItem);
|
|
141
146
|
const flexibleOption = getFlexibleOption({
|
|
142
147
|
cacheItem,
|
|
143
148
|
useStartTime,
|
|
@@ -148,7 +153,8 @@ var getTimeObj = ({
|
|
|
148
153
|
});
|
|
149
154
|
let obj = (0, import_utils.sliceDayIntoFiveMinutes)(
|
|
150
155
|
(_c = (_b = (_a = state.bookingConfig) == null ? void 0 : _a.config) == null ? void 0 : _b.basic) == null ? void 0 : _c.service_time,
|
|
151
|
-
import_utils2.locales.locale
|
|
156
|
+
import_utils2.locales.locale,
|
|
157
|
+
isMultiDay
|
|
152
158
|
);
|
|
153
159
|
let timeSlices = [...obj.timeSlices];
|
|
154
160
|
let durationSlicesBasedOnTime = [...obj.durationSlicesBasedOnTime];
|
|
@@ -157,7 +163,7 @@ var getTimeObj = ({
|
|
|
157
163
|
}
|
|
158
164
|
if (useDuration && !durationSlicesBasedOnTime.some((d) => d.value === useDuration)) {
|
|
159
165
|
durationSlicesBasedOnTime.unshift({
|
|
160
|
-
label: (0, import_utils.getDiscountTime)(useDuration),
|
|
166
|
+
label: (0, import_utils.getDiscountTime)(useDuration, isMultiDay),
|
|
161
167
|
value: useDuration,
|
|
162
168
|
//@ts-ignore
|
|
163
169
|
disabled: true
|
|
@@ -395,12 +401,44 @@ var getIsAutoClose = (cacheItem) => {
|
|
|
395
401
|
}
|
|
396
402
|
);
|
|
397
403
|
};
|
|
404
|
+
var isMultiDayProduct = (product) => {
|
|
405
|
+
var _a;
|
|
406
|
+
return ((_a = product == null ? void 0 : product.duration) == null ? void 0 : _a.type) === "days";
|
|
407
|
+
};
|
|
408
|
+
var getMultiDay = async ({
|
|
409
|
+
start_date,
|
|
410
|
+
end_date,
|
|
411
|
+
state,
|
|
412
|
+
cacheItem
|
|
413
|
+
}) => {
|
|
414
|
+
let _cacheItem = cacheItem || state.service.cacheItem;
|
|
415
|
+
if (isMultiDayProduct(_cacheItem)) {
|
|
416
|
+
const { multiDayPrices, price } = await (0, import_utils4.updateAppointmentServicePrice)(
|
|
417
|
+
state,
|
|
418
|
+
{
|
|
419
|
+
start_date,
|
|
420
|
+
end_date,
|
|
421
|
+
product_id: _cacheItem.product_id
|
|
422
|
+
}
|
|
423
|
+
);
|
|
424
|
+
_cacheItem._extend.multiDayPrices = (0, import_utils5.getMultiDayPrices)(multiDayPrices || []);
|
|
425
|
+
if (!(multiDayPrices == null ? void 0 : multiDayPrices.length)) {
|
|
426
|
+
_cacheItem._extend.price = price;
|
|
427
|
+
}
|
|
428
|
+
return _cacheItem;
|
|
429
|
+
}
|
|
430
|
+
return _cacheItem;
|
|
431
|
+
};
|
|
398
432
|
var getProductExtend = ({ cacheItem, state, isDisabledTime }) => {
|
|
399
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
433
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
400
434
|
const isNew = cacheItem.new || !cacheItem._extend.endDate;
|
|
401
435
|
let _cacheItem = { ...cacheItem };
|
|
402
436
|
const resourcesOriginMap = state.service.resourcesOriginMap || {};
|
|
403
437
|
_cacheItem._data = {};
|
|
438
|
+
if (isMultiDayProduct(cacheItem)) {
|
|
439
|
+
_cacheItem._extend.holder_id = ((_a = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _a.holder_id) || [];
|
|
440
|
+
_cacheItem._extend.sub_type = "days";
|
|
441
|
+
}
|
|
404
442
|
if (isNew) {
|
|
405
443
|
_cacheItem._data.timeObj = getTimeObj({
|
|
406
444
|
cacheItem,
|
|
@@ -418,7 +456,7 @@ var getProductExtend = ({ cacheItem, state, isDisabledTime }) => {
|
|
|
418
456
|
cacheItem,
|
|
419
457
|
{
|
|
420
458
|
// 此数据用来控制 该商品所展示的资源是自身关联的, 还是全部的
|
|
421
|
-
resourceTab: (
|
|
459
|
+
resourceTab: (_c = (_b = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _b.config) == null ? void 0 : _c.resource_tab,
|
|
422
460
|
resourcesOrigin: state.service.resourcesOrigin
|
|
423
461
|
}
|
|
424
462
|
);
|
|
@@ -444,10 +482,8 @@ var getProductExtend = ({ cacheItem, state, isDisabledTime }) => {
|
|
|
444
482
|
state
|
|
445
483
|
});
|
|
446
484
|
if ((0, import_utils.getDuration)(_cacheItem == null ? void 0 : _cacheItem.duration) === "flexible") {
|
|
447
|
-
_cacheItem._extend.duration = (
|
|
448
|
-
const { startDate, endDate } = (0, import_utils.getServiceTimes)(
|
|
449
|
-
_extend: _cacheItem._extend
|
|
450
|
-
});
|
|
485
|
+
_cacheItem._extend.duration = (_f = (_e = (_d = _cacheItem._data.timeObj) == null ? void 0 : _d.durationSlicesBasedOnTime) == null ? void 0 : _e[0]) == null ? void 0 : _f.value;
|
|
486
|
+
const { startDate, endDate } = (0, import_utils.getServiceTimes)(_cacheItem);
|
|
451
487
|
_cacheItem._extend.endDate = endDate;
|
|
452
488
|
}
|
|
453
489
|
}
|
|
@@ -478,7 +514,7 @@ var getProductExtend = ({ cacheItem, state, isDisabledTime }) => {
|
|
|
478
514
|
{
|
|
479
515
|
extraResources,
|
|
480
516
|
// 此数据用来控制 该商品所展示的资源是自身关联的, 还是全部的
|
|
481
|
-
resourceTab: (
|
|
517
|
+
resourceTab: (_h = (_g = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _g.config) == null ? void 0 : _h.resource_tab,
|
|
482
518
|
resourcesOrigin: state.service.resourcesOrigin
|
|
483
519
|
}
|
|
484
520
|
);
|
|
@@ -518,11 +554,13 @@ var transServiceList = (list) => {
|
|
|
518
554
|
formatResources,
|
|
519
555
|
getDurationProps,
|
|
520
556
|
getFlexibleOption,
|
|
557
|
+
getMultiDay,
|
|
521
558
|
getProductExtend,
|
|
522
559
|
getResourceByIds,
|
|
523
560
|
getTimeObj,
|
|
524
561
|
getTimeSlices,
|
|
525
562
|
getUsableTime,
|
|
563
|
+
isMultiDayProduct,
|
|
526
564
|
setDefaultCapacitys,
|
|
527
565
|
setDefaultResource,
|
|
528
566
|
transServiceList
|