@pisell/pisellos 2.3.67 → 2.3.69
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/model/strategy/adapter/walletPass/evaluator.js +0 -1
- package/dist/model/strategy/adapter/walletPass/utils.js +0 -2
- package/dist/modules/BaseModule.d.ts +1 -0
- package/dist/modules/BaseModule.js +24 -28
- package/dist/modules/Customer/index.d.ts +4 -0
- package/dist/modules/Customer/index.js +91 -59
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Order/index.d.ts +22 -2
- package/dist/modules/Order/index.js +313 -142
- package/dist/modules/Order/types.d.ts +13 -1
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +75 -0
- package/dist/modules/Order/utils.js +0 -1
- package/dist/modules/Payment/index.d.ts +4 -0
- package/dist/modules/Payment/index.js +14 -4
- package/dist/modules/Payment/walletpass.js +52 -18
- package/dist/modules/Rules/index.js +46 -31
- package/dist/server/index.js +3 -6
- package/dist/server/modules/order/index.d.ts +1 -0
- package/dist/server/modules/order/index.js +252 -93
- package/dist/server/utils/small-ticket.js +2 -1
- package/dist/solution/BaseSales/index.d.ts +13 -1
- package/dist/solution/BaseSales/index.js +903 -831
- package/dist/solution/BaseSales/utils.js +31 -20
- package/dist/solution/BookingTicket/index.d.ts +7 -1
- package/dist/solution/BookingTicket/index.js +310 -224
- package/dist/solution/ScanOrder/utils.js +31 -20
- package/dist/solution/UnifiedBookingSales/index.d.ts +25 -0
- package/dist/solution/UnifiedBookingSales/index.js +640 -321
- package/dist/solution/UnifiedBookingSales/types.d.ts +7 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -1
- package/lib/model/strategy/adapter/walletPass/utils.js +0 -1
- package/lib/modules/BaseModule.d.ts +1 -0
- package/lib/modules/BaseModule.js +24 -37
- package/lib/modules/Customer/index.d.ts +4 -0
- package/lib/modules/Customer/index.js +11 -0
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Order/index.d.ts +22 -2
- package/lib/modules/Order/index.js +212 -54
- package/lib/modules/Order/types.d.ts +13 -1
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +70 -0
- package/lib/modules/Order/utils.js +0 -1
- package/lib/modules/Payment/index.d.ts +4 -0
- package/lib/modules/Payment/index.js +7 -0
- package/lib/modules/Payment/walletpass.js +27 -2
- package/lib/modules/Rules/index.js +17 -1
- package/lib/server/index.js +3 -6
- package/lib/server/modules/order/index.d.ts +1 -0
- package/lib/server/modules/order/index.js +66 -2
- package/lib/server/utils/small-ticket.js +1 -1
- package/lib/solution/BaseSales/index.d.ts +13 -1
- package/lib/solution/BaseSales/index.js +61 -18
- package/lib/solution/BaseSales/utils.js +29 -18
- package/lib/solution/BookingTicket/index.d.ts +7 -1
- package/lib/solution/BookingTicket/index.js +65 -14
- package/lib/solution/ScanOrder/utils.js +29 -18
- package/lib/solution/UnifiedBookingSales/index.d.ts +25 -0
- package/lib/solution/UnifiedBookingSales/index.js +188 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +7 -0
- package/package.json +1 -1
|
@@ -505,7 +505,6 @@ export var WalletPassEvaluator = /*#__PURE__*/function () {
|
|
|
505
505
|
}, {
|
|
506
506
|
key: "calculateApplicableProducts",
|
|
507
507
|
value: function calculateApplicableProducts(products, applicableProductIds, deductTaxAndFee) {
|
|
508
|
-
console.log(products, 'products1234');
|
|
509
508
|
var total = 0;
|
|
510
509
|
var count = 0;
|
|
511
510
|
|
|
@@ -189,8 +189,6 @@ var getApplicableProducts = function getApplicableProducts(voucher, productsData
|
|
|
189
189
|
* @returns 返回推荐券列表和全部列表,每个券包含 _available_max_amount 和 _unified_available_status
|
|
190
190
|
*/
|
|
191
191
|
export function processVouchers(applicableVouchers, orderTotalAmount, products) {
|
|
192
|
-
console.log(products, 'products123');
|
|
193
|
-
|
|
194
192
|
// 拆分商品数据,同时维护含税和不含税两个金额池
|
|
195
193
|
// remainingAmountWithTax: 含税费的剩余可抵扣金额
|
|
196
194
|
// remainingAmountPure: 纯商品金额(不含税费)的剩余可抵扣金额
|
|
@@ -8,6 +8,7 @@ export declare class BaseModule {
|
|
|
8
8
|
protected core: PisellCore;
|
|
9
9
|
constructor(name?: string, version?: string);
|
|
10
10
|
destroy(): void;
|
|
11
|
+
private isRecord;
|
|
11
12
|
checkSaveCache({ cacheId, fatherModule, store, cacheKey, }: {
|
|
12
13
|
cacheId: string | undefined;
|
|
13
14
|
fatherModule: string | undefined;
|
|
@@ -23,45 +23,41 @@ export var BaseModule = /*#__PURE__*/function () {
|
|
|
23
23
|
this.core.effects.offByModuleDestroy(this.name);
|
|
24
24
|
this.core.unregisterModule(this);
|
|
25
25
|
}
|
|
26
|
+
}, {
|
|
27
|
+
key: "isRecord",
|
|
28
|
+
value: function isRecord(value) {
|
|
29
|
+
return !!value && _typeof(value) === 'object' && !Array.isArray(value);
|
|
30
|
+
}
|
|
26
31
|
|
|
27
32
|
// 提供统一的缓存 module 里的数据的方法
|
|
28
33
|
}, {
|
|
29
34
|
key: "checkSaveCache",
|
|
30
35
|
value: function checkSaveCache(_ref) {
|
|
31
|
-
var _this = this;
|
|
32
36
|
var cacheId = _ref.cacheId,
|
|
33
37
|
fatherModule = _ref.fatherModule,
|
|
34
38
|
store = _ref.store,
|
|
35
39
|
cacheKey = _ref.cacheKey;
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
if (!cacheId) return;
|
|
41
|
+
try {
|
|
42
|
+
var window = this.core.getPlugin('window');
|
|
43
|
+
var sessionStorage = window === null || window === void 0 ? void 0 : window.sessionStorage;
|
|
44
|
+
if (!sessionStorage) return;
|
|
45
|
+
var storageKey = fatherModule || cacheId;
|
|
46
|
+
var rawCacheData = sessionStorage.getItem(storageKey);
|
|
47
|
+
var parsedCacheData = rawCacheData ? JSON.parse(rawCacheData) : {};
|
|
48
|
+
if (!this.isRecord(parsedCacheData)) return;
|
|
49
|
+
var cacheBucket = fatherModule ? this.isRecord(parsedCacheData[cacheId]) ? parsedCacheData[cacheId] : {} : parsedCacheData;
|
|
50
|
+
var moduleBucket = this.isRecord(cacheBucket[this.name]) ? cacheBucket[this.name] : {};
|
|
51
|
+
cacheKey.forEach(function (key) {
|
|
52
|
+
moduleBucket[key] = store === null || store === void 0 ? void 0 : store[key];
|
|
53
|
+
});
|
|
54
|
+
cacheBucket[this.name] = moduleBucket;
|
|
38
55
|
if (fatherModule) {
|
|
39
|
-
|
|
40
|
-
var currentCacheDataObj = JSON.parse(currentCacheData || '{}');
|
|
41
|
-
if (!currentCacheData || !currentCacheDataObj[cacheId]) {
|
|
42
|
-
currentCacheDataObj = _defineProperty({}, cacheId, _defineProperty({}, this.name, {}));
|
|
43
|
-
}
|
|
44
|
-
if (!currentCacheDataObj[cacheId][this.name]) {
|
|
45
|
-
currentCacheDataObj[cacheId][this.name] = {};
|
|
46
|
-
}
|
|
47
|
-
cacheKey.forEach(function (key) {
|
|
48
|
-
currentCacheDataObj[cacheId][_this.name][key] = store === null || store === void 0 ? void 0 : store[key];
|
|
49
|
-
});
|
|
50
|
-
window.sessionStorage.setItem(fatherModule, JSON.stringify(currentCacheDataObj));
|
|
51
|
-
} else {
|
|
52
|
-
var _currentCacheData = window.sessionStorage.getItem(cacheId);
|
|
53
|
-
var _currentCacheDataObj2 = JSON.parse(_currentCacheData || '{}');
|
|
54
|
-
if (!_currentCacheDataObj2) {
|
|
55
|
-
_currentCacheDataObj2 = {};
|
|
56
|
-
}
|
|
57
|
-
if (!_currentCacheDataObj2[this.name]) {
|
|
58
|
-
_currentCacheDataObj2[this.name] = {};
|
|
59
|
-
}
|
|
60
|
-
cacheKey.forEach(function (key) {
|
|
61
|
-
_currentCacheDataObj2[_this.name][key] = store[key];
|
|
62
|
-
});
|
|
63
|
-
window.sessionStorage.setItem(cacheId, JSON.stringify(_currentCacheDataObj2));
|
|
56
|
+
parsedCacheData[cacheId] = cacheBucket;
|
|
64
57
|
}
|
|
58
|
+
sessionStorage.setItem(storageKey, JSON.stringify(parsedCacheData));
|
|
59
|
+
} catch (_unused) {
|
|
60
|
+
// sessionStorage persistence is best-effort and must not block checkout.
|
|
65
61
|
}
|
|
66
62
|
}
|
|
67
63
|
}, {
|
|
@@ -44,6 +44,10 @@ export declare class CustomerModule extends BaseModule implements Module, Custom
|
|
|
44
44
|
* 用于按 ID 补齐客户等内部查询,避免把临时的 num/searchParams 污染到滚动列表。
|
|
45
45
|
*/
|
|
46
46
|
queryCustomerList(params?: ShopGetCustomerListParams): Promise<ICustomerListResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* 查询单个客户详情,不写入 customerList / pagination 状态。
|
|
49
|
+
*/
|
|
50
|
+
queryCustomerDetail(id: string | number): Promise<ShopCustomer | null>;
|
|
47
51
|
/**
|
|
48
52
|
* 获取客户列表
|
|
49
53
|
* @param params 查询参数
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var _excluded = ["skip", "num", "search"],
|
|
2
2
|
_excluded2 = ["skip", "num"];
|
|
3
|
-
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); }
|
|
4
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
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."); }
|
|
6
5
|
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); }
|
|
7
6
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
7
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
9
8
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
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); }
|
|
10
10
|
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; }
|
|
11
11
|
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; }
|
|
12
12
|
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; }
|
|
@@ -322,6 +322,38 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
322
322
|
}
|
|
323
323
|
return queryCustomerList;
|
|
324
324
|
}()
|
|
325
|
+
/**
|
|
326
|
+
* 查询单个客户详情,不写入 customerList / pagination 状态。
|
|
327
|
+
*/
|
|
328
|
+
)
|
|
329
|
+
}, {
|
|
330
|
+
key: "queryCustomerDetail",
|
|
331
|
+
value: (function () {
|
|
332
|
+
var _queryCustomerDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(id) {
|
|
333
|
+
var _result$data;
|
|
334
|
+
var result, customer;
|
|
335
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
336
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
337
|
+
case 0:
|
|
338
|
+
_context5.next = 2;
|
|
339
|
+
return this.request.get("/customer/info/".concat(id), {
|
|
340
|
+
with_trashed: 1
|
|
341
|
+
});
|
|
342
|
+
case 2:
|
|
343
|
+
result = _context5.sent;
|
|
344
|
+
customer = (result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.customer) || (result === null || result === void 0 ? void 0 : result.data) || (result === null || result === void 0 ? void 0 : result.customer) || null;
|
|
345
|
+
return _context5.abrupt("return", customer && _typeof(customer) === 'object' ? customer : null);
|
|
346
|
+
case 5:
|
|
347
|
+
case "end":
|
|
348
|
+
return _context5.stop();
|
|
349
|
+
}
|
|
350
|
+
}, _callee5, this);
|
|
351
|
+
}));
|
|
352
|
+
function queryCustomerDetail(_x5) {
|
|
353
|
+
return _queryCustomerDetail.apply(this, arguments);
|
|
354
|
+
}
|
|
355
|
+
return queryCustomerDetail;
|
|
356
|
+
}()
|
|
325
357
|
/**
|
|
326
358
|
* 获取客户列表
|
|
327
359
|
* @param params 查询参数
|
|
@@ -331,7 +363,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
331
363
|
}, {
|
|
332
364
|
key: "getCustomerList",
|
|
333
365
|
value: (function () {
|
|
334
|
-
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
366
|
+
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
335
367
|
var params,
|
|
336
368
|
_yield$this$fetchCust2,
|
|
337
369
|
customerList,
|
|
@@ -342,18 +374,18 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
342
374
|
num,
|
|
343
375
|
searchParams,
|
|
344
376
|
response,
|
|
345
|
-
|
|
346
|
-
return _regeneratorRuntime().wrap(function
|
|
347
|
-
while (1) switch (
|
|
377
|
+
_args6 = arguments;
|
|
378
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
379
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
348
380
|
case 0:
|
|
349
|
-
params =
|
|
350
|
-
|
|
381
|
+
params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
|
|
382
|
+
_context6.prev = 1;
|
|
351
383
|
this.store.loading = true;
|
|
352
384
|
this.store.error = null;
|
|
353
|
-
|
|
385
|
+
_context6.next = 6;
|
|
354
386
|
return this.fetchCustomerListData(params);
|
|
355
387
|
case 6:
|
|
356
|
-
_yield$this$fetchCust2 =
|
|
388
|
+
_yield$this$fetchCust2 = _context6.sent;
|
|
357
389
|
customerList = _yield$this$fetchCust2.customerList;
|
|
358
390
|
total = _yield$this$fetchCust2.total;
|
|
359
391
|
page = _yield$this$fetchCust2.page;
|
|
@@ -386,27 +418,27 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
386
418
|
page: page,
|
|
387
419
|
pageSize: pageSize
|
|
388
420
|
};
|
|
389
|
-
return
|
|
421
|
+
return _context6.abrupt("return", response);
|
|
390
422
|
case 23:
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
return this.handleCustomerListError(
|
|
423
|
+
_context6.prev = 23;
|
|
424
|
+
_context6.t0 = _context6["catch"](1);
|
|
425
|
+
_context6.next = 27;
|
|
426
|
+
return this.handleCustomerListError(_context6.t0, 'fetch customer list');
|
|
395
427
|
case 27:
|
|
396
|
-
throw
|
|
428
|
+
throw _context6.t0;
|
|
397
429
|
case 28:
|
|
398
|
-
|
|
430
|
+
_context6.prev = 28;
|
|
399
431
|
this.store.loading = false;
|
|
400
432
|
this.storeChange();
|
|
401
|
-
|
|
433
|
+
_context6.next = 33;
|
|
402
434
|
return this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), this.store);
|
|
403
435
|
case 33:
|
|
404
|
-
return
|
|
436
|
+
return _context6.finish(28);
|
|
405
437
|
case 34:
|
|
406
438
|
case "end":
|
|
407
|
-
return
|
|
439
|
+
return _context6.stop();
|
|
408
440
|
}
|
|
409
|
-
},
|
|
441
|
+
}, _callee6, this, [[1, 23, 28, 34]]);
|
|
410
442
|
}));
|
|
411
443
|
function getCustomerList() {
|
|
412
444
|
return _getCustomerList.apply(this, arguments);
|
|
@@ -583,10 +615,10 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
583
615
|
}, {
|
|
584
616
|
key: "changeCustomerPage",
|
|
585
617
|
value: (function () {
|
|
586
|
-
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
618
|
+
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(page, pageSize) {
|
|
587
619
|
var targetPageSize, skip, num;
|
|
588
|
-
return _regeneratorRuntime().wrap(function
|
|
589
|
-
while (1) switch (
|
|
620
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
621
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
590
622
|
case 0:
|
|
591
623
|
targetPageSize = pageSize || this.store.pageSize; // 先更新分页状态
|
|
592
624
|
this.setPaginationInfo(page, targetPageSize);
|
|
@@ -594,20 +626,20 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
594
626
|
// skip直接使用page,num使用pageSize
|
|
595
627
|
skip = page;
|
|
596
628
|
num = targetPageSize; // 自动调用获取客户列表,使用存储的搜索条件
|
|
597
|
-
|
|
629
|
+
_context7.next = 6;
|
|
598
630
|
return this.getCustomerList(_objectSpread({
|
|
599
631
|
skip: skip,
|
|
600
632
|
num: num
|
|
601
633
|
}, this.store.searchParams));
|
|
602
634
|
case 6:
|
|
603
|
-
return
|
|
635
|
+
return _context7.abrupt("return", _context7.sent);
|
|
604
636
|
case 7:
|
|
605
637
|
case "end":
|
|
606
|
-
return
|
|
638
|
+
return _context7.stop();
|
|
607
639
|
}
|
|
608
|
-
},
|
|
640
|
+
}, _callee7, this);
|
|
609
641
|
}));
|
|
610
|
-
function changeCustomerPage(
|
|
642
|
+
function changeCustomerPage(_x6, _x7) {
|
|
611
643
|
return _changeCustomerPage.apply(this, arguments);
|
|
612
644
|
}
|
|
613
645
|
return changeCustomerPage;
|
|
@@ -620,16 +652,16 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
620
652
|
}, {
|
|
621
653
|
key: "loadMoreCustomers",
|
|
622
654
|
value: (function () {
|
|
623
|
-
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
655
|
+
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
624
656
|
var nextPage, loadMoreParams, _yield$this$fetchCust3, newCustomers, total, page, pageSize, updatedCustomerList, response;
|
|
625
|
-
return _regeneratorRuntime().wrap(function
|
|
626
|
-
while (1) switch (
|
|
657
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
658
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
627
659
|
case 0:
|
|
628
660
|
if (!(!this.store.hasMore || this.store.loadingMore)) {
|
|
629
|
-
|
|
661
|
+
_context8.next = 2;
|
|
630
662
|
break;
|
|
631
663
|
}
|
|
632
|
-
return
|
|
664
|
+
return _context8.abrupt("return", {
|
|
633
665
|
list: [],
|
|
634
666
|
total: this.store.total,
|
|
635
667
|
page: this.store.currentPage,
|
|
@@ -638,17 +670,17 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
638
670
|
case 2:
|
|
639
671
|
// 计算下一页
|
|
640
672
|
nextPage = this.store.currentPage + 1;
|
|
641
|
-
|
|
673
|
+
_context8.prev = 3;
|
|
642
674
|
this.store.loadingMore = true;
|
|
643
675
|
this.store.error = null;
|
|
644
676
|
loadMoreParams = _objectSpread({
|
|
645
677
|
skip: nextPage,
|
|
646
678
|
num: this.store.pageSize
|
|
647
679
|
}, this.store.searchParams); // 使用公共方法获取数据,传入存储的搜索条件
|
|
648
|
-
|
|
680
|
+
_context8.next = 9;
|
|
649
681
|
return this.fetchCustomerListData(loadMoreParams);
|
|
650
682
|
case 9:
|
|
651
|
-
_yield$this$fetchCust3 =
|
|
683
|
+
_yield$this$fetchCust3 = _context8.sent;
|
|
652
684
|
newCustomers = _yield$this$fetchCust3.customerList;
|
|
653
685
|
total = _yield$this$fetchCust3.total;
|
|
654
686
|
page = _yield$this$fetchCust3.page;
|
|
@@ -661,7 +693,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
661
693
|
this.store.hasMore = page * pageSize < total;
|
|
662
694
|
|
|
663
695
|
// 触发滚动加载特定事件
|
|
664
|
-
|
|
696
|
+
_context8.next = 21;
|
|
665
697
|
return this.core.effects.emit("".concat(this.name, ":onScrollLoadMore"), {
|
|
666
698
|
newCustomers: newCustomers,
|
|
667
699
|
allCustomers: this.store.customerList,
|
|
@@ -683,27 +715,27 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
683
715
|
page: page,
|
|
684
716
|
pageSize: pageSize
|
|
685
717
|
};
|
|
686
|
-
return
|
|
718
|
+
return _context8.abrupt("return", response);
|
|
687
719
|
case 26:
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
return this.handleCustomerListError(
|
|
720
|
+
_context8.prev = 26;
|
|
721
|
+
_context8.t0 = _context8["catch"](3);
|
|
722
|
+
_context8.next = 30;
|
|
723
|
+
return this.handleCustomerListError(_context8.t0, 'load more customers');
|
|
692
724
|
case 30:
|
|
693
|
-
throw
|
|
725
|
+
throw _context8.t0;
|
|
694
726
|
case 31:
|
|
695
|
-
|
|
727
|
+
_context8.prev = 31;
|
|
696
728
|
this.store.loadingMore = false;
|
|
697
729
|
this.storeChange();
|
|
698
|
-
|
|
730
|
+
_context8.next = 36;
|
|
699
731
|
return this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), this.store);
|
|
700
732
|
case 36:
|
|
701
|
-
return
|
|
733
|
+
return _context8.finish(31);
|
|
702
734
|
case 37:
|
|
703
735
|
case "end":
|
|
704
|
-
return
|
|
736
|
+
return _context8.stop();
|
|
705
737
|
}
|
|
706
|
-
},
|
|
738
|
+
}, _callee8, this, [[3, 26, 31, 37]]);
|
|
707
739
|
}));
|
|
708
740
|
function loadMoreCustomers() {
|
|
709
741
|
return _loadMoreCustomers.apply(this, arguments);
|
|
@@ -719,15 +751,15 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
719
751
|
}, {
|
|
720
752
|
key: "resetAndLoadCustomers",
|
|
721
753
|
value: (function () {
|
|
722
|
-
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
754
|
+
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
723
755
|
var params,
|
|
724
756
|
resetParams,
|
|
725
757
|
response,
|
|
726
|
-
|
|
727
|
-
return _regeneratorRuntime().wrap(function
|
|
728
|
-
while (1) switch (
|
|
758
|
+
_args9 = arguments;
|
|
759
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
760
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
729
761
|
case 0:
|
|
730
|
-
params =
|
|
762
|
+
params = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
|
|
731
763
|
// 重置状态
|
|
732
764
|
this.store.customerList = [];
|
|
733
765
|
this.store.currentPage = 1;
|
|
@@ -739,23 +771,23 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
739
771
|
skip: 1,
|
|
740
772
|
num: params.num || this.store.pageSize
|
|
741
773
|
}); // 调用普通的获取列表方法
|
|
742
|
-
|
|
774
|
+
_context9.next = 8;
|
|
743
775
|
return this.getCustomerList(resetParams);
|
|
744
776
|
case 8:
|
|
745
|
-
response =
|
|
746
|
-
|
|
777
|
+
response = _context9.sent;
|
|
778
|
+
_context9.next = 11;
|
|
747
779
|
return this.core.effects.emit("".concat(this.name, ":onScrollLoadComplete"), {
|
|
748
780
|
customers: this.store.customerList,
|
|
749
781
|
total: this.store.total,
|
|
750
782
|
hasMore: this.store.hasMore
|
|
751
783
|
});
|
|
752
784
|
case 11:
|
|
753
|
-
return
|
|
785
|
+
return _context9.abrupt("return", response);
|
|
754
786
|
case 12:
|
|
755
787
|
case "end":
|
|
756
|
-
return
|
|
788
|
+
return _context9.stop();
|
|
757
789
|
}
|
|
758
|
-
},
|
|
790
|
+
}, _callee9, this);
|
|
759
791
|
}));
|
|
760
792
|
function resetAndLoadCustomers() {
|
|
761
793
|
return _resetAndLoadCustomers.apply(this, arguments);
|
|
@@ -112,6 +112,8 @@ export interface CustomerModuleAPI {
|
|
|
112
112
|
getCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
|
|
113
113
|
/** 查询客户列表但不更新列表分页状态 */
|
|
114
114
|
queryCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
|
|
115
|
+
/** 查询单个客户详情但不修改客户列表状态 */
|
|
116
|
+
queryCustomerDetail: (id: string | number) => Promise<ShopCustomer | null>;
|
|
115
117
|
/** 设置客户列表 */
|
|
116
118
|
setCustomerList: (customers: ShopCustomer[], total?: number) => void;
|
|
117
119
|
/** 设置当前选择的客户 */
|
|
@@ -16,6 +16,10 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
16
16
|
private window;
|
|
17
17
|
private appPlugin;
|
|
18
18
|
private cacheId;
|
|
19
|
+
private fatherModule;
|
|
20
|
+
private openCache;
|
|
21
|
+
private sessionStoragePersistEnabled;
|
|
22
|
+
private sessionStorageRestoreRecord;
|
|
19
23
|
private salesSummaryModuleName;
|
|
20
24
|
private rulesHooksOverride?;
|
|
21
25
|
private moduleHooksOverride?;
|
|
@@ -46,6 +50,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
46
50
|
static populateSavedAmounts(productList: Array<Record<string, any>>, discountList: Array<Record<string, any>>): void;
|
|
47
51
|
private applyProductDiscountPrices;
|
|
48
52
|
constructor(name?: string, version?: string);
|
|
53
|
+
private syncSessionStorageOptions;
|
|
49
54
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
50
55
|
destroy(): Promise<void>;
|
|
51
56
|
/**
|
|
@@ -137,7 +142,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
137
142
|
}): void;
|
|
138
143
|
/**
|
|
139
144
|
* 控制 IndexedDB 草稿(saveDraft)是否写入。
|
|
140
|
-
*
|
|
145
|
+
* 此开关仅影响 saveDraft;可选 sessionStorage 会话恢复由
|
|
146
|
+
* enableSessionStoragePersist 独立控制。
|
|
141
147
|
*
|
|
142
148
|
* @example
|
|
143
149
|
* order.setEnableTempOrderPersist(false); // BigSale 弹窗:跳过 ~1s 的 dbUpdate
|
|
@@ -145,8 +151,19 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
145
151
|
setEnableTempOrderPersist(enabled: boolean): void;
|
|
146
152
|
/** 是否允许 saveDraft 写入 IndexedDB 草稿。 */
|
|
147
153
|
isTempOrderPersistEnabled(): boolean;
|
|
148
|
-
/**
|
|
154
|
+
/**
|
|
155
|
+
* 在 UnifiedBookingSales 显式开启会话恢复时,将完整 tempOrder 写入
|
|
156
|
+
* sessionStorage 的 cacheId 分桶。写入失败由 BaseModule 静默降级。
|
|
157
|
+
*/
|
|
149
158
|
persistTempOrder(): void;
|
|
159
|
+
/**
|
|
160
|
+
* 终止当前模块实例的 sessionStorage 订单恢复会话。
|
|
161
|
+
*
|
|
162
|
+
* 支付跳转等终态场景需要同时删除当前 cacheId 的 tempOrder 快照,并关闭
|
|
163
|
+
* 本实例后续异步任务的再次写入;新模块实例初始化时会按 otherParams 重新启用。
|
|
164
|
+
*/
|
|
165
|
+
clearSessionStoragePersistedTempOrder(): void;
|
|
166
|
+
consumeSessionStorageRestore(): Record<string, any> | null;
|
|
150
167
|
notifyTempOrderChanged(): void;
|
|
151
168
|
private createDefaultTempOrderInstance;
|
|
152
169
|
private createExternalSaleNumber;
|
|
@@ -178,6 +195,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
178
195
|
orderExpectedAmount: string;
|
|
179
196
|
};
|
|
180
197
|
private calculateDepositPaidAmount;
|
|
198
|
+
private hasPaidNormalPayment;
|
|
181
199
|
private resolveNextOrderPaymentType;
|
|
182
200
|
private getPaymentNumberAppData;
|
|
183
201
|
private getPaymentNumberDevicePrefixSync;
|
|
@@ -227,6 +245,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
227
245
|
private sanitizeOrderProductForTempOrder;
|
|
228
246
|
private sanitizeTempOrderProducts;
|
|
229
247
|
private ensureExtend;
|
|
248
|
+
private repairDuplicateProductLineIdentities;
|
|
230
249
|
private captureProductRuntime;
|
|
231
250
|
private createLinkedProductAndBooking;
|
|
232
251
|
/**
|
|
@@ -543,6 +562,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
543
562
|
*/
|
|
544
563
|
hydrateTempOrderFromRecord(record: Record<string, any>, options?: {
|
|
545
564
|
recalcOnHydrate?: boolean;
|
|
565
|
+
source?: 'salesDetail' | 'sessionStorage';
|
|
546
566
|
}): Promise<OrderTempOrder>;
|
|
547
567
|
/**
|
|
548
568
|
* 兼容后端详情将 holder 放在 metadata.holder 的历史形态,统一补到运行时展示路径。
|