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