@pisell/pisellos 0.0.240 → 0.0.241
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.
|
@@ -560,7 +560,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
560
560
|
key: "getCustomerWallet",
|
|
561
561
|
value: function () {
|
|
562
562
|
var _getCustomerWallet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(id) {
|
|
563
|
-
var
|
|
563
|
+
var _result, customer;
|
|
564
564
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
565
565
|
while (1) switch (_context7.prev = _context7.next) {
|
|
566
566
|
case 0:
|
|
@@ -570,12 +570,12 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
570
570
|
with_trashed: 1
|
|
571
571
|
});
|
|
572
572
|
case 3:
|
|
573
|
-
|
|
574
|
-
if (!(
|
|
573
|
+
_result = _context7.sent;
|
|
574
|
+
if (!(_result !== null && _result !== void 0 && _result.data)) {
|
|
575
575
|
_context7.next = 9;
|
|
576
576
|
break;
|
|
577
577
|
}
|
|
578
|
-
customer = Object.assign({}, (_objectDestructuringEmpty(
|
|
578
|
+
customer = Object.assign({}, (_objectDestructuringEmpty(_result.data), _result.data));
|
|
579
579
|
this.setCustomer(customer);
|
|
580
580
|
_context7.next = 9;
|
|
581
581
|
return this.core.effects.emit(ShopDiscountHooks.onScanCustomerChange, customer);
|
|
@@ -600,31 +600,32 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
600
600
|
}, {
|
|
601
601
|
key: "bestDiscount",
|
|
602
602
|
value: function () {
|
|
603
|
-
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
603
|
+
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(cb) {
|
|
604
604
|
var _this$store$productLi;
|
|
605
|
-
var newDiscountList,
|
|
605
|
+
var newDiscountList, _result2;
|
|
606
606
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
607
607
|
while (1) switch (_context8.prev = _context8.next) {
|
|
608
608
|
case 0:
|
|
609
609
|
newDiscountList = this.store.originalDiscountList;
|
|
610
610
|
this.setDiscountList(newDiscountList);
|
|
611
611
|
if (!((_this$store$productLi = this.store.productList) !== null && _this$store$productLi !== void 0 && _this$store$productLi.length)) {
|
|
612
|
-
_context8.next =
|
|
612
|
+
_context8.next = 7;
|
|
613
613
|
break;
|
|
614
614
|
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
615
|
+
_result2 = this.calcDiscount(this.store.productList);
|
|
616
|
+
cb === null || cb === void 0 || cb(_result2);
|
|
617
|
+
_context8.next = 7;
|
|
618
|
+
return this.core.effects.emit(ShopDiscountHooks.onLoadPrepareCalcResult, _result2);
|
|
619
|
+
case 7:
|
|
620
|
+
_context8.next = 9;
|
|
620
621
|
return this.core.effects.emit(ShopDiscountHooks.onLoadDiscountList, newDiscountList);
|
|
621
|
-
case
|
|
622
|
+
case 9:
|
|
622
623
|
case "end":
|
|
623
624
|
return _context8.stop();
|
|
624
625
|
}
|
|
625
626
|
}, _callee8, this);
|
|
626
627
|
}));
|
|
627
|
-
function bestDiscount() {
|
|
628
|
+
function bestDiscount(_x8) {
|
|
628
629
|
return _bestDiscount.apply(this, arguments);
|
|
629
630
|
}
|
|
630
631
|
return bestDiscount;
|
|
@@ -633,7 +634,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
633
634
|
key: "loadPrepareConfig",
|
|
634
635
|
value: function () {
|
|
635
636
|
var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
|
|
636
|
-
var _this$getCustomer2, _this$store$discount7, _this$getDiscountList, _this$store$productLi2, customerId, goodPassList, scanDiscount, scanDiscountIds, newGoodPassList, newDiscountList,
|
|
637
|
+
var _this$getCustomer2, _this$store$discount7, _this$getDiscountList, _this$store$productLi2, customerId, goodPassList, scanDiscount, scanDiscountIds, newGoodPassList, newDiscountList, _result3;
|
|
637
638
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
638
639
|
while (1) switch (_context9.prev = _context9.next) {
|
|
639
640
|
case 0:
|
|
@@ -666,9 +667,9 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
666
667
|
_context9.next = 15;
|
|
667
668
|
break;
|
|
668
669
|
}
|
|
669
|
-
|
|
670
|
+
_result3 = this.calcDiscount(this.store.productList);
|
|
670
671
|
_context9.next = 15;
|
|
671
|
-
return this.core.effects.emit(ShopDiscountHooks.onLoadPrepareCalcResult,
|
|
672
|
+
return this.core.effects.emit(ShopDiscountHooks.onLoadPrepareCalcResult, _result3);
|
|
672
673
|
case 15:
|
|
673
674
|
_context9.next = 17;
|
|
674
675
|
return this.core.effects.emit(ShopDiscountHooks.onLoadDiscountList, newDiscountList);
|
|
@@ -685,7 +686,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
685
686
|
}
|
|
686
687
|
}, _callee9, this, [[0, 19]]);
|
|
687
688
|
}));
|
|
688
|
-
function loadPrepareConfig(
|
|
689
|
+
function loadPrepareConfig(_x9) {
|
|
689
690
|
return _loadPrepareConfig.apply(this, arguments);
|
|
690
691
|
}
|
|
691
692
|
return loadPrepareConfig;
|
|
@@ -397,12 +397,13 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
397
397
|
console.error("[ShopDiscount] 获取客户钱包信息出错:", error);
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
|
-
async bestDiscount() {
|
|
400
|
+
async bestDiscount(cb) {
|
|
401
401
|
var _a;
|
|
402
402
|
const newDiscountList = this.store.originalDiscountList;
|
|
403
403
|
this.setDiscountList(newDiscountList);
|
|
404
404
|
if ((_a = this.store.productList) == null ? void 0 : _a.length) {
|
|
405
405
|
const result = this.calcDiscount(this.store.productList);
|
|
406
|
+
cb == null ? void 0 : cb(result);
|
|
406
407
|
await this.core.effects.emit(
|
|
407
408
|
import_types.ShopDiscountHooks.onLoadPrepareCalcResult,
|
|
408
409
|
result
|