@pisell/pisellos 0.10.44 → 0.10.45
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/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +4 -2
- package/dist/modules/Customer/index.js +2 -1
- package/dist/modules/Discount/availability.d.ts +7 -0
- package/dist/modules/Discount/availability.js +49 -0
- package/dist/modules/Discount/index.d.ts +1 -3
- package/dist/modules/Discount/index.js +12 -151
- package/dist/modules/Discount/types.d.ts +6 -0
- package/dist/modules/Order/index.js +155 -130
- package/dist/modules/Order/utils.d.ts +1 -1
- package/dist/modules/Order/utils.js +84 -59
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Rules/index.js +50 -16
- package/dist/solution/BaseSales/types.d.ts +2 -2
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +59 -22
- package/dist/solution/ShopDiscount/utils.d.ts +4 -2
- package/dist/solution/ShopDiscount/utils.js +40 -21
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -0
- package/lib/modules/Customer/index.js +1 -0
- package/lib/modules/Discount/availability.d.ts +7 -0
- package/lib/modules/Discount/availability.js +43 -0
- package/lib/modules/Discount/index.d.ts +1 -3
- package/lib/modules/Discount/index.js +10 -131
- package/lib/modules/Discount/types.d.ts +6 -0
- package/lib/modules/Order/index.js +22 -8
- package/lib/modules/Order/utils.d.ts +1 -1
- package/lib/modules/Order/utils.js +20 -2
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Rules/index.js +42 -5
- package/lib/solution/BaseSales/types.d.ts +2 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +29 -3
- package/lib/solution/ShopDiscount/utils.d.ts +4 -2
- package/lib/solution/ShopDiscount/utils.js +39 -23
- package/package.json +1 -1
|
@@ -35,6 +35,7 @@ import { OrderHooks } from "./types";
|
|
|
35
35
|
import { composeLinePrice, generateDuration, getAllDiscountList, mergeRelationForms, ensureCartItemOriginHolder, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, isTempOrder, normalizeOrderMetaList, normalizeBookingIsAll, normalizeBookingSubType, mapPaymentItemsToOrderPayments, normalizeOrderProductDiscountList, resolveEffectivePerUnitDiscount, ensureProductSku, getProductSkuOptions, normalizeProductSkuOptions, sumOptionUnitPrice, clearTempOrderHolderAssignments, getOrderProductLineUid, indexOrderProductsByUid, calculateOrderProductsDeposit, buildPointCardSnapshotFromWalletPassList, buildVirtualCurrencySnapshotFromList, mergeOrderProductDisplayFields, resolveIsFormSubject, isMarkdownBundle } from "./utils";
|
|
36
36
|
import { isNormalProduct } from "../Product/utils";
|
|
37
37
|
import dayjs from 'dayjs';
|
|
38
|
+
import { getDiscountLifecycleReason } from "../Discount/availability";
|
|
38
39
|
import { stripOsPrivatePayloadFields } from "../../utils/os-private-payload";
|
|
39
40
|
import { buildSalesNoteText, decodeSalesNotesSnapshot, getSalesNotePolicy } from "./salesNotes";
|
|
40
41
|
import { ensureOrderPaymentNumber, mergeOrderPaymentRecord, resolveOrderPaymentIdentity } from "./payment-utils";
|
|
@@ -597,7 +598,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
597
598
|
}, {
|
|
598
599
|
key: "createDefaultRulesHooks",
|
|
599
600
|
value: function createDefaultRulesHooks() {
|
|
600
|
-
|
|
601
|
+
var _this2 = this;
|
|
602
|
+
return createDefaultOrderRulesHooks(function () {
|
|
603
|
+
var _this2$store$tempOrde;
|
|
604
|
+
return ((_this2$store$tempOrde = _this2.store.tempOrder) === null || _this2$store$tempOrde === void 0 ? void 0 : _this2$store$tempOrde.bookings) || [];
|
|
605
|
+
});
|
|
601
606
|
}
|
|
602
607
|
|
|
603
608
|
/**
|
|
@@ -619,7 +624,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
619
624
|
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
620
625
|
var _this$store$tempOrder,
|
|
621
626
|
_this$store$discount,
|
|
622
|
-
|
|
627
|
+
_this3 = this,
|
|
623
628
|
_this$store$tempOrder2;
|
|
624
629
|
var orderId, requestEpoch, requestOrderIdentityKey, prepareConfigResult, isCurrentRequest, discountList, _this$store$discount2, _this$store$discount3, _this$store$discount4, currentDiscountList, currentCommittedDiscounts, currentScanDiscounts, currentScanDiscountById, committedDiscountById, mergedCommittedDiscountIds, refreshedScanDiscountIds, runtimeDiscountIds, runtimeDiscounts, retainedCommittedDiscounts, retainedScanDiscounts, mergedDiscountList;
|
|
625
630
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
@@ -639,6 +644,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
639
644
|
with_available_wallet_pass_flag: 1,
|
|
640
645
|
with_virtual_currency: 1,
|
|
641
646
|
with_entitlement_pass: 1,
|
|
647
|
+
filter_order_wallet_pass_usage: 0,
|
|
642
648
|
request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
643
649
|
}, orderId ? {
|
|
644
650
|
order_id: orderId
|
|
@@ -646,8 +652,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
646
652
|
case 5:
|
|
647
653
|
prepareConfigResult = _context3.sent;
|
|
648
654
|
isCurrentRequest = function isCurrentRequest() {
|
|
649
|
-
var
|
|
650
|
-
return requestEpoch ===
|
|
655
|
+
var _this3$store$tempOrde, _this3$store$tempOrde2;
|
|
656
|
+
return requestEpoch === _this3.customerWalletPrepareConfigEpoch && _this3.getDiscountConfigOrderIdentityKey(_this3.store.tempOrder) === requestOrderIdentityKey && String((_this3$store$tempOrde = (_this3$store$tempOrde2 = _this3.store.tempOrder) === null || _this3$store$tempOrde2 === void 0 ? void 0 : _this3$store$tempOrde2.customer_id) !== null && _this3$store$tempOrde !== void 0 ? _this3$store$tempOrde : '') === String(params.customerId);
|
|
651
657
|
};
|
|
652
658
|
if (isCurrentRequest()) {
|
|
653
659
|
_context3.next = 9;
|
|
@@ -879,7 +885,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
879
885
|
value: function () {
|
|
880
886
|
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(code, customerId) {
|
|
881
887
|
var _this$store$discount11, _tempOrder$holder, _this$store$summary;
|
|
882
|
-
var resultDiscountWithReason, resultDiscountList, unavailableReasonKey, rulesModule, withScanList, currentSelected, tempOrder, holders, _ref16, isAvailable, newDiscountList, evaluatedDiscountList, unavailableReason, shouldRetainForLater, normalizedNewDiscountList,
|
|
888
|
+
var resultDiscountWithReason, resultDiscountList, unavailableReasonKey, rulesModule, withScanList, currentSelected, tempOrder, holders, _ref16, isAvailable, newDiscountList, evaluatedDiscountList, unavailableReason, scannedIds, evaluatedScannedDiscounts, shouldRetainForLater, normalizedNewDiscountList, resolvedDiscountList, _this$store$discount12, _this$store$discount13, retainedDiscounts;
|
|
883
889
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
884
890
|
while (1) switch (_context6.prev = _context6.next) {
|
|
885
891
|
case 0:
|
|
@@ -982,46 +988,65 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
982
988
|
isAvailable: false,
|
|
983
989
|
discountList: this.getDiscountList()
|
|
984
990
|
}, isAvailable = _ref16.isAvailable, newDiscountList = _ref16.discountList, evaluatedDiscountList = _ref16.evaluatedDiscountList, unavailableReason = _ref16.unavailableReason;
|
|
985
|
-
|
|
991
|
+
scannedIds = new Set(withScanList.map(function (discount) {
|
|
992
|
+
return String(discount.id);
|
|
993
|
+
}));
|
|
994
|
+
evaluatedScannedDiscounts = (evaluatedDiscountList || withScanList).filter(function (discount) {
|
|
995
|
+
return scannedIds.has(String(discount.id)) && isCustomerPromotionDiscount(discount) && !getDiscountLifecycleReason(discount);
|
|
996
|
+
});
|
|
997
|
+
shouldRetainForLater = !isAvailable && evaluatedScannedDiscounts.length > 0;
|
|
986
998
|
normalizedNewDiscountList = newDiscountList ? markScannedDiscounts(newDiscountList, withScanList) : undefined;
|
|
987
|
-
retainedDiscountList = evaluatedDiscountList ? markScannedDiscounts(evaluatedDiscountList, withScanList) : normalizedNewDiscountList;
|
|
988
999
|
resolvedDiscountList = normalizedNewDiscountList || this.getDiscountList();
|
|
989
1000
|
if (!(isAvailable && normalizedNewDiscountList)) {
|
|
990
|
-
_context6.next =
|
|
1001
|
+
_context6.next = 37;
|
|
991
1002
|
break;
|
|
992
1003
|
}
|
|
993
|
-
_context6.next =
|
|
1004
|
+
_context6.next = 31;
|
|
994
1005
|
return (_this$store$discount12 = this.store.discount) === null || _this$store$discount12 === void 0 ? void 0 : _this$store$discount12.setDiscountList(normalizedNewDiscountList);
|
|
995
|
-
case
|
|
1006
|
+
case 31:
|
|
996
1007
|
this.applyDiscount();
|
|
997
|
-
_context6.next =
|
|
1008
|
+
_context6.next = 34;
|
|
998
1009
|
return this.syncScannedDiscountsToOriginalDiscountList(this.getDiscountList());
|
|
999
|
-
case
|
|
1010
|
+
case 34:
|
|
1000
1011
|
resolvedDiscountList = this.getDiscountList();
|
|
1001
|
-
_context6.next =
|
|
1012
|
+
_context6.next = 45;
|
|
1002
1013
|
break;
|
|
1003
|
-
case
|
|
1004
|
-
if (!
|
|
1005
|
-
_context6.next =
|
|
1014
|
+
case 37:
|
|
1015
|
+
if (!shouldRetainForLater) {
|
|
1016
|
+
_context6.next = 45;
|
|
1006
1017
|
break;
|
|
1007
1018
|
}
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1019
|
+
// 只合并本次识别的卡券;不把试算产生的其他选券状态写回订单。
|
|
1020
|
+
retainedDiscounts = new Map(this.getDiscountList().map(function (discount) {
|
|
1021
|
+
return [String(discount.id), discount];
|
|
1022
|
+
}));
|
|
1023
|
+
evaluatedScannedDiscounts.forEach(function (discount) {
|
|
1024
|
+
retainedDiscounts.set(String(discount.id), _objectSpread(_objectSpread({}, discount), {}, {
|
|
1025
|
+
isScan: true,
|
|
1026
|
+
isAvailable: false,
|
|
1027
|
+
isSelected: false,
|
|
1028
|
+
reasonCode: discount.reasonCode || 'product_not_applicable',
|
|
1029
|
+
appliedProductDetails: [],
|
|
1030
|
+
savedAmount: 0
|
|
1031
|
+
}));
|
|
1032
|
+
});
|
|
1033
|
+
_context6.next = 42;
|
|
1034
|
+
return (_this$store$discount13 = this.store.discount) === null || _this$store$discount13 === void 0 ? void 0 : _this$store$discount13.setDiscountList(_toConsumableArray(retainedDiscounts.values()));
|
|
1035
|
+
case 42:
|
|
1036
|
+
_context6.next = 44;
|
|
1012
1037
|
return this.syncScannedDiscountsToOriginalDiscountList(this.getDiscountList());
|
|
1013
|
-
case
|
|
1038
|
+
case 44:
|
|
1014
1039
|
resolvedDiscountList = this.getDiscountList();
|
|
1015
|
-
case
|
|
1040
|
+
case 45:
|
|
1016
1041
|
return _context6.abrupt("return", {
|
|
1017
1042
|
type: 'clientCalc',
|
|
1018
1043
|
isAvailable: isAvailable || false,
|
|
1019
1044
|
isAccepted: Boolean(isAvailable || shouldRetainForLater),
|
|
1020
1045
|
discountList: resolvedDiscountList,
|
|
1021
|
-
scannedDiscountList:
|
|
1046
|
+
scannedDiscountList: evaluatedScannedDiscounts,
|
|
1022
1047
|
unavailableReason: unavailableReason
|
|
1023
1048
|
});
|
|
1024
|
-
case
|
|
1049
|
+
case 46:
|
|
1025
1050
|
case "end":
|
|
1026
1051
|
return _context6.stop();
|
|
1027
1052
|
}
|
|
@@ -1037,7 +1062,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1037
1062
|
value: function applyDiscount(options) {
|
|
1038
1063
|
var _this$store$discount16,
|
|
1039
1064
|
_this$store$summary2,
|
|
1040
|
-
|
|
1065
|
+
_this4 = this;
|
|
1041
1066
|
var tempOrder = this.store.tempOrder;
|
|
1042
1067
|
// 任意 products CRUD 后都应当重算 discount 状态;即使 products 为空,
|
|
1043
1068
|
// 也需要让 Rules.calcDiscount 把 DiscountModule 的 isSelected / isAvailable /
|
|
@@ -1093,7 +1118,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1093
1118
|
(_this$store$discount17 = this.store.discount) === null || _this$store$discount17 === void 0 || _this$store$discount17.setDiscountList(result.discountList);
|
|
1094
1119
|
}
|
|
1095
1120
|
this.hasActiveCustomerBoundDiscount = (tempOrder.products || []).some(function (product) {
|
|
1096
|
-
return
|
|
1121
|
+
return _this4.productHasCustomerBoundDiscount(product);
|
|
1097
1122
|
});
|
|
1098
1123
|
}
|
|
1099
1124
|
|
|
@@ -1156,7 +1181,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1156
1181
|
var _evaluatePromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
1157
1182
|
var _this$promotionEvalua,
|
|
1158
1183
|
_this$promotionEvalua2,
|
|
1159
|
-
|
|
1184
|
+
_this5 = this;
|
|
1160
1185
|
var tempOrder, strategyConfigs, result, removeSet, _iterator3, _step3, reduce, _iterator6, _step6, _loop2, _iterator4, _step4, _loop, payload;
|
|
1161
1186
|
return _regeneratorRuntime().wrap(function _callee7$(_context9) {
|
|
1162
1187
|
while (1) switch (_context9.prev = _context9.next) {
|
|
@@ -1315,7 +1340,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1315
1340
|
case 6:
|
|
1316
1341
|
_context7.prev = 6;
|
|
1317
1342
|
_context7.next = 9;
|
|
1318
|
-
return
|
|
1343
|
+
return _this5.giftSelectResolver({
|
|
1319
1344
|
strategyId: addAction.strategyId,
|
|
1320
1345
|
strategyName: addAction.strategyName,
|
|
1321
1346
|
giftCount: addAction.giftCount,
|
|
@@ -1350,7 +1375,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1350
1375
|
_context7.next = 26;
|
|
1351
1376
|
break;
|
|
1352
1377
|
}
|
|
1353
|
-
linked =
|
|
1378
|
+
linked = _this5.createLinkedProductAndBooking({
|
|
1354
1379
|
product: gp,
|
|
1355
1380
|
booking: booking
|
|
1356
1381
|
});
|
|
@@ -1811,23 +1836,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1811
1836
|
}, {
|
|
1812
1837
|
key: "calculatePaymentTotal",
|
|
1813
1838
|
value: function calculatePaymentTotal(payments) {
|
|
1814
|
-
var
|
|
1839
|
+
var _this6 = this;
|
|
1815
1840
|
return mapPaymentItemsToOrderPayments(payments, {
|
|
1816
1841
|
includeVoided: false
|
|
1817
1842
|
}).reduce(function (sum, payment) {
|
|
1818
1843
|
if (!isPaidPaymentRecord(payment)) return sum;
|
|
1819
|
-
return sum.plus(
|
|
1844
|
+
return sum.plus(_this6.calculatePaymentEffectiveAmount(payment));
|
|
1820
1845
|
}, new Decimal(0));
|
|
1821
1846
|
}
|
|
1822
1847
|
}, {
|
|
1823
1848
|
key: "calculateOrderPaidPaymentTotal",
|
|
1824
1849
|
value: function calculateOrderPaidPaymentTotal(payments) {
|
|
1825
|
-
var
|
|
1850
|
+
var _this7 = this;
|
|
1826
1851
|
return mapPaymentItemsToOrderPayments(payments, {
|
|
1827
1852
|
includeVoided: false
|
|
1828
1853
|
}).reduce(function (sum, payment) {
|
|
1829
1854
|
if (!isPaidPaymentRecord(payment)) return sum;
|
|
1830
|
-
return sum.plus(
|
|
1855
|
+
return sum.plus(_this7.calculatePaymentGapAmount(payment));
|
|
1831
1856
|
}, new Decimal(0));
|
|
1832
1857
|
}
|
|
1833
1858
|
}, {
|
|
@@ -1963,13 +1988,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1963
1988
|
}, {
|
|
1964
1989
|
key: "calculateDepositPaidAmount",
|
|
1965
1990
|
value: function calculateDepositPaidAmount(payments) {
|
|
1966
|
-
var
|
|
1991
|
+
var _this8 = this;
|
|
1967
1992
|
return (payments || []).reduce(function (sum, payment) {
|
|
1968
1993
|
var paymentRecord = payment;
|
|
1969
1994
|
if (!isPaidPaymentRecord(paymentRecord)) return sum;
|
|
1970
1995
|
var isDepositPayment = paymentRecord.type === 'deposit' || paymentRecord.order_payment_type === 'deposit';
|
|
1971
1996
|
if (!isDepositPayment) return sum;
|
|
1972
|
-
return sum.plus(
|
|
1997
|
+
return sum.plus(_this8.calculatePaymentGapAmount(paymentRecord));
|
|
1973
1998
|
}, new Decimal(0));
|
|
1974
1999
|
}
|
|
1975
2000
|
}, {
|
|
@@ -2006,17 +2031,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2006
2031
|
}, {
|
|
2007
2032
|
key: "getPaymentNumberDevicePrefixSync",
|
|
2008
2033
|
value: function getPaymentNumberDevicePrefixSync() {
|
|
2009
|
-
var
|
|
2034
|
+
var _this9 = this;
|
|
2010
2035
|
return resolvePaymentNumberDevicePrefixFromDeviceId(function (key) {
|
|
2011
|
-
return
|
|
2036
|
+
return _this9.getPaymentNumberAppData(key);
|
|
2012
2037
|
});
|
|
2013
2038
|
}
|
|
2014
2039
|
}, {
|
|
2015
2040
|
key: "getPaymentNumberDevicePrefixAsync",
|
|
2016
2041
|
value: function getPaymentNumberDevicePrefixAsync() {
|
|
2017
|
-
var
|
|
2042
|
+
var _this10 = this;
|
|
2018
2043
|
return resolvePaymentNumberDevicePrefix(function (key) {
|
|
2019
|
-
return
|
|
2044
|
+
return _this10.getPaymentNumberAppData(key);
|
|
2020
2045
|
});
|
|
2021
2046
|
}
|
|
2022
2047
|
}, {
|
|
@@ -2146,16 +2171,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2146
2171
|
}, {
|
|
2147
2172
|
key: "calculatePaidPaymentSummary",
|
|
2148
2173
|
value: function calculatePaidPaymentSummary(payments) {
|
|
2149
|
-
var
|
|
2174
|
+
var _this11 = this;
|
|
2150
2175
|
return (payments || []).reduce(function (summary, payment) {
|
|
2151
2176
|
var paymentRecord = payment;
|
|
2152
2177
|
if (!isPaidPaymentRecord(paymentRecord)) return summary;
|
|
2153
2178
|
return {
|
|
2154
2179
|
customerPaidAmount: summary.customerPaidAmount.plus(paymentRecord.amount || 0),
|
|
2155
|
-
orderPaidAmount: summary.orderPaidAmount.plus(
|
|
2156
|
-
gapPaidAmount: summary.gapPaidAmount.plus(
|
|
2157
|
-
payServiceChargeAmount: summary.payServiceChargeAmount.plus(
|
|
2158
|
-
roundingAmount: summary.roundingAmount.plus(
|
|
2180
|
+
orderPaidAmount: summary.orderPaidAmount.plus(_this11.calculatePaymentOrderAmount(paymentRecord)),
|
|
2181
|
+
gapPaidAmount: summary.gapPaidAmount.plus(_this11.calculatePaymentGapAmount(paymentRecord)),
|
|
2182
|
+
payServiceChargeAmount: summary.payServiceChargeAmount.plus(_this11.calculatePaymentServiceFee(paymentRecord)),
|
|
2183
|
+
roundingAmount: summary.roundingAmount.plus(_this11.calculatePaymentRoundingAmount(paymentRecord))
|
|
2159
2184
|
};
|
|
2160
2185
|
}, {
|
|
2161
2186
|
customerPaidAmount: new Decimal(0),
|
|
@@ -2362,15 +2387,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2362
2387
|
}, {
|
|
2363
2388
|
key: "normalizeFingerprintValue",
|
|
2364
2389
|
value: function normalizeFingerprintValue(value) {
|
|
2365
|
-
var
|
|
2390
|
+
var _this12 = this;
|
|
2366
2391
|
if (Array.isArray(value)) {
|
|
2367
2392
|
return value.map(function (item) {
|
|
2368
|
-
return
|
|
2393
|
+
return _this12.normalizeFingerprintValue(item);
|
|
2369
2394
|
});
|
|
2370
2395
|
}
|
|
2371
2396
|
if (!value || _typeof(value) !== 'object') return value !== null && value !== void 0 ? value : '';
|
|
2372
2397
|
return Object.keys(value).sort().reduce(function (result, key) {
|
|
2373
|
-
result[key] =
|
|
2398
|
+
result[key] = _this12.normalizeFingerprintValue(value[key]);
|
|
2374
2399
|
return result;
|
|
2375
2400
|
}, {});
|
|
2376
2401
|
}
|
|
@@ -2385,7 +2410,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2385
2410
|
_sku$barcode,
|
|
2386
2411
|
_ref23,
|
|
2387
2412
|
_sku$variant_id,
|
|
2388
|
-
|
|
2413
|
+
_this13 = this;
|
|
2389
2414
|
var sku = (product === null || product === void 0 ? void 0 : product.product_sku) || {};
|
|
2390
2415
|
var metadata = (product === null || product === void 0 ? void 0 : product.metadata) || {};
|
|
2391
2416
|
var discountTypes = ((product === null || product === void 0 ? void 0 : product.discount_list) || []).map(function (discount) {
|
|
@@ -2422,7 +2447,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2422
2447
|
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,
|
|
2423
2448
|
option_group_item_id: (_ref25 = (_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 && _ref25 !== void 0 ? _ref25 : null,
|
|
2424
2449
|
num: Number((_option$num = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num !== void 0 ? _option$num : 1) || 1,
|
|
2425
|
-
add_price:
|
|
2450
|
+
add_price: _this13.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)
|
|
2426
2451
|
};
|
|
2427
2452
|
})
|
|
2428
2453
|
}),
|
|
@@ -2432,8 +2457,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2432
2457
|
bundle_product_id: (_ref26 = (_ref27 = (_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 && _ref27 !== void 0 ? _ref27 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id) !== null && _ref26 !== void 0 ? _ref26 : null,
|
|
2433
2458
|
bundle_variant_id: (_ref28 = (_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 && _ref28 !== void 0 ? _ref28 : 0,
|
|
2434
2459
|
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),
|
|
2435
|
-
price:
|
|
2436
|
-
bundle_selling_price:
|
|
2460
|
+
price: _this13.normalizeFingerprintMoney(bundle === null || bundle === void 0 ? void 0 : bundle.price),
|
|
2461
|
+
bundle_selling_price: _this13.normalizeFingerprintMoney(bundle === null || bundle === void 0 ? void 0 : bundle.bundle_selling_price),
|
|
2437
2462
|
price_type: (_bundle$price_type = bundle === null || bundle === void 0 ? void 0 : bundle.price_type) !== null && _bundle$price_type !== void 0 ? _bundle$price_type : '',
|
|
2438
2463
|
price_type_ext: (_bundle$price_type_ex = bundle === null || bundle === void 0 ? void 0 : bundle.price_type_ext) !== null && _bundle$price_type_ex !== void 0 ? _bundle$price_type_ex : ''
|
|
2439
2464
|
};
|
|
@@ -2443,7 +2468,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2443
2468
|
return {
|
|
2444
2469
|
type: (_ref29 = (_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 && _ref29 !== void 0 ? _ref29 : '',
|
|
2445
2470
|
discount_id: (_ref30 = (_ref31 = (_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 && _ref31 !== void 0 ? _ref31 : discount === null || discount === void 0 || (_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) !== null && _ref30 !== void 0 ? _ref30 : null,
|
|
2446
|
-
amount:
|
|
2471
|
+
amount: _this13.normalizeFingerprintMoney(discount === null || discount === void 0 ? void 0 : discount.amount)
|
|
2447
2472
|
};
|
|
2448
2473
|
}))
|
|
2449
2474
|
};
|
|
@@ -2451,9 +2476,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2451
2476
|
}, {
|
|
2452
2477
|
key: "buildOrderProductsFingerprint",
|
|
2453
2478
|
value: function buildOrderProductsFingerprint(products) {
|
|
2454
|
-
var
|
|
2479
|
+
var _this14 = this;
|
|
2455
2480
|
var items = (products || []).map(function (product) {
|
|
2456
|
-
return
|
|
2481
|
+
return _this14.buildProductFingerprintItem(product);
|
|
2457
2482
|
});
|
|
2458
2483
|
items.sort(function (left, right) {
|
|
2459
2484
|
return JSON.stringify(left).localeCompare(JSON.stringify(right));
|
|
@@ -2475,7 +2500,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2475
2500
|
_sku$barcode2,
|
|
2476
2501
|
_ref33,
|
|
2477
2502
|
_sku$variant_id2,
|
|
2478
|
-
|
|
2503
|
+
_this15 = this;
|
|
2479
2504
|
var sku = (product === null || product === void 0 ? void 0 : product.product_sku) || {};
|
|
2480
2505
|
var metadata = (product === null || product === void 0 ? void 0 : product.metadata) || {};
|
|
2481
2506
|
var discountTypes = ((product === null || product === void 0 ? void 0 : product.discount_list) || []).map(function (discount) {
|
|
@@ -2509,7 +2534,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2509
2534
|
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,
|
|
2510
2535
|
option_group_item_id: (_ref35 = (_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 && _ref35 !== void 0 ? _ref35 : null,
|
|
2511
2536
|
num: Number((_option$num2 = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num2 !== void 0 ? _option$num2 : 1) || 1,
|
|
2512
|
-
add_price:
|
|
2537
|
+
add_price: _this15.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)
|
|
2513
2538
|
};
|
|
2514
2539
|
})
|
|
2515
2540
|
}),
|
|
@@ -2523,14 +2548,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2523
2548
|
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),
|
|
2524
2549
|
price_type: (_bundle$price_type2 = bundle === null || bundle === void 0 ? void 0 : bundle.price_type) !== null && _bundle$price_type2 !== void 0 ? _bundle$price_type2 : '',
|
|
2525
2550
|
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 : '',
|
|
2526
|
-
option:
|
|
2551
|
+
option: _this15.normalizeFingerprintValue(((bundle === null || bundle === void 0 ? void 0 : bundle.option) || []).map(function (option) {
|
|
2527
2552
|
var _ref41, _option$id3, _option$option_group_5, _ref42, _option$option_group_6, _option$num3, _option$add_price3;
|
|
2528
2553
|
return {
|
|
2529
2554
|
id: (_ref41 = (_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 && _ref41 !== void 0 ? _ref41 : null,
|
|
2530
2555
|
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,
|
|
2531
2556
|
option_group_item_id: (_ref42 = (_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 && _ref42 !== void 0 ? _ref42 : null,
|
|
2532
2557
|
num: Number((_option$num3 = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num3 !== void 0 ? _option$num3 : 1) || 1,
|
|
2533
|
-
add_price:
|
|
2558
|
+
add_price: _this15.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)
|
|
2534
2559
|
};
|
|
2535
2560
|
}))
|
|
2536
2561
|
};
|
|
@@ -2540,7 +2565,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2540
2565
|
return {
|
|
2541
2566
|
type: (_ref43 = (_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 && _ref43 !== void 0 ? _ref43 : '',
|
|
2542
2567
|
discount_id: (_ref44 = (_ref45 = (_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 && _ref45 !== void 0 ? _ref45 : discount === null || discount === void 0 || (_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.resource_id) !== null && _ref44 !== void 0 ? _ref44 : null,
|
|
2543
|
-
amount:
|
|
2568
|
+
amount: _this15.normalizeFingerprintMoney(discount === null || discount === void 0 ? void 0 : discount.amount)
|
|
2544
2569
|
};
|
|
2545
2570
|
}))
|
|
2546
2571
|
};
|
|
@@ -2548,9 +2573,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2548
2573
|
}, {
|
|
2549
2574
|
key: "buildOrderProductsStructuralFingerprint",
|
|
2550
2575
|
value: function buildOrderProductsStructuralFingerprint(products) {
|
|
2551
|
-
var
|
|
2576
|
+
var _this16 = this;
|
|
2552
2577
|
var items = (products || []).map(function (product) {
|
|
2553
|
-
return
|
|
2578
|
+
return _this16.buildProductStructuralFingerprintItem(product);
|
|
2554
2579
|
});
|
|
2555
2580
|
items.sort(function (left, right) {
|
|
2556
2581
|
return JSON.stringify(left).localeCompare(JSON.stringify(right));
|
|
@@ -3002,9 +3027,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3002
3027
|
}, {
|
|
3003
3028
|
key: "sanitizeTempOrderProducts",
|
|
3004
3029
|
value: function sanitizeTempOrderProducts(tempOrder) {
|
|
3005
|
-
var
|
|
3030
|
+
var _this17 = this;
|
|
3006
3031
|
tempOrder.products = (tempOrder.products || []).map(function (product) {
|
|
3007
|
-
return
|
|
3032
|
+
return _this17.sanitizeOrderProductForTempOrder(_this17.normalizeVirtualSettlementProductIfEnabled(product));
|
|
3008
3033
|
});
|
|
3009
3034
|
this.syncTempOrderSettlementState(tempOrder);
|
|
3010
3035
|
ensureUniqueProductLineUids(tempOrder);
|
|
@@ -3124,7 +3149,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3124
3149
|
}, {
|
|
3125
3150
|
key: "syncLinkedBookingHoldersToProducts",
|
|
3126
3151
|
value: function syncLinkedBookingHoldersToProducts(tempOrder) {
|
|
3127
|
-
var
|
|
3152
|
+
var _this18 = this;
|
|
3128
3153
|
var bookings = tempOrder.bookings || [];
|
|
3129
3154
|
var products = tempOrder.products || [];
|
|
3130
3155
|
if (!bookings.length || !products.length) return;
|
|
@@ -3149,7 +3174,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3149
3174
|
var bookingUid = product.booking_uid || ((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.booking_uid);
|
|
3150
3175
|
var linkedBooking = (productUid !== undefined && productUid !== null && String(productUid) !== '' ? bookingByProductUid.get(String(productUid)) : undefined) || (bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '' ? bookingByBookingUid.get(String(bookingUid)) : undefined);
|
|
3151
3176
|
if (linkedBooking) {
|
|
3152
|
-
|
|
3177
|
+
_this18.setProductHolderFromBooking(product, linkedBooking);
|
|
3153
3178
|
}
|
|
3154
3179
|
});
|
|
3155
3180
|
}
|
|
@@ -3277,9 +3302,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3277
3302
|
}, {
|
|
3278
3303
|
key: "findBookingIndexByUniqueIdentificationNumber",
|
|
3279
3304
|
value: function findBookingIndexByUniqueIdentificationNumber(tempOrder, uniqueIdentificationNumber) {
|
|
3280
|
-
var
|
|
3305
|
+
var _this19 = this;
|
|
3281
3306
|
return (tempOrder.bookings || []).findIndex(function (booking) {
|
|
3282
|
-
return
|
|
3307
|
+
return _this19.getBookingUniqueIdentificationNumber(booking) === uniqueIdentificationNumber;
|
|
3283
3308
|
});
|
|
3284
3309
|
}
|
|
3285
3310
|
}, {
|
|
@@ -3287,12 +3312,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3287
3312
|
value: function removeLinkedBookingsForProduct(tempOrder, product) {
|
|
3288
3313
|
var _product$metadata5,
|
|
3289
3314
|
_product$metadata6,
|
|
3290
|
-
|
|
3315
|
+
_this20 = this;
|
|
3291
3316
|
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);
|
|
3292
3317
|
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);
|
|
3293
3318
|
if (!productUid && !bookingUid) return;
|
|
3294
3319
|
tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
|
|
3295
|
-
var currentBookingUid =
|
|
3320
|
+
var currentBookingUid = _this20.getBookingUniqueIdentificationNumber(booking);
|
|
3296
3321
|
if (bookingUid && currentBookingUid === String(bookingUid)) return false;
|
|
3297
3322
|
if (productUid && String((booking === null || booking === void 0 ? void 0 : booking.product_uid) || '') === String(productUid)) return false;
|
|
3298
3323
|
return true;
|
|
@@ -3594,7 +3619,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3594
3619
|
}, {
|
|
3595
3620
|
key: "removeSalesNotesForMissingProductLines",
|
|
3596
3621
|
value: function removeSalesNotesForMissingProductLines(tempOrder) {
|
|
3597
|
-
var
|
|
3622
|
+
var _this21 = this;
|
|
3598
3623
|
var state = this.ensureSalesNotesRuntimeState(tempOrder);
|
|
3599
3624
|
if (!state.loaded || !Array.isArray(tempOrder.notes) || tempOrder.notes.length === 0) {
|
|
3600
3625
|
return;
|
|
@@ -3606,7 +3631,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3606
3631
|
return typeof uid === 'string' && uid.length > 0;
|
|
3607
3632
|
}));
|
|
3608
3633
|
var nextNotes = tempOrder.notes.filter(function (note) {
|
|
3609
|
-
var primary =
|
|
3634
|
+
var primary = _this21.getSalesNotePrimaryRelation(note);
|
|
3610
3635
|
if (!primary || primary.target_type !== 'order_detail') return true;
|
|
3611
3636
|
return remainingProductUids.has(primary.target_uuid);
|
|
3612
3637
|
});
|
|
@@ -3618,7 +3643,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3618
3643
|
key: "setSalesNoteOnTempOrder",
|
|
3619
3644
|
value: function setSalesNoteOnTempOrder(tempOrder, input) {
|
|
3620
3645
|
var _input$target,
|
|
3621
|
-
|
|
3646
|
+
_this22 = this,
|
|
3622
3647
|
_tempOrder$shop_order;
|
|
3623
3648
|
this.ensureSalesNotesLoadedForMutation(tempOrder);
|
|
3624
3649
|
var note_type = String(input.note_type || '').trim();
|
|
@@ -3642,7 +3667,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3642
3667
|
var notes = tempOrder.notes || [];
|
|
3643
3668
|
// 当前 allergy policy 固定同一商品行只保留一条;业务调用方不参与去重规则。
|
|
3644
3669
|
var existingIndex = policy.uniquePerPrimaryTarget ? notes.findIndex(function (note) {
|
|
3645
|
-
var primary =
|
|
3670
|
+
var primary = _this22.getSalesNotePrimaryRelation(note);
|
|
3646
3671
|
return note.note_type === note_type && (primary === null || primary === void 0 ? void 0 : primary.target_type) === 'order_detail' && primary.target_uuid === target_uuid;
|
|
3647
3672
|
}) : -1;
|
|
3648
3673
|
var existing = existingIndex >= 0 ? notes[existingIndex] : null;
|
|
@@ -3924,15 +3949,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3924
3949
|
}, {
|
|
3925
3950
|
key: "productHasCustomerBoundDiscount",
|
|
3926
3951
|
value: function productHasCustomerBoundDiscount(product) {
|
|
3927
|
-
var
|
|
3952
|
+
var _this23 = this;
|
|
3928
3953
|
if (((product === null || product === void 0 ? void 0 : product.discount_list) || []).some(function (discount) {
|
|
3929
|
-
return
|
|
3954
|
+
return _this23.isCustomerBoundDiscount(discount);
|
|
3930
3955
|
})) {
|
|
3931
3956
|
return true;
|
|
3932
3957
|
}
|
|
3933
3958
|
return ((product === null || product === void 0 ? void 0 : product.product_bundle) || []).some(function (bundle) {
|
|
3934
3959
|
return ((bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) || []).some(function (discount) {
|
|
3935
|
-
return
|
|
3960
|
+
return _this23.isCustomerBoundDiscount(discount);
|
|
3936
3961
|
});
|
|
3937
3962
|
});
|
|
3938
3963
|
}
|
|
@@ -3941,18 +3966,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3941
3966
|
value: function shouldSkipDiscountCalculation(tempOrder) {
|
|
3942
3967
|
var _this$store$discount20,
|
|
3943
3968
|
_this$store$discount21,
|
|
3944
|
-
|
|
3969
|
+
_this24 = this;
|
|
3945
3970
|
if (this.hasActiveCustomerBoundDiscount) return false;
|
|
3946
3971
|
var discountList = ((_this$store$discount20 = this.store.discount) === null || _this$store$discount20 === void 0 || (_this$store$discount21 = _this$store$discount20.getDiscountList) === null || _this$store$discount21 === void 0 ? void 0 : _this$store$discount21.call(_this$store$discount20)) || [];
|
|
3947
3972
|
if (discountList.length > 0) return false;
|
|
3948
3973
|
return !(tempOrder.products || []).some(function (product) {
|
|
3949
|
-
return
|
|
3974
|
+
return _this24.productHasCustomerBoundDiscount(product);
|
|
3950
3975
|
});
|
|
3951
3976
|
}
|
|
3952
3977
|
}, {
|
|
3953
3978
|
key: "clearCustomerBoundDiscounts",
|
|
3954
3979
|
value: function clearCustomerBoundDiscounts(tempOrder) {
|
|
3955
|
-
var
|
|
3980
|
+
var _this25 = this,
|
|
3956
3981
|
_discountModule$getDi,
|
|
3957
3982
|
_discountModule$getOr,
|
|
3958
3983
|
_discountModule$setDi,
|
|
@@ -3961,7 +3986,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3961
3986
|
var filterDiscountList = function filterDiscountList(discountList) {
|
|
3962
3987
|
if (!Array.isArray(discountList)) return [];
|
|
3963
3988
|
return discountList.filter(function (discount) {
|
|
3964
|
-
var shouldRemove =
|
|
3989
|
+
var shouldRemove = _this25.isCustomerBoundDiscount(discount);
|
|
3965
3990
|
if (shouldRemove) didRemoveCustomerBoundDiscount = true;
|
|
3966
3991
|
return !shouldRemove;
|
|
3967
3992
|
});
|
|
@@ -3988,12 +4013,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3988
4013
|
var currentDiscounts = ((_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [];
|
|
3989
4014
|
var currentOriginalDiscounts = ((_discountModule$getOr = discountModule.getOriginalDiscountList) === null || _discountModule$getOr === void 0 ? void 0 : _discountModule$getOr.call(discountModule)) || [];
|
|
3990
4015
|
var nextDiscounts = currentDiscounts.filter(function (discount) {
|
|
3991
|
-
if (
|
|
3992
|
-
return !
|
|
4016
|
+
if (_this25.shouldKeepCustomerBoundDiscountAfterCustomerChange(discount)) return true;
|
|
4017
|
+
return !_this25.isCustomerBoundDiscount(discount);
|
|
3993
4018
|
});
|
|
3994
4019
|
var nextOriginalDiscounts = currentOriginalDiscounts.filter(function (discount) {
|
|
3995
|
-
if (
|
|
3996
|
-
return !
|
|
4020
|
+
if (_this25.shouldKeepCustomerBoundDiscountAfterCustomerChange(discount)) return true;
|
|
4021
|
+
return !_this25.isCustomerBoundDiscount(discount);
|
|
3997
4022
|
});
|
|
3998
4023
|
void ((_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, nextDiscounts));
|
|
3999
4024
|
void ((_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, nextOriginalDiscounts));
|
|
@@ -4157,10 +4182,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4157
4182
|
}, {
|
|
4158
4183
|
key: "setOrderPayments",
|
|
4159
4184
|
value: function setOrderPayments(payments) {
|
|
4160
|
-
var
|
|
4185
|
+
var _this26 = this;
|
|
4161
4186
|
var tempOrder = this.ensureTempOrder();
|
|
4162
4187
|
tempOrder.payments = mapPaymentItemsToOrderPayments((payments || []).map(function (payment) {
|
|
4163
|
-
return
|
|
4188
|
+
return _this26.normalizePaymentSource(payment, {
|
|
4164
4189
|
defaultPaid: false
|
|
4165
4190
|
});
|
|
4166
4191
|
}));
|
|
@@ -4215,7 +4240,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4215
4240
|
}, {
|
|
4216
4241
|
key: "addOrderPaymentWithDevicePrefix",
|
|
4217
4242
|
value: function addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
|
|
4218
|
-
var
|
|
4243
|
+
var _this27 = this;
|
|
4219
4244
|
this.logInfo('addOrderPayment', {
|
|
4220
4245
|
payment: payment
|
|
4221
4246
|
});
|
|
@@ -4233,7 +4258,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4233
4258
|
void this.recalculateSummary({
|
|
4234
4259
|
createIfMissing: true
|
|
4235
4260
|
}).catch(function (error) {
|
|
4236
|
-
|
|
4261
|
+
_this27.logError('recalculate summary after addOrderPayment failed', {
|
|
4237
4262
|
error: error instanceof Error ? error.message : String(error)
|
|
4238
4263
|
});
|
|
4239
4264
|
});
|
|
@@ -4346,7 +4371,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4346
4371
|
}, {
|
|
4347
4372
|
key: "applyPaymentLifecycleChange",
|
|
4348
4373
|
value: function applyPaymentLifecycleChange(tempOrder, options) {
|
|
4349
|
-
var
|
|
4374
|
+
var _this28 = this;
|
|
4350
4375
|
this.updateTempOrderPaymentStatus(tempOrder);
|
|
4351
4376
|
if ((options === null || options === void 0 ? void 0 : options.persist) !== false) {
|
|
4352
4377
|
this.persistTempOrder();
|
|
@@ -4356,7 +4381,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4356
4381
|
void this.recalculateSummary({
|
|
4357
4382
|
createIfMissing: true
|
|
4358
4383
|
}).catch(function (error) {
|
|
4359
|
-
|
|
4384
|
+
_this28.logError("recalculate summary after ".concat(logContext, " failed"), {
|
|
4360
4385
|
error: error instanceof Error ? error.message : String(error)
|
|
4361
4386
|
});
|
|
4362
4387
|
});
|
|
@@ -4400,7 +4425,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4400
4425
|
}, {
|
|
4401
4426
|
key: "updateVoucherOrderPayments",
|
|
4402
4427
|
value: function updateVoucherOrderPayments(payments, options) {
|
|
4403
|
-
var
|
|
4428
|
+
var _this29 = this;
|
|
4404
4429
|
var tempOrder = this.ensureTempOrder();
|
|
4405
4430
|
var isOrderPaymentType = function isOrderPaymentType(value) {
|
|
4406
4431
|
return value === 'normal' || value === 'deposit';
|
|
@@ -4435,7 +4460,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4435
4460
|
});
|
|
4436
4461
|
};
|
|
4437
4462
|
var mappedVouchers = mapPaymentItemsToOrderPayments(payments.map(function (payment) {
|
|
4438
|
-
return
|
|
4463
|
+
return _this29.normalizePaymentSource(normalizeVoucherPaymentStatus(withVoucherPaymentType(payment)), {
|
|
4439
4464
|
defaultPaid: false,
|
|
4440
4465
|
devicePrefix: options === null || options === void 0 ? void 0 : options.devicePrefix
|
|
4441
4466
|
});
|
|
@@ -4488,7 +4513,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4488
4513
|
void this.recalculateSummary({
|
|
4489
4514
|
createIfMissing: true
|
|
4490
4515
|
}).catch(function (error) {
|
|
4491
|
-
|
|
4516
|
+
_this29.logError('recalculate summary after updateVoucherOrderPayments failed', {
|
|
4492
4517
|
error: error instanceof Error ? error.message : String(error)
|
|
4493
4518
|
});
|
|
4494
4519
|
});
|
|
@@ -4546,7 +4571,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4546
4571
|
key: "shouldMergeProductToOrder",
|
|
4547
4572
|
value: function shouldMergeProductToOrder(params) {
|
|
4548
4573
|
var _this$orderHooks,
|
|
4549
|
-
|
|
4574
|
+
_this30 = this;
|
|
4550
4575
|
var onBeforeMergeProductToOrder = (_this$orderHooks = this.orderHooks) === null || _this$orderHooks === void 0 ? void 0 : _this$orderHooks.onBeforeMergeProductToOrder;
|
|
4551
4576
|
if (!onBeforeMergeProductToOrder) return true;
|
|
4552
4577
|
var result = onBeforeMergeProductToOrder(_objectSpread(_objectSpread({}, params), {}, {
|
|
@@ -4554,7 +4579,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4554
4579
|
}));
|
|
4555
4580
|
if (result && _typeof(result) === 'object' && typeof result.then === 'function') {
|
|
4556
4581
|
return Promise.resolve(result).then(function (resolved) {
|
|
4557
|
-
return
|
|
4582
|
+
return _this30.normalizeShouldMergeProductResult(resolved);
|
|
4558
4583
|
});
|
|
4559
4584
|
}
|
|
4560
4585
|
return this.normalizeShouldMergeProductResult(result);
|
|
@@ -4755,7 +4780,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4755
4780
|
_metadata,
|
|
4756
4781
|
_productToAdd$metadat,
|
|
4757
4782
|
_origin,
|
|
4758
|
-
|
|
4783
|
+
_this31 = this;
|
|
4759
4784
|
var linked = booking ? this.createLinkedProductAndBooking({
|
|
4760
4785
|
product: product,
|
|
4761
4786
|
booking: booking
|
|
@@ -4791,26 +4816,26 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4791
4816
|
var 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;
|
|
4792
4817
|
var shouldForceNewLine = disableMerge || !!booking || hasIncomingGoodPass || isIncomingPersistedEntitlementPass || hasIncomingBookingUid || isIncomingCustomItem || isWeighingProduct;
|
|
4793
4818
|
var matchedIndex = shouldForceNewLine ? -1 : tempOrder.products.findIndex(function (item) {
|
|
4794
|
-
if (
|
|
4795
|
-
var isRuntimeEntitlementPass =
|
|
4819
|
+
if (_this31.hasGoodPassDiscount(item)) return false;
|
|
4820
|
+
var isRuntimeEntitlementPass = _this31.isRuntimeEntitlementAppend(item, tempOrder);
|
|
4796
4821
|
if (isIncomingEntitlementAppend !== isRuntimeEntitlementPass) {
|
|
4797
4822
|
return false;
|
|
4798
4823
|
}
|
|
4799
|
-
if (isIncomingEntitlementAppend &&
|
|
4824
|
+
if (isIncomingEntitlementAppend && _this31.isPersistedProductLine(item)) {
|
|
4800
4825
|
return false;
|
|
4801
4826
|
}
|
|
4802
|
-
var hasExistingProductNote =
|
|
4827
|
+
var hasExistingProductNote = _this31.hasOrderProductLineNote(item);
|
|
4803
4828
|
if ((hasIncomingProductNote || hasExistingProductNote) && (!isRuntimeEntitlementPass || String(normalizedIncoming.note || '').trim() !== String(item.note || '').trim())) {
|
|
4804
4829
|
return false;
|
|
4805
4830
|
}
|
|
4806
4831
|
var hasExistingManualProductDiscount = isManualProductDiscountProduct(item);
|
|
4807
|
-
if (isRuntimeEntitlementPass && !
|
|
4832
|
+
if (isRuntimeEntitlementPass && !_this31.hasSameEntitlementMergePriceConfig(normalizedIncoming, item)) {
|
|
4808
4833
|
return false;
|
|
4809
4834
|
}
|
|
4810
4835
|
if ((hasIncomingManualProductDiscount || hasExistingManualProductDiscount) && !isRuntimeEntitlementPass) {
|
|
4811
4836
|
return false;
|
|
4812
4837
|
}
|
|
4813
|
-
if (
|
|
4838
|
+
if (_this31.isPersistedProductLine(item)) return false;
|
|
4814
4839
|
if (item.product_id !== productToAdd.product_id) return false;
|
|
4815
4840
|
if (item.product_variant_id !== productToAdd.product_variant_id) return false;
|
|
4816
4841
|
var existedFingerprint = buildProductLineFingerprint(getProductSkuOptions(item), item.product_bundle);
|
|
@@ -4821,7 +4846,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4821
4846
|
var commitProductLine = function commitProductLine(shouldMerge) {
|
|
4822
4847
|
var committedProduct;
|
|
4823
4848
|
if (matchedIndex === -1 || !matchedProduct || !shouldMerge) {
|
|
4824
|
-
|
|
4849
|
+
_this31.captureProductRuntime(tempOrder, productToAdd, normalizedIncoming);
|
|
4825
4850
|
if (linked) {
|
|
4826
4851
|
normalizedIncoming.booking_uid = linked.bookingUid;
|
|
4827
4852
|
normalizedIncoming.metadata = _objectSpread(_objectSpread({}, normalizedIncoming.metadata || {}), {}, {
|
|
@@ -4839,7 +4864,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4839
4864
|
var _targetProduct$metada;
|
|
4840
4865
|
var targetProduct = matchedProduct;
|
|
4841
4866
|
var targetUid = (_targetProduct$metada = targetProduct.metadata) === null || _targetProduct$metada === void 0 ? void 0 : _targetProduct$metada.unique_identification_number;
|
|
4842
|
-
var normalizedProduct =
|
|
4867
|
+
var normalizedProduct = _this31.normalizeVirtualSettlementProductIfEnabled(mergeOrderProductDisplayFields(targetProduct, normalizeOrderProduct(_objectSpread(_objectSpread({}, productToAdd), {}, {
|
|
4843
4868
|
metadata: _objectSpread(_objectSpread({}, productToAdd.metadata || {}), {}, {
|
|
4844
4869
|
unique_identification_number: targetUid
|
|
4845
4870
|
})
|
|
@@ -4862,7 +4887,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4862
4887
|
order_detail_id: targetProduct.order_detail_id,
|
|
4863
4888
|
num: nextNum
|
|
4864
4889
|
});
|
|
4865
|
-
|
|
4890
|
+
_this31.captureProductRuntime(tempOrder, productToAdd, tempOrder.products[matchedIndex], targetUid);
|
|
4866
4891
|
committedProduct = tempOrder.products[matchedIndex];
|
|
4867
4892
|
if (matchedIndex !== tempOrder.products.length - 1) {
|
|
4868
4893
|
var mergedProduct = tempOrder.products[matchedIndex];
|
|
@@ -4972,7 +4997,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4972
4997
|
key: "addProductToOrder",
|
|
4973
4998
|
value: (function () {
|
|
4974
4999
|
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(product, booking, options) {
|
|
4975
|
-
var
|
|
5000
|
+
var _this32 = this;
|
|
4976
5001
|
var tempOrder, salesNoteDrafts, mutationSnapshot, attachSalesNoteDrafts, rollbackProductAndNotesMutation, insertAfterProductUid, anchorIndex, insertAtIndex, _ref68, _productRecord$num, productRecord, splitCount, i, splitLine, committedProduct, _committedProduct, _committedProduct2;
|
|
4977
5002
|
return _regeneratorRuntime().wrap(function _callee23$(_context25) {
|
|
4978
5003
|
while (1) switch (_context25.prev = _context25.next) {
|
|
@@ -5001,7 +5026,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5001
5026
|
throw new Error('[Order Notes] 商品行缺少 unique_identification_number');
|
|
5002
5027
|
}
|
|
5003
5028
|
salesNoteDrafts.forEach(function (draft) {
|
|
5004
|
-
|
|
5029
|
+
_this32.setSalesNoteOnTempOrder(tempOrder, {
|
|
5005
5030
|
note_type: draft.note_type,
|
|
5006
5031
|
target: {
|
|
5007
5032
|
target_type: 'order_detail',
|
|
@@ -5281,7 +5306,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5281
5306
|
}, {
|
|
5282
5307
|
key: "hasSameEntitlementMergePriceConfig",
|
|
5283
5308
|
value: function hasSameEntitlementMergePriceConfig(incoming, existing) {
|
|
5284
|
-
var
|
|
5309
|
+
var _this33 = this;
|
|
5285
5310
|
var buildPriceConfig = function buildPriceConfig(product) {
|
|
5286
5311
|
var metadata = product.metadata || {};
|
|
5287
5312
|
var bundle = (product.product_bundle || []).map(function (item) {
|
|
@@ -5297,10 +5322,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5297
5322
|
return JSON.stringify(left).localeCompare(JSON.stringify(right));
|
|
5298
5323
|
});
|
|
5299
5324
|
return JSON.stringify({
|
|
5300
|
-
original_price:
|
|
5301
|
-
source_product_price:
|
|
5302
|
-
main_product_original_price:
|
|
5303
|
-
price_override:
|
|
5325
|
+
original_price: _this33.normalizeFingerprintMoney(product.original_price),
|
|
5326
|
+
source_product_price: _this33.normalizeFingerprintMoney(metadata.source_product_price),
|
|
5327
|
+
main_product_original_price: _this33.normalizeFingerprintMoney(metadata.main_product_original_price),
|
|
5328
|
+
price_override: _this33.normalizeFingerprintMoney(metadata.price_override),
|
|
5304
5329
|
is_manual_discount: Boolean(metadata.is_manual_discount),
|
|
5305
5330
|
bundle: bundle
|
|
5306
5331
|
});
|
|
@@ -5317,17 +5342,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5317
5342
|
}, {
|
|
5318
5343
|
key: "preservePersistedBundlePriceFields",
|
|
5319
5344
|
value: function preservePersistedBundlePriceFields(previousBundles, nextBundles) {
|
|
5320
|
-
var
|
|
5345
|
+
var _this34 = this;
|
|
5321
5346
|
if (!Array.isArray(nextBundles)) return nextBundles;
|
|
5322
5347
|
if (!Array.isArray(previousBundles) || previousBundles.length === 0) return nextBundles;
|
|
5323
5348
|
var previousByIdentity = new Map();
|
|
5324
5349
|
previousBundles.forEach(function (bundle) {
|
|
5325
|
-
var identity =
|
|
5350
|
+
var identity = _this34.getBundleRuntimeIdentity(bundle);
|
|
5326
5351
|
if (identity) previousByIdentity.set(identity, bundle);
|
|
5327
5352
|
});
|
|
5328
5353
|
return nextBundles.map(function (bundle, index) {
|
|
5329
5354
|
if (!bundle || _typeof(bundle) !== 'object') return bundle;
|
|
5330
|
-
var previous = previousByIdentity.get(
|
|
5355
|
+
var previous = previousByIdentity.get(_this34.getBundleRuntimeIdentity(bundle)) || previousBundles[index];
|
|
5331
5356
|
if (!previous || _typeof(previous) !== 'object') return bundle;
|
|
5332
5357
|
return _objectSpread(_objectSpread(_objectSpread({}, bundle), (bundle.cover === undefined || bundle.cover === null || bundle.cover === '') && previous.cover !== undefined && previous.cover !== null && previous.cover !== '' ? {
|
|
5333
5358
|
cover: previous.cover
|
|
@@ -5569,7 +5594,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5569
5594
|
key: "updateOrderProducts",
|
|
5570
5595
|
value: function () {
|
|
5571
5596
|
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(paramsList) {
|
|
5572
|
-
var
|
|
5597
|
+
var _this35 = this;
|
|
5573
5598
|
var tempOrder, reapplyBookingDiscountProductUids;
|
|
5574
5599
|
return _regeneratorRuntime().wrap(function _callee26$(_context28) {
|
|
5575
5600
|
while (1) switch (_context28.prev = _context28.next) {
|
|
@@ -5582,7 +5607,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5582
5607
|
return _context28.abrupt("return", tempOrder.products);
|
|
5583
5608
|
case 3:
|
|
5584
5609
|
reapplyBookingDiscountProductUids = paramsList.reduce(function (acc, params) {
|
|
5585
|
-
var updatedProductUid =
|
|
5610
|
+
var updatedProductUid = _this35.applyOrderProductUpdateToTempOrder(tempOrder, params);
|
|
5586
5611
|
// 批量改预约时间时,延迟到最后一次折扣计算里统一恢复已选预约折扣卡。
|
|
5587
5612
|
if (params.allow_booking_discount_reapply && updatedProductUid) {
|
|
5588
5613
|
acc.push(String(updatedProductUid));
|
|
@@ -5809,7 +5834,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5809
5834
|
key: "removeProductsFromOrder",
|
|
5810
5835
|
value: (function () {
|
|
5811
5836
|
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(identities, options) {
|
|
5812
|
-
var
|
|
5837
|
+
var _this36 = this;
|
|
5813
5838
|
var tempOrder, productsBeforeRemove, bookingsBeforeRemove, preserveDisplayPosition, anchorIndex, productsAfterAnchor, matchedProducts, removedProducts, _i2, _removedProducts, product, linkedBookingUidsToRemove, _iterator21, _step21, _loop3, remainingProductIndex, remainingProduct, nextProduct, productsWithoutRemaining, nextProductIndex;
|
|
5814
5839
|
return _regeneratorRuntime().wrap(function _callee29$(_context32) {
|
|
5815
5840
|
while (1) switch (_context32.prev = _context32.next) {
|
|
@@ -5874,7 +5899,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5874
5899
|
}
|
|
5875
5900
|
if (productUid !== undefined && productUid !== null && productUid !== '') {
|
|
5876
5901
|
bookingsBeforeRemove.forEach(function (booking) {
|
|
5877
|
-
var bookingUid =
|
|
5902
|
+
var bookingUid = _this36.getBookingUniqueIdentificationNumber(booking);
|
|
5878
5903
|
if (bookingUid && String((booking === null || booking === void 0 ? void 0 : booking.product_uid) || '') === String(productUid)) {
|
|
5879
5904
|
linkedBookingUidsToRemove.add(bookingUid);
|
|
5880
5905
|
}
|
|
@@ -6506,10 +6531,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6506
6531
|
value: function extractSubmitErrorResponse(error) {
|
|
6507
6532
|
var _error$response,
|
|
6508
6533
|
_error$response2,
|
|
6509
|
-
|
|
6534
|
+
_this37 = this;
|
|
6510
6535
|
var candidates = [error === null || error === void 0 || (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data, error === null || error === void 0 ? void 0 : error.data, error === null || error === void 0 || (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.body, error === null || error === void 0 ? void 0 : error.body];
|
|
6511
6536
|
return candidates.find(function (candidate) {
|
|
6512
|
-
return
|
|
6537
|
+
return _this37.isSubmitErrorResponse(candidate);
|
|
6513
6538
|
}) || null;
|
|
6514
6539
|
}
|
|
6515
6540
|
}, {
|
|
@@ -6537,7 +6562,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6537
6562
|
key: "syncPaymentsToOrder",
|
|
6538
6563
|
value: function () {
|
|
6539
6564
|
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
|
|
6540
|
-
var
|
|
6565
|
+
var _this38 = this,
|
|
6541
6566
|
_params$confirmPendin;
|
|
6542
6567
|
var tempOrder, needsPaymentNumber, devicePrefix, mappedPayments, shouldConfirmPendingVoucherPayments, effectivePayments, completion, orderPaidPaymentTotal, paymentStatus, paymentSyncIdempotencyToken, enhancePayload, submitParams, submitResult;
|
|
6543
6568
|
return _regeneratorRuntime().wrap(function _callee39$(_context42) {
|
|
@@ -6562,7 +6587,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6562
6587
|
case 9:
|
|
6563
6588
|
devicePrefix = _context42.t0;
|
|
6564
6589
|
mappedPayments = mapPaymentItemsToOrderPayments((params.payments || []).map(function (payment) {
|
|
6565
|
-
return
|
|
6590
|
+
return _this38.normalizePaymentSource(payment, {
|
|
6566
6591
|
defaultPaid: false,
|
|
6567
6592
|
devicePrefix: devicePrefix
|
|
6568
6593
|
});
|
|
@@ -6641,7 +6666,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6641
6666
|
}, {
|
|
6642
6667
|
key: "createOrder",
|
|
6643
6668
|
value: function createOrder(params) {
|
|
6644
|
-
var
|
|
6669
|
+
var _this39 = this;
|
|
6645
6670
|
var order = _objectSpread({
|
|
6646
6671
|
type: (params === null || params === void 0 ? void 0 : params.type) || 'appointment_booking',
|
|
6647
6672
|
// 要从外面拿,virtual
|
|
@@ -6673,7 +6698,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6673
6698
|
|
|
6674
6699
|
// 为预约补齐 holder 信息
|
|
6675
6700
|
if (params !== null && params !== void 0 && (_params$extraData = params.extraData) !== null && _params$extraData !== void 0 && _params$extraData.is_add_holder_info) {
|
|
6676
|
-
ensureCartItemOriginHolder(item,
|
|
6701
|
+
ensureCartItemOriginHolder(item, _this39.window);
|
|
6677
6702
|
}
|
|
6678
6703
|
|
|
6679
6704
|
// 购物车是否为普通商品
|
|
@@ -7376,7 +7401,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
7376
7401
|
}, {
|
|
7377
7402
|
key: "normalizeTempOrderForRuntime",
|
|
7378
7403
|
value: function normalizeTempOrderForRuntime(raw, options) {
|
|
7379
|
-
var
|
|
7404
|
+
var _this40 = this,
|
|
7380
7405
|
_raw$_extend;
|
|
7381
7406
|
var runtimeRaw = this.withoutSyntheticDraftOrderIdForRuntime(raw);
|
|
7382
7407
|
var nextTempOrder = _objectSpread(_objectSpread({}, this.createDefaultTempOrderInstance()), runtimeRaw || {});
|
|
@@ -7401,12 +7426,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
7401
7426
|
nextTempOrder.holder = raw.holder && _typeof(raw.holder) === 'object' ? _objectSpread({}, raw.holder) : null;
|
|
7402
7427
|
var rawProducts = Array.isArray(raw.products) ? raw.products : [];
|
|
7403
7428
|
nextTempOrder.products = rawProducts.length > 0 ? rawProducts.map(function (p) {
|
|
7404
|
-
return
|
|
7429
|
+
return _this40.normalizeHydratedOrderProduct(p, {
|
|
7405
7430
|
makeEditMark: options === null || options === void 0 ? void 0 : options.makeEditMark
|
|
7406
7431
|
});
|
|
7407
7432
|
}) : [];
|
|
7408
7433
|
nextTempOrder.bookings = Array.isArray(raw.bookings) ? raw.bookings.map(function (b) {
|
|
7409
|
-
var booking =
|
|
7434
|
+
var booking = _this40.normalizeHydratedBookingHolder(b || {});
|
|
7410
7435
|
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
7411
7436
|
is_all: normalizeBookingIsAll(booking),
|
|
7412
7437
|
sub_type: normalizeBookingSubType(booking)
|
|
@@ -7613,7 +7638,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
7613
7638
|
}, {
|
|
7614
7639
|
key: "normalizeHydratedOrderProduct",
|
|
7615
7640
|
value: function normalizeHydratedOrderProduct(product, options) {
|
|
7616
|
-
var
|
|
7641
|
+
var _this41 = this;
|
|
7617
7642
|
var row = _objectSpread({}, product || {});
|
|
7618
7643
|
if (row.num === undefined && row.product_quantity !== undefined) {
|
|
7619
7644
|
row.num = row.product_quantity;
|
|
@@ -7621,7 +7646,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
7621
7646
|
var productSku = ensureProductSku(row);
|
|
7622
7647
|
row.product_sku = _objectSpread(_objectSpread({}, productSku), {}, {
|
|
7623
7648
|
option: normalizeProductSkuOptions(productSku.option.map(function (optionItem) {
|
|
7624
|
-
return
|
|
7649
|
+
return _this41.normalizeHydratedProductOptionItem(optionItem || {});
|
|
7625
7650
|
}))
|
|
7626
7651
|
});
|
|
7627
7652
|
delete row["product_".concat('option', "_item")];
|