@pisell/pisellos 0.10.6 → 0.10.8
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/utils/buildCacheItemFromOrderLine.js +12 -10
- package/dist/modules/Order/index.d.ts +14 -6
- package/dist/modules/Order/index.js +373 -246
- package/dist/modules/Order/types.d.ts +26 -3
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +227 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +75 -0
- package/dist/modules/Rules/index.js +125 -52
- package/dist/modules/SalesSummary/utils.js +7 -1
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.js +810 -729
- package/dist/server/modules/order/index.d.ts +1 -0
- package/dist/server/modules/order/index.js +9 -2
- package/dist/server/modules/order/types.d.ts +1 -1
- package/dist/solution/BaseSales/index.d.ts +15 -5
- package/dist/solution/BaseSales/index.js +211 -159
- package/dist/solution/BaseSales/utils/cartPromotion.js +26 -3
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
- package/dist/solution/BaseSales/utils.js +31 -20
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +13 -1
- package/dist/solution/BookingTicket/index.js +19 -22
- package/dist/solution/BookingTicket/types.d.ts +3 -0
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +16 -2
- package/dist/solution/ScanOrder/utils.js +31 -20
- package/dist/solution/UnifiedBookingSales/index.d.ts +16 -4
- package/dist/solution/UnifiedBookingSales/index.js +113 -48
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -1
- package/lib/modules/Order/index.d.ts +14 -6
- package/lib/modules/Order/index.js +192 -52
- package/lib/modules/Order/types.d.ts +26 -3
- package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +170 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +70 -0
- package/lib/modules/Rules/index.js +100 -20
- package/lib/modules/SalesSummary/utils.js +5 -1
- package/lib/server/index.d.ts +6 -0
- package/lib/server/index.js +51 -0
- package/lib/server/modules/order/index.d.ts +1 -0
- package/lib/server/modules/order/index.js +9 -3
- package/lib/server/modules/order/types.d.ts +1 -1
- package/lib/solution/BaseSales/index.d.ts +15 -5
- package/lib/solution/BaseSales/index.js +64 -16
- package/lib/solution/BaseSales/utils/cartPromotion.js +26 -2
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
- package/lib/solution/BaseSales/utils.js +29 -18
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +13 -1
- package/lib/solution/BookingTicket/index.js +6 -9
- package/lib/solution/BookingTicket/types.d.ts +3 -0
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +15 -3
- package/lib/solution/ScanOrder/utils.js +29 -18
- package/lib/solution/UnifiedBookingSales/index.d.ts +16 -4
- package/lib/solution/UnifiedBookingSales/index.js +80 -26
- package/package.json +1 -1
|
@@ -39,9 +39,10 @@ import { ensureOrderPaymentNumber, mergeOrderPaymentRecord, resolveOrderPaymentI
|
|
|
39
39
|
import { resolvePaymentNumberDevicePrefix, resolvePaymentNumberDevicePrefixFromDeviceId } from "../../utils/payment-number";
|
|
40
40
|
import { processCartPromotion, appendPromotionTags as _appendPromotionTags, getOrderProductUid as getPromotionUid } from "../../solution/BaseSales/utils/cartPromotion";
|
|
41
41
|
import { buildProductLineFingerprint, getProductIdentityIndex, getSafeProductNum, isIdentityMatch, normalizeOrderProduct } from "../../solution/ScanOrder/utils";
|
|
42
|
-
import { syncManualProductDiscountProductNum } from "./utils/manualProductDiscount";
|
|
42
|
+
import { hasManualProductDiscountFlag, syncManualProductDiscountProductNum } from "./utils/manualProductDiscount";
|
|
43
43
|
import { expandHydratedProductsForDiscountCollection, restoreHydratedBundleDiscounts } from "./utils/bundleDiscountHydration";
|
|
44
|
-
import { getOrderCollectionPersistentId, getOrderCollectionUid, normalizeOrderCollections, setOrderCollectionUid } from "./utils/orderCollectionIdentity";
|
|
44
|
+
import { getOrderCollectionPersistentId, getOrderCollectionUid, normalizeOrderCollections, repairDuplicateProductLineIdentities as repairDuplicateOrderProductLineIdentities, setOrderCollectionUid } from "./utils/orderCollectionIdentity";
|
|
45
|
+
import { consolidateDiscountFreeProductLines, ensureUniqueProductLineUids } from "./utils/discountProductLineIdentity";
|
|
45
46
|
import { DiscountModule } from "../Discount";
|
|
46
47
|
import { RulesModule } from "../Rules";
|
|
47
48
|
import { UnavailableReason } from "../Rules/types";
|
|
@@ -63,8 +64,7 @@ function isSameDiscountList(left, right) {
|
|
|
63
64
|
return JSON.stringify(normalizeDiscountListSignature(left)) === JSON.stringify(normalizeDiscountListSignature(right));
|
|
64
65
|
}
|
|
65
66
|
function isManualProductDiscountProduct(product) {
|
|
66
|
-
|
|
67
|
-
return (product === null || product === void 0 || (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.is_manual_discount) === true || (product === null || product === void 0 || (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.is_manual_discount) === 1 || ((product === null || product === void 0 ? void 0 : product.discount_list) || []).some(function (item) {
|
|
67
|
+
return hasManualProductDiscountFlag(product === null || product === void 0 ? void 0 : product.metadata) || ((product === null || product === void 0 ? void 0 : product.discount_list) || []).some(function (item) {
|
|
68
68
|
return (item === null || item === void 0 ? void 0 : item.type) === 'product';
|
|
69
69
|
});
|
|
70
70
|
}
|
|
@@ -163,7 +163,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
163
163
|
_step2;
|
|
164
164
|
try {
|
|
165
165
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
166
|
-
var _item$type2, _ref, _ref2, _item$discount$resour, _item$discount, _item$discount$title, _item$discount2, _item$amount, _ref3, _item$discount$origin, _item$
|
|
166
|
+
var _item$type2, _ref, _ref2, _item$discount$resour, _item$discount, _item$discount$title, _item$discount2, _item$discount3, _item$discount$fixed_, _item$discount4, _item$discount5, _item$amount, _ref3, _item$discount$origin, _item$discount6, _ref4, _ref5, _item$metadata$num, _item$metadata, _ref6, _ref7, _item$metadata$num2, _item$metadata2, _ref8, _item$discount$discou, _item$discount7, _item$amount2, _item$amount3, _product$product_id, _product$is_charge_ta, _ref9, _product$original_pri, _ref10, _item$discount$discou2, _item$discount8, _item$discount$discou3, _item$discount9;
|
|
167
167
|
var item = _step2.value;
|
|
168
168
|
var type = (_item$type2 = item === null || item === void 0 ? void 0 : item.type) !== null && _item$type2 !== void 0 ? _item$type2 : item === null || item === void 0 ? void 0 : item.tag;
|
|
169
169
|
if (!type || type === 'product') continue;
|
|
@@ -174,12 +174,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
174
174
|
var key = Number.isFinite(id) ? id : String(resourceId);
|
|
175
175
|
var title = (_item$discount$title = item === null || item === void 0 || (_item$discount2 = item.discount) === null || _item$discount2 === void 0 ? void 0 : _item$discount2.title) !== null && _item$discount$title !== void 0 ? _item$discount$title : {};
|
|
176
176
|
var amount = Number((item === null || item === void 0 ? void 0 : item.amount) || 0);
|
|
177
|
+
var discountCardType = item === null || item === void 0 || (_item$discount3 = item.discount) === null || _item$discount3 === void 0 ? void 0 : _item$discount3.discount_card_type;
|
|
178
|
+
var parValue = isDiscountCard ? discountCardType === 'fixed_amount' ? (_item$discount$fixed_ = item === null || item === void 0 || (_item$discount4 = item.discount) === null || _item$discount4 === void 0 ? void 0 : _item$discount4.fixed_amount) !== null && _item$discount$fixed_ !== void 0 ? _item$discount$fixed_ : item === null || item === void 0 ? void 0 : item.amount : item === null || item === void 0 || (_item$discount5 = item.discount) === null || _item$discount5 === void 0 ? void 0 : _item$discount5.percent : '0';
|
|
177
179
|
var detail = {
|
|
178
180
|
amount: String((_item$amount = item === null || item === void 0 ? void 0 : item.amount) !== null && _item$amount !== void 0 ? _item$amount : '0'),
|
|
179
181
|
type: type,
|
|
180
182
|
resource_id: key,
|
|
181
183
|
title: title,
|
|
182
|
-
original_amount: String((_ref3 = (_item$discount$origin = item === null || item === void 0 || (_item$
|
|
184
|
+
original_amount: String((_ref3 = (_item$discount$origin = item === null || item === void 0 || (_item$discount6 = item.discount) === null || _item$discount6 === void 0 ? void 0 : _item$discount6.original_amount) !== null && _item$discount$origin !== void 0 ? _item$discount$origin : item === null || item === void 0 ? void 0 : item.amount) !== null && _ref3 !== void 0 ? _ref3 : '0'),
|
|
183
185
|
num: Number((_ref4 = (_ref5 = (_item$metadata$num = item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.num) !== null && _item$metadata$num !== void 0 ? _item$metadata$num : product === null || product === void 0 ? void 0 : product.num) !== null && _ref5 !== void 0 ? _ref5 : product === null || product === void 0 ? void 0 : product.product_quantity) !== null && _ref4 !== void 0 ? _ref4 : 1) || 1,
|
|
184
186
|
metadata: item === null || item === void 0 ? void 0 : item.metadata,
|
|
185
187
|
discount: item === null || item === void 0 ? void 0 : item.discount,
|
|
@@ -209,9 +211,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
209
211
|
encoded: '',
|
|
210
212
|
code: '',
|
|
211
213
|
tag: type,
|
|
212
|
-
product_id: (_ref8 = (_item$discount$discou = item === null || item === void 0 || (_item$
|
|
214
|
+
product_id: (_ref8 = (_item$discount$discou = item === null || item === void 0 || (_item$discount7 = item.discount) === null || _item$discount7 === void 0 ? void 0 : _item$discount7.discount_product_id) !== null && _item$discount$discou !== void 0 ? _item$discount$discou : product === null || product === void 0 ? void 0 : product.product_id) !== null && _ref8 !== void 0 ? _ref8 : 0,
|
|
213
215
|
relation_type: '',
|
|
214
|
-
par_value: String(
|
|
216
|
+
par_value: String(parValue !== null && parValue !== void 0 ? parValue : '0'),
|
|
215
217
|
used_par_value: String((_item$amount2 = item === null || item === void 0 ? void 0 : item.amount) !== null && _item$amount2 !== void 0 ? _item$amount2 : '0'),
|
|
216
218
|
limit_status: 'enable',
|
|
217
219
|
limited_relation_product_data: {
|
|
@@ -230,7 +232,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
230
232
|
id: (_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : 0,
|
|
231
233
|
title: '',
|
|
232
234
|
is_charge_tax: (_product$is_charge_ta = product === null || product === void 0 ? void 0 : product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
|
|
233
|
-
base_price: String((
|
|
235
|
+
base_price: String((_ref9 = (_product$original_pri = product === null || product === void 0 ? void 0 : product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : product === null || product === void 0 ? void 0 : product.selling_price) !== null && _ref9 !== void 0 ? _ref9 : '0')
|
|
234
236
|
},
|
|
235
237
|
type: type,
|
|
236
238
|
resource_id: key,
|
|
@@ -242,8 +244,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
242
244
|
amount: amount,
|
|
243
245
|
discount: _objectSpread(_objectSpread({}, (item === null || item === void 0 ? void 0 : item.discount) || {}), {}, {
|
|
244
246
|
resource_id: key,
|
|
245
|
-
discount_product_id: (
|
|
246
|
-
discount_calculation_mode: (_item$discount$discou3 = item === null || item === void 0 || (_item$
|
|
247
|
+
discount_product_id: (_ref10 = (_item$discount$discou2 = item === null || item === void 0 || (_item$discount8 = item.discount) === null || _item$discount8 === void 0 ? void 0 : _item$discount8.discount_product_id) !== null && _item$discount$discou2 !== void 0 ? _item$discount$discou2 : product === null || product === void 0 ? void 0 : product.product_id) !== null && _ref10 !== void 0 ? _ref10 : 0,
|
|
248
|
+
discount_calculation_mode: (_item$discount$discou3 = item === null || item === void 0 || (_item$discount9 = item.discount) === null || _item$discount9 === void 0 ? void 0 : _item$discount9.discount_calculation_mode) !== null && _item$discount$discou3 !== void 0 ? _item$discount$discou3 : 'item_level'
|
|
247
249
|
}),
|
|
248
250
|
applicableProductDetails: [detail],
|
|
249
251
|
appliedProductDetails: [detail]
|
|
@@ -271,7 +273,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
271
273
|
key: "applyProductDiscountPrices",
|
|
272
274
|
value: function applyProductDiscountPrices(products) {
|
|
273
275
|
return (products || []).map(function (product) {
|
|
274
|
-
var _product$metadata$sou, _product$
|
|
276
|
+
var _product$metadata$sou, _product$metadata, _product$metadata2, _product$original_pri2;
|
|
275
277
|
if (isManualProductDiscountProduct(product)) return product;
|
|
276
278
|
var discountItems = Array.isArray(product.discount_list) ? product.discount_list : [];
|
|
277
279
|
var hasOnlyPersistedDiscountSnapshots = product.order_detail_id !== undefined && product.order_detail_id !== null && discountItems.length > 0 && discountItems.every(function (discount) {
|
|
@@ -282,7 +284,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
282
284
|
}
|
|
283
285
|
var totalPerUnitDiscount = resolveEffectivePerUnitDiscount(product);
|
|
284
286
|
var optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
|
|
285
|
-
var sourcePrice = (_product$metadata$sou = (_product$
|
|
287
|
+
var sourcePrice = (_product$metadata$sou = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri2 = product.original_price) !== null && _product$original_pri2 !== void 0 ? _product$original_pri2 : '0';
|
|
286
288
|
var newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
287
289
|
var newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
288
290
|
if (product.metadata) {
|
|
@@ -291,10 +293,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
291
293
|
}
|
|
292
294
|
if (Array.isArray(product.product_bundle)) {
|
|
293
295
|
product.product_bundle = product.product_bundle.map(function (bundle) {
|
|
294
|
-
var
|
|
296
|
+
var _ref11, _bundle$original_pric;
|
|
295
297
|
var hasBundleDiscount = Array.isArray(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) && bundle.discount_list.length > 0;
|
|
296
298
|
if (hasBundleDiscount) return bundle;
|
|
297
|
-
var restoredPrice = (
|
|
299
|
+
var restoredPrice = (_ref11 = (_bundle$original_pric = bundle === null || bundle === void 0 ? void 0 : bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle === null || bundle === void 0 ? void 0 : bundle.product_price) !== null && _ref11 !== void 0 ? _ref11 : bundle === null || bundle === void 0 ? void 0 : bundle.price;
|
|
298
300
|
if (restoredPrice === undefined || restoredPrice === null || restoredPrice === '') return bundle;
|
|
299
301
|
return _objectSpread(_objectSpread({}, bundle), {}, {
|
|
300
302
|
price: restoredPrice,
|
|
@@ -707,7 +709,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
707
709
|
value: function () {
|
|
708
710
|
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(code, customerId) {
|
|
709
711
|
var _this$store$discount11, _tempOrder$holder, _this$store$summary;
|
|
710
|
-
var resultDiscountWithReason, resultDiscountList, unavailableReasonKey, rulesModule, withScanList, currentSelected, tempOrder, holders,
|
|
712
|
+
var resultDiscountWithReason, resultDiscountList, unavailableReasonKey, rulesModule, withScanList, currentSelected, tempOrder, holders, _ref12, isAvailable, newDiscountList, evaluatedDiscountList, unavailableReason, shouldRetainForLater, normalizedNewDiscountList, retainedDiscountList, resolvedDiscountList, _this$store$discount12, _this$store$discount13;
|
|
711
713
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
712
714
|
while (1) switch (_context6.prev = _context6.next) {
|
|
713
715
|
case 0:
|
|
@@ -784,7 +786,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
784
786
|
case 18:
|
|
785
787
|
tempOrder = this.store.tempOrder;
|
|
786
788
|
holders = (tempOrder === null || tempOrder === void 0 || (_tempOrder$holder = tempOrder.holder) === null || _tempOrder$holder === void 0 ? void 0 : _tempOrder$holder.form_record) || [];
|
|
787
|
-
|
|
789
|
+
_ref12 = rulesModule.isDiscountListAvailable({
|
|
788
790
|
productList: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
|
|
789
791
|
oldDiscountList: this.getDiscountList(),
|
|
790
792
|
newDiscountList: withScanList,
|
|
@@ -796,7 +798,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
796
798
|
}) || {
|
|
797
799
|
isAvailable: false,
|
|
798
800
|
discountList: this.getDiscountList()
|
|
799
|
-
}, isAvailable =
|
|
801
|
+
}, isAvailable = _ref12.isAvailable, newDiscountList = _ref12.discountList, evaluatedDiscountList = _ref12.evaluatedDiscountList, unavailableReason = _ref12.unavailableReason;
|
|
800
802
|
shouldRetainForLater = !isAvailable && unavailableReason === UnavailableReason.ProductNotApplicable && withScanList.some(isCustomerPromotionDiscount);
|
|
801
803
|
normalizedNewDiscountList = newDiscountList ? markScannedDiscounts(newDiscountList, withScanList) : undefined;
|
|
802
804
|
retainedDiscountList = evaluatedDiscountList ? markScannedDiscounts(evaluatedDiscountList, withScanList) : normalizedNewDiscountList;
|
|
@@ -879,9 +881,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
879
881
|
if (result !== null && result !== void 0 && result.productList) {
|
|
880
882
|
var previousProductsByUid = indexOrderProductsByUid(tempOrder.products);
|
|
881
883
|
tempOrder.products = this.applyProductDiscountPrices((result.productList || []).map(function (product, index) {
|
|
882
|
-
var
|
|
884
|
+
var _ref13;
|
|
883
885
|
var uid = getOrderProductLineUid(product);
|
|
884
|
-
var previous = (
|
|
886
|
+
var previous = (_ref13 = uid ? previousProductsByUid.get(uid) : undefined) !== null && _ref13 !== void 0 ? _ref13 : previousProductsByUid.get("__index__:".concat(index));
|
|
885
887
|
if (isManualProductDiscountProduct(previous)) {
|
|
886
888
|
return previous;
|
|
887
889
|
}
|
|
@@ -890,6 +892,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
890
892
|
discount_list: normalizeOrderProductDiscountList(syncManualProductDiscountProductNum(mergedProduct.discount_list, mergedProduct.num))
|
|
891
893
|
});
|
|
892
894
|
}));
|
|
895
|
+
ensureUniqueProductLineUids(tempOrder);
|
|
896
|
+
consolidateDiscountFreeProductLines(tempOrder);
|
|
893
897
|
}
|
|
894
898
|
if (result !== null && result !== void 0 && result.discountList) {
|
|
895
899
|
var _this$store$discount15;
|
|
@@ -1309,6 +1313,53 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1309
1313
|
cacheKey: ['tempOrder']
|
|
1310
1314
|
});
|
|
1311
1315
|
}
|
|
1316
|
+
|
|
1317
|
+
/**
|
|
1318
|
+
* 终止当前模块实例的 sessionStorage 订单恢复会话。
|
|
1319
|
+
*
|
|
1320
|
+
* 支付跳转等终态场景需要同时删除当前 cacheId 的 tempOrder 快照,并关闭
|
|
1321
|
+
* 本实例后续异步任务的再次写入;新模块实例初始化时会按 otherParams 重新启用。
|
|
1322
|
+
*/
|
|
1323
|
+
}, {
|
|
1324
|
+
key: "clearSessionStoragePersistedTempOrder",
|
|
1325
|
+
value: function clearSessionStoragePersistedTempOrder() {
|
|
1326
|
+
var _this$window;
|
|
1327
|
+
this.sessionStorageRestoreRecord = null;
|
|
1328
|
+
if (!this.sessionStoragePersistEnabled) return;
|
|
1329
|
+
this.sessionStoragePersistEnabled = false;
|
|
1330
|
+
if (!this.cacheId || !this.fatherModule || !((_this$window = this.window) !== null && _this$window !== void 0 && _this$window.sessionStorage)) {
|
|
1331
|
+
return;
|
|
1332
|
+
}
|
|
1333
|
+
var sessionStorage = this.window.sessionStorage;
|
|
1334
|
+
var rawCacheData = sessionStorage.getItem(this.fatherModule);
|
|
1335
|
+
if (!rawCacheData) return;
|
|
1336
|
+
var parsedCacheData;
|
|
1337
|
+
try {
|
|
1338
|
+
parsedCacheData = JSON.parse(rawCacheData);
|
|
1339
|
+
} catch (_unused2) {
|
|
1340
|
+
return;
|
|
1341
|
+
}
|
|
1342
|
+
if (!parsedCacheData || _typeof(parsedCacheData) !== 'object' || Array.isArray(parsedCacheData)) {
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
var cacheRoot = parsedCacheData;
|
|
1346
|
+
var cacheBucket = cacheRoot[this.cacheId];
|
|
1347
|
+
if (!cacheBucket || _typeof(cacheBucket) !== 'object' || Array.isArray(cacheBucket)) {
|
|
1348
|
+
return;
|
|
1349
|
+
}
|
|
1350
|
+
var moduleBucket = cacheBucket[this.name];
|
|
1351
|
+
if (!moduleBucket || _typeof(moduleBucket) !== 'object' || Array.isArray(moduleBucket)) {
|
|
1352
|
+
return;
|
|
1353
|
+
}
|
|
1354
|
+
delete moduleBucket.tempOrder;
|
|
1355
|
+
if (Object.keys(moduleBucket).length === 0) {
|
|
1356
|
+
delete cacheBucket[this.name];
|
|
1357
|
+
}
|
|
1358
|
+
if (Object.keys(cacheBucket).length === 0) {
|
|
1359
|
+
delete cacheRoot[this.cacheId];
|
|
1360
|
+
}
|
|
1361
|
+
sessionStorage.setItem(this.fatherModule, JSON.stringify(cacheRoot));
|
|
1362
|
+
}
|
|
1312
1363
|
}, {
|
|
1313
1364
|
key: "consumeSessionStorageRestore",
|
|
1314
1365
|
value: function consumeSessionStorageRestore() {
|
|
@@ -1435,15 +1486,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1435
1486
|
}, {
|
|
1436
1487
|
key: "extractOrderIdFromSubmitResult",
|
|
1437
1488
|
value: function extractOrderIdFromSubmitResult(result) {
|
|
1438
|
-
var _ref15, _ref16,
|
|
1439
|
-
return (
|
|
1489
|
+
var _ref14, _ref15, _ref16, _result$data$order_id, _result$data, _result$data2;
|
|
1490
|
+
return (_ref14 = (_ref15 = (_ref16 = (_result$data$order_id = result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.order_id) !== null && _result$data$order_id !== void 0 ? _result$data$order_id : result === null || result === void 0 ? void 0 : result.order_id) !== null && _ref16 !== void 0 ? _ref16 : result === null || result === void 0 || (_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.id) !== null && _ref15 !== void 0 ? _ref15 : result === null || result === void 0 ? void 0 : result.id) !== null && _ref14 !== void 0 ? _ref14 : null;
|
|
1440
1491
|
}
|
|
1441
1492
|
}, {
|
|
1442
1493
|
key: "calculatePaymentEffectiveAmount",
|
|
1443
1494
|
value: function calculatePaymentEffectiveAmount(payment) {
|
|
1444
|
-
var
|
|
1495
|
+
var _ref17, _payment$origin_amoun;
|
|
1445
1496
|
var amount = new Decimal(payment.amount || 0);
|
|
1446
|
-
var originAmount = new Decimal((
|
|
1497
|
+
var originAmount = new Decimal((_ref17 = (_payment$origin_amoun = payment.origin_amount) !== null && _payment$origin_amoun !== void 0 ? _payment$origin_amoun : payment.amount) !== null && _ref17 !== void 0 ? _ref17 : 0);
|
|
1447
1498
|
var serviceFee = new Decimal(payment.service_fee || 0);
|
|
1448
1499
|
// TODO: 后端允许 amount 表示顾客实际支付总额后,移除这个兼容分支。
|
|
1449
1500
|
var effectiveAmount = serviceFee.gt(0) && amount.eq(originAmount) ? amount.plus(serviceFee) : amount;
|
|
@@ -1643,12 +1694,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1643
1694
|
}, {
|
|
1644
1695
|
key: "normalizePaymentSource",
|
|
1645
1696
|
value: function normalizePaymentSource(payment, options) {
|
|
1646
|
-
var
|
|
1697
|
+
var _ref18, _paymentRecord$origin;
|
|
1647
1698
|
var paymentRecord = payment;
|
|
1648
1699
|
var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
|
|
1649
1700
|
var normalized = ensureOrderPaymentNumber(_objectSpread(_objectSpread({}, paymentRecord), {}, {
|
|
1650
1701
|
metadata: metadata,
|
|
1651
|
-
origin_amount: (
|
|
1702
|
+
origin_amount: (_ref18 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref18 !== void 0 ? _ref18 : '0.00'
|
|
1652
1703
|
}), (options === null || options === void 0 ? void 0 : options.devicePrefix) || this.getPaymentNumberDevicePrefixSync(), createUuidV4);
|
|
1653
1704
|
if (paymentRecord.status !== undefined) {
|
|
1654
1705
|
normalized.status = paymentRecord.status;
|
|
@@ -1971,7 +2022,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1971
2022
|
try {
|
|
1972
2023
|
var parsed = new Decimal(String(value || 0));
|
|
1973
2024
|
return parsed.toFixed(4);
|
|
1974
|
-
} catch (
|
|
2025
|
+
} catch (_unused3) {
|
|
1975
2026
|
return String(value);
|
|
1976
2027
|
}
|
|
1977
2028
|
}
|
|
@@ -1999,7 +2050,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1999
2050
|
_product$payment_pric,
|
|
2000
2051
|
_sku$code,
|
|
2001
2052
|
_sku$barcode,
|
|
2002
|
-
|
|
2053
|
+
_ref19,
|
|
2003
2054
|
_sku$variant_id,
|
|
2004
2055
|
_this11 = this;
|
|
2005
2056
|
var sku = (product === null || product === void 0 ? void 0 : product.product_sku) || {};
|
|
@@ -2026,24 +2077,24 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2026
2077
|
product_sku: this.normalizeFingerprintValue({
|
|
2027
2078
|
code: (_sku$code = sku.code) !== null && _sku$code !== void 0 ? _sku$code : '',
|
|
2028
2079
|
barcode: (_sku$barcode = sku.barcode) !== null && _sku$barcode !== void 0 ? _sku$barcode : '',
|
|
2029
|
-
variant_id: (
|
|
2080
|
+
variant_id: (_ref19 = (_sku$variant_id = sku.variant_id) !== null && _sku$variant_id !== void 0 ? _sku$variant_id : product === null || product === void 0 ? void 0 : product.product_variant_id) !== null && _ref19 !== void 0 ? _ref19 : 0,
|
|
2030
2081
|
variant: sku.variant || [],
|
|
2031
2082
|
option: getProductSkuOptions(product || {}).map(function (option) {
|
|
2032
|
-
var
|
|
2083
|
+
var _ref20, _option$id, _option$option_group_, _ref21, _option$option_group_2, _option$num, _option$add_price;
|
|
2033
2084
|
return {
|
|
2034
|
-
id: (
|
|
2085
|
+
id: (_ref20 = (_option$id = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id !== void 0 ? _option$id : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref20 !== void 0 ? _ref20 : null,
|
|
2035
2086
|
option_group_id: (_option$option_group_ = option === null || option === void 0 ? void 0 : option.option_group_id) !== null && _option$option_group_ !== void 0 ? _option$option_group_ : null,
|
|
2036
|
-
option_group_item_id: (
|
|
2087
|
+
option_group_item_id: (_ref21 = (_option$option_group_2 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_2 !== void 0 ? _option$option_group_2 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref21 !== void 0 ? _ref21 : null,
|
|
2037
2088
|
num: Number((_option$num = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num !== void 0 ? _option$num : 1) || 1,
|
|
2038
2089
|
add_price: _this11.normalizeFingerprintMoney((_option$add_price = option === null || option === void 0 ? void 0 : option.add_price) !== null && _option$add_price !== void 0 ? _option$add_price : option === null || option === void 0 ? void 0 : option.price)
|
|
2039
2090
|
};
|
|
2040
2091
|
})
|
|
2041
2092
|
}),
|
|
2042
2093
|
product_bundle: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.product_bundle) || []).map(function (bundle) {
|
|
2043
|
-
var
|
|
2094
|
+
var _ref22, _ref23, _bundle$bundle_produc, _ref24, _bundle$bundle_varian, _bundle$num, _bundle$price_type, _bundle$price_type_ex;
|
|
2044
2095
|
return {
|
|
2045
|
-
bundle_product_id: (
|
|
2046
|
-
bundle_variant_id: (
|
|
2096
|
+
bundle_product_id: (_ref22 = (_ref23 = (_bundle$bundle_produc = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref23 !== void 0 ? _ref23 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id) !== null && _ref22 !== void 0 ? _ref22 : null,
|
|
2097
|
+
bundle_variant_id: (_ref24 = (_bundle$bundle_varian = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle === null || bundle === void 0 ? void 0 : bundle.product_variant_id) !== null && _ref24 !== void 0 ? _ref24 : 0,
|
|
2047
2098
|
num: getSafeProductNum((_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),
|
|
2048
2099
|
price: _this11.normalizeFingerprintMoney(bundle === null || bundle === void 0 ? void 0 : bundle.price),
|
|
2049
2100
|
bundle_selling_price: _this11.normalizeFingerprintMoney(bundle === null || bundle === void 0 ? void 0 : bundle.bundle_selling_price),
|
|
@@ -2052,10 +2103,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2052
2103
|
};
|
|
2053
2104
|
})),
|
|
2054
2105
|
discount_list: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.discount_list) || []).map(function (discount) {
|
|
2055
|
-
var
|
|
2106
|
+
var _ref25, _discount$type2, _ref26, _ref27, _discount$discount_id, _discount$discount;
|
|
2056
2107
|
return {
|
|
2057
|
-
type: (
|
|
2058
|
-
discount_id: (
|
|
2108
|
+
type: (_ref25 = (_discount$type2 = discount === null || discount === void 0 ? void 0 : discount.type) !== null && _discount$type2 !== void 0 ? _discount$type2 : discount === null || discount === void 0 ? void 0 : discount.tag) !== null && _ref25 !== void 0 ? _ref25 : '',
|
|
2109
|
+
discount_id: (_ref26 = (_ref27 = (_discount$discount_id = discount === null || discount === void 0 ? void 0 : discount.discount_id) !== null && _discount$discount_id !== void 0 ? _discount$discount_id : discount === null || discount === void 0 ? void 0 : discount.order_discount_id) !== null && _ref27 !== void 0 ? _ref27 : discount === null || discount === void 0 || (_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) !== null && _ref26 !== void 0 ? _ref26 : null,
|
|
2059
2110
|
amount: _this11.normalizeFingerprintMoney(discount === null || discount === void 0 ? void 0 : discount.amount)
|
|
2060
2111
|
};
|
|
2061
2112
|
}))
|
|
@@ -2079,14 +2130,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2079
2130
|
var _product$product_id3,
|
|
2080
2131
|
_product$product_vari2,
|
|
2081
2132
|
_product$num2,
|
|
2082
|
-
|
|
2133
|
+
_ref28,
|
|
2083
2134
|
_metadata$unique_iden,
|
|
2084
2135
|
_metadata$price_overr,
|
|
2085
2136
|
_metadata$is_manual_d,
|
|
2086
2137
|
_metadata$product_dis,
|
|
2087
2138
|
_sku$code2,
|
|
2088
2139
|
_sku$barcode2,
|
|
2089
|
-
|
|
2140
|
+
_ref29,
|
|
2090
2141
|
_sku$variant_id2,
|
|
2091
2142
|
_this13 = this;
|
|
2092
2143
|
var sku = (product === null || product === void 0 ? void 0 : product.product_sku) || {};
|
|
@@ -2102,7 +2153,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2102
2153
|
extension_type: extensionType,
|
|
2103
2154
|
num: getSafeProductNum((_product$num2 = product === null || product === void 0 ? void 0 : product.num) !== null && _product$num2 !== void 0 ? _product$num2 : product === null || product === void 0 ? void 0 : product.product_quantity),
|
|
2104
2155
|
metadata: {
|
|
2105
|
-
unique_identification_number: (
|
|
2156
|
+
unique_identification_number: (_ref28 = (_metadata$unique_iden = metadata.unique_identification_number) !== null && _metadata$unique_iden !== void 0 ? _metadata$unique_iden : product === null || product === void 0 ? void 0 : product.unique_identification_number) !== null && _ref28 !== void 0 ? _ref28 : '',
|
|
2106
2157
|
price_override: (_metadata$price_overr = metadata.price_override) !== null && _metadata$price_overr !== void 0 ? _metadata$price_overr : '',
|
|
2107
2158
|
is_manual_discount: (_metadata$is_manual_d = metadata.is_manual_discount) !== null && _metadata$is_manual_d !== void 0 ? _metadata$is_manual_d : '',
|
|
2108
2159
|
product_discount_reason: (_metadata$product_dis = metadata.product_discount_reason) !== null && _metadata$product_dis !== void 0 ? _metadata$product_dis : ''
|
|
@@ -2110,35 +2161,35 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2110
2161
|
product_sku: this.normalizeFingerprintValue({
|
|
2111
2162
|
code: (_sku$code2 = sku.code) !== null && _sku$code2 !== void 0 ? _sku$code2 : '',
|
|
2112
2163
|
barcode: (_sku$barcode2 = sku.barcode) !== null && _sku$barcode2 !== void 0 ? _sku$barcode2 : '',
|
|
2113
|
-
variant_id: (
|
|
2164
|
+
variant_id: (_ref29 = (_sku$variant_id2 = sku.variant_id) !== null && _sku$variant_id2 !== void 0 ? _sku$variant_id2 : product === null || product === void 0 ? void 0 : product.product_variant_id) !== null && _ref29 !== void 0 ? _ref29 : 0,
|
|
2114
2165
|
variant: sku.variant || [],
|
|
2115
2166
|
option: getProductSkuOptions(product || {}).map(function (option) {
|
|
2116
|
-
var
|
|
2167
|
+
var _ref30, _option$id2, _option$option_group_3, _ref31, _option$option_group_4, _option$num2, _option$add_price2;
|
|
2117
2168
|
return {
|
|
2118
|
-
id: (
|
|
2169
|
+
id: (_ref30 = (_option$id2 = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id2 !== void 0 ? _option$id2 : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref30 !== void 0 ? _ref30 : null,
|
|
2119
2170
|
option_group_id: (_option$option_group_3 = option === null || option === void 0 ? void 0 : option.option_group_id) !== null && _option$option_group_3 !== void 0 ? _option$option_group_3 : null,
|
|
2120
|
-
option_group_item_id: (
|
|
2171
|
+
option_group_item_id: (_ref31 = (_option$option_group_4 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_4 !== void 0 ? _option$option_group_4 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref31 !== void 0 ? _ref31 : null,
|
|
2121
2172
|
num: Number((_option$num2 = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num2 !== void 0 ? _option$num2 : 1) || 1,
|
|
2122
2173
|
add_price: _this13.normalizeFingerprintMoney((_option$add_price2 = option === null || option === void 0 ? void 0 : option.add_price) !== null && _option$add_price2 !== void 0 ? _option$add_price2 : option === null || option === void 0 ? void 0 : option.price)
|
|
2123
2174
|
};
|
|
2124
2175
|
})
|
|
2125
2176
|
}),
|
|
2126
2177
|
product_bundle: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.product_bundle) || []).map(function (bundle) {
|
|
2127
|
-
var
|
|
2178
|
+
var _ref32, _bundle$bundle_id, _ref33, _bundle$bundle_group_, _ref34, _ref35, _bundle$bundle_produc2, _ref36, _bundle$bundle_varian2, _bundle$num2, _bundle$price_type2, _bundle$price_type_ex2;
|
|
2128
2179
|
return {
|
|
2129
|
-
bundle_id: (
|
|
2130
|
-
bundle_group_id: (
|
|
2131
|
-
bundle_product_id: (
|
|
2132
|
-
bundle_variant_id: (
|
|
2180
|
+
bundle_id: (_ref32 = (_bundle$bundle_id = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_id) !== null && _bundle$bundle_id !== void 0 ? _bundle$bundle_id : bundle === null || bundle === void 0 ? void 0 : bundle.id) !== null && _ref32 !== void 0 ? _ref32 : null,
|
|
2181
|
+
bundle_group_id: (_ref33 = (_bundle$bundle_group_ = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle === null || bundle === void 0 ? void 0 : bundle.group_id) !== null && _ref33 !== void 0 ? _ref33 : null,
|
|
2182
|
+
bundle_product_id: (_ref34 = (_ref35 = (_bundle$bundle_produc2 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc2 !== void 0 ? _bundle$bundle_produc2 : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref35 !== void 0 ? _ref35 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id) !== null && _ref34 !== void 0 ? _ref34 : null,
|
|
2183
|
+
bundle_variant_id: (_ref36 = (_bundle$bundle_varian2 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_variant_id) !== null && _bundle$bundle_varian2 !== void 0 ? _bundle$bundle_varian2 : bundle === null || bundle === void 0 ? void 0 : bundle.product_variant_id) !== null && _ref36 !== void 0 ? _ref36 : 0,
|
|
2133
2184
|
num: getSafeProductNum((_bundle$num2 = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num2 !== void 0 ? _bundle$num2 : bundle === null || bundle === void 0 ? void 0 : bundle.quantity),
|
|
2134
2185
|
price_type: (_bundle$price_type2 = bundle === null || bundle === void 0 ? void 0 : bundle.price_type) !== null && _bundle$price_type2 !== void 0 ? _bundle$price_type2 : '',
|
|
2135
2186
|
price_type_ext: (_bundle$price_type_ex2 = bundle === null || bundle === void 0 ? void 0 : bundle.price_type_ext) !== null && _bundle$price_type_ex2 !== void 0 ? _bundle$price_type_ex2 : '',
|
|
2136
2187
|
option: _this13.normalizeFingerprintValue(((bundle === null || bundle === void 0 ? void 0 : bundle.option) || []).map(function (option) {
|
|
2137
|
-
var
|
|
2188
|
+
var _ref37, _option$id3, _option$option_group_5, _ref38, _option$option_group_6, _option$num3, _option$add_price3;
|
|
2138
2189
|
return {
|
|
2139
|
-
id: (
|
|
2190
|
+
id: (_ref37 = (_option$id3 = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id3 !== void 0 ? _option$id3 : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref37 !== void 0 ? _ref37 : null,
|
|
2140
2191
|
option_group_id: (_option$option_group_5 = option === null || option === void 0 ? void 0 : option.option_group_id) !== null && _option$option_group_5 !== void 0 ? _option$option_group_5 : null,
|
|
2141
|
-
option_group_item_id: (
|
|
2192
|
+
option_group_item_id: (_ref38 = (_option$option_group_6 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_6 !== void 0 ? _option$option_group_6 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref38 !== void 0 ? _ref38 : null,
|
|
2142
2193
|
num: Number((_option$num3 = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num3 !== void 0 ? _option$num3 : 1) || 1,
|
|
2143
2194
|
add_price: _this13.normalizeFingerprintMoney((_option$add_price3 = option === null || option === void 0 ? void 0 : option.add_price) !== null && _option$add_price3 !== void 0 ? _option$add_price3 : option === null || option === void 0 ? void 0 : option.price)
|
|
2144
2195
|
};
|
|
@@ -2146,10 +2197,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2146
2197
|
};
|
|
2147
2198
|
})),
|
|
2148
2199
|
discount_list: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.discount_list) || []).map(function (discount) {
|
|
2149
|
-
var
|
|
2200
|
+
var _ref39, _discount$type4, _ref40, _ref41, _discount$discount_id2, _discount$discount2;
|
|
2150
2201
|
return {
|
|
2151
|
-
type: (
|
|
2152
|
-
discount_id: (
|
|
2202
|
+
type: (_ref39 = (_discount$type4 = discount === null || discount === void 0 ? void 0 : discount.type) !== null && _discount$type4 !== void 0 ? _discount$type4 : discount === null || discount === void 0 ? void 0 : discount.tag) !== null && _ref39 !== void 0 ? _ref39 : '',
|
|
2203
|
+
discount_id: (_ref40 = (_ref41 = (_discount$discount_id2 = discount === null || discount === void 0 ? void 0 : discount.discount_id) !== null && _discount$discount_id2 !== void 0 ? _discount$discount_id2 : discount === null || discount === void 0 ? void 0 : discount.order_discount_id) !== null && _ref41 !== void 0 ? _ref41 : discount === null || discount === void 0 || (_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.resource_id) !== null && _ref40 !== void 0 ? _ref40 : null,
|
|
2153
2204
|
amount: _this13.normalizeFingerprintMoney(discount === null || discount === void 0 ? void 0 : discount.amount)
|
|
2154
2205
|
};
|
|
2155
2206
|
}))
|
|
@@ -2454,11 +2505,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2454
2505
|
}, {
|
|
2455
2506
|
key: "getOrderIdentity",
|
|
2456
2507
|
value: function getOrderIdentity() {
|
|
2457
|
-
var
|
|
2508
|
+
var _ref42, _ref43, _tempOrder$order_id, _tempOrder$_extend6;
|
|
2458
2509
|
var tempOrder = this.store.tempOrder;
|
|
2459
2510
|
if (!tempOrder) return null;
|
|
2460
2511
|
var lastOrderInfo = this.store.lastOrderInfo || {};
|
|
2461
|
-
var orderId = (
|
|
2512
|
+
var orderId = (_ref42 = (_ref43 = (_tempOrder$order_id = tempOrder.order_id) !== null && _tempOrder$order_id !== void 0 ? _tempOrder$order_id : lastOrderInfo.order_id) !== null && _ref43 !== void 0 ? _ref43 : lastOrderInfo.id) !== null && _ref42 !== void 0 ? _ref42 : null;
|
|
2462
2513
|
return {
|
|
2463
2514
|
localId: this.cacheId || ((_tempOrder$_extend6 = tempOrder._extend) === null || _tempOrder$_extend6 === void 0 ? void 0 : _tempOrder$_extend6.localId),
|
|
2464
2515
|
orderId: orderId,
|
|
@@ -2594,6 +2645,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2594
2645
|
tempOrder.products = (tempOrder.products || []).map(function (product) {
|
|
2595
2646
|
return _this15.sanitizeOrderProductForTempOrder(product);
|
|
2596
2647
|
});
|
|
2648
|
+
ensureUniqueProductLineUids(tempOrder);
|
|
2597
2649
|
}
|
|
2598
2650
|
}, {
|
|
2599
2651
|
key: "ensureExtend",
|
|
@@ -2608,14 +2660,29 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2608
2660
|
}
|
|
2609
2661
|
return tempOrder._extend;
|
|
2610
2662
|
}
|
|
2663
|
+
}, {
|
|
2664
|
+
key: "repairDuplicateProductLineIdentities",
|
|
2665
|
+
value: function repairDuplicateProductLineIdentities(tempOrder) {
|
|
2666
|
+
var _tempOrder$_extend7;
|
|
2667
|
+
var result = repairDuplicateOrderProductLineIdentities(tempOrder.products, (_tempOrder$_extend7 = tempOrder._extend) === null || _tempOrder$_extend7 === void 0 ? void 0 : _tempOrder$_extend7.productsByUid);
|
|
2668
|
+
if (!result.repairs.length) return;
|
|
2669
|
+
tempOrder.products = result.products;
|
|
2670
|
+
if (result.productsByUid) {
|
|
2671
|
+
this.ensureExtend(tempOrder).productsByUid = result.productsByUid;
|
|
2672
|
+
}
|
|
2673
|
+
this.logWarning('Repaired duplicate product line identities', {
|
|
2674
|
+
repairCount: result.repairs.length,
|
|
2675
|
+
repairs: result.repairs
|
|
2676
|
+
});
|
|
2677
|
+
}
|
|
2611
2678
|
}, {
|
|
2612
2679
|
key: "captureProductRuntime",
|
|
2613
2680
|
value: function captureProductRuntime(tempOrder, rawProduct, normalizedProduct, existedUid) {
|
|
2614
|
-
var _extend$productsByUid,
|
|
2681
|
+
var _extend$productsByUid, _ref44, _rawProduct$_origin;
|
|
2615
2682
|
var uid = existedUid || this.getProductUid(normalizedProduct);
|
|
2616
2683
|
var extend = this.ensureExtend(tempOrder);
|
|
2617
2684
|
var existed = ((_extend$productsByUid = extend.productsByUid) === null || _extend$productsByUid === void 0 ? void 0 : _extend$productsByUid[uid]) || {};
|
|
2618
|
-
var origin = (
|
|
2685
|
+
var origin = (_ref44 = (_rawProduct$_origin = rawProduct._origin) !== null && _rawProduct$_origin !== void 0 ? _rawProduct$_origin : normalizedProduct._origin) !== null && _ref44 !== void 0 ? _ref44 : existed.origin;
|
|
2619
2686
|
extend.productsByUid[uid] = _objectSpread(_objectSpread({}, existed), origin !== undefined ? {
|
|
2620
2687
|
origin: origin
|
|
2621
2688
|
} : {});
|
|
@@ -2714,10 +2781,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2714
2781
|
}
|
|
2715
2782
|
});
|
|
2716
2783
|
products.forEach(function (product) {
|
|
2717
|
-
var _product$
|
|
2784
|
+
var _product$metadata3, _product$metadata4;
|
|
2718
2785
|
if (!product || _typeof(product) !== 'object') return;
|
|
2719
|
-
var productUid = ((_product$
|
|
2720
|
-
var bookingUid = product.booking_uid || ((_product$
|
|
2786
|
+
var productUid = ((_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.unique_identification_number) || product.unique_identification_number;
|
|
2787
|
+
var bookingUid = product.booking_uid || ((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.booking_uid);
|
|
2721
2788
|
var linkedBooking = (productUid !== undefined && productUid !== null && String(productUid) !== '' ? bookingByProductUid.get(String(productUid)) : undefined) || (bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '' ? bookingByBookingUid.get(String(bookingUid)) : undefined);
|
|
2722
2789
|
if (linkedBooking) {
|
|
2723
2790
|
_this16.setProductHolderFromBooking(product, linkedBooking);
|
|
@@ -2758,7 +2825,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2758
2825
|
}, {
|
|
2759
2826
|
key: "buildTempOrderHolderFromBookings",
|
|
2760
2827
|
value: function buildTempOrderHolderFromBookings(tempOrder) {
|
|
2761
|
-
var _baseHolder$customer_, _baseHolder,
|
|
2828
|
+
var _baseHolder$customer_, _baseHolder, _ref45, _baseHolder$form_id, _baseHolder2, _tempOrder$holder2, _baseHolder3, _this$otherParams;
|
|
2762
2829
|
var holderRecords = [];
|
|
2763
2830
|
var holderNames = [];
|
|
2764
2831
|
var baseHolder = null;
|
|
@@ -2805,7 +2872,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2805
2872
|
}
|
|
2806
2873
|
var nextHolder = {
|
|
2807
2874
|
customer_id: (_baseHolder$customer_ = (_baseHolder = baseHolder) === null || _baseHolder === void 0 ? void 0 : _baseHolder.customer_id) !== null && _baseHolder$customer_ !== void 0 ? _baseHolder$customer_ : tempOrder.customer_id,
|
|
2808
|
-
form_id: (
|
|
2875
|
+
form_id: (_ref45 = (_baseHolder$form_id = (_baseHolder2 = baseHolder) === null || _baseHolder2 === void 0 ? void 0 : _baseHolder2.form_id) !== null && _baseHolder$form_id !== void 0 ? _baseHolder$form_id : (_tempOrder$holder2 = tempOrder.holder) === null || _tempOrder$holder2 === void 0 ? void 0 : _tempOrder$holder2.form_id) !== null && _ref45 !== void 0 ? _ref45 : 0,
|
|
2809
2876
|
form_record: holderRecords
|
|
2810
2877
|
};
|
|
2811
2878
|
if (holderNames.length) {
|
|
@@ -2856,11 +2923,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2856
2923
|
}, {
|
|
2857
2924
|
key: "removeLinkedBookingsForProduct",
|
|
2858
2925
|
value: function removeLinkedBookingsForProduct(tempOrder, product) {
|
|
2859
|
-
var _product$
|
|
2860
|
-
_product$
|
|
2926
|
+
var _product$metadata5,
|
|
2927
|
+
_product$metadata6,
|
|
2861
2928
|
_this18 = this;
|
|
2862
|
-
var productUid = (product === null || product === void 0 || (_product$
|
|
2863
|
-
var bookingUid = (product === null || product === void 0 ? void 0 : product.booking_uid) || (product === null || product === void 0 || (_product$
|
|
2929
|
+
var productUid = (product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number) || (product === null || product === void 0 ? void 0 : product.unique_identification_number);
|
|
2930
|
+
var bookingUid = (product === null || product === void 0 ? void 0 : product.booking_uid) || (product === null || product === void 0 || (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.booking_uid);
|
|
2864
2931
|
if (!productUid && !bookingUid) return;
|
|
2865
2932
|
tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
|
|
2866
2933
|
var currentBookingUid = _this18.getBookingUniqueIdentificationNumber(booking);
|
|
@@ -2880,9 +2947,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2880
2947
|
}, {
|
|
2881
2948
|
key: "applyOrderProductsDepositSummary",
|
|
2882
2949
|
value: function applyOrderProductsDepositSummary(tempOrder, summary) {
|
|
2883
|
-
var _tempOrder$
|
|
2950
|
+
var _tempOrder$_extend8;
|
|
2884
2951
|
var depositSummary = calculateOrderProductsDeposit(tempOrder.products || [], {
|
|
2885
|
-
productsByUid: (_tempOrder$
|
|
2952
|
+
productsByUid: (_tempOrder$_extend8 = tempOrder._extend) === null || _tempOrder$_extend8 === void 0 ? void 0 : _tempOrder$_extend8.productsByUid
|
|
2886
2953
|
});
|
|
2887
2954
|
var manualDepositOverride = this.getManualDepositOverride(tempOrder);
|
|
2888
2955
|
var currentStructuralFingerprint = manualDepositOverride ? this.buildOrderProductsStructuralFingerprint(tempOrder.products) : '';
|
|
@@ -2910,7 +2977,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2910
2977
|
key: "recalculateSummary",
|
|
2911
2978
|
value: function () {
|
|
2912
2979
|
var _recalculateSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(options) {
|
|
2913
|
-
var _this$otherParams2,
|
|
2980
|
+
var _this$otherParams2, _ref46, _salesSummaryResult$e;
|
|
2914
2981
|
var tempOrder, originalSnapshot, hasShopDiscountChanged, shouldReuseOriginalSnapshot, snapshotSummary, shouldFullRecalculateFromSnapshot, summaryProducts, salesSummary, existedSummary, totalRefundAmount, paidPaymentSummary, emptyBaseSummary, emptySummaryBase, emptySummaryWithDeposit, emptySummary, salesSummaryResult, roundingAmount, payServiceChargeAmount, hasSalesSummaryAmount, expectAmount, amountPaymentPatch, normalizedExpectAmountPatch, summaryForGap, summary;
|
|
2915
2982
|
return _regeneratorRuntime().wrap(function _callee12$(_context14) {
|
|
2916
2983
|
while (1) switch (_context14.prev = _context14.next) {
|
|
@@ -2988,7 +3055,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2988
3055
|
roundingAmount = paidPaymentSummary.roundingAmount;
|
|
2989
3056
|
payServiceChargeAmount = paidPaymentSummary.payServiceChargeAmount;
|
|
2990
3057
|
hasSalesSummaryAmount = salesSummaryResult.expect_amount !== undefined || salesSummaryResult.total_amount !== undefined;
|
|
2991
|
-
expectAmount = hasSalesSummaryAmount ? new Decimal((
|
|
3058
|
+
expectAmount = hasSalesSummaryAmount ? new Decimal((_ref46 = (_salesSummaryResult$e = salesSummaryResult.expect_amount) !== null && _salesSummaryResult$e !== void 0 ? _salesSummaryResult$e : salesSummaryResult.total_amount) !== null && _ref46 !== void 0 ? _ref46 : 0) : null;
|
|
2992
3059
|
amountPaymentPatch = hasSalesSummaryAmount || !roundingAmount.eq(0) || !payServiceChargeAmount.eq(0) ? _objectSpread({
|
|
2993
3060
|
rounding_amount: roundingAmount.toFixed(2)
|
|
2994
3061
|
}, expectAmount ? {
|
|
@@ -3166,17 +3233,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3166
3233
|
}, {
|
|
3167
3234
|
key: "buildTempOrderCustomer",
|
|
3168
3235
|
value: function buildTempOrderCustomer(params) {
|
|
3169
|
-
var _ref48, _ref49,
|
|
3236
|
+
var _ref47, _ref48, _ref49, _source$name, _ref50, _ref51, _ref52, _source$customer_name, _source$id, _source$customer_id, _ref53, _source$country_calli, _source$phone, _source$email;
|
|
3170
3237
|
if (!params.customerId) return null;
|
|
3171
3238
|
var source = params.source ? cloneDeep(params.source) : {};
|
|
3172
|
-
var name = (
|
|
3173
|
-
var customerName = (
|
|
3239
|
+
var name = (_ref47 = (_ref48 = (_ref49 = (_source$name = source.name) !== null && _source$name !== void 0 ? _source$name : source.display_name) !== null && _ref49 !== void 0 ? _ref49 : source.customerName) !== null && _ref48 !== void 0 ? _ref48 : source.customer_name) !== null && _ref47 !== void 0 ? _ref47 : params.customerName;
|
|
3240
|
+
var customerName = (_ref50 = (_ref51 = (_ref52 = (_source$customer_name = source.customer_name) !== null && _source$customer_name !== void 0 ? _source$customer_name : source.customerName) !== null && _ref52 !== void 0 ? _ref52 : source.display_name) !== null && _ref51 !== void 0 ? _ref51 : source.name) !== null && _ref50 !== void 0 ? _ref50 : params.customerName;
|
|
3174
3241
|
return _objectSpread(_objectSpread({}, source), {}, {
|
|
3175
3242
|
id: (_source$id = source.id) !== null && _source$id !== void 0 ? _source$id : params.customerId,
|
|
3176
3243
|
customer_id: (_source$customer_id = source.customer_id) !== null && _source$customer_id !== void 0 ? _source$customer_id : params.customerId,
|
|
3177
3244
|
name: String(name || ''),
|
|
3178
3245
|
customer_name: String(customerName || ''),
|
|
3179
|
-
country_calling_code: String((
|
|
3246
|
+
country_calling_code: String((_ref53 = (_source$country_calli = source.country_calling_code) !== null && _source$country_calli !== void 0 ? _source$country_calli : source.countryCallingCode) !== null && _ref53 !== void 0 ? _ref53 : params.countryCallingCode),
|
|
3180
3247
|
phone: String((_source$phone = source.phone) !== null && _source$phone !== void 0 ? _source$phone : params.phone),
|
|
3181
3248
|
email: String((_source$email = source.email) !== null && _source$email !== void 0 ? _source$email : params.email)
|
|
3182
3249
|
});
|
|
@@ -3280,14 +3347,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3280
3347
|
}, {
|
|
3281
3348
|
key: "updateTempOrderCustomer",
|
|
3282
3349
|
value: function updateTempOrderCustomer(customer) {
|
|
3283
|
-
var _tempOrder$customer_i2,
|
|
3350
|
+
var _tempOrder$customer_i2, _ref54, _ref55, _customer$customer_id, _ref56, _ref57, _ref58, _customer$customer_na, _ref59, _customer$country_cal, _tempOrder$customer_i3;
|
|
3284
3351
|
var tempOrder = this.ensureTempOrder();
|
|
3285
3352
|
var previousCustomerId = (_tempOrder$customer_i2 = tempOrder.customer_id) !== null && _tempOrder$customer_i2 !== void 0 ? _tempOrder$customer_i2 : null;
|
|
3286
|
-
var customerId = (
|
|
3287
|
-
var customerName = (
|
|
3353
|
+
var customerId = (_ref54 = (_ref55 = (_customer$customer_id = customer.customer_id) !== null && _customer$customer_id !== void 0 ? _customer$customer_id : customer.customerId) !== null && _ref55 !== void 0 ? _ref55 : customer.id) !== null && _ref54 !== void 0 ? _ref54 : null;
|
|
3354
|
+
var customerName = (_ref56 = (_ref57 = (_ref58 = (_customer$customer_na = customer.customer_name) !== null && _customer$customer_na !== void 0 ? _customer$customer_na : customer.customerName) !== null && _ref58 !== void 0 ? _ref58 : customer.display_name) !== null && _ref57 !== void 0 ? _ref57 : customer.name) !== null && _ref56 !== void 0 ? _ref56 : '';
|
|
3288
3355
|
tempOrder.customer_id = customerId === null || customerId === undefined || customerId === '' ? null : Number(customerId);
|
|
3289
3356
|
tempOrder.customer_name = String(customerName || '');
|
|
3290
|
-
tempOrder.country_calling_code = String((
|
|
3357
|
+
tempOrder.country_calling_code = String((_ref59 = (_customer$country_cal = customer.country_calling_code) !== null && _customer$country_cal !== void 0 ? _customer$country_cal : customer.countryCallingCode) !== null && _ref59 !== void 0 ? _ref59 : '');
|
|
3291
3358
|
tempOrder.phone = String(customer.phone || '');
|
|
3292
3359
|
tempOrder.email = String(customer.email || '');
|
|
3293
3360
|
tempOrder.customer = this.buildTempOrderCustomer({
|
|
@@ -3383,6 +3450,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3383
3450
|
if (tempOrder._extend) delete tempOrder._extend.customerSnapshot;
|
|
3384
3451
|
this.store.availableWalletIds = [];
|
|
3385
3452
|
this.clearCustomerBoundDiscounts(tempOrder);
|
|
3453
|
+
this.applyDiscount();
|
|
3386
3454
|
this.persistTempOrder();
|
|
3387
3455
|
this.saveDraftInBackground();
|
|
3388
3456
|
this.core.effects.emit(OrderHooks.OnOrderCustomerChange, null);
|
|
@@ -3862,8 +3930,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3862
3930
|
}, {
|
|
3863
3931
|
key: "hasLinkedBookingUid",
|
|
3864
3932
|
value: function hasLinkedBookingUid(product) {
|
|
3865
|
-
var _product$booking_uid, _product$
|
|
3866
|
-
var bookingUid = (_product$booking_uid = product === null || product === void 0 ? void 0 : product.booking_uid) !== null && _product$booking_uid !== void 0 ? _product$booking_uid : product === null || product === void 0 || (_product$
|
|
3933
|
+
var _product$booking_uid, _product$metadata7;
|
|
3934
|
+
var bookingUid = (_product$booking_uid = product === null || product === void 0 ? void 0 : product.booking_uid) !== null && _product$booking_uid !== void 0 ? _product$booking_uid : product === null || product === void 0 || (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.booking_uid;
|
|
3867
3935
|
return bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '';
|
|
3868
3936
|
}
|
|
3869
3937
|
|
|
@@ -3928,11 +3996,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3928
3996
|
}, {
|
|
3929
3997
|
key: "appendProductLineToTempOrder",
|
|
3930
3998
|
value: (function () {
|
|
3931
|
-
var _appendProductLineToTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(tempOrder, product, booking) {
|
|
3932
|
-
var
|
|
3999
|
+
var _appendProductLineToTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(tempOrder, product, booking, options) {
|
|
4000
|
+
var _normalizedIncoming$p,
|
|
4001
|
+
_normalizedIncoming$p2,
|
|
4002
|
+
_booking_uid,
|
|
3933
4003
|
_metadata,
|
|
4004
|
+
_productToAdd$metadat,
|
|
4005
|
+
_origin,
|
|
3934
4006
|
_this26 = this;
|
|
3935
|
-
var linked, productToAdd, incomingFingerprint, normalizedIncoming, incomingBookingUid, hasIncomingGoodPass, hasIncomingProductNote, hasIncomingBookingUid, shouldForceNewLine, matchedIndex, matchedProduct, existedFingerprint, shouldMerge, _targetProduct$metada, targetProduct, targetUid, normalizedProduct, nextNum,
|
|
4007
|
+
var linked, productToAdd, incomingFingerprint, normalizedIncoming, isWeighingProduct, netWeight, incomingBookingUid, hasIncomingGoodPass, hasIncomingProductNote, hasIncomingManualProductDiscount, hasIncomingBookingUid, isIncomingCustomItem, shouldForceNewLine, matchedIndex, matchedProduct, existedFingerprint, shouldMerge, insertAtIndex, _targetProduct$metada, targetProduct, targetUid, normalizedProduct, nextNum, mergedProduct;
|
|
3936
4008
|
return _regeneratorRuntime().wrap(function _callee20$(_context22) {
|
|
3937
4009
|
while (1) switch (_context22.prev = _context22.next) {
|
|
3938
4010
|
case 0:
|
|
@@ -3943,6 +4015,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3943
4015
|
productToAdd = (linked === null || linked === void 0 ? void 0 : linked.product) || product;
|
|
3944
4016
|
incomingFingerprint = buildProductLineFingerprint(getProductSkuOptions(productToAdd), productToAdd.product_bundle);
|
|
3945
4017
|
normalizedIncoming = mergeOrderProductDisplayFields(productToAdd, normalizeOrderProduct(productToAdd));
|
|
4018
|
+
isWeighingProduct = Number(((_normalizedIncoming$p = normalizedIncoming.product_sku) === null || _normalizedIncoming$p === void 0 ? void 0 : _normalizedIncoming$p.open_sold_weight) || 0) === 1;
|
|
4019
|
+
netWeight = Number((_normalizedIncoming$p2 = normalizedIncoming.product_sku) === null || _normalizedIncoming$p2 === void 0 ? void 0 : _normalizedIncoming$p2.net_weight);
|
|
4020
|
+
if (!(isWeighingProduct && (!Number.isFinite(netWeight) || netWeight <= 0))) {
|
|
4021
|
+
_context22.next = 8;
|
|
4022
|
+
break;
|
|
4023
|
+
}
|
|
4024
|
+
throw new Error('[Order] 称重商品净重必须大于 0');
|
|
4025
|
+
case 8:
|
|
3946
4026
|
incomingBookingUid = (_booking_uid = productToAdd.booking_uid) !== null && _booking_uid !== void 0 ? _booking_uid : (_metadata = productToAdd.metadata) === null || _metadata === void 0 ? void 0 : _metadata.booking_uid;
|
|
3947
4027
|
if (incomingBookingUid !== undefined && incomingBookingUid !== null && String(incomingBookingUid) !== '') {
|
|
3948
4028
|
normalizedIncoming.booking_uid = String(incomingBookingUid);
|
|
@@ -3953,12 +4033,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3953
4033
|
normalizedIncoming.discount_list = normalizeOrderProductDiscountList(normalizedIncoming.discount_list);
|
|
3954
4034
|
hasIncomingGoodPass = this.hasGoodPassDiscount(normalizedIncoming);
|
|
3955
4035
|
hasIncomingProductNote = this.hasOrderProductLineNote(normalizedIncoming);
|
|
4036
|
+
hasIncomingManualProductDiscount = isManualProductDiscountProduct(normalizedIncoming);
|
|
3956
4037
|
hasIncomingBookingUid = this.hasLinkedBookingUid(productToAdd) || this.hasLinkedBookingUid(normalizedIncoming);
|
|
3957
|
-
|
|
4038
|
+
isIncomingCustomItem = ((_productToAdd$metadat = productToAdd.metadata) === null || _productToAdd$metadat === void 0 || (_productToAdd$metadat = _productToAdd$metadat.origin) === null || _productToAdd$metadat === void 0 ? void 0 : _productToAdd$metadat.isCustomItem) === true || ((_origin = productToAdd._origin) === null || _origin === void 0 ? void 0 : _origin.isCustomItem) === true;
|
|
4039
|
+
shouldForceNewLine = !!booking || hasIncomingProductNote || hasIncomingManualProductDiscount || hasIncomingBookingUid || isIncomingCustomItem || isWeighingProduct;
|
|
3958
4040
|
matchedIndex = hasIncomingGoodPass || shouldForceNewLine ? -1 : tempOrder.products.findIndex(function (item) {
|
|
3959
4041
|
var _item$metadata3;
|
|
3960
4042
|
if (_this26.hasGoodPassDiscount(item)) return false;
|
|
3961
4043
|
if (_this26.hasOrderProductLineNote(item)) return false;
|
|
4044
|
+
if (isManualProductDiscountProduct(item)) return false;
|
|
3962
4045
|
if (item.order_detail_id !== undefined && item.order_detail_id !== null) return false;
|
|
3963
4046
|
if ((_item$metadata3 = item.metadata) !== null && _item$metadata3 !== void 0 && _item$metadata3.is_edit_for_runtime) return false;
|
|
3964
4047
|
if (item.product_id !== productToAdd.product_id) return false;
|
|
@@ -3969,10 +4052,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3969
4052
|
matchedProduct = matchedIndex === -1 ? null : tempOrder.products[matchedIndex];
|
|
3970
4053
|
existedFingerprint = matchedProduct ? buildProductLineFingerprint(getProductSkuOptions(matchedProduct), matchedProduct.product_bundle) : '';
|
|
3971
4054
|
if (!matchedProduct) {
|
|
3972
|
-
_context22.next =
|
|
4055
|
+
_context22.next = 26;
|
|
3973
4056
|
break;
|
|
3974
4057
|
}
|
|
3975
|
-
_context22.next =
|
|
4058
|
+
_context22.next = 23;
|
|
3976
4059
|
return this.shouldMergeProductToOrder({
|
|
3977
4060
|
incomingProduct: productToAdd,
|
|
3978
4061
|
normalizedIncoming: normalizedIncoming,
|
|
@@ -3983,13 +4066,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3983
4066
|
tempOrder: tempOrder,
|
|
3984
4067
|
booking: booking
|
|
3985
4068
|
});
|
|
3986
|
-
case
|
|
4069
|
+
case 23:
|
|
3987
4070
|
_context22.t0 = _context22.sent;
|
|
3988
|
-
_context22.next =
|
|
4071
|
+
_context22.next = 27;
|
|
3989
4072
|
break;
|
|
3990
|
-
case
|
|
4073
|
+
case 26:
|
|
3991
4074
|
_context22.t0 = false;
|
|
3992
|
-
case
|
|
4075
|
+
case 27:
|
|
3993
4076
|
shouldMerge = _context22.t0;
|
|
3994
4077
|
if (matchedIndex === -1 || !matchedProduct || !shouldMerge) {
|
|
3995
4078
|
this.captureProductRuntime(tempOrder, productToAdd, normalizedIncoming);
|
|
@@ -3999,8 +4082,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3999
4082
|
booking_uid: linked.bookingUid
|
|
4000
4083
|
});
|
|
4001
4084
|
}
|
|
4002
|
-
|
|
4003
|
-
|
|
4085
|
+
insertAtIndex = options === null || options === void 0 ? void 0 : options.insertAtIndex;
|
|
4086
|
+
if (Number.isInteger(insertAtIndex) && Number(insertAtIndex) >= 0 && Number(insertAtIndex) < tempOrder.products.length) {
|
|
4087
|
+
tempOrder.products = [].concat(_toConsumableArray(tempOrder.products.slice(0, insertAtIndex)), [normalizedIncoming], _toConsumableArray(tempOrder.products.slice(insertAtIndex)));
|
|
4088
|
+
} else {
|
|
4089
|
+
tempOrder.products = [].concat(_toConsumableArray(tempOrder.products), [normalizedIncoming]);
|
|
4090
|
+
}
|
|
4004
4091
|
} else {
|
|
4005
4092
|
targetProduct = matchedProduct;
|
|
4006
4093
|
targetUid = (_targetProduct$metada = targetProduct.metadata) === null || _targetProduct$metada === void 0 ? void 0 : _targetProduct$metada.unique_identification_number;
|
|
@@ -4011,10 +4098,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4011
4098
|
})));
|
|
4012
4099
|
normalizedProduct.discount_list = normalizeOrderProductDiscountList(normalizedProduct.discount_list);
|
|
4013
4100
|
nextNum = getSafeProductNum(targetProduct.num + normalizedProduct.num);
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
tempOrder.products[matchedIndex] = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, targetProduct), normalizedProduct), {}, {
|
|
4017
|
-
discount_list: nextDiscountList,
|
|
4101
|
+
tempOrder.products[matchedIndex] = _objectSpread(_objectSpread(_objectSpread({}, targetProduct), normalizedProduct), {}, {
|
|
4102
|
+
discount_list: normalizedProduct.discount_list,
|
|
4018
4103
|
metadata: _objectSpread(_objectSpread(_objectSpread({}, targetProduct.metadata || {}), normalizedProduct.metadata || {}), {}, {
|
|
4019
4104
|
unique_identification_number: targetUid
|
|
4020
4105
|
}),
|
|
@@ -4024,31 +4109,27 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4024
4109
|
option: []
|
|
4025
4110
|
}), {}, {
|
|
4026
4111
|
option: getProductSkuOptions(normalizedProduct)
|
|
4027
|
-
})
|
|
4028
|
-
}, targetIsManualProductDiscount ? {
|
|
4029
|
-
selling_price: targetProduct.selling_price,
|
|
4030
|
-
original_price: targetProduct.original_price,
|
|
4031
|
-
payment_price: targetProduct.payment_price,
|
|
4032
|
-
metadata: _objectSpread(_objectSpread(_objectSpread({}, normalizedProduct.metadata || {}), targetProduct.metadata || {}), {}, {
|
|
4033
|
-
unique_identification_number: targetUid
|
|
4034
|
-
})
|
|
4035
|
-
} : {}), {}, {
|
|
4112
|
+
}),
|
|
4036
4113
|
note: targetProduct.note,
|
|
4037
4114
|
order_detail_id: targetProduct.order_detail_id,
|
|
4038
4115
|
num: nextNum
|
|
4039
4116
|
});
|
|
4040
4117
|
this.captureProductRuntime(tempOrder, productToAdd, tempOrder.products[matchedIndex], targetUid);
|
|
4118
|
+
if (matchedIndex !== tempOrder.products.length - 1) {
|
|
4119
|
+
mergedProduct = tempOrder.products[matchedIndex];
|
|
4120
|
+
tempOrder.products = [].concat(_toConsumableArray(tempOrder.products.slice(0, matchedIndex)), _toConsumableArray(tempOrder.products.slice(matchedIndex + 1)), [mergedProduct]);
|
|
4121
|
+
}
|
|
4041
4122
|
}
|
|
4042
4123
|
if (linked) {
|
|
4043
4124
|
tempOrder.bookings = [].concat(_toConsumableArray(tempOrder.bookings || []), [linked.booking]);
|
|
4044
4125
|
}
|
|
4045
|
-
case
|
|
4126
|
+
case 30:
|
|
4046
4127
|
case "end":
|
|
4047
4128
|
return _context22.stop();
|
|
4048
4129
|
}
|
|
4049
4130
|
}, _callee20, this);
|
|
4050
4131
|
}));
|
|
4051
|
-
function appendProductLineToTempOrder(_x22, _x23, _x24) {
|
|
4132
|
+
function appendProductLineToTempOrder(_x22, _x23, _x24, _x25) {
|
|
4052
4133
|
return _appendProductLineToTempOrder.apply(this, arguments);
|
|
4053
4134
|
}
|
|
4054
4135
|
return appendProductLineToTempOrder;
|
|
@@ -4064,61 +4145,74 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4064
4145
|
}, {
|
|
4065
4146
|
key: "addProductToOrder",
|
|
4066
4147
|
value: (function () {
|
|
4067
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(product, booking) {
|
|
4068
|
-
var tempOrder,
|
|
4148
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(product, booking, options) {
|
|
4149
|
+
var tempOrder, insertAfterProductUid, anchorIndex, insertAtIndex, _ref60, _productRecord$num, productRecord, splitCount, i, singleLine;
|
|
4069
4150
|
return _regeneratorRuntime().wrap(function _callee21$(_context23) {
|
|
4070
4151
|
while (1) switch (_context23.prev = _context23.next) {
|
|
4071
4152
|
case 0:
|
|
4072
4153
|
tempOrder = this.ensureTempOrder();
|
|
4154
|
+
insertAfterProductUid = options === null || options === void 0 ? void 0 : options.insertAfterProductUid;
|
|
4155
|
+
anchorIndex = booking && insertAfterProductUid ? tempOrder.products.findIndex(function (line) {
|
|
4156
|
+
var _line$metadata;
|
|
4157
|
+
var uid = ((_line$metadata = line.metadata) === null || _line$metadata === void 0 ? void 0 : _line$metadata.unique_identification_number) || line.unique_identification_number;
|
|
4158
|
+
return uid !== undefined && uid !== null && String(uid) === String(insertAfterProductUid);
|
|
4159
|
+
}) : -1;
|
|
4160
|
+
insertAtIndex = anchorIndex >= 0 ? anchorIndex + 1 : undefined;
|
|
4073
4161
|
if (!booking) {
|
|
4074
|
-
_context23.next =
|
|
4162
|
+
_context23.next = 22;
|
|
4075
4163
|
break;
|
|
4076
4164
|
}
|
|
4077
4165
|
productRecord = product;
|
|
4078
|
-
splitCount = getSafeProductNum((
|
|
4166
|
+
splitCount = getSafeProductNum((_ref60 = (_productRecord$num = productRecord.num) !== null && _productRecord$num !== void 0 ? _productRecord$num : productRecord.product_quantity) !== null && _ref60 !== void 0 ? _ref60 : 1);
|
|
4079
4167
|
if (!(splitCount > 1)) {
|
|
4080
|
-
_context23.next =
|
|
4168
|
+
_context23.next = 22;
|
|
4081
4169
|
break;
|
|
4082
4170
|
}
|
|
4083
4171
|
i = 0;
|
|
4084
|
-
case
|
|
4172
|
+
case 9:
|
|
4085
4173
|
if (!(i < splitCount)) {
|
|
4086
|
-
_context23.next =
|
|
4174
|
+
_context23.next = 19;
|
|
4087
4175
|
break;
|
|
4088
4176
|
}
|
|
4089
4177
|
singleLine = cloneDeep(productRecord);
|
|
4090
4178
|
singleLine.num = 1;
|
|
4091
4179
|
delete singleLine.product_quantity;
|
|
4092
|
-
_context23.next =
|
|
4093
|
-
return this.appendProductLineToTempOrder(tempOrder, singleLine, cloneDeep(booking)
|
|
4094
|
-
|
|
4180
|
+
_context23.next = 15;
|
|
4181
|
+
return this.appendProductLineToTempOrder(tempOrder, singleLine, cloneDeep(booking), {
|
|
4182
|
+
insertAtIndex: insertAtIndex
|
|
4183
|
+
});
|
|
4184
|
+
case 15:
|
|
4185
|
+
if (insertAtIndex !== undefined) insertAtIndex += 1;
|
|
4186
|
+
case 16:
|
|
4095
4187
|
i += 1;
|
|
4096
|
-
_context23.next =
|
|
4188
|
+
_context23.next = 9;
|
|
4097
4189
|
break;
|
|
4098
|
-
case
|
|
4099
|
-
_context23.next =
|
|
4190
|
+
case 19:
|
|
4191
|
+
_context23.next = 21;
|
|
4100
4192
|
return this.finalizeProductOrderMutation(tempOrder);
|
|
4101
|
-
case
|
|
4193
|
+
case 21:
|
|
4102
4194
|
return _context23.abrupt("return", tempOrder.products);
|
|
4103
|
-
case 18:
|
|
4104
|
-
_context23.next = 20;
|
|
4105
|
-
return this.appendProductLineToTempOrder(tempOrder, product, booking);
|
|
4106
|
-
case 20:
|
|
4107
|
-
_context23.next = 22;
|
|
4108
|
-
return this.finalizeProductOrderMutation(tempOrder);
|
|
4109
4195
|
case 22:
|
|
4196
|
+
_context23.next = 24;
|
|
4197
|
+
return this.appendProductLineToTempOrder(tempOrder, product, booking, {
|
|
4198
|
+
insertAtIndex: insertAtIndex
|
|
4199
|
+
});
|
|
4200
|
+
case 24:
|
|
4201
|
+
_context23.next = 26;
|
|
4202
|
+
return this.finalizeProductOrderMutation(tempOrder);
|
|
4203
|
+
case 26:
|
|
4110
4204
|
this.logInfo('addProductToOrder success', {
|
|
4111
4205
|
product_id: product.product_id,
|
|
4112
4206
|
with_booking: !!booking
|
|
4113
4207
|
});
|
|
4114
4208
|
return _context23.abrupt("return", tempOrder.products);
|
|
4115
|
-
case
|
|
4209
|
+
case 28:
|
|
4116
4210
|
case "end":
|
|
4117
4211
|
return _context23.stop();
|
|
4118
4212
|
}
|
|
4119
4213
|
}, _callee21, this);
|
|
4120
4214
|
}));
|
|
4121
|
-
function addProductToOrder(
|
|
4215
|
+
function addProductToOrder(_x26, _x27, _x28) {
|
|
4122
4216
|
return _addProductToOrder.apply(this, arguments);
|
|
4123
4217
|
}
|
|
4124
4218
|
return addProductToOrder;
|
|
@@ -4137,7 +4231,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4137
4231
|
key: "addProductsToOrder",
|
|
4138
4232
|
value: (function () {
|
|
4139
4233
|
var _addProductsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(items, options) {
|
|
4140
|
-
var tempOrder, _iterator20, _step20, item, product, booking,
|
|
4234
|
+
var tempOrder, _iterator20, _step20, item, product, booking, _ref61, _productRecord$num2, productRecord, splitCount, i, singleLine;
|
|
4141
4235
|
return _regeneratorRuntime().wrap(function _callee22$(_context24) {
|
|
4142
4236
|
while (1) switch (_context24.prev = _context24.next) {
|
|
4143
4237
|
case 0:
|
|
@@ -4169,7 +4263,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4169
4263
|
break;
|
|
4170
4264
|
}
|
|
4171
4265
|
productRecord = product;
|
|
4172
|
-
splitCount = getSafeProductNum((
|
|
4266
|
+
splitCount = getSafeProductNum((_ref61 = (_productRecord$num2 = productRecord.num) !== null && _productRecord$num2 !== void 0 ? _productRecord$num2 : productRecord.product_quantity) !== null && _ref61 !== void 0 ? _ref61 : 1);
|
|
4173
4267
|
if (!(splitCount > 1)) {
|
|
4174
4268
|
_context24.next = 26;
|
|
4175
4269
|
break;
|
|
@@ -4222,7 +4316,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4222
4316
|
}
|
|
4223
4317
|
}, _callee22, this, [[4, 32, 35, 38]]);
|
|
4224
4318
|
}));
|
|
4225
|
-
function addProductsToOrder(
|
|
4319
|
+
function addProductsToOrder(_x29, _x30) {
|
|
4226
4320
|
return _addProductsToOrder.apply(this, arguments);
|
|
4227
4321
|
}
|
|
4228
4322
|
return addProductsToOrder;
|
|
@@ -4249,9 +4343,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4249
4343
|
}, {
|
|
4250
4344
|
key: "getBundleRuntimeIdentity",
|
|
4251
4345
|
value: function getBundleRuntimeIdentity(bundle) {
|
|
4252
|
-
var
|
|
4346
|
+
var _ref62, _bundle$bundle_id2, _ref63, _bundle$bundle_group_2, _ref64, _ref65, _bundle$bundle_produc3, _ref66, _bundle$bundle_varian3;
|
|
4253
4347
|
if (!bundle || _typeof(bundle) !== 'object') return '';
|
|
4254
|
-
return [(
|
|
4348
|
+
return [(_ref62 = (_bundle$bundle_id2 = bundle.bundle_id) !== null && _bundle$bundle_id2 !== void 0 ? _bundle$bundle_id2 : bundle.id) !== null && _ref62 !== void 0 ? _ref62 : '', (_ref63 = (_bundle$bundle_group_2 = bundle.bundle_group_id) !== null && _bundle$bundle_group_2 !== void 0 ? _bundle$bundle_group_2 : bundle.group_id) !== null && _ref63 !== void 0 ? _ref63 : '', (_ref64 = (_ref65 = (_bundle$bundle_produc3 = bundle.bundle_product_id) !== null && _bundle$bundle_produc3 !== void 0 ? _bundle$bundle_produc3 : bundle._bundle_product_id) !== null && _ref65 !== void 0 ? _ref65 : bundle.product_id) !== null && _ref64 !== void 0 ? _ref64 : '', (_ref66 = (_bundle$bundle_varian3 = bundle.bundle_variant_id) !== null && _bundle$bundle_varian3 !== void 0 ? _bundle$bundle_varian3 : bundle.product_variant_id) !== null && _ref66 !== void 0 ? _ref66 : 0].join('|');
|
|
4255
4349
|
}
|
|
4256
4350
|
}, {
|
|
4257
4351
|
key: "preservePersistedBundlePriceFields",
|
|
@@ -4402,13 +4496,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4402
4496
|
delete nextProduct.metadata.main_product_original_price;
|
|
4403
4497
|
delete nextProduct.metadata.price_schema_version;
|
|
4404
4498
|
} else if (callerChangesLineConfiguration && !callerUpdatesTopPrice && !callerUpdatesMainMeta) {
|
|
4405
|
-
var
|
|
4499
|
+
var _ref67, _targetProduct$metada10, _targetProduct$metada11, _ref68, _targetProduct$metada12, _targetProduct$metada13, _targetProduct$metada14;
|
|
4406
4500
|
// 仅 option / bundle 变化时,保留历史 source 和主商品折扣金额,
|
|
4407
4501
|
// 但必须让 original 与 selling 一起随新的 option 金额移动。
|
|
4408
4502
|
var previousOptionSum = sumOptionUnitPrice(getProductSkuOptions(targetProduct));
|
|
4409
4503
|
var nextOptionSum = sumOptionUnitPrice(getProductSkuOptions(nextProduct));
|
|
4410
|
-
var _previousMainOriginal = new Decimal(Number((
|
|
4411
|
-
var _previousMainSelling = new Decimal(Number((
|
|
4504
|
+
var _previousMainOriginal = new Decimal(Number((_ref67 = (_targetProduct$metada10 = (_targetProduct$metada11 = targetProduct.metadata) === null || _targetProduct$metada11 === void 0 ? void 0 : _targetProduct$metada11.main_product_original_price) !== null && _targetProduct$metada10 !== void 0 ? _targetProduct$metada10 : targetProduct.original_price) !== null && _ref67 !== void 0 ? _ref67 : 0) || 0);
|
|
4505
|
+
var _previousMainSelling = new Decimal(Number((_ref68 = (_targetProduct$metada12 = (_targetProduct$metada13 = targetProduct.metadata) === null || _targetProduct$metada13 === void 0 ? void 0 : _targetProduct$metada13.main_product_selling_price) !== null && _targetProduct$metada12 !== void 0 ? _targetProduct$metada12 : targetProduct.selling_price) !== null && _ref68 !== void 0 ? _ref68 : _previousMainOriginal.toNumber()) || 0);
|
|
4412
4506
|
var _preservedDiscount = _previousMainOriginal.minus(_previousMainSelling);
|
|
4413
4507
|
var previousSource = ((_targetProduct$metada14 = targetProduct.metadata) === null || _targetProduct$metada14 === void 0 ? void 0 : _targetProduct$metada14.source_product_price) != null ? new Decimal(Number(targetProduct.metadata.source_product_price) || 0) : _previousMainOriginal.minus(previousOptionSum);
|
|
4414
4508
|
var _nextMainOriginal = previousSource.plus(nextOptionSum);
|
|
@@ -4497,7 +4591,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4497
4591
|
}
|
|
4498
4592
|
}, _callee23, this);
|
|
4499
4593
|
}));
|
|
4500
|
-
function updateOrderProduct(
|
|
4594
|
+
function updateOrderProduct(_x31) {
|
|
4501
4595
|
return _updateOrderProduct.apply(this, arguments);
|
|
4502
4596
|
}
|
|
4503
4597
|
return updateOrderProduct;
|
|
@@ -4541,7 +4635,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4541
4635
|
}
|
|
4542
4636
|
}, _callee24, this);
|
|
4543
4637
|
}));
|
|
4544
|
-
function updateOrderProducts(
|
|
4638
|
+
function updateOrderProducts(_x32) {
|
|
4545
4639
|
return _updateOrderProducts.apply(this, arguments);
|
|
4546
4640
|
}
|
|
4547
4641
|
return updateOrderProducts;
|
|
@@ -4557,6 +4651,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4557
4651
|
case 0:
|
|
4558
4652
|
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;
|
|
4559
4653
|
tempOrder = this.ensureTempOrder();
|
|
4654
|
+
this.repairDuplicateProductLineIdentities(tempOrder);
|
|
4560
4655
|
identityLookup = {
|
|
4561
4656
|
product_id: product_id,
|
|
4562
4657
|
product_variant_id: product_variant_id
|
|
@@ -4582,11 +4677,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4582
4677
|
productIndex = getProductIdentityIndex(tempOrder.products, identityLookup);
|
|
4583
4678
|
}
|
|
4584
4679
|
if (!(productIndex === -1)) {
|
|
4585
|
-
_context27.next =
|
|
4680
|
+
_context27.next = 13;
|
|
4586
4681
|
break;
|
|
4587
4682
|
}
|
|
4588
4683
|
throw new Error('[Order] 目标商品不存在,无法更新数量');
|
|
4589
|
-
case
|
|
4684
|
+
case 13:
|
|
4590
4685
|
targetProduct = tempOrder.products[productIndex];
|
|
4591
4686
|
normalizedProduct = normalizeOrderProduct(_objectSpread(_objectSpread({}, targetProduct), {}, {
|
|
4592
4687
|
num: getSafeProductNum(num),
|
|
@@ -4596,28 +4691,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4596
4691
|
}));
|
|
4597
4692
|
normalizedProduct.discount_list = normalizeOrderProductDiscountList(normalizedProduct.discount_list);
|
|
4598
4693
|
tempOrder.products[productIndex] = normalizedProduct;
|
|
4599
|
-
_context27.next =
|
|
4694
|
+
_context27.next = 19;
|
|
4600
4695
|
return this.applyPromotion();
|
|
4601
|
-
case
|
|
4696
|
+
case 19:
|
|
4602
4697
|
this.applyDiscount();
|
|
4603
4698
|
this.sanitizeTempOrderProducts(tempOrder);
|
|
4604
|
-
_context27.next =
|
|
4699
|
+
_context27.next = 23;
|
|
4605
4700
|
return this.recalculateSummary({
|
|
4606
4701
|
createIfMissing: true
|
|
4607
4702
|
});
|
|
4608
|
-
case
|
|
4703
|
+
case 23:
|
|
4609
4704
|
this.persistTempOrder();
|
|
4610
4705
|
this.logInfo('updateOrderProductQuantity success', {
|
|
4611
4706
|
params: params
|
|
4612
4707
|
});
|
|
4613
4708
|
return _context27.abrupt("return", tempOrder.products);
|
|
4614
|
-
case
|
|
4709
|
+
case 26:
|
|
4615
4710
|
case "end":
|
|
4616
4711
|
return _context27.stop();
|
|
4617
4712
|
}
|
|
4618
4713
|
}, _callee25, this);
|
|
4619
4714
|
}));
|
|
4620
|
-
function updateOrderProductQuantity(
|
|
4715
|
+
function updateOrderProductQuantity(_x33) {
|
|
4621
4716
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
4622
4717
|
}
|
|
4623
4718
|
return updateOrderProductQuantity;
|
|
@@ -4682,7 +4777,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4682
4777
|
}
|
|
4683
4778
|
}, _callee26, this);
|
|
4684
4779
|
}));
|
|
4685
|
-
function finalizeAfterProductsMutation(
|
|
4780
|
+
function finalizeAfterProductsMutation(_x34, _x35) {
|
|
4686
4781
|
return _finalizeAfterProductsMutation.apply(this, arguments);
|
|
4687
4782
|
}
|
|
4688
4783
|
return finalizeAfterProductsMutation;
|
|
@@ -4697,21 +4792,29 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4697
4792
|
}, {
|
|
4698
4793
|
key: "removeProductsFromOrder",
|
|
4699
4794
|
value: (function () {
|
|
4700
|
-
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(identities) {
|
|
4795
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(identities, options) {
|
|
4701
4796
|
var _this29 = this;
|
|
4702
|
-
var tempOrder, productsBeforeRemove, bookingsBeforeRemove, matchedProducts, removedProducts, _i2, _removedProducts, product, linkedBookingUidsToRemove, _iterator21, _step21, _loop3;
|
|
4797
|
+
var tempOrder, productsBeforeRemove, bookingsBeforeRemove, preserveDisplayPosition, anchorIndex, productsAfterAnchor, matchedProducts, removedProducts, _i2, _removedProducts, product, linkedBookingUidsToRemove, _iterator21, _step21, _loop3, remainingProductIndex, remainingProduct, nextProduct, productsWithoutRemaining, nextProductIndex;
|
|
4703
4798
|
return _regeneratorRuntime().wrap(function _callee27$(_context30) {
|
|
4704
4799
|
while (1) switch (_context30.prev = _context30.next) {
|
|
4705
4800
|
case 0:
|
|
4706
4801
|
tempOrder = this.ensureTempOrder();
|
|
4802
|
+
this.repairDuplicateProductLineIdentities(tempOrder);
|
|
4707
4803
|
if (identities.length) {
|
|
4708
|
-
_context30.next =
|
|
4804
|
+
_context30.next = 4;
|
|
4709
4805
|
break;
|
|
4710
4806
|
}
|
|
4711
4807
|
return _context30.abrupt("return", tempOrder.products);
|
|
4712
|
-
case
|
|
4808
|
+
case 4:
|
|
4713
4809
|
productsBeforeRemove = tempOrder.products || [];
|
|
4714
4810
|
bookingsBeforeRemove = tempOrder.bookings || [];
|
|
4811
|
+
preserveDisplayPosition = options === null || options === void 0 ? void 0 : options.preserveDisplayPosition;
|
|
4812
|
+
anchorIndex = preserveDisplayPosition ? productsBeforeRemove.findIndex(function (item) {
|
|
4813
|
+
var _item$metadata6;
|
|
4814
|
+
var uid = ((_item$metadata6 = item.metadata) === null || _item$metadata6 === void 0 ? void 0 : _item$metadata6.unique_identification_number) || item.unique_identification_number;
|
|
4815
|
+
return uid !== undefined && uid !== null && String(uid) === String(preserveDisplayPosition.anchorProductUid);
|
|
4816
|
+
}) : -1;
|
|
4817
|
+
productsAfterAnchor = anchorIndex >= 0 ? productsBeforeRemove.slice(anchorIndex + 1) : [];
|
|
4715
4818
|
matchedProducts = productsBeforeRemove.filter(function (item) {
|
|
4716
4819
|
return identities.some(function (identity) {
|
|
4717
4820
|
return isIdentityMatch(item, identity);
|
|
@@ -4731,7 +4834,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4731
4834
|
}
|
|
4732
4835
|
linkedBookingUidsToRemove = new Set();
|
|
4733
4836
|
_iterator21 = _createForOfIteratorHelper(matchedProducts);
|
|
4734
|
-
_context30.prev =
|
|
4837
|
+
_context30.prev = 15;
|
|
4735
4838
|
_loop3 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop3() {
|
|
4736
4839
|
var _metadata11, _metadata12, _metadata13, _metadata14;
|
|
4737
4840
|
var product, productUid, productBookingUid, isAddTimeProduct;
|
|
@@ -4766,56 +4869,72 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4766
4869
|
}, _loop3);
|
|
4767
4870
|
});
|
|
4768
4871
|
_iterator21.s();
|
|
4769
|
-
case
|
|
4872
|
+
case 18:
|
|
4770
4873
|
if ((_step21 = _iterator21.n()).done) {
|
|
4771
|
-
_context30.next =
|
|
4874
|
+
_context30.next = 24;
|
|
4772
4875
|
break;
|
|
4773
4876
|
}
|
|
4774
|
-
return _context30.delegateYield(_loop3(), "t0",
|
|
4775
|
-
case
|
|
4877
|
+
return _context30.delegateYield(_loop3(), "t0", 20);
|
|
4878
|
+
case 20:
|
|
4776
4879
|
if (!_context30.t0) {
|
|
4777
|
-
_context30.next =
|
|
4880
|
+
_context30.next = 22;
|
|
4778
4881
|
break;
|
|
4779
4882
|
}
|
|
4780
|
-
return _context30.abrupt("continue",
|
|
4781
|
-
case
|
|
4782
|
-
_context30.next =
|
|
4883
|
+
return _context30.abrupt("continue", 22);
|
|
4884
|
+
case 22:
|
|
4885
|
+
_context30.next = 18;
|
|
4783
4886
|
break;
|
|
4784
|
-
case
|
|
4785
|
-
_context30.next =
|
|
4887
|
+
case 24:
|
|
4888
|
+
_context30.next = 29;
|
|
4786
4889
|
break;
|
|
4787
|
-
case
|
|
4788
|
-
_context30.prev =
|
|
4789
|
-
_context30.t1 = _context30["catch"](
|
|
4890
|
+
case 26:
|
|
4891
|
+
_context30.prev = 26;
|
|
4892
|
+
_context30.t1 = _context30["catch"](15);
|
|
4790
4893
|
_iterator21.e(_context30.t1);
|
|
4791
|
-
case
|
|
4792
|
-
_context30.prev =
|
|
4894
|
+
case 29:
|
|
4895
|
+
_context30.prev = 29;
|
|
4793
4896
|
_iterator21.f();
|
|
4794
|
-
return _context30.finish(
|
|
4795
|
-
case
|
|
4897
|
+
return _context30.finish(29);
|
|
4898
|
+
case 32:
|
|
4796
4899
|
if (linkedBookingUidsToRemove.size > 0) {
|
|
4797
4900
|
// 删除主预约商品时,同步移除挂在同一 booking_uid 下的加时商品,避免残留孤儿行。
|
|
4798
4901
|
tempOrder.products = (tempOrder.products || []).filter(function (line) {
|
|
4799
|
-
var _line$
|
|
4800
|
-
var lineBookingUid = (line === null || line === void 0 || (_line$
|
|
4801
|
-
var isAddTimeProduct = (line === null || line === void 0 || (_line$
|
|
4902
|
+
var _line$metadata2, _line$metadata3, _line$metadata4;
|
|
4903
|
+
var lineBookingUid = (line === null || line === void 0 || (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.booking_uid) || (line === null || line === void 0 ? void 0 : line.booking_uid);
|
|
4904
|
+
var isAddTimeProduct = (line === null || line === void 0 || (_line$metadata3 = line.metadata) === null || _line$metadata3 === void 0 ? void 0 : _line$metadata3.product_add_schedule_time) !== undefined && (line === null || line === void 0 || (_line$metadata4 = line.metadata) === null || _line$metadata4 === void 0 ? void 0 : _line$metadata4.product_add_schedule_time) !== null;
|
|
4802
4905
|
return !(isAddTimeProduct && lineBookingUid !== undefined && lineBookingUid !== null && linkedBookingUidsToRemove.has(String(lineBookingUid)));
|
|
4803
4906
|
});
|
|
4804
4907
|
}
|
|
4805
|
-
|
|
4908
|
+
if (preserveDisplayPosition && anchorIndex >= 0) {
|
|
4909
|
+
remainingProductIndex = tempOrder.products.findIndex(function (item) {
|
|
4910
|
+
var _item$metadata7;
|
|
4911
|
+
var uid = ((_item$metadata7 = item.metadata) === null || _item$metadata7 === void 0 ? void 0 : _item$metadata7.unique_identification_number) || item.unique_identification_number;
|
|
4912
|
+
return uid !== undefined && uid !== null && String(uid) === String(preserveDisplayPosition.remainingProductUid);
|
|
4913
|
+
});
|
|
4914
|
+
if (remainingProductIndex >= 0) {
|
|
4915
|
+
remainingProduct = tempOrder.products[remainingProductIndex];
|
|
4916
|
+
nextProduct = productsAfterAnchor.find(function (item) {
|
|
4917
|
+
return tempOrder.products.includes(item);
|
|
4918
|
+
});
|
|
4919
|
+
productsWithoutRemaining = [].concat(_toConsumableArray(tempOrder.products.slice(0, remainingProductIndex)), _toConsumableArray(tempOrder.products.slice(remainingProductIndex + 1)));
|
|
4920
|
+
nextProductIndex = nextProduct ? productsWithoutRemaining.indexOf(nextProduct) : -1;
|
|
4921
|
+
tempOrder.products = nextProductIndex >= 0 ? [].concat(_toConsumableArray(productsWithoutRemaining.slice(0, nextProductIndex)), [remainingProduct], _toConsumableArray(productsWithoutRemaining.slice(nextProductIndex))) : [].concat(_toConsumableArray(productsWithoutRemaining), [remainingProduct]);
|
|
4922
|
+
}
|
|
4923
|
+
}
|
|
4924
|
+
_context30.next = 36;
|
|
4806
4925
|
return this.finalizeAfterProductsMutation(tempOrder);
|
|
4807
|
-
case
|
|
4926
|
+
case 36:
|
|
4808
4927
|
this.logInfo('removeProductsFromOrder success', {
|
|
4809
4928
|
identities: identities
|
|
4810
4929
|
});
|
|
4811
4930
|
return _context30.abrupt("return", tempOrder.products);
|
|
4812
|
-
case
|
|
4931
|
+
case 38:
|
|
4813
4932
|
case "end":
|
|
4814
4933
|
return _context30.stop();
|
|
4815
4934
|
}
|
|
4816
|
-
}, _callee27, this, [[
|
|
4935
|
+
}, _callee27, this, [[15, 26, 29, 32]]);
|
|
4817
4936
|
}));
|
|
4818
|
-
function removeProductsFromOrder(
|
|
4937
|
+
function removeProductsFromOrder(_x36, _x37) {
|
|
4819
4938
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
4820
4939
|
}
|
|
4821
4940
|
return removeProductsFromOrder;
|
|
@@ -4823,18 +4942,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4823
4942
|
}, {
|
|
4824
4943
|
key: "removeProductFromOrder",
|
|
4825
4944
|
value: function () {
|
|
4826
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identity) {
|
|
4945
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identity, options) {
|
|
4827
4946
|
return _regeneratorRuntime().wrap(function _callee28$(_context31) {
|
|
4828
4947
|
while (1) switch (_context31.prev = _context31.next) {
|
|
4829
4948
|
case 0:
|
|
4830
|
-
return _context31.abrupt("return", this.removeProductsFromOrder([identity]));
|
|
4949
|
+
return _context31.abrupt("return", this.removeProductsFromOrder([identity], options));
|
|
4831
4950
|
case 1:
|
|
4832
4951
|
case "end":
|
|
4833
4952
|
return _context31.stop();
|
|
4834
4953
|
}
|
|
4835
4954
|
}, _callee28, this);
|
|
4836
4955
|
}));
|
|
4837
|
-
function removeProductFromOrder(
|
|
4956
|
+
function removeProductFromOrder(_x38, _x39) {
|
|
4838
4957
|
return _removeProductFromOrder.apply(this, arguments);
|
|
4839
4958
|
}
|
|
4840
4959
|
return removeProductFromOrder;
|
|
@@ -4888,23 +5007,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4888
5007
|
}, {
|
|
4889
5008
|
key: "buildCurrentSubmitPayloadForLocalPrint",
|
|
4890
5009
|
value: function buildCurrentSubmitPayloadForLocalPrint(params) {
|
|
4891
|
-
var _params$cacheId, _this$otherParams3,
|
|
5010
|
+
var _params$cacheId, _this$otherParams3, _ref69, _params$businessCode, _this$otherParams4, _this$otherParams5;
|
|
4892
5011
|
var tempOrder = this.ensureTempOrder();
|
|
4893
5012
|
this.persistTempOrder();
|
|
4894
5013
|
var payload = buildSubmitPayload({
|
|
4895
5014
|
tempOrder: tempOrder,
|
|
4896
5015
|
cacheId: (_params$cacheId = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId !== void 0 ? _params$cacheId : this.cacheId,
|
|
4897
5016
|
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.platform),
|
|
4898
|
-
businessCode: (
|
|
5017
|
+
businessCode: (_ref69 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.businessCode) !== null && _ref69 !== void 0 ? _ref69 : (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.business_code,
|
|
4899
5018
|
channel: params === null || params === void 0 ? void 0 : params.channel,
|
|
4900
5019
|
type: params === null || params === void 0 ? void 0 : params.type,
|
|
4901
5020
|
summary: this.store.summary || createEmptySummary(),
|
|
4902
5021
|
enhance: function enhance(nextPayload) {
|
|
4903
|
-
var
|
|
5022
|
+
var _ref70, _tempOrder$order_numb, _ref71, _tempOrder$shop_order, _ref72, _tempOrder$shop_full_;
|
|
4904
5023
|
return _objectSpread(_objectSpread({}, nextPayload), {}, {
|
|
4905
|
-
order_number: (
|
|
4906
|
-
shop_order_number: (
|
|
4907
|
-
shop_full_order_number: (
|
|
5024
|
+
order_number: (_ref70 = (_tempOrder$order_numb = tempOrder.order_number) !== null && _tempOrder$order_numb !== void 0 ? _tempOrder$order_numb : nextPayload.order_number) !== null && _ref70 !== void 0 ? _ref70 : null,
|
|
5025
|
+
shop_order_number: (_ref71 = (_tempOrder$shop_order = tempOrder.shop_order_number) !== null && _tempOrder$shop_order !== void 0 ? _tempOrder$shop_order : nextPayload.shop_order_number) !== null && _ref71 !== void 0 ? _ref71 : null,
|
|
5026
|
+
shop_full_order_number: (_ref72 = (_tempOrder$shop_full_ = tempOrder.shop_full_order_number) !== null && _tempOrder$shop_full_ !== void 0 ? _tempOrder$shop_full_ : nextPayload.shop_full_order_number) !== null && _ref72 !== void 0 ? _ref72 : null,
|
|
4908
5027
|
small_ticket_data_flag: 1
|
|
4909
5028
|
});
|
|
4910
5029
|
}
|
|
@@ -4946,7 +5065,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4946
5065
|
}
|
|
4947
5066
|
}, _callee30, this);
|
|
4948
5067
|
}));
|
|
4949
|
-
function applyLocalPrintOrderNumbers(
|
|
5068
|
+
function applyLocalPrintOrderNumbers(_x40) {
|
|
4950
5069
|
return _applyLocalPrintOrderNumbers.apply(this, arguments);
|
|
4951
5070
|
}
|
|
4952
5071
|
return applyLocalPrintOrderNumbers;
|
|
@@ -5013,7 +5132,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5013
5132
|
}
|
|
5014
5133
|
}, _callee31, this);
|
|
5015
5134
|
}));
|
|
5016
|
-
function saveTempOrderAsDraft(
|
|
5135
|
+
function saveTempOrderAsDraft(_x41) {
|
|
5017
5136
|
return _saveTempOrderAsDraft.apply(this, arguments);
|
|
5018
5137
|
}
|
|
5019
5138
|
return saveTempOrderAsDraft;
|
|
@@ -5038,7 +5157,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5038
5157
|
}
|
|
5039
5158
|
}, _callee32, this);
|
|
5040
5159
|
}));
|
|
5041
|
-
function submitTempOrder(
|
|
5160
|
+
function submitTempOrder(_x42) {
|
|
5042
5161
|
return _submitTempOrder.apply(this, arguments);
|
|
5043
5162
|
}
|
|
5044
5163
|
return submitTempOrder;
|
|
@@ -5059,7 +5178,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5059
5178
|
}
|
|
5060
5179
|
}, _callee33, this);
|
|
5061
5180
|
}));
|
|
5062
|
-
function submitTempOrderAsync(
|
|
5181
|
+
function submitTempOrderAsync(_x43) {
|
|
5063
5182
|
return _submitTempOrderAsync.apply(this, arguments);
|
|
5064
5183
|
}
|
|
5065
5184
|
return submitTempOrderAsync;
|
|
@@ -5068,7 +5187,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5068
5187
|
key: "runSubmitTempOrder",
|
|
5069
5188
|
value: function () {
|
|
5070
5189
|
var _runSubmitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
|
|
5071
|
-
var _params$cacheId3, _this$otherParams10,
|
|
5190
|
+
var _params$cacheId3, _this$otherParams10, _ref73, _ref74, _submitSnapshot$busin, _this$otherParams11, _this$otherParams12, _submitSnapshot$type;
|
|
5072
5191
|
var tempOrder, shouldConfirmPendingVoucherPayments, hasPaymentOverride, preparedPaymentOverride, latestSummary, effectiveCacheId, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, submitSnapshot, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
|
|
5073
5192
|
return _regeneratorRuntime().wrap(function _callee34$(_context37) {
|
|
5074
5193
|
while (1) switch (_context37.prev = _context37.next) {
|
|
@@ -5130,7 +5249,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5130
5249
|
tempOrder: tempOrder,
|
|
5131
5250
|
cacheId: effectiveCacheId,
|
|
5132
5251
|
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.platform),
|
|
5133
|
-
businessCode: (
|
|
5252
|
+
businessCode: (_ref73 = (_ref74 = (_submitSnapshot$busin = submitSnapshot.businessCode) !== null && _submitSnapshot$busin !== void 0 ? _submitSnapshot$busin : params === null || params === void 0 ? void 0 : params.businessCode) !== null && _ref74 !== void 0 ? _ref74 : (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.businessCode) !== null && _ref73 !== void 0 ? _ref73 : (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.business_code,
|
|
5134
5253
|
channel: params === null || params === void 0 ? void 0 : params.channel,
|
|
5135
5254
|
type: (_submitSnapshot$type = submitSnapshot.type) !== null && _submitSnapshot$type !== void 0 ? _submitSnapshot$type : params === null || params === void 0 ? void 0 : params.type,
|
|
5136
5255
|
summary: latestSummary,
|
|
@@ -5229,7 +5348,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5229
5348
|
}
|
|
5230
5349
|
}, _callee34, this, [[26, 33]]);
|
|
5231
5350
|
}));
|
|
5232
|
-
function runSubmitTempOrder(
|
|
5351
|
+
function runSubmitTempOrder(_x44) {
|
|
5233
5352
|
return _runSubmitTempOrder.apply(this, arguments);
|
|
5234
5353
|
}
|
|
5235
5354
|
return runSubmitTempOrder;
|
|
@@ -5256,7 +5375,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5256
5375
|
}
|
|
5257
5376
|
}, _callee35, this);
|
|
5258
5377
|
}));
|
|
5259
|
-
function markLocalOrderSynced(
|
|
5378
|
+
function markLocalOrderSynced(_x45, _x46) {
|
|
5260
5379
|
return _markLocalOrderSynced.apply(this, arguments);
|
|
5261
5380
|
}
|
|
5262
5381
|
return markLocalOrderSynced;
|
|
@@ -5425,7 +5544,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5425
5544
|
}
|
|
5426
5545
|
}, _callee36, this);
|
|
5427
5546
|
}));
|
|
5428
|
-
function syncPaymentsToOrder(
|
|
5547
|
+
function syncPaymentsToOrder(_x47) {
|
|
5429
5548
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
5430
5549
|
}
|
|
5431
5550
|
return syncPaymentsToOrder;
|
|
@@ -5553,7 +5672,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5553
5672
|
}
|
|
5554
5673
|
}, _callee37, this);
|
|
5555
5674
|
}));
|
|
5556
|
-
function submitOrder(
|
|
5675
|
+
function submitOrder(_x48) {
|
|
5557
5676
|
return _submitOrder.apply(this, arguments);
|
|
5558
5677
|
}
|
|
5559
5678
|
return submitOrder;
|
|
@@ -5592,7 +5711,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5592
5711
|
}
|
|
5593
5712
|
}, _callee38, this);
|
|
5594
5713
|
}));
|
|
5595
|
-
function cancelOrder(
|
|
5714
|
+
function cancelOrder(_x49) {
|
|
5596
5715
|
return _cancelOrder.apply(this, arguments);
|
|
5597
5716
|
}
|
|
5598
5717
|
return cancelOrder;
|
|
@@ -5636,7 +5755,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5636
5755
|
}
|
|
5637
5756
|
}, _callee39, this);
|
|
5638
5757
|
}));
|
|
5639
|
-
function changeBookingStatus(
|
|
5758
|
+
function changeBookingStatus(_x50) {
|
|
5640
5759
|
return _changeBookingStatus.apply(this, arguments);
|
|
5641
5760
|
}
|
|
5642
5761
|
return changeBookingStatus;
|
|
@@ -5783,7 +5902,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5783
5902
|
}
|
|
5784
5903
|
}, _callee40, this, [[4, 18]]);
|
|
5785
5904
|
}));
|
|
5786
|
-
function createOrderByCheckout(
|
|
5905
|
+
function createOrderByCheckout(_x51) {
|
|
5787
5906
|
return _createOrderByCheckout.apply(this, arguments);
|
|
5788
5907
|
}
|
|
5789
5908
|
return createOrderByCheckout;
|
|
@@ -5808,7 +5927,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5808
5927
|
}
|
|
5809
5928
|
}, _callee41, this);
|
|
5810
5929
|
}));
|
|
5811
|
-
function submitSalesOrder(
|
|
5930
|
+
function submitSalesOrder(_x52) {
|
|
5812
5931
|
return _submitSalesOrder.apply(this, arguments);
|
|
5813
5932
|
}
|
|
5814
5933
|
return submitSalesOrder;
|
|
@@ -5852,7 +5971,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5852
5971
|
}
|
|
5853
5972
|
}, _callee42, this);
|
|
5854
5973
|
}));
|
|
5855
|
-
function sendCustomerPayLink(
|
|
5974
|
+
function sendCustomerPayLink(_x53) {
|
|
5856
5975
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
5857
5976
|
}
|
|
5858
5977
|
return sendCustomerPayLink;
|
|
@@ -5896,7 +6015,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5896
6015
|
}
|
|
5897
6016
|
}, _callee43, this);
|
|
5898
6017
|
}));
|
|
5899
|
-
function getSalesOrderByLookup(
|
|
6018
|
+
function getSalesOrderByLookup(_x54) {
|
|
5900
6019
|
return _getSalesOrderByLookup.apply(this, arguments);
|
|
5901
6020
|
}
|
|
5902
6021
|
return getSalesOrderByLookup;
|
|
@@ -5911,26 +6030,35 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5911
6030
|
key: "hydrateTempOrderFromRecord",
|
|
5912
6031
|
value: (function () {
|
|
5913
6032
|
var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(record, options) {
|
|
5914
|
-
var _this$store$discount22;
|
|
5915
|
-
var sourceRaw, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, isSessionStorageHydrate, nextTempOrder, _this$store$discount20, _this$store$discount21, restoredSessionDiscounts, nextExtend, sourceLastOrderInfo, isDraftOrder, syntheticIdentityOptions, rawSummary, summarySurcharges, hadSyntheticDraftOrderId, hydratedEditDiscounts, currentDiscounts, currentScanDiscounts, hydratedDiscountIds, retainedScanDiscounts, nextDiscounts, shouldSkipEmptyDiscountSync, _this$store$discount23, _this$store$discount24;
|
|
6033
|
+
var _sourceRaw$_extend, _this$store$discount22;
|
|
6034
|
+
var sourceRaw, duplicateProductIdentityRepair, duplicateIdentityReadySource, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, isSessionStorageHydrate, nextTempOrder, _this$store$discount20, _this$store$discount21, restoredSessionDiscounts, nextExtend, sourceLastOrderInfo, isDraftOrder, syntheticIdentityOptions, rawSummary, summarySurcharges, hadSyntheticDraftOrderId, hydratedEditDiscounts, currentDiscounts, currentScanDiscounts, hydratedDiscountIds, retainedScanDiscounts, nextDiscounts, shouldSkipEmptyDiscountSync, _this$store$discount23, _this$store$discount24;
|
|
5916
6035
|
return _regeneratorRuntime().wrap(function _callee44$(_context47) {
|
|
5917
6036
|
while (1) switch (_context47.prev = _context47.next) {
|
|
5918
6037
|
case 0:
|
|
5919
6038
|
sourceRaw = record && _typeof(record) === 'object' && record.data && record.order_id == null ? record.data : record || {};
|
|
5920
|
-
|
|
6039
|
+
duplicateProductIdentityRepair = repairDuplicateOrderProductLineIdentities(Array.isArray(sourceRaw.products) ? sourceRaw.products : [], (_sourceRaw$_extend = sourceRaw._extend) === null || _sourceRaw$_extend === void 0 ? void 0 : _sourceRaw$_extend.productsByUid);
|
|
6040
|
+
duplicateIdentityReadySource = duplicateProductIdentityRepair.repairs.length ? _objectSpread(_objectSpread({}, sourceRaw), {}, {
|
|
6041
|
+
products: duplicateProductIdentityRepair.products
|
|
6042
|
+
}, duplicateProductIdentityRepair.productsByUid ? {
|
|
6043
|
+
_extend: _objectSpread(_objectSpread({}, sourceRaw._extend || {}), {}, {
|
|
6044
|
+
productsByUid: duplicateProductIdentityRepair.productsByUid
|
|
6045
|
+
})
|
|
6046
|
+
} : {}) : sourceRaw;
|
|
6047
|
+
identityReadySource = this.seedAnonymousBookingUidsFromProducts(duplicateIdentityReadySource);
|
|
5921
6048
|
normalizedCollections = normalizeOrderCollections(identityReadySource);
|
|
5922
6049
|
raw = normalizedCollections.order;
|
|
5923
|
-
hasIdentityChanges = Object.values(normalizedCollections.stats).some(function (stats) {
|
|
6050
|
+
hasIdentityChanges = duplicateProductIdentityRepair.repairs.length > 0 || Object.values(normalizedCollections.stats).some(function (stats) {
|
|
5924
6051
|
return stats.backfilledUidCount > 0 || stats.collapsedDuplicateCount > 0 || stats.uidConflictCount > 0 || stats.anonymousRowCount > 0;
|
|
5925
6052
|
});
|
|
5926
6053
|
if (hasIdentityChanges) {
|
|
5927
6054
|
identityLogMetadata = {
|
|
5928
6055
|
collections: normalizedCollections.stats,
|
|
5929
|
-
uidRemapCount: normalizedCollections.uidRemaps.length
|
|
6056
|
+
uidRemapCount: normalizedCollections.uidRemaps.length,
|
|
6057
|
+
duplicateProductUidRepairCount: duplicateProductIdentityRepair.repairs.length
|
|
5930
6058
|
};
|
|
5931
6059
|
hasIdentityWarnings = Object.values(normalizedCollections.stats).some(function (stats) {
|
|
5932
6060
|
return stats.uidConflictCount > 0 || stats.anonymousRowCount > 0;
|
|
5933
|
-
});
|
|
6061
|
+
}) || duplicateProductIdentityRepair.repairs.length > 0;
|
|
5934
6062
|
if (hasIdentityWarnings) {
|
|
5935
6063
|
this.logWarning('Normalized hydrated order collection identities', identityLogMetadata);
|
|
5936
6064
|
} else {
|
|
@@ -5943,7 +6071,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5943
6071
|
});
|
|
5944
6072
|
this.store.tempOrder = nextTempOrder;
|
|
5945
6073
|
if (!isSessionStorageHydrate) {
|
|
5946
|
-
_context47.next =
|
|
6074
|
+
_context47.next = 29;
|
|
5947
6075
|
break;
|
|
5948
6076
|
}
|
|
5949
6077
|
// 会话快照是未提交购物车,不应获得编辑订单的 saved/edit 标记与服务端基线。
|
|
@@ -5959,24 +6087,24 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5959
6087
|
nextTempOrder.discount_list = restoredSessionDiscounts;
|
|
5960
6088
|
this.store.summary = createEmptySummary();
|
|
5961
6089
|
this.store.lastOrderInfo = undefined;
|
|
5962
|
-
_context47.next = 20;
|
|
5963
|
-
return (_this$store$discount20 = this.store.discount) === null || _this$store$discount20 === void 0 ? void 0 : _this$store$discount20.setOriginalDiscountList(cloneDeep(restoredSessionDiscounts));
|
|
5964
|
-
case 20:
|
|
5965
6090
|
_context47.next = 22;
|
|
5966
|
-
return (_this$store$
|
|
6091
|
+
return (_this$store$discount20 = this.store.discount) === null || _this$store$discount20 === void 0 ? void 0 : _this$store$discount20.setOriginalDiscountList(cloneDeep(restoredSessionDiscounts));
|
|
5967
6092
|
case 22:
|
|
6093
|
+
_context47.next = 24;
|
|
6094
|
+
return (_this$store$discount21 = this.store.discount) === null || _this$store$discount21 === void 0 ? void 0 : _this$store$discount21.setDiscountList(cloneDeep(restoredSessionDiscounts));
|
|
6095
|
+
case 24:
|
|
5968
6096
|
if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
|
|
5969
|
-
_context47.next =
|
|
6097
|
+
_context47.next = 27;
|
|
5970
6098
|
break;
|
|
5971
6099
|
}
|
|
5972
|
-
_context47.next =
|
|
6100
|
+
_context47.next = 27;
|
|
5973
6101
|
return this.recalculateSummary({
|
|
5974
6102
|
createIfMissing: false
|
|
5975
6103
|
});
|
|
5976
|
-
case
|
|
6104
|
+
case 27:
|
|
5977
6105
|
this.persistTempOrder();
|
|
5978
6106
|
return _context47.abrupt("return", nextTempOrder);
|
|
5979
|
-
case
|
|
6107
|
+
case 29:
|
|
5980
6108
|
// Server list compatibility may synthesize order_id from external_sale_number; tempOrder must not.
|
|
5981
6109
|
sourceLastOrderInfo = sourceRaw.lastOrderInfo || sourceRaw;
|
|
5982
6110
|
isDraftOrder = Number(nextTempOrder.is_draft_order || 0) === 1;
|
|
@@ -6021,34 +6149,34 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6021
6149
|
nextDiscounts = [].concat(_toConsumableArray(hydratedEditDiscounts), _toConsumableArray(retainedScanDiscounts));
|
|
6022
6150
|
shouldSkipEmptyDiscountSync = nextDiscounts.length === 0 && currentDiscounts.length === 0;
|
|
6023
6151
|
if (shouldSkipEmptyDiscountSync) {
|
|
6024
|
-
_context47.next =
|
|
6152
|
+
_context47.next = 52;
|
|
6025
6153
|
break;
|
|
6026
6154
|
}
|
|
6027
6155
|
OrderModule.populateSavedAmounts(nextTempOrder.products, nextDiscounts);
|
|
6028
|
-
_context47.next = 48;
|
|
6029
|
-
return (_this$store$discount23 = this.store.discount) === null || _this$store$discount23 === void 0 ? void 0 : _this$store$discount23.setOriginalDiscountList(nextDiscounts);
|
|
6030
|
-
case 48:
|
|
6031
6156
|
_context47.next = 50;
|
|
6032
|
-
return (_this$store$
|
|
6157
|
+
return (_this$store$discount23 = this.store.discount) === null || _this$store$discount23 === void 0 ? void 0 : _this$store$discount23.setOriginalDiscountList(nextDiscounts);
|
|
6033
6158
|
case 50:
|
|
6159
|
+
_context47.next = 52;
|
|
6160
|
+
return (_this$store$discount24 = this.store.discount) === null || _this$store$discount24 === void 0 ? void 0 : _this$store$discount24.setDiscountList(nextDiscounts);
|
|
6161
|
+
case 52:
|
|
6034
6162
|
if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
|
|
6035
|
-
_context47.next =
|
|
6163
|
+
_context47.next = 55;
|
|
6036
6164
|
break;
|
|
6037
6165
|
}
|
|
6038
|
-
_context47.next =
|
|
6166
|
+
_context47.next = 55;
|
|
6039
6167
|
return this.recalculateSummary({
|
|
6040
6168
|
createIfMissing: false
|
|
6041
6169
|
});
|
|
6042
|
-
case
|
|
6170
|
+
case 55:
|
|
6043
6171
|
this.persistTempOrder();
|
|
6044
6172
|
return _context47.abrupt("return", nextTempOrder);
|
|
6045
|
-
case
|
|
6173
|
+
case 57:
|
|
6046
6174
|
case "end":
|
|
6047
6175
|
return _context47.stop();
|
|
6048
6176
|
}
|
|
6049
6177
|
}, _callee44, this);
|
|
6050
6178
|
}));
|
|
6051
|
-
function hydrateTempOrderFromRecord(
|
|
6179
|
+
function hydrateTempOrderFromRecord(_x55, _x56) {
|
|
6052
6180
|
return _hydrateTempOrderFromRecord.apply(this, arguments);
|
|
6053
6181
|
}
|
|
6054
6182
|
return hydrateTempOrderFromRecord;
|
|
@@ -6101,10 +6229,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6101
6229
|
_step22;
|
|
6102
6230
|
try {
|
|
6103
6231
|
for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
|
|
6104
|
-
var _product$
|
|
6232
|
+
var _product$metadata8;
|
|
6105
6233
|
var product = _step22.value;
|
|
6106
6234
|
var productUid = getOrderCollectionUid('product', product);
|
|
6107
|
-
var bookingUid = (product === null || product === void 0 ? void 0 : product.booking_uid) || (product === null || product === void 0 || (_product$
|
|
6235
|
+
var bookingUid = (product === null || product === void 0 ? void 0 : product.booking_uid) || (product === null || product === void 0 || (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.booking_uid);
|
|
6108
6236
|
if (!productUid || bookingUid === undefined || bookingUid === null || bookingUid === '') {
|
|
6109
6237
|
continue;
|
|
6110
6238
|
}
|
|
@@ -6221,15 +6349,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6221
6349
|
_step24;
|
|
6222
6350
|
try {
|
|
6223
6351
|
for (_iterator24.s(); !(_step24 = _iterator24.n()).done;) {
|
|
6224
|
-
var _product$
|
|
6352
|
+
var _product$metadata9, _ref75, _ref76, _existed$origin, _rawProduct$metadata;
|
|
6225
6353
|
var _step24$value = _slicedToArray(_step24.value, 2),
|
|
6226
6354
|
index = _step24$value[0],
|
|
6227
6355
|
product = _step24$value[1];
|
|
6228
|
-
var uid = (_product$
|
|
6356
|
+
var uid = (_product$metadata9 = product.metadata) === null || _product$metadata9 === void 0 ? void 0 : _product$metadata9.unique_identification_number;
|
|
6229
6357
|
if (!uid) continue;
|
|
6230
6358
|
var existed = productsByUid[uid] && _typeof(productsByUid[uid]) === 'object' ? productsByUid[uid] : {};
|
|
6231
6359
|
var rawProduct = rawProducts[index] && _typeof(rawProducts[index]) === 'object' ? rawProducts[index] : product;
|
|
6232
|
-
var origin = (
|
|
6360
|
+
var origin = (_ref75 = (_ref76 = (_existed$origin = existed.origin) !== null && _existed$origin !== void 0 ? _existed$origin : rawProduct._origin) !== null && _ref76 !== void 0 ? _ref76 : (_rawProduct$metadata = rawProduct.metadata) === null || _rawProduct$metadata === void 0 ? void 0 : _rawProduct$metadata.origin) !== null && _ref75 !== void 0 ? _ref75 : rawProduct;
|
|
6233
6361
|
var originSnapshot = cloneDeep(origin);
|
|
6234
6362
|
var productOptionString = this.buildHydratedProductOptionString(rawProduct) || this.buildHydratedProductOptionString(product);
|
|
6235
6363
|
if (productOptionString && originSnapshot && _typeof(originSnapshot) === 'object') {
|
|
@@ -6280,8 +6408,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6280
6408
|
var bookingUidByProductUid = new Map();
|
|
6281
6409
|
var productByUid = new Map();
|
|
6282
6410
|
(tempOrder.products || []).forEach(function (product) {
|
|
6283
|
-
var _product$
|
|
6284
|
-
var productUid = (product === null || product === void 0 || (_product$
|
|
6411
|
+
var _product$metadata10;
|
|
6412
|
+
var productUid = (product === null || product === void 0 || (_product$metadata10 = product.metadata) === null || _product$metadata10 === void 0 ? void 0 : _product$metadata10.unique_identification_number) || (product === null || product === void 0 ? void 0 : product.unique_identification_number);
|
|
6285
6413
|
if (productUid !== undefined && productUid !== null && String(productUid) !== '') {
|
|
6286
6414
|
productByUid.set(String(productUid), product);
|
|
6287
6415
|
}
|
|
@@ -6302,8 +6430,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6302
6430
|
bookingUidByProductUid.set(String(productUid), bookingUid);
|
|
6303
6431
|
});
|
|
6304
6432
|
(tempOrder.products || []).forEach(function (product) {
|
|
6305
|
-
var _product$
|
|
6306
|
-
var productUid = (product === null || product === void 0 || (_product$
|
|
6433
|
+
var _product$metadata11;
|
|
6434
|
+
var productUid = (product === null || product === void 0 || (_product$metadata11 = product.metadata) === null || _product$metadata11 === void 0 ? void 0 : _product$metadata11.unique_identification_number) || (product === null || product === void 0 ? void 0 : product.unique_identification_number);
|
|
6307
6435
|
if (productUid === undefined || productUid === null || String(productUid) === '') return;
|
|
6308
6436
|
var bookingUid = bookingUidByProductUid.get(String(productUid));
|
|
6309
6437
|
if (!bookingUid) return;
|
|
@@ -6358,10 +6486,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6358
6486
|
}, {
|
|
6359
6487
|
key: "normalizeHydratedProductOptionItem",
|
|
6360
6488
|
value: function normalizeHydratedProductOptionItem(optionItem) {
|
|
6361
|
-
var
|
|
6362
|
-
var rawNum = (
|
|
6489
|
+
var _ref77, _optionItem$num, _ref78, _optionItem$add_price;
|
|
6490
|
+
var rawNum = (_ref77 = (_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 && _ref77 !== void 0 ? _ref77 : 1;
|
|
6363
6491
|
var parsedNum = Number(rawNum);
|
|
6364
|
-
var rawPrice = (
|
|
6492
|
+
var rawPrice = (_ref78 = (_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 && _ref78 !== void 0 ? _ref78 : 0;
|
|
6365
6493
|
var parsedPrice = Number(rawPrice);
|
|
6366
6494
|
var normalized = _objectSpread(_objectSpread({}, optionItem), {}, {
|
|
6367
6495
|
option_group_item_id: optionItem === null || optionItem === void 0 ? void 0 : optionItem.option_group_item_id,
|
|
@@ -6443,7 +6571,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6443
6571
|
}
|
|
6444
6572
|
}, _callee45, this);
|
|
6445
6573
|
}));
|
|
6446
|
-
function getOrderInfo(
|
|
6574
|
+
function getOrderInfo(_x57) {
|
|
6447
6575
|
return _getOrderInfo.apply(this, arguments);
|
|
6448
6576
|
}
|
|
6449
6577
|
return getOrderInfo;
|
|
@@ -6502,10 +6630,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6502
6630
|
_step29;
|
|
6503
6631
|
try {
|
|
6504
6632
|
for (_iterator29.s(); !(_step29 = _iterator29.n()).done;) {
|
|
6505
|
-
var _ref80, _bundle$num3;
|
|
6506
6633
|
var bundle = _step29.value;
|
|
6507
6634
|
var isPersistedBundleProduct = isPersistedProduct || Boolean((bundle === null || bundle === void 0 ? void 0 : bundle.order_detail_id) || (bundle === null || bundle === void 0 ? void 0 : bundle.orderDetailId) || (bundle === null || bundle === void 0 ? void 0 : bundle.booking_id));
|
|
6508
|
-
var bundleQty =
|
|
6635
|
+
var bundleQty = Number(qty) || 1;
|
|
6509
6636
|
var _iterator30 = _createForOfIteratorHelper((bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) || []),
|
|
6510
6637
|
_step30;
|
|
6511
6638
|
try {
|