@pisell/private-materials 6.6.54 → 6.6.55

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 (67) hide show
  1. package/build/lowcode/render/default/view.css +1 -1
  2. package/build/lowcode/render/default/view.js +1 -1
  3. package/build/lowcode/view.css +1 -1
  4. package/build/lowcode/view.js +1 -1
  5. package/es/components/appointmentBooking/components/Voucher/index.js +22 -7
  6. package/es/components/booking/addons/index.js +3 -2
  7. package/es/components/booking/components/footer/amount.js +4 -5
  8. package/es/components/booking/components/footer/index.js +7 -0
  9. package/es/components/booking/components/footer/utils.d.ts +1 -1
  10. package/es/components/booking/components/footer/utils.js +10 -15
  11. package/es/components/booking/components/voucher/index.js +7 -1
  12. package/es/components/booking/components/voucher/index.less +4 -1
  13. package/es/components/booking/components/voucherModal/index.less +1 -0
  14. package/es/components/booking/info2/service/editService/index.js +10 -8
  15. package/es/components/booking/info2/service/editService/utils.d.ts +0 -1
  16. package/es/components/booking/info2/service/editService/utils.js +0 -16
  17. package/es/components/booking/payments/index.js +1 -1
  18. package/es/components/checkout/components/WalletPassModule/index.js +1 -0
  19. package/es/components/checkout/components/WalletPassModule/utils.d.ts +1 -0
  20. package/es/components/checkout/components/WalletPassModule/utils.js +17 -3
  21. package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
  22. package/es/components/checkout/hooks/useWalletPass.js +316 -192
  23. package/es/components/pay/toC/PaymentMethods/WalletPass/index.d.ts +5 -0
  24. package/es/components/pay/toC/PaymentMethods/WalletPass/index.js +166 -145
  25. package/es/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +6 -0
  26. package/es/components/pay/toC/PaymentMethods/WalletPass/utils.js +3 -3
  27. package/es/components/pay/toC/WalletPassBlock/index.js +3 -1
  28. package/es/components/pay/toC/index.js +66 -27
  29. package/es/components/pay/toC/model.d.ts +1 -0
  30. package/es/components/pay/toC/serve.d.ts +18 -0
  31. package/es/components/pay/toC/serve.js +29 -1
  32. package/es/components/pay/toC/utils.d.ts +2 -2
  33. package/es/components/pay/toC/utils.js +4 -0
  34. package/es/components/ticketBooking/components/addServiceVariant/addService.js +7 -4
  35. package/lib/components/appointmentBooking/components/Voucher/index.js +10 -2
  36. package/lib/components/booking/addons/index.js +3 -2
  37. package/lib/components/booking/components/footer/amount.js +4 -4
  38. package/lib/components/booking/components/footer/index.js +9 -0
  39. package/lib/components/booking/components/footer/utils.d.ts +1 -1
  40. package/lib/components/booking/components/footer/utils.js +10 -15
  41. package/lib/components/booking/components/voucher/index.js +7 -1
  42. package/lib/components/booking/components/voucher/index.less +4 -1
  43. package/lib/components/booking/components/voucherModal/index.less +1 -0
  44. package/lib/components/booking/info2/service/editService/index.js +24 -21
  45. package/lib/components/booking/info2/service/editService/utils.d.ts +0 -1
  46. package/lib/components/booking/info2/service/editService/utils.js +0 -16
  47. package/lib/components/booking/payments/index.js +1 -1
  48. package/lib/components/checkout/components/WalletPassModule/index.js +1 -0
  49. package/lib/components/checkout/components/WalletPassModule/utils.d.ts +1 -0
  50. package/lib/components/checkout/components/WalletPassModule/utils.js +18 -2
  51. package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
  52. package/lib/components/checkout/hooks/useWalletPass.js +157 -108
  53. package/lib/components/pay/toC/PaymentMethods/WalletPass/index.d.ts +5 -0
  54. package/lib/components/pay/toC/PaymentMethods/WalletPass/index.js +90 -103
  55. package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +6 -0
  56. package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.js +2 -2
  57. package/lib/components/pay/toC/WalletPassBlock/index.js +3 -1
  58. package/lib/components/pay/toC/index.js +52 -11
  59. package/lib/components/pay/toC/model.d.ts +1 -0
  60. package/lib/components/pay/toC/serve.d.ts +18 -0
  61. package/lib/components/pay/toC/serve.js +6 -0
  62. package/lib/components/pay/toC/utils.d.ts +2 -2
  63. package/lib/components/pay/toC/utils.js +4 -0
  64. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +11 -7
  65. package/package.json +3 -3
  66. package/es/components/booking/info/service2/utils.d.ts +0 -219
  67. package/lib/components/booking/info/service2/utils.d.ts +0 -219
