@pisell/pisellos 2.3.182 → 2.3.183
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/Order/index.d.ts +2 -2
- package/dist/modules/Order/index.js +30 -21
- package/dist/server/modules/order/index.js +2 -2
- package/dist/solution/BaseSales/index.d.ts +1 -1
- package/dist/solution/BaseSales/index.js +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -13
- package/lib/modules/Order/index.d.ts +2 -2
- package/lib/modules/Order/index.js +10 -1
- package/lib/server/modules/order/index.js +2 -2
- package/lib/solution/BaseSales/index.d.ts +1 -1
- package/lib/solution/BaseSales/index.js +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -13
- package/package.json +1 -1
|
@@ -530,7 +530,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
530
530
|
removeProductsFromOrder(identities: OrderProductIdentity[], options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
531
531
|
removeProductFromOrder(identity: OrderProductIdentity, options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
532
532
|
/**
|
|
533
|
-
*
|
|
533
|
+
* 清空购物车行(products / bookings)及整单折扣,不重置整单。
|
|
534
534
|
* 普通整单 note 保持不变;以商品行为主体的 Sales Notes 同步删除。
|
|
535
535
|
*/
|
|
536
536
|
clearOrderCartLines(): Promise<OrderTempOrder>;
|
|
@@ -595,7 +595,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
595
595
|
generateIdempotencyToken(): string;
|
|
596
596
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
597
597
|
createOrder(params: CommitOrderParams['query']): {
|
|
598
|
-
type: "
|
|
598
|
+
type: "virtual" | "appointment_booking";
|
|
599
599
|
platform: string;
|
|
600
600
|
sales_channel: string;
|
|
601
601
|
order_sales_channel: string;
|
|
@@ -1531,6 +1531,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1531
1531
|
return _context8.abrupt("return", null);
|
|
1532
1532
|
case 117:
|
|
1533
1533
|
tempOrder.products = result.products;
|
|
1534
|
+
if (tempOrder.products.length === 0) {
|
|
1535
|
+
// 删除主商品后,促销重算可能继续移除最后的赠品。
|
|
1536
|
+
tempOrder.shop_discount = '0.00';
|
|
1537
|
+
}
|
|
1534
1538
|
this.lastUnfulfilledPromotions = result.unfulfilledPromotions;
|
|
1535
1539
|
this.lastGiftActions = result.giftActions;
|
|
1536
1540
|
payload = {
|
|
@@ -1547,20 +1551,20 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1547
1551
|
products: tempOrder.products
|
|
1548
1552
|
};
|
|
1549
1553
|
return _context8.abrupt("return", payload);
|
|
1550
|
-
case
|
|
1551
|
-
_context8.prev =
|
|
1554
|
+
case 125:
|
|
1555
|
+
_context8.prev = 125;
|
|
1552
1556
|
_context8.t6 = _context8["catch"](16);
|
|
1553
1557
|
console.error('[OrderModule] applyPromotion failed', _context8.t6);
|
|
1554
1558
|
return _context8.abrupt("return", null);
|
|
1555
|
-
case
|
|
1556
|
-
_context8.prev =
|
|
1559
|
+
case 129:
|
|
1560
|
+
_context8.prev = 129;
|
|
1557
1561
|
this.isApplyingPromotion = false;
|
|
1558
|
-
return _context8.finish(
|
|
1559
|
-
case
|
|
1562
|
+
return _context8.finish(129);
|
|
1563
|
+
case 132:
|
|
1560
1564
|
case "end":
|
|
1561
1565
|
return _context8.stop();
|
|
1562
1566
|
}
|
|
1563
|
-
}, _callee7, this, [[16,
|
|
1567
|
+
}, _callee7, this, [[16, 125, 129, 132], [20, 44, 47, 50], [25, 34, 37, 40], [56, 109, 112, 115], [61, 98], [73, 90, 93, 96]]);
|
|
1564
1568
|
}));
|
|
1565
1569
|
function evaluatePromotion(_x8) {
|
|
1566
1570
|
return _evaluatePromotion.apply(this, arguments);
|
|
@@ -6478,27 +6482,31 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6478
6482
|
return !tempOrder.products.includes(product);
|
|
6479
6483
|
}));
|
|
6480
6484
|
this.removeSalesNotesForMissingProductLines(tempOrder);
|
|
6485
|
+
if (tempOrder.products.length === 0) {
|
|
6486
|
+
// 整单折扣随购物车清空,避免重新加购时沿用上一批商品的优惠。
|
|
6487
|
+
tempOrder.shop_discount = '0.00';
|
|
6488
|
+
}
|
|
6481
6489
|
if (!isCurrentOrder) {
|
|
6482
|
-
_context31.next =
|
|
6490
|
+
_context31.next = 46;
|
|
6483
6491
|
break;
|
|
6484
6492
|
}
|
|
6485
|
-
_context31.next =
|
|
6493
|
+
_context31.next = 44;
|
|
6486
6494
|
return this.finalizeProductOrderMutation(tempOrder, {
|
|
6487
6495
|
skipEditDiscountConfigRefresh: true,
|
|
6488
6496
|
isCurrentOrder: isCurrentOrder
|
|
6489
6497
|
});
|
|
6490
|
-
case
|
|
6491
|
-
_context31.next =
|
|
6498
|
+
case 44:
|
|
6499
|
+
_context31.next = 48;
|
|
6492
6500
|
break;
|
|
6493
|
-
case
|
|
6494
|
-
_context31.next =
|
|
6501
|
+
case 46:
|
|
6502
|
+
_context31.next = 48;
|
|
6495
6503
|
return this.finalizeAfterProductsMutation(tempOrder);
|
|
6496
|
-
case
|
|
6504
|
+
case 48:
|
|
6497
6505
|
this.logInfo('removeProductsFromOrder success', {
|
|
6498
6506
|
identities: identities
|
|
6499
6507
|
});
|
|
6500
6508
|
return _context31.abrupt("return", tempOrder.products);
|
|
6501
|
-
case
|
|
6509
|
+
case 50:
|
|
6502
6510
|
case "end":
|
|
6503
6511
|
return _context31.stop();
|
|
6504
6512
|
}
|
|
@@ -6529,7 +6537,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6529
6537
|
return removeProductFromOrder;
|
|
6530
6538
|
}()
|
|
6531
6539
|
/**
|
|
6532
|
-
*
|
|
6540
|
+
* 清空购物车行(products / bookings)及整单折扣,不重置整单。
|
|
6533
6541
|
* 普通整单 note 保持不变;以商品行为主体的 Sales Notes 同步删除。
|
|
6534
6542
|
*/
|
|
6535
6543
|
}, {
|
|
@@ -6545,6 +6553,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6545
6553
|
removeProductHolderRelations(tempOrder, tempOrder.products);
|
|
6546
6554
|
tempOrder.products = [];
|
|
6547
6555
|
tempOrder.bookings = [];
|
|
6556
|
+
tempOrder.shop_discount = '0.00';
|
|
6548
6557
|
releaseTempOrderSettlementState(tempOrder);
|
|
6549
6558
|
this.removeSalesNotesForMissingProductLines(tempOrder);
|
|
6550
6559
|
this.syncTempOrderHolderFromBookings(tempOrder);
|
|
@@ -6553,22 +6562,22 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6553
6562
|
productsByUid: {}
|
|
6554
6563
|
});
|
|
6555
6564
|
}
|
|
6556
|
-
_context33.next =
|
|
6565
|
+
_context33.next = 12;
|
|
6557
6566
|
return this.evaluatePromotion();
|
|
6558
|
-
case
|
|
6567
|
+
case 12:
|
|
6559
6568
|
promotionPayload = _context33.sent;
|
|
6560
6569
|
this.applyDiscount();
|
|
6561
6570
|
this.sanitizeTempOrderProducts(tempOrder);
|
|
6562
|
-
_context33.next =
|
|
6571
|
+
_context33.next = 17;
|
|
6563
6572
|
return this.recalculateSummary({
|
|
6564
6573
|
createIfMissing: true
|
|
6565
6574
|
});
|
|
6566
|
-
case
|
|
6575
|
+
case 17:
|
|
6567
6576
|
this.persistTempOrder();
|
|
6568
6577
|
this.emitPromotionApplied(promotionPayload);
|
|
6569
6578
|
this.logInfo('clearOrderCartLines success', {});
|
|
6570
6579
|
return _context33.abrupt("return", tempOrder);
|
|
6571
|
-
case
|
|
6580
|
+
case 21:
|
|
6572
6581
|
case "end":
|
|
6573
6582
|
return _context33.stop();
|
|
6574
6583
|
}
|
|
@@ -541,7 +541,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
541
541
|
continue;
|
|
542
542
|
}
|
|
543
543
|
|
|
544
|
-
//
|
|
544
|
+
// 远端商品成员、Holder 关系或预约数据确实变化时必须落库,避免被回声窗口跳过。
|
|
545
545
|
if (forceWriteStorageKeys.has(storageKey)) {
|
|
546
546
|
toWrite.push(order);
|
|
547
547
|
continue;
|
|
@@ -3045,7 +3045,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3045
3045
|
mergedStorageKey = this.getOrderStorageKey(mergedOrder);
|
|
3046
3046
|
if (mergedStorageKey) forceWriteStorageKeys.add(mergedStorageKey);
|
|
3047
3047
|
}
|
|
3048
|
-
if (nextStorageKey && !isEqual(existingOrder.holder_relations, mergedOrder.holder_relations)) {
|
|
3048
|
+
if (nextStorageKey && (!isEqual(existingOrder.holder_relations, mergedOrder.holder_relations) || !isEqual(existingOrder.bookings, mergedOrder.bookings))) {
|
|
3049
3049
|
forceWriteStorageKeys.add(nextStorageKey);
|
|
3050
3050
|
}
|
|
3051
3051
|
// 合并后身份字段可能新增(如挂单拿到 order_id),同步登记到索引,
|
|
@@ -294,7 +294,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
294
294
|
saveDraft(): Promise<void>;
|
|
295
295
|
restoreOrder(): Promise<OrderTempOrder>;
|
|
296
296
|
/**
|
|
297
|
-
*
|
|
297
|
+
* 清空 tempOrder 购物车行(products / bookings / discount_list)及整单折扣。
|
|
298
298
|
* 同步清空内存中的 salesDetail 商品/预约视图,避免编辑态仍读到旧 bookings。
|
|
299
299
|
*/
|
|
300
300
|
clearOrderCartLines(): Promise<OrderTempOrder>;
|
|
@@ -3114,7 +3114,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3114
3114
|
return restoreOrder;
|
|
3115
3115
|
}()
|
|
3116
3116
|
/**
|
|
3117
|
-
*
|
|
3117
|
+
* 清空 tempOrder 购物车行(products / bookings / discount_list)及整单折扣。
|
|
3118
3118
|
* 同步清空内存中的 salesDetail 商品/预约视图,避免编辑态仍读到旧 bookings。
|
|
3119
3119
|
*/
|
|
3120
3120
|
}, {
|
|
@@ -485,19 +485,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
485
485
|
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
486
486
|
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
487
487
|
*/
|
|
488
|
-
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>):
|
|
489
|
-
action: "reloadCatalog";
|
|
490
|
-
} | {
|
|
491
|
-
action: "add";
|
|
492
|
-
cacheItem: any;
|
|
493
|
-
} | {
|
|
494
|
-
action: "requiresDetail";
|
|
495
|
-
payload: AddProductRequiresDetailPayload;
|
|
496
|
-
} | {
|
|
497
|
-
action: "requiresBookingEdit";
|
|
498
|
-
cacheItem: any;
|
|
499
|
-
payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
|
|
500
|
-
};
|
|
488
|
+
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
501
489
|
/** 规格弹窗 callback 后的第二段决策。 */
|
|
502
490
|
decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
503
491
|
/**
|
|
@@ -530,7 +530,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
530
530
|
removeProductsFromOrder(identities: OrderProductIdentity[], options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
531
531
|
removeProductFromOrder(identity: OrderProductIdentity, options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
532
532
|
/**
|
|
533
|
-
*
|
|
533
|
+
* 清空购物车行(products / bookings)及整单折扣,不重置整单。
|
|
534
534
|
* 普通整单 note 保持不变;以商品行为主体的 Sales Notes 同步删除。
|
|
535
535
|
*/
|
|
536
536
|
clearOrderCartLines(): Promise<OrderTempOrder>;
|
|
@@ -595,7 +595,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
595
595
|
generateIdempotencyToken(): string;
|
|
596
596
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
597
597
|
createOrder(params: CommitOrderParams['query']): {
|
|
598
|
-
type: "
|
|
598
|
+
type: "virtual" | "appointment_booking";
|
|
599
599
|
platform: string;
|
|
600
600
|
sales_channel: string;
|
|
601
601
|
order_sales_channel: string;
|
|
@@ -1032,6 +1032,10 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
1032
1032
|
}
|
|
1033
1033
|
if (options?.isCurrentOrder && !options.isCurrentOrder()) return null;
|
|
1034
1034
|
tempOrder.products = result.products;
|
|
1035
|
+
if (tempOrder.products.length === 0) {
|
|
1036
|
+
// 删除主商品后,促销重算可能继续移除最后的赠品。
|
|
1037
|
+
tempOrder.shop_discount = '0.00';
|
|
1038
|
+
}
|
|
1035
1039
|
this.lastUnfulfilledPromotions = result.unfulfilledPromotions;
|
|
1036
1040
|
this.lastGiftActions = result.giftActions;
|
|
1037
1041
|
const payload = {
|
|
@@ -4588,6 +4592,10 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
4588
4592
|
}
|
|
4589
4593
|
(0, _holderRelations.removeProductHolderRelations)(tempOrder, productsBeforeRemove.filter(product => !tempOrder.products.includes(product)));
|
|
4590
4594
|
this.removeSalesNotesForMissingProductLines(tempOrder);
|
|
4595
|
+
if (tempOrder.products.length === 0) {
|
|
4596
|
+
// 整单折扣随购物车清空,避免重新加购时沿用上一批商品的优惠。
|
|
4597
|
+
tempOrder.shop_discount = '0.00';
|
|
4598
|
+
}
|
|
4591
4599
|
if (isCurrentOrder) {
|
|
4592
4600
|
await this.finalizeProductOrderMutation(tempOrder, {
|
|
4593
4601
|
skipEditDiscountConfigRefresh: true,
|
|
@@ -4606,7 +4614,7 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
4606
4614
|
}
|
|
4607
4615
|
|
|
4608
4616
|
/**
|
|
4609
|
-
*
|
|
4617
|
+
* 清空购物车行(products / bookings)及整单折扣,不重置整单。
|
|
4610
4618
|
* 普通整单 note 保持不变;以商品行为主体的 Sales Notes 同步删除。
|
|
4611
4619
|
*/
|
|
4612
4620
|
async clearOrderCartLines() {
|
|
@@ -4615,6 +4623,7 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
4615
4623
|
(0, _holderRelations.removeProductHolderRelations)(tempOrder, tempOrder.products);
|
|
4616
4624
|
tempOrder.products = [];
|
|
4617
4625
|
tempOrder.bookings = [];
|
|
4626
|
+
tempOrder.shop_discount = '0.00';
|
|
4618
4627
|
(0, _virtualSettlement.releaseTempOrderSettlementState)(tempOrder);
|
|
4619
4628
|
this.removeSalesNotesForMissingProductLines(tempOrder);
|
|
4620
4629
|
this.syncTempOrderHolderFromBookings(tempOrder);
|
|
@@ -366,7 +366,7 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
366
366
|
continue;
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
-
//
|
|
369
|
+
// 远端商品成员、Holder 关系或预约数据确实变化时必须落库,避免被回声窗口跳过。
|
|
370
370
|
if (forceWriteStorageKeys.has(storageKey)) {
|
|
371
371
|
toWrite.push(order);
|
|
372
372
|
continue;
|
|
@@ -1841,7 +1841,7 @@ class OrderModule extends _BaseModule.BaseModule {
|
|
|
1841
1841
|
const mergedStorageKey = this.getOrderStorageKey(mergedOrder);
|
|
1842
1842
|
if (mergedStorageKey) forceWriteStorageKeys.add(mergedStorageKey);
|
|
1843
1843
|
}
|
|
1844
|
-
if (nextStorageKey && !(0, _lodashEs.isEqual)(existingOrder.holder_relations, mergedOrder.holder_relations)) {
|
|
1844
|
+
if (nextStorageKey && (!(0, _lodashEs.isEqual)(existingOrder.holder_relations, mergedOrder.holder_relations) || !(0, _lodashEs.isEqual)(existingOrder.bookings, mergedOrder.bookings))) {
|
|
1845
1845
|
forceWriteStorageKeys.add(nextStorageKey);
|
|
1846
1846
|
}
|
|
1847
1847
|
// 合并后身份字段可能新增(如挂单拿到 order_id),同步登记到索引,
|
|
@@ -294,7 +294,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
294
294
|
saveDraft(): Promise<void>;
|
|
295
295
|
restoreOrder(): Promise<OrderTempOrder>;
|
|
296
296
|
/**
|
|
297
|
-
*
|
|
297
|
+
* 清空 tempOrder 购物车行(products / bookings / discount_list)及整单折扣。
|
|
298
298
|
* 同步清空内存中的 salesDetail 商品/预约视图,避免编辑态仍读到旧 bookings。
|
|
299
299
|
*/
|
|
300
300
|
clearOrderCartLines(): Promise<OrderTempOrder>;
|
|
@@ -1994,7 +1994,7 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
1994
1994
|
}
|
|
1995
1995
|
|
|
1996
1996
|
/**
|
|
1997
|
-
*
|
|
1997
|
+
* 清空 tempOrder 购物车行(products / bookings / discount_list)及整单折扣。
|
|
1998
1998
|
* 同步清空内存中的 salesDetail 商品/预约视图,避免编辑态仍读到旧 bookings。
|
|
1999
1999
|
*/
|
|
2000
2000
|
async clearOrderCartLines() {
|
|
@@ -485,19 +485,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
485
485
|
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
486
486
|
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
487
487
|
*/
|
|
488
|
-
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>):
|
|
489
|
-
action: "reloadCatalog";
|
|
490
|
-
} | {
|
|
491
|
-
action: "add";
|
|
492
|
-
cacheItem: any;
|
|
493
|
-
} | {
|
|
494
|
-
action: "requiresDetail";
|
|
495
|
-
payload: AddProductRequiresDetailPayload;
|
|
496
|
-
} | {
|
|
497
|
-
action: "requiresBookingEdit";
|
|
498
|
-
cacheItem: any;
|
|
499
|
-
payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
|
|
500
|
-
};
|
|
488
|
+
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
501
489
|
/** 规格弹窗 callback 后的第二段决策。 */
|
|
502
490
|
decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
503
491
|
/**
|