@pisell/private-materials 3.0.46 → 3.0.48

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.
@@ -17,10 +17,10 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
17
17
  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; }
18
18
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
19
19
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
- import React, { useMemo, useState } from "react";
20
+ import React, { useEffect, useMemo, useState } from "react";
21
21
  import ChevronDown from "@pisell/icon/es/ChevronDown";
22
22
  import classNames from "classnames";
23
- import { Skeleton, message } from "antd";
23
+ import { Skeleton, message, Dropdown, Space } from "antd";
24
24
  import { formatAmount, locales } from "@pisell/utils";
25
25
  import { Button } from "antd";
26
26
  import { formatProducts } from "../../addons";
@@ -29,6 +29,7 @@ import { getSumTotal, is_price_include_tax } from "./amount";
29
29
  import FooterMenus from "./FooterMenus";
30
30
  import "./index.less";
31
31
  import useEngineContext from "../../../../hooks/useEngineContext";
32
+ import { DownOutlined } from "@ant-design/icons";
32
33
 
33
34
  /**
34
35
  * @title: 底部
@@ -39,7 +40,7 @@ import useEngineContext from "../../../../hooks/useEngineContext";
39
40
  * @Date: 2024-01-30 16:51
40
41
  */
41
42
  var Footer = function Footer(props) {
42
- var _context$appHelper, _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$addons2, _state$addons4, _state$bookingDetail8;
43
+ var _context$appHelper, _store$getState, _store$getState$call, _store$getState$call$, _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$addons2, _state$addons4, _state$bookingDetail8;
43
44
  var state = props.state,
44
45
  buttons = props.buttons,
45
46
  dispatch = props.dispatch,
@@ -62,7 +63,14 @@ var Footer = function Footer(props) {
62
63
  var context = useEngineContext();
63
64
  var _context$appHelper$ut = (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils,
64
65
  isTerminal = _context$appHelper$ut.isTerminal,
65
- interaction = _context$appHelper$ut.interaction;
66
+ interaction = _context$appHelper$ut.interaction,
67
+ store = _context$appHelper$ut.store;
68
+ var isShowPaymentLink = store === null || store === void 0 ? void 0 : (_store$getState = store.getState) === null || _store$getState === void 0 ? void 0 : (_store$getState$call = _store$getState.call(store)) === null || _store$getState$call === void 0 ? void 0 : (_store$getState$call$ = _store$getState$call.global) === null || _store$getState$call$ === void 0 ? void 0 : _store$getState$call$.paymentLinkBtnShow;
69
+ useEffect(function () {
70
+ store === null || store === void 0 ? void 0 : store.dispatch({
71
+ type: "global/_getPaymentLinkBtnShow"
72
+ });
73
+ }, []);
66
74
 
67
75
  // board 配置
68
76
  var params = useMemo(function () {
@@ -277,11 +285,11 @@ var Footer = function Footer(props) {
277
285
  */
278
286
  var handleSave = /*#__PURE__*/function () {
279
287
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref4) {
280
- var type, _setLoading, editApi, createApi, saveOtherValue, _state$onSave, callbackData, values, api;
288
+ var type, _ref4$messageShow, messageShow, _setLoading, editApi, createApi, saveOtherValue, _state$onSave, callbackData, values, api;
281
289
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
282
290
  while (1) switch (_context4.prev = _context4.next) {
283
291
  case 0:
284
- type = _ref4.type;
292
+ type = _ref4.type, _ref4$messageShow = _ref4.messageShow, messageShow = _ref4$messageShow === void 0 ? true : _ref4$messageShow;
285
293
  // 区分loading, 是点击的checkout 还是save
286
294
  _setLoading = type === "checkout" ? setCheckoutLoading : setLoading;
287
295
  _setLoading(true);
@@ -323,7 +331,9 @@ var Footer = function Footer(props) {
323
331
  return api(values);
324
332
  case 23:
325
333
  callbackData = _context4.sent;
326
- message.success(locales.getText(state.bookingId ? "pisell2.text.appointment-updated" : "pisell2.text.created-successfully"));
334
+ if (messageShow) {
335
+ message.success(locales.getText(state.bookingId ? "pisell2.text.appointment-updated" : "pisell2.text.created-successfully"));
336
+ }
327
337
  case 25:
328
338
  // 回调关闭弹窗
329
339
  state === null || state === void 0 ? void 0 : state.callback(callbackData);
@@ -432,6 +442,71 @@ var Footer = function Footer(props) {
432
442
  disabled: isDisabled
433
443
  }, locales.getText("pisell2.text.checkout"));
434
444
  }, [isEdit, checkoutLoading, isDisabled, state, source]);
445
+ var handleMenuClick = /*#__PURE__*/function () {
446
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(e) {
447
+ var id, res;
448
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
449
+ while (1) switch (_context6.prev = _context6.next) {
450
+ case 0:
451
+ id = state.bookingId;
452
+ if (!isEdit) {
453
+ _context6.next = 6;
454
+ break;
455
+ }
456
+ _context6.next = 4;
457
+ return handleSave({
458
+ type: "checkout",
459
+ messageShow: false
460
+ });
461
+ case 4:
462
+ res = _context6.sent;
463
+ id = (res === null || res === void 0 ? void 0 : res.order_id) || state.bookingId;
464
+ case 6:
465
+ if (e.key === 'sendMail') {
466
+ state.action({
467
+ type: 'pisell1.sendPayLinkEmail',
468
+ data: {
469
+ id: id
470
+ },
471
+ callback: function callback() {}
472
+ });
473
+ }
474
+ if (e.key === 'copy') {
475
+ state.action({
476
+ type: 'pisell1.genClientPayLink',
477
+ data: {
478
+ id: id
479
+ },
480
+ callback: function callback() {}
481
+ });
482
+ }
483
+ case 8:
484
+ case "end":
485
+ return _context6.stop();
486
+ }
487
+ }, _callee6);
488
+ }));
489
+ return function handleMenuClick(_x5) {
490
+ return _ref7.apply(this, arguments);
491
+ };
492
+ }();
493
+ var paymentLinkButton = useMemo(function () {
494
+ var items = [{
495
+ label: locales.getText('pisell2.text.send-mail'),
496
+ key: 'sendMail'
497
+ }, {
498
+ label: locales.getText('pisell2.text.copy-to-clipboard'),
499
+ key: 'copy'
500
+ }];
501
+ return /*#__PURE__*/React.createElement(Dropdown, {
502
+ menu: {
503
+ items: items,
504
+ onClick: handleMenuClick
505
+ }
506
+ }, /*#__PURE__*/React.createElement(Button, {
507
+ className: "pisell-lowcode__booking-footer-buttons-item"
508
+ }, /*#__PURE__*/React.createElement(Space, null, locales.getText('pisell2.text.payment-link'), /*#__PURE__*/React.createElement(DownOutlined, null))));
509
+ }, [handleMenuClick]);
435
510
 
436
511
  /**
437
512
  * @title: 保存按钮
@@ -491,7 +566,8 @@ var Footer = function Footer(props) {
491
566
  checkout: checkoutButton,
492
567
  save: saveButton,
493
568
  complete: completeButton,
494
- refund: refundButton
569
+ refund: refundButton,
570
+ paymentLink: paymentLinkButton
495
571
  };
496
572
 
497
573
  /**
@@ -539,6 +615,9 @@ var Footer = function Footer(props) {
539
615
  // payment
540
616
  if (source === "payment") {
541
617
  var _arr2 = [];
618
+ if (state.bookingId && isShowPaymentLink) {
619
+ _arr2.push(buttonMap.paymentLink);
620
+ }
542
621
  // 有已支付金额, 展示退款
543
622
  if (total.paidAmount > 0) {
544
623
  _arr2.push(buttonMap.refund);
@@ -553,6 +632,9 @@ var Footer = function Footer(props) {
553
632
  // info
554
633
  if (source === "info") {
555
634
  var _arr3 = [];
635
+ if (state.bookingId && isShowPaymentLink) {
636
+ _arr3.push(buttonMap.paymentLink);
637
+ }
556
638
  // 有未支付金额 展示checkout
557
639
  if (isCheckout) {
558
640
  _arr3.push(buttonMap.checkout);
@@ -10,6 +10,7 @@ declare type DepositItemProps = {
10
10
  orderNumber: number;
11
11
  handleGoOrderDetail: () => void;
12
12
  generatePaymentLink: (orderId: number) => void;
13
+ sendEmail: (orderId: number) => void;
13
14
  depositAmount: number;
14
15
  amountSymbol: string;
15
16
  createdTime: string;
@@ -26,7 +26,8 @@ var DepositItem = function DepositItem(props) {
26
26
  amountSymbol = props.amountSymbol,
27
27
  createdTime = props.createdTime,
28
28
  isPaid = props.isPaid,
29
- isBookingCancelled = props.isBookingCancelled;
29
+ isBookingCancelled = props.isBookingCancelled,
30
+ sendEmail = props.sendEmail;
30
31
  var statusText = {
31
32
  unpaid: locales.getText("pisell2.text.deposit-item-status-unpaid"),
32
33
  paid: locales.getText("pisell2.text.deposit-item-status-paid")
@@ -35,20 +36,19 @@ var DepositItem = function DepositItem(props) {
35
36
  document.body.id = "body";
36
37
  }, []);
37
38
  var items = [{
39
+ key: "send",
40
+ label: /*#__PURE__*/React.createElement("div", null, locales.getText('pisell2.text.send-mail'))
41
+ }, {
38
42
  key: "1",
39
43
  disabled: isPaid || isBookingCancelled,
40
44
  label: /*#__PURE__*/React.createElement("div", null, locales.getText("pisell2.text.deposit-generate-payment-link"))
41
- }
42
- // {
43
- // key: "2",
44
- // label: <div>发送邮件</div>,
45
- // },
46
- ];
47
-
45
+ }];
48
46
  var onClick = function onClick(_ref) {
49
47
  var key = _ref.key;
50
48
  if (key === '1') {
51
49
  generatePaymentLink === null || generatePaymentLink === void 0 ? void 0 : generatePaymentLink(orderId);
50
+ } else if (key === 'send') {
51
+ sendEmail === null || sendEmail === void 0 ? void 0 : sendEmail(orderId);
52
52
  }
53
53
  };
