@pisell/private-materials 6.6.70 → 6.6.73

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.
Files changed (27) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/meta.js +1 -1
  5. package/build/lowcode/render/default/view.css +1 -1
  6. package/build/lowcode/render/default/view.js +1 -1
  7. package/build/lowcode/view.css +1 -1
  8. package/build/lowcode/view.js +1 -1
  9. package/es/components/booking/components/footer/index.js +71 -59
  10. package/es/components/booking/components/footer/utils.js +2 -1
  11. package/es/components/booking/info/hooks/useAddHolder.js +1 -0
  12. package/es/components/booking/info/main.js +2 -1
  13. package/es/components/booking/info2/index.js +2 -1
  14. package/es/components/booking/utils/holderAssignmentConfirmModal.d.ts +7 -0
  15. package/es/components/booking/utils/holderAssignmentConfirmModal.js +403 -0
  16. package/es/components/eftposPay/hooks.d.ts +1 -1
  17. package/es/components/eftposPay/store/index.d.ts +2 -2
  18. package/lib/components/booking/components/footer/index.js +26 -20
  19. package/lib/components/booking/components/footer/utils.js +1 -1
  20. package/lib/components/booking/info/hooks/useAddHolder.js +1 -0
  21. package/lib/components/booking/info/main.js +2 -1
  22. package/lib/components/booking/info2/index.js +2 -1
  23. package/lib/components/booking/utils/holderAssignmentConfirmModal.d.ts +7 -0
  24. package/lib/components/booking/utils/holderAssignmentConfirmModal.js +374 -0
  25. package/lib/components/eftposPay/hooks.d.ts +1 -1
  26. package/lib/components/eftposPay/store/index.d.ts +2 -2
  27. package/package.json +1 -1
@@ -37,7 +37,7 @@ import "./index.less";
37
37
  import { createEventBooking, editEventBooking } from "./serve";
38
38
  import { checkHolderIsError, formatValues } from "./utils";
39
39
  import NoteModal from "../../../../plus/noteModal";
40
- import { showConfirmHolderModal, ConfirmHolderModal } from "../../utils/confirmHolderModal";
40
+ import { showHolderAssignmentConfirmModal } from "../../utils/holderAssignmentConfirmModal";
41
41
  import { SubTotal } from "../../../../index";
42
42
  import { useIsBooking4Shop } from "../../hooks/useIsBooking4Shop";
43
43
  import dayjs from 'dayjs';
