@pisell/pisellos 0.10.7 → 0.10.9
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 +0 -1
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +287 -101
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +57 -26
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +18 -12
- package/dist/modules/BookingContext/utils/productExtend.js +5 -9
- package/dist/modules/BookingContext/utils/timeSlices.js +24 -3
- 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/Discount/index.d.ts +2 -0
- package/dist/modules/Discount/index.js +38 -5
- package/dist/modules/Discount/types.d.ts +11 -0
- package/dist/modules/Order/index.d.ts +32 -6
- package/dist/modules/Order/index.js +1165 -819
- package/dist/modules/Order/types.d.ts +32 -4
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +227 -0
- package/dist/modules/Order/utils/virtualSettlement.d.ts +56 -0
- package/dist/modules/Order/utils/virtualSettlement.js +271 -0
- package/dist/modules/Order/utils.js +89 -48
- package/dist/modules/Payment/types.d.ts +2 -0
- package/dist/modules/Payment/utils.js +4 -1
- package/dist/modules/Payment/walletpass.d.ts +11 -0
- package/dist/modules/Payment/walletpass.js +235 -60
- package/dist/modules/Product/types.d.ts +23 -0
- package/dist/modules/ProductList/index.d.ts +15 -2
- package/dist/modules/ProductList/index.js +92 -13
- package/dist/modules/Rules/index.js +125 -52
- package/dist/modules/SalesSummary/index.d.ts +1 -0
- package/dist/modules/SalesSummary/index.js +4 -3
- package/dist/modules/SalesSummary/types.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.js +28 -2
- package/dist/server/index.d.ts +15 -0
- package/dist/server/index.js +894 -781
- package/dist/server/modules/order/index.d.ts +2 -0
- package/dist/server/modules/order/index.js +261 -96
- package/dist/server/modules/order/types.d.ts +1 -1
- package/dist/server/utils/small-ticket.js +2 -1
- package/dist/solution/BaseSales/index.d.ts +41 -7
- package/dist/solution/BaseSales/index.js +1405 -974
- package/dist/solution/BaseSales/utils/cartPromotion.js +26 -3
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +79 -13
- package/dist/solution/BaseSales/utils.js +31 -20
- package/dist/solution/BookingByStep/index.d.ts +3 -3
- package/dist/solution/BookingTicket/index.d.ts +5 -1
- package/dist/solution/BookingTicket/index.js +221 -162
- package/dist/solution/BookingTicket/types.d.ts +3 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +2 -1
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +16 -2
- package/dist/solution/ScanOrder/index.js +25 -64
- package/dist/solution/ScanOrder/utils.js +31 -20
- package/dist/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/dist/solution/UnifiedBookingSales/index.js +51 -39
- package/lib/core/index.js +0 -1
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +170 -7
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/lib/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +62 -11
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +6 -1
- package/lib/modules/BookingContext/utils/productExtend.js +4 -3
- package/lib/modules/BookingContext/utils/timeSlices.js +18 -3
- 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/Discount/index.d.ts +2 -0
- package/lib/modules/Discount/index.js +37 -3
- package/lib/modules/Discount/types.d.ts +11 -0
- package/lib/modules/Order/index.d.ts +32 -6
- package/lib/modules/Order/index.js +518 -148
- package/lib/modules/Order/types.d.ts +32 -4
- package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +170 -0
- package/lib/modules/Order/utils/virtualSettlement.d.ts +56 -0
- package/lib/modules/Order/utils/virtualSettlement.js +300 -0
- package/lib/modules/Order/utils.js +65 -21
- package/lib/modules/Payment/types.d.ts +2 -0
- package/lib/modules/Payment/utils.js +5 -1
- package/lib/modules/Payment/walletpass.d.ts +11 -0
- package/lib/modules/Payment/walletpass.js +198 -17
- package/lib/modules/Product/types.d.ts +23 -0
- package/lib/modules/ProductList/index.d.ts +15 -2
- package/lib/modules/ProductList/index.js +85 -3
- package/lib/modules/Rules/index.js +100 -20
- package/lib/modules/SalesSummary/index.d.ts +1 -0
- package/lib/modules/SalesSummary/index.js +10 -2
- package/lib/modules/SalesSummary/types.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.js +30 -2
- package/lib/server/index.d.ts +15 -0
- package/lib/server/index.js +105 -14
- package/lib/server/modules/order/index.d.ts +2 -0
- package/lib/server/modules/order/index.js +75 -5
- package/lib/server/modules/order/types.d.ts +1 -1
- package/lib/server/utils/small-ticket.js +1 -1
- package/lib/solution/BaseSales/index.d.ts +41 -7
- package/lib/solution/BaseSales/index.js +325 -39
- package/lib/solution/BaseSales/utils/cartPromotion.js +26 -2
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +62 -12
- package/lib/solution/BaseSales/utils.js +29 -18
- package/lib/solution/BookingByStep/index.d.ts +3 -3
- package/lib/solution/BookingTicket/index.d.ts +5 -1
- package/lib/solution/BookingTicket/index.js +31 -6
- package/lib/solution/BookingTicket/types.d.ts +3 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +2 -1
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +15 -3
- package/lib/solution/ScanOrder/index.js +17 -54
- package/lib/solution/ScanOrder/utils.js +29 -18
- package/lib/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/lib/solution/UnifiedBookingSales/index.js +35 -26
- package/package.json +1 -1
|
@@ -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
|
/** 设置当前选择的客户 */
|
|
@@ -25,9 +25,11 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
|
|
|
25
25
|
with_wallet_pass_holder: 0 | 1;
|
|
26
26
|
with_available_wallet_flag?: 0 | 1;
|
|
27
27
|
with_available_wallet_pass_flag?: 0 | 1;
|
|
28
|
+
with_virtual_currency?: 0 | 1;
|
|
28
29
|
request_timezone: string;
|
|
29
30
|
order_id?: number | string;
|
|
30
31
|
}): Promise<DiscountPrepareConfigResult>;
|
|
32
|
+
private normalizeVirtualCurrencyList;
|
|
31
33
|
batchSearch(code: string, options?: {
|
|
32
34
|
customerId?: number;
|
|
33
35
|
orderId?: number;
|
|
@@ -165,8 +165,8 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
165
165
|
key: "loadPrepareConfig",
|
|
166
166
|
value: function () {
|
|
167
167
|
var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
168
|
-
var _params$with_availabl, _params$with_availabl2, _prepareConfig$data, _prepareConfig$data2, _prepareConfig$data3, _prepareConfig$data4, _prepareConfig$data5;
|
|
169
|
-
var prepareConfig, rawDiscountList, availableWalletList, availableWalletPassList, availableWalletIds, goodPassList;
|
|
168
|
+
var _params$with_availabl, _params$with_availabl2, _params$with_virtual_, _prepareConfig$data, _prepareConfig$data2, _prepareConfig$data3, _prepareConfig$data4, _prepareConfig$data5, _prepareConfig$data6;
|
|
169
|
+
var prepareConfig, rawDiscountList, availableWalletList, availableWalletPassList, availableWalletIds, virtualCurrencyList, goodPassList;
|
|
170
170
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
171
171
|
while (1) switch (_context4.prev = _context4.next) {
|
|
172
172
|
case 0:
|
|
@@ -176,7 +176,8 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
176
176
|
_context4.next = 3;
|
|
177
177
|
return this.request.post("/order/prepare/config", _objectSpread(_objectSpread({}, params), {}, {
|
|
178
178
|
with_available_wallet_flag: (_params$with_availabl = params.with_available_wallet_flag) !== null && _params$with_availabl !== void 0 ? _params$with_availabl : 1,
|
|
179
|
-
with_available_wallet_pass_flag: (_params$with_availabl2 = params.with_available_wallet_pass_flag) !== null && _params$with_availabl2 !== void 0 ? _params$with_availabl2 : 1
|
|
179
|
+
with_available_wallet_pass_flag: (_params$with_availabl2 = params.with_available_wallet_pass_flag) !== null && _params$with_availabl2 !== void 0 ? _params$with_availabl2 : 1,
|
|
180
|
+
with_virtual_currency: (_params$with_virtual_ = params.with_virtual_currency) !== null && _params$with_virtual_ !== void 0 ? _params$with_virtual_ : 1
|
|
180
181
|
}));
|
|
181
182
|
case 3:
|
|
182
183
|
prepareConfig = _context4.sent;
|
|
@@ -188,12 +189,14 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
188
189
|
})), _toConsumableArray(availableWalletPassList.map(function (item) {
|
|
189
190
|
return item === null || item === void 0 ? void 0 : item.product_id;
|
|
190
191
|
}))));
|
|
192
|
+
virtualCurrencyList = this.normalizeVirtualCurrencyList(prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data6 = prepareConfig.data) === null || _prepareConfig$data6 === void 0 ? void 0 : _prepareConfig$data6.virtual_currency_list);
|
|
191
193
|
goodPassList = this.filterEnabledDiscountList(rawDiscountList) || []; // this.setDiscountList(goodPassList);
|
|
192
194
|
return _context4.abrupt("return", {
|
|
193
195
|
discountList: goodPassList,
|
|
194
|
-
availableWalletIds: availableWalletIds
|
|
196
|
+
availableWalletIds: availableWalletIds,
|
|
197
|
+
virtualCurrencyList: virtualCurrencyList
|
|
195
198
|
});
|
|
196
|
-
case
|
|
199
|
+
case 11:
|
|
197
200
|
case "end":
|
|
198
201
|
return _context4.stop();
|
|
199
202
|
}
|
|
@@ -204,6 +207,36 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
204
207
|
}
|
|
205
208
|
return loadPrepareConfig;
|
|
206
209
|
}()
|
|
210
|
+
}, {
|
|
211
|
+
key: "normalizeVirtualCurrencyList",
|
|
212
|
+
value: function normalizeVirtualCurrencyList(value) {
|
|
213
|
+
if (!Array.isArray(value)) return [];
|
|
214
|
+
return value.flatMap(function (item) {
|
|
215
|
+
var _item$balance;
|
|
216
|
+
var id = Number(item === null || item === void 0 ? void 0 : item.id);
|
|
217
|
+
var productId = Number(item === null || item === void 0 ? void 0 : item.product_id);
|
|
218
|
+
if (!Number.isFinite(id) || id <= 0 || !Number.isFinite(productId) || productId <= 0) {
|
|
219
|
+
return [];
|
|
220
|
+
}
|
|
221
|
+
var displayExtension = Array.isArray(item === null || item === void 0 ? void 0 : item.extension_data) ? item.extension_data.find(function (extension) {
|
|
222
|
+
return (extension === null || extension === void 0 ? void 0 : extension.field_key) === 'virtual_currency_display';
|
|
223
|
+
}) : undefined;
|
|
224
|
+
var display = displayExtension === null || displayExtension === void 0 ? void 0 : displayExtension.value;
|
|
225
|
+
if (typeof display === 'string') {
|
|
226
|
+
try {
|
|
227
|
+
display = JSON.parse(display);
|
|
228
|
+
} catch (_unused) {
|
|
229
|
+
display = {};
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return [_objectSpread(_objectSpread({}, item), {}, {
|
|
233
|
+
id: id,
|
|
234
|
+
product_id: productId,
|
|
235
|
+
balance: String((_item$balance = item === null || item === void 0 ? void 0 : item.balance) !== null && _item$balance !== void 0 ? _item$balance : '0'),
|
|
236
|
+
virtual_currency_display: display && _typeof(display) === 'object' && !Array.isArray(display) ? display : {}
|
|
237
|
+
})];
|
|
238
|
+
});
|
|
239
|
+
}
|
|
207
240
|
}, {
|
|
208
241
|
key: "batchSearch",
|
|
209
242
|
value: function () {
|
|
@@ -71,6 +71,17 @@ export interface DiscountWithReason {
|
|
|
71
71
|
export interface DiscountPrepareConfigResult {
|
|
72
72
|
discountList: Discount[];
|
|
73
73
|
availableWalletIds: number[];
|
|
74
|
+
virtualCurrencyList?: VirtualCurrencyAsset[];
|
|
75
|
+
}
|
|
76
|
+
export interface VirtualCurrencyAsset extends Record<string, any> {
|
|
77
|
+
id: number;
|
|
78
|
+
product_id: number;
|
|
79
|
+
balance: string;
|
|
80
|
+
product_name?: string;
|
|
81
|
+
format_title?: Record<string, any>;
|
|
82
|
+
code?: string;
|
|
83
|
+
encoded?: string;
|
|
84
|
+
virtual_currency_display?: Record<string, any>;
|
|
74
85
|
}
|
|
75
86
|
interface ExtensionData {
|
|
76
87
|
id: number;
|
|
@@ -3,7 +3,7 @@ import { BaseModule } from '../BaseModule';
|
|
|
3
3
|
import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CancelOrderParams, ChangeBookingStatusParams, CheckoutOrderParams } from './types';
|
|
4
4
|
import { CartItem } from '../Cart/types';
|
|
5
5
|
import { type SubmitPayloadEnhancer } from './utils';
|
|
6
|
-
import type { OrderAmountSnapshot, AddProductBookingInput, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from './types';
|
|
6
|
+
import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions } from './types';
|
|
7
7
|
import type { ICustomer } from '../AccountList/types';
|
|
8
8
|
import type { Discount } from '../Discount/types';
|
|
9
9
|
import { UnavailableReason } from '../Rules/types';
|
|
@@ -82,6 +82,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
82
82
|
}): Promise<Discount[]>;
|
|
83
83
|
getDiscountList(): Discount[];
|
|
84
84
|
getAvailableWalletIds(): number[];
|
|
85
|
+
getVirtualCurrencyList(): import("../Discount/types").VirtualCurrencyAsset[];
|
|
85
86
|
private syncScannedDiscountsToOriginalDiscountList;
|
|
86
87
|
private ensureEditDiscountConfigForProductChange;
|
|
87
88
|
scanCode(code: string, customerId?: number): Promise<{
|
|
@@ -156,6 +157,13 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
156
157
|
* sessionStorage 的 cacheId 分桶。写入失败由 BaseModule 静默降级。
|
|
157
158
|
*/
|
|
158
159
|
persistTempOrder(): void;
|
|
160
|
+
/**
|
|
161
|
+
* 终止当前模块实例的 sessionStorage 订单恢复会话。
|
|
162
|
+
*
|
|
163
|
+
* 支付跳转等终态场景需要同时删除当前 cacheId 的 tempOrder 快照,并关闭
|
|
164
|
+
* 本实例后续异步任务的再次写入;新模块实例初始化时会按 otherParams 重新启用。
|
|
165
|
+
*/
|
|
166
|
+
clearSessionStoragePersistedTempOrder(): void;
|
|
159
167
|
consumeSessionStorageRestore(): Record<string, any> | null;
|
|
160
168
|
notifyTempOrderChanged(): void;
|
|
161
169
|
private createDefaultTempOrderInstance;
|
|
@@ -188,6 +196,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
188
196
|
orderExpectedAmount: string;
|
|
189
197
|
};
|
|
190
198
|
private calculateDepositPaidAmount;
|
|
199
|
+
private hasPaidNormalPayment;
|
|
191
200
|
private resolveNextOrderPaymentType;
|
|
192
201
|
private getPaymentNumberAppData;
|
|
193
202
|
private getPaymentNumberDevicePrefixSync;
|
|
@@ -365,6 +374,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
365
374
|
updateVoucherOrderPaymentsAsync(payments: OrderPaymentSource[], options?: {
|
|
366
375
|
status?: 'paid' | 'payment_pending';
|
|
367
376
|
}): Promise<OrderPaymentData[]>;
|
|
377
|
+
private normalizeShouldMergeProductResult;
|
|
368
378
|
private shouldMergeProductToOrder;
|
|
369
379
|
private hasOrderProductLineNote;
|
|
370
380
|
/**
|
|
@@ -374,6 +384,13 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
374
384
|
* this.hasLinkedBookingUid({ metadata: { booking_uid: 'booking-1' } });
|
|
375
385
|
*/
|
|
376
386
|
private hasLinkedBookingUid;
|
|
387
|
+
private isMultiCurrencySettlementEnabled;
|
|
388
|
+
private isActiveVirtualSettlementOrder;
|
|
389
|
+
private shouldUseVirtualSettlementSummary;
|
|
390
|
+
private normalizeVirtualSettlementProductIfEnabled;
|
|
391
|
+
private assertAndLockProductSettlement;
|
|
392
|
+
private syncTempOrderSettlementState;
|
|
393
|
+
private prepareVirtualSettlementTempOrder;
|
|
377
394
|
/**
|
|
378
395
|
* 预约商品加车后的统一收尾:促销、折扣、summary 重算与持久化(批量拆行时只调用一次)。
|
|
379
396
|
*
|
|
@@ -386,7 +403,12 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
386
403
|
* 带 booking 且 num>1 时由 `addProductToOrder` 拆成多次本方法调用(每次 num=1)。
|
|
387
404
|
*
|
|
388
405
|
* @example
|
|
389
|
-
*
|
|
406
|
+
* const pending = this.appendProductLineToTempOrder(
|
|
407
|
+
* tempOrder,
|
|
408
|
+
* { product_id: 1, num: 1 },
|
|
409
|
+
* booking,
|
|
410
|
+
* );
|
|
411
|
+
* if (pending) await pending;
|
|
390
412
|
*/
|
|
391
413
|
private appendProductLineToTempOrder;
|
|
392
414
|
/**
|
|
@@ -396,7 +418,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
396
418
|
* await order.addProductToOrder({ product_id: 1, num: 3 }, { start_time: '10:00' });
|
|
397
419
|
* // → tempOrder.products 新增 3 行,每行 num=1,bookings 3 条
|
|
398
420
|
*/
|
|
399
|
-
addProductToOrder(product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput): Promise<OrderProduct[]>;
|
|
421
|
+
addProductToOrder(product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions): Promise<OrderProduct[]>;
|
|
400
422
|
/**
|
|
401
423
|
* 批量添加商品行,所有行追加完成后只触发一次促销、折扣、summary 重算与持久化。
|
|
402
424
|
*
|
|
@@ -434,13 +456,17 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
434
456
|
* @example
|
|
435
457
|
* await order.removeProductsFromOrder([identityA, identityB]);
|
|
436
458
|
*/
|
|
437
|
-
removeProductsFromOrder(identities: OrderProductIdentity[]): Promise<OrderProduct[]>;
|
|
438
|
-
removeProductFromOrder(identity: OrderProductIdentity): Promise<OrderProduct[]>;
|
|
459
|
+
removeProductsFromOrder(identities: OrderProductIdentity[], options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
460
|
+
removeProductFromOrder(identity: OrderProductIdentity, options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
439
461
|
/**
|
|
440
462
|
* 仅清空购物车行(products / bookings),不重置整单。
|
|
441
463
|
* 用于「仅清空商品」;客户、备注、支付等协议字段保持不变。
|
|
442
464
|
*/
|
|
443
465
|
clearOrderCartLines(): Promise<OrderTempOrder>;
|
|
466
|
+
/**
|
|
467
|
+
* 切换购物车结算单位时清理所有会影响新币种的订单状态,但保留当前客户。
|
|
468
|
+
*/
|
|
469
|
+
clearOrderForSettlementSwitch(): Promise<OrderTempOrder>;
|
|
444
470
|
buildCurrentSubmitPayloadForLocalPrint(params?: {
|
|
445
471
|
cacheId?: string;
|
|
446
472
|
platform?: string;
|
|
@@ -575,4 +601,4 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
575
601
|
getOrderInfo(order_id: number): Promise<any>;
|
|
576
602
|
getVouchers(): any[];
|
|
577
603
|
}
|
|
578
|
-
export type { UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|
|
604
|
+
export type { AddProductToOrderOptions, RemoveProductsFromOrderOptions, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|