@pisell/private-materials 3.3.34 → 3.3.35
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/Sales/Cart/index.js +26 -13
- package/es/components/Sales/Cart/types.d.ts +12 -0
- package/es/components/Sales/Cart/utils.d.ts +23 -0
- package/es/components/Sales/Cart/utils.js +161 -0
- package/es/components/Sales/Checkout/utils.d.ts +9 -1
- package/es/components/Sales/Checkout/utils.js +25 -3
- package/es/components/Sales/Event/Detail.d.ts +2 -0
- package/es/components/Sales/Event/Detail.js +56 -13
- package/es/components/Sales/Event/serve.d.ts +10 -0
- package/es/components/Sales/Event/serve.js +26 -1
- package/es/components/Sales/Summary/utils.js +1 -0
- package/es/components/appointmentBooking/components/Cart/ContinueButton/index.js +18 -17
- package/es/components/appointmentBooking/components/Cart/Item/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Cart/Item/index.js +21 -20
- package/es/components/appointmentBooking/components/ConfirmInformation/index.js +156 -53
- package/es/components/appointmentBooking/components/ConfirmInformation/utils.d.ts +12 -0
- package/es/components/appointmentBooking/components/ConfirmInformation/utils.js +17 -0
- package/es/components/appointmentBooking/components/Content/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Content/index.js +26 -25
- package/es/components/appointmentBooking/components/Content/index.less +23 -1
- package/es/components/appointmentBooking/components/Footer/index.js +5 -5
- package/es/components/appointmentBooking/components/Header/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Header/index.js +7 -7
- package/es/components/appointmentBooking/components/Services/index.js +50 -25
- package/es/components/appointmentBooking/hooks.d.ts +2 -1
- package/es/components/appointmentBooking/hooks.js +52 -47
- package/es/components/appointmentBooking/index.d.ts +0 -1
- package/es/components/booking/components/TabProduct/index.d.ts +0 -1
- package/es/components/booking/components/TabProduct/productItem/index.d.ts +0 -1
- package/es/components/booking/components/footer/index.d.ts +0 -1
- package/es/components/booking/deposit/index.d.ts +0 -1
- package/es/components/booking/forms/single/index.d.ts +0 -1
- package/es/components/booking/info/addServiceVariant/index.d.ts +0 -1
- package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -1
- package/es/components/booking/info/date/index.d.ts +0 -1
- package/es/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
- package/es/components/booking/info/index.d.ts +0 -1
- package/es/components/booking/info/service/Lists.d.ts +0 -1
- package/es/components/booking/info/service/actions/index.d.ts +0 -1
- package/es/components/booking/info/service/addService/index.d.ts +0 -1
- package/es/components/booking/info/service/addTimeModal/index.d.ts +0 -1
- package/es/components/booking/info/service/serviceList/index.d.ts +0 -1
- package/es/components/booking/info/service2/Lists.d.ts +0 -1
- package/es/components/booking/info2/service/actions/index.d.ts +0 -1
- package/es/components/booking/info2/service/addService/index.d.ts +0 -1
- package/es/components/booking/info2/service/addTimeModal/index.d.ts +0 -1
- package/es/components/booking/info2/service/serviceList/index.d.ts +0 -1
- package/es/components/booking/materiels/duration/index.d.ts +0 -1
- package/es/components/booking/materiels/holder/index.d.ts +0 -1
- package/es/components/booking/materiels/startTime/index.d.ts +0 -1
- package/es/components/booking/utils.d.ts +2 -2
- package/es/components/booking/utils.js +19 -11
- package/es/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +218 -73
- package/es/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Header/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/SelectHolderModal.d.ts +0 -1
- package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +3 -1
- package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.js +7 -4
- package/es/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +0 -1
- package/es/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +0 -1
- package/es/components/eventBooking/components/bookingDetailModal/index.js +70 -13
- package/es/components/eventBooking/index.d.ts +0 -1
- package/es/components/productExtension/fields/Actor/index.d.ts +0 -1
- package/es/components/productExtension/fields/Forms/index.d.ts +0 -1
- package/es/components/productExtension/fields/SelectProducts/index.d.ts +0 -1
- package/es/components/productExtension/index.d.ts +0 -1
- package/es/components/productSelect/components/TabProduct/index.js +4 -2
- package/es/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/es/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/Sales/Cart/index.js +30 -18
- package/lib/components/Sales/Cart/types.d.ts +12 -0
- package/lib/components/Sales/Cart/utils.d.ts +23 -0
- package/lib/components/Sales/Cart/utils.js +149 -0
- package/lib/components/Sales/Checkout/utils.d.ts +9 -1
- package/lib/components/Sales/Checkout/utils.js +18 -4
- package/lib/components/Sales/Event/Detail.d.ts +2 -0
- package/lib/components/Sales/Event/Detail.js +34 -10
- package/lib/components/Sales/Event/serve.d.ts +10 -0
- package/lib/components/Sales/Event/serve.js +5 -2
- package/lib/components/Sales/Summary/utils.js +1 -0
- package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.js +3 -3
- package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Cart/Item/index.js +1 -1
- package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +43 -6
- package/lib/components/appointmentBooking/components/ConfirmInformation/utils.d.ts +12 -0
- package/lib/components/appointmentBooking/components/ConfirmInformation/utils.js +37 -0
- package/lib/components/appointmentBooking/components/Content/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Content/index.js +7 -7
- package/lib/components/appointmentBooking/components/Content/index.less +23 -1
- package/lib/components/appointmentBooking/components/Header/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Header/index.js +5 -3
- package/lib/components/appointmentBooking/components/Services/index.js +18 -10
- package/lib/components/appointmentBooking/hooks.d.ts +2 -1
- package/lib/components/appointmentBooking/hooks.js +9 -3
- package/lib/components/appointmentBooking/index.d.ts +0 -1
- package/lib/components/booking/components/TabProduct/index.d.ts +0 -1
- package/lib/components/booking/components/TabProduct/productItem/index.d.ts +0 -1
- package/lib/components/booking/components/footer/index.d.ts +0 -1
- package/lib/components/booking/deposit/index.d.ts +0 -1
- package/lib/components/booking/forms/single/index.d.ts +0 -1
- package/lib/components/booking/info/addServiceVariant/index.d.ts +0 -1
- package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -1
- package/lib/components/booking/info/date/index.d.ts +0 -1
- package/lib/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
- package/lib/components/booking/info/index.d.ts +0 -1
- package/lib/components/booking/info/service/Lists.d.ts +0 -1
- package/lib/components/booking/info/service/actions/index.d.ts +0 -1
- package/lib/components/booking/info/service/addService/index.d.ts +0 -1
- package/lib/components/booking/info/service/addTimeModal/index.d.ts +0 -1
- package/lib/components/booking/info/service/serviceList/index.d.ts +0 -1
- package/lib/components/booking/info/service2/Lists.d.ts +0 -1
- package/lib/components/booking/info2/service/actions/index.d.ts +0 -1
- package/lib/components/booking/info2/service/addService/index.d.ts +0 -1
- package/lib/components/booking/info2/service/addTimeModal/index.d.ts +0 -1
- package/lib/components/booking/info2/service/serviceList/index.d.ts +0 -1
- package/lib/components/booking/materiels/duration/index.d.ts +0 -1
- package/lib/components/booking/materiels/holder/index.d.ts +0 -1
- package/lib/components/booking/materiels/startTime/index.d.ts +0 -1
- package/lib/components/booking/utils.d.ts +2 -2
- package/lib/components/booking/utils.js +5 -1
- package/lib/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +128 -42
- package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Header/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/SelectHolderModal.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +3 -1
- package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.js +7 -2
- package/lib/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingDetailModal/index.js +79 -24
- package/lib/components/eventBooking/index.d.ts +0 -1
- package/lib/components/productExtension/fields/Actor/index.d.ts +0 -1
- package/lib/components/productExtension/fields/Forms/index.d.ts +0 -1
- package/lib/components/productExtension/fields/SelectProducts/index.d.ts +0 -1
- package/lib/components/productExtension/index.d.ts +0 -1
- package/lib/components/productSelect/components/TabProduct/index.js +6 -2
- package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/ticketBooking/index.d.ts +0 -1
- package/package.json +4 -4
|
@@ -163,10 +163,10 @@ export declare const getProductTotalPrice: (item: any) => number;
|
|
|
163
163
|
export declare const getDuration: (duration: number | {
|
|
164
164
|
type: string;
|
|
165
165
|
value: number;
|
|
166
|
-
}) => number | {
|
|
166
|
+
}) => number | "flexible" | {
|
|
167
167
|
type: string;
|
|
168
168
|
value: number;
|
|
169
|
-
}
|
|
169
|
+
};
|
|
170
170
|
export declare const isWalkIn: (customer_id?: number | string) => boolean;
|
|
171
171
|
export declare const getIsEdit: (state: any) => boolean;
|
|
172
172
|
export {};
|
|
@@ -251,6 +251,12 @@ export var formatProductListByCategory = function formatProductListByCategory(li
|
|
|
251
251
|
});
|
|
252
252
|
};
|
|
253
253
|
export var getResourceTimeIsUsable = function getResourceTimeIsUsable(item, cacheItem) {
|
|
254
|
+
var _cacheItem$_extend;
|
|
255
|
+
// 是编辑的商品
|
|
256
|
+
var isEdit = !!cacheItem.booking_id;
|
|
257
|
+
|
|
258
|
+
// 是当前绑定的资源
|
|
259
|
+
var isCurrentRelation = item.item_id === (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.relation_id);
|
|
254
260
|
var startDate = dayjs(cacheItem._extend.start_date.format('YYYY-MM-DD') + ' ' + getServeStartTime(cacheItem._extend.start_time));
|
|
255
261
|
var isFlexible = flexibleObj.isFlexible(cacheItem._extend.duration);
|
|
256
262
|
|
|
@@ -264,7 +270,9 @@ export var getResourceTimeIsUsable = function getResourceTimeIsUsable(item, cach
|
|
|
264
270
|
if (time.max_participants_limit == 0) {
|
|
265
271
|
isMaxLimitRange = true;
|
|
266
272
|
} else {
|
|
267
|
-
|
|
273
|
+
// 编辑当前选择资源,当前资源已预约数量 - 1
|
|
274
|
+
var orderEventCount = isEdit && isCurrentRelation ? time.order_event_count - 1 : time.order_event_count;
|
|
275
|
+
isMaxLimitRange = orderEventCount < time.max_participants_limit;
|
|
268
276
|
}
|
|
269
277
|
var timeStartDate = dayjs(time.start_date + ' ' + time.start_time).subtract(1, 'second');
|
|
270
278
|
var timeEndDate = dayjs(time.end_date + ' ' + time.end_time).add(1, 'second');
|
|
@@ -304,8 +312,8 @@ export var getResourceTimeIsUsable = function getResourceTimeIsUsable(item, cach
|
|
|
304
312
|
* @Date: 2024-01-09 13:57
|
|
305
313
|
*/
|
|
306
314
|
export var formatTimes = function formatTimes(resourceItem, cacheItem) {
|
|
307
|
-
var _cacheItem$
|
|
308
|
-
if ((cacheItem === null || cacheItem === void 0 || (_cacheItem$
|
|
315
|
+
var _cacheItem$_extend2;
|
|
316
|
+
if ((cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.sub_type) === 'days') {
|
|
309
317
|
var isResourceItem = (resourceItem === null || resourceItem === void 0 ? void 0 : resourceItem.form_record_id) > 0;
|
|
310
318
|
|
|
311
319
|
// 是否在最大预约数量的区间内
|
|
@@ -520,9 +528,9 @@ export var getErrorList = function getErrorList(resource, cacheItem, isDay) {
|
|
|
520
528
|
|
|
521
529
|
// 跨日预约
|
|
522
530
|
if (isDay) {
|
|
523
|
-
var _cacheItem$
|
|
524
|
-
start_date = _cacheItem$
|
|
525
|
-
end_date = _cacheItem$
|
|
531
|
+
var _cacheItem$_extend3 = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem._extend,
|
|
532
|
+
start_date = _cacheItem$_extend3.start_date,
|
|
533
|
+
end_date = _cacheItem$_extend3.end_date;
|
|
526
534
|
startText = start_date === null || start_date === void 0 ? void 0 : start_date.format('YYYY-MM-DD');
|
|
527
535
|
endText = end_date ? end_date === null || end_date === void 0 ? void 0 : end_date.format('YYYY-MM-DD') : '';
|
|
528
536
|
} else {
|
|
@@ -563,7 +571,7 @@ export var getErrorList = function getErrorList(resource, cacheItem, isDay) {
|
|
|
563
571
|
* @Date: 2024-01-09 13:40
|
|
564
572
|
*/
|
|
565
573
|
export var formatResource = function formatResource(resourceItem, cacheItem, formatLabel) {
|
|
566
|
-
var _resourceItem$_extend, _cacheItem$
|
|
574
|
+
var _resourceItem$_extend, _cacheItem$_extend4;
|
|
567
575
|
// 当前资源
|
|
568
576
|
var _resourceItem = _objectSpread({}, resourceItem);
|
|
569
577
|
|
|
@@ -578,7 +586,7 @@ export var formatResource = function formatResource(resourceItem, cacheItem, for
|
|
|
578
586
|
var usable = _resourceItem._extend.usableTime && ((_resourceItem$_extend = _resourceItem._extend.usableTime._extend) === null || _resourceItem$_extend === void 0 ? void 0 : _resourceItem$_extend.isMaxLimitRange) && _resourceItem._extend.usableProduct;
|
|
579
587
|
|
|
580
588
|
// 跨日预约
|
|
581
|
-
if ((cacheItem === null || cacheItem === void 0 || (_cacheItem$
|
|
589
|
+
if ((cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend4 = cacheItem._extend) === null || _cacheItem$_extend4 === void 0 ? void 0 : _cacheItem$_extend4.sub_type) === 'days') {
|
|
582
590
|
var _resourceItem$_extend2, _resourceItem$_extend3;
|
|
583
591
|
usable = ((_resourceItem$_extend2 = _resourceItem._extend) === null || _resourceItem$_extend2 === void 0 || (_resourceItem$_extend2 = _resourceItem$_extend2.usableTime) === null || _resourceItem$_extend2 === void 0 ? void 0 : _resourceItem$_extend2.isUsable) && ((_resourceItem$_extend3 = _resourceItem._extend) === null || _resourceItem$_extend3 === void 0 ? void 0 : _resourceItem$_extend3.usableProduct);
|
|
584
592
|
}
|
|
@@ -612,7 +620,7 @@ export var deleteCacheParams = function deleteCacheParams() {
|
|
|
612
620
|
* @Date: 2024-12-01 22:43
|
|
613
621
|
*/
|
|
614
622
|
export var getDays = function getDays(cacheItem, type) {
|
|
615
|
-
var _cacheItem$
|
|
623
|
+
var _cacheItem$_extend5, _cacheItem$_extend6;
|
|
616
624
|
// 计算天数
|
|
617
625
|
if (type === 'days') {
|
|
618
626
|
var _formatDayDate = formatDayDate(cacheItem._extend),
|
|
@@ -620,8 +628,8 @@ export var getDays = function getDays(cacheItem, type) {
|
|
|
620
628
|
end_date = _formatDayDate.end_date;
|
|
621
629
|
return end_date.diff(start_date, 'day');
|
|
622
630
|
}
|
|
623
|
-
var startDate = dayjs((_cacheItem$
|
|
624
|
-
var endDate = dayjs((_cacheItem$
|
|
631
|
+
var startDate = dayjs((_cacheItem$_extend5 = cacheItem._extend) === null || _cacheItem$_extend5 === void 0 ? void 0 : _cacheItem$_extend5.start_date);
|
|
632
|
+
var endDate = dayjs((_cacheItem$_extend6 = cacheItem._extend) === null || _cacheItem$_extend6 === void 0 ? void 0 : _cacheItem$_extend6.end_date);
|
|
625
633
|
return endDate.diff(startDate, type);
|
|
626
634
|
};
|
|
627
635
|
export var isSessionProduct = function isSessionProduct(cacheItem) {
|
|
@@ -17,10 +17,10 @@ import React, { useMemo, useState } from 'react';
|
|
|
17
17
|
import { locales } from '@pisell/utils';
|
|
18
18
|
import { Button, PisellToast } from '@pisell/materials';
|
|
19
19
|
import { useCart, useHolder, useStep, useCheckout, useSales, useCustomer } from "../../../../../Sales";
|
|
20
|
-
import { formatValues } from "../../../../../Sales/Checkout/utils";
|
|
20
|
+
import { formatValues, getFormParams } from "../../../../../Sales/Checkout/utils";
|
|
21
21
|
import OrderProductModal from "../../OrderProductModal/index";
|
|
22
22
|
import EmptyHolderModal from "../../EmptyHolderModal";
|
|
23
|
-
import {
|
|
23
|
+
import { getProductPrice } from "../../../../../Sales/Event/serve";
|
|
24
24
|
import { useRequest } from 'ahooks';
|
|
25
25
|
import useEngineContext from "../../../../../../hooks/useEngineContext";
|
|
26
26
|
import "./index.less";
|
|
@@ -67,7 +67,9 @@ var ContinueButton = function ContinueButton() {
|
|
|
67
67
|
removeSessionStorage = _useSales2.removeSessionStorage;
|
|
68
68
|
var context = useEngineContext();
|
|
69
69
|
var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
|
|
70
|
-
store = _ref.store
|
|
70
|
+
store = _ref.store,
|
|
71
|
+
action = _ref.action,
|
|
72
|
+
getStore = _ref.getStore;
|
|
71
73
|
|
|
72
74
|
/**
|
|
73
75
|
* @title: 下单
|
|
@@ -77,29 +79,53 @@ var ContinueButton = function ContinueButton() {
|
|
|
77
79
|
* @Date: 2025-02-10 17:54
|
|
78
80
|
*/
|
|
79
81
|
var handleCheckout = /*#__PURE__*/function () {
|
|
80
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
81
|
-
var
|
|
82
|
-
return _regeneratorRuntime().wrap(function
|
|
83
|
-
while (1) switch (
|
|
82
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
83
|
+
var params;
|
|
84
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
85
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
84
86
|
case 0:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
87
|
+
params = getFormParams(data);
|
|
88
|
+
action === null || action === void 0 || action({
|
|
89
|
+
type: 'pisell1.goProductForm',
|
|
90
|
+
data: params,
|
|
91
|
+
callback: function () {
|
|
92
|
+
var _callback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
|
|
93
|
+
var value, result, _result$err;
|
|
94
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
95
|
+
while (1) switch (_context.prev = _context.next) {
|
|
96
|
+
case 0:
|
|
97
|
+
value = formatValues(data, false, {
|
|
98
|
+
relation_forms: e
|
|
99
|
+
}); // 如果检测成功,则直接下单
|
|
100
|
+
_context.next = 3;
|
|
101
|
+
return onCheckout(value);
|
|
102
|
+
case 3:
|
|
103
|
+
result = _context.sent;
|
|
104
|
+
// 清空数据
|
|
105
|
+
if (result !== null && result !== void 0 && result.success) {
|
|
106
|
+
removeSessionStorage();
|
|
107
|
+
} else {
|
|
108
|
+
PisellToast({
|
|
109
|
+
content: (result === null || result === void 0 || (_result$err = result.err) === null || _result$err === void 0 ? void 0 : _result$err.message) || ''
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
case 5:
|
|
113
|
+
case "end":
|
|
114
|
+
return _context.stop();
|
|
115
|
+
}
|
|
116
|
+
}, _callee);
|
|
117
|
+
}));
|
|
118
|
+
function callback(_x) {
|
|
119
|
+
return _callback.apply(this, arguments);
|
|
120
|
+
}
|
|
121
|
+
return callback;
|
|
122
|
+
}()
|
|
123
|
+
});
|
|
124
|
+
case 2:
|
|
99
125
|
case "end":
|
|
100
|
-
return
|
|
126
|
+
return _context2.stop();
|
|
101
127
|
}
|
|
102
|
-
},
|
|
128
|
+
}, _callee2);
|
|
103
129
|
}));
|
|
104
130
|
return function handleCheckout() {
|
|
105
131
|
return _ref2.apply(this, arguments);
|
|
@@ -109,23 +135,130 @@ var ContinueButton = function ContinueButton() {
|
|
|
109
135
|
/**
|
|
110
136
|
* 登录后根据返回商品价格更新cartItem price
|
|
111
137
|
*/
|
|
112
|
-
var
|
|
138
|
+
var _getProductPrice = useRequest(getProductPrice, {
|
|
113
139
|
manual: true,
|
|
114
140
|
onSuccess: function onSuccess(res) {
|
|
115
|
-
var
|
|
116
|
-
var list = ((_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list) || [];
|
|
141
|
+
var list = res.data || [];
|
|
117
142
|
var productById = list.reduce(function (pre, cur) {
|
|
118
143
|
pre[cur.id] = cur;
|
|
119
144
|
return pre;
|
|
120
145
|
}, {});
|
|
146
|
+
console.log('start update price');
|
|
121
147
|
var newCartItems = cartData.cartItems.map(function (item) {
|
|
122
148
|
var _ref3 = item._originData || {},
|
|
123
149
|
product = _ref3.product;
|
|
124
150
|
var newProduct = productById[product.product_id];
|
|
125
|
-
|
|
126
|
-
|
|
151
|
+
// 目前默认按单件商品计算
|
|
152
|
+
var _totalPrice = Number(newProduct.price);
|
|
153
|
+
if (!(item !== null && item !== void 0 && item._productDetail)) {
|
|
154
|
+
// 没有 _productDetail 说明可能是普通商品 则直接替换价格
|
|
155
|
+
item.price = _totalPrice;
|
|
156
|
+
item.total = _totalPrice;
|
|
157
|
+
return item;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// 从 cartItem 中获取bundleItem原始信息
|
|
161
|
+
var _item$_productDetail = item._productDetail,
|
|
162
|
+
_item$_productDetail$ = _item$_productDetail.bundle,
|
|
163
|
+
bundle = _item$_productDetail$ === void 0 ? [] : _item$_productDetail$,
|
|
164
|
+
options = _item$_productDetail.options;
|
|
165
|
+
|
|
166
|
+
// 1. 组合规格商品
|
|
167
|
+
if (product !== null && product !== void 0 && product.product_variant_id) {
|
|
168
|
+
var _newProduct$variant = newProduct.variant,
|
|
169
|
+
variant = _newProduct$variant === void 0 ? [] : _newProduct$variant;
|
|
170
|
+
var _variant = variant.find(function (v) {
|
|
171
|
+
return v.id === product.product_variant_id;
|
|
172
|
+
});
|
|
173
|
+
if (_variant) {
|
|
174
|
+
_totalPrice = Number(_variant.price);
|
|
175
|
+
}
|
|
176
|
+
} else if (
|
|
177
|
+
// 2. 套餐商品
|
|
178
|
+
Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle) && product.product_bundle.length > 0) {
|
|
179
|
+
// 登录后的最新商品分组信息
|
|
180
|
+
var _newProduct$bundle_gr = newProduct.bundle_group,
|
|
181
|
+
bundle_group = _newProduct$bundle_gr === void 0 ? [] : _newProduct$bundle_gr;
|
|
182
|
+
var _loop = function _loop() {
|
|
183
|
+
var _targetBundleGroup$bu;
|
|
184
|
+
var pbItem = product.product_bundle[i];
|
|
185
|
+
var bundle_group_id = pbItem.bundle_group_id,
|
|
186
|
+
bundle_id = pbItem.bundle_id,
|
|
187
|
+
option = pbItem.option;
|
|
188
|
+
// 最初绑定的bundle的基本信息,主要是获取 price_type 用于计算最新价格
|
|
189
|
+
var _originBundleItemInfo = bundle.find(function (bi) {
|
|
190
|
+
return bi.id === bundle_id;
|
|
191
|
+
});
|
|
192
|
+
var _targetBundleGroup = bundle_group.find(function (bg) {
|
|
193
|
+
return bg.id === bundle_group_id;
|
|
194
|
+
});
|
|
195
|
+
// 如果匹配到bundle group items, 则继续定位 item
|
|
196
|
+
if (_targetBundleGroup !== null && _targetBundleGroup !== void 0 && (_targetBundleGroup$bu = _targetBundleGroup.bundle_item) !== null && _targetBundleGroup$bu !== void 0 && _targetBundleGroup$bu.length) {
|
|
197
|
+
var _newBundleItemInfo = _targetBundleGroup.bundle_item.find(function (bi) {
|
|
198
|
+
return bi.id === bundle_id;
|
|
199
|
+
});
|
|
200
|
+
// 比对原始bundle_item中的商品id和最新bundle_item中的商品id
|
|
201
|
+
if ((_originBundleItemInfo === null || _originBundleItemInfo === void 0 ? void 0 : _originBundleItemInfo._bundle_product_id) === (_newBundleItemInfo === null || _newBundleItemInfo === void 0 ? void 0 : _newBundleItemInfo.bundle_product_id)) {
|
|
202
|
+
var price_type = _originBundleItemInfo.price_type,
|
|
203
|
+
_originBundleItemInfo2 = _originBundleItemInfo.num,
|
|
204
|
+
num = _originBundleItemInfo2 === void 0 ? 0 : _originBundleItemInfo2,
|
|
205
|
+
_originBundleItemOptions = _originBundleItemInfo.option;
|
|
206
|
+
var _bundleItemPrice = Number(_newBundleItemInfo.price);
|
|
207
|
+
if (price_type === 'markup') {
|
|
208
|
+
_totalPrice += _bundleItemPrice * num;
|
|
209
|
+
} else if (price_type === 'markdown') {
|
|
210
|
+
_totalPrice -= _bundleItemPrice * num;
|
|
211
|
+
} else {
|
|
212
|
+
_totalPrice += _bundleItemPrice * num;
|
|
213
|
+
}
|
|
214
|
+
// 如果该套餐商品子商品为单规格商品
|
|
215
|
+
if (Array.isArray(option) && (option === null || option === void 0 ? void 0 : option.length) > 0) {
|
|
216
|
+
var _loop2 = function _loop2() {
|
|
217
|
+
var option_group_item_id = option[j].option_group_item_id;
|
|
218
|
+
var _originOptionItem = _originBundleItemOptions.find(function (op) {
|
|
219
|
+
return op.product_option_item_id === option_group_item_id;
|
|
220
|
+
});
|
|
221
|
+
if (_originOptionItem) {
|
|
222
|
+
var price = _originOptionItem.price,
|
|
223
|
+
_originOptionItem$num = _originOptionItem.num,
|
|
224
|
+
_optionNum = _originOptionItem$num === void 0 ? 0 : _originOptionItem$num;
|
|
225
|
+
_totalPrice += Number(price) * _optionNum;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
for (var j = 0; j < option.length; j++) {
|
|
229
|
+
_loop2();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
for (var i = 0; i < product.product_bundle.length; i++) {
|
|
236
|
+
_loop();
|
|
237
|
+
}
|
|
238
|
+
} else if (
|
|
239
|
+
// 3. 单规格商品
|
|
240
|
+
Array.isArray(product === null || product === void 0 ? void 0 : product.product_option_item) && product.product_option_item.length > 0) {
|
|
241
|
+
var _loop3 = function _loop3() {
|
|
242
|
+
var option_group_item_id = product.product_option_item[_i].option_group_item_id;
|
|
243
|
+
var _originOptionItem = options.find(function (op) {
|
|
244
|
+
return op.product_option_item_id === option_group_item_id;
|
|
245
|
+
});
|
|
246
|
+
if (_originOptionItem) {
|
|
247
|
+
var price = _originOptionItem.price,
|
|
248
|
+
_originOptionItem$num2 = _originOptionItem.num,
|
|
249
|
+
num = _originOptionItem$num2 === void 0 ? 0 : _originOptionItem$num2;
|
|
250
|
+
_totalPrice += Number(price) * num;
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
for (var _i = 0; _i < product.product_option_item.length; _i++) {
|
|
254
|
+
_loop3();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
item.price = _totalPrice;
|
|
258
|
+
item.total = _totalPrice;
|
|
127
259
|
return item;
|
|
128
260
|
});
|
|
261
|
+
console.log('new cart data', newCartItems);
|
|
129
262
|
setData({
|
|
130
263
|
cartData: _objectSpread(_objectSpread({}, cartData), {}, {
|
|
131
264
|
cartItems: newCartItems
|
|
@@ -133,33 +266,45 @@ var ContinueButton = function ContinueButton() {
|
|
|
133
266
|
});
|
|
134
267
|
}
|
|
135
268
|
});
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* 登录后重新获取应用报价单后的价格
|
|
272
|
+
* 过滤掉组规格商品
|
|
273
|
+
*/
|
|
136
274
|
var getCartItemProductsWithQuotation = /*#__PURE__*/function () {
|
|
137
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
275
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
138
276
|
var _store$getState;
|
|
139
|
-
var ids, customer;
|
|
140
|
-
return _regeneratorRuntime().wrap(function
|
|
141
|
-
while (1) switch (
|
|
277
|
+
var ids, store, customer;
|
|
278
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
279
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
142
280
|
case 0:
|
|
143
281
|
ids = cartData.cartItems.map(function (item) {
|
|
144
282
|
var _ref5 = item._originData || {},
|
|
145
|
-
product = _ref5.product
|
|
146
|
-
|
|
283
|
+
_ref5$product = _ref5.product,
|
|
284
|
+
product = _ref5$product === void 0 ? {} : _ref5$product;
|
|
285
|
+
var product_id = product.product_id;
|
|
286
|
+
return product_id;
|
|
147
287
|
}).filter(function (id) {
|
|
148
288
|
return !!id;
|
|
149
289
|
});
|
|
290
|
+
store = getStore();
|
|
150
291
|
customer = store === null || store === void 0 || (_store$getState = store.getState()) === null || _store$getState === void 0 || (_store$getState = _store$getState.global) === null || _store$getState === void 0 ? void 0 : _store$getState.userInfo;
|
|
151
|
-
|
|
292
|
+
if (ids !== null && ids !== void 0 && ids.length) {
|
|
293
|
+
_context3.next = 5;
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
return _context3.abrupt("return");
|
|
297
|
+
case 5:
|
|
298
|
+
_getProductPrice.run({
|
|
152
299
|
ids: ids,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
customer_id: customer === null || customer === void 0 ? void 0 : customer.id,
|
|
156
|
-
open_quotation: 1
|
|
300
|
+
customer_id: customer === null || customer === void 0 ? void 0 : customer.id
|
|
301
|
+
// open_quotation: 1,
|
|
157
302
|
});
|
|
158
|
-
case
|
|
303
|
+
case 6:
|
|
159
304
|
case "end":
|
|
160
|
-
return
|
|
305
|
+
return _context3.stop();
|
|
161
306
|
}
|
|
162
|
-
},
|
|
307
|
+
}, _callee3);
|
|
163
308
|
}));
|
|
164
309
|
return function getCartItemProductsWithQuotation() {
|
|
165
310
|
return _ref4.apply(this, arguments);
|
|
@@ -174,26 +319,26 @@ var ContinueButton = function ContinueButton() {
|
|
|
174
319
|
* @Date: 2025-02-08 18:57
|
|
175
320
|
*/
|
|
176
321
|
var handleNextStep = /*#__PURE__*/function () {
|
|
177
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
178
|
-
return _regeneratorRuntime().wrap(function
|
|
179
|
-
while (1) switch (
|
|
322
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
323
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
324
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
180
325
|
case 0:
|
|
181
326
|
onCloseCart();
|
|
182
327
|
setOpenEmptyHolder(false);
|
|
183
328
|
|
|
184
329
|
// 如果当前是确认信息页面,则到结算页面
|
|
185
330
|
if (!isLastStep) {
|
|
186
|
-
|
|
331
|
+
_context4.next = 4;
|
|
187
332
|
break;
|
|
188
333
|
}
|
|
189
|
-
return
|
|
334
|
+
return _context4.abrupt("return", handleCheckout());
|
|
190
335
|
case 4:
|
|
191
336
|
nextStep();
|
|
192
337
|
case 5:
|
|
193
338
|
case "end":
|
|
194
|
-
return
|
|
339
|
+
return _context4.stop();
|
|
195
340
|
}
|
|
196
|
-
},
|
|
341
|
+
}, _callee4);
|
|
197
342
|
}));
|
|
198
343
|
return function handleNextStep() {
|
|
199
344
|
return _ref6.apply(this, arguments);
|
|
@@ -231,67 +376,67 @@ var ContinueButton = function ContinueButton() {
|
|
|
231
376
|
* @Date: 2025-01-16 16:30
|
|
232
377
|
*/
|
|
233
378
|
var handleContinue = /*#__PURE__*/function () {
|
|
234
|
-
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
379
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
235
380
|
var value, checkRes, emptyHolders;
|
|
236
|
-
return _regeneratorRuntime().wrap(function
|
|
237
|
-
while (1) switch (
|
|
381
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
382
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
238
383
|
case 0:
|
|
239
384
|
if (!isLastStep) {
|
|
240
|
-
|
|
385
|
+
_context6.next = 14;
|
|
241
386
|
break;
|
|
242
387
|
}
|
|
243
388
|
value = formatValues(data); // 检测商品是否可以下单
|
|
244
|
-
|
|
389
|
+
_context6.next = 4;
|
|
245
390
|
return onCheckBeforeBooking(value);
|
|
246
391
|
case 4:
|
|
247
|
-
checkRes =
|
|
392
|
+
checkRes = _context6.sent;
|
|
248
393
|
if (!((checkRes === null || checkRes === void 0 ? void 0 : checkRes.result) === false)) {
|
|
249
|
-
|
|
394
|
+
_context6.next = 9;
|
|
250
395
|
break;
|
|
251
396
|
}
|
|
252
397
|
setCheckedNumber(checkRes === null || checkRes === void 0 ? void 0 : checkRes.num);
|
|
253
398
|
setOpenCheckout(true);
|
|
254
|
-
return
|
|
399
|
+
return _context6.abrupt("return");
|
|
255
400
|
case 9:
|
|
256
401
|
// 验证holder是否为空
|
|
257
402
|
emptyHolders = getWithoutCartItemsHolderNames();
|
|
258
403
|
if (!((emptyHolders === null || emptyHolders === void 0 ? void 0 : emptyHolders.length) > 0)) {
|
|
259
|
-
|
|
404
|
+
_context6.next = 12;
|
|
260
405
|
break;
|
|
261
406
|
}
|
|
262
|
-
return
|
|
407
|
+
return _context6.abrupt("return", setOpenEmptyHolder(true));
|
|
263
408
|
case 12:
|
|
264
409
|
// 关闭购物车弹窗
|
|
265
410
|
onCloseCart();
|
|
266
|
-
return
|
|
411
|
+
return _context6.abrupt("return", handleCheckout());
|
|
267
412
|
case 14:
|
|
268
413
|
if (isLogin()) {
|
|
269
|
-
|
|
414
|
+
_context6.next = 17;
|
|
270
415
|
break;
|
|
271
416
|
}
|
|
272
417
|
onCloseCart();
|
|
273
|
-
return
|
|
418
|
+
return _context6.abrupt("return", openLoginModal({
|
|
274
419
|
callback: function () {
|
|
275
|
-
var
|
|
276
|
-
return _regeneratorRuntime().wrap(function
|
|
277
|
-
while (1) switch (
|
|
420
|
+
var _callback2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(status) {
|
|
421
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
422
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
278
423
|
case 0:
|
|
279
424
|
if (!(status === 'success')) {
|
|
280
|
-
|
|
425
|
+
_context5.next = 4;
|
|
281
426
|
break;
|
|
282
427
|
}
|
|
283
|
-
|
|
428
|
+
_context5.next = 3;
|
|
284
429
|
return getCartItemProductsWithQuotation();
|
|
285
430
|
case 3:
|
|
286
431
|
handleHolder();
|
|
287
432
|
case 4:
|
|
288
433
|
case "end":
|
|
289
|
-
return
|
|
434
|
+
return _context5.stop();
|
|
290
435
|
}
|
|
291
|
-
},
|
|
436
|
+
}, _callee5);
|
|
292
437
|
}));
|
|
293
|
-
function callback(
|
|
294
|
-
return
|
|
438
|
+
function callback(_x2) {
|
|
439
|
+
return _callback2.apply(this, arguments);
|
|
295
440
|
}
|
|
296
441
|
return callback;
|
|
297
442
|
}()
|
|
@@ -300,9 +445,9 @@ var ContinueButton = function ContinueButton() {
|
|
|
300
445
|
handleHolder();
|
|
301
446
|
case 18:
|
|
302
447
|
case "end":
|
|
303
|
-
return
|
|
448
|
+
return _context6.stop();
|
|
304
449
|
}
|
|
305
|
-
},
|
|
450
|
+
}, _callee6);
|
|
306
451
|
}));
|
|
307
452
|
return function handleContinue() {
|
|
308
453
|
return _ref7.apply(this, arguments);
|
package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.js
CHANGED
|
@@ -3,12 +3,17 @@ import OpenCard from "../../OpenCard";
|
|
|
3
3
|
import { PisellCheckboxGroup, PisellText } from '@pisell/materials';
|
|
4
4
|
import { locales } from '@pisell/utils';
|
|
5
5
|
import { useEventDetail } from "../../../../Sales";
|
|
6
|
-
var BookingOptions = function BookingOptions() {
|
|
6
|
+
var BookingOptions = function BookingOptions(props) {
|
|
7
7
|
var _detail$bookingOption, _detail$bookingOption2;
|
|
8
8
|
var _useEventDetail = useEventDetail(),
|
|
9
9
|
detail = _useEventDetail.detail,
|
|
10
10
|
currentBookingOption = _useEventDetail.currentBookingOption,
|
|
11
11
|
selectEventDetailBookingOptions = _useEventDetail.selectEventDetailBookingOptions;
|
|
12
|
+
var onChange = function onChange(value, item) {
|
|
13
|
+
var _props$onChangeBookin;
|
|
14
|
+
selectEventDetailBookingOptions(value);
|
|
15
|
+
props === null || props === void 0 || (_props$onChangeBookin = props.onChangeBookingOption) === null || _props$onChangeBookin === void 0 || _props$onChangeBookin.call(props, item);
|
|
16
|
+
};
|
|
12
17
|
return /*#__PURE__*/React.createElement(OpenCard, {
|
|
13
18
|
title: locales.getText('pisell2.event.booking.options'),
|
|
14
19
|
showBorder: true,
|
|
@@ -30,9 +35,7 @@ var BookingOptions = function BookingOptions() {
|
|
|
30
35
|
className: "price"
|
|
31
36
|
}));
|
|
32
37
|
},
|
|
33
|
-
onChange:
|
|
34
|
-
return selectEventDetailBookingOptions(value);
|
|
35
|
-
}
|
|
38
|
+
onChange: onChange
|
|
36
39
|
}));
|
|
37
40
|
};
|
|
38
41
|
export default BookingOptions;
|