@pisell/private-materials 3.0.140 → 3.0.141

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.
@@ -21,7 +21,7 @@ import useEngineContext from "../../../../hooks/useEngineContext";
21
21
  import "./index.less";
22
22
  import classNames from 'classnames';
23
23
  var header = function header(_ref) {
24
- var _context$appHelper, _state$bookingDetail2, _state$service2, _state$bookingDetail4, _state$bookingDetail5, _state$bookingDetail6, _state$bookingDetail7, _state$bookingDetail8;
24
+ var _context$appHelper, _state$bookingDetail2, _state$service2, _state$bookingDetail4, _state$bookingDetail5, _state$bookingDetail6;
25
25
  var state = _ref.state,
26
26
  dispatch = _ref.dispatch;
27
27
  var context = useEngineContext();
@@ -292,11 +292,22 @@ var header = function header(_ref) {
292
292
  * @Author: zhiwei.Wang
293
293
  * @Date: 2024-08-22 09:32
294
294
  */
295
- var isPaymentProcessingPayments = useMemo(function () {
295
+ var paymentProcessingPayment = function paymentProcessingPayment(type) {
296
296
  var _state$bookingDetail3;
297
- // 根据订单详情内 待确认支付列表 的长度判断
298
- return !!((_state$bookingDetail3 = state.bookingDetail) !== null && _state$bookingDetail3 !== void 0 && _state$bookingDetail3.payment_processing_payment_nums);
299
- }, [(_state$bookingDetail4 = state.bookingDetail) === null || _state$bookingDetail4 === void 0 ? void 0 : (_state$bookingDetail5 = _state$bookingDetail4.payment_processing_payments) === null || _state$bookingDetail5 === void 0 ? void 0 : _state$bookingDetail5.length]);
297
+ var payments = (state === null || state === void 0 ? void 0 : (_state$bookingDetail3 = state.bookingDetail) === null || _state$bookingDetail3 === void 0 ? void 0 : _state$bookingDetail3.payments) || [];
298
+ var status = ['payment_processing'];
299
+ var payment_method = ['BANK_DEPOSIT'];
300
+
301
+ // 是否有银行转账
302
+ if (type === 'bank') {
303
+ return !!(payments !== null && payments !== void 0 && payments.find(function (item) {
304
+ return status.includes(item === null || item === void 0 ? void 0 : item.status) && payment_method.includes(item === null || item === void 0 ? void 0 : item.payment_method);
305
+ }));
306
+ }
307
+ return !!(payments !== null && payments !== void 0 && payments.find(function (item) {
308
+ return status.includes(item === null || item === void 0 ? void 0 : item.status);
309
+ }));
310
+ };
300
311
 
301
312
  /**
302
313
  * @title: 取消预约
@@ -306,11 +317,16 @@ var header = function header(_ref) {
306
317
  * @Date: 2024-08-22 09:33
307
318
  */
308
319
  var handleCancel = function handleCancel() {
309
- // 存在待确认的支付,则弹窗提示
310
- if (isPaymentProcessingPayments) {
320
+ // 如果支付方式是银行转账,则打开未确认弹窗
321
+ if (paymentProcessingPayment('bank')) {
311
322
  return showPaymentModal();
312
323
  }
313
324
 
325
+ // 存在待确认的支付,则弹窗提示
326
+ if (paymentProcessingPayment()) {
327
+ return showCancelCalendarModal();
328
+ }
329
+
314
330
  // 取消
315
331
  return showCancelledModal();
316
332
  };
@@ -398,6 +414,54 @@ var header = function header(_ref) {
398
414
  });
399
415
  };
400
416
 
417
+ /**
418
+ * @title: 显示去支付的弹窗
419
+ * @description:
420
+ * @return {*}
421
+ * @Author: zhiwei.Wang
422
+ * @Date: 2024-08-22 09:33
423
+ */
424
+ var showCancelCalendarModal = function showCancelCalendarModal() {
425
+ setModalContentState({
426
+ className: 'go-payments-modal-wrap',
427
+ open: true,
428
+ width: 480,
429
+ onCancel: function onCancel() {
430
+ setModalContentState({
431
+ open: false
432
+ });
433
+ },
434
+ children: /*#__PURE__*/React.createElement("div", {
435
+ className: "go-payments-modal-content"
436
+ }, /*#__PURE__*/React.createElement("div", {
437
+ className: "go-payments-modal-content-title"
438
+ }, locales.getText('page.booking.text.cancel-booking')), /*#__PURE__*/React.createElement("div", {
439
+ className: "go-payments-modal-content-desc"
440
+ }, locales.getText('page.booking.text.cancel.calendar.msg')), /*#__PURE__*/React.createElement("div", {
441
+ className: "go-payments-footer"
442
+ }, /*#__PURE__*/React.createElement(Button, {
443
+ className: "go-payments-footer-btn",
444
+ size: "large",
445
+ onClick: function onClick() {
446
+ setModalContentState({
447
+ open: false
448
+ });
449
+ }
450
+ }, locales.getText('page.booking.text.go-back')), /*#__PURE__*/React.createElement(Button, {
451
+ className: "go-payments-footer-btn",
452
+ type: "primary",
453
+ size: "large",
454
+ onClick: function onClick() {
455
+ setBookingStatus('cancelled');
456
+ setModalContentState({
457
+ open: false
458
+ });
459
+ }
460
+ }, locales.getText('page.booking.text.cancel-booking')))),
461
+ footer: null
462
+ });
463
+ };
464
+
401
465
  /**
402
466
  * @title: 显示取消预约弹窗
403
467
  * @description:
@@ -491,11 +555,11 @@ var header = function header(_ref) {
491
555
  }
492
556
  }, /*#__PURE__*/React.createElement("div", {
493
557
  className: "booking-order-sales-channel"
494
- }, orderSalesChannel[(_state$bookingDetail6 = state.bookingDetail) === null || _state$bookingDetail6 === void 0 ? void 0 : _state$bookingDetail6.order_sales_channel] || ''), /*#__PURE__*/React.createElement("div", {
558
+ }, orderSalesChannel[(_state$bookingDetail4 = state.bookingDetail) === null || _state$bookingDetail4 === void 0 ? void 0 : _state$bookingDetail4.order_sales_channel] || ''), /*#__PURE__*/React.createElement("div", {
495
559
  className: "booking-header-line-2"
496
560
  }, /*#__PURE__*/React.createElement("div", {
497
561
  className: "booking-header-left"
498
- }, locales.getText('pisell2.text.status.booking_id'), ":", ' ', ((_state$bookingDetail7 = state.bookingDetail) === null || _state$bookingDetail7 === void 0 ? void 0 : (_state$bookingDetail8 = _state$bookingDetail7.bookings) === null || _state$bookingDetail8 === void 0 ? void 0 : _state$bookingDetail8.booking_id) || '-'), /*#__PURE__*/React.createElement("div", {
562
+ }, locales.getText('pisell2.text.status.booking_id'), ":", ' ', ((_state$bookingDetail5 = state.bookingDetail) === null || _state$bookingDetail5 === void 0 ? void 0 : (_state$bookingDetail6 = _state$bookingDetail5.bookings) === null || _state$bookingDetail6 === void 0 ? void 0 : _state$bookingDetail6.booking_id) || '-'), /*#__PURE__*/React.createElement("div", {
499
563
  className: "booking-header-right"
500
564
  }, /*#__PURE__*/React.createElement(Dropdown, {
501
565
  menu: {
@@ -181,6 +181,7 @@ declare const _default: {
181
181
  'page.event.booking.text.duplicate-enrollment-confirm': string;
182
182
  'page.booking.text.unconfirmed-payments': string;
183
183
  'page.booking.text.unconfirmed-payments.msg': string;
184
+ 'page.booking.text.cancel.calendar.msg': string;
184
185
  'page.booking.text.go-to-payments': string;
185
186
  'page.booking.text.cancel-only': string;
186
187
  'page.booking.text.refund': string;
@@ -376,6 +377,7 @@ declare const _default: {
376
377
  'page.event.booking.text.duplicate-enrollment-confirm': string;
377
378
  'page.booking.text.unconfirmed-payments': string;
378
379
  'page.booking.text.unconfirmed-payments.msg': string;
380
+ 'page.booking.text.cancel.calendar.msg': string;
379
381
  'page.booking.text.go-to-payments': string;
380
382
  'page.booking.text.cancel-only': string;
381
383
  'page.booking.text.refund': string;
@@ -571,6 +573,7 @@ declare const _default: {
571
573
  'page.event.booking.text.duplicate-enrollment-confirm': string;
572
574
  'page.booking.text.unconfirmed-payments': string;
573
575
  'page.booking.text.unconfirmed-payments.msg': string;
576
+ 'page.booking.text.cancel.calendar.msg': string;
574
577
  'page.booking.text.go-to-payments': string;
575
578
  'page.booking.text.cancel-only': string;
576
579
  'page.booking.text.refund': string;
@@ -208,6 +208,7 @@ export default {
208
208
  'page.event.booking.text.duplicate-enrollment-confirm': 'Confirm',
209
209
  'page.booking.text.unconfirmed-payments': 'Unconfirmed payments',
210
210
  'page.booking.text.unconfirmed-payments.msg': 'There are unconfirmed payments, please confirm or void the payments first.',
211
+ 'page.booking.text.cancel.calendar.msg': 'Are you sure you want to cancel the appointment? This appointment will be removed from the calendar.',
211
212
  'page.booking.text.go-to-payments': 'Go to payments',
212
213
  'page.booking.text.cancel-only': 'Cancel only',
213
214
  'page.booking.text.refund': 'Refund',
@@ -436,6 +437,7 @@ export default {
436
437
  'page.event.booking.text.duplicate-enrollment-confirm': '确认',
437
438
  'page.booking.text.unconfirmed-payments': '未确认的付款',
438
439
  'page.booking.text.unconfirmed-payments.msg': '存在未确认的付款,请先确认收款或作废。',
440
+ 'page.booking.text.cancel.calendar.msg': '确定要取消预约吗?此预约将从日历中移除。',
439
441
  'page.booking.text.go-to-payments': '前往收款界面',
440
442
  'page.booking.text.cancel-only': '仅取消',
441
443
  'page.booking.text.refund': '退款',
@@ -664,6 +666,7 @@ export default {
664
666
  'page.event.booking.text.duplicate-enrollment-confirm': '確認',
665
667
  'page.booking.text.unconfirmed-payments': '未確認的付款',
666
668
  'page.booking.text.unconfirmed-payments.msg': '存在未確認的付款,請先確認收款或作廢。',
669
+ 'page.booking.text.cancel.calendar.msg': '確定要取消預約嗎?此預約將從日曆中移除。',
667
670
  'page.booking.text.go-to-payments': '前往收款界面',
668
671
  'page.booking.text.cancel-only': '僅取消',
669
672
  'page.booking.text.refund': '退款',
@@ -40,7 +40,7 @@ var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContex
40
40
  var import_index = require("./index.less");
41
41
  var import_classnames = __toESM(require("classnames"));
42
42
  var header = ({ state, dispatch }) => {
43
- var _a, _b, _c, _d, _e, _f, _g, _h;
43
+ var _a, _b, _c, _d, _e, _f;
44
44
  const context = (0, import_useEngineContext.default)();
45
45
  const [modalContent, setModalContent] = (0, import_react.useState)({
46
46
  open: false,
@@ -169,14 +169,25 @@ var header = ({ state, dispatch }) => {
169
169
  )
170
170
  );
171
171
  }, [(_c = state.service) == null ? void 0 : _c.value]);
172
- const isPaymentProcessingPayments = (0, import_react.useMemo)(() => {
172
+ const paymentProcessingPayment = (type) => {
173
173
  var _a2;
174
- return !!((_a2 = state.bookingDetail) == null ? void 0 : _a2.payment_processing_payment_nums);
175
- }, [(_e = (_d = state.bookingDetail) == null ? void 0 : _d.payment_processing_payments) == null ? void 0 : _e.length]);
174
+ const payments = ((_a2 = state == null ? void 0 : state.bookingDetail) == null ? void 0 : _a2.payments) || [];
175
+ const status = ["payment_processing"];
176
+ const payment_method = ["BANK_DEPOSIT"];
177
+ if (type === "bank") {
178
+ return !!(payments == null ? void 0 : payments.find(
179
+ (item) => status.includes(item == null ? void 0 : item.status) && payment_method.includes(item == null ? void 0 : item.payment_method)
180
+ ));
181
+ }
182
+ return !!(payments == null ? void 0 : payments.find((item) => status.includes(item == null ? void 0 : item.status)));
183
+ };
176
184
  const handleCancel = () => {
177
- if (isPaymentProcessingPayments) {
185
+ if (paymentProcessingPayment("bank")) {
178
186
  return showPaymentModal();
179
187
  }
188
+ if (paymentProcessingPayment()) {
189
+ return showCancelCalendarModal();
190
+ }
180
191
  return showCancelledModal();
181
192
  };
182
193
  const handleRefund = () => {
@@ -235,6 +246,40 @@ var header = ({ state, dispatch }) => {
235
246
  footer: null
236
247
  });
237
248
  };
249
+ const showCancelCalendarModal = () => {
250
+ setModalContentState({
251
+ className: "go-payments-modal-wrap",
252
+ open: true,
253
+ width: 480,
254
+ onCancel: () => {
255
+ setModalContentState({ open: false });
256
+ },
257
+ children: /* @__PURE__ */ import_react.default.createElement("div", { className: "go-payments-modal-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "go-payments-modal-content-title" }, import_utils.locales.getText("page.booking.text.cancel-booking")), /* @__PURE__ */ import_react.default.createElement("div", { className: "go-payments-modal-content-desc" }, import_utils.locales.getText("page.booking.text.cancel.calendar.msg")), /* @__PURE__ */ import_react.default.createElement("div", { className: "go-payments-footer" }, /* @__PURE__ */ import_react.default.createElement(
258
+ import_antd.Button,
259
+ {
260
+ className: "go-payments-footer-btn",
261
+ size: "large",
262
+ onClick: () => {
263
+ setModalContentState({ open: false });
264
+ }
265
+ },
266
+ import_utils.locales.getText("page.booking.text.go-back")
267
+ ), /* @__PURE__ */ import_react.default.createElement(
268
+ import_antd.Button,
269
+ {
270
+ className: "go-payments-footer-btn",
271
+ type: "primary",
272
+ size: "large",
273
+ onClick: () => {
274
+ setBookingStatus("cancelled");
275
+ setModalContentState({ open: false });
276
+ }
277
+ },
278
+ import_utils.locales.getText("page.booking.text.cancel-booking")
279
+ ))),
280
+ footer: null
281
+ });
282
+ };
238
283
  const showCancelledModal = () => {
239
284
  const cancelBtn = /* @__PURE__ */ import_react.default.createElement(
240
285
  import_antd.Button,
@@ -316,8 +361,8 @@ var header = ({ state, dispatch }) => {
316
361
  className: "booking-header",
317
362
  style: { backgroundColor: currentStatus.color }
318
363
  },
319
- /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-order-sales-channel" }, orderSalesChannel[(_f = state.bookingDetail) == null ? void 0 : _f.order_sales_channel] || ""),
320
- /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-header-line-2" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-header-left" }, import_utils.locales.getText("pisell2.text.status.booking_id"), ":", " ", ((_h = (_g = state.bookingDetail) == null ? void 0 : _g.bookings) == null ? void 0 : _h.booking_id) || "-"), /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-header-right" }, /* @__PURE__ */ import_react.default.createElement(
364
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-order-sales-channel" }, orderSalesChannel[(_d = state.bookingDetail) == null ? void 0 : _d.order_sales_channel] || ""),
365
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-header-line-2" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-header-left" }, import_utils.locales.getText("pisell2.text.status.booking_id"), ":", " ", ((_f = (_e = state.bookingDetail) == null ? void 0 : _e.bookings) == null ? void 0 : _f.booking_id) || "-"), /* @__PURE__ */ import_react.default.createElement("div", { className: "booking-header-right" }, /* @__PURE__ */ import_react.default.createElement(
321
366
  import_antd.Dropdown,
322
367
  {
323
368
  menu: { items, onClick: onSelect },
@@ -181,6 +181,7 @@ declare const _default: {
181
181
  'page.event.booking.text.duplicate-enrollment-confirm': string;
182
182
  'page.booking.text.unconfirmed-payments': string;
183
183
  'page.booking.text.unconfirmed-payments.msg': string;
184
+ 'page.booking.text.cancel.calendar.msg': string;
184
185
  'page.booking.text.go-to-payments': string;
185
186
  'page.booking.text.cancel-only': string;
186
187
  'page.booking.text.refund': string;
@@ -376,6 +377,7 @@ declare const _default: {
376
377
  'page.event.booking.text.duplicate-enrollment-confirm': string;
377
378
  'page.booking.text.unconfirmed-payments': string;
378
379
  'page.booking.text.unconfirmed-payments.msg': string;
380
+ 'page.booking.text.cancel.calendar.msg': string;
379
381
  'page.booking.text.go-to-payments': string;
380
382
  'page.booking.text.cancel-only': string;
381
383
  'page.booking.text.refund': string;
@@ -571,6 +573,7 @@ declare const _default: {
571
573
  'page.event.booking.text.duplicate-enrollment-confirm': string;
572
574
  'page.booking.text.unconfirmed-payments': string;
573
575
  'page.booking.text.unconfirmed-payments.msg': string;
576
+ 'page.booking.text.cancel.calendar.msg': string;
574
577
  'page.booking.text.go-to-payments': string;
575
578
  'page.booking.text.cancel-only': string;
576
579
  'page.booking.text.refund': string;
@@ -237,6 +237,7 @@ var locales_default = {
237
237
  "page.event.booking.text.duplicate-enrollment-confirm": "Confirm",
238
238
  "page.booking.text.unconfirmed-payments": "Unconfirmed payments",
239
239
  "page.booking.text.unconfirmed-payments.msg": "There are unconfirmed payments, please confirm or void the payments first.",
240
+ "page.booking.text.cancel.calendar.msg": "Are you sure you want to cancel the appointment? This appointment will be removed from the calendar.",
240
241
  "page.booking.text.go-to-payments": "Go to payments",
241
242
  "page.booking.text.cancel-only": "Cancel only",
242
243
  "page.booking.text.refund": "Refund",
@@ -458,6 +459,7 @@ var locales_default = {
458
459
  "page.event.booking.text.duplicate-enrollment-confirm": "确认",
459
460
  "page.booking.text.unconfirmed-payments": "未确认的付款",
460
461
  "page.booking.text.unconfirmed-payments.msg": "存在未确认的付款,请先确认收款或作废。",
462
+ "page.booking.text.cancel.calendar.msg": "确定要取消预约吗?此预约将从日历中移除。",
461
463
  "page.booking.text.go-to-payments": "前往收款界面",
462
464
  "page.booking.text.cancel-only": "仅取消",
463
465
  "page.booking.text.refund": "退款",
@@ -679,6 +681,7 @@ var locales_default = {
679
681
  "page.event.booking.text.duplicate-enrollment-confirm": "確認",
680
682
  "page.booking.text.unconfirmed-payments": "未確認的付款",
681
683
  "page.booking.text.unconfirmed-payments.msg": "存在未確認的付款,請先確認收款或作廢。",
684
+ "page.booking.text.cancel.calendar.msg": "確定要取消預約嗎?此預約將從日曆中移除。",
682
685
  "page.booking.text.go-to-payments": "前往收款界面",
683
686
  "page.booking.text.cancel-only": "僅取消",
684
687
  "page.booking.text.refund": "退款",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "3.0.140",
3
+ "version": "3.0.141",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -60,8 +60,8 @@
60
60
  "rc-virtual-list": "^3.11.3",
61
61
  "decimal.js": "^10.4.3",
62
62
  "@pisell/utils": "1.0.42",
63
- "@pisell/icon": "0.0.11",
64
63
  "@pisell/materials": "3.0.47",
64
+ "@pisell/icon": "0.0.11",
65
65
  "@pisell/date-picker": "1.0.100"
66
66
  },
67
67
  "peerDependencies": {