@pisell/private-materials 6.4.71 → 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 +6 -6
- 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/forms/sendModal/useSendModal.d.ts +1 -1
- 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/checkout/hooks/useWalletPass.d.ts +1 -1
- 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/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/forms/sendModal/useSendModal.d.ts +1 -1
- 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/checkout/hooks/useWalletPass.d.ts +1 -1
- 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/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 +13 -13
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { FormState } from "../model";
|
|
3
|
-
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
|
-
state: FormState;
|
|
5
|
-
} & {
|
|
6
|
-
dispatch: (params: {
|
|
7
|
-
type: string;
|
|
8
|
-
payload: any;
|
|
9
|
-
}) => void;
|
|
10
|
-
}>;
|
|
1
|
+
export declare const Provider: any, Context: any;
|
|
@@ -7,10 +7,11 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
7
7
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
8
8
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
9
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
10
|
-
import {
|
|
10
|
+
import { flexibleObj, getDiscountTimeByDayMinutes } from "../../utils";
|
|
11
11
|
import { formatAmount } from '@pisell/utils';
|
|
12
12
|
import Decimal from 'decimal.js';
|
|
13
|
-
import { isDayBooking,
|
|
13
|
+
import { isDayBooking, isNormalProductByDurationSchedule } from "../../info/service2/utils";
|
|
14
|
+
import { isMultiDayProduct } from "../../info2/service/addService/utils";
|
|
14
15
|
export var getRelationDetailsTotal = function getRelationDetailsTotal(relation_details) {
|
|
15
16
|
var total = new Decimal(0);
|
|
16
17
|
var _iterator = _createForOfIteratorHelper(relation_details),
|
|
@@ -39,6 +40,8 @@ var getProductExpectAmount = function getProductExpectAmount(state, isEdit) {
|
|
|
39
40
|
var duration = new Decimal(0);
|
|
40
41
|
// 是否是跨日预约
|
|
41
42
|
var isDay = isDayBooking(state);
|
|
43
|
+
var dayDuration = new Decimal(0);
|
|
44
|
+
var minuteDuration = new Decimal(0);
|
|
42
45
|
if (isEdit) {
|
|
43
46
|
// 计算总价 服务 和 附加商品
|
|
44
47
|
if (state !== null && state !== void 0 && state.service || state !== null && state !== void 0 && state.addons) {
|
|
@@ -51,14 +54,18 @@ var getProductExpectAmount = function getProductExpectAmount(state, isEdit) {
|
|
|
51
54
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
52
55
|
var item = _step2.value;
|
|
53
56
|
// 跨日预约
|
|
54
|
-
if (isDay || isNormalProductByDurationSchedule(item)) {
|
|
57
|
+
if (isDay || isNormalProductByDurationSchedule(item) || isMultiDayProduct(item)) {
|
|
55
58
|
var quantity = new Decimal(item._extend.quantity || 1);
|
|
56
59
|
var itemTotal = new Decimal(item._extend.total || 0);
|
|
57
60
|
price = price.add(itemTotal.mul(quantity));
|
|
58
61
|
|
|
59
62
|
// 普通商品不能加到时长上
|
|
60
|
-
var _duration =
|
|
61
|
-
|
|
63
|
+
var _duration = !isNormalProductByDurationSchedule(item) ? new Decimal(item._extend.duration || 0) : new Decimal(0);
|
|
64
|
+
if (isDay || isMultiDayProduct(item)) {
|
|
65
|
+
dayDuration = dayDuration.add(_duration);
|
|
66
|
+
} else {
|
|
67
|
+
minuteDuration = minuteDuration.add(_duration);
|
|
68
|
+
}
|
|
62
69
|
} else {
|
|
63
70
|
var _quantity = new Decimal(item._extend.quantity || 1);
|
|
64
71
|
var _itemTotal = new Decimal(item._extend.total || 0);
|
|
@@ -69,6 +76,11 @@ var getProductExpectAmount = function getProductExpectAmount(state, isEdit) {
|
|
|
69
76
|
price = price.add(relationTotal);
|
|
70
77
|
var itemDuration = new Decimal(flexibleObj.getValue(item._extend.duration) || 0);
|
|
71
78
|
duration = duration.add(itemDuration);
|
|
79
|
+
if (isMultiDayProduct(item)) {
|
|
80
|
+
dayDuration = dayDuration.add(itemDuration);
|
|
81
|
+
} else {
|
|
82
|
+
minuteDuration = minuteDuration.add(itemDuration);
|
|
83
|
+
}
|
|
72
84
|
}
|
|
73
85
|
}
|
|
74
86
|
} catch (err) {
|
|
@@ -102,20 +114,25 @@ var getProductExpectAmount = function getProductExpectAmount(state, isEdit) {
|
|
|
102
114
|
var services = (state === null || state === void 0 || (_state$service2 = state.service) === null || _state$service2 === void 0 ? void 0 : _state$service2.value) || [];
|
|
103
115
|
duration = services.reduce(function (pre, cur) {
|
|
104
116
|
var current = new Decimal(0);
|
|
105
|
-
if (isDay) {
|
|
117
|
+
if (isDay || isMultiDayProduct(cur)) {
|
|
106
118
|
// 普通商品不能加到时长上
|
|
107
|
-
var _duration2 =
|
|
119
|
+
var _duration2 = !isNormalProductByDurationSchedule(cur) ? new Decimal(cur._extend.duration || 0) : new Decimal(0);
|
|
108
120
|
current = _duration2;
|
|
109
121
|
} else {
|
|
110
122
|
var _cur$_extend;
|
|
111
123
|
current = new Decimal(flexibleObj.getValue(((_cur$_extend = cur._extend) === null || _cur$_extend === void 0 ? void 0 : _cur$_extend.duration) || 0) || 0);
|
|
112
124
|
}
|
|
125
|
+
if (isDay || isMultiDayProduct(cur)) {
|
|
126
|
+
dayDuration = dayDuration.add(current);
|
|
127
|
+
} else {
|
|
128
|
+
minuteDuration = minuteDuration.add(current);
|
|
129
|
+
}
|
|
113
130
|
return pre.add(current);
|
|
114
131
|
}, new Decimal(0));
|
|
115
132
|
}
|
|
116
133
|
return {
|
|
117
134
|
productExpectAmount: price.toNumber(),
|
|
118
|
-
duration:
|
|
135
|
+
duration: getDiscountTimeByDayMinutes(dayDuration.toNumber(), minuteDuration.toNumber())
|
|
119
136
|
};
|
|
120
137
|
};
|
|
121
138
|
var getProductItemTax = function getProductItemTax(item, state, options) {
|
|
@@ -37,5 +37,12 @@ export declare const checkResourcesFormat: (resources: any[], service: any, isCh
|
|
|
37
37
|
* @Date: 2024-12-23 12:05
|
|
38
38
|
*/
|
|
39
39
|
export declare const formatProductPrice: (item: any) => number;
|
|
40
|
+
/**
|
|
41
|
+
* @title: 是否包含跨日预约商品
|
|
42
|
+
* @description:
|
|
43
|
+
* @param {any} data
|
|
44
|
+
* @return {*}
|
|
45
|
+
*/
|
|
46
|
+
export declare const getHasMultiDayProduct: (data: any) => any;
|
|
40
47
|
export declare const formatValues: (state: any) => any;
|
|
41
48
|
export declare const checkHolderIsError: (state: any) => any;
|
|
@@ -471,6 +471,21 @@ var getHolderByIndex = function getHolderByIndex(holder, index) {
|
|
|
471
471
|
});
|
|
472
472
|
};
|
|
473
473
|
|
|
474
|
+
/**
|
|
475
|
+
* @title: 是否包含跨日预约商品
|
|
476
|
+
* @description:
|
|
477
|
+
* @param {any} data
|
|
478
|
+
* @return {*}
|
|
479
|
+
*/
|
|
480
|
+
export var getHasMultiDayProduct = function getHasMultiDayProduct(data) {
|
|
481
|
+
var list = data.service.value;
|
|
482
|
+
var isHas = list.some(function (item) {
|
|
483
|
+
var _item$_extend26;
|
|
484
|
+
return (_item$_extend26 = item._extend) === null || _item$_extend26 === void 0 ? void 0 : _item$_extend26.groupId;
|
|
485
|
+
});
|
|
486
|
+
return isHas;
|
|
487
|
+
};
|
|
488
|
+
|
|
474
489
|
/**
|
|
475
490
|
* @title: 预约商品信息
|
|
476
491
|
* @description:
|
|
@@ -505,7 +520,7 @@ var formatBookings = function formatBookings(data, values) {
|
|
|
505
520
|
var eventOtherParams = data.eventOtherParams;
|
|
506
521
|
var bookings = [];
|
|
507
522
|
list.forEach(function (item) {
|
|
508
|
-
var _item$
|
|
523
|
+
var _item$_extend27, _item$_extend32;
|
|
509
524
|
// 自定义商品直接使用 _extend 中的数据,并将 id 转换为 0 提交给后端
|
|
510
525
|
if (item.isCustomItem) {
|
|
511
526
|
bookings.push(_objectSpread(_objectSpread({}, item._extend), {}, {
|
|
@@ -513,6 +528,9 @@ var formatBookings = function formatBookings(data, values) {
|
|
|
513
528
|
}));
|
|
514
529
|
return;
|
|
515
530
|
}
|
|
531
|
+
|
|
532
|
+
// 当前商品是跨日预约商品
|
|
533
|
+
var isMultiDay = (_item$_extend27 = item._extend) === null || _item$_extend27 === void 0 ? void 0 : _item$_extend27.groupId;
|
|
516
534
|
var start_date = item._extend.startDate.format('YYYY-MM-DD');
|
|
517
535
|
var end_date = item._extend.endDate.format('YYYY-MM-DD');
|
|
518
536
|
var end_time = item._extend.endDate.format('HH:mm');
|
|
@@ -526,9 +544,9 @@ var formatBookings = function formatBookings(data, values) {
|
|
|
526
544
|
|
|
527
545
|
// 跨日预约下的普通商品
|
|
528
546
|
if (isDay) {
|
|
529
|
-
var _item$
|
|
530
|
-
var startDate = ((_item$
|
|
531
|
-
var endDate = ((_item$
|
|
547
|
+
var _item$_extend28, _item$_extend29, _item$_extend30, _item$_extend31;
|
|
548
|
+
var startDate = ((_item$_extend28 = item._extend) === null || _item$_extend28 === void 0 ? void 0 : _item$_extend28.startDate) || ((_item$_extend29 = item._extend) === null || _item$_extend29 === void 0 ? void 0 : _item$_extend29.start_date);
|
|
549
|
+
var endDate = ((_item$_extend30 = item._extend) === null || _item$_extend30 === void 0 ? void 0 : _item$_extend30.endDate) || ((_item$_extend31 = item._extend) === null || _item$_extend31 === void 0 ? void 0 : _item$_extend31.end_date);
|
|
532
550
|
var _formatDayTime = formatDayTime({
|
|
533
551
|
startDate: startDate,
|
|
534
552
|
endDate: endDate
|
|
@@ -550,7 +568,7 @@ var formatBookings = function formatBookings(data, values) {
|
|
|
550
568
|
}
|
|
551
569
|
}, 'minutes');
|
|
552
570
|
}
|
|
553
|
-
if (!((_item$
|
|
571
|
+
if (!((_item$_extend32 = item._extend) !== null && _item$_extend32 !== void 0 && _item$_extend32.unique_identification_number)) {
|
|
554
572
|
var unique_identification_number = getUniqueId();
|
|
555
573
|
item._extend.unique_identification_number = unique_identification_number;
|
|
556
574
|
}
|
|
@@ -570,14 +588,16 @@ var formatBookings = function formatBookings(data, values) {
|
|
|
570
588
|
start_time: start_time,
|
|
571
589
|
end_date: end_date,
|
|
572
590
|
start_date: start_date,
|
|
573
|
-
duration: isDay ? 0 : flexibleObj.getValue(item._extend.duration),
|
|
591
|
+
duration: isDay || isMultiDay ? 0 : flexibleObj.getValue(item._extend.duration),
|
|
574
592
|
number: item._extend.capacity ? getSumCapacity({
|
|
575
593
|
cacheItem: item
|
|
576
594
|
}) : item._extend.number || 1,
|
|
577
595
|
resources: formatResource(item),
|
|
578
596
|
note: item._extend.note
|
|
579
597
|
}, eventOtherParams || {}), dayParams);
|
|
580
|
-
|
|
598
|
+
|
|
599
|
+
// 跨日预约模版或当前是跨日预约商品时
|
|
600
|
+
if (isDay || isMultiDay) {
|
|
581
601
|
bookings.push(booking);
|
|
582
602
|
return;
|
|
583
603
|
}
|
|
@@ -610,16 +630,16 @@ var formatRelationProducts = function formatRelationProducts(data, type) {
|
|
|
610
630
|
var list = ((_data$service = data.service) === null || _data$service === void 0 ? void 0 : _data$service.value) || [];
|
|
611
631
|
// open items 下的商品
|
|
612
632
|
list = list.filter(function (item) {
|
|
613
|
-
var _item$
|
|
633
|
+
var _item$_extend33;
|
|
614
634
|
return (
|
|
615
635
|
// 跨日预约把普通商品加在relationProducts 活动预约按之前逻辑
|
|
616
|
-
type === 'day' ? isNormalProductByDurationSchedule(item) : ((_item$
|
|
636
|
+
type === 'day' ? isNormalProductByDurationSchedule(item) : ((_item$_extend33 = item._extend) === null || _item$_extend33 === void 0 ? void 0 : _item$_extend33.holder_id) && appointmentTypes.includes(item.extension_type)
|
|
617
637
|
);
|
|
618
638
|
});
|
|
619
639
|
var relationProducts = [];
|
|
620
640
|
relationProducts = list.map(function (item) {
|
|
621
|
-
var _item$
|
|
622
|
-
if (!((_item$
|
|
641
|
+
var _item$_extend34;
|
|
642
|
+
if (!((_item$_extend34 = item._extend) !== null && _item$_extend34 !== void 0 && _item$_extend34.unique_identification_number)) {
|
|
623
643
|
var unique_identification_number = getUniqueId();
|
|
624
644
|
item._extend.unique_identification_number = unique_identification_number;
|
|
625
645
|
}
|
|
@@ -638,8 +658,8 @@ var formatNormalProducts = function formatNormalProducts(data) {
|
|
|
638
658
|
});
|
|
639
659
|
var relationProducts = [];
|
|
640
660
|
relationProducts = list.map(function (item) {
|
|
641
|
-
var _item$
|
|
642
|
-
if (!((_item$
|
|
661
|
+
var _item$_extend35;
|
|
662
|
+
if (!((_item$_extend35 = item._extend) !== null && _item$_extend35 !== void 0 && _item$_extend35.unique_identification_number)) {
|
|
643
663
|
var unique_identification_number = getUniqueId();
|
|
644
664
|
item._extend.unique_identification_number = unique_identification_number;
|
|
645
665
|
}
|
|
@@ -696,7 +716,11 @@ export var formatValues = function formatValues(state) {
|
|
|
696
716
|
relation_products: [],
|
|
697
717
|
metadata: {}
|
|
698
718
|
};
|
|
719
|
+
|
|
720
|
+
// 是是跨日预约模版
|
|
699
721
|
var isDay = isDaysBooking(state);
|
|
722
|
+
// 是否包含跨日预约商品
|
|
723
|
+
var isHasMultiDay = getHasMultiDayProduct(state);
|
|
700
724
|
var isEvent = isEventBooking(state);
|
|
701
725
|
if (!state.bookingId || isDay) {
|
|
702
726
|
// 备注
|
|
@@ -719,8 +743,8 @@ export var formatValues = function formatValues(state) {
|
|
|
719
743
|
// 主体
|
|
720
744
|
values.holder = formatHolder(state, values);
|
|
721
745
|
// todo
|
|
722
|
-
if (
|
|
723
|
-
values.relation_products = formatRelationProducts(state,
|
|
746
|
+
if (isEvent) {
|
|
747
|
+
values.relation_products = formatRelationProducts(state, 'event');
|
|
724
748
|
} else {
|
|
725
749
|
var _values$relation_prod;
|
|
726
750
|
values.relation_products = formatNormalProducts(state);
|
|
@@ -741,7 +765,7 @@ export var formatValues = function formatValues(state) {
|
|
|
741
765
|
}
|
|
742
766
|
|
|
743
767
|
// 跨日预约增加多余参数区分
|
|
744
|
-
if (isDay) {
|
|
768
|
+
if (isDay || isHasMultiDay) {
|
|
745
769
|
values.metadata.is_multiday_appointment = 1;
|
|
746
770
|
// is_bundle_price_calculated 用于区分商品的price是总价,还是商品的单价
|
|
747
771
|
// values.is_bundle_price_calculated = 1
|
|
@@ -760,21 +784,21 @@ export var checkHolderIsError = function checkHolderIsError(state) {
|
|
|
760
784
|
var _state$client;
|
|
761
785
|
var errorRowKey = '';
|
|
762
786
|
var holderError = state.service.value.some(function (item) {
|
|
763
|
-
var _item$
|
|
787
|
+
var _item$_extend37;
|
|
764
788
|
// 普通商品不需要检测holder
|
|
765
789
|
if (isNormalProductByDurationSchedule(item)) {
|
|
766
790
|
return false;
|
|
767
791
|
}
|
|
768
792
|
if (item._extend.quantity === 1 && !item._extend.holder_id) {
|
|
769
|
-
var _item$_extend34;
|
|
770
|
-
errorRowKey = genRowKey(item === null || item === void 0 || (_item$_extend34 = item._extend) === null || _item$_extend34 === void 0 || (_item$_extend34 = _item$_extend34.other) === null || _item$_extend34 === void 0 ? void 0 : _item$_extend34.rowKey);
|
|
771
|
-
return true;
|
|
772
|
-
}
|
|
773
|
-
if (item._extend.quantity > 1 && ((_item$_extend35 = item._extend) === null || _item$_extend35 === void 0 || (_item$_extend35 = _item$_extend35.holder_id) === null || _item$_extend35 === void 0 ? void 0 : _item$_extend35.length) !== item._extend.quantity) {
|
|
774
793
|
var _item$_extend36;
|
|
775
794
|
errorRowKey = genRowKey(item === null || item === void 0 || (_item$_extend36 = item._extend) === null || _item$_extend36 === void 0 || (_item$_extend36 = _item$_extend36.other) === null || _item$_extend36 === void 0 ? void 0 : _item$_extend36.rowKey);
|
|
776
795
|
return true;
|
|
777
796
|
}
|
|
797
|
+
if (item._extend.quantity > 1 && ((_item$_extend37 = item._extend) === null || _item$_extend37 === void 0 || (_item$_extend37 = _item$_extend37.holder_id) === null || _item$_extend37 === void 0 ? void 0 : _item$_extend37.length) !== item._extend.quantity) {
|
|
798
|
+
var _item$_extend38;
|
|
799
|
+
errorRowKey = genRowKey(item === null || item === void 0 || (_item$_extend38 = item._extend) === null || _item$_extend38 === void 0 || (_item$_extend38 = _item$_extend38.other) === null || _item$_extend38 === void 0 ? void 0 : _item$_extend38.rowKey);
|
|
800
|
+
return true;
|
|
801
|
+
}
|
|
778
802
|
return false;
|
|
779
803
|
});
|
|
780
804
|
var clientId = (_state$client = state.client) === null || _state$client === void 0 || (_state$client = _state$client.value) === null || _state$client === void 0 ? void 0 : _state$client.id;
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { FormState } from "../model";
|
|
3
|
-
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
|
-
state: FormState;
|
|
5
|
-
} & {
|
|
6
|
-
dispatch: (params: {
|
|
7
|
-
type: string;
|
|
8
|
-
payload: any;
|
|
9
|
-
}) => void;
|
|
10
|
-
}>;
|
|
1
|
+
export declare const Provider: any, Context: any;
|
|
@@ -4,6 +4,6 @@ declare const useSendModal: (bookingId?: number) => {
|
|
|
4
4
|
setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
5
5
|
handleOpen: () => void;
|
|
6
6
|
handleValuesChange: (val: any) => void;
|
|
7
|
-
handleOk: (values: SendModalValues) => Promise<
|
|
7
|
+
handleOk: (values: SendModalValues) => Promise<any>;
|
|
8
8
|
};
|
|
9
9
|
export default useSendModal;
|
|
@@ -18,8 +18,9 @@ import { getProductTotalPrice } from "../utils";
|
|
|
18
18
|
import useEngineContext from "../../../hooks/useEngineContext";
|
|
19
19
|
import { locales } from "@pisell/utils";
|
|
20
20
|
import { PisellModal } from "@pisell/materials";
|
|
21
|
-
import {
|
|
21
|
+
import { getNormalAndMultiDayProductPrice } from "../info/service/serve";
|
|
22
22
|
import Decimal from 'decimal.js';
|
|
23
|
+
import dayjs from 'dayjs';
|
|
23
24
|
var formatBundleItemMap = function formatBundleItemMap(product) {
|
|
24
25
|
return product.bundle_group.reduce(function (pre, cur) {
|
|
25
26
|
var curObj = {};
|
|
@@ -53,10 +54,17 @@ var setNewCartValue = function setNewCartValue(cartValue, newProducts) {
|
|
|
53
54
|
// 是否套餐子商品被删除
|
|
54
55
|
var isNotFoundBundle = false;
|
|
55
56
|
var notFoundProducts = [];
|
|
57
|
+
|
|
58
|
+
// 缓存跨日商品的 multiDayPrices,避免同一 groupId 重复计算
|
|
59
|
+
var multiDayPricesCache = new Map();
|
|
56
60
|
var value = cartValue.map(function (item) {
|
|
57
|
-
var _item$_extend, _item$_extend2;
|
|
61
|
+
var _item$_extend, _item$_extend2, _item$_extend3, _item$_extend4;
|
|
62
|
+
// 格式化商品日期用于匹配
|
|
63
|
+
var itemScheduleDate = (_item$_extend = item._extend) !== null && _item$_extend !== void 0 && _item$_extend.startDate ? dayjs(item._extend.startDate).format('YYYY-MM-DD') : '';
|
|
64
|
+
|
|
65
|
+
// 根据 product_id 和 schedule_date 匹配
|
|
58
66
|
var newProduct = newProducts.find(function (newItem) {
|
|
59
|
-
return newItem.id === item.product_id;
|
|
67
|
+
return newItem.id === item.product_id && newItem.schedule_date === itemScheduleDate;
|
|
60
68
|
});
|
|
61
69
|
if (!newProduct) {
|
|
62
70
|
return item;
|
|
@@ -64,7 +72,7 @@ var setNewCartValue = function setNewCartValue(cartValue, newProducts) {
|
|
|
64
72
|
// 是否报价单变更价格更新
|
|
65
73
|
var isChangePrice = newProduct.price != item.price;
|
|
66
74
|
var bundleItemMap = formatBundleItemMap(newProduct);
|
|
67
|
-
var newBundle = (((_item$
|
|
75
|
+
var newBundle = (((_item$_extend2 = item._extend) === null || _item$_extend2 === void 0 || (_item$_extend2 = _item$_extend2.other) === null || _item$_extend2 === void 0 ? void 0 : _item$_extend2.bundle) || []).map(function (bundle) {
|
|
68
76
|
if (!bundleItemMap[bundle.id]) {
|
|
69
77
|
isNotFoundBundle = true;
|
|
70
78
|
if (!notFoundProducts.some(function (p) {
|
|
@@ -92,6 +100,36 @@ var setNewCartValue = function setNewCartValue(cartValue, newProducts) {
|
|
|
92
100
|
});
|
|
93
101
|
});
|
|
94
102
|
|
|
103
|
+
// 处理跨日商品的 multiDayPrices
|
|
104
|
+
if ((_item$_extend3 = item._extend) !== null && _item$_extend3 !== void 0 && _item$_extend3.groupId) {
|
|
105
|
+
// 检查缓存中是否已经计算过该 groupId
|
|
106
|
+
if (!multiDayPricesCache.has(item._extend.groupId)) {
|
|
107
|
+
// 找到该商品所有日期的价格记录
|
|
108
|
+
var productPrices = newProducts.filter(function (p) {
|
|
109
|
+
return p.id === item.product_id;
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// 构建 multiDayPrices 对象
|
|
113
|
+
var multiDayPrices = {};
|
|
114
|
+
productPrices.forEach(function (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: dayjs(priceItem.schedule_date).add(1, 'day').format('YYYY-MM-DD')
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// 缓存结果
|
|
126
|
+
multiDayPricesCache.set(item._extend.groupId, multiDayPrices);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// 从缓存获取并设置到商品
|
|
130
|
+
item._extend.multiDayPrices = multiDayPricesCache.get(item._extend.groupId);
|
|
131
|
+
}
|
|
132
|
+
|
|
95
133
|
// 价格都没有变动时返回原始信息
|
|
96
134
|
if (!isChangePrice) {
|
|
97
135
|
return item;
|
|
@@ -107,7 +145,7 @@ var setNewCartValue = function setNewCartValue(cartValue, newProducts) {
|
|
|
107
145
|
// total: newProduct.total,
|
|
108
146
|
bundle_edit: isBundleChange ? 1 : item._extend.bundle_edit,
|
|
109
147
|
other: _objectSpread(_objectSpread({}, item._extend.other), {}, {
|
|
110
|
-
option: (_item$
|
|
148
|
+
option: (_item$_extend4 = item._extend) === null || _item$_extend4 === void 0 || (_item$_extend4 = _item$_extend4.other) === null || _item$_extend4 === void 0 ? void 0 : _item$_extend4.option,
|
|
111
149
|
bundle: newBundle
|
|
112
150
|
})
|
|
113
151
|
})
|
|
@@ -139,7 +177,7 @@ var useQuotation = function useQuotation(state, dispatch) {
|
|
|
139
177
|
cartValueRef.current = state.service.value;
|
|
140
178
|
var getCartQuotation = /*#__PURE__*/function () {
|
|
141
179
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
|
142
|
-
var
|
|
180
|
+
var queryData, data;
|
|
143
181
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
144
182
|
while (1) switch (_context.prev = _context.next) {
|
|
145
183
|
case 0:
|
|
@@ -149,28 +187,38 @@ var useQuotation = function useQuotation(state, dispatch) {
|
|
|
149
187
|
}
|
|
150
188
|
return _context.abrupt("return");
|
|
151
189
|
case 2:
|
|
152
|
-
|
|
190
|
+
if (params !== null && params !== void 0 && params.customer_id) {
|
|
191
|
+
_context.next = 4;
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
return _context.abrupt("return");
|
|
195
|
+
case 4:
|
|
196
|
+
// 构建查询参数:为每个商品生成 { product_id, schedule_date }
|
|
197
|
+
queryData = cartValueRef.current.filter(function (item) {
|
|
153
198
|
return !item.isCustomItem;
|
|
154
199
|
}) // 过滤掉自定义商品
|
|
155
200
|
.map(function (item) {
|
|
156
|
-
|
|
201
|
+
var _item$_extend5;
|
|
202
|
+
return {
|
|
203
|
+
product_id: item.product_id,
|
|
204
|
+
schedule_date: (_item$_extend5 = item._extend) !== null && _item$_extend5 !== void 0 && _item$_extend5.startDate ? dayjs(item._extend.startDate).format('YYYY-MM-DD') : params === null || params === void 0 ? void 0 : params.schedule_date // 如果没有商品日期,使用传入的默认日期
|
|
205
|
+
};
|
|
157
206
|
});
|
|
158
|
-
if (
|
|
159
|
-
_context.next =
|
|
207
|
+
if (queryData.length) {
|
|
208
|
+
_context.next = 7;
|
|
160
209
|
break;
|
|
161
210
|
}
|
|
162
211
|
return _context.abrupt("return");
|
|
163
|
-
case 5:
|
|
164
|
-
_context.next = 7;
|
|
165
|
-
return getProductPrice({
|
|
166
|
-
ids: ids,
|
|
167
|
-
schedule_date: params === null || params === void 0 ? void 0 : params.schedule_date,
|
|
168
|
-
customer_id: params === null || params === void 0 ? void 0 : params.customer_id
|
|
169
|
-
});
|
|
170
212
|
case 7:
|
|
171
|
-
|
|
172
|
-
return
|
|
213
|
+
_context.next = 9;
|
|
214
|
+
return getNormalAndMultiDayProductPrice({
|
|
215
|
+
customer_id: params === null || params === void 0 ? void 0 : params.customer_id,
|
|
216
|
+
data: queryData
|
|
217
|
+
});
|
|
173
218
|
case 9:
|
|
219
|
+
data = _context.sent;
|
|
220
|
+
return _context.abrupt("return", data.data);
|
|
221
|
+
case 11:
|
|
174
222
|
case "end":
|
|
175
223
|
return _context.stop();
|
|
176
224
|
}
|
|
@@ -193,13 +241,13 @@ var useQuotation = function useQuotation(state, dispatch) {
|
|
|
193
241
|
return getCartQuotation(params);
|
|
194
242
|
case 2:
|
|
195
243
|
data = _context2.sent;
|
|
196
|
-
if (data
|
|
244
|
+
if (!(!data || !data.length)) {
|
|
197
245
|
_context2.next = 5;
|
|
198
246
|
break;
|
|
199
247
|
}
|
|
200
248
|
return _context2.abrupt("return");
|
|
201
249
|
case 5:
|
|
202
|
-
_setNewCartValue = setNewCartValue(cartValueRef.current, data
|
|
250
|
+
_setNewCartValue = setNewCartValue(cartValueRef.current, data), isChange = _setNewCartValue.isChange, newCartValue = _setNewCartValue.value, isNotFoundBundle = _setNewCartValue.isNotFoundBundle, notFoundProducts = _setNewCartValue.notFoundProducts;
|
|
203
251
|
if (!isNotFoundBundle) {
|
|
204
252
|
_context2.next = 10;
|
|
205
253
|
break;
|
|
@@ -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;
|
|
@@ -104,7 +104,7 @@ var Lists = function Lists(_ref) {
|
|
|
104
104
|
var products = useMemo(function () {
|
|
105
105
|
var _state$service;
|
|
106
106
|
console.time('products');
|
|
107
|
-
var p = formatProducts((state === null || state === void 0 || (_state$service = state.service) === null || _state$service === void 0 ? void 0 : _state$service.value) || [], state,
|
|
107
|
+
var p = formatProducts((state === null || state === void 0 || (_state$service = state.service) === null || _state$service === void 0 ? void 0 : _state$service.value) || [], state, true, true, isParallelResource);
|
|
108
108
|
console.timeEnd('products');
|
|
109
109
|
return p;
|
|
110
110
|
}, [state === null || state === void 0 || (_state$service2 = state.service) === null || _state$service2 === void 0 ? void 0 : _state$service2.value, state]);
|
|
@@ -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 {};
|
|
@@ -22,7 +22,7 @@ export var getProductDetail = /*#__PURE__*/function () {
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* @title: 跨日预约获取预约商品报价单
|
|
25
|
-
* @description:
|
|
25
|
+
* @description:
|
|
26
26
|
* @param {string} id
|
|
27
27
|
* @param {any} params
|
|
28
28
|
* @return {*}
|
|
@@ -67,4 +67,25 @@ export var getProductPrice = /*#__PURE__*/function () {
|
|
|
67
67
|
return function getProductPrice(_x5) {
|
|
68
68
|
return _ref3.apply(this, arguments);
|
|
69
69
|
};
|
|
70
|
+
}();
|
|
71
|
+
/**
|
|
72
|
+
* 获取普通商品和跨日预约的价格
|
|
73
|
+
* @param params
|
|
74
|
+
* @returns
|
|
75
|
+
*/
|
|
76
|
+
export var getNormalAndMultiDayProductPrice = /*#__PURE__*/function () {
|
|
77
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
78
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
79
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
80
|
+
case 0:
|
|
81
|
+
return _context4.abrupt("return", request.getRequest().post("/shop/product/query/shelf/price", params));
|
|
82
|
+
case 1:
|
|
83
|
+
case "end":
|
|
84
|
+
return _context4.stop();
|
|
85
|
+
}
|
|
86
|
+
}, _callee4);
|
|
87
|
+
}));
|
|
88
|
+
return function getNormalAndMultiDayProductPrice(_x6) {
|
|
89
|
+
return _ref4.apply(this, arguments);
|
|
90
|
+
};
|
|
70
91
|
}();
|
|
@@ -7,6 +7,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
7
7
|
import { getUniqueId } from "@pisell/utils";
|
|
8
8
|
import { getProductTotalPrice } from "../../../utils";
|
|
9
9
|
import { distributeDiscountOrIncrease } from "../../service/serviceManager/distributeDiscount";
|
|
10
|
+
import { genServiceKey } from "../../../../ticketBooking/utils";
|
|
10
11
|
|
|
11
12
|
// 创建group
|
|
12
13
|
|
|
@@ -107,6 +108,7 @@ export var createBookingItemsByGroup = function createBookingItemsByGroup(item,
|
|
|
107
108
|
cacheItem._extend.total = totalPrice;
|
|
108
109
|
cacheItem._extend.origin_total = totalPrice;
|
|
109
110
|
cacheItem._extend.items = undefined;
|
|
111
|
+
cacheItem._serviceKey = genServiceKey(cacheItem);
|
|
110
112
|
bookings.push(cacheItem);
|
|
111
113
|
}
|
|
112
114
|
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:
|