@pisell/pisellos 2.2.171 → 2.2.173
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/promotion/index.js +9 -0
- package/dist/modules/BookingContext/index.d.ts +37 -0
- package/dist/modules/BookingContext/index.js +436 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +193 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +137 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +75 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +215 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Customer/index.d.ts +6 -0
- package/dist/modules/Customer/index.js +129 -83
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +2 -4
- package/dist/modules/Discount/index.js +8 -93
- package/dist/modules/Discount/types.d.ts +1 -7
- package/dist/modules/Order/index.d.ts +33 -17
- package/dist/modules/Order/index.js +757 -395
- package/dist/modules/Order/types.d.ts +58 -17
- package/dist/modules/Order/types.js +2 -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 +39 -1
- package/dist/modules/Order/utils.js +219 -31
- package/dist/modules/Quotation/index.js +16 -5
- package/dist/modules/Rules/index.d.ts +4 -0
- package/dist/modules/Rules/index.js +26 -10
- package/dist/modules/SalesSummary/index.js +4 -2
- package/dist/modules/Schedule/index.js +6 -2
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +2 -1
- package/dist/server/index.js +10 -6
- package/dist/server/modules/order/utils/filterOrders.js +20 -6
- package/dist/server/modules/products/index.js +113 -94
- package/dist/server/modules/schedule/index.js +13 -6
- package/dist/solution/BaseSales/index.d.ts +53 -7
- package/dist/solution/BaseSales/index.js +1160 -339
- package/dist/solution/BaseSales/types.d.ts +67 -1
- package/dist/solution/BaseSales/types.js +3 -1
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +65 -15
- package/dist/solution/BaseSales/utils.js +46 -8
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +134 -2
- package/dist/solution/BookingTicket/index.js +776 -175
- package/dist/solution/BookingTicket/types.d.ts +2 -0
- package/dist/solution/BookingTicket/types.js +3 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +113 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
- package/dist/solution/ScanOrder/index.d.ts +9 -3
- package/dist/solution/ScanOrder/index.js +231 -128
- package/dist/solution/ScanOrder/utils.js +46 -8
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +18 -23
- package/dist/solution/VenueBooking/index.d.ts +5 -9
- package/dist/solution/VenueBooking/index.js +103 -55
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/BookingContext/index.d.ts +37 -0
- package/lib/modules/BookingContext/index.js +297 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +34 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +207 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +141 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +75 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +198 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +80 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +43 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +90 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +283 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +377 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
- package/lib/modules/Customer/index.d.ts +6 -0
- package/lib/modules/Customer/index.js +26 -11
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +2 -4
- package/lib/modules/Discount/index.js +8 -63
- package/lib/modules/Discount/types.d.ts +1 -7
- package/lib/modules/Order/index.d.ts +33 -17
- package/lib/modules/Order/index.js +402 -148
- package/lib/modules/Order/types.d.ts +58 -17
- 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 +39 -1
- package/lib/modules/Order/utils.js +197 -22
- package/lib/modules/Quotation/index.js +17 -6
- package/lib/modules/Rules/index.d.ts +4 -0
- package/lib/modules/Rules/index.js +22 -14
- package/lib/modules/SalesSummary/index.js +4 -2
- package/lib/modules/Schedule/index.js +3 -1
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +3 -1
- package/lib/server/index.js +2 -0
- package/lib/server/modules/order/utils/filterOrders.js +12 -4
- package/lib/server/modules/products/index.js +23 -12
- package/lib/server/modules/schedule/index.js +2 -1
- package/lib/solution/BaseSales/index.d.ts +53 -7
- package/lib/solution/BaseSales/index.js +527 -20
- package/lib/solution/BaseSales/types.d.ts +67 -1
- package/lib/solution/BaseSales/types.js +3 -1
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +70 -11
- package/lib/solution/BaseSales/utils.js +46 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +134 -2
- package/lib/solution/BookingTicket/index.js +349 -8
- package/lib/solution/BookingTicket/types.d.ts +2 -0
- package/lib/solution/BookingTicket/types.js +6 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +113 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
- package/lib/solution/ScanOrder/index.d.ts +9 -3
- package/lib/solution/ScanOrder/index.js +147 -66
- package/lib/solution/ScanOrder/utils.js +46 -6
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +2 -4
- package/lib/solution/VenueBooking/index.d.ts +5 -9
- package/lib/solution/VenueBooking/index.js +50 -14
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/package.json +2 -2
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
var _excluded = ["unique_identification_number"],
|
|
2
|
-
_excluded2 = ["num", "product_option_item", "surcharge_fee"],
|
|
3
|
-
_excluded3 = ["_extend", "relation_id", "table_form_id", "resource_id", "summary", "lastOrderInfo", "paid_amount", "shop_id", "shop_note", "shop_service_type", "start_time", "customer", "
|
|
2
|
+
_excluded2 = ["num", "product_option_item", "surcharge_fee", "discount_amount", "discount_type", "discountway", "product_discount_reason", "discount_per"],
|
|
3
|
+
_excluded3 = ["_extend", "relation_id", "table_form_id", "resource_id", "summary", "lastOrderInfo", "paid_amount", "shop_id", "shop_note", "shop_service_type", "start_time", "customer", "discount_list", "tax_fee", "total_amount", "total_refund_amount", "create_date", "holder_id"],
|
|
4
4
|
_excluded4 = ["collect_pax", "table_occupancy_duration"];
|
|
5
5
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
6
6
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
7
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
7
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
9
8
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
9
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
@@ -14,6 +13,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
14
13
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
14
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
15
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
17
17
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
18
18
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
19
19
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
@@ -113,6 +113,90 @@ export function sumOptionUnitPrice(options) {
|
|
|
113
113
|
*
|
|
114
114
|
* 导出为纯函数方便单测直接驱动钩子,不依赖 OrderModule 实例。
|
|
115
115
|
*/
|
|
116
|
+
|
|
117
|
+
/** Rules calcDiscount 用手动价标记;undefined 表示交给 Rules 用 total/origin_total 推断 */
|
|
118
|
+
export function resolveRulesManualDiscountFlag(metadata) {
|
|
119
|
+
if (!metadata) return undefined;
|
|
120
|
+
if (metadata.is_manual_discount === true || metadata.is_manual_discount === 1) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
var priceOverride = metadata.price_override;
|
|
124
|
+
if (priceOverride !== undefined && priceOverride !== null && priceOverride !== '') {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
function normalizeOrderProductDiscountAmount(amount) {
|
|
130
|
+
if (amount === undefined || amount === null) return undefined;
|
|
131
|
+
return String(amount);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* 商品行折扣只保留后端 OrderProductDiscountItem 协议字段。
|
|
136
|
+
* Rules/券计算过程中的 `_num`、`config` 等运行态字段不应进入 tempOrder 或提交 payload。
|
|
137
|
+
*/
|
|
138
|
+
export function normalizeOrderProductDiscountList(discountList) {
|
|
139
|
+
if (!Array.isArray(discountList)) return [];
|
|
140
|
+
return discountList.filter(function (item) {
|
|
141
|
+
return !!item && _typeof(item) === 'object';
|
|
142
|
+
}).map(function (item) {
|
|
143
|
+
var normalized = {
|
|
144
|
+
discount_id: Number.isFinite(Number(item.discount_id)) ? Number(item.discount_id) : 0
|
|
145
|
+
};
|
|
146
|
+
if (item.order_discount_id === null) {
|
|
147
|
+
normalized.order_discount_id = null;
|
|
148
|
+
} else if (item.order_discount_id !== undefined) {
|
|
149
|
+
var orderDiscountId = Number(item.order_discount_id);
|
|
150
|
+
if (Number.isFinite(orderDiscountId)) {
|
|
151
|
+
normalized.order_discount_id = orderDiscountId;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (item.type !== undefined) normalized.type = item.type;
|
|
155
|
+
var amount = normalizeOrderProductDiscountAmount(item.amount);
|
|
156
|
+
if (amount !== undefined) normalized.amount = amount;
|
|
157
|
+
if (item.discount && _typeof(item.discount) === 'object') {
|
|
158
|
+
normalized.discount = _objectSpread({}, item.discount);
|
|
159
|
+
}
|
|
160
|
+
if (item.metadata === null) {
|
|
161
|
+
normalized.metadata = null;
|
|
162
|
+
} else if (item.metadata && _typeof(item.metadata) === 'object') {
|
|
163
|
+
normalized.metadata = _objectSpread({}, item.metadata);
|
|
164
|
+
}
|
|
165
|
+
return normalized;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* 手动改价(price_override)时行级 original_price(composite 单价):
|
|
171
|
+
* 购物车划线价应对齐 metadata.origin._extend.origin_total(改价前单价 composite,如 40),
|
|
172
|
+
* 而非 bundle 子项 catalog 原价合成的 composedOriginalPrice(如 30)。
|
|
173
|
+
*
|
|
174
|
+
* origin_total 与 SkuDetailModal / cacheItem._extend 一致,为单价语义,不再除以 num。
|
|
175
|
+
*/
|
|
176
|
+
export function resolveManualOverrideLineOriginalPrice(params, fallbackCompositeOriginal) {
|
|
177
|
+
var _metadata$origin;
|
|
178
|
+
var metadata = params.metadata || {};
|
|
179
|
+
var priceOverride = metadata.price_override;
|
|
180
|
+
if (priceOverride === undefined || priceOverride === null || priceOverride === '') {
|
|
181
|
+
return fallbackCompositeOriginal;
|
|
182
|
+
}
|
|
183
|
+
var refTotal = (_metadata$origin = metadata.origin) === null || _metadata$origin === void 0 || (_metadata$origin = _metadata$origin._extend) === null || _metadata$origin === void 0 ? void 0 : _metadata$origin.origin_total;
|
|
184
|
+
if (refTotal !== undefined && refTotal !== null && refTotal !== '') {
|
|
185
|
+
var parsed = Number(refTotal);
|
|
186
|
+
if (Number.isFinite(parsed)) {
|
|
187
|
+
return new Decimal(parsed).toDecimalPlaces(2).toFixed(2);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
var lineOriginal = params.lineOriginalPrice;
|
|
191
|
+
if (lineOriginal !== undefined && lineOriginal !== null && lineOriginal !== '') {
|
|
192
|
+
var parsedLine = Number(lineOriginal);
|
|
193
|
+
var parsedFallback = Number(fallbackCompositeOriginal);
|
|
194
|
+
if (Number.isFinite(parsedLine) && Number.isFinite(parsedFallback) && parsedLine > parsedFallback) {
|
|
195
|
+
return new Decimal(parsedLine).toDecimalPlaces(2).toFixed(2);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return fallbackCompositeOriginal;
|
|
199
|
+
}
|
|
116
200
|
export function createDefaultOrderRulesHooks() {
|
|
117
201
|
var toUnitPriceString = function toUnitPriceString(totalLike, num) {
|
|
118
202
|
var effectiveNum = Number(num) > 0 ? Number(num) : 1;
|
|
@@ -120,7 +204,7 @@ export function createDefaultOrderRulesHooks() {
|
|
|
120
204
|
};
|
|
121
205
|
return {
|
|
122
206
|
getProduct: function getProduct(product) {
|
|
123
|
-
var _product$metadata, _product$metadata2, _product$metadata3, _product$metadata4, _product$metadata5
|
|
207
|
+
var _product$metadata, _product$metadata2, _product$metadata3, _product$metadata4, _product$metadata5;
|
|
124
208
|
// source_product_price 是权威源;兜底链:source → mainSelling − options(反推)→ 行 selling_price
|
|
125
209
|
var metadataAny = product.metadata || {};
|
|
126
210
|
var optionSum = sumOptionUnitPrice(product.product_option_item);
|
|
@@ -145,7 +229,7 @@ export function createDefaultOrderRulesHooks() {
|
|
|
145
229
|
id: product.product_id,
|
|
146
230
|
// Rules 引擎用 _id 作为 processedProductsMap 键;必须与购物车行级 identity 一致,
|
|
147
231
|
// 否则同 SKU 不同小料会在 calcDiscount 重组时互相覆盖。
|
|
148
|
-
// 不透明 identity 契约下,normalizeOrderProduct /
|
|
232
|
+
// 不透明 identity 契约下,normalizeOrderProduct / hydrate 已保证唯一值存在;
|
|
149
233
|
// 留 fingerprint 分支仅作 Rules 单测里直接传裸 product 时的兜底。
|
|
150
234
|
_id: (_product$metadata = product.metadata) !== null && _product$metadata !== void 0 && _product$metadata.unique_identification_number ? "".concat(product.product_id, "_").concat(product.product_variant_id, "_").concat(product.metadata.unique_identification_number) : "".concat(product.product_id, "_").concat(product.product_variant_id, "_").concat(buildProductLineFingerprint(product.product_option_item, product.product_bundle)),
|
|
151
235
|
// Rules 内部 getProductTotalPrice / getProductOriginTotalPrice 会各自再叠加 bundle + option,
|
|
@@ -161,9 +245,11 @@ export function createDefaultOrderRulesHooks() {
|
|
|
161
245
|
bundle: product.product_bundle || [],
|
|
162
246
|
booking_id: ((_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.booking_id) || null,
|
|
163
247
|
isClient: false,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
248
|
+
// 勿写死 false:否则 Rules 不会走 total≠origin_total 的手动价推断,
|
|
249
|
+
// 无券时会把 bundle 价还原成 original_price(手动改价套餐会从 20 回到 30)。
|
|
250
|
+
isManualDiscount: resolveRulesManualDiscountFlag(metadataAny),
|
|
251
|
+
holder_id: (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.holder_id,
|
|
252
|
+
startDate: ((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.start_date) || ((_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.startDate)
|
|
167
253
|
};
|
|
168
254
|
},
|
|
169
255
|
setProduct: function setProduct(product, values) {
|
|
@@ -196,9 +282,14 @@ export function createDefaultOrderRulesHooks() {
|
|
|
196
282
|
bundle: nextBundle,
|
|
197
283
|
useOriginalBundle: true
|
|
198
284
|
});
|
|
285
|
+
var finalOriginalPrice = resolveManualOverrideLineOriginalPrice({
|
|
286
|
+
num: nextNum,
|
|
287
|
+
metadata: metadataAny,
|
|
288
|
+
lineOriginalPrice: product.original_price
|
|
289
|
+
}, composedOriginalPrice);
|
|
199
290
|
return _objectSpread(_objectSpread({}, product), {}, {
|
|
200
291
|
selling_price: composedSellingPrice,
|
|
201
|
-
original_price:
|
|
292
|
+
original_price: finalOriginalPrice,
|
|
202
293
|
discount_list: (_values$discount_list = values.discount_list) !== null && _values$discount_list !== void 0 ? _values$discount_list : product.discount_list,
|
|
203
294
|
num: (_values$quantity2 = values.quantity) !== null && _values$quantity2 !== void 0 ? _values$quantity2 : product.num,
|
|
204
295
|
product_bundle: nextBundle,
|
|
@@ -394,6 +485,11 @@ function normalizeSubmitProduct(product) {
|
|
|
394
485
|
var num = submitProduct.num,
|
|
395
486
|
productOptionItem = submitProduct.product_option_item,
|
|
396
487
|
_productSurchargeFee = submitProduct.surcharge_fee,
|
|
488
|
+
_deprecatedDiscountAmount = submitProduct.discount_amount,
|
|
489
|
+
_deprecatedDiscountType = submitProduct.discount_type,
|
|
490
|
+
_deprecatedDiscountway = submitProduct.discountway,
|
|
491
|
+
_deprecatedProductDiscountReason = submitProduct.product_discount_reason,
|
|
492
|
+
_deprecatedDiscountPer = submitProduct.discount_per,
|
|
397
493
|
productRest = _objectWithoutProperties(submitProduct, _excluded2);
|
|
398
494
|
var rawMetadata = submitProduct.metadata || {};
|
|
399
495
|
var bookingUid = rawMetadata.booking_uid;
|
|
@@ -423,7 +519,7 @@ function normalizeSubmitProduct(product) {
|
|
|
423
519
|
} : {}), {}, {
|
|
424
520
|
product_quantity: toBundleNumber(num !== null && num !== void 0 ? num : submitProduct.product_quantity, 1),
|
|
425
521
|
product_sku: productSku,
|
|
426
|
-
discount_list: submitProduct.discount_list
|
|
522
|
+
discount_list: normalizeOrderProductDiscountList(submitProduct.discount_list),
|
|
427
523
|
product_bundle: formatSubmitBundleItems(submitProduct.product_bundle),
|
|
428
524
|
metadata: cleanMetadata,
|
|
429
525
|
// 出站兼容:后端消费 payment_price 字段,这里从 selling_price 直接派生。
|
|
@@ -502,22 +598,23 @@ export function createDefaultTempOrder(params) {
|
|
|
502
598
|
return {
|
|
503
599
|
order_id: null,
|
|
504
600
|
external_sale_number: '',
|
|
505
|
-
order_number:
|
|
506
|
-
shop_order_number:
|
|
507
|
-
shop_full_order_number:
|
|
508
|
-
type: '
|
|
509
|
-
business_code:
|
|
601
|
+
order_number: null,
|
|
602
|
+
shop_order_number: null,
|
|
603
|
+
shop_full_order_number: null,
|
|
604
|
+
type: '',
|
|
605
|
+
business_code: undefined,
|
|
510
606
|
platform: 'h5',
|
|
511
607
|
sales_channel: 'my_pisel',
|
|
512
608
|
order_sales_channel: 'online_store',
|
|
513
609
|
status: 'normal',
|
|
514
610
|
payment_status: 'payment_processing',
|
|
515
611
|
shipping_status: 'unfulfilled',
|
|
516
|
-
customer_id:
|
|
612
|
+
customer_id: 0,
|
|
517
613
|
customer_name: '',
|
|
518
614
|
country_calling_code: '',
|
|
519
615
|
phone: '',
|
|
520
616
|
email: '',
|
|
617
|
+
customer: null,
|
|
521
618
|
is_price_include_tax: 1,
|
|
522
619
|
tax_title: '',
|
|
523
620
|
tax_country_code: '',
|
|
@@ -536,7 +633,6 @@ export function createDefaultTempOrder(params) {
|
|
|
536
633
|
bookings: [],
|
|
537
634
|
payments: [],
|
|
538
635
|
surcharges: [],
|
|
539
|
-
discount_list: [],
|
|
540
636
|
relation_forms: [],
|
|
541
637
|
contacts: [],
|
|
542
638
|
contacts_info: null,
|
|
@@ -548,7 +644,7 @@ export function createDefaultTempOrder(params) {
|
|
|
548
644
|
};
|
|
549
645
|
}
|
|
550
646
|
export function buildSubmitPayload(params) {
|
|
551
|
-
var
|
|
647
|
+
var _tempOrder$customer_i, _ref10, _tempOrder$is_price_i, _tempOrder$is_deposit;
|
|
552
648
|
var tempOrder = params.tempOrder,
|
|
553
649
|
cacheId = params.cacheId,
|
|
554
650
|
_params$now = params.now,
|
|
@@ -573,20 +669,34 @@ export function buildSubmitPayload(params) {
|
|
|
573
669
|
_shopServiceType = _ref9.shop_service_type,
|
|
574
670
|
_startTime = _ref9.start_time,
|
|
575
671
|
_customer = _ref9.customer,
|
|
576
|
-
|
|
672
|
+
_discountList = _ref9.discount_list,
|
|
577
673
|
_rootTaxFee = _ref9.tax_fee,
|
|
578
674
|
_totalAmount = _ref9.total_amount,
|
|
579
675
|
_totalRefundAmount = _ref9.total_refund_amount,
|
|
580
676
|
_createDate = _ref9.create_date,
|
|
581
677
|
_holderId = _ref9.holder_id,
|
|
582
678
|
tempOrderRest = _objectWithoutProperties(_ref9, _excluded3);
|
|
679
|
+
var submitType = type !== null && type !== void 0 ? type : tempOrder.type;
|
|
680
|
+
if (!submitType) {
|
|
681
|
+
var _tempOrder$bookings;
|
|
682
|
+
// 如果外部没有传递 types,根据订单里当前是否有 bookings 来决定是 appointment_booking 还是 virtual
|
|
683
|
+
if (tempOrder !== null && tempOrder !== void 0 && (_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 && _tempOrder$bookings.length) {
|
|
684
|
+
submitType = 'appointment_booking';
|
|
685
|
+
} else {
|
|
686
|
+
submitType = 'virtual';
|
|
687
|
+
}
|
|
688
|
+
}
|
|
583
689
|
var payload = _objectSpread(_objectSpread({}, tempOrderRest), {}, {
|
|
690
|
+
customer_id: (_tempOrder$customer_i = tempOrder.customer_id) !== null && _tempOrder$customer_i !== void 0 ? _tempOrder$customer_i : 0,
|
|
691
|
+
order_number: null,
|
|
692
|
+
shop_order_number: null,
|
|
693
|
+
shop_full_order_number: null,
|
|
584
694
|
platform: normalizeSubmitPlatform(platform),
|
|
585
695
|
request_unique_idempotency_token: tempOrder.request_unique_idempotency_token || "".concat(tempOrder.external_sale_number, "_").concat(now.getTime()),
|
|
586
|
-
type:
|
|
587
|
-
business_code:
|
|
696
|
+
type: submitType,
|
|
697
|
+
business_code: businessCode !== null && businessCode !== void 0 ? businessCode : tempOrder.business_code,
|
|
588
698
|
sales_channel: tempOrder.sales_channel || 'my_pisel',
|
|
589
|
-
order_sales_channel: (
|
|
699
|
+
order_sales_channel: (_ref10 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref10 !== void 0 ? _ref10 : 'online_store',
|
|
590
700
|
status: tempOrder.status || 'normal',
|
|
591
701
|
payment_status: tempOrder.payment_status || 'payment_processing',
|
|
592
702
|
// shipping_status: tempOrder.shipping_status || 'unfulfilled',
|
|
@@ -599,25 +709,23 @@ export function buildSubmitPayload(params) {
|
|
|
599
709
|
note: tempOrder.note || '',
|
|
600
710
|
delivery_type: tempOrder.delivery_type || 'nil',
|
|
601
711
|
schedule_date: scheduleDate,
|
|
602
|
-
created_at: tempOrder.created_at || formatDateTime(now),
|
|
712
|
+
// created_at: tempOrder.created_at || formatDateTime(now), 和后端协定这个字段先不提交到接口
|
|
603
713
|
bookings: (tempOrder.bookings || []).filter(function (booking) {
|
|
604
|
-
|
|
605
|
-
return Number((_parent_id = booking.parent_id) !== null && _parent_id !== void 0 ? _parent_id : 0) !== 0;
|
|
714
|
+
return Number(booking.parent_id) !== 0;
|
|
606
715
|
}).map(function (booking) {
|
|
607
716
|
return normalizeSubmitBooking(booking);
|
|
608
717
|
}),
|
|
609
718
|
payments: tempOrder.payments || [],
|
|
610
|
-
// discount_list: tempOrder.discount_list || [],
|
|
611
719
|
relation_forms: tempOrder.relation_forms || [],
|
|
612
720
|
// contacts: tempOrder.contacts || [],
|
|
613
721
|
contacts_info: tempOrder.contacts_info && !Array.isArray(tempOrder.contacts_info) ? tempOrder.contacts_info : null,
|
|
614
722
|
// holder: tempOrder.holder || null,
|
|
615
723
|
// summary,
|
|
616
724
|
metadata: function () {
|
|
617
|
-
var
|
|
618
|
-
_collectPax =
|
|
619
|
-
_tableOccupancyDuration =
|
|
620
|
-
rest = _objectWithoutProperties(
|
|
725
|
+
var _ref11 = tempOrder.metadata || {},
|
|
726
|
+
_collectPax = _ref11.collect_pax,
|
|
727
|
+
_tableOccupancyDuration = _ref11.table_occupancy_duration,
|
|
728
|
+
rest = _objectWithoutProperties(_ref11, _excluded4);
|
|
621
729
|
return _objectSpread({}, rest);
|
|
622
730
|
}(),
|
|
623
731
|
products: (tempOrder.products || []).map(function (product) {
|
|
@@ -712,4 +820,84 @@ export function formatV1Product(products) {
|
|
|
712
820
|
};
|
|
713
821
|
});
|
|
714
822
|
}
|
|
715
|
-
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* 判断 holder_id 是否已分配(非空)。
|
|
826
|
+
*
|
|
827
|
+
* @example
|
|
828
|
+
* hasAssignedHolderId(12); // true
|
|
829
|
+
* hasAssignedHolderId([]); // false
|
|
830
|
+
*/
|
|
831
|
+
export function hasAssignedHolderId(value) {
|
|
832
|
+
if (value === undefined || value === null || value === '') return false;
|
|
833
|
+
if (Array.isArray(value)) return value.length > 0;
|
|
834
|
+
return true;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* 清空 tempOrder 购物车行上的 holder 分配(products / bookings / runtime origin)。
|
|
839
|
+
* 移除或更换下单客户时调用,与 booking 页换客户清 holder 行为对齐。
|
|
840
|
+
*
|
|
841
|
+
* @example
|
|
842
|
+
* clearTempOrderHolderAssignments(tempOrder);
|
|
843
|
+
*/
|
|
844
|
+
export function clearTempOrderHolderAssignments(tempOrder) {
|
|
845
|
+
var _tempOrder$_extend;
|
|
846
|
+
var changed = false;
|
|
847
|
+
var resetHolderField = function resetHolderField(target) {
|
|
848
|
+
var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'holder_id';
|
|
849
|
+
if (!hasAssignedHolderId(target[key])) return;
|
|
850
|
+
target[key] = null;
|
|
851
|
+
changed = true;
|
|
852
|
+
};
|
|
853
|
+
var _iterator4 = _createForOfIteratorHelper(tempOrder.products || []),
|
|
854
|
+
_step4;
|
|
855
|
+
try {
|
|
856
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
857
|
+
var product = _step4.value;
|
|
858
|
+
if (product.metadata && _typeof(product.metadata) === 'object') {
|
|
859
|
+
resetHolderField(product.metadata);
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
} catch (err) {
|
|
863
|
+
_iterator4.e(err);
|
|
864
|
+
} finally {
|
|
865
|
+
_iterator4.f();
|
|
866
|
+
}
|
|
867
|
+
var _iterator5 = _createForOfIteratorHelper(tempOrder.bookings || []),
|
|
868
|
+
_step5;
|
|
869
|
+
try {
|
|
870
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
871
|
+
var booking = _step5.value;
|
|
872
|
+
var bookingRecord = booking;
|
|
873
|
+
if (booking.metadata && _typeof(booking.metadata) === 'object') {
|
|
874
|
+
resetHolderField(booking.metadata);
|
|
875
|
+
}
|
|
876
|
+
if (bookingRecord.holder !== undefined && bookingRecord.holder !== null) {
|
|
877
|
+
delete bookingRecord.holder;
|
|
878
|
+
changed = true;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
} catch (err) {
|
|
882
|
+
_iterator5.e(err);
|
|
883
|
+
} finally {
|
|
884
|
+
_iterator5.f();
|
|
885
|
+
}
|
|
886
|
+
var productsByUid = (_tempOrder$_extend = tempOrder._extend) === null || _tempOrder$_extend === void 0 ? void 0 : _tempOrder$_extend.productsByUid;
|
|
887
|
+
if (productsByUid && _typeof(productsByUid) === 'object') {
|
|
888
|
+
for (var _i4 = 0, _Object$values = Object.values(productsByUid); _i4 < _Object$values.length; _i4++) {
|
|
889
|
+
var entry = _Object$values[_i4];
|
|
890
|
+
var origin = entry === null || entry === void 0 ? void 0 : entry.origin;
|
|
891
|
+
if (!origin || _typeof(origin) !== 'object') continue;
|
|
892
|
+
if (origin.metadata && _typeof(origin.metadata) === 'object') {
|
|
893
|
+
resetHolderField(origin.metadata);
|
|
894
|
+
}
|
|
895
|
+
if (origin._extend && _typeof(origin._extend) === 'object') {
|
|
896
|
+
resetHolderField(origin._extend);
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
return changed;
|
|
901
|
+
}
|
|
902
|
+
export { createEmptySummary } from "../../solution/ScanOrder/utils";
|
|
903
|
+
export { buildManualProductDiscountItem, ensureManualProductDiscountList, findManualProductDiscountItem, mergeManualProductDiscountIntoList, resolveManualDiscountMessage, resolveManualDiscountOriginTotal, resolveManualDiscountReasonFromSources, resolveSafeProductNum, shouldBuildManualProductDiscount, syncManualProductDiscountProductNum, stripManualProductDiscountItems } from "./utils/manualProductDiscount";
|
|
@@ -130,8 +130,10 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
130
130
|
try {
|
|
131
131
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
132
132
|
var quotation = _step.value;
|
|
133
|
-
|
|
134
|
-
if (!
|
|
133
|
+
var visible = this.isQuotationVisibleForCustomer(quotation, customer_id);
|
|
134
|
+
if (!visible) continue;
|
|
135
|
+
var active = this.isQuotationActiveAt(quotation, datetime);
|
|
136
|
+
if (!active) continue;
|
|
135
137
|
var match = this.findProductData(quotation.product_data, productId, variantId);
|
|
136
138
|
if (!match) continue;
|
|
137
139
|
if (match.value === 0) continue;
|
|
@@ -248,16 +250,25 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
248
250
|
var _quotation$schedule,
|
|
249
251
|
_this3 = this;
|
|
250
252
|
if (!((_quotation$schedule = quotation.schedule) !== null && _quotation$schedule !== void 0 && _quotation$schedule.length)) return false;
|
|
251
|
-
var scheduleItems =
|
|
253
|
+
var scheduleItems = [];
|
|
254
|
+
quotation.schedule.forEach(function (s) {
|
|
252
255
|
var _this3$scheduleResolv;
|
|
253
256
|
var full = (_this3$scheduleResolv = _this3.scheduleResolver) === null || _this3$scheduleResolv === void 0 ? void 0 : _this3$scheduleResolv.call(_this3, s.id);
|
|
254
|
-
if (full)
|
|
255
|
-
|
|
257
|
+
if (full) {
|
|
258
|
+
scheduleItems.push(full);
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if (_this3.scheduleResolver) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
var fallbackSchedule = _objectSpread(_objectSpread({}, s), {}, {
|
|
256
265
|
repeat_type: s.repeat_type || 'none',
|
|
257
266
|
repeat_rule: s.repeat_rule || null,
|
|
258
267
|
time_slot: s.time_slot || []
|
|
259
268
|
});
|
|
269
|
+
scheduleItems.push(fallbackSchedule);
|
|
260
270
|
});
|
|
271
|
+
if (!scheduleItems.length) return false;
|
|
261
272
|
return getDateIsInSchedule(datetime, scheduleItems);
|
|
262
273
|
}
|
|
263
274
|
}, {
|
|
@@ -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[];
|
|
@@ -222,6 +222,22 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
222
222
|
return item.type === type || item.tag === type;
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
|
+
|
|
226
|
+
/** 剔除指定 type/tag 的折扣项,保留手动改价(type=product) / 券等 */
|
|
227
|
+
}, {
|
|
228
|
+
key: "excludeDiscountListByType",
|
|
229
|
+
value: function excludeDiscountListByType(discountList, type) {
|
|
230
|
+
return (discountList || []).filter(function (item) {
|
|
231
|
+
return item.type !== type && item.tag !== type;
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** 手动改价场景:去掉 promotion,保留 type=product 等行内折扣 */
|
|
236
|
+
}, {
|
|
237
|
+
key: "resolveDiscountListForManualOverride",
|
|
238
|
+
value: function resolveDiscountListForManualOverride(discountList) {
|
|
239
|
+
return this.excludeDiscountListByType(discountList, 'promotion');
|
|
240
|
+
}
|
|
225
241
|
// 获取券不可用的原因
|
|
226
242
|
}, {
|
|
227
243
|
key: "getUnavailableReason",
|
|
@@ -1208,7 +1224,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1208
1224
|
price: product.price,
|
|
1209
1225
|
options: restoredOptions
|
|
1210
1226
|
}), {}, {
|
|
1211
|
-
discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion')
|
|
1227
|
+
discount_list: isManualDiscount ? _this3.resolveDiscountListForManualOverride(product.discount_list) : _this3.filterDiscountListByType(product.discount_list, 'promotion')
|
|
1212
1228
|
}))]);
|
|
1213
1229
|
} else {
|
|
1214
1230
|
var _ref13, _product$_promotion$f, _product13, _product$origin_total;
|
|
@@ -1231,14 +1247,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1231
1247
|
main_product_selling_price: main_product_selling_price,
|
|
1232
1248
|
options: restoredOptions
|
|
1233
1249
|
}), {}, {
|
|
1234
|
-
discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion')
|
|
1250
|
+
discount_list: isManualDiscount ? _this3.resolveDiscountListForManualOverride(product.discount_list) : _this3.filterDiscountListByType(product.discount_list, 'promotion')
|
|
1235
1251
|
}))]);
|
|
1236
1252
|
}
|
|
1237
1253
|
} else {
|
|
1238
|
-
var _flatItem$bundleItem8;
|
|
1254
|
+
var _flatItem$bundleItem8, _flatItem$bundleItem9;
|
|
1239
1255
|
// bundle子商品:保存到扁平化Map
|
|
1240
1256
|
processedFlatItemsMap.set(flatItem._id, [_objectSpread(_objectSpread({}, flatItem), {}, {
|
|
1241
|
-
discount_list: _this3.
|
|
1257
|
+
discount_list: isManualDiscount ? _this3.resolveDiscountListForManualOverride(((_flatItem$bundleItem8 = flatItem.bundleItem) === null || _flatItem$bundleItem8 === void 0 ? void 0 : _flatItem$bundleItem8.discount_list) || []) : _this3.filterDiscountListByType(((_flatItem$bundleItem9 = flatItem.bundleItem) === null || _flatItem$bundleItem9 === void 0 ? void 0 : _flatItem$bundleItem9.discount_list) || [], 'promotion'),
|
|
1242
1258
|
price: isManualDiscount ? flatItem.bundleItem.price : flatItem.bundleItem.original_price,
|
|
1243
1259
|
processed: true
|
|
1244
1260
|
})]);
|
|
@@ -2069,10 +2085,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2069
2085
|
return true; // 单独购买时可用
|
|
2070
2086
|
}
|
|
2071
2087
|
if (isBundleItem) {
|
|
2072
|
-
var _flatItem$
|
|
2088
|
+
var _flatItem$bundleItem10, _flatItem$bundleItem11, _flatItem$originProdu, _flatItem$parentProdu10;
|
|
2073
2089
|
// 套餐中购买时,判断是否为原价
|
|
2074
|
-
var priceType = (_flatItem$
|
|
2075
|
-
var priceTypeExt = (_flatItem$
|
|
2090
|
+
var priceType = (_flatItem$bundleItem10 = flatItem.bundleItem) === null || _flatItem$bundleItem10 === void 0 ? void 0 : _flatItem$bundleItem10.price_type;
|
|
2091
|
+
var priceTypeExt = (_flatItem$bundleItem11 = flatItem.bundleItem) === null || _flatItem$bundleItem11 === void 0 ? void 0 : _flatItem$bundleItem11.price_type_ext;
|
|
2076
2092
|
// 主商品id
|
|
2077
2093
|
var mainProductId = (flatItem === null || flatItem === void 0 || (_flatItem$originProdu = flatItem.originProduct) === null || _flatItem$originProdu === void 0 || (_flatItem$originProdu = _flatItem$originProdu._productOrigin) === null || _flatItem$originProdu === void 0 ? void 0 : _flatItem$originProdu.id) || (flatItem === null || flatItem === void 0 || (_flatItem$parentProdu10 = flatItem.parentProduct) === null || _flatItem$parentProdu10 === void 0 ? void 0 : _flatItem$parentProdu10.id) || 0;
|
|
2078
2094
|
// original_price 对应:
|
|
@@ -2139,10 +2155,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2139
2155
|
return false; // 单独购买时不可用
|
|
2140
2156
|
}
|
|
2141
2157
|
if (isBundleItem) {
|
|
2142
|
-
var _flatItem$
|
|
2158
|
+
var _flatItem$bundleItem12, _flatItem$bundleItem13;
|
|
2143
2159
|
// 套餐中购买时,判断是否为原价
|
|
2144
|
-
var _priceType = (_flatItem$
|
|
2145
|
-
var _priceTypeExt = (_flatItem$
|
|
2160
|
+
var _priceType = (_flatItem$bundleItem12 = flatItem.bundleItem) === null || _flatItem$bundleItem12 === void 0 ? void 0 : _flatItem$bundleItem12.price_type;
|
|
2161
|
+
var _priceTypeExt = (_flatItem$bundleItem13 = flatItem.bundleItem) === null || _flatItem$bundleItem13 === void 0 ? void 0 : _flatItem$bundleItem13.price_type_ext;
|
|
2146
2162
|
|
|
2147
2163
|
// original_price 对应:
|
|
2148
2164
|
// 1. price_type: "markup" && price_type_ext: "product_price"
|
|
@@ -27,7 +27,8 @@ export * from "./types";
|
|
|
27
27
|
var salesSummaryDataKeys = {
|
|
28
28
|
isPriceIncludeTax: 'is_price_include_tax',
|
|
29
29
|
taxRate: 'tax_rate',
|
|
30
|
-
taxTitle: 'tax_title'
|
|
30
|
+
taxTitle: 'tax_title',
|
|
31
|
+
taxCountryCode: 'tax_country_code'
|
|
31
32
|
};
|
|
32
33
|
export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
33
34
|
_inherits(SalesSummaryModule, _BaseModule);
|
|
@@ -135,7 +136,8 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
135
136
|
return {
|
|
136
137
|
isPriceIncludeTax: this.getAppData(salesSummaryDataKeys.isPriceIncludeTax),
|
|
137
138
|
taxRate: this.getAppData(salesSummaryDataKeys.taxRate),
|
|
138
|
-
taxTitle: this.getAppData(salesSummaryDataKeys.taxTitle)
|
|
139
|
+
taxTitle: this.getAppData(salesSummaryDataKeys.taxTitle),
|
|
140
|
+
taxCountryCode: this.getAppData(salesSummaryDataKeys.taxCountryCode)
|
|
139
141
|
};
|
|
140
142
|
}
|
|
141
143
|
}, {
|
|
@@ -205,9 +205,13 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
205
205
|
}, {
|
|
206
206
|
key: "getScheduleListByIds",
|
|
207
207
|
value: function getScheduleListByIds(ids) {
|
|
208
|
-
|
|
209
|
-
return
|
|
208
|
+
var idSet = new Set(ids.map(function (id) {
|
|
209
|
+
return String(id);
|
|
210
|
+
}));
|
|
211
|
+
var list = this.store.scheduleList.filter(function (n) {
|
|
212
|
+
return idSet.has(String(n.id));
|
|
210
213
|
});
|
|
214
|
+
return list;
|
|
211
215
|
}
|
|
212
216
|
}, {
|
|
213
217
|
key: "setAvailabilityScheduleDateList",
|
package/dist/modules/index.d.ts
CHANGED
package/dist/modules/index.js
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -1608,26 +1608,30 @@ var Server = /*#__PURE__*/function () {
|
|
|
1608
1608
|
case 6:
|
|
1609
1609
|
_context18.prev = 6;
|
|
1610
1610
|
_context18.next = 9;
|
|
1611
|
+
return this.schedule.loadAllSchedule();
|
|
1612
|
+
case 9:
|
|
1613
|
+
this.products.clearPriceCache();
|
|
1614
|
+
_context18.next = 12;
|
|
1611
1615
|
return this.products.setupQuotationPriceBridge({
|
|
1612
1616
|
scheduleModule: this.schedule,
|
|
1613
1617
|
channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel
|
|
1614
1618
|
});
|
|
1615
|
-
case
|
|
1619
|
+
case 12:
|
|
1616
1620
|
this.logInfo('Products 报价单价格桥接初始化完成');
|
|
1617
|
-
_context18.next =
|
|
1621
|
+
_context18.next = 19;
|
|
1618
1622
|
break;
|
|
1619
|
-
case
|
|
1620
|
-
_context18.prev =
|
|
1623
|
+
case 15:
|
|
1624
|
+
_context18.prev = 15;
|
|
1621
1625
|
_context18.t0 = _context18["catch"](6);
|
|
1622
1626
|
errorMessage = _context18.t0 instanceof Error ? _context18.t0.message : String(_context18.t0);
|
|
1623
1627
|
this.logError('Products 报价单价格桥接初始化失败', {
|
|
1624
1628
|
error: errorMessage
|
|
1625
1629
|
});
|
|
1626
|
-
case
|
|
1630
|
+
case 19:
|
|
1627
1631
|
case "end":
|
|
1628
1632
|
return _context18.stop();
|
|
1629
1633
|
}
|
|
1630
|
-
}, _callee18, this, [[6,
|
|
1634
|
+
}, _callee18, this, [[6, 15]]);
|
|
1631
1635
|
}));
|
|
1632
1636
|
function setupProductsQuotationPriceBridge() {
|
|
1633
1637
|
return _setupProductsQuotationPriceBridge.apply(this, arguments);
|