@pisell/pisellos 2.1.129 → 2.1.131
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/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/Order/index.d.ts +7 -6
- package/dist/modules/Order/index.js +137 -42
- package/dist/modules/Order/types.d.ts +32 -6
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils.d.ts +73 -11
- package/dist/modules/Order/utils.js +304 -52
- package/dist/modules/SalesSummary/utils.js +33 -68
- package/dist/modules/ScanOrderLogger/providers/feishu.js +168 -60
- package/dist/modules/ScanOrderLogger/types.d.ts +6 -0
- package/dist/modules/Summary/utils.js +6 -21
- package/dist/solution/ScanOrder/index.d.ts +57 -8
- package/dist/solution/ScanOrder/index.js +1531 -583
- package/dist/solution/ScanOrder/types.d.ts +86 -26
- package/dist/solution/ScanOrder/types.js +20 -1
- package/dist/solution/ScanOrder/utils.d.ts +53 -5
- package/dist/solution/ScanOrder/utils.js +257 -37
- package/dist/solution/VenueBooking/index.d.ts +30 -10
- package/dist/solution/VenueBooking/index.js +460 -217
- package/dist/solution/VenueBooking/types.d.ts +23 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -1
- package/dist/solution/VenueBooking/utils/dateSummary.js +1 -1
- package/dist/solution/VenueBooking/utils/resource.d.ts +11 -1
- package/dist/solution/VenueBooking/utils/resource.js +57 -21
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +5 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +33 -12
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +1 -1
- package/dist/solution/VenueBooking/utils/timeSlot.js +259 -62
- package/lib/modules/Order/index.d.ts +7 -6
- package/lib/modules/Order/index.js +123 -31
- package/lib/modules/Order/types.d.ts +32 -6
- package/lib/modules/Order/utils.d.ts +73 -11
- package/lib/modules/Order/utils.js +203 -28
- package/lib/modules/SalesSummary/utils.js +13 -47
- package/lib/modules/ScanOrderLogger/providers/feishu.js +100 -34
- package/lib/modules/ScanOrderLogger/types.d.ts +6 -0
- package/lib/modules/Summary/utils.js +4 -18
- package/lib/solution/ScanOrder/index.d.ts +57 -8
- package/lib/solution/ScanOrder/index.js +713 -117
- package/lib/solution/ScanOrder/types.d.ts +86 -26
- package/lib/solution/ScanOrder/utils.d.ts +53 -5
- package/lib/solution/ScanOrder/utils.js +186 -19
- package/lib/solution/VenueBooking/index.d.ts +30 -10
- package/lib/solution/VenueBooking/index.js +206 -51
- package/lib/solution/VenueBooking/types.d.ts +23 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -1
- package/lib/solution/VenueBooking/utils/dateSummary.js +1 -1
- package/lib/solution/VenueBooking/utils/resource.d.ts +11 -1
- package/lib/solution/VenueBooking/utils/resource.js +15 -4
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +5 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +29 -12
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +1 -1
- package/lib/solution/VenueBooking/utils/timeSlot.js +182 -43
- package/package.json +1 -1
|
@@ -45,7 +45,7 @@ import { extractResourceIds, buildResourceProductMap } from "./utils/resource";
|
|
|
45
45
|
import { buildTimeSlotGrid, isBusinessHoursCrossDay, generateTimeLabels } from "./utils/timeSlot";
|
|
46
46
|
import { buildDateRangeSummary } from "./utils/dateSummary";
|
|
47
47
|
import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry, buildPriceBreakdown } from "./utils/slotMerge";
|
|
48
|
-
import { createUuidV4 } from "../../modules/Order/utils";
|
|
48
|
+
import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
49
49
|
import { OrderModule } from "../../modules/Order";
|
|
50
50
|
import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
|
|
51
51
|
import Decimal from 'decimal.js';
|
|
@@ -994,7 +994,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
994
994
|
key: "fetchResourceAvailability",
|
|
995
995
|
value: function () {
|
|
996
996
|
var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
|
|
997
|
-
var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData, _iterator2, _step2, item, _i2, _rawData, _item, mapping;
|
|
997
|
+
var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData, _iterator2, _step2, item, _i2, _rawData, _item, mappings, _iterator3, _step3, mapping;
|
|
998
998
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
999
999
|
while (1) switch (_context15.prev = _context15.next) {
|
|
1000
1000
|
case 0:
|
|
@@ -1062,35 +1062,56 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1062
1062
|
}
|
|
1063
1063
|
}
|
|
1064
1064
|
this.store.rawResourceData = rawData;
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1065
|
+
_i2 = 0, _rawData = rawData;
|
|
1066
|
+
case 24:
|
|
1067
|
+
if (!(_i2 < _rawData.length)) {
|
|
1068
|
+
_context15.next = 34;
|
|
1069
|
+
break;
|
|
1070
|
+
}
|
|
1071
|
+
_item = _rawData[_i2];
|
|
1072
|
+
mappings = this.resourceProductMap.get(_item.resourceId);
|
|
1073
|
+
if (mappings) {
|
|
1074
|
+
_context15.next = 29;
|
|
1075
|
+
break;
|
|
1076
|
+
}
|
|
1077
|
+
return _context15.abrupt("continue", 31);
|
|
1078
|
+
case 29:
|
|
1079
|
+
_iterator3 = _createForOfIteratorHelper(mappings);
|
|
1080
|
+
try {
|
|
1081
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
1082
|
+
mapping = _step3.value;
|
|
1083
|
+
if (_item.main_field) mapping.resourceName = _item.main_field;
|
|
1084
|
+
if (_item.resource_form_id) mapping.formId = _item.resource_form_id;
|
|
1073
1085
|
}
|
|
1086
|
+
} catch (err) {
|
|
1087
|
+
_iterator3.e(err);
|
|
1088
|
+
} finally {
|
|
1089
|
+
_iterator3.f();
|
|
1074
1090
|
}
|
|
1091
|
+
case 31:
|
|
1092
|
+
_i2++;
|
|
1093
|
+
_context15.next = 24;
|
|
1094
|
+
break;
|
|
1095
|
+
case 34:
|
|
1075
1096
|
this.logMethodSuccess('fetchResourceAvailability', {
|
|
1076
1097
|
resourceCount: rawData.length,
|
|
1077
1098
|
totalTimes: rawData.reduce(function (sum, r) {
|
|
1078
1099
|
return sum + r.times.length;
|
|
1079
1100
|
}, 0)
|
|
1080
1101
|
});
|
|
1081
|
-
_context15.next =
|
|
1102
|
+
_context15.next = 42;
|
|
1082
1103
|
break;
|
|
1083
|
-
case
|
|
1084
|
-
_context15.prev =
|
|
1104
|
+
case 37:
|
|
1105
|
+
_context15.prev = 37;
|
|
1085
1106
|
_context15.t0 = _context15["catch"](1);
|
|
1086
1107
|
this.store.rawResourceData = [];
|
|
1087
1108
|
this.logMethodError('fetchResourceAvailability', _context15.t0);
|
|
1088
1109
|
throw _context15.t0;
|
|
1089
|
-
case
|
|
1110
|
+
case 42:
|
|
1090
1111
|
case "end":
|
|
1091
1112
|
return _context15.stop();
|
|
1092
1113
|
}
|
|
1093
|
-
}, _callee15, this, [[1,
|
|
1114
|
+
}, _callee15, this, [[1, 37]]);
|
|
1094
1115
|
}));
|
|
1095
1116
|
function fetchResourceAvailability(_x7) {
|
|
1096
1117
|
return _fetchResourceAvailability.apply(this, arguments);
|
|
@@ -1124,18 +1145,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1124
1145
|
var timeRangeMap = calcMinTimeMaxTimeBySchedules(scheduleList, undefined, date);
|
|
1125
1146
|
var earliestStart = null;
|
|
1126
1147
|
var latestEnd = null;
|
|
1127
|
-
var
|
|
1128
|
-
|
|
1148
|
+
var _iterator4 = _createForOfIteratorHelper(scheduleList),
|
|
1149
|
+
_step4;
|
|
1129
1150
|
try {
|
|
1130
|
-
for (
|
|
1151
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
1131
1152
|
var _timeRangeMap$schedul;
|
|
1132
|
-
var schedule =
|
|
1153
|
+
var schedule = _step4.value;
|
|
1133
1154
|
var dateRangeList = (timeRangeMap === null || timeRangeMap === void 0 || (_timeRangeMap$schedul = timeRangeMap[schedule.id]) === null || _timeRangeMap$schedul === void 0 ? void 0 : _timeRangeMap$schedul.dateRangeFormat) || [];
|
|
1134
|
-
var
|
|
1135
|
-
|
|
1155
|
+
var _iterator5 = _createForOfIteratorHelper(dateRangeList),
|
|
1156
|
+
_step5;
|
|
1136
1157
|
try {
|
|
1137
|
-
for (
|
|
1138
|
-
var range =
|
|
1158
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
1159
|
+
var range = _step5.value;
|
|
1139
1160
|
var start = dayjs(range === null || range === void 0 ? void 0 : range.start);
|
|
1140
1161
|
var end = dayjs(range === null || range === void 0 ? void 0 : range.end);
|
|
1141
1162
|
if (!start.isValid() || !end.isValid()) continue;
|
|
@@ -1147,15 +1168,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1147
1168
|
}
|
|
1148
1169
|
}
|
|
1149
1170
|
} catch (err) {
|
|
1150
|
-
|
|
1171
|
+
_iterator5.e(err);
|
|
1151
1172
|
} finally {
|
|
1152
|
-
|
|
1173
|
+
_iterator5.f();
|
|
1153
1174
|
}
|
|
1154
1175
|
}
|
|
1155
1176
|
} catch (err) {
|
|
1156
|
-
|
|
1177
|
+
_iterator4.e(err);
|
|
1157
1178
|
} finally {
|
|
1158
|
-
|
|
1179
|
+
_iterator4.f();
|
|
1159
1180
|
}
|
|
1160
1181
|
if (!earliestStart || !latestEnd) return nextSlotConfig;
|
|
1161
1182
|
return _objectSpread(_objectSpread({}, nextSlotConfig), {}, {
|
|
@@ -1192,7 +1213,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1192
1213
|
var resolvedSlotConfig = this.syncOperatingHoursToSlotConfig(date);
|
|
1193
1214
|
var quotationPriceMap;
|
|
1194
1215
|
if (this.store.quotation) {
|
|
1195
|
-
var productIds = _toConsumableArray(new Set(_toConsumableArray(this.resourceProductMap.values()).map(function (m) {
|
|
1216
|
+
var productIds = _toConsumableArray(new Set(_toConsumableArray(this.resourceProductMap.values()).flat().map(function (m) {
|
|
1196
1217
|
return m.productId;
|
|
1197
1218
|
})));
|
|
1198
1219
|
var timeLabels = generateTimeLabels(resolvedSlotConfig);
|
|
@@ -1218,34 +1239,47 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1218
1239
|
/**
|
|
1219
1240
|
* 切换单个时段的选中状态(选中/取消)。
|
|
1220
1241
|
* 内部自动处理连续时段的合并与拆分,订单是唯一真相源。
|
|
1242
|
+
*
|
|
1243
|
+
* slot.productId 指定当前操作针对的是该 resourceId 下的哪一个商品。
|
|
1244
|
+
* 同一资源下不同 productId 之间互相隔离,不会相互合并。
|
|
1221
1245
|
*/
|
|
1222
1246
|
}, {
|
|
1223
1247
|
key: "toggleSlot",
|
|
1224
1248
|
value: function () {
|
|
1225
1249
|
var _toggleSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(slot) {
|
|
1226
|
-
var mapping, currentSlots, existIndex, nextSlots, products;
|
|
1250
|
+
var mappings, mapping, currentSlots, existIndex, nextSlots, products;
|
|
1227
1251
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1228
1252
|
while (1) switch (_context16.prev = _context16.next) {
|
|
1229
1253
|
case 0:
|
|
1230
1254
|
this.logMethodStart('toggleSlot', {
|
|
1231
1255
|
resourceId: slot.resourceId,
|
|
1256
|
+
productId: slot.productId,
|
|
1232
1257
|
startTime: slot.startTime
|
|
1233
1258
|
});
|
|
1234
1259
|
_context16.prev = 1;
|
|
1235
|
-
|
|
1236
|
-
if (
|
|
1260
|
+
mappings = this.resourceProductMap.get(slot.resourceId);
|
|
1261
|
+
if (!(!mappings || !mappings.length)) {
|
|
1237
1262
|
_context16.next = 5;
|
|
1238
1263
|
break;
|
|
1239
1264
|
}
|
|
1240
1265
|
throw new Error("\u672A\u627E\u5230\u8D44\u6E90 ".concat(slot.resourceId, " \u7684\u5546\u54C1\u6620\u5C04"));
|
|
1241
1266
|
case 5:
|
|
1267
|
+
mapping = mappings.find(function (m) {
|
|
1268
|
+
return m.productId === slot.productId;
|
|
1269
|
+
});
|
|
1270
|
+
if (mapping) {
|
|
1271
|
+
_context16.next = 8;
|
|
1272
|
+
break;
|
|
1273
|
+
}
|
|
1274
|
+
throw new Error("\u8D44\u6E90 ".concat(slot.resourceId, " \u672A\u5173\u8054\u5546\u54C1 ").concat(slot.productId));
|
|
1275
|
+
case 8:
|
|
1242
1276
|
if (this.store.order) {
|
|
1243
|
-
_context16.next =
|
|
1277
|
+
_context16.next = 10;
|
|
1244
1278
|
break;
|
|
1245
1279
|
}
|
|
1246
1280
|
throw new Error('order 模块未初始化');
|
|
1247
|
-
case
|
|
1248
|
-
currentSlots = this.
|
|
1281
|
+
case 10:
|
|
1282
|
+
currentSlots = this.getSelectedSlotsForResourceProduct(slot.resourceId, slot.productId);
|
|
1249
1283
|
existIndex = currentSlots.findIndex(function (s) {
|
|
1250
1284
|
return s.startTime === slot.startTime;
|
|
1251
1285
|
});
|
|
@@ -1256,32 +1290,33 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1256
1290
|
} else {
|
|
1257
1291
|
nextSlots = [].concat(_toConsumableArray(currentSlots), [slot]);
|
|
1258
1292
|
}
|
|
1259
|
-
_context16.next = 12;
|
|
1260
|
-
return this.reconcileOrderForResource(slot.resourceId, nextSlots);
|
|
1261
|
-
case 12:
|
|
1262
|
-
products = this.store.order.getOrderProducts();
|
|
1263
1293
|
_context16.next = 15;
|
|
1264
|
-
return this.
|
|
1294
|
+
return this.reconcileOrderForResourceProduct(slot.resourceId, slot.productId, nextSlots);
|
|
1265
1295
|
case 15:
|
|
1266
|
-
|
|
1296
|
+
products = this.store.order.getOrderProducts();
|
|
1297
|
+
_context16.next = 18;
|
|
1298
|
+
return this.refreshItemRuleQuantityLimits();
|
|
1299
|
+
case 18:
|
|
1300
|
+
_context16.next = 20;
|
|
1267
1301
|
return this.refreshCartValidationPassed();
|
|
1268
|
-
case
|
|
1302
|
+
case 20:
|
|
1269
1303
|
this.logMethodSuccess('toggleSlot', {
|
|
1270
1304
|
action: existIndex !== -1 ? 'remove' : 'add',
|
|
1271
1305
|
resourceId: slot.resourceId,
|
|
1306
|
+
productId: slot.productId,
|
|
1272
1307
|
slotCount: nextSlots.length
|
|
1273
1308
|
});
|
|
1274
1309
|
return _context16.abrupt("return", products);
|
|
1275
|
-
case
|
|
1276
|
-
_context16.prev =
|
|
1310
|
+
case 24:
|
|
1311
|
+
_context16.prev = 24;
|
|
1277
1312
|
_context16.t0 = _context16["catch"](1);
|
|
1278
1313
|
this.logMethodError('toggleSlot', _context16.t0);
|
|
1279
1314
|
throw _context16.t0;
|
|
1280
|
-
case
|
|
1315
|
+
case 28:
|
|
1281
1316
|
case "end":
|
|
1282
1317
|
return _context16.stop();
|
|
1283
1318
|
}
|
|
1284
|
-
}, _callee16, this, [[1,
|
|
1319
|
+
}, _callee16, this, [[1, 24]]);
|
|
1285
1320
|
}));
|
|
1286
1321
|
function toggleSlot(_x8) {
|
|
1287
1322
|
return _toggleSlot.apply(this, arguments);
|
|
@@ -1290,49 +1325,169 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1290
1325
|
}()
|
|
1291
1326
|
/**
|
|
1292
1327
|
* 获取某资源当前选中的所有独立时段(从订单中解析)。
|
|
1328
|
+
* 不传 productId 时返回该资源下所有商品的选中时段;传了则精确匹配。
|
|
1293
1329
|
*/
|
|
1294
1330
|
}, {
|
|
1295
1331
|
key: "getSelectedSlotsForResource",
|
|
1296
|
-
value: function getSelectedSlotsForResource(resourceId) {
|
|
1332
|
+
value: function getSelectedSlotsForResource(resourceId, productId) {
|
|
1297
1333
|
var _this$store$order3;
|
|
1298
1334
|
var tempOrder = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 ? void 0 : _this$store$order3.getTempOrder();
|
|
1299
1335
|
if (!tempOrder) return [];
|
|
1300
1336
|
var venueProducts = tempOrder.products.filter(function (p) {
|
|
1301
1337
|
var _p$metadata, _p$metadata2;
|
|
1302
|
-
|
|
1338
|
+
if (!((_p$metadata = p.metadata) !== null && _p$metadata !== void 0 && _p$metadata.venue_booking)) return false;
|
|
1339
|
+
if (String((_p$metadata2 = p.metadata) === null || _p$metadata2 === void 0 ? void 0 : _p$metadata2.resource_id) !== String(resourceId)) return false;
|
|
1340
|
+
if (productId != null && Number(p.product_id) !== Number(productId)) return false;
|
|
1341
|
+
return true;
|
|
1303
1342
|
});
|
|
1304
1343
|
var slotDuration = this.store.slotConfig.slotDurationMinutes;
|
|
1305
1344
|
var slots = [];
|
|
1306
|
-
var
|
|
1307
|
-
|
|
1345
|
+
var _iterator6 = _createForOfIteratorHelper(venueProducts),
|
|
1346
|
+
_step6;
|
|
1308
1347
|
try {
|
|
1309
|
-
|
|
1310
|
-
var product =
|
|
1311
|
-
slots.push.apply(slots, _toConsumableArray(expandMergedSlotToIndividual(product, slotDuration))
|
|
1348
|
+
var _loop = function _loop() {
|
|
1349
|
+
var product = _step6.value;
|
|
1350
|
+
slots.push.apply(slots, _toConsumableArray(expandMergedSlotToIndividual(product, slotDuration).map(function (s) {
|
|
1351
|
+
return _objectSpread(_objectSpread({}, s), {}, {
|
|
1352
|
+
productId: Number(product.product_id)
|
|
1353
|
+
});
|
|
1354
|
+
})));
|
|
1355
|
+
};
|
|
1356
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
1357
|
+
_loop();
|
|
1312
1358
|
}
|
|
1313
1359
|
} catch (err) {
|
|
1314
|
-
|
|
1360
|
+
_iterator6.e(err);
|
|
1315
1361
|
} finally {
|
|
1316
|
-
|
|
1362
|
+
_iterator6.f();
|
|
1317
1363
|
}
|
|
1318
1364
|
return slots.sort(function (a, b) {
|
|
1319
1365
|
return a.startTime.localeCompare(b.startTime);
|
|
1320
1366
|
});
|
|
1321
1367
|
}
|
|
1322
1368
|
|
|
1369
|
+
/** getSelectedSlotsForResource 的 (resourceId, productId) 精确版,内部使用。 */
|
|
1370
|
+
}, {
|
|
1371
|
+
key: "getSelectedSlotsForResourceProduct",
|
|
1372
|
+
value: function getSelectedSlotsForResourceProduct(resourceId, productId) {
|
|
1373
|
+
return this.getSelectedSlotsForResource(resourceId, productId);
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1323
1376
|
/**
|
|
1324
1377
|
* 判断某个时段是否已选中。
|
|
1378
|
+
* 不传 productId 时:只要该资源下任一商品在 startTime 被选中即返回 true;传了则精确匹配。
|
|
1325
1379
|
*/
|
|
1326
1380
|
}, {
|
|
1327
1381
|
key: "isSlotSelected",
|
|
1328
|
-
value: function isSlotSelected(resourceId, startTime) {
|
|
1329
|
-
return this.getSelectedSlotsForResource(resourceId).some(function (s) {
|
|
1382
|
+
value: function isSlotSelected(resourceId, startTime, productId) {
|
|
1383
|
+
return this.getSelectedSlotsForResource(resourceId, productId).some(function (s) {
|
|
1330
1384
|
return s.startTime === startTime;
|
|
1331
1385
|
});
|
|
1332
1386
|
}
|
|
1333
1387
|
|
|
1334
1388
|
/**
|
|
1335
|
-
*
|
|
1389
|
+
* 判断指定 (resourceId, productId, startTime) 格子是否应因其它已选项而被禁用。
|
|
1390
|
+
* 规则:
|
|
1391
|
+
* 1) 同一 resourceId 下若已选了另一个 productId 的同 startTime → 禁用
|
|
1392
|
+
* 2) 当前 resource 是组合资源:若其任一 child resource 在 startTime 被选中 → 禁用
|
|
1393
|
+
* 3) 当前 resource 是某些组合资源的 child:若该组合资源在 startTime 被选中 → 禁用
|
|
1394
|
+
* 4) 两个组合资源的 child 集合有交集,且对方在该 startTime 被选中 → 禁用
|
|
1395
|
+
*/
|
|
1396
|
+
}, {
|
|
1397
|
+
key: "isSlotDisabledBySelection",
|
|
1398
|
+
value: function isSlotDisabledBySelection(params) {
|
|
1399
|
+
var _this7 = this;
|
|
1400
|
+
var resourceId = params.resourceId,
|
|
1401
|
+
productId = params.productId,
|
|
1402
|
+
startTime = params.startTime;
|
|
1403
|
+
var allSelected = this.getAllSelectedSlots();
|
|
1404
|
+
var getSelectedAt = function getSelectedAt(resId) {
|
|
1405
|
+
var list = allSelected.get(resId) || [];
|
|
1406
|
+
return list.filter(function (s) {
|
|
1407
|
+
return s.startTime === startTime;
|
|
1408
|
+
});
|
|
1409
|
+
};
|
|
1410
|
+
|
|
1411
|
+
// 规则 1:同场地、不同 productId 的已选
|
|
1412
|
+
var sameResourceSelections = getSelectedAt(resourceId);
|
|
1413
|
+
if (sameResourceSelections.some(function (s) {
|
|
1414
|
+
return Number(s.productId) !== Number(productId);
|
|
1415
|
+
})) {
|
|
1416
|
+
return true;
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
// 组合资源字段缓存
|
|
1420
|
+
var getCombinedChildIds = function getCombinedChildIds(resId) {
|
|
1421
|
+
var raw = _this7.store.rawResourceData.find(function (r) {
|
|
1422
|
+
return String(r.resourceId) === String(resId);
|
|
1423
|
+
});
|
|
1424
|
+
var combined = raw === null || raw === void 0 ? void 0 : raw.combined_resource;
|
|
1425
|
+
if (combined && combined.status === 1 && Array.isArray(combined.resource_ids)) {
|
|
1426
|
+
return combined.resource_ids;
|
|
1427
|
+
}
|
|
1428
|
+
return [];
|
|
1429
|
+
};
|
|
1430
|
+
var currentChildIds = getCombinedChildIds(resourceId);
|
|
1431
|
+
var currentIsCombined = currentChildIds.length > 0;
|
|
1432
|
+
|
|
1433
|
+
// 规则 2:当前是组合资源,任一子资源被选 → 禁用
|
|
1434
|
+
if (currentIsCombined) {
|
|
1435
|
+
var _iterator7 = _createForOfIteratorHelper(currentChildIds),
|
|
1436
|
+
_step7;
|
|
1437
|
+
try {
|
|
1438
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
1439
|
+
var childId = _step7.value;
|
|
1440
|
+
if (getSelectedAt(childId).length > 0) return true;
|
|
1441
|
+
}
|
|
1442
|
+
} catch (err) {
|
|
1443
|
+
_iterator7.e(err);
|
|
1444
|
+
} finally {
|
|
1445
|
+
_iterator7.f();
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
// 规则 3 & 4:扫描所有已选的 (resId),若是组合资源,检查其 children 是否包含当前 resourceId 或与当前 child 集合有交集
|
|
1450
|
+
var _iterator8 = _createForOfIteratorHelper(allSelected),
|
|
1451
|
+
_step8;
|
|
1452
|
+
try {
|
|
1453
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
1454
|
+
var _step8$value = _slicedToArray(_step8.value, 2),
|
|
1455
|
+
selectedResId = _step8$value[0],
|
|
1456
|
+
slots = _step8$value[1];
|
|
1457
|
+
if (!slots.some(function (s) {
|
|
1458
|
+
return s.startTime === startTime;
|
|
1459
|
+
})) continue;
|
|
1460
|
+
if (String(selectedResId) === String(resourceId)) continue;
|
|
1461
|
+
var selectedChildIds = getCombinedChildIds(selectedResId);
|
|
1462
|
+
if (selectedChildIds.length === 0) continue;
|
|
1463
|
+
|
|
1464
|
+
// 对方是组合资源,其 children 包含当前 resourceId(规则 3)
|
|
1465
|
+
if (selectedChildIds.some(function (id) {
|
|
1466
|
+
return String(id) === String(resourceId);
|
|
1467
|
+
})) {
|
|
1468
|
+
return true;
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
// 双方都是组合资源,child 集合有交集(规则 4)
|
|
1472
|
+
if (currentIsCombined) {
|
|
1473
|
+
var intersect = selectedChildIds.some(function (id) {
|
|
1474
|
+
return currentChildIds.some(function (cid) {
|
|
1475
|
+
return String(cid) === String(id);
|
|
1476
|
+
});
|
|
1477
|
+
});
|
|
1478
|
+
if (intersect) return true;
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
} catch (err) {
|
|
1482
|
+
_iterator8.e(err);
|
|
1483
|
+
} finally {
|
|
1484
|
+
_iterator8.f();
|
|
1485
|
+
}
|
|
1486
|
+
return false;
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
/**
|
|
1490
|
+
* 获取所有已选时段(按资源分组)。每个 slot 上带 productId,便于 UI 做 per-product 判定。
|
|
1336
1491
|
*/
|
|
1337
1492
|
}, {
|
|
1338
1493
|
key: "getAllSelectedSlots",
|
|
@@ -1346,87 +1501,112 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1346
1501
|
return (_p$metadata3 = p.metadata) === null || _p$metadata3 === void 0 ? void 0 : _p$metadata3.venue_booking;
|
|
1347
1502
|
});
|
|
1348
1503
|
var slotDuration = this.store.slotConfig.slotDurationMinutes;
|
|
1349
|
-
var
|
|
1350
|
-
|
|
1504
|
+
var _iterator9 = _createForOfIteratorHelper(venueProducts),
|
|
1505
|
+
_step9;
|
|
1351
1506
|
try {
|
|
1352
|
-
|
|
1507
|
+
var _loop2 = function _loop2() {
|
|
1353
1508
|
var _product$metadata;
|
|
1354
|
-
var product =
|
|
1509
|
+
var product = _step9.value;
|
|
1355
1510
|
var resourceId = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.resource_id;
|
|
1356
|
-
if (resourceId == null) continue
|
|
1511
|
+
if (resourceId == null) return 1; // continue
|
|
1512
|
+
var productId = Number(product.product_id);
|
|
1357
1513
|
var existing = result.get(resourceId) || [];
|
|
1358
|
-
existing.push.apply(existing, _toConsumableArray(expandMergedSlotToIndividual(product, slotDuration))
|
|
1514
|
+
existing.push.apply(existing, _toConsumableArray(expandMergedSlotToIndividual(product, slotDuration).map(function (s) {
|
|
1515
|
+
return _objectSpread(_objectSpread({}, s), {}, {
|
|
1516
|
+
productId: productId
|
|
1517
|
+
});
|
|
1518
|
+
})));
|
|
1359
1519
|
result.set(resourceId, existing);
|
|
1520
|
+
};
|
|
1521
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
1522
|
+
if (_loop2()) continue;
|
|
1360
1523
|
}
|
|
1361
1524
|
} catch (err) {
|
|
1362
|
-
|
|
1525
|
+
_iterator9.e(err);
|
|
1363
1526
|
} finally {
|
|
1364
|
-
|
|
1527
|
+
_iterator9.f();
|
|
1365
1528
|
}
|
|
1366
|
-
var
|
|
1367
|
-
|
|
1529
|
+
var _iterator10 = _createForOfIteratorHelper(result),
|
|
1530
|
+
_step10;
|
|
1368
1531
|
try {
|
|
1369
|
-
for (
|
|
1370
|
-
var
|
|
1371
|
-
key =
|
|
1372
|
-
slots =
|
|
1532
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
1533
|
+
var _step10$value = _slicedToArray(_step10.value, 2),
|
|
1534
|
+
key = _step10$value[0],
|
|
1535
|
+
slots = _step10$value[1];
|
|
1373
1536
|
result.set(key, slots.sort(function (a, b) {
|
|
1374
1537
|
return a.startTime.localeCompare(b.startTime);
|
|
1375
1538
|
}));
|
|
1376
1539
|
}
|
|
1377
1540
|
} catch (err) {
|
|
1378
|
-
|
|
1541
|
+
_iterator10.e(err);
|
|
1379
1542
|
} finally {
|
|
1380
|
-
|
|
1543
|
+
_iterator10.f();
|
|
1381
1544
|
}
|
|
1382
1545
|
return result;
|
|
1383
1546
|
}
|
|
1384
1547
|
|
|
1385
1548
|
/**
|
|
1386
|
-
*
|
|
1549
|
+
* 对指定 (resourceId, productId) 的订单商品进行 reconcile:
|
|
1387
1550
|
* 清除旧商品 → 合并连续时段 → 重新写入。
|
|
1551
|
+
* 同一场地下不同商品互不干扰,各自单独 reconcile。
|
|
1388
1552
|
*/
|
|
1389
1553
|
}, {
|
|
1390
|
-
key: "
|
|
1554
|
+
key: "reconcileOrderForResourceProduct",
|
|
1391
1555
|
value: (function () {
|
|
1392
|
-
var
|
|
1393
|
-
var mapping, tempOrder, merged, rawResource, venueProduct, i,
|
|
1556
|
+
var _reconcileOrderForResourceProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(resourceId, productId, slots) {
|
|
1557
|
+
var mappings, mapping, tempOrder, matchesCurrent, merged, rawResource, childRawResources, venueProduct, i, _rawResource$form_id, _venueProduct$is_char, group, identityKey, bookingUuid, startMoment, endMoment, duration, customDepositData, resourceEntry, booking;
|
|
1394
1558
|
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1395
1559
|
while (1) switch (_context17.prev = _context17.next) {
|
|
1396
1560
|
case 0:
|
|
1397
|
-
|
|
1398
|
-
if (!(!
|
|
1561
|
+
mappings = this.resourceProductMap.get(resourceId);
|
|
1562
|
+
if (!(!mappings || !mappings.length || !this.store.order)) {
|
|
1399
1563
|
_context17.next = 3;
|
|
1400
1564
|
break;
|
|
1401
1565
|
}
|
|
1402
1566
|
return _context17.abrupt("return");
|
|
1403
1567
|
case 3:
|
|
1568
|
+
mapping = mappings.find(function (m) {
|
|
1569
|
+
return m.productId === productId;
|
|
1570
|
+
});
|
|
1571
|
+
if (mapping) {
|
|
1572
|
+
_context17.next = 6;
|
|
1573
|
+
break;
|
|
1574
|
+
}
|
|
1575
|
+
return _context17.abrupt("return");
|
|
1576
|
+
case 6:
|
|
1404
1577
|
tempOrder = this.store.order.ensureTempOrder();
|
|
1578
|
+
matchesCurrent = function matchesCurrent(meta, pid) {
|
|
1579
|
+
return !!(meta !== null && meta !== void 0 && meta.venue_booking) && String(meta === null || meta === void 0 ? void 0 : meta.resource_id) === String(resourceId) && Number(pid) === Number(productId);
|
|
1580
|
+
};
|
|
1405
1581
|
tempOrder.products = tempOrder.products.filter(function (p) {
|
|
1406
|
-
|
|
1407
|
-
return !((_p$metadata4 = p.metadata) !== null && _p$metadata4 !== void 0 && _p$metadata4.venue_booking && String((_p$metadata5 = p.metadata) === null || _p$metadata5 === void 0 ? void 0 : _p$metadata5.resource_id) === String(resourceId));
|
|
1582
|
+
return !matchesCurrent(p.metadata, p.product_id);
|
|
1408
1583
|
});
|
|
1409
1584
|
tempOrder.bookings = (tempOrder.bookings || []).filter(function (b) {
|
|
1410
|
-
var _b$metadata, _b$metadata2;
|
|
1411
|
-
|
|
1585
|
+
var _b$metadata, _b$metadata2, _b$metadata$product_i, _b$metadata3, _b$product;
|
|
1586
|
+
if (!((_b$metadata = b.metadata) !== null && _b$metadata !== void 0 && _b$metadata.venue_booking)) return true;
|
|
1587
|
+
if (String((_b$metadata2 = b.metadata) === null || _b$metadata2 === void 0 ? void 0 : _b$metadata2.resource_id) !== String(resourceId)) return true;
|
|
1588
|
+
var bookingProductId = (_b$metadata$product_i = (_b$metadata3 = b.metadata) === null || _b$metadata3 === void 0 ? void 0 : _b$metadata3.product_id) !== null && _b$metadata$product_i !== void 0 ? _b$metadata$product_i : b === null || b === void 0 || (_b$product = b.product) === null || _b$product === void 0 ? void 0 : _b$product.product_id;
|
|
1589
|
+
if (bookingProductId == null) return false;
|
|
1590
|
+
return Number(bookingProductId) !== Number(productId);
|
|
1412
1591
|
});
|
|
1413
1592
|
if (slots.length) {
|
|
1414
|
-
_context17.next =
|
|
1593
|
+
_context17.next = 16;
|
|
1415
1594
|
break;
|
|
1416
1595
|
}
|
|
1417
1596
|
this.store.order.applyDiscount();
|
|
1418
|
-
_context17.next =
|
|
1597
|
+
_context17.next = 14;
|
|
1419
1598
|
return this.store.order.recalculateSummary({
|
|
1420
1599
|
createIfMissing: true
|
|
1421
1600
|
});
|
|
1422
|
-
case
|
|
1601
|
+
case 14:
|
|
1423
1602
|
this.store.order.persistTempOrder();
|
|
1424
1603
|
return _context17.abrupt("return");
|
|
1425
|
-
case
|
|
1604
|
+
case 16:
|
|
1426
1605
|
merged = mergeConsecutiveSlots(slots);
|
|
1427
1606
|
rawResource = this.store.rawResourceData.find(function (r) {
|
|
1428
1607
|
return String(r.resourceId) === String(resourceId);
|
|
1429
1608
|
});
|
|
1609
|
+
childRawResources = this.getCombinedChildRawResources(rawResource);
|
|
1430
1610
|
venueProduct = this.getVenueProducts().find(function (p) {
|
|
1431
1611
|
return p.id === mapping.productId;
|
|
1432
1612
|
});
|
|
@@ -1439,6 +1619,31 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1439
1619
|
endMoment = dayjs(group.endTime, 'YYYY-MM-DD HH:mm');
|
|
1440
1620
|
duration = endMoment.diff(startMoment, 'minute');
|
|
1441
1621
|
customDepositData = cloneCustomDepositData(venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.custom_deposit_data);
|
|
1622
|
+
resourceEntry = {
|
|
1623
|
+
relation_type: 'form',
|
|
1624
|
+
like_status: 'common',
|
|
1625
|
+
id: resourceId,
|
|
1626
|
+
main_field: mapping.resourceName,
|
|
1627
|
+
form_id: (_rawResource$form_id = rawResource === null || rawResource === void 0 ? void 0 : rawResource.form_id) !== null && _rawResource$form_id !== void 0 ? _rawResource$form_id : mapping.formId,
|
|
1628
|
+
relation_id: resourceId,
|
|
1629
|
+
capacity: 1,
|
|
1630
|
+
metadata: {}
|
|
1631
|
+
};
|
|
1632
|
+
if (childRawResources && childRawResources.length) {
|
|
1633
|
+
resourceEntry.children = childRawResources.map(function (child) {
|
|
1634
|
+
var _child$form_id, _child$capacity;
|
|
1635
|
+
return {
|
|
1636
|
+
relation_type: 'form',
|
|
1637
|
+
like_status: 'common',
|
|
1638
|
+
id: child.resourceId,
|
|
1639
|
+
main_field: child.main_field || '',
|
|
1640
|
+
form_id: (_child$form_id = child.form_id) !== null && _child$form_id !== void 0 ? _child$form_id : child.formId,
|
|
1641
|
+
relation_id: child.resourceId,
|
|
1642
|
+
capacity: (_child$capacity = child.capacity) !== null && _child$capacity !== void 0 ? _child$capacity : 1,
|
|
1643
|
+
metadata: {}
|
|
1644
|
+
};
|
|
1645
|
+
});
|
|
1646
|
+
}
|
|
1442
1647
|
tempOrder.products.push(normalizeOrderProduct({
|
|
1443
1648
|
product_id: mapping.productId,
|
|
1444
1649
|
product_variant_id: 0,
|
|
@@ -1484,16 +1689,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1484
1689
|
sub_type: 'minutes',
|
|
1485
1690
|
duration: duration,
|
|
1486
1691
|
like_status: 'common',
|
|
1487
|
-
resources: [
|
|
1488
|
-
relation_type: 'form',
|
|
1489
|
-
like_status: 'common',
|
|
1490
|
-
id: resourceId,
|
|
1491
|
-
main_field: mapping.resourceName,
|
|
1492
|
-
form_id: (_rawResource$form_id = rawResource === null || rawResource === void 0 ? void 0 : rawResource.form_id) !== null && _rawResource$form_id !== void 0 ? _rawResource$form_id : mapping.formId,
|
|
1493
|
-
relation_id: resourceId,
|
|
1494
|
-
capacity: 1,
|
|
1495
|
-
metadata: {}
|
|
1496
|
-
}],
|
|
1692
|
+
resources: [resourceEntry],
|
|
1497
1693
|
schedule_id: 0,
|
|
1498
1694
|
select_date: startMoment.format('YYYY-MM-DD'),
|
|
1499
1695
|
start_date: startMoment.format('YYYY-MM-DD'),
|
|
@@ -1513,29 +1709,61 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1513
1709
|
mapping: mapping,
|
|
1514
1710
|
rawResource: rawResource,
|
|
1515
1711
|
bookingUuid: bookingUuid,
|
|
1516
|
-
productUid: identityKey
|
|
1712
|
+
productUid: identityKey,
|
|
1713
|
+
childResources: childRawResources
|
|
1517
1714
|
});
|
|
1518
1715
|
tempOrder.bookings.push(booking);
|
|
1519
1716
|
}
|
|
1520
1717
|
this.store.order.applyDiscount();
|
|
1521
|
-
_context17.next =
|
|
1718
|
+
_context17.next = 25;
|
|
1522
1719
|
return this.store.order.recalculateSummary({
|
|
1523
1720
|
createIfMissing: true
|
|
1524
1721
|
});
|
|
1525
|
-
case
|
|
1722
|
+
case 25:
|
|
1526
1723
|
this.store.order.persistTempOrder();
|
|
1527
|
-
case
|
|
1724
|
+
case 26:
|
|
1528
1725
|
case "end":
|
|
1529
1726
|
return _context17.stop();
|
|
1530
1727
|
}
|
|
1531
1728
|
}, _callee17, this);
|
|
1532
1729
|
}));
|
|
1533
|
-
function
|
|
1534
|
-
return
|
|
1730
|
+
function reconcileOrderForResourceProduct(_x9, _x10, _x11) {
|
|
1731
|
+
return _reconcileOrderForResourceProduct.apply(this, arguments);
|
|
1535
1732
|
}
|
|
1536
|
-
return
|
|
1537
|
-
}()
|
|
1538
|
-
|
|
1733
|
+
return reconcileOrderForResourceProduct;
|
|
1734
|
+
}() /** 给定一个父 rawResource,返回其 combined_resource.resource_ids 对应的子 rawResource 列表。 */)
|
|
1735
|
+
}, {
|
|
1736
|
+
key: "getCombinedChildRawResources",
|
|
1737
|
+
value: function getCombinedChildRawResources(rawResource) {
|
|
1738
|
+
var _this8 = this;
|
|
1739
|
+
if (!rawResource) return undefined;
|
|
1740
|
+
var combined = rawResource.combined_resource;
|
|
1741
|
+
if (!combined || combined.status !== 1 || !Array.isArray(combined.resource_ids) || !combined.resource_ids.length) {
|
|
1742
|
+
return undefined;
|
|
1743
|
+
}
|
|
1744
|
+
var children = [];
|
|
1745
|
+
var _iterator11 = _createForOfIteratorHelper(combined.resource_ids),
|
|
1746
|
+
_step11;
|
|
1747
|
+
try {
|
|
1748
|
+
var _loop3 = function _loop3() {
|
|
1749
|
+
var id = _step11.value;
|
|
1750
|
+
var child = _this8.store.rawResourceData.find(function (r) {
|
|
1751
|
+
return String(r.resourceId) === String(id);
|
|
1752
|
+
});
|
|
1753
|
+
if (child) children.push(child);
|
|
1754
|
+
};
|
|
1755
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
1756
|
+
_loop3();
|
|
1757
|
+
}
|
|
1758
|
+
} catch (err) {
|
|
1759
|
+
_iterator11.e(err);
|
|
1760
|
+
} finally {
|
|
1761
|
+
_iterator11.f();
|
|
1762
|
+
}
|
|
1763
|
+
return children.length ? children : undefined;
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
// ─── 配置 ───
|
|
1539
1767
|
}, {
|
|
1540
1768
|
key: "setSlotConfig",
|
|
1541
1769
|
value: function setSlotConfig(config) {
|
|
@@ -1590,10 +1818,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1590
1818
|
}, {
|
|
1591
1819
|
key: "injectScheduleResolverToQuotation",
|
|
1592
1820
|
value: function injectScheduleResolverToQuotation() {
|
|
1593
|
-
var
|
|
1821
|
+
var _this9 = this;
|
|
1594
1822
|
if (this.store.quotation && this.store.schedule) {
|
|
1595
1823
|
this.store.quotation.setScheduleResolver(function (id) {
|
|
1596
|
-
return
|
|
1824
|
+
return _this9.store.schedule.getScheduleListByIds([id])[0];
|
|
1597
1825
|
});
|
|
1598
1826
|
}
|
|
1599
1827
|
}
|
|
@@ -1662,7 +1890,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1662
1890
|
}
|
|
1663
1891
|
}, _callee19, this, [[1, 7]]);
|
|
1664
1892
|
}));
|
|
1665
|
-
function onCustomerLogin(
|
|
1893
|
+
function onCustomerLogin(_x12) {
|
|
1666
1894
|
return _onCustomerLogin.apply(this, arguments);
|
|
1667
1895
|
}
|
|
1668
1896
|
return onCustomerLogin;
|
|
@@ -1671,60 +1899,67 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1671
1899
|
key: "recalculateOrderPricesFromQuotation",
|
|
1672
1900
|
value: function recalculateOrderPricesFromQuotation() {
|
|
1673
1901
|
var _tempOrder$products,
|
|
1674
|
-
|
|
1902
|
+
_this10 = this;
|
|
1675
1903
|
if (!this.store.order || !this.store.quotation) return;
|
|
1676
1904
|
var tempOrder = this.store.order.getTempOrder();
|
|
1677
1905
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
|
|
1678
1906
|
var now = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
1679
|
-
var
|
|
1680
|
-
|
|
1907
|
+
var _iterator12 = _createForOfIteratorHelper(tempOrder.products),
|
|
1908
|
+
_step12;
|
|
1681
1909
|
try {
|
|
1682
|
-
var
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1910
|
+
var _loop4 = function _loop4() {
|
|
1911
|
+
var _product$metadata2;
|
|
1912
|
+
var product = _step12.value;
|
|
1913
|
+
if ((_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking) {
|
|
1914
|
+
var mappings = _this10.resourceProductMap.get(product.metadata.resource_id);
|
|
1915
|
+
if (!mappings || !mappings.length) return 0; // continue
|
|
1916
|
+
var mapping = mappings.find(function (m) {
|
|
1917
|
+
return Number(m.productId) === Number(product.product_id);
|
|
1918
|
+
}) || mappings[0];
|
|
1919
|
+
if (!mapping) return 0; // continue
|
|
1920
|
+
var slots = expandMergedSlotToIndividual(product, _this10.store.slotConfig.slotDurationMinutes);
|
|
1921
|
+
var updatedSlots = slots.map(function (slot) {
|
|
1922
|
+
var _getPriceForProduct;
|
|
1923
|
+
return _objectSpread(_objectSpread({}, slot), {}, {
|
|
1693
1924
|
productId: mapping.productId,
|
|
1694
|
-
|
|
1695
|
-
|
|
1925
|
+
price: (_getPriceForProduct = _this10.store.quotation.getPriceForProduct({
|
|
1926
|
+
productId: mapping.productId,
|
|
1927
|
+
datetime: slot.startTime
|
|
1928
|
+
})) !== null && _getPriceForProduct !== void 0 ? _getPriceForProduct : mapping.price
|
|
1929
|
+
});
|
|
1696
1930
|
});
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1931
|
+
var merged = mergeConsecutiveSlots(updatedSlots);
|
|
1932
|
+
if (merged.length === 1) {
|
|
1933
|
+
product.selling_price = merged[0].totalPrice;
|
|
1934
|
+
product.original_price = merged[0].totalPrice;
|
|
1935
|
+
product.metadata.price_breakdown = buildPriceBreakdown({
|
|
1936
|
+
group: merged[0],
|
|
1937
|
+
productId: mapping.productId,
|
|
1938
|
+
quotation: _this10.store.quotation
|
|
1939
|
+
});
|
|
1940
|
+
}
|
|
1941
|
+
} else if (product.product_id != null) {
|
|
1942
|
+
var _product$product_vari;
|
|
1943
|
+
var quotationPrice = _this10.store.quotation.getPriceForProduct({
|
|
1944
|
+
productId: product.product_id,
|
|
1945
|
+
variantId: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : undefined,
|
|
1946
|
+
datetime: now
|
|
1706
1947
|
});
|
|
1948
|
+
if (quotationPrice !== null) {
|
|
1949
|
+
product.selling_price = quotationPrice;
|
|
1950
|
+
product.original_price = quotationPrice;
|
|
1951
|
+
}
|
|
1707
1952
|
}
|
|
1708
|
-
}
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
datetime: now
|
|
1714
|
-
});
|
|
1715
|
-
if (quotationPrice !== null) {
|
|
1716
|
-
product.selling_price = quotationPrice;
|
|
1717
|
-
product.original_price = quotationPrice;
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1720
|
-
};
|
|
1721
|
-
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
1722
|
-
if (_loop()) continue;
|
|
1953
|
+
},
|
|
1954
|
+
_ret;
|
|
1955
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
1956
|
+
_ret = _loop4();
|
|
1957
|
+
if (_ret === 0) continue;
|
|
1723
1958
|
}
|
|
1724
1959
|
} catch (err) {
|
|
1725
|
-
|
|
1960
|
+
_iterator12.e(err);
|
|
1726
1961
|
} finally {
|
|
1727
|
-
|
|
1962
|
+
_iterator12.f();
|
|
1728
1963
|
}
|
|
1729
1964
|
}
|
|
1730
1965
|
}, {
|
|
@@ -1775,7 +2010,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1775
2010
|
}
|
|
1776
2011
|
}, _callee20, this, [[1, 15]]);
|
|
1777
2012
|
}));
|
|
1778
|
-
function scanCode(
|
|
2013
|
+
function scanCode(_x13, _x14) {
|
|
1779
2014
|
return _scanCode.apply(this, arguments);
|
|
1780
2015
|
}
|
|
1781
2016
|
return scanCode;
|
|
@@ -1792,7 +2027,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1792
2027
|
key: "setDiscountSelected",
|
|
1793
2028
|
value: (function () {
|
|
1794
2029
|
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
1795
|
-
var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds,
|
|
2030
|
+
var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator13, _step13, d, selectedResourceIds, _iterator14, _step14, _product$_origin, _product$metadata$sou, _product$metadata3, _product$metadata4, _product$original_pri, product, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
|
|
1796
2031
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1797
2032
|
while (1) switch (_context21.prev = _context21.next) {
|
|
1798
2033
|
case 0:
|
|
@@ -1852,18 +2087,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1852
2087
|
}).map(function (d) {
|
|
1853
2088
|
return d.id;
|
|
1854
2089
|
}));
|
|
1855
|
-
|
|
2090
|
+
_iterator13 = _createForOfIteratorHelper(nextDiscountList);
|
|
1856
2091
|
try {
|
|
1857
|
-
for (
|
|
1858
|
-
d =
|
|
2092
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
2093
|
+
d = _step13.value;
|
|
1859
2094
|
if (d.isSelected && !beforeSelectedIds.has(d.id)) {
|
|
1860
2095
|
d.isSelected = false;
|
|
1861
2096
|
}
|
|
1862
2097
|
}
|
|
1863
2098
|
} catch (err) {
|
|
1864
|
-
|
|
2099
|
+
_iterator13.e(err);
|
|
1865
2100
|
} finally {
|
|
1866
|
-
|
|
2101
|
+
_iterator13.f();
|
|
1867
2102
|
}
|
|
1868
2103
|
}
|
|
1869
2104
|
}
|
|
@@ -1876,20 +2111,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1876
2111
|
// 都以 original_price - Σ (当前选中 discount_list.amount) 重算 selling_price。
|
|
1877
2112
|
// 目的:避免 unselect 后 selling_price 残留、reselect 时把残留价带进下一轮 Rules 造成双折扣。
|
|
1878
2113
|
// 手动改价商品(_origin.isManualDiscount=true)不参与券流程归一化,保留手工价。
|
|
1879
|
-
|
|
2114
|
+
_iterator14 = _createForOfIteratorHelper(tempOrder.products);
|
|
1880
2115
|
_context21.prev = 19;
|
|
1881
|
-
|
|
2116
|
+
_iterator14.s();
|
|
1882
2117
|
case 21:
|
|
1883
|
-
if ((
|
|
1884
|
-
_context21.next =
|
|
2118
|
+
if ((_step14 = _iterator14.n()).done) {
|
|
2119
|
+
_context21.next = 35;
|
|
1885
2120
|
break;
|
|
1886
2121
|
}
|
|
1887
|
-
product =
|
|
2122
|
+
product = _step14.value;
|
|
1888
2123
|
if (!((_product$_origin = product._origin) !== null && _product$_origin !== void 0 && _product$_origin.isManualDiscount)) {
|
|
1889
2124
|
_context21.next = 25;
|
|
1890
2125
|
break;
|
|
1891
2126
|
}
|
|
1892
|
-
return _context21.abrupt("continue",
|
|
2127
|
+
return _context21.abrupt("continue", 33);
|
|
1893
2128
|
case 25:
|
|
1894
2129
|
// 1. 把 product.discount_list 和当前选中的 discount 对齐(剔除已取消的券)
|
|
1895
2130
|
product.discount_list = (product.discount_list || []).filter(function (pd) {
|
|
@@ -1898,45 +2133,53 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1898
2133
|
return rid != null && selectedResourceIds.has(rid);
|
|
1899
2134
|
});
|
|
1900
2135
|
|
|
1901
|
-
// 2. 以
|
|
2136
|
+
// 2. 以 source_product_price 为券作用基准:券作用于 source(不含 option),
|
|
2137
|
+
// 再把 option 加回得到含 option 的 main_product_selling_price,最后合成 composite。
|
|
1902
2138
|
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
1903
2139
|
return sum + (pd.amount || 0);
|
|
1904
2140
|
}, 0);
|
|
1905
|
-
|
|
1906
|
-
product.
|
|
2141
|
+
optionSum = sumOptionUnitPrice(product.product_option_item);
|
|
2142
|
+
sourcePrice = (_product$metadata$sou = (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : '0';
|
|
2143
|
+
newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
2144
|
+
newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
1907
2145
|
if (product.metadata) {
|
|
1908
|
-
product.metadata.main_product_selling_price =
|
|
2146
|
+
product.metadata.main_product_selling_price = newMainSellingPrice;
|
|
2147
|
+
product.metadata.price_schema_version = 2;
|
|
1909
2148
|
}
|
|
1910
|
-
|
|
2149
|
+
product.selling_price = composeLinePrice({
|
|
2150
|
+
mainPrice: newMainSellingPrice,
|
|
2151
|
+
bundle: product.product_bundle
|
|
2152
|
+
});
|
|
2153
|
+
case 33:
|
|
1911
2154
|
_context21.next = 21;
|
|
1912
2155
|
break;
|
|
1913
|
-
case
|
|
1914
|
-
_context21.next =
|
|
2156
|
+
case 35:
|
|
2157
|
+
_context21.next = 40;
|
|
1915
2158
|
break;
|
|
1916
|
-
case 34:
|
|
1917
|
-
_context21.prev = 34;
|
|
1918
|
-
_context21.t0 = _context21["catch"](19);
|
|
1919
|
-
_iterator10.e(_context21.t0);
|
|
1920
2159
|
case 37:
|
|
1921
2160
|
_context21.prev = 37;
|
|
1922
|
-
|
|
1923
|
-
|
|
2161
|
+
_context21.t0 = _context21["catch"](19);
|
|
2162
|
+
_iterator14.e(_context21.t0);
|
|
1924
2163
|
case 40:
|
|
2164
|
+
_context21.prev = 40;
|
|
2165
|
+
_iterator14.f();
|
|
2166
|
+
return _context21.finish(40);
|
|
2167
|
+
case 43:
|
|
1925
2168
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1926
|
-
_context21.next =
|
|
2169
|
+
_context21.next = 46;
|
|
1927
2170
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1928
|
-
case
|
|
2171
|
+
case 46:
|
|
1929
2172
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
1930
2173
|
return d.isSelected;
|
|
1931
2174
|
});
|
|
1932
2175
|
afterApplyTarget = this.store.order.getDiscountList().find(function (d) {
|
|
1933
2176
|
return d.id === params.discountId;
|
|
1934
2177
|
}) || null;
|
|
1935
|
-
_context21.next =
|
|
2178
|
+
_context21.next = 50;
|
|
1936
2179
|
return this.store.order.recalculateSummary({
|
|
1937
2180
|
createIfMissing: true
|
|
1938
2181
|
});
|
|
1939
|
-
case
|
|
2182
|
+
case 50:
|
|
1940
2183
|
this.store.order.persistTempOrder();
|
|
1941
2184
|
finalSummary = ((_this$store$order$get = this.store.order.getTempOrder()) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.summary) || null;
|
|
1942
2185
|
finalProduct = ((_this$store$order$get2 = this.store.order.getTempOrder()) === null || _this$store$order$get2 === void 0 || (_this$store$order$get2 = _this$store$order$get2.products) === null || _this$store$order$get2 === void 0 ? void 0 : _this$store$order$get2[0]) || null;
|
|
@@ -1945,18 +2188,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1945
2188
|
return d.id === params.discountId;
|
|
1946
2189
|
}) || null;
|
|
1947
2190
|
return _context21.abrupt("return", this.store.order.getDiscountList());
|
|
1948
|
-
case
|
|
1949
|
-
_context21.prev =
|
|
2191
|
+
case 58:
|
|
2192
|
+
_context21.prev = 58;
|
|
1950
2193
|
_context21.t1 = _context21["catch"](1);
|
|
1951
2194
|
this.logMethodError('setDiscountSelected', _context21.t1);
|
|
1952
2195
|
throw _context21.t1;
|
|
1953
|
-
case
|
|
2196
|
+
case 62:
|
|
1954
2197
|
case "end":
|
|
1955
2198
|
return _context21.stop();
|
|
1956
2199
|
}
|
|
1957
|
-
}, _callee21, this, [[1,
|
|
2200
|
+
}, _callee21, this, [[1, 58], [19, 37, 40, 43]]);
|
|
1958
2201
|
}));
|
|
1959
|
-
function setDiscountSelected(
|
|
2202
|
+
function setDiscountSelected(_x15) {
|
|
1960
2203
|
return _setDiscountSelected.apply(this, arguments);
|
|
1961
2204
|
}
|
|
1962
2205
|
return setDiscountSelected;
|
|
@@ -2101,7 +2344,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2101
2344
|
key: "addProductToOrder",
|
|
2102
2345
|
value: function () {
|
|
2103
2346
|
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(product) {
|
|
2104
|
-
var _product$
|
|
2347
|
+
var _product$metadata5, _product$product_vari2, quotationPrice, products;
|
|
2105
2348
|
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2106
2349
|
while (1) switch (_context25.prev = _context25.next) {
|
|
2107
2350
|
case 0:
|
|
@@ -2116,7 +2359,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2116
2359
|
}
|
|
2117
2360
|
throw new Error('order 模块未初始化');
|
|
2118
2361
|
case 4:
|
|
2119
|
-
if (!((_product$
|
|
2362
|
+
if (!((_product$metadata5 = product.metadata) !== null && _product$metadata5 !== void 0 && _product$metadata5.venue_booking) && this.store.quotation && product.product_id != null) {
|
|
2120
2363
|
quotationPrice = this.store.quotation.getPriceForProduct({
|
|
2121
2364
|
productId: product.product_id,
|
|
2122
2365
|
variantId: (_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : undefined,
|
|
@@ -2154,7 +2397,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2154
2397
|
}
|
|
2155
2398
|
}, _callee25, this, [[1, 16]]);
|
|
2156
2399
|
}));
|
|
2157
|
-
function addProductToOrder(
|
|
2400
|
+
function addProductToOrder(_x16) {
|
|
2158
2401
|
return _addProductToOrder.apply(this, arguments);
|
|
2159
2402
|
}
|
|
2160
2403
|
return addProductToOrder;
|
|
@@ -2203,7 +2446,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2203
2446
|
}
|
|
2204
2447
|
}, _callee26, this, [[1, 15]]);
|
|
2205
2448
|
}));
|
|
2206
|
-
function updateProductInOrder(
|
|
2449
|
+
function updateProductInOrder(_x17) {
|
|
2207
2450
|
return _updateProductInOrder.apply(this, arguments);
|
|
2208
2451
|
}
|
|
2209
2452
|
return updateProductInOrder;
|
|
@@ -2252,7 +2495,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2252
2495
|
}
|
|
2253
2496
|
}, _callee27, this, [[1, 15]]);
|
|
2254
2497
|
}));
|
|
2255
|
-
function removeProductFromOrder(
|
|
2498
|
+
function removeProductFromOrder(_x18) {
|
|
2256
2499
|
return _removeProductFromOrder.apply(this, arguments);
|
|
2257
2500
|
}
|
|
2258
2501
|
return removeProductFromOrder;
|
|
@@ -2291,7 +2534,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2291
2534
|
key: "loadOpenDataConfig",
|
|
2292
2535
|
value: function () {
|
|
2293
2536
|
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2294
|
-
var
|
|
2537
|
+
var _this11 = this;
|
|
2295
2538
|
var lastFetchedAt, cachedData;
|
|
2296
2539
|
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2297
2540
|
while (1) switch (_context29.prev = _context29.next) {
|
|
@@ -2322,10 +2565,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2322
2565
|
target: 'venue_booking+online_store',
|
|
2323
2566
|
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
2324
2567
|
}).then(function (openDataConfig) {
|
|
2325
|
-
|
|
2568
|
+
_this11.otherParams.openData = openDataConfig;
|
|
2326
2569
|
return openDataConfig;
|
|
2327
2570
|
}).finally(function () {
|
|
2328
|
-
|
|
2571
|
+
_this11.loadOpenDataConfigInFlight = null;
|
|
2329
2572
|
});
|
|
2330
2573
|
return _context29.abrupt("return", this.loadOpenDataConfigInFlight);
|
|
2331
2574
|
case 11:
|
|
@@ -2422,7 +2665,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2422
2665
|
}
|
|
2423
2666
|
}, _callee31, this, [[3, 13]]);
|
|
2424
2667
|
}));
|
|
2425
|
-
function fetchItemRuleConfigsByModelIds(
|
|
2668
|
+
function fetchItemRuleConfigsByModelIds(_x19) {
|
|
2426
2669
|
return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
|
|
2427
2670
|
}
|
|
2428
2671
|
return fetchItemRuleConfigsByModelIds;
|
|
@@ -2454,17 +2697,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2454
2697
|
if (visited.has(value)) return;
|
|
2455
2698
|
visited.add(value);
|
|
2456
2699
|
if (Array.isArray(value)) {
|
|
2457
|
-
var
|
|
2458
|
-
|
|
2700
|
+
var _iterator15 = _createForOfIteratorHelper(value),
|
|
2701
|
+
_step15;
|
|
2459
2702
|
try {
|
|
2460
|
-
for (
|
|
2461
|
-
var item =
|
|
2703
|
+
for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
|
|
2704
|
+
var item = _step15.value;
|
|
2462
2705
|
collectFromValue(item);
|
|
2463
2706
|
}
|
|
2464
2707
|
} catch (err) {
|
|
2465
|
-
|
|
2708
|
+
_iterator15.e(err);
|
|
2466
2709
|
} finally {
|
|
2467
|
-
|
|
2710
|
+
_iterator15.f();
|
|
2468
2711
|
}
|
|
2469
2712
|
return;
|
|
2470
2713
|
}
|
|
@@ -2512,7 +2755,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2512
2755
|
key: "ensureItemRuleConfigsLoaded",
|
|
2513
2756
|
value: function () {
|
|
2514
2757
|
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
2515
|
-
var
|
|
2758
|
+
var _this12 = this;
|
|
2516
2759
|
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2517
2760
|
while (1) switch (_context34.prev = _context34.next) {
|
|
2518
2761
|
case 0:
|
|
@@ -2533,19 +2776,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2533
2776
|
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2534
2777
|
while (1) switch (_context33.prev = _context33.next) {
|
|
2535
2778
|
case 0:
|
|
2536
|
-
runtimeConfig =
|
|
2779
|
+
runtimeConfig = _this12.getItemRuleRuntimeConfig();
|
|
2537
2780
|
staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
|
|
2538
2781
|
if (!(staticConfigs.length > 0)) {
|
|
2539
2782
|
_context33.next = 6;
|
|
2540
2783
|
break;
|
|
2541
2784
|
}
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
return _context33.abrupt("return",
|
|
2785
|
+
_this12.itemRuleConfigs = staticConfigs;
|
|
2786
|
+
_this12.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
2787
|
+
return _context33.abrupt("return", _this12.itemRuleConfigs);
|
|
2545
2788
|
case 6:
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
return _context33.abrupt("return",
|
|
2789
|
+
_this12.itemRuleConfigs = [];
|
|
2790
|
+
_this12.itemRuleEvaluator.setStrategyConfigs([]);
|
|
2791
|
+
return _context33.abrupt("return", _this12.itemRuleConfigs);
|
|
2549
2792
|
case 9:
|
|
2550
2793
|
case "end":
|
|
2551
2794
|
return _context33.stop();
|
|
@@ -2619,7 +2862,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2619
2862
|
key: "applyPrefillByItemRule",
|
|
2620
2863
|
value: function () {
|
|
2621
2864
|
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
2622
|
-
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges,
|
|
2865
|
+
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator16, _step16, _prefillItem$product_, _targetProduct$_origi, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct;
|
|
2623
2866
|
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2624
2867
|
while (1) switch (_context36.prev = _context36.next) {
|
|
2625
2868
|
case 0:
|
|
@@ -2664,15 +2907,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2664
2907
|
productSourceMap = _context36.sent;
|
|
2665
2908
|
tempOrder = this.ensureTempOrder();
|
|
2666
2909
|
hasChanges = false;
|
|
2667
|
-
|
|
2910
|
+
_iterator16 = _createForOfIteratorHelper(prefillItems);
|
|
2668
2911
|
_context36.prev = 20;
|
|
2669
|
-
|
|
2912
|
+
_iterator16.s();
|
|
2670
2913
|
case 22:
|
|
2671
|
-
if ((
|
|
2914
|
+
if ((_step16 = _iterator16.n()).done) {
|
|
2672
2915
|
_context36.next = 45;
|
|
2673
2916
|
break;
|
|
2674
2917
|
}
|
|
2675
|
-
prefillItem =
|
|
2918
|
+
prefillItem = _step16.value;
|
|
2676
2919
|
productId = Number(prefillItem.product_id);
|
|
2677
2920
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
2678
2921
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
@@ -2741,10 +2984,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2741
2984
|
case 47:
|
|
2742
2985
|
_context36.prev = 47;
|
|
2743
2986
|
_context36.t0 = _context36["catch"](20);
|
|
2744
|
-
|
|
2987
|
+
_iterator16.e(_context36.t0);
|
|
2745
2988
|
case 50:
|
|
2746
2989
|
_context36.prev = 50;
|
|
2747
|
-
|
|
2990
|
+
_iterator16.f();
|
|
2748
2991
|
return _context36.finish(50);
|
|
2749
2992
|
case 53:
|
|
2750
2993
|
if (!hasChanges) {
|
|
@@ -3096,7 +3339,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3096
3339
|
}
|
|
3097
3340
|
}, _callee43, this);
|
|
3098
3341
|
}));
|
|
3099
|
-
function setOtherParams(
|
|
3342
|
+
function setOtherParams(_x20) {
|
|
3100
3343
|
return _setOtherParams.apply(this, arguments);
|
|
3101
3344
|
}
|
|
3102
3345
|
return setOtherParams;
|