@pisell/pisellos 2.2.191 → 2.2.193
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/walletPass/utils.js +7 -4
- package/dist/modules/Order/index.d.ts +12 -10
- package/dist/modules/Order/index.js +462 -571
- package/dist/modules/Order/types.d.ts +5 -5
- package/dist/modules/Order/utils.js +3 -3
- package/dist/modules/Payment/utils.js +2 -1
- package/dist/modules/SalesSummary/utils.js +1 -1
- package/dist/server/index.d.ts +8 -1
- package/dist/server/index.js +651 -464
- package/dist/server/modules/order/index.d.ts +4 -70
- package/dist/server/modules/order/index.js +336 -747
- package/dist/server/modules/products/index.d.ts +0 -57
- package/dist/server/modules/products/index.js +347 -706
- package/dist/solution/BaseSales/index.d.ts +2 -1
- package/dist/solution/BaseSales/index.js +116 -122
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +0 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/ScanOrder/index.js +3 -1
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +3 -2
- package/lib/modules/Order/index.d.ts +12 -10
- package/lib/modules/Order/index.js +94 -118
- package/lib/modules/Order/types.d.ts +5 -5
- package/lib/modules/Order/utils.js +4 -4
- package/lib/modules/Payment/utils.js +2 -1
- package/lib/modules/SalesSummary/utils.js +1 -3
- package/lib/server/index.d.ts +8 -1
- package/lib/server/index.js +143 -24
- package/lib/server/modules/order/index.d.ts +4 -70
- package/lib/server/modules/order/index.js +31 -391
- package/lib/server/modules/products/index.d.ts +0 -57
- package/lib/server/modules/products/index.js +0 -333
- package/lib/solution/BaseSales/index.d.ts +2 -1
- package/lib/solution/BaseSales/index.js +53 -16
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +0 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/ScanOrder/index.js +3 -1
- package/package.json +1 -1
|
@@ -429,7 +429,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
429
429
|
}
|
|
430
430
|
/**
|
|
431
431
|
* 加载销售订单到统一 tempOrder 工作区。
|
|
432
|
-
*
|
|
432
|
+
* 统一通过 OrderModule 的 sales detail lookup 加载订单详情。
|
|
433
433
|
*
|
|
434
434
|
* 子类可在 `super.loadSalesDetail` 之后基于返回的 `sales` 做业务侧装配
|
|
435
435
|
* (比如把 `sales.customer` 写入 CustomerModule、emit 业务 hook 等)。
|
|
@@ -439,25 +439,19 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
439
439
|
throw new Error("order 模块未初始化");
|
|
440
440
|
const params = typeof orderIdOrParams === "object" ? orderIdOrParams : { orderId: orderIdOrParams };
|
|
441
441
|
const externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
const sales2 = await this.store.order.hydrateTempOrderFromRecord(localRecord, { recalcOnHydrate: false });
|
|
446
|
-
this.currentSalesDetail = sales2;
|
|
447
|
-
await this.core.effects.emit(`${this.name}:onSalesOrderLoaded`, { sales: sales2 });
|
|
448
|
-
return sales2;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
if (params.orderId === void 0 || params.orderId === null) {
|
|
452
|
-
throw new Error("加载销售详情需要 orderId,或本地库中存在对应 externalSaleNumber/orderNumber");
|
|
442
|
+
const lookup = params.orderId ?? externalSaleNumber ?? params.orderNumber;
|
|
443
|
+
if (lookup === void 0 || lookup === null || lookup === "") {
|
|
444
|
+
throw new Error("加载销售详情需要 orderId、externalSaleNumber 或 orderNumber");
|
|
453
445
|
}
|
|
454
|
-
const res = await this.store.order.
|
|
446
|
+
const res = await this.store.order.getSalesOrderByLookup({
|
|
447
|
+
lookup,
|
|
448
|
+
forceRemote: params.forceRemote
|
|
449
|
+
});
|
|
455
450
|
if (!res || res.code !== 200) {
|
|
456
|
-
const message = res && (res.message || res.msg) || `加载销售详情失败: ${
|
|
451
|
+
const message = res && (res.message || res.msg) || `加载销售详情失败: ${lookup}`;
|
|
457
452
|
throw new Error(message);
|
|
458
453
|
}
|
|
459
454
|
const sales = await this.store.order.hydrateTempOrderFromRecord(res.data, { recalcOnHydrate: false });
|
|
460
|
-
await this.store.order.saveDraft();
|
|
461
455
|
this.currentSalesDetail = sales;
|
|
462
456
|
await this.core.effects.emit(`${this.name}:onSalesOrderLoaded`, { sales });
|
|
463
457
|
return sales;
|
|
@@ -733,6 +727,23 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
733
727
|
...(discountList || []).filter((discount) => !historyIds.has(discount.id))
|
|
734
728
|
];
|
|
735
729
|
}
|
|
730
|
+
shouldSkipAutoApplyFetchedDiscountsInEditMode(params) {
|
|
731
|
+
if (params.discountAction !== "edit")
|
|
732
|
+
return false;
|
|
733
|
+
if (!params.products.length)
|
|
734
|
+
return false;
|
|
735
|
+
const hasDraftProduct = params.products.some((product) => !this.isPersistedOrderProduct(product));
|
|
736
|
+
if (hasDraftProduct)
|
|
737
|
+
return false;
|
|
738
|
+
const hasSelectedDiscount = params.currentDiscountList.some(
|
|
739
|
+
(discount) => discount.isSelected || discount.isEditMode || discount.isManualSelect
|
|
740
|
+
);
|
|
741
|
+
if (hasSelectedDiscount)
|
|
742
|
+
return false;
|
|
743
|
+
return !params.nextDiscountList.some(
|
|
744
|
+
(discount) => discount.isSelected || discount.isEditMode || discount.isManualSelect
|
|
745
|
+
);
|
|
746
|
+
}
|
|
736
747
|
mergeCurrentDiscountSelectionState(discountList, currentDiscountList) {
|
|
737
748
|
if (!currentDiscountList.length)
|
|
738
749
|
return discountList;
|
|
@@ -811,6 +822,26 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
811
822
|
currentDiscountList
|
|
812
823
|
);
|
|
813
824
|
await (discountModule == null ? void 0 : discountModule.setDiscountList(nextDiscountList));
|
|
825
|
+
const shouldSkipAutoApplyFetchedDiscounts = this.shouldSkipAutoApplyFetchedDiscountsInEditMode({
|
|
826
|
+
discountAction,
|
|
827
|
+
products: tempOrder.products || [],
|
|
828
|
+
currentDiscountList,
|
|
829
|
+
nextDiscountList
|
|
830
|
+
});
|
|
831
|
+
if (shouldSkipAutoApplyFetchedDiscounts) {
|
|
832
|
+
const summary2 = await this.store.order.recalculateSummary({ createIfMissing: true });
|
|
833
|
+
this.store.order.persistTempOrder();
|
|
834
|
+
await this.effectsEmit("onDiscountApplied", {
|
|
835
|
+
productList: tempOrder.products || [],
|
|
836
|
+
discountList: nextDiscountList,
|
|
837
|
+
selectedDiscountList: tempOrder.discount_list || [],
|
|
838
|
+
tempOrder
|
|
839
|
+
});
|
|
840
|
+
return {
|
|
841
|
+
productList: tempOrder.products || [],
|
|
842
|
+
discountList: nextDiscountList
|
|
843
|
+
};
|
|
844
|
+
}
|
|
814
845
|
if (rulesModule) {
|
|
815
846
|
const holders = ((_l = tempOrder.holder) == null ? void 0 : _l.form_record_id) ? [{ form_record_id: tempOrder.holder.form_record_id }] : [];
|
|
816
847
|
const result = rulesModule.calcDiscount({
|
|
@@ -1173,8 +1204,14 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1173
1204
|
if (!this.store.order)
|
|
1174
1205
|
throw new Error("order 模块未初始化");
|
|
1175
1206
|
const paymentRecord = payment;
|
|
1207
|
+
const paymentAmount = new import_decimal.default(paymentRecord.amount || 0);
|
|
1208
|
+
if (paymentAmount.isZero()) {
|
|
1209
|
+
this.logWarning("addOrderPayment: 支付金额为 0,跳过添加支付项", {
|
|
1210
|
+
payment: paymentRecord
|
|
1211
|
+
});
|
|
1212
|
+
return this.store.order.getOrderPayments();
|
|
1213
|
+
}
|
|
1176
1214
|
const metadata = paymentRecord.metadata && typeof paymentRecord.metadata === "object" ? { ...paymentRecord.metadata } : {};
|
|
1177
|
-
debugger;
|
|
1178
1215
|
const shopWalletPassId = (_a = this.otherParams) == null ? void 0 : _a.shop_wallet_pass_id;
|
|
1179
1216
|
if (shopWalletPassId !== void 0 && shopWalletPassId !== null) {
|
|
1180
1217
|
metadata.shop_wallet_pass_id = shopWalletPassId;
|
|
@@ -180,7 +180,6 @@ function transformBaseProductToOrderProduct(params) {
|
|
|
180
180
|
duration: payload.duration,
|
|
181
181
|
policy_id: payload.policy_id,
|
|
182
182
|
source_shop_id: payload.source_shop_id,
|
|
183
|
-
origin,
|
|
184
183
|
source_product_price: sourceProductPrice,
|
|
185
184
|
main_product_selling_price: mainProductSellingPrice,
|
|
186
185
|
main_product_original_price: mainProductOriginalPrice,
|
|
@@ -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 | 1 | 2 | 6 | 3 | 5 | 4;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -279,7 +279,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
279
279
|
* 获取当前的客户搜索条件
|
|
280
280
|
* @returns 当前搜索条件
|
|
281
281
|
*/
|
|
282
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
282
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
283
283
|
/**
|
|
284
284
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
285
285
|
* @returns 客户状态
|
|
@@ -1654,7 +1654,9 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1654
1654
|
tempOrder.order_id = resourceState.lastOrderId;
|
|
1655
1655
|
}
|
|
1656
1656
|
if (tempOrder.order_id) {
|
|
1657
|
-
const res = await ((_i = this.store.order) == null ? void 0 : _i.
|
|
1657
|
+
const res = await ((_i = this.store.order) == null ? void 0 : _i.getSalesOrderByLookup({
|
|
1658
|
+
lookup: tempOrder.order_id
|
|
1659
|
+
}));
|
|
1658
1660
|
const entryPaxNumber = (_m = (_l = (_k = (_j = res == null ? void 0 : res.data) == null ? void 0 : _j.bookings) == null ? void 0 : _k.find((p) => {
|
|
1659
1661
|
var _a2;
|
|
1660
1662
|
return (_a2 = p.metadata) == null ? void 0 : _a2.collect_pax;
|