@pisell/private-materials 6.11.150 → 6.11.152

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.
@@ -730,7 +730,6 @@ export var getHasMultiDayProduct = function getHasMultiDayProduct(data) {
730
730
  * @Date: 2024-02-19 09:26
731
731
  */
732
732
  var formatBookings = function formatBookings(data, values) {
733
- var _data$appointment_sta;
734
733
  // 是否是跨日预约
735
734
  var isDay = isDaysBooking(data);
736
735
  var isEvent = isEventBooking(data);
@@ -754,7 +753,7 @@ var formatBookings = function formatBookings(data, values) {
754
753
  }
755
754
  var dayParams = {};
756
755
  var eventOtherParams = data.eventOtherParams;
757
- var appointmentStatus = (_data$appointment_sta = data.appointment_status) !== null && _data$appointment_sta !== void 0 ? _data$appointment_sta : 'new';
756
+ // const appointment_booking = data?.appointment_bookin
758
757
  var bookings = [];
759
758
  var obj = {};
760
759
 
@@ -766,19 +765,20 @@ var formatBookings = function formatBookings(data, values) {
766
765
  }
767
766
  });
768
767
  list.forEach(function (item) {
769
- var _item$_extend52, _item$_extend57;
768
+ var _item$_extend53, _item$_extend58, _item$_extend59;
770
769
  // 自定义商品直接使用 _extend 中的数据,并将 id 转换为 0 提交给后端
771
770
  if (item.isCustomItem) {
771
+ var _item$_extend52;
772
772
  bookings.push(_objectSpread(_objectSpread({}, item._extend), {}, {
773
773
  product_id: 0,
774
774
  // 确保后端接收到的 product_id 为 0
775
- appointment_status: appointmentStatus
775
+ appointment_status: (item === null || item === void 0 || (_item$_extend52 = item._extend) === null || _item$_extend52 === void 0 ? void 0 : _item$_extend52.appointment_status) || (data === null || data === void 0 ? void 0 : data.appointment_status) || 'new'
776
776
  }));
777
777
  return;
778
778
  }
779
779
 
780
780
  // 当前商品是跨日预约商品
781
- var isMultiDay = (_item$_extend52 = item._extend) === null || _item$_extend52 === void 0 ? void 0 : _item$_extend52.groupId;
781
+ var isMultiDay = (_item$_extend53 = item._extend) === null || _item$_extend53 === void 0 ? void 0 : _item$_extend53.groupId;
782
782
  var start_date = item._extend.startDate.format('YYYY-MM-DD');
783
783
  var end_date = item._extend.endDate.format('YYYY-MM-DD');
784
784
  var end_time = item._extend.endDate.format('HH:mm');
@@ -792,9 +792,9 @@ var formatBookings = function formatBookings(data, values) {
792
792
 
793
793
  // 跨日预约下的普通商品
794
794
  if (isDay) {
795
- var _item$_extend53, _item$_extend54, _item$_extend55, _item$_extend56;
796
- var startDate = ((_item$_extend53 = item._extend) === null || _item$_extend53 === void 0 ? void 0 : _item$_extend53.startDate) || ((_item$_extend54 = item._extend) === null || _item$_extend54 === void 0 ? void 0 : _item$_extend54.start_date);
797
- var endDate = ((_item$_extend55 = item._extend) === null || _item$_extend55 === void 0 ? void 0 : _item$_extend55.endDate) || ((_item$_extend56 = item._extend) === null || _item$_extend56 === void 0 ? void 0 : _item$_extend56.end_date);
795
+ var _item$_extend54, _item$_extend55, _item$_extend56, _item$_extend57;
796
+ var startDate = ((_item$_extend54 = item._extend) === null || _item$_extend54 === void 0 ? void 0 : _item$_extend54.startDate) || ((_item$_extend55 = item._extend) === null || _item$_extend55 === void 0 ? void 0 : _item$_extend55.start_date);
797
+ var endDate = ((_item$_extend56 = item._extend) === null || _item$_extend56 === void 0 ? void 0 : _item$_extend56.endDate) || ((_item$_extend57 = item._extend) === null || _item$_extend57 === void 0 ? void 0 : _item$_extend57.end_date);
798
798
  var _formatDayTime = formatDayTime({
799
799
  startDate: startDate,
800
800
  endDate: endDate
@@ -820,9 +820,9 @@ var formatBookings = function formatBookings(data, values) {
820
820
  // 跨日预约处理: 跨日预约所有数据都在list中, 每一组预约通过groupId进行分组
821
821
  // 通过obj 记录下每个GroupId第一次出现的时机, 第一次出现需要设置 metadata.multiDayPrices
822
822
  // 后续出现不需要设置 metadata.multiDayPrices. 节省体积
823
- var isSetGroupId = obj[item === null || item === void 0 || (_item$_extend57 = item._extend) === null || _item$_extend57 === void 0 ? void 0 : _item$_extend57.groupId];
823
+ var isSetGroupId = obj[item === null || item === void 0 || (_item$_extend58 = item._extend) === null || _item$_extend58 === void 0 ? void 0 : _item$_extend58.groupId];
824
824
  var booking = _objectSpread(_objectSpread({
825
- appointment_status: appointmentStatus,
825
+ appointment_status: (item === null || item === void 0 || (_item$_extend59 = item._extend) === null || _item$_extend59 === void 0 ? void 0 : _item$_extend59.appointment_status) || (data === null || data === void 0 ? void 0 : data.appointment_status) || 'new',
826
826
  schedule_event_id: item === null || item === void 0 ? void 0 : item.booking_id,
827
827
  product: formatProducts(item, undefined, list),
828
828
  relation_products: formatRelationDetails(item._extend.relation_details),
@@ -898,16 +898,16 @@ var formatRelationProducts = function formatRelationProducts(data, type) {
898
898
  var allList = ((_data$service = data.service) === null || _data$service === void 0 ? void 0 : _data$service.value) || [];
899
899
  // open items 下的商品
900
900
  var list = allList.filter(function (item) {
901
- var _item$_extend58;
901
+ var _item$_extend60;
902
902
  return (
903
903
  // 跨日预约把普通商品加在relationProducts 活动预约按之前逻辑
904
- type === 'day' ? isNormalProductByDurationSchedule(item) : ((_item$_extend58 = item._extend) === null || _item$_extend58 === void 0 ? void 0 : _item$_extend58.holder_id) && appointmentTypes.includes(item.extension_type)
904
+ type === 'day' ? isNormalProductByDurationSchedule(item) : ((_item$_extend60 = item._extend) === null || _item$_extend60 === void 0 ? void 0 : _item$_extend60.holder_id) && appointmentTypes.includes(item.extension_type)
905
905
  );
906
906
  });
907
907
  var relationProducts = [];
908
908
  relationProducts = list.map(function (item) {
909
- var _item$_extend59;
910
- if (!((_item$_extend59 = item._extend) !== null && _item$_extend59 !== void 0 && _item$_extend59.unique_identification_number)) {
909
+ var _item$_extend61;
910
+ if (!((_item$_extend61 = item._extend) !== null && _item$_extend61 !== void 0 && _item$_extend61.unique_identification_number)) {
911
911
  var unique_identification_number = getUniqueId();
912
912
  item._extend.unique_identification_number = unique_identification_number;
913
913
  }
@@ -921,8 +921,8 @@ var formatNormalProducts = function formatNormalProducts(data) {
921
921
  var _data$service2;
922
922
  var allList = ((_data$service2 = data.service) === null || _data$service2 === void 0 ? void 0 : _data$service2.value) || [];
923
923
  allList.forEach(function (item) {
924
- var _item$_extend60;
925
- if (!((_item$_extend60 = item._extend) !== null && _item$_extend60 !== void 0 && _item$_extend60.unique_identification_number)) {
924
+ var _item$_extend62;
925
+ if (!((_item$_extend62 = item._extend) !== null && _item$_extend62 !== void 0 && _item$_extend62.unique_identification_number)) {
926
926
  var unique_identification_number = getUniqueId();
927
927
  item._extend.unique_identification_number = unique_identification_number;
928
928
  }
@@ -1059,21 +1059,21 @@ export var checkHolderIsError = function checkHolderIsError(state) {
1059
1059
  var _state$client;
1060
1060
  var errorRowKey = '';
1061
1061
  var holderError = state.service.value.some(function (item) {
1062
- var _item$_extend$holder_2, _item$_extend62;
1062
+ var _item$_extend$holder_2, _item$_extend64;
1063
1063
  // 普通商品不需要检测holder
1064
1064
  if (isNormalProductByDurationSchedule(item)) {
1065
1065
  return false;
1066
1066
  }
1067
1067
  if (item._extend.quantity === 1 && (!item._extend.holder_id || ((_item$_extend$holder_2 = item._extend.holder_id) === null || _item$_extend$holder_2 === void 0 ? void 0 : _item$_extend$holder_2.length) === 0)) {
1068
- var _item$_extend61;
1069
- errorRowKey = genRowKey(item === null || item === void 0 || (_item$_extend61 = item._extend) === null || _item$_extend61 === void 0 || (_item$_extend61 = _item$_extend61.other) === null || _item$_extend61 === void 0 ? void 0 : _item$_extend61.rowKey);
1070
- return true;
1071
- }
1072
- if (item._extend.quantity > 1 && ((_item$_extend62 = item._extend) === null || _item$_extend62 === void 0 || (_item$_extend62 = _item$_extend62.holder_id) === null || _item$_extend62 === void 0 ? void 0 : _item$_extend62.length) !== item._extend.quantity) {
1073
1068
  var _item$_extend63;
1074
1069
  errorRowKey = genRowKey(item === null || item === void 0 || (_item$_extend63 = item._extend) === null || _item$_extend63 === void 0 || (_item$_extend63 = _item$_extend63.other) === null || _item$_extend63 === void 0 ? void 0 : _item$_extend63.rowKey);
1075
1070
  return true;
1076
1071
  }
1072
+ if (item._extend.quantity > 1 && ((_item$_extend64 = item._extend) === null || _item$_extend64 === void 0 || (_item$_extend64 = _item$_extend64.holder_id) === null || _item$_extend64 === void 0 ? void 0 : _item$_extend64.length) !== item._extend.quantity) {
1073
+ var _item$_extend65;
1074
+ errorRowKey = genRowKey(item === null || item === void 0 || (_item$_extend65 = item._extend) === null || _item$_extend65 === void 0 || (_item$_extend65 = _item$_extend65.other) === null || _item$_extend65 === void 0 ? void 0 : _item$_extend65.rowKey);
1075
+ return true;
1076
+ }
1077
1077
  return false;
1078
1078
  });
1079
1079
  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;
@@ -330,10 +330,13 @@ function TicketBookingDialog(props) {
330
330
  */
331
331
  function getPaidAmounts(bookingOrigin) {
332
332
  var payments = (bookingOrigin === null || bookingOrigin === void 0 ? void 0 : bookingOrigin.payments) || [];
333
- var paidAmount = payments.reduce(function (total, item) {
333
+ var paidPayments = payments.filter(function (item) {
334
+ return (item === null || item === void 0 ? void 0 : item.status) === 'paid';
335
+ });
336
+ var paidAmount = paidPayments.reduce(function (total, item) {
334
337
  return total + Number(item.amount);
335
338
  }, 0);
336
- var paidAmountWithoutSurcharge = payments.reduce(function (total, item) {
339
+ var paidAmountWithoutSurcharge = paidPayments.reduce(function (total, item) {
337
340
  return total + Number(item.amount) - Number(item.service_fee || 0);
338
341
  }, 0);
339
342
  return {
@@ -541,7 +541,6 @@ var formatBookings = (data, values) => {
541
541
  }
542
542
  let dayParams = {};
543
543
  const eventOtherParams = data.eventOtherParams;
544
- const appointmentStatus = data.appointment_status ?? "new";
545
544
  let bookings = [];
546
545
  let obj = {};
547
546
  list.forEach((item) => {
@@ -551,17 +550,17 @@ var formatBookings = (data, values) => {
551
550
  }
552
551
  });
553
552
  list.forEach((item) => {
554
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
553
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
555
554
  if (item.isCustomItem) {
556
555
  bookings.push({
557
556
  ...item._extend,
558
557
  product_id: 0,
559
558
  // 确保后端接收到的 product_id 为 0
560
- appointment_status: appointmentStatus
559
+ appointment_status: ((_a = item == null ? void 0 : item._extend) == null ? void 0 : _a.appointment_status) || (data == null ? void 0 : data.appointment_status) || "new"
561
560
  });
562
561
  return;
563
562
  }
564
- const isMultiDay = (_a = item._extend) == null ? void 0 : _a.groupId;
563
+ const isMultiDay = (_b = item._extend) == null ? void 0 : _b.groupId;
565
564
  let start_date = item._extend.startDate.format("YYYY-MM-DD");
566
565
  let end_date = item._extend.endDate.format("YYYY-MM-DD");
567
566
  let end_time = item._extend.endDate.format("HH:mm");
@@ -571,8 +570,8 @@ var formatBookings = (data, values) => {
571
570
  }
572
571
  dayParams.holder = formatHolders(data, item, values);
573
572
  if (isDay) {
574
- const startDate = ((_b = item._extend) == null ? void 0 : _b.startDate) || ((_c = item._extend) == null ? void 0 : _c.start_date);
575
- const endDate = ((_d = item._extend) == null ? void 0 : _d.endDate) || ((_e = item._extend) == null ? void 0 : _e.end_date);
573
+ const startDate = ((_c = item._extend) == null ? void 0 : _c.startDate) || ((_d = item._extend) == null ? void 0 : _d.start_date);
574
+ const endDate = ((_e = item._extend) == null ? void 0 : _e.endDate) || ((_f = item._extend) == null ? void 0 : _f.end_date);
576
575
  const { startDateTime, endDateTime } = (0, import_utils4.formatDayTime)({
577
576
  startDate,
578
577
  endDate
@@ -588,9 +587,9 @@ var formatBookings = (data, values) => {
588
587
  "minutes"
589
588
  );
590
589
  }
591
- const isSetGroupId = obj[(_f = item == null ? void 0 : item._extend) == null ? void 0 : _f.groupId];
590
+ const isSetGroupId = obj[(_g = item == null ? void 0 : item._extend) == null ? void 0 : _g.groupId];
592
591
  const booking = {
593
- appointment_status: appointmentStatus,
592
+ appointment_status: ((_h = item == null ? void 0 : item._extend) == null ? void 0 : _h.appointment_status) || (data == null ? void 0 : data.appointment_status) || "new",
594
593
  schedule_event_id: item == null ? void 0 : item.booking_id,
595
594
  product: formatProducts(item, void 0, list),
596
595
  relation_products: formatRelationDetails(item._extend.relation_details),
@@ -626,7 +625,7 @@ var formatBookings = (data, values) => {
626
625
  newItem._extend.unique_identification_number = `${item._extend.unique_identification_number}_${i}`;
627
626
  if (i > 0) {
628
627
  newItem._extend.surcharge_rounding_remainder = void 0;
629
- if (((_i = (_h = (_g = newItem._extend) == null ? void 0 : _g.other) == null ? void 0 : _h.bundle) == null ? void 0 : _i.length) > 0) {
628
+ if (((_k = (_j = (_i = newItem._extend) == null ? void 0 : _i.other) == null ? void 0 : _j.bundle) == null ? void 0 : _k.length) > 0) {
630
629
  newItem._extend.other.bundle.forEach((bundleItem) => {
631
630
  bundleItem.surcharge_rounding_remainder = void 0;
632
631
  });
@@ -267,10 +267,11 @@ function TicketBookingDialog(props) {
267
267
  }
268
268
  function getPaidAmounts(bookingOrigin) {
269
269
  const payments = (bookingOrigin == null ? void 0 : bookingOrigin.payments) || [];
270
- const paidAmount = payments.reduce((total, item) => {
270
+ const paidPayments = payments.filter((item) => (item == null ? void 0 : item.status) === "paid");
271
+ const paidAmount = paidPayments.reduce((total, item) => {
271
272
  return total + Number(item.amount);
272
273
  }, 0);
273
- const paidAmountWithoutSurcharge = payments.reduce(
274
+ const paidAmountWithoutSurcharge = paidPayments.reduce(
274
275
  (total, item) => {
275
276
  return total + Number(item.amount) - Number(item.service_fee || 0);
276
277
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.11.150",
3
+ "version": "6.11.152",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -68,8 +68,8 @@
68
68
  "react-resizable": "^3.0.5",
69
69
  "styled-components": "^6.0.0-rc.3",
70
70
  "@pisell/utils": "3.0.2",
71
- "@pisell/materials": "6.11.48",
72
71
  "@pisell/icon": "0.0.11",
72
+ "@pisell/materials": "6.11.48",
73
73
  "@pisell/date-picker": "3.0.8"
74
74
  },
75
75
  "peerDependencies": {
@@ -1,12 +0,0 @@
1
- export interface ResourceItem {
2
- [key: string]: any;
3
- }
4
- /**
5
- * @title: 传入资源,如果有子资源,会根据组合资源的 capacity 计算修改子资源的 capacity
6
- * @description:
7
- * @param {object} resource
8
- * @return {*}
9
- * @Author: jinglin.tan
10
- */
11
- export declare const checkSubResourcesCapacity: (resource: ResourceItem) => void;
12
- export declare const formatValues: (data: any, values: any) => any;
@@ -1,12 +0,0 @@
1
- export interface ResourceItem {
2
- [key: string]: any;
3
- }
4
- /**
5
- * @title: 传入资源,如果有子资源,会根据组合资源的 capacity 计算修改子资源的 capacity
6
- * @description:
7
- * @param {object} resource
8
- * @return {*}
9
- * @Author: jinglin.tan
10
- */
11
- export declare const checkSubResourcesCapacity: (resource: ResourceItem) => void;
12
- export declare const formatValues: (data: any, values: any) => any;