@pisell/pisellos 2.1.118 → 2.1.120
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/apis/picoding.d.ts +0 -0
- package/dist/apis/picoding.js +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/model/strategy/adapter/index.d.ts +4 -0
- package/dist/model/strategy/adapter/index.js +4 -1
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +59 -0
- package/dist/model/strategy/adapter/itemRule/adapter.js +439 -0
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
- package/dist/model/strategy/adapter/itemRule/evaluator.js +169 -0
- package/dist/model/strategy/adapter/itemRule/examples.d.ts +64 -0
- package/dist/model/strategy/adapter/itemRule/examples.js +315 -0
- package/dist/model/strategy/adapter/itemRule/index.d.ts +5 -0
- package/dist/model/strategy/adapter/itemRule/index.js +5 -0
- package/dist/model/strategy/adapter/itemRule/type.d.ts +206 -0
- package/dist/model/strategy/adapter/itemRule/type.js +101 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +66 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +271 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +1206 -0
- package/dist/model/strategy/adapter/promotion/examples.d.ts +138 -0
- package/dist/model/strategy/adapter/promotion/examples.js +166 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/index.js +0 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +447 -0
- package/dist/model/strategy/adapter/promotion/type.js +209 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +4 -1
- package/dist/model/strategy/engine.d.ts +106 -0
- package/dist/model/strategy/engine.js +611 -0
- package/dist/model/strategy/index.d.ts +2 -93
- package/dist/model/strategy/index.js +6 -549
- package/dist/modules/Cart/types.d.ts +0 -2
- package/dist/modules/Cart/utils/cartProduct.js +25 -56
- package/dist/modules/Discount/types.d.ts +0 -18
- package/dist/modules/OpenData/index.d.ts +23 -0
- package/dist/modules/OpenData/index.js +167 -0
- package/dist/modules/OpenData/types.d.ts +73 -0
- package/dist/modules/OpenData/types.js +1 -0
- package/dist/modules/OpenData/utils.d.ts +2 -0
- package/dist/modules/OpenData/utils.js +75 -0
- package/dist/modules/Order/index.d.ts +58 -1
- package/dist/modules/Order/index.js +780 -29
- package/dist/modules/Order/types.d.ts +144 -12
- package/dist/modules/Order/utils.d.ts +25 -0
- package/dist/modules/Order/utils.js +225 -1
- package/dist/modules/Payment/index.d.ts +1 -2
- package/dist/modules/Payment/index.js +7 -10
- package/dist/modules/Payment/utils.js +0 -3
- package/dist/modules/Payment/walletpass.d.ts +0 -23
- package/dist/modules/Payment/walletpass.js +95 -191
- package/dist/modules/Product/utils.js +2 -2
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +2 -1
- package/dist/modules/Quotation/index.d.ts +48 -0
- package/dist/modules/Quotation/index.js +245 -0
- package/dist/modules/Quotation/types.d.ts +42 -0
- package/dist/modules/Quotation/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +5 -9
- package/dist/modules/Rules/index.js +164 -673
- package/dist/modules/Rules/types.d.ts +0 -2
- package/dist/modules/SalesSummary/index.d.ts +63 -0
- package/dist/modules/SalesSummary/index.js +174 -0
- package/dist/modules/SalesSummary/types.d.ts +59 -0
- package/dist/modules/SalesSummary/types.js +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +30 -0
- package/dist/modules/SalesSummary/utils.js +513 -0
- package/dist/modules/ScanOrderLogger/index.d.ts +21 -0
- package/dist/modules/ScanOrderLogger/index.js +161 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.js +95 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.js +50 -0
- package/dist/modules/ScanOrderLogger/types.d.ts +46 -0
- package/dist/modules/ScanOrderLogger/types.js +1 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +11 -18
- package/dist/modules/Summary/types.d.ts +0 -2
- package/dist/modules/Summary/utils.d.ts +3 -9
- package/dist/modules/Summary/utils.js +4 -25
- package/dist/modules/index.d.ts +4 -0
- package/dist/modules/index.js +5 -1
- package/dist/plugins/window.d.ts +0 -2
- package/dist/solution/BookingByStep/index.d.ts +1 -2
- package/dist/solution/BookingByStep/index.js +44 -42
- package/dist/solution/BookingByStep/types.d.ts +3 -1
- package/dist/solution/BookingByStep/types.js +5 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/Checkout/index.js +0 -2
- package/dist/solution/ScanOrder/index.d.ts +90 -0
- package/dist/solution/ScanOrder/index.js +1853 -0
- package/dist/solution/ScanOrder/types.d.ts +210 -0
- package/dist/solution/ScanOrder/types.js +16 -0
- package/dist/solution/ScanOrder/utils.d.ts +93 -0
- package/dist/solution/ScanOrder/utils.js +397 -0
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +7 -23
- package/dist/solution/ShopDiscount/types.d.ts +0 -1
- package/dist/solution/ShopDiscount/types.js +1 -2
- package/dist/solution/ShopDiscount/utils.js +12 -26
- package/dist/solution/VenueBooking/index.d.ts +158 -0
- package/dist/solution/VenueBooking/index.js +2873 -0
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/dist/solution/VenueBooking/types.d.ts +130 -0
- package/dist/solution/VenueBooking/types.js +21 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +10 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +102 -0
- package/dist/solution/VenueBooking/utils/resource.d.ts +4 -0
- package/dist/solution/VenueBooking/utils/resource.js +94 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +29 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +204 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/dist/solution/VenueBooking/utils/timeSlot.js +256 -0
- package/dist/solution/VenueBooking/utils.d.ts +1 -0
- package/dist/solution/VenueBooking/utils.js +1 -0
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/lib/apis/picoding.d.ts +0 -0
- package/lib/apis/picoding.js +0 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/model/strategy/adapter/index.d.ts +4 -0
- package/lib/model/strategy/adapter/index.js +12 -0
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +59 -0
- package/lib/model/strategy/adapter/itemRule/adapter.js +338 -0
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
- package/lib/model/strategy/adapter/itemRule/evaluator.js +124 -0
- package/lib/model/strategy/adapter/itemRule/examples.d.ts +64 -0
- package/lib/model/strategy/adapter/itemRule/examples.js +269 -0
- package/lib/model/strategy/adapter/itemRule/index.d.ts +5 -0
- package/lib/model/strategy/adapter/itemRule/index.js +58 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +206 -0
- package/lib/model/strategy/adapter/itemRule/type.js +46 -0
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +66 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +217 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +844 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +138 -0
- package/lib/model/strategy/adapter/promotion/examples.js +192 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/index.js +0 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +447 -0
- package/lib/model/strategy/adapter/promotion/type.js +51 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -1
- package/lib/model/strategy/engine.d.ts +106 -0
- package/lib/model/strategy/engine.js +450 -0
- package/lib/model/strategy/index.d.ts +2 -93
- package/lib/model/strategy/index.js +6 -381
- package/lib/modules/Cart/types.d.ts +0 -2
- package/lib/modules/Cart/utils/cartProduct.js +12 -39
- package/lib/modules/Discount/types.d.ts +0 -18
- package/lib/modules/OpenData/index.d.ts +23 -0
- package/lib/modules/OpenData/index.js +116 -0
- package/lib/modules/OpenData/types.d.ts +73 -0
- package/lib/modules/OpenData/types.js +17 -0
- package/lib/modules/OpenData/utils.d.ts +2 -0
- package/lib/modules/OpenData/utils.js +111 -0
- package/lib/modules/Order/index.d.ts +58 -1
- package/lib/modules/Order/index.js +423 -1
- package/lib/modules/Order/types.d.ts +144 -12
- package/lib/modules/Order/utils.d.ts +25 -0
- package/lib/modules/Order/utils.js +229 -0
- package/lib/modules/Payment/index.d.ts +1 -2
- package/lib/modules/Payment/index.js +0 -1
- package/lib/modules/Payment/utils.js +0 -3
- package/lib/modules/Payment/walletpass.d.ts +0 -23
- package/lib/modules/Payment/walletpass.js +17 -94
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +2 -1
- package/lib/modules/Quotation/index.d.ts +48 -0
- package/lib/modules/Quotation/index.js +149 -0
- package/lib/modules/Quotation/types.d.ts +42 -0
- package/lib/modules/Quotation/types.js +17 -0
- package/lib/modules/Rules/index.d.ts +5 -9
- package/lib/modules/Rules/index.js +286 -778
- package/lib/modules/Rules/types.d.ts +0 -2
- package/lib/modules/SalesSummary/index.d.ts +63 -0
- package/lib/modules/SalesSummary/index.js +105 -0
- package/lib/modules/SalesSummary/types.d.ts +59 -0
- package/lib/modules/SalesSummary/types.js +17 -0
- package/lib/modules/SalesSummary/utils.d.ts +30 -0
- package/lib/modules/SalesSummary/utils.js +452 -0
- package/lib/modules/ScanOrderLogger/index.d.ts +21 -0
- package/lib/modules/ScanOrderLogger/index.js +135 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.js +82 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.js +52 -0
- package/lib/modules/ScanOrderLogger/types.d.ts +46 -0
- package/lib/modules/ScanOrderLogger/types.js +17 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +9 -11
- package/lib/modules/Summary/types.d.ts +0 -2
- package/lib/modules/Summary/utils.d.ts +3 -9
- package/lib/modules/Summary/utils.js +4 -19
- package/lib/modules/index.d.ts +4 -0
- package/lib/modules/index.js +9 -1
- package/lib/plugins/window.d.ts +0 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -2
- package/lib/solution/BookingByStep/index.js +4 -2
- package/lib/solution/BookingByStep/types.d.ts +3 -1
- package/lib/solution/BookingByStep/types.js +10 -0
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/Checkout/index.js +0 -2
- package/lib/solution/ScanOrder/index.d.ts +90 -0
- package/lib/solution/ScanOrder/index.js +1071 -0
- package/lib/solution/ScanOrder/types.d.ts +210 -0
- package/lib/solution/ScanOrder/types.js +36 -0
- package/lib/solution/ScanOrder/utils.d.ts +93 -0
- package/lib/solution/ScanOrder/utils.js +359 -0
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +8 -22
- package/lib/solution/ShopDiscount/types.d.ts +0 -1
- package/lib/solution/ShopDiscount/utils.js +6 -10
- package/lib/solution/VenueBooking/index.d.ts +158 -0
- package/lib/solution/VenueBooking/index.js +1545 -0
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/lib/solution/VenueBooking/types.d.ts +130 -0
- package/lib/solution/VenueBooking/types.js +44 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +10 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +101 -0
- package/lib/solution/VenueBooking/utils/resource.d.ts +4 -0
- package/lib/solution/VenueBooking/utils/resource.js +80 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +29 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +209 -0
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/lib/solution/VenueBooking/utils/timeSlot.js +200 -0
- package/lib/solution/VenueBooking/utils.d.ts +1 -0
- package/lib/solution/VenueBooking/utils.js +69 -0
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +5 -1
- package/package.json +1 -1
|
@@ -28,7 +28,6 @@ export interface RulesModuleAPI {
|
|
|
28
28
|
calcDiscount: (params: {
|
|
29
29
|
discountList: any[];
|
|
30
30
|
productList: any[];
|
|
31
|
-
orderTotalAmount: number;
|
|
32
31
|
holders: {
|
|
33
32
|
form_record_id: number;
|
|
34
33
|
}[];
|
|
@@ -67,7 +66,6 @@ export interface RulesParamsHooks {
|
|
|
67
66
|
quantity?: number;
|
|
68
67
|
bundle?: any[];
|
|
69
68
|
main_product_selling_price?: string | number;
|
|
70
|
-
options?: any[];
|
|
71
69
|
}) => Record<string, any>;
|
|
72
70
|
}
|
|
73
71
|
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
|
+
import { BaseModule } from '../BaseModule';
|
|
3
|
+
import { SalesSummaryModuleAPI } from './types';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export declare class SalesSummaryModule extends BaseModule implements Module, SalesSummaryModuleAPI {
|
|
6
|
+
protected defaultName: string;
|
|
7
|
+
protected defaultVersion: string;
|
|
8
|
+
private shopStore;
|
|
9
|
+
private store;
|
|
10
|
+
private request;
|
|
11
|
+
constructor(name?: string, version?: string);
|
|
12
|
+
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
13
|
+
getSurchargeList(): Promise<void>;
|
|
14
|
+
getSummary(params: {
|
|
15
|
+
products: any[];
|
|
16
|
+
isPriceIncludeTax?: number;
|
|
17
|
+
taxRate?: number;
|
|
18
|
+
}): Promise<{
|
|
19
|
+
tax_title: any;
|
|
20
|
+
tax_rate: any;
|
|
21
|
+
product_quantity: number;
|
|
22
|
+
product_original_amount: string;
|
|
23
|
+
product_amount: string;
|
|
24
|
+
product_expect_amount: string;
|
|
25
|
+
product_tax_fee: string;
|
|
26
|
+
shipping_fee: string;
|
|
27
|
+
shipping_tax_fee: string;
|
|
28
|
+
tax_fee: string;
|
|
29
|
+
surcharge_fee: string;
|
|
30
|
+
surcharges: any[];
|
|
31
|
+
discount_amount: string;
|
|
32
|
+
deposit_amount: string;
|
|
33
|
+
deposit?: import("./types").DepositInfo | undefined;
|
|
34
|
+
expect_amount: string;
|
|
35
|
+
total_amount: string;
|
|
36
|
+
amount_gap: string;
|
|
37
|
+
rounding_amount: string;
|
|
38
|
+
pay_service_charge_amount: string;
|
|
39
|
+
is_price_include_tax?: number | undefined;
|
|
40
|
+
} | {
|
|
41
|
+
tax_title: any;
|
|
42
|
+
tax_rate: any;
|
|
43
|
+
product_quantity: number;
|
|
44
|
+
product_original_amount: string;
|
|
45
|
+
product_amount: string;
|
|
46
|
+
product_expect_amount: string;
|
|
47
|
+
product_tax_fee: string;
|
|
48
|
+
shipping_fee: string;
|
|
49
|
+
shipping_tax_fee: string;
|
|
50
|
+
tax_fee: string;
|
|
51
|
+
surcharge_fee: string;
|
|
52
|
+
surcharges: any;
|
|
53
|
+
discount_amount: string;
|
|
54
|
+
deposit_amount: string;
|
|
55
|
+
deposit: import("./types").DepositInfo | undefined;
|
|
56
|
+
expect_amount: string;
|
|
57
|
+
total_amount: string;
|
|
58
|
+
amount_gap: string;
|
|
59
|
+
rounding_amount: string;
|
|
60
|
+
pay_service_charge_amount: string;
|
|
61
|
+
is_price_include_tax: number;
|
|
62
|
+
}>;
|
|
63
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/modules/SalesSummary/index.ts
|
|
21
|
+
var SalesSummary_exports = {};
|
|
22
|
+
__export(SalesSummary_exports, {
|
|
23
|
+
SalesSummaryModule: () => SalesSummaryModule
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(SalesSummary_exports);
|
|
26
|
+
var import_BaseModule = require("../BaseModule");
|
|
27
|
+
var import_Schedule = require("../Schedule");
|
|
28
|
+
var import_utils = require("./utils");
|
|
29
|
+
__reExport(SalesSummary_exports, require("./types"), module.exports);
|
|
30
|
+
var SalesSummaryModule = class extends import_BaseModule.BaseModule {
|
|
31
|
+
constructor(name, version) {
|
|
32
|
+
super(name, version);
|
|
33
|
+
this.defaultName = "salesSummary";
|
|
34
|
+
this.defaultVersion = "1.0.0";
|
|
35
|
+
}
|
|
36
|
+
async initialize(core, options) {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
this.core = core;
|
|
39
|
+
this.store = options.store;
|
|
40
|
+
this.shopStore = this.core.getPlugin("shopStore");
|
|
41
|
+
this.request = this.core.getPlugin("request");
|
|
42
|
+
this.store.surchargeList = ((_a = options.initialState) == null ? void 0 : _a.surchargeList) || [];
|
|
43
|
+
this.store.summary = ((_b = options.initialState) == null ? void 0 : _b.summary) || (0, import_utils.createEmptySalesSummary)();
|
|
44
|
+
if (!this.shopStore) {
|
|
45
|
+
throw new Error("SalesSummaryModule 需要 shopStore 插件支持");
|
|
46
|
+
}
|
|
47
|
+
if (!this.request) {
|
|
48
|
+
throw new Error("SalesSummaryModule 需要 request 插件支持");
|
|
49
|
+
}
|
|
50
|
+
await this.getSurchargeList();
|
|
51
|
+
}
|
|
52
|
+
async getSurchargeList() {
|
|
53
|
+
try {
|
|
54
|
+
const surchargeList = await this.request.get(
|
|
55
|
+
"/order/custom-surcharge/available/v2",
|
|
56
|
+
{
|
|
57
|
+
channel: "online-store",
|
|
58
|
+
is_assemble_product_data: 1,
|
|
59
|
+
is_assemble_schedule_data: 1,
|
|
60
|
+
with: ["relationSchedule"]
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
this.store.surchargeList = (surchargeList == null ? void 0 : surchargeList.data) || [];
|
|
64
|
+
} catch (error) {
|
|
65
|
+
console.warn("[SalesSummaryModule] 加载附加费配置失败", error);
|
|
66
|
+
this.store.surchargeList = [];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async getSummary(params) {
|
|
70
|
+
var _a, _b;
|
|
71
|
+
const { products = [], isPriceIncludeTax, taxRate } = params;
|
|
72
|
+
const shopInfo = ((_b = (_a = this.shopStore.get("core")) == null ? void 0 : _a.core) == null ? void 0 : _b.shop) || {};
|
|
73
|
+
const summarySchedule = this.core.getModule(
|
|
74
|
+
`${this.name.split("_")[0]}_schedule`
|
|
75
|
+
);
|
|
76
|
+
const needScheduleIds = this.store.surchargeList.map((item) => item.available_schedule_ids).flat();
|
|
77
|
+
const scheduleList = summarySchedule == null ? void 0 : summarySchedule.getScheduleListByIds(needScheduleIds);
|
|
78
|
+
const scheduleById = {};
|
|
79
|
+
if (Array.isArray(scheduleList)) {
|
|
80
|
+
for (const item of scheduleList) {
|
|
81
|
+
scheduleById[item.id] = item;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const summary = (0, import_utils.calculateSalesSummary)({
|
|
85
|
+
products,
|
|
86
|
+
isPriceIncludeTax: isPriceIncludeTax ?? (shopInfo == null ? void 0 : shopInfo.is_price_include_tax) ?? 1,
|
|
87
|
+
taxRate: taxRate ?? (shopInfo == null ? void 0 : shopInfo.tax_rate),
|
|
88
|
+
surchargeList: this.store.surchargeList,
|
|
89
|
+
scheduleById,
|
|
90
|
+
isInScheduleByDate: import_Schedule.ScheduleModule.isInScheduleByDate
|
|
91
|
+
});
|
|
92
|
+
const summaryWithTaxMeta = {
|
|
93
|
+
...summary,
|
|
94
|
+
tax_title: (shopInfo == null ? void 0 : shopInfo.tax_title) || "",
|
|
95
|
+
tax_rate: taxRate ?? (shopInfo == null ? void 0 : shopInfo.tax_rate)
|
|
96
|
+
};
|
|
97
|
+
this.store.summary = summaryWithTaxMeta;
|
|
98
|
+
return summaryWithTaxMeta;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
102
|
+
0 && (module.exports = {
|
|
103
|
+
SalesSummaryModule,
|
|
104
|
+
...require("./types")
|
|
105
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export interface SalesSummaryProduct {
|
|
2
|
+
product_id: number | null;
|
|
3
|
+
product_variant_id: number;
|
|
4
|
+
num: number;
|
|
5
|
+
selling_price: string;
|
|
6
|
+
original_price: string;
|
|
7
|
+
payment_price: string;
|
|
8
|
+
tax_fee: string;
|
|
9
|
+
is_charge_tax?: number;
|
|
10
|
+
product_option_item?: any[];
|
|
11
|
+
discount_list?: any[];
|
|
12
|
+
product_bundle?: any[];
|
|
13
|
+
metadata?: Record<string, any>;
|
|
14
|
+
_origin?: Record<string, any>;
|
|
15
|
+
}
|
|
16
|
+
export interface DepositPolicyData {
|
|
17
|
+
id: number;
|
|
18
|
+
title: string;
|
|
19
|
+
}
|
|
20
|
+
export interface DepositInfo {
|
|
21
|
+
total: string;
|
|
22
|
+
deposit_policy_ids: number[];
|
|
23
|
+
deposit_policy_data: DepositPolicyData[];
|
|
24
|
+
hasDeposit: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface SalesSummaryData {
|
|
27
|
+
product_quantity: number;
|
|
28
|
+
product_original_amount: string;
|
|
29
|
+
product_amount: string;
|
|
30
|
+
product_expect_amount: string;
|
|
31
|
+
product_tax_fee: string;
|
|
32
|
+
shipping_fee: string;
|
|
33
|
+
shipping_tax_fee: string;
|
|
34
|
+
tax_fee: string;
|
|
35
|
+
surcharge_fee: string;
|
|
36
|
+
surcharges: any[];
|
|
37
|
+
discount_amount: string;
|
|
38
|
+
deposit_amount: string;
|
|
39
|
+
deposit?: DepositInfo;
|
|
40
|
+
expect_amount: string;
|
|
41
|
+
total_amount: string;
|
|
42
|
+
amount_gap: string;
|
|
43
|
+
rounding_amount: string;
|
|
44
|
+
pay_service_charge_amount: string;
|
|
45
|
+
is_price_include_tax?: number;
|
|
46
|
+
tax_title?: string;
|
|
47
|
+
tax_rate?: number;
|
|
48
|
+
}
|
|
49
|
+
export interface SalesSummaryState {
|
|
50
|
+
surchargeList: any[];
|
|
51
|
+
summary: SalesSummaryData;
|
|
52
|
+
}
|
|
53
|
+
export interface SalesSummaryModuleAPI {
|
|
54
|
+
getSummary(params: {
|
|
55
|
+
products: SalesSummaryProduct[];
|
|
56
|
+
isPriceIncludeTax?: number;
|
|
57
|
+
taxRate?: number;
|
|
58
|
+
}): Promise<SalesSummaryData>;
|
|
59
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/modules/SalesSummary/types.ts
|
|
16
|
+
var types_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DepositInfo, SalesSummaryData, SalesSummaryProduct } from './types';
|
|
2
|
+
export declare function createEmptySalesSummary(): SalesSummaryData;
|
|
3
|
+
export declare function calculateSalesSummary(params: {
|
|
4
|
+
products: SalesSummaryProduct[];
|
|
5
|
+
isPriceIncludeTax: number;
|
|
6
|
+
taxRate?: number;
|
|
7
|
+
surchargeList: any[];
|
|
8
|
+
scheduleById?: Record<string, any>;
|
|
9
|
+
isInScheduleByDate?: any;
|
|
10
|
+
}): SalesSummaryData | {
|
|
11
|
+
product_quantity: number;
|
|
12
|
+
product_original_amount: string;
|
|
13
|
+
product_amount: string;
|
|
14
|
+
product_expect_amount: string;
|
|
15
|
+
product_tax_fee: string;
|
|
16
|
+
shipping_fee: string;
|
|
17
|
+
shipping_tax_fee: string;
|
|
18
|
+
tax_fee: string;
|
|
19
|
+
surcharge_fee: string;
|
|
20
|
+
surcharges: any;
|
|
21
|
+
discount_amount: string;
|
|
22
|
+
deposit_amount: string;
|
|
23
|
+
deposit: DepositInfo | undefined;
|
|
24
|
+
expect_amount: string;
|
|
25
|
+
total_amount: string;
|
|
26
|
+
amount_gap: string;
|
|
27
|
+
rounding_amount: string;
|
|
28
|
+
pay_service_charge_amount: string;
|
|
29
|
+
is_price_include_tax: number;
|
|
30
|
+
};
|