@@ -28,6 +28,8 @@ import { PisellInput, PisellGoodPassCard, PisellText, PisellToast } from '@pisel
28
28
  import { useAppointmentBooking, useShopDiscount, useAppointmentBookingLogin, useAppointmentBookingAccount } from "../../hooks";
29
29
  import "../../../booking/components/voucher/index.less";
30
30
  import "./index.less";
31
+ import { useAppointmentBookingContext } from "../../context";
32
+ import { useDebounceFn } from 'ahooks';
31
33
  var ShopDiscountHooks = {
32
34
  onInited: 'shopDiscount:onInited',
33
35
  onDestroy: 'shopDiscount:onDestroy',
@@ -69,11 +71,19 @@ var VoucherCard = function VoucherCard(props) {
69
71
  openLoginModal = _useAppointmentBookin.openLoginModal;
70
72
  var _useAppointmentBookin2 = useAppointmentBookingAccount(),
71
73
  accountLists = _useAppointmentBookin2.accountLists;
74
+ var _useAppointmentBookin3 = useAppointmentBookingContext(),
75
+ summary = _useAppointmentBookin3.summary;
76
+ var originTotal = summary.originTotal,
77
+ total = summary.total;
72
78
  var cart = appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$s = appointmentBooking.store) === null || _appointmentBooking$s === void 0 ? void 0 : _appointmentBooking$s.cart;
73
79
  var isUserLoggedIn = useMemo(function () {
74
80
  var _utils$token, _utils$token$get;
75
81
  return !!(utils !== null && utils !== void 0 && (_utils$token = utils.token) !== null && _utils$token !== void 0 && (_utils$token$get = _utils$token.get) !== null && _utils$token$get !== void 0 && _utils$token$get.call(_utils$token)) || false;
76
82
  }, [store]);
83
+ useEffect(function () {
84
+ var shopDiscount = pisellos.getModule('shopDiscount');
85
+ shopDiscount.setOriginTotalAmount(originTotal);
86
+ }, [originTotal]);
77
87
  var availableData = useMemo(function () {
78
88
  return discountList.filter(function (item) {
79
89
  return !!item.isAvailable;
@@ -110,13 +120,18 @@ var VoucherCard = function VoucherCard(props) {
110
120
  });
111
121
  appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$b = appointmentBooking.batchUpdateCart) === null || _appointmentBooking$b === void 0 || _appointmentBooking$b.call(appointmentBooking, items);
112
122
  };
113
- var onCartChange = function onCartChange() {
114
- var _shopDiscount$setBook, _appointmentBooking$o;
115
- var products = cart === null || cart === void 0 ? void 0 : cart.getItems();
116
- shopDiscount === null || shopDiscount === void 0 || (_shopDiscount$setBook = shopDiscount.setBookingSubject) === null || _shopDiscount$setBook === void 0 || _shopDiscount$setBook.call(shopDiscount, appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$o = appointmentBooking.otherParams) === null || _appointmentBooking$o === void 0 || (_appointmentBooking$o = _appointmentBooking$o.bookingSetting) === null || _appointmentBooking$o === void 0 ? void 0 : _appointmentBooking$o.bookingSubject);
117
- var val = shopDiscount.calcDiscount(products);
118
- batchUpdateCart(val.productList);
119
- };
123
+
124
+ // 防抖处理
125
+ var _useDebounceFn = useDebounceFn(function () {
126
+ var _shopDiscount$setBook, _appointmentBooking$o;
127
+ var products = cart === null || cart === void 0 ? void 0 : cart.getItems();
128
+ shopDiscount === null || shopDiscount === void 0 || (_shopDiscount$setBook = shopDiscount.setBookingSubject) === null || _shopDiscount$setBook === void 0 || _shopDiscount$setBook.call(shopDiscount, appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$o = appointmentBooking.otherParams) === null || _appointmentBooking$o === void 0 || (_appointmentBooking$o = _appointmentBooking$o.bookingSetting) === null || _appointmentBooking$o === void 0 ? void 0 : _appointmentBooking$o.bookingSubject);
129
+ var val = shopDiscount.calcDiscount(products);
130
+ batchUpdateCart(val.productList);
131
+ }, {
132
+ wait: 200
133
+ }),
134
+ onCartChange = _useDebounceFn.run;
120
135
  var stringifiedHolders = useMemo(function () {
121
136
  var _ret;
122
137
  try {
@@ -60,14 +60,15 @@ export var formatProducts = function formatProducts(values) {
60
60
  discountway: 'num',
61
61
  discount_type: 'discount',
62
62
  bundle_edit: (_item$_extend2 = item._extend) === null || _item$_extend2 === void 0 ? void 0 : _item$_extend2.bundle_edit,
63
- product_bundle: formatProductBundle((_item$_extend3 = item._extend) === null || _item$_extend3 === void 0 || (_item$_extend3 = _item$_extend3.other) === null || _item$_extend3 === void 0 ? void 0 : _item$_extend3.bundle),
63
+ product_bundle: formatProductBundle((_item$_extend3 = item._extend) === null || _item$_extend3 === void 0 || (_item$_extend3 = _item$_extend3.other) === null || _item$_extend3 === void 0 ? void 0 : _item$_extend3.bundle, item.is_price_include_tax),
64
64
  "product_option_item": formatProductOption((_item$_extend4 = item._extend) === null || _item$_extend4 === void 0 || (_item$_extend4 = _item$_extend4.other) === null || _item$_extend4 === void 0 ? void 0 : _item$_extend4.option),
65
65
  "product_variant_id": ((_item$_extend5 = item._extend) === null || _item$_extend5 === void 0 || (_item$_extend5 = _item$_extend5.other) === null || _item$_extend5 === void 0 ? void 0 : _item$_extend5.product_variant_id) || 0,
66
66
  "source_product_price": getSourceProductPrice(item),
67
67
  "main_product_selling_price": (_getMainProductSellin = getMainProductSellingPrice(item)) !== null && _getMainProductSellin !== void 0 ? _getMainProductSellin : formatProductPrice(item),
68
68
  "calculated_original_price": formatOriginalPrice(item),
69
69
  "calculated_selling_price": formatSellingPrice(item),
70
- "tax_fee": item._extend.tax_fee
70
+ "tax_fee": item._extend.tax_fee,
71
+ is_price_include_tax: item.is_price_include_tax
71
72
  };
72
73
  });
73
74
  return arr;
@@ -519,8 +519,7 @@ var processItemsTax = function processItemsTax(items, state, options) {
519
519
  }
520
520
  return {
521
521
  originTax: expectedOriginTax,
522
- tax: expectedTax,
523
- taxDecimal: preciseTax
522
+ tax: expectedTax
524
523
  };
525
524
  };
