@pisell/pisellos 2.3.224 → 2.3.226
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/dataVariant/evaluator.d.ts +2 -1
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +60 -15
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/Customer/types.d.ts +4 -0
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +123 -79
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/Order/utils/bookingUuid.d.ts +4 -0
- package/dist/modules/Order/utils/bookingUuid.js +24 -0
- package/dist/modules/Order/utils.js +2 -0
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/solution/BaseSales/index.js +3 -0
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/utils/redeemArrival.d.ts +12 -12
- package/dist/solution/Checkout/index.js +104 -69
- package/dist/solution/Checkout/types.d.ts +1 -0
- package/dist/solution/ScanOrder/index.js +10 -2
- package/dist/solution/VenueBooking/index.js +522 -490
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +2 -1
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +40 -6
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/Customer/types.d.ts +4 -0
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +44 -6
- package/lib/modules/Order/types.d.ts +2 -0
- package/lib/modules/Order/utils/bookingUuid.d.ts +4 -0
- package/lib/modules/Order/utils/bookingUuid.js +25 -0
- package/lib/modules/Order/utils.js +5 -1
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/solution/BaseSales/index.js +3 -0
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/utils/redeemArrival.d.ts +12 -12
- package/lib/solution/Checkout/index.js +21 -0
- package/lib/solution/Checkout/types.d.ts +1 -0
- package/lib/solution/ScanOrder/index.js +6 -0
- package/lib/solution/VenueBooking/index.js +6 -1
- package/package.json +1 -1
|
@@ -50,6 +50,7 @@ import { buildSlotPriceMapByScheduleSegments, formatProductsWithDataVariant, get
|
|
|
50
50
|
import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry, buildVenueResourceMetadata, buildPriceBreakdown } from "./utils/slotMerge";
|
|
51
51
|
import { composeLinePrice, createUuidV4, getOrderProductLineUid, getProductSkuOptions, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
52
52
|
import { OrderModule } from "../../modules/Order";
|
|
53
|
+
import { ensureBookingUuid } from "../../modules/Order/utils/bookingUuid";
|
|
53
54
|
import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
|
|
54
55
|
import Decimal from 'decimal.js';
|
|
55
56
|
import { HolderModule } from "../../modules/Holder";
|
|
@@ -2073,31 +2074,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2073
2074
|
key: "reconcileOrderForResourceProduct",
|
|
2074
2075
|
value: (function () {
|
|
2075
2076
|
var _reconcileOrderForResourceProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(resourceId, productId, slots) {
|
|
2076
|
-
var
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2077
|
+
var _this10 = this,
|
|
2078
|
+
_this$store$order7,
|
|
2079
|
+
_this$store$order7$ge;
|
|
2080
|
+
var mappings, mapping, tempOrder, matchesCurrent, previousBookings, merged, rawResource, childRawResources, venueProduct, _loop3, i, products;
|
|
2081
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context22) {
|
|
2082
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2080
2083
|
case 0:
|
|
2081
2084
|
mappings = this.resourceProductMap.get(resourceId);
|
|
2082
2085
|
if (!(!mappings || !mappings.length || !this.store.order)) {
|
|
2083
|
-
|
|
2086
|
+
_context22.next = 3;
|
|
2084
2087
|
break;
|
|
2085
2088
|
}
|
|
2086
|
-
return
|
|
2089
|
+
return _context22.abrupt("return");
|
|
2087
2090
|
case 3:
|
|
2088
2091
|
mapping = mappings.find(function (m) {
|
|
2089
2092
|
return m.productId === productId;
|
|
2090
2093
|
});
|
|
2091
2094
|
if (mapping) {
|
|
2092
|
-
|
|
2095
|
+
_context22.next = 6;
|
|
2093
2096
|
break;
|
|
2094
2097
|
}
|
|
2095
|
-
return
|
|
2098
|
+
return _context22.abrupt("return");
|
|
2096
2099
|
case 6:
|
|
2097
2100
|
tempOrder = this.store.order.ensureTempOrder();
|
|
2098
2101
|
matchesCurrent = function matchesCurrent(meta, pid) {
|
|
2099
2102
|
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);
|
|
2100
2103
|
};
|
|
2104
|
+
previousBookings = (tempOrder.bookings || []).filter(function (row) {
|
|
2105
|
+
var _row$metadata$product, _row$metadata, _row$product;
|
|
2106
|
+
return row.uuid && matchesCurrent(row.metadata, (_row$metadata$product = (_row$metadata = row.metadata) === null || _row$metadata === void 0 ? void 0 : _row$metadata.product_id) !== null && _row$metadata$product !== void 0 ? _row$metadata$product : (_row$product = row.product) === null || _row$product === void 0 ? void 0 : _row$product.product_id);
|
|
2107
|
+
});
|
|
2101
2108
|
tempOrder.products = tempOrder.products.filter(function (p) {
|
|
2102
2109
|
return !matchesCurrent(p.metadata, p.product_id);
|
|
2103
2110
|
});
|
|
@@ -2110,18 +2117,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2110
2117
|
return Number(bookingProductId) !== Number(productId);
|
|
2111
2118
|
});
|
|
2112
2119
|
if (slots.length) {
|
|
2113
|
-
|
|
2120
|
+
_context22.next = 17;
|
|
2114
2121
|
break;
|
|
2115
2122
|
}
|
|
2116
2123
|
this.store.order.applyDiscount();
|
|
2117
|
-
|
|
2124
|
+
_context22.next = 15;
|
|
2118
2125
|
return this.store.order.recalculateSummary({
|
|
2119
2126
|
createIfMissing: true
|
|
2120
2127
|
});
|
|
2121
|
-
case
|
|
2128
|
+
case 15:
|
|
2122
2129
|
this.store.order.persistTempOrder();
|
|
2123
|
-
return
|
|
2124
|
-
case
|
|
2130
|
+
return _context22.abrupt("return");
|
|
2131
|
+
case 17:
|
|
2125
2132
|
merged = mergeConsecutiveSlots(slots);
|
|
2126
2133
|
rawResource = this.store.rawResourceData.find(function (r) {
|
|
2127
2134
|
return String(r.resourceId) === String(resourceId);
|
|
@@ -2131,140 +2138,165 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2131
2138
|
return p.id === mapping.productId;
|
|
2132
2139
|
});
|
|
2133
2140
|
tempOrder.bookings = tempOrder.bookings || [];
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
productUid
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2141
|
+
_loop3 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop3() {
|
|
2142
|
+
var _rawResource$form_id, _venueProduct$is_char;
|
|
2143
|
+
var group, productUid, bookingUuid, startMoment, endMoment, duration, customDepositData, productTitle, resourceEntry, venueProductOrigin, normalizedVenueOrderProduct, venueOrderProduct, booking, original;
|
|
2144
|
+
return _regeneratorRuntime().wrap(function _loop3$(_context21) {
|
|
2145
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2146
|
+
case 0:
|
|
2147
|
+
group = merged[i];
|
|
2148
|
+
productUid = buildVenueIdentityKey(resourceId, i);
|
|
2149
|
+
bookingUuid = createUuidV4();
|
|
2150
|
+
startMoment = dayjs(group.startTime, 'YYYY-MM-DD HH:mm');
|
|
2151
|
+
endMoment = dayjs(group.endTime, 'YYYY-MM-DD HH:mm');
|
|
2152
|
+
duration = endMoment.diff(startMoment, 'minute');
|
|
2153
|
+
customDepositData = cloneCustomDepositData(venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.custom_deposit_data);
|
|
2154
|
+
productTitle = _this10.normalizeVenueProductTitle(venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.product_title) || _this10.normalizeVenueProductTitle(venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.title) || _this10.normalizeVenueProductTitle(mapping.productTitle);
|
|
2155
|
+
resourceEntry = {
|
|
2156
|
+
relation_type: 'form',
|
|
2157
|
+
like_status: 'common',
|
|
2158
|
+
id: resourceId,
|
|
2159
|
+
main_field: mapping.resourceName,
|
|
2160
|
+
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,
|
|
2161
|
+
relation_id: resourceId,
|
|
2162
|
+
capacity: 1,
|
|
2163
|
+
metadata: buildVenueResourceMetadata({
|
|
2164
|
+
mapping: mapping,
|
|
2165
|
+
rawResource: rawResource
|
|
2166
|
+
})
|
|
2167
|
+
};
|
|
2168
|
+
if (childRawResources && childRawResources.length) {
|
|
2169
|
+
resourceEntry.children = childRawResources.map(function (child) {
|
|
2170
|
+
var _child$form_id, _child$capacity;
|
|
2171
|
+
return {
|
|
2172
|
+
relation_type: 'form',
|
|
2173
|
+
like_status: 'common',
|
|
2174
|
+
id: child.resourceId,
|
|
2175
|
+
main_field: child.main_field || '',
|
|
2176
|
+
form_id: (_child$form_id = child.form_id) !== null && _child$form_id !== void 0 ? _child$form_id : child.formId,
|
|
2177
|
+
relation_id: child.resourceId,
|
|
2178
|
+
capacity: (_child$capacity = child.capacity) !== null && _child$capacity !== void 0 ? _child$capacity : 1,
|
|
2179
|
+
metadata: {}
|
|
2180
|
+
};
|
|
2181
|
+
});
|
|
2182
|
+
}
|
|
2183
|
+
venueProductOrigin = {
|
|
2184
|
+
name: mapping.productTitle,
|
|
2185
|
+
product_title: productTitle,
|
|
2186
|
+
cover: (venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.cover) || '',
|
|
2187
|
+
custom_deposit_data: customDepositData,
|
|
2188
|
+
id: 0,
|
|
2189
|
+
number: 1,
|
|
2190
|
+
registration_type: 'all',
|
|
2191
|
+
relation_products: [],
|
|
2192
|
+
is_all: false,
|
|
2193
|
+
product: {
|
|
2194
|
+
product_id: mapping.productId,
|
|
2195
|
+
product_variant_id: 0,
|
|
2196
|
+
num: 1,
|
|
2197
|
+
product_bundle: [],
|
|
2198
|
+
product_sku: {
|
|
2199
|
+
option: []
|
|
2200
|
+
},
|
|
2201
|
+
discount_list: [],
|
|
2202
|
+
custom_deposit_data: customDepositData,
|
|
2203
|
+
metadata: {}
|
|
2204
|
+
},
|
|
2205
|
+
sub_type: 'minutes',
|
|
2206
|
+
duration: duration,
|
|
2207
|
+
like_status: 'common',
|
|
2208
|
+
resources: [resourceEntry],
|
|
2209
|
+
schedule_id: 0,
|
|
2210
|
+
select_date: startMoment.format('YYYY-MM-DD'),
|
|
2211
|
+
start_date: startMoment.format('YYYY-MM-DD'),
|
|
2212
|
+
start_time: startMoment.format('HH:mm'),
|
|
2213
|
+
end_date: endMoment.format('YYYY-MM-DD'),
|
|
2214
|
+
end_time: endMoment.format('HH:mm'),
|
|
2215
|
+
metadata: {
|
|
2216
|
+
venue_booking: true,
|
|
2217
|
+
slot_count: group.slotCount
|
|
2218
|
+
},
|
|
2219
|
+
holder: null
|
|
2220
|
+
};
|
|
2221
|
+
normalizedVenueOrderProduct = normalizeOrderProduct({
|
|
2222
|
+
product_id: mapping.productId,
|
|
2223
|
+
product_variant_id: 0,
|
|
2224
|
+
num: 1,
|
|
2225
|
+
selling_price: group.totalPrice,
|
|
2226
|
+
original_price: group.totalPrice,
|
|
2227
|
+
is_charge_tax: (_venueProduct$is_char = venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.is_charge_tax) !== null && _venueProduct$is_char !== void 0 ? _venueProduct$is_char : 0,
|
|
2228
|
+
metadata: _objectSpread(_objectSpread({
|
|
2229
|
+
unique_identification_number: productUid,
|
|
2230
|
+
venue_booking: true
|
|
2231
|
+
}, productTitle ? {
|
|
2232
|
+
product_title: productTitle
|
|
2233
|
+
} : {}), {}, {
|
|
2234
|
+
resource_id: resourceId,
|
|
2235
|
+
resource_form_id: mapping.formId,
|
|
2236
|
+
resource_name: mapping.resourceName,
|
|
2237
|
+
start_time: group.startTime,
|
|
2238
|
+
end_time: group.endTime,
|
|
2239
|
+
slot_count: group.slotCount,
|
|
2240
|
+
booking_uid: bookingUuid,
|
|
2241
|
+
price_breakdown: buildPriceBreakdown({
|
|
2242
|
+
group: group,
|
|
2243
|
+
productId: mapping.productId
|
|
2244
|
+
})
|
|
2245
|
+
}),
|
|
2246
|
+
_origin: venueProductOrigin
|
|
2247
|
+
});
|
|
2248
|
+
venueOrderProduct = productTitle ? _objectSpread(_objectSpread({}, normalizedVenueOrderProduct), {}, {
|
|
2249
|
+
product_title: productTitle
|
|
2250
|
+
}) : normalizedVenueOrderProduct;
|
|
2251
|
+
_this10.attachProductOriginToTempOrder(tempOrder, productUid, venueProductOrigin);
|
|
2252
|
+
tempOrder.products.push(venueOrderProduct);
|
|
2253
|
+
booking = buildVenueBookingEntry({
|
|
2254
|
+
group: group,
|
|
2255
|
+
resourceId: resourceId,
|
|
2256
|
+
mapping: mapping,
|
|
2257
|
+
rawResource: rawResource,
|
|
2258
|
+
bookingUuid: bookingUuid,
|
|
2259
|
+
productUid: productUid,
|
|
2260
|
+
childResources: childRawResources
|
|
2261
|
+
}); // A resized or split interval can reuse its original UUID once.
|
|
2262
|
+
original = previousBookings.findIndex(function (row) {
|
|
2263
|
+
return "".concat(row.start_date, " ").concat(String(row.start_time).slice(0, 5)) < group.endTime && "".concat(row.end_date, " ").concat(String(row.end_time).slice(0, 5)) > group.startTime;
|
|
2264
|
+
});
|
|
2265
|
+
if (original >= 0) booking.uuid = previousBookings.splice(original, 1)[0].uuid;
|
|
2266
|
+
tempOrder.bookings.push(ensureBookingUuid(booking));
|
|
2267
|
+
case 19:
|
|
2268
|
+
case "end":
|
|
2269
|
+
return _context21.stop();
|
|
2270
|
+
}
|
|
2271
|
+
}, _loop3);
|
|
2272
|
+
});
|
|
2273
|
+
i = 0;
|
|
2274
|
+
case 24:
|
|
2275
|
+
if (!(i < merged.length)) {
|
|
2276
|
+
_context22.next = 29;
|
|
2277
|
+
break;
|
|
2251
2278
|
}
|
|
2252
|
-
|
|
2279
|
+
return _context22.delegateYield(_loop3(), "t0", 26);
|
|
2280
|
+
case 26:
|
|
2281
|
+
i++;
|
|
2282
|
+
_context22.next = 24;
|
|
2283
|
+
break;
|
|
2284
|
+
case 29:
|
|
2253
2285
|
// 获取表单信息
|
|
2254
2286
|
products = ((_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 || (_this$store$order7$ge = _this$store$order7.getOrderProducts) === null || _this$store$order7$ge === void 0 ? void 0 : _this$store$order7$ge.call(_this$store$order7)) || [];
|
|
2255
|
-
|
|
2287
|
+
_context22.next = 32;
|
|
2256
2288
|
return this.preloadHolderForms(products);
|
|
2257
|
-
case
|
|
2289
|
+
case 32:
|
|
2258
2290
|
this.store.order.applyDiscount();
|
|
2259
|
-
|
|
2291
|
+
_context22.next = 35;
|
|
2260
2292
|
return this.store.order.recalculateSummary({
|
|
2261
2293
|
createIfMissing: true
|
|
2262
2294
|
});
|
|
2263
|
-
case
|
|
2295
|
+
case 35:
|
|
2264
2296
|
this.store.order.persistTempOrder();
|
|
2265
|
-
case
|
|
2297
|
+
case 36:
|
|
2266
2298
|
case "end":
|
|
2267
|
-
return
|
|
2299
|
+
return _context22.stop();
|
|
2268
2300
|
}
|
|
2269
2301
|
}, _callee21, this);
|
|
2270
2302
|
}));
|
|
@@ -2276,7 +2308,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2276
2308
|
}, {
|
|
2277
2309
|
key: "getCombinedChildRawResources",
|
|
2278
2310
|
value: function getCombinedChildRawResources(rawResource) {
|
|
2279
|
-
var
|
|
2311
|
+
var _this11 = this;
|
|
2280
2312
|
if (!rawResource) return undefined;
|
|
2281
2313
|
var combined = rawResource.combined_resource;
|
|
2282
2314
|
if (!combined || combined.status !== 1 || !Array.isArray(combined.resource_ids) || !combined.resource_ids.length) {
|
|
@@ -2286,15 +2318,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2286
2318
|
var _iterator12 = _createForOfIteratorHelper(combined.resource_ids),
|
|
2287
2319
|
_step12;
|
|
2288
2320
|
try {
|
|
2289
|
-
var
|
|
2321
|
+
var _loop4 = function _loop4() {
|
|
2290
2322
|
var id = _step12.value;
|
|
2291
|
-
var child =
|
|
2323
|
+
var child = _this11.store.rawResourceData.find(function (r) {
|
|
2292
2324
|
return String(r.resourceId) === String(id);
|
|
2293
2325
|
});
|
|
2294
2326
|
if (child) children.push(child);
|
|
2295
2327
|
};
|
|
2296
2328
|
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
2297
|
-
|
|
2329
|
+
_loop4();
|
|
2298
2330
|
}
|
|
2299
2331
|
} catch (err) {
|
|
2300
2332
|
_iterator12.e(err);
|
|
@@ -2323,36 +2355,36 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2323
2355
|
key: "loadSchedules",
|
|
2324
2356
|
value: function () {
|
|
2325
2357
|
var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
2326
|
-
return _regeneratorRuntime().wrap(function _callee22$(
|
|
2327
|
-
while (1) switch (
|
|
2358
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context23) {
|
|
2359
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2328
2360
|
case 0:
|
|
2329
2361
|
this.logMethodStart('loadSchedules');
|
|
2330
|
-
|
|
2362
|
+
_context23.prev = 1;
|
|
2331
2363
|
if (this.store.schedule) {
|
|
2332
|
-
|
|
2364
|
+
_context23.next = 4;
|
|
2333
2365
|
break;
|
|
2334
2366
|
}
|
|
2335
2367
|
throw new Error('schedule 模块未初始化');
|
|
2336
2368
|
case 4:
|
|
2337
|
-
|
|
2369
|
+
_context23.next = 6;
|
|
2338
2370
|
return this.store.schedule.loadAllSchedule();
|
|
2339
2371
|
case 6:
|
|
2340
2372
|
this.injectScheduleResolverToQuotation();
|
|
2341
2373
|
this.slotPriceMapCache.clear();
|
|
2342
|
-
|
|
2374
|
+
_context23.next = 10;
|
|
2343
2375
|
return this.refreshSmartPricing();
|
|
2344
2376
|
case 10:
|
|
2345
2377
|
this.logMethodSuccess('loadSchedules');
|
|
2346
|
-
|
|
2378
|
+
_context23.next = 17;
|
|
2347
2379
|
break;
|
|
2348
2380
|
case 13:
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
this.logMethodError('loadSchedules',
|
|
2352
|
-
throw
|
|
2381
|
+
_context23.prev = 13;
|
|
2382
|
+
_context23.t0 = _context23["catch"](1);
|
|
2383
|
+
this.logMethodError('loadSchedules', _context23.t0);
|
|
2384
|
+
throw _context23.t0;
|
|
2353
2385
|
case 17:
|
|
2354
2386
|
case "end":
|
|
2355
|
-
return
|
|
2387
|
+
return _context23.stop();
|
|
2356
2388
|
}
|
|
2357
2389
|
}, _callee22, this, [[1, 13]]);
|
|
2358
2390
|
}));
|
|
@@ -2364,10 +2396,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2364
2396
|
}, {
|
|
2365
2397
|
key: "injectScheduleResolverToQuotation",
|
|
2366
2398
|
value: function injectScheduleResolverToQuotation() {
|
|
2367
|
-
var
|
|
2399
|
+
var _this12 = this;
|
|
2368
2400
|
if (this.store.quotation && this.store.schedule) {
|
|
2369
2401
|
this.store.quotation.setScheduleResolver(function (id) {
|
|
2370
|
-
return
|
|
2402
|
+
return _this12.store.schedule.getScheduleListByIds([id])[0];
|
|
2371
2403
|
});
|
|
2372
2404
|
}
|
|
2373
2405
|
}
|
|
@@ -2409,14 +2441,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2409
2441
|
key: "onCustomerLogin",
|
|
2410
2442
|
value: function () {
|
|
2411
2443
|
var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
|
|
2412
|
-
return _regeneratorRuntime().wrap(function _callee23$(
|
|
2413
|
-
while (1) switch (
|
|
2444
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context24) {
|
|
2445
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2414
2446
|
case 0:
|
|
2415
2447
|
this.logMethodStart('onCustomerLogin', {
|
|
2416
2448
|
customerId: params.customerId
|
|
2417
2449
|
});
|
|
2418
|
-
|
|
2419
|
-
|
|
2450
|
+
_context24.prev = 1;
|
|
2451
|
+
_context24.next = 4;
|
|
2420
2452
|
return this.refreshOrderMarketingForCustomer({
|
|
2421
2453
|
customerId: params.customerId
|
|
2422
2454
|
});
|
|
@@ -2424,16 +2456,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2424
2456
|
this.logMethodSuccess('onCustomerLogin', {
|
|
2425
2457
|
customerId: params.customerId
|
|
2426
2458
|
});
|
|
2427
|
-
|
|
2459
|
+
_context24.next = 11;
|
|
2428
2460
|
break;
|
|
2429
2461
|
case 7:
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
this.logMethodError('onCustomerLogin',
|
|
2433
|
-
throw
|
|
2462
|
+
_context24.prev = 7;
|
|
2463
|
+
_context24.t0 = _context24["catch"](1);
|
|
2464
|
+
this.logMethodError('onCustomerLogin', _context24.t0);
|
|
2465
|
+
throw _context24.t0;
|
|
2434
2466
|
case 11:
|
|
2435
2467
|
case "end":
|
|
2436
|
-
return
|
|
2468
|
+
return _context24.stop();
|
|
2437
2469
|
}
|
|
2438
2470
|
}, _callee23, this, [[1, 7]]);
|
|
2439
2471
|
}));
|
|
@@ -2446,16 +2478,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2446
2478
|
key: "onCustomerLogout",
|
|
2447
2479
|
value: (function () {
|
|
2448
2480
|
var _onCustomerLogout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
2449
|
-
return _regeneratorRuntime().wrap(function _callee24$(
|
|
2450
|
-
while (1) switch (
|
|
2481
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context25) {
|
|
2482
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2451
2483
|
case 0:
|
|
2452
|
-
|
|
2484
|
+
_context25.next = 2;
|
|
2453
2485
|
return this.refreshOrderMarketingForCustomer({
|
|
2454
2486
|
customerId: null
|
|
2455
2487
|
});
|
|
2456
2488
|
case 2:
|
|
2457
2489
|
case "end":
|
|
2458
|
-
return
|
|
2490
|
+
return _context25.stop();
|
|
2459
2491
|
}
|
|
2460
2492
|
}, _callee24, this);
|
|
2461
2493
|
}));
|
|
@@ -2468,7 +2500,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2468
2500
|
key: "recalculateOrderPricesFromSmartPricing",
|
|
2469
2501
|
value: function recalculateOrderPricesFromSmartPricing() {
|
|
2470
2502
|
var _tempOrder$products,
|
|
2471
|
-
|
|
2503
|
+
_this13 = this;
|
|
2472
2504
|
if (!this.store.order) return;
|
|
2473
2505
|
var tempOrder = this.store.order.getTempOrder();
|
|
2474
2506
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
|
|
@@ -2476,26 +2508,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2476
2508
|
var _iterator13 = _createForOfIteratorHelper(tempOrder.products),
|
|
2477
2509
|
_step13;
|
|
2478
2510
|
try {
|
|
2479
|
-
var
|
|
2511
|
+
var _loop5 = function _loop5() {
|
|
2480
2512
|
var _product$metadata2;
|
|
2481
2513
|
var product = _step13.value;
|
|
2482
2514
|
if ((_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking) {
|
|
2483
|
-
var mappings =
|
|
2515
|
+
var mappings = _this13.resourceProductMap.get(product.metadata.resource_id);
|
|
2484
2516
|
if (!mappings || !mappings.length) return 0; // continue
|
|
2485
2517
|
var mapping = mappings.find(function (m) {
|
|
2486
2518
|
return Number(m.productId) === Number(product.product_id);
|
|
2487
2519
|
}) || mappings[0];
|
|
2488
2520
|
if (!mapping) return 0; // continue
|
|
2489
|
-
var slots = expandMergedSlotToIndividual(product,
|
|
2521
|
+
var slots = expandMergedSlotToIndividual(product, _this13.store.slotConfig.slotDurationMinutes);
|
|
2490
2522
|
var updatedSlots = slots.map(function (slot) {
|
|
2491
2523
|
var slotStart = dayjs(slot.startTime);
|
|
2492
2524
|
var date = slotStart.format('YYYY-MM-DD');
|
|
2493
2525
|
var previousDate = slotStart.subtract(1, 'day').format('YYYY-MM-DD');
|
|
2494
|
-
var previousConfig =
|
|
2526
|
+
var previousConfig = _this13.resolveSlotConfigForDate(previousDate);
|
|
2495
2527
|
if (isBusinessHoursCrossDay(previousConfig) && slotStart.format('HH:mm') < previousConfig.businessStartTime) {
|
|
2496
2528
|
date = previousDate;
|
|
2497
2529
|
}
|
|
2498
|
-
var slotPriceMap =
|
|
2530
|
+
var slotPriceMap = _this13.buildSlotPriceMapForDate(date, _this13.resolveSlotConfigForDate(date), [mapping.productId]);
|
|
2499
2531
|
return _objectSpread(_objectSpread({}, slot), {}, {
|
|
2500
2532
|
productId: mapping.productId,
|
|
2501
2533
|
price: getSlotPriceFromMap({
|
|
@@ -2508,7 +2540,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2508
2540
|
});
|
|
2509
2541
|
var merged = mergeConsecutiveSlots(updatedSlots);
|
|
2510
2542
|
if (merged.length === 1) {
|
|
2511
|
-
|
|
2543
|
+
_this13.resetProductPriceForSmartPricing(product, merged[0].totalPrice);
|
|
2512
2544
|
product.metadata.price_breakdown = buildPriceBreakdown({
|
|
2513
2545
|
group: merged[0],
|
|
2514
2546
|
productId: mapping.productId
|
|
@@ -2517,19 +2549,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2517
2549
|
} else if (product.product_id != null) {
|
|
2518
2550
|
var _product$product_vari, _product$metadata$sou, _product$metadata3;
|
|
2519
2551
|
var price = getPriceForProductAtDatetime({
|
|
2520
|
-
products:
|
|
2521
|
-
context:
|
|
2552
|
+
products: _this13.smartPricingProductCatalog,
|
|
2553
|
+
context: _this13.buildSmartPricingContext(),
|
|
2522
2554
|
productId: product.product_id,
|
|
2523
2555
|
variantId: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : undefined,
|
|
2524
2556
|
datetime: now,
|
|
2525
2557
|
fallbackPrice: (_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.original_price
|
|
2526
2558
|
});
|
|
2527
|
-
|
|
2559
|
+
_this13.resetProductPriceForSmartPricing(product, price);
|
|
2528
2560
|
}
|
|
2529
2561
|
},
|
|
2530
2562
|
_ret;
|
|
2531
2563
|
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
2532
|
-
_ret =
|
|
2564
|
+
_ret = _loop5();
|
|
2533
2565
|
if (_ret === 0) continue;
|
|
2534
2566
|
}
|
|
2535
2567
|
} catch (err) {
|
|
@@ -2564,28 +2596,28 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2564
2596
|
value: function () {
|
|
2565
2597
|
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(code, customerId) {
|
|
2566
2598
|
var result;
|
|
2567
|
-
return _regeneratorRuntime().wrap(function _callee25$(
|
|
2568
|
-
while (1) switch (
|
|
2599
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context26) {
|
|
2600
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2569
2601
|
case 0:
|
|
2570
2602
|
this.logMethodStart('scanCode', {
|
|
2571
2603
|
code: code
|
|
2572
2604
|
});
|
|
2573
|
-
|
|
2605
|
+
_context26.prev = 1;
|
|
2574
2606
|
if (this.store.order) {
|
|
2575
|
-
|
|
2607
|
+
_context26.next = 4;
|
|
2576
2608
|
break;
|
|
2577
2609
|
}
|
|
2578
2610
|
throw new Error('order 模块未初始化');
|
|
2579
2611
|
case 4:
|
|
2580
|
-
|
|
2612
|
+
_context26.next = 6;
|
|
2581
2613
|
return this.store.order.scanCode(code, customerId);
|
|
2582
2614
|
case 6:
|
|
2583
|
-
result =
|
|
2615
|
+
result = _context26.sent;
|
|
2584
2616
|
if (!result.isAvailable) {
|
|
2585
|
-
|
|
2617
|
+
_context26.next = 11;
|
|
2586
2618
|
break;
|
|
2587
2619
|
}
|
|
2588
|
-
|
|
2620
|
+
_context26.next = 10;
|
|
2589
2621
|
return this.store.order.recalculateSummary({
|
|
2590
2622
|
createIfMissing: true
|
|
2591
2623
|
});
|
|
@@ -2595,15 +2627,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2595
2627
|
this.logMethodSuccess('scanCode', {
|
|
2596
2628
|
isAvailable: result.isAvailable
|
|
2597
2629
|
});
|
|
2598
|
-
return
|
|
2630
|
+
return _context26.abrupt("return", result);
|
|
2599
2631
|
case 15:
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
this.logMethodError('scanCode',
|
|
2603
|
-
throw
|
|
2632
|
+
_context26.prev = 15;
|
|
2633
|
+
_context26.t0 = _context26["catch"](1);
|
|
2634
|
+
this.logMethodError('scanCode', _context26.t0);
|
|
2635
|
+
throw _context26.t0;
|
|
2604
2636
|
case 19:
|
|
2605
2637
|
case "end":
|
|
2606
|
-
return
|
|
2638
|
+
return _context26.stop();
|
|
2607
2639
|
}
|
|
2608
2640
|
}, _callee25, this, [[1, 15]]);
|
|
2609
2641
|
}));
|
|
@@ -2625,13 +2657,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2625
2657
|
value: (function () {
|
|
2626
2658
|
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
|
|
2627
2659
|
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, _iterator14, _step14, d, selectedResourceIds, _iterator15, _step15, _origin, _product$metadata$sou2, _product$metadata4, _product$metadata5, _product$original_pri, product, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
|
|
2628
|
-
return _regeneratorRuntime().wrap(function _callee26$(
|
|
2629
|
-
while (1) switch (
|
|
2660
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context27) {
|
|
2661
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2630
2662
|
case 0:
|
|
2631
2663
|
this.logMethodStart('setDiscountSelected', params);
|
|
2632
|
-
|
|
2664
|
+
_context27.prev = 1;
|
|
2633
2665
|
if (this.store.order) {
|
|
2634
|
-
|
|
2666
|
+
_context27.next = 4;
|
|
2635
2667
|
break;
|
|
2636
2668
|
}
|
|
2637
2669
|
throw new Error('order 模块未初始化');
|
|
@@ -2657,7 +2689,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2657
2689
|
form_record_id: tempOrder.holder.form_record_id
|
|
2658
2690
|
}] : [];
|
|
2659
2691
|
nextDiscountList = updated;
|
|
2660
|
-
|
|
2692
|
+
_context27.next = 16;
|
|
2661
2693
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
2662
2694
|
case 16:
|
|
2663
2695
|
if (rulesModule) {
|
|
@@ -2709,26 +2741,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2709
2741
|
// 目的:避免 unselect 后 selling_price 残留、reselect 时把残留价带进下一轮 Rules 造成双折扣。
|
|
2710
2742
|
// 手动改价商品(_origin.isManualDiscount=true)不参与券流程归一化,保留手工价。
|
|
2711
2743
|
_iterator15 = _createForOfIteratorHelper(tempOrder.products);
|
|
2712
|
-
|
|
2744
|
+
_context27.prev = 19;
|
|
2713
2745
|
_iterator15.s();
|
|
2714
2746
|
case 21:
|
|
2715
2747
|
if ((_step15 = _iterator15.n()).done) {
|
|
2716
|
-
|
|
2748
|
+
_context27.next = 38;
|
|
2717
2749
|
break;
|
|
2718
2750
|
}
|
|
2719
2751
|
product = _step15.value;
|
|
2720
2752
|
if (!((_origin = product._origin) !== null && _origin !== void 0 && _origin.isManualDiscount)) {
|
|
2721
|
-
|
|
2753
|
+
_context27.next = 25;
|
|
2722
2754
|
break;
|
|
2723
2755
|
}
|
|
2724
|
-
return
|
|
2756
|
+
return _context27.abrupt("continue", 36);
|
|
2725
2757
|
case 25:
|
|
2726
2758
|
if (!(product.discount_list || []).some(isItemRewardProductDiscount)) {
|
|
2727
|
-
|
|
2759
|
+
_context27.next = 28;
|
|
2728
2760
|
break;
|
|
2729
2761
|
}
|
|
2730
2762
|
product.discount_list = (product.discount_list || []).filter(isItemRewardProductDiscount);
|
|
2731
|
-
return
|
|
2763
|
+
return _context27.abrupt("continue", 36);
|
|
2732
2764
|
case 28:
|
|
2733
2765
|
// 1. 把 product.discount_list 和当前选中的 discount 对齐(剔除已取消的券)
|
|
2734
2766
|
product.discount_list = (product.discount_list || []).filter(function (pd) {
|
|
@@ -2755,22 +2787,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2755
2787
|
bundle: product.product_bundle
|
|
2756
2788
|
});
|
|
2757
2789
|
case 36:
|
|
2758
|
-
|
|
2790
|
+
_context27.next = 21;
|
|
2759
2791
|
break;
|
|
2760
2792
|
case 38:
|
|
2761
|
-
|
|
2793
|
+
_context27.next = 43;
|
|
2762
2794
|
break;
|
|
2763
2795
|
case 40:
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
_iterator15.e(
|
|
2796
|
+
_context27.prev = 40;
|
|
2797
|
+
_context27.t0 = _context27["catch"](19);
|
|
2798
|
+
_iterator15.e(_context27.t0);
|
|
2767
2799
|
case 43:
|
|
2768
|
-
|
|
2800
|
+
_context27.prev = 43;
|
|
2769
2801
|
_iterator15.f();
|
|
2770
|
-
return
|
|
2802
|
+
return _context27.finish(43);
|
|
2771
2803
|
case 46:
|
|
2772
2804
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2773
|
-
|
|
2805
|
+
_context27.next = 49;
|
|
2774
2806
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2775
2807
|
case 49:
|
|
2776
2808
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
@@ -2779,7 +2811,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2779
2811
|
afterApplyTarget = this.store.order.getDiscountList().find(function (d) {
|
|
2780
2812
|
return d.id === params.discountId;
|
|
2781
2813
|
}) || null;
|
|
2782
|
-
|
|
2814
|
+
_context27.next = 53;
|
|
2783
2815
|
return this.store.order.recalculateSummary({
|
|
2784
2816
|
createIfMissing: true
|
|
2785
2817
|
});
|
|
@@ -2791,15 +2823,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2791
2823
|
finalTarget = this.store.order.getDiscountList().find(function (d) {
|
|
2792
2824
|
return d.id === params.discountId;
|
|
2793
2825
|
}) || null;
|
|
2794
|
-
return
|
|
2826
|
+
return _context27.abrupt("return", this.store.order.getDiscountList());
|
|
2795
2827
|
case 61:
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
this.logMethodError('setDiscountSelected',
|
|
2799
|
-
throw
|
|
2828
|
+
_context27.prev = 61;
|
|
2829
|
+
_context27.t1 = _context27["catch"](1);
|
|
2830
|
+
this.logMethodError('setDiscountSelected', _context27.t1);
|
|
2831
|
+
throw _context27.t1;
|
|
2800
2832
|
case 65:
|
|
2801
2833
|
case "end":
|
|
2802
|
-
return
|
|
2834
|
+
return _context27.stop();
|
|
2803
2835
|
}
|
|
2804
2836
|
}, _callee26, this, [[1, 61], [19, 40, 43, 46]]);
|
|
2805
2837
|
}));
|
|
@@ -2813,33 +2845,33 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2813
2845
|
value: function () {
|
|
2814
2846
|
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
2815
2847
|
var tempOrder;
|
|
2816
|
-
return _regeneratorRuntime().wrap(function _callee27$(
|
|
2817
|
-
while (1) switch (
|
|
2848
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context28) {
|
|
2849
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2818
2850
|
case 0:
|
|
2819
2851
|
this.logMethodStart('addNewOrder');
|
|
2820
|
-
|
|
2852
|
+
_context28.prev = 1;
|
|
2821
2853
|
if (this.store.order) {
|
|
2822
|
-
|
|
2854
|
+
_context28.next = 4;
|
|
2823
2855
|
break;
|
|
2824
2856
|
}
|
|
2825
2857
|
throw new Error('order 模块未初始化');
|
|
2826
2858
|
case 4:
|
|
2827
|
-
|
|
2859
|
+
_context28.next = 6;
|
|
2828
2860
|
return this.store.order.addNewOrder();
|
|
2829
2861
|
case 6:
|
|
2830
|
-
tempOrder =
|
|
2862
|
+
tempOrder = _context28.sent;
|
|
2831
2863
|
this.logMethodSuccess('addNewOrder', {
|
|
2832
2864
|
productCount: tempOrder.products.length
|
|
2833
2865
|
});
|
|
2834
|
-
return
|
|
2866
|
+
return _context28.abrupt("return", tempOrder);
|
|
2835
2867
|
case 11:
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
this.logMethodError('addNewOrder',
|
|
2839
|
-
throw
|
|
2868
|
+
_context28.prev = 11;
|
|
2869
|
+
_context28.t0 = _context28["catch"](1);
|
|
2870
|
+
this.logMethodError('addNewOrder', _context28.t0);
|
|
2871
|
+
throw _context28.t0;
|
|
2840
2872
|
case 15:
|
|
2841
2873
|
case "end":
|
|
2842
|
-
return
|
|
2874
|
+
return _context28.stop();
|
|
2843
2875
|
}
|
|
2844
2876
|
}, _callee27, this, [[1, 11]]);
|
|
2845
2877
|
}));
|
|
@@ -2860,33 +2892,33 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2860
2892
|
value: function () {
|
|
2861
2893
|
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
2862
2894
|
var summary;
|
|
2863
|
-
return _regeneratorRuntime().wrap(function _callee28$(
|
|
2864
|
-
while (1) switch (
|
|
2895
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context29) {
|
|
2896
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2865
2897
|
case 0:
|
|
2866
2898
|
this.logMethodStart('getSummary');
|
|
2867
|
-
|
|
2899
|
+
_context29.prev = 1;
|
|
2868
2900
|
if (this.store.order) {
|
|
2869
|
-
|
|
2901
|
+
_context29.next = 4;
|
|
2870
2902
|
break;
|
|
2871
2903
|
}
|
|
2872
2904
|
throw new Error('order 模块未初始化');
|
|
2873
2905
|
case 4:
|
|
2874
|
-
|
|
2906
|
+
_context29.next = 6;
|
|
2875
2907
|
return this.store.order.getOrderSummary();
|
|
2876
2908
|
case 6:
|
|
2877
|
-
summary =
|
|
2909
|
+
summary = _context29.sent;
|
|
2878
2910
|
this.logMethodSuccess('getSummary', {
|
|
2879
2911
|
totalAmount: summary.total_amount
|
|
2880
2912
|
});
|
|
2881
|
-
return
|
|
2913
|
+
return _context29.abrupt("return", summary);
|
|
2882
2914
|
case 11:
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
this.logMethodError('getSummary',
|
|
2886
|
-
throw
|
|
2915
|
+
_context29.prev = 11;
|
|
2916
|
+
_context29.t0 = _context29["catch"](1);
|
|
2917
|
+
this.logMethodError('getSummary', _context29.t0);
|
|
2918
|
+
throw _context29.t0;
|
|
2887
2919
|
case 15:
|
|
2888
2920
|
case "end":
|
|
2889
|
-
return
|
|
2921
|
+
return _context29.stop();
|
|
2890
2922
|
}
|
|
2891
2923
|
}, _callee28, this, [[1, 11]]);
|
|
2892
2924
|
}));
|
|
@@ -2900,21 +2932,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2900
2932
|
value: function () {
|
|
2901
2933
|
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2902
2934
|
var _this$otherParams22, _this$otherParams23, _this$otherParams24, _this$otherParams25, _tempOrder$products2, result, tempOrder;
|
|
2903
|
-
return _regeneratorRuntime().wrap(function _callee29$(
|
|
2904
|
-
while (1) switch (
|
|
2935
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context30) {
|
|
2936
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2905
2937
|
case 0:
|
|
2906
2938
|
this.logMethodStart('submitOrder');
|
|
2907
|
-
|
|
2908
|
-
|
|
2939
|
+
_context30.prev = 1;
|
|
2940
|
+
_context30.next = 4;
|
|
2909
2941
|
return this.validateBeforeSubmitByItemRule();
|
|
2910
2942
|
case 4:
|
|
2911
2943
|
if (this.store.order) {
|
|
2912
|
-
|
|
2944
|
+
_context30.next = 6;
|
|
2913
2945
|
break;
|
|
2914
2946
|
}
|
|
2915
2947
|
throw new Error('venueBooking解决方案需要 order 模块支持');
|
|
2916
2948
|
case 6:
|
|
2917
|
-
|
|
2949
|
+
_context30.next = 8;
|
|
2918
2950
|
return this.store.order.submitTempOrder({
|
|
2919
2951
|
cacheId: this.cacheId,
|
|
2920
2952
|
platform: (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.platform,
|
|
@@ -2923,20 +2955,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2923
2955
|
type: (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.type
|
|
2924
2956
|
});
|
|
2925
2957
|
case 8:
|
|
2926
|
-
result =
|
|
2958
|
+
result = _context30.sent;
|
|
2927
2959
|
tempOrder = this.store.order.getTempOrder();
|
|
2928
2960
|
this.logMethodSuccess('submitOrder', {
|
|
2929
2961
|
productCount: (tempOrder === null || tempOrder === void 0 || (_tempOrder$products2 = tempOrder.products) === null || _tempOrder$products2 === void 0 ? void 0 : _tempOrder$products2.length) || 0
|
|
2930
2962
|
});
|
|
2931
|
-
return
|
|
2963
|
+
return _context30.abrupt("return", result);
|
|
2932
2964
|
case 14:
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
this.logMethodError('submitOrder',
|
|
2936
|
-
throw
|
|
2965
|
+
_context30.prev = 14;
|
|
2966
|
+
_context30.t0 = _context30["catch"](1);
|
|
2967
|
+
this.logMethodError('submitOrder', _context30.t0);
|
|
2968
|
+
throw _context30.t0;
|
|
2937
2969
|
case 18:
|
|
2938
2970
|
case "end":
|
|
2939
|
-
return
|
|
2971
|
+
return _context30.stop();
|
|
2940
2972
|
}
|
|
2941
2973
|
}, _callee29, this, [[1, 14]]);
|
|
2942
2974
|
}));
|
|
@@ -2950,16 +2982,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2950
2982
|
value: function () {
|
|
2951
2983
|
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(product) {
|
|
2952
2984
|
var _product$metadata6, _product$product_vari2, _product$metadata$sou3, _product$metadata7, price, products;
|
|
2953
|
-
return _regeneratorRuntime().wrap(function _callee30$(
|
|
2954
|
-
while (1) switch (
|
|
2985
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context31) {
|
|
2986
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2955
2987
|
case 0:
|
|
2956
2988
|
this.logMethodStart('addProductToOrder', {
|
|
2957
2989
|
product_id: product.product_id,
|
|
2958
2990
|
product_variant_id: product.product_variant_id
|
|
2959
2991
|
});
|
|
2960
|
-
|
|
2992
|
+
_context31.prev = 1;
|
|
2961
2993
|
if (this.store.order) {
|
|
2962
|
-
|
|
2994
|
+
_context31.next = 4;
|
|
2963
2995
|
break;
|
|
2964
2996
|
}
|
|
2965
2997
|
throw new Error('order 模块未初始化');
|
|
@@ -2975,28 +3007,28 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2975
3007
|
});
|
|
2976
3008
|
this.resetProductPriceForSmartPricing(product, price);
|
|
2977
3009
|
}
|
|
2978
|
-
|
|
3010
|
+
_context31.next = 7;
|
|
2979
3011
|
return this.store.order.addProductToOrder(product);
|
|
2980
3012
|
case 7:
|
|
2981
|
-
products =
|
|
2982
|
-
|
|
3013
|
+
products = _context31.sent;
|
|
3014
|
+
_context31.next = 10;
|
|
2983
3015
|
return this.refreshItemRuleQuantityLimits();
|
|
2984
3016
|
case 10:
|
|
2985
|
-
|
|
3017
|
+
_context31.next = 12;
|
|
2986
3018
|
return this.refreshCartValidationPassed();
|
|
2987
3019
|
case 12:
|
|
2988
3020
|
this.logMethodSuccess('addProductToOrder', {
|
|
2989
3021
|
productCount: products.length
|
|
2990
3022
|
});
|
|
2991
|
-
return
|
|
3023
|
+
return _context31.abrupt("return", products);
|
|
2992
3024
|
case 16:
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
this.logMethodError('addProductToOrder',
|
|
2996
|
-
throw
|
|
3025
|
+
_context31.prev = 16;
|
|
3026
|
+
_context31.t0 = _context31["catch"](1);
|
|
3027
|
+
this.logMethodError('addProductToOrder', _context31.t0);
|
|
3028
|
+
throw _context31.t0;
|
|
2997
3029
|
case 20:
|
|
2998
3030
|
case "end":
|
|
2999
|
-
return
|
|
3031
|
+
return _context31.stop();
|
|
3000
3032
|
}
|
|
3001
3033
|
}, _callee30, this, [[1, 16]]);
|
|
3002
3034
|
}));
|
|
@@ -3010,42 +3042,42 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3010
3042
|
value: function () {
|
|
3011
3043
|
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
3012
3044
|
var products;
|
|
3013
|
-
return _regeneratorRuntime().wrap(function _callee31$(
|
|
3014
|
-
while (1) switch (
|
|
3045
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context32) {
|
|
3046
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3015
3047
|
case 0:
|
|
3016
3048
|
this.logMethodStart('updateOrderProduct', {
|
|
3017
3049
|
product_id: params.product_id,
|
|
3018
3050
|
product_variant_id: params.product_variant_id
|
|
3019
3051
|
});
|
|
3020
|
-
|
|
3052
|
+
_context32.prev = 1;
|
|
3021
3053
|
if (this.store.order) {
|
|
3022
|
-
|
|
3054
|
+
_context32.next = 4;
|
|
3023
3055
|
break;
|
|
3024
3056
|
}
|
|
3025
3057
|
throw new Error('order 模块未初始化');
|
|
3026
3058
|
case 4:
|
|
3027
|
-
|
|
3059
|
+
_context32.next = 6;
|
|
3028
3060
|
return this.store.order.updateOrderProduct(params);
|
|
3029
3061
|
case 6:
|
|
3030
|
-
products =
|
|
3031
|
-
|
|
3062
|
+
products = _context32.sent;
|
|
3063
|
+
_context32.next = 9;
|
|
3032
3064
|
return this.refreshItemRuleQuantityLimits();
|
|
3033
3065
|
case 9:
|
|
3034
|
-
|
|
3066
|
+
_context32.next = 11;
|
|
3035
3067
|
return this.refreshCartValidationPassed();
|
|
3036
3068
|
case 11:
|
|
3037
3069
|
this.logMethodSuccess('updateOrderProduct', {
|
|
3038
3070
|
productCount: products.length
|
|
3039
3071
|
});
|
|
3040
|
-
return
|
|
3072
|
+
return _context32.abrupt("return", products);
|
|
3041
3073
|
case 15:
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
this.logMethodError('updateOrderProduct',
|
|
3045
|
-
throw
|
|
3074
|
+
_context32.prev = 15;
|
|
3075
|
+
_context32.t0 = _context32["catch"](1);
|
|
3076
|
+
this.logMethodError('updateOrderProduct', _context32.t0);
|
|
3077
|
+
throw _context32.t0;
|
|
3046
3078
|
case 19:
|
|
3047
3079
|
case "end":
|
|
3048
|
-
return
|
|
3080
|
+
return _context32.stop();
|
|
3049
3081
|
}
|
|
3050
3082
|
}, _callee31, this, [[1, 15]]);
|
|
3051
3083
|
}));
|
|
@@ -3059,45 +3091,45 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3059
3091
|
value: function () {
|
|
3060
3092
|
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(identity) {
|
|
3061
3093
|
var _this$store$order$get3, _this$store$order9, _this$store$order$ens, _this$store$order10, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator16, _step16, _product$metadata8, _product$metadata9, product, productUid, beforeBookingCount, _this$store$order$per, _this$store$order11;
|
|
3062
|
-
return _regeneratorRuntime().wrap(function _callee32$(
|
|
3063
|
-
while (1) switch (
|
|
3094
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context33) {
|
|
3095
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3064
3096
|
case 0:
|
|
3065
3097
|
this.logMethodStart('removeProductFromOrder', {
|
|
3066
3098
|
product_id: identity.product_id,
|
|
3067
3099
|
product_variant_id: identity.product_variant_id
|
|
3068
3100
|
});
|
|
3069
|
-
|
|
3101
|
+
_context33.prev = 1;
|
|
3070
3102
|
if (this.store.order) {
|
|
3071
|
-
|
|
3103
|
+
_context33.next = 4;
|
|
3072
3104
|
break;
|
|
3073
3105
|
}
|
|
3074
3106
|
throw new Error('order 模块未初始化');
|
|
3075
3107
|
case 4:
|
|
3076
3108
|
tempOrder = ((_this$store$order$get3 = (_this$store$order9 = this.store.order).getTempOrder) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order9)) || ((_this$store$order$ens = (_this$store$order10 = this.store.order).ensureTempOrder) === null || _this$store$order$ens === void 0 ? void 0 : _this$store$order$ens.call(_this$store$order10));
|
|
3077
|
-
|
|
3109
|
+
_context33.next = 7;
|
|
3078
3110
|
return this.store.order.removeProductFromOrder(identity);
|
|
3079
3111
|
case 7:
|
|
3080
|
-
products =
|
|
3112
|
+
products = _context33.sent;
|
|
3081
3113
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 && _tempOrder$bookings.length)) {
|
|
3082
|
-
|
|
3114
|
+
_context33.next = 34;
|
|
3083
3115
|
break;
|
|
3084
3116
|
}
|
|
3085
3117
|
venueProductUids = new Set();
|
|
3086
3118
|
venueBookingUids = new Set();
|
|
3087
3119
|
_iterator16 = _createForOfIteratorHelper(tempOrder.products || []);
|
|
3088
|
-
|
|
3120
|
+
_context33.prev = 12;
|
|
3089
3121
|
_iterator16.s();
|
|
3090
3122
|
case 14:
|
|
3091
3123
|
if ((_step16 = _iterator16.n()).done) {
|
|
3092
|
-
|
|
3124
|
+
_context33.next = 23;
|
|
3093
3125
|
break;
|
|
3094
3126
|
}
|
|
3095
3127
|
product = _step16.value;
|
|
3096
3128
|
if (product !== null && product !== void 0 && (_product$metadata8 = product.metadata) !== null && _product$metadata8 !== void 0 && _product$metadata8.venue_booking) {
|
|
3097
|
-
|
|
3129
|
+
_context33.next = 18;
|
|
3098
3130
|
break;
|
|
3099
3131
|
}
|
|
3100
|
-
return
|
|
3132
|
+
return _context33.abrupt("continue", 21);
|
|
3101
3133
|
case 18:
|
|
3102
3134
|
productUid = getOrderProductLineUid(product);
|
|
3103
3135
|
if (productUid) venueProductUids.add(productUid);
|
|
@@ -3105,19 +3137,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3105
3137
|
venueBookingUids.add(String(product.metadata.booking_uid));
|
|
3106
3138
|
}
|
|
3107
3139
|
case 21:
|
|
3108
|
-
|
|
3140
|
+
_context33.next = 14;
|
|
3109
3141
|
break;
|
|
3110
3142
|
case 23:
|
|
3111
|
-
|
|
3143
|
+
_context33.next = 28;
|
|
3112
3144
|
break;
|
|
3113
3145
|
case 25:
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
_iterator16.e(
|
|
3146
|
+
_context33.prev = 25;
|
|
3147
|
+
_context33.t0 = _context33["catch"](12);
|
|
3148
|
+
_iterator16.e(_context33.t0);
|
|
3117
3149
|
case 28:
|
|
3118
|
-
|
|
3150
|
+
_context33.prev = 28;
|
|
3119
3151
|
_iterator16.f();
|
|
3120
|
-
return
|
|
3152
|
+
return _context33.finish(28);
|
|
3121
3153
|
case 31:
|
|
3122
3154
|
beforeBookingCount = ((_tempOrder$bookings2 = tempOrder.bookings) === null || _tempOrder$bookings2 === void 0 ? void 0 : _tempOrder$bookings2.length) || 0;
|
|
3123
3155
|
tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
|
|
@@ -3134,24 +3166,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3134
3166
|
(_this$store$order$per = (_this$store$order11 = this.store.order).persistTempOrder) === null || _this$store$order$per === void 0 || _this$store$order$per.call(_this$store$order11);
|
|
3135
3167
|
}
|
|
3136
3168
|
case 34:
|
|
3137
|
-
|
|
3169
|
+
_context33.next = 36;
|
|
3138
3170
|
return this.refreshItemRuleQuantityLimits();
|
|
3139
3171
|
case 36:
|
|
3140
|
-
|
|
3172
|
+
_context33.next = 38;
|
|
3141
3173
|
return this.refreshCartValidationPassed();
|
|
3142
3174
|
case 38:
|
|
3143
3175
|
this.logMethodSuccess('removeProductFromOrder', {
|
|
3144
3176
|
productCount: products.length
|
|
3145
3177
|
});
|
|
3146
|
-
return
|
|
3178
|
+
return _context33.abrupt("return", products);
|
|
3147
3179
|
case 42:
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
this.logMethodError('removeProductFromOrder',
|
|
3151
|
-
throw
|
|
3180
|
+
_context33.prev = 42;
|
|
3181
|
+
_context33.t1 = _context33["catch"](1);
|
|
3182
|
+
this.logMethodError('removeProductFromOrder', _context33.t1);
|
|
3183
|
+
throw _context33.t1;
|
|
3152
3184
|
case 46:
|
|
3153
3185
|
case "end":
|
|
3154
|
-
return
|
|
3186
|
+
return _context33.stop();
|
|
3155
3187
|
}
|
|
3156
3188
|
}, _callee32, this, [[1, 42], [12, 25, 28, 31]]);
|
|
3157
3189
|
}));
|
|
@@ -3165,23 +3197,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3165
3197
|
value: function () {
|
|
3166
3198
|
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
3167
3199
|
var result;
|
|
3168
|
-
return _regeneratorRuntime().wrap(function _callee33$(
|
|
3169
|
-
while (1) switch (
|
|
3200
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context34) {
|
|
3201
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3170
3202
|
case 0:
|
|
3171
3203
|
if (!this.productsLoaded) {
|
|
3172
|
-
|
|
3204
|
+
_context34.next = 2;
|
|
3173
3205
|
break;
|
|
3174
3206
|
}
|
|
3175
|
-
return
|
|
3207
|
+
return _context34.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
|
|
3176
3208
|
case 2:
|
|
3177
|
-
|
|
3209
|
+
_context34.next = 4;
|
|
3178
3210
|
return this.loadAllProducts();
|
|
3179
3211
|
case 4:
|
|
3180
|
-
result =
|
|
3181
|
-
return
|
|
3212
|
+
result = _context34.sent;
|
|
3213
|
+
return _context34.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
|
|
3182
3214
|
case 6:
|
|
3183
3215
|
case "end":
|
|
3184
|
-
return
|
|
3216
|
+
return _context34.stop();
|
|
3185
3217
|
}
|
|
3186
3218
|
}, _callee33, this);
|
|
3187
3219
|
}));
|
|
@@ -3195,11 +3227,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3195
3227
|
value: function () {
|
|
3196
3228
|
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
3197
3229
|
var lastFetchedAt, cachedData, openDataConfig;
|
|
3198
|
-
return _regeneratorRuntime().wrap(function _callee34$(
|
|
3199
|
-
while (1) switch (
|
|
3230
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context35) {
|
|
3231
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3200
3232
|
case 0:
|
|
3201
3233
|
if (this.store.openData) {
|
|
3202
|
-
|
|
3234
|
+
_context35.next = 2;
|
|
3203
3235
|
break;
|
|
3204
3236
|
}
|
|
3205
3237
|
throw new Error('openData 模块未初始化');
|
|
@@ -3207,40 +3239,40 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3207
3239
|
lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
3208
3240
|
cachedData = this.store.openData.getOpenData();
|
|
3209
3241
|
if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < VenueBookingImpl.OPEN_DATA_CACHE_TTL)) {
|
|
3210
|
-
|
|
3242
|
+
_context35.next = 7;
|
|
3211
3243
|
break;
|
|
3212
3244
|
}
|
|
3213
3245
|
this.otherParams.openData = cachedData;
|
|
3214
|
-
return
|
|
3246
|
+
return _context35.abrupt("return", cachedData);
|
|
3215
3247
|
case 7:
|
|
3216
3248
|
if (!this.loadOpenDataConfigInFlight) {
|
|
3217
|
-
|
|
3249
|
+
_context35.next = 11;
|
|
3218
3250
|
break;
|
|
3219
3251
|
}
|
|
3220
|
-
|
|
3252
|
+
_context35.next = 10;
|
|
3221
3253
|
return this.loadOpenDataConfigInFlight;
|
|
3222
3254
|
case 10:
|
|
3223
|
-
return
|
|
3255
|
+
return _context35.abrupt("return", _context35.sent);
|
|
3224
3256
|
case 11:
|
|
3225
3257
|
this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
|
|
3226
3258
|
scope: 'board',
|
|
3227
3259
|
target: 'venue_booking+online_store',
|
|
3228
3260
|
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
3229
3261
|
});
|
|
3230
|
-
|
|
3231
|
-
|
|
3262
|
+
_context35.prev = 12;
|
|
3263
|
+
_context35.next = 15;
|
|
3232
3264
|
return this.loadOpenDataConfigInFlight;
|
|
3233
3265
|
case 15:
|
|
3234
|
-
openDataConfig =
|
|
3266
|
+
openDataConfig = _context35.sent;
|
|
3235
3267
|
this.otherParams.openData = openDataConfig;
|
|
3236
|
-
return
|
|
3268
|
+
return _context35.abrupt("return", openDataConfig);
|
|
3237
3269
|
case 18:
|
|
3238
|
-
|
|
3270
|
+
_context35.prev = 18;
|
|
3239
3271
|
this.loadOpenDataConfigInFlight = null;
|
|
3240
|
-
return
|
|
3272
|
+
return _context35.finish(18);
|
|
3241
3273
|
case 21:
|
|
3242
3274
|
case "end":
|
|
3243
|
-
return
|
|
3275
|
+
return _context35.stop();
|
|
3244
3276
|
}
|
|
3245
3277
|
}, _callee34, this, [[12,, 18, 21]]);
|
|
3246
3278
|
}));
|
|
@@ -3254,25 +3286,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3254
3286
|
value: function () {
|
|
3255
3287
|
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
3256
3288
|
var itemRuleConfigs;
|
|
3257
|
-
return _regeneratorRuntime().wrap(function _callee35$(
|
|
3258
|
-
while (1) switch (
|
|
3289
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context36) {
|
|
3290
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3259
3291
|
case 0:
|
|
3260
|
-
|
|
3292
|
+
_context36.next = 2;
|
|
3261
3293
|
return this.loadOpenDataConfig();
|
|
3262
3294
|
case 2:
|
|
3263
|
-
|
|
3295
|
+
_context36.next = 4;
|
|
3264
3296
|
return this.ensureItemRuleConfigsLoaded();
|
|
3265
3297
|
case 4:
|
|
3266
|
-
itemRuleConfigs =
|
|
3298
|
+
itemRuleConfigs = _context36.sent;
|
|
3267
3299
|
this.logMethodSuccess('loadRuntimeConfigs', {
|
|
3268
3300
|
itemRuleCount: itemRuleConfigs.length
|
|
3269
3301
|
});
|
|
3270
|
-
return
|
|
3302
|
+
return _context36.abrupt("return", {
|
|
3271
3303
|
itemRuleConfigs: itemRuleConfigs
|
|
3272
3304
|
});
|
|
3273
3305
|
case 7:
|
|
3274
3306
|
case "end":
|
|
3275
|
-
return
|
|
3307
|
+
return _context36.stop();
|
|
3276
3308
|
}
|
|
3277
3309
|
}, _callee35, this);
|
|
3278
3310
|
}));
|
|
@@ -3286,20 +3318,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3286
3318
|
value: function () {
|
|
3287
3319
|
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(strategyModelIds) {
|
|
3288
3320
|
var result, configs;
|
|
3289
|
-
return _regeneratorRuntime().wrap(function _callee36$(
|
|
3290
|
-
while (1) switch (
|
|
3321
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context37) {
|
|
3322
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3291
3323
|
case 0:
|
|
3292
3324
|
this.logMethodStart('fetchItemRuleConfigsByModelIds', {
|
|
3293
3325
|
strategyModelIds: strategyModelIds
|
|
3294
3326
|
});
|
|
3295
3327
|
if (strategyModelIds.length) {
|
|
3296
|
-
|
|
3328
|
+
_context37.next = 3;
|
|
3297
3329
|
break;
|
|
3298
3330
|
}
|
|
3299
|
-
return
|
|
3331
|
+
return _context37.abrupt("return", []);
|
|
3300
3332
|
case 3:
|
|
3301
|
-
|
|
3302
|
-
|
|
3333
|
+
_context37.prev = 3;
|
|
3334
|
+
_context37.next = 6;
|
|
3303
3335
|
return this.request.get('/promotion', {
|
|
3304
3336
|
skip: 1,
|
|
3305
3337
|
num: 99,
|
|
@@ -3307,7 +3339,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3307
3339
|
ids: strategyModelIds
|
|
3308
3340
|
});
|
|
3309
3341
|
case 6:
|
|
3310
|
-
result =
|
|
3342
|
+
result = _context37.sent;
|
|
3311
3343
|
configs = [];
|
|
3312
3344
|
if (result.code === 200) {
|
|
3313
3345
|
configs = result.data.list.map(function (item) {
|
|
@@ -3318,17 +3350,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3318
3350
|
strategyModelIds: strategyModelIds,
|
|
3319
3351
|
strategyCount: configs.length
|
|
3320
3352
|
});
|
|
3321
|
-
return
|
|
3353
|
+
return _context37.abrupt("return", configs);
|
|
3322
3354
|
case 13:
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
this.logMethodError('fetchItemRuleConfigsByModelIds',
|
|
3355
|
+
_context37.prev = 13;
|
|
3356
|
+
_context37.t0 = _context37["catch"](3);
|
|
3357
|
+
this.logMethodError('fetchItemRuleConfigsByModelIds', _context37.t0, {
|
|
3326
3358
|
strategyModelIds: strategyModelIds
|
|
3327
3359
|
});
|
|
3328
|
-
return
|
|
3360
|
+
return _context37.abrupt("return", []);
|
|
3329
3361
|
case 17:
|
|
3330
3362
|
case "end":
|
|
3331
|
-
return
|
|
3363
|
+
return _context37.stop();
|
|
3332
3364
|
}
|
|
3333
3365
|
}, _callee36, this, [[3, 13]]);
|
|
3334
3366
|
}));
|
|
@@ -3342,20 +3374,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3342
3374
|
value: function () {
|
|
3343
3375
|
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
3344
3376
|
var sourceMap, productList, visited, collectFromValue;
|
|
3345
|
-
return _regeneratorRuntime().wrap(function _callee37$(
|
|
3346
|
-
while (1) switch (
|
|
3377
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context38) {
|
|
3378
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3347
3379
|
case 0:
|
|
3348
3380
|
sourceMap = new Map();
|
|
3349
|
-
|
|
3350
|
-
|
|
3381
|
+
_context38.prev = 1;
|
|
3382
|
+
_context38.next = 4;
|
|
3351
3383
|
return this.getProductList();
|
|
3352
3384
|
case 4:
|
|
3353
|
-
productList =
|
|
3385
|
+
productList = _context38.sent;
|
|
3354
3386
|
if (Array.isArray(productList)) {
|
|
3355
|
-
|
|
3387
|
+
_context38.next = 7;
|
|
3356
3388
|
break;
|
|
3357
3389
|
}
|
|
3358
|
-
return
|
|
3390
|
+
return _context38.abrupt("return", sourceMap);
|
|
3359
3391
|
case 7:
|
|
3360
3392
|
visited = new Set();
|
|
3361
3393
|
collectFromValue = function collectFromValue(value) {
|
|
@@ -3394,17 +3426,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3394
3426
|
}
|
|
3395
3427
|
};
|
|
3396
3428
|
collectFromValue(productList);
|
|
3397
|
-
|
|
3429
|
+
_context38.next = 15;
|
|
3398
3430
|
break;
|
|
3399
3431
|
case 12:
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
this.logMethodError('buildPrefillProductSourceMap',
|
|
3432
|
+
_context38.prev = 12;
|
|
3433
|
+
_context38.t0 = _context38["catch"](1);
|
|
3434
|
+
this.logMethodError('buildPrefillProductSourceMap', _context38.t0);
|
|
3403
3435
|
case 15:
|
|
3404
|
-
return
|
|
3436
|
+
return _context38.abrupt("return", sourceMap);
|
|
3405
3437
|
case 16:
|
|
3406
3438
|
case "end":
|
|
3407
|
-
return
|
|
3439
|
+
return _context38.stop();
|
|
3408
3440
|
}
|
|
3409
3441
|
}, _callee37, this, [[1, 12]]);
|
|
3410
3442
|
}));
|
|
@@ -3426,53 +3458,53 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3426
3458
|
key: "ensureItemRuleConfigsLoaded",
|
|
3427
3459
|
value: function () {
|
|
3428
3460
|
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3429
|
-
var
|
|
3430
|
-
return _regeneratorRuntime().wrap(function _callee39$(
|
|
3431
|
-
while (1) switch (
|
|
3461
|
+
var _this14 = this;
|
|
3462
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context40) {
|
|
3463
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3432
3464
|
case 0:
|
|
3433
3465
|
if (!(this.itemRuleConfigs.length > 0)) {
|
|
3434
|
-
|
|
3466
|
+
_context40.next = 2;
|
|
3435
3467
|
break;
|
|
3436
3468
|
}
|
|
3437
|
-
return
|
|
3469
|
+
return _context40.abrupt("return", this.itemRuleConfigs);
|
|
3438
3470
|
case 2:
|
|
3439
3471
|
if (!this.itemRuleConfigsPromise) {
|
|
3440
|
-
|
|
3472
|
+
_context40.next = 4;
|
|
3441
3473
|
break;
|
|
3442
3474
|
}
|
|
3443
|
-
return
|
|
3475
|
+
return _context40.abrupt("return", this.itemRuleConfigsPromise);
|
|
3444
3476
|
case 4:
|
|
3445
3477
|
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
3446
3478
|
var runtimeConfig, staticConfigs;
|
|
3447
|
-
return _regeneratorRuntime().wrap(function _callee38$(
|
|
3448
|
-
while (1) switch (
|
|
3479
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context39) {
|
|
3480
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3449
3481
|
case 0:
|
|
3450
|
-
runtimeConfig =
|
|
3482
|
+
runtimeConfig = _this14.getItemRuleRuntimeConfig();
|
|
3451
3483
|
staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
|
|
3452
3484
|
if (!(staticConfigs.length > 0)) {
|
|
3453
|
-
|
|
3485
|
+
_context39.next = 6;
|
|
3454
3486
|
break;
|
|
3455
3487
|
}
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
return
|
|
3488
|
+
_this14.itemRuleConfigs = staticConfigs;
|
|
3489
|
+
_this14.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
3490
|
+
return _context39.abrupt("return", _this14.itemRuleConfigs);
|
|
3459
3491
|
case 6:
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
return
|
|
3492
|
+
_this14.itemRuleConfigs = [];
|
|
3493
|
+
_this14.itemRuleEvaluator.setStrategyConfigs([]);
|
|
3494
|
+
return _context39.abrupt("return", _this14.itemRuleConfigs);
|
|
3463
3495
|
case 9:
|
|
3464
3496
|
case "end":
|
|
3465
|
-
return
|
|
3497
|
+
return _context39.stop();
|
|
3466
3498
|
}
|
|
3467
3499
|
}, _callee38);
|
|
3468
3500
|
}))();
|
|
3469
|
-
|
|
3501
|
+
_context40.next = 7;
|
|
3470
3502
|
return this.itemRuleConfigsPromise;
|
|
3471
3503
|
case 7:
|
|
3472
|
-
return
|
|
3504
|
+
return _context40.abrupt("return", _context40.sent);
|
|
3473
3505
|
case 8:
|
|
3474
3506
|
case "end":
|
|
3475
|
-
return
|
|
3507
|
+
return _context40.stop();
|
|
3476
3508
|
}
|
|
3477
3509
|
}, _callee39, this);
|
|
3478
3510
|
}));
|
|
@@ -3486,20 +3518,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3486
3518
|
value: function () {
|
|
3487
3519
|
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3488
3520
|
var strategyConfigs, businessData, limits;
|
|
3489
|
-
return _regeneratorRuntime().wrap(function _callee40$(
|
|
3490
|
-
while (1) switch (
|
|
3521
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context41) {
|
|
3522
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3491
3523
|
case 0:
|
|
3492
|
-
|
|
3493
|
-
|
|
3524
|
+
_context41.prev = 0;
|
|
3525
|
+
_context41.next = 3;
|
|
3494
3526
|
return this.ensureItemRuleConfigsLoaded();
|
|
3495
3527
|
case 3:
|
|
3496
|
-
strategyConfigs =
|
|
3528
|
+
strategyConfigs = _context41.sent;
|
|
3497
3529
|
if (strategyConfigs.length) {
|
|
3498
|
-
|
|
3530
|
+
_context41.next = 7;
|
|
3499
3531
|
break;
|
|
3500
3532
|
}
|
|
3501
3533
|
this.store.itemRuleQuantityLimits = [];
|
|
3502
|
-
return
|
|
3534
|
+
return _context41.abrupt("return", []);
|
|
3503
3535
|
case 7:
|
|
3504
3536
|
businessData = buildItemRuleBusinessData({
|
|
3505
3537
|
tempOrder: this.ensureVenueTempOrder(),
|
|
@@ -3511,16 +3543,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3511
3543
|
this.logMethodSuccess('refreshItemRuleQuantityLimits', {
|
|
3512
3544
|
limitCount: limits.length
|
|
3513
3545
|
});
|
|
3514
|
-
return
|
|
3546
|
+
return _context41.abrupt("return", limits);
|
|
3515
3547
|
case 14:
|
|
3516
|
-
|
|
3517
|
-
|
|
3548
|
+
_context41.prev = 14;
|
|
3549
|
+
_context41.t0 = _context41["catch"](0);
|
|
3518
3550
|
this.store.itemRuleQuantityLimits = [];
|
|
3519
|
-
this.logMethodError('refreshItemRuleQuantityLimits',
|
|
3520
|
-
return
|
|
3551
|
+
this.logMethodError('refreshItemRuleQuantityLimits', _context41.t0);
|
|
3552
|
+
return _context41.abrupt("return", []);
|
|
3521
3553
|
case 19:
|
|
3522
3554
|
case "end":
|
|
3523
|
-
return
|
|
3555
|
+
return _context41.stop();
|
|
3524
3556
|
}
|
|
3525
3557
|
}, _callee40, this, [[0, 14]]);
|
|
3526
3558
|
}));
|
|
@@ -3534,30 +3566,30 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3534
3566
|
value: function () {
|
|
3535
3567
|
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
|
|
3536
3568
|
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator18, _step18, _prefillItem$product_, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, origin, product, productUid, targetProduct, previousOrigin, nextOrigin, existedQuantity, delta, nextProduct, _productUid;
|
|
3537
|
-
return _regeneratorRuntime().wrap(function _callee41$(
|
|
3538
|
-
while (1) switch (
|
|
3569
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context42) {
|
|
3570
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3539
3571
|
case 0:
|
|
3540
3572
|
if (!this.itemRulePrefillApplied) {
|
|
3541
|
-
|
|
3573
|
+
_context42.next = 2;
|
|
3542
3574
|
break;
|
|
3543
3575
|
}
|
|
3544
|
-
return
|
|
3576
|
+
return _context42.abrupt("return");
|
|
3545
3577
|
case 2:
|
|
3546
3578
|
if (this.store.order) {
|
|
3547
|
-
|
|
3579
|
+
_context42.next = 4;
|
|
3548
3580
|
break;
|
|
3549
3581
|
}
|
|
3550
|
-
return
|
|
3582
|
+
return _context42.abrupt("return");
|
|
3551
3583
|
case 4:
|
|
3552
|
-
|
|
3584
|
+
_context42.next = 6;
|
|
3553
3585
|
return this.ensureItemRuleConfigsLoaded();
|
|
3554
3586
|
case 6:
|
|
3555
|
-
strategyConfigs =
|
|
3587
|
+
strategyConfigs = _context42.sent;
|
|
3556
3588
|
if (strategyConfigs.length) {
|
|
3557
|
-
|
|
3589
|
+
_context42.next = 9;
|
|
3558
3590
|
break;
|
|
3559
3591
|
}
|
|
3560
|
-
return
|
|
3592
|
+
return _context42.abrupt("return");
|
|
3561
3593
|
case 9:
|
|
3562
3594
|
businessData = buildItemRuleBusinessData({
|
|
3563
3595
|
tempOrder: this.ensureVenueTempOrder(),
|
|
@@ -3566,24 +3598,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3566
3598
|
});
|
|
3567
3599
|
prefillItems = this.itemRuleEvaluator.getPrefillItems(businessData);
|
|
3568
3600
|
if (prefillItems.length) {
|
|
3569
|
-
|
|
3601
|
+
_context42.next = 14;
|
|
3570
3602
|
break;
|
|
3571
3603
|
}
|
|
3572
3604
|
this.itemRulePrefillApplied = true;
|
|
3573
|
-
return
|
|
3605
|
+
return _context42.abrupt("return");
|
|
3574
3606
|
case 14:
|
|
3575
|
-
|
|
3607
|
+
_context42.next = 16;
|
|
3576
3608
|
return this.buildPrefillProductSourceMap();
|
|
3577
3609
|
case 16:
|
|
3578
|
-
productSourceMap =
|
|
3610
|
+
productSourceMap = _context42.sent;
|
|
3579
3611
|
tempOrder = this.ensureVenueTempOrder();
|
|
3580
3612
|
hasChanges = false;
|
|
3581
3613
|
_iterator18 = _createForOfIteratorHelper(prefillItems);
|
|
3582
|
-
|
|
3614
|
+
_context42.prev = 20;
|
|
3583
3615
|
_iterator18.s();
|
|
3584
3616
|
case 22:
|
|
3585
3617
|
if ((_step18 = _iterator18.n()).done) {
|
|
3586
|
-
|
|
3618
|
+
_context42.next = 51;
|
|
3587
3619
|
break;
|
|
3588
3620
|
}
|
|
3589
3621
|
prefillItem = _step18.value;
|
|
@@ -3591,16 +3623,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3591
3623
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
3592
3624
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
3593
3625
|
if (!(!Number.isFinite(productId) || targetQuantity <= 0)) {
|
|
3594
|
-
|
|
3626
|
+
_context42.next = 29;
|
|
3595
3627
|
break;
|
|
3596
3628
|
}
|
|
3597
|
-
return
|
|
3629
|
+
return _context42.abrupt("continue", 49);
|
|
3598
3630
|
case 29:
|
|
3599
3631
|
if (!Number.isNaN(productVariantId)) {
|
|
3600
|
-
|
|
3632
|
+
_context42.next = 31;
|
|
3601
3633
|
break;
|
|
3602
3634
|
}
|
|
3603
|
-
return
|
|
3635
|
+
return _context42.abrupt("continue", 49);
|
|
3604
3636
|
case 31:
|
|
3605
3637
|
sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
|
|
3606
3638
|
productIndex = getProductIdentityIndex(tempOrder.products, {
|
|
@@ -3608,7 +3640,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3608
3640
|
product_variant_id: productVariantId
|
|
3609
3641
|
});
|
|
3610
3642
|
if (!(productIndex === -1)) {
|
|
3611
|
-
|
|
3643
|
+
_context42.next = 42;
|
|
3612
3644
|
break;
|
|
3613
3645
|
}
|
|
3614
3646
|
sellingPrice = toPriceString((_sourceItem$price = sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price) !== null && _sourceItem$price !== void 0 ? _sourceItem$price : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.selling_price, '0.00');
|
|
@@ -3632,7 +3664,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3632
3664
|
this.attachProductOriginToTempOrder(tempOrder, productUid, origin);
|
|
3633
3665
|
tempOrder.products.push(product);
|
|
3634
3666
|
hasChanges = true;
|
|
3635
|
-
return
|
|
3667
|
+
return _context42.abrupt("continue", 49);
|
|
3636
3668
|
case 42:
|
|
3637
3669
|
targetProduct = tempOrder.products[productIndex];
|
|
3638
3670
|
previousOrigin = this.readProductOriginFromTempOrder(tempOrder, targetProduct);
|
|
@@ -3654,34 +3686,34 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3654
3686
|
hasChanges = true;
|
|
3655
3687
|
}
|
|
3656
3688
|
case 49:
|
|
3657
|
-
|
|
3689
|
+
_context42.next = 22;
|
|
3658
3690
|
break;
|
|
3659
3691
|
case 51:
|
|
3660
|
-
|
|
3692
|
+
_context42.next = 56;
|
|
3661
3693
|
break;
|
|
3662
3694
|
case 53:
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
_iterator18.e(
|
|
3695
|
+
_context42.prev = 53;
|
|
3696
|
+
_context42.t0 = _context42["catch"](20);
|
|
3697
|
+
_iterator18.e(_context42.t0);
|
|
3666
3698
|
case 56:
|
|
3667
|
-
|
|
3699
|
+
_context42.prev = 56;
|
|
3668
3700
|
_iterator18.f();
|
|
3669
|
-
return
|
|
3701
|
+
return _context42.finish(56);
|
|
3670
3702
|
case 59:
|
|
3671
3703
|
if (!hasChanges) {
|
|
3672
|
-
|
|
3704
|
+
_context42.next = 64;
|
|
3673
3705
|
break;
|
|
3674
3706
|
}
|
|
3675
3707
|
// Prefill 属于 products CRUD 的一种形式:新增后让 Rules 重算,以支持自动应用可用优惠券。
|
|
3676
3708
|
this.store.order.applyDiscount();
|
|
3677
|
-
|
|
3709
|
+
_context42.next = 63;
|
|
3678
3710
|
return this.store.order.recalculateSummary({
|
|
3679
3711
|
createIfMissing: true
|
|
3680
3712
|
});
|
|
3681
3713
|
case 63:
|
|
3682
3714
|
this.store.order.persistTempOrder();
|
|
3683
3715
|
case 64:
|
|
3684
|
-
|
|
3716
|
+
_context42.next = 66;
|
|
3685
3717
|
return this.refreshItemRuleQuantityLimits();
|
|
3686
3718
|
case 66:
|
|
3687
3719
|
this.itemRulePrefillApplied = true;
|
|
@@ -3691,7 +3723,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3691
3723
|
});
|
|
3692
3724
|
case 68:
|
|
3693
3725
|
case "end":
|
|
3694
|
-
return
|
|
3726
|
+
return _context42.stop();
|
|
3695
3727
|
}
|
|
3696
3728
|
}, _callee41, this, [[20, 53, 56, 59]]);
|
|
3697
3729
|
}));
|
|
@@ -3704,21 +3736,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3704
3736
|
key: "applyItemRulePrefill",
|
|
3705
3737
|
value: function () {
|
|
3706
3738
|
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
3707
|
-
return _regeneratorRuntime().wrap(function _callee42$(
|
|
3708
|
-
while (1) switch (
|
|
3739
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context43) {
|
|
3740
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3709
3741
|
case 0:
|
|
3710
3742
|
this.logMethodStart('applyItemRulePrefill');
|
|
3711
|
-
|
|
3743
|
+
_context43.next = 3;
|
|
3712
3744
|
return this.applyPrefillByItemRule();
|
|
3713
3745
|
case 3:
|
|
3714
|
-
|
|
3746
|
+
_context43.next = 5;
|
|
3715
3747
|
return this.refreshItemRuleQuantityLimits();
|
|
3716
3748
|
case 5:
|
|
3717
|
-
|
|
3749
|
+
_context43.next = 7;
|
|
3718
3750
|
return this.refreshCartValidationPassed();
|
|
3719
3751
|
case 7:
|
|
3720
3752
|
case "end":
|
|
3721
|
-
return
|
|
3753
|
+
return _context43.stop();
|
|
3722
3754
|
}
|
|
3723
3755
|
}, _callee42, this);
|
|
3724
3756
|
}));
|
|
@@ -3732,18 +3764,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3732
3764
|
value: function () {
|
|
3733
3765
|
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43() {
|
|
3734
3766
|
var strategyConfigs, businessData;
|
|
3735
|
-
return _regeneratorRuntime().wrap(function _callee43$(
|
|
3736
|
-
while (1) switch (
|
|
3767
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context44) {
|
|
3768
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
3737
3769
|
case 0:
|
|
3738
|
-
|
|
3770
|
+
_context44.next = 2;
|
|
3739
3771
|
return this.ensureItemRuleConfigsLoaded();
|
|
3740
3772
|
case 2:
|
|
3741
|
-
strategyConfigs =
|
|
3773
|
+
strategyConfigs = _context44.sent;
|
|
3742
3774
|
if (strategyConfigs.length) {
|
|
3743
|
-
|
|
3775
|
+
_context44.next = 5;
|
|
3744
3776
|
break;
|
|
3745
3777
|
}
|
|
3746
|
-
return
|
|
3778
|
+
return _context44.abrupt("return", {
|
|
3747
3779
|
passed: true,
|
|
3748
3780
|
failures: []
|
|
3749
3781
|
});
|
|
@@ -3753,10 +3785,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3753
3785
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
3754
3786
|
itemRuleConfigs: this.itemRuleConfigs
|
|
3755
3787
|
});
|
|
3756
|
-
return
|
|
3788
|
+
return _context44.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
|
|
3757
3789
|
case 7:
|
|
3758
3790
|
case "end":
|
|
3759
|
-
return
|
|
3791
|
+
return _context44.stop();
|
|
3760
3792
|
}
|
|
3761
3793
|
}, _callee43, this);
|
|
3762
3794
|
}));
|
|
@@ -3770,18 +3802,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3770
3802
|
value: function () {
|
|
3771
3803
|
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
|
|
3772
3804
|
var validationResult, firstFailure, errorMessage, error;
|
|
3773
|
-
return _regeneratorRuntime().wrap(function _callee44$(
|
|
3774
|
-
while (1) switch (
|
|
3805
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context45) {
|
|
3806
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
3775
3807
|
case 0:
|
|
3776
|
-
|
|
3808
|
+
_context45.next = 2;
|
|
3777
3809
|
return this.evaluateCartValidationByItemRule();
|
|
3778
3810
|
case 2:
|
|
3779
|
-
validationResult =
|
|
3811
|
+
validationResult = _context45.sent;
|
|
3780
3812
|
if (!validationResult.passed) {
|
|
3781
|
-
|
|
3813
|
+
_context45.next = 5;
|
|
3782
3814
|
break;
|
|
3783
3815
|
}
|
|
3784
|
-
return
|
|
3816
|
+
return _context45.abrupt("return");
|
|
3785
3817
|
case 5:
|
|
3786
3818
|
firstFailure = validationResult.failures[0];
|
|
3787
3819
|
errorMessage = (firstFailure === null || firstFailure === void 0 ? void 0 : firstFailure.validationMessage) || '当前购物车未满足商品规则,请调整后再提交';
|
|
@@ -3790,7 +3822,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3790
3822
|
throw error;
|
|
3791
3823
|
case 10:
|
|
3792
3824
|
case "end":
|
|
3793
|
-
return
|
|
3825
|
+
return _context45.stop();
|
|
3794
3826
|
}
|
|
3795
3827
|
}, _callee44, this);
|
|
3796
3828
|
}));
|
|
@@ -3804,8 +3836,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3804
3836
|
value: function () {
|
|
3805
3837
|
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
|
|
3806
3838
|
var previous, nextState, validationResult, changed;
|
|
3807
|
-
return _regeneratorRuntime().wrap(function _callee45$(
|
|
3808
|
-
while (1) switch (
|
|
3839
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context46) {
|
|
3840
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
3809
3841
|
case 0:
|
|
3810
3842
|
previous = this.store.cartValidation || {
|
|
3811
3843
|
passed: null,
|
|
@@ -3815,20 +3847,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3815
3847
|
passed: null,
|
|
3816
3848
|
failures: []
|
|
3817
3849
|
};
|
|
3818
|
-
|
|
3819
|
-
|
|
3850
|
+
_context46.prev = 2;
|
|
3851
|
+
_context46.next = 5;
|
|
3820
3852
|
return this.evaluateCartValidationByItemRule();
|
|
3821
3853
|
case 5:
|
|
3822
|
-
validationResult =
|
|
3854
|
+
validationResult = _context46.sent;
|
|
3823
3855
|
nextState = {
|
|
3824
3856
|
passed: validationResult.passed,
|
|
3825
3857
|
failures: validationResult.failures || []
|
|
3826
3858
|
};
|
|
3827
|
-
|
|
3859
|
+
_context46.next = 12;
|
|
3828
3860
|
break;
|
|
3829
3861
|
case 9:
|
|
3830
|
-
|
|
3831
|
-
|
|
3862
|
+
_context46.prev = 9;
|
|
3863
|
+
_context46.t0 = _context46["catch"](2);
|
|
3832
3864
|
nextState = {
|
|
3833
3865
|
passed: false,
|
|
3834
3866
|
failures: []
|
|
@@ -3837,19 +3869,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3837
3869
|
this.store.cartValidation = nextState;
|
|
3838
3870
|
changed = previous.passed !== nextState.passed || previous.failures !== nextState.failures;
|
|
3839
3871
|
if (!changed) {
|
|
3840
|
-
|
|
3872
|
+
_context46.next = 17;
|
|
3841
3873
|
break;
|
|
3842
3874
|
}
|
|
3843
|
-
|
|
3875
|
+
_context46.next = 17;
|
|
3844
3876
|
return this.core.effects.emit(VenueBookingHooks.onCartValidationChanged, {
|
|
3845
3877
|
cartValidation: nextState,
|
|
3846
3878
|
cartValidationPassed: nextState.passed
|
|
3847
3879
|
});
|
|
3848
3880
|
case 17:
|
|
3849
|
-
return
|
|
3881
|
+
return _context46.abrupt("return", nextState.passed);
|
|
3850
3882
|
case 18:
|
|
3851
3883
|
case "end":
|
|
3852
|
-
return
|
|
3884
|
+
return _context46.stop();
|
|
3853
3885
|
}
|
|
3854
3886
|
}, _callee45, this, [[2, 9]]);
|
|
3855
3887
|
}));
|
|
@@ -3864,11 +3896,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3864
3896
|
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
|
|
3865
3897
|
var _this$itemRuleRuntime, _this$itemRuleRuntime2;
|
|
3866
3898
|
var config,
|
|
3867
|
-
|
|
3868
|
-
return _regeneratorRuntime().wrap(function _callee46$(
|
|
3869
|
-
while (1) switch (
|
|
3899
|
+
_args47 = arguments;
|
|
3900
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context47) {
|
|
3901
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
3870
3902
|
case 0:
|
|
3871
|
-
config =
|
|
3903
|
+
config = _args47.length > 0 && _args47[0] !== undefined ? _args47[0] : {};
|
|
3872
3904
|
this.logMethodStart('setItemRuleRuntimeConfig');
|
|
3873
3905
|
this.itemRuleRuntimeConfig = _objectSpread(_objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), config), {}, {
|
|
3874
3906
|
pax: _objectSpread(_objectSpread({}, ((_this$itemRuleRuntime = this.itemRuleRuntimeConfig) === null || _this$itemRuleRuntime === void 0 ? void 0 : _this$itemRuleRuntime.pax) || {}), (config === null || config === void 0 ? void 0 : config.pax) || {}),
|
|
@@ -3880,10 +3912,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3880
3912
|
this.itemRuleEvaluator.setStrategyConfigs([]);
|
|
3881
3913
|
}
|
|
3882
3914
|
this.itemRulePrefillApplied = false;
|
|
3883
|
-
|
|
3915
|
+
_context47.next = 7;
|
|
3884
3916
|
return this.refreshItemRuleQuantityLimits();
|
|
3885
3917
|
case 7:
|
|
3886
|
-
|
|
3918
|
+
_context47.next = 9;
|
|
3887
3919
|
return this.refreshCartValidationPassed();
|
|
3888
3920
|
case 9:
|
|
3889
3921
|
this.logMethodSuccess('setItemRuleRuntimeConfig', {
|
|
@@ -3891,7 +3923,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3891
3923
|
});
|
|
3892
3924
|
case 10:
|
|
3893
3925
|
case "end":
|
|
3894
|
-
return
|
|
3926
|
+
return _context47.stop();
|
|
3895
3927
|
}
|
|
3896
3928
|
}, _callee46, this);
|
|
3897
3929
|
}));
|
|
@@ -4017,23 +4049,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
4017
4049
|
var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
|
|
4018
4050
|
var _params$customer_id, _params$useCache;
|
|
4019
4051
|
var customer_id;
|
|
4020
|
-
return _regeneratorRuntime().wrap(function _callee47$(
|
|
4021
|
-
while (1) switch (
|
|
4052
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context48) {
|
|
4053
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
4022
4054
|
case 0:
|
|
4023
4055
|
if (this.store.holder) {
|
|
4024
|
-
|
|
4056
|
+
_context48.next = 2;
|
|
4025
4057
|
break;
|
|
4026
4058
|
}
|
|
4027
4059
|
throw new Error('[VenueBooking] holder 模块未初始化');
|
|
4028
4060
|
case 2:
|
|
4029
4061
|
customer_id = (_params$customer_id = params === null || params === void 0 ? void 0 : params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.resolveHolderCustomerId();
|
|
4030
|
-
return
|
|
4062
|
+
return _context48.abrupt("return", this.store.holder.refreshAllFormRecords(_objectSpread(_objectSpread({}, params), {}, {
|
|
4031
4063
|
customer_id: customer_id,
|
|
4032
4064
|
useCache: (_params$useCache = params === null || params === void 0 ? void 0 : params.useCache) !== null && _params$useCache !== void 0 ? _params$useCache : false
|
|
4033
4065
|
})));
|
|
4034
4066
|
case 4:
|
|
4035
4067
|
case "end":
|
|
4036
|
-
return
|
|
4068
|
+
return _context48.stop();
|
|
4037
4069
|
}
|
|
4038
4070
|
}, _callee47, this);
|
|
4039
4071
|
}));
|
|
@@ -4058,22 +4090,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
4058
4090
|
key: "checkOpenDataAvailability",
|
|
4059
4091
|
value: function () {
|
|
4060
4092
|
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48() {
|
|
4061
|
-
return _regeneratorRuntime().wrap(function _callee48$(
|
|
4062
|
-
while (1) switch (
|
|
4093
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context49) {
|
|
4094
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
4063
4095
|
case 0:
|
|
4064
4096
|
if (this.store.openData) {
|
|
4065
|
-
|
|
4097
|
+
_context49.next = 2;
|
|
4066
4098
|
break;
|
|
4067
4099
|
}
|
|
4068
4100
|
throw new Error('openData 模块未初始化');
|
|
4069
4101
|
case 2:
|
|
4070
|
-
|
|
4102
|
+
_context49.next = 4;
|
|
4071
4103
|
return this.loadOpenDataConfig();
|
|
4072
4104
|
case 4:
|
|
4073
|
-
return
|
|
4105
|
+
return _context49.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
|
|
4074
4106
|
case 5:
|
|
4075
4107
|
case "end":
|
|
4076
|
-
return
|
|
4108
|
+
return _context49.stop();
|
|
4077
4109
|
}
|
|
4078
4110
|
}, _callee48, this);
|
|
4079
4111
|
}));
|
|
@@ -4089,11 +4121,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
4089
4121
|
var _ref13,
|
|
4090
4122
|
_ref13$cover,
|
|
4091
4123
|
cover,
|
|
4092
|
-
|
|
4093
|
-
return _regeneratorRuntime().wrap(function _callee49$(
|
|
4094
|
-
while (1) switch (
|
|
4124
|
+
_args50 = arguments;
|
|
4125
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context50) {
|
|
4126
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
4095
4127
|
case 0:
|
|
4096
|
-
_ref13 =
|
|
4128
|
+
_ref13 = _args50.length > 1 && _args50[1] !== undefined ? _args50[1] : {}, _ref13$cover = _ref13.cover, cover = _ref13$cover === void 0 ? false : _ref13$cover;
|
|
4097
4129
|
this.slotPriceMapCache.clear();
|
|
4098
4130
|
if (cover) {
|
|
4099
4131
|
this.otherParams = params;
|
|
@@ -4102,7 +4134,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
4102
4134
|
}
|
|
4103
4135
|
case 3:
|
|
4104
4136
|
case "end":
|
|
4105
|
-
return
|
|
4137
|
+
return _context50.stop();
|
|
4106
4138
|
}
|
|
4107
4139
|
}, _callee49, this);
|
|
4108
4140
|
}));
|