@pisell/pisellos 2.2.249 → 2.2.251
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +97 -91
- package/dist/modules/Order/types.d.ts +5 -0
- package/dist/server/index.d.ts +21 -0
- package/dist/server/index.js +32 -3
- package/dist/server/modules/order/index.d.ts +1 -1
- package/dist/server/modules/order/index.js +76 -51
- package/dist/server/modules/order/types.d.ts +3 -0
- package/dist/server/modules/order/utils/filterBookings.js +8 -1
- package/dist/server/utils/small-ticket.d.ts +0 -1
- package/dist/server/utils/small-ticket.js +12 -15
- package/dist/solution/BaseSales/index.js +47 -29
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +13 -1
- package/dist/solution/BookingTicket/index.js +3 -4
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +10 -8
- package/lib/modules/Order/types.d.ts +5 -0
- package/lib/server/index.d.ts +21 -0
- package/lib/server/index.js +24 -1
- package/lib/server/modules/order/index.d.ts +1 -1
- package/lib/server/modules/order/index.js +24 -13
- package/lib/server/modules/order/types.d.ts +3 -0
- package/lib/server/modules/order/utils/filterBookings.js +6 -1
- package/lib/server/utils/small-ticket.d.ts +0 -1
- package/lib/server/utils/small-ticket.js +3 -6
- package/lib/solution/BaseSales/index.js +14 -7
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +13 -1
- package/lib/solution/BookingTicket/index.js +0 -1
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// 导出评估器
|
|
2
|
+
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
+
|
|
4
|
+
// 导出适配器
|
|
5
|
+
export { PromotionAdapter } from "./adapter";
|
|
6
|
+
export { default } from "./adapter";
|
|
7
|
+
|
|
8
|
+
// 导出策略配置示例常量
|
|
9
|
+
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
|
|
@@ -429,7 +429,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
429
429
|
generateIdempotencyToken(): string;
|
|
430
430
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
431
431
|
createOrder(params: CommitOrderParams['query']): {
|
|
432
|
-
type: "
|
|
432
|
+
type: "appointment_booking" | "virtual";
|
|
433
433
|
platform: string;
|
|
434
434
|
sales_channel: string;
|
|
435
435
|
order_sales_channel: string;
|
|
@@ -1224,9 +1224,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1224
1224
|
}, {
|
|
1225
1225
|
key: "calculatePaymentEffectiveAmount",
|
|
1226
1226
|
value: function calculatePaymentEffectiveAmount(payment) {
|
|
1227
|
-
var
|
|
1227
|
+
var _ref17, _payment$origin_amoun;
|
|
1228
|
+
var amount = new Decimal(payment.amount || 0);
|
|
1229
|
+
var originAmount = new Decimal((_ref17 = (_payment$origin_amoun = payment.origin_amount) !== null && _payment$origin_amoun !== void 0 ? _payment$origin_amoun : payment.amount) !== null && _ref17 !== void 0 ? _ref17 : 0);
|
|
1230
|
+
var serviceFee = new Decimal(payment.service_fee || 0);
|
|
1231
|
+
// TODO: 后端允许 amount 表示顾客实际支付总额后,移除这个兼容分支。
|
|
1232
|
+
var effectiveAmount = serviceFee.gt(0) && amount.eq(originAmount) ? amount.plus(serviceFee) : amount;
|
|
1228
1233
|
var rounding = new Decimal(payment.rounding_amount || 0);
|
|
1229
|
-
return
|
|
1234
|
+
return effectiveAmount.minus(rounding);
|
|
1230
1235
|
}
|
|
1231
1236
|
}, {
|
|
1232
1237
|
key: "calculatePaymentTotal",
|
|
@@ -1312,7 +1317,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1312
1317
|
}, {
|
|
1313
1318
|
key: "normalizePaymentSource",
|
|
1314
1319
|
value: function normalizePaymentSource(payment, options) {
|
|
1315
|
-
var
|
|
1320
|
+
var _ref18, _paymentRecord$origin;
|
|
1316
1321
|
var paymentRecord = payment;
|
|
1317
1322
|
var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
|
|
1318
1323
|
if (!metadata.unique_payment_number) {
|
|
@@ -1320,7 +1325,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1320
1325
|
}
|
|
1321
1326
|
var normalized = _objectSpread(_objectSpread({}, paymentRecord), {}, {
|
|
1322
1327
|
metadata: metadata,
|
|
1323
|
-
origin_amount: (
|
|
1328
|
+
origin_amount: (_ref18 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref18 !== void 0 ? _ref18 : '0.00'
|
|
1324
1329
|
});
|
|
1325
1330
|
if (paymentRecord.status !== undefined) {
|
|
1326
1331
|
normalized.status = paymentRecord.status;
|
|
@@ -1364,15 +1369,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1364
1369
|
if (normalizedStatus !== 'refunded' && normalizedStatus !== 'partially_refunded') {
|
|
1365
1370
|
return false;
|
|
1366
1371
|
}
|
|
1367
|
-
if (params.refundAmount.lte(0)) return false;
|
|
1368
1372
|
if (params.previousSummary) {
|
|
1369
1373
|
var previousTargetAmount = this.calculatePaymentTargetAmount(params.tempOrder, params.previousSummary, params.netPaymentTotal);
|
|
1370
1374
|
if (!previousTargetAmount.eq(params.targetAmount)) return false;
|
|
1371
1375
|
}
|
|
1372
|
-
|
|
1373
|
-
return params.refundAmount.gte(params.paymentTotal);
|
|
1374
|
-
}
|
|
1375
|
-
return params.netPaymentTotal.gte(params.targetAmount);
|
|
1376
|
+
return true;
|
|
1376
1377
|
}
|
|
1377
1378
|
}, {
|
|
1378
1379
|
key: "resolveWalletPassUseValue",
|
|
@@ -1654,7 +1655,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1654
1655
|
_product$payment_pric,
|
|
1655
1656
|
_sku$code,
|
|
1656
1657
|
_sku$barcode,
|
|
1657
|
-
|
|
1658
|
+
_ref19,
|
|
1658
1659
|
_sku$variant_id,
|
|
1659
1660
|
_this8 = this;
|
|
1660
1661
|
var sku = (product === null || product === void 0 ? void 0 : product.product_sku) || {};
|
|
@@ -1681,24 +1682,24 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1681
1682
|
product_sku: this.normalizeFingerprintValue({
|
|
1682
1683
|
code: (_sku$code = sku.code) !== null && _sku$code !== void 0 ? _sku$code : '',
|
|
1683
1684
|
barcode: (_sku$barcode = sku.barcode) !== null && _sku$barcode !== void 0 ? _sku$barcode : '',
|
|
1684
|
-
variant_id: (
|
|
1685
|
+
variant_id: (_ref19 = (_sku$variant_id = sku.variant_id) !== null && _sku$variant_id !== void 0 ? _sku$variant_id : product === null || product === void 0 ? void 0 : product.product_variant_id) !== null && _ref19 !== void 0 ? _ref19 : 0,
|
|
1685
1686
|
variant: sku.variant || [],
|
|
1686
1687
|
option: getProductSkuOptions(product || {}).map(function (option) {
|
|
1687
|
-
var
|
|
1688
|
+
var _ref20, _option$id, _option$option_group_, _ref21, _option$option_group_2, _option$num, _option$add_price;
|
|
1688
1689
|
return {
|
|
1689
|
-
id: (
|
|
1690
|
+
id: (_ref20 = (_option$id = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id !== void 0 ? _option$id : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref20 !== void 0 ? _ref20 : null,
|
|
1690
1691
|
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,
|
|
1691
|
-
option_group_item_id: (
|
|
1692
|
+
option_group_item_id: (_ref21 = (_option$option_group_2 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_2 !== void 0 ? _option$option_group_2 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref21 !== void 0 ? _ref21 : null,
|
|
1692
1693
|
num: Number((_option$num = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num !== void 0 ? _option$num : 1) || 1,
|
|
1693
1694
|
add_price: _this8.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)
|
|
1694
1695
|
};
|
|
1695
1696
|
})
|
|
1696
1697
|
}),
|
|
1697
1698
|
product_bundle: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.product_bundle) || []).map(function (bundle) {
|
|
1698
|
-
var
|
|
1699
|
+
var _ref22, _ref23, _bundle$bundle_produc, _ref24, _bundle$bundle_varian, _bundle$num, _bundle$price_type, _bundle$price_type_ex;
|
|
1699
1700
|
return {
|
|
1700
|
-
bundle_product_id: (
|
|
1701
|
-
bundle_variant_id: (
|
|
1701
|
+
bundle_product_id: (_ref22 = (_ref23 = (_bundle$bundle_produc = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref23 !== void 0 ? _ref23 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id) !== null && _ref22 !== void 0 ? _ref22 : null,
|
|
1702
|
+
bundle_variant_id: (_ref24 = (_bundle$bundle_varian = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle === null || bundle === void 0 ? void 0 : bundle.product_variant_id) !== null && _ref24 !== void 0 ? _ref24 : 0,
|
|
1702
1703
|
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),
|
|
1703
1704
|
price: _this8.normalizeFingerprintMoney(bundle === null || bundle === void 0 ? void 0 : bundle.price),
|
|
1704
1705
|
bundle_selling_price: _this8.normalizeFingerprintMoney(bundle === null || bundle === void 0 ? void 0 : bundle.bundle_selling_price),
|
|
@@ -1707,10 +1708,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1707
1708
|
};
|
|
1708
1709
|
})),
|
|
1709
1710
|
discount_list: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.discount_list) || []).map(function (discount) {
|
|
1710
|
-
var
|
|
1711
|
+
var _ref25, _discount$type2, _ref26, _ref27, _discount$discount_id, _discount$discount;
|
|
1711
1712
|
return {
|
|
1712
|
-
type: (
|
|
1713
|
-
discount_id: (
|
|
1713
|
+
type: (_ref25 = (_discount$type2 = discount === null || discount === void 0 ? void 0 : discount.type) !== null && _discount$type2 !== void 0 ? _discount$type2 : discount === null || discount === void 0 ? void 0 : discount.tag) !== null && _ref25 !== void 0 ? _ref25 : '',
|
|
1714
|
+
discount_id: (_ref26 = (_ref27 = (_discount$discount_id = discount === null || discount === void 0 ? void 0 : discount.discount_id) !== null && _discount$discount_id !== void 0 ? _discount$discount_id : discount === null || discount === void 0 ? void 0 : discount.order_discount_id) !== null && _ref27 !== void 0 ? _ref27 : discount === null || discount === void 0 || (_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) !== null && _ref26 !== void 0 ? _ref26 : null,
|
|
1714
1715
|
amount: _this8.normalizeFingerprintMoney(discount === null || discount === void 0 ? void 0 : discount.amount)
|
|
1715
1716
|
};
|
|
1716
1717
|
}))
|
|
@@ -1734,14 +1735,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1734
1735
|
var _product$product_id3,
|
|
1735
1736
|
_product$product_vari2,
|
|
1736
1737
|
_product$num2,
|
|
1737
|
-
|
|
1738
|
+
_ref28,
|
|
1738
1739
|
_metadata$unique_iden,
|
|
1739
1740
|
_metadata$price_overr,
|
|
1740
1741
|
_metadata$is_manual_d,
|
|
1741
1742
|
_metadata$product_dis,
|
|
1742
1743
|
_sku$code2,
|
|
1743
1744
|
_sku$barcode2,
|
|
1744
|
-
|
|
1745
|
+
_ref29,
|
|
1745
1746
|
_sku$variant_id2,
|
|
1746
1747
|
_this10 = this;
|
|
1747
1748
|
var sku = (product === null || product === void 0 ? void 0 : product.product_sku) || {};
|
|
@@ -1757,7 +1758,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1757
1758
|
extension_type: extensionType,
|
|
1758
1759
|
num: getSafeProductNum((_product$num2 = product === null || product === void 0 ? void 0 : product.num) !== null && _product$num2 !== void 0 ? _product$num2 : product === null || product === void 0 ? void 0 : product.product_quantity),
|
|
1759
1760
|
metadata: {
|
|
1760
|
-
unique_identification_number: (
|
|
1761
|
+
unique_identification_number: (_ref28 = (_metadata$unique_iden = metadata.unique_identification_number) !== null && _metadata$unique_iden !== void 0 ? _metadata$unique_iden : product === null || product === void 0 ? void 0 : product.unique_identification_number) !== null && _ref28 !== void 0 ? _ref28 : '',
|
|
1761
1762
|
price_override: (_metadata$price_overr = metadata.price_override) !== null && _metadata$price_overr !== void 0 ? _metadata$price_overr : '',
|
|
1762
1763
|
is_manual_discount: (_metadata$is_manual_d = metadata.is_manual_discount) !== null && _metadata$is_manual_d !== void 0 ? _metadata$is_manual_d : '',
|
|
1763
1764
|
product_discount_reason: (_metadata$product_dis = metadata.product_discount_reason) !== null && _metadata$product_dis !== void 0 ? _metadata$product_dis : ''
|
|
@@ -1765,35 +1766,35 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1765
1766
|
product_sku: this.normalizeFingerprintValue({
|
|
1766
1767
|
code: (_sku$code2 = sku.code) !== null && _sku$code2 !== void 0 ? _sku$code2 : '',
|
|
1767
1768
|
barcode: (_sku$barcode2 = sku.barcode) !== null && _sku$barcode2 !== void 0 ? _sku$barcode2 : '',
|
|
1768
|
-
variant_id: (
|
|
1769
|
+
variant_id: (_ref29 = (_sku$variant_id2 = sku.variant_id) !== null && _sku$variant_id2 !== void 0 ? _sku$variant_id2 : product === null || product === void 0 ? void 0 : product.product_variant_id) !== null && _ref29 !== void 0 ? _ref29 : 0,
|
|
1769
1770
|
variant: sku.variant || [],
|
|
1770
1771
|
option: getProductSkuOptions(product || {}).map(function (option) {
|
|
1771
|
-
var
|
|
1772
|
+
var _ref30, _option$id2, _option$option_group_3, _ref31, _option$option_group_4, _option$num2, _option$add_price2;
|
|
1772
1773
|
return {
|
|
1773
|
-
id: (
|
|
1774
|
+
id: (_ref30 = (_option$id2 = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id2 !== void 0 ? _option$id2 : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref30 !== void 0 ? _ref30 : null,
|
|
1774
1775
|
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,
|
|
1775
|
-
option_group_item_id: (
|
|
1776
|
+
option_group_item_id: (_ref31 = (_option$option_group_4 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_4 !== void 0 ? _option$option_group_4 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref31 !== void 0 ? _ref31 : null,
|
|
1776
1777
|
num: Number((_option$num2 = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num2 !== void 0 ? _option$num2 : 1) || 1,
|
|
1777
1778
|
add_price: _this10.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)
|
|
1778
1779
|
};
|
|
1779
1780
|
})
|
|
1780
1781
|
}),
|
|
1781
1782
|
product_bundle: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.product_bundle) || []).map(function (bundle) {
|
|
1782
|
-
var
|
|
1783
|
+
var _ref32, _bundle$bundle_id, _ref33, _bundle$bundle_group_, _ref34, _ref35, _bundle$bundle_produc2, _ref36, _bundle$bundle_varian2, _bundle$num2, _bundle$price_type2, _bundle$price_type_ex2;
|
|
1783
1784
|
return {
|
|
1784
|
-
bundle_id: (
|
|
1785
|
-
bundle_group_id: (
|
|
1786
|
-
bundle_product_id: (
|
|
1787
|
-
bundle_variant_id: (
|
|
1785
|
+
bundle_id: (_ref32 = (_bundle$bundle_id = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_id) !== null && _bundle$bundle_id !== void 0 ? _bundle$bundle_id : bundle === null || bundle === void 0 ? void 0 : bundle.id) !== null && _ref32 !== void 0 ? _ref32 : null,
|
|
1786
|
+
bundle_group_id: (_ref33 = (_bundle$bundle_group_ = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle === null || bundle === void 0 ? void 0 : bundle.group_id) !== null && _ref33 !== void 0 ? _ref33 : null,
|
|
1787
|
+
bundle_product_id: (_ref34 = (_ref35 = (_bundle$bundle_produc2 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc2 !== void 0 ? _bundle$bundle_produc2 : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref35 !== void 0 ? _ref35 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id) !== null && _ref34 !== void 0 ? _ref34 : null,
|
|
1788
|
+
bundle_variant_id: (_ref36 = (_bundle$bundle_varian2 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_variant_id) !== null && _bundle$bundle_varian2 !== void 0 ? _bundle$bundle_varian2 : bundle === null || bundle === void 0 ? void 0 : bundle.product_variant_id) !== null && _ref36 !== void 0 ? _ref36 : 0,
|
|
1788
1789
|
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),
|
|
1789
1790
|
price_type: (_bundle$price_type2 = bundle === null || bundle === void 0 ? void 0 : bundle.price_type) !== null && _bundle$price_type2 !== void 0 ? _bundle$price_type2 : '',
|
|
1790
1791
|
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 : '',
|
|
1791
1792
|
option: _this10.normalizeFingerprintValue(((bundle === null || bundle === void 0 ? void 0 : bundle.option) || []).map(function (option) {
|
|
1792
|
-
var
|
|
1793
|
+
var _ref37, _option$id3, _option$option_group_5, _ref38, _option$option_group_6, _option$num3, _option$add_price3;
|
|
1793
1794
|
return {
|
|
1794
|
-
id: (
|
|
1795
|
+
id: (_ref37 = (_option$id3 = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id3 !== void 0 ? _option$id3 : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref37 !== void 0 ? _ref37 : null,
|
|
1795
1796
|
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,
|
|
1796
|
-
option_group_item_id: (
|
|
1797
|
+
option_group_item_id: (_ref38 = (_option$option_group_6 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_6 !== void 0 ? _option$option_group_6 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref38 !== void 0 ? _ref38 : null,
|
|
1797
1798
|
num: Number((_option$num3 = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num3 !== void 0 ? _option$num3 : 1) || 1,
|
|
1798
1799
|
add_price: _this10.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)
|
|
1799
1800
|
};
|
|
@@ -1801,10 +1802,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1801
1802
|
};
|
|
1802
1803
|
})),
|
|
1803
1804
|
discount_list: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.discount_list) || []).map(function (discount) {
|
|
1804
|
-
var
|
|
1805
|
+
var _ref39, _discount$type4, _ref40, _ref41, _discount$discount_id2, _discount$discount2;
|
|
1805
1806
|
return {
|
|
1806
|
-
type: (
|
|
1807
|
-
discount_id: (
|
|
1807
|
+
type: (_ref39 = (_discount$type4 = discount === null || discount === void 0 ? void 0 : discount.type) !== null && _discount$type4 !== void 0 ? _discount$type4 : discount === null || discount === void 0 ? void 0 : discount.tag) !== null && _ref39 !== void 0 ? _ref39 : '',
|
|
1808
|
+
discount_id: (_ref40 = (_ref41 = (_discount$discount_id2 = discount === null || discount === void 0 ? void 0 : discount.discount_id) !== null && _discount$discount_id2 !== void 0 ? _discount$discount_id2 : discount === null || discount === void 0 ? void 0 : discount.order_discount_id) !== null && _ref41 !== void 0 ? _ref41 : discount === null || discount === void 0 || (_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.resource_id) !== null && _ref40 !== void 0 ? _ref40 : null,
|
|
1808
1809
|
amount: _this10.normalizeFingerprintMoney(discount === null || discount === void 0 ? void 0 : discount.amount)
|
|
1809
1810
|
};
|
|
1810
1811
|
}))
|
|
@@ -2084,11 +2085,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2084
2085
|
}, {
|
|
2085
2086
|
key: "getOrderIdentity",
|
|
2086
2087
|
value: function getOrderIdentity() {
|
|
2087
|
-
var
|
|
2088
|
+
var _ref42, _ref43, _tempOrder$order_id, _tempOrder$_extend6;
|
|
2088
2089
|
var tempOrder = this.store.tempOrder;
|
|
2089
2090
|
if (!tempOrder) return null;
|
|
2090
2091
|
var lastOrderInfo = this.store.lastOrderInfo || {};
|
|
2091
|
-
var orderId = (
|
|
2092
|
+
var orderId = (_ref42 = (_ref43 = (_tempOrder$order_id = tempOrder.order_id) !== null && _tempOrder$order_id !== void 0 ? _tempOrder$order_id : lastOrderInfo.order_id) !== null && _ref43 !== void 0 ? _ref43 : lastOrderInfo.id) !== null && _ref42 !== void 0 ? _ref42 : null;
|
|
2092
2093
|
return {
|
|
2093
2094
|
localId: this.cacheId || ((_tempOrder$_extend6 = tempOrder._extend) === null || _tempOrder$_extend6 === void 0 ? void 0 : _tempOrder$_extend6.localId),
|
|
2094
2095
|
orderId: orderId,
|
|
@@ -2241,11 +2242,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2241
2242
|
}, {
|
|
2242
2243
|
key: "captureProductRuntime",
|
|
2243
2244
|
value: function captureProductRuntime(tempOrder, rawProduct, normalizedProduct, existedUid) {
|
|
2244
|
-
var _extend$productsByUid,
|
|
2245
|
+
var _extend$productsByUid, _ref44, _rawProduct$_origin;
|
|
2245
2246
|
var uid = existedUid || this.getProductUid(normalizedProduct);
|
|
2246
2247
|
var extend = this.ensureExtend(tempOrder);
|
|
2247
2248
|
var existed = ((_extend$productsByUid = extend.productsByUid) === null || _extend$productsByUid === void 0 ? void 0 : _extend$productsByUid[uid]) || {};
|
|
2248
|
-
var origin = (
|
|
2249
|
+
var origin = (_ref44 = (_rawProduct$_origin = rawProduct._origin) !== null && _rawProduct$_origin !== void 0 ? _rawProduct$_origin : normalizedProduct._origin) !== null && _ref44 !== void 0 ? _ref44 : existed.origin;
|
|
2249
2250
|
extend.productsByUid[uid] = _objectSpread(_objectSpread({}, existed), origin !== undefined ? {
|
|
2250
2251
|
origin: origin
|
|
2251
2252
|
} : {});
|
|
@@ -2346,7 +2347,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2346
2347
|
}, {
|
|
2347
2348
|
key: "buildTempOrderHolderFromBookings",
|
|
2348
2349
|
value: function buildTempOrderHolderFromBookings(tempOrder) {
|
|
2349
|
-
var _baseHolder$customer_, _baseHolder,
|
|
2350
|
+
var _baseHolder$customer_, _baseHolder, _ref45, _baseHolder$form_id, _baseHolder2, _tempOrder$holder5, _baseHolder3, _this$otherParams;
|
|
2350
2351
|
var holderRecords = [];
|
|
2351
2352
|
var holderNames = [];
|
|
2352
2353
|
var baseHolder = null;
|
|
@@ -2393,7 +2394,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2393
2394
|
}
|
|
2394
2395
|
var nextHolder = {
|
|
2395
2396
|
customer_id: (_baseHolder$customer_ = (_baseHolder = baseHolder) === null || _baseHolder === void 0 ? void 0 : _baseHolder.customer_id) !== null && _baseHolder$customer_ !== void 0 ? _baseHolder$customer_ : tempOrder.customer_id,
|
|
2396
|
-
form_id: (
|
|
2397
|
+
form_id: (_ref45 = (_baseHolder$form_id = (_baseHolder2 = baseHolder) === null || _baseHolder2 === void 0 ? void 0 : _baseHolder2.form_id) !== null && _baseHolder$form_id !== void 0 ? _baseHolder$form_id : (_tempOrder$holder5 = tempOrder.holder) === null || _tempOrder$holder5 === void 0 ? void 0 : _tempOrder$holder5.form_id) !== null && _ref45 !== void 0 ? _ref45 : 0,
|
|
2397
2398
|
form_record: holderRecords
|
|
2398
2399
|
};
|
|
2399
2400
|
if (holderNames.length) {
|
|
@@ -2496,7 +2497,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2496
2497
|
key: "recalculateSummary",
|
|
2497
2498
|
value: function () {
|
|
2498
2499
|
var _recalculateSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(options) {
|
|
2499
|
-
var
|
|
2500
|
+
var _ref46, _salesSummaryResult$e;
|
|
2500
2501
|
var tempOrder, snapshotSummary, shouldFullRecalculateFromSnapshot, summaryProducts, salesSummary, existedSummary, totalRefundAmount, paidPaymentSummary, emptyBaseSummary, emptySummaryBase, emptySummaryWithDeposit, emptySummary, salesSummaryResult, roundingAmount, payServiceChargeAmount, hasSalesSummaryAmount, expectAmount, amountPaymentPatch, normalizedExpectAmountPatch, summaryForGap, summary;
|
|
2501
2502
|
return _regeneratorRuntime().wrap(function _callee11$(_context13) {
|
|
2502
2503
|
while (1) switch (_context13.prev = _context13.next) {
|
|
@@ -2569,7 +2570,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2569
2570
|
roundingAmount = paidPaymentSummary.roundingAmount;
|
|
2570
2571
|
payServiceChargeAmount = paidPaymentSummary.payServiceChargeAmount;
|
|
2571
2572
|
hasSalesSummaryAmount = salesSummaryResult.expect_amount !== undefined || salesSummaryResult.total_amount !== undefined;
|
|
2572
|
-
expectAmount = hasSalesSummaryAmount ? new Decimal((
|
|
2573
|
+
expectAmount = hasSalesSummaryAmount ? new Decimal((_ref46 = (_salesSummaryResult$e = salesSummaryResult.expect_amount) !== null && _salesSummaryResult$e !== void 0 ? _salesSummaryResult$e : salesSummaryResult.total_amount) !== null && _ref46 !== void 0 ? _ref46 : 0) : null;
|
|
2573
2574
|
amountPaymentPatch = hasSalesSummaryAmount || !roundingAmount.eq(0) || !payServiceChargeAmount.eq(0) ? _objectSpread({
|
|
2574
2575
|
rounding_amount: roundingAmount.toFixed(2)
|
|
2575
2576
|
}, expectAmount ? {
|
|
@@ -2747,17 +2748,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2747
2748
|
}, {
|
|
2748
2749
|
key: "buildTempOrderCustomer",
|
|
2749
2750
|
value: function buildTempOrderCustomer(params) {
|
|
2750
|
-
var
|
|
2751
|
+
var _ref47, _ref48, _ref49, _source$name, _ref50, _ref51, _ref52, _source$customer_name, _source$id, _source$customer_id, _ref53, _source$country_calli, _source$phone, _source$email;
|
|
2751
2752
|
if (!params.customerId) return null;
|
|
2752
2753
|
var source = params.source ? cloneDeep(params.source) : {};
|
|
2753
|
-
var name = (
|
|
2754
|
-
var customerName = (
|
|
2754
|
+
var name = (_ref47 = (_ref48 = (_ref49 = (_source$name = source.name) !== null && _source$name !== void 0 ? _source$name : source.display_name) !== null && _ref49 !== void 0 ? _ref49 : source.customerName) !== null && _ref48 !== void 0 ? _ref48 : source.customer_name) !== null && _ref47 !== void 0 ? _ref47 : params.customerName;
|
|
2755
|
+
var customerName = (_ref50 = (_ref51 = (_ref52 = (_source$customer_name = source.customer_name) !== null && _source$customer_name !== void 0 ? _source$customer_name : source.customerName) !== null && _ref52 !== void 0 ? _ref52 : source.display_name) !== null && _ref51 !== void 0 ? _ref51 : source.name) !== null && _ref50 !== void 0 ? _ref50 : params.customerName;
|
|
2755
2756
|
return _objectSpread(_objectSpread({}, source), {}, {
|
|
2756
2757
|
id: (_source$id = source.id) !== null && _source$id !== void 0 ? _source$id : params.customerId,
|
|
2757
2758
|
customer_id: (_source$customer_id = source.customer_id) !== null && _source$customer_id !== void 0 ? _source$customer_id : params.customerId,
|
|
2758
2759
|
name: String(name || ''),
|
|
2759
2760
|
customer_name: String(customerName || ''),
|
|
2760
|
-
country_calling_code: String((
|
|
2761
|
+
country_calling_code: String((_ref53 = (_source$country_calli = source.country_calling_code) !== null && _source$country_calli !== void 0 ? _source$country_calli : source.countryCallingCode) !== null && _ref53 !== void 0 ? _ref53 : params.countryCallingCode),
|
|
2761
2762
|
phone: String((_source$phone = source.phone) !== null && _source$phone !== void 0 ? _source$phone : params.phone),
|
|
2762
2763
|
email: String((_source$email = source.email) !== null && _source$email !== void 0 ? _source$email : params.email)
|
|
2763
2764
|
});
|
|
@@ -2856,14 +2857,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2856
2857
|
}, {
|
|
2857
2858
|
key: "updateTempOrderCustomer",
|
|
2858
2859
|
value: function updateTempOrderCustomer(customer) {
|
|
2859
|
-
var _tempOrder$customer_i2,
|
|
2860
|
+
var _tempOrder$customer_i2, _ref54, _ref55, _customer$customer_id, _ref56, _ref57, _ref58, _customer$customer_na, _ref59, _customer$country_cal, _tempOrder$customer_i3;
|
|
2860
2861
|
var tempOrder = this.ensureTempOrder();
|
|
2861
2862
|
var previousCustomerId = (_tempOrder$customer_i2 = tempOrder.customer_id) !== null && _tempOrder$customer_i2 !== void 0 ? _tempOrder$customer_i2 : null;
|
|
2862
|
-
var customerId = (
|
|
2863
|
-
var customerName = (
|
|
2863
|
+
var customerId = (_ref54 = (_ref55 = (_customer$customer_id = customer.customer_id) !== null && _customer$customer_id !== void 0 ? _customer$customer_id : customer.customerId) !== null && _ref55 !== void 0 ? _ref55 : customer.id) !== null && _ref54 !== void 0 ? _ref54 : null;
|
|
2864
|
+
var customerName = (_ref56 = (_ref57 = (_ref58 = (_customer$customer_na = customer.customer_name) !== null && _customer$customer_na !== void 0 ? _customer$customer_na : customer.customerName) !== null && _ref58 !== void 0 ? _ref58 : customer.display_name) !== null && _ref57 !== void 0 ? _ref57 : customer.name) !== null && _ref56 !== void 0 ? _ref56 : '';
|
|
2864
2865
|
tempOrder.customer_id = customerId === null || customerId === undefined || customerId === '' ? null : Number(customerId);
|
|
2865
2866
|
tempOrder.customer_name = String(customerName || '');
|
|
2866
|
-
tempOrder.country_calling_code = String((
|
|
2867
|
+
tempOrder.country_calling_code = String((_ref59 = (_customer$country_cal = customer.country_calling_code) !== null && _customer$country_cal !== void 0 ? _customer$country_cal : customer.countryCallingCode) !== null && _ref59 !== void 0 ? _ref59 : '');
|
|
2867
2868
|
tempOrder.phone = String(customer.phone || '');
|
|
2868
2869
|
tempOrder.email = String(customer.email || '');
|
|
2869
2870
|
tempOrder.customer = this.buildTempOrderCustomer({
|
|
@@ -3408,50 +3409,51 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3408
3409
|
key: "addProductToOrder",
|
|
3409
3410
|
value: (function () {
|
|
3410
3411
|
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(product, booking) {
|
|
3411
|
-
var tempOrder,
|
|
3412
|
+
var tempOrder, _ref60, _productRecord$num, productRecord, splitCount, i, singleLine;
|
|
3412
3413
|
return _regeneratorRuntime().wrap(function _callee17$(_context19) {
|
|
3413
3414
|
while (1) switch (_context19.prev = _context19.next) {
|
|
3414
3415
|
case 0:
|
|
3415
3416
|
tempOrder = this.ensureTempOrder();
|
|
3417
|
+
debugger;
|
|
3416
3418
|
if (!booking) {
|
|
3417
|
-
_context19.next =
|
|
3419
|
+
_context19.next = 19;
|
|
3418
3420
|
break;
|
|
3419
3421
|
}
|
|
3420
3422
|
productRecord = product;
|
|
3421
|
-
splitCount = getSafeProductNum((
|
|
3423
|
+
splitCount = getSafeProductNum((_ref60 = (_productRecord$num = productRecord.num) !== null && _productRecord$num !== void 0 ? _productRecord$num : productRecord.product_quantity) !== null && _ref60 !== void 0 ? _ref60 : 1);
|
|
3422
3424
|
if (!(splitCount > 1)) {
|
|
3423
|
-
_context19.next =
|
|
3425
|
+
_context19.next = 19;
|
|
3424
3426
|
break;
|
|
3425
3427
|
}
|
|
3426
3428
|
i = 0;
|
|
3427
|
-
case
|
|
3429
|
+
case 7:
|
|
3428
3430
|
if (!(i < splitCount)) {
|
|
3429
|
-
_context19.next =
|
|
3431
|
+
_context19.next = 16;
|
|
3430
3432
|
break;
|
|
3431
3433
|
}
|
|
3432
3434
|
singleLine = cloneDeep(productRecord);
|
|
3433
3435
|
singleLine.num = 1;
|
|
3434
3436
|
delete singleLine.product_quantity;
|
|
3435
|
-
_context19.next =
|
|
3437
|
+
_context19.next = 13;
|
|
3436
3438
|
return this.appendProductLineToTempOrder(tempOrder, singleLine, cloneDeep(booking));
|
|
3437
|
-
case
|
|
3439
|
+
case 13:
|
|
3438
3440
|
i += 1;
|
|
3439
|
-
_context19.next =
|
|
3441
|
+
_context19.next = 7;
|
|
3440
3442
|
break;
|
|
3441
|
-
case
|
|
3442
|
-
_context19.next =
|
|
3443
|
+
case 16:
|
|
3444
|
+
_context19.next = 18;
|
|
3443
3445
|
return this.finalizeProductOrderMutation(tempOrder);
|
|
3444
|
-
case 17:
|
|
3445
|
-
return _context19.abrupt("return", tempOrder.products);
|
|
3446
3446
|
case 18:
|
|
3447
|
-
_context19.
|
|
3447
|
+
return _context19.abrupt("return", tempOrder.products);
|
|
3448
|
+
case 19:
|
|
3449
|
+
_context19.next = 21;
|
|
3448
3450
|
return this.appendProductLineToTempOrder(tempOrder, product, booking);
|
|
3449
|
-
case
|
|
3450
|
-
_context19.next =
|
|
3451
|
+
case 21:
|
|
3452
|
+
_context19.next = 23;
|
|
3451
3453
|
return this.finalizeProductOrderMutation(tempOrder);
|
|
3452
|
-
case 22:
|
|
3453
|
-
return _context19.abrupt("return", tempOrder.products);
|
|
3454
3454
|
case 23:
|
|
3455
|
+
return _context19.abrupt("return", tempOrder.products);
|
|
3456
|
+
case 24:
|
|
3455
3457
|
case "end":
|
|
3456
3458
|
return _context19.stop();
|
|
3457
3459
|
}
|
|
@@ -3476,7 +3478,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3476
3478
|
key: "addProductsToOrder",
|
|
3477
3479
|
value: (function () {
|
|
3478
3480
|
var _addProductsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(items, options) {
|
|
3479
|
-
var tempOrder, _iterator20, _step20, item, product, booking,
|
|
3481
|
+
var tempOrder, _iterator20, _step20, item, product, booking, _ref61, _productRecord$num2, productRecord, splitCount, i, singleLine;
|
|
3480
3482
|
return _regeneratorRuntime().wrap(function _callee18$(_context20) {
|
|
3481
3483
|
while (1) switch (_context20.prev = _context20.next) {
|
|
3482
3484
|
case 0:
|
|
@@ -3508,7 +3510,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3508
3510
|
break;
|
|
3509
3511
|
}
|
|
3510
3512
|
productRecord = product;
|
|
3511
|
-
splitCount = getSafeProductNum((
|
|
3513
|
+
splitCount = getSafeProductNum((_ref61 = (_productRecord$num2 = productRecord.num) !== null && _productRecord$num2 !== void 0 ? _productRecord$num2 : productRecord.product_quantity) !== null && _ref61 !== void 0 ? _ref61 : 1);
|
|
3512
3514
|
if (!(splitCount > 1)) {
|
|
3513
3515
|
_context20.next = 26;
|
|
3514
3516
|
break;
|
|
@@ -3585,9 +3587,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3585
3587
|
}, {
|
|
3586
3588
|
key: "getBundleRuntimeIdentity",
|
|
3587
3589
|
value: function getBundleRuntimeIdentity(bundle) {
|
|
3588
|
-
var
|
|
3590
|
+
var _ref62, _bundle$bundle_id2, _ref63, _bundle$bundle_group_2, _ref64, _ref65, _bundle$bundle_produc3, _ref66, _bundle$bundle_varian3;
|
|
3589
3591
|
if (!bundle || _typeof(bundle) !== 'object') return '';
|
|
3590
|
-
return [(
|
|
3592
|
+
return [(_ref62 = (_bundle$bundle_id2 = bundle.bundle_id) !== null && _bundle$bundle_id2 !== void 0 ? _bundle$bundle_id2 : bundle.id) !== null && _ref62 !== void 0 ? _ref62 : '', (_ref63 = (_bundle$bundle_group_2 = bundle.bundle_group_id) !== null && _bundle$bundle_group_2 !== void 0 ? _bundle$bundle_group_2 : bundle.group_id) !== null && _ref63 !== void 0 ? _ref63 : '', (_ref64 = (_ref65 = (_bundle$bundle_produc3 = bundle.bundle_product_id) !== null && _bundle$bundle_produc3 !== void 0 ? _bundle$bundle_produc3 : bundle._bundle_product_id) !== null && _ref65 !== void 0 ? _ref65 : bundle.product_id) !== null && _ref64 !== void 0 ? _ref64 : '', (_ref66 = (_bundle$bundle_varian3 = bundle.bundle_variant_id) !== null && _bundle$bundle_varian3 !== void 0 ? _bundle$bundle_varian3 : bundle.product_variant_id) !== null && _ref66 !== void 0 ? _ref66 : 0].join('|');
|
|
3591
3593
|
}
|
|
3592
3594
|
}, {
|
|
3593
3595
|
key: "preservePersistedBundlePriceFields",
|
|
@@ -4104,23 +4106,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4104
4106
|
}, {
|
|
4105
4107
|
key: "buildCurrentSubmitPayloadForLocalPrint",
|
|
4106
4108
|
value: function buildCurrentSubmitPayloadForLocalPrint(params) {
|
|
4107
|
-
var _params$cacheId, _this$otherParams2,
|
|
4109
|
+
var _params$cacheId, _this$otherParams2, _ref67, _params$businessCode, _this$otherParams3, _this$otherParams4;
|
|
4108
4110
|
var tempOrder = this.ensureTempOrder();
|
|
4109
4111
|
this.persistTempOrder();
|
|
4110
4112
|
var payload = buildSubmitPayload({
|
|
4111
4113
|
tempOrder: tempOrder,
|
|
4112
4114
|
cacheId: (_params$cacheId = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId !== void 0 ? _params$cacheId : this.cacheId,
|
|
4113
4115
|
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.platform),
|
|
4114
|
-
businessCode: (
|
|
4116
|
+
businessCode: (_ref67 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.businessCode) !== null && _ref67 !== void 0 ? _ref67 : (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.business_code,
|
|
4115
4117
|
channel: params === null || params === void 0 ? void 0 : params.channel,
|
|
4116
4118
|
type: params === null || params === void 0 ? void 0 : params.type,
|
|
4117
4119
|
summary: this.store.summary || createEmptySummary(),
|
|
4118
4120
|
enhance: function enhance(nextPayload) {
|
|
4119
|
-
var
|
|
4121
|
+
var _ref68, _tempOrder$order_numb, _ref69, _tempOrder$shop_order, _ref70, _tempOrder$shop_full_;
|
|
4120
4122
|
return _objectSpread(_objectSpread({}, nextPayload), {}, {
|
|
4121
|
-
order_number: (
|
|
4122
|
-
shop_order_number: (
|
|
4123
|
-
shop_full_order_number: (
|
|
4123
|
+
order_number: (_ref68 = (_tempOrder$order_numb = tempOrder.order_number) !== null && _tempOrder$order_numb !== void 0 ? _tempOrder$order_numb : nextPayload.order_number) !== null && _ref68 !== void 0 ? _ref68 : null,
|
|
4124
|
+
shop_order_number: (_ref69 = (_tempOrder$shop_order = tempOrder.shop_order_number) !== null && _tempOrder$shop_order !== void 0 ? _tempOrder$shop_order : nextPayload.shop_order_number) !== null && _ref69 !== void 0 ? _ref69 : null,
|
|
4125
|
+
shop_full_order_number: (_ref70 = (_tempOrder$shop_full_ = tempOrder.shop_full_order_number) !== null && _tempOrder$shop_full_ !== void 0 ? _tempOrder$shop_full_ : nextPayload.shop_full_order_number) !== null && _ref70 !== void 0 ? _ref70 : null,
|
|
4124
4126
|
small_ticket_data_flag: 1
|
|
4125
4127
|
});
|
|
4126
4128
|
}
|
|
@@ -4217,7 +4219,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4217
4219
|
key: "runSubmitTempOrder",
|
|
4218
4220
|
value: function () {
|
|
4219
4221
|
var _runSubmitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
4220
|
-
var _params$cacheId2, _this$otherParams5,
|
|
4222
|
+
var _params$cacheId2, _this$otherParams5, _ref71, _params$businessCode2, _this$otherParams6, _this$otherParams7;
|
|
4221
4223
|
var tempOrder, latestSummary, effectiveCacheId, hasPaymentOverride, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
|
|
4222
4224
|
return _regeneratorRuntime().wrap(function _callee28$(_context31) {
|
|
4223
4225
|
while (1) switch (_context31.prev = _context31.next) {
|
|
@@ -4263,7 +4265,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4263
4265
|
tempOrder: tempOrder,
|
|
4264
4266
|
cacheId: effectiveCacheId,
|
|
4265
4267
|
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.platform),
|
|
4266
|
-
businessCode: (
|
|
4268
|
+
businessCode: (_ref71 = (_params$businessCode2 = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode2 !== void 0 ? _params$businessCode2 : (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.businessCode) !== null && _ref71 !== void 0 ? _ref71 : (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.business_code,
|
|
4267
4269
|
channel: params === null || params === void 0 ? void 0 : params.channel,
|
|
4268
4270
|
type: params === null || params === void 0 ? void 0 : params.type,
|
|
4269
4271
|
summary: latestSummary,
|
|
@@ -5063,6 +5065,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5063
5065
|
value: function normalizeTempOrderForRuntime(raw, options) {
|
|
5064
5066
|
var _this24 = this;
|
|
5065
5067
|
var nextTempOrder = _objectSpread(_objectSpread({}, this.createDefaultTempOrderInstance()), raw || {});
|
|
5068
|
+
// ES 列表详情使用 id 表示订单主键;OS 详情态统一依赖 order_id 驱动操作按钮。
|
|
5069
|
+
if ((nextTempOrder.order_id === undefined || nextTempOrder.order_id === null) && (raw === null || raw === void 0 ? void 0 : raw.id) !== undefined && (raw === null || raw === void 0 ? void 0 : raw.id) !== null) {
|
|
5070
|
+
nextTempOrder.order_id = raw.id;
|
|
5071
|
+
}
|
|
5066
5072
|
delete nextTempOrder.summary;
|
|
5067
5073
|
delete nextTempOrder.lastOrderInfo;
|
|
5068
5074
|
delete nextTempOrder.discount_list;
|
|
@@ -5112,7 +5118,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5112
5118
|
_step22;
|
|
5113
5119
|
try {
|
|
5114
5120
|
for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
|
|
5115
|
-
var _product$metadata8,
|
|
5121
|
+
var _product$metadata8, _ref72, _ref73, _existed$origin, _rawProduct$metadata;
|
|
5116
5122
|
var _step22$value = _slicedToArray(_step22.value, 2),
|
|
5117
5123
|
index = _step22$value[0],
|
|
5118
5124
|
product = _step22$value[1];
|
|
@@ -5120,7 +5126,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5120
5126
|
if (!uid) continue;
|
|
5121
5127
|
var existed = productsByUid[uid] && _typeof(productsByUid[uid]) === 'object' ? productsByUid[uid] : {};
|
|
5122
5128
|
var rawProduct = rawProducts[index] && _typeof(rawProducts[index]) === 'object' ? rawProducts[index] : product;
|
|
5123
|
-
var origin = (
|
|
5129
|
+
var origin = (_ref72 = (_ref73 = (_existed$origin = existed.origin) !== null && _existed$origin !== void 0 ? _existed$origin : rawProduct._origin) !== null && _ref73 !== void 0 ? _ref73 : (_rawProduct$metadata = rawProduct.metadata) === null || _rawProduct$metadata === void 0 ? void 0 : _rawProduct$metadata.origin) !== null && _ref72 !== void 0 ? _ref72 : rawProduct;
|
|
5124
5130
|
var originSnapshot = cloneDeep(origin);
|
|
5125
5131
|
var productOptionString = this.buildHydratedProductOptionString(rawProduct) || this.buildHydratedProductOptionString(product);
|
|
5126
5132
|
if (productOptionString && originSnapshot && _typeof(originSnapshot) === 'object') {
|
|
@@ -5230,10 +5236,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5230
5236
|
}, {
|
|
5231
5237
|
key: "normalizeHydratedProductOptionItem",
|
|
5232
5238
|
value: function normalizeHydratedProductOptionItem(optionItem) {
|
|
5233
|
-
var
|
|
5234
|
-
var rawNum = (
|
|
5239
|
+
var _ref74, _optionItem$num, _ref75, _optionItem$add_price;
|
|
5240
|
+
var rawNum = (_ref74 = (_optionItem$num = optionItem === null || optionItem === void 0 ? void 0 : optionItem.num) !== null && _optionItem$num !== void 0 ? _optionItem$num : optionItem === null || optionItem === void 0 ? void 0 : optionItem.quantity) !== null && _ref74 !== void 0 ? _ref74 : 1;
|
|
5235
5241
|
var parsedNum = Number(rawNum);
|
|
5236
|
-
var rawPrice = (
|
|
5242
|
+
var rawPrice = (_ref75 = (_optionItem$add_price = optionItem === null || optionItem === void 0 ? void 0 : optionItem.add_price) !== null && _optionItem$add_price !== void 0 ? _optionItem$add_price : optionItem === null || optionItem === void 0 ? void 0 : optionItem.price) !== null && _ref75 !== void 0 ? _ref75 : 0;
|
|
5237
5243
|
var parsedPrice = Number(rawPrice);
|
|
5238
5244
|
var normalized = _objectSpread(_objectSpread({}, optionItem), {}, {
|
|
5239
5245
|
option_group_item_id: optionItem === null || optionItem === void 0 ? void 0 : optionItem.option_group_item_id,
|
|
@@ -5360,10 +5366,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5360
5366
|
_step27;
|
|
5361
5367
|
try {
|
|
5362
5368
|
for (_iterator27.s(); !(_step27 = _iterator27.n()).done;) {
|
|
5363
|
-
var
|
|
5369
|
+
var _ref76, _bundle$num3;
|
|
5364
5370
|
var bundle = _step27.value;
|
|
5365
5371
|
var isPersistedBundleProduct = isPersistedProduct || Boolean((bundle === null || bundle === void 0 ? void 0 : bundle.order_detail_id) || (bundle === null || bundle === void 0 ? void 0 : bundle.orderDetailId) || (bundle === null || bundle === void 0 ? void 0 : bundle.booking_id));
|
|
5366
|
-
var bundleQty = new Decimal(Number(qty) || 1).times(Number((
|
|
5372
|
+
var bundleQty = new Decimal(Number(qty) || 1).times(Number((_ref76 = (_bundle$num3 = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num3 !== void 0 ? _bundle$num3 : bundle === null || bundle === void 0 ? void 0 : bundle.quantity) !== null && _ref76 !== void 0 ? _ref76 : 1) || 1).toNumber();
|
|
5367
5373
|
var _iterator28 = _createForOfIteratorHelper((bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) || []),
|
|
5368
5374
|
_step28;
|
|
5369
5375
|
try {
|
|
@@ -518,6 +518,11 @@ export interface LoadSalesDetailParams {
|
|
|
518
518
|
orderNumber?: string;
|
|
519
519
|
externalSaleNumber?: string;
|
|
520
520
|
external_sale_number?: string;
|
|
521
|
+
/**
|
|
522
|
+
* 已由调用方查询到的销售详情记录。
|
|
523
|
+
* 存在时 loadSalesDetail 会跳过远端 lookup,直接复用 hydrate 后半段逻辑。
|
|
524
|
+
*/
|
|
525
|
+
preloadedSalesDetail?: Record<string, any>;
|
|
521
526
|
forceRemote?: boolean;
|
|
522
527
|
merge?: boolean;
|
|
523
528
|
}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -9,6 +9,20 @@ import { PisellCore, ServerModuleConfig, InitializeServerOptions } from '../type
|
|
|
9
9
|
import type { RouteHandler, HttpMethod, RouteDefinition, Router, ModuleRegistryConfig, RequestSetting } from './types';
|
|
10
10
|
import { OrderModule } from './modules/order';
|
|
11
11
|
export type { RouteHandler, HttpMethod, RouteDefinition, Router, ModuleRegistryConfig, };
|
|
12
|
+
/** Server 运行时诊断快照,用于排查订阅者是否持续增长。 */
|
|
13
|
+
export interface ServerDiagnosticsSnapshot {
|
|
14
|
+
subscribers: {
|
|
15
|
+
productQuerySubscribers: number;
|
|
16
|
+
orderQuerySubscribers: number;
|
|
17
|
+
bookingQuerySubscribers: number;
|
|
18
|
+
bookingRemoteQuerySubscribers: number;
|
|
19
|
+
salesSearchSubscribers: number;
|
|
20
|
+
floorPlanQuerySubscribers: number;
|
|
21
|
+
};
|
|
22
|
+
caches: {
|
|
23
|
+
bookingRemoteCache: number;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
12
26
|
/**
|
|
13
27
|
* Server 类
|
|
14
28
|
* 用于注册和管理服务端模块
|
|
@@ -44,6 +58,13 @@ declare class Server {
|
|
|
44
58
|
private floorPlanQuerySubscribers;
|
|
45
59
|
private moduleRegistry;
|
|
46
60
|
constructor(core: PisellCore);
|
|
61
|
+
/**
|
|
62
|
+
* 获取 Server 内部订阅者和缓存数量快照。
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* const snapshot = pisellos.server?.getDiagnosticsSnapshot?.();
|
|
66
|
+
*/
|
|
67
|
+
getDiagnosticsSnapshot(): ServerDiagnosticsSnapshot;
|
|
47
68
|
/**
|
|
48
69
|
* 注册路由
|
|
49
70
|
* @param routes 路由定义数组
|