@pisell/pisellos 3.0.76 → 3.0.77
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/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 +15 -37
- package/dist/modules/Resource/index.js +1 -1
- package/dist/modules/Rules/index.d.ts +1 -2
- package/dist/modules/Rules/index.js +26 -66
- package/dist/modules/Rules/types.d.ts +0 -1
- 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.js +13 -43
- package/dist/solution/BookingByStep/utils/capacity.js +1 -1
- package/dist/solution/BookingByStep/utils/products.d.ts +0 -6
- package/dist/solution/BookingByStep/utils/products.js +0 -10
- package/dist/solution/BuyTickets/index.js +8 -7
- package/dist/solution/ShopDiscount/index.d.ts +10 -10
- package/dist/solution/ShopDiscount/index.js +57 -107
- 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/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 +12 -31
- package/lib/modules/Resource/index.js +1 -1
- package/lib/modules/Rules/index.d.ts +1 -2
- package/lib/modules/Rules/index.js +24 -41
- package/lib/modules/Rules/types.d.ts +0 -1
- 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.js +6 -18
- package/lib/solution/BookingByStep/utils/capacity.js +1 -1
- package/lib/solution/BookingByStep/utils/products.d.ts +0 -6
- package/lib/solution/BookingByStep/utils/products.js +2 -8
- package/lib/solution/BuyTickets/index.js +8 -7
- package/lib/solution/ShopDiscount/index.d.ts +10 -10
- package/lib/solution/ShopDiscount/index.js +21 -47
- 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
|
@@ -25,11 +25,11 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
25
25
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
26
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); }
|
|
27
27
|
import { BaseModule } from "../../modules/BaseModule";
|
|
28
|
+
import { ShopDiscountHooks } from "./types";
|
|
28
29
|
import { DiscountModule } from "../../modules/Discount";
|
|
29
30
|
import { RulesModule } from "../../modules/Rules";
|
|
30
31
|
import { filterDiscountListByBookingTime as _filterDiscountListByBookingTime, isAllNormalProduct } from "./utils";
|
|
31
32
|
import Decimal from 'decimal.js';
|
|
32
|
-
import { isBoolean } from 'lodash-es';
|
|
33
33
|
export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
34
34
|
_inherits(ShopDiscountImpl, _BaseModule);
|
|
35
35
|
var _super = _createSuper(ShopDiscountImpl);
|
|
@@ -108,7 +108,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
108
108
|
(_this$store$rules = this.store.rules) === null || _this$store$rules === void 0 || _this$store$rules.destroy();
|
|
109
109
|
this.core.effects.offByModuleDestroy(this.name);
|
|
110
110
|
_context2.next = 7;
|
|
111
|
-
return this.core.effects.emit(
|
|
111
|
+
return this.core.effects.emit(ShopDiscountHooks.onDestroy, {});
|
|
112
112
|
case 7:
|
|
113
113
|
console.log('[ShopDiscount] 已销毁');
|
|
114
114
|
case 8:
|
|
@@ -196,7 +196,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
196
196
|
key: "registerEventListeners",
|
|
197
197
|
value: function registerEventListeners() {
|
|
198
198
|
var _this2 = this;
|
|
199
|
-
this.core.effects.
|
|
199
|
+
this.core.effects.on(ShopDiscountHooks.onCustomerChange, function (customer) {
|
|
200
200
|
var _this2$options$otherP;
|
|
201
201
|
if ((_this2$options$otherP = _this2.options.otherParams) !== null && _this2$options$otherP !== void 0 && _this2$options$otherP.cacheId && _this2.getDiscountList().length) {
|
|
202
202
|
return;
|
|
@@ -276,7 +276,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
276
276
|
}
|
|
277
277
|
this.store.customer = customer;
|
|
278
278
|
_context4.next = 4;
|
|
279
|
-
return this.core.effects.emit(
|
|
279
|
+
return this.core.effects.emit(ShopDiscountHooks.onCustomerChange, customer);
|
|
280
280
|
case 4:
|
|
281
281
|
case "end":
|
|
282
282
|
return _context4.stop();
|
|
@@ -335,38 +335,19 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
335
335
|
// 设置优惠券使用状态
|
|
336
336
|
}, {
|
|
337
337
|
key: "setDiscountSelected",
|
|
338
|
-
value: function setDiscountSelected(
|
|
338
|
+
value: function setDiscountSelected(_ref2) {
|
|
339
|
+
var discountId = _ref2.discountId,
|
|
340
|
+
isSelected = _ref2.isSelected;
|
|
339
341
|
// 获取当前优惠券列表
|
|
340
342
|
var discountList = this.getDiscountList();
|
|
341
343
|
|
|
342
|
-
// 构建选择操作列表
|
|
343
|
-
var selectionOperations = [];
|
|
344
|
-
|
|
345
|
-
// 主要操作
|
|
346
|
-
selectionOperations.push({
|
|
347
|
-
discountId: params.discountId,
|
|
348
|
-
isSelected: params.isSelected
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
// 如果有批量操作列表,添加到操作列表中
|
|
352
|
-
if (params.selectedList && params.selectedList.length > 0) {
|
|
353
|
-
selectionOperations.push.apply(selectionOperations, _toConsumableArray(params.selectedList));
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
// 创建选择状态映射(去重处理,后面的操作会覆盖前面的)
|
|
357
|
-
var selectionMap = new Map();
|
|
358
|
-
selectionOperations.forEach(function (operation) {
|
|
359
|
-
selectionMap.set(operation.discountId, operation.isSelected);
|
|
360
|
-
});
|
|
361
|
-
|
|
362
344
|
// 找到需要修改状态的优惠券
|
|
363
345
|
var newDiscountList = discountList.map(function (discount) {
|
|
364
|
-
if (
|
|
365
|
-
var targetIsSelected = selectionMap.get(discount.id);
|
|
346
|
+
if (discount.id === discountId) {
|
|
366
347
|
return _objectSpread(_objectSpread({}, discount), {}, {
|
|
367
|
-
isSelected:
|
|
348
|
+
isSelected: isSelected,
|
|
368
349
|
// 手动设置不使用
|
|
369
|
-
isManualSelect: !
|
|
350
|
+
isManualSelect: !isSelected
|
|
370
351
|
});
|
|
371
352
|
}
|
|
372
353
|
return _objectSpread(_objectSpread({}, discount), {}, {
|
|
@@ -376,7 +357,12 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
376
357
|
|
|
377
358
|
// 更新优惠券列表
|
|
378
359
|
this.setDiscountList(newDiscountList);
|
|
379
|
-
|
|
360
|
+
|
|
361
|
+
// 如果取消选择优惠券,需要重新计算其他可用优惠券
|
|
362
|
+
return this.calcDiscount(this.store.productList || [], {
|
|
363
|
+
discountId: discountId,
|
|
364
|
+
isSelected: isSelected
|
|
365
|
+
});
|
|
380
366
|
}
|
|
381
367
|
}, {
|
|
382
368
|
key: "setProductList",
|
|
@@ -389,7 +375,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
389
375
|
key: "scanCode",
|
|
390
376
|
value: function () {
|
|
391
377
|
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(code, customerId) {
|
|
392
|
-
var _this$store$discount3, _this$store$bookingSu2, resultDiscountList, rulesModule, withScanList, currentSelectedDiscountList,
|
|
378
|
+
var _this$store$discount3, _this$store$bookingSu2, resultDiscountList, rulesModule, withScanList, currentSelectedDiscountList, _ref3, newProductList, newDiscountList, isAvailable, _this$options$otherPa6;
|
|
393
379
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
394
380
|
while (1) switch (_context5.prev = _context5.next) {
|
|
395
381
|
case 0:
|
|
@@ -451,7 +437,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
451
437
|
discountList: this.getDiscountList()
|
|
452
438
|
});
|
|
453
439
|
case 16:
|
|
454
|
-
|
|
440
|
+
_ref3 = rulesModule.isDiscountListAvailable({
|
|
455
441
|
productList: this.store.productList || [],
|
|
456
442
|
oldDiscountList: this.getDiscountList(),
|
|
457
443
|
newDiscountList: withScanList,
|
|
@@ -461,29 +447,28 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
461
447
|
isAvailable: false,
|
|
462
448
|
productList: this.store.productList || [],
|
|
463
449
|
discountList: this.getDiscountList()
|
|
464
|
-
}, newProductList =
|
|
450
|
+
}, newProductList = _ref3.productList, newDiscountList = _ref3.discountList, isAvailable = _ref3.isAvailable;
|
|
465
451
|
if (!isAvailable) {
|
|
466
|
-
_context5.next =
|
|
452
|
+
_context5.next = 23;
|
|
467
453
|
break;
|
|
468
454
|
}
|
|
469
455
|
this.setDiscountList(newDiscountList || []);
|
|
470
|
-
this.store.originalDiscountList = newDiscountList || [];
|
|
471
456
|
this.setProductList(newProductList || []);
|
|
472
457
|
if (!(this.isWalkIn() && resultDiscountList.length && ((_this$options$otherPa6 = this.options.otherParams) === null || _this$options$otherPa6 === void 0 ? void 0 : _this$options$otherPa6.platform) === 'shop')) {
|
|
473
|
-
_context5.next =
|
|
458
|
+
_context5.next = 23;
|
|
474
459
|
break;
|
|
475
460
|
}
|
|
476
|
-
_context5.next =
|
|
461
|
+
_context5.next = 23;
|
|
477
462
|
return this.getCustomerWallet(resultDiscountList[0].customer_id);
|
|
478
|
-
case
|
|
463
|
+
case 23:
|
|
479
464
|
return _context5.abrupt("return", {
|
|
480
465
|
type: "clientCalc",
|
|
481
466
|
isAvailable: isAvailable || false,
|
|
482
467
|
productList: newProductList || this.store.productList || [],
|
|
483
468
|
discountList: newDiscountList || this.getDiscountList()
|
|
484
469
|
});
|
|
485
|
-
case
|
|
486
|
-
_context5.prev =
|
|
470
|
+
case 26:
|
|
471
|
+
_context5.prev = 26;
|
|
487
472
|
_context5.t1 = _context5["catch"](0);
|
|
488
473
|
console.error('[ShopDiscount] 扫码出错:', _context5.t1);
|
|
489
474
|
return _context5.abrupt("return", {
|
|
@@ -492,11 +477,11 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
492
477
|
productList: this.store.productList || [],
|
|
493
478
|
discountList: this.getDiscountList()
|
|
494
479
|
});
|
|
495
|
-
case
|
|
480
|
+
case 30:
|
|
496
481
|
case "end":
|
|
497
482
|
return _context5.stop();
|
|
498
483
|
}
|
|
499
|
-
}, _callee5, this, [[0,
|
|
484
|
+
}, _callee5, this, [[0, 26]]);
|
|
500
485
|
}));
|
|
501
486
|
function scanCode(_x4, _x5) {
|
|
502
487
|
return _scanCode.apply(this, arguments);
|
|
@@ -536,7 +521,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
536
521
|
while (1) switch (_context6.prev = _context6.next) {
|
|
537
522
|
case 0:
|
|
538
523
|
_context6.next = 2;
|
|
539
|
-
return this.core.effects.emit(
|
|
524
|
+
return this.core.effects.emit(ShopDiscountHooks.onDiscountListChange, discountList);
|
|
540
525
|
case 2:
|
|
541
526
|
case "end":
|
|
542
527
|
return _context6.stop();
|
|
@@ -577,7 +562,6 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
577
562
|
discount.tag = discount.type;
|
|
578
563
|
}
|
|
579
564
|
editModeDiscountList.push(_objectSpread(_objectSpread({}, discount), {}, {
|
|
580
|
-
name: discount.name || discount.discount.title.auto,
|
|
581
565
|
isEditMode: true,
|
|
582
566
|
limited_relation_product_data: {},
|
|
583
567
|
savedAmount: new Decimal(discount.amount || 0).times((product === null || product === void 0 ? void 0 : product.quantity) || (product === null || product === void 0 ? void 0 : product.num) || 1).plus((discount === null || discount === void 0 || (_discount$metadata2 = discount.metadata) === null || _discount$metadata2 === void 0 ? void 0 : _discount$metadata2.product_discount_difference) || 0).toNumber(),
|
|
@@ -603,9 +587,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
603
587
|
});
|
|
604
588
|
if (!targetProduct) return false;
|
|
605
589
|
var product = (_this3$hooks2 = _this3.hooks) === null || _this3$hooks2 === void 0 ? void 0 : _this3$hooks2.getProduct(targetProduct);
|
|
606
|
-
// 如果 product.total
|
|
607
|
-
|
|
608
|
-
return Number(product === null || product === void 0 ? void 0 : product.total) <= 0 && (Number(product === null || product === void 0 ? void 0 : product.origin_total) <= 0 || !(product !== null && product !== void 0 && product.origin_total)) || isBoolean(product === null || product === void 0 ? void 0 : product.vouchersApplicable) && !(product !== null && product !== void 0 && product.vouchersApplicable);
|
|
590
|
+
// 如果 product.total 是 0有可能是她已经用过商品券或者折扣卡导致的 0,所以此时还需要判断 origin_total 是否为 0
|
|
591
|
+
return Number(product === null || product === void 0 ? void 0 : product.total) === 0 && (Number(product === null || product === void 0 ? void 0 : product.origin_total) === 0 || !(product !== null && product !== void 0 && product.origin_total));
|
|
609
592
|
};
|
|
610
593
|
var allUsedProductIds = newDiscountList.filter(function (item) {
|
|
611
594
|
return !(item !== null && item !== void 0 && item.isEditMode);
|
|
@@ -653,7 +636,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
653
636
|
key: "getCustomerWallet",
|
|
654
637
|
value: function () {
|
|
655
638
|
var _getCustomerWallet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(id) {
|
|
656
|
-
var
|
|
639
|
+
var result, customer;
|
|
657
640
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
658
641
|
while (1) switch (_context7.prev = _context7.next) {
|
|
659
642
|
case 0:
|
|
@@ -663,15 +646,15 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
663
646
|
with_trashed: 1
|
|
664
647
|
});
|
|
665
648
|
case 3:
|
|
666
|
-
|
|
667
|
-
if (!(
|
|
649
|
+
result = _context7.sent;
|
|
650
|
+
if (!(result !== null && result !== void 0 && result.data)) {
|
|
668
651
|
_context7.next = 9;
|
|
669
652
|
break;
|
|
670
653
|
}
|
|
671
|
-
customer = Object.assign({}, (_objectDestructuringEmpty(
|
|
654
|
+
customer = Object.assign({}, (_objectDestructuringEmpty(result.data), result.data));
|
|
672
655
|
this.setCustomer(customer);
|
|
673
656
|
_context7.next = 9;
|
|
674
|
-
return this.core.effects.emit(
|
|
657
|
+
return this.core.effects.emit(ShopDiscountHooks.onScanCustomerChange, customer);
|
|
675
658
|
case 9:
|
|
676
659
|
_context7.next = 14;
|
|
677
660
|
break;
|
|
@@ -689,53 +672,20 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
689
672
|
return _getCustomerWallet.apply(this, arguments);
|
|
690
673
|
}
|
|
691
674
|
return getCustomerWallet;
|
|
692
|
-
}()
|
|
693
|
-
}, {
|
|
694
|
-
key: "bestDiscount",
|
|
695
|
-
value: function () {
|
|
696
|
-
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(cb) {
|
|
697
|
-
var _this$store$productLi;
|
|
698
|
-
var newDiscountList, _result2;
|
|
699
|
-
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
700
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
701
|
-
case 0:
|
|
702
|
-
newDiscountList = this.store.originalDiscountList;
|
|
703
|
-
this.setDiscountList(newDiscountList);
|
|
704
|
-
if (!((_this$store$productLi = this.store.productList) !== null && _this$store$productLi !== void 0 && _this$store$productLi.length)) {
|
|
705
|
-
_context8.next = 7;
|
|
706
|
-
break;
|
|
707
|
-
}
|
|
708
|
-
_result2 = this.calcDiscount(this.store.productList);
|
|
709
|
-
cb === null || cb === void 0 || cb(_result2);
|
|
710
|
-
_context8.next = 7;
|
|
711
|
-
return this.core.effects.emit("".concat(this.name, ":onLoadPrepareCalcResult"), _result2);
|
|
712
|
-
case 7:
|
|
713
|
-
_context8.next = 9;
|
|
714
|
-
return this.core.effects.emit("".concat(this.name, ":onLoadDiscountList"), newDiscountList);
|
|
715
|
-
case 9:
|
|
716
|
-
case "end":
|
|
717
|
-
return _context8.stop();
|
|
718
|
-
}
|
|
719
|
-
}, _callee8, this);
|
|
720
|
-
}));
|
|
721
|
-
function bestDiscount(_x8) {
|
|
722
|
-
return _bestDiscount.apply(this, arguments);
|
|
723
|
-
}
|
|
724
|
-
return bestDiscount;
|
|
725
675
|
}() // 加载准备配置
|
|
726
676
|
}, {
|
|
727
677
|
key: "loadPrepareConfig",
|
|
728
678
|
value: function () {
|
|
729
|
-
var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
730
|
-
var _this$getCustomer2, _this$store$discount7, _this$getDiscountList, _this$store$discount8, _this$store$
|
|
731
|
-
return _regeneratorRuntime().wrap(function
|
|
732
|
-
while (1) switch (
|
|
679
|
+
var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
|
|
680
|
+
var _this$getCustomer2, _this$store$discount7, _this$getDiscountList, _this$store$discount8, _this$store$productLi, customerId, goodPassList, scanDiscount, scanDiscountIds, newGoodPassList, newDiscountList, filteredDiscountList, result;
|
|
681
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
682
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
733
683
|
case 0:
|
|
734
|
-
|
|
684
|
+
_context8.prev = 0;
|
|
735
685
|
customerId = params.customerId || ((_this$getCustomer2 = this.getCustomer()) === null || _this$getCustomer2 === void 0 ? void 0 : _this$getCustomer2.id); // if (customerId === 1 || !customerId) {
|
|
736
686
|
// return
|
|
737
687
|
// }
|
|
738
|
-
|
|
688
|
+
_context8.next = 4;
|
|
739
689
|
return (_this$store$discount7 = this.store.discount) === null || _this$store$discount7 === void 0 ? void 0 : _this$store$discount7.loadPrepareConfig({
|
|
740
690
|
customer_id: customerId,
|
|
741
691
|
action: 'create',
|
|
@@ -744,7 +694,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
744
694
|
with_wallet_pass_holder: 1
|
|
745
695
|
});
|
|
746
696
|
case 4:
|
|
747
|
-
goodPassList =
|
|
697
|
+
goodPassList = _context8.sent;
|
|
748
698
|
scanDiscount = (_this$getDiscountList = this.getDiscountList()) === null || _this$getDiscountList === void 0 ? void 0 : _this$getDiscountList.filter(function (item) {
|
|
749
699
|
return item.isScan;
|
|
750
700
|
}); // goodPassList 里可能有 scanDiscount 重合的部分,goodPassList 需要剔除
|
|
@@ -756,37 +706,37 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
756
706
|
});
|
|
757
707
|
newDiscountList = [].concat(_toConsumableArray(scanDiscount), _toConsumableArray(newGoodPassList || [])); // 存储原始优惠券列表
|
|
758
708
|
this.store.originalDiscountList = newDiscountList;
|
|
759
|
-
|
|
709
|
+
_context8.next = 12;
|
|
760
710
|
return (_this$store$discount8 = this.store.discount) === null || _this$store$discount8 === void 0 ? void 0 : _this$store$discount8.setOriginalDiscountList(newDiscountList);
|
|
761
711
|
case 12:
|
|
762
712
|
// 根据当前预约时间过滤优惠券列表
|
|
763
713
|
filteredDiscountList = this.filterDiscountListByBookingTime(newDiscountList, this.store.currentBookingTime);
|
|
764
714
|
this.store.filteredDiscountList = filteredDiscountList;
|
|
765
715
|
this.setDiscountList(filteredDiscountList || []);
|
|
766
|
-
if (!((_this$store$
|
|
767
|
-
|
|
716
|
+
if (!((_this$store$productLi = this.store.productList) !== null && _this$store$productLi !== void 0 && _this$store$productLi.length)) {
|
|
717
|
+
_context8.next = 19;
|
|
768
718
|
break;
|
|
769
719
|
}
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
return this.core.effects.emit(
|
|
720
|
+
result = this.calcDiscount(this.store.productList);
|
|
721
|
+
_context8.next = 19;
|
|
722
|
+
return this.core.effects.emit(ShopDiscountHooks.onLoadPrepareCalcResult, result);
|
|
773
723
|
case 19:
|
|
774
|
-
|
|
775
|
-
return this.core.effects.emit(
|
|
724
|
+
_context8.next = 21;
|
|
725
|
+
return this.core.effects.emit(ShopDiscountHooks.onLoadDiscountList, filteredDiscountList);
|
|
776
726
|
case 21:
|
|
777
|
-
|
|
727
|
+
_context8.next = 26;
|
|
778
728
|
break;
|
|
779
729
|
case 23:
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
console.error('[ShopDiscount] 加载准备配置出错:',
|
|
730
|
+
_context8.prev = 23;
|
|
731
|
+
_context8.t0 = _context8["catch"](0);
|
|
732
|
+
console.error('[ShopDiscount] 加载准备配置出错:', _context8.t0);
|
|
783
733
|
case 26:
|
|
784
734
|
case "end":
|
|
785
|
-
return
|
|
735
|
+
return _context8.stop();
|
|
786
736
|
}
|
|
787
|
-
},
|
|
737
|
+
}, _callee8, this, [[0, 23]]);
|
|
788
738
|
}));
|
|
789
|
-
function loadPrepareConfig(
|
|
739
|
+
function loadPrepareConfig(_x8) {
|
|
790
740
|
return _loadPrepareConfig.apply(this, arguments);
|
|
791
741
|
}
|
|
792
742
|
return loadPrepareConfig;
|
package/dist/solution/index.d.ts
CHANGED
package/dist/solution/index.js
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -38,10 +38,7 @@ export interface PisellCore {
|
|
|
38
38
|
getModuleExports: <T = any>(name: string) => T | null;
|
|
39
39
|
hasModule: (name: string) => boolean;
|
|
40
40
|
effects: {
|
|
41
|
-
on: (event: string, callback: (payload: any) => void) =>
|
|
42
|
-
once: (event: string, callback: (payload: any) => void) => () => void;
|
|
43
|
-
only: (event: string, callback: (payload: any) => void) => () => void;
|
|
44
|
-
off: (event: string, callback: (payload: any) => void) => void;
|
|
41
|
+
on: (event: string, callback: (payload: any) => void) => void;
|
|
45
42
|
emit: (event: string, payload: any, value?: any) => Promise<{
|
|
46
43
|
status: boolean;
|
|
47
44
|
data: any;
|
package/lib/core/index.js
CHANGED
|
@@ -61,7 +61,7 @@ var PisellOSCore = class {
|
|
|
61
61
|
console.log(`${prefix} ${message}`);
|
|
62
62
|
break;
|
|
63
63
|
case "warn":
|
|
64
|
-
console.
|
|
64
|
+
console.warn(`${prefix} ${message}`);
|
|
65
65
|
break;
|
|
66
66
|
case "error":
|
|
67
67
|
console.error(`${prefix} ${message}`);
|
package/lib/effects/index.d.ts
CHANGED
|
@@ -2,18 +2,16 @@ type EffectCallback = (payload: any) => void | Promise<void | {
|
|
|
2
2
|
status: boolean;
|
|
3
3
|
message?: string;
|
|
4
4
|
}>;
|
|
5
|
-
type UnsubscribeFunction = () => void;
|
|
6
5
|
declare class EffectsManager {
|
|
7
6
|
private listeners;
|
|
8
|
-
on(event: string, callback: EffectCallback):
|
|
9
|
-
only(event: string, callback: EffectCallback): UnsubscribeFunction;
|
|
7
|
+
on(event: string, callback: EffectCallback): void;
|
|
10
8
|
off(event: string, callback: EffectCallback): void;
|
|
11
9
|
offByModuleDestroy(module: string): void;
|
|
12
|
-
once(event: string, callback: EffectCallback):
|
|
10
|
+
once(event: string, callback: EffectCallback): void;
|
|
13
11
|
emit(event: string, payload: any): Promise<{
|
|
14
12
|
status: boolean;
|
|
15
13
|
data: any;
|
|
16
14
|
}>;
|
|
17
15
|
clear(): void;
|
|
18
16
|
}
|
|
19
|
-
export { EffectsManager
|
|
17
|
+
export { EffectsManager };
|
package/lib/effects/index.js
CHANGED
|
@@ -31,22 +31,6 @@ var EffectsManager = class {
|
|
|
31
31
|
if (!this.listeners.has(event))
|
|
32
32
|
this.listeners.set(event, /* @__PURE__ */ new Set());
|
|
33
33
|
(_a = this.listeners.get(event)) == null ? void 0 : _a.add(callback);
|
|
34
|
-
return () => {
|
|
35
|
-
this.off(event, callback);
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
// 设置单例监听器,只能存在一个,新的会替换旧的
|
|
39
|
-
only(event, callback) {
|
|
40
|
-
var _a, _b;
|
|
41
|
-
if (this.listeners.has(event)) {
|
|
42
|
-
(_a = this.listeners.get(event)) == null ? void 0 : _a.clear();
|
|
43
|
-
} else {
|
|
44
|
-
this.listeners.set(event, /* @__PURE__ */ new Set());
|
|
45
|
-
}
|
|
46
|
-
(_b = this.listeners.get(event)) == null ? void 0 : _b.add(callback);
|
|
47
|
-
return () => {
|
|
48
|
-
this.off(event, callback);
|
|
49
|
-
};
|
|
50
34
|
}
|
|
51
35
|
off(event, callback) {
|
|
52
36
|
var _a;
|
|
@@ -65,7 +49,7 @@ var EffectsManager = class {
|
|
|
65
49
|
await callback(payload);
|
|
66
50
|
this.off(event, wrapper);
|
|
67
51
|
};
|
|
68
|
-
|
|
52
|
+
this.on(event, wrapper);
|
|
69
53
|
}
|
|
70
54
|
async emit(event, payload) {
|
|
71
55
|
const callbacks = this.listeners.get(event);
|
|
@@ -24,6 +24,7 @@ __export(Account_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(Account_exports);
|
|
26
26
|
var import_BaseModule = require("../BaseModule");
|
|
27
|
+
var import_types = require("./types");
|
|
27
28
|
__reExport(Account_exports, require("./types"), module.exports);
|
|
28
29
|
var AccountModule = class extends import_BaseModule.BaseModule {
|
|
29
30
|
constructor(name, version) {
|
|
@@ -58,7 +59,7 @@ var AccountModule = class extends import_BaseModule.BaseModule {
|
|
|
58
59
|
};
|
|
59
60
|
this.store.accountInfo = account;
|
|
60
61
|
this.store.isLoggedIn = true;
|
|
61
|
-
await this.core.effects.emit(
|
|
62
|
+
await this.core.effects.emit(import_types.AccountHooks.OnLogin, account);
|
|
62
63
|
}
|
|
63
64
|
getCurrentAccount() {
|
|
64
65
|
return this.store.accountInfo;
|
|
@@ -71,7 +72,7 @@ var AccountModule = class extends import_BaseModule.BaseModule {
|
|
|
71
72
|
...updates
|
|
72
73
|
};
|
|
73
74
|
await this.core.effects.emit(
|
|
74
|
-
|
|
75
|
+
import_types.AccountHooks.OnProfileUpdate,
|
|
75
76
|
this.store.accountInfo
|
|
76
77
|
);
|
|
77
78
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { AccountModule, Account } from '../Account';
|
|
3
3
|
import { BaseModule } from '../BaseModule';
|
|
4
|
-
import { IFetchHolderAccountsParams, IHolder
|
|
4
|
+
import { IFetchHolderAccountsParams, IHolder } from './types';
|
|
5
5
|
export declare class AccountListModule extends BaseModule implements Module {
|
|
6
6
|
protected defaultName: string;
|
|
7
7
|
protected defaultVersion: string;
|
|
@@ -37,12 +37,6 @@ export declare class AccountListModule extends BaseModule implements Module {
|
|
|
37
37
|
customerId: number;
|
|
38
38
|
type?: 'unshift' | 'push';
|
|
39
39
|
}): Promise<AccountModule[]>;
|
|
40
|
-
/**
|
|
41
|
-
* 获取客户列表
|
|
42
|
-
* @param params 查询参数
|
|
43
|
-
* @returns 客户列表
|
|
44
|
-
*/
|
|
45
|
-
getCustomerList(params?: IGetCustomerListParams): Promise<any>;
|
|
46
40
|
/**
|
|
47
41
|
* 获取holder类型账户列表
|
|
48
42
|
* @param params
|
|
@@ -288,33 +288,6 @@ var AccountListModule = class extends import_BaseModule.BaseModule {
|
|
|
288
288
|
);
|
|
289
289
|
return accountModules;
|
|
290
290
|
}
|
|
291
|
-
/**
|
|
292
|
-
* 获取客户列表
|
|
293
|
-
* @param params 查询参数
|
|
294
|
-
* @returns 客户列表
|
|
295
|
-
*/
|
|
296
|
-
async getCustomerList(params = {}) {
|
|
297
|
-
const url = "/customer/es/data";
|
|
298
|
-
const { page = 1, pageSize = 20, keyword, ...otherParams } = params;
|
|
299
|
-
try {
|
|
300
|
-
this.store.isLoading = true;
|
|
301
|
-
this.store.error = null;
|
|
302
|
-
const queryParams = {
|
|
303
|
-
page,
|
|
304
|
-
pageSize,
|
|
305
|
-
...keyword && { keyword },
|
|
306
|
-
...otherParams
|
|
307
|
-
};
|
|
308
|
-
const res = await this.request.get(url, queryParams);
|
|
309
|
-
return (res == null ? void 0 : res.data) || [];
|
|
310
|
-
} catch (error) {
|
|
311
|
-
console.error("Failed to fetch customer list:", error);
|
|
312
|
-
this.store.error = error instanceof Error ? error.message : "Failed to fetch customer list";
|
|
313
|
-
throw error;
|
|
314
|
-
} finally {
|
|
315
|
-
this.store.isLoading = false;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
291
|
/**
|
|
319
292
|
* 获取holder类型账户列表
|
|
320
293
|
* @param params
|
|
@@ -67,31 +67,3 @@ export interface IHolder {
|
|
|
67
67
|
main_field: string;
|
|
68
68
|
customer_cover?: string;
|
|
69
69
|
}
|
|
70
|
-
/**
|
|
71
|
-
* 获取客户列表参数
|
|
72
|
-
*/
|
|
73
|
-
export interface IGetCustomerListParams {
|
|
74
|
-
/** 页码 */
|
|
75
|
-
page?: number;
|
|
76
|
-
/** 每页数量 */
|
|
77
|
-
pageSize?: number;
|
|
78
|
-
/** 搜索关键词 */
|
|
79
|
-
keyword?: string;
|
|
80
|
-
/** 其他筛选参数 */
|
|
81
|
-
[key: string]: any;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* 客户数据
|
|
85
|
-
*/
|
|
86
|
-
export interface ICustomer {
|
|
87
|
-
/** 客户ID */
|
|
88
|
-
id: string | number;
|
|
89
|
-
/** 客户姓名 */
|
|
90
|
-
name: string;
|
|
91
|
-
/** 客户电话 */
|
|
92
|
-
phone?: string;
|
|
93
|
-
/** 客户邮箱 */
|
|
94
|
-
email?: string;
|
|
95
|
-
/** 其他客户信息 */
|
|
96
|
-
[key: string]: any;
|
|
97
|
-
}
|
|
@@ -14,7 +14,4 @@ export declare class BaseModule {
|
|
|
14
14
|
store: any;
|
|
15
15
|
cacheKey: string[];
|
|
16
16
|
}): void;
|
|
17
|
-
effectsOn(eventType: string, callback: (payload: any) => void): () => void;
|
|
18
|
-
effectsOff(eventType: string, callback: (payload: any) => void): void;
|
|
19
|
-
effectsOnce(eventType: string, callback: (payload: any) => void): () => void;
|
|
20
17
|
}
|
|
@@ -82,15 +82,6 @@ var BaseModule = class {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
effectsOn(eventType, callback) {
|
|
86
|
-
return this.core.effects.on(`${this.name}:${eventType}`, callback);
|
|
87
|
-
}
|
|
88
|
-
effectsOff(eventType, callback) {
|
|
89
|
-
return this.core.effects.off(`${this.name}:${eventType}`, callback);
|
|
90
|
-
}
|
|
91
|
-
effectsOnce(eventType, callback) {
|
|
92
|
-
return this.core.effects.once(`${this.name}:${eventType}`, callback);
|
|
93
|
-
}
|
|
94
85
|
};
|
|
95
86
|
// Annotate the CommonJS export names for ESM import in node:
|
|
96
87
|
0 && (module.exports = {
|
|
@@ -3,7 +3,6 @@ import { BaseModule } from '../BaseModule';
|
|
|
3
3
|
import { CartItem, CartModuleAPI, ECartItemCheckType, ECartItemInfoType, IAddItemParams, IUpdateItemParams } from './types';
|
|
4
4
|
import { Account } from '../Account';
|
|
5
5
|
export * from './types';
|
|
6
|
-
export { getProductDeposit } from './utils';
|
|
7
6
|
/**
|
|
8
7
|
* 购物车模块实现
|
|
9
8
|
*/
|
|
@@ -20,8 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/modules/Cart/index.ts
|
|
21
21
|
var Cart_exports = {};
|
|
22
22
|
__export(Cart_exports, {
|
|
23
|
-
CartModule: () => CartModule
|
|
24
|
-
getProductDeposit: () => import_utils3.getProductDeposit
|
|
23
|
+
CartModule: () => CartModule
|
|
25
24
|
});
|
|
26
25
|
module.exports = __toCommonJS(Cart_exports);
|
|
27
26
|
var import_BaseModule = require("../BaseModule");
|
|
@@ -30,10 +29,9 @@ var import_utils = require("./utils");
|
|
|
30
29
|
var import_lodash_es = require("lodash-es");
|
|
31
30
|
var import_utils2 = require("../Product/utils");
|
|
32
31
|
__reExport(Cart_exports, require("./types"), module.exports);
|
|
33
|
-
var import_utils3 = require("./utils");
|
|
34
32
|
var CartModule = class extends import_BaseModule.BaseModule {
|
|
35
33
|
constructor(name, version) {
|
|
36
|
-
super(name
|
|
34
|
+
super(name, version);
|
|
37
35
|
// 提供给 baseModule 用的默认名称 和 默认版本
|
|
38
36
|
this.defaultName = "cart";
|
|
39
37
|
this.defaultVersion = "1.0.0";
|
|
@@ -363,6 +361,5 @@ var CartModule = class extends import_BaseModule.BaseModule {
|
|
|
363
361
|
// Annotate the CommonJS export names for ESM import in node:
|
|
364
362
|
0 && (module.exports = {
|
|
365
363
|
CartModule,
|
|
366
|
-
getProductDeposit,
|
|
367
364
|
...require("./types")
|
|
368
365
|
});
|