526
525
 
@@ -652,7 +651,7 @@ var getTax = function getTax(state, options) {
652
651
  computed: computed
653
652
  });
654
653
  totalOriginTax = totalOriginTax.plus(serviceResult.originTax);
655
- totalTax = totalTax.plus(serviceResult.taxDecimal);
654
+ totalTax = totalTax.plus(serviceResult.tax);
656
655
  }
657
656
 
658
657
  // 处理附加商品
@@ -663,7 +662,7 @@ var getTax = function getTax(state, options) {
663
662
  computed: computed
664
663
  });
665
664
  totalOriginTax = totalOriginTax.plus(addonsResult.originTax);
666
- totalTax = totalTax.plus(addonsResult.taxDecimal);
665
+ totalTax = totalTax.plus(addonsResult.tax);
667
666
  }
668
667
  }
669
668
  return {
@@ -844,7 +843,7 @@ var getMainProductTotal = function getMainProductTotal(item) {
844
843
  // 子商品价格
845
844
  var bundleItemPrice = new Decimal((_ref5 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref5 !== void 0 ? _ref5 : 0);
846
845
  // todo: 套餐子商品后不需要处理 子商品价格 - 子商品折扣金额
847
- var bundleItemTotal = bundleItemPrice.minus(discountAmount);
846
+ var bundleItemTotal = bundleItemPrice;
848
847
  total = total.add(bundleItemTotal);
849
848
  }
850
849
  }
@@ -338,6 +338,13 @@ var Footer = function Footer(props) {
338
338
  ScheduleModule: ScheduleModule
339
339
  }, getDataFromHost()));
340
340
  }, [state, isEdit]);
