@pisell/private-materials 6.4.41 → 6.4.43

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 (230) 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/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +8 -8
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +8 -8
  11. package/es/components/Sales/Summary/utils.d.ts +1 -1
  12. package/es/components/booking/addons/model.d.ts +10 -1
  13. package/es/components/booking/components/actionButtons/index.js +37 -42
  14. package/es/components/booking/components/actionButtons/index.less +0 -28
  15. package/es/components/booking/components/footer/amount.d.ts +3 -3
  16. package/es/components/booking/components/footer/amount.js +13 -2
  17. package/es/components/booking/components/footer/index.js +168 -68
  18. package/es/components/booking/components/footer/utils.js +62 -33
  19. package/es/components/booking/forms/model.d.ts +10 -1
  20. package/es/components/booking/info/model.d.ts +10 -1
  21. package/es/components/booking/info/model.js +5 -0
  22. package/es/components/booking/info/service/addService/index.js +2 -1
  23. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  24. package/es/components/booking/info/service2/utils.d.ts +1 -1
  25. package/es/components/booking/info2/index.js +42 -2
  26. package/es/components/booking/info2/service/addService/index.js +2 -1
  27. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  28. package/es/components/booking/info2/service/editService/index.js +12 -4
  29. package/es/components/booking/model.d.ts +9 -1
  30. package/es/components/booking/notes/model.d.ts +10 -1
  31. package/es/components/booking/payments/model.d.ts +10 -1
  32. package/es/components/booking/utils.d.ts +2 -2
  33. package/es/components/checkout/PaymentModal.d.ts +2 -0
  34. package/es/components/checkout/PaymentModal.js +395 -240
  35. package/es/components/checkout/components/AdditionalModule/index.less +1 -1
  36. package/es/components/checkout/components/AmountSummary/index.js +161 -54
  37. package/es/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
  38. package/es/components/checkout/components/CashPaymentModule/index.js +114 -137
  39. package/es/components/checkout/components/CashPaymentModule/index.less +200 -176
  40. package/es/components/checkout/components/PaymentDetailModal/index.js +2 -2
  41. package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +29 -0
  42. package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +210 -0
  43. package/es/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -4
  44. package/es/components/checkout/components/PaymentOptionsModule/index.js +12 -114
  45. package/es/components/checkout/components/PaymentOptionsModule/index.less +29 -0
  46. package/es/components/checkout/components/SavePayLaterHandler/index.js +1 -1
  47. package/es/components/checkout/components/SearchAndClientModule/index.js +40 -39
  48. package/es/components/checkout/components/WalletPassModule/index.js +3 -2
  49. package/es/components/checkout/components/WalletPassModule/utils.js +6 -1
  50. package/es/components/checkout/hooks/useWalletPass.js +2 -0
  51. package/es/components/checkout/index.less +1 -1
  52. package/es/components/checkout/locales.d.ts +33 -0
  53. package/es/components/checkout/locales.js +39 -3
  54. package/es/components/checkout/types.d.ts +1 -0
  55. package/es/components/eftposPay/amount.d.ts +1 -1
  56. package/es/components/eftposPay/device.d.ts +1 -1
  57. package/es/components/eftposPay/hooks.d.ts +2 -2
  58. package/es/components/eftposPay/store/index.d.ts +5 -5
  59. package/es/components/pay/toC/model.d.ts +9 -1
  60. package/es/components/schedules/model.d.ts +9 -1
  61. package/es/components/shoppingCart/components/Cart/Product.js +143 -71
  62. package/es/components/shoppingCart/components/Cart/index.js +1 -1
  63. package/es/components/shoppingCart/components/Cart/index.less +31 -0
  64. package/es/components/shoppingCart/locales.d.ts +3 -0
  65. package/es/components/shoppingCart/locales.js +12 -3
  66. package/es/components/ticketBooking/hooks/pisellos/useCustomer.js +7 -7
  67. package/es/components/ticketBooking/utils/index.js +2 -1
  68. package/es/components/wallet/Detail/model.d.ts +13 -1
  69. package/es/components/wallet/DiscountCard/model.d.ts +14 -1
  70. package/es/components/wallet/PointCard/model.d.ts +13 -1
  71. package/es/components/wallet/RechargeableCard/model.d.ts +29 -1
  72. package/es/components/wallet/Voucher/model.d.ts +13 -1
  73. package/es/components/wallet/model.d.ts +9 -1
  74. package/es/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +1 -1
  75. package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
  76. package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +148 -0
  77. package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
  78. package/es/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
  79. package/es/pro/pisellSimplePriceKeyboardPopover/index.js +1 -0
  80. package/es/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
  81. package/es/pro/pisellSimplePriceKeyboardPopover/types.js +1 -0
  82. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +4 -0
  83. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +310 -0
  84. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
  85. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +349 -0
  86. package/es/pro/priceKeyboard/components/cashKeyboard/index.d.ts +11 -0
  87. package/es/pro/priceKeyboard/components/cashKeyboard/index.js +49 -0
  88. package/es/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
  89. package/es/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
  90. package/es/pro/priceKeyboard/components/cashKeyboard/locales.js +41 -0
  91. package/es/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
  92. package/es/pro/priceKeyboard/components/cashKeyboard/types.js +1 -0
  93. package/es/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
  94. package/es/pro/priceKeyboard/components/discountKeyboard/index.js +442 -0
  95. package/es/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
  96. package/es/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
  97. package/es/pro/priceKeyboard/components/discountKeyboard/locales.js +44 -0
  98. package/es/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
  99. package/es/pro/priceKeyboard/components/discountKeyboard/types.js +1 -0
  100. package/es/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +11 -0
  101. package/es/pro/priceKeyboard/components/paymentKeyboard/index.js +444 -0
  102. package/es/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
  103. package/es/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
  104. package/es/pro/priceKeyboard/components/paymentKeyboard/locales.js +47 -0
  105. package/es/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
  106. package/es/pro/priceKeyboard/components/paymentKeyboard/types.js +1 -0
  107. package/es/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
  108. package/es/pro/priceKeyboard/components/shortcuts/index.js +47 -0
  109. package/es/pro/priceKeyboard/components/shortcuts/index.less +39 -0
  110. package/es/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
  111. package/es/pro/priceKeyboard/hooks/keyActions.js +252 -0
  112. package/es/pro/priceKeyboard/hooks/rightItems.d.ts +27 -0
  113. package/es/pro/priceKeyboard/hooks/rightItems.js +50 -0
  114. package/es/pro/priceKeyboard/index.d.ts +3 -0
  115. package/es/pro/priceKeyboard/index.js +3 -0
  116. package/es/pro/priceKeyboard/index.less +215 -0
  117. package/es/pro/priceKeyboard/utils.d.ts +31 -0
  118. package/es/pro/priceKeyboard/utils.js +51 -0
  119. package/es/pro/skuDetailModal/index.js +19 -16
  120. package/lib/components/Sales/Summary/utils.d.ts +1 -1
  121. package/lib/components/booking/addons/model.d.ts +10 -1
  122. package/lib/components/booking/components/actionButtons/index.js +31 -28
  123. package/lib/components/booking/components/actionButtons/index.less +0 -28
  124. package/lib/components/booking/components/footer/amount.d.ts +3 -3
  125. package/lib/components/booking/components/footer/amount.js +10 -4
  126. package/lib/components/booking/components/footer/index.js +107 -40
  127. package/lib/components/booking/components/footer/utils.js +35 -7
  128. package/lib/components/booking/forms/model.d.ts +10 -1
  129. package/lib/components/booking/info/model.d.ts +10 -1
  130. package/lib/components/booking/info/model.js +3 -0
  131. package/lib/components/booking/info/service/addService/index.js +2 -1
  132. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  133. package/lib/components/booking/info/service2/utils.d.ts +1 -1
  134. package/lib/components/booking/info2/index.js +18 -1
  135. package/lib/components/booking/info2/service/addService/index.js +2 -1
  136. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  137. package/lib/components/booking/info2/service/editService/index.js +12 -4
  138. package/lib/components/booking/model.d.ts +9 -1
  139. package/lib/components/booking/notes/model.d.ts +10 -1
  140. package/lib/components/booking/payments/model.d.ts +10 -1
  141. package/lib/components/booking/utils.d.ts +2 -2
  142. package/lib/components/checkout/PaymentModal.d.ts +2 -0
  143. package/lib/components/checkout/PaymentModal.js +152 -73
  144. package/lib/components/checkout/components/AdditionalModule/index.less +1 -1
  145. package/lib/components/checkout/components/AmountSummary/index.js +114 -40
  146. package/lib/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
  147. package/lib/components/checkout/components/CashPaymentModule/index.js +103 -140
  148. package/lib/components/checkout/components/CashPaymentModule/index.less +200 -176
  149. package/lib/components/checkout/components/PaymentDetailModal/index.js +2 -2
  150. package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +29 -0
  151. package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +172 -0
  152. package/lib/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -4
  153. package/lib/components/checkout/components/PaymentOptionsModule/index.js +11 -123
  154. package/lib/components/checkout/components/PaymentOptionsModule/index.less +29 -0
  155. package/lib/components/checkout/components/SavePayLaterHandler/index.js +1 -1
  156. package/lib/components/checkout/components/SearchAndClientModule/index.js +3 -29
  157. package/lib/components/checkout/components/WalletPassModule/index.js +3 -2
  158. package/lib/components/checkout/components/WalletPassModule/utils.js +4 -1
  159. package/lib/components/checkout/hooks/useWalletPass.js +2 -0
  160. package/lib/components/checkout/index.less +1 -1
  161. package/lib/components/checkout/locales.d.ts +33 -0
  162. package/lib/components/checkout/locales.js +39 -3
  163. package/lib/components/checkout/types.d.ts +1 -0
  164. package/lib/components/eftposPay/amount.d.ts +1 -1
  165. package/lib/components/eftposPay/device.d.ts +1 -1
  166. package/lib/components/eftposPay/hooks.d.ts +2 -2
  167. package/lib/components/eftposPay/store/index.d.ts +5 -5
  168. package/lib/components/pay/toC/model.d.ts +9 -1
  169. package/lib/components/schedules/model.d.ts +9 -1
  170. package/lib/components/shoppingCart/components/Cart/Product.js +111 -51
  171. package/lib/components/shoppingCart/components/Cart/index.js +1 -1
  172. package/lib/components/shoppingCart/components/Cart/index.less +31 -0
  173. package/lib/components/shoppingCart/locales.d.ts +3 -0
  174. package/lib/components/shoppingCart/locales.js +6 -3
  175. package/lib/components/ticketBooking/hooks/pisellos/useCustomer.js +7 -7
  176. package/lib/components/ticketBooking/index.js +5 -1
  177. package/lib/components/ticketBooking/utils/index.js +2 -1
  178. package/lib/components/wallet/Detail/model.d.ts +13 -1
  179. package/lib/components/wallet/DiscountCard/model.d.ts +14 -1
  180. package/lib/components/wallet/PointCard/model.d.ts +13 -1
  181. package/lib/components/wallet/RechargeableCard/model.d.ts +29 -1
  182. package/lib/components/wallet/Voucher/model.d.ts +13 -1
  183. package/lib/components/wallet/model.d.ts +9 -1
  184. package/lib/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +2 -2
  185. package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
  186. package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +144 -0
  187. package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
  188. package/lib/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
  189. package/lib/pro/pisellSimplePriceKeyboardPopover/index.js +35 -0
  190. package/lib/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
  191. package/lib/pro/pisellSimplePriceKeyboardPopover/types.js +17 -0
  192. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +4 -0
  193. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +332 -0
  194. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
  195. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +399 -0
  196. package/lib/pro/priceKeyboard/components/cashKeyboard/index.d.ts +11 -0
  197. package/lib/pro/priceKeyboard/components/cashKeyboard/index.js +76 -0
  198. package/lib/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
  199. package/lib/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
  200. package/lib/pro/priceKeyboard/components/cashKeyboard/locales.js +65 -0
  201. package/lib/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
  202. package/lib/pro/priceKeyboard/components/cashKeyboard/types.js +17 -0
  203. package/lib/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
  204. package/lib/pro/priceKeyboard/components/discountKeyboard/index.js +485 -0
  205. package/lib/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
  206. package/lib/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
  207. package/lib/pro/priceKeyboard/components/discountKeyboard/locales.js +68 -0
  208. package/lib/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
  209. package/lib/pro/priceKeyboard/components/discountKeyboard/types.js +17 -0
  210. package/lib/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +11 -0
  211. package/lib/pro/priceKeyboard/components/paymentKeyboard/index.js +488 -0
  212. package/lib/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
  213. package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
  214. package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.js +71 -0
  215. package/lib/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
  216. package/lib/pro/priceKeyboard/components/paymentKeyboard/types.js +17 -0
  217. package/lib/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
  218. package/lib/pro/priceKeyboard/components/shortcuts/index.js +79 -0
  219. package/lib/pro/priceKeyboard/components/shortcuts/index.less +39 -0
  220. package/lib/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
  221. package/lib/pro/priceKeyboard/hooks/keyActions.js +176 -0
  222. package/lib/pro/priceKeyboard/hooks/rightItems.d.ts +27 -0
  223. package/lib/pro/priceKeyboard/hooks/rightItems.js +81 -0
  224. package/lib/pro/priceKeyboard/index.d.ts +3 -0
  225. package/lib/pro/priceKeyboard/index.js +45 -0
  226. package/lib/pro/priceKeyboard/index.less +215 -0
  227. package/lib/pro/priceKeyboard/utils.d.ts +31 -0
  228. package/lib/pro/priceKeyboard/utils.js +75 -0
  229. package/lib/pro/skuDetailModal/index.js +18 -22
  230. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  .additional-module {
2
- padding-bottom: 16px; // 底部间距
2
+ // padding-bottom: 16px; // 底部间距
3
3
 
4
4
  // 标题样式
5
5
  &-title {
@@ -8,8 +8,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
8
8
  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; }
9
9
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import { useState, useEffect } from 'react';
12
- import { Button, Dropdown } from 'antd';
11
+ import { useState, useEffect, useMemo } from 'react';
12
+ import { Button, Dropdown, Popover } from 'antd';
13
13
  import { CheckCircleOutlined, PieChartOutlined } from '@ant-design/icons';
14
14
  import { Edit05 } from '@pisell/icon';
15
15
  import { PisellModal } from '@pisell/materials';
@@ -17,7 +17,8 @@ import { locales, formatAmountWithOptions } from '@pisell/utils';
17
17
  import Decimal from 'decimal.js';
18
18
  import checkoutLocales from "../../locales";
19
19
  import PaymentDetailModal from "../PaymentDetailModal";
20
- import PisellPriceKeyboardPopover from "../../../../pro/pisellPriceKeyboardPopover";
20
+ import PisellPriceKeyboardPopover from "../../../../pro/pisellSimplePriceKeyboardPopover";
21
+ import { PaymentKeyboard } from "../../../../pro/priceKeyboard";
21
22
  import "./index.less";
22
23
  import classNames from 'classnames';
23
24
  import useEngineContext from "../../../../hooks/useEngineContext";
@@ -112,6 +113,12 @@ function AmountSummary(_ref2) {
112
113
  // 获取 checkout 模块
113
114
  var checkoutModule = pisellos.getModule('checkout');
114
115
 
116
+ // 控制键盘弹窗显示状态
117
+ var _useState9 = useState(false),
118
+ _useState10 = _slicedToArray(_useState9, 2),
119
+ isKeyboardVisible = _useState10[0],
120
+ setIsKeyboardVisible = _useState10[1];
121
+
115
122
  // 小计标签映射
116
123
  var labelMaps = {
117
124
  deposit: getText('pisell2.subtotal.deposit') || 'Deposit',
@@ -127,16 +134,16 @@ function AmountSummary(_ref2) {
127
134
 
128
135
  // 获取右侧Balance Due的金额
129
136
  var getBalanceDueAmount = function getBalanceDueAmount() {
130
- // 优先使用 pisellos 数据中的 expect_amount
131
- var expectAmountItem = summaryData.find(function (item) {
132
- return item.key === 'expect_amount';
133
- });
134
- if (expectAmountItem) {
135
- return expectAmountItem.value;
137
+ // 如果当前订单是定金,则使用 depositAmount
138
+ if (paymentType === 'deposit') {
139
+ return (orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.depositAmount) || '0';
136
140
  }
137
-
138
- // 降级方案:使用硬编码值
139
- return 0;
141
+ return (paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.reduce(function (acc, item) {
142
+ if (item.isSynced || !item.voucher_id) {
143
+ return acc;
144
+ }
145
+ return acc.plus(item.amount);
146
+ }, new Decimal(0)).toNumber()) || 0;
140
147
  };
141
148
 
142
149
  // 解析格式化金额字符串为数字的工具函数
@@ -156,10 +163,10 @@ function AmountSummary(_ref2) {
156
163
  }
157
164
  return 0;
158
165
  };
159
- var _useState9 = useState(customAmount && customAmount !== '' ? customAmount : parseFormattedAmount(getBalanceDueAmount())),
160
- _useState10 = _slicedToArray(_useState9, 2),
161
- currentAmount = _useState10[0],
162
- setCurrentAmount = _useState10[1];
166
+ var _useState11 = useState(customAmount && customAmount !== '' ? customAmount : parseFormattedAmount(getBalanceDueAmount())),
167
+ _useState12 = _slicedToArray(_useState11, 2),
168
+ currentAmount = _useState12[0],
169
+ setCurrentAmount = _useState12[1];
163
170
 
164
171
  // 响应外部 customAmount 变化
165
172
  useEffect(function () {
@@ -176,6 +183,7 @@ function AmountSummary(_ref2) {
176
183
  if (Array.isArray(summary)) {
177
184
  setSummaryData(summary);
178
185
  }
186
+ setPaymentType(orderInfo.isDeposit ? 'deposit' : 'regular');
179
187
  } catch (error) {
180
188
  console.warn('Failed to get cart summary:', error);
181
189
  }
@@ -257,26 +265,14 @@ function AmountSummary(_ref2) {
257
265
  return totalDecimal.toNumber();
258
266
  };
259
267
 
260
- // 获取订单待支付金额
261
- var getOrderDueAmount = function getOrderDueAmount() {
262
- var expectAmountItem = summaryData.find(function (item) {
263
- return item.key === 'expect_amount';
264
- });
265
- if (expectAmountItem) {
266
- return expectAmountItem.value;
267
- }
268
- // 降级方案:使用硬编码值
269
- return paymentType === 'deposit' ? 15.1 : 130.2;
270
- };
271
-
272
268
  // 计算键盘输入的最小值和最大值
273
269
  var getKeyboardLimits = function getKeyboardLimits() {
274
270
  var walletTotal = getWalletTotalAmount();
275
- var orderDue = getOrderDueAmount();
271
+ // const orderDue = getBalanceDueAmount();
276
272
 
277
273
  // 使用 Decimal.js 进行精确计算,避免浮点数精度问题
278
274
  var walletTotalDecimal = new Decimal(walletTotal);
279
- var orderDueDecimal = new Decimal(orderDue);
275
+ var orderDueDecimal = new Decimal(Number(balanceDueAmount || 0));
280
276
  var minDecimal = new Decimal(0.01);
281
277
 
282
278
  // 计算 orderDue - walletTotal
@@ -377,7 +373,7 @@ function AmountSummary(_ref2) {
377
373
 
378
374
  // 计算含有 voucher_id 的付款项金额合计
379
375
  var voucherPaymentAmount = (paymentItems === null || paymentItems === void 0 || (_paymentItems$reduce2 = paymentItems.reduce(function (acc, item) {
380
- if (item.voucher_id) {
376
+ if (item.voucher_id && !item.isSynced) {
381
377
  try {
382
378
  var _amount = new Decimal(item.amount || '0');
383
379
  var roundingAmount = new Decimal(item.rounding_amount || '0');
@@ -390,6 +386,13 @@ function AmountSummary(_ref2) {
390
386
  }, new Decimal(0))) === null || _paymentItems$reduce2 === void 0 ? void 0 : _paymentItems$reduce2.toNumber()) || 0;
391
387
  var totalPaidAmount = partialPaidAmountDecimal.plus(voucherPaymentAmount).toNumber();
392
388
 
389
+ // 如果已经有除了voucher 以外的其他支付项 isSynced的,并且还没超过订单总金额,则需要显示
390
+ var syncedPaymentItems = (paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.filter(function (item) {
391
+ return item.isSynced && !item.voucher_id;
392
+ })) || [];
393
+ if ((syncedPaymentItems === null || syncedPaymentItems === void 0 ? void 0 : syncedPaymentItems.length) > 0 && totalPaidAmount < totalAmount) {
394
+ return true;
395
+ }
393
396
  // 如果 (部分付款金额 + 含有voucher_id的付款项金额合计) >= 总金额,则不显示
394
397
  if (totalPaidAmount >= totalAmount) {
395
398
  return false;
@@ -449,9 +452,13 @@ function AmountSummary(_ref2) {
449
452
  var _walletPassData$selec, _walletPassData$selec2;
450
453
  // 检查是否有支付项
451
454
  // if (!paymentItems || paymentItems.length === 0) return false;
455
+ // 先去除掉已经同步的支付项
456
+ var unSyncedPaymentItems = paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.filter(function (item) {
457
+ return !item.isSynced;
458
+ });
452
459
 
453
460
  // 检查所有支付项是否都含有voucher_id
454
- var allItemsHaveVoucherId = paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.every(function (item) {
461
+ var allItemsHaveVoucherId = unSyncedPaymentItems === null || unSyncedPaymentItems === void 0 ? void 0 : unSyncedPaymentItems.every(function (item) {
455
462
  return item.voucher_id;
456
463
  });
457
464
  return allItemsHaveVoucherId || ((_walletPassData$selec = walletPassData === null || walletPassData === void 0 || (_walletPassData$selec2 = walletPassData.selectedDiscountList) === null || _walletPassData$selec2 === void 0 ? void 0 : _walletPassData$selec2.length) !== null && _walletPassData$selec !== void 0 ? _walletPassData$selec : 0) > 0;
@@ -540,7 +547,7 @@ function AmountSummary(_ref2) {
540
547
  className: classNames('partial-paid-card')
541
548
  }, /*#__PURE__*/React.createElement("span", {
542
549
  className: classNames('partial-paid-label')
543
- }, getText('partial.paid') || 'Partial Paid'), /*#__PURE__*/React.createElement("span", {
550
+ }, paymentType === 'deposit' ? getText('deposit.partial.paid') || 'Deposit Paid' : getText('partial.paid') || 'Partial Paid'), /*#__PURE__*/React.createElement("span", {
544
551
  className: classNames('partial-paid-amount')
545
552
  }, formatAmountWithOptions(partialPaidAmount, amountSymbol, {
546
553
  precision: 2,
@@ -595,11 +602,43 @@ function AmountSummary(_ref2) {
595
602
  })));
596
603
  }
597
604
  };
605
+ var canSwitch = useMemo(function () {
606
+ if (Number(orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.totalAmount) === 0) {
607
+ return false;
608
+ }
609
+ // 如果当前是普通支付,并且支付项里已经有了type=default 的数据,则不可以再切换到定金支付
610
+ // 增加一个逻辑,如果当前是普通支付,并且支付项里有定金支付的钱,并且定金支付的钱已经超过了定金总金额,就不可以再切换了
611
+ if (paymentType === 'regular') {
612
+ var depositPaidAmount = paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.reduce(function (acc, item) {
613
+ if (item.order_payment_type === 'deposit') {
614
+ return acc.plus(item.amount).plus(Math.abs(item.rounding_amount));
615
+ }
616
+ return acc;
617
+ }, new Decimal(0)).toNumber();
618
+ var depositFlag = depositPaidAmount >= new Decimal((orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.depositAmount) || '0').toNumber() && Number(orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.depositAmount) > 0;
619
+ return !(paymentItems !== null && paymentItems !== void 0 && paymentItems.some(function (item) {
620
+ return item.order_payment_type === 'normal';
621
+ })) && !depositFlag;
622
+ } else {
623
+ // 如果是定金支付,且定金已付款金额大于等于订单总金额,则不可以再切换到普通支付
624
+ var _depositPaidAmount = paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.reduce(function (acc, item) {
625
+ if (item.order_payment_type === 'deposit') {
626
+ return acc.plus(item.amount);
627
+ }
628
+ return acc;
629
+ }, new Decimal(0)).toNumber();
630
+ return _depositPaidAmount < new Decimal(totalAmount).toNumber();
631
+ }
632
+ }, [paymentItems, paymentType, totalAmount]);
633
+ var handleChangeDepositAmount = function handleChangeDepositAmount(value) {
634
+ console.log('handleChangeDepositAmount', value);
635
+ checkoutModule === null || checkoutModule === void 0 || checkoutModule.setDepositAmountAsync(value);
636
+ };
598
637
  return /*#__PURE__*/React.createElement("div", {
599
638
  className: classNames('amount-summary-module', 'amount-summary-container')
600
639
  }, /*#__PURE__*/React.createElement("div", {
601
640
  className: classNames('left-section')
602
- }, open_deposit ? /*#__PURE__*/React.createElement(Dropdown, {
641
+ }, open_deposit && canSwitch ? /*#__PURE__*/React.createElement(Dropdown, {
603
642
  menu: {
604
643
  items: paymentOptions,
605
644
  onClick: function onClick(_ref5) {
@@ -644,9 +683,32 @@ function AmountSummary(_ref2) {
644
683
  // 如果应该显示确认模式,直接返回确认界面
645
684
  shouldShowConfirmMode() ? renderConfirmMode() : /*#__PURE__*/React.createElement("div", {
646
685
  className: classNames('balance-due-info')
647
- }, /*#__PURE__*/React.createElement("div", {
686
+ }, paymentType === 'deposit' ? /*#__PURE__*/React.createElement(PisellPriceKeyboardPopover, {
687
+ value: (orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.depositAmount) || '0'
688
+ // onChange={handleKeyboardChange}
689
+ ,
690
+ onConfirm: handleChangeDepositAmount,
691
+ showCurrencySymbol: true,
692
+ useThousandsSeparator: true,
693
+ selectType: "dark",
694
+ overlayClassName: "cash-payment-keyboard-popover"
695
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
696
+ className: classNames('balance-due-label')
697
+ }, getText('deposit.due') || 'Deposit Due'), /*#__PURE__*/React.createElement("div", {
698
+ className: classNames('balance-due-amount')
699
+ }, formatAmountWithOptions(balanceDueAmount, amountSymbol, {
700
+ precision: 2,
701
+ hideDecimalForWholeNumbers: false,
702
+ useThousandsSeparator: true,
703
+ showCurrencySymbol: true
704
+ }), /*#__PURE__*/React.createElement(Edit05, {
705
+ className: classNames('edit-icon'),
706
+ style: {
707
+ color: '#7F56DA'
708
+ }
709
+ })))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
648
710
  className: classNames('balance-due-label')
649
- }, paymentType === 'deposit' ? getText('deposit.due') || 'Deposit Due' : getText('balance.due') || 'Balance Due'), /*#__PURE__*/React.createElement("div", {
711
+ }, getText('balance.due') || 'Balance Due'), /*#__PURE__*/React.createElement("div", {
650
712
  className: classNames('balance-due-amount'),
651
713
  onClick: function onClick() {
652
714
  onBalanceDueAmountClick === null || onBalanceDueAmountClick === void 0 || onBalanceDueAmountClick('manual-discount');
@@ -661,7 +723,7 @@ function AmountSummary(_ref2) {
661
723
  style: {
662
724
  color: '#7F56DA'
663
725
  }
664
- }))), /*#__PURE__*/React.createElement("div", {
726
+ })))), Number(currentAmount) > 0 && /*#__PURE__*/React.createElement("div", {
665
727
  className: classNames('pay-section'),
666
728
  style: {
667
729
  cursor: 'pointer'
@@ -682,26 +744,71 @@ function AmountSummary(_ref2) {
682
744
  hideDecimalForWholeNumbers: false,
683
745
  useThousandsSeparator: true,
684
746
  showCurrencySymbol: true
685
- })))), !shouldShowConfirmMode() && /*#__PURE__*/React.createElement(PisellPriceKeyboardPopover, {
686
- value: function () {
687
- try {
688
- return new Decimal(currentAmount || '0').toNumber();
689
- } catch (_unused8) {
690
- return 0;
747
+ })))), !shouldShowConfirmMode() && /*#__PURE__*/React.createElement(Popover, {
748
+ content: /*#__PURE__*/React.createElement("div", {
749
+ onClick: function onClick(e) {
750
+ return e.stopPropagation();
691
751
  }
692
- }()
693
- // onChange={handleKeyboardConfirm}
694
- ,
695
- onConfirm: handleKeyboardConfirm
696
- // onCancel={handleKeyboardCancel}
697
- ,
698
- showCurrencySymbol: true,
699
- useThousandsSeparator: false,
700
- selectType: "dark",
701
- overlayClassName: "amount-summary-keyboard-popover"
752
+ }, /*#__PURE__*/React.createElement(PaymentKeyboard
753
+ // 原始值:此支付阶段的待支付金额,reset时还原为此值
754
+ , {
755
+ paymentOriginalValue: balanceDueAmount,
756
+ paymentDefaultValue: String(customAmount || 0),
757
+ enableExceedMaxAmount: false,
758
+ payment: {
759
+ enable: true
760
+ },
761
+ surcharge: {
762
+ enable: false
763
+ },
764
+ surchargeDefaultValue: {
765
+ percent: '0',
766
+ fixed: '0'
767
+ },
768
+ selectType: "light",
769
+ onChange: function onChange(value) {
770
+ console.log(value);
771
+ },
772
+ doneText: getText('confirm'),
773
+ onPay: function onPay(args) {
774
+ console.log(args);
775
+ // 处理支付逻辑
776
+ setIsKeyboardVisible(false);
777
+ handleKeyboardConfirm(args.amount);
778
+ }
779
+ })),
780
+ trigger: "click",
781
+ open: isKeyboardVisible,
782
+ onOpenChange: setIsKeyboardVisible,
783
+ placement: "bottom",
784
+ overlayClassName: "payment-keyboard-popover",
785
+ arrow: true,
786
+ destroyTooltipOnHide: true
702
787
  }, /*#__PURE__*/React.createElement(Button, {
703
788
  className: classNames('split-payment-button')
704
- }, getText('split.payment') || '拆分支付')), /*#__PURE__*/React.createElement(PisellModal, {
789
+ }, getText('split.payment') || '拆分支付'))
790
+ // <PisellPriceKeyboardPopover
791
+ // value={(() => {
792
+ // try {
793
+ // return new Decimal(currentAmount || '0').toNumber();
794
+ // } catch {
795
+ // return 0;
796
+ // }
797
+ // })()}
798
+ // // onChange={handleKeyboardConfirm}
799
+ // onConfirm={handleKeyboardConfirm}
800
+ // // onCancel={handleKeyboardCancel}
801
+ // showCurrencySymbol={true}
802
+ // useThousandsSeparator={false}
803
+ // selectType="dark"
804
+ // overlayClassName="amount-summary-keyboard-popover"
805
+ // >
806
+ // {/* 右侧: 拆分支付按钮 */}
807
+ // <Button className={classNames('split-payment-button')}>
808
+ // {getText('split.payment') || '拆分支付'}
809
+ // </Button>
810
+ // </PisellPriceKeyboardPopover>
811
+ , /*#__PURE__*/React.createElement(PisellModal, {
705
812
  open: isPaymentDetailOpen,
706
813
  onCancel: handlePaymentDetailClose,
707
814
  footer: null,
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import './index.less';
3
2
  import { CurrentOrderInfo } from '../../types';
3
+ import './index.less';
4
4
  export interface CashPaymentModuleProps {
5
5
  amountSymbol?: string;
6
6
  orderInfo?: CurrentOrderInfo;
@@ -13,8 +13,10 @@ export interface CashPaymentModuleProps {
13
13
  roundingDifference: number;
14
14
  }>;
15
15
  balanceDueAmount?: string;
16
+ syncingLock?: boolean;
16
17
  }
17
- export declare function CashPaymentModule({ amountSymbol, orderInfo, onPaymentComplete, customAmount, amountButtons, // 按钮列表
18
+ export declare function CashPaymentModule({ amountSymbol, orderInfo, onPaymentComplete, customAmount, amountButtons, // 按钮列表,默认5个推荐金额
18
19
  disabled, // 禁用状态
19
- roundingFunction, balanceDueAmount, }: CashPaymentModuleProps): JSX.Element;
20
+ roundingFunction, balanceDueAmount, // 剩余支付金额
21
+ syncingLock, }: CashPaymentModuleProps): JSX.Element;
20
22
  export default CashPaymentModule;