@pisell/pisellos 2.2.189 → 2.2.191
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 +0 -9
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -7
- package/dist/modules/Cart/utils/cartProduct.js +13 -2
- package/dist/modules/Order/index.d.ts +1 -3
- package/dist/modules/Order/index.js +88 -114
- package/dist/modules/Order/types.d.ts +10 -6
- package/dist/modules/Order/utils.d.ts +9 -2
- package/dist/modules/Order/utils.js +36 -13
- package/dist/modules/SalesSummary/types.d.ts +3 -1
- package/dist/modules/SalesSummary/utils.js +7 -3
- package/dist/server/modules/order/index.d.ts +126 -6
- package/dist/server/modules/order/index.js +1204 -285
- package/dist/server/modules/order/types.d.ts +0 -2
- package/dist/server/modules/products/index.d.ts +90 -6
- package/dist/server/modules/products/index.js +1017 -361
- package/dist/solution/BaseSales/index.js +54 -39
- package/dist/solution/BaseSales/types.d.ts +8 -5
- package/dist/solution/BaseSales/types.js +2 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +7 -7
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +29 -14
- package/dist/solution/BaseSales/utils.d.ts +1 -1
- package/dist/solution/BaseSales/utils.js +22 -19
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/ScanOrder/index.js +7 -5
- package/dist/solution/ScanOrder/types.d.ts +8 -5
- package/dist/solution/ScanOrder/types.js +2 -3
- package/dist/solution/ScanOrder/utils.d.ts +1 -1
- package/dist/solution/ScanOrder/utils.js +26 -23
- package/dist/solution/VenueBooking/index.js +5 -3
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/lib/modules/Cart/utils/cartProduct.js +9 -2
- package/lib/modules/Order/index.d.ts +1 -3
- package/lib/modules/Order/index.js +50 -63
- package/lib/modules/Order/types.d.ts +10 -6
- package/lib/modules/Order/utils.d.ts +9 -2
- package/lib/modules/Order/utils.js +41 -10
- package/lib/modules/SalesSummary/types.d.ts +3 -1
- package/lib/modules/SalesSummary/utils.js +5 -3
- package/lib/server/modules/order/index.d.ts +126 -6
- package/lib/server/modules/order/index.js +722 -42
- package/lib/server/modules/order/types.d.ts +0 -2
- package/lib/server/modules/products/index.d.ts +90 -6
- package/lib/server/modules/products/index.js +492 -30
- package/lib/solution/BaseSales/index.js +26 -8
- package/lib/solution/BaseSales/types.d.ts +8 -5
- package/lib/solution/BaseSales/utils/cartPromotion.js +6 -6
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +32 -16
- package/lib/solution/BaseSales/utils.d.ts +1 -1
- package/lib/solution/BaseSales/utils.js +11 -7
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/ScanOrder/index.js +4 -4
- package/lib/solution/ScanOrder/types.d.ts +8 -5
- package/lib/solution/ScanOrder/utils.d.ts +1 -1
- package/lib/solution/ScanOrder/utils.js +12 -8
- package/lib/solution/VenueBooking/index.js +2 -2
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/package.json +1 -1
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// 导出评估器
|
|
2
|
-
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
-
|
|
4
|
-
// 导出适配器
|
|
5
|
-
export { PromotionAdapter } from "./adapter";
|
|
6
|
-
export { default } from "./adapter";
|
|
7
|
-
|
|
8
|
-
// 导出策略配置示例常量
|
|
9
|
-
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
|
|
@@ -15,6 +15,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
15
15
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
16
|
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); }
|
|
17
17
|
import dayjs from 'dayjs';
|
|
18
|
+
import { getProductSkuOptions } from "../../Order/utils";
|
|
18
19
|
import { resolveManualDiscountMessage } from "../../Order/utils/manualProductDiscount";
|
|
19
20
|
import { buildProductOptionStringFromOrderLine } from "./orderLineDisplay";
|
|
20
21
|
function safeFormat(value, fmt) {
|
|
@@ -192,7 +193,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
192
193
|
var productOptionString = buildProductOptionStringFromOrderLine(product);
|
|
193
194
|
var other = {
|
|
194
195
|
product_variant_id: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : 0,
|
|
195
|
-
option:
|
|
196
|
+
option: getProductSkuOptions(product),
|
|
196
197
|
bundle: Array.isArray(product.product_bundle) ? _toConsumableArray(product.product_bundle) : []
|
|
197
198
|
};
|
|
198
199
|
var extend = _objectSpread({
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
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); }
|
|
2
2
|
var _excluded = ["bundle_selling_price"];
|
|
3
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
|
-
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."); }
|
|
5
|
-
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); }
|
|
6
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
7
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
|
-
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; }
|
|
9
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
5
|
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; }
|
|
@@ -13,6 +7,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
13
7
|
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); }
|
|
14
8
|
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; }
|
|
15
9
|
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; }
|
|
10
|
+
import { getProductSkuOptions } from "../../Order/utils";
|
|
16
11
|
import { buildProductOptionStringFromOrderLine } from "./orderLineDisplay";
|
|
17
12
|
/**
|
|
18
13
|
* 从已加车的普通商品 order line 反查 SkuDetailModal edit 所需的 cacheItem。
|
|
@@ -84,7 +79,7 @@ export function buildNormalProductCacheItemFromOrderLine(input) {
|
|
|
84
79
|
var selling = Number((_product$selling_pric2 = product.selling_price) !== null && _product$selling_pric2 !== void 0 ? _product$selling_pric2 : 0);
|
|
85
80
|
var original = Number((_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : selling);
|
|
86
81
|
var uid = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number;
|
|
87
|
-
var option =
|
|
82
|
+
var option = getProductSkuOptions(product);
|
|
88
83
|
var bundle = mapOrderBundleToOtherBundle(Array.isArray(product.product_bundle) ? product.product_bundle : []);
|
|
89
84
|
var originExtend = (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 || (_product$metadata2 = _product$metadata2.origin) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2._extend;
|
|
90
85
|
var productOptionString = buildProductOptionStringFromOrderLine(product);
|
|
@@ -183,7 +183,9 @@ export var formatProductToCartItemOrigin = function formatProductToCartItemOrigi
|
|
|
183
183
|
product_id: product.id,
|
|
184
184
|
product_variant_id: product_variant_id || 0,
|
|
185
185
|
product_bundle: ((_origin$product2 = origin.product) === null || _origin$product2 === void 0 ? void 0 : _origin$product2.product_bundle) || [],
|
|
186
|
-
|
|
186
|
+
product_sku: ((_origin$product3 = origin.product) === null || _origin$product3 === void 0 ? void 0 : _origin$product3.product_sku) || {
|
|
187
|
+
option: []
|
|
188
|
+
},
|
|
187
189
|
metadata: {
|
|
188
190
|
product_discount_difference: product_discount_difference
|
|
189
191
|
}
|
|
@@ -196,7 +198,16 @@ export var formatProductToCartItemOrigin = function formatProductToCartItemOrigi
|
|
|
196
198
|
origin.product.product_bundle = formatBundleToOrigin(bundle);
|
|
197
199
|
}
|
|
198
200
|
if (options !== null && options !== void 0 && options.length) {
|
|
199
|
-
origin.product.
|
|
201
|
+
origin.product.product_sku = _objectSpread(_objectSpread({}, origin.product.product_sku || {}), {}, {
|
|
202
|
+
option: formatOptionsToOrigin(options).map(function (option) {
|
|
203
|
+
var _option$add_price;
|
|
204
|
+
var next = _objectSpread(_objectSpread({}, option), {}, {
|
|
205
|
+
add_price: (_option$add_price = option.add_price) !== null && _option$add_price !== void 0 ? _option$add_price : option.price
|
|
206
|
+
});
|
|
207
|
+
delete next.price;
|
|
208
|
+
return next;
|
|
209
|
+
})
|
|
210
|
+
});
|
|
200
211
|
}
|
|
201
212
|
}
|
|
202
213
|
return origin;
|
|
@@ -265,7 +265,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
265
265
|
private logSubmitBackendRejected;
|
|
266
266
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
267
267
|
createOrder(params: CommitOrderParams['query']): {
|
|
268
|
-
type: "
|
|
268
|
+
type: "appointment_booking" | "virtual";
|
|
269
269
|
platform: string;
|
|
270
270
|
sales_channel: string;
|
|
271
271
|
order_sales_channel: string;
|
|
@@ -317,8 +317,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
317
317
|
private formatHydratedNamePair;
|
|
318
318
|
private buildHydratedProductOptionString;
|
|
319
319
|
private normalizeHydratedProductOptionItem;
|
|
320
|
-
private mergeHydratedProductOptionDisplayFields;
|
|
321
|
-
private resolveHydratedProductOptions;
|
|
322
320
|
private normalizeHydratedOrderProduct;
|
|
323
321
|
getLastOrderInfo(): Record<string, any> | undefined;
|
|
324
322
|
getOrderInfo(order_id: number): Promise<any>;
|
|
@@ -30,7 +30,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
30
30
|
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); }
|
|
31
31
|
import { BaseModule } from "../BaseModule";
|
|
32
32
|
import { OrderHooks } from "./types";
|
|
33
|
-
import { composeLinePrice, generateDuration, getAllDiscountList, mergeRelationForms, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, isTempOrder, normalizeBookingIsAll, normalizeBookingSubType, mapPaymentItemsToOrderPayments, normalizeOrderProductDiscountList, resolveEffectivePerUnitDiscount, sumOptionUnitPrice, clearTempOrderHolderAssignments, getOrderProductLineUid, indexOrderProductsByUid, mergeOrderProductDisplayFields } from "./utils";
|
|
33
|
+
import { composeLinePrice, generateDuration, getAllDiscountList, mergeRelationForms, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, isTempOrder, normalizeBookingIsAll, normalizeBookingSubType, mapPaymentItemsToOrderPayments, normalizeOrderProductDiscountList, resolveEffectivePerUnitDiscount, ensureProductSku, getProductSkuOptions, normalizeProductSkuOptions, sumOptionUnitPrice, clearTempOrderHolderAssignments, getOrderProductLineUid, indexOrderProductsByUid, mergeOrderProductDisplayFields } from "./utils";
|
|
34
34
|
import { isNormalProduct } from "../Product/utils";
|
|
35
35
|
import dayjs from 'dayjs';
|
|
36
36
|
import { processCartPromotion, appendPromotionTags as _appendPromotionTags, getOrderProductUid as getPromotionUid } from "../../solution/BaseSales/utils/cartPromotion";
|
|
@@ -87,7 +87,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
87
87
|
var _product$metadata, _product$metadata$sou, _product$metadata2, _product$metadata3, _product$original_pri;
|
|
88
88
|
if ((_product$metadata = product.metadata) !== null && _product$metadata !== void 0 && _product$metadata.is_manual_discount) return product;
|
|
89
89
|
var totalPerUnitDiscount = resolveEffectivePerUnitDiscount(product);
|
|
90
|
-
var optionSum = sumOptionUnitPrice(product
|
|
90
|
+
var optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
|
|
91
91
|
var sourcePrice = (_product$metadata$sou = (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : '0';
|
|
92
92
|
var newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
93
93
|
var newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
@@ -2117,14 +2117,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2117
2117
|
return _regeneratorRuntime().wrap(function _callee16$(_context18) {
|
|
2118
2118
|
while (1) switch (_context18.prev = _context18.next) {
|
|
2119
2119
|
case 0:
|
|
2120
|
-
debugger;
|
|
2121
2120
|
tempOrder = this.ensureTempOrder();
|
|
2122
2121
|
linked = booking ? this.createLinkedProductAndBooking({
|
|
2123
2122
|
product: product,
|
|
2124
2123
|
booking: booking
|
|
2125
2124
|
}) : null;
|
|
2126
2125
|
productToAdd = (linked === null || linked === void 0 ? void 0 : linked.product) || product;
|
|
2127
|
-
incomingFingerprint = buildProductLineFingerprint(productToAdd
|
|
2126
|
+
incomingFingerprint = buildProductLineFingerprint(getProductSkuOptions(productToAdd), productToAdd.product_bundle);
|
|
2128
2127
|
normalizedIncoming = mergeOrderProductDisplayFields(productToAdd, normalizeOrderProduct(productToAdd));
|
|
2129
2128
|
normalizedIncoming.discount_list = normalizeOrderProductDiscountList(normalizedIncoming.discount_list);
|
|
2130
2129
|
hasIncomingGoodPass = this.hasGoodPassDiscount(normalizedIncoming);
|
|
@@ -2133,16 +2132,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2133
2132
|
if (_this9.hasGoodPassDiscount(item)) return false;
|
|
2134
2133
|
if (item.product_id !== productToAdd.product_id) return false;
|
|
2135
2134
|
if (item.product_variant_id !== productToAdd.product_variant_id) return false;
|
|
2136
|
-
var existedFingerprint = buildProductLineFingerprint(item
|
|
2135
|
+
var existedFingerprint = buildProductLineFingerprint(getProductSkuOptions(item), item.product_bundle);
|
|
2137
2136
|
return existedFingerprint === incomingFingerprint;
|
|
2138
2137
|
});
|
|
2139
2138
|
matchedProduct = matchedIndex === -1 ? null : tempOrder.products[matchedIndex];
|
|
2140
|
-
existedFingerprint = matchedProduct ? buildProductLineFingerprint(matchedProduct
|
|
2139
|
+
existedFingerprint = matchedProduct ? buildProductLineFingerprint(getProductSkuOptions(matchedProduct), matchedProduct.product_bundle) : '';
|
|
2141
2140
|
if (!matchedProduct) {
|
|
2142
|
-
_context18.next =
|
|
2141
|
+
_context18.next = 17;
|
|
2143
2142
|
break;
|
|
2144
2143
|
}
|
|
2145
|
-
_context18.next =
|
|
2144
|
+
_context18.next = 14;
|
|
2146
2145
|
return this.shouldMergeProductToOrder({
|
|
2147
2146
|
incomingProduct: productToAdd,
|
|
2148
2147
|
normalizedIncoming: normalizedIncoming,
|
|
@@ -2153,13 +2152,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2153
2152
|
tempOrder: tempOrder,
|
|
2154
2153
|
booking: booking
|
|
2155
2154
|
});
|
|
2156
|
-
case
|
|
2155
|
+
case 14:
|
|
2157
2156
|
_context18.t0 = _context18.sent;
|
|
2158
|
-
_context18.next =
|
|
2157
|
+
_context18.next = 18;
|
|
2159
2158
|
break;
|
|
2160
|
-
case
|
|
2159
|
+
case 17:
|
|
2161
2160
|
_context18.t0 = false;
|
|
2162
|
-
case
|
|
2161
|
+
case 18:
|
|
2163
2162
|
shouldMerge = _context18.t0;
|
|
2164
2163
|
if (matchedIndex === -1 || !matchedProduct || !shouldMerge) {
|
|
2165
2164
|
this.captureProductRuntime(tempOrder, productToAdd, normalizedIncoming);
|
|
@@ -2183,6 +2182,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2183
2182
|
metadata: _objectSpread(_objectSpread(_objectSpread({}, targetProduct.metadata || {}), normalizedProduct.metadata || {}), {}, {
|
|
2184
2183
|
unique_identification_number: targetUid
|
|
2185
2184
|
}),
|
|
2185
|
+
product_sku: _objectSpread(_objectSpread(_objectSpread({}, targetProduct.product_sku || {
|
|
2186
|
+
option: []
|
|
2187
|
+
}), normalizedProduct.product_sku || {
|
|
2188
|
+
option: []
|
|
2189
|
+
}), {}, {
|
|
2190
|
+
option: getProductSkuOptions(normalizedProduct)
|
|
2191
|
+
}),
|
|
2186
2192
|
note: targetProduct.note,
|
|
2187
2193
|
order_detail_id: targetProduct.order_detail_id,
|
|
2188
2194
|
num: getSafeProductNum(targetProduct.num + normalizedProduct.num)
|
|
@@ -2192,18 +2198,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2192
2198
|
if (linked) {
|
|
2193
2199
|
tempOrder.bookings = [].concat(_toConsumableArray(tempOrder.bookings || []), [linked.booking]);
|
|
2194
2200
|
}
|
|
2195
|
-
_context18.next =
|
|
2201
|
+
_context18.next = 23;
|
|
2196
2202
|
return this.applyPromotion();
|
|
2197
|
-
case
|
|
2203
|
+
case 23:
|
|
2198
2204
|
this.applyDiscount();
|
|
2199
|
-
_context18.next =
|
|
2205
|
+
_context18.next = 26;
|
|
2200
2206
|
return this.recalculateSummary({
|
|
2201
2207
|
createIfMissing: true
|
|
2202
2208
|
});
|
|
2203
|
-
case
|
|
2209
|
+
case 26:
|
|
2204
2210
|
this.persistTempOrder();
|
|
2205
2211
|
return _context18.abrupt("return", tempOrder.products);
|
|
2206
|
-
case
|
|
2212
|
+
case 28:
|
|
2207
2213
|
case "end":
|
|
2208
2214
|
return _context18.stop();
|
|
2209
2215
|
}
|
|
@@ -2237,12 +2243,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2237
2243
|
key: "updateOrderProduct",
|
|
2238
2244
|
value: function () {
|
|
2239
2245
|
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
|
|
2240
|
-
var _targetProduct$metada2, _metadata, _metadata2, _metadata3, _metadata4, _metadata5, _metadata6, _nextProduct$metadata, _targetProduct$metada7, _tempOrder$products$p;
|
|
2241
|
-
var product_id, product_variant_id, updates, unique_identification_number, identity_key,
|
|
2246
|
+
var _targetProduct$metada2, _product_sku, _metadata, _metadata2, _metadata3, _metadata4, _metadata5, _metadata6, _nextProduct$metadata, _targetProduct$metada7, _tempOrder$products$p;
|
|
2247
|
+
var product_id, product_variant_id, updates, unique_identification_number, identity_key, product_sku, product_bundle, booking, tempOrder, identityLookup, productIndex, targetUid, targetProduct, nextProduct, callerUpdatesTopPrice, callerUpdatesMainMeta, isPersistedOrderLine, callerUpdatesManualPrice, _targetProduct$metada3, _targetProduct$metada4, _targetProduct$metada5, _targetProduct$metada6, existedMeta, normalizedProduct, preservedBookingUid, _normalizedProduct$me, _targetProduct$metada8, productUid, linked;
|
|
2242
2248
|
return _regeneratorRuntime().wrap(function _callee17$(_context19) {
|
|
2243
2249
|
while (1) switch (_context19.prev = _context19.next) {
|
|
2244
2250
|
case 0:
|
|
2245
|
-
product_id = params.product_id, product_variant_id = params.product_variant_id, updates = params.updates, unique_identification_number = params.unique_identification_number, identity_key = params.identity_key,
|
|
2251
|
+
product_id = params.product_id, product_variant_id = params.product_variant_id, updates = params.updates, unique_identification_number = params.unique_identification_number, identity_key = params.identity_key, product_sku = params.product_sku, product_bundle = params.product_bundle, booking = params.booking;
|
|
2246
2252
|
tempOrder = this.ensureTempOrder();
|
|
2247
2253
|
identityLookup = {
|
|
2248
2254
|
product_id: product_id,
|
|
@@ -2257,7 +2263,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2257
2263
|
if (identity_key !== undefined) {
|
|
2258
2264
|
identityLookup.identity_key = identity_key;
|
|
2259
2265
|
}
|
|
2260
|
-
if (
|
|
2266
|
+
if (product_sku !== undefined) identityLookup.product_sku = product_sku;
|
|
2261
2267
|
if (product_bundle !== undefined) identityLookup.product_bundle = product_bundle;
|
|
2262
2268
|
productIndex = -1;
|
|
2263
2269
|
if (unique_identification_number !== undefined) {
|
|
@@ -2282,6 +2288,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2282
2288
|
product_variant_id: product_variant_id,
|
|
2283
2289
|
metadata: _objectSpread(_objectSpread(_objectSpread({}, targetProduct.metadata || {}), (updates === null || updates === void 0 ? void 0 : updates.metadata) || {}), {}, {
|
|
2284
2290
|
unique_identification_number: ((_targetProduct$metada2 = targetProduct.metadata) === null || _targetProduct$metada2 === void 0 ? void 0 : _targetProduct$metada2.unique_identification_number) || unique_identification_number
|
|
2291
|
+
}),
|
|
2292
|
+
product_sku: _objectSpread(_objectSpread(_objectSpread({}, targetProduct.product_sku || {
|
|
2293
|
+
option: []
|
|
2294
|
+
}), updates !== null && updates !== void 0 && updates.product_sku && _typeof(updates.product_sku) === 'object' ? updates.product_sku : {}), {}, {
|
|
2295
|
+
option: Array.isArray(updates === null || updates === void 0 || (_product_sku = updates.product_sku) === null || _product_sku === void 0 ? void 0 : _product_sku.option) ? updates.product_sku.option : getProductSkuOptions(targetProduct)
|
|
2285
2296
|
})
|
|
2286
2297
|
});
|
|
2287
2298
|
nextProduct.num = getSafeProductNum(nextProduct.num);
|
|
@@ -2374,11 +2385,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2374
2385
|
value: function () {
|
|
2375
2386
|
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
|
|
2376
2387
|
var _targetProduct$metada9;
|
|
2377
|
-
var product_id, product_variant_id, num, unique_identification_number, identity_key,
|
|
2388
|
+
var product_id, product_variant_id, num, unique_identification_number, identity_key, product_sku, product_bundle, tempOrder, identityLookup, productIndex, targetUid, targetProduct, normalizedProduct;
|
|
2378
2389
|
return _regeneratorRuntime().wrap(function _callee18$(_context20) {
|
|
2379
2390
|
while (1) switch (_context20.prev = _context20.next) {
|
|
2380
2391
|
case 0:
|
|
2381
|
-
product_id = params.product_id, product_variant_id = params.product_variant_id, num = params.num, unique_identification_number = params.unique_identification_number, identity_key = params.identity_key,
|
|
2392
|
+
product_id = params.product_id, product_variant_id = params.product_variant_id, num = params.num, unique_identification_number = params.unique_identification_number, identity_key = params.identity_key, product_sku = params.product_sku, product_bundle = params.product_bundle;
|
|
2382
2393
|
tempOrder = this.ensureTempOrder();
|
|
2383
2394
|
identityLookup = {
|
|
2384
2395
|
product_id: product_id,
|
|
@@ -2391,7 +2402,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2391
2402
|
}
|
|
2392
2403
|
}
|
|
2393
2404
|
if (identity_key !== undefined) identityLookup.identity_key = identity_key;
|
|
2394
|
-
if (
|
|
2405
|
+
if (product_sku !== undefined) identityLookup.product_sku = product_sku;
|
|
2395
2406
|
if (product_bundle !== undefined) identityLookup.product_bundle = product_bundle;
|
|
2396
2407
|
productIndex = -1;
|
|
2397
2408
|
if (unique_identification_number !== undefined) {
|
|
@@ -2558,7 +2569,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2558
2569
|
key: "submitTempOrder",
|
|
2559
2570
|
value: function () {
|
|
2560
2571
|
var _submitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
2561
|
-
var _params$cacheId, _this$otherParams;
|
|
2572
|
+
var _params$cacheId, _this$otherParams, _ref23, _params$businessCode, _this$otherParams2, _this$otherParams3;
|
|
2562
2573
|
var tempOrder, effectiveCacheId, hasPaymentOverride, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
|
|
2563
2574
|
return _regeneratorRuntime().wrap(function _callee21$(_context23) {
|
|
2564
2575
|
while (1) switch (_context23.prev = _context23.next) {
|
|
@@ -2584,7 +2595,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2584
2595
|
tempOrder: tempOrder,
|
|
2585
2596
|
cacheId: effectiveCacheId,
|
|
2586
2597
|
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform),
|
|
2587
|
-
businessCode: params === null || params === void 0 ? void 0 : params.businessCode,
|
|
2598
|
+
businessCode: (_ref23 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.businessCode) !== null && _ref23 !== void 0 ? _ref23 : (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.business_code,
|
|
2588
2599
|
channel: params === null || params === void 0 ? void 0 : params.channel,
|
|
2589
2600
|
type: params === null || params === void 0 ? void 0 : params.type,
|
|
2590
2601
|
enhance: enhancePayload
|
|
@@ -2770,6 +2781,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2770
2781
|
payments: mappedPayments,
|
|
2771
2782
|
paymentStatus: paymentStatus,
|
|
2772
2783
|
smallTicketDataFlag: params.smallTicketDataFlag,
|
|
2784
|
+
businessCode: params.businessCode,
|
|
2773
2785
|
channel: params.channel,
|
|
2774
2786
|
enhancePayload: function enhancePayload(payload) {
|
|
2775
2787
|
var nextPayload = _objectSpread(_objectSpread({}, payload), {}, {
|
|
@@ -3339,7 +3351,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3339
3351
|
_step8;
|
|
3340
3352
|
try {
|
|
3341
3353
|
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
3342
|
-
var _product$metadata6,
|
|
3354
|
+
var _product$metadata6, _ref24, _ref25, _existed$origin, _rawProduct$metadata;
|
|
3343
3355
|
var _step8$value = _slicedToArray(_step8.value, 2),
|
|
3344
3356
|
index = _step8$value[0],
|
|
3345
3357
|
product = _step8$value[1];
|
|
@@ -3347,7 +3359,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3347
3359
|
if (!uid) continue;
|
|
3348
3360
|
var existed = productsByUid[uid] && _typeof(productsByUid[uid]) === 'object' ? productsByUid[uid] : {};
|
|
3349
3361
|
var rawProduct = rawProducts[index] && _typeof(rawProducts[index]) === 'object' ? rawProducts[index] : product;
|
|
3350
|
-
var origin = (
|
|
3362
|
+
var origin = (_ref24 = (_ref25 = (_existed$origin = existed.origin) !== null && _existed$origin !== void 0 ? _existed$origin : rawProduct._origin) !== null && _ref25 !== void 0 ? _ref25 : (_rawProduct$metadata = rawProduct.metadata) === null || _rawProduct$metadata === void 0 ? void 0 : _rawProduct$metadata.origin) !== null && _ref24 !== void 0 ? _ref24 : rawProduct;
|
|
3351
3363
|
var originSnapshot = cloneDeep(origin);
|
|
3352
3364
|
var productOptionString = this.buildHydratedProductOptionString(rawProduct) || this.buildHydratedProductOptionString(product);
|
|
3353
3365
|
if (productOptionString && originSnapshot && _typeof(originSnapshot) === 'object') {
|
|
@@ -3415,76 +3427,38 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3415
3427
|
}, {
|
|
3416
3428
|
key: "normalizeHydratedProductOptionItem",
|
|
3417
3429
|
value: function normalizeHydratedProductOptionItem(optionItem) {
|
|
3418
|
-
var
|
|
3419
|
-
var rawNum = (
|
|
3430
|
+
var _ref26, _optionItem$num, _ref27, _optionItem$add_price;
|
|
3431
|
+
var rawNum = (_ref26 = (_optionItem$num = optionItem === null || optionItem === void 0 ? void 0 : optionItem.num) !== null && _optionItem$num !== void 0 ? _optionItem$num : optionItem === null || optionItem === void 0 ? void 0 : optionItem.quantity) !== null && _ref26 !== void 0 ? _ref26 : 1;
|
|
3420
3432
|
var parsedNum = Number(rawNum);
|
|
3421
|
-
var rawPrice = (
|
|
3433
|
+
var rawPrice = (_ref27 = (_optionItem$add_price = optionItem === null || optionItem === void 0 ? void 0 : optionItem.add_price) !== null && _optionItem$add_price !== void 0 ? _optionItem$add_price : optionItem === null || optionItem === void 0 ? void 0 : optionItem.price) !== null && _ref27 !== void 0 ? _ref27 : 0;
|
|
3422
3434
|
var parsedPrice = Number(rawPrice);
|
|
3423
|
-
var normalized = {
|
|
3435
|
+
var normalized = _objectSpread(_objectSpread({}, optionItem), {}, {
|
|
3424
3436
|
option_group_item_id: optionItem === null || optionItem === void 0 ? void 0 : optionItem.option_group_item_id,
|
|
3425
3437
|
option_group_id: optionItem === null || optionItem === void 0 ? void 0 : optionItem.option_group_id,
|
|
3426
3438
|
num: Number.isFinite(parsedNum) && parsedNum > 0 ? parsedNum : 1,
|
|
3427
|
-
|
|
3428
|
-
};
|
|
3439
|
+
add_price: Number.isFinite(parsedPrice) ? parsedPrice : 0
|
|
3440
|
+
});
|
|
3441
|
+
delete normalized.price;
|
|
3429
3442
|
if ((optionItem === null || optionItem === void 0 ? void 0 : optionItem.name) !== undefined) normalized.name = optionItem.name;
|
|
3430
3443
|
if ((optionItem === null || optionItem === void 0 ? void 0 : optionItem.group_name) !== undefined) normalized.group_name = optionItem.group_name;
|
|
3431
3444
|
if ((optionItem === null || optionItem === void 0 ? void 0 : optionItem.id) !== undefined) normalized.id = optionItem.id;
|
|
3432
3445
|
return normalized;
|
|
3433
3446
|
}
|
|
3434
|
-
}, {
|
|
3435
|
-
key: "mergeHydratedProductOptionDisplayFields",
|
|
3436
|
-
value: function mergeHydratedProductOptionDisplayFields(options, skuOptions) {
|
|
3437
|
-
if (!Array.isArray(skuOptions) || skuOptions.length === 0) return options;
|
|
3438
|
-
var displayByItemId = new Map();
|
|
3439
|
-
var _iterator10 = _createForOfIteratorHelper(skuOptions),
|
|
3440
|
-
_step10;
|
|
3441
|
-
try {
|
|
3442
|
-
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
3443
|
-
var option = _step10.value;
|
|
3444
|
-
var key = option === null || option === void 0 ? void 0 : option.option_group_item_id;
|
|
3445
|
-
if (key === undefined || key === null || key === '') continue;
|
|
3446
|
-
displayByItemId.set(String(key), option);
|
|
3447
|
-
}
|
|
3448
|
-
} catch (err) {
|
|
3449
|
-
_iterator10.e(err);
|
|
3450
|
-
} finally {
|
|
3451
|
-
_iterator10.f();
|
|
3452
|
-
}
|
|
3453
|
-
return options.map(function (option) {
|
|
3454
|
-
var _option$option_group_;
|
|
3455
|
-
var display = displayByItemId.get(String((_option$option_group_ = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_ !== void 0 ? _option$option_group_ : ''));
|
|
3456
|
-
if (!display) return option;
|
|
3457
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, option), option.name === undefined && display.name !== undefined ? {
|
|
3458
|
-
name: display.name
|
|
3459
|
-
} : {}), option.group_name === undefined && display.group_name !== undefined ? {
|
|
3460
|
-
group_name: display.group_name
|
|
3461
|
-
} : {}), option.id === undefined && display.id !== undefined ? {
|
|
3462
|
-
id: display.id
|
|
3463
|
-
} : {});
|
|
3464
|
-
});
|
|
3465
|
-
}
|
|
3466
|
-
}, {
|
|
3467
|
-
key: "resolveHydratedProductOptions",
|
|
3468
|
-
value: function resolveHydratedProductOptions(row) {
|
|
3469
|
-
var _row$product_sku,
|
|
3470
|
-
_this12 = this;
|
|
3471
|
-
var skuOptions = (_row$product_sku = row.product_sku) === null || _row$product_sku === void 0 ? void 0 : _row$product_sku.option;
|
|
3472
|
-
if (Array.isArray(row.product_option_item) && row.product_option_item.length > 0) {
|
|
3473
|
-
return this.mergeHydratedProductOptionDisplayFields(row.product_option_item, skuOptions);
|
|
3474
|
-
}
|
|
3475
|
-
if (!Array.isArray(skuOptions)) return [];
|
|
3476
|
-
return skuOptions.map(function (optionItem) {
|
|
3477
|
-
return _this12.normalizeHydratedProductOptionItem(optionItem || {});
|
|
3478
|
-
});
|
|
3479
|
-
}
|
|
3480
3447
|
}, {
|
|
3481
3448
|
key: "normalizeHydratedOrderProduct",
|
|
3482
3449
|
value: function normalizeHydratedOrderProduct(product) {
|
|
3450
|
+
var _this12 = this;
|
|
3483
3451
|
var row = _objectSpread({}, product || {});
|
|
3484
3452
|
if (row.num === undefined && row.product_quantity !== undefined) {
|
|
3485
3453
|
row.num = row.product_quantity;
|
|
3486
3454
|
}
|
|
3487
|
-
|
|
3455
|
+
var productSku = ensureProductSku(row);
|
|
3456
|
+
row.product_sku = _objectSpread(_objectSpread({}, productSku), {}, {
|
|
3457
|
+
option: normalizeProductSkuOptions(productSku.option.map(function (optionItem) {
|
|
3458
|
+
return _this12.normalizeHydratedProductOptionItem(optionItem || {});
|
|
3459
|
+
}))
|
|
3460
|
+
});
|
|
3461
|
+
delete row["product_".concat('option', "_item")];
|
|
3488
3462
|
if (!Array.isArray(row.product_bundle)) row.product_bundle = [];
|
|
3489
3463
|
if (!row.metadata || _typeof(row.metadata) !== 'object') row.metadata = {};
|
|
3490
3464
|
if (row.booking_uid && !row.metadata.booking_uid) {
|
|
@@ -3497,7 +3471,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3497
3471
|
var normalized = normalizeOrderProduct(row);
|
|
3498
3472
|
normalized.discount_list = normalizeOrderProductDiscountList(normalized.discount_list);
|
|
3499
3473
|
var result = _objectSpread(_objectSpread(_objectSpread({}, row), normalized), {}, {
|
|
3500
|
-
product_sku:
|
|
3474
|
+
product_sku: normalized.product_sku,
|
|
3501
3475
|
metadata: _objectSpread(_objectSpread({}, row.metadata), normalized.metadata)
|
|
3502
3476
|
});
|
|
3503
3477
|
if (result.metadata) delete result.metadata.price_schema_version;
|
|
@@ -3552,67 +3526,67 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3552
3526
|
var amount = new Decimal(discount.amount || 0).times(qty).plus(((_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.product_discount_difference) || 0);
|
|
3553
3527
|
savedMap.set(discountKey, (savedMap.get(discountKey) || new Decimal(0)).plus(amount));
|
|
3554
3528
|
};
|
|
3555
|
-
var
|
|
3556
|
-
|
|
3529
|
+
var _iterator10 = _createForOfIteratorHelper(productList),
|
|
3530
|
+
_step10;
|
|
3557
3531
|
try {
|
|
3558
|
-
for (
|
|
3559
|
-
var product =
|
|
3532
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
3533
|
+
var product = _step10.value;
|
|
3560
3534
|
var qty = product.num || 1;
|
|
3561
|
-
var
|
|
3562
|
-
|
|
3535
|
+
var _iterator12 = _createForOfIteratorHelper(product.discount_list || []),
|
|
3536
|
+
_step12;
|
|
3563
3537
|
try {
|
|
3564
|
-
for (
|
|
3565
|
-
var pd =
|
|
3538
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
3539
|
+
var pd = _step12.value;
|
|
3566
3540
|
addDiscountAmount(pd, qty);
|
|
3567
3541
|
}
|
|
3568
3542
|
} catch (err) {
|
|
3569
|
-
|
|
3543
|
+
_iterator12.e(err);
|
|
3570
3544
|
} finally {
|
|
3571
|
-
|
|
3545
|
+
_iterator12.f();
|
|
3572
3546
|
}
|
|
3573
|
-
var
|
|
3574
|
-
|
|
3547
|
+
var _iterator13 = _createForOfIteratorHelper(product.product_bundle || []),
|
|
3548
|
+
_step13;
|
|
3575
3549
|
try {
|
|
3576
|
-
for (
|
|
3577
|
-
var
|
|
3578
|
-
var bundle =
|
|
3579
|
-
var bundleQty = new Decimal(Number(qty) || 1).times(Number((
|
|
3580
|
-
var
|
|
3581
|
-
|
|
3550
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
3551
|
+
var _ref28, _bundle$num;
|
|
3552
|
+
var bundle = _step13.value;
|
|
3553
|
+
var bundleQty = new Decimal(Number(qty) || 1).times(Number((_ref28 = (_bundle$num = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num !== void 0 ? _bundle$num : bundle === null || bundle === void 0 ? void 0 : bundle.quantity) !== null && _ref28 !== void 0 ? _ref28 : 1) || 1).toNumber();
|
|
3554
|
+
var _iterator14 = _createForOfIteratorHelper((bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) || []),
|
|
3555
|
+
_step14;
|
|
3582
3556
|
try {
|
|
3583
|
-
for (
|
|
3584
|
-
var _pd =
|
|
3557
|
+
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
3558
|
+
var _pd = _step14.value;
|
|
3585
3559
|
addDiscountAmount(_pd, bundleQty);
|
|
3586
3560
|
}
|
|
3587
3561
|
} catch (err) {
|
|
3588
|
-
|
|
3562
|
+
_iterator14.e(err);
|
|
3589
3563
|
} finally {
|
|
3590
|
-
|
|
3564
|
+
_iterator14.f();
|
|
3591
3565
|
}
|
|
3592
3566
|
}
|
|
3593
3567
|
} catch (err) {
|
|
3594
|
-
|
|
3568
|
+
_iterator13.e(err);
|
|
3595
3569
|
} finally {
|
|
3596
|
-
|
|
3570
|
+
_iterator13.f();
|
|
3597
3571
|
}
|
|
3598
3572
|
}
|
|
3599
3573
|
} catch (err) {
|
|
3600
|
-
|
|
3574
|
+
_iterator10.e(err);
|
|
3601
3575
|
} finally {
|
|
3602
|
-
|
|
3576
|
+
_iterator10.f();
|
|
3603
3577
|
}
|
|
3604
|
-
var
|
|
3605
|
-
|
|
3578
|
+
var _iterator11 = _createForOfIteratorHelper(discountList),
|
|
3579
|
+
_step11;
|
|
3606
3580
|
try {
|
|
3607
|
-
for (
|
|
3608
|
-
var d =
|
|
3581
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
3582
|
+
var d = _step11.value;
|
|
3609
3583
|
var key = d.id;
|
|
3610
3584
|
d.savedAmount = d.isSelected && key != null && savedMap.has(key) ? savedMap.get(key).toNumber() : 0;
|
|
3611
3585
|
}
|
|
3612
3586
|
} catch (err) {
|
|
3613
|
-
|
|
3587
|
+
_iterator11.e(err);
|
|
3614
3588
|
} finally {
|
|
3615
|
-
|
|
3589
|
+
_iterator11.f();
|
|
3616
3590
|
}
|
|
3617
3591
|
}
|
|
3618
3592
|
}]);
|
|
@@ -161,15 +161,18 @@ export interface OrderProductIdentity {
|
|
|
161
161
|
product_id: number | null;
|
|
162
162
|
product_variant_id: number;
|
|
163
163
|
unique_identification_number?: string;
|
|
164
|
-
|
|
164
|
+
product_sku?: OrderProductSku;
|
|
165
165
|
product_bundle?: any[];
|
|
166
166
|
}
|
|
167
|
+
export interface OrderProductSku {
|
|
168
|
+
option: any[];
|
|
169
|
+
[key: string]: any;
|
|
170
|
+
}
|
|
167
171
|
export interface OrderProduct extends OrderProductIdentity {
|
|
168
172
|
order_detail_id: number | null;
|
|
169
173
|
num: number;
|
|
170
174
|
bundle_edit?: number;
|
|
171
|
-
|
|
172
|
-
product_sku?: Record<string, any>;
|
|
175
|
+
product_sku: OrderProductSku;
|
|
173
176
|
gift_card?: number;
|
|
174
177
|
selling_price: string;
|
|
175
178
|
original_price: string;
|
|
@@ -262,10 +265,10 @@ export interface OrderTempOrder {
|
|
|
262
265
|
[key: string]: any;
|
|
263
266
|
};
|
|
264
267
|
}
|
|
265
|
-
export interface OrderSubmitProduct extends Omit<OrderProduct, 'unique_identification_number' | 'num'
|
|
268
|
+
export interface OrderSubmitProduct extends Omit<OrderProduct, 'unique_identification_number' | 'num'> {
|
|
266
269
|
product_quantity: number;
|
|
267
270
|
payment_price: string;
|
|
268
|
-
product_sku:
|
|
271
|
+
product_sku: OrderProductSku;
|
|
269
272
|
}
|
|
270
273
|
export interface OrderSubmitPayload extends Omit<OrderTempOrder, 'platform' | 'products' | '_extend' | 'customer' | 'discount_list' | 'created_at'> {
|
|
271
274
|
platform: string;
|
|
@@ -300,7 +303,7 @@ export interface UpdateOrderProductParams {
|
|
|
300
303
|
updates: Partial<OrderProduct>;
|
|
301
304
|
unique_identification_number?: string;
|
|
302
305
|
identity_key?: string;
|
|
303
|
-
|
|
306
|
+
product_sku?: OrderProductSku;
|
|
304
307
|
product_bundle?: any[];
|
|
305
308
|
booking?: AddProductBookingInput;
|
|
306
309
|
}
|
|
@@ -479,6 +482,7 @@ export interface SyncPaymentsToOrderParams {
|
|
|
479
482
|
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
480
483
|
submitWhenPaid?: boolean;
|
|
481
484
|
smallTicketDataFlag?: number;
|
|
485
|
+
businessCode?: string;
|
|
482
486
|
channel?: string;
|
|
483
487
|
}
|
|
484
488
|
export interface SyncPaymentsToOrderResult<T = any> {
|
|
@@ -28,11 +28,18 @@ export declare function composeLinePrice(params: {
|
|
|
28
28
|
}> | null;
|
|
29
29
|
useOriginalBundle?: boolean;
|
|
30
30
|
}): string;
|
|
31
|
+
export declare function normalizeProductSkuOptions(options?: unknown): Record<string, any>[];
|
|
32
|
+
export declare function ensureProductSku(product?: Record<string, any> | null): Record<string, any> & {
|
|
33
|
+
option: Record<string, any>[];
|
|
34
|
+
};
|
|
35
|
+
export declare function getProductSkuOptions(product?: Record<string, any> | null): Record<string, any>[];
|
|
31
36
|
/**
|
|
32
|
-
* 计算 option 单价合计:Σ(option.
|
|
37
|
+
* 计算 option 单价合计:Σ(option.add_price × option.num)。
|
|
38
|
+
* 兼容入参仍带旧 `price` 的调用方,但运行时归一化后只维护 `add_price`。
|
|
33
39
|
* 在新语义 v2 下,main_product_original_price = source_product_price + 本函数结果。
|
|
34
40
|
*/
|
|
35
41
|
export declare function sumOptionUnitPrice(options?: Array<{
|
|
42
|
+
add_price?: any;
|
|
36
43
|
price?: any;
|
|
37
44
|
num?: any;
|
|
38
45
|
}> | null): Decimal;
|
|
@@ -162,7 +169,7 @@ export declare function mapPaymentItemsToOrderPayments(paymentItems: OrderPaymen
|
|
|
162
169
|
export declare function formatV1Product(products: OrderSubmitProduct[]): {
|
|
163
170
|
bundle: any[];
|
|
164
171
|
key: number | null;
|
|
165
|
-
option: any;
|
|
172
|
+
option: any[];
|
|
166
173
|
product_id: number | null;
|
|
167
174
|
product_variant_id: number;
|
|
168
175
|
num: number;
|