@pisell/pisellos 2.1.180 → 2.1.183
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.
|
@@ -136,8 +136,8 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
136
136
|
key: "loadScheduleAvailableDate",
|
|
137
137
|
value: function () {
|
|
138
138
|
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref) {
|
|
139
|
-
var _res$data$
|
|
140
|
-
var startDate, endDate, custom_page_id, channel, dates, res;
|
|
139
|
+
var _res$data, _res$data2, _res$data3, _res$data4, _res$data5;
|
|
140
|
+
var startDate, endDate, custom_page_id, channel, dates, res, _res$data6;
|
|
141
141
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
142
142
|
while (1) switch (_context3.prev = _context3.next) {
|
|
143
143
|
case 0:
|
|
@@ -165,22 +165,22 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
165
165
|
});
|
|
166
166
|
case 8:
|
|
167
167
|
res = _context3.sent;
|
|
168
|
-
this.setAvailabilityScheduleDateList(res.data.date_list);
|
|
169
|
-
this.setOtherProductsIds(res.data.other_product_ids || []);
|
|
168
|
+
this.setAvailabilityScheduleDateList(((_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.date_list) || []);
|
|
169
|
+
this.setOtherProductsIds(((_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.other_product_ids) || []);
|
|
170
170
|
// 如果没有schedule或者结束日期在今天之前,则所有日期均不可用
|
|
171
|
-
if (!(!((_res$
|
|
171
|
+
if (!(!((_res$data3 = res.data) !== null && _res$data3 !== void 0 && (_res$data3 = _res$data3.date_list) !== null && _res$data3 !== void 0 && _res$data3.length) && !((_res$data4 = res.data) !== null && _res$data4 !== void 0 && (_res$data4 = _res$data4.other_product_ids) !== null && _res$data4 !== void 0 && _res$data4.length) || dayjs(endDate).isBefore(dayjs(), 'day'))) {
|
|
172
172
|
_context3.next = 13;
|
|
173
173
|
break;
|
|
174
174
|
}
|
|
175
175
|
return _context3.abrupt("return", dates);
|
|
176
176
|
case 13:
|
|
177
|
-
if ((_res$
|
|
177
|
+
if ((_res$data5 = res.data) !== null && _res$data5 !== void 0 && (_res$data5 = _res$data5.other_product_ids) !== null && _res$data5 !== void 0 && _res$data5.length) {
|
|
178
178
|
// 如果后端有返回 other_product_ids ,意味着有 duration 商品,则今天以及今天以后的日期均可用
|
|
179
179
|
dates.forEach(function (n) {
|
|
180
180
|
n.status = 'available';
|
|
181
181
|
});
|
|
182
182
|
} else {
|
|
183
|
-
res.data.date_list.forEach(function (n) {
|
|
183
|
+
(_res$data6 = res.data) === null || _res$data6 === void 0 || (_res$data6 = _res$data6.date_list) === null || _res$data6 === void 0 || _res$data6.forEach(function (n) {
|
|
184
184
|
var index = dates.findIndex(function (m) {
|
|
185
185
|
return m.date === n.date;
|
|
186
186
|
});
|
|
@@ -96,7 +96,7 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
|
96
96
|
custom_page_id,
|
|
97
97
|
channel
|
|
98
98
|
}) {
|
|
99
|
-
var _a, _b, _c;
|
|
99
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
100
100
|
if ((0, import_dayjs.default)(startDate).isBefore((0, import_dayjs.default)(), "day")) {
|
|
101
101
|
startDate = (0, import_dayjs.default)().format("YYYY-MM-DD");
|
|
102
102
|
}
|
|
@@ -114,17 +114,17 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
|
114
114
|
channel
|
|
115
115
|
}
|
|
116
116
|
);
|
|
117
|
-
this.setAvailabilityScheduleDateList(res.data.date_list);
|
|
118
|
-
this.setOtherProductsIds(res.data.other_product_ids || []);
|
|
119
|
-
if (!((
|
|
117
|
+
this.setAvailabilityScheduleDateList(((_a = res.data) == null ? void 0 : _a.date_list) || []);
|
|
118
|
+
this.setOtherProductsIds(((_b = res.data) == null ? void 0 : _b.other_product_ids) || []);
|
|
119
|
+
if (!((_d = (_c = res.data) == null ? void 0 : _c.date_list) == null ? void 0 : _d.length) && !((_f = (_e = res.data) == null ? void 0 : _e.other_product_ids) == null ? void 0 : _f.length) || (0, import_dayjs.default)(endDate).isBefore((0, import_dayjs.default)(), "day")) {
|
|
120
120
|
return dates;
|
|
121
121
|
}
|
|
122
|
-
if ((
|
|
122
|
+
if ((_h = (_g = res.data) == null ? void 0 : _g.other_product_ids) == null ? void 0 : _h.length) {
|
|
123
123
|
dates.forEach((n) => {
|
|
124
124
|
n.status = "available";
|
|
125
125
|
});
|
|
126
126
|
} else {
|
|
127
|
-
res.data.date_list.forEach((n) => {
|
|
127
|
+
(_j = (_i = res.data) == null ? void 0 : _i.date_list) == null ? void 0 : _j.forEach((n) => {
|
|
128
128
|
const index = dates.findIndex((m) => m.date === n.date);
|
|
129
129
|
if (index !== -1) {
|
|
130
130
|
dates[index].status = "available";
|