@pisell/pisellos 2.2.167 → 2.2.169
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 +51 -15
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +11 -1
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +26 -2
- package/dist/modules/Customer/index.d.ts +6 -0
- package/dist/modules/Customer/index.js +122 -77
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/Order/index.d.ts +5 -10
- package/dist/modules/Order/index.js +53 -9
- package/dist/modules/Order/types.d.ts +8 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +212 -0
- package/dist/modules/Order/utils.d.ts +4 -0
- package/dist/modules/Order/utils.js +25 -10
- package/dist/modules/Rules/index.d.ts +4 -0
- package/dist/modules/Rules/index.js +26 -10
- package/dist/server/modules/order/utils/filterOrders.js +20 -6
- package/dist/solution/BaseSales/index.js +11 -5
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +37 -6
- package/dist/solution/BaseSales/utils.js +11 -2
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +9 -0
- package/dist/solution/BookingTicket/index.js +372 -192
- package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -1
- package/dist/solution/ScanOrder/utils.js +11 -2
- package/dist/solution/VenueBooking/index.d.ts +1 -6
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +42 -9
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +11 -1
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +22 -1
- package/lib/modules/Customer/index.d.ts +6 -0
- package/lib/modules/Customer/index.js +18 -3
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Order/index.d.ts +5 -10
- package/lib/modules/Order/index.js +52 -5
- package/lib/modules/Order/types.d.ts +8 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +207 -0
- package/lib/modules/Order/utils.d.ts +4 -0
- package/lib/modules/Order/utils.js +46 -10
- package/lib/modules/Rules/index.d.ts +4 -0
- package/lib/modules/Rules/index.js +22 -14
- package/lib/server/modules/order/utils/filterOrders.js +12 -4
- package/lib/solution/BaseSales/index.js +6 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +42 -4
- package/lib/solution/BaseSales/utils.js +10 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +9 -0
- package/lib/solution/BookingTicket/index.js +78 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +3 -1
- package/lib/solution/ScanOrder/utils.js +10 -2
- package/lib/solution/VenueBooking/index.d.ts +1 -6
- package/package.json +1 -1
|
@@ -0,0 +1,207 @@
|
|
|
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/modules/Order/utils/manualProductDiscount.ts
|
|
30
|
+
var manualProductDiscount_exports = {};
|
|
31
|
+
__export(manualProductDiscount_exports, {
|
|
32
|
+
buildManualProductDiscountItem: () => buildManualProductDiscountItem,
|
|
33
|
+
ensureManualProductDiscountList: () => ensureManualProductDiscountList,
|
|
34
|
+
findManualProductDiscountItem: () => findManualProductDiscountItem,
|
|
35
|
+
hasManualProductDiscountFlag: () => hasManualProductDiscountFlag,
|
|
36
|
+
mergeManualProductDiscountIntoList: () => mergeManualProductDiscountIntoList,
|
|
37
|
+
resolveManualDiscountMessage: () => resolveManualDiscountMessage,
|
|
38
|
+
resolveManualDiscountOriginTotal: () => resolveManualDiscountOriginTotal,
|
|
39
|
+
resolveManualDiscountReasonFromSources: () => resolveManualDiscountReasonFromSources,
|
|
40
|
+
resolveSafeProductNum: () => resolveSafeProductNum,
|
|
41
|
+
shouldBuildManualProductDiscount: () => shouldBuildManualProductDiscount,
|
|
42
|
+
stripManualProductDiscountItems: () => stripManualProductDiscountItems,
|
|
43
|
+
syncManualProductDiscountProductNum: () => syncManualProductDiscountProductNum
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(manualProductDiscount_exports);
|
|
46
|
+
var import_decimal = __toESM(require("decimal.js"));
|
|
47
|
+
function resolveSafeProductNum(num) {
|
|
48
|
+
const parsed = Number(num);
|
|
49
|
+
if (!Number.isFinite(parsed) || parsed <= 0)
|
|
50
|
+
return 1;
|
|
51
|
+
return Math.floor(parsed);
|
|
52
|
+
}
|
|
53
|
+
function syncManualProductDiscountProductNum(discountList, productNum) {
|
|
54
|
+
const quantity = resolveSafeProductNum(productNum);
|
|
55
|
+
return (discountList || []).map((item) => {
|
|
56
|
+
if ((item == null ? void 0 : item.type) !== "product")
|
|
57
|
+
return item;
|
|
58
|
+
return {
|
|
59
|
+
...item,
|
|
60
|
+
discount: {
|
|
61
|
+
...item.discount || {},
|
|
62
|
+
product_num: quantity
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function resolveManualDiscountOriginTotal(sources) {
|
|
68
|
+
const candidates = [
|
|
69
|
+
sources.originTotal,
|
|
70
|
+
sources.extendOriginTotal,
|
|
71
|
+
sources.originExtendOriginTotal,
|
|
72
|
+
sources.sourceExtendOriginTotal
|
|
73
|
+
];
|
|
74
|
+
for (const candidate of candidates) {
|
|
75
|
+
if (candidate === void 0 || candidate === null || candidate === "")
|
|
76
|
+
continue;
|
|
77
|
+
const parsed = Number(candidate);
|
|
78
|
+
if (Number.isFinite(parsed))
|
|
79
|
+
return parsed;
|
|
80
|
+
}
|
|
81
|
+
const unit = Number(sources.catalogUnitPrice);
|
|
82
|
+
const quantity = sources.quantity ?? 1;
|
|
83
|
+
if (Number.isFinite(unit) && unit > 0) {
|
|
84
|
+
return new import_decimal.default(unit).mul(quantity).toNumber();
|
|
85
|
+
}
|
|
86
|
+
return NaN;
|
|
87
|
+
}
|
|
88
|
+
function resolveManualDiscountReasonFromSources(sources) {
|
|
89
|
+
for (const candidate of [
|
|
90
|
+
sources.discountReason,
|
|
91
|
+
sources.extendDiscountReason,
|
|
92
|
+
sources.originExtendDiscountReason
|
|
93
|
+
]) {
|
|
94
|
+
if (candidate != null && String(candidate).trim() !== "") {
|
|
95
|
+
return String(candidate);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return "";
|
|
99
|
+
}
|
|
100
|
+
function hasManualProductDiscountFlag(metadata) {
|
|
101
|
+
if (!metadata)
|
|
102
|
+
return false;
|
|
103
|
+
const override = metadata.price_override;
|
|
104
|
+
if (override !== void 0 && override !== null && override !== "") {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
return metadata.is_manual_discount === 1 || metadata.is_manual_discount === true;
|
|
108
|
+
}
|
|
109
|
+
function ensureManualProductDiscountList(params) {
|
|
110
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
111
|
+
const list = params.discountList || [];
|
|
112
|
+
const quantity = resolveSafeProductNum(params.quantity);
|
|
113
|
+
if (findManualProductDiscountItem(list)) {
|
|
114
|
+
return syncManualProductDiscountProductNum(list, quantity);
|
|
115
|
+
}
|
|
116
|
+
const metadata = params.metadata || {};
|
|
117
|
+
const originalNum = Number(params.originalPrice);
|
|
118
|
+
const sellingNum = Number(params.sellingPrice);
|
|
119
|
+
const shouldBuild = hasManualProductDiscountFlag(metadata) || shouldBuildManualProductDiscount({ originTotal: originalNum, sellingTotal: sellingNum });
|
|
120
|
+
if (!shouldBuild) {
|
|
121
|
+
return list;
|
|
122
|
+
}
|
|
123
|
+
if (!Number.isFinite(originalNum) || !Number.isFinite(sellingNum) || originalNum === sellingNum) {
|
|
124
|
+
return list;
|
|
125
|
+
}
|
|
126
|
+
const message = resolveManualDiscountMessage(
|
|
127
|
+
list,
|
|
128
|
+
resolveManualDiscountReasonFromSources({
|
|
129
|
+
extendDiscountReason: (_b = (_a = metadata.origin) == null ? void 0 : _a._extend) == null ? void 0 : _b.discount_reason,
|
|
130
|
+
originExtendDiscountReason: (_d = (_c = metadata.origin) == null ? void 0 : _c._extend) == null ? void 0 : _d.discount_reason
|
|
131
|
+
})
|
|
132
|
+
);
|
|
133
|
+
return mergeManualProductDiscountIntoList(
|
|
134
|
+
list,
|
|
135
|
+
buildManualProductDiscountItem({
|
|
136
|
+
originTotal: originalNum,
|
|
137
|
+
sellingTotal: sellingNum,
|
|
138
|
+
quantity,
|
|
139
|
+
message,
|
|
140
|
+
discountway: (_f = (_e = metadata.origin) == null ? void 0 : _e._extend) == null ? void 0 : _f.discountway,
|
|
141
|
+
discount_per: (_h = (_g = metadata.origin) == null ? void 0 : _g._extend) == null ? void 0 : _h.discount_per
|
|
142
|
+
})
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
function findManualProductDiscountItem(discountList) {
|
|
146
|
+
return (discountList || []).find((item) => (item == null ? void 0 : item.type) === "product");
|
|
147
|
+
}
|
|
148
|
+
function resolveManualDiscountMessage(discountList, fallback) {
|
|
149
|
+
var _a, _b;
|
|
150
|
+
const message = (_b = (_a = findManualProductDiscountItem(discountList)) == null ? void 0 : _a.discount) == null ? void 0 : _b.message;
|
|
151
|
+
if (message != null && String(message).trim() !== "") {
|
|
152
|
+
return String(message);
|
|
153
|
+
}
|
|
154
|
+
return fallback ?? "";
|
|
155
|
+
}
|
|
156
|
+
function stripManualProductDiscountItems(discountList) {
|
|
157
|
+
return (discountList || []).filter((item) => (item == null ? void 0 : item.type) !== "product");
|
|
158
|
+
}
|
|
159
|
+
function buildManualProductDiscountItem(params) {
|
|
160
|
+
const origin = new import_decimal.default(Number(params.originTotal) || 0);
|
|
161
|
+
const selling = new import_decimal.default(Number(params.sellingTotal) || 0);
|
|
162
|
+
const diff = origin.minus(selling);
|
|
163
|
+
const quantity = resolveSafeProductNum(params.quantity);
|
|
164
|
+
return {
|
|
165
|
+
amount: diff.abs().toDecimalPlaces(2).toNumber(),
|
|
166
|
+
type: "product",
|
|
167
|
+
discount: {
|
|
168
|
+
message: params.message ?? "",
|
|
169
|
+
discountway: params.discountway ?? "num",
|
|
170
|
+
product_num: quantity,
|
|
171
|
+
discount_per: params.discount_per ?? "",
|
|
172
|
+
discount_type: diff.isNegative() ? "change_price" : "discount"
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function mergeManualProductDiscountIntoList(discountList, manualItem) {
|
|
177
|
+
const base = stripManualProductDiscountItems(discountList);
|
|
178
|
+
if (!manualItem)
|
|
179
|
+
return base;
|
|
180
|
+
if (manualItem.amount === 0 && !manualItem.discount.message)
|
|
181
|
+
return base;
|
|
182
|
+
return [...base, manualItem];
|
|
183
|
+
}
|
|
184
|
+
function shouldBuildManualProductDiscount(params) {
|
|
185
|
+
if (params.hasPriceOverride)
|
|
186
|
+
return true;
|
|
187
|
+
const origin = Number(params.originTotal);
|
|
188
|
+
const selling = Number(params.sellingTotal);
|
|
189
|
+
if (!Number.isFinite(origin) || !Number.isFinite(selling))
|
|
190
|
+
return false;
|
|
191
|
+
return origin !== selling;
|
|
192
|
+
}
|
|
193
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
194
|
+
0 && (module.exports = {
|
|
195
|
+
buildManualProductDiscountItem,
|
|
196
|
+
ensureManualProductDiscountList,
|
|
197
|
+
findManualProductDiscountItem,
|
|
198
|
+
hasManualProductDiscountFlag,
|
|
199
|
+
mergeManualProductDiscountIntoList,
|
|
200
|
+
resolveManualDiscountMessage,
|
|
201
|
+
resolveManualDiscountOriginTotal,
|
|
202
|
+
resolveManualDiscountReasonFromSources,
|
|
203
|
+
resolveSafeProductNum,
|
|
204
|
+
shouldBuildManualProductDiscount,
|
|
205
|
+
stripManualProductDiscountItems,
|
|
206
|
+
syncManualProductDiscountProductNum
|
|
207
|
+
});
|
|
@@ -77,6 +77,8 @@ export declare function resolveRulesManualDiscountFlag(metadata: Record<string,
|
|
|
77
77
|
export declare function resolveManualOverrideLineOriginalPrice(params: {
|
|
78
78
|
num?: number;
|
|
79
79
|
metadata?: Record<string, any> | null;
|
|
80
|
+
/** 已有行级 original_price(origin 被裁剪时兜底划线价) */
|
|
81
|
+
lineOriginalPrice?: string | number | null;
|
|
80
82
|
}, fallbackCompositeOriginal: string): string;
|
|
81
83
|
export declare function createDefaultOrderRulesHooks(): RulesParamsHooks;
|
|
82
84
|
/**
|
|
@@ -154,3 +156,5 @@ export declare function formatV1Product(products: OrderSubmitProduct[]): {
|
|
|
154
156
|
unique: string;
|
|
155
157
|
}[];
|
|
156
158
|
export { createEmptySummary } from '../../solution/ScanOrder/utils';
|
|
159
|
+
export { buildManualProductDiscountItem, ensureManualProductDiscountList, findManualProductDiscountItem, mergeManualProductDiscountIntoList, resolveManualDiscountMessage, resolveManualDiscountOriginTotal, resolveManualDiscountReasonFromSources, resolveSafeProductNum, shouldBuildManualProductDiscount, syncManualProductDiscountProductNum, stripManualProductDiscountItems, } from './utils/manualProductDiscount';
|
|
160
|
+
export type { ManualProductDiscountItem } from './utils/manualProductDiscount';
|
|
@@ -29,12 +29,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
// src/modules/Order/utils.ts
|
|
30
30
|
var utils_exports = {};
|
|
31
31
|
__export(utils_exports, {
|
|
32
|
+
buildManualProductDiscountItem: () => import_manualProductDiscount.buildManualProductDiscountItem,
|
|
32
33
|
buildSubmitPayload: () => buildSubmitPayload,
|
|
33
34
|
composeLinePrice: () => composeLinePrice,
|
|
34
35
|
createDefaultOrderRulesHooks: () => createDefaultOrderRulesHooks,
|
|
35
36
|
createDefaultTempOrder: () => createDefaultTempOrder,
|
|
36
37
|
createEmptySummary: () => import_utils2.createEmptySummary,
|
|
37
38
|
createUuidV4: () => createUuidV4,
|
|
39
|
+
ensureManualProductDiscountList: () => import_manualProductDiscount.ensureManualProductDiscountList,
|
|
40
|
+
findManualProductDiscountItem: () => import_manualProductDiscount.findManualProductDiscountItem,
|
|
38
41
|
formatDateTime: () => formatDateTime,
|
|
39
42
|
formatV1Product: () => formatV1Product,
|
|
40
43
|
generateDuration: () => generateDuration,
|
|
@@ -42,21 +45,30 @@ __export(utils_exports, {
|
|
|
42
45
|
isTempOrder: () => isTempOrder,
|
|
43
46
|
mapPaymentItemToOrderPayment: () => mapPaymentItemToOrderPayment,
|
|
44
47
|
mapPaymentItemsToOrderPayments: () => mapPaymentItemsToOrderPayments,
|
|
48
|
+
mergeManualProductDiscountIntoList: () => import_manualProductDiscount.mergeManualProductDiscountIntoList,
|
|
45
49
|
mergeRelationForms: () => mergeRelationForms,
|
|
46
50
|
normalizeBookingIsAll: () => normalizeBookingIsAll,
|
|
47
51
|
normalizeBookingSubType: () => normalizeBookingSubType,
|
|
48
52
|
normalizeSubmitBooking: () => normalizeSubmitBooking,
|
|
49
53
|
normalizeSubmitCollectPaxValue: () => normalizeSubmitCollectPaxValue,
|
|
54
|
+
resolveManualDiscountMessage: () => import_manualProductDiscount.resolveManualDiscountMessage,
|
|
55
|
+
resolveManualDiscountOriginTotal: () => import_manualProductDiscount.resolveManualDiscountOriginTotal,
|
|
56
|
+
resolveManualDiscountReasonFromSources: () => import_manualProductDiscount.resolveManualDiscountReasonFromSources,
|
|
50
57
|
resolveManualOverrideLineOriginalPrice: () => resolveManualOverrideLineOriginalPrice,
|
|
51
58
|
resolveRulesManualDiscountFlag: () => resolveRulesManualDiscountFlag,
|
|
59
|
+
resolveSafeProductNum: () => import_manualProductDiscount.resolveSafeProductNum,
|
|
52
60
|
resolveSubmitCollectPax: () => resolveSubmitCollectPax,
|
|
53
|
-
|
|
61
|
+
shouldBuildManualProductDiscount: () => import_manualProductDiscount.shouldBuildManualProductDiscount,
|
|
62
|
+
stripManualProductDiscountItems: () => import_manualProductDiscount.stripManualProductDiscountItems,
|
|
63
|
+
sumOptionUnitPrice: () => sumOptionUnitPrice,
|
|
64
|
+
syncManualProductDiscountProductNum: () => import_manualProductDiscount.syncManualProductDiscountProductNum
|
|
54
65
|
});
|
|
55
66
|
module.exports = __toCommonJS(utils_exports);
|
|
56
67
|
var import_dayjs = __toESM(require("dayjs"));
|
|
57
68
|
var import_decimal = __toESM(require("decimal.js"));
|
|
58
69
|
var import_utils = require("../../solution/ScanOrder/utils");
|
|
59
70
|
var import_utils2 = require("../../solution/ScanOrder/utils");
|
|
71
|
+
var import_manualProductDiscount = require("./utils/manualProductDiscount");
|
|
60
72
|
function composeLinePrice(params) {
|
|
61
73
|
const { mainPrice, bundle, useOriginalBundle } = params;
|
|
62
74
|
let total = new import_decimal.default(Number(mainPrice) || 0);
|
|
@@ -102,14 +114,21 @@ function resolveManualOverrideLineOriginalPrice(params, fallbackCompositeOrigina
|
|
|
102
114
|
return fallbackCompositeOriginal;
|
|
103
115
|
}
|
|
104
116
|
const refTotal = (_b = (_a = metadata.origin) == null ? void 0 : _a._extend) == null ? void 0 : _b.origin_total;
|
|
105
|
-
if (refTotal
|
|
106
|
-
|
|
117
|
+
if (refTotal !== void 0 && refTotal !== null && refTotal !== "") {
|
|
118
|
+
const parsed = Number(refTotal);
|
|
119
|
+
if (Number.isFinite(parsed)) {
|
|
120
|
+
return new import_decimal.default(parsed).toDecimalPlaces(2).toFixed(2);
|
|
121
|
+
}
|
|
107
122
|
}
|
|
108
|
-
const
|
|
109
|
-
if (
|
|
110
|
-
|
|
123
|
+
const lineOriginal = params.lineOriginalPrice;
|
|
124
|
+
if (lineOriginal !== void 0 && lineOriginal !== null && lineOriginal !== "") {
|
|
125
|
+
const parsedLine = Number(lineOriginal);
|
|
126
|
+
const parsedFallback = Number(fallbackCompositeOriginal);
|
|
127
|
+
if (Number.isFinite(parsedLine) && Number.isFinite(parsedFallback) && parsedLine > parsedFallback) {
|
|
128
|
+
return new import_decimal.default(parsedLine).toDecimalPlaces(2).toFixed(2);
|
|
129
|
+
}
|
|
111
130
|
}
|
|
112
|
-
return
|
|
131
|
+
return fallbackCompositeOriginal;
|
|
113
132
|
}
|
|
114
133
|
function createDefaultOrderRulesHooks() {
|
|
115
134
|
const toUnitPriceString = (totalLike, num) => {
|
|
@@ -194,7 +213,7 @@ function createDefaultOrderRulesHooks() {
|
|
|
194
213
|
useOriginalBundle: true
|
|
195
214
|
});
|
|
196
215
|
const finalOriginalPrice = resolveManualOverrideLineOriginalPrice(
|
|
197
|
-
{ num: nextNum, metadata: metadataAny },
|
|
216
|
+
{ num: nextNum, metadata: metadataAny, lineOriginalPrice: product.original_price },
|
|
198
217
|
composedOriginalPrice
|
|
199
218
|
);
|
|
200
219
|
return {
|
|
@@ -358,6 +377,11 @@ function normalizeSubmitProduct(product) {
|
|
|
358
377
|
num,
|
|
359
378
|
product_option_item: productOptionItem,
|
|
360
379
|
surcharge_fee: _productSurchargeFee,
|
|
380
|
+
discount_amount: _deprecatedDiscountAmount,
|
|
381
|
+
discount_type: _deprecatedDiscountType,
|
|
382
|
+
discountway: _deprecatedDiscountway,
|
|
383
|
+
product_discount_reason: _deprecatedProductDiscountReason,
|
|
384
|
+
discount_per: _deprecatedDiscountPer,
|
|
361
385
|
...productRest
|
|
362
386
|
} = submitProduct;
|
|
363
387
|
const rawMetadata = submitProduct.metadata || {};
|
|
@@ -478,6 +502,7 @@ function createDefaultTempOrder(params) {
|
|
|
478
502
|
country_calling_code: "",
|
|
479
503
|
phone: "",
|
|
480
504
|
email: "",
|
|
505
|
+
customer: null,
|
|
481
506
|
is_price_include_tax: 1,
|
|
482
507
|
tax_title: "",
|
|
483
508
|
tax_country_code: "",
|
|
@@ -572,7 +597,7 @@ function buildSubmitPayload(params) {
|
|
|
572
597
|
note: tempOrder.note || "",
|
|
573
598
|
delivery_type: tempOrder.delivery_type || "nil",
|
|
574
599
|
schedule_date: scheduleDate,
|
|
575
|
-
created_at: tempOrder.created_at || formatDateTime(now),
|
|
600
|
+
// created_at: tempOrder.created_at || formatDateTime(now), 和后端协定这个字段先不提交到接口
|
|
576
601
|
bookings: (tempOrder.bookings || []).filter(
|
|
577
602
|
(booking) => Number(booking.parent_id) !== 0
|
|
578
603
|
).map((booking) => normalizeSubmitBooking(booking)),
|
|
@@ -660,12 +685,15 @@ function formatV1Product(products) {
|
|
|
660
685
|
}
|
|
661
686
|
// Annotate the CommonJS export names for ESM import in node:
|
|
662
687
|
0 && (module.exports = {
|
|
688
|
+
buildManualProductDiscountItem,
|
|
663
689
|
buildSubmitPayload,
|
|
664
690
|
composeLinePrice,
|
|
665
691
|
createDefaultOrderRulesHooks,
|
|
666
692
|
createDefaultTempOrder,
|
|
667
693
|
createEmptySummary,
|
|
668
694
|
createUuidV4,
|
|
695
|
+
ensureManualProductDiscountList,
|
|
696
|
+
findManualProductDiscountItem,
|
|
669
697
|
formatDateTime,
|
|
670
698
|
formatV1Product,
|
|
671
699
|
generateDuration,
|
|
@@ -673,13 +701,21 @@ function formatV1Product(products) {
|
|
|
673
701
|
isTempOrder,
|
|
674
702
|
mapPaymentItemToOrderPayment,
|
|
675
703
|
mapPaymentItemsToOrderPayments,
|
|
704
|
+
mergeManualProductDiscountIntoList,
|
|
676
705
|
mergeRelationForms,
|
|
677
706
|
normalizeBookingIsAll,
|
|
678
707
|
normalizeBookingSubType,
|
|
679
708
|
normalizeSubmitBooking,
|
|
680
709
|
normalizeSubmitCollectPaxValue,
|
|
710
|
+
resolveManualDiscountMessage,
|
|
711
|
+
resolveManualDiscountOriginTotal,
|
|
712
|
+
resolveManualDiscountReasonFromSources,
|
|
681
713
|
resolveManualOverrideLineOriginalPrice,
|
|
682
714
|
resolveRulesManualDiscountFlag,
|
|
715
|
+
resolveSafeProductNum,
|
|
683
716
|
resolveSubmitCollectPax,
|
|
684
|
-
|
|
717
|
+
shouldBuildManualProductDiscount,
|
|
718
|
+
stripManualProductDiscountItems,
|
|
719
|
+
sumOptionUnitPrice,
|
|
720
|
+
syncManualProductDiscountProductNum
|
|
685
721
|
});
|
|
@@ -32,6 +32,10 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
32
32
|
unavailableReason?: UnavailableReason;
|
|
33
33
|
};
|
|
34
34
|
filterDiscountListByType(discountList: Discount[], type: string): Discount[];
|
|
35
|
+
/** 剔除指定 type/tag 的折扣项,保留手动改价(type=product) / 券等 */
|
|
36
|
+
excludeDiscountListByType(discountList: Discount[], type: string): Discount[];
|
|
37
|
+
/** 手动改价场景:去掉 promotion,保留 type=product 等行内折扣 */
|
|
38
|
+
resolveDiscountListForManualOverride(discountList: Discount[]): Discount[];
|
|
35
39
|
private getUnavailableReason;
|
|
36
40
|
calcDiscount({ discountList, productList, holders, isFormSubject, orderTotalAmount }: {
|
|
37
41
|
discountList: Discount[];
|
|
@@ -159,6 +159,14 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
159
159
|
filterDiscountListByType(discountList, type) {
|
|
160
160
|
return (discountList || []).filter((item) => item.type === type || item.tag === type);
|
|
161
161
|
}
|
|
162
|
+
/** 剔除指定 type/tag 的折扣项,保留手动改价(type=product) / 券等 */
|
|
163
|
+
excludeDiscountListByType(discountList, type) {
|
|
164
|
+
return (discountList || []).filter((item) => item.type !== type && item.tag !== type);
|
|
165
|
+
}
|
|
166
|
+
/** 手动改价场景:去掉 promotion,保留 type=product 等行内折扣 */
|
|
167
|
+
resolveDiscountListForManualOverride(discountList) {
|
|
168
|
+
return this.excludeDiscountListByType(discountList, "promotion");
|
|
169
|
+
}
|
|
162
170
|
// 获取券不可用的原因
|
|
163
171
|
getUnavailableReason(discountList, productList) {
|
|
164
172
|
var _a;
|
|
@@ -673,7 +681,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
673
681
|
}, 0);
|
|
674
682
|
};
|
|
675
683
|
sortedFlattenedList.forEach((flatItem, index) => {
|
|
676
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
|
|
684
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G;
|
|
677
685
|
let product, originProduct;
|
|
678
686
|
if (flatItem.type === "main") {
|
|
679
687
|
product = flatItem.product;
|
|
@@ -896,7 +904,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
896
904
|
price: product.price,
|
|
897
905
|
options: restoredOptions
|
|
898
906
|
},
|
|
899
|
-
discount_list: this.filterDiscountListByType(product.discount_list, "promotion")
|
|
907
|
+
discount_list: isManualDiscount ? this.resolveDiscountListForManualOverride(product.discount_list) : this.filterDiscountListByType(product.discount_list, "promotion")
|
|
900
908
|
})
|
|
901
909
|
]);
|
|
902
910
|
} else {
|
|
@@ -918,14 +926,14 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
918
926
|
main_product_selling_price,
|
|
919
927
|
options: restoredOptions
|
|
920
928
|
},
|
|
921
|
-
discount_list: this.filterDiscountListByType(product.discount_list, "promotion")
|
|
929
|
+
discount_list: isManualDiscount ? this.resolveDiscountListForManualOverride(product.discount_list) : this.filterDiscountListByType(product.discount_list, "promotion")
|
|
922
930
|
})
|
|
923
931
|
]);
|
|
924
932
|
}
|
|
925
933
|
} else {
|
|
926
934
|
processedFlatItemsMap.set(flatItem._id, [{
|
|
927
935
|
...flatItem,
|
|
928
|
-
discount_list: this.
|
|
936
|
+
discount_list: isManualDiscount ? this.resolveDiscountListForManualOverride(((_v = flatItem.bundleItem) == null ? void 0 : _v.discount_list) || []) : this.filterDiscountListByType(((_w = flatItem.bundleItem) == null ? void 0 : _w.discount_list) || [], "promotion"),
|
|
929
937
|
price: isManualDiscount ? flatItem.bundleItem.price : flatItem.bundleItem.original_price,
|
|
930
938
|
processed: true
|
|
931
939
|
}]);
|
|
@@ -976,13 +984,13 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
976
984
|
if (this.filterDiscountListByType(product.discount_list, "promotion").length && product.origin_total) {
|
|
977
985
|
productOriginTotal = product.origin_total;
|
|
978
986
|
}
|
|
979
|
-
if (Number(((
|
|
987
|
+
if (Number(((_x = originProduct == null ? void 0 : originProduct._productInit) == null ? void 0 : _x.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
|
|
980
988
|
productOriginTotal = product.total;
|
|
981
989
|
}
|
|
982
990
|
const isOrderLevel = (0, import_utils3.isOrderLevelFixedAmountDiscount)(selectedDiscount2);
|
|
983
991
|
const orderLevelAllocation = isOrderLevel ? orderLevelDiscountAllocations.get(selectedDiscount2.id) : null;
|
|
984
992
|
const productAllocation = orderLevelAllocation == null ? void 0 : orderLevelAllocation.get(flatItem._id);
|
|
985
|
-
const isDeductOptionPrice = !!((
|
|
993
|
+
const isDeductOptionPrice = !!((_y = selectedDiscount2.config) == null ? void 0 : _y.deductOptionPrice);
|
|
986
994
|
let mainProductSellingPrice;
|
|
987
995
|
let amount;
|
|
988
996
|
let productDiscountDifference;
|
|
@@ -1000,7 +1008,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1000
1008
|
);
|
|
1001
1009
|
amount = new import_decimal.default(product.price).minus(new import_decimal.default(mainProductSellingPrice)).toNumber();
|
|
1002
1010
|
}
|
|
1003
|
-
if (isDeductOptionPrice && ((
|
|
1011
|
+
if (isDeductOptionPrice && ((_z = product.options) == null ? void 0 : _z.length)) {
|
|
1004
1012
|
const optionResult = applyDiscountToOptions(
|
|
1005
1013
|
product.options,
|
|
1006
1014
|
selectedDiscount2
|
|
@@ -1008,7 +1016,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1008
1016
|
discountedOptions = optionResult.discountedOptions;
|
|
1009
1017
|
optionDiscountAmount = optionResult.optionDiscountAmount;
|
|
1010
1018
|
}
|
|
1011
|
-
const optionsForLineTotal = isDeductOptionPrice && ((
|
|
1019
|
+
const optionsForLineTotal = isDeductOptionPrice && ((_A = product.options) == null ? void 0 : _A.length) ? discountedOptions : product.options;
|
|
1012
1020
|
const optionsLineTotal = getOptionTotal(optionsForLineTotal || []);
|
|
1013
1021
|
const total = new import_decimal.default(mainProductSellingPrice).plus(optionsLineTotal).toNumber();
|
|
1014
1022
|
const mainProductDiscountAmount = amount;
|
|
@@ -1019,9 +1027,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1019
1027
|
amount: lineDiscountAmount,
|
|
1020
1028
|
type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : discountType,
|
|
1021
1029
|
discount: {
|
|
1022
|
-
discount_card_type: (
|
|
1030
|
+
discount_card_type: (_B = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _B.discount_card_type,
|
|
1023
1031
|
fixed_amount: lineDiscountAmount,
|
|
1024
|
-
discount_calculation_mode: (
|
|
1032
|
+
discount_calculation_mode: (_C = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _C.discount_calculation_mode,
|
|
1025
1033
|
resource_id: selectedDiscount2.id,
|
|
1026
1034
|
title: selectedDiscount2.format_title,
|
|
1027
1035
|
original_amount: product.price,
|
|
@@ -1103,7 +1111,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1103
1111
|
type: "good_pass",
|
|
1104
1112
|
discount: {
|
|
1105
1113
|
fixed_amount: product.origin_total,
|
|
1106
|
-
discount_calculation_mode: (
|
|
1114
|
+
discount_calculation_mode: (_D = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _D.discount_calculation_mode,
|
|
1107
1115
|
resource_id: selectedDiscount2.id,
|
|
1108
1116
|
title: selectedDiscount2.format_title,
|
|
1109
1117
|
original_amount: product.origin_total,
|
|
@@ -1177,9 +1185,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1177
1185
|
amount: fixedAmountPerItem * (product.num || 1),
|
|
1178
1186
|
type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag,
|
|
1179
1187
|
discount: {
|
|
1180
|
-
discount_card_type: (
|
|
1188
|
+
discount_card_type: (_E = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _E.discount_card_type,
|
|
1181
1189
|
fixed_amount: fixedAmountPerItem,
|
|
1182
|
-
discount_calculation_mode: (
|
|
1190
|
+
discount_calculation_mode: (_F = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _F.discount_calculation_mode,
|
|
1183
1191
|
resource_id: selectedDiscount2.id,
|
|
1184
1192
|
title: selectedDiscount2.format_title,
|
|
1185
1193
|
original_amount: product.original_price,
|
|
@@ -1195,7 +1203,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1195
1203
|
...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference }
|
|
1196
1204
|
},
|
|
1197
1205
|
config: selectedDiscount2 == null ? void 0 : selectedDiscount2.config,
|
|
1198
|
-
_num: (product.num || 1) * (((
|
|
1206
|
+
_num: (product.num || 1) * (((_G = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _G.num) || 1)
|
|
1199
1207
|
};
|
|
1200
1208
|
const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
|
|
1201
1209
|
appliedProducts.push(discountDetail);
|
|
@@ -33,6 +33,13 @@ __export(filterOrders_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(filterOrders_exports);
|
|
35
35
|
var import_dayjs = __toESM(require("dayjs"));
|
|
36
|
+
function getOrderPaymentCodes(order) {
|
|
37
|
+
const payments = order.payments;
|
|
38
|
+
if (!Array.isArray(payments) || payments.length === 0) {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
return payments.map((item) => item == null ? void 0 : item.code).filter((code) => typeof code === "string" && code.length > 0);
|
|
42
|
+
}
|
|
36
43
|
function filterOrders(orders, filters) {
|
|
37
44
|
const safeFilters = filters || {};
|
|
38
45
|
if (!orders || !Array.isArray(orders)) {
|
|
@@ -133,26 +140,27 @@ function filterOrders(orders, filters) {
|
|
|
133
140
|
}
|
|
134
141
|
}
|
|
135
142
|
if (safeFilters.payment_methods && safeFilters.payment_methods.length > 0) {
|
|
136
|
-
|
|
143
|
+
const orderPaymentCodes = getOrderPaymentCodes(order);
|
|
144
|
+
if (orderPaymentCodes.length === 0) {
|
|
137
145
|
rejected.push({
|
|
138
146
|
order_id: order.order_id,
|
|
139
147
|
order_number: order.order_number,
|
|
140
148
|
reason: {
|
|
141
149
|
field: "payment_methods",
|
|
142
|
-
actual: order.
|
|
150
|
+
actual: order.payments,
|
|
143
151
|
expected: safeFilters.payment_methods
|
|
144
152
|
}
|
|
145
153
|
});
|
|
146
154
|
return false;
|
|
147
155
|
}
|
|
148
|
-
const hasMatch =
|
|
156
|
+
const hasMatch = orderPaymentCodes.some((code) => safeFilters.payment_methods.includes(code));
|
|
149
157
|
if (!hasMatch) {
|
|
150
158
|
rejected.push({
|
|
151
159
|
order_id: order.order_id,
|
|
152
160
|
order_number: order.order_number,
|
|
153
161
|
reason: {
|
|
154
162
|
field: "payment_methods",
|
|
155
|
-
actual:
|
|
163
|
+
actual: orderPaymentCodes,
|
|
156
164
|
expected: safeFilters.payment_methods
|
|
157
165
|
}
|
|
158
166
|
});
|
|
@@ -780,6 +780,12 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
780
780
|
tempOrder.discount_list = (nextDiscountList || []).filter((d) => d.isSelected);
|
|
781
781
|
await this.store.order.recalculateSummary({ createIfMissing: true });
|
|
782
782
|
this.store.order.persistTempOrder();
|
|
783
|
+
this.effectsEmit("onDiscountApplied", {
|
|
784
|
+
productList: tempOrder.products,
|
|
785
|
+
discountList: nextDiscountList,
|
|
786
|
+
selectedDiscountList: tempOrder.discount_list,
|
|
787
|
+
tempOrder
|
|
788
|
+
});
|
|
783
789
|
} catch (error) {
|
|
784
790
|
throw error;
|
|
785
791
|
}
|
|
@@ -22,6 +22,7 @@ __export(transformBaseProductToOrderProduct_exports, {
|
|
|
22
22
|
transformBaseProductToOrderProduct: () => transformBaseProductToOrderProduct
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(transformBaseProductToOrderProduct_exports);
|
|
25
|
+
var import_manualProductDiscount = require("../../../modules/Order/utils/manualProductDiscount");
|
|
25
26
|
function toNumber(value, fallback = 0) {
|
|
26
27
|
const parsedValue = Number(value);
|
|
27
28
|
if (!Number.isFinite(parsedValue))
|
|
@@ -87,7 +88,7 @@ function findVariantById(origin, variantId) {
|
|
|
87
88
|
return variants.find((variant) => Number(variant == null ? void 0 : variant.id) === variantId) || null;
|
|
88
89
|
}
|
|
89
90
|
function transformBaseProductToOrderProduct(params) {
|
|
90
|
-
var _a, _b, _c;
|
|
91
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
91
92
|
const { payload, fallbackProductId = null } = params;
|
|
92
93
|
if (!payload || typeof payload !== "object")
|
|
93
94
|
return null;
|
|
@@ -124,6 +125,39 @@ function transformBaseProductToOrderProduct(params) {
|
|
|
124
125
|
hasPriceOverride
|
|
125
126
|
);
|
|
126
127
|
const uniqueIdentificationNumber = payload.unique_identification_number ?? payload.unique;
|
|
128
|
+
const resolvedQuantity = toSafePositiveInt(payload.quantity ?? payload.num, 1);
|
|
129
|
+
const originTotal = (0, import_manualProductDiscount.resolveManualDiscountOriginTotal)({
|
|
130
|
+
originTotal: payload.origin_total,
|
|
131
|
+
extendOriginTotal: (_d = payload._extend) == null ? void 0 : _d.origin_total,
|
|
132
|
+
originExtendOriginTotal: (_e = origin == null ? void 0 : origin._extend) == null ? void 0 : _e.origin_total,
|
|
133
|
+
sourceExtendOriginTotal: (_f = sourceProduct == null ? void 0 : sourceProduct._extend) == null ? void 0 : _f.origin_total,
|
|
134
|
+
catalogUnitPrice: (origin == null ? void 0 : origin.base_price) ?? (origin == null ? void 0 : origin.price) ?? (sourceProduct == null ? void 0 : sourceProduct.base_price) ?? (sourceProduct == null ? void 0 : sourceProduct.price),
|
|
135
|
+
quantity: resolvedQuantity
|
|
136
|
+
});
|
|
137
|
+
const sellingTotal = Number(
|
|
138
|
+
payload.line_total ?? payload.total ?? ((_g = payload._extend) == null ? void 0 : _g.total) ?? lineCompositeTotal
|
|
139
|
+
);
|
|
140
|
+
const discountReason = (0, import_manualProductDiscount.resolveManualDiscountReasonFromSources)({
|
|
141
|
+
discountReason: payload.discount_reason,
|
|
142
|
+
extendDiscountReason: (_h = payload._extend) == null ? void 0 : _h.discount_reason,
|
|
143
|
+
originExtendDiscountReason: (_i = origin == null ? void 0 : origin._extend) == null ? void 0 : _i.discount_reason
|
|
144
|
+
});
|
|
145
|
+
const lineOriginalPrice = hasPriceOverride && Number.isFinite(originTotal) ? toPriceString(originTotal) : lineCompositeTotal;
|
|
146
|
+
const manualDiscountList = (0, import_manualProductDiscount.shouldBuildManualProductDiscount)({
|
|
147
|
+
hasPriceOverride,
|
|
148
|
+
originTotal,
|
|
149
|
+
sellingTotal
|
|
150
|
+
}) ? (0, import_manualProductDiscount.mergeManualProductDiscountIntoList)(
|
|
151
|
+
payload.discount_list,
|
|
152
|
+
(0, import_manualProductDiscount.buildManualProductDiscountItem)({
|
|
153
|
+
originTotal: Number.isFinite(originTotal) ? originTotal : Number(lineOriginalPrice),
|
|
154
|
+
sellingTotal: Number.isFinite(sellingTotal) ? sellingTotal : Number(lineCompositeTotal),
|
|
155
|
+
quantity: resolvedQuantity,
|
|
156
|
+
message: discountReason,
|
|
157
|
+
discountway: (_j = payload._extend) == null ? void 0 : _j.discountway,
|
|
158
|
+
discount_per: (_k = payload._extend) == null ? void 0 : _k.discount_per
|
|
159
|
+
})
|
|
160
|
+
) : payload.discount_list || [];
|
|
127
161
|
const metadata = {
|
|
128
162
|
unique: payload.unique,
|
|
129
163
|
session: payload.session,
|
|
@@ -138,7 +172,10 @@ function transformBaseProductToOrderProduct(params) {
|
|
|
138
172
|
source_product_price: sourceProductPrice,
|
|
139
173
|
main_product_selling_price: sourceProductPrice,
|
|
140
174
|
main_product_original_price: sourceProductPrice,
|
|
141
|
-
...hasPriceOverride ? {
|
|
175
|
+
...hasPriceOverride ? {
|
|
176
|
+
price_override: String(payload.price_override),
|
|
177
|
+
is_manual_discount: 1
|
|
178
|
+
} : {},
|
|
142
179
|
...payload.bundle_edit !== void 0 ? { bundle_edit: payload.bundle_edit } : {}
|
|
143
180
|
};
|
|
144
181
|
if (uniqueIdentificationNumber) {
|
|
@@ -148,12 +185,13 @@ function transformBaseProductToOrderProduct(params) {
|
|
|
148
185
|
product_id: productId,
|
|
149
186
|
product_variant_id: productVariantId,
|
|
150
187
|
unique_identification_number: uniqueIdentificationNumber ? String(uniqueIdentificationNumber) : void 0,
|
|
151
|
-
num:
|
|
188
|
+
num: resolvedQuantity,
|
|
152
189
|
product_option_item: productOptionItem,
|
|
153
190
|
product_bundle: productBundle,
|
|
191
|
+
discount_list: manualDiscountList,
|
|
154
192
|
// 折后行价由 normalizeOrderProduct 按 main + bundle 合成;手动改价时 bundle 已为分摊后单价
|
|
155
193
|
selling_price: lineCompositeTotal,
|
|
156
|
-
original_price:
|
|
194
|
+
original_price: lineOriginalPrice,
|
|
157
195
|
tax_fee: toPriceString(
|
|
158
196
|
payload.tax_fee ?? (matchedVariant == null ? void 0 : matchedVariant.tax_fee) ?? (origin == null ? void 0 : origin.tax_fee) ?? (sourceProduct == null ? void 0 : sourceProduct.tax_fee),
|
|
159
197
|
"0.00"
|