@pisell/private-materials 6.5.4 → 6.5.6

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 (249) 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 +160 -146
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +9 -9
  11. package/es/components/booking/addons/model.d.ts +1 -10
  12. package/es/components/booking/components/actionButtons/index.js +37 -42
  13. package/es/components/booking/components/actionButtons/index.less +0 -28
  14. package/es/components/booking/components/footer/amount.d.ts +3 -3
  15. package/es/components/booking/components/footer/amount.js +51 -31
  16. package/es/components/booking/components/footer/index.js +177 -68
  17. package/es/components/booking/components/footer/utils.js +62 -33
  18. package/es/components/booking/forms/model.d.ts +1 -10
  19. package/es/components/booking/info/model.d.ts +1 -10
  20. package/es/components/booking/info/model.js +5 -0
  21. package/es/components/booking/info/service/addService/index.js +2 -1
  22. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  23. package/es/components/booking/info/service2/utils.d.ts +1 -1
  24. package/es/components/booking/info2/index.js +42 -2
  25. package/es/components/booking/info2/service/addService/index.js +2 -1
  26. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  27. package/es/components/booking/info2/service/editService/index.js +12 -4
  28. package/es/components/booking/model.d.ts +1 -9
  29. package/es/components/booking/notes/model.d.ts +1 -10
  30. package/es/components/booking/payments/model.d.ts +1 -10
  31. package/es/components/booking/utils.js +10 -5
  32. package/es/components/checkout/PaymentModal.d.ts +2 -0
  33. package/es/components/checkout/PaymentModal.js +462 -263
  34. package/es/components/checkout/components/AdditionalModule/index.less +1 -1
  35. package/es/components/checkout/components/AmountSummary/index.js +176 -65
  36. package/es/components/checkout/components/AmountSummary/index.less +13 -0
  37. package/es/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
  38. package/es/components/checkout/components/CashPaymentModule/index.js +110 -132
  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 +214 -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 +23 -0
  46. package/es/components/checkout/components/PaymentResultToast/index.js +38 -8
  47. package/es/components/checkout/components/PaymentResultToast/types.d.ts +2 -0
  48. package/es/components/checkout/components/SavePayLaterHandler/index.js +1 -1
  49. package/es/components/checkout/components/SearchAndClientModule/index.js +40 -39
  50. package/es/components/checkout/components/WalletPassModule/index.js +4 -3
  51. package/es/components/checkout/components/WalletPassModule/utils.js +10 -4
  52. package/es/components/checkout/hooks/useWalletPass.js +11 -4
  53. package/es/components/checkout/index.less +1 -1
  54. package/es/components/checkout/locales.d.ts +36 -0
  55. package/es/components/checkout/locales.js +43 -4
  56. package/es/components/checkout/types.d.ts +1 -0
  57. package/es/components/eftposPay/amount.d.ts +1 -1
  58. package/es/components/eftposPay/device.d.ts +1 -1
  59. package/es/components/eftposPay/hooks.d.ts +1 -1
  60. package/es/components/eftposPay/store/index.d.ts +3 -3
  61. package/es/components/pay/toC/model.d.ts +1 -9
  62. package/es/components/schedules/model.d.ts +1 -9
  63. package/es/components/shoppingCart/components/Cart/Product.js +143 -71
  64. package/es/components/shoppingCart/components/Cart/index.js +1 -1
  65. package/es/components/shoppingCart/components/Cart/index.less +31 -0
  66. package/es/components/shoppingCart/locales.d.ts +3 -0
  67. package/es/components/shoppingCart/locales.js +12 -3
  68. package/es/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -1
  69. package/es/components/ticketBooking/components/addServiceVariant/addService.js +9 -12
  70. package/es/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -1
  71. package/es/components/ticketBooking/components/menuBar/index.js +3 -1
  72. package/es/components/ticketBooking/components/menuBar/index.less +7 -0
  73. package/es/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
  74. package/es/components/ticketBooking/hooks/pisellos/useCustomer.js +7 -7
  75. package/es/components/ticketBooking/index.d.ts +0 -1
  76. package/es/components/ticketBooking/utils/index.d.ts +1 -1
  77. package/es/components/ticketBooking/utils/index.js +2 -1
  78. package/es/components/wallet/Detail/model.d.ts +1 -13
  79. package/es/components/wallet/DiscountCard/model.d.ts +1 -14
  80. package/es/components/wallet/PointCard/model.d.ts +1 -13
  81. package/es/components/wallet/RechargeableCard/model.d.ts +1 -29
  82. package/es/components/wallet/Voucher/model.d.ts +1 -13
  83. package/es/components/wallet/model.d.ts +1 -9
  84. package/es/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +1 -1
  85. package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
  86. package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +148 -0
  87. package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
  88. package/es/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
  89. package/es/pro/pisellSimplePriceKeyboardPopover/index.js +1 -0
  90. package/es/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
  91. package/es/pro/pisellSimplePriceKeyboardPopover/types.js +1 -0
  92. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +5 -0
  93. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +331 -0
  94. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
  95. package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +349 -0
  96. package/es/pro/priceKeyboard/components/cashKeyboard/index.d.ts +12 -0
  97. package/es/pro/priceKeyboard/components/cashKeyboard/index.js +49 -0
  98. package/es/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
  99. package/es/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
  100. package/es/pro/priceKeyboard/components/cashKeyboard/locales.js +41 -0
  101. package/es/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
  102. package/es/pro/priceKeyboard/components/cashKeyboard/types.js +1 -0
  103. package/es/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
  104. package/es/pro/priceKeyboard/components/discountKeyboard/index.js +465 -0
  105. package/es/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
  106. package/es/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
  107. package/es/pro/priceKeyboard/components/discountKeyboard/locales.js +44 -0
  108. package/es/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
  109. package/es/pro/priceKeyboard/components/discountKeyboard/types.js +1 -0
  110. package/es/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +12 -0
  111. package/es/pro/priceKeyboard/components/paymentKeyboard/index.js +444 -0
  112. package/es/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
  113. package/es/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
  114. package/es/pro/priceKeyboard/components/paymentKeyboard/locales.js +47 -0
  115. package/es/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
  116. package/es/pro/priceKeyboard/components/paymentKeyboard/types.js +1 -0
  117. package/es/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
  118. package/es/pro/priceKeyboard/components/shortcuts/index.js +47 -0
  119. package/es/pro/priceKeyboard/components/shortcuts/index.less +39 -0
  120. package/es/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
  121. package/es/pro/priceKeyboard/hooks/keyActions.js +252 -0
  122. package/es/pro/priceKeyboard/hooks/rightItems.d.ts +28 -0
  123. package/es/pro/priceKeyboard/hooks/rightItems.js +50 -0
  124. package/es/pro/priceKeyboard/index.d.ts +3 -0
  125. package/es/pro/priceKeyboard/index.js +3 -0
  126. package/es/pro/priceKeyboard/index.less +215 -0
  127. package/es/pro/priceKeyboard/utils.d.ts +31 -0
  128. package/es/pro/priceKeyboard/utils.js +51 -0
  129. package/es/pro/skuDetailModal/index.js +19 -16
  130. package/lib/components/booking/addons/model.d.ts +1 -10
  131. package/lib/components/booking/components/actionButtons/index.js +31 -28
  132. package/lib/components/booking/components/actionButtons/index.less +0 -28
  133. package/lib/components/booking/components/footer/amount.d.ts +3 -3
  134. package/lib/components/booking/components/footer/amount.js +49 -34
  135. package/lib/components/booking/components/footer/index.js +114 -40
  136. package/lib/components/booking/components/footer/utils.js +35 -7
  137. package/lib/components/booking/forms/model.d.ts +1 -10
  138. package/lib/components/booking/info/model.d.ts +1 -10
  139. package/lib/components/booking/info/model.js +3 -0
  140. package/lib/components/booking/info/service/addService/index.js +2 -1
  141. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  142. package/lib/components/booking/info/service2/utils.d.ts +1 -1
  143. package/lib/components/booking/info2/index.js +18 -1
  144. package/lib/components/booking/info2/service/addService/index.js +2 -1
  145. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  146. package/lib/components/booking/info2/service/editService/index.js +12 -4
  147. package/lib/components/booking/model.d.ts +1 -9
  148. package/lib/components/booking/notes/model.d.ts +1 -10
  149. package/lib/components/booking/payments/model.d.ts +1 -10
  150. package/lib/components/booking/utils.js +10 -5
  151. package/lib/components/checkout/PaymentModal.d.ts +2 -0
  152. package/lib/components/checkout/PaymentModal.js +208 -91
  153. package/lib/components/checkout/components/AdditionalModule/index.less +1 -1
  154. package/lib/components/checkout/components/AmountSummary/index.js +120 -50
  155. package/lib/components/checkout/components/AmountSummary/index.less +13 -0
  156. package/lib/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
  157. package/lib/components/checkout/components/CashPaymentModule/index.js +101 -134
  158. package/lib/components/checkout/components/CashPaymentModule/index.less +200 -176
  159. package/lib/components/checkout/components/PaymentDetailModal/index.js +2 -2
  160. package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +29 -0
  161. package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +163 -0
  162. package/lib/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -4
  163. package/lib/components/checkout/components/PaymentOptionsModule/index.js +11 -123
  164. package/lib/components/checkout/components/PaymentOptionsModule/index.less +23 -0
  165. package/lib/components/checkout/components/PaymentResultToast/index.js +26 -1
  166. package/lib/components/checkout/components/PaymentResultToast/types.d.ts +2 -0
  167. package/lib/components/checkout/components/SavePayLaterHandler/index.js +1 -1
  168. package/lib/components/checkout/components/SearchAndClientModule/index.js +3 -29
  169. package/lib/components/checkout/components/WalletPassModule/index.js +4 -3
  170. package/lib/components/checkout/components/WalletPassModule/utils.js +8 -4
  171. package/lib/components/checkout/hooks/useWalletPass.js +11 -6
  172. package/lib/components/checkout/index.less +1 -1
  173. package/lib/components/checkout/locales.d.ts +36 -0
  174. package/lib/components/checkout/locales.js +43 -4
  175. package/lib/components/checkout/types.d.ts +1 -0
  176. package/lib/components/eftposPay/amount.d.ts +1 -1
  177. package/lib/components/eftposPay/device.d.ts +1 -1
  178. package/lib/components/eftposPay/hooks.d.ts +1 -1
  179. package/lib/components/eftposPay/store/index.d.ts +3 -3
  180. package/lib/components/pay/toC/model.d.ts +1 -9
  181. package/lib/components/schedules/model.d.ts +1 -9
  182. package/lib/components/shoppingCart/components/Cart/Product.js +111 -51
  183. package/lib/components/shoppingCart/components/Cart/index.js +1 -1
  184. package/lib/components/shoppingCart/components/Cart/index.less +31 -0
  185. package/lib/components/shoppingCart/locales.d.ts +3 -0
  186. package/lib/components/shoppingCart/locales.js +6 -3
  187. package/lib/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -1
  188. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +1 -4
  189. package/lib/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -1
  190. package/lib/components/ticketBooking/components/menuBar/index.js +1 -1
  191. package/lib/components/ticketBooking/components/menuBar/index.less +7 -0
  192. package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
  193. package/lib/components/ticketBooking/hooks/pisellos/useCustomer.js +7 -7
  194. package/lib/components/ticketBooking/index.d.ts +0 -1
  195. package/lib/components/ticketBooking/utils/index.d.ts +1 -1
  196. package/lib/components/ticketBooking/utils/index.js +2 -1
  197. package/lib/components/wallet/Detail/model.d.ts +1 -13
  198. package/lib/components/wallet/DiscountCard/model.d.ts +1 -14
  199. package/lib/components/wallet/PointCard/model.d.ts +1 -13
  200. package/lib/components/wallet/RechargeableCard/model.d.ts +1 -29
  201. package/lib/components/wallet/Voucher/model.d.ts +1 -13
  202. package/lib/components/wallet/model.d.ts +1 -9
  203. package/lib/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +2 -2
  204. package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
  205. package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +144 -0
  206. package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
  207. package/lib/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
  208. package/lib/pro/pisellSimplePriceKeyboardPopover/index.js +35 -0
  209. package/lib/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
  210. package/lib/pro/pisellSimplePriceKeyboardPopover/types.js +17 -0
  211. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +5 -0
  212. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +360 -0
  213. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
  214. package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +399 -0
  215. package/lib/pro/priceKeyboard/components/cashKeyboard/index.d.ts +12 -0
  216. package/lib/pro/priceKeyboard/components/cashKeyboard/index.js +76 -0
  217. package/lib/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
  218. package/lib/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
  219. package/lib/pro/priceKeyboard/components/cashKeyboard/locales.js +65 -0
  220. package/lib/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
  221. package/lib/pro/priceKeyboard/components/cashKeyboard/types.js +17 -0
  222. package/lib/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
  223. package/lib/pro/priceKeyboard/components/discountKeyboard/index.js +504 -0
  224. package/lib/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
  225. package/lib/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
  226. package/lib/pro/priceKeyboard/components/discountKeyboard/locales.js +68 -0
  227. package/lib/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
  228. package/lib/pro/priceKeyboard/components/discountKeyboard/types.js +17 -0
  229. package/lib/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +12 -0
  230. package/lib/pro/priceKeyboard/components/paymentKeyboard/index.js +488 -0
  231. package/lib/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
  232. package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
  233. package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.js +71 -0
  234. package/lib/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
  235. package/lib/pro/priceKeyboard/components/paymentKeyboard/types.js +17 -0
  236. package/lib/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
  237. package/lib/pro/priceKeyboard/components/shortcuts/index.js +79 -0
  238. package/lib/pro/priceKeyboard/components/shortcuts/index.less +39 -0
  239. package/lib/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
  240. package/lib/pro/priceKeyboard/hooks/keyActions.js +176 -0
  241. package/lib/pro/priceKeyboard/hooks/rightItems.d.ts +28 -0
  242. package/lib/pro/priceKeyboard/hooks/rightItems.js +81 -0
  243. package/lib/pro/priceKeyboard/index.d.ts +3 -0
  244. package/lib/pro/priceKeyboard/index.js +45 -0
  245. package/lib/pro/priceKeyboard/index.less +215 -0
  246. package/lib/pro/priceKeyboard/utils.d.ts +31 -0
  247. package/lib/pro/priceKeyboard/utils.js +75 -0
  248. package/lib/pro/skuDetailModal/index.js +18 -22
  249. package/package.json +12 -12
