@pisell/private-materials 3.3.89 → 3.3.91

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 (263) 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 +13 -13
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +11 -11
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +11 -11
  11. package/es/businessModel/SalesModel/Sales/index.js +4 -37
  12. package/es/components/Sales/Cart/index.js +1 -5
  13. package/es/components/Sales/Cart/utils.d.ts +0 -40
  14. package/es/components/Sales/Cart/utils.js +0 -167
  15. package/es/components/Sales/Checkout/index.d.ts +0 -4
  16. package/es/components/Sales/Checkout/index.js +8 -52
  17. package/es/components/Sales/Checkout/serve.d.ts +0 -13
  18. package/es/components/Sales/Checkout/serve.js +2 -16
  19. package/es/components/Sales/Checkout/utils.js +1 -7
  20. package/es/components/Sales/Resource/index.js +2 -2
  21. package/es/components/Sales/Resource/serve.d.ts +0 -7
  22. package/es/components/Sales/Resource/serve.js +0 -10
  23. package/es/components/Sales/Summary/index.d.ts +0 -10
  24. package/es/components/Sales/Summary/index.js +2 -17
  25. package/es/components/Sales/Summary/serve.d.ts +0 -1
  26. package/es/components/Sales/Summary/serve.js +0 -6
  27. package/es/components/Sales/Summary/utils.d.ts +1 -16
  28. package/es/components/Sales/Summary/utils.js +1 -43
  29. package/es/components/appointmentBooking/components/Cart/Item/index.less +3 -3
  30. package/es/components/appointmentBooking/components/Content/index.less +1 -1
  31. package/es/components/appointmentBooking/components/Deposit/index.d.ts +0 -6
  32. package/es/components/appointmentBooking/components/Deposit/index.js +7 -27
  33. package/es/components/appointmentBooking/components/Services/index.js +27 -23
  34. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.js +20 -25
  35. package/es/components/appointmentBooking/deposit/index.js +2 -4
  36. package/es/components/appointmentBooking/index.js +0 -14
  37. package/es/components/appointmentBooking/index.less +1 -1
  38. package/es/components/booking/components/footer/utils.d.ts +0 -1
  39. package/es/components/booking/components/footer/utils.js +1 -1
  40. package/es/components/booking/components/voucher/index.js +2 -2
  41. package/es/components/booking/info/service2/utils.d.ts +1 -1
  42. package/es/components/booking/info/service2/utils.js +2 -3
  43. package/es/components/booking/info2/service/addService/utils.d.ts +0 -10
  44. package/es/components/booking/info2/service/addService/utils.js +13 -44
  45. package/es/components/booking/info2/service/editService/Resources/index.js +8 -22
  46. package/es/components/booking/info2/service/editService/Resources/index.less +0 -6
  47. package/es/components/booking/info2/utilsByBooking.js +0 -9
  48. package/es/components/booking/locales.d.ts +0 -3
  49. package/es/components/booking/locales.js +0 -3
  50. package/es/components/eftposPay/amount.d.ts +1 -1
  51. package/es/components/eftposPay/const.d.ts +1 -4
  52. package/es/components/eftposPay/const.js +1 -3
  53. package/es/components/eftposPay/device.d.ts +1 -1
  54. package/es/components/eftposPay/hooks.d.ts +2 -2
  55. package/es/components/eftposPay/hooks.js +1 -3
  56. package/es/components/eftposPay/index.js +1 -1
  57. package/es/components/eftposPay/manufacturer.d.ts +0 -1
  58. package/es/components/eftposPay/manufacturer.js +0 -4
  59. package/es/components/eftposPay/pay.d.ts +1 -1
  60. package/es/components/eftposPay/pay.js +2 -6
  61. package/es/components/eftposPay/store/index.d.ts +4 -4
  62. package/es/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +17 -29
  63. package/es/components/eventBooking/components/Provider/Cart/Item/Total.js +6 -10
  64. package/es/components/eventBooking/components/Provider/Cart/Item/index.js +2 -4
  65. package/es/components/eventBooking/components/Provider/Event/index.js +4 -13
  66. package/es/components/eventBooking/components/bookingDetailModal/index.js +4 -22
  67. package/es/components/eventBooking/index.js +7 -21
  68. package/es/components/eventBooking/locales.d.ts +0 -24
  69. package/es/components/eventBooking/locales.js +6 -30
  70. package/es/components/index.d.ts +1 -3
  71. package/es/components/index.js +1 -3
  72. package/es/components/pay/toC/PaymentMethods/index.js +4 -5
  73. package/es/components/schedules/utils.d.ts +1 -1
  74. package/es/components/ticketBooking/components/addServiceVariant/addService.js +1 -1
  75. package/es/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
  76. package/es/components/ticketBooking/components/ticketBooking/index.js +138 -257
  77. package/es/components/ticketBooking/locales.d.ts +146 -164
  78. package/es/components/ticketBooking/locales.js +147 -195
  79. package/es/index.d.ts +0 -2
  80. package/es/index.js +1 -3
  81. package/es/utils/index.d.ts +1 -1
  82. package/lib/businessModel/SalesModel/Sales/index.js +8 -22
  83. package/lib/components/Sales/Cart/index.js +0 -1
  84. package/lib/components/Sales/Cart/utils.d.ts +0 -40
  85. package/lib/components/Sales/Cart/utils.js +0 -117
  86. package/lib/components/Sales/Checkout/index.d.ts +0 -4
  87. package/lib/components/Sales/Checkout/index.js +7 -39
  88. package/lib/components/Sales/Checkout/serve.d.ts +0 -13
  89. package/lib/components/Sales/Checkout/serve.js +2 -7
  90. package/lib/components/Sales/Checkout/utils.js +0 -2
  91. package/lib/components/Sales/Resource/index.js +1 -1
  92. package/lib/components/Sales/Resource/serve.d.ts +0 -7
  93. package/lib/components/Sales/Resource/serve.js +2 -9
  94. package/lib/components/Sales/Summary/index.d.ts +0 -10
  95. package/lib/components/Sales/Summary/index.js +1 -7
  96. package/lib/components/Sales/Summary/serve.d.ts +0 -1
  97. package/lib/components/Sales/Summary/serve.js +0 -32
  98. package/lib/components/Sales/Summary/utils.d.ts +1 -16
  99. package/lib/components/Sales/Summary/utils.js +1 -30
  100. package/lib/components/appointmentBooking/components/Cart/Item/index.less +3 -3
  101. package/lib/components/appointmentBooking/components/Content/index.less +1 -1
  102. package/lib/components/appointmentBooking/components/Deposit/index.d.ts +0 -6
  103. package/lib/components/appointmentBooking/components/Deposit/index.js +4 -36
  104. package/lib/components/appointmentBooking/components/Services/index.js +11 -6
  105. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.js +4 -8
  106. package/lib/components/appointmentBooking/deposit/index.js +2 -4
  107. package/lib/components/appointmentBooking/index.js +0 -11
  108. package/lib/components/appointmentBooking/index.less +1 -1
  109. package/lib/components/booking/components/footer/utils.d.ts +0 -1
  110. package/lib/components/booking/components/footer/utils.js +0 -2
  111. package/lib/components/booking/components/voucher/index.js +2 -2
  112. package/lib/components/booking/info/service2/utils.d.ts +1 -1
  113. package/lib/components/booking/info/service2/utils.js +2 -2
  114. package/lib/components/booking/info2/service/addService/utils.d.ts +0 -10
  115. package/lib/components/booking/info2/service/addService/utils.js +4 -27
  116. package/lib/components/booking/info2/service/editService/Resources/index.js +10 -54
  117. package/lib/components/booking/info2/service/editService/Resources/index.less +0 -6
  118. package/lib/components/booking/info2/utilsByBooking.js +0 -6
  119. package/lib/components/booking/locales.d.ts +0 -3
  120. package/lib/components/booking/locales.js +0 -3
  121. package/lib/components/eftposPay/amount.d.ts +1 -1
  122. package/lib/components/eftposPay/const.d.ts +1 -4
  123. package/lib/components/eftposPay/const.js +0 -2
  124. package/lib/components/eftposPay/device.d.ts +1 -1
  125. package/lib/components/eftposPay/hooks.d.ts +2 -2
  126. package/lib/components/eftposPay/hooks.js +4 -11
  127. package/lib/components/eftposPay/index.js +1 -1
  128. package/lib/components/eftposPay/manufacturer.d.ts +0 -1
  129. package/lib/components/eftposPay/manufacturer.js +0 -6
  130. package/lib/components/eftposPay/pay.d.ts +1 -1
  131. package/lib/components/eftposPay/pay.js +2 -13
  132. package/lib/components/eftposPay/store/index.d.ts +4 -4
  133. package/lib/components/eventBooking/components/Provider/Cart/ContinueButton/index.js +3 -16
  134. package/lib/components/eventBooking/components/Provider/Cart/Item/Total.js +5 -8
  135. package/lib/components/eventBooking/components/Provider/Cart/Item/index.js +2 -4
  136. package/lib/components/eventBooking/components/Provider/Event/index.js +3 -10
  137. package/lib/components/eventBooking/components/bookingDetailModal/index.js +4 -10
  138. package/lib/components/eventBooking/index.js +7 -11
  139. package/lib/components/eventBooking/locales.d.ts +0 -24
  140. package/lib/components/eventBooking/locales.js +6 -30
  141. package/lib/components/index.d.ts +1 -3
  142. package/lib/components/index.js +0 -6
  143. package/lib/components/pay/toC/PaymentMethods/index.js +9 -10
  144. package/lib/components/schedules/utils.d.ts +1 -1
  145. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +1 -1
  146. package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
  147. package/lib/components/ticketBooking/components/ticketBooking/index.js +139 -263
  148. package/lib/components/ticketBooking/locales.d.ts +146 -164
  149. package/lib/components/ticketBooking/locales.js +4 -22
  150. package/lib/index.d.ts +0 -2
  151. package/lib/index.js +0 -6
  152. package/lib/utils/index.d.ts +1 -1
  153. package/package.json +3 -3
  154. package/es/components/booking/editBookingModal/index.d.ts +0 -5
  155. package/es/components/booking/editBookingModal/index.js +0 -386
  156. package/es/components/booking/editBookingModal/index.less +0 -8
  157. package/es/components/booking/editBookingModal/locales.d.ts +0 -21
  158. package/es/components/booking/editBookingModal/locales.js +0 -20
  159. package/es/components/booking/editBookingModal/mock.d.ts +0 -807
  160. package/es/components/booking/editBookingModal/mock.js +0 -2993
  161. package/es/components/booking/editBookingModal/serve.d.ts +0 -51
  162. package/es/components/booking/editBookingModal/serve.js +0 -288
  163. package/es/components/booking/editBookingModal/type.d.ts +0 -12
  164. package/es/components/booking/editBookingModal/type.js +0 -1
  165. package/es/components/booking/editBookingModal/utils.d.ts +0 -12
  166. package/es/components/booking/editBookingModal/utils.js +0 -157
  167. package/es/components/booking/info2/service/editService/ResourcesV2/MaxLengthSelect/index.d.ts +0 -7
  168. package/es/components/booking/info2/service/editService/ResourcesV2/MaxLengthSelect/index.js +0 -26
  169. package/es/components/booking/info2/service/editService/ResourcesV2/index.d.ts +0 -10
  170. package/es/components/booking/info2/service/editService/ResourcesV2/index.js +0 -308
  171. package/es/components/booking/info2/service/editService/ResourcesV2/index.less +0 -44
  172. package/es/components/eftposPay/linkly/const.d.ts +0 -23
  173. package/es/components/eftposPay/linkly/const.js +0 -82
  174. package/es/components/eftposPay/linkly/hooks/index.d.ts +0 -2
  175. package/es/components/eftposPay/linkly/hooks/index.js +0 -2
  176. package/es/components/eftposPay/linkly/hooks/normal.d.ts +0 -30
  177. package/es/components/eftposPay/linkly/hooks/normal.js +0 -318
  178. package/es/components/eftposPay/linkly/hooks/useTimeQuery.d.ts +0 -4
  179. package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +0 -273
  180. package/es/components/eftposPay/linkly/index.d.ts +0 -2
  181. package/es/components/eftposPay/linkly/index.js +0 -197
  182. package/es/components/eftposPay/linkly/service.d.ts +0 -32
  183. package/es/components/eftposPay/linkly/service.js +0 -73
  184. package/es/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +0 -2
  185. package/es/components/eventBooking/components/Provider/Cart/Deposit/index.js +0 -17
  186. package/es/components/stepController/components/Content/index.d.ts +0 -7
  187. package/es/components/stepController/components/Content/index.js +0 -9
  188. package/es/components/stepController/components/Content/index.less +0 -8
  189. package/es/components/stepController/components/Footer/index.d.ts +0 -8
  190. package/es/components/stepController/components/Footer/index.js +0 -15
  191. package/es/components/stepController/components/Footer/index.less +0 -39
  192. package/es/components/stepController/components/Header/index.d.ts +0 -20
  193. package/es/components/stepController/components/Header/index.js +0 -97
  194. package/es/components/stepController/components/Header/index.less +0 -21
  195. package/es/components/stepController/index.d.ts +0 -5
  196. package/es/components/stepController/index.js +0 -64
  197. package/es/components/stepController/index.less +0 -11
  198. package/es/components/stepController/locales.d.ts +0 -27
  199. package/es/components/stepController/locales.js +0 -32
  200. package/es/components/stepController/types.d.ts +0 -23
  201. package/es/components/stepController/types.js +0 -1
  202. package/es/components/ticketBooking/utils/formatProductMessage.d.ts +0 -2
  203. package/es/components/ticketBooking/utils/formatProductMessage.js +0 -62
  204. package/es/components/ticketBooking/utils/formatTime.d.ts +0 -31
  205. package/es/components/ticketBooking/utils/formatTime.js +0 -144
  206. package/es/hooks/useWindowSize.d.ts +0 -5
  207. package/es/hooks/useWindowSize.js +0 -26
  208. package/lib/components/booking/editBookingModal/index.d.ts +0 -5
  209. package/lib/components/booking/editBookingModal/index.js +0 -363
  210. package/lib/components/booking/editBookingModal/index.less +0 -8
  211. package/lib/components/booking/editBookingModal/locales.d.ts +0 -21
  212. package/lib/components/booking/editBookingModal/locales.js +0 -44
  213. package/lib/components/booking/editBookingModal/mock.d.ts +0 -807
  214. package/lib/components/booking/editBookingModal/mock.js +0 -3314
  215. package/lib/components/booking/editBookingModal/serve.d.ts +0 -51
  216. package/lib/components/booking/editBookingModal/serve.js +0 -178
  217. package/lib/components/booking/editBookingModal/type.d.ts +0 -12
  218. package/lib/components/booking/editBookingModal/type.js +0 -17
  219. package/lib/components/booking/editBookingModal/utils.d.ts +0 -12
  220. package/lib/components/booking/editBookingModal/utils.js +0 -158
  221. package/lib/components/booking/info2/service/editService/ResourcesV2/MaxLengthSelect/index.d.ts +0 -7
  222. package/lib/components/booking/info2/service/editService/ResourcesV2/MaxLengthSelect/index.js +0 -53
  223. package/lib/components/booking/info2/service/editService/ResourcesV2/index.d.ts +0 -10
  224. package/lib/components/booking/info2/service/editService/ResourcesV2/index.js +0 -311
  225. package/lib/components/booking/info2/service/editService/ResourcesV2/index.less +0 -44
  226. package/lib/components/eftposPay/linkly/const.d.ts +0 -23
  227. package/lib/components/eftposPay/linkly/const.js +0 -102
  228. package/lib/components/eftposPay/linkly/hooks/index.d.ts +0 -2
  229. package/lib/components/eftposPay/linkly/hooks/index.js +0 -25
  230. package/lib/components/eftposPay/linkly/hooks/normal.d.ts +0 -30
  231. package/lib/components/eftposPay/linkly/hooks/normal.js +0 -239
  232. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.d.ts +0 -4
  233. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +0 -222
  234. package/lib/components/eftposPay/linkly/index.d.ts +0 -2
  235. package/lib/components/eftposPay/linkly/index.js +0 -208
  236. package/lib/components/eftposPay/linkly/service.d.ts +0 -32
  237. package/lib/components/eftposPay/linkly/service.js +0 -55
  238. package/lib/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +0 -2
  239. package/lib/components/eventBooking/components/Provider/Cart/Deposit/index.js +0 -55
  240. package/lib/components/stepController/components/Content/index.d.ts +0 -7
  241. package/lib/components/stepController/components/Content/index.js +0 -40
  242. package/lib/components/stepController/components/Content/index.less +0 -8
  243. package/lib/components/stepController/components/Footer/index.d.ts +0 -8
  244. package/lib/components/stepController/components/Footer/index.js +0 -49
  245. package/lib/components/stepController/components/Footer/index.less +0 -39
  246. package/lib/components/stepController/components/Header/index.d.ts +0 -20
  247. package/lib/components/stepController/components/Header/index.js +0 -104
  248. package/lib/components/stepController/components/Header/index.less +0 -21
  249. package/lib/components/stepController/index.d.ts +0 -5
  250. package/lib/components/stepController/index.js +0 -89
  251. package/lib/components/stepController/index.less +0 -11
  252. package/lib/components/stepController/locales.d.ts +0 -27
  253. package/lib/components/stepController/locales.js +0 -50
  254. package/lib/components/stepController/types.d.ts +0 -23
  255. package/lib/components/stepController/types.js +0 -17
  256. package/lib/components/ticketBooking/utils/formatProductMessage.d.ts +0 -2
  257. package/lib/components/ticketBooking/utils/formatProductMessage.js +0 -84
  258. package/lib/components/ticketBooking/utils/formatTime.d.ts +0 -31
  259. package/lib/components/ticketBooking/utils/formatTime.js +0 -139
  260. package/lib/hooks/useWindowSize.d.ts +0 -5
  261. package/lib/hooks/useWindowSize.js +0 -51
  262. package/lowcode/edit-booking-modal/meta.ts +0 -53
  263. package/lowcode/step-controller/meta.ts +0 -88
