@pisell/pisellos 2.0.67 → 2.1.2
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 -4
- package/dist/effects/index.js +6 -15
- 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/Cart/utils/changePrice.d.ts +2 -2
- package/dist/modules/Cart/utils/changePrice.js +1 -1
- package/dist/modules/ProductList/index.d.ts +3 -14
- package/dist/modules/ProductList/index.js +33 -67
- package/dist/modules/ProductList/types.d.ts +0 -1
- package/dist/modules/Rules/index.js +14 -27
- package/dist/modules/Rules/types.d.ts +0 -1
- 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 +50 -34
- package/dist/solution/BookingByStep/types.d.ts +3 -2
- package/dist/solution/BookingByStep/utils/resources.js +12 -4
- package/dist/solution/BuyTickets/index.d.ts +2 -2
- package/dist/solution/BuyTickets/index.js +1 -1
- package/dist/solution/ShopDiscount/index.js +2 -4
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +0 -1
- package/dist/types/index.d.ts +1 -3
- package/lib/core/index.js +1 -1
- package/lib/effects/index.d.ts +3 -4
- package/lib/effects/index.js +1 -4
- 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/Cart/utils/changePrice.d.ts +2 -2
- package/lib/modules/Cart/utils/changePrice.js +1 -1
- package/lib/modules/ProductList/index.d.ts +3 -14
- package/lib/modules/ProductList/index.js +14 -54
- package/lib/modules/ProductList/types.d.ts +0 -1
- package/lib/modules/Rules/index.js +12 -20
- package/lib/modules/Rules/types.d.ts +0 -1
- 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 +39 -27
- package/lib/solution/BookingByStep/types.d.ts +3 -2
- package/lib/solution/BookingByStep/utils/resources.js +12 -4
- package/lib/solution/BuyTickets/index.d.ts +2 -2
- package/lib/solution/BuyTickets/index.js +1 -1
- package/lib/solution/ShopDiscount/index.js +1 -2
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +0 -2
- package/lib/types/index.d.ts +1 -3
- package/package.json +1 -1
- 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 -697
- package/dist/modules/Customer/types.d.ts +0 -146
- package/dist/modules/Customer/types.js +0 -41
- package/dist/solution/BookingTicket/index.d.ts +0 -172
- package/dist/solution/BookingTicket/index.js +0 -665
- 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 -16
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +0 -174
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -81
- package/dist/solution/BookingTicket/utils/scan/index.js +0 -285
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/dist/solution/BookingTicket/utils/scan/scanCache.js +0 -305
- 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 -440
- package/lib/modules/Customer/types.d.ts +0 -146
- package/lib/modules/Customer/types.js +0 -37
- package/lib/solution/BookingTicket/index.d.ts +0 -172
- package/lib/solution/BookingTicket/index.js +0 -399
- 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 -16
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +0 -125
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -81
- package/lib/solution/BookingTicket/utils/scan/index.js +0 -210
- package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +0 -231
- 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
package/dist/core/index.js
CHANGED
|
@@ -67,8 +67,7 @@ var PisellOSCore = /*#__PURE__*/function () {
|
|
|
67
67
|
console.log("".concat(prefix, " ").concat(message));
|
|
68
68
|
break;
|
|
69
69
|
case 'warn':
|
|
70
|
-
|
|
71
|
-
console.log("%c".concat(prefix, "%c ").concat(message), 'color: #f59e0b; font-weight: bold;', 'color: #f59e0b;');
|
|
70
|
+
console.warn("".concat(prefix, " ").concat(message));
|
|
72
71
|
break;
|
|
73
72
|
case 'error':
|
|
74
73
|
console.error("".concat(prefix, " ").concat(message));
|
package/dist/effects/index.d.ts
CHANGED
|
@@ -2,17 +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):
|
|
7
|
+
on(event: string, callback: EffectCallback): void;
|
|
9
8
|
off(event: string, callback: EffectCallback): void;
|
|
10
9
|
offByModuleDestroy(module: string): void;
|
|
11
|
-
once(event: string, callback: EffectCallback):
|
|
10
|
+
once(event: string, callback: EffectCallback): void;
|
|
12
11
|
emit(event: string, payload: any): Promise<{
|
|
13
12
|
status: boolean;
|
|
14
13
|
data: any;
|
|
15
14
|
}>;
|
|
16
15
|
clear(): void;
|
|
17
16
|
}
|
|
18
|
-
export { EffectsManager
|
|
17
|
+
export { EffectsManager };
|
package/dist/effects/index.js
CHANGED
|
@@ -11,7 +11,6 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
11
11
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
12
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
13
13
|
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); }
|
|
14
|
-
// 取消监听函数类型
|
|
15
14
|
var EffectsManager = /*#__PURE__*/function () {
|
|
16
15
|
function EffectsManager() {
|
|
17
16
|
_classCallCheck(this, EffectsManager);
|
|
@@ -20,15 +19,9 @@ var EffectsManager = /*#__PURE__*/function () {
|
|
|
20
19
|
_createClass(EffectsManager, [{
|
|
21
20
|
key: "on",
|
|
22
21
|
value: function on(event, callback) {
|
|
23
|
-
var _this$listeners$get
|
|
24
|
-
_this = this;
|
|
22
|
+
var _this$listeners$get;
|
|
25
23
|
if (!this.listeners.has(event)) this.listeners.set(event, new Set());
|
|
26
24
|
(_this$listeners$get = this.listeners.get(event)) === null || _this$listeners$get === void 0 || _this$listeners$get.add(callback);
|
|
27
|
-
|
|
28
|
-
// 返回取消函数
|
|
29
|
-
return function () {
|
|
30
|
-
_this.off(event, callback);
|
|
31
|
-
};
|
|
32
25
|
}
|
|
33
26
|
}, {
|
|
34
27
|
key: "off",
|
|
@@ -41,17 +34,17 @@ var EffectsManager = /*#__PURE__*/function () {
|
|
|
41
34
|
}, {
|
|
42
35
|
key: "offByModuleDestroy",
|
|
43
36
|
value: function offByModuleDestroy(module) {
|
|
44
|
-
var
|
|
37
|
+
var _this = this;
|
|
45
38
|
Array.from(this.listeners.keys()).forEach(function (item) {
|
|
46
39
|
if (item.startsWith(module)) {
|
|
47
|
-
|
|
40
|
+
_this.listeners.delete(item);
|
|
48
41
|
}
|
|
49
42
|
});
|
|
50
43
|
}
|
|
51
44
|
}, {
|
|
52
45
|
key: "once",
|
|
53
46
|
value: function once(event, callback) {
|
|
54
|
-
var
|
|
47
|
+
var _this2 = this;
|
|
55
48
|
var wrapper = /*#__PURE__*/function () {
|
|
56
49
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(payload) {
|
|
57
50
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -60,7 +53,7 @@ var EffectsManager = /*#__PURE__*/function () {
|
|
|
60
53
|
_context.next = 2;
|
|
61
54
|
return callback(payload);
|
|
62
55
|
case 2:
|
|
63
|
-
|
|
56
|
+
_this2.off(event, wrapper);
|
|
64
57
|
case 3:
|
|
65
58
|
case "end":
|
|
66
59
|
return _context.stop();
|
|
@@ -71,9 +64,7 @@ var EffectsManager = /*#__PURE__*/function () {
|
|
|
71
64
|
return _ref.apply(this, arguments);
|
|
72
65
|
};
|
|
73
66
|
}();
|
|
74
|
-
|
|
75
|
-
// 调用修改后的on方法,它会返回取消函数
|
|
76
|
-
return this.on(event, wrapper);
|
|
67
|
+
this.on(event, wrapper);
|
|
77
68
|
}
|
|
78
69
|
}, {
|
|
79
70
|
key: "emit",
|
|
@@ -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
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
var _excluded = ["page", "pageSize", "keyword"];
|
|
2
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); }
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
6
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
7
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; } } }; }
|
|
8
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
9
4
|
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."); }
|
|
@@ -509,68 +504,6 @@ export var AccountListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
509
504
|
}
|
|
510
505
|
return addHolderAccounts;
|
|
511
506
|
}()
|
|
512
|
-
/**
|
|
513
|
-
* 获取客户列表
|
|
514
|
-
* @param params 查询参数
|
|
515
|
-
* @returns 客户列表
|
|
516
|
-
*/
|
|
517
|
-
)
|
|
518
|
-
}, {
|
|
519
|
-
key: "getCustomerList",
|
|
520
|
-
value: (function () {
|
|
521
|
-
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
522
|
-
var params,
|
|
523
|
-
url,
|
|
524
|
-
_params$page,
|
|
525
|
-
page,
|
|
526
|
-
_params$pageSize,
|
|
527
|
-
pageSize,
|
|
528
|
-
keyword,
|
|
529
|
-
otherParams,
|
|
530
|
-
queryParams,
|
|
531
|
-
res,
|
|
532
|
-
_args9 = arguments;
|
|
533
|
-
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
534
|
-
while (1) switch (_context9.prev = _context9.next) {
|
|
535
|
-
case 0:
|
|
536
|
-
params = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
|
|
537
|
-
url = '/customer/es/data';
|
|
538
|
-
_params$page = params.page, page = _params$page === void 0 ? 1 : _params$page, _params$pageSize = params.pageSize, pageSize = _params$pageSize === void 0 ? 20 : _params$pageSize, keyword = params.keyword, otherParams = _objectWithoutProperties(params, _excluded);
|
|
539
|
-
_context9.prev = 3;
|
|
540
|
-
this.store.isLoading = true;
|
|
541
|
-
this.store.error = null;
|
|
542
|
-
queryParams = _objectSpread(_objectSpread({
|
|
543
|
-
page: page,
|
|
544
|
-
pageSize: pageSize
|
|
545
|
-
}, keyword && {
|
|
546
|
-
keyword: keyword
|
|
547
|
-
}), otherParams);
|
|
548
|
-
_context9.next = 9;
|
|
549
|
-
return this.request.get(url, queryParams);
|
|
550
|
-
case 9:
|
|
551
|
-
res = _context9.sent;
|
|
552
|
-
return _context9.abrupt("return", (res === null || res === void 0 ? void 0 : res.data) || []);
|
|
553
|
-
case 13:
|
|
554
|
-
_context9.prev = 13;
|
|
555
|
-
_context9.t0 = _context9["catch"](3);
|
|
556
|
-
console.error('Failed to fetch customer list:', _context9.t0);
|
|
557
|
-
this.store.error = _context9.t0 instanceof Error ? _context9.t0.message : 'Failed to fetch customer list';
|
|
558
|
-
throw _context9.t0;
|
|
559
|
-
case 18:
|
|
560
|
-
_context9.prev = 18;
|
|
561
|
-
this.store.isLoading = false;
|
|
562
|
-
return _context9.finish(18);
|
|
563
|
-
case 21:
|
|
564
|
-
case "end":
|
|
565
|
-
return _context9.stop();
|
|
566
|
-
}
|
|
567
|
-
}, _callee9, this, [[3, 13, 18, 21]]);
|
|
568
|
-
}));
|
|
569
|
-
function getCustomerList() {
|
|
570
|
-
return _getCustomerList.apply(this, arguments);
|
|
571
|
-
}
|
|
572
|
-
return getCustomerList;
|
|
573
|
-
}()
|
|
574
507
|
/**
|
|
575
508
|
* 获取holder类型账户列表
|
|
576
509
|
* @param params
|
|
@@ -579,15 +512,15 @@ export var AccountListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
579
512
|
}, {
|
|
580
513
|
key: "fetchHolderAccounts",
|
|
581
514
|
value: (function () {
|
|
582
|
-
var _fetchHolderAccounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
515
|
+
var _fetchHolderAccounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
|
|
583
516
|
var url, _ref, form_id, shop_id, num, skip, customer_id, _res$data, res;
|
|
584
|
-
return _regeneratorRuntime().wrap(function
|
|
585
|
-
while (1) switch (
|
|
517
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
518
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
586
519
|
case 0:
|
|
587
520
|
url = params.url || '/account/holder';
|
|
588
521
|
_ref = (params === null || params === void 0 ? void 0 : params.query) || {}, form_id = _ref.form_id, shop_id = _ref.shop_id, num = _ref.num, skip = _ref.skip, customer_id = _ref.customer_id;
|
|
589
|
-
|
|
590
|
-
|
|
522
|
+
_context9.prev = 2;
|
|
523
|
+
_context9.next = 5;
|
|
591
524
|
return this.request.get(url, {
|
|
592
525
|
customer_id: customer_id,
|
|
593
526
|
form_id: form_id,
|
|
@@ -596,30 +529,30 @@ export var AccountListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
596
529
|
skip: skip || 1
|
|
597
530
|
});
|
|
598
531
|
case 5:
|
|
599
|
-
res =
|
|
532
|
+
res = _context9.sent;
|
|
600
533
|
this.store.accountList = [];
|
|
601
534
|
this.store.accounts = [];
|
|
602
535
|
if (!(res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && (_res$data = _res$data.list) !== null && _res$data !== void 0 && _res$data.length)) {
|
|
603
|
-
|
|
536
|
+
_context9.next = 11;
|
|
604
537
|
break;
|
|
605
538
|
}
|
|
606
|
-
|
|
539
|
+
_context9.next = 11;
|
|
607
540
|
return this.addHolderAccounts({
|
|
608
541
|
holders: res.data.list,
|
|
609
542
|
customerId: customer_id
|
|
610
543
|
});
|
|
611
544
|
case 11:
|
|
612
|
-
|
|
545
|
+
_context9.next = 16;
|
|
613
546
|
break;
|
|
614
547
|
case 13:
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
console.error(
|
|
548
|
+
_context9.prev = 13;
|
|
549
|
+
_context9.t0 = _context9["catch"](2);
|
|
550
|
+
console.error(_context9.t0);
|
|
618
551
|
case 16:
|
|
619
552
|
case "end":
|
|
620
|
-
return
|
|
553
|
+
return _context9.stop();
|
|
621
554
|
}
|
|
622
|
-
},
|
|
555
|
+
}, _callee9, this, [[2, 13]]);
|
|
623
556
|
}));
|
|
624
557
|
function fetchHolderAccounts(_x11) {
|
|
625
558
|
return _fetchHolderAccounts.apply(this, arguments);
|
|
@@ -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
|
-
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProductData } from "../../Product";
|
|
2
2
|
import { CartItem, IUpdateItemParams } from "../types";
|
|
3
|
-
export declare function updateAllCartItemPrice(cartItems: CartItem[], priceData: any, getProduct: (id: number) => Promise<
|
|
3
|
+
export declare function updateAllCartItemPrice(cartItems: CartItem[], priceData: any, getProduct: (id: number) => Promise<ProductData | undefined>, updateCart: (item: IUpdateItemParams) => void, updateItemInitInfo: (item: IUpdateItemParams) => void): Promise<void>;
|
|
@@ -36,7 +36,7 @@ function _updateAllCartItemPrice() {
|
|
|
36
36
|
return getProduct(item.id);
|
|
37
37
|
case 4:
|
|
38
38
|
cartProduct = _context.sent;
|
|
39
|
-
productInfo = cartProduct
|
|
39
|
+
productInfo = cartProduct;
|
|
40
40
|
if (!productInfo) {
|
|
41
41
|
productInfo = item._productOrigin;
|
|
42
42
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Module, PisellCore } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { Product } from '../Product';
|
|
4
3
|
import { ProductData } from '../Product/types';
|
|
5
4
|
export * from './types';
|
|
6
5
|
export declare class ProductList extends BaseModule implements Module {
|
|
@@ -8,20 +7,16 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
8
7
|
protected defaultVersion: string;
|
|
9
8
|
private store;
|
|
10
9
|
private request;
|
|
10
|
+
private otherParams;
|
|
11
11
|
constructor(name?: string, version?: string);
|
|
12
12
|
initialize(core: PisellCore, options: any): Promise<void>;
|
|
13
13
|
storeChange(path?: string, value?: any): Promise<void>;
|
|
14
|
-
loadProducts({ category_ids, product_ids, collection,
|
|
14
|
+
loadProducts({ category_ids, product_ids, collection, schedule_date, cacheId }: {
|
|
15
15
|
category_ids?: number[];
|
|
16
16
|
product_ids?: number[];
|
|
17
17
|
collection?: number | string[];
|
|
18
18
|
schedule_date?: string;
|
|
19
19
|
cacheId?: string;
|
|
20
|
-
customer_id?: number;
|
|
21
|
-
menu_list_ids?: number[];
|
|
22
|
-
schedule_datetime?: string;
|
|
23
|
-
with_count?: string[];
|
|
24
|
-
with_schedule?: number;
|
|
25
20
|
}): Promise<any>;
|
|
26
21
|
loadProductsPrice({ ids, customer_id, schedule_date, channel, }: {
|
|
27
22
|
ids?: number[];
|
|
@@ -30,13 +25,7 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
30
25
|
channel?: string;
|
|
31
26
|
}): Promise<any>;
|
|
32
27
|
getProducts(): Promise<ProductData[]>;
|
|
33
|
-
getProduct(id: number): Promise<
|
|
28
|
+
getProduct(id: number): Promise<ProductData | undefined>;
|
|
34
29
|
addProduct(products: ProductData[]): Promise<void>;
|
|
35
30
|
selectProducts(products: ProductData[]): Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* 根据商品编码或条码搜索商品
|
|
38
|
-
* @param code 商品编码或条码
|
|
39
|
-
* @returns 匹配的商品列表,如果没有匹配则返回空数组
|
|
40
|
-
*/
|
|
41
|
-
findProductsByCodeOrBarcode(code: string): ProductData[];
|
|
42
31
|
}
|
|
@@ -16,7 +16,6 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
16
16
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
17
17
|
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); }
|
|
18
18
|
import { BaseModule } from "../BaseModule";
|
|
19
|
-
import { Product } from "../Product";
|
|
20
19
|
import { ProductListHooks } from "./types";
|
|
21
20
|
import { cloneDeep } from 'lodash-es';
|
|
22
21
|
export * from "./types";
|
|
@@ -31,6 +30,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
31
30
|
_defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
|
|
32
31
|
_defineProperty(_assertThisInitialized(_this), "store", void 0);
|
|
33
32
|
_defineProperty(_assertThisInitialized(_this), "request", void 0);
|
|
33
|
+
_defineProperty(_assertThisInitialized(_this), "otherParams", {});
|
|
34
34
|
return _this;
|
|
35
35
|
}
|
|
36
36
|
_createClass(ProductList, [{
|
|
@@ -43,17 +43,18 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
43
43
|
case 0:
|
|
44
44
|
this.core = core;
|
|
45
45
|
this.store = options.store;
|
|
46
|
+
this.otherParams = options.otherParams || {};
|
|
46
47
|
if (Array.isArray((_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.list)) {
|
|
47
|
-
this.store.list = options.initialState.list
|
|
48
|
+
this.store.list = options.initialState.list.slice().sort(function (a, b) {
|
|
49
|
+
return Number(b.sort) - Number(a.sort);
|
|
50
|
+
});
|
|
48
51
|
this.core.effects.emit("".concat(this.name, ":changed"), this.store.list);
|
|
49
|
-
this.storeChange();
|
|
50
52
|
} else {
|
|
51
53
|
this.store.list = [];
|
|
52
|
-
this.store.productMap = new Map();
|
|
53
54
|
this.store.selectProducts = [];
|
|
54
55
|
}
|
|
55
56
|
this.request = core.getPlugin('request');
|
|
56
|
-
case
|
|
57
|
+
case 5:
|
|
57
58
|
case "end":
|
|
58
59
|
return _context.stop();
|
|
59
60
|
}
|
|
@@ -68,28 +69,13 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
68
69
|
key: "storeChange",
|
|
69
70
|
value: function () {
|
|
70
71
|
var _storeChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(path, value) {
|
|
71
|
-
var _this$store$list,
|
|
72
|
-
_this2 = this;
|
|
73
72
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
74
73
|
while (1) switch (_context2.prev = _context2.next) {
|
|
75
74
|
case 0:
|
|
76
|
-
(_this$store$list = this.store.list) === null || _this$store$list === void 0 || _this$store$list.forEach(function (product) {
|
|
77
|
-
var productModule = _this2.store.productMap.get("product-".concat(product.id));
|
|
78
|
-
if (!productModule) {
|
|
79
|
-
var newProductModule = new Product("product_".concat(product.id.toString()));
|
|
80
|
-
_this2.core.registerModule(newProductModule, {
|
|
81
|
-
initialState: product
|
|
82
|
-
});
|
|
83
|
-
_this2.store.productMap.set(product.id.toString(), newProductModule);
|
|
84
|
-
} else {
|
|
85
|
-
productModule.updateData(product);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
case 1:
|
|
89
75
|
case "end":
|
|
90
76
|
return _context2.stop();
|
|
91
77
|
}
|
|
92
|
-
}, _callee2
|
|
78
|
+
}, _callee2);
|
|
93
79
|
}));
|
|
94
80
|
function storeChange(_x3, _x4) {
|
|
95
81
|
return _storeChange.apply(this, arguments);
|
|
@@ -100,11 +86,12 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
100
86
|
key: "loadProducts",
|
|
101
87
|
value: function () {
|
|
102
88
|
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref) {
|
|
103
|
-
var
|
|
89
|
+
var _this$otherParams;
|
|
90
|
+
var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, schedule_date, cacheId, userPlugin, customer_id, _userPlugin$get, productsData, sortedList;
|
|
104
91
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
105
92
|
while (1) switch (_context3.prev = _context3.next) {
|
|
106
93
|
case 0:
|
|
107
|
-
_ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection,
|
|
94
|
+
_ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId;
|
|
108
95
|
// // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
|
|
109
96
|
// if (!schedule_ids?.length) {
|
|
110
97
|
// const schedule_ids_data = this.store.schedule
|
|
@@ -120,7 +107,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
120
107
|
userPlugin = this.core.getPlugin('user');
|
|
121
108
|
customer_id = undefined;
|
|
122
109
|
try {
|
|
123
|
-
customer_id =
|
|
110
|
+
customer_id = userPlugin === null || userPlugin === void 0 || (_userPlugin$get = userPlugin.get()) === null || _userPlugin$get === void 0 ? void 0 : _userPlugin$get.id;
|
|
124
111
|
} catch (error) {
|
|
125
112
|
console.error(error);
|
|
126
113
|
}
|
|
@@ -139,20 +126,20 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
139
126
|
ids: product_ids,
|
|
140
127
|
collection: collection,
|
|
141
128
|
front_end_cache_id: cacheId,
|
|
142
|
-
menu_list_ids: menu_list_ids,
|
|
143
|
-
with_count: with_count,
|
|
144
129
|
// client_schedule_ids: schedule_ids,
|
|
145
130
|
schedule_date: schedule_date,
|
|
146
|
-
|
|
147
|
-
schedule_datetime: schedule_datetime
|
|
131
|
+
application_code: (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel
|
|
148
132
|
}, {
|
|
149
133
|
useCache: true
|
|
150
134
|
});
|
|
151
135
|
case 6:
|
|
152
136
|
productsData = _context3.sent;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
137
|
+
sortedList = (productsData.data.list || []).slice().sort(function (a, b) {
|
|
138
|
+
return Number(b.sort) - Number(a.sort);
|
|
139
|
+
});
|
|
140
|
+
this.addProduct(sortedList);
|
|
141
|
+
return _context3.abrupt("return", sortedList);
|
|
142
|
+
case 10:
|
|
156
143
|
case "end":
|
|
157
144
|
return _context3.stop();
|
|
158
145
|
}
|
|
@@ -228,15 +215,11 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
228
215
|
_context6.next = 2;
|
|
229
216
|
return this.core.effects.emit(ProductListHooks.onGetProduct, this.store.list);
|
|
230
217
|
case 2:
|
|
231
|
-
product = this.store.
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
return _context6.abrupt("return", product);
|
|
237
|
-
case 5:
|
|
238
|
-
return _context6.abrupt("return", undefined);
|
|
239
|
-
case 6:
|
|
218
|
+
product = this.store.list.find(function (product) {
|
|
219
|
+
return product.id === id;
|
|
220
|
+
});
|
|
221
|
+
return _context6.abrupt("return", product ? cloneDeep(product) : undefined);
|
|
222
|
+
case 4:
|
|
240
223
|
case "end":
|
|
241
224
|
return _context6.stop();
|
|
242
225
|
}
|
|
@@ -251,27 +234,30 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
251
234
|
key: "addProduct",
|
|
252
235
|
value: function () {
|
|
253
236
|
var _addProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(products) {
|
|
254
|
-
var
|
|
237
|
+
var _this2 = this;
|
|
255
238
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
256
239
|
while (1) switch (_context7.prev = _context7.next) {
|
|
257
240
|
case 0:
|
|
258
|
-
// 加到 list 以后上面的storeChange 会自动初始化商品详情的 module 实例
|
|
259
241
|
// list 需要根据 id 去重
|
|
260
242
|
if (!this.store.list) {
|
|
261
243
|
this.store.list = [];
|
|
262
244
|
}
|
|
263
245
|
products.forEach(function (n) {
|
|
264
|
-
var index =
|
|
246
|
+
var index = _this2.store.list.findIndex(function (m) {
|
|
265
247
|
return m.id === n.id;
|
|
266
248
|
});
|
|
267
249
|
if (index === -1) {
|
|
268
|
-
|
|
250
|
+
_this2.store.list.push(n);
|
|
269
251
|
} else {
|
|
270
|
-
|
|
252
|
+
_this2.store.list[index] = n;
|
|
271
253
|
}
|
|
272
254
|
});
|
|
273
|
-
|
|
274
|
-
|
|
255
|
+
// 根据 sort 值做降序排序(数字越大越靠前)
|
|
256
|
+
this.store.list.sort(function (a, b) {
|
|
257
|
+
return Number(b.sort) - Number(a.sort);
|
|
258
|
+
});
|
|
259
|
+
this.core.effects.emit("".concat(this.name, ":changed"), this.store.list);
|
|
260
|
+
case 4:
|
|
275
261
|
case "end":
|
|
276
262
|
return _context7.stop();
|
|
277
263
|
}
|
|
@@ -301,26 +287,6 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
301
287
|
}
|
|
302
288
|
return selectProducts;
|
|
303
289
|
}()
|
|
304
|
-
/**
|
|
305
|
-
* 根据商品编码或条码搜索商品
|
|
306
|
-
* @param code 商品编码或条码
|
|
307
|
-
* @returns 匹配的商品列表,如果没有匹配则返回空数组
|
|
308
|
-
*/
|
|
309
|
-
}, {
|
|
310
|
-
key: "findProductsByCodeOrBarcode",
|
|
311
|
-
value: function findProductsByCodeOrBarcode(code) {
|
|
312
|
-
if (!code || typeof code !== 'string') {
|
|
313
|
-
return [];
|
|
314
|
-
}
|
|
315
|
-
var trimmedCode = code.trim();
|
|
316
|
-
if (!trimmedCode) {
|
|
317
|
-
return [];
|
|
318
|
-
}
|
|
319
|
-
var matchingProducts = this.store.list.filter(function (product) {
|
|
320
|
-
return product.code && product.code.trim() === trimmedCode || product.barcode && product.barcode.trim() === trimmedCode;
|
|
321
|
-
});
|
|
322
|
-
return cloneDeep(matchingProducts);
|
|
323
|
-
}
|
|
324
290
|
}]);
|
|
325
291
|
return ProductList;
|
|
326
292
|
}(BaseModule);
|