@pisell/pisellos 2.2.186 → 2.2.188
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +11 -4
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +11 -4
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
- package/dist/modules/Order/index.d.ts +4 -0
- package/dist/modules/Order/index.js +150 -50
- package/dist/modules/Rules/index.js +32 -21
- package/dist/solution/BaseSales/index.d.ts +1 -0
- package/dist/solution/BaseSales/index.js +45 -30
- package/dist/solution/BaseSales/utils/cartPromotion.js +31 -11
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +18 -4
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +4 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +56 -0
- package/lib/modules/Order/index.d.ts +4 -0
- package/lib/modules/Order/index.js +97 -13
- package/lib/modules/Rules/index.js +88 -78
- package/lib/solution/BaseSales/index.d.ts +1 -0
- package/lib/solution/BaseSales/index.js +16 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +22 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +19 -2
- package/package.json +1 -1
|
@@ -314,7 +314,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
314
314
|
}, {
|
|
315
315
|
key: "calcDiscount",
|
|
316
316
|
value: function calcDiscount(_ref2, options) {
|
|
317
|
-
var
|
|
317
|
+
var _options$selectedList,
|
|
318
|
+
_this3 = this;
|
|
318
319
|
var discountList = _ref2.discountList,
|
|
319
320
|
productList = _ref2.productList,
|
|
320
321
|
holders = _ref2.holders,
|
|
@@ -360,6 +361,13 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
360
361
|
var filteredDiscountList = addModeDiscount.filter(function (discount) {
|
|
361
362
|
return !discount.isManualSelect;
|
|
362
363
|
});
|
|
364
|
+
var hasDiscountInput = editModeDiscount.length > 0 || addModeDiscount.length > 0 || Boolean(options === null || options === void 0 ? void 0 : options.discountId) || Boolean(options === null || options === void 0 || (_options$selectedList = options.selectedList) === null || _options$selectedList === void 0 ? void 0 : _options$selectedList.length) || Boolean(options === null || options === void 0 ? void 0 : options.scan);
|
|
365
|
+
if (!hasDiscountInput) {
|
|
366
|
+
return {
|
|
367
|
+
discountList: discountList,
|
|
368
|
+
productList: productList
|
|
369
|
+
};
|
|
370
|
+
}
|
|
363
371
|
|
|
364
372
|
// 🔥 扁平化商品列表:将 bundle 子商品展开为虚拟商品
|
|
365
373
|
var flattenProductsWithBundle = function flattenProductsWithBundle(productList) {
|
|
@@ -1177,8 +1185,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1177
1185
|
var _product$discount_lis9;
|
|
1178
1186
|
// 主商品:检查自己的 discount_list
|
|
1179
1187
|
if (flatItem.type === 'main' && (_product$discount_lis9 = product.discount_list) !== null && _product$discount_lis9 !== void 0 && _product$discount_lis9.some(function (item) {
|
|
1180
|
-
var _options$
|
|
1181
|
-
return options === null || options === void 0 || (_options$
|
|
1188
|
+
var _options$selectedList2;
|
|
1189
|
+
return options === null || options === void 0 || (_options$selectedList2 = options.selectedList) === null || _options$selectedList2 === void 0 ? void 0 : _options$selectedList2.some(function (n) {
|
|
1182
1190
|
var _item$discount4;
|
|
1183
1191
|
return n.discountId === ((_item$discount4 = item.discount) === null || _item$discount4 === void 0 ? void 0 : _item$discount4.resource_id);
|
|
1184
1192
|
});
|
|
@@ -1189,14 +1197,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1189
1197
|
if (flatItem.type === 'bundle') {
|
|
1190
1198
|
var _product$discount_lis10, _flatItem$parentProdu8;
|
|
1191
1199
|
if ((_product$discount_lis10 = product.discount_list) !== null && _product$discount_lis10 !== void 0 && _product$discount_lis10.some(function (item) {
|
|
1192
|
-
var _options$
|
|
1193
|
-
return options === null || options === void 0 || (_options$
|
|
1200
|
+
var _options$selectedList3;
|
|
1201
|
+
return options === null || options === void 0 || (_options$selectedList3 = options.selectedList) === null || _options$selectedList3 === void 0 ? void 0 : _options$selectedList3.some(function (n) {
|
|
1194
1202
|
var _item$discount5;
|
|
1195
1203
|
return n.discountId === ((_item$discount5 = item.discount) === null || _item$discount5 === void 0 ? void 0 : _item$discount5.resource_id);
|
|
1196
1204
|
});
|
|
1197
1205
|
}) || (_flatItem$parentProdu8 = flatItem.parentProduct) !== null && _flatItem$parentProdu8 !== void 0 && (_flatItem$parentProdu8 = _flatItem$parentProdu8.discount_list) !== null && _flatItem$parentProdu8 !== void 0 && _flatItem$parentProdu8.some(function (item) {
|
|
1198
|
-
var _options$
|
|
1199
|
-
return options === null || options === void 0 || (_options$
|
|
1206
|
+
var _options$selectedList4;
|
|
1207
|
+
return options === null || options === void 0 || (_options$selectedList4 = options.selectedList) === null || _options$selectedList4 === void 0 ? void 0 : _options$selectedList4.some(function (n) {
|
|
1200
1208
|
var _item$discount6;
|
|
1201
1209
|
return n.discountId === ((_item$discount6 = item.discount) === null || _item$discount6 === void 0 ? void 0 : _item$discount6.resource_id);
|
|
1202
1210
|
});
|
|
@@ -1871,7 +1879,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1871
1879
|
} else {
|
|
1872
1880
|
// 🔥 没有子商品被拆分,使用原有逻辑
|
|
1873
1881
|
mainProductArr.forEach(function (mainProduct) {
|
|
1874
|
-
var
|
|
1882
|
+
var _ref15, _mainProductData$main, _mainProductData$disc, _mainProductData$disc2, _mainProductData$disc3;
|
|
1875
1883
|
var mainProductData = _this3.hooks.getProduct(mainProduct);
|
|
1876
1884
|
|
|
1877
1885
|
// 重组bundle
|
|
@@ -1886,6 +1894,9 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1886
1894
|
} else {
|
|
1887
1895
|
// 🔥 关键:拆分后的bundle item
|
|
1888
1896
|
processedBundleItems.forEach(function (item) {
|
|
1897
|
+
var _item$price, _ref14, _item$bundle_selling_;
|
|
1898
|
+
var nextBundlePrice = (_item$price = item.price) !== null && _item$price !== void 0 ? _item$price : bundleItem.price;
|
|
1899
|
+
var nextBundleSellingPrice = (_ref14 = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref14 !== void 0 ? _ref14 : bundleItem.bundle_selling_price;
|
|
1889
1900
|
// 🔥 更新 discount_list 中的 num,使其与拆分后的 item.num 一致
|
|
1890
1901
|
var updatedDiscountList = (item.discount_list || []).map(function (discount) {
|
|
1891
1902
|
var _discount$metadata10;
|
|
@@ -1900,10 +1911,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1900
1911
|
newBundle.push(_objectSpread(_objectSpread({}, bundleItem), {}, {
|
|
1901
1912
|
_id: item._id,
|
|
1902
1913
|
product_id: bundleItem.product_id,
|
|
1903
|
-
price:
|
|
1914
|
+
price: nextBundlePrice,
|
|
1904
1915
|
num: item.num,
|
|
1905
1916
|
discount_list: updatedDiscountList,
|
|
1906
|
-
bundle_selling_price: bundleItem.bundle_selling_price !== undefined ?
|
|
1917
|
+
bundle_selling_price: bundleItem.bundle_selling_price !== undefined ? nextBundleSellingPrice : undefined
|
|
1907
1918
|
}));
|
|
1908
1919
|
});
|
|
1909
1920
|
}
|
|
@@ -1912,7 +1923,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1912
1923
|
|
|
1913
1924
|
// 主商品已经在前面的 setProduct 中应用过折扣;这里只替换 bundle,
|
|
1914
1925
|
// 避免把主商品 discount_list 再扣一次。
|
|
1915
|
-
var mainSellingPrice = (
|
|
1926
|
+
var mainSellingPrice = (_ref15 = (_mainProductData$main = mainProductData.main_product_selling_price) !== null && _mainProductData$main !== void 0 ? _mainProductData$main : mainProductData.price) !== null && _ref15 !== void 0 ? _ref15 : 0;
|
|
1916
1927
|
var newTotal = Number(mainSellingPrice || 0);
|
|
1917
1928
|
var newOriginTotal = Number(mainProductData.original_price || mainProductData.price || 0);
|
|
1918
1929
|
|
|
@@ -1930,8 +1941,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1930
1941
|
// 累加 bundle 的折后价格(只累加一次)
|
|
1931
1942
|
if (newBundle.length > 0) {
|
|
1932
1943
|
newBundle.forEach(function (item) {
|
|
1933
|
-
var _item$
|
|
1934
|
-
var bundleSellingPrice = (_item$
|
|
1944
|
+
var _item$bundle_selling_2;
|
|
1945
|
+
var bundleSellingPrice = (_item$bundle_selling_2 = item.bundle_selling_price) !== null && _item$bundle_selling_2 !== void 0 ? _item$bundle_selling_2 : item.price;
|
|
1935
1946
|
newTotal += Number(bundleSellingPrice) * Number(item.num);
|
|
1936
1947
|
});
|
|
1937
1948
|
|
|
@@ -2060,14 +2071,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2060
2071
|
var ruleType = usageRules.type;
|
|
2061
2072
|
// 套餐适用范围配置
|
|
2062
2073
|
var packageScope = usageRules === null || usageRules === void 0 ? void 0 : usageRules.package_scope;
|
|
2063
|
-
var
|
|
2064
|
-
scopeType =
|
|
2065
|
-
|
|
2066
|
-
exclude_bundle_product_ids =
|
|
2067
|
-
|
|
2068
|
-
include_bundle_product_ids =
|
|
2069
|
-
|
|
2070
|
-
filter =
|
|
2074
|
+
var _ref16 = packageScope || {},
|
|
2075
|
+
scopeType = _ref16.type,
|
|
2076
|
+
_ref16$exclude_bundle = _ref16.exclude_bundle_product_ids,
|
|
2077
|
+
exclude_bundle_product_ids = _ref16$exclude_bundle === void 0 ? [] : _ref16$exclude_bundle,
|
|
2078
|
+
_ref16$include_bundle = _ref16.include_bundle_product_ids,
|
|
2079
|
+
include_bundle_product_ids = _ref16$include_bundle === void 0 ? [] : _ref16$include_bundle,
|
|
2080
|
+
_ref16$filter = _ref16.filter,
|
|
2081
|
+
filter = _ref16$filter === void 0 ? 0 : _ref16$filter;
|
|
2071
2082
|
var isMainProduct = flatItem.type === 'main'; // 单独购买
|
|
2072
2083
|
var isBundleItem = flatItem.type === 'bundle'; // 套餐中购买
|
|
2073
2084
|
|
|
@@ -180,6 +180,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
180
180
|
smallTicketDataFlag?: number;
|
|
181
181
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
182
182
|
}): Promise<T>;
|
|
183
|
+
private getSubmitPaymentStatus;
|
|
183
184
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
184
185
|
/** 读取当前 BaseSales 订单上下文中的 Sales 协议支付项。 */
|
|
185
186
|
getOrderPayments(): OrderPaymentData[];
|
|
@@ -607,7 +607,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
607
607
|
};
|
|
608
608
|
externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
|
|
609
609
|
if (params.forceRemote) {
|
|
610
|
-
_context5.next =
|
|
610
|
+
_context5.next = 36;
|
|
611
611
|
break;
|
|
612
612
|
}
|
|
613
613
|
if (!(params.orderId !== undefined)) {
|
|
@@ -650,58 +650,59 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
650
650
|
_context5.t0 = _context5.t1;
|
|
651
651
|
case 26:
|
|
652
652
|
localRecord = _context5.t0;
|
|
653
|
+
debugger;
|
|
653
654
|
if (!localRecord) {
|
|
654
|
-
_context5.next =
|
|
655
|
+
_context5.next = 36;
|
|
655
656
|
break;
|
|
656
657
|
}
|
|
657
|
-
_context5.next =
|
|
658
|
+
_context5.next = 31;
|
|
658
659
|
return this.store.order.hydrateTempOrderFromRecord(localRecord, {
|
|
659
660
|
recalcOnHydrate: false
|
|
660
661
|
});
|
|
661
|
-
case
|
|
662
|
+
case 31:
|
|
662
663
|
_sales = _context5.sent;
|
|
663
664
|
this.currentSalesDetail = _sales;
|
|
664
|
-
_context5.next =
|
|
665
|
+
_context5.next = 35;
|
|
665
666
|
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
666
667
|
sales: _sales
|
|
667
668
|
});
|
|
668
|
-
case 34:
|
|
669
|
-
return _context5.abrupt("return", _sales);
|
|
670
669
|
case 35:
|
|
670
|
+
return _context5.abrupt("return", _sales);
|
|
671
|
+
case 36:
|
|
671
672
|
if (!(params.orderId === undefined || params.orderId === null)) {
|
|
672
|
-
_context5.next =
|
|
673
|
+
_context5.next = 38;
|
|
673
674
|
break;
|
|
674
675
|
}
|
|
675
676
|
throw new Error('加载销售详情需要 orderId,或本地库中存在对应 externalSaleNumber/orderNumber');
|
|
676
|
-
case
|
|
677
|
-
_context5.next =
|
|
677
|
+
case 38:
|
|
678
|
+
_context5.next = 40;
|
|
678
679
|
return this.store.order.getOrderInfoByRemote(Number(params.orderId));
|
|
679
|
-
case
|
|
680
|
+
case 40:
|
|
680
681
|
res = _context5.sent;
|
|
681
682
|
if (!(!res || res.code !== 200)) {
|
|
682
|
-
_context5.next =
|
|
683
|
+
_context5.next = 44;
|
|
683
684
|
break;
|
|
684
685
|
}
|
|
685
686
|
message = res && (res.message || res.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(params.orderId);
|
|
686
687
|
throw new Error(message);
|
|
687
|
-
case
|
|
688
|
-
_context5.next =
|
|
688
|
+
case 44:
|
|
689
|
+
_context5.next = 46;
|
|
689
690
|
return this.store.order.hydrateTempOrderFromRecord(res.data, {
|
|
690
691
|
recalcOnHydrate: false
|
|
691
692
|
});
|
|
692
|
-
case
|
|
693
|
+
case 46:
|
|
693
694
|
sales = _context5.sent;
|
|
694
|
-
_context5.next =
|
|
695
|
+
_context5.next = 49;
|
|
695
696
|
return this.store.order.saveDraft();
|
|
696
|
-
case
|
|
697
|
+
case 49:
|
|
697
698
|
this.currentSalesDetail = sales;
|
|
698
|
-
_context5.next =
|
|
699
|
+
_context5.next = 52;
|
|
699
700
|
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
700
701
|
sales: sales
|
|
701
702
|
});
|
|
702
|
-
case 51:
|
|
703
|
-
return _context5.abrupt("return", sales);
|
|
704
703
|
case 52:
|
|
704
|
+
return _context5.abrupt("return", sales);
|
|
705
|
+
case 53:
|
|
705
706
|
case "end":
|
|
706
707
|
return _context5.stop();
|
|
707
708
|
}
|
|
@@ -1790,7 +1791,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1790
1791
|
value: (function () {
|
|
1791
1792
|
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
|
|
1792
1793
|
var _this$otherParams6, _this$otherParams7, _this$otherParams8;
|
|
1793
|
-
var submitParams;
|
|
1794
|
+
var inferredPaymentStatus, submitParams;
|
|
1794
1795
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1795
1796
|
while (1) switch (_context18.prev = _context18.next) {
|
|
1796
1797
|
case 0:
|
|
@@ -1801,6 +1802,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1801
1802
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
1802
1803
|
case 2:
|
|
1803
1804
|
this.store.order.persistTempOrder();
|
|
1805
|
+
inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
1804
1806
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
1805
1807
|
cacheId: this.cacheId,
|
|
1806
1808
|
platform: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.platform,
|
|
@@ -1809,8 +1811,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1809
1811
|
type: (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.type
|
|
1810
1812
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
1811
1813
|
payments: params.payments
|
|
1812
|
-
} : {}),
|
|
1813
|
-
paymentStatus:
|
|
1814
|
+
} : {}), inferredPaymentStatus !== undefined ? {
|
|
1815
|
+
paymentStatus: inferredPaymentStatus
|
|
1814
1816
|
} : {}), (params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== undefined ? {
|
|
1815
1817
|
smallTicketDataFlag: params.smallTicketDataFlag
|
|
1816
1818
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
@@ -1818,7 +1820,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1818
1820
|
} : {});
|
|
1819
1821
|
console.log(submitParams, 'submitParams123');
|
|
1820
1822
|
return _context18.abrupt("return", this.store.order.submitTempOrder(submitParams));
|
|
1821
|
-
case
|
|
1823
|
+
case 7:
|
|
1822
1824
|
case "end":
|
|
1823
1825
|
return _context18.stop();
|
|
1824
1826
|
}
|
|
@@ -1829,6 +1831,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1829
1831
|
}
|
|
1830
1832
|
return submitSalesOrder;
|
|
1831
1833
|
}())
|
|
1834
|
+
}, {
|
|
1835
|
+
key: "getSubmitPaymentStatus",
|
|
1836
|
+
value: function getSubmitPaymentStatus(paymentStatus) {
|
|
1837
|
+
var _this$store$order3, _this$store$order3$ge;
|
|
1838
|
+
if (paymentStatus !== undefined) return paymentStatus;
|
|
1839
|
+
var amountSnapshot = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getOrderAmountSnapshot) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3);
|
|
1840
|
+
if (!amountSnapshot) return undefined;
|
|
1841
|
+
try {
|
|
1842
|
+
return new Decimal(amountSnapshot.amountGap || 0).lte(0) ? 'paid' : undefined;
|
|
1843
|
+
} catch (_unused2) {
|
|
1844
|
+
return undefined;
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1832
1847
|
}, {
|
|
1833
1848
|
key: "syncPaymentsToOrder",
|
|
1834
1849
|
value: function () {
|
|
@@ -1978,8 +1993,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1978
1993
|
}, {
|
|
1979
1994
|
key: "getWalletProductList",
|
|
1980
1995
|
value: function getWalletProductList() {
|
|
1981
|
-
var _this$store$
|
|
1982
|
-
var tempOrder = (_this$store$
|
|
1996
|
+
var _this$store$order4, _tempOrder$products, _tempOrder$products2;
|
|
1997
|
+
var tempOrder = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder();
|
|
1983
1998
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return [];
|
|
1984
1999
|
// 过滤出有 product_id的商品来,如果没有代表他是自定义商品,不需要参与 wallet
|
|
1985
2000
|
var products = tempOrder === null || tempOrder === void 0 || (_tempOrder$products2 = tempOrder.products) === null || _tempOrder$products2 === void 0 ? void 0 : _tempOrder$products2.filter(function (n) {
|
|
@@ -2555,16 +2570,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2555
2570
|
}, {
|
|
2556
2571
|
key: "getUnfulfilledPromotions",
|
|
2557
2572
|
value: function getUnfulfilledPromotions() {
|
|
2558
|
-
var _this$store$
|
|
2559
|
-
return ((_this$store$
|
|
2573
|
+
var _this$store$order5;
|
|
2574
|
+
return ((_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getUnfulfilledPromotions()) || [];
|
|
2560
2575
|
}
|
|
2561
2576
|
|
|
2562
2577
|
/** 最近一次促销计算输出的赠品操作 diff。 */
|
|
2563
2578
|
}, {
|
|
2564
2579
|
key: "getLastGiftActions",
|
|
2565
2580
|
value: function getLastGiftActions() {
|
|
2566
|
-
var _this$store$
|
|
2567
|
-
return ((_this$store$
|
|
2581
|
+
var _this$store$order6;
|
|
2582
|
+
return ((_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getLastGiftActions()) || null;
|
|
2568
2583
|
}
|
|
2569
2584
|
|
|
2570
2585
|
// 获取商品列表
|
|
@@ -230,7 +230,7 @@ export function mergeIdenticalPromotionCartLines(products) {
|
|
|
230
230
|
_step;
|
|
231
231
|
try {
|
|
232
232
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
233
|
-
var _line$metadata, _ref2, _line$metadata$source, _line$metadata2, _ref3, _promotion$finalPrice, _line$metadata3, _line$booking_uid, _line$metadata4, _line$product_variant;
|
|
233
|
+
var _line$metadata, _ref2, _line$metadata$source, _line$metadata2, _ref3, _promotion$finalPrice, _line$metadata3, _line$booking_uid, _line$metadata4, _line$order_detail_id, _line$product_variant;
|
|
234
234
|
var line = _step.value;
|
|
235
235
|
if (getGiftInfo(line)) {
|
|
236
236
|
merged.push(line);
|
|
@@ -245,7 +245,8 @@ export function mergeIdenticalPromotionCartLines(products) {
|
|
|
245
245
|
var unitPrice = String((_ref2 = (_line$metadata$source = (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.source_product_price) !== null && _line$metadata$source !== void 0 ? _line$metadata$source : line.selling_price) !== null && _ref2 !== void 0 ? _ref2 : '');
|
|
246
246
|
var promoUnitPrice = String((_ref3 = (_promotion$finalPrice = promotion.finalPrice) !== null && _promotion$finalPrice !== void 0 ? _promotion$finalPrice : (_line$metadata3 = line.metadata) === null || _line$metadata3 === void 0 ? void 0 : _line$metadata3.main_product_selling_price) !== null && _ref3 !== void 0 ? _ref3 : '');
|
|
247
247
|
var bookingUid = (_line$booking_uid = line === null || line === void 0 ? void 0 : line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : line === null || line === void 0 || (_line$metadata4 = line.metadata) === null || _line$metadata4 === void 0 ? void 0 : _line$metadata4.booking_uid;
|
|
248
|
-
var
|
|
248
|
+
var orderDetailId = (_line$order_detail_id = line === null || line === void 0 ? void 0 : line.order_detail_id) !== null && _line$order_detail_id !== void 0 ? _line$order_detail_id : line === null || line === void 0 ? void 0 : line.orderDetailId;
|
|
249
|
+
var mergeKey = [line.product_id, (_line$product_variant = line.product_variant_id) !== null && _line$product_variant !== void 0 ? _line$product_variant : 0, fingerprint, bookingUid ? String(bookingUid) : '', orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '' ? String(orderDetailId) : '', promotion.strategyId, unitPrice, promoUnitPrice].join('#');
|
|
249
250
|
var hitIndex = indexByKey.get(mergeKey);
|
|
250
251
|
if (hitIndex === undefined) {
|
|
251
252
|
indexByKey.set(mergeKey, merged.length);
|
|
@@ -413,6 +414,15 @@ function getGiftInfo(product) {
|
|
|
413
414
|
var _product$metadata2;
|
|
414
415
|
return (product === null || product === void 0 || (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2._giftInfo) || (product === null || product === void 0 ? void 0 : product._giftInfo) || null;
|
|
415
416
|
}
|
|
417
|
+
function isPersistedGeneratedVoucher(product) {
|
|
418
|
+
var _product$order_detail;
|
|
419
|
+
var orderDetailId = (_product$order_detail = product === null || product === void 0 ? void 0 : product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : product === null || product === void 0 ? void 0 : product.orderDetailId;
|
|
420
|
+
if (orderDetailId === undefined || orderDetailId === null || orderDetailId === '') {
|
|
421
|
+
return false;
|
|
422
|
+
}
|
|
423
|
+
var metadata = (product === null || product === void 0 ? void 0 : product.metadata) || {};
|
|
424
|
+
return (product === null || product === void 0 ? void 0 : product.extension_type) === 'product_voucher' || metadata.parent_order_detail_id !== undefined || metadata.gift_card_type !== undefined;
|
|
425
|
+
}
|
|
416
426
|
function getProductBundleForEvaluator(product) {
|
|
417
427
|
var bundles = Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle) ? product.product_bundle : [];
|
|
418
428
|
return bundles.map(function (b) {
|
|
@@ -441,14 +451,19 @@ function getProductBundleForEvaluator(product) {
|
|
|
441
451
|
* // => 单行 num=4,清除 _promotion 后重新评估
|
|
442
452
|
*/
|
|
443
453
|
export function buildConsolidateKeyForPromotion(item) {
|
|
444
|
-
var _item$booking_uid, _item$metadata, _item$
|
|
454
|
+
var _item$booking_uid, _item$metadata, _item$order_detail_id, _item$product_variant3;
|
|
445
455
|
var fingerprint = buildProductLineFingerprint(item.product_option_item, item.product_bundle);
|
|
446
456
|
var bookingUid = (_item$booking_uid = item === null || item === void 0 ? void 0 : item.booking_uid) !== null && _item$booking_uid !== void 0 ? _item$booking_uid : item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.booking_uid;
|
|
447
|
-
|
|
457
|
+
var orderDetailId = (_item$order_detail_id = item === null || item === void 0 ? void 0 : item.order_detail_id) !== null && _item$order_detail_id !== void 0 ? _item$order_detail_id : item === null || item === void 0 ? void 0 : item.orderDetailId;
|
|
458
|
+
if (orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '') {
|
|
448
459
|
var _item$product_variant;
|
|
449
|
-
return [item.product_id, (_item$product_variant = item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0, fingerprint, String(
|
|
460
|
+
return [item.product_id, (_item$product_variant = item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0, fingerprint, String(orderDetailId)].join('#');
|
|
461
|
+
}
|
|
462
|
+
if (bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '') {
|
|
463
|
+
var _item$product_variant2;
|
|
464
|
+
return [item.product_id, (_item$product_variant2 = item.product_variant_id) !== null && _item$product_variant2 !== void 0 ? _item$product_variant2 : 0, fingerprint, String(bookingUid)].join('#');
|
|
450
465
|
}
|
|
451
|
-
return [item.product_id, (_item$
|
|
466
|
+
return [item.product_id, (_item$product_variant3 = item.product_variant_id) !== null && _item$product_variant3 !== void 0 ? _item$product_variant3 : 0, fingerprint].join('#');
|
|
452
467
|
}
|
|
453
468
|
function consolidateMainProductsForPromotion(entries) {
|
|
454
469
|
if (!Array.isArray(entries) || entries.length <= 1) {
|
|
@@ -882,11 +897,11 @@ export function appendPromotionTags(products, evaluator) {
|
|
|
882
897
|
|
|
883
898
|
// 评估器期望的 product shape,最少字段集
|
|
884
899
|
var evaluatorInput = products.map(function (item, index) {
|
|
885
|
-
var _ref14, _item$id, _item$
|
|
900
|
+
var _ref14, _item$id, _item$product_variant4, _item$price, _item$quantity;
|
|
886
901
|
return {
|
|
887
902
|
id: index,
|
|
888
903
|
product_id: Number((_ref14 = (_item$id = item === null || item === void 0 ? void 0 : item.id) !== null && _item$id !== void 0 ? _item$id : item === null || item === void 0 ? void 0 : item.product_id) !== null && _ref14 !== void 0 ? _ref14 : 0) || 0,
|
|
889
|
-
product_variant_id: Number((_item$
|
|
904
|
+
product_variant_id: Number((_item$product_variant4 = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant4 !== void 0 ? _item$product_variant4 : 0) || 0,
|
|
890
905
|
name: (item === null || item === void 0 ? void 0 : item.title) || (item === null || item === void 0 ? void 0 : item.name) || '',
|
|
891
906
|
price: Number((_item$price = item === null || item === void 0 ? void 0 : item.price) !== null && _item$price !== void 0 ? _item$price : 0) || 0,
|
|
892
907
|
quantity: Number((_item$quantity = item === null || item === void 0 ? void 0 : item.quantity) !== null && _item$quantity !== void 0 ? _item$quantity : 1) || 1,
|
|
@@ -975,7 +990,12 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
975
990
|
for (var i = 0; i < list.length; i++) {
|
|
976
991
|
var item = list[i];
|
|
977
992
|
var giftInfo = getGiftInfo(item);
|
|
978
|
-
if (
|
|
993
|
+
if (isPersistedGeneratedVoucher(item)) {
|
|
994
|
+
editProductsWithIndex.push({
|
|
995
|
+
item: item,
|
|
996
|
+
originalListIndex: i
|
|
997
|
+
});
|
|
998
|
+
} else if (giftInfo) {
|
|
979
999
|
existingGiftsWithIndex.push({
|
|
980
1000
|
item: item,
|
|
981
1001
|
originalListIndex: i
|
|
@@ -1039,12 +1059,12 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1039
1059
|
var promotionProducts = [];
|
|
1040
1060
|
var originalItemMap = new Map();
|
|
1041
1061
|
var productsForStrategies = consolidatedMainProductsWithIndex.map(function (_ref16, i) {
|
|
1042
|
-
var _item$product_id, _item$
|
|
1062
|
+
var _item$product_id, _item$product_variant5, _item$metadata2, _item$num;
|
|
1043
1063
|
var item = _ref16.item;
|
|
1044
1064
|
return {
|
|
1045
1065
|
id: i,
|
|
1046
1066
|
product_id: Number((_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : 0) || 0,
|
|
1047
|
-
product_variant_id: Number((_item$
|
|
1067
|
+
product_variant_id: Number((_item$product_variant5 = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant5 !== void 0 ? _item$product_variant5 : 0) || 0,
|
|
1048
1068
|
name: (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.product_name) || (item === null || item === void 0 ? void 0 : item.title) || '',
|
|
1049
1069
|
price: getOrderProductBasePrice(item),
|
|
1050
1070
|
quantity: Number((_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : 1) || 1,
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 | 1 | 2 | 3 |
|
|
314
|
+
weekNum: 0 | 1 | 2 | 3 | 5 | 4 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -2,8 +2,6 @@ var _excluded = ["id"],
|
|
|
2
2
|
_excluded2 = ["product_id"],
|
|
3
3
|
_excluded3 = ["product_id"];
|
|
4
4
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
5
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
8
6
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
7
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
@@ -27,6 +25,8 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
|
27
25
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
28
26
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
29
27
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
28
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
29
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
30
30
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
31
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
32
32
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
@@ -41,7 +41,19 @@ import { buildCartView } from "./utils/cartView";
|
|
|
41
41
|
import { buildCacheItemFromCartDetail, buildCacheItemFromDetail, buildRequiresDetailPayload as _buildRequiresDetailPayload, decideAddProduct as decideAddProductUtil, decideAfterDetail as decideAfterDetailUtil, decideAutoClose as decideAutoCloseUtil, getIsEject as getIsEjectUtil, getIsOnlySession as getIsOnlySessionUtil, transformDetailToProductAndBooking as transformDetailToProductAndBookingUtil } from "./utils/addProductDecision";
|
|
42
42
|
import { buildCacheItemFromOrderLine as buildCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildCacheItemFromOrderLine";
|
|
43
43
|
import { buildNormalProductCacheItemFromOrderLine as buildNormalProductCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine";
|
|
44
|
+
import { buildProductOptionStringFromOrderLine } from "../../modules/BookingContext/utils/orderLineDisplay";
|
|
44
45
|
import { applyBookingsStatus, resolveScheduleId, restoreBookingsStatus } from "./utils/bookingStatus";
|
|
46
|
+
function withProductOptionString(cacheItem) {
|
|
47
|
+
var _cacheItem$_extend;
|
|
48
|
+
var productOptionString = buildProductOptionStringFromOrderLine(cacheItem);
|
|
49
|
+
if (!productOptionString) return cacheItem;
|
|
50
|
+
return _objectSpread(_objectSpread({}, cacheItem), {}, {
|
|
51
|
+
product_option_string: (cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_option_string) || productOptionString,
|
|
52
|
+
_extend: _objectSpread(_objectSpread({}, (cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem._extend) || {}), {}, {
|
|
53
|
+
product_option_string: (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.product_option_string) || productOptionString
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
}
|
|
45
57
|
export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
46
58
|
_inherits(BookingTicketImpl, _BaseSalesImpl);
|
|
47
59
|
var _super = _createSuper(BookingTicketImpl);
|
|
@@ -1579,10 +1591,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1579
1591
|
}, {
|
|
1580
1592
|
key: "getProductExtend",
|
|
1581
1593
|
value: function getProductExtend(cacheItem, extra) {
|
|
1582
|
-
|
|
1583
|
-
|
|
1594
|
+
var preparedCacheItem = withProductOptionString(cacheItem);
|
|
1595
|
+
var result = getProductExtendUtil({
|
|
1596
|
+
cacheItem: preparedCacheItem,
|
|
1584
1597
|
ctx: this.buildBookingCalcContext(extra)
|
|
1585
1598
|
});
|
|
1599
|
+
return result;
|
|
1586
1600
|
}
|
|
1587
1601
|
|
|
1588
1602
|
/**
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
-
var promotion_exports = {};
|
|
31
|
-
__export(promotion_exports, {
|
|
32
|
-
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
-
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
34
|
-
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
35
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
36
|
-
default: () => import_adapter2.default
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(promotion_exports);
|
|
39
|
-
var import_evaluator = require("./evaluator");
|
|
40
|
-
var import_adapter = require("./adapter");
|
|
41
|
-
var import_adapter2 = __toESM(require("./adapter"));
|
|
42
|
-
var import_examples = require("./examples");
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
BUY_X_GET_Y_FREE_STRATEGY,
|
|
46
|
-
PromotionAdapter,
|
|
47
|
-
PromotionEvaluator,
|
|
48
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
49
|
-
});
|
|
@@ -34,6 +34,7 @@ __export(buildCacheItemFromOrderLine_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(buildCacheItemFromOrderLine_exports);
|
|
35
35
|
var import_dayjs = __toESM(require("dayjs"));
|
|
36
36
|
var import_manualProductDiscount = require("../../Order/utils/manualProductDiscount");
|
|
37
|
+
var import_orderLineDisplay = require("./orderLineDisplay");
|
|
37
38
|
function safeFormat(value, fmt) {
|
|
38
39
|
if (value === void 0 || value === null)
|
|
39
40
|
return void 0;
|
|
@@ -178,6 +179,7 @@ function buildCacheItemFromOrderLine(input) {
|
|
|
178
179
|
const capacity = resolveCapacityFromBooking(booking);
|
|
179
180
|
const holderId = ((_a = booking.metadata) == null ? void 0 : _a.holder_id) ?? booking.holder_id;
|
|
180
181
|
const productTitle = resolveProductTitle(product, booking, sourceProduct);
|
|
182
|
+
const productOptionString = (0, import_orderLineDisplay.buildProductOptionStringFromOrderLine)(product);
|
|
181
183
|
const other = {
|
|
182
184
|
product_variant_id: product.product_variant_id ?? 0,
|
|
183
185
|
option: Array.isArray(product.product_option_item) ? [...product.product_option_item] : [],
|
|
@@ -206,7 +208,8 @@ function buildCacheItemFromOrderLine(input) {
|
|
|
206
208
|
discount_reason: (0, import_manualProductDiscount.resolveManualDiscountMessage)(
|
|
207
209
|
product.discount_list,
|
|
208
210
|
(_c = product.metadata) == null ? void 0 : _c.product_discount_reason
|
|
209
|
-
) || void 0
|
|
211
|
+
) || void 0,
|
|
212
|
+
...productOptionString ? { product_option_string: productOptionString } : {}
|
|
210
213
|
};
|
|
211
214
|
const manualDiscount = (product.discount_list || []).find((d) => (d == null ? void 0 : d.type) === "product");
|
|
212
215
|
if (manualDiscount && extend.origin_total === selling) {
|
|
@@ -233,6 +236,7 @@ function buildCacheItemFromOrderLine(input) {
|
|
|
233
236
|
price: (sourceProduct == null ? void 0 : sourceProduct.price) ?? selling,
|
|
234
237
|
selling_price: product.selling_price,
|
|
235
238
|
original_price: product.original_price,
|
|
239
|
+
...productOptionString ? { product_option_string: productOptionString } : {},
|
|
236
240
|
_extend: extend,
|
|
237
241
|
new: 0,
|
|
238
242
|
autoClose: false,
|
|
@@ -22,6 +22,7 @@ __export(buildNormalProductCacheItemFromOrderLine_exports, {
|
|
|
22
22
|
buildNormalProductCacheItemFromOrderLine: () => buildNormalProductCacheItemFromOrderLine
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(buildNormalProductCacheItemFromOrderLine_exports);
|
|
25
|
+
var import_orderLineDisplay = require("./orderLineDisplay");
|
|
25
26
|
function resolveSourceProductPrice(product, sourceProduct) {
|
|
26
27
|
var _a, _b, _c;
|
|
27
28
|
const metadata = product.metadata || {};
|
|
@@ -85,6 +86,7 @@ function buildNormalProductCacheItemFromOrderLine(input) {
|
|
|
85
86
|
Array.isArray(product.product_bundle) ? product.product_bundle : []
|
|
86
87
|
);
|
|
87
88
|
const originExtend = (_c = (_b = product.metadata) == null ? void 0 : _b.origin) == null ? void 0 : _c._extend;
|
|
89
|
+
const productOptionString = (0, import_orderLineDisplay.buildProductOptionStringFromOrderLine)(product);
|
|
88
90
|
const other = {
|
|
89
91
|
product_id: resolvedId,
|
|
90
92
|
product_variant_id: product.product_variant_id ?? 0,
|
|
@@ -110,6 +112,7 @@ function buildNormalProductCacheItemFromOrderLine(input) {
|
|
|
110
112
|
skuValue: JSON.parse(JSON.stringify(skuValue)),
|
|
111
113
|
_skuValue: JSON.parse(JSON.stringify(skuValue)),
|
|
112
114
|
isNormalProduct: true,
|
|
115
|
+
...productOptionString ? { product_option_string: productOptionString } : {},
|
|
113
116
|
...(originExtend == null ? void 0 : originExtend.priceOverride) !== void 0 ? { priceOverride: originExtend.priceOverride } : {},
|
|
114
117
|
...(originExtend == null ? void 0 : originExtend.bundle_edit) !== void 0 ? { bundle_edit: originExtend.bundle_edit } : {}
|
|
115
118
|
};
|
|
@@ -128,6 +131,7 @@ function buildNormalProductCacheItemFromOrderLine(input) {
|
|
|
128
131
|
price: (sourceProduct == null ? void 0 : sourceProduct.price) ?? sourcePrice,
|
|
129
132
|
selling_price: product.selling_price,
|
|
130
133
|
original_price: product.original_price,
|
|
134
|
+
...productOptionString ? { product_option_string: productOptionString } : {},
|
|
131
135
|
note: product.note,
|
|
132
136
|
order_detail_id: product.order_detail_id ?? null,
|
|
133
137
|
new: 0,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function buildProductOptionStringFromOrderLine(product: any): string;
|