54
54
  return /*#__PURE__*/React.createElement("div", {
@@ -39,13 +39,23 @@ var Deposit = function Deposit(props) {
39
39
  var context = useEngineContext();
40
40
  var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
41
41
  isTerminal = _ref.isTerminal,
42
- interaction = _ref.interaction;
42
+ interaction = _ref.interaction,
43
+ action = _ref.action;
43
44
  request.setRequest(context.appHelper.utils.request);
44
45
  var bookingDetail = globalState.bookingDetail,
45
46
  bookingId = globalState.bookingId,
46
47
  amountSymbol = globalState.amountSymbol,
47
48
  generatePaymentLink = globalState.generatePaymentLink,
48
49
  locale = globalState.locale;
50
+ var sendEmail = function sendEmail(id) {
51
+ action({
52
+ type: 'pisell1.sendPayLinkEmail',
53
+ data: {
54
+ id: id
55
+ },
56
+ callback: function callback() {}
57
+ });
58
+ };
49
59
  var create = function create() {
50
60
  var _editDepositModalRef$, _editDepositModalRef$2;
51
61
  (_editDepositModalRef$ = editDepositModalRef.current) === null || _editDepositModalRef$ === void 0 ? void 0 : (_editDepositModalRef$2 = _editDepositModalRef$.handleOpen) === null || _editDepositModalRef$2 === void 0 ? void 0 : _editDepositModalRef$2.call(_editDepositModalRef$);
@@ -147,6 +157,7 @@ var Deposit = function Deposit(props) {
147
157
  key: item.status
148
158
  }, item, {
149
159
  generatePaymentLink: generatePaymentLink,
160
+ sendEmail: sendEmail,
150
161
  handleGoOrderDetail: handleGoOrderDetail,
151
162
  onEdit: function onEdit(e) {
152
163
  return handleEdit(e, item);
@@ -313,7 +313,7 @@ var Info = function Info() {
313
313
  return;
314
314
  }
315
315
  // 如果弹窗打开,并且是创建, 则自动打开选择服务的弹窗
316
- if (state.modalOpen && !state.bookingId) {
316
+ if (state.modalOpen && !state.bookingId && state.renderType !== 'eventBooking') {
317
317
  handleSelectService();
318
318
  }
319
319
  }, [state.modalOpen, state.bookingId]);
@@ -326,6 +326,11 @@ var Info = function Info() {
326
326
  setSearch("");
327
327
  }
328
328
  }, [state.service.addModal]);
329
+ useEffect(function () {
330
+ if (state.renderType === "eventBooking" && state.modalOpen) {
331
+ getServices();
332
+ }
333
+ }, [state.renderType, state.modalOpen]);
329
334
  var addButton = useMemo(function () {
330
335
  if (state.renderType === "eventBooking") {
331
336
  return isService ? /*#__PURE__*/React.createElement("div", {
@@ -351,6 +356,7 @@ var Info = function Info() {
351
356
  }
352
357
  });
353
358
  }, [state.renderType, showAddButton, isService, state.service.value, loading]);
359
+ console.log(state.service.addModal, 'state.service.addModal');
354
360
  return /*#__PURE__*/React.createElement(React.Fragment, null, ((_state$service3 = state.service) === null || _state$service3 === void 0 ? void 0 : (_state$service3$cache = _state$service3.cacheItem) === null || _state$service3$cache === void 0 ? void 0 : _state$service3$cache.autoClose) && /*#__PURE__*/React.createElement(Skeleton, {
355
361
  loading: true,
356
362
  active: true,
@@ -1,7 +1,7 @@
1
1
  // 商品是套餐或单规格多规格
2
2
  export var getIsBundleOrCombination = function getIsBundleOrCombination(productDetail) {
3
- var _productDetail$bundle, _productDetail$option, _productDetail$varian;
4
- if (productDetail !== null && productDetail !== void 0 && (_productDetail$bundle = productDetail.bundle_group) !== null && _productDetail$bundle !== void 0 && _productDetail$bundle.length || productDetail !== null && productDetail !== void 0 && (_productDetail$option = productDetail.option_group) !== null && _productDetail$option !== void 0 && _productDetail$option.length || productDetail !== null && productDetail !== void 0 && (_productDetail$varian = productDetail.variant) !== null && _productDetail$varian !== void 0 && _productDetail$varian.length) {
3
+ var _productDetail$bundle;
4
+ if (productDetail !== null && productDetail !== void 0 && (_productDetail$bundle = productDetail.bundle_group) !== null && _productDetail$bundle !== void 0 && _productDetail$bundle.length) {
5
5
  return true;
6
6
  }
7
7
  return false;
@@ -142,6 +142,9 @@ declare const _default: {
142
142
  'pisell2.text.deposit-delete-message': string;
143
143
  'pisell2.text.deposit-paid': string;
144
144
  "pisell2.text.stock": string;
145
+ 'pisell2.text.payment-link': string;
146
+ 'pisell2.text.send-mail': string;
147
+ 'pisell2.text.copy-to-clipboard': string;
145
148
  };
146
149
  'zh-CN': {
147
150
  'pisell2.text.refunded-amount': string;
@@ -286,6 +289,9 @@ declare const _default: {
286
289
  'pisell2.text.deposit-delete-message': string;
287
290
  'pisell2.text.deposit-paid': string;
288
291
  "pisell2.text.stock": string;
292
+ 'pisell2.text.payment-link': string;
293
+ 'pisell2.text.send-mail': string;
294
+ 'pisell2.text.copy-to-clipboard': string;
289
295
  };
290
296
  'zh-HK': {
291
297
  'pisell2.text.refunded-amount': string;
@@ -430,6 +436,9 @@ declare const _default: {
430
436
  'pisell2.text.deposit-delete-message': string;
431
437
  'pisell2.text.deposit-paid': string;
432
438
  "pisell2.text.stock": string;
439
+ 'pisell2.text.payment-link': string;
440
+ 'pisell2.text.send-mail': string;
441
+ 'pisell2.text.copy-to-clipboard': string;
433
442
  };
434
443
  };
435
444
  export default _default;
@@ -156,7 +156,10 @@ export default {
156
156
  'pisell2.text.deposit-delete-message-title': "Prompt",
157
157
  'pisell2.text.deposit-delete-message': "It cannot be restored after deletion. Please confirm the operation.",
158
158
  'pisell2.text.deposit-paid': "Deposit paid",
159
- "pisell2.text.stock": "Stock"
159
+ "pisell2.text.stock": "Stock",
160
+ 'pisell2.text.payment-link': "Payment link",
161
+ 'pisell2.text.send-mail': "Send mail",
162
+ 'pisell2.text.copy-to-clipboard': "Copy to clipboard"
160
163
  },
161
164
  'zh-CN': {
162
165
  'pisell2.text.refunded-amount': '已退金额',
@@ -320,7 +323,10 @@ export default {
320
323
  'pisell2.text.deposit-delete-message-title': "提示",
321
324
  'pisell2.text.deposit-delete-message': "删除后不可恢复,请确认操作",
322
325
  'pisell2.text.deposit-paid': "已付定金",
323
- "pisell2.text.stock": "库存"
326
+ "pisell2.text.stock": "库存",
327
+ 'pisell2.text.payment-link': "付款链接",
328
+ 'pisell2.text.send-mail': "发送邮件",
329
+ 'pisell2.text.copy-to-clipboard': "复制到剪切板"
324
330
  },
325
331
  'zh-HK': {
326
332
  'pisell2.text.refunded-amount': '已退金額',
@@ -484,6 +490,9 @@ export default {
484
490
  'pisell2.text.deposit-delete-message-title': "提示",
485
491
  'pisell2.text.deposit-delete-message': "刪除後不可恢復,請確認操作",
486
492
  'pisell2.text.deposit-paid': "已付定金",
487
- "pisell2.text.stock": "庫存"
493
+ "pisell2.text.stock": "庫存",
494
+ 'pisell2.text.payment-link': "付款鏈接",
495
+ 'pisell2.text.send-mail': "發送郵件",
496
+ 'pisell2.text.copy-to-clipboard': "複製到剪切板"
488
497
  }
489
498
  };
@@ -44,25 +44,32 @@ var import_amount = require("./amount");
44
44
  var import_FooterMenus = __toESM(require("./FooterMenus"));
45
45
  var import_index = require("./index.less");
46
46
  var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
47
+ var import_icons = require("@ant-design/icons");
47
48
  var Footer = (props) => {
48
- var _a, _b, _c, _d, _e, _f, _g;
49
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
49
50
  const { state, buttons, dispatch, source } = props;
50
51
  const [showDetail, setShowDetail] = (0, import_react.useState)(false);
51
52
  const [loading, setLoading] = (0, import_react.useState)(false);
52
53
  const [checkoutLoading, setCheckoutLoading] = (0, import_react.useState)(false);
53
54
  const context = (0, import_useEngineContext.default)();
54
- const { isTerminal, interaction } = (_a = context.appHelper) == null ? void 0 : _a.utils;
55
+ const { isTerminal, interaction, store } = (_a = context.appHelper) == null ? void 0 : _a.utils;
56
+ const isShowPaymentLink = (_d = (_c = (_b = store == null ? void 0 : store.getState) == null ? void 0 : _b.call(store)) == null ? void 0 : _c.global) == null ? void 0 : _d.paymentLinkBtnShow;
57
+ (0, import_react.useEffect)(() => {
58
+ store == null ? void 0 : store.dispatch({
59
+ type: "global/_getPaymentLinkBtnShow"
60
+ });
61
+ }, []);
55
62
  const params = (0, import_react.useMemo)(() => {
56
63
  var _a2, _b2, _c2;
57
64
  return ((_c2 = (_b2 = (_a2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b2.basic) == null ? void 0 : _c2.appointment_subject) || {};
58
- }, [(_d = (_c = (_b = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _b.config) == null ? void 0 : _c.basic) == null ? void 0 : _d.appointment_subject]);
65
+ }, [(_g = (_f = (_e = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _e.config) == null ? void 0 : _f.basic) == null ? void 0 : _g.appointment_subject]);
59
66
  const addonsEdit = (0, import_react.useMemo)(() => {
60
67
  var _a2;
61
68
  if ((_a2 = state.addons) == null ? void 0 : _a2.edit) {
62
69
  return true;
63
70
  }
64
71
  return false;
65
- }, [(_e = state.addons) == null ? void 0 : _e.edit]);
72
+ }, [(_h = state.addons) == null ? void 0 : _h.edit]);
66
73
  const infoEdit = (0, import_react.useMemo)(() => {
67
74
  var _a2, _b2, _c2, _d2, _e2, _f2;
68
75
  if (!state.bookingId) {
@@ -154,7 +161,7 @@ var Footer = (props) => {
154
161
  console.log("state.bookingId && state.addons.edit", err);
155
162
  }
156
163
  };
157
- const handleSave = async ({ type }) => {
164
+ const handleSave = async ({ type, messageShow = true }) => {
158
165
  var _a2;
159
166
  let _setLoading = type === "checkout" ? setCheckoutLoading : setLoading;
160
167
  _setLoading(true);
@@ -173,11 +180,13 @@ var Footer = (props) => {
173
180
  }
174
181
  if (infoEdit) {
175
182
  callbackData = await api(values);
176
- import_antd.message.success(
177
- import_utils.locales.getText(
178
- state.bookingId ? "pisell2.text.appointment-updated" : "pisell2.text.created-successfully"
179
- )
180
- );
183
+ if (messageShow) {
184
+ import_antd.message.success(
185
+ import_utils.locales.getText(
186
+ state.bookingId ? "pisell2.text.appointment-updated" : "pisell2.text.created-successfully"
187
+ )
188
+ );
189
+ }
181
190
  }
182
191
  state == null ? void 0 : state.callback(callbackData);
183
192
  _setLoading(false);
@@ -228,6 +237,52 @@ var Footer = (props) => {
228
237
  import_utils.locales.getText("pisell2.text.checkout")
229
238
  );
230
239
  }, [isEdit, checkoutLoading, isDisabled, state, source]);
240
+ const handleMenuClick = async (e) => {
241
+ let id = state.bookingId;
242
+ if (isEdit) {
243
+ const res = await handleSave({ type: "checkout", messageShow: false });
244
+ id = (res == null ? void 0 : res.order_id) || state.bookingId;
245
+ }
246
+ if (e.key === "sendMail") {
247
+ state.action({
248
+ type: "pisell1.sendPayLinkEmail",
249
+ data: {
250
+ id
251
+ },
252
+ callback: () => {
253
+ }
254
+ });
255
+ }
256
+ if (e.key === "copy") {
257
+ state.action({
258
+ type: "pisell1.genClientPayLink",
259
+ data: {
260
+ id
261
+ },
262
+ callback: () => {
263
+ }
264
+ });
265
+ }
266
+ };
267
+ const paymentLinkButton = (0, import_react.useMemo)(() => {
268
+ const items = [
269
+ { label: import_utils.locales.getText("pisell2.text.send-mail"), key: "sendMail" },
270
+ { label: import_utils.locales.getText("pisell2.text.copy-to-clipboard"), key: "copy" }
271
+ ];
272
+ return /* @__PURE__ */ import_react.default.createElement(
273
+ import_antd.Dropdown,
274
+ {
275
+ menu: { items, onClick: handleMenuClick }
276
+ },
277
+ /* @__PURE__ */ import_react.default.createElement(
278
+ import_antd2.Button,
279
+ {
280
+ className: "pisell-lowcode__booking-footer-buttons-item"
281
+ },
282
+ /* @__PURE__ */ import_react.default.createElement(import_antd.Space, null, import_utils.locales.getText("pisell2.text.payment-link"), /* @__PURE__ */ import_react.default.createElement(import_icons.DownOutlined, null))
283
+ )
284
+ );
285
+ }, [handleMenuClick]);
231
286
  const saveButton = (0, import_react.useMemo)(() => {
232
287
  return /* @__PURE__ */ import_react.default.createElement(
233
288
  import_antd2.Button,
@@ -270,7 +325,8 @@ var Footer = (props) => {
270
325
  checkout: checkoutButton,
271
326
  save: saveButton,
272
327
  complete: completeButton,
273
- refund: refundButton
328
+ refund: refundButton,
329
+ paymentLink: paymentLinkButton
274
330
  };
275
331
  const isCheckout = (0, import_react.useMemo)(() => {
276
332
  var _a2, _b2, _c2;
@@ -303,6 +359,9 @@ var Footer = (props) => {
303
359
  }
304
360
  if (source === "payment") {
305
361
  let arr = [];
362
+ if (state.bookingId && isShowPaymentLink) {
363
+ arr.push(buttonMap.paymentLink);
364
+ }
306
365
  if (total.paidAmount > 0) {
307
366
  arr.push(buttonMap.refund);
308
367
  }
@@ -313,6 +372,9 @@ var Footer = (props) => {
313
372
  }
314
373
  if (source === "info") {
315
374
  let arr = [];
375
+ if (state.bookingId && isShowPaymentLink) {
376
+ arr.push(buttonMap.paymentLink);
377
+ }
316
378
  if (isCheckout) {
317
379
  arr.push(buttonMap.checkout);
318
380
  } else {
@@ -428,7 +490,7 @@ var Footer = (props) => {
428
490
  }, [
429
491
  state.bookingId,
430
492
  state.bookingDetail,
431
- (_f = state.addons) == null ? void 0 : _f.load,
493
+ (_i = state.addons) == null ? void 0 : _i.load,
432
494
  state.renderType
433
495
  ]);
434
496
  return /* @__PURE__ */ import_react.default.createElement(import_antd.Skeleton, { title: false, round: true, loading: showFooter, active: true }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-footer-total" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-footer-left" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-footer-left-total" }, totalText), /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-footer-left-arrears" }, arrearsText)), /* @__PURE__ */ import_react.default.createElement(
@@ -458,7 +520,7 @@ var Footer = (props) => {
458
520
  },
459
521
  /* @__PURE__ */ import_react.default.createElement("div", { className: "order-total-item-border" }),
460
522
  /* @__PURE__ */ import_react.default.createElement("div", { className: "order-total-item" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "order-total-item-label" }, import_utils.locales.getText("pisell1.text.subtotal")), /* @__PURE__ */ import_react.default.createElement("span", { className: "order-total-item-value" }, (0, import_utils.formatAmount)(total.productAmount, 2, (state == null ? void 0 : state.amountSymbol) || "$"))),
461
- (((_g = state.bookingDetail) == null ? void 0 : _g.surcharge) || []).map((d) => {
523
+ (((_j = state.bookingDetail) == null ? void 0 : _j.surcharge) || []).map((d) => {
462
524
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "order-total-item", key: d.id }, /* @__PURE__ */ import_react.default.createElement("span", { className: "order-total-item-label" }, d.name[state.locale]), /* @__PURE__ */ import_react.default.createElement("span", { className: "order-total-item-value" }, (0, import_utils.formatAmount)(d.amount, 2, (state == null ? void 0 : state.amountSymbol) || "$")));
463
525
  }),
464
526
  state.bookingId ? /* @__PURE__ */ import_react.default.createElement("div", { className: "order-total-item" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "order-total-item-label" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, import_utils.locales.getText("pisell1.text.tax")), /* @__PURE__ */ import_react.default.createElement("div", { className: "", style: { fontSize: 14 } }, taxText)), /* @__PURE__ */ import_react.default.createElement("span", { className: "order-total-item-value" }, (0, import_utils.formatAmount)(total.tax, 2, (state == null ? void 0 : state.amountSymbol) || "$"))) : null,
@@ -10,6 +10,7 @@ declare type DepositItemProps = {
10
10
  orderNumber: number;
11
11
  handleGoOrderDetail: () => void;
12
12
  generatePaymentLink: (orderId: number) => void;
13
+ sendEmail: (orderId: number) => void;
13
14
  depositAmount: number;
14
15
  amountSymbol: string;
15
16
  createdTime: string;
@@ -61,7 +61,8 @@ var DepositItem = (props) => {
61
61
  amountSymbol,
62
62
  createdTime,
63
63
  isPaid,
64
- isBookingCancelled
64
+ isBookingCancelled,
65
+ sendEmail
65
66
  } = props;
66
67
  const statusText = {
67
68
  unpaid: import_utils.locales.getText("pisell2.text.deposit-item-status-unpaid"),
@@ -71,19 +72,21 @@ var DepositItem = (props) => {
71
72
  document.body.id = "body";
72
73
  }, []);
73
74
  const items = [
75
+ {
76
+ key: "send",
77
+ label: /* @__PURE__ */ import_react.default.createElement("div", null, import_utils.locales.getText("pisell2.text.send-mail"))
78
+ },
74
79
  {
75
80
  key: "1",
76
81
  disabled: isPaid || isBookingCancelled,
77
82
  label: /* @__PURE__ */ import_react.default.createElement("div", null, import_utils.locales.getText("pisell2.text.deposit-generate-payment-link"))
78
83
  }
79
- // {
80
- // key: "2",
81
- // label: <div>发送邮件</div>,
82
- // },
83
84
  ];
84
85
  const onClick = ({ key }) => {
85
86
  if (key === "1") {
86
87
  generatePaymentLink == null ? void 0 : generatePaymentLink(orderId);
88
+ } else if (key === "send") {
89
+ sendEmail == null ? void 0 : sendEmail(orderId);
87
90
  }
88
91
  };
89
92
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__deposit-item" }, /* @__PURE__ */ import_react.default.createElement(
@@ -51,9 +51,19 @@ var Deposit = (props) => {
51
51
  const [modal, contextHolder] = import_antd.Modal.useModal();
52
52
  const editDepositModalRef = (0, import_react.useRef)();
53
53
  const context = (0, import_useEngineContext.default)();
54
- const { isTerminal, interaction } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
54
+ const { isTerminal, interaction, action } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
55
55
  import_utils2.request.setRequest(context.appHelper.utils.request);
56
56
  const { bookingDetail, bookingId, amountSymbol, generatePaymentLink, locale } = globalState;
57
+ const sendEmail = (id) => {
58
+ action({
59
+ type: "pisell1.sendPayLinkEmail",
60
+ data: {
61
+ id
62
+ },
63
+ callback: () => {
64
+ }
65
+ });
66
+ };
57
67
  const create = () => {
58
68
  var _a2, _b2;
59
69
  (_b2 = (_a2 = editDepositModalRef.current) == null ? void 0 : _a2.handleOpen) == null ? void 0 : _b2.call(_a2);
@@ -165,6 +175,7 @@ var Deposit = (props) => {
165
175
  key: item.status,
166
176
  ...item,
167
177
  generatePaymentLink,
178
+ sendEmail,
168
179
  handleGoOrderDetail,
169
180
  onEdit: (e) => handleEdit(e, item),
170
181
  isPaid,
@@ -228,7 +228,7 @@ var Info = () => {
228
228
  )) {
229
229
  return;
230
230
  }
231
- if (state.modalOpen && !state.bookingId) {
231
+ if (state.modalOpen && !state.bookingId && state.renderType !== "eventBooking") {
232
232
  handleSelectService();
233
233
  }
234
234
  }, [state.modalOpen, state.bookingId]);
@@ -241,6 +241,11 @@ var Info = () => {
241
241
  setSearch("");
242
242
  }
243
243
  }, [state.service.addModal]);
244
+ (0, import_react.useEffect)(() => {
245
+ if (state.renderType === "eventBooking" && state.modalOpen) {
246
+ getServices();
247
+ }
248
+ }, [state.renderType, state.modalOpen]);
244
249
  const addButton = (0, import_react.useMemo)(() => {
245
250
  if (state.renderType === "eventBooking") {
246
251
  return isService ? /* @__PURE__ */ import_react.default.createElement("div", { style: { height: 20 } }) : /* @__PURE__ */ import_react.default.createElement(
@@ -270,6 +275,7 @@ var Info = () => {
270
275
  state.service.value,
271
276
  loading
272
277
  ]);
278
+ console.log(state.service.addModal, "state.service.addModal");
273
279
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, ((_c = (_b = state.service) == null ? void 0 : _b.cacheItem) == null ? void 0 : _c.autoClose) && /* @__PURE__ */ import_react.default.createElement(import_antd.Skeleton, { loading: true, active: true, round: true }), addButton, /* @__PURE__ */ import_react.default.createElement(
274
280
  import_drawer.default,
275
281
  {
@@ -23,8 +23,8 @@ __export(utils_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(utils_exports);
25
25
  var getIsBundleOrCombination = (productDetail) => {
26
- var _a, _b, _c;
27
- if (((_a = productDetail == null ? void 0 : productDetail.bundle_group) == null ? void 0 : _a.length) || ((_b = productDetail == null ? void 0 : productDetail.option_group) == null ? void 0 : _b.length) || ((_c = productDetail == null ? void 0 : productDetail.variant) == null ? void 0 : _c.length)) {
26
+ var _a;
27
+ if ((_a = productDetail == null ? void 0 : productDetail.bundle_group) == null ? void 0 : _a.length) {
28
28
  return true;
29
29
  }
30
30
  return false;