341
+ useEffect(function () {
342
+ window.dispatchEvent(new CustomEvent('onOriginExpectAmountWithoutDiscountChange', {
343
+ detail: {
344
+ originExpectAmountWithoutDiscount: total === null || total === void 0 ? void 0 : total.originExpectAmountWithoutDiscount
345
+ }
346
+ }));
347
+ }, [total === null || total === void 0 ? void 0 : total.originExpectAmountWithoutDiscount]);
341
348
  useDebounceEffect(function () {
342
349
  var _state$service4;
343
350
  if (state !== null && state !== void 0 && (_state$service4 = state.service) !== null && _state$service4 !== void 0 && _state$service4.addTimeModal) {
@@ -15,7 +15,7 @@ export declare const formatProductOption: (option: any) => any;
15
15
  * @Author: zhiwei.Wang
16
16
  * @Date: 2024-02-19 09:26
17
17
  */
18
- export declare const formatProductBundle: (bundle: any) => any;
18
+ export declare const formatProductBundle: (bundle: any, is_price_include_tax: number) => any;
19
19
  /**
20
20
  * 获取子商品折扣信息
21
21
  * @param item
@@ -93,7 +93,7 @@ var log = function log(data) {
93
93
  * @Author: zhiwei.Wang
94
94
  * @Date: 2024-02-19 09:26
95
95
  */
96
- export var formatProductBundle = function formatProductBundle(bundle) {
96
+ export var formatProductBundle = function formatProductBundle(bundle, is_price_include_tax) {
97
97
  if (!bundle) {
98
98
  return;
99
99
  }
@@ -108,7 +108,6 @@ export var formatProductBundle = function formatProductBundle(bundle) {
108
108
  }
109
109
  } catch (error) {}
110
110
  return bundle.map(function (d) {
111
- var _d$metadata;
112
111
  var option = formatProductOption(d.option);
113
112
  var option_price = option.reduce(function (temp, item) {
114
113
  return temp + Number(item.num) * item.custom_add_price;
@@ -135,8 +134,9 @@ export var formatProductBundle = function formatProductBundle(bundle) {
135
134
  "option": option,
136
135
  "bundle_selling_price": Math.abs(d === null || d === void 0 ? void 0 : d.price),
137
136
  // "bundle_sum_price": d?.original_price || d?.original_total,
137
+ is_price_include_tax: is_price_include_tax,
138
138
  "metadata": {
139
- custom_product_bundle_map_id: (d === null || d === void 0 || (_d$metadata = d.metadata) === null || _d$metadata === void 0 ? void 0 : _d$metadata.custom_product_bundle_map_id) || d._id,
139
+ custom_product_bundle_map_id: d._id,
140
140
  // 子商品单数量附加费
141
141
  "surcharge_fee": d.surcharge_fee,
142
142
  // 可选,附加费均摊舍入金额
@@ -324,8 +324,8 @@ export var formatOriginalPrice = function formatOriginalPrice(item) {
324
324
 
325
325
  /**
326
326
  * 获取套餐子商品折扣差价
327
- * @param item
328
- * @returns
327
+ * @param item
328
+ * @returns
329
329
  */
330
330
  var getBundleProductDiscountDifference = function getBundleProductDiscountDifference(item) {
331
331
  var _item$_extend9, _item$_extend10, _item$_extend11;
@@ -478,7 +478,7 @@ export var getMainProductSellingPrice = function getMainProductSellingPrice(item
478
478
  * @Author: WangHan
479
479
  * @Date: 2024-12-07 14:21
480
480
  */
481
- var formatProducts = function formatProducts(item, quantity, options) {
481
+ var formatProducts = function formatProducts(item, quantity) {
482
482
  var _item$_extend36, _getMainProductSellin, _item$_extend37, _item$_extend38, _item$_extend39, _item$_extend40;
483
483
  var total = Number(item._extend.total);
484
484
  var origin_total = Number(item._extend.origin_total);
@@ -493,9 +493,6 @@ var formatProducts = function formatProducts(item, quantity, options) {
493
493
  d.metadata = _objectSpread(_objectSpread({}, d.metadata), {}, {
494
494
  unique_identification_number: "".concat(item._extend.unique_identification_number, "_").concat(d.discount.resource_id)
495
495
  });
496
- if (options !== null && options !== void 0 && options.isServiceEdit && options !== null && options !== void 0 && options.isMultiDay) {
497
- delete d.id;
498
- }
499
496
  });
500
497
 
501
498
  // 非手动折扣
@@ -520,7 +517,7 @@ var formatProducts = function formatProducts(item, quantity, options) {
520
517
  "discount_per": item._extend.discount_per,
521
518
  "discount_type": item._extend.discount_type || discount_type,
522
519
  "order_detail_id": item._extend.order_detail_id || 0,
523
- "product_bundle": formatProductBundle((_item$_extend38 = item._extend) === null || _item$_extend38 === void 0 || (_item$_extend38 = _item$_extend38.other) === null || _item$_extend38 === void 0 ? void 0 : _item$_extend38.bundle),
520
+ "product_bundle": formatProductBundle((_item$_extend38 = item._extend) === null || _item$_extend38 === void 0 || (_item$_extend38 = _item$_extend38.other) === null || _item$_extend38 === void 0 ? void 0 : _item$_extend38.bundle, item.is_price_include_tax),
524
521
  "bundle_edit": item._extend.bundle_edit || bundleDiscountList.length ? 1 : 0,
525
522
  "product_option_item": formatProductOption((_item$_extend39 = item._extend) === null || _item$_extend39 === void 0 || (_item$_extend39 = _item$_extend39.other) === null || _item$_extend39 === void 0 ? void 0 : _item$_extend39.option),
526
523
  "product_variant_id": ((_item$_extend40 = item._extend) === null || _item$_extend40 === void 0 || (_item$_extend40 = _item$_extend40.other) === null || _item$_extend40 === void 0 ? void 0 : _item$_extend40.product_variant_id) || 0,
@@ -530,7 +527,8 @@ var formatProducts = function formatProducts(item, quantity, options) {
530
527
  "calculated_original_price": formatOriginalPrice(item),
531
528
  "calculated_selling_price": formatSellingPrice(item),
532
529
  "tax_fee": item._extend.tax_fee,
533
- "custom_deposit_data": item.custom_deposit_data
530
+ "custom_deposit_data": item.custom_deposit_data,
531
+ is_price_include_tax: item.is_price_include_tax
534
532
  };
535
533
  };
536
534
 
@@ -718,10 +716,7 @@ var formatBookings = function formatBookings(data, values) {
718
716
  item._extend.unique_identification_number = unique_identification_number;
719
717
  }
720
718
  var booking = _objectSpread(_objectSpread({
721
- product: formatProducts(item, undefined, {
722
- isServiceEdit: data.service.edit,
723
- isMultiDay: isMultiDay
724
- }),
719
+ product: formatProducts(item),
725
720
  relation_products: formatRelationDetails(item._extend.relation_details),
726
721
  id: item.booking_id || 0,
727
722
  relation_id: item._extend.relation_id || 0,
@@ -128,7 +128,7 @@ var VoucherCard = function VoucherCard(props) {
128
128
  var val = (_ref = state.service.value || []) === null || _ref === void 0 ? void 0 : _ref.map(function (value) {
129
129
  var _value$_extend, _value$_extend2, _value$_extend3;
130
130
  return {
131
- // booking_id: value.booking_id,
131
+ booking_id: value.booking_id,
132
132
  id: value.id,
133
133
  price: value.price,
134
134
  total: value === null || value === void 0 || (_value$_extend = value._extend) === null || _value$_extend === void 0 ? void 0 : _value$_extend.total,
@@ -152,11 +152,17 @@ var VoucherCard = function VoucherCard(props) {
152
152
  }
153
153
  onScanCode(e.detail.code);
154
154
  });
155
+ var onOriginExpectAmountWithoutDiscountChange = useMemoizedFn(function (e) {
156
+ var _shopDiscount$setOrig;
157
+ shopDiscount === null || shopDiscount === void 0 || (_shopDiscount$setOrig = shopDiscount.setOriginTotalAmount) === null || _shopDiscount$setOrig === void 0 || _shopDiscount$setOrig.call(shopDiscount, e.detail.originExpectAmountWithoutDiscount);
158
+ });
155
159
  useEffect(function () {
156
160
  var wrappedOnScanWallPassCode = executeIfActive(onScanWallPassCode);
157
161
  window.addEventListener('onScanWallPassCode', wrappedOnScanWallPassCode);
162
+ window.addEventListener('onOriginExpectAmountWithoutDiscountChange', onOriginExpectAmountWithoutDiscountChange);
158
163
  return function () {
159
164
  window.removeEventListener('onScanWallPassCode', wrappedOnScanWallPassCode);
165
+ window.removeEventListener('onOriginExpectAmountWithoutDiscountChange', onOriginExpectAmountWithoutDiscountChange);
160
166
  };
161
167
  }, []);
162
168
  var addonsMemo = useMemo(function () {
@@ -1,5 +1,8 @@
1
1
  .pisell-lowcode__booking-footer-voucher-container {
2
2
  margin-bottom: 8px;
3
+ width: 100%;
4
+ display: flex;
5
+ flex-direction: column;
3
6
  .voucher-title {
4
7
  display: flex;
5
8
  align-items: center;
@@ -47,9 +50,9 @@
47
50
  width: 100%;
48
51
  transition: 0.2s;
49
52
  max-height: 0;
50
- overflow: hidden;
51
53
  display: flex;
52
54
  flex-direction: column;
55
+ overflow: auto;
53
56
 
54
57
  &.show {
55
58
  max-height: unset;
@@ -6,6 +6,7 @@
6
6
  .pisell-voucher-modal-content {
7
7
  max-height: 70vh;
8
8
  overflow-y: auto;
9
+ display: flex;
9
10
  }
10
11
 
11
12
  // 隐藏状态下的样式优化
@@ -41,19 +41,20 @@ import { editSessionProduct } from "../../../info/utils";
41
41
  import { deleteCacheParams, getDays, getProductOriginTotalPrice, getProductTotalPrice, getServiceTimes, isSessionProduct, isWalkIn } from "../../../utils";
42
42
  import { getErrorList, getIsNoSpecAndPackage } from "../../utilsByBooking";
43
43
  import { formatResources, getDurationProps, getFlexibleOption, getMultiDay, getTimeObj, setDefaultCapacitys } from "../addService/utils";
44
- import { getProductAllDiscountList, mergeBundles, setProductPrice, mergeBundleWithOriginalPrice } from "./utils";
44
+ import { getProductAllDiscountList, mergeBundleWithOriginalPrice, setProductPrice } from "./utils";
45
45
  import NoteModal from "../../../../../plus/noteModal";
46
46
  import { DiscountKeyboard } from "../../../../../pro/priceKeyboard";
47
47
  import EditTabs from "../../../info/service/editService/EditTabs";
48
48
  import BookingList from "../../../info/service/editService/BookingList";
49
49
  import dayjs from "dayjs";
50
50
  import { createBookingItemsByGroup, getGroupTotalPrice } from "../../../info/service2/Group/utils";
51
+ import useEngineContext from "../../../../../hooks/useEngineContext";
51
52
  import { useShopDiscountModule } from "../../../../ticketBooking/hooks/pisellos/useShopDiscountModule";
52
53
  import DiscountChangeModal from "./DiscountChangeModal";
53
54
  import Decimal from "decimal.js";
54
55
  var submitLock = false;
55
56
  var Info = function Info(_, ref) {
56
- var _state$service4, _state$bookingConfig2, _state$bookingConfig3, _state$service$cacheI5, _state$service$cacheI7, _state$service6, _window$BaseMaterials, _state$service8, _state$service$cacheI12, _state$bookingConfig5, _state$service$cacheI13, _state$service$cacheI14, _state$service9, _state$service$resour2, _state$service$cacheI16, _state$service$cacheI17, _state$client2;
57
+ var _context$appHelper, _state$service4, _state$bookingConfig2, _state$bookingConfig3, _state$service$cacheI5, _state$service$cacheI7, _state$service6, _window$BaseMaterials, _state$service8, _state$service$cacheI12, _state$bookingConfig5, _state$service$cacheI13, _state$service$cacheI14, _state$service9, _state$service$resour2, _state$service$cacheI16, _state$service$cacheI17, _state$client2;
57
58
  var _Form$useForm = Form.useForm(),
58
59
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
59
60
  form = _Form$useForm2[0];
@@ -89,6 +90,9 @@ var Info = function Info(_, ref) {
89
90
  _useState8 = _slicedToArray(_useState7, 2),
90
91
  currentTab = _useState8[0],
91
92
  setCurrentTab = _useState8[1];
93
+ var context = useEngineContext();
94
+ var _context$appHelper$ut = (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils,
95
+ getData = _context$appHelper$ut.getData;
92
96
  var valuesRef = useRef({});
93
97
  var noInOriginalDiscountIdsRef = useRef([]);
94
98
 
@@ -323,7 +327,9 @@ var Info = function Info(_, ref) {
323
327
  submitLock = false;
324
328
  }, 1500);
325
329
  var _list = _toConsumableArray(state.service.value);
326
- var _item = _objectSpread(_objectSpread({}, cacheItem !== null && cacheItem !== void 0 ? cacheItem : state.service.cacheItem), {}, {
330
+ var _item = _objectSpread(_objectSpread({
331
+ is_price_include_tax: getData('is_price_include_tax')
332
+ }, cacheItem !== null && cacheItem !== void 0 ? cacheItem : state.service.cacheItem), {}, {
327
333
  autoClose: false
328
334
  });
329
335
  var _extend = _objectSpread(_objectSpread({}, _item._extend), {}, {
@@ -687,9 +693,7 @@ var Info = function Info(_, ref) {
687
693
  },
688
694
  isOS: isSession,
689
695
  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,
690
- value: _objectSpread(_objectSpread(_objectSpread({}, item._extend.other), {}, {
691
- bundle: mergeBundles(item._extend.other)
692
- }, sessionValue), {}, {
696
+ value: _objectSpread(_objectSpread(_objectSpread({}, item._extend.other), sessionValue), {}, {
693
697
  quantity: values.quantity || item._extend.quantity
694
698
  })
695
699
  },
@@ -1225,8 +1229,6 @@ var Info = function Info(_, ref) {
1225
1229
  var _cacheItem$_extend$ot, _cacheItem$_extend$ot2;
1226
1230
  delete cacheItem.discount_list;
1227
1231
  (_cacheItem$_extend$ot = cacheItem._extend.other) === null || _cacheItem$_extend$ot === void 0 || (_cacheItem$_extend$ot = _cacheItem$_extend$ot.bundle) === null || _cacheItem$_extend$ot === void 0 || (_cacheItem$_extend$ot2 = _cacheItem$_extend$ot.forEach) === null || _cacheItem$_extend$ot2 === void 0 || _cacheItem$_extend$ot2.call(_cacheItem$_extend$ot, function (bundle) {
1228
- var _bundle$metadata;
1229
- bundle === null || bundle === void 0 || (_bundle$metadata = bundle.metadata) === null || _bundle$metadata === void 0 || delete _bundle$metadata.custom_product_bundle_map_id;
1230
1232
  bundle === null || bundle === void 0 || delete bundle.discount_list;
1231
1233
  bundle === null || bundle === void 0 || delete bundle.booking_id;
1232
1234
  bundle === null || bundle === void 0 || delete bundle.bundle_selling_price;
@@ -32,7 +32,6 @@ export declare const setProductPrice: (cacheItem: any, { newTotal, origin_total
32
32
  * @returns 折扣列表
33
33
  */
34
34
  export declare const getProductAllDiscountList: (cacheItem: any) => any;
35
- export declare const mergeBundles: (other: any) => any[];
36
35
  /**
37
36
  * 合并 bundle 数据,基于 id 和 product_id 匹配,price 优先使用 originalOther 中的值
38
37
  * @param other - callback 返回的新数据
@@ -149,22 +149,6 @@ export var getProductAllDiscountList = function getProductAllDiscountList(cacheI
149
149
  (_discountList = discountList).push.apply(_discountList, _toConsumableArray(bundleDiscountList));
150
150
  return discountList;
151
151
  };
152
- export var mergeBundles = function mergeBundles(other) {
153
- var bundle = (other === null || other === void 0 ? void 0 : other.bundle) || [];
154
- var newBundle = [];
155
- bundle.forEach(function (item) {
156
- var newItem = newBundle.find(function (newItem) {
157
- return newItem.id === item.id;
158
- });
159
- if (newItem) {
160
- newItem.num += item.num || 1;
161
- newItem.quantity += item.quantity || 1;
162
- } else {
163
- newBundle.push(_objectSpread({}, item));
164
- }
165
- });
166
- return newBundle;
167
- };
168
152
 
169
153
  /**
170
154
  * 合并 bundle 数据,基于 id 和 product_id 匹配,price 优先使用 originalOther 中的值
@@ -189,7 +189,7 @@ var Payments = Provider(function (props) {
189
189
  className: "payment-list-item-surcharge"
190
190
  }, "(", locales.getText("pisell2.text.surcharge"), " ", formatAmount(item.service_fee, 2, (state === null || state === void 0 ? void 0 : state.amountSymbol) || "$"), ")") : null, /*#__PURE__*/React.createElement("div", {
191
191
  className: "payment-list-item-date"
192
- }, dayjs(item.payment_time || item.created_at).format("HH:mm YYYY/MM/DD"), /*#__PURE__*/React.createElement("span", {
192
+ }, dayjs(item.payment_time).format("HH:mm YYYY/MM/DD"), /*#__PURE__*/React.createElement("span", {
193
193
  className: "payment-list-item-platform-type"
194
194
  }, item.platform && locales.getText("pisell2.text.platform.type")(item.platform))))))));
195
195
  }
@@ -25,6 +25,7 @@ var WalletPassModule = /*#__PURE__*/forwardRef(function (props, ref) {
25
25
  var _useWalletPass = useWalletPass({
26
26
  onSelectChange: onSelectChange,
27
27
  customAmount: customAmount,
28
+ totalAmount: Number(orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.totalAmount) || 0,
28
29
  clientId: clientId
29
30
  }),
30
31
  handleSelectWallet = _useWalletPass.handleSelectWallet,
@@ -1,6 +1,7 @@
1
1
  declare type WalletPassDataType = Record<string, any>;
2
2
  export declare const getAvailableMaxAmount: (data: WalletPassDataType) => any;
3
3
  export declare const voucherTime: (data: WalletPassDataType, key?: string) => any;
4
+ export declare const getVoucherAvailableStatus: (item: any) => boolean;
4
5
  export declare const formatMachineCodeServer2CardList: (data: WalletPassDataType[], selectId?: number[], otherProps?: Record<string, any>) => any;
5
6
  export declare const formatDiscountWalletData: (data: any, selectId?: number[]) => any;
6
7
  export interface WalletPassUsageUnit {
@@ -11,12 +11,15 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
11
11
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
12
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
13
  import React from 'react';
14
- import { formatDate, locales } from '@pisell/utils';
14
+ import { formatDate, isNumber, locales } from '@pisell/utils';
15
15
  import { globalConfig, PisellText } from "@pisell/materials";
16
16
  import Decimal from 'decimal.js';
17
17
  var Amount = PisellText.Amount;
18
18
  // 获取walletPass可用最大金额
19
19
  export var getAvailableMaxAmount = function getAvailableMaxAmount(data) {
20
+ if (isNumber(data._available_max_amount)) {
21
+ return data._available_max_amount;
22
+ }
20
23
  return data.tag !== 'point_card' ? data.available_max_amount : data === null || data === void 0 ? void 0 : data.recommended_usage_amount;
21
24
  };
22
25
  export var voucherTime = function voucherTime(data) {
@@ -27,11 +30,22 @@ export var voucherTime = function voucherTime(data) {
27
30
  }
28
31
  return locales.getText('pisell2.text.walletPassPermanent');
29
32
  };
33
+ export var getVoucherAvailableStatus = function getVoucherAvailableStatus(item) {
34
+ return item.unified_available_status === 1 && (isNumber(item._unified_available_status) ? !!item._unified_available_status : true);
35
+ };
30
36
  export var formatMachineCodeServer2CardList = function formatMachineCodeServer2CardList(data) {
31
37
  var selectId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
32
38
  var otherProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
33
39
  return (data || []).map(function (item) {
34
40
  var _item$unified_message, _item$product;
41
+ var disabled = false;
42
+ if (item.unified_available_status === 0) {
43
+ disabled = true;
44
+ } else {
45
+ if (isNumber(item._unified_available_status)) {
46
+ disabled = !item._unified_available_status;
47
+ }
48
+ }
35
49
  return _objectSpread({
36
50
  id: item.id,
37
51
  name: item.product_name,
@@ -48,8 +62,8 @@ export var formatMachineCodeServer2CardList = function formatMachineCodeServer2C
48
62
  showQrCode: false,
49
63
  showStatus: true,
50
64
  code: item.code,
51
- disabled: !item.unified_available_status,
52
- disabledReason: (_item$unified_message = item.unified_messages) === null || _item$unified_message === void 0 ? void 0 : _item$unified_message.title,
65
+ disabled: disabled,
66
+ disabledReason: isNumber(item._unified_available_status) && item._unified_available_status !== 1 ? item.reason : (_item$unified_message = item.unified_messages) === null || _item$unified_message === void 0 ? void 0 : _item$unified_message.title,
53
67
  cover: (_item$product = item.product) === null || _item$product === void 0 ? void 0 : _item$product.cover,
54
68
  qrCode: item.code,
55
69
  validDate: voucherTime(item),
@@ -9,6 +9,7 @@ export declare const useWalletPass: (props: {
9
9
  }[]) => void) | undefined;
10
10
  customAmount?: string | undefined;
11
11
  clientId?: number | undefined;
12
+ totalAmount?: number | undefined;
12
13
  }) => {
13
14
  walletRecommendList: any[];
14
15
  userIdentificationCodes: any[];
@@ -29,7 +30,6 @@ export declare const useWalletPass: (props: {
29
30
  selectedDiscountList: any;
30
31
  handleSelectDiscount: (this: unknown, value: number[], option: any) => void;
31
32
  customerName: any;
32
- fetchWalletRecommendList: (this: unknown, params: any) => Promise<any>;
33
33
  fetchUserIdentificationCodes: (this: unknown, params: any) => Promise<any>;
34
34
  getCachedWalletRecommendList: (this: unknown) => any;
35
35
  getCachedUserIdentificationCodes: (this: unknown) => any;