@@ -11,7 +11,6 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
11
11
  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; } }
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import React, { createContext, useRef, useState } from 'react';
14
- import useEngineContext from "../../../hooks/useEngineContext";
15
14
  var defaultData = {};
16
15
  var SALES_MODEL_SESSION_STORAGE_KEY = 'shop_h5_sales_model_data';
17
16
  export var SalesContext = /*#__PURE__*/createContext({});
@@ -27,55 +26,23 @@ export var SalesProvider = function SalesProvider(props) {
27
26
  _useState4 = _slicedToArray(_useState3, 2),
28
27
  hooks = _useState4[0],
29
28
  setHooks = _useState4[1];
30
- var context = useEngineContext();
31
- var utils = context.appHelper.utils || {};
32
29
  var _setData = function _setData(newData) {
33
30
  dataRef.current = _objectSpread(_objectSpread({}, dataRef.current), newData);
34
31
  console.log('sales_model_newData', dataRef.current);
35
32
  if (config !== null && config !== void 0 && config.useSessionStorage) {
36
- setSessionStorage();
33
+ sessionStorage.setItem(SALES_MODEL_SESSION_STORAGE_KEY, JSON.stringify(dataRef.current || {}));
37
34
  }
38
35
  setData(_objectSpread({}, dataRef.current));
39
36
  };
40
37
  var getCurrentData = function getCurrentData() {
41
38
  return dataRef.current;
42
39
  };
43
-
44
- /**
45
- * @title 设置sessionStorage
46
- * @description 获取路由参数中的cacheId,并设置到sessionStorage中
47
- */
48
40
  var setSessionStorage = function setSessionStorage() {
49
- var _utils$getHistory, _history$location;
50
- var history = (utils === null || utils === void 0 || (_utils$getHistory = utils.getHistory) === null || _utils$getHistory === void 0 ? void 0 : _utils$getHistory.call(utils)) || {};
51
- var cacheId = (history === null || history === void 0 || (_history$location = history.location) === null || _history$location === void 0 || (_history$location = _history$location.query) === null || _history$location === void 0 ? void 0 : _history$location.cacheId) || '';
52
- var sessionData = _objectSpread(_objectSpread({}, dataRef.current || {}), {}, {
53
- cacheId: cacheId
54
- });
55
- sessionStorage.setItem("".concat(SALES_MODEL_SESSION_STORAGE_KEY), JSON.stringify(sessionData || {}));
41
+ sessionStorage.setItem(SALES_MODEL_SESSION_STORAGE_KEY, JSON.stringify(dataRef.current || {}));
56
42
  };
57
-
58
- /**
59
- * @title 获取sessionStorage
60
- * @description 获取路由参数中的cacheId并与sessionStorage中的cacheId进行匹配,如果匹配成功,则返回sessionStorage中的数据
61
- */
62
43
  var getSessionStorage = function getSessionStorage() {
63
- var _utils$getHistory2, _history$location2;
64
- var history = (utils === null || utils === void 0 || (_utils$getHistory2 = utils.getHistory) === null || _utils$getHistory2 === void 0 ? void 0 : _utils$getHistory2.call(utils)) || {};
65
- var strResult = sessionStorage.getItem(SALES_MODEL_SESSION_STORAGE_KEY);
66
- var result = strResult ? JSON.parse(strResult || '{}') : {};
67
- var cacheId = (history === null || history === void 0 || (_history$location2 = history.location) === null || _history$location2 === void 0 || (_history$location2 = _history$location2.query) === null || _history$location2 === void 0 ? void 0 : _history$location2.cacheId) || '';
68
-
69
- // cacheId 为空,且sessionStorage中cacheId也为空,则返回sessionStorage中的数据
70
- if (!cacheId && !(result !== null && result !== void 0 && result.cacheId)) {
71
- return result;
72
- }
73
-
74
- // cacheId 不为空,需要比对sessionStorage中的cacheId与路由参数中的cacheId是否一致
75
- if (cacheId && (result === null || result === void 0 ? void 0 : result.cacheId) === cacheId) {
76
- return result;
77
- }
78
- return {};
44
+ var result = sessionStorage.getItem(SALES_MODEL_SESSION_STORAGE_KEY);
45
+ return JSON.parse(result || '{}');
79
46
  };
80
47
  var removeSessionStorage = function removeSessionStorage() {
81
48
  sessionStorage.removeItem(SALES_MODEL_SESSION_STORAGE_KEY);
@@ -22,7 +22,7 @@ import { checkBeforeAddToCartApi } from "./serve";
22
22
  import { useCustomer } from "../Customer";
23
23
  import { useRequest } from 'ahooks';
24
24
  import { formatValues } from "../Checkout/utils";
25
- import { handleCartItemOrigin, handleProductDeposit, handleProductInfo } from "./utils";
25
+ import { handleCartItemOrigin, handleProductInfo } from "./utils";
26
26
  var defaultState = {
27
27
  cartItems: [],
28
28
  currentCartItem: null
@@ -324,10 +324,6 @@ export var CartProvider = function CartProvider(_ref) {
324
324
  }),
325
325
  _productDetail: eventDetail.productDetail
326
326
  };
327
-
328
- // 处理定金
329
- newCartItem.deposit = handleProductDeposit(newCartItem, eventDetail, num);
330
- // 处理提交给接口的数据
331
327
  var originData = handleCartItemOrigin(newCartItem, eventDetail);
332
328
  newCartItem._originData = originData;
333
329
  if (_holderItem !== null && _holderItem !== void 0 && _holderItem._originData) {
@@ -1,4 +1,3 @@
1
- import Decimal from 'decimal.js';
2
1
  import { ICalculatePriceParams } from './types';
3
2
  export declare const handleProductInfo: (eventDetail: any, num: number) => {
4
3
  totalPrice: number;
@@ -22,42 +21,3 @@ export declare const getOriginTotalPrice: (params: ICalculatePriceParams) => num
22
21
  export declare const handleCartItemOrigin: (cartItem: any, eventDetail: any) => any;
23
22
  export declare const formatBundleToOrigin: (bundle: any) => any;
24
23
  export declare const formatOptionsToOrigin: (options: any) => any;
25
- export declare const handleProductDeposit: (cartItem: any, eventDetail: any, num: number) => {
26
- total: number;
27
- protocols: any;
28
- } | null;
29
- /**
30
- * 获取商品定金
31
- * @description 定金基于商品售价来算,最终乘商品数量
32
- * 1、如果套餐主商品有定金规则,则定金为:(套餐商品总售价 * 定金百分比 + 定金固定金额)* 商品数量
33
- * 2、如果套餐主商品没有定金规则,子商品有定金规则,则定金为:(套餐子商品售价 * 套餐子商品定金百分比 + 套餐子商品定金固定金额)* 商品数量,最终将所有子商品定金相加
34
- * 3、普通商品/单规格商品/组合规则商品,定金规则:(商品总售价 * 定金百分比 + 定金固定金额)* 商品数量
35
- * @param params 参数
36
- * @returns 商品定金
37
- */
38
- export declare const getProductDeposit: (params: {
39
- cartItem: any;
40
- product: any;
41
- bundle?: any;
42
- options?: any;
43
- num?: number;
44
- }) => {
45
- total: number;
46
- protocols: any;
47
- } | null;
48
- /**
49
- * 计算商品定金
50
- * @param params 参数
51
- * @returns 商品定金
52
- */
53
- export declare const calculateProductDeposit: (params: {
54
- depositData: {
55
- deposit_fixed?: string;
56
- deposit_percentage?: string;
57
- };
58
- total: string | number;
59
- num: number;
60
- }) => {
61
- result: boolean;
62
- depositTotal: Decimal;
63
- };
@@ -1,10 +1,3 @@
1
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
- 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; }
7
- import Decimal from 'decimal.js';
8
1
  export var handleProductInfo = function handleProductInfo(eventDetail, num) {
9
2
  var productDetail = eventDetail.productDetail,
10
3
  bookingOptionItem = eventDetail.bookingOptionItem;
@@ -165,164 +158,4 @@ export var formatOptionsToOrigin = function formatOptionsToOrigin(options) {
165
158
  option_group_id: d.option_group_id
166
159
  };
167
160
  });
168
- };
169
- export var handleProductDeposit = function handleProductDeposit(cartItem, eventDetail, num) {
170
- var _origin$custom_deposi;
171
- var productDetail = eventDetail.productDetail;
172
- var origin = productDetail.origin,
173
- bundle = productDetail.bundle,
174
- options = productDetail.options,
175
- product_variant_id = productDetail.product_variant_id;
176
- var deposit = null;
177
- var product = origin;
178
- if (product_variant_id) {
179
- product.product_variant_id = product_variant_id;
180
- }
181
- if ((origin === null || origin === void 0 || (_origin$custom_deposi = origin.custom_deposit_data) === null || _origin$custom_deposi === void 0 ? void 0 : _origin$custom_deposi.has_deposit) == 1) {
182
- deposit = getProductDeposit({
183
- cartItem: cartItem,
184
- product: product,
185
- bundle: bundle,
186
- options: options,
187
- num: num
188
- });
189
- }
190
- return deposit;
191
- };
192
-
193
- /**
194
- * 获取商品定金
195
- * @description 定金基于商品售价来算,最终乘商品数量
196
- * 1、如果套餐主商品有定金规则,则定金为:(套餐商品总售价 * 定金百分比 + 定金固定金额)* 商品数量
197
- * 2、如果套餐主商品没有定金规则,子商品有定金规则,则定金为:(套餐子商品售价 * 套餐子商品定金百分比 + 套餐子商品定金固定金额)* 商品数量,最终将所有子商品定金相加
198
- * 3、普通商品/单规格商品/组合规则商品,定金规则:(商品总售价 * 定金百分比 + 定金固定金额)* 商品数量
199
- * @param params 参数
200
- * @returns 商品定金
201
- */
202
- export var getProductDeposit = function getProductDeposit(params) {
203
- var _product$custom_depos;
204
- var cartItem = params.cartItem,
205
- product = params.product,
206
- bundle = params.bundle,
207
- options = params.options;
208
- var num = (params === null || params === void 0 ? void 0 : params.num) || 1;
209
-
210
- // 判定商品是否有定金规则
211
- if ((product === null || product === void 0 || (_product$custom_depos = product.custom_deposit_data) === null || _product$custom_depos === void 0 ? void 0 : _product$custom_depos.has_deposit) == 1) {
212
- var total = new Decimal(0);
213
- var _ref = (product === null || product === void 0 ? void 0 : product.custom_deposit_data) || {},
214
- deposit_fixed = _ref.deposit_fixed,
215
- deposit_percentage = _ref.deposit_percentage,
216
- deposit_policy_data = _ref.deposit_policy_data,
217
- self_deposit_policy_ids = _ref.self_deposit_policy_ids;
218
- // 所有协议数据
219
- var allProtocols = deposit_policy_data || [];
220
- // 是否存在定金,主商品has_deposit为1,但是自身没有定金设置,需要判定子商品是否存在定金,如果不存在最终判定也是不存在定金
221
- var productHasDeposit = false;
222
- // 关联的定金协议id
223
- var protocolIds = [];
224
-
225
- // 判断主商品是否有定金规则
226
- if (typeof deposit_fixed === 'string' && typeof deposit_percentage === 'string') {
227
- var _calculateProductDepo = calculateProductDeposit({
228
- depositData: product === null || product === void 0 ? void 0 : product.custom_deposit_data,
229
- total: (cartItem === null || cartItem === void 0 ? void 0 : cartItem.total) || 0,
230
- num: num
231
- }),
232
- depositTotal = _calculateProductDepo.depositTotal,
233
- result = _calculateProductDepo.result;
234
- if (result) {
235
- total = depositTotal;
236
- protocolIds.push.apply(protocolIds, _toConsumableArray(self_deposit_policy_ids || []));
237
- productHasDeposit = true;
238
- }
239
- } else {
240
- // 组合规格商品
241
- if (product !== null && product !== void 0 && product.product_variant_id) {
242
- var _product$variant;
243
- var variantProduct = product === null || product === void 0 || (_product$variant = product.variant) === null || _product$variant === void 0 ? void 0 : _product$variant.find(function (item) {
244
- return (item === null || item === void 0 ? void 0 : item.id) === (product === null || product === void 0 ? void 0 : product.product_variant_id);
245
- });
246
- if (variantProduct) {
247
- var depositData = variantProduct === null || variantProduct === void 0 ? void 0 : variantProduct.custom_deposit_data;
248
- var _calculateProductDepo2 = calculateProductDeposit({
249
- depositData: depositData,
250
- total: (cartItem === null || cartItem === void 0 ? void 0 : cartItem.total) || 0,
251
- num: num
252
- }),
253
- _depositTotal = _calculateProductDepo2.depositTotal,
254
- _result = _calculateProductDepo2.result;
255
- if (_result) {
256
- total = _depositTotal;
257
- protocolIds.push.apply(protocolIds, _toConsumableArray((depositData === null || depositData === void 0 ? void 0 : depositData.self_deposit_policy_ids) || []));
258
- productHasDeposit = true;
259
- }
260
- }
261
- }
262
- if (bundle !== null && bundle !== void 0 && bundle.length) {
263
- total = bundle.reduce(function (accumulator, currBundleProduct) {
264
- var depositData = currBundleProduct === null || currBundleProduct === void 0 ? void 0 : currBundleProduct.custom_deposit_data;
265
- var _calculateProductDepo3 = calculateProductDeposit({
266
- depositData: depositData,
267
- total: currBundleProduct === null || currBundleProduct === void 0 ? void 0 : currBundleProduct.price,
268
- num: (currBundleProduct === null || currBundleProduct === void 0 ? void 0 : currBundleProduct.num) || 1
269
- }),
270
- depositTotal = _calculateProductDepo3.depositTotal,
271
- result = _calculateProductDepo3.result;
272
- if (result) {
273
- protocolIds.push.apply(protocolIds, _toConsumableArray((depositData === null || depositData === void 0 ? void 0 : depositData.self_deposit_policy_ids) || []));
274
- productHasDeposit = true;
275
- return accumulator.plus(depositTotal);
276
- }
277
- return accumulator;
278
- }, new Decimal(0));
279
- }
280
- }
281
- if (productHasDeposit) {
282
- var ids = new Set(protocolIds);
283
- var protocols = allProtocols.filter(function (item) {
284
- return ids.has(item.id);
285
- });
286
- return {
287
- total: total.toNumber(),
288
- protocols: protocols
289
- };
290
- }
291
- return null;
292
- }
293
- return null;
294
- };
295
-
296
- /**
297
- * 计算商品定金
298
- * @param params 参数
299
- * @returns 商品定金
300
- */
301
- export var calculateProductDeposit = function calculateProductDeposit(params) {
302
- var depositData = params.depositData,
303
- total = params.total,
304
- num = params.num;
305
- if (!depositData) {
306
- return {
307
- result: false,
308
- depositTotal: new Decimal(0)
309
- };
310
- }
311
- var _ref2 = depositData || {},
312
- deposit_fixed = _ref2.deposit_fixed,
313
- deposit_percentage = _ref2.deposit_percentage;
314
- if (typeof deposit_fixed === 'string' && typeof deposit_percentage === 'string') {
315
- var depositFixed = new Decimal(deposit_fixed || 0);
316
- var depositPercent = new Decimal(deposit_percentage || 0);
317
- var productTotalPrice = new Decimal(total || 0);
318
- var deposit = depositFixed.plus(depositPercent.times(productTotalPrice));
319
- return {
320
- depositTotal: deposit.times(num),
321
- result: true
322
- };
323
- }
324
- return {
325
- result: false,
326
- depositTotal: new Decimal(0)
327
- };
328
161
  };
