@pisell/pisellos 3.0.49 → 3.0.50
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.js +2 -2
- package/dist/modules/Order/types.d.ts +1 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -0
- package/dist/solution/BookingByStep/index.js +9 -4
- package/lib/modules/Order/index.js +5 -3
- package/lib/modules/Order/types.d.ts +1 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -0
- package/lib/solution/BookingByStep/index.js +16 -7
- package/package.json +1 -1
|
@@ -62,9 +62,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
62
62
|
key: "createOrder",
|
|
63
63
|
value: function createOrder(params) {
|
|
64
64
|
var order = {
|
|
65
|
-
type: params.type || 'appointment_booking',
|
|
65
|
+
type: (params === null || params === void 0 ? void 0 : params.type) || 'appointment_booking',
|
|
66
66
|
// 要从外面拿,virtual
|
|
67
|
-
platform: 'H5',
|
|
67
|
+
platform: (params === null || params === void 0 ? void 0 : params.platform) === 'pc' ? 'PC' : 'H5',
|
|
68
68
|
sales_channel: 'my_pisel',
|
|
69
69
|
order_sales_channel: 'online_store',
|
|
70
70
|
bookings: [],
|
|
@@ -21,6 +21,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
21
21
|
private otherParams;
|
|
22
22
|
private cacheId;
|
|
23
23
|
private otherData;
|
|
24
|
+
private platform;
|
|
24
25
|
initialize(core: PisellCore, options: any): Promise<void>;
|
|
25
26
|
initStep(stepList: (keyof BookingByStepState)[]): void;
|
|
26
27
|
getCurrentStep(): {
|
|
@@ -61,15 +61,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
61
61
|
_defineProperty(_assertThisInitialized(_this), "otherParams", {});
|
|
62
62
|
_defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
|
|
63
63
|
_defineProperty(_assertThisInitialized(_this), "otherData", {});
|
|
64
|
+
// 提供给 UI 层的临时数据存储,会进缓存
|
|
65
|
+
_defineProperty(_assertThisInitialized(_this), "platform", void 0);
|
|
64
66
|
return _this;
|
|
65
67
|
}
|
|
66
68
|
_createClass(BookingByStepImpl, [{
|
|
67
69
|
key: "initialize",
|
|
68
|
-
value: //
|
|
70
|
+
value: // 平台类型,用于判断是 PC / H5
|
|
69
71
|
function () {
|
|
70
72
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
71
73
|
var _this$otherParams,
|
|
72
74
|
_this$otherParams2,
|
|
75
|
+
_this$otherParams3,
|
|
73
76
|
_this2 = this;
|
|
74
77
|
var targetCacheData, sessionData, _data$this$otherParam, data, moduleArr;
|
|
75
78
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -99,7 +102,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
99
102
|
// 并且在上面 registerModule 的时候,读取 sessionStroage 里的数据,塞进默认值
|
|
100
103
|
targetCacheData = {};
|
|
101
104
|
this.cacheId = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.cacheId;
|
|
102
|
-
|
|
105
|
+
this.platform = (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.platform;
|
|
106
|
+
if ((_this$otherParams3 = this.otherParams) !== null && _this$otherParams3 !== void 0 && _this$otherParams3.cacheId) {
|
|
103
107
|
sessionData = this.window.sessionStorage.getItem(this.name);
|
|
104
108
|
if (sessionData) {
|
|
105
109
|
data = JSON.parse(sessionData); // 匹配 cacheid,如果匹配不到,直接把 sessionData 清掉即可
|
|
@@ -128,7 +132,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
128
132
|
});
|
|
129
133
|
this.store.schedule.loadAllSchedule();
|
|
130
134
|
this.core.effects.emit(BookingByStepHooks.onInited, {});
|
|
131
|
-
case
|
|
135
|
+
case 19:
|
|
132
136
|
case "end":
|
|
133
137
|
return _context.stop();
|
|
134
138
|
}
|
|
@@ -989,7 +993,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
989
993
|
return _context19.abrupt("return", this.store.order.submitOrder({
|
|
990
994
|
query: {
|
|
991
995
|
cartItems: newCartItems,
|
|
992
|
-
type: type
|
|
996
|
+
type: type,
|
|
997
|
+
platform: this.platform
|
|
993
998
|
}
|
|
994
999
|
}));
|
|
995
1000
|
case 6:
|
|
@@ -39,9 +39,9 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
39
39
|
createOrder(params) {
|
|
40
40
|
var _a;
|
|
41
41
|
const order = {
|
|
42
|
-
type: params.type || "appointment_booking",
|
|
42
|
+
type: (params == null ? void 0 : params.type) || "appointment_booking",
|
|
43
43
|
// 要从外面拿,virtual
|
|
44
|
-
platform: "H5",
|
|
44
|
+
platform: (params == null ? void 0 : params.platform) === "pc" ? "PC" : "H5",
|
|
45
45
|
sales_channel: "my_pisel",
|
|
46
46
|
order_sales_channel: "online_store",
|
|
47
47
|
bookings: [],
|
|
@@ -74,7 +74,9 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
76
|
if (order.type === "appointment_booking") {
|
|
77
|
-
const firstAppointmentCartItem = (_a = params.cartItems.filter(
|
|
77
|
+
const firstAppointmentCartItem = (_a = params.cartItems.filter(
|
|
78
|
+
(n) => !(0, import_utils2.isNormalProduct)(n._productOrigin)
|
|
79
|
+
)) == null ? void 0 : _a[0];
|
|
78
80
|
if (firstAppointmentCartItem) {
|
|
79
81
|
order.schedule_date = firstAppointmentCartItem.start_date + " " + firstAppointmentCartItem.start_time + ":00";
|
|
80
82
|
}
|
|
@@ -21,6 +21,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
21
21
|
private otherParams;
|
|
22
22
|
private cacheId;
|
|
23
23
|
private otherData;
|
|
24
|
+
private platform;
|
|
24
25
|
initialize(core: PisellCore, options: any): Promise<void>;
|
|
25
26
|
initStep(stepList: (keyof BookingByStepState)[]): void;
|
|
26
27
|
getCurrentStep(): {
|
|
@@ -58,9 +58,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
58
58
|
this.otherParams = {};
|
|
59
59
|
this.otherData = {};
|
|
60
60
|
}
|
|
61
|
-
//
|
|
61
|
+
// 平台类型,用于判断是 PC / H5
|
|
62
62
|
async initialize(core, options) {
|
|
63
|
-
var _a, _b, _c, _d;
|
|
63
|
+
var _a, _b, _c, _d, _e;
|
|
64
64
|
this.core = core;
|
|
65
65
|
this.store = options.store || {};
|
|
66
66
|
this.otherParams = options.otherParams || {};
|
|
@@ -76,12 +76,13 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
76
76
|
}
|
|
77
77
|
let targetCacheData = {};
|
|
78
78
|
this.cacheId = (_a = this.otherParams) == null ? void 0 : _a.cacheId;
|
|
79
|
-
|
|
79
|
+
this.platform = (_b = this.otherParams) == null ? void 0 : _b.platform;
|
|
80
|
+
if ((_c = this.otherParams) == null ? void 0 : _c.cacheId) {
|
|
80
81
|
const sessionData = this.window.sessionStorage.getItem(this.name);
|
|
81
82
|
if (sessionData) {
|
|
82
83
|
const data = JSON.parse(sessionData);
|
|
83
84
|
targetCacheData = data[this.otherParams.cacheId];
|
|
84
|
-
this.otherData = ((
|
|
85
|
+
this.otherData = ((_e = (_d = data[this.otherParams.cacheId]) == null ? void 0 : _d[this.name]) == null ? void 0 : _e["otherData"]) || {};
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
const moduleArr = [
|
|
@@ -529,7 +530,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
529
530
|
type = "virtual";
|
|
530
531
|
}
|
|
531
532
|
return this.store.order.submitOrder({
|
|
532
|
-
query: {
|
|
533
|
+
query: {
|
|
534
|
+
cartItems: newCartItems,
|
|
535
|
+
type,
|
|
536
|
+
platform: this.platform
|
|
537
|
+
}
|
|
533
538
|
});
|
|
534
539
|
}
|
|
535
540
|
// 拉起支付模块
|
|
@@ -827,7 +832,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
827
832
|
if (!resources.length) {
|
|
828
833
|
const firstDateCartItem = cartItems == null ? void 0 : cartItems.find((n) => n.start_date);
|
|
829
834
|
if (firstDateCartItem == null ? void 0 : firstDateCartItem.start_date) {
|
|
830
|
-
const dateResources = this.store.date.getResourcesListByDate(
|
|
835
|
+
const dateResources = this.store.date.getResourcesListByDate(
|
|
836
|
+
firstDateCartItem.start_date
|
|
837
|
+
);
|
|
831
838
|
resources.push(...dateResources || []);
|
|
832
839
|
} else {
|
|
833
840
|
const dateList = this.store.date.getDateList();
|
|
@@ -1051,7 +1058,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1051
1058
|
if (!AllResources.length) {
|
|
1052
1059
|
const firstDateCartItem = cartItems == null ? void 0 : cartItems.find((n) => n.start_date);
|
|
1053
1060
|
if (firstDateCartItem == null ? void 0 : firstDateCartItem.start_date) {
|
|
1054
|
-
const dateResources = this.store.date.getResourcesListByDate(
|
|
1061
|
+
const dateResources = this.store.date.getResourcesListByDate(
|
|
1062
|
+
firstDateCartItem.start_date
|
|
1063
|
+
);
|
|
1055
1064
|
AllResources.push(...dateResources || []);
|
|
1056
1065
|
} else {
|
|
1057
1066
|
const dateList = this.store.date.getDateList();
|