@pisell/private-materials 3.3.68 → 3.3.69
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 +3 -3
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +5 -5
- package/es/components/appointmentBooking/components/Cart/Item/index.js +4 -2
- package/es/components/appointmentBooking/components/Services/index.js +25 -32
- package/es/components/appointmentBooking/components/Voucher/index.js +13 -0
- package/es/components/appointmentBooking/deposit/components/PolicyModal/index.js +6 -7
- package/es/components/appointmentBooking/locales.js +3 -3
- package/es/components/booking/addons/index.js +9 -2
- package/es/components/booking/addons/model.js +5 -0
- package/es/components/booking/components/TabProduct/selectProductItem/index.js +3 -1
- package/es/components/booking/components/TabProduct/selectProductItem/index.less +6 -0
- package/es/components/booking/components/footer/index.js +9 -3
- package/es/components/booking/components/footer/utils.js +73 -35
- package/es/components/booking/components/voucher/index.js +110 -66
- package/es/components/booking/components/voucher/utils.d.ts +4 -0
- package/es/components/booking/components/voucher/utils.js +15 -0
- package/es/components/booking/hooks/useQuotation.d.ts +1 -0
- package/es/components/booking/hooks/useQuotation.js +16 -1
- package/es/components/booking/info/service2/utils.d.ts +1 -1
- package/es/components/booking/info/service2/utils.js +6 -2
- package/es/components/booking/info2/index.js +9 -4
- package/es/components/booking/info2/serve.d.ts +1 -1
- package/es/components/booking/info2/serve.js +12 -8
- package/es/components/booking/info2/service/addService/index.js +2 -2
- package/es/components/booking/info2/service/editService/index.js +5 -2
- package/es/components/booking/info2/utils.d.ts +1 -1
- package/es/components/booking/info2/utils.js +3 -2
- package/es/components/booking/info2/utilsByBooking.d.ts +1 -1
- package/es/components/booking/info2/utilsByBooking.js +5 -3
- package/es/components/booking/locales.d.ts +3 -0
- package/es/components/booking/locales.js +6 -3
- package/es/components/booking/utils.d.ts +2 -2
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/device.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/ticketBooking/components/addServiceVariant/addService.js +5 -4
- package/es/components/ticketBooking/components/ticketBooking/index.js +4 -2
- package/es/components/ticketBooking/utils/index.d.ts +5 -1
- package/es/components/ticketBooking/utils/index.js +50 -5
- package/lib/components/appointmentBooking/components/Cart/Item/index.js +5 -4
- package/lib/components/appointmentBooking/components/Services/index.js +6 -14
- package/lib/components/appointmentBooking/components/Voucher/index.js +9 -0
- package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.js +0 -1
- package/lib/components/appointmentBooking/locales.js +3 -3
- package/lib/components/booking/addons/index.js +10 -2
- package/lib/components/booking/addons/model.js +3 -0
- package/lib/components/booking/components/TabProduct/selectProductItem/index.js +5 -1
- package/lib/components/booking/components/TabProduct/selectProductItem/index.less +6 -0
- package/lib/components/booking/components/footer/index.js +10 -5
- package/lib/components/booking/components/footer/utils.js +47 -11
- package/lib/components/booking/components/voucher/index.js +111 -67
- package/lib/components/booking/components/voucher/utils.d.ts +4 -0
- package/lib/components/booking/components/voucher/utils.js +43 -0
- package/lib/components/booking/hooks/useQuotation.d.ts +1 -0
- package/lib/components/booking/hooks/useQuotation.js +19 -1
- package/lib/components/booking/info/service2/utils.d.ts +1 -1
- package/lib/components/booking/info/service2/utils.js +3 -1
- package/lib/components/booking/info2/index.js +9 -9
- package/lib/components/booking/info2/serve.d.ts +1 -1
- package/lib/components/booking/info2/serve.js +1 -1
- package/lib/components/booking/info2/service/addService/index.js +2 -2
- package/lib/components/booking/info2/service/editService/index.js +5 -2
- package/lib/components/booking/info2/utils.d.ts +1 -1
- package/lib/components/booking/info2/utils.js +2 -2
- package/lib/components/booking/info2/utilsByBooking.d.ts +1 -1
- package/lib/components/booking/info2/utilsByBooking.js +3 -2
- package/lib/components/booking/locales.d.ts +3 -0
- package/lib/components/booking/locales.js +6 -3
- package/lib/components/booking/utils.d.ts +2 -2
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/device.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/ticketBooking/components/addServiceVariant/addService.js +5 -3
- package/lib/components/ticketBooking/components/ticketBooking/index.js +4 -2
- package/lib/components/ticketBooking/utils/index.d.ts +5 -1
- package/lib/components/ticketBooking/utils/index.js +44 -4
- package/package.json +2 -2
|
@@ -74,9 +74,7 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
|
|
|
74
74
|
let type = "";
|
|
75
75
|
if (!isRetailTemplate) {
|
|
76
76
|
type = await checkProductType(item == null ? void 0 : item.id);
|
|
77
|
-
|
|
78
|
-
appointmentBooking.openProductDetail(item.id);
|
|
79
|
-
}
|
|
77
|
+
appointmentBooking.openProductDetail(item.id);
|
|
80
78
|
}
|
|
81
79
|
utils == null ? void 0 : utils.action({
|
|
82
80
|
type: "pisell1.productDetail",
|
|
@@ -86,6 +84,10 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
|
|
|
86
84
|
},
|
|
87
85
|
callback: async (data) => {
|
|
88
86
|
var _a, _b;
|
|
87
|
+
if (data.isCancel) {
|
|
88
|
+
appointmentBooking.closeProductDetail();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
89
91
|
const product = {
|
|
90
92
|
...data,
|
|
91
93
|
options: (data == null ? void 0 : data.option) || []
|
|
@@ -96,13 +98,6 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
|
|
|
96
98
|
appointmentBooking.storeProduct(product);
|
|
97
99
|
return;
|
|
98
100
|
}
|
|
99
|
-
if (data == null ? void 0 : data.isCancel) {
|
|
100
|
-
if (type === "session") {
|
|
101
|
-
appointmentBooking.closeProductDetail();
|
|
102
|
-
appointmentBooking.getAvailableDate();
|
|
103
|
-
}
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
101
|
const session = data == null ? void 0 : data.session;
|
|
107
102
|
if (session) {
|
|
108
103
|
const startDate = (0, import_dayjs.default)(session == null ? void 0 : session.start_at).format("YYYY-MM-DD");
|
|
@@ -114,7 +109,6 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
|
|
|
114
109
|
endTime: `${endDate} ${session == null ? void 0 : session.end_time}`
|
|
115
110
|
}
|
|
116
111
|
});
|
|
117
|
-
appointmentBooking.closeProductDetail();
|
|
118
112
|
await appointmentBooking.getAvailableDate({
|
|
119
113
|
startDate,
|
|
120
114
|
endDate
|
|
@@ -128,10 +122,8 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
|
|
|
128
122
|
);
|
|
129
123
|
}
|
|
130
124
|
appointmentBooking.storeProduct(product);
|
|
131
|
-
if (type === "duration") {
|
|
132
|
-
await appointmentBooking.getAvailableDate();
|
|
133
|
-
}
|
|
134
125
|
}
|
|
126
|
+
appointmentBooking.closeProductDetail();
|
|
135
127
|
if (isDateSelectedFirst) {
|
|
136
128
|
const index = (currentStep == null ? void 0 : currentStep.index) + 2;
|
|
137
129
|
if (type === "duration") {
|
|
@@ -76,6 +76,7 @@ var VoucherCard = (props) => {
|
|
|
76
76
|
return discountList.filter((item) => !!item.isAvailable).map((discount) => {
|
|
77
77
|
return {
|
|
78
78
|
...discount,
|
|
79
|
+
isDisabled: discount.isDisabled || discount.isDisabledForProductUsed,
|
|
79
80
|
savedAmount: shopDiscount.calcDiscountApplicableProductTotalPrice(discount)
|
|
80
81
|
};
|
|
81
82
|
});
|
|
@@ -122,6 +123,7 @@ var VoucherCard = (props) => {
|
|
|
122
123
|
);
|
|
123
124
|
pisellos.effects.on("appointmentBooking_cart:onAddItem", onCartChange);
|
|
124
125
|
pisellos.effects.on("appointmentBooking_cart:onUpdateQuotationPrice", onCartChange);
|
|
126
|
+
pisellos.effects.on("appointmentBooking_cart:onUpdateCartItemNums", onCartChange);
|
|
125
127
|
pisellos.effects.on("appointmentBooking_cart:onRemoveItem", onCartChange);
|
|
126
128
|
pisellos.effects.on(
|
|
127
129
|
ShopDiscountHooks.onDiscountListChange,
|
|
@@ -169,6 +171,11 @@ var VoucherCard = (props) => {
|
|
|
169
171
|
import_utils.locales.getText("pisell2.text.goodpass.login")
|
|
170
172
|
), /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell2.text.goodpass.login-tip"))));
|
|
171
173
|
};
|
|
174
|
+
const mixedSort = (val) => {
|
|
175
|
+
return [...val].sort((a, b) => {
|
|
176
|
+
return Number(b == null ? void 0 : b.isSelected) - Number(a == null ? void 0 : a.isSelected);
|
|
177
|
+
});
|
|
178
|
+
};
|
|
172
179
|
const renderVoucherInfo = () => {
|
|
173
180
|
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "voucher-title" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "voucher-title-left" }, import_utils.locales.getText("pisell2.text.goodpass")), /* @__PURE__ */ import_react.default.createElement(
|
|
174
181
|
"span",
|
|
@@ -201,6 +208,7 @@ var VoucherCard = (props) => {
|
|
|
201
208
|
{
|
|
202
209
|
style: { width: "100%" },
|
|
203
210
|
dataSource: availableData,
|
|
211
|
+
mixedSort,
|
|
204
212
|
onChange: (val) => {
|
|
205
213
|
const detail = shopDiscount.setDiscountSelected({
|
|
206
214
|
discountId: val.id,
|
|
@@ -215,6 +223,7 @@ var VoucherCard = (props) => {
|
|
|
215
223
|
import_materials.PisellInput,
|
|
216
224
|
{
|
|
217
225
|
value: code,
|
|
226
|
+
allowClear: true,
|
|
218
227
|
onChange: (e) => {
|
|
219
228
|
var _a2;
|
|
220
229
|
setCode((_a2 = e.target) == null ? void 0 : _a2.value);
|
|
@@ -132,7 +132,7 @@ var locales_default = {
|
|
|
132
132
|
"pisell2.appointment.policy.confirm": "Confirm",
|
|
133
133
|
"pisell2.appointment.resource.tip": (val) => `Tip: Change ${val || "resource"} using the dropdown in the cart.`,
|
|
134
134
|
"pisell2.text.apply": "Apply",
|
|
135
|
-
"pisell2.text.goodpass": "
|
|
135
|
+
"pisell2.text.goodpass": "Promotion",
|
|
136
136
|
"pisell2.text.goodpass.product-vouchers": "Product Vouchers",
|
|
137
137
|
"pisell2.text.goodpass.view-more": "View More",
|
|
138
138
|
"pisell2.text.goodpass.code": "Code",
|
|
@@ -250,7 +250,7 @@ var locales_default = {
|
|
|
250
250
|
"pisell2.appointment.policy.confirm": "确定",
|
|
251
251
|
"pisell2.appointment.resource.tip": (val) => `提示:在右侧购物车中,通过下拉框修改“${val || "资源"}”`,
|
|
252
252
|
"pisell2.text.apply": "应用",
|
|
253
|
-
"pisell2.text.goodpass": "
|
|
253
|
+
"pisell2.text.goodpass": "促销",
|
|
254
254
|
"pisell2.text.goodpass.product-vouchers": "商品兑换券",
|
|
255
255
|
"pisell2.text.goodpass.view-more": "查看更多",
|
|
256
256
|
"pisell2.text.goodpass.code": "券码",
|
|
@@ -368,7 +368,7 @@ var locales_default = {
|
|
|
368
368
|
"pisell2.appointment.policy.confirm": "確定",
|
|
369
369
|
"pisell2.appointment.resource.tip": (val) => `提示:在右側購物車中,透過下拉框修改“${val || "資源"}”`,
|
|
370
370
|
"pisell2.text.apply": "應用",
|
|
371
|
-
"pisell2.text.goodpass": "
|
|
371
|
+
"pisell2.text.goodpass": "促銷",
|
|
372
372
|
"pisell2.text.goodpass.product-vouchers": "商品兌換券",
|
|
373
373
|
"pisell2.text.goodpass.view-more": "查看更多",
|
|
374
374
|
"pisell2.text.goodpass.code": "券碼",
|
|
@@ -106,11 +106,13 @@ var formatProductValues = (data) => {
|
|
|
106
106
|
...d,
|
|
107
107
|
id: d.product_id,
|
|
108
108
|
title: d.product_title,
|
|
109
|
+
isAddons: true,
|
|
109
110
|
quantity: d.product_quantity,
|
|
110
111
|
cover: d.product_cover,
|
|
111
112
|
price: Number(d.source_product_price),
|
|
112
113
|
_extend: {
|
|
113
114
|
total: Number(d.selling_price),
|
|
115
|
+
origin_total: Number(d.selling_price),
|
|
114
116
|
payment_price: Number(d.payment_price),
|
|
115
117
|
price: Number(d.source_product_price),
|
|
116
118
|
quantity: d.product_quantity,
|
|
@@ -236,6 +238,7 @@ var Addons = (0, import_model.Provider)((props) => {
|
|
|
236
238
|
let product = {
|
|
237
239
|
..._detail,
|
|
238
240
|
_id: (0, import_utils3.getUniqueId)(),
|
|
241
|
+
isAddons: true,
|
|
239
242
|
_key: e.key,
|
|
240
243
|
_extend: {
|
|
241
244
|
price: _detail.price,
|
|
@@ -246,7 +249,11 @@ var Addons = (0, import_model.Provider)((props) => {
|
|
|
246
249
|
};
|
|
247
250
|
let _total = (0, import_utils2.getProductTotalPrice)(product);
|
|
248
251
|
product._extend.total = _total;
|
|
249
|
-
|
|
252
|
+
product._extend.origin_total = _total;
|
|
253
|
+
let _item = _list.find((d) => {
|
|
254
|
+
var _a2;
|
|
255
|
+
return d._extend.other.rowKey === e.rowKey && !d.booking_id && !((_a2 = d.discount_list) == null ? void 0 : _a2.length);
|
|
256
|
+
});
|
|
250
257
|
if (_item) {
|
|
251
258
|
_item._extend.quantity = _item._extend.quantity + product.quantity;
|
|
252
259
|
} else {
|
|
@@ -392,6 +399,7 @@ var Addons = (0, import_model.Provider)((props) => {
|
|
|
392
399
|
let product = {
|
|
393
400
|
...item,
|
|
394
401
|
..._detail,
|
|
402
|
+
isAddons: true,
|
|
395
403
|
// 编辑商品时清除折扣信息
|
|
396
404
|
discount_list: [],
|
|
397
405
|
_extend: {
|
|
@@ -405,8 +413,8 @@ var Addons = (0, import_model.Provider)((props) => {
|
|
|
405
413
|
}
|
|
406
414
|
let _total = (0, import_utils2.getProductTotalPrice)(product);
|
|
407
415
|
product._extend.total = _total;
|
|
416
|
+
product._extend.origin_total = _total;
|
|
408
417
|
let _list = [...state.addons.value];
|
|
409
|
-
console.log("cacheItem", product);
|
|
410
418
|
_list = _list.map((d) => d._id === product._id ? product : d);
|
|
411
419
|
dispatch({
|
|
412
420
|
type: "setAddons",
|
|
@@ -34,6 +34,9 @@ var { Provider, Context } = (0, import_utils.miniRedux)({
|
|
|
34
34
|
},
|
|
35
35
|
setAddons(state, payload) {
|
|
36
36
|
state.setGlobalState({ addons: { ...state.addons, ...payload } });
|
|
37
|
+
},
|
|
38
|
+
setService(state, payload) {
|
|
39
|
+
state.setGlobalState({ service: { ...state.service, ...payload } });
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
42
|
});
|
|
@@ -101,7 +101,11 @@ var SelectProductItem = ({
|
|
|
101
101
|
disabled
|
|
102
102
|
}
|
|
103
103
|
),
|
|
104
|
-
/* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-total" }, (0, import_utils.formatAmount)(
|
|
104
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-total" }, item._extend.origin_total !== item._extend.total && /* @__PURE__ */ import_react.default.createElement("span", { className: "server-select-product-origin-total" }, (0, import_utils.formatAmount)(
|
|
105
|
+
item._extend.origin_total * item._extend.quantity,
|
|
106
|
+
2,
|
|
107
|
+
amountSymbol
|
|
108
|
+
)), (0, import_utils.formatAmount)(
|
|
105
109
|
item._extend.total * item._extend.quantity,
|
|
106
110
|
2,
|
|
107
111
|
amountSymbol
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
font-style: normal;
|
|
67
67
|
font-weight: 400;
|
|
68
68
|
|
|
69
|
+
|
|
69
70
|
.server-select-product-total {
|
|
70
71
|
color: var(--Base-Black, #000);
|
|
71
72
|
font-size: 16px;
|
|
@@ -73,6 +74,11 @@
|
|
|
73
74
|
font-weight: 500;
|
|
74
75
|
line-height: 24px;
|
|
75
76
|
}
|
|
77
|
+
.server-select-product-origin-total {
|
|
78
|
+
text-decoration: line-through;
|
|
79
|
+
color: #4e4e4e;
|
|
80
|
+
margin-right: 12px;
|
|
81
|
+
}
|
|
76
82
|
}
|
|
77
83
|
|
|
78
84
|
|
|
@@ -54,7 +54,7 @@ var import_useIsBooking4Shop = require("../../hooks/useIsBooking4Shop");
|
|
|
54
54
|
var import_utils4 = require("@pisell/utils");
|
|
55
55
|
var import_dayjs = __toESM(require("dayjs"));
|
|
56
56
|
var Footer = (props) => {
|
|
57
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
57
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
58
58
|
const { state, buttons, dispatch, source } = props;
|
|
59
59
|
const [showDetail, setShowDetail] = (0, import_react.useState)(false);
|
|
60
60
|
const [loading, setLoading] = (0, import_react.useState)(false);
|
|
@@ -194,6 +194,7 @@ var Footer = (props) => {
|
|
|
194
194
|
return false;
|
|
195
195
|
}, [state, params]);
|
|
196
196
|
const hasGoodPassApp = !!((_h = businessUtils == null ? void 0 : businessUtils.getAppByModal) == null ? void 0 : _h.call(businessUtils, "goodpass"));
|
|
197
|
+
const hasDiscountCardApp = !!((_i = businessUtils == null ? void 0 : businessUtils.getAppByModal) == null ? void 0 : _i.call(businessUtils, "discountcard"));
|
|
197
198
|
console.log("has goodpass app:", hasGoodPassApp);
|
|
198
199
|
const goCheckout = async (order_id) => {
|
|
199
200
|
var _a2, _b2;
|
|
@@ -798,7 +799,7 @@ var Footer = (props) => {
|
|
|
798
799
|
}, [
|
|
799
800
|
state.bookingId,
|
|
800
801
|
state.bookingDetail,
|
|
801
|
-
(
|
|
802
|
+
(_j = state.addons) == null ? void 0 : _j.load,
|
|
802
803
|
state.renderType
|
|
803
804
|
]);
|
|
804
805
|
const menuChange = (e) => {
|
|
@@ -881,7 +882,7 @@ var Footer = (props) => {
|
|
|
881
882
|
label: import_utils.locales.getText("pisell1.text.rounding")
|
|
882
883
|
}
|
|
883
884
|
];
|
|
884
|
-
}, [total, (
|
|
885
|
+
}, [total, (_k = state.bookingDetail) == null ? void 0 : _k.surcharge, state, state.bookingId]);
|
|
885
886
|
const orderTotalList = (0, import_react.useMemo)(() => {
|
|
886
887
|
return [
|
|
887
888
|
// 订单已付金额
|
|
@@ -915,8 +916,12 @@ var Footer = (props) => {
|
|
|
915
916
|
label: import_utils.locales.getText("pisell2.text.refunded-amount")
|
|
916
917
|
}
|
|
917
918
|
];
|
|
918
|
-
}, [total, (
|
|
919
|
-
|
|
919
|
+
}, [total, (_l = state.bookingDetail) == null ? void 0 : _l.surcharge, state, state.bookingId]);
|
|
920
|
+
const paymentRefundedStatus = (0, import_react.useMemo)(() => {
|
|
921
|
+
var _a2;
|
|
922
|
+
return ["partially_refunded", "refunded"].includes((_a2 = state == null ? void 0 : state.bookingDetail) == null ? void 0 : _a2.payment_status);
|
|
923
|
+
}, [state == null ? void 0 : state.bookingDetail]);
|
|
924
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd.Skeleton, { title: false, round: true, loading: showFooter, active: true }, (hasGoodPassApp || hasDiscountCardApp) && ["addons", "info"].includes(source) && !paymentRefundedStatus ? /* @__PURE__ */ import_react.default.createElement(import_voucher.default, { state, dispatch, source }) : null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-footer-total" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-footer-left" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-footer-left-total" }, totalText), /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-footer-left-arrears" }, arrearsText)), /* @__PURE__ */ import_react.default.createElement(
|
|
920
925
|
"span",
|
|
921
926
|
{
|
|
922
927
|
className: "pisell-lowcode__booking-footer-right",
|
|
@@ -177,12 +177,16 @@ var formatResource = (service) => {
|
|
|
177
177
|
}
|
|
178
178
|
};
|
|
179
179
|
var formatHolders = (state, item, values) => {
|
|
180
|
-
var _a, _b, _c, _d, _e, _f;
|
|
180
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
181
181
|
const form_id = ((_d = (_c = (_b = (_a = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a.config) == null ? void 0 : _b.basic) == null ? void 0 : _c.appointment_subject) == null ? void 0 : _d.form_id) || 0;
|
|
182
|
+
let form_record = ((_e = item._extend) == null ? void 0 : _e.holder_id) ? [(_f = item._extend) == null ? void 0 : _f.holder_id] : [];
|
|
183
|
+
if (((_g = item._extend) == null ? void 0 : _g.holder_id) && (0, import_utils5.isArr)((_h = item._extend) == null ? void 0 : _h.holder_id)) {
|
|
184
|
+
form_record = (_i = item._extend) == null ? void 0 : _i.holder_id;
|
|
185
|
+
}
|
|
182
186
|
let obj = {
|
|
183
187
|
customer_id: values.customer_id,
|
|
184
188
|
form_id,
|
|
185
|
-
form_record
|
|
189
|
+
form_record
|
|
186
190
|
};
|
|
187
191
|
if (state.isFranchisee) {
|
|
188
192
|
obj.is_source_shop = 1;
|
|
@@ -217,7 +221,7 @@ var formatMetaData = (item) => {
|
|
|
217
221
|
}
|
|
218
222
|
return metadata;
|
|
219
223
|
};
|
|
220
|
-
var formatProducts = (item) => {
|
|
224
|
+
var formatProducts = (item, quantity) => {
|
|
221
225
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
222
226
|
const total = Number(item._extend.total);
|
|
223
227
|
const origin_total = Number(item._extend.origin_total);
|
|
@@ -226,7 +230,7 @@ var formatProducts = (item) => {
|
|
|
226
230
|
const discount_type = discount_amount < 0 ? "change_price" : "discount";
|
|
227
231
|
const notManualDiscount = discount_list.filter((item2) => item2.type !== "product");
|
|
228
232
|
return {
|
|
229
|
-
"num": item._extend.quantity,
|
|
233
|
+
"num": quantity || item._extend.quantity,
|
|
230
234
|
"price": formatProductPrice(item),
|
|
231
235
|
"source_product_price": (_a = item._extend) == null ? void 0 : _a.price,
|
|
232
236
|
"product_id": (item == null ? void 0 : item.product_id) || item.id,
|
|
@@ -268,6 +272,13 @@ var formatAppointmentProductLists = (data) => {
|
|
|
268
272
|
} catch (error) {
|
|
269
273
|
}
|
|
270
274
|
};
|
|
275
|
+
var getHolderByIndex = (holder, index) => {
|
|
276
|
+
var _a;
|
|
277
|
+
return {
|
|
278
|
+
...holder,
|
|
279
|
+
form_record: [(_a = holder == null ? void 0 : holder.form_record) == null ? void 0 : _a[index]].filter(Boolean)
|
|
280
|
+
};
|
|
281
|
+
};
|
|
271
282
|
var formatBookings = (data, values) => {
|
|
272
283
|
const isDay = (0, import_utils4.isDaysBooking)(data);
|
|
273
284
|
const isEvent = (0, import_utils4.isEventBooking)(data);
|
|
@@ -287,7 +298,7 @@ var formatBookings = (data, values) => {
|
|
|
287
298
|
let dayParams = {};
|
|
288
299
|
const eventOtherParams = data.eventOtherParams;
|
|
289
300
|
let bookings = [];
|
|
290
|
-
|
|
301
|
+
list.forEach((item) => {
|
|
291
302
|
var _a, _b, _c, _d;
|
|
292
303
|
let start_date = item._extend.startDate.format("YYYY-MM-DD");
|
|
293
304
|
let end_date = item._extend.endDate.format("YYYY-MM-DD");
|
|
@@ -309,7 +320,7 @@ var formatBookings = (data, values) => {
|
|
|
309
320
|
dayParams.holder = formatHolders(data, item, values);
|
|
310
321
|
dayParams.duration = (0, import_utils3.getDays)({ _extend: { start_date: startDateTime, end_date: endDateTime } }, "minutes");
|
|
311
322
|
}
|
|
312
|
-
|
|
323
|
+
const booking = {
|
|
313
324
|
"product": formatProducts(item),
|
|
314
325
|
"relation_products": formatRelationDetails(item._extend.relation_details),
|
|
315
326
|
"id": item.booking_id || 0,
|
|
@@ -331,6 +342,18 @@ var formatBookings = (data, values) => {
|
|
|
331
342
|
...eventOtherParams || {},
|
|
332
343
|
...dayParams
|
|
333
344
|
};
|
|
345
|
+
if (isDay) {
|
|
346
|
+
bookings.push(booking);
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
for (let i = 0; i < (item._extend.quantity || 1); i++) {
|
|
350
|
+
bookings.push({
|
|
351
|
+
...booking,
|
|
352
|
+
"product": formatProducts(item, 1),
|
|
353
|
+
"number": item._extend.capacity ? (0, import_utilsByBooking.getSumCapacity)({ cacheItem: item }, false) : item._extend.number || 1,
|
|
354
|
+
"holder": getHolderByIndex(booking.holder, i)
|
|
355
|
+
});
|
|
356
|
+
}
|
|
334
357
|
});
|
|
335
358
|
return bookings;
|
|
336
359
|
};
|
|
@@ -375,7 +398,7 @@ var formatHolder = (state, values) => {
|
|
|
375
398
|
return obj;
|
|
376
399
|
};
|
|
377
400
|
var formatValues = (state) => {
|
|
378
|
-
var _a, _b, _c, _d, _e, _f;
|
|
401
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
379
402
|
let values = {
|
|
380
403
|
type: state.renderType === "eventBooking" ? "event_booking_v2" : "appointment_booking",
|
|
381
404
|
platform: "shop",
|
|
@@ -409,17 +432,20 @@ var formatValues = (state) => {
|
|
|
409
432
|
values.relation_products = formatRelationProducts(state);
|
|
410
433
|
} else {
|
|
411
434
|
values.relation_products = formatNormalProducts(state);
|
|
435
|
+
if (!((_b = values.relation_products) == null ? void 0 : _b.length)) {
|
|
436
|
+
values.relation_products = void 0;
|
|
437
|
+
}
|
|
412
438
|
}
|
|
413
439
|
values.bookings = formatBookings(state, values);
|
|
414
|
-
if (((
|
|
415
|
-
let startTime = `${(
|
|
440
|
+
if (((_d = (_c = values == null ? void 0 : values.bookings) == null ? void 0 : _c[0]) == null ? void 0 : _d.select_date) && !(state == null ? void 0 : state.bookingId)) {
|
|
441
|
+
let startTime = `${(_f = (_e = values == null ? void 0 : values.bookings) == null ? void 0 : _e[0]) == null ? void 0 : _f.start_time}`;
|
|
416
442
|
startTime = `${startTime || "00:00"}:00`;
|
|
417
443
|
values.schedule_date = `${values.bookings[0].select_date} ${startTime}`;
|
|
418
444
|
}
|
|
419
445
|
if (isDay) {
|
|
420
446
|
values.metadata.is_multiday_appointment = 1;
|
|
421
447
|
}
|
|
422
|
-
if (!((
|
|
448
|
+
if (!((_g = values == null ? void 0 : values.bookings) == null ? void 0 : _g.length)) {
|
|
423
449
|
values.type = "virtual";
|
|
424
450
|
}
|
|
425
451
|
return values;
|
|
@@ -427,7 +453,17 @@ var formatValues = (state) => {
|
|
|
427
453
|
var checkHolderIsError = (state) => {
|
|
428
454
|
var _a, _b;
|
|
429
455
|
const holderError = state.service.value.some((item) => {
|
|
430
|
-
|
|
456
|
+
var _a2, _b2;
|
|
457
|
+
if ((0, import_utils4.isNormalProductByDurationSchedule)(item)) {
|
|
458
|
+
return false;
|
|
459
|
+
}
|
|
460
|
+
if (item._extend.quantity === 1 && !item._extend.holder_id) {
|
|
461
|
+
return true;
|
|
462
|
+
}
|
|
463
|
+
if (item._extend.quantity > 1 && ((_b2 = (_a2 = item._extend) == null ? void 0 : _a2.holder_id) == null ? void 0 : _b2.length) !== item._extend.quantity) {
|
|
464
|
+
return true;
|
|
465
|
+
}
|
|
466
|
+
return false;
|
|
431
467
|
});
|
|
432
468
|
const clientId = (_b = (_a = state.client) == null ? void 0 : _a.value) == null ? void 0 : _b.id;
|
|
433
469
|
if (holderError && (!clientId || clientId === 0 || clientId === 1)) {
|