@pisell/pisellos 2.2.257 → 2.2.259
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/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +17 -13
- package/dist/modules/Order/index.d.ts +32 -1
- package/dist/modules/Order/index.js +615 -288
- package/dist/modules/Order/types.d.ts +20 -2
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
- package/dist/modules/Order/utils.d.ts +4 -0
- package/dist/modules/Order/utils.js +114 -28
- package/dist/modules/Rules/index.d.ts +3 -3
- package/dist/modules/Rules/index.js +8 -3
- package/dist/modules/Rules/types.d.ts +2 -1
- package/dist/modules/SalesSummary/index.d.ts +7 -3
- package/dist/modules/SalesSummary/index.js +67 -39
- package/dist/modules/SalesSummary/types.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.js +2 -1
- package/dist/modules/SurchargeList/index.d.ts +6 -4
- package/dist/modules/SurchargeList/index.js +62 -39
- package/dist/modules/SurchargeList/types.d.ts +6 -2
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +1136 -855
- package/dist/server/modules/order/index.d.ts +22 -3
- package/dist/server/modules/order/index.js +398 -316
- package/dist/solution/BaseSales/index.d.ts +22 -2
- package/dist/solution/BaseSales/index.js +995 -701
- package/dist/solution/BaseSales/types.d.ts +1 -0
- package/dist/solution/BaseSales/types.js +2 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +2 -1
- package/dist/solution/BookingTicket/index.d.ts +8 -0
- package/dist/solution/BookingTicket/index.js +153 -6
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +11 -1
- package/lib/modules/Order/index.d.ts +32 -1
- package/lib/modules/Order/index.js +402 -64
- package/lib/modules/Order/types.d.ts +20 -2
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/lib/modules/Order/utils/bundleDiscountHydration.js +139 -0
- package/lib/modules/Order/utils.d.ts +4 -0
- package/lib/modules/Order/utils.js +84 -2
- package/lib/modules/Rules/index.d.ts +3 -3
- package/lib/modules/Rules/index.js +4 -3
- package/lib/modules/Rules/types.d.ts +2 -1
- package/lib/modules/SalesSummary/index.d.ts +7 -3
- package/lib/modules/SalesSummary/index.js +28 -11
- package/lib/modules/SalesSummary/types.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.js +2 -0
- package/lib/modules/SurchargeList/index.d.ts +6 -4
- package/lib/modules/SurchargeList/index.js +41 -21
- package/lib/modules/SurchargeList/types.d.ts +6 -2
- package/lib/server/index.d.ts +3 -0
- package/lib/server/index.js +215 -9
- package/lib/server/modules/order/index.d.ts +22 -3
- package/lib/server/modules/order/index.js +103 -53
- package/lib/solution/BaseSales/index.d.ts +22 -2
- package/lib/solution/BaseSales/index.js +246 -60
- package/lib/solution/BaseSales/types.d.ts +1 -0
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +2 -1
- package/lib/solution/BookingTicket/index.d.ts +8 -0
- package/lib/solution/BookingTicket/index.js +101 -0
- package/package.json +1 -1
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
4
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
5
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
3
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -132,6 +128,14 @@ function resolveMainProductPrice(product, fallback) {
|
|
|
132
128
|
var parsed = Number(value);
|
|
133
129
|
return Number.isFinite(parsed) ? parsed : fallback;
|
|
134
130
|
}
|
|
131
|
+
function mapOrderBundleToOtherBundle(bundle) {
|
|
132
|
+
return bundle.map(function (item) {
|
|
133
|
+
var _ref6, _item$original_price;
|
|
134
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
135
|
+
original_price: (_ref6 = (_item$original_price = item.original_price) !== null && _item$original_price !== void 0 ? _item$original_price : item.bundle_selling_price) !== null && _ref6 !== void 0 ? _ref6 : item.price
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
}
|
|
135
139
|
|
|
136
140
|
/**
|
|
137
141
|
* catalog 缺 product_resource 时,从 booking.resources 反推最小 product_resource 结构,
|
|
@@ -159,10 +163,10 @@ function synthesizeProductResourceFromBooking(booking) {
|
|
|
159
163
|
});
|
|
160
164
|
if (relationIdsByForm.size === 0) return undefined;
|
|
161
165
|
return {
|
|
162
|
-
resources: Array.from(relationIdsByForm.entries()).map(function (
|
|
163
|
-
var
|
|
164
|
-
formId =
|
|
165
|
-
relationIds =
|
|
166
|
+
resources: Array.from(relationIdsByForm.entries()).map(function (_ref7) {
|
|
167
|
+
var _ref8 = _slicedToArray(_ref7, 2),
|
|
168
|
+
formId = _ref8[0],
|
|
169
|
+
relationIds = _ref8[1];
|
|
166
170
|
return {
|
|
167
171
|
id: formId,
|
|
168
172
|
status: 1,
|
|
@@ -182,7 +186,7 @@ function synthesizeProductResourceFromBooking(booking) {
|
|
|
182
186
|
* 调用方须传入与该行关联的 booking(通常 bookings[].product_uid === product.metadata.unique_identification_number)。
|
|
183
187
|
*/
|
|
184
188
|
export function buildCacheItemFromOrderLine(input) {
|
|
185
|
-
var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$product_vari, _product$num,
|
|
189
|
+
var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$product_vari, _product$num, _ref9, _product$note, _booking$detail2, _product$metadata, _product$metadata2, _ref10, _extension_type, _booking$product2, _booking$product3, _price, _product$order_detail, _ref11, _booking$id;
|
|
186
190
|
var product = input.product,
|
|
187
191
|
booking = input.booking,
|
|
188
192
|
sourceProduct = input.sourceProduct;
|
|
@@ -202,7 +206,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
202
206
|
var other = {
|
|
203
207
|
product_variant_id: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : 0,
|
|
204
208
|
option: getProductSkuOptions(product),
|
|
205
|
-
bundle: Array.isArray(product.product_bundle) ?
|
|
209
|
+
bundle: mapOrderBundleToOtherBundle(Array.isArray(product.product_bundle) ? product.product_bundle : [])
|
|
206
210
|
};
|
|
207
211
|
var extend = _objectSpread({
|
|
208
212
|
start_date: startDate ? dayjs(startDate) : undefined,
|
|
@@ -215,7 +219,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
215
219
|
sub_type: booking.sub_type,
|
|
216
220
|
quantity: (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : 1,
|
|
217
221
|
product_name: productTitle,
|
|
218
|
-
note: (
|
|
222
|
+
note: (_ref9 = (_product$note = product.note) !== null && _product$note !== void 0 ? _product$note : booking === null || booking === void 0 || (_booking$detail2 = booking.detail) === null || _booking$detail2 === void 0 ? void 0 : _booking$detail2.note) !== null && _ref9 !== void 0 ? _ref9 : '',
|
|
219
223
|
price: mainProductPrice,
|
|
220
224
|
total: selling,
|
|
221
225
|
origin_total: original,
|
|
@@ -250,7 +254,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
250
254
|
var base = _objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
|
|
251
255
|
id: resolvedId,
|
|
252
256
|
product_id: resolvedId,
|
|
253
|
-
extension_type: (
|
|
257
|
+
extension_type: (_ref10 = (_extension_type = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type) !== null && _extension_type !== void 0 ? _extension_type : booking === null || booking === void 0 || (_booking$product2 = booking.product) === null || _booking$product2 === void 0 ? void 0 : _booking$product2.extension_type) !== null && _ref10 !== void 0 ? _ref10 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type,
|
|
254
258
|
title: productTitle || (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) || (booking === null || booking === void 0 || (_booking$product3 = booking.product) === null || _booking$product3 === void 0 ? void 0 : _booking$product3.title),
|
|
255
259
|
price: (_price = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price !== void 0 ? _price : selling,
|
|
256
260
|
selling_price: product.selling_price,
|
|
@@ -262,7 +266,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
262
266
|
new: 0,
|
|
263
267
|
autoClose: false,
|
|
264
268
|
order_detail_id: (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : null,
|
|
265
|
-
booking_id: (
|
|
269
|
+
booking_id: (_ref11 = (_booking$id = booking.id) !== null && _booking$id !== void 0 ? _booking$id : booking.booking_id) !== null && _ref11 !== void 0 ? _ref11 : 0
|
|
266
270
|
});
|
|
267
271
|
if ((sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.capacity) !== undefined) {
|
|
268
272
|
base.capacity = sourceProduct.capacity;
|
|
@@ -154,10 +154,21 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
154
154
|
private calculatePaymentTotal;
|
|
155
155
|
private getDepositAmount;
|
|
156
156
|
private normalizeDepositAmount;
|
|
157
|
+
private getLastOrderDepositSnapshot;
|
|
158
|
+
private getLastOrderSubmitSnapshot;
|
|
157
159
|
private applyDepositAmountToSummary;
|
|
160
|
+
private applyLastOrderDepositSnapshot;
|
|
158
161
|
private isDepositOrder;
|
|
159
162
|
private getOrderExpectedAmount;
|
|
160
163
|
private isDepositCovered;
|
|
164
|
+
getPaymentCompletion(payments?: OrderPaymentSource[]): {
|
|
165
|
+
isFullyPaid: boolean;
|
|
166
|
+
isOrderFullyPaid: boolean;
|
|
167
|
+
isDepositFullyPaid: boolean;
|
|
168
|
+
paymentStage: 'deposit' | 'normal';
|
|
169
|
+
depositAmount: string;
|
|
170
|
+
orderExpectedAmount: string;
|
|
171
|
+
};
|
|
161
172
|
private calculateDepositPaidAmount;
|
|
162
173
|
private resolveNextOrderPaymentType;
|
|
163
174
|
private normalizePaymentSource;
|
|
@@ -186,6 +197,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
186
197
|
private clearManualDepositOverride;
|
|
187
198
|
private getOriginalSalesSnapshot;
|
|
188
199
|
private isSnapshotPayableAmountUnchanged;
|
|
200
|
+
private hasShopDiscountChangedFromSnapshot;
|
|
189
201
|
private restoreOriginalSnapshotIfProductsUnchanged;
|
|
190
202
|
private clearPersistedAmountFieldsForFullRecalc;
|
|
191
203
|
private getPaymentTargetAmount;
|
|
@@ -219,6 +231,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
219
231
|
* const ids = this.collectBookingHolderRecords(booking);
|
|
220
232
|
*/
|
|
221
233
|
private collectBookingHolderRecords;
|
|
234
|
+
private setProductHolderFromBooking;
|
|
235
|
+
private syncLinkedBookingHoldersToProducts;
|
|
222
236
|
/**
|
|
223
237
|
* 按 form_record 顺序读取 booking holder 的主字段名称。
|
|
224
238
|
*
|
|
@@ -301,13 +315,27 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
301
315
|
updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>): OrderPaymentData[];
|
|
302
316
|
/** 从当前订单支付项中移除指定支付项。 */
|
|
303
317
|
deleteOrderPayment(paymentIdentity: string | number): OrderPaymentData[];
|
|
318
|
+
private confirmPendingVoucherPaymentsInList;
|
|
319
|
+
private discardPendingVoucherPaymentsFromList;
|
|
320
|
+
private prepareVoucherPaymentsForSubmit;
|
|
321
|
+
private applyPaymentLifecycleChange;
|
|
322
|
+
confirmPendingVoucherPayments(options?: {
|
|
323
|
+
persist?: boolean;
|
|
324
|
+
recalculateSummary?: boolean;
|
|
325
|
+
}): OrderPaymentData[];
|
|
326
|
+
discardPendingVoucherPayments(options?: {
|
|
327
|
+
persist?: boolean;
|
|
328
|
+
recalculateSummary?: boolean;
|
|
329
|
+
}): OrderPaymentData[];
|
|
304
330
|
/**
|
|
305
331
|
* 覆盖当前订单中的 wallet pass 支付项。
|
|
306
332
|
*
|
|
307
333
|
* 判断口径与 PaymentModal 保持一致:voucher_id 存在且不为 0 的支付项
|
|
308
334
|
* 视为 wallet pass;其它支付项保持不变。
|
|
309
335
|
*/
|
|
310
|
-
updateVoucherOrderPayments(payments: OrderPaymentSource[]
|
|
336
|
+
updateVoucherOrderPayments(payments: OrderPaymentSource[], options?: {
|
|
337
|
+
status?: 'paid' | 'payment_pending';
|
|
338
|
+
}): OrderPaymentData[];
|
|
311
339
|
private shouldMergeProductToOrder;
|
|
312
340
|
private hasOrderProductLineNote;
|
|
313
341
|
/**
|
|
@@ -407,6 +435,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
407
435
|
payments?: OrderPaymentSource[];
|
|
408
436
|
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
409
437
|
smallTicketDataFlag?: number;
|
|
438
|
+
confirmPendingVoucherPayments?: boolean;
|
|
410
439
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
411
440
|
}): Promise<T>;
|
|
412
441
|
submitTempOrderAsync<T = any>(params?: {
|
|
@@ -418,6 +447,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
418
447
|
payments?: OrderPaymentSource[];
|
|
419
448
|
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
420
449
|
smallTicketDataFlag?: number;
|
|
450
|
+
confirmPendingVoucherPayments?: boolean;
|
|
421
451
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
422
452
|
}): Promise<T>;
|
|
423
453
|
private runSubmitTempOrder;
|
|
@@ -497,5 +527,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
497
527
|
private normalizeHydratedOrderProduct;
|
|
498
528
|
getLastOrderInfo(): Record<string, any> | undefined;
|
|
499
529
|
getOrderInfo(order_id: number): Promise<any>;
|
|
530
|
+
getVouchers(): any[];
|
|
500
531
|
}
|
|
501
532
|
export type { UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|