@@ -1,5 +1,5 @@
1
1
  .additional-module {
2
- padding-bottom: 16px; // 底部间距
2
+ padding-bottom: 2px; // 底部间距
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,36 +265,25 @@ 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
- var walletTotal = getWalletTotalAmount();
275
- var orderDue = getOrderDueAmount();
270
+ // const walletTotal = getWalletTotalAmount();
271
+ // const orderDue = getBalanceDueAmount();
276
272
 
277
273
  // 使用 Decimal.js 进行精确计算,避免浮点数精度问题
278
- var walletTotalDecimal = new Decimal(walletTotal);
279
- var orderDueDecimal = new Decimal(orderDue);
274
+ // const walletTotalDecimal = new Decimal(walletTotal);
275
+ var orderDueDecimal = new Decimal(Number(balanceDueAmount || 0));
280
276
  var minDecimal = new Decimal(0.01);
281
277
 
282
278
  // 计算 orderDue - walletTotal
283
- var diffDecimal = orderDueDecimal.minus(walletTotalDecimal);
279
+ // const diffDecimal = orderDueDecimal.minus(walletTotalDecimal);
284
280
 
285
281
  // 取最大值:max(0.01, orderDue - walletTotal)
286
- var maxAmountDecimal = Decimal.max(minDecimal, diffDecimal);
282
+ // const maxAmountDecimal = Decimal.max(minDecimal, diffDecimal);
283
+
287
284
  return {
288
285
  min: minDecimal.toNumber(),
289
- max: maxAmountDecimal.toNumber()
286
+ max: orderDueDecimal.toNumber()
290
287
  };
291
288
  };
