@pisell/pisellos 2.2.211 → 2.2.212
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +3 -0
- package/dist/modules/Order/index.d.ts +35 -0
- package/dist/modules/Order/index.js +250 -99
- package/dist/modules/Order/utils.js +1 -1
- package/dist/server/modules/order/utils/filterBookings.js +25 -2
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +3 -0
- package/lib/modules/Order/index.d.ts +35 -0
- package/lib/modules/Order/index.js +111 -0
- package/lib/modules/Order/utils.js +2 -1
- package/lib/server/modules/order/utils/filterBookings.js +17 -2
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// 导出评估器
|
|
2
|
+
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
+
|
|
4
|
+
// 导出适配器
|
|
5
|
+
export { PromotionAdapter } from "./adapter";
|
|
6
|
+
export { default } from "./adapter";
|
|
7
|
+
|
|
8
|
+
// 导出策略配置示例常量
|
|
9
|
+
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
|
|
@@ -193,6 +193,9 @@ export function cacheItemToBookingInput(cacheItem, options) {
|
|
|
193
193
|
if (ext.holder_id !== undefined && ext.holder_id !== null) {
|
|
194
194
|
metadata.holder_id = ext.holder_id;
|
|
195
195
|
}
|
|
196
|
+
if (ext.holder !== undefined) {
|
|
197
|
+
metadata.holder = ext.holder;
|
|
198
|
+
}
|
|
196
199
|
if (ext.collect_pax !== undefined) metadata.collect_pax = ext.collect_pax;
|
|
197
200
|
// 与 info2 formatMetaData 一致:优先写入完整人数维度数组,供编辑回显 / 详情回灌。
|
|
198
201
|
var extendCapacity = normalizeExtendCapacityForMetadata(ext.capacity);
|
|
@@ -186,6 +186,41 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
186
186
|
private ensureExtend;
|
|
187
187
|
private captureProductRuntime;
|
|
188
188
|
private createLinkedProductAndBooking;
|
|
189
|
+
/**
|
|
190
|
+
* booking.holder 是提交真源;metadata.holder 作为详情/回显冗余字段同步保存。
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* this.syncBookingMetadataHolder(booking, metadata);
|
|
194
|
+
*/
|
|
195
|
+
private syncBookingMetadataHolder;
|
|
196
|
+
/**
|
|
197
|
+
* 从单条 booking 的 holder / metadata 中收集 holder form_record。
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* const ids = this.collectBookingHolderRecords(booking);
|
|
201
|
+
*/
|
|
202
|
+
private collectBookingHolderRecords;
|
|
203
|
+
/**
|
|
204
|
+
* 按 form_record 顺序读取 booking holder 的主字段名称。
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* const names = this.collectBookingHolderNames(booking);
|
|
208
|
+
*/
|
|
209
|
+
private collectBookingHolderNames;
|
|
210
|
+
/**
|
|
211
|
+
* 按老 ticketBooking `formatHolder` 语义汇总订单顶层 holder。
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* const holder = this.buildTempOrderHolderFromBookings(tempOrder);
|
|
215
|
+
*/
|
|
216
|
+
private buildTempOrderHolderFromBookings;
|
|
217
|
+
/**
|
|
218
|
+
* 将 booking 级 holder 汇总到 tempOrder 顶层 holder。
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* this.syncTempOrderHolderFromBookings(tempOrder);
|
|
222
|
+
*/
|
|
223
|
+
private syncTempOrderHolderFromBookings;
|
|
189
224
|
private getBookingUniqueIdentificationNumber;
|
|
190
225
|
private findBookingIndexByUniqueIdentificationNumber;
|
|
191
226
|
private removeLinkedBookingsForProduct;
|
|
@@ -2052,6 +2052,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2052
2052
|
var bookingUid = String(bookingMetadata.unique_identification_number || createUuidV4());
|
|
2053
2053
|
productMetadata.unique_identification_number = productUid;
|
|
2054
2054
|
bookingMetadata.unique_identification_number = bookingUid;
|
|
2055
|
+
this.syncBookingMetadataHolder(params.booking, bookingMetadata);
|
|
2055
2056
|
return {
|
|
2056
2057
|
productUid: productUid,
|
|
2057
2058
|
bookingUid: bookingUid,
|
|
@@ -2070,11 +2071,155 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2070
2071
|
})
|
|
2071
2072
|
};
|
|
2072
2073
|
}
|
|
2074
|
+
|
|
2075
|
+
/**
|
|
2076
|
+
* booking.holder 是提交真源;metadata.holder 作为详情/回显冗余字段同步保存。
|
|
2077
|
+
*
|
|
2078
|
+
* @example
|
|
2079
|
+
* this.syncBookingMetadataHolder(booking, metadata);
|
|
2080
|
+
*/
|
|
2081
|
+
}, {
|
|
2082
|
+
key: "syncBookingMetadataHolder",
|
|
2083
|
+
value: function syncBookingMetadataHolder(booking, metadata) {
|
|
2084
|
+
if ((booking === null || booking === void 0 ? void 0 : booking.holder) !== undefined) {
|
|
2085
|
+
metadata.holder = booking.holder;
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
/**
|
|
2090
|
+
* 从单条 booking 的 holder / metadata 中收集 holder form_record。
|
|
2091
|
+
*
|
|
2092
|
+
* @example
|
|
2093
|
+
* const ids = this.collectBookingHolderRecords(booking);
|
|
2094
|
+
*/
|
|
2095
|
+
}, {
|
|
2096
|
+
key: "collectBookingHolderRecords",
|
|
2097
|
+
value: function collectBookingHolderRecords(booking) {
|
|
2098
|
+
var _holder$form_record, _booking$metadata;
|
|
2099
|
+
var holder = booking !== null && booking !== void 0 && booking.holder && _typeof(booking.holder) === 'object' ? booking.holder : null;
|
|
2100
|
+
var source = (_holder$form_record = holder === null || holder === void 0 ? void 0 : holder.form_record) !== null && _holder$form_record !== void 0 ? _holder$form_record : booking === null || booking === void 0 || (_booking$metadata = booking.metadata) === null || _booking$metadata === void 0 ? void 0 : _booking$metadata.holder_id;
|
|
2101
|
+
var records = Array.isArray(source) ? source : [source];
|
|
2102
|
+
return records.filter(function (record) {
|
|
2103
|
+
return record !== undefined && record !== null && record !== '';
|
|
2104
|
+
});
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
/**
|
|
2108
|
+
* 按 form_record 顺序读取 booking holder 的主字段名称。
|
|
2109
|
+
*
|
|
2110
|
+
* @example
|
|
2111
|
+
* const names = this.collectBookingHolderNames(booking);
|
|
2112
|
+
*/
|
|
2113
|
+
}, {
|
|
2114
|
+
key: "collectBookingHolderNames",
|
|
2115
|
+
value: function collectBookingHolderNames(booking) {
|
|
2116
|
+
var holder = booking !== null && booking !== void 0 && booking.holder && _typeof(booking.holder) === 'object' ? booking.holder : null;
|
|
2117
|
+
var rawName = holder === null || holder === void 0 ? void 0 : holder.name;
|
|
2118
|
+
if (Array.isArray(rawName)) {
|
|
2119
|
+
return rawName.map(function (name) {
|
|
2120
|
+
return String(name || '').trim();
|
|
2121
|
+
});
|
|
2122
|
+
}
|
|
2123
|
+
if (typeof rawName === 'string') {
|
|
2124
|
+
return rawName.split(',').map(function (name) {
|
|
2125
|
+
return name.trim();
|
|
2126
|
+
});
|
|
2127
|
+
}
|
|
2128
|
+
return [];
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2131
|
+
/**
|
|
2132
|
+
* 按老 ticketBooking `formatHolder` 语义汇总订单顶层 holder。
|
|
2133
|
+
*
|
|
2134
|
+
* @example
|
|
2135
|
+
* const holder = this.buildTempOrderHolderFromBookings(tempOrder);
|
|
2136
|
+
*/
|
|
2137
|
+
}, {
|
|
2138
|
+
key: "buildTempOrderHolderFromBookings",
|
|
2139
|
+
value: function buildTempOrderHolderFromBookings(tempOrder) {
|
|
2140
|
+
var _baseHolder$customer_, _baseHolder, _ref44, _baseHolder$form_id, _baseHolder2, _tempOrder$holder5, _baseHolder3, _this$otherParams;
|
|
2141
|
+
var holderRecords = [];
|
|
2142
|
+
var holderNames = [];
|
|
2143
|
+
var baseHolder = null;
|
|
2144
|
+
var seen = new Set();
|
|
2145
|
+
var _iterator18 = _createForOfIteratorHelper(tempOrder.bookings || []),
|
|
2146
|
+
_step18;
|
|
2147
|
+
try {
|
|
2148
|
+
for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
|
|
2149
|
+
var booking = _step18.value;
|
|
2150
|
+
var holder = booking !== null && booking !== void 0 && booking.holder && _typeof(booking.holder) === 'object' ? booking.holder : null;
|
|
2151
|
+
if (!baseHolder && holder) {
|
|
2152
|
+
baseHolder = holder;
|
|
2153
|
+
}
|
|
2154
|
+
var records = this.collectBookingHolderRecords(booking);
|
|
2155
|
+
var names = this.collectBookingHolderNames(booking);
|
|
2156
|
+
var _iterator19 = _createForOfIteratorHelper(records.entries()),
|
|
2157
|
+
_step19;
|
|
2158
|
+
try {
|
|
2159
|
+
for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
|
|
2160
|
+
var _step19$value = _slicedToArray(_step19.value, 2),
|
|
2161
|
+
index = _step19$value[0],
|
|
2162
|
+
record = _step19$value[1];
|
|
2163
|
+
var key = String(record);
|
|
2164
|
+
if (seen.has(key)) continue;
|
|
2165
|
+
seen.add(key);
|
|
2166
|
+
holderRecords.push(record);
|
|
2167
|
+
if (names[index]) {
|
|
2168
|
+
holderNames.push(names[index]);
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
} catch (err) {
|
|
2172
|
+
_iterator19.e(err);
|
|
2173
|
+
} finally {
|
|
2174
|
+
_iterator19.f();
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
} catch (err) {
|
|
2178
|
+
_iterator18.e(err);
|
|
2179
|
+
} finally {
|
|
2180
|
+
_iterator18.f();
|
|
2181
|
+
}
|
|
2182
|
+
if (!holderRecords.length) {
|
|
2183
|
+
return null;
|
|
2184
|
+
}
|
|
2185
|
+
var nextHolder = {
|
|
2186
|
+
customer_id: (_baseHolder$customer_ = (_baseHolder = baseHolder) === null || _baseHolder === void 0 ? void 0 : _baseHolder.customer_id) !== null && _baseHolder$customer_ !== void 0 ? _baseHolder$customer_ : tempOrder.customer_id,
|
|
2187
|
+
form_id: (_ref44 = (_baseHolder$form_id = (_baseHolder2 = baseHolder) === null || _baseHolder2 === void 0 ? void 0 : _baseHolder2.form_id) !== null && _baseHolder$form_id !== void 0 ? _baseHolder$form_id : (_tempOrder$holder5 = tempOrder.holder) === null || _tempOrder$holder5 === void 0 ? void 0 : _tempOrder$holder5.form_id) !== null && _ref44 !== void 0 ? _ref44 : 0,
|
|
2188
|
+
form_record: holderRecords
|
|
2189
|
+
};
|
|
2190
|
+
if (holderNames.length) {
|
|
2191
|
+
nextHolder.name = holderNames.join(',');
|
|
2192
|
+
}
|
|
2193
|
+
if ((_baseHolder3 = baseHolder) !== null && _baseHolder3 !== void 0 && _baseHolder3.is_source_shop || (_this$otherParams = this.otherParams) !== null && _this$otherParams !== void 0 && _this$otherParams.isFranchisee) {
|
|
2194
|
+
nextHolder.is_source_shop = 1;
|
|
2195
|
+
}
|
|
2196
|
+
return nextHolder;
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
/**
|
|
2200
|
+
* 将 booking 级 holder 汇总到 tempOrder 顶层 holder。
|
|
2201
|
+
*
|
|
2202
|
+
* @example
|
|
2203
|
+
* this.syncTempOrderHolderFromBookings(tempOrder);
|
|
2204
|
+
*/
|
|
2205
|
+
}, {
|
|
2206
|
+
key: "syncTempOrderHolderFromBookings",
|
|
2207
|
+
value: function syncTempOrderHolderFromBookings(tempOrder) {
|
|
2208
|
+
var bookings = tempOrder.bookings || [];
|
|
2209
|
+
var hasHolderSource = bookings.some(function (booking) {
|
|
2210
|
+
var _booking$metadata2;
|
|
2211
|
+
return (booking === null || booking === void 0 ? void 0 : booking.holder) !== undefined || (booking === null || booking === void 0 || (_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.holder_id) !== undefined;
|
|
2212
|
+
});
|
|
2213
|
+
var nextHolder = this.buildTempOrderHolderFromBookings(tempOrder);
|
|
2214
|
+
if (nextHolder || hasHolderSource || bookings.length === 0) {
|
|
2215
|
+
tempOrder.holder = nextHolder;
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2073
2218
|
}, {
|
|
2074
2219
|
key: "getBookingUniqueIdentificationNumber",
|
|
2075
2220
|
value: function getBookingUniqueIdentificationNumber(booking) {
|
|
2076
|
-
var _booking$
|
|
2077
|
-
var uid = booking === null || booking === void 0 || (_booking$
|
|
2221
|
+
var _booking$metadata3;
|
|
2222
|
+
var uid = booking === null || booking === void 0 || (_booking$metadata3 = booking.metadata) === null || _booking$metadata3 === void 0 ? void 0 : _booking$metadata3.unique_identification_number;
|
|
2078
2223
|
if (uid === undefined || uid === null || uid === '') return null;
|
|
2079
2224
|
return String(uid);
|
|
2080
2225
|
}
|
|
@@ -2114,7 +2259,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2114
2259
|
key: "recalculateSummary",
|
|
2115
2260
|
value: function () {
|
|
2116
2261
|
var _recalculateSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(options) {
|
|
2117
|
-
var
|
|
2262
|
+
var _ref45, _salesSummaryResult$e;
|
|
2118
2263
|
var tempOrder, snapshotSummary, shouldFullRecalculateFromSnapshot, summaryProducts, salesSummary, existedSummary, totalRefundAmount, paidPaymentSummary, emptyBaseSummary, emptySummary, salesSummaryResult, roundingAmount, payServiceChargeAmount, hasSalesSummaryAmount, expectAmount, amountPaymentPatch, normalizedExpectAmountPatch, summaryForGap, summary;
|
|
2119
2264
|
return _regeneratorRuntime().wrap(function _callee10$(_context12) {
|
|
2120
2265
|
while (1) switch (_context12.prev = _context12.next) {
|
|
@@ -2184,7 +2329,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2184
2329
|
roundingAmount = paidPaymentSummary.roundingAmount;
|
|
2185
2330
|
payServiceChargeAmount = paidPaymentSummary.payServiceChargeAmount;
|
|
2186
2331
|
hasSalesSummaryAmount = salesSummaryResult.expect_amount !== undefined || salesSummaryResult.total_amount !== undefined;
|
|
2187
|
-
expectAmount = hasSalesSummaryAmount ? new Decimal((
|
|
2332
|
+
expectAmount = hasSalesSummaryAmount ? new Decimal((_ref45 = (_salesSummaryResult$e = salesSummaryResult.expect_amount) !== null && _salesSummaryResult$e !== void 0 ? _salesSummaryResult$e : salesSummaryResult.total_amount) !== null && _ref45 !== void 0 ? _ref45 : 0) : null;
|
|
2188
2333
|
amountPaymentPatch = hasSalesSummaryAmount || !roundingAmount.eq(0) || !payServiceChargeAmount.eq(0) ? _objectSpread({
|
|
2189
2334
|
rounding_amount: roundingAmount.toFixed(2)
|
|
2190
2335
|
}, expectAmount ? {
|
|
@@ -2340,17 +2485,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2340
2485
|
}, {
|
|
2341
2486
|
key: "buildTempOrderCustomer",
|
|
2342
2487
|
value: function buildTempOrderCustomer(params) {
|
|
2343
|
-
var
|
|
2488
|
+
var _ref46, _ref47, _ref48, _source$name, _ref49, _ref50, _ref51, _source$customer_name, _source$id, _source$customer_id, _ref52, _source$country_calli, _source$phone, _source$email;
|
|
2344
2489
|
if (!params.customerId) return null;
|
|
2345
2490
|
var source = params.source ? cloneDeep(params.source) : {};
|
|
2346
|
-
var name = (
|
|
2347
|
-
var customerName = (
|
|
2491
|
+
var name = (_ref46 = (_ref47 = (_ref48 = (_source$name = source.name) !== null && _source$name !== void 0 ? _source$name : source.display_name) !== null && _ref48 !== void 0 ? _ref48 : source.customerName) !== null && _ref47 !== void 0 ? _ref47 : source.customer_name) !== null && _ref46 !== void 0 ? _ref46 : params.customerName;
|
|
2492
|
+
var customerName = (_ref49 = (_ref50 = (_ref51 = (_source$customer_name = source.customer_name) !== null && _source$customer_name !== void 0 ? _source$customer_name : source.customerName) !== null && _ref51 !== void 0 ? _ref51 : source.display_name) !== null && _ref50 !== void 0 ? _ref50 : source.name) !== null && _ref49 !== void 0 ? _ref49 : params.customerName;
|
|
2348
2493
|
return _objectSpread(_objectSpread({}, source), {}, {
|
|
2349
2494
|
id: (_source$id = source.id) !== null && _source$id !== void 0 ? _source$id : params.customerId,
|
|
2350
2495
|
customer_id: (_source$customer_id = source.customer_id) !== null && _source$customer_id !== void 0 ? _source$customer_id : params.customerId,
|
|
2351
2496
|
name: String(name || ''),
|
|
2352
2497
|
customer_name: String(customerName || ''),
|
|
2353
|
-
country_calling_code: String((
|
|
2498
|
+
country_calling_code: String((_ref52 = (_source$country_calli = source.country_calling_code) !== null && _source$country_calli !== void 0 ? _source$country_calli : source.countryCallingCode) !== null && _ref52 !== void 0 ? _ref52 : params.countryCallingCode),
|
|
2354
2499
|
phone: String((_source$phone = source.phone) !== null && _source$phone !== void 0 ? _source$phone : params.phone),
|
|
2355
2500
|
email: String((_source$email = source.email) !== null && _source$email !== void 0 ? _source$email : params.email)
|
|
2356
2501
|
});
|
|
@@ -2415,14 +2560,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2415
2560
|
}, {
|
|
2416
2561
|
key: "updateTempOrderCustomer",
|
|
2417
2562
|
value: function updateTempOrderCustomer(customer) {
|
|
2418
|
-
var _tempOrder$customer_i2,
|
|
2563
|
+
var _tempOrder$customer_i2, _ref53, _ref54, _customer$customer_id, _ref55, _ref56, _ref57, _customer$customer_na, _ref58, _customer$country_cal, _tempOrder$customer_i3;
|
|
2419
2564
|
var tempOrder = this.ensureTempOrder();
|
|
2420
2565
|
var previousCustomerId = (_tempOrder$customer_i2 = tempOrder.customer_id) !== null && _tempOrder$customer_i2 !== void 0 ? _tempOrder$customer_i2 : null;
|
|
2421
|
-
var customerId = (
|
|
2422
|
-
var customerName = (
|
|
2566
|
+
var customerId = (_ref53 = (_ref54 = (_customer$customer_id = customer.customer_id) !== null && _customer$customer_id !== void 0 ? _customer$customer_id : customer.customerId) !== null && _ref54 !== void 0 ? _ref54 : customer.id) !== null && _ref53 !== void 0 ? _ref53 : null;
|
|
2567
|
+
var customerName = (_ref55 = (_ref56 = (_ref57 = (_customer$customer_na = customer.customer_name) !== null && _customer$customer_na !== void 0 ? _customer$customer_na : customer.customerName) !== null && _ref57 !== void 0 ? _ref57 : customer.display_name) !== null && _ref56 !== void 0 ? _ref56 : customer.name) !== null && _ref55 !== void 0 ? _ref55 : '';
|
|
2423
2568
|
tempOrder.customer_id = customerId === null || customerId === undefined || customerId === '' ? null : Number(customerId);
|
|
2424
2569
|
tempOrder.customer_name = String(customerName || '');
|
|
2425
|
-
tempOrder.country_calling_code = String((
|
|
2570
|
+
tempOrder.country_calling_code = String((_ref58 = (_customer$country_cal = customer.country_calling_code) !== null && _customer$country_cal !== void 0 ? _customer$country_cal : customer.countryCallingCode) !== null && _ref58 !== void 0 ? _ref58 : '');
|
|
2426
2571
|
tempOrder.phone = String(customer.phone || '');
|
|
2427
2572
|
tempOrder.email = String(customer.email || '');
|
|
2428
2573
|
tempOrder.customer = this.buildTempOrderCustomer({
|
|
@@ -2748,21 +2893,22 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2748
2893
|
return _regeneratorRuntime().wrap(function _callee14$(_context16) {
|
|
2749
2894
|
while (1) switch (_context16.prev = _context16.next) {
|
|
2750
2895
|
case 0:
|
|
2751
|
-
|
|
2896
|
+
this.syncTempOrderHolderFromBookings(tempOrder);
|
|
2897
|
+
_context16.next = 3;
|
|
2752
2898
|
return this.ensureEditDiscountConfigForProductChange(tempOrder);
|
|
2753
|
-
case
|
|
2754
|
-
_context16.next =
|
|
2899
|
+
case 3:
|
|
2900
|
+
_context16.next = 5;
|
|
2755
2901
|
return this.applyPromotion();
|
|
2756
|
-
case
|
|
2902
|
+
case 5:
|
|
2757
2903
|
this.applyDiscount();
|
|
2758
2904
|
this.sanitizeTempOrderProducts(tempOrder);
|
|
2759
|
-
_context16.next =
|
|
2905
|
+
_context16.next = 9;
|
|
2760
2906
|
return this.recalculateSummary({
|
|
2761
2907
|
createIfMissing: true
|
|
2762
2908
|
});
|
|
2763
|
-
case 8:
|
|
2764
|
-
this.persistTempOrder();
|
|
2765
2909
|
case 9:
|
|
2910
|
+
this.persistTempOrder();
|
|
2911
|
+
case 10:
|
|
2766
2912
|
case "end":
|
|
2767
2913
|
return _context16.stop();
|
|
2768
2914
|
}
|
|
@@ -2905,7 +3051,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2905
3051
|
key: "addProductToOrder",
|
|
2906
3052
|
value: (function () {
|
|
2907
3053
|
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(product, booking) {
|
|
2908
|
-
var tempOrder,
|
|
3054
|
+
var tempOrder, _ref59, _productRecord$num, productRecord, splitCount, i, singleLine;
|
|
2909
3055
|
return _regeneratorRuntime().wrap(function _callee16$(_context18) {
|
|
2910
3056
|
while (1) switch (_context18.prev = _context18.next) {
|
|
2911
3057
|
case 0:
|
|
@@ -2915,7 +3061,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2915
3061
|
break;
|
|
2916
3062
|
}
|
|
2917
3063
|
productRecord = product;
|
|
2918
|
-
splitCount = getSafeProductNum((
|
|
3064
|
+
splitCount = getSafeProductNum((_ref59 = (_productRecord$num = productRecord.num) !== null && _productRecord$num !== void 0 ? _productRecord$num : productRecord.product_quantity) !== null && _ref59 !== void 0 ? _ref59 : 1);
|
|
2919
3065
|
if (!(splitCount > 1)) {
|
|
2920
3066
|
_context18.next = 18;
|
|
2921
3067
|
break;
|
|
@@ -2981,9 +3127,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2981
3127
|
}, {
|
|
2982
3128
|
key: "getBundleRuntimeIdentity",
|
|
2983
3129
|
value: function getBundleRuntimeIdentity(bundle) {
|
|
2984
|
-
var
|
|
3130
|
+
var _ref60, _bundle$bundle_id2, _ref61, _bundle$bundle_group_2, _ref62, _ref63, _bundle$bundle_produc3, _ref64, _bundle$bundle_varian3;
|
|
2985
3131
|
if (!bundle || _typeof(bundle) !== 'object') return '';
|
|
2986
|
-
return [(
|
|
3132
|
+
return [(_ref60 = (_bundle$bundle_id2 = bundle.bundle_id) !== null && _bundle$bundle_id2 !== void 0 ? _bundle$bundle_id2 : bundle.id) !== null && _ref60 !== void 0 ? _ref60 : '', (_ref61 = (_bundle$bundle_group_2 = bundle.bundle_group_id) !== null && _bundle$bundle_group_2 !== void 0 ? _bundle$bundle_group_2 : bundle.group_id) !== null && _ref61 !== void 0 ? _ref61 : '', (_ref62 = (_ref63 = (_bundle$bundle_produc3 = bundle.bundle_product_id) !== null && _bundle$bundle_produc3 !== void 0 ? _bundle$bundle_produc3 : bundle._bundle_product_id) !== null && _ref63 !== void 0 ? _ref63 : bundle.product_id) !== null && _ref62 !== void 0 ? _ref62 : '', (_ref64 = (_bundle$bundle_varian3 = bundle.bundle_variant_id) !== null && _bundle$bundle_varian3 !== void 0 ? _bundle$bundle_varian3 : bundle.product_variant_id) !== null && _ref64 !== void 0 ? _ref64 : 0].join('|');
|
|
2987
3133
|
}
|
|
2988
3134
|
}, {
|
|
2989
3135
|
key: "preservePersistedBundlePriceFields",
|
|
@@ -3130,20 +3276,21 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3130
3276
|
tempOrder.bookings = [].concat(_toConsumableArray(tempOrder.bookings || []), [linked.booking]);
|
|
3131
3277
|
}
|
|
3132
3278
|
tempOrder.products[productIndex] = normalizedProduct;
|
|
3279
|
+
this.syncTempOrderHolderFromBookings(tempOrder);
|
|
3133
3280
|
this.captureProductRuntime(tempOrder, updates, tempOrder.products[productIndex], (_tempOrder$products$p = tempOrder.products[productIndex].metadata) === null || _tempOrder$products$p === void 0 ? void 0 : _tempOrder$products$p.unique_identification_number);
|
|
3134
|
-
_context19.next =
|
|
3281
|
+
_context19.next = 31;
|
|
3135
3282
|
return this.applyPromotion();
|
|
3136
|
-
case
|
|
3283
|
+
case 31:
|
|
3137
3284
|
this.applyDiscount();
|
|
3138
3285
|
this.sanitizeTempOrderProducts(tempOrder);
|
|
3139
|
-
_context19.next =
|
|
3286
|
+
_context19.next = 35;
|
|
3140
3287
|
return this.recalculateSummary({
|
|
3141
3288
|
createIfMissing: true
|
|
3142
3289
|
});
|
|
3143
|
-
case
|
|
3290
|
+
case 35:
|
|
3144
3291
|
this.persistTempOrder();
|
|
3145
3292
|
return _context19.abrupt("return", tempOrder.products);
|
|
3146
|
-
case
|
|
3293
|
+
case 37:
|
|
3147
3294
|
case "end":
|
|
3148
3295
|
return _context19.stop();
|
|
3149
3296
|
}
|
|
@@ -3244,9 +3391,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3244
3391
|
unique_identification_number: bookingUid
|
|
3245
3392
|
})
|
|
3246
3393
|
});
|
|
3394
|
+
this.syncBookingMetadataHolder(nextBooking, nextBooking.metadata);
|
|
3247
3395
|
nextBooking.is_all = normalizeBookingIsAll(nextBooking);
|
|
3248
3396
|
nextBooking.sub_type = normalizeBookingSubType(nextBooking);
|
|
3249
3397
|
tempOrder.bookings[bookingIndex] = nextBooking;
|
|
3398
|
+
this.syncTempOrderHolderFromBookings(tempOrder);
|
|
3250
3399
|
this.persistTempOrder();
|
|
3251
3400
|
return tempOrder.bookings;
|
|
3252
3401
|
}
|
|
@@ -3265,18 +3414,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3265
3414
|
return _regeneratorRuntime().wrap(function _callee19$(_context21) {
|
|
3266
3415
|
while (1) switch (_context21.prev = _context21.next) {
|
|
3267
3416
|
case 0:
|
|
3268
|
-
|
|
3417
|
+
this.syncTempOrderHolderFromBookings(tempOrder);
|
|
3418
|
+
_context21.next = 3;
|
|
3269
3419
|
return this.applyPromotion();
|
|
3270
|
-
case
|
|
3420
|
+
case 3:
|
|
3271
3421
|
this.applyDiscount();
|
|
3272
3422
|
this.sanitizeTempOrderProducts(tempOrder);
|
|
3273
|
-
_context21.next =
|
|
3423
|
+
_context21.next = 7;
|
|
3274
3424
|
return this.recalculateSummary({
|
|
3275
3425
|
createIfMissing: true
|
|
3276
3426
|
});
|
|
3277
|
-
case 6:
|
|
3278
|
-
this.persistTempOrder();
|
|
3279
3427
|
case 7:
|
|
3428
|
+
this.persistTempOrder();
|
|
3429
|
+
case 8:
|
|
3280
3430
|
case "end":
|
|
3281
3431
|
return _context21.stop();
|
|
3282
3432
|
}
|
|
@@ -3370,24 +3520,25 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3370
3520
|
tempOrder = this.ensureTempOrder();
|
|
3371
3521
|
tempOrder.products = [];
|
|
3372
3522
|
tempOrder.bookings = [];
|
|
3523
|
+
this.syncTempOrderHolderFromBookings(tempOrder);
|
|
3373
3524
|
if (tempOrder._extend && _typeof(tempOrder._extend) === 'object') {
|
|
3374
3525
|
tempOrder._extend = _objectSpread(_objectSpread({}, tempOrder._extend), {}, {
|
|
3375
3526
|
productsByUid: {}
|
|
3376
3527
|
});
|
|
3377
3528
|
}
|
|
3378
|
-
_context24.next =
|
|
3529
|
+
_context24.next = 7;
|
|
3379
3530
|
return this.applyPromotion();
|
|
3380
|
-
case
|
|
3531
|
+
case 7:
|
|
3381
3532
|
this.applyDiscount();
|
|
3382
3533
|
this.sanitizeTempOrderProducts(tempOrder);
|
|
3383
|
-
_context24.next =
|
|
3534
|
+
_context24.next = 11;
|
|
3384
3535
|
return this.recalculateSummary({
|
|
3385
3536
|
createIfMissing: true
|
|
3386
3537
|
});
|
|
3387
|
-
case
|
|
3538
|
+
case 11:
|
|
3388
3539
|
this.persistTempOrder();
|
|
3389
3540
|
return _context24.abrupt("return", tempOrder);
|
|
3390
|
-
case
|
|
3541
|
+
case 13:
|
|
3391
3542
|
case "end":
|
|
3392
3543
|
return _context24.stop();
|
|
3393
3544
|
}
|
|
@@ -3402,23 +3553,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3402
3553
|
}, {
|
|
3403
3554
|
key: "buildCurrentSubmitPayloadForLocalPrint",
|
|
3404
3555
|
value: function buildCurrentSubmitPayloadForLocalPrint(params) {
|
|
3405
|
-
var _params$cacheId, _this$
|
|
3556
|
+
var _params$cacheId, _this$otherParams2, _ref65, _params$businessCode, _this$otherParams3, _this$otherParams4;
|
|
3406
3557
|
var tempOrder = this.ensureTempOrder();
|
|
3407
3558
|
this.persistTempOrder();
|
|
3408
3559
|
var payload = buildSubmitPayload({
|
|
3409
3560
|
tempOrder: tempOrder,
|
|
3410
3561
|
cacheId: (_params$cacheId = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId !== void 0 ? _params$cacheId : this.cacheId,
|
|
3411
|
-
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$
|
|
3412
|
-
businessCode: (
|
|
3562
|
+
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.platform),
|
|
3563
|
+
businessCode: (_ref65 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.businessCode) !== null && _ref65 !== void 0 ? _ref65 : (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.business_code,
|
|
3413
3564
|
channel: params === null || params === void 0 ? void 0 : params.channel,
|
|
3414
3565
|
type: params === null || params === void 0 ? void 0 : params.type,
|
|
3415
3566
|
summary: this.store.summary || createEmptySummary(),
|
|
3416
3567
|
enhance: function enhance(nextPayload) {
|
|
3417
|
-
var
|
|
3568
|
+
var _ref66, _tempOrder$order_numb, _ref67, _tempOrder$shop_order, _ref68, _tempOrder$shop_full_;
|
|
3418
3569
|
return _objectSpread(_objectSpread({}, nextPayload), {}, {
|
|
3419
|
-
order_number: (
|
|
3420
|
-
shop_order_number: (
|
|
3421
|
-
shop_full_order_number: (
|
|
3570
|
+
order_number: (_ref66 = (_tempOrder$order_numb = tempOrder.order_number) !== null && _tempOrder$order_numb !== void 0 ? _tempOrder$order_numb : nextPayload.order_number) !== null && _ref66 !== void 0 ? _ref66 : null,
|
|
3571
|
+
shop_order_number: (_ref67 = (_tempOrder$shop_order = tempOrder.shop_order_number) !== null && _tempOrder$shop_order !== void 0 ? _tempOrder$shop_order : nextPayload.shop_order_number) !== null && _ref67 !== void 0 ? _ref67 : null,
|
|
3572
|
+
shop_full_order_number: (_ref68 = (_tempOrder$shop_full_ = tempOrder.shop_full_order_number) !== null && _tempOrder$shop_full_ !== void 0 ? _tempOrder$shop_full_ : nextPayload.shop_full_order_number) !== null && _ref68 !== void 0 ? _ref68 : null,
|
|
3422
3573
|
small_ticket_data_flag: 1
|
|
3423
3574
|
});
|
|
3424
3575
|
}
|
|
@@ -3475,7 +3626,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3475
3626
|
key: "submitTempOrder",
|
|
3476
3627
|
value: (function () {
|
|
3477
3628
|
var _submitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
3478
|
-
var _params$cacheId2, _this$
|
|
3629
|
+
var _params$cacheId2, _this$otherParams5, _ref69, _params$businessCode2, _this$otherParams6, _this$otherParams7;
|
|
3479
3630
|
var tempOrder, latestSummary, effectiveCacheId, hasPaymentOverride, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
|
|
3480
3631
|
return _regeneratorRuntime().wrap(function _callee24$(_context26) {
|
|
3481
3632
|
while (1) switch (_context26.prev = _context26.next) {
|
|
@@ -3520,8 +3671,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3520
3671
|
payload = buildSubmitPayload({
|
|
3521
3672
|
tempOrder: tempOrder,
|
|
3522
3673
|
cacheId: effectiveCacheId,
|
|
3523
|
-
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$
|
|
3524
|
-
businessCode: (
|
|
3674
|
+
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.platform),
|
|
3675
|
+
businessCode: (_ref69 = (_params$businessCode2 = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode2 !== void 0 ? _params$businessCode2 : (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.businessCode) !== null && _ref69 !== void 0 ? _ref69 : (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.business_code,
|
|
3525
3676
|
channel: params === null || params === void 0 ? void 0 : params.channel,
|
|
3526
3677
|
type: params === null || params === void 0 ? void 0 : params.type,
|
|
3527
3678
|
summary: latestSummary,
|
|
@@ -4324,19 +4475,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4324
4475
|
};
|
|
4325
4476
|
var tempOrderExtend = nextTempOrder._extend;
|
|
4326
4477
|
var productsByUid = tempOrderExtend.productsByUid || {};
|
|
4327
|
-
var
|
|
4328
|
-
|
|
4478
|
+
var _iterator20 = _createForOfIteratorHelper(nextTempOrder.products.entries()),
|
|
4479
|
+
_step20;
|
|
4329
4480
|
try {
|
|
4330
|
-
for (
|
|
4331
|
-
var _product$metadata7,
|
|
4332
|
-
var
|
|
4333
|
-
index =
|
|
4334
|
-
product =
|
|
4481
|
+
for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
|
|
4482
|
+
var _product$metadata7, _ref70, _ref71, _existed$origin, _rawProduct$metadata;
|
|
4483
|
+
var _step20$value = _slicedToArray(_step20.value, 2),
|
|
4484
|
+
index = _step20$value[0],
|
|
4485
|
+
product = _step20$value[1];
|
|
4335
4486
|
var uid = (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.unique_identification_number;
|
|
4336
4487
|
if (!uid) continue;
|
|
4337
4488
|
var existed = productsByUid[uid] && _typeof(productsByUid[uid]) === 'object' ? productsByUid[uid] : {};
|
|
4338
4489
|
var rawProduct = rawProducts[index] && _typeof(rawProducts[index]) === 'object' ? rawProducts[index] : product;
|
|
4339
|
-
var origin = (
|
|
4490
|
+
var origin = (_ref70 = (_ref71 = (_existed$origin = existed.origin) !== null && _existed$origin !== void 0 ? _existed$origin : rawProduct._origin) !== null && _ref71 !== void 0 ? _ref71 : (_rawProduct$metadata = rawProduct.metadata) === null || _rawProduct$metadata === void 0 ? void 0 : _rawProduct$metadata.origin) !== null && _ref70 !== void 0 ? _ref70 : rawProduct;
|
|
4340
4491
|
var originSnapshot = cloneDeep(origin);
|
|
4341
4492
|
var productOptionString = this.buildHydratedProductOptionString(rawProduct) || this.buildHydratedProductOptionString(product);
|
|
4342
4493
|
if (productOptionString && originSnapshot && _typeof(originSnapshot) === 'object') {
|
|
@@ -4352,9 +4503,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4352
4503
|
});
|
|
4353
4504
|
}
|
|
4354
4505
|
} catch (err) {
|
|
4355
|
-
|
|
4506
|
+
_iterator20.e(err);
|
|
4356
4507
|
} finally {
|
|
4357
|
-
|
|
4508
|
+
_iterator20.f();
|
|
4358
4509
|
}
|
|
4359
4510
|
tempOrderExtend.productsByUid = productsByUid;
|
|
4360
4511
|
if ((options === null || options === void 0 ? void 0 : options.ensureIdentity) !== false) {
|
|
@@ -4385,18 +4536,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4385
4536
|
var segments = [];
|
|
4386
4537
|
var sku = (product === null || product === void 0 ? void 0 : product.product_sku) || {};
|
|
4387
4538
|
if (Array.isArray(sku.variant)) {
|
|
4388
|
-
var
|
|
4389
|
-
|
|
4539
|
+
var _iterator21 = _createForOfIteratorHelper(sku.variant),
|
|
4540
|
+
_step21;
|
|
4390
4541
|
try {
|
|
4391
|
-
for (
|
|
4392
|
-
var variant =
|
|
4542
|
+
for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) {
|
|
4543
|
+
var variant = _step21.value;
|
|
4393
4544
|
var segment = this.formatHydratedNamePair(variant === null || variant === void 0 ? void 0 : variant.group, variant === null || variant === void 0 ? void 0 : variant.item);
|
|
4394
4545
|
if (segment) segments.push(segment);
|
|
4395
4546
|
}
|
|
4396
4547
|
} catch (err) {
|
|
4397
|
-
|
|
4548
|
+
_iterator21.e(err);
|
|
4398
4549
|
} finally {
|
|
4399
|
-
|
|
4550
|
+
_iterator21.f();
|
|
4400
4551
|
}
|
|
4401
4552
|
}
|
|
4402
4553
|
return segments.join(', ');
|
|
@@ -4404,10 +4555,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4404
4555
|
}, {
|
|
4405
4556
|
key: "normalizeHydratedProductOptionItem",
|
|
4406
4557
|
value: function normalizeHydratedProductOptionItem(optionItem) {
|
|
4407
|
-
var
|
|
4408
|
-
var rawNum = (
|
|
4558
|
+
var _ref72, _optionItem$num, _ref73, _optionItem$add_price;
|
|
4559
|
+
var rawNum = (_ref72 = (_optionItem$num = optionItem === null || optionItem === void 0 ? void 0 : optionItem.num) !== null && _optionItem$num !== void 0 ? _optionItem$num : optionItem === null || optionItem === void 0 ? void 0 : optionItem.quantity) !== null && _ref72 !== void 0 ? _ref72 : 1;
|
|
4409
4560
|
var parsedNum = Number(rawNum);
|
|
4410
|
-
var rawPrice = (
|
|
4561
|
+
var rawPrice = (_ref73 = (_optionItem$add_price = optionItem === null || optionItem === void 0 ? void 0 : optionItem.add_price) !== null && _optionItem$add_price !== void 0 ? _optionItem$add_price : optionItem === null || optionItem === void 0 ? void 0 : optionItem.price) !== null && _ref73 !== void 0 ? _ref73 : 0;
|
|
4411
4562
|
var parsedPrice = Number(rawPrice);
|
|
4412
4563
|
var normalized = _objectSpread(_objectSpread({}, optionItem), {}, {
|
|
4413
4564
|
option_group_item_id: optionItem === null || optionItem === void 0 ? void 0 : optionItem.option_group_item_id,
|
|
@@ -4498,67 +4649,67 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4498
4649
|
var amount = new Decimal(discount.amount || 0).times(qty).plus(((_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.product_discount_difference) || 0);
|
|
4499
4650
|
savedMap.set(discountKey, (savedMap.get(discountKey) || new Decimal(0)).plus(amount));
|
|
4500
4651
|
};
|
|
4501
|
-
var
|
|
4502
|
-
|
|
4652
|
+
var _iterator22 = _createForOfIteratorHelper(productList),
|
|
4653
|
+
_step22;
|
|
4503
4654
|
try {
|
|
4504
|
-
for (
|
|
4505
|
-
var product =
|
|
4655
|
+
for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
|
|
4656
|
+
var product = _step22.value;
|
|
4506
4657
|
var qty = product.num || 1;
|
|
4507
|
-
var
|
|
4508
|
-
|
|
4658
|
+
var _iterator24 = _createForOfIteratorHelper(product.discount_list || []),
|
|
4659
|
+
_step24;
|
|
4509
4660
|
try {
|
|
4510
|
-
for (
|
|
4511
|
-
var pd =
|
|
4661
|
+
for (_iterator24.s(); !(_step24 = _iterator24.n()).done;) {
|
|
4662
|
+
var pd = _step24.value;
|
|
4512
4663
|
addDiscountAmount(pd, qty);
|
|
4513
4664
|
}
|
|
4514
4665
|
} catch (err) {
|
|
4515
|
-
|
|
4666
|
+
_iterator24.e(err);
|
|
4516
4667
|
} finally {
|
|
4517
|
-
|
|
4668
|
+
_iterator24.f();
|
|
4518
4669
|
}
|
|
4519
|
-
var
|
|
4520
|
-
|
|
4670
|
+
var _iterator25 = _createForOfIteratorHelper(product.product_bundle || []),
|
|
4671
|
+
_step25;
|
|
4521
4672
|
try {
|
|
4522
|
-
for (
|
|
4523
|
-
var
|
|
4524
|
-
var bundle =
|
|
4525
|
-
var bundleQty = new Decimal(Number(qty) || 1).times(Number((
|
|
4526
|
-
var
|
|
4527
|
-
|
|
4673
|
+
for (_iterator25.s(); !(_step25 = _iterator25.n()).done;) {
|
|
4674
|
+
var _ref74, _bundle$num3;
|
|
4675
|
+
var bundle = _step25.value;
|
|
4676
|
+
var bundleQty = new Decimal(Number(qty) || 1).times(Number((_ref74 = (_bundle$num3 = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num3 !== void 0 ? _bundle$num3 : bundle === null || bundle === void 0 ? void 0 : bundle.quantity) !== null && _ref74 !== void 0 ? _ref74 : 1) || 1).toNumber();
|
|
4677
|
+
var _iterator26 = _createForOfIteratorHelper((bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) || []),
|
|
4678
|
+
_step26;
|
|
4528
4679
|
try {
|
|
4529
|
-
for (
|
|
4530
|
-
var _pd =
|
|
4680
|
+
for (_iterator26.s(); !(_step26 = _iterator26.n()).done;) {
|
|
4681
|
+
var _pd = _step26.value;
|
|
4531
4682
|
addDiscountAmount(_pd, bundleQty);
|
|
4532
4683
|
}
|
|
4533
4684
|
} catch (err) {
|
|
4534
|
-
|
|
4685
|
+
_iterator26.e(err);
|
|
4535
4686
|
} finally {
|
|
4536
|
-
|
|
4687
|
+
_iterator26.f();
|
|
4537
4688
|
}
|
|
4538
4689
|
}
|
|
4539
4690
|
} catch (err) {
|
|
4540
|
-
|
|
4691
|
+
_iterator25.e(err);
|
|
4541
4692
|
} finally {
|
|
4542
|
-
|
|
4693
|
+
_iterator25.f();
|
|
4543
4694
|
}
|
|
4544
4695
|
}
|
|
4545
4696
|
} catch (err) {
|
|
4546
|
-
|
|
4697
|
+
_iterator22.e(err);
|
|
4547
4698
|
} finally {
|
|
4548
|
-
|
|
4699
|
+
_iterator22.f();
|
|
4549
4700
|
}
|
|
4550
|
-
var
|
|
4551
|
-
|
|
4701
|
+
var _iterator23 = _createForOfIteratorHelper(discountList),
|
|
4702
|
+
_step23;
|
|
4552
4703
|
try {
|
|
4553
|
-
for (
|
|
4554
|
-
var d =
|
|
4704
|
+
for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) {
|
|
4705
|
+
var d = _step23.value;
|
|
4555
4706
|
var key = d.id;
|
|
4556
4707
|
d.savedAmount = d.isSelected && key != null && savedMap.has(key) ? savedMap.get(key).toNumber() : 0;
|
|
4557
4708
|
}
|
|
4558
4709
|
} catch (err) {
|
|
4559
|
-
|
|
4710
|
+
_iterator23.e(err);
|
|
4560
4711
|
} finally {
|
|
4561
|
-
|
|
4712
|
+
_iterator23.f();
|
|
4562
4713
|
}
|
|
4563
4714
|
}
|
|
4564
4715
|
}]);
|
|
@@ -677,7 +677,7 @@ function normalizeSubmitProduct(product) {
|
|
|
677
677
|
payment_price: (_submitProduct$paymen = submitProduct.payment_price) !== null && _submitProduct$paymen !== void 0 ? _submitProduct$paymen : submitProduct.selling_price
|
|
678
678
|
});
|
|
679
679
|
}
|
|
680
|
-
var SUBMIT_BOOKING_METADATA_WHITELIST = ['unique_identification_number', 'collect_pax', 'capacity', 'holder_id', 'resource_select_type'];
|
|
680
|
+
var SUBMIT_BOOKING_METADATA_WHITELIST = ['unique_identification_number', 'collect_pax', 'capacity', 'holder_id', 'resource_select_type', 'holder'];
|
|
681
681
|
export function normalizeBookingIsAll(booking) {
|
|
682
682
|
return booking.is_all === true || booking.is_all === 1 || booking.is_all === '1' || booking.is_all === 'true' ? 1 : 0;
|
|
683
683
|
}
|
|
@@ -54,6 +54,29 @@ function bookingDateTimeString(datePart, timePart) {
|
|
|
54
54
|
}
|
|
55
55
|
return "".concat(d, " ").concat(t).trim();
|
|
56
56
|
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 解析预约自身的起止时间区间,供 `sales_time_between` 做区间重叠匹配。
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* const span = resolveBookingTimeRange({ start_date: '2026-06-09', start_time: '10:00', end_date: '2026-06-15', end_time: '10:00' })
|
|
63
|
+
*/
|
|
64
|
+
function resolveBookingTimeRange(booking) {
|
|
65
|
+
var start = toTimestamp(bookingDateTimeString(booking.start_date, booking.start_time));
|
|
66
|
+
if (!start) return null;
|
|
67
|
+
var end = toTimestamp(bookingDateTimeString(booking.end_date || booking.start_date, booking.end_time || booking.start_time)) || start;
|
|
68
|
+
return end >= start ? [start, end] : [end, start];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 判断两个闭区间是否有交集。
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* isRangeOverlapping([1, 10], [5, 6]) // true
|
|
76
|
+
*/
|
|
77
|
+
function isRangeOverlapping(left, right) {
|
|
78
|
+
return left[0] <= right[1] && left[1] >= right[0];
|
|
79
|
+
}
|
|
57
80
|
function parseDateRange(range) {
|
|
58
81
|
if (!Array.isArray(range) || range.length < 2) return null;
|
|
59
82
|
var start = toRangeBoundary(range[0], false);
|
|
@@ -160,8 +183,8 @@ function matchBooking(booking, orderInfo, ctx) {
|
|
|
160
183
|
}
|
|
161
184
|
if (ctx.appointmentStatusSet && !ctx.appointmentStatusSet.has(getBookingAppointmentStatus(booking))) return false;
|
|
162
185
|
if (ctx.bookingTimeRange) {
|
|
163
|
-
var
|
|
164
|
-
if (
|
|
186
|
+
var bookingRange = resolveBookingTimeRange(booking);
|
|
187
|
+
if (!bookingRange || !isRangeOverlapping(bookingRange, ctx.bookingTimeRange)) return false;
|
|
165
188
|
}
|
|
166
189
|
if (ctx.afterExecutionTimeMs != null) {
|
|
167
190
|
var bookingStartMs = toTimestamp(bookingDateTimeString(booking.start_date, booking.start_time));
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -330,7 +330,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
330
330
|
count: number;
|
|
331
331
|
left: number;
|
|
332
332
|
summaryCount: number;
|
|
333
|
-
status: "
|
|
333
|
+
status: "lots_of_space" | "filling_up_fast" | "sold_out";
|
|
334
334
|
}[];
|
|
335
335
|
/**
|
|
336
336
|
* 找到多个资源的公共可用时间段
|
|
@@ -310,7 +310,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
310
310
|
* 获取当前的客户搜索条件
|
|
311
311
|
* @returns 当前搜索条件
|
|
312
312
|
*/
|
|
313
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
313
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
314
314
|
/**
|
|
315
315
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
316
316
|
* @returns 客户状态
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
-
var promotion_exports = {};
|
|
31
|
-
__export(promotion_exports, {
|
|
32
|
-
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
-
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
34
|
-
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
35
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
36
|
-
default: () => import_adapter2.default
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(promotion_exports);
|
|
39
|
-
var import_evaluator = require("./evaluator");
|
|
40
|
-
var import_adapter = require("./adapter");
|
|
41
|
-
var import_adapter2 = __toESM(require("./adapter"));
|
|
42
|
-
var import_examples = require("./examples");
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
BUY_X_GET_Y_FREE_STRATEGY,
|
|
46
|
-
PromotionAdapter,
|
|
47
|
-
PromotionEvaluator,
|
|
48
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
49
|
-
});
|
|
@@ -174,6 +174,9 @@ function cacheItemToBookingInput(cacheItem, options) {
|
|
|
174
174
|
if (ext.holder_id !== void 0 && ext.holder_id !== null) {
|
|
175
175
|
metadata.holder_id = ext.holder_id;
|
|
176
176
|
}
|
|
177
|
+
if (ext.holder !== void 0) {
|
|
178
|
+
metadata.holder = ext.holder;
|
|
179
|
+
}
|
|
177
180
|
if (ext.collect_pax !== void 0)
|
|
178
181
|
metadata.collect_pax = ext.collect_pax;
|
|
179
182
|
const extendCapacity = normalizeExtendCapacityForMetadata(ext.capacity);
|
|
@@ -186,6 +186,41 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
186
186
|
private ensureExtend;
|
|
187
187
|
private captureProductRuntime;
|
|
188
188
|
private createLinkedProductAndBooking;
|
|
189
|
+
/**
|
|
190
|
+
* booking.holder 是提交真源;metadata.holder 作为详情/回显冗余字段同步保存。
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* this.syncBookingMetadataHolder(booking, metadata);
|
|
194
|
+
*/
|
|
195
|
+
private syncBookingMetadataHolder;
|
|
196
|
+
/**
|
|
197
|
+
* 从单条 booking 的 holder / metadata 中收集 holder form_record。
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* const ids = this.collectBookingHolderRecords(booking);
|
|
201
|
+
*/
|
|
202
|
+
private collectBookingHolderRecords;
|
|
203
|
+
/**
|
|
204
|
+
* 按 form_record 顺序读取 booking holder 的主字段名称。
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* const names = this.collectBookingHolderNames(booking);
|
|
208
|
+
*/
|
|
209
|
+
private collectBookingHolderNames;
|
|
210
|
+
/**
|
|
211
|
+
* 按老 ticketBooking `formatHolder` 语义汇总订单顶层 holder。
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* const holder = this.buildTempOrderHolderFromBookings(tempOrder);
|
|
215
|
+
*/
|
|
216
|
+
private buildTempOrderHolderFromBookings;
|
|
217
|
+
/**
|
|
218
|
+
* 将 booking 级 holder 汇总到 tempOrder 顶层 holder。
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* this.syncTempOrderHolderFromBookings(tempOrder);
|
|
222
|
+
*/
|
|
223
|
+
private syncTempOrderHolderFromBookings;
|
|
189
224
|
private getBookingUniqueIdentificationNumber;
|
|
190
225
|
private findBookingIndexByUniqueIdentificationNumber;
|
|
191
226
|
private removeLinkedBookingsForProduct;
|
|
@@ -1438,6 +1438,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
1438
1438
|
);
|
|
1439
1439
|
productMetadata.unique_identification_number = productUid;
|
|
1440
1440
|
bookingMetadata.unique_identification_number = bookingUid;
|
|
1441
|
+
this.syncBookingMetadataHolder(params.booking, bookingMetadata);
|
|
1441
1442
|
return {
|
|
1442
1443
|
productUid,
|
|
1443
1444
|
bookingUid,
|
|
@@ -1459,6 +1460,110 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
1459
1460
|
}
|
|
1460
1461
|
};
|
|
1461
1462
|
}
|
|
1463
|
+
/**
|
|
1464
|
+
* booking.holder 是提交真源;metadata.holder 作为详情/回显冗余字段同步保存。
|
|
1465
|
+
*
|
|
1466
|
+
* @example
|
|
1467
|
+
* this.syncBookingMetadataHolder(booking, metadata);
|
|
1468
|
+
*/
|
|
1469
|
+
syncBookingMetadataHolder(booking, metadata) {
|
|
1470
|
+
if ((booking == null ? void 0 : booking.holder) !== void 0) {
|
|
1471
|
+
metadata.holder = booking.holder;
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
/**
|
|
1475
|
+
* 从单条 booking 的 holder / metadata 中收集 holder form_record。
|
|
1476
|
+
*
|
|
1477
|
+
* @example
|
|
1478
|
+
* const ids = this.collectBookingHolderRecords(booking);
|
|
1479
|
+
*/
|
|
1480
|
+
collectBookingHolderRecords(booking) {
|
|
1481
|
+
var _a;
|
|
1482
|
+
const holder = (booking == null ? void 0 : booking.holder) && typeof booking.holder === "object" ? booking.holder : null;
|
|
1483
|
+
const source = (holder == null ? void 0 : holder.form_record) ?? ((_a = booking == null ? void 0 : booking.metadata) == null ? void 0 : _a.holder_id);
|
|
1484
|
+
const records = Array.isArray(source) ? source : [source];
|
|
1485
|
+
return records.filter((record) => record !== void 0 && record !== null && record !== "");
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* 按 form_record 顺序读取 booking holder 的主字段名称。
|
|
1489
|
+
*
|
|
1490
|
+
* @example
|
|
1491
|
+
* const names = this.collectBookingHolderNames(booking);
|
|
1492
|
+
*/
|
|
1493
|
+
collectBookingHolderNames(booking) {
|
|
1494
|
+
const holder = (booking == null ? void 0 : booking.holder) && typeof booking.holder === "object" ? booking.holder : null;
|
|
1495
|
+
const rawName = holder == null ? void 0 : holder.name;
|
|
1496
|
+
if (Array.isArray(rawName)) {
|
|
1497
|
+
return rawName.map((name) => String(name || "").trim());
|
|
1498
|
+
}
|
|
1499
|
+
if (typeof rawName === "string") {
|
|
1500
|
+
return rawName.split(",").map((name) => name.trim());
|
|
1501
|
+
}
|
|
1502
|
+
return [];
|
|
1503
|
+
}
|
|
1504
|
+
/**
|
|
1505
|
+
* 按老 ticketBooking `formatHolder` 语义汇总订单顶层 holder。
|
|
1506
|
+
*
|
|
1507
|
+
* @example
|
|
1508
|
+
* const holder = this.buildTempOrderHolderFromBookings(tempOrder);
|
|
1509
|
+
*/
|
|
1510
|
+
buildTempOrderHolderFromBookings(tempOrder) {
|
|
1511
|
+
var _a, _b;
|
|
1512
|
+
const holderRecords = [];
|
|
1513
|
+
const holderNames = [];
|
|
1514
|
+
let baseHolder = null;
|
|
1515
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1516
|
+
for (const booking of tempOrder.bookings || []) {
|
|
1517
|
+
const holder = (booking == null ? void 0 : booking.holder) && typeof booking.holder === "object" ? booking.holder : null;
|
|
1518
|
+
if (!baseHolder && holder) {
|
|
1519
|
+
baseHolder = holder;
|
|
1520
|
+
}
|
|
1521
|
+
const records = this.collectBookingHolderRecords(booking);
|
|
1522
|
+
const names = this.collectBookingHolderNames(booking);
|
|
1523
|
+
for (const [index, record] of records.entries()) {
|
|
1524
|
+
const key = String(record);
|
|
1525
|
+
if (seen.has(key))
|
|
1526
|
+
continue;
|
|
1527
|
+
seen.add(key);
|
|
1528
|
+
holderRecords.push(record);
|
|
1529
|
+
if (names[index]) {
|
|
1530
|
+
holderNames.push(names[index]);
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
if (!holderRecords.length) {
|
|
1535
|
+
return null;
|
|
1536
|
+
}
|
|
1537
|
+
const nextHolder = {
|
|
1538
|
+
customer_id: (baseHolder == null ? void 0 : baseHolder.customer_id) ?? tempOrder.customer_id,
|
|
1539
|
+
form_id: (baseHolder == null ? void 0 : baseHolder.form_id) ?? ((_a = tempOrder.holder) == null ? void 0 : _a.form_id) ?? 0,
|
|
1540
|
+
form_record: holderRecords
|
|
1541
|
+
};
|
|
1542
|
+
if (holderNames.length) {
|
|
1543
|
+
nextHolder.name = holderNames.join(",");
|
|
1544
|
+
}
|
|
1545
|
+
if ((baseHolder == null ? void 0 : baseHolder.is_source_shop) || ((_b = this.otherParams) == null ? void 0 : _b.isFranchisee)) {
|
|
1546
|
+
nextHolder.is_source_shop = 1;
|
|
1547
|
+
}
|
|
1548
|
+
return nextHolder;
|
|
1549
|
+
}
|
|
1550
|
+
/**
|
|
1551
|
+
* 将 booking 级 holder 汇总到 tempOrder 顶层 holder。
|
|
1552
|
+
*
|
|
1553
|
+
* @example
|
|
1554
|
+
* this.syncTempOrderHolderFromBookings(tempOrder);
|
|
1555
|
+
*/
|
|
1556
|
+
syncTempOrderHolderFromBookings(tempOrder) {
|
|
1557
|
+
const bookings = tempOrder.bookings || [];
|
|
1558
|
+
const hasHolderSource = bookings.some((booking) => {
|
|
1559
|
+
var _a;
|
|
1560
|
+
return (booking == null ? void 0 : booking.holder) !== void 0 || ((_a = booking == null ? void 0 : booking.metadata) == null ? void 0 : _a.holder_id) !== void 0;
|
|
1561
|
+
});
|
|
1562
|
+
const nextHolder = this.buildTempOrderHolderFromBookings(tempOrder);
|
|
1563
|
+
if (nextHolder || hasHolderSource || bookings.length === 0) {
|
|
1564
|
+
tempOrder.holder = nextHolder;
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1462
1567
|
getBookingUniqueIdentificationNumber(booking) {
|
|
1463
1568
|
var _a;
|
|
1464
1569
|
const uid = (_a = booking == null ? void 0 : booking.metadata) == null ? void 0 : _a.unique_identification_number;
|
|
@@ -1996,6 +2101,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
1996
2101
|
* await this.finalizeProductOrderMutation(tempOrder);
|
|
1997
2102
|
*/
|
|
1998
2103
|
async finalizeProductOrderMutation(tempOrder) {
|
|
2104
|
+
this.syncTempOrderHolderFromBookings(tempOrder);
|
|
1999
2105
|
await this.ensureEditDiscountConfigForProductChange(tempOrder);
|
|
2000
2106
|
await this.applyPromotion();
|
|
2001
2107
|
this.applyDiscount();
|
|
@@ -2360,6 +2466,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
2360
2466
|
tempOrder.bookings = [...tempOrder.bookings || [], linked.booking];
|
|
2361
2467
|
}
|
|
2362
2468
|
tempOrder.products[productIndex] = normalizedProduct;
|
|
2469
|
+
this.syncTempOrderHolderFromBookings(tempOrder);
|
|
2363
2470
|
this.captureProductRuntime(
|
|
2364
2471
|
tempOrder,
|
|
2365
2472
|
updates,
|
|
@@ -2458,9 +2565,11 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
2458
2565
|
unique_identification_number: bookingUid
|
|
2459
2566
|
}
|
|
2460
2567
|
};
|
|
2568
|
+
this.syncBookingMetadataHolder(nextBooking, nextBooking.metadata);
|
|
2461
2569
|
nextBooking.is_all = (0, import_utils.normalizeBookingIsAll)(nextBooking);
|
|
2462
2570
|
nextBooking.sub_type = (0, import_utils.normalizeBookingSubType)(nextBooking);
|
|
2463
2571
|
tempOrder.bookings[bookingIndex] = nextBooking;
|
|
2572
|
+
this.syncTempOrderHolderFromBookings(tempOrder);
|
|
2464
2573
|
this.persistTempOrder();
|
|
2465
2574
|
return tempOrder.bookings;
|
|
2466
2575
|
}
|
|
@@ -2472,6 +2581,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
2472
2581
|
* await this.finalizeAfterProductsMutation(tempOrder);
|
|
2473
2582
|
*/
|
|
2474
2583
|
async finalizeAfterProductsMutation(tempOrder) {
|
|
2584
|
+
this.syncTempOrderHolderFromBookings(tempOrder);
|
|
2475
2585
|
await this.applyPromotion();
|
|
2476
2586
|
this.applyDiscount();
|
|
2477
2587
|
this.sanitizeTempOrderProducts(tempOrder);
|
|
@@ -2513,6 +2623,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
2513
2623
|
const tempOrder = this.ensureTempOrder();
|
|
2514
2624
|
tempOrder.products = [];
|
|
2515
2625
|
tempOrder.bookings = [];
|
|
2626
|
+
this.syncTempOrderHolderFromBookings(tempOrder);
|
|
2516
2627
|
if (tempOrder._extend && typeof tempOrder._extend === "object") {
|
|
2517
2628
|
tempOrder._extend = {
|
|
2518
2629
|
...tempOrder._extend,
|
|
@@ -608,7 +608,8 @@ var SUBMIT_BOOKING_METADATA_WHITELIST = [
|
|
|
608
608
|
"collect_pax",
|
|
609
609
|
"capacity",
|
|
610
610
|
"holder_id",
|
|
611
|
-
"resource_select_type"
|
|
611
|
+
"resource_select_type",
|
|
612
|
+
"holder"
|
|
612
613
|
];
|
|
613
614
|
function normalizeBookingIsAll(booking) {
|
|
614
615
|
return booking.is_all === true || booking.is_all === 1 || booking.is_all === "1" || booking.is_all === "true" ? 1 : 0;
|
|
@@ -71,6 +71,21 @@ function bookingDateTimeString(datePart, timePart) {
|
|
|
71
71
|
}
|
|
72
72
|
return `${d} ${t}`.trim();
|
|
73
73
|
}
|
|
74
|
+
function resolveBookingTimeRange(booking) {
|
|
75
|
+
const start = toTimestamp(bookingDateTimeString(booking.start_date, booking.start_time));
|
|
76
|
+
if (!start)
|
|
77
|
+
return null;
|
|
78
|
+
const end = toTimestamp(
|
|
79
|
+
bookingDateTimeString(
|
|
80
|
+
booking.end_date || booking.start_date,
|
|
81
|
+
booking.end_time || booking.start_time
|
|
82
|
+
)
|
|
83
|
+
) || start;
|
|
84
|
+
return end >= start ? [start, end] : [end, start];
|
|
85
|
+
}
|
|
86
|
+
function isRangeOverlapping(left, right) {
|
|
87
|
+
return left[0] <= right[1] && left[1] >= right[0];
|
|
88
|
+
}
|
|
74
89
|
function parseDateRange(range) {
|
|
75
90
|
if (!Array.isArray(range) || range.length < 2)
|
|
76
91
|
return null;
|
|
@@ -178,8 +193,8 @@ function matchBooking(booking, orderInfo, ctx) {
|
|
|
178
193
|
if (ctx.appointmentStatusSet && !ctx.appointmentStatusSet.has(getBookingAppointmentStatus(booking)))
|
|
179
194
|
return false;
|
|
180
195
|
if (ctx.bookingTimeRange) {
|
|
181
|
-
const
|
|
182
|
-
if (
|
|
196
|
+
const bookingRange = resolveBookingTimeRange(booking);
|
|
197
|
+
if (!bookingRange || !isRangeOverlapping(bookingRange, ctx.bookingTimeRange))
|
|
183
198
|
return false;
|
|
184
199
|
}
|
|
185
200
|
if (ctx.afterExecutionTimeMs != null) {
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -330,7 +330,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
330
330
|
count: number;
|
|
331
331
|
left: number;
|
|
332
332
|
summaryCount: number;
|
|
333
|
-
status: "
|
|
333
|
+
status: "lots_of_space" | "filling_up_fast" | "sold_out";
|
|
334
334
|
}[];
|
|
335
335
|
/**
|
|
336
336
|
* 找到多个资源的公共可用时间段
|
|
@@ -310,7 +310,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
310
310
|
* 获取当前的客户搜索条件
|
|
311
311
|
* @returns 当前搜索条件
|
|
312
312
|
*/
|
|
313
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
313
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
314
314
|
/**
|
|
315
315
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
316
316
|
* @returns 客户状态
|