@@ -5,9 +5,6 @@ interface PayProps {
5
5
  order_id: string;
6
6
  amount: number;
7
7
  sale_channel?: string;
8
- is_deposit?: number;
9
- deposit_amount?: number;
10
- total_amount?: number;
11
8
  }
12
9
  interface CheckoutContextType {
13
10
  onCheckBeforeBooking: (data: any) => Promise<{
@@ -18,7 +15,6 @@ interface CheckoutContextType {
18
15
  onPay: (payProps: PayProps) => void;
19
16
  createBooking: any;
20
17
  checkBeforeBooking: any;
21
- freePay: any;
22
18
  }
23
19
  interface CheckoutProviderProps {
24
20
  children: React.ReactNode;
@@ -1,9 +1,4 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
- 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); }
7
2
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
8
3
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
9
4
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -11,9 +6,8 @@ import React, { createContext, useRef } from 'react';
11
6
  import { useSales } from "../../../businessModel/SalesModel";
12
7
  import useEngineContext from "../../../hooks/useEngineContext";
13
8
  import { useRequest } from 'ahooks';
14
- import { checkBeforeBookingApi, createBookingApi, freePayApi } from "./serve";
9
+ import { checkBeforeBookingApi, createBookingApi } from "./serve";
15
10
  import { useCart } from "../Cart";
16
- import { Toast } from "../../appointmentBooking/utils";
17
11
 
18
12
  // 定义上下文接口
19
13
 
@@ -33,7 +27,6 @@ export var CheckoutProvider = function CheckoutProvider(_ref) {
33
27
  updateDisabledCartItem = _useCart.updateDisabledCartItem;
34
28
  var checkoutCallback = useRef(null);
35
29
  var checkRef = useRef(null);
36
- var payRef = useRef(null);
37
30
  var checkBeforeBooking = useRequest(checkBeforeBookingApi, {
38
31
  manual: true,
39
32
  onSuccess: function onSuccess(res) {
@@ -68,17 +61,6 @@ export var CheckoutProvider = function CheckoutProvider(_ref) {
68
61
  });
69
62
  }
70
63
  });
71
- var freePay = useRequest(freePayApi, {
72
- manual: true,
73
- onSuccess: function onSuccess(res) {
74
- if (res !== null && res !== void 0 && res.status) {
75
- var _payRef$current, _payRef$current2;
76
- goPaymentFinish((_payRef$current = payRef.current) === null || _payRef$current === void 0 ? void 0 : _payRef$current.order_id, (_payRef$current2 = payRef.current) === null || _payRef$current2 === void 0 ? void 0 : _payRef$current2.total_amount);
77
- } else {
78
- Toast(res === null || res === void 0 ? void 0 : res.message);
79
- }
80
- }
81
- });
82
64
 
83
65
  /**
84
66
  * @title: 下单前校验
@@ -124,11 +106,6 @@ export var CheckoutProvider = function CheckoutProvider(_ref) {
124
106
  return _ref2.apply(this, arguments);
125
107
  };
126
108
  }();
127
- var goPaymentFinish = function goPaymentFinish(order_id, amount) {
128
- var _utils$history;
129
- var url = "/payment-finish/success?order_id=".concat(order_id, "&amount=").concat(Number(amount));
130
- utils === null || utils === void 0 || (_utils$history = utils.history) === null || _utils$history === void 0 || _utils$history.replace(url);
131
- };
132
109
 
133
110
  /**
134
111
  * @title: 支付
@@ -138,41 +115,20 @@ export var CheckoutProvider = function CheckoutProvider(_ref) {
138
115
  * @Author: zhiwei.Wang
139
116
  */
140
117
  var onPay = function onPay(payProps) {
141
- payRef.current = payProps;
142
- var is_deposit = payProps.is_deposit,
143
- deposit_amount = payProps.deposit_amount,
144
- total_amount = payProps.total_amount;
145
-
146
- // 如果有定金,则支付定金金额,否则订单金额
147
- var _total = is_deposit ? deposit_amount || 0 : total_amount || 0;
148
- if (_total > 0) {
149
- utils.action({
150
- type: 'pisell1.payment',
151
- data: _objectSpread(_objectSpread({}, payProps), {}, {
152
- total_amount: _total
153
- }),
154
- callback: function callback(e) {
155
- checkoutCallback.current && checkoutCallback.current(e);
156
- }
157
- });
158
- } else {
159
- // 定金为0则直接跳转结果页面
160
- if (is_deposit) {
161
- goPaymentFinish(payProps.order_id, _total);
162
- return;
118
+ utils.action({
119
+ type: 'pisell1.payment',
120
+ data: payProps,
121
+ callback: function callback(e) {
122
+ checkoutCallback.current && checkoutCallback.current(e);
163
123
  }
164
-
165
- // 金额为0则需要调用免费支付接口,接口调用成功后跳转结果页面
166
- freePay.runAsync(payProps.order_id);
167
- }
124
+ });
168
125
  };
169
126
  var contextValue = {
170
127
  onCheckBeforeBooking: onCheckBeforeBooking,
171
128
  onCheckout: onCheckout,
172
129
  onPay: onPay,
173
130
  createBooking: createBooking,
174
- checkBeforeBooking: checkBeforeBooking,
175
- freePay: freePay
131
+ checkBeforeBooking: checkBeforeBooking
176
132
  };
177
133
  return /*#__PURE__*/React.createElement(CheckoutContext.Provider, {
178
134
  value: contextValue
@@ -1,15 +1,2 @@
1
- /**
2
- * @title: 下单前置校验接口
3
- * @param {any} data
4
- */
5
1
  export declare const checkBeforeBookingApi: (data: any) => Promise<any>;
6
- /**
7
- * @title: 创建订单
8
- * @param {any} data
9
- */
10
2
  export declare const createBookingApi: (data: any) => Promise<any>;
11
- /**
12
- * @title: 免费支付
13
- * @param {string} orderId
14
- */
15
- export declare const freePayApi: (orderId: string) => Promise<any>;
@@ -1,25 +1,11 @@
1
1
  import { request } from "../../../utils";
2
2
 
3
- /**
4
- * @title: 下单前置校验接口
5
- * @param {any} data
6
- */
3
+ // 下单前置校验接口
7
4
  export var checkBeforeBookingApi = function checkBeforeBookingApi(data) {
8
5
  return request.getRequest().post('/h5/eventbookingv2/order/check-config', data);
9
6
  };
10
7
 
11
- /**
12
- * @title: 创建订单
13
- * @param {any} data
14
- */
8
+ // 创建
15
9
  export var createBookingApi = function createBookingApi(data) {
16
10
  return request.getRequest().post('/h5/eventbookingv2/order', data);
17
- };
18
-
19
- /**
20
- * @title: 免费支付
21
- * @param {string} orderId
22
- */
23
- export var freePayApi = function freePayApi(orderId) {
24
- return request.getRequest().post("/h5/pay/order/free-pay/".concat(orderId), {});
25
11
  };
@@ -104,12 +104,6 @@ export var formatValues = function formatValues(state, excludeDisabled, otherVal
104
104
  data = state.cartData.cartItems;
105
105
  }
106
106
 
107
- // 定金
108
- var is_deposit = data.find(function (v) {
109
- return v.deposit;
110
- }) ? 1 : 0;
111
- values.is_deposit = is_deposit;
112
-
113
107
  // 服务
114
108
  values.bookings = formatBookings(data);
115
109
  return values;
@@ -127,6 +121,6 @@ export var getFormParams = function getFormParams(state) {
127
121
  });
128
122
  return {
129
123
  product_id: product_id,
130
- appointment_type: 'event_booking_v2'
124
+ appointment_type: "event_booking_v2"
131
125
  };
132
126
  };
@@ -6,7 +6,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
6
6
  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); }
