@pisell/pisellos 3.0.76 → 3.0.78
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.
- package/dist/core/index.js +1 -2
- package/dist/effects/index.d.ts +3 -5
- package/dist/effects/index.js +8 -40
- package/dist/modules/Account/index.js +3 -2
- package/dist/modules/AccountList/index.d.ts +1 -7
- package/dist/modules/AccountList/index.js +14 -81
- package/dist/modules/AccountList/types.d.ts +0 -28
- package/dist/modules/AccountList/types.js +0 -8
- package/dist/modules/BaseModule.d.ts +0 -3
- package/dist/modules/BaseModule.js +0 -15
- package/dist/modules/Cart/index.d.ts +0 -1
- package/dist/modules/Cart/index.js +1 -2
- package/dist/modules/Date/types.d.ts +3 -1
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +1 -1
- package/dist/modules/Guests/index.js +9 -9
- package/dist/modules/Order/index.d.ts +1 -25
- package/dist/modules/Order/index.js +3 -224
- package/dist/modules/Order/types.d.ts +0 -45
- package/dist/modules/Order/types.js +0 -8
- package/dist/modules/Order/utils.js +1 -1
- package/dist/modules/Payment/index.d.ts +9 -184
- package/dist/modules/Payment/index.js +109 -2084
- package/dist/modules/Payment/types.d.ts +30 -772
- package/dist/modules/Payment/types.js +12 -236
- package/dist/modules/ProductList/index.d.ts +1 -12
- package/dist/modules/ProductList/index.js +6 -29
- package/dist/modules/Resource/index.js +1 -1
- package/dist/modules/Rules/index.d.ts +4 -3
- package/dist/modules/Rules/index.js +121 -78
- package/dist/modules/Rules/types.d.ts +6 -1
- package/dist/modules/Rules/types.js +8 -0
- package/dist/modules/Schedule/index.d.ts +0 -9
- package/dist/modules/Schedule/index.js +0 -77
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +0 -1
- package/dist/plugins/window.d.ts +0 -1
- package/dist/solution/BookingByStep/index.d.ts +17 -0
- package/dist/solution/BookingByStep/index.js +525 -190
- package/dist/solution/BookingByStep/utils/products.d.ts +0 -6
- package/dist/solution/BookingByStep/utils/products.js +0 -10
- package/dist/solution/BookingByStep/utils/resources.js +4 -0
- package/dist/solution/BuyTickets/index.js +8 -7
- package/dist/solution/ShopDiscount/index.d.ts +12 -10
- package/dist/solution/ShopDiscount/index.js +64 -110
- package/dist/solution/ShopDiscount/types.d.ts +0 -8
- package/dist/solution/ShopDiscount/utils.js +1 -0
- package/dist/solution/index.d.ts +0 -2
- package/dist/solution/index.js +1 -3
- package/dist/types/index.d.ts +1 -4
- package/lib/core/index.js +1 -1
- package/lib/effects/index.d.ts +3 -5
- package/lib/effects/index.js +1 -17
- package/lib/modules/Account/index.js +3 -2
- package/lib/modules/AccountList/index.d.ts +1 -7
- package/lib/modules/AccountList/index.js +0 -27
- package/lib/modules/AccountList/types.d.ts +0 -28
- package/lib/modules/BaseModule.d.ts +0 -3
- package/lib/modules/BaseModule.js +0 -9
- package/lib/modules/Cart/index.d.ts +0 -1
- package/lib/modules/Cart/index.js +2 -5
- package/lib/modules/Date/types.d.ts +3 -1
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +1 -1
- package/lib/modules/Guests/index.js +9 -9
- package/lib/modules/Order/index.d.ts +1 -25
- package/lib/modules/Order/index.js +1 -186
- package/lib/modules/Order/types.d.ts +0 -45
- package/lib/modules/Order/utils.js +1 -1
- package/lib/modules/Payment/index.d.ts +9 -184
- package/lib/modules/Payment/index.js +51 -1084
- package/lib/modules/Payment/types.d.ts +30 -772
- package/lib/modules/Payment/types.js +6 -79
- package/lib/modules/ProductList/index.d.ts +1 -12
- package/lib/modules/ProductList/index.js +5 -31
- package/lib/modules/Resource/index.js +1 -1
- package/lib/modules/Rules/index.d.ts +4 -3
- package/lib/modules/Rules/index.js +64 -43
- package/lib/modules/Rules/types.d.ts +6 -1
- package/lib/modules/Rules/types.js +11 -2
- package/lib/modules/Schedule/index.d.ts +0 -9
- package/lib/modules/Schedule/index.js +0 -60
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +0 -2
- package/lib/plugins/window.d.ts +0 -1
- package/lib/solution/BookingByStep/index.d.ts +17 -0
- package/lib/solution/BookingByStep/index.js +325 -60
- package/lib/solution/BookingByStep/utils/products.d.ts +0 -6
- package/lib/solution/BookingByStep/utils/products.js +2 -8
- package/lib/solution/BookingByStep/utils/resources.js +4 -1
- package/lib/solution/BuyTickets/index.js +8 -7
- package/lib/solution/ShopDiscount/index.d.ts +12 -10
- package/lib/solution/ShopDiscount/index.js +30 -51
- package/lib/solution/ShopDiscount/types.d.ts +0 -8
- package/lib/solution/index.d.ts +0 -2
- package/lib/solution/index.js +1 -5
- package/lib/types/index.d.ts +1 -4
- package/package.json +1 -3
- package/dist/modules/Customer/constants.d.ts +0 -7
- package/dist/modules/Customer/constants.js +0 -12
- package/dist/modules/Customer/index.d.ts +0 -122
- package/dist/modules/Customer/index.js +0 -696
- package/dist/modules/Customer/types.d.ts +0 -146
- package/dist/modules/Customer/types.js +0 -41
- package/dist/modules/Payment/cash.d.ts +0 -19
- package/dist/modules/Payment/cash.js +0 -97
- package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +0 -22
- package/dist/modules/Payment/cashRecommendationAlgorithm.js +0 -423
- package/dist/modules/Payment/eftpos.d.ts +0 -11
- package/dist/modules/Payment/eftpos.js +0 -80
- package/dist/modules/Payment/mx51.d.ts +0 -0
- package/dist/modules/Payment/mx51.js +0 -0
- package/dist/modules/Payment/utils.d.ts +0 -17
- package/dist/modules/Payment/utils.js +0 -62
- package/dist/modules/Payment/walletpass.d.ts +0 -99
- package/dist/modules/Payment/walletpass.js +0 -711
- package/dist/plugins/app-types/app/app.d.ts +0 -83
- package/dist/plugins/app-types/app/const.d.ts +0 -4
- package/dist/plugins/app-types/app/index.d.ts +0 -14
- package/dist/plugins/app-types/applicationManager/application.d.ts +0 -50
- package/dist/plugins/app-types/applicationManager/index.d.ts +0 -13
- package/dist/plugins/app-types/config.d.ts +0 -3
- package/dist/plugins/app-types/cookie/index.d.ts +0 -13
- package/dist/plugins/app-types/data/index.d.ts +0 -8
- package/dist/plugins/app-types/history/config.d.ts +0 -24
- package/dist/plugins/app-types/history/index.d.ts +0 -20
- package/dist/plugins/app-types/history/type.d.ts +0 -2
- package/dist/plugins/app-types/hooks/index.d.ts +0 -12
- package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
- package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
- package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
- package/dist/plugins/app-types/hooks/useStore/index.d.ts +0 -6
- package/dist/plugins/app-types/index.d.ts +0 -6
- package/dist/plugins/app-types/indexDB/index.d.ts +0 -178
- package/dist/plugins/app-types/locales/en.d.ts +0 -3
- package/dist/plugins/app-types/locales/index.d.ts +0 -37
- package/dist/plugins/app-types/locales/original.d.ts +0 -3
- package/dist/plugins/app-types/locales/type.d.ts +0 -19
- package/dist/plugins/app-types/locales/zh-CN.d.ts +0 -3
- package/dist/plugins/app-types/locales/zh-HK.d.ts +0 -3
- package/dist/plugins/app-types/logger/feishu.d.ts +0 -11
- package/dist/plugins/app-types/logger/index.d.ts +0 -122
- package/dist/plugins/app-types/menuManager/hooks.d.ts +0 -17
- package/dist/plugins/app-types/menuManager/index.d.ts +0 -28
- package/dist/plugins/app-types/models/global.d.ts +0 -32
- package/dist/plugins/app-types/models/index.d.ts +0 -45
- package/dist/plugins/app-types/models/type.d.ts +0 -2
- package/dist/plugins/app-types/package.json +0 -15
- package/dist/plugins/app-types/plugin/index.d.ts +0 -0
- package/dist/plugins/app-types/pubsub/example.d.ts +0 -5
- package/dist/plugins/app-types/pubsub/index.d.ts +0 -63
- package/dist/plugins/app-types/request/cache.d.ts +0 -46
- package/dist/plugins/app-types/request/cancelToken.d.ts +0 -38
- package/dist/plugins/app-types/request/config.d.ts +0 -3
- package/dist/plugins/app-types/request/constants.d.ts +0 -2
- package/dist/plugins/app-types/request/index.d.ts +0 -24
- package/dist/plugins/app-types/request/pisell2Request.d.ts +0 -6
- package/dist/plugins/app-types/request/type.d.ts +0 -41
- package/dist/plugins/app-types/request/utils.d.ts +0 -46
- package/dist/plugins/app-types/routes/config.d.ts +0 -7
- package/dist/plugins/app-types/routes/index.d.ts +0 -28
- package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
- package/dist/plugins/app-types/socket/components/index.d.ts +0 -2
- package/dist/plugins/app-types/socket/constants.d.ts +0 -33
- package/dist/plugins/app-types/socket/events.d.ts +0 -31
- package/dist/plugins/app-types/socket/heartbeat.d.ts +0 -66
- package/dist/plugins/app-types/socket/index.d.ts +0 -61
- package/dist/plugins/app-types/socket/monitor.d.ts +0 -169
- package/dist/plugins/app-types/socket/reconnect.d.ts +0 -61
- package/dist/plugins/app-types/socket/socket.d.ts +0 -129
- package/dist/plugins/app-types/socket/types.d.ts +0 -85
- package/dist/plugins/app-types/storage/index.d.ts +0 -17
- package/dist/plugins/app-types/tasks/index.d.ts +0 -77
- package/dist/plugins/app-types/tasks/type.d.ts +0 -62
- package/dist/plugins/app-types/tasks/useTasks.d.ts +0 -5
- package/dist/plugins/app-types/type.d.ts +0 -2
- package/dist/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
- package/dist/plugins/app-types/variables/config.d.ts +0 -3
- package/dist/plugins/app-types/variables/index.d.ts +0 -6
- package/dist/plugins/app-types/variables/type.d.ts +0 -2
- package/dist/plugins/app-types/website/index.d.ts +0 -6
- package/dist/plugins/app.d.ts +0 -8
- package/dist/plugins/app.js +0 -1
- package/dist/solution/BookingTicket/index.d.ts +0 -184
- package/dist/solution/BookingTicket/index.js +0 -698
- package/dist/solution/BookingTicket/types.d.ts +0 -68
- package/dist/solution/BookingTicket/types.js +0 -43
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -159
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -22
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +0 -189
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -85
- package/dist/solution/BookingTicket/utils/scan/index.js +0 -294
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/dist/solution/BookingTicket/utils/scan/scanCache.js +0 -305
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/dist/solution/Checkout/index.d.ts +0 -432
- package/dist/solution/Checkout/index.js +0 -4452
- package/dist/solution/Checkout/types.d.ts +0 -727
- package/dist/solution/Checkout/types.js +0 -104
- package/dist/solution/Checkout/utils/index.d.ts +0 -121
- package/dist/solution/Checkout/utils/index.js +0 -511
- package/dist/utils/task.d.ts +0 -40
- package/dist/utils/task.js +0 -171
- package/dist/utils/watch.d.ts +0 -102
- package/dist/utils/watch.js +0 -294
- package/lib/modules/Customer/constants.d.ts +0 -7
- package/lib/modules/Customer/constants.js +0 -39
- package/lib/modules/Customer/index.d.ts +0 -122
- package/lib/modules/Customer/index.js +0 -439
- package/lib/modules/Customer/types.d.ts +0 -146
- package/lib/modules/Customer/types.js +0 -37
- package/lib/modules/Payment/cash.d.ts +0 -19
- package/lib/modules/Payment/cash.js +0 -64
- package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +0 -22
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +0 -342
- package/lib/modules/Payment/eftpos.d.ts +0 -11
- package/lib/modules/Payment/eftpos.js +0 -51
- package/lib/modules/Payment/mx51.d.ts +0 -0
- package/lib/modules/Payment/mx51.js +0 -0
- package/lib/modules/Payment/utils.d.ts +0 -17
- package/lib/modules/Payment/utils.js +0 -67
- package/lib/modules/Payment/walletpass.d.ts +0 -99
- package/lib/modules/Payment/walletpass.js +0 -484
- package/lib/plugins/app-types/app/app.d.ts +0 -83
- package/lib/plugins/app-types/app/const.d.ts +0 -4
- package/lib/plugins/app-types/app/index.d.ts +0 -14
- package/lib/plugins/app-types/applicationManager/application.d.ts +0 -50
- package/lib/plugins/app-types/applicationManager/index.d.ts +0 -13
- package/lib/plugins/app-types/config.d.ts +0 -3
- package/lib/plugins/app-types/cookie/index.d.ts +0 -13
- package/lib/plugins/app-types/data/index.d.ts +0 -8
- package/lib/plugins/app-types/history/config.d.ts +0 -24
- package/lib/plugins/app-types/history/index.d.ts +0 -20
- package/lib/plugins/app-types/history/type.d.ts +0 -2
- package/lib/plugins/app-types/hooks/index.d.ts +0 -12
- package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
- package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
- package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
- package/lib/plugins/app-types/hooks/useStore/index.d.ts +0 -6
- package/lib/plugins/app-types/index.d.ts +0 -6
- package/lib/plugins/app-types/indexDB/index.d.ts +0 -178
- package/lib/plugins/app-types/locales/en.d.ts +0 -3
- package/lib/plugins/app-types/locales/index.d.ts +0 -37
- package/lib/plugins/app-types/locales/original.d.ts +0 -3
- package/lib/plugins/app-types/locales/type.d.ts +0 -19
- package/lib/plugins/app-types/locales/zh-CN.d.ts +0 -3
- package/lib/plugins/app-types/locales/zh-HK.d.ts +0 -3
- package/lib/plugins/app-types/logger/feishu.d.ts +0 -11
- package/lib/plugins/app-types/logger/index.d.ts +0 -122
- package/lib/plugins/app-types/menuManager/hooks.d.ts +0 -17
- package/lib/plugins/app-types/menuManager/index.d.ts +0 -28
- package/lib/plugins/app-types/models/global.d.ts +0 -32
- package/lib/plugins/app-types/models/index.d.ts +0 -45
- package/lib/plugins/app-types/models/type.d.ts +0 -2
- package/lib/plugins/app-types/package.json +0 -15
- package/lib/plugins/app-types/plugin/index.d.ts +0 -0
- package/lib/plugins/app-types/pubsub/example.d.ts +0 -5
- package/lib/plugins/app-types/pubsub/index.d.ts +0 -63
- package/lib/plugins/app-types/request/cache.d.ts +0 -46
- package/lib/plugins/app-types/request/cancelToken.d.ts +0 -38
- package/lib/plugins/app-types/request/config.d.ts +0 -3
- package/lib/plugins/app-types/request/constants.d.ts +0 -2
- package/lib/plugins/app-types/request/index.d.ts +0 -24
- package/lib/plugins/app-types/request/pisell2Request.d.ts +0 -6
- package/lib/plugins/app-types/request/type.d.ts +0 -41
- package/lib/plugins/app-types/request/utils.d.ts +0 -46
- package/lib/plugins/app-types/routes/config.d.ts +0 -7
- package/lib/plugins/app-types/routes/index.d.ts +0 -28
- package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
- package/lib/plugins/app-types/socket/components/index.d.ts +0 -2
- package/lib/plugins/app-types/socket/constants.d.ts +0 -33
- package/lib/plugins/app-types/socket/events.d.ts +0 -31
- package/lib/plugins/app-types/socket/heartbeat.d.ts +0 -66
- package/lib/plugins/app-types/socket/index.d.ts +0 -61
- package/lib/plugins/app-types/socket/monitor.d.ts +0 -169
- package/lib/plugins/app-types/socket/reconnect.d.ts +0 -61
- package/lib/plugins/app-types/socket/socket.d.ts +0 -129
- package/lib/plugins/app-types/socket/types.d.ts +0 -85
- package/lib/plugins/app-types/storage/index.d.ts +0 -17
- package/lib/plugins/app-types/tasks/index.d.ts +0 -77
- package/lib/plugins/app-types/tasks/type.d.ts +0 -62
- package/lib/plugins/app-types/tasks/useTasks.d.ts +0 -5
- package/lib/plugins/app-types/type.d.ts +0 -2
- package/lib/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
- package/lib/plugins/app-types/variables/config.d.ts +0 -3
- package/lib/plugins/app-types/variables/index.d.ts +0 -6
- package/lib/plugins/app-types/variables/type.d.ts +0 -2
- package/lib/plugins/app-types/website/index.d.ts +0 -6
- package/lib/plugins/app.d.ts +0 -8
- package/lib/plugins/app.js +0 -17
- package/lib/solution/BookingTicket/index.d.ts +0 -184
- package/lib/solution/BookingTicket/index.js +0 -426
- package/lib/solution/BookingTicket/types.d.ts +0 -68
- package/lib/solution/BookingTicket/types.js +0 -72
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -117
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -22
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +0 -132
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -85
- package/lib/solution/BookingTicket/utils/scan/index.js +0 -216
- package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +0 -231
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/Checkout/index.d.ts +0 -432
- package/lib/solution/Checkout/index.js +0 -2776
- package/lib/solution/Checkout/types.d.ts +0 -727
- package/lib/solution/Checkout/types.js +0 -63
- package/lib/solution/Checkout/utils/index.d.ts +0 -121
- package/lib/solution/Checkout/utils/index.js +0 -362
- package/lib/utils/task.d.ts +0 -40
- package/lib/utils/task.js +0 -109
- package/lib/utils/watch.d.ts +0 -102
- package/lib/utils/watch.js +0 -217
|
@@ -1,6 +1,7 @@
|
|
|
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
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
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 _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
4
5
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
6
|
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."); }
|
|
6
7
|
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); }
|
|
@@ -24,14 +25,12 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
24
25
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
25
26
|
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); }
|
|
26
27
|
import { BaseModule } from "../BaseModule";
|
|
28
|
+
import { RulesHooks, UnavailableReason } from "./types";
|
|
27
29
|
import { uniqueById, getDiscountAmount, getDiscountListAmountTotal, getDiscountListAmount, filterDiscountListByBookingTime, isOrderLevelFixedAmountDiscount, calculateOrderLevelDiscountAllocation } from "../../solution/ShopDiscount/utils";
|
|
28
30
|
import { getProductOriginTotalPrice, getProductTotalPrice } from "../Cart/utils";
|
|
29
31
|
import Decimal from 'decimal.js';
|
|
30
32
|
import { isBoolean } from 'lodash-es';
|
|
31
33
|
import dayjs from 'dayjs';
|
|
32
|
-
|
|
33
|
-
// 临时变量
|
|
34
|
-
var flatItem;
|
|
35
34
|
export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
36
35
|
_inherits(RulesModule, _BaseModule);
|
|
37
36
|
var _super = _createSuper(RulesModule);
|
|
@@ -76,7 +75,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
76
75
|
case 0:
|
|
77
76
|
this.store.rulesList = rulesList;
|
|
78
77
|
_context2.next = 3;
|
|
79
|
-
return this.core.effects.emit(
|
|
78
|
+
return this.core.effects.emit(RulesHooks.OnRulesListChange, rulesList);
|
|
80
79
|
case 3:
|
|
81
80
|
case "end":
|
|
82
81
|
return _context2.stop();
|
|
@@ -140,7 +139,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
140
139
|
return {
|
|
141
140
|
isAvailable: false,
|
|
142
141
|
discountList: oldDiscountList,
|
|
143
|
-
productList: productList
|
|
142
|
+
productList: productList,
|
|
143
|
+
unavailableReason: UnavailableReason.AlreadyUsed
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -185,12 +185,93 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
});
|
|
188
|
+
|
|
189
|
+
// 如果券不可用,判断不可用原因
|
|
190
|
+
var unavailableReason;
|
|
191
|
+
if (!hasApplicableDiscount) {
|
|
192
|
+
unavailableReason = this.getUnavailableReason(newDiscountList, productList);
|
|
193
|
+
}
|
|
188
194
|
return {
|
|
189
195
|
isAvailable: hasApplicableDiscount,
|
|
190
196
|
discountList: hasApplicableDiscount ? result.discountList : oldDiscountList,
|
|
191
|
-
productList: hasApplicableDiscount ? result.productList : productList
|
|
197
|
+
productList: hasApplicableDiscount ? result.productList : productList,
|
|
198
|
+
unavailableReason: unavailableReason
|
|
192
199
|
};
|
|
193
200
|
}
|
|
201
|
+
|
|
202
|
+
// 获取券不可用的原因
|
|
203
|
+
}, {
|
|
204
|
+
key: "getUnavailableReason",
|
|
205
|
+
value: function getUnavailableReason(discountList, productList) {
|
|
206
|
+
// 检查时间限制
|
|
207
|
+
var _iterator = _createForOfIteratorHelper(discountList),
|
|
208
|
+
_step;
|
|
209
|
+
try {
|
|
210
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
211
|
+
var discount = _step.value;
|
|
212
|
+
var _iterator3 = _createForOfIteratorHelper(productList),
|
|
213
|
+
_step3;
|
|
214
|
+
try {
|
|
215
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
216
|
+
var item = _step3.value;
|
|
217
|
+
var product = this.hooks.getProduct(item);
|
|
218
|
+
var bookingTime = ((product === null || product === void 0 ? void 0 : product.startDate) || dayjs()).format('YYYY-MM-DD HH:mm:ss');
|
|
219
|
+
var filteredList = filterDiscountListByBookingTime([discount], bookingTime);
|
|
220
|
+
if (filteredList.length === 0) {
|
|
221
|
+
return UnavailableReason.TimeLimit;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
} catch (err) {
|
|
225
|
+
_iterator3.e(err);
|
|
226
|
+
} finally {
|
|
227
|
+
_iterator3.f();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// 检查商品适用性
|
|
232
|
+
} catch (err) {
|
|
233
|
+
_iterator.e(err);
|
|
234
|
+
} finally {
|
|
235
|
+
_iterator.f();
|
|
236
|
+
}
|
|
237
|
+
var _iterator2 = _createForOfIteratorHelper(discountList),
|
|
238
|
+
_step2;
|
|
239
|
+
try {
|
|
240
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
241
|
+
var _discount = _step2.value;
|
|
242
|
+
var limitedData = _discount.limited_relation_product_data;
|
|
243
|
+
var hasApplicableProduct = false;
|
|
244
|
+
var _iterator4 = _createForOfIteratorHelper(productList),
|
|
245
|
+
_step4;
|
|
246
|
+
try {
|
|
247
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
248
|
+
var _limitedData$product_;
|
|
249
|
+
var _item = _step4.value;
|
|
250
|
+
var _product = this.hooks.getProduct(_item);
|
|
251
|
+
if (limitedData.type === 'product_all') {
|
|
252
|
+
hasApplicableProduct = true;
|
|
253
|
+
break;
|
|
254
|
+
} else if ((_limitedData$product_ = limitedData.product_ids) !== null && _limitedData$product_ !== void 0 && _limitedData$product_.includes(_product.id)) {
|
|
255
|
+
hasApplicableProduct = true;
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
} catch (err) {
|
|
260
|
+
_iterator4.e(err);
|
|
261
|
+
} finally {
|
|
262
|
+
_iterator4.f();
|
|
263
|
+
}
|
|
264
|
+
if (!hasApplicableProduct) {
|
|
265
|
+
return UnavailableReason.ProductNotApplicable;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
} catch (err) {
|
|
269
|
+
_iterator2.e(err);
|
|
270
|
+
} finally {
|
|
271
|
+
_iterator2.f();
|
|
272
|
+
}
|
|
273
|
+
return UnavailableReason.Unknown;
|
|
274
|
+
}
|
|
194
275
|
}, {
|
|
195
276
|
key: "calcDiscount",
|
|
196
277
|
value: function calcDiscount(_ref2, options) {
|
|
@@ -454,7 +535,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
454
535
|
const priceB = new Decimal((bProduct.price as string) || '0');
|
|
455
536
|
if (priceA.toNumber() === priceB.toNumber()) {
|
|
456
537
|
if (aProduct.quantity === bProduct.quantity) {
|
|
457
|
-
return bProduct.discount_list?.length
|
|
538
|
+
return bProduct.discount_list?.length - aProduct.discount_list?.length;
|
|
458
539
|
}
|
|
459
540
|
return aProduct.quantity - bProduct.quantity;
|
|
460
541
|
}
|
|
@@ -489,7 +570,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
489
570
|
|
|
490
571
|
// 辅助函数:检查商品是否对某个折扣卡可用
|
|
491
572
|
var checkItemApplicableForDiscount = function checkItemApplicableForDiscount(flatItem, discount) {
|
|
492
|
-
var
|
|
573
|
+
var _product2, _product3, _product4, _flatItem$bundleItem, _flatItem$bundleItem2, _product5;
|
|
493
574
|
var product;
|
|
494
575
|
if (flatItem.type === 'main') {
|
|
495
576
|
product = flatItem.product;
|
|
@@ -508,7 +589,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
508
589
|
}
|
|
509
590
|
|
|
510
591
|
// 编辑的商品使用了优惠券不可用
|
|
511
|
-
var isAvailableProduct = flatItem.type === 'main' ? !((
|
|
592
|
+
var isAvailableProduct = flatItem.type === 'main' ? !((_product2 = product) !== null && _product2 !== void 0 && _product2.booking_id && (_product3 = product) !== null && _product3 !== void 0 && (_product3 = _product3.discount_list) !== null && _product3 !== void 0 && _product3.length && (_product4 = product) !== null && _product4 !== void 0 && (_product4 = _product4.discount_list) !== null && _product4 !== void 0 && _product4.every(function (d) {
|
|
512
593
|
return d.id && ['good_pass', 'discount_card', 'product_discount_card'].includes(d.tag || d.type);
|
|
513
594
|
})) : !(flatItem !== null && flatItem !== void 0 && flatItem.booking_id && !!(flatItem !== null && flatItem !== void 0 && (_flatItem$bundleItem = flatItem.bundleItem) !== null && _flatItem$bundleItem !== void 0 && (_flatItem$bundleItem = _flatItem$bundleItem.discount_list) !== null && _flatItem$bundleItem !== void 0 && _flatItem$bundleItem.length) && flatItem !== null && flatItem !== void 0 && (_flatItem$bundleItem2 = flatItem.bundleItem) !== null && _flatItem$bundleItem2 !== void 0 && (_flatItem$bundleItem2 = _flatItem$bundleItem2.discount_list) !== null && _flatItem$bundleItem2 !== void 0 && _flatItem$bundleItem2.every(function (d) {
|
|
514
595
|
return d.id;
|
|
@@ -529,7 +610,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
529
610
|
var limitedData = discount.limited_relation_product_data;
|
|
530
611
|
|
|
531
612
|
// 时间限制检查
|
|
532
|
-
var timeLimit = !!filterDiscountListByBookingTime([discount], (((
|
|
613
|
+
var timeLimit = !!filterDiscountListByBookingTime([discount], (((_product5 = product) === null || _product5 === void 0 ? void 0 : _product5.startDate) || dayjs()).format('YYYY-MM-DD HH:mm:ss')).length;
|
|
533
614
|
if (!timeLimit) {
|
|
534
615
|
return false;
|
|
535
616
|
}
|
|
@@ -694,8 +775,9 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
694
775
|
originProduct = flatItem.originProduct;
|
|
695
776
|
}
|
|
696
777
|
addModeDiscount.forEach(function (discount) {
|
|
697
|
-
var
|
|
778
|
+
var _product6, _product7, _product8, _product9, _flatItem$bundleItem3, _flatItem$bundleItem4;
|
|
698
779
|
var limitedData = discount === null || discount === void 0 ? void 0 : discount.limited_relation_product_data;
|
|
780
|
+
|
|
699
781
|
// 拿到discount配置的holder信息 product信息 product.holder 加在 isLimitedProduct
|
|
700
782
|
var _tempVar = (flatItem === null || flatItem === void 0 ? void 0 : flatItem.type) === 'bundle' ? flatItem === null || flatItem === void 0 ? void 0 : flatItem.parentProduct : flatItem === null || flatItem === void 0 ? void 0 : flatItem.product;
|
|
701
783
|
var isHolderMatch = _this3.checkHolderMatch(discount, {
|
|
@@ -703,12 +785,12 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
703
785
|
holder_id: (_tempVar === null || _tempVar === void 0 ? void 0 : _tempVar.holder_id) || product.holder_id
|
|
704
786
|
}, holders);
|
|
705
787
|
var timeLimit = true;
|
|
706
|
-
timeLimit = !!filterDiscountListByBookingTime([discount], (((
|
|
788
|
+
timeLimit = !!filterDiscountListByBookingTime([discount], (((_product6 = product) === null || _product6 === void 0 ? void 0 : _product6.startDate) || dayjs()).format('YYYY-MM-DD HH:mm:ss')).length;
|
|
707
789
|
// 是符合折扣的商品
|
|
708
790
|
var isLimitedProduct = (limitedData.type === 'product_all' || limitedData.product_ids && limitedData.product_ids.includes(product.id)) && isHolderMatch;
|
|
709
791
|
|
|
710
792
|
// 编辑的商品 使用了优惠券不可用
|
|
711
|
-
var isAvailableProduct = flatItem.type === 'main' ? !((
|
|
793
|
+
var isAvailableProduct = flatItem.type === 'main' ? !((_product7 = product) !== null && _product7 !== void 0 && _product7.booking_id && (_product8 = product) !== null && _product8 !== void 0 && (_product8 = _product8.discount_list) !== null && _product8 !== void 0 && _product8.length && (_product9 = product) !== null && _product9 !== void 0 && (_product9 = _product9.discount_list) !== null && _product9 !== void 0 && _product9.every(function (discount) {
|
|
712
794
|
return discount.id && ['good_pass', 'discount_card', 'product_discount_card'].includes(discount.tag || discount.type);
|
|
713
795
|
})) : !(flatItem !== null && flatItem !== void 0 && flatItem.booking_id && !!(flatItem !== null && flatItem !== void 0 && (_flatItem$bundleItem3 = flatItem.bundleItem) !== null && _flatItem$bundleItem3 !== void 0 && (_flatItem$bundleItem3 = _flatItem$bundleItem3.discount_list) !== null && _flatItem$bundleItem3 !== void 0 && _flatItem$bundleItem3.length) && flatItem !== null && flatItem !== void 0 && (_flatItem$bundleItem4 = flatItem.bundleItem) !== null && _flatItem$bundleItem4 !== void 0 && (_flatItem$bundleItem4 = _flatItem$bundleItem4.discount_list) !== null && _flatItem$bundleItem4 !== void 0 && _flatItem$bundleItem4.every(function (discount) {
|
|
714
796
|
return discount.id;
|
|
@@ -718,7 +800,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
718
800
|
var isBundleAvailable = _this3.checkPackageSubItemUsageRules(discount, flatItem);
|
|
719
801
|
|
|
720
802
|
// 判断优惠券是否适用于该商品
|
|
721
|
-
if (isAvailableProduct && isLimitedProduct &&
|
|
803
|
+
if (isAvailableProduct && isLimitedProduct && isBundleAvailable && timeLimit) {
|
|
722
804
|
var _discountApplicabilit, _discount$metadata4, _discount$metadata5;
|
|
723
805
|
// 记录此优惠券适用的商品
|
|
724
806
|
(_discountApplicabilit = discountApplicability.get(discount.id)) === null || _discountApplicabilit === void 0 || _discountApplicabilit.push(product.id);
|
|
@@ -760,7 +842,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
760
842
|
// 然后再处理应用哪些优惠券,此时只考虑filteredDiscountList中的优惠券
|
|
761
843
|
// 🔥 使用扁平化后的列表进行处理
|
|
762
844
|
sortedFlattenedList.forEach(function (flatItem, index) {
|
|
763
|
-
var
|
|
845
|
+
var _product10, _product$discount_lis2, _product11;
|
|
764
846
|
// 获取商品数据
|
|
765
847
|
var product, originProduct;
|
|
766
848
|
if (flatItem.type === 'main') {
|
|
@@ -786,7 +868,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
786
868
|
}
|
|
787
869
|
|
|
788
870
|
// 已有优惠的商品跳过
|
|
789
|
-
if ((
|
|
871
|
+
if ((_product10 = product) !== null && _product10 !== void 0 && _product10.booking_id && (_product$discount_lis2 = product.discount_list) !== null && _product$discount_lis2 !== void 0 && _product$discount_lis2.length && (_product11 = product) !== null && _product11 !== void 0 && (_product11 = _product11.discount_list) !== null && _product11 !== void 0 && _product11.every(function (discount) {
|
|
790
872
|
return discount.id && ['good_pass', 'discount_card', 'product_discount_card'].includes(discount.tag || discount.type);
|
|
791
873
|
})) {
|
|
792
874
|
if (flatItem.type === 'main') {
|
|
@@ -807,7 +889,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
807
889
|
if ((Number(product.price) <= 0 || !product.price) && !((_product$discount_lis3 = product.discount_list) !== null && _product$discount_lis3 !== void 0 && _product$discount_lis3.length) && (discount.tag || discount.type) === 'good_pass') return false;
|
|
808
890
|
|
|
809
891
|
// 折扣卡商品价格为0时不可用
|
|
810
|
-
if ((Number(product.price)
|
|
892
|
+
if ((Number(product.price) === 0 || !product.price) && !((_product$discount_lis4 = product.discount_list) !== null && _product$discount_lis4 !== void 0 && _product$discount_lis4.find(function (n) {
|
|
811
893
|
var _n$discount;
|
|
812
894
|
return ((_n$discount = n.discount) === null || _n$discount === void 0 ? void 0 : _n$discount.resource_id) === discount.id;
|
|
813
895
|
})) && (discount.tag || discount.type) !== 'good_pass') return false;
|
|
@@ -858,12 +940,12 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
858
940
|
// 如果是手动折扣,则不适用优惠券
|
|
859
941
|
var isManualDiscount = false;
|
|
860
942
|
if (flatItem.type === 'main') {
|
|
861
|
-
var _product$discount_lis5,
|
|
943
|
+
var _product$discount_lis5, _product12, _product12$every;
|
|
862
944
|
// 主商品:判断自身是否手动折扣
|
|
863
945
|
isManualDiscount = typeof product.isManualDiscount === 'boolean' ? product.isManualDiscount : product.total != product.origin_total && (product.bundle || []).every(function (item) {
|
|
864
946
|
var _ref6;
|
|
865
947
|
return !((_ref6 = item.discount_list || []) !== null && _ref6 !== void 0 && _ref6.length);
|
|
866
|
-
}) && (!((_product$discount_lis5 = product.discount_list) !== null && _product$discount_lis5 !== void 0 && _product$discount_lis5.length) || ((
|
|
948
|
+
}) && (!((_product$discount_lis5 = product.discount_list) !== null && _product$discount_lis5 !== void 0 && _product$discount_lis5.length) || ((_product12 = product) === null || _product12 === void 0 || (_product12 = _product12.discount_list) === null || _product12 === void 0 || (_product12$every = _product12.every) === null || _product12$every === void 0 ? void 0 : _product12$every.call(_product12, function (item) {
|
|
867
949
|
return item.type === 'product';
|
|
868
950
|
})));
|
|
869
951
|
} else {
|
|
@@ -938,7 +1020,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
938
1020
|
}
|
|
939
1021
|
|
|
940
1022
|
// 如果没有适用的优惠券,或者手动折扣,则不适用优惠券
|
|
941
|
-
if (applicableDiscounts.length === 0 || isManualDiscount
|
|
1023
|
+
if (applicableDiscounts.length === 0 || isManualDiscount) {
|
|
942
1024
|
if (flatItem.type === 'main') {
|
|
943
1025
|
// 主商品:保持原有逻辑
|
|
944
1026
|
if (product.isClient) {
|
|
@@ -964,10 +1046,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
964
1046
|
discount_list: []
|
|
965
1047
|
}))]);
|
|
966
1048
|
} else {
|
|
967
|
-
processedProductsMap.set(product._id, [_this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {
|
|
968
|
-
price: product.price,
|
|
969
|
-
main_product_selling_price: product.price
|
|
970
|
-
} : {
|
|
1049
|
+
processedProductsMap.set(product._id, [_this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {} : {
|
|
971
1050
|
_id: product._id.split('___')[0] + '___' + index,
|
|
972
1051
|
total: product.origin_total || product.total,
|
|
973
1052
|
price: product.price,
|
|
@@ -980,7 +1059,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
980
1059
|
// bundle子商品:保存到扁平化Map
|
|
981
1060
|
processedFlatItemsMap.set(flatItem._id, [_objectSpread(_objectSpread({}, flatItem), {}, {
|
|
982
1061
|
discount_list: [],
|
|
983
|
-
price:
|
|
1062
|
+
price: flatItem.bundleItem.original_price,
|
|
984
1063
|
processed: true
|
|
985
1064
|
})]);
|
|
986
1065
|
}
|
|
@@ -1420,18 +1499,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1420
1499
|
var allDiscountAmount = getDiscountListAmountTotal(mainDiscountList);
|
|
1421
1500
|
newTotalWithDiscount = (_Decimal$minus$toNumb = new Decimal(mainProductData.price || 0).minus(allDiscountAmount).toNumber()) !== null && _Decimal$minus$toNumb !== void 0 ? _Decimal$minus$toNumb : newTotalWithDiscount;
|
|
1422
1501
|
newOriginTotalWithDiscount = (_mainProductData$orig = mainProductData.origin_total) !== null && _mainProductData$orig !== void 0 ? _mainProductData$orig : newOriginTotalWithDiscount;
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
var _item$discount_list2;
|
|
1432
|
-
var originalPrice = ((_item$discount_list2 = item.discount_list) === null || _item$discount_list2 === void 0 || (_item$discount_list2 = _item$discount_list2[0]) === null || _item$discount_list2 === void 0 || (_item$discount_list2 = _item$discount_list2.discount) === null || _item$discount_list2 === void 0 ? void 0 : _item$discount_list2.original_amount) || item.price;
|
|
1433
|
-
newOriginTotalWithDiscount += Number(originalPrice) * Number(item.num);
|
|
1434
|
-
});
|
|
1502
|
+
if (newBundleWithDiscount.length > 0) {
|
|
1503
|
+
newBundleWithDiscount.forEach(function (item) {
|
|
1504
|
+
var _item$discount_list2;
|
|
1505
|
+
newTotalWithDiscount += Number(item.price) * Number(item.num);
|
|
1506
|
+
var originalPrice = ((_item$discount_list2 = item.discount_list) === null || _item$discount_list2 === void 0 || (_item$discount_list2 = _item$discount_list2[0]) === null || _item$discount_list2 === void 0 || (_item$discount_list2 = _item$discount_list2.discount) === null || _item$discount_list2 === void 0 ? void 0 : _item$discount_list2.original_amount) || item.price;
|
|
1507
|
+
newOriginTotalWithDiscount += Number(originalPrice) * Number(item.num);
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1435
1510
|
}
|
|
1436
1511
|
|
|
1437
1512
|
// 累加options的价格(options不参与折扣,在最终设置total时处理)
|
|
@@ -1494,14 +1569,12 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1494
1569
|
var _allDiscountAmount = getDiscountListAmount(mainDiscountListOriginal);
|
|
1495
1570
|
newTotalOriginal = (_Decimal$minus$toNumb2 = new Decimal(mainProductData.price || 0).minus(_allDiscountAmount).toNumber()) !== null && _Decimal$minus$toNumb2 !== void 0 ? _Decimal$minus$toNumb2 : newTotalOriginal;
|
|
1496
1571
|
newOriginTotalOriginal = (_mainProductData$orig2 = mainProductData.origin_total) !== null && _mainProductData$orig2 !== void 0 ? _mainProductData$orig2 : newOriginTotalOriginal;
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
newOriginTotalOriginal += Number(item.price) * Number(item.num);
|
|
1504
|
-
});
|
|
1572
|
+
if (newBundleOriginal.length > 0) {
|
|
1573
|
+
newBundleOriginal.forEach(function (item) {
|
|
1574
|
+
newTotalOriginal += Number(item.price) * Number(item.num);
|
|
1575
|
+
newOriginTotalOriginal += Number(item.price) * Number(item.num);
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1505
1578
|
}
|
|
1506
1579
|
|
|
1507
1580
|
// 累加options的价格(options不参与折扣,在最终设置total时处理)
|
|
@@ -1595,13 +1668,9 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1595
1668
|
|
|
1596
1669
|
// 累加bundle的价格(只累加一次)
|
|
1597
1670
|
if (newBundle.length > 0) {
|
|
1598
|
-
newBundle.forEach(function (item) {
|
|
1599
|
-
newTotal += Number(item.price) * Number(item.num);
|
|
1600
|
-
});
|
|
1601
|
-
|
|
1602
|
-
// 计算原始总价(不考虑折扣)
|
|
1603
1671
|
newBundle.forEach(function (item) {
|
|
1604
1672
|
var _item$discount_list3;
|
|
1673
|
+
newTotal += Number(item.price) * Number(item.num);
|
|
1605
1674
|
var originalPrice = ((_item$discount_list3 = item.discount_list) === null || _item$discount_list3 === void 0 || (_item$discount_list3 = _item$discount_list3[0]) === null || _item$discount_list3 === void 0 || (_item$discount_list3 = _item$discount_list3.discount) === null || _item$discount_list3 === void 0 ? void 0 : _item$discount_list3.original_amount) || item.price;
|
|
1606
1675
|
newOriginTotal += Number(originalPrice) * Number(item.num);
|
|
1607
1676
|
});
|
|
@@ -1780,34 +1849,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1780
1849
|
// 套餐中购买时,判断是否为原价
|
|
1781
1850
|
var _priceType = (_flatItem$bundleItem10 = flatItem.bundleItem) === null || _flatItem$bundleItem10 === void 0 ? void 0 : _flatItem$bundleItem10.price_type;
|
|
1782
1851
|
var _priceTypeExt = (_flatItem$bundleItem11 = flatItem.bundleItem) === null || _flatItem$bundleItem11 === void 0 ? void 0 : _flatItem$bundleItem11.price_type_ext;
|
|
1783
|
-
|
|
1784
|
-
// original_price 对应:
|
|
1785
|
-
// 1. price_type: "markup" && price_type_ext: "product_price"
|
|
1786
|
-
// markup_price 对应:
|
|
1787
|
-
// price_type: "markup" && price_type_ext: ""
|
|
1788
|
-
/** 原价 */
|
|
1789
|
-
var _isOriginalPrice = _priceType === 'markup' && _priceTypeExt === 'product_price';
|
|
1790
|
-
/** 加价 */
|
|
1791
|
-
var _isMarkupPrice = _priceType === 'markup' && (_priceTypeExt === '' || !_priceTypeExt);
|
|
1792
|
-
|
|
1793
|
-
// 检查 rules
|
|
1794
|
-
if (rules.length > 0) {
|
|
1795
|
-
// 检查原价
|
|
1796
|
-
if (_isOriginalPrice && rules.includes('original_price')) {
|
|
1797
|
-
return true;
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1800
|
-
// 检查加价
|
|
1801
|
-
if (_isMarkupPrice && rules.includes('markup_price')) {
|
|
1802
|
-
return true;
|
|
1803
|
-
}
|
|
1804
|
-
|
|
1805
|
-
// 如果都不匹配,则不可用
|
|
1806
|
-
return false;
|
|
1807
|
-
}
|
|
1808
|
-
|
|
1809
1852
|
// 原价包括:price_type: "markup" && price_type_ext: "product_price"
|
|
1810
|
-
return
|
|
1853
|
+
return _priceType === 'markup' && _priceTypeExt === 'product_price';
|
|
1811
1854
|
}
|
|
1812
1855
|
return false;
|
|
1813
1856
|
}
|
|
@@ -1876,7 +1919,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1876
1919
|
case 0:
|
|
1877
1920
|
this.core.effects.offByModuleDestroy(this.name);
|
|
1878
1921
|
_context3.next = 3;
|
|
1879
|
-
return this.core.effects.emit(
|
|
1922
|
+
return this.core.effects.emit(RulesHooks.OnDestroy, {});
|
|
1880
1923
|
case 3:
|
|
1881
1924
|
console.log('[Rules] 已销毁');
|
|
1882
1925
|
case 4:
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { Discount } from '../Discount/types';
|
|
2
|
+
export declare enum UnavailableReason {
|
|
3
|
+
TimeLimit = "time_limit",
|
|
4
|
+
ProductNotApplicable = "product_not_applicable",
|
|
5
|
+
AlreadyUsed = "already_used",
|
|
6
|
+
Unknown = "unknown"
|
|
7
|
+
}
|
|
2
8
|
export declare enum RulesHooks {
|
|
3
9
|
OnRulesListChange = "rules:onRulesListChange",
|
|
4
10
|
OnDestroy = "rules:onDestroy"
|
|
@@ -44,7 +50,6 @@ type ProductDetail = {
|
|
|
44
50
|
num?: number;
|
|
45
51
|
quantity: number;
|
|
46
52
|
holder_id?: number | string;
|
|
47
|
-
vouchersApplicable?: boolean;
|
|
48
53
|
startDate?: any;
|
|
49
54
|
};
|
|
50
55
|
export interface RulesParamsHooks {
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
// 券不可用原因枚举
|
|
2
|
+
export var UnavailableReason = /*#__PURE__*/function (UnavailableReason) {
|
|
3
|
+
UnavailableReason["TimeLimit"] = "time_limit";
|
|
4
|
+
UnavailableReason["ProductNotApplicable"] = "product_not_applicable";
|
|
5
|
+
UnavailableReason["AlreadyUsed"] = "already_used";
|
|
6
|
+
UnavailableReason["Unknown"] = "unknown";
|
|
7
|
+
return UnavailableReason;
|
|
8
|
+
}({});
|
|
1
9
|
export var RulesHooks = /*#__PURE__*/function (RulesHooks) {
|
|
2
10
|
RulesHooks["OnRulesListChange"] = "rules:onRulesListChange";
|
|
3
11
|
RulesHooks["OnDestroy"] = "rules:onDestroy";
|
|
@@ -25,13 +25,4 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
|
|
|
25
25
|
setOtherProductsIds(ids: number[]): void;
|
|
26
26
|
getOtherProductsIds(): number[];
|
|
27
27
|
storeChange(): void;
|
|
28
|
-
/**
|
|
29
|
-
* 传入一个时间, 判断改时间是否在schedule 内
|
|
30
|
-
* @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
|
|
31
|
-
* @returns
|
|
32
|
-
*/
|
|
33
|
-
static isInScheduleByDate({ date, schedule, }: {
|
|
34
|
-
date: string;
|
|
35
|
-
schedule: any;
|
|
36
|
-
}): boolean | undefined;
|
|
37
28
|
}
|
|
@@ -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 _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
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 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; }
|
|
6
|
-
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; }
|
|
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); }); }; }
|
|
@@ -26,7 +21,6 @@ import dayjs from 'dayjs';
|
|
|
26
21
|
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
|
|
27
22
|
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
|
|
28
23
|
import { generateMonthDates, disableAllDates, disableDatesBeforeOneDay } from "../Date/utils";
|
|
29
|
-
import { calcScheduleDateRange } from "./utils";
|
|
30
24
|
dayjs.extend(isSameOrBefore);
|
|
31
25
|
dayjs.extend(isSameOrAfter);
|
|
32
26
|
export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
@@ -242,77 +236,6 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
242
236
|
});
|
|
243
237
|
}
|
|
244
238
|
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* 传入一个时间, 判断改时间是否在schedule 内
|
|
248
|
-
* @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
|
|
249
|
-
* @returns
|
|
250
|
-
*/
|
|
251
|
-
}], [{
|
|
252
|
-
key: "isInScheduleByDate",
|
|
253
|
-
value: function isInScheduleByDate(_ref2) {
|
|
254
|
-
var _schedule$repeat_rule, _schedule$repeat_rule2;
|
|
255
|
-
var date = _ref2.date,
|
|
256
|
-
schedule = _ref2.schedule;
|
|
257
|
-
if (schedule.start_time && schedule.end_time) {
|
|
258
|
-
var isBeforeStartTime = dayjs(date).isBefore(dayjs(schedule.start_time));
|
|
259
|
-
var isAfterEndTime = dayjs(date).isAfter(dayjs(schedule.end_time));
|
|
260
|
-
// 如果不在 schedule 日期区间内直接返回false
|
|
261
|
-
if (isBeforeStartTime || isAfterEndTime) {
|
|
262
|
-
return false;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
// 节约性能, 强制将schedule的时间范围改为前后一天,避免大量计算.
|
|
267
|
-
var _schedule = _objectSpread(_objectSpread({}, schedule), {}, {
|
|
268
|
-
// 开始时间向前推一天
|
|
269
|
-
start_time: dayjs(date).subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'),
|
|
270
|
-
end_time: dayjs(date).add(1, 'day').format('YYYY-MM-DD HH:mm:ss')
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
// 不限制的 改为后一天
|
|
274
|
-
if (((_schedule$repeat_rule = _schedule.repeat_rule) === null || _schedule$repeat_rule === void 0 || (_schedule$repeat_rule = _schedule$repeat_rule.end) === null || _schedule$repeat_rule === void 0 ? void 0 : _schedule$repeat_rule.type) === 'never') {
|
|
275
|
-
_schedule = _objectSpread(_objectSpread({}, _schedule), {}, {
|
|
276
|
-
repeat_rule: _objectSpread(_objectSpread({}, _schedule.repeat_rule), {}, {
|
|
277
|
-
end: {
|
|
278
|
-
type: 'date',
|
|
279
|
-
end_date: _schedule.end_time,
|
|
280
|
-
occurrence: null
|
|
281
|
-
}
|
|
282
|
-
})
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// 限制结束日期的也改为后一天
|
|
287
|
-
if (((_schedule$repeat_rule2 = _schedule.repeat_rule) === null || _schedule$repeat_rule2 === void 0 || (_schedule$repeat_rule2 = _schedule$repeat_rule2.end) === null || _schedule$repeat_rule2 === void 0 ? void 0 : _schedule$repeat_rule2.type) === 'date') {
|
|
288
|
-
_schedule = _objectSpread(_objectSpread({}, _schedule), {}, {
|
|
289
|
-
repeat_rule: _objectSpread(_objectSpread({}, _schedule.repeat_rule), {}, {
|
|
290
|
-
end: _objectSpread(_objectSpread({}, _schedule.repeat_rule.end), {}, {
|
|
291
|
-
end_date: _schedule.end_time
|
|
292
|
-
})
|
|
293
|
-
})
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
var dateRanges = calcScheduleDateRange(_objectSpread({}, _schedule));
|
|
297
|
-
var _iterator = _createForOfIteratorHelper(dateRanges),
|
|
298
|
-
_step;
|
|
299
|
-
try {
|
|
300
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
301
|
-
var range = _step.value;
|
|
302
|
-
var startTime = dayjs(range.start);
|
|
303
|
-
var endTime = dayjs(range.end);
|
|
304
|
-
|
|
305
|
-
// 如果输入时间在这个范围内(包含边界)
|
|
306
|
-
if (dayjs(date).isSameOrAfter(startTime) && dayjs(date).isSameOrBefore(endTime)) {
|
|
307
|
-
return true;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
} catch (err) {
|
|
311
|
-
_iterator.e(err);
|
|
312
|
-
} finally {
|
|
313
|
-
_iterator.f();
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
239
|
}]);
|
|
317
240
|
return ScheduleModule;
|
|
318
241
|
}(BaseModule);
|
package/dist/modules/index.d.ts
CHANGED
package/dist/modules/index.js
CHANGED
package/dist/plugins/window.d.ts
CHANGED
|
@@ -299,6 +299,16 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
299
299
|
errorList: any[];
|
|
300
300
|
};
|
|
301
301
|
getTimeSlotByAllResources(resources_code: string): any[];
|
|
302
|
+
getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
|
|
303
|
+
resources_code: string;
|
|
304
|
+
startDate: string;
|
|
305
|
+
endDate: string;
|
|
306
|
+
}): Promise<{
|
|
307
|
+
date: string;
|
|
308
|
+
status: string;
|
|
309
|
+
week: string;
|
|
310
|
+
weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
311
|
+
}[]>;
|
|
302
312
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
303
313
|
private getScheduleDataByIds;
|
|
304
314
|
openProductDetail(productId: number): Promise<void>;
|
|
@@ -316,6 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
316
326
|
count: number;
|
|
317
327
|
left: number;
|
|
318
328
|
summaryCount: number;
|
|
329
|
+
status: keyof TimeStatusMap;
|
|
319
330
|
}[];
|
|
320
331
|
/**
|
|
321
332
|
* 找到多个资源的公共可用时间段
|
|
@@ -380,3 +391,9 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
380
391
|
*/
|
|
381
392
|
getContactInfo(params: any): Promise<any>;
|
|
382
393
|
}
|
|
394
|
+
interface TimeStatusMap {
|
|
395
|
+
lots_of_space: true;
|
|
396
|
+
filling_up_fast: true;
|
|
397
|
+
sold_out: true;
|
|
398
|
+
}
|
|
399
|
+
export {};
|