292
289
 
@@ -314,12 +311,6 @@ function AmountSummary(_ref2) {
314
311
  Toast.fail(getText('pisell2.amount-summary.amount-cannot-be-zero', 'The amount cannot be 0'));
315
312
  return;
316
313
  }
317
-
318
- // 兜底策略:如果是空字符串、NaN或0,默认使用待支付金额
319
- if (!inputStr || numericValue <= 0) {
320
- numericValue = getOrderDueAmount();
321
- }
322
-
323
314
  // 确保输入值在允许范围内
324
315
  var minDecimal = new Decimal(limits.min);
325
316
  var maxDecimal = new Decimal(limits.max);
@@ -377,7 +368,7 @@ function AmountSummary(_ref2) {
377
368
 
378
369
  // 计算含有 voucher_id 的付款项金额合计
379
370
  var voucherPaymentAmount = (paymentItems === null || paymentItems === void 0 || (_paymentItems$reduce2 = paymentItems.reduce(function (acc, item) {
380
- if (item.voucher_id) {
371
+ if (item.voucher_id && !item.isSynced) {
381
372
  try {
382
373
  var _amount = new Decimal(item.amount || '0');
383
374
  var roundingAmount = new Decimal(item.rounding_amount || '0');
@@ -390,6 +381,13 @@ function AmountSummary(_ref2) {
390
381
  }, new Decimal(0))) === null || _paymentItems$reduce2 === void 0 ? void 0 : _paymentItems$reduce2.toNumber()) || 0;
391
382
  var totalPaidAmount = partialPaidAmountDecimal.plus(voucherPaymentAmount).toNumber();
392
383
 
384
+ // 如果已经有除了voucher 以外的其他支付项 isSynced的,并且还没超过订单总金额,则需要显示
385
+ var syncedPaymentItems = (paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.filter(function (item) {
386
+ return item.isSynced && !item.voucher_id;
387
+ })) || [];
388
+ if ((syncedPaymentItems === null || syncedPaymentItems === void 0 ? void 0 : syncedPaymentItems.length) > 0 && totalPaidAmount < totalAmount) {
389
+ return true;
390
+ }
393
391
  // 如果 (部分付款金额 + 含有voucher_id的付款项金额合计) >= 总金额,则不显示
394
392
  if (totalPaidAmount >= totalAmount) {
395
393
  return false;
@@ -449,9 +447,13 @@ function AmountSummary(_ref2) {
449
447
  var _walletPassData$selec, _walletPassData$selec2;
450
448
  // 检查是否有支付项
451
449
  // if (!paymentItems || paymentItems.length === 0) return false;
450
+ // 先去除掉已经同步的支付项
451
+ var unSyncedPaymentItems = paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.filter(function (item) {
452
+ return !item.isSynced;
453
+ });
452
454
 
453
455
  // 检查所有支付项是否都含有voucher_id
454
- var allItemsHaveVoucherId = paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.every(function (item) {
456
+ var allItemsHaveVoucherId = unSyncedPaymentItems === null || unSyncedPaymentItems === void 0 ? void 0 : unSyncedPaymentItems.every(function (item) {
455
457
  return item.voucher_id;
456
458
  });
457
459
  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 +542,7 @@ function AmountSummary(_ref2) {
540
542
  className: classNames('partial-paid-card')
541
543
  }, /*#__PURE__*/React.createElement("span", {
542
544
  className: classNames('partial-paid-label')
543
- }, getText('partial.paid') || 'Partial Paid'), /*#__PURE__*/React.createElement("span", {
545
+ }, paymentType === 'deposit' ? getText('deposit.partial.paid') || 'Deposit Paid' : getText('partial.paid') || 'Partial Paid'), /*#__PURE__*/React.createElement("span", {
544
546
  className: classNames('partial-paid-amount')
545
547
  }, formatAmountWithOptions(partialPaidAmount, amountSymbol, {
546
548
  precision: 2,
@@ -595,11 +597,47 @@ function AmountSummary(_ref2) {
595
597
  })));
596
598
  }
597
599
  };
600
+ var canSwitch = useMemo(function () {
601
+ if (Number(orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.totalAmount) === 0) {
602
+ return false;
603
+ }
604
+ // 如果当前是普通支付,并且支付项里已经有了type=default 的数据,则不可以再切换到定金支付
605
+ // 增加一个逻辑,如果当前是普通支付,并且支付项里有定金支付的钱,并且定金支付的钱已经超过了定金总金额,就不可以再切换了
606
+ if (paymentType === 'regular') {
607
+ var depositPaidAmount = paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.reduce(function (acc, item) {
608
+ if (item.order_payment_type === 'deposit') {
609
+ return acc.plus(item.amount).plus(Math.abs(item.rounding_amount));
610
+ }
611
+ return acc;
612
+ }, new Decimal(0)).toNumber();
613
+ 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;
614
+ return !(paymentItems !== null && paymentItems !== void 0 && paymentItems.some(function (item) {
615
+ return item.order_payment_type === 'normal';
616
+ })) && !depositFlag;
617
+ } else {
618
+ // 如果是定金支付,且定金已付款金额大于等于订单总金额,则不可以再切换到普通支付
619
+ var _depositPaidAmount = paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.reduce(function (acc, item) {
620
+ if (item.order_payment_type === 'deposit') {
621
+ return acc.plus(item.amount);
622
+ }
623
+ return acc;
624
+ }, new Decimal(0)).toNumber();
625
+ return _depositPaidAmount < new Decimal(totalAmount).toNumber();
626
+ }
627
+ }, [paymentItems, paymentType, totalAmount]);
628
+ var showCancelSplitPayment = useMemo(function () {
629
+ // 如果 balanceDueAmount 和 balanceDueAmount 不一样,则展示取消拆分支付按钮
630
+ return balanceDueAmount !== customAmount;
631
+ }, [customAmount, balanceDueAmount]);
632
+ var handleChangeDepositAmount = function handleChangeDepositAmount(value) {
633
+ console.log('handleChangeDepositAmount', value);
634
+ checkoutModule === null || checkoutModule === void 0 || checkoutModule.setDepositAmountAsync(value);
635
+ };
598
636
  return /*#__PURE__*/React.createElement("div", {
599
637
  className: classNames('amount-summary-module', 'amount-summary-container')
600
638
  }, /*#__PURE__*/React.createElement("div", {
601
639
  className: classNames('left-section')
602
- }, open_deposit ? /*#__PURE__*/React.createElement(Dropdown, {
640
+ }, open_deposit && canSwitch ? /*#__PURE__*/React.createElement(Dropdown, {
603
641
  menu: {
604
642
  items: paymentOptions,
605
643
  onClick: function onClick(_ref5) {
@@ -644,9 +682,32 @@ function AmountSummary(_ref2) {
644
682
  // 如果应该显示确认模式,直接返回确认界面
645
683
  shouldShowConfirmMode() ? renderConfirmMode() : /*#__PURE__*/React.createElement("div", {
646
684
  className: classNames('balance-due-info')
647
- }, /*#__PURE__*/React.createElement("div", {
685
+ }, paymentType === 'deposit' ? /*#__PURE__*/React.createElement(PisellPriceKeyboardPopover, {
686
+ value: balanceDueAmount || '0'
687
+ // onChange={handleKeyboardChange}
688
+ ,
689
+ onConfirm: handleChangeDepositAmount,
690
+ showCurrencySymbol: true,
691
+ useThousandsSeparator: true,
692
+ selectType: "dark",
693
+ overlayClassName: "cash-payment-keyboard-popover"
694
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
695
+ className: classNames('balance-due-label')
696
+ }, getText('deposit.due') || 'Deposit Due'), /*#__PURE__*/React.createElement("div", {
697
+ className: classNames('balance-due-amount')
698
+ }, formatAmountWithOptions(balanceDueAmount, amountSymbol, {
699
+ precision: 2,
700
+ hideDecimalForWholeNumbers: false,
701
+ useThousandsSeparator: true,
702
+ showCurrencySymbol: true
703
+ }), /*#__PURE__*/React.createElement(Edit05, {
704
+ className: classNames('edit-icon'),
705
+ style: {
706
+ color: '#7F56DA'
707
+ }
708
+ })))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
648
709
  className: classNames('balance-due-label')
649
- }, paymentType === 'deposit' ? getText('deposit.due') || 'Deposit Due' : getText('balance.due') || 'Balance Due'), /*#__PURE__*/React.createElement("div", {
710
+ }, getText('balance.due') || 'Balance Due'), /*#__PURE__*/React.createElement("div", {
650
711
  className: classNames('balance-due-amount'),
651
712
  onClick: function onClick() {
652
713
  onBalanceDueAmountClick === null || onBalanceDueAmountClick === void 0 || onBalanceDueAmountClick('manual-discount');
@@ -661,7 +722,7 @@ function AmountSummary(_ref2) {
661
722
  style: {
662
723
  color: '#7F56DA'
663
724
  }
664
- }))), /*#__PURE__*/React.createElement("div", {
725
+ })))), Number(currentAmount) > 0 && /*#__PURE__*/React.createElement("div", {
665
726
  className: classNames('pay-section'),
666
727
  style: {
667
728
  cursor: 'pointer'
@@ -682,26 +743,76 @@ function AmountSummary(_ref2) {
682
743
  hideDecimalForWholeNumbers: false,
683
744
  useThousandsSeparator: true,
684
745
  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;
746
+ })))), !shouldShowConfirmMode() && (showCancelSplitPayment ? /*#__PURE__*/React.createElement(Button, {
747
+ className: classNames('cancel-split-payment-button'),
748
+ onClick: function onClick() {
749
+ return onAmountChange === null || onAmountChange === void 0 ? void 0 : onAmountChange(balanceDueAmount);
750
+ }
751
+ }, getText('split.cancel') || '取消部\n分支付') : /*#__PURE__*/React.createElement(Popover, {
752
+ content: /*#__PURE__*/React.createElement("div", {
753
+ onClick: function onClick(e) {
754
+ return e.stopPropagation();
691
755
  }
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"
756
+ }, /*#__PURE__*/React.createElement(PaymentKeyboard
757
+ // 原始值:此支付阶段的待支付金额,reset时还原为此值
758
+ , {
759
+ paymentOriginalValue: balanceDueAmount,
760
+ paymentDefaultValue: String(customAmount || 0),
761
+ enableExceedMaxAmount: false,
762
+ payment: {
763
+ enable: true
764
+ },
765
+ surcharge: {
766
+ enable: false
767
+ },
768
+ surchargeDefaultValue: {
769
+ percent: '0',
770
+ fixed: '0'
771
+ },
772
+ selectType: "light",
773
+ onChange: function onChange(value) {
774
+ console.log(value);
775
+ },
776
+ doneText: getText('confirm'),
777
+ onPay: function onPay(args) {
778
+ console.log(args);
779
+ // 处理支付逻辑
780
+ setIsKeyboardVisible(false);
781
+ handleKeyboardConfirm(args.amount);
782
+ }
783
+ })),
784
+ trigger: "click",
785
+ open: isKeyboardVisible,
786
+ onOpenChange: setIsKeyboardVisible,
787
+ placement: "bottom",
788
+ overlayClassName: "payment-keyboard-popover",
789
+ arrow: true,
790
+ destroyTooltipOnHide: true
702
791
  }, /*#__PURE__*/React.createElement(Button, {
703
792
  className: classNames('split-payment-button')
704
- }, getText('split.payment') || '拆分支付')), /*#__PURE__*/React.createElement(PisellModal, {
793
+ }, getText('split.payment') || '拆分支付')))
794
+ // <PisellPriceKeyboardPopover
795
+ // value={(() => {
796
+ // try {
797
+ // return new Decimal(currentAmount || '0').toNumber();
798
+ // } catch {
799
+ // return 0;
800
+ // }
801
+ // })()}
802
+ // // onChange={handleKeyboardConfirm}
803
+ // onConfirm={handleKeyboardConfirm}
804
+ // // onCancel={handleKeyboardCancel}
805
+ // showCurrencySymbol={true}
806
+ // useThousandsSeparator={false}
807
+ // selectType="dark"
808
+ // overlayClassName="amount-summary-keyboard-popover"
809
+ // >
810
+ // {/* 右侧: 拆分支付按钮 */}
811
+ // <Button className={classNames('split-payment-button')}>
812
+ // {getText('split.payment') || '拆分支付'}
813
+ // </Button>
814
+ // </PisellPriceKeyboardPopover>
815
+ , /*#__PURE__*/React.createElement(PisellModal, {
705
816
  open: isPaymentDetailOpen,
706
817
  onCancel: handlePaymentDetailClose,
707
818
  footer: null,
@@ -476,6 +476,7 @@
476
476
  }
477
477
 
478
478
  .split-payment-button {
479
+ width: 80px;
479
480
  padding: 0 8px;
480
481
  background: #079455;
481
482
  color: white;
@@ -485,4 +486,16 @@
485
486
  white-space: pre-line; // 让换行符(\n)生效
486
487
  text-align: left; // 确保文本居中对齐
487
488
  min-width: 68px;
489
+ }
490
+ .cancel-split-payment-button {
491
+ width: 80px;
492
+ padding: 0 8px;
493
+ background: #DF5342;
494
+ color: white;
495
+ font-size: 14px;
496
+ border: 1px solid #C3B2E7;
497
+ height: 80px;
498
+ white-space: pre-line; // 让换行符(\n)生效
499
+ text-align: left; // 确保文本居中对齐
500
+ min-width: 68px;
488
501
  }
@@ -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;