7
7
  import React, { createContext } from 'react';
8
8
  import { useSales } from "../../../businessModel/SalesModel";
9
- import { getSpecialResourceListApi } from "./serve";
9
+ import { getResourceListApi } from "./serve";
10
10
  import { useRequest } from 'ahooks';
11
11
  import { useCart } from "../Cart";
12
12
  import { getIamgeFromMedia } from "../utils";
@@ -73,7 +73,7 @@ export var ResourceProvider = function ResourceProvider(_ref) {
73
73
  });
74
74
  return renderData;
75
75
  };
76
- var getResourceList = useRequest(getSpecialResourceListApi, {
76
+ var getResourceList = useRequest(getResourceListApi, {
77
77
  manual: true,
78
78
  onSuccess: function onSuccess(res) {
79
79
  var formatData = formatResourceList(res);
@@ -3,10 +3,3 @@ export declare const getResourceListApi: (params: {
3
3
  shop_id: string;
4
4
  form_data_status: string;
5
5
  }) => Promise<any>;
6
- /**
7
- * @title: 获取特殊资源列表
8
- * @Author: xiangfeng.xue
9
- */
10
- export declare const getSpecialResourceListApi: (params: {
11
- event_item_ids?: string | number[];
12
- }) => Promise<any>;
@@ -5,14 +5,4 @@ export var getResourceListApi = function getResourceListApi(params) {
5
5
  return request.getRequest().get('/h5/form/data/v1', params, {
6
6
  useCache: true
7
7
  });
8
- };
9
-
10
- /**
11
- * @title: 获取特殊资源列表
12
- * @Author: xiangfeng.xue
13
- */
14
- export var getSpecialResourceListApi = function getSpecialResourceListApi(params) {
15
- return request.getRequest().get('/h5/eventbookingv2/item/specify-resources', params, {
16
- useCache: true
17
- });
18
8
  };
@@ -7,16 +7,6 @@ interface SummaryContextType {
7
7
  taxTitle?: string;
8
8
  totalTaxFee?: string;
9
9
  isPriceIncludeTax?: 0 | 1;
10
- deposit?: {
11
- total: string;
12
- protocols: any[];
13
- hasDeposit: boolean;
14
- };
15
- isAgreeDepositPolicy: boolean;
16
- setIsAgreeDepositPolicy: (value: boolean) => void;
17
- getDepositProtocol: (params: {
18
- id: string;
19
- }) => Promise<any>;
20
10
  }
21
11
  interface SummaryProviderProps {
22
12
  children: React.ReactNode;
@@ -1,14 +1,7 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- 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; }
5
- 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; } }
6
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import React, { createContext, useMemo, useState } from 'react';
1
+ import React, { createContext, useMemo } from 'react';
8
2
  import { useCart } from "../Cart";
9
3
  import { calculatePriceDetails } from "./utils";
10
4
  import { useInit } from "../Init";
11
- import { getDepositProtocolApi } from "./serve";
12
5
 
13
6
  // 定义上下文接口
14
7
 
@@ -23,10 +16,6 @@ export var SummaryProvider = function SummaryProvider(_ref) {
23
16
  cartData = _useCart.cartData;
24
17
  var _useInit = useInit(),
25
18
  initData = _useInit.initData;
26
- var _useState = useState(false),
27
- _useState2 = _slicedToArray(_useState, 2),
28
- isAgreeDepositPolicy = _useState2[0],
29
- setIsAgreeDepositPolicy = _useState2[1];
30
19
  var summaryData = useMemo(function () {
31
20
  return calculatePriceDetails((initData === null || initData === void 0 ? void 0 : initData.shop) || {}, cartData.cartItems);
32
21
  }, [cartData.cartItems, initData === null || initData === void 0 ? void 0 : initData.shop]);
@@ -37,11 +26,7 @@ export var SummaryProvider = function SummaryProvider(_ref) {
37
26
  total: summaryData.total,
38
27
  taxTitle: summaryData.taxTitle,
39
28
  totalTaxFee: summaryData.totalTaxFee,
40
- isPriceIncludeTax: summaryData.isPriceIncludeTax,
41
- deposit: summaryData.deposit,
42
- isAgreeDepositPolicy: isAgreeDepositPolicy,
43
- setIsAgreeDepositPolicy: setIsAgreeDepositPolicy,
44
- getDepositProtocol: getDepositProtocolApi
29
+ isPriceIncludeTax: summaryData.isPriceIncludeTax
45
30
  };
46
31
  return /*#__PURE__*/React.createElement(SummaryContext.Provider, {
47
32
  value: contextValue
@@ -1 +0,0 @@
1
- export declare const getDepositProtocolApi: (id: string) => Promise<any>;
@@ -1,6 +0,0 @@
1
- import { request } from "../../../utils";
2
-
3
- // 获取定金协议
4
- export var getDepositProtocolApi = function getDepositProtocolApi(id) {
5
- return request.getRequest().get("/h5/shop-policy/".concat(id), {});
6
- };