@pisell/pisellos 0.0.42 → 0.0.44
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/modules/Order/index.d.ts +1 -0
- package/dist/modules/Order/index.js +8 -3
- package/dist/solution/BookingByStep/index.d.ts +4 -0
- package/dist/solution/BookingByStep/index.js +88 -65
- package/lib/modules/Order/index.d.ts +1 -0
- package/lib/modules/Order/index.js +7 -2
- package/lib/solution/BookingByStep/index.d.ts +4 -0
- package/lib/solution/BookingByStep/index.js +6 -0
- package/package.json +1 -1
|
@@ -60,14 +60,20 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
60
60
|
order_sales_channel: "online_store",
|
|
61
61
|
bookings: [],
|
|
62
62
|
shop_note: "",
|
|
63
|
-
schedule_date: ""
|
|
63
|
+
schedule_date: "",
|
|
64
|
+
is_deposit: 0
|
|
64
65
|
};
|
|
66
|
+
var is_deposit = 0; // 是否存在定金,0 不存在,1 存在
|
|
65
67
|
if (params.cartItems.length > 0) {
|
|
66
68
|
params.cartItems.forEach(function (item) {
|
|
67
69
|
order.bookings.push(item._origin);
|
|
70
|
+
if (item !== null && item !== void 0 && item.deposit) {
|
|
71
|
+
is_deposit = 1;
|
|
72
|
+
}
|
|
68
73
|
});
|
|
69
74
|
var firstCartItem = params.cartItems[0];
|
|
70
75
|
order.schedule_date = firstCartItem.start_date + " " + firstCartItem.start_time + ":00";
|
|
76
|
+
order.is_deposit = is_deposit;
|
|
71
77
|
}
|
|
72
78
|
return order;
|
|
73
79
|
}
|
|
@@ -82,9 +88,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
82
88
|
url = order.url, query = order.query;
|
|
83
89
|
fetchUrl = url || "/order/appointment";
|
|
84
90
|
params = this.createOrder(query);
|
|
85
|
-
console.log(params);
|
|
86
91
|
return _context2.abrupt("return", this.request.post(fetchUrl, params));
|
|
87
|
-
case
|
|
92
|
+
case 4:
|
|
88
93
|
case "end":
|
|
89
94
|
return _context2.stop();
|
|
90
95
|
}
|
|
@@ -70,6 +70,10 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
70
70
|
policies?: import("../../modules/Summary/types").IProtocol[] | undefined;
|
|
71
71
|
} | undefined;
|
|
72
72
|
}>;
|
|
73
|
+
/**
|
|
74
|
+
* 获取协议
|
|
75
|
+
*/
|
|
76
|
+
getProtocol(protocolId: string): Promise<any>;
|
|
73
77
|
getProducts(): Promise<ProductData[]>;
|
|
74
78
|
setLoginAccount(accountId: string, accountInfo: Account): Promise<void>;
|
|
75
79
|
generateCartData(): Promise<void>;
|
|
@@ -527,22 +527,45 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
527
527
|
return _getSummary.apply(this, arguments);
|
|
528
528
|
}
|
|
529
529
|
return getSummary;
|
|
530
|
-
}()
|
|
530
|
+
}()
|
|
531
|
+
/**
|
|
532
|
+
* 获取协议
|
|
533
|
+
*/
|
|
531
534
|
)
|
|
532
535
|
}, {
|
|
533
|
-
key: "
|
|
534
|
-
value: function () {
|
|
535
|
-
var
|
|
536
|
+
key: "getProtocol",
|
|
537
|
+
value: (function () {
|
|
538
|
+
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(protocolId) {
|
|
536
539
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
537
540
|
while (1) switch (_context12.prev = _context12.next) {
|
|
538
541
|
case 0:
|
|
539
|
-
return _context12.abrupt("return", this.store.
|
|
542
|
+
return _context12.abrupt("return", this.store.summary.getProtocol(protocolId));
|
|
540
543
|
case 1:
|
|
541
544
|
case "end":
|
|
542
545
|
return _context12.stop();
|
|
543
546
|
}
|
|
544
547
|
}, _callee12, this);
|
|
545
548
|
}));
|
|
549
|
+
function getProtocol(_x8) {
|
|
550
|
+
return _getProtocol.apply(this, arguments);
|
|
551
|
+
}
|
|
552
|
+
return getProtocol;
|
|
553
|
+
}() // 获取可选择的商品、服务列表
|
|
554
|
+
)
|
|
555
|
+
}, {
|
|
556
|
+
key: "getProducts",
|
|
557
|
+
value: function () {
|
|
558
|
+
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
559
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
560
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
561
|
+
case 0:
|
|
562
|
+
return _context13.abrupt("return", this.store.products.getProducts());
|
|
563
|
+
case 1:
|
|
564
|
+
case "end":
|
|
565
|
+
return _context13.stop();
|
|
566
|
+
}
|
|
567
|
+
}, _callee13, this);
|
|
568
|
+
}));
|
|
546
569
|
function getProducts() {
|
|
547
570
|
return _getProducts.apply(this, arguments);
|
|
548
571
|
}
|
|
@@ -551,15 +574,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
551
574
|
}, {
|
|
552
575
|
key: "setLoginAccount",
|
|
553
576
|
value: function () {
|
|
554
|
-
var _setLoginAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
577
|
+
var _setLoginAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(accountId, accountInfo) {
|
|
555
578
|
var _this4 = this;
|
|
556
579
|
var account, stateAccountId, cartItems;
|
|
557
|
-
return _regeneratorRuntime().wrap(function
|
|
558
|
-
while (1) switch (
|
|
580
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
581
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
559
582
|
case 0:
|
|
560
583
|
account = this.store.accountList.getAccount(accountId);
|
|
561
584
|
if (!account) {
|
|
562
|
-
|
|
585
|
+
_context14.next = 9;
|
|
563
586
|
break;
|
|
564
587
|
}
|
|
565
588
|
stateAccountId = account.getId();
|
|
@@ -575,17 +598,17 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
575
598
|
}
|
|
576
599
|
});
|
|
577
600
|
this.store.accountList.updateAccountListById(stateAccountId, accountInfo);
|
|
578
|
-
|
|
601
|
+
_context14.next = 10;
|
|
579
602
|
break;
|
|
580
603
|
case 9:
|
|
581
604
|
throw new Error("\u6CA1\u6709\u627E\u5230".concat(accountId, "\u8D26\u6237"));
|
|
582
605
|
case 10:
|
|
583
606
|
case "end":
|
|
584
|
-
return
|
|
607
|
+
return _context14.stop();
|
|
585
608
|
}
|
|
586
|
-
},
|
|
609
|
+
}, _callee14, this);
|
|
587
610
|
}));
|
|
588
|
-
function setLoginAccount(
|
|
611
|
+
function setLoginAccount(_x9, _x10) {
|
|
589
612
|
return _setLoginAccount.apply(this, arguments);
|
|
590
613
|
}
|
|
591
614
|
return setLoginAccount;
|
|
@@ -593,14 +616,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
593
616
|
}, {
|
|
594
617
|
key: "generateCartData",
|
|
595
618
|
value: function () {
|
|
596
|
-
var _generateCartData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
597
|
-
return _regeneratorRuntime().wrap(function
|
|
598
|
-
while (1) switch (
|
|
619
|
+
var _generateCartData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
620
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
621
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
599
622
|
case 0:
|
|
600
623
|
case "end":
|
|
601
|
-
return
|
|
624
|
+
return _context15.stop();
|
|
602
625
|
}
|
|
603
|
-
},
|
|
626
|
+
}, _callee15);
|
|
604
627
|
}));
|
|
605
628
|
function generateCartData() {
|
|
606
629
|
return _generateCartData.apply(this, arguments);
|
|
@@ -610,23 +633,23 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
610
633
|
}, {
|
|
611
634
|
key: "getFreeProduct",
|
|
612
635
|
value: function () {
|
|
613
|
-
var _getFreeProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
636
|
+
var _getFreeProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(id) {
|
|
614
637
|
var res;
|
|
615
|
-
return _regeneratorRuntime().wrap(function
|
|
616
|
-
while (1) switch (
|
|
638
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
639
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
617
640
|
case 0:
|
|
618
|
-
|
|
641
|
+
_context16.next = 2;
|
|
619
642
|
return this.request.post("/pay/order/free-pay/".concat(id));
|
|
620
643
|
case 2:
|
|
621
|
-
res =
|
|
622
|
-
return
|
|
644
|
+
res = _context16.sent;
|
|
645
|
+
return _context16.abrupt("return", res);
|
|
623
646
|
case 4:
|
|
624
647
|
case "end":
|
|
625
|
-
return
|
|
648
|
+
return _context16.stop();
|
|
626
649
|
}
|
|
627
|
-
},
|
|
650
|
+
}, _callee16, this);
|
|
628
651
|
}));
|
|
629
|
-
function getFreeProduct(
|
|
652
|
+
function getFreeProduct(_x11) {
|
|
630
653
|
return _getFreeProduct.apply(this, arguments);
|
|
631
654
|
}
|
|
632
655
|
return getFreeProduct;
|
|
@@ -634,10 +657,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
634
657
|
}, {
|
|
635
658
|
key: "submitOrder",
|
|
636
659
|
value: function () {
|
|
637
|
-
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
660
|
+
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
638
661
|
var cartItems, newCartItems;
|
|
639
|
-
return _regeneratorRuntime().wrap(function
|
|
640
|
-
while (1) switch (
|
|
662
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
663
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
641
664
|
case 0:
|
|
642
665
|
cartItems = this.store.cart.getItems();
|
|
643
666
|
newCartItems = cloneDeep(cartItems); // 先整个临时的逻辑,把购物车里所有商品的资源给他格式化一下
|
|
@@ -650,16 +673,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
650
673
|
return _objectSpread({}, newResourcesItem);
|
|
651
674
|
});
|
|
652
675
|
});
|
|
653
|
-
return
|
|
676
|
+
return _context17.abrupt("return", this.store.order.commitOrder({
|
|
654
677
|
query: {
|
|
655
678
|
cartItems: newCartItems
|
|
656
679
|
}
|
|
657
680
|
}));
|
|
658
681
|
case 4:
|
|
659
682
|
case "end":
|
|
660
|
-
return
|
|
683
|
+
return _context17.stop();
|
|
661
684
|
}
|
|
662
|
-
},
|
|
685
|
+
}, _callee17, this);
|
|
663
686
|
}));
|
|
664
687
|
function submitOrder() {
|
|
665
688
|
return _submitOrder.apply(this, arguments);
|
|
@@ -669,14 +692,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
669
692
|
}, {
|
|
670
693
|
key: "pay",
|
|
671
694
|
value: function () {
|
|
672
|
-
var _pay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
673
|
-
return _regeneratorRuntime().wrap(function
|
|
674
|
-
while (1) switch (
|
|
695
|
+
var _pay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
696
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
697
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
675
698
|
case 0:
|
|
676
699
|
case "end":
|
|
677
|
-
return
|
|
700
|
+
return _context18.stop();
|
|
678
701
|
}
|
|
679
|
-
},
|
|
702
|
+
}, _callee18);
|
|
680
703
|
}));
|
|
681
704
|
function pay() {
|
|
682
705
|
return _pay.apply(this, arguments);
|
|
@@ -686,14 +709,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
686
709
|
}, {
|
|
687
710
|
key: "getPayInfo",
|
|
688
711
|
value: function () {
|
|
689
|
-
var _getPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
690
|
-
return _regeneratorRuntime().wrap(function
|
|
691
|
-
while (1) switch (
|
|
712
|
+
var _getPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
713
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
714
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
692
715
|
case 0:
|
|
693
716
|
case "end":
|
|
694
|
-
return
|
|
717
|
+
return _context19.stop();
|
|
695
718
|
}
|
|
696
|
-
},
|
|
719
|
+
}, _callee19);
|
|
697
720
|
}));
|
|
698
721
|
function getPayInfo() {
|
|
699
722
|
return _getPayInfo.apply(this, arguments);
|
|
@@ -703,15 +726,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
703
726
|
}, {
|
|
704
727
|
key: "setOtherParams",
|
|
705
728
|
value: function () {
|
|
706
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
729
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
707
730
|
var _ref5,
|
|
708
731
|
_ref5$cover,
|
|
709
732
|
cover,
|
|
710
|
-
|
|
711
|
-
return _regeneratorRuntime().wrap(function
|
|
712
|
-
while (1) switch (
|
|
733
|
+
_args20 = arguments;
|
|
734
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
735
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
713
736
|
case 0:
|
|
714
|
-
_ref5 =
|
|
737
|
+
_ref5 = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {}, _ref5$cover = _ref5.cover, cover = _ref5$cover === void 0 ? false : _ref5$cover;
|
|
715
738
|
if (cover) {
|
|
716
739
|
this.otherParams = params;
|
|
717
740
|
} else {
|
|
@@ -719,11 +742,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
719
742
|
}
|
|
720
743
|
case 2:
|
|
721
744
|
case "end":
|
|
722
|
-
return
|
|
745
|
+
return _context20.stop();
|
|
723
746
|
}
|
|
724
|
-
},
|
|
747
|
+
}, _callee20, this);
|
|
725
748
|
}));
|
|
726
|
-
function setOtherParams(
|
|
749
|
+
function setOtherParams(_x12) {
|
|
727
750
|
return _setOtherParams.apply(this, arguments);
|
|
728
751
|
}
|
|
729
752
|
return setOtherParams;
|
|
@@ -731,16 +754,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
731
754
|
}, {
|
|
732
755
|
key: "getOtherParams",
|
|
733
756
|
value: function () {
|
|
734
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
735
|
-
return _regeneratorRuntime().wrap(function
|
|
736
|
-
while (1) switch (
|
|
757
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
758
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
759
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
737
760
|
case 0:
|
|
738
|
-
return
|
|
761
|
+
return _context21.abrupt("return", this.otherParams);
|
|
739
762
|
case 1:
|
|
740
763
|
case "end":
|
|
741
|
-
return
|
|
764
|
+
return _context21.stop();
|
|
742
765
|
}
|
|
743
|
-
},
|
|
766
|
+
}, _callee21, this);
|
|
744
767
|
}));
|
|
745
768
|
function getOtherParams() {
|
|
746
769
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -1327,25 +1350,25 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1327
1350
|
}, {
|
|
1328
1351
|
key: "openProductDetail",
|
|
1329
1352
|
value: function () {
|
|
1330
|
-
var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1353
|
+
var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(productId) {
|
|
1331
1354
|
var targetProduct;
|
|
1332
|
-
return _regeneratorRuntime().wrap(function
|
|
1333
|
-
while (1) switch (
|
|
1355
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1356
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1334
1357
|
case 0:
|
|
1335
|
-
|
|
1358
|
+
_context22.next = 2;
|
|
1336
1359
|
return this.store.products.getProduct(productId);
|
|
1337
1360
|
case 2:
|
|
1338
|
-
targetProduct =
|
|
1361
|
+
targetProduct = _context22.sent;
|
|
1339
1362
|
if (targetProduct) {
|
|
1340
1363
|
this.store.currentProduct = targetProduct;
|
|
1341
1364
|
}
|
|
1342
1365
|
case 4:
|
|
1343
1366
|
case "end":
|
|
1344
|
-
return
|
|
1367
|
+
return _context22.stop();
|
|
1345
1368
|
}
|
|
1346
|
-
},
|
|
1369
|
+
}, _callee22, this);
|
|
1347
1370
|
}));
|
|
1348
|
-
function openProductDetail(
|
|
1371
|
+
function openProductDetail(_x13) {
|
|
1349
1372
|
return _openProductDetail.apply(this, arguments);
|
|
1350
1373
|
}
|
|
1351
1374
|
return openProductDetail;
|
|
@@ -42,14 +42,20 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
42
42
|
order_sales_channel: "online_store",
|
|
43
43
|
bookings: [],
|
|
44
44
|
shop_note: "",
|
|
45
|
-
schedule_date: ""
|
|
45
|
+
schedule_date: "",
|
|
46
|
+
is_deposit: 0
|
|
46
47
|
};
|
|
48
|
+
let is_deposit = 0;
|
|
47
49
|
if (params.cartItems.length > 0) {
|
|
48
50
|
params.cartItems.forEach((item) => {
|
|
49
51
|
order.bookings.push(item._origin);
|
|
52
|
+
if (item == null ? void 0 : item.deposit) {
|
|
53
|
+
is_deposit = 1;
|
|
54
|
+
}
|
|
50
55
|
});
|
|
51
56
|
const firstCartItem = params.cartItems[0];
|
|
52
57
|
order.schedule_date = firstCartItem.start_date + " " + firstCartItem.start_time + ":00";
|
|
58
|
+
order.is_deposit = is_deposit;
|
|
53
59
|
}
|
|
54
60
|
return order;
|
|
55
61
|
}
|
|
@@ -57,7 +63,6 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
57
63
|
const { url, query } = order;
|
|
58
64
|
const fetchUrl = url || "/order/appointment";
|
|
59
65
|
const params = this.createOrder(query);
|
|
60
|
-
console.log(params);
|
|
61
66
|
return this.request.post(fetchUrl, params);
|
|
62
67
|
}
|
|
63
68
|
};
|
|
@@ -70,6 +70,10 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
70
70
|
policies?: import("../../modules/Summary/types").IProtocol[] | undefined;
|
|
71
71
|
} | undefined;
|
|
72
72
|
}>;
|
|
73
|
+
/**
|
|
74
|
+
* 获取协议
|
|
75
|
+
*/
|
|
76
|
+
getProtocol(protocolId: string): Promise<any>;
|
|
73
77
|
getProducts(): Promise<ProductData[]>;
|
|
74
78
|
setLoginAccount(accountId: string, accountInfo: Account): Promise<void>;
|
|
75
79
|
generateCartData(): Promise<void>;
|
|
@@ -252,6 +252,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
252
252
|
const summary = await this.store.summary.getSummary(cartItems);
|
|
253
253
|
return summary;
|
|
254
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* 获取协议
|
|
257
|
+
*/
|
|
258
|
+
async getProtocol(protocolId) {
|
|
259
|
+
return this.store.summary.getProtocol(protocolId);
|
|
260
|
+
}
|
|
255
261
|
// 获取可选择的商品、服务列表
|
|
256
262
|
async getProducts() {
|
|
257
263
|
return this.store.products.getProducts();
|