@@ -96,6 +96,8 @@ var Footer = function Footer(props) {
96
96
  _useState14 = _slicedToArray(_useState13, 2),
97
97
  paymentCallback = _useState14[0],
98
98
  setPaymentCallback = _useState14[1];
99
+ var stateRef = useRef(state);
100
+ stateRef.current = state;
99
101
 
100
102
  // edit order id
101
103
  var _useState15 = useState(0),
@@ -869,47 +871,56 @@ var Footer = function Footer(props) {
869
871
  */
870
872
  var handleSave = /*#__PURE__*/function () {
871
873
  var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref6) {
872
- var _state$bookingConfig6, _state$service$value2, _state$client3;
873
- var type, _ref6$messageShow, messageShow, _ref6$noSubmit, noSubmit, isToastMode, isHasDayProducts, hasUnspecifiedHolderProduct, _setLoading, loadingTimer, _getApis, createBooking, editBooking, editApi, createApi, saveOtherValue, _state$onSave, _store$getState, _window7, callbackData, values, checkout, subtotal_info, res, isNeedDeposit, api;
874
+ var _submitState, _submitState$service, _submitState$client;
875
+ var type, _ref6$messageShow, messageShow, _ref6$noSubmit, noSubmit, submitState, isToastMode, isHasDayProducts, hasUnspecifiedHolderProduct, shouldContinue, _setLoading, loadingTimer, _getApis, createBooking, editBooking, editApi, createApi, saveOtherValue, _submitState2, _submitState2$onSave, _store$getState, _window7, _submitState4, callbackData, values, checkout, subtotal_info, res, _submitState3, isNeedDeposit, api;
874
876
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
875
877
  while (1) switch (_context6.prev = _context6.next) {
876
878
  case 0:
877
879
  type = _ref6.type, _ref6$messageShow = _ref6.messageShow, messageShow = _ref6$messageShow === void 0 ? true : _ref6$messageShow, _ref6$noSubmit = _ref6.noSubmit, noSubmit = _ref6$noSubmit === void 0 ? false : _ref6$noSubmit;
878
- // 关闭页面上所有的PaymentResultToast
880
+ submitState = stateRef.current; // 关闭页面上所有的PaymentResultToast
879
881
  // 弹窗模式判断
880
- isToastMode = (state === null || state === void 0 || (_state$bookingConfig6 = state.bookingConfig) === null || _state$bookingConfig6 === void 0 || (_state$bookingConfig6 = _state$bookingConfig6.config) === null || _state$bookingConfig6 === void 0 || (_state$bookingConfig6 = _state$bookingConfig6.payment_setting) === null || _state$bookingConfig6 === void 0 ? void 0 : _state$bookingConfig6.payment_result_display_mode) !== 'modal'; // 只有 toast 模式才关闭,modal 模式留着
882
+ isToastMode = ((_submitState = submitState) === null || _submitState === void 0 || (_submitState = _submitState.bookingConfig) === null || _submitState === void 0 || (_submitState = _submitState.config) === null || _submitState === void 0 || (_submitState = _submitState.payment_setting) === null || _submitState === void 0 ? void 0 : _submitState.payment_result_display_mode) !== 'modal'; // 只有 toast 模式才关闭,modal 模式留着
881
883
  if (isToastMode) {
882
884
  closeAllPaymentResultToasts();
883
885
  }
884
886
  // 跨日预约验证是否有预约商品
885
- if (!isDayBooking(state)) {
886
- _context6.next = 7;
887
+ if (!isDayBooking(submitState)) {
888
+ _context6.next = 8;
887
889
  break;
888
890
  }
889
891
  isHasDayProducts = handleDaySubmit();
890
892
  if (!isHasDayProducts) {
891
- _context6.next = 7;
893
+ _context6.next = 8;
892
894
  break;
893
895
  }
894
896
  return _context6.abrupt("return");
895
- case 7:
896
- hasUnspecifiedHolderProduct = (_state$service$value2 = state.service.value) === null || _state$service$value2 === void 0 ? void 0 : _state$service$value2.some(function (item) {
897
+ case 8:
898
+ hasUnspecifiedHolderProduct = (_submitState$service = submitState.service) === null || _submitState$service === void 0 || (_submitState$service = _submitState$service.value) === null || _submitState$service === void 0 ? void 0 : _submitState$service.some(function (item) {
897
899
  var _item$_extend, _item$_extend2;
898
900
  return (!((_item$_extend = item._extend) !== null && _item$_extend !== void 0 && _item$_extend.holder_id) || ((_item$_extend2 = item._extend) === null || _item$_extend2 === void 0 || (_item$_extend2 = _item$_extend2.holder_id) === null || _item$_extend2 === void 0 ? void 0 : _item$_extend2.length) === 0) && !isNormalProductByDurationSchedule(item);
899
901
  });
900
- if (!(!isWalkIn((_state$client3 = state.client) === null || _state$client3 === void 0 || (_state$client3 = _state$client3.value) === null || _state$client3 === void 0 ? void 0 : _state$client3.id) && getIsSubjectRequire(state) && hasUnspecifiedHolderProduct)) {
901
- _context6.next = 11;
902
+ if (!(!isWalkIn((_submitState$client = submitState.client) === null || _submitState$client === void 0 || (_submitState$client = _submitState$client.value) === null || _submitState$client === void 0 ? void 0 : _submitState$client.id) && getIsSubjectRequire(submitState) && hasUnspecifiedHolderProduct)) {
903
+ _context6.next = 16;
902
904
  break;
903
905
  }
904
- _context6.next = 11;
905
- return showConfirmHolderModal(state, dispatch);
906
- case 11:
907
- if (!(isBooking4Shop && getIsSubjectRequire(state) && checkHolderIsError(state))) {
908
- _context6.next = 13;
906
+ _context6.next = 12;
907
+ return showHolderAssignmentConfirmModal(submitState);
908
+ case 12:
909
+ shouldContinue = _context6.sent;
910
+ if (shouldContinue) {
911
+ _context6.next = 15;
909
912
  break;
910
913
  }
911
914
  return _context6.abrupt("return");
912
- case 13:
915
+ case 15:
916
+ submitState = stateRef.current;
917
+ case 16:
918
+ if (!(isBooking4Shop && getIsSubjectRequire(submitState) && checkHolderIsError(submitState))) {
919
+ _context6.next = 18;
920
+ break;
921
+ }
922
+ return _context6.abrupt("return");
923
+ case 18:
913
924
  // 区分loading, 是点击的checkout 还是save
914
925
  _setLoading = type === 'checkout' ? setCheckoutLoading : setLoading;
915
926
  _setLoading(true);
@@ -918,38 +929,39 @@ var Footer = function Footer(props) {
918
929
  _setLoading(false);
919
930
  }, 20000);
920
931
  _getApis = getApis(), createBooking = _getApis.createBooking, editBooking = _getApis.editBooking;
921
- editApi = state.renderType === 'eventBooking' ? editEventBooking : editBooking;
922
- createApi = state.renderType === 'eventBooking' ? createEventBooking : createBooking;
932
+ editApi = submitState.renderType === 'eventBooking' ? editEventBooking : editBooking;
933
+ createApi = submitState.renderType === 'eventBooking' ? createEventBooking : createBooking;
923
934
  saveOtherValue = {};
924
935
  if (!(type === 'save')) {
925
- _context6.next = 27;
936
+ _context6.next = 33;
926
937
  break;
927
938
  }
928
- _context6.next = 23;
929
- return state === null || state === void 0 || (_state$onSave = state.onSave) === null || _state$onSave === void 0 ? void 0 : _state$onSave.call(state, state.client);
930
- case 23:
939
+ _context6.next = 28;
940
+ return (_submitState2 = submitState) === null || _submitState2 === void 0 || (_submitState2$onSave = _submitState2.onSave) === null || _submitState2$onSave === void 0 ? void 0 : _submitState2$onSave.call(_submitState2, submitState.client);
941
+ case 28:
931
942
  _context6.t0 = _context6.sent;
932
943
  if (_context6.t0) {
933
- _context6.next = 26;
944
+ _context6.next = 31;
934
945
  break;
935
946
  }
936
947
  _context6.t0 = {};
937
- case 26:
948
+ case 31:
938
949
  saveOtherValue = _context6.t0;
939
- case 27:
940
- _context6.prev = 27;
950
+ submitState = stateRef.current;
951
+ case 33:
952
+ _context6.prev = 33;
941
953
  callbackData = null; // 格式化提交的参数
942
- values = formatValues(_objectSpread(_objectSpread({}, state), saveOtherValue)); // checkout 2.0 补充商品总税费字段
954
+ values = formatValues(_objectSpread(_objectSpread({}, submitState), saveOtherValue)); // checkout 2.0 补充商品总税费字段
943
955
  values.product_tax_fee = total.tax || 0;
944
956
  if (!noSubmit) {
945
- _context6.next = 33;
957
+ _context6.next = 39;
946
958
  break;
947
959
  }
948
960
  return _context6.abrupt("return", values);
949
- case 33:
961
+ case 39:
950
962
  checkout = pisellos.getModule('checkout'); // 如果有 orderid,则应该走更新逻辑
951
963
  if (!editOrderId) {
952
- _context6.next = 43;
964
+ _context6.next = 49;
953
965
  break;
954
966
  }
955
967
  subtotal_info = {
@@ -958,7 +970,7 @@ var Footer = function Footer(props) {
958
970
  total: cloneDeep(total),
959
971
  showDetail: showDetail
960
972
  };
961
- _context6.next = 38;
973
+ _context6.next = 44;
962
974
  return checkout.updateLocalOrderAsync({
963
975
  orderId: editOrderId,
964
976
  orderData: values,
@@ -966,20 +978,20 @@ var Footer = function Footer(props) {
966
978
  autoPayment: true,
967
979
  totalInfo: subtotal_info
968
980
  });
969
- case 38:
970
- _context6.next = 40;
981
+ case 44:
982
+ _context6.next = 46;
971
983
  return checkout.manualSyncOrderAsync();
972
- case 40:
984
+ case 46:
973
985
  res = _context6.sent;
974
986
  if (res.success) {
975
987
  // 回调关闭弹窗
976
- state === null || state === void 0 || state.callback(res, type);
988
+ (_submitState3 = submitState) === null || _submitState3 === void 0 || _submitState3.callback(res, type);
977
989
  _setLoading(false);
978
990
  }
979
991
  return _context6.abrupt("return");
980
- case 43:
992
+ case 49:
981
993
  // 如果是保存,检查是否需要支付定金
982
- if (type === 'save' && !state.bookingId) {
994
+ if (type === 'save' && !submitState.bookingId) {
983
995
  isNeedDeposit = checkout.checkIsNeedDepositAsync(values.bookings, values.relation_products);
984
996
  if (isNeedDeposit !== null && isNeedDeposit !== void 0 && isNeedDeposit.hasDeposit) {
985
997
  values.is_deposit = 1;
@@ -988,7 +1000,7 @@ var Footer = function Footer(props) {
988
1000
  }
989
1001
 
990
1002
  // 区分是新增还是编辑
991
- api = state.bookingId ? editApi : createApi; // 增加日志记录
1003
+ api = submitState.bookingId ? editApi : createApi; // 增加日志记录
992
1004
  sendWarningLog({
993
1005
  title: 'saveBooking',
994
1006
  content: [{
@@ -1012,7 +1024,7 @@ var Footer = function Footer(props) {
1012
1024
  });
1013
1025
 
1014
1026
  // 活动预约新建时校验重复 -- 暂不处理
1015
- // if (!state.bookingId && state.renderType === 'eventBooking') {
1027
+ // if (!submitState.bookingId && submitState.renderType === 'eventBooking') {
1016
1028
  // const { data } = await eventBookingCheck(values);
1017
1029
  // if (data.list.length) {
1018
1030
  // const confirmed = await modal.confirm({
@@ -1041,45 +1053,45 @@ var Footer = function Footer(props) {
1041
1053
 
1042
1054
  // 如果有addons改动, 则先保存
1043
1055
  if (!addonsEdit) {
1044
- _context6.next = 49;
1056
+ _context6.next = 55;
1045
1057
  break;
1046
1058
  }
1047
- _context6.next = 49;
1059
+ _context6.next = 55;
1048
1060
  return handleSaveAddons();
1049
- case 49:
1061
+ case 55:
1050
1062
  if (!infoEdit) {
1051
- _context6.next = 54;
1063
+ _context6.next = 60;
1052
1064
  break;
1053
1065
  }
1054
- _context6.next = 52;
1055
- return api(values, state.bookingId || editOrderId);
1056
- case 52:
1066
+ _context6.next = 58;
1067
+ return api(values, submitState.bookingId || editOrderId);
1068
+ case 58:
1057
1069
  callbackData = _context6.sent;
1058
1070
  if (messageShow) {
1059
- message.success(locales.getText(state.bookingId ? 'pisell2.text.appointment-updated' : 'pisell2.text.created-successfully'));
1071
+ message.success(locales.getText(submitState.bookingId ? 'pisell2.text.appointment-updated' : 'pisell2.text.created-successfully'));
1060
1072
  }
1061
- case 54:
1073
+ case 60:
1062
1074
  // 回调关闭弹窗
1063
- state === null || state === void 0 || state.callback(callbackData, type);
1075
+ (_submitState4 = submitState) === null || _submitState4 === void 0 || _submitState4.callback(callbackData, type);
1064
1076
  clearTimeout(loadingTimer);
1065
1077
  _setLoading(false);
1066
1078
 
1067
1079
  // return数据 checkout时需要
1068
1080
  return _context6.abrupt("return", callbackData || values);
1069
- case 60:
1070
- _context6.prev = 60;
1071
- _context6.t1 = _context6["catch"](27);
1081
+ case 66:
1082
+ _context6.prev = 66;
1083
+ _context6.t1 = _context6["catch"](33);
1072
1084
  console.log(_context6.t1);
1073
1085
  if ((_context6.t1 === null || _context6.t1 === void 0 ? void 0 : _context6.t1.code) === 70101) {
1074
1086
  message.error(_context6.t1 === null || _context6.t1 === void 0 ? void 0 : _context6.t1.message);
1075
1087
  }
1076
1088
  clearTimeout(loadingTimer);
1077
1089
  _setLoading(false);
1078
- case 66:
1090
+ case 72:
1079
1091
  case "end":
1080
1092
  return _context6.stop();
1081
1093
  }
1082
- }, _callee6, null, [[27, 60]]);
1094
+ }, _callee6, null, [[33, 66]]);
1083
1095
  }));
1084
1096
  return function handleSave(_x5) {
1085
1097
  return _ref7.apply(this, arguments);
@@ -1768,8 +1780,8 @@ var Footer = function Footer(props) {
1768
1780
  }
1769
1781
  };
1770
1782
  var changeCustomerToGlobalState = useMemoizedFn(function (value) {
1771
- var _state$client4, _state$service6;
1772
- var beforeValue = state === null || state === void 0 || (_state$client4 = state.client) === null || _state$client4 === void 0 ? void 0 : _state$client4.value;
1783
+ var _state$client3, _state$service6;
1784
+ var beforeValue = state === null || state === void 0 || (_state$client3 = state.client) === null || _state$client3 === void 0 ? void 0 : _state$client3.value;
1773
1785
  dispatch({
1774
1786
  type: 'setClient',
1775
1787
  payload: {
@@ -2024,6 +2036,6 @@ var Footer = function Footer(props) {
2024
2036
  // handleClearAllAndReset();
2025
2037
  // }
2026
2038
  }
2027
- }), /*#__PURE__*/React.createElement(ConfirmHolderModal, null));
2039
+ }));
2028
2040
  };
2029
2041
  export default Footer;
@@ -108,6 +108,7 @@ export var formatProductBundle = function formatProductBundle(bundle) {
108
108
  }
109
109
  } catch (error) {}
110
110
  return bundle.map(function (d) {
111
+ var _d$original_price;
111
112
  var option = formatProductOption(d.option);
112
113
  var option_price = option.reduce(function (temp, item) {
113
114
  return temp + Number(item.num) * item.custom_add_price;
@@ -129,7 +130,7 @@ export var formatProductBundle = function formatProductBundle(bundle) {
129
130
  "price": Number(d === null || d === void 0 ? void 0 : d.product_price),
130
131
  "price_type": d === null || d === void 0 ? void 0 : d.price_type,
131
132
  "price_type_ext": d === null || d === void 0 ? void 0 : d.price_type_ext,
132
- "custom_price": (d === null || d === void 0 ? void 0 : d.custom_price) || Math.abs(new Decimal((d === null || d === void 0 ? void 0 : d.original_price) || (d === null || d === void 0 ? void 0 : d.product_price)).sub(option_price).toNumber()).toFixed(2),
133
+ "custom_price": (d === null || d === void 0 ? void 0 : d.custom_price) || Math.abs(new Decimal((_d$original_price = d === null || d === void 0 ? void 0 : d.original_price) !== null && _d$original_price !== void 0 ? _d$original_price : d === null || d === void 0 ? void 0 : d.product_price).sub(option_price).toNumber()).toFixed(2),
133
134
  "custom_price_type": d === null || d === void 0 ? void 0 : d.price_type,
134
135
  "option": option,
135
136
  "bundle_selling_price": Math.abs(d === null || d === void 0 ? void 0 : d.price),
@@ -84,6 +84,7 @@ var useAddHolder = function useAddHolder(state, dispatch) {
84
84
  var handleAddHolder = function handleAddHolder(products, currentItem) {
85
85
  var _state$client, _state$client2;
86
86
  var _data = {
87
+ zIndex: 1300,
87
88
  formDataConfig: isMinorAndWaiver ? _objectSpread(_objectSpread({}, waiverForm), {}, {
88
89
  customer_id: (_state$client = state.client) === null || _state$client === void 0 || (_state$client = _state$client.value) === null || _state$client === void 0 ? void 0 : _state$client.id,
89
90
  is_franchisor: formDataConfig.is_franchisor
@@ -27,6 +27,7 @@ import Notes from "./notes";
27
27
  import { Service2Cart } from "./service2";
28
28
  import { isDayBooking, isEventBooking, isTerminalDayBooking } from "./service2/utils";
29
29
  import ContactInfoMode from "../info2/service/contactInfoMode";
30
+ import { HolderAssignmentConfirmModal } from "../utils/holderAssignmentConfirmModal";
30
31
  var defaultModules = {
31
32
  client: 1,
32
33
  date: 1,
@@ -127,7 +128,7 @@ var Info = Provider(function (props) {
127
128
  // <AddNote value={modal.state?.notes?.orderNote} onChange={addNote} />
128
129
  null;
129
130
  }, [modules.note, globalState === null || globalState === void 0 ? void 0 : globalState.bookingId, globalState.render, (_modal$state3 = modal.state) === null || _modal$state3 === void 0 || (_modal$state3 = _modal$state3.notes) === null || _modal$state3 === void 0 ? void 0 : _modal$state3.orderNote]);
130
- return /*#__PURE__*/React.createElement(React.Fragment, null, !!modal.state.setGlobalState ? /*#__PURE__*/React.createElement(TabPane, {
131
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HolderAssignmentConfirmModal, null), !!modal.state.setGlobalState ? /*#__PURE__*/React.createElement(TabPane, {
131
132
  style: _objectSpread(_objectSpread({}, style), {}, {
132
133
  height: '100%'
133
134
  }),
@@ -36,6 +36,7 @@ import { useDebounceEffect } from 'ahooks';
36
36
  import CartClientCard from "./cartClientCard";
37
37
  import { Iconfont, useToast } from '@pisell/materials';
38
38
  import ContactInfoMode from "./service/contactInfoMode";
39
+ import { HolderAssignmentConfirmModal } from "../utils/holderAssignmentConfirmModal";
39
40
  var defaultModules = {
40
41
  client: 1,
41
42
  date: 1,
@@ -291,7 +292,7 @@ var Info = Provider(function (props) {
291
292
  }, [currentDate], {
292
293
  wait: 300
293
294
  });
294
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ReloadResourceModal, {
295
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HolderAssignmentConfirmModal, null), /*#__PURE__*/React.createElement(ReloadResourceModal, {
295
296
  modal: modal,
296
297
  onReload: getResourcesData,
297
298
  onCancel: function onCancel() {
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import './confirmHolderModal.less';
3
+ export declare const HolderAssignmentConfirmModal: React.FC;
4
+ /**
5
+ * 通过 await 调起保存前 holder 分配确认弹窗。
6
+ */
7
+ export declare function showHolderAssignmentConfirmModal(state: any): Promise<boolean>;