@pisell/pisellos 2.3.169 → 2.3.171
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/evaluator.js +5 -4
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/Discount/types.d.ts +4 -0
- package/dist/modules/Order/index.js +27 -13
- package/dist/modules/Order/utils.js +45 -45
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Rules/index.d.ts +3 -10
- package/dist/modules/Rules/index.js +169 -87
- package/dist/modules/Rules/promotionSelection.d.ts +14 -0
- package/dist/modules/Rules/promotionSelection.js +390 -0
- package/dist/modules/Rules/types.d.ts +9 -0
- package/dist/server/modules/order/index.d.ts +6 -0
- package/dist/server/modules/order/index.js +782 -447
- package/dist/solution/BaseSales/index.js +41 -21
- package/dist/solution/BaseSales/utils/cartPromotion.js +5 -2
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/lib/model/strategy/adapter/promotion/evaluator.js +5 -4
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/Discount/types.d.ts +4 -0
- package/lib/modules/Order/index.js +11 -0
- package/lib/modules/Order/utils.js +1 -1
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Rules/index.d.ts +3 -10
- package/lib/modules/Rules/index.js +62 -22
- package/lib/modules/Rules/promotionSelection.d.ts +14 -0
- package/lib/modules/Rules/promotionSelection.js +230 -0
- package/lib/modules/Rules/types.d.ts +9 -0
- package/lib/server/modules/order/index.d.ts +6 -0
- package/lib/server/modules/order/index.js +226 -29
- package/lib/solution/BaseSales/index.js +19 -5
- package/lib/solution/BaseSales/utils/cartPromotion.js +5 -2
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -792,6 +792,7 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
792
792
|
_iterator11.f();
|
|
793
793
|
}
|
|
794
794
|
var allocatedPricesByProductId = new Map();
|
|
795
|
+
var expectedPromoTotal = new Decimal(0);
|
|
795
796
|
for (var g = 0; g < groupCount; g++) {
|
|
796
797
|
var startIdx = g * x;
|
|
797
798
|
var endIdx = startIdx + x;
|
|
@@ -802,8 +803,9 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
802
803
|
return sum.plus(u.price);
|
|
803
804
|
}, new Decimal(0));
|
|
804
805
|
|
|
805
|
-
//
|
|
806
|
-
var groupPriceDecimal = new Decimal(groupPrice);
|
|
806
|
+
// 组价高于本组原价时保留原价,尾差目标也必须使用封顶后的实际组价。
|
|
807
|
+
var groupPriceDecimal = Decimal.min(new Decimal(groupPrice), groupOriginalTotal);
|
|
808
|
+
expectedPromoTotal = expectedPromoTotal.plus(groupPriceDecimal);
|
|
807
809
|
var allocatedSum = new Decimal(0);
|
|
808
810
|
for (var i = 0; i < groupUnits.length; i++) {
|
|
809
811
|
var unit = groupUnits[i];
|
|
@@ -911,14 +913,13 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
911
913
|
processedQuantityMap.set(_key, _processedQty + _availableQty);
|
|
912
914
|
}
|
|
913
915
|
|
|
914
|
-
// 8.
|
|
916
|
+
// 8. 尾差调整:只补实际组价的舍入差额,不将高于原价的组价补到某一件。
|
|
915
917
|
} catch (err) {
|
|
916
918
|
_iterator12.e(err);
|
|
917
919
|
} finally {
|
|
918
920
|
_iterator12.f();
|
|
919
921
|
}
|
|
920
922
|
if (groupCount > 0) {
|
|
921
|
-
var expectedPromoTotal = new Decimal(groupPrice).mul(groupCount);
|
|
922
923
|
var promoItems = result.filter(function (p) {
|
|
923
924
|
return p.inPromotion;
|
|
924
925
|
});
|
|
@@ -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, ITEM_REWARD_STRATEGY } from "./examples";
|
|
@@ -158,6 +158,10 @@ export interface Discount {
|
|
|
158
158
|
discount_calculation_mode: 'item_level' | 'order_level';
|
|
159
159
|
};
|
|
160
160
|
isManualSelect?: boolean;
|
|
161
|
+
/** X 件 Y 元互斥选择的手动意图;isSelected 只表示本次实际应用结果。 */
|
|
162
|
+
promotionSelection?: 'card' | 'promotion';
|
|
163
|
+
/** 记录手动操作影响的促销组,避免卡失效后普通重算丢失取消意图。 */
|
|
164
|
+
promotionSelectionStrategyIds?: string[];
|
|
161
165
|
isDisabled?: boolean;
|
|
162
166
|
isSelected?: boolean;
|
|
163
167
|
isAvailable?: boolean;
|
|
@@ -676,7 +676,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
676
676
|
_this$store$discount,
|
|
677
677
|
_this4 = this,
|
|
678
678
|
_this$store$tempOrder2;
|
|
679
|
-
var orderId, requestEpoch, requestOrderIdentityKey, prepareConfigResult, isCurrentRequest, discountList, _this$store$discount2, _this$store$discount3, _this$store$discount4, currentDiscountList, currentCommittedDiscounts, currentScanDiscounts, currentScanDiscountById, committedDiscountById, mergedCommittedDiscountIds, refreshedScanDiscountIds, runtimeDiscountIds, runtimeDiscounts, retainedCommittedDiscounts, retainedScanDiscounts, mergedDiscountList;
|
|
679
|
+
var orderId, requestEpoch, requestOrderIdentityKey, prepareConfigResult, isCurrentRequest, discountList, _this$store$discount2, _this$store$discount3, _this$store$discount4, currentDiscountList, currentPromotionSelections, currentCommittedDiscounts, currentScanDiscounts, currentScanDiscountById, committedDiscountById, mergedCommittedDiscountIds, refreshedScanDiscountIds, runtimeDiscountIds, runtimeDiscounts, retainedCommittedDiscounts, retainedScanDiscounts, mergedDiscountList;
|
|
680
680
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
681
681
|
while (1) switch (_context3.prev = _context3.next) {
|
|
682
682
|
case 0:
|
|
@@ -721,10 +721,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
721
721
|
});
|
|
722
722
|
}
|
|
723
723
|
if (!discountList) {
|
|
724
|
-
_context3.next =
|
|
724
|
+
_context3.next = 33;
|
|
725
725
|
break;
|
|
726
726
|
}
|
|
727
727
|
currentDiscountList = ((_this$store$discount2 = this.store.discount) === null || _this$store$discount2 === void 0 ? void 0 : _this$store$discount2.getDiscountList()) || [];
|
|
728
|
+
currentPromotionSelections = new Map(currentDiscountList.filter(function (discount) {
|
|
729
|
+
return !discount.isEditMode && discount.promotionSelection;
|
|
730
|
+
}).map(function (discount) {
|
|
731
|
+
return [String(discount.id), discount];
|
|
732
|
+
}));
|
|
728
733
|
currentCommittedDiscounts = currentDiscountList.filter(function (discount) {
|
|
729
734
|
var _discount$committedAp;
|
|
730
735
|
return (discount === null || discount === void 0 ? void 0 : discount.isEditMode) || (discount === null || discount === void 0 || (_discount$committedAp = discount.committedAppliedProductDetails) === null || _discount$committedAp === void 0 ? void 0 : _discount$committedAp.length);
|
|
@@ -767,6 +772,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
767
772
|
isManualSelect: (_currentScanDiscount$2 = currentScanDiscount.isManualSelect) !== null && _currentScanDiscount$2 !== void 0 ? _currentScanDiscount$2 : nextDiscount.isManualSelect
|
|
768
773
|
});
|
|
769
774
|
}
|
|
775
|
+
var currentSelection = currentPromotionSelections.get(String(discount.id));
|
|
776
|
+
if (currentSelection) {
|
|
777
|
+
nextDiscount = _objectSpread(_objectSpread({}, nextDiscount), {}, {
|
|
778
|
+
promotionSelection: currentSelection.promotionSelection,
|
|
779
|
+
promotionSelectionStrategyIds: currentSelection.promotionSelectionStrategyIds,
|
|
780
|
+
isManualSelect: currentSelection.isManualSelect,
|
|
781
|
+
isSelected: currentSelection.isSelected
|
|
782
|
+
});
|
|
783
|
+
}
|
|
770
784
|
return [nextDiscount];
|
|
771
785
|
});
|
|
772
786
|
retainedCommittedDiscounts = currentCommittedDiscounts.filter(function (discount) {
|
|
@@ -788,34 +802,34 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
788
802
|
});
|
|
789
803
|
mergedDiscountList = [].concat(_toConsumableArray(retainedCommittedDiscounts), _toConsumableArray(retainedScanDiscounts), _toConsumableArray(runtimeDiscounts));
|
|
790
804
|
if (isCurrentRequest()) {
|
|
791
|
-
_context3.next =
|
|
805
|
+
_context3.next = 27;
|
|
792
806
|
break;
|
|
793
807
|
}
|
|
794
808
|
return _context3.abrupt("return", this.getDiscountList());
|
|
795
|
-
case
|
|
796
|
-
_context3.next =
|
|
809
|
+
case 27:
|
|
810
|
+
_context3.next = 29;
|
|
797
811
|
return (_this$store$discount3 = this.store.discount) === null || _this$store$discount3 === void 0 ? void 0 : _this$store$discount3.setOriginalDiscountList(mergedDiscountList);
|
|
798
|
-
case
|
|
812
|
+
case 29:
|
|
799
813
|
if (isCurrentRequest()) {
|
|
800
|
-
_context3.next =
|
|
814
|
+
_context3.next = 31;
|
|
801
815
|
break;
|
|
802
816
|
}
|
|
803
817
|
return _context3.abrupt("return", this.getDiscountList());
|
|
804
|
-
case
|
|
805
|
-
_context3.next =
|
|
818
|
+
case 31:
|
|
819
|
+
_context3.next = 33;
|
|
806
820
|
return (_this$store$discount4 = this.store.discount) === null || _this$store$discount4 === void 0 ? void 0 : _this$store$discount4.setDiscountList(mergedDiscountList);
|
|
807
|
-
case
|
|
821
|
+
case 33:
|
|
808
822
|
if (isCurrentRequest()) {
|
|
809
|
-
_context3.next =
|
|
823
|
+
_context3.next = 35;
|
|
810
824
|
break;
|
|
811
825
|
}
|
|
812
826
|
return _context3.abrupt("return", this.getDiscountList());
|
|
813
|
-
case
|
|
827
|
+
case 35:
|
|
814
828
|
if (params.apply !== false && (_this$store$tempOrder2 = this.store.tempOrder) !== null && _this$store$tempOrder2 !== void 0 && (_this$store$tempOrder2 = _this$store$tempOrder2.products) !== null && _this$store$tempOrder2 !== void 0 && _this$store$tempOrder2.length) {
|
|
815
829
|
this.applyDiscount();
|
|
816
830
|
}
|
|
817
831
|
return _context3.abrupt("return", this.getDiscountList());
|
|
818
|
-
case
|
|
832
|
+
case 37:
|
|
819
833
|
case "end":
|
|
820
834
|
return _context3.stop();
|
|
821
835
|
}
|
|
@@ -1115,10 +1115,10 @@ function formatSubmitOptionItems(options) {
|
|
|
1115
1115
|
var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1116
1116
|
if (!Array.isArray(options)) return [];
|
|
1117
1117
|
return options.map(function (d) {
|
|
1118
|
-
var _d$add_price;
|
|
1118
|
+
var _ref34, _d$option_group_item_, _d$add_price;
|
|
1119
1119
|
var option = _objectSpread(_objectSpread({}, d && _typeof(d) === 'object' ? d : {}), {}, {
|
|
1120
1120
|
num: d === null || d === void 0 ? void 0 : d.num,
|
|
1121
|
-
option_group_item_id: d === null || d === void 0 ? void 0 : d.option_group_item_id,
|
|
1121
|
+
option_group_item_id: (_ref34 = (_d$option_group_item_ = d === null || d === void 0 ? void 0 : d.option_group_item_id) !== null && _d$option_group_item_ !== void 0 ? _d$option_group_item_ : d === null || d === void 0 ? void 0 : d.product_option_item_id) !== null && _ref34 !== void 0 ? _ref34 : d === null || d === void 0 ? void 0 : d.id,
|
|
1122
1122
|
option_group_id: d === null || d === void 0 ? void 0 : d.option_group_id
|
|
1123
1123
|
});
|
|
1124
1124
|
var productionCode = normalizeSubmitProductionCode(d === null || d === void 0 ? void 0 : d.production_code);
|
|
@@ -1151,7 +1151,7 @@ function formatSubmitBundleItems(bundle) {
|
|
|
1151
1151
|
var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1152
1152
|
if (!Array.isArray(bundle)) return [];
|
|
1153
1153
|
return bundle.map(function (b) {
|
|
1154
|
-
var
|
|
1154
|
+
var _ref35, _rawBundle$price, _rawBundle$surcharge_, _rawBundle$num, _rawBundle$is_charge_, _rawBundle$bundle_var, _rawBundle$quantity, _rawBundle$extension_, _rawBundle$extension_2, _ref36, _rawBundle$price_type, _ref37, _rawBundle$price_type2, _rawBundle$bundle_gro, _rawBundle$bundle_id, _rawBundle$bundle_pro;
|
|
1155
1155
|
var rawBundle = b && _typeof(b) === 'object' ? b : {};
|
|
1156
1156
|
var existedMetadata = rawBundle.metadata && _typeof(rawBundle.metadata) === 'object' ? rawBundle.metadata : {};
|
|
1157
1157
|
var _customProductBundleMapId = existedMetadata.custom_product_bundle_map_id,
|
|
@@ -1162,7 +1162,7 @@ function formatSubmitBundleItems(bundle) {
|
|
|
1162
1162
|
var sellingPrice = formatOptions.virtualSettlementMode ? '0.00' : getBundleSellingMagnitude(rawBundle).toFixed(2);
|
|
1163
1163
|
// payment 价由整单折扣均摊层产出;缺省(无折扣)时与 selling 净额同义。
|
|
1164
1164
|
var paymentPrice = formatOptions.virtualSettlementMode ? '0.00' : rawBundle.bundle_payment_price !== undefined && rawBundle.bundle_payment_price !== null && rawBundle.bundle_payment_price !== '' ? toMoneyString(rawBundle.bundle_payment_price) : sellingPrice;
|
|
1165
|
-
var priceValue = formatOptions.virtualSettlementMode ? 0 : (
|
|
1165
|
+
var priceValue = formatOptions.virtualSettlementMode ? 0 : (_ref35 = (_rawBundle$price = rawBundle.price) !== null && _rawBundle$price !== void 0 ? _rawBundle$price : rawBundle.custom_price) !== null && _ref35 !== void 0 ? _ref35 : rawBundle.bundle_selling_price;
|
|
1166
1166
|
var relationSurchargeIds = Array.isArray(rawBundle.relation_surcharge_ids) ? rawBundle.relation_surcharge_ids : Array.isArray(existedMetadata.relation_surcharge_ids) ? existedMetadata.relation_surcharge_ids : [];
|
|
1167
1167
|
var surchargeFee = toMoneyString((_rawBundle$surcharge_ = rawBundle.surcharge_fee) !== null && _rawBundle$surcharge_ !== void 0 ? _rawBundle$surcharge_ : existedMetadata.surcharge_fee);
|
|
1168
1168
|
var productDiscountDifference = toBundleNumber(existedMetadata.product_discount_difference, 0);
|
|
@@ -1181,8 +1181,8 @@ function formatSubmitBundleItems(bundle) {
|
|
|
1181
1181
|
extension_id: (_rawBundle$extension_ = rawBundle.extension_id) !== null && _rawBundle$extension_ !== void 0 ? _rawBundle$extension_ : 0,
|
|
1182
1182
|
extension_type: (_rawBundle$extension_2 = rawBundle.extension_type) !== null && _rawBundle$extension_2 !== void 0 ? _rawBundle$extension_2 : 'normal',
|
|
1183
1183
|
price: priceValue,
|
|
1184
|
-
price_type: (
|
|
1185
|
-
price_type_ext: (
|
|
1184
|
+
price_type: (_ref36 = (_rawBundle$price_type = rawBundle.price_type) !== null && _rawBundle$price_type !== void 0 ? _rawBundle$price_type : rawBundle.custom_price_type) !== null && _ref36 !== void 0 ? _ref36 : '',
|
|
1185
|
+
price_type_ext: (_ref37 = (_rawBundle$price_type2 = rawBundle.price_type_ext) !== null && _rawBundle$price_type2 !== void 0 ? _rawBundle$price_type2 : rawBundle.custom_price_type_ext) !== null && _ref37 !== void 0 ? _ref37 : '',
|
|
1186
1186
|
bundle_selling_price: sellingPrice,
|
|
1187
1187
|
bundle_payment_price: paymentPrice,
|
|
1188
1188
|
option: formatSubmitOptionItems(rawBundle.option, formatOptions),
|
|
@@ -1218,11 +1218,11 @@ function formatSubmitBundleItems(bundle) {
|
|
|
1218
1218
|
* 法币仅做字段/metadata 裁剪;虚拟币在出站前再次执行零加价与固定单价断言。
|
|
1219
1219
|
*/
|
|
1220
1220
|
function normalizeSubmitProduct(product) {
|
|
1221
|
-
var
|
|
1221
|
+
var _ref39, _submitProduct$bundle, _rawMetadata$product_, _rawMetadata$selected, _rawMetadata$selected2, _submitProduct$produc, _submitProduct$paymen;
|
|
1222
1222
|
var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1223
|
-
var
|
|
1224
|
-
_runtimeUid =
|
|
1225
|
-
submitProduct = _objectWithoutProperties(
|
|
1223
|
+
var _ref38 = product,
|
|
1224
|
+
_runtimeUid = _ref38.unique_identification_number,
|
|
1225
|
+
submitProduct = _objectWithoutProperties(_ref38, _excluded2);
|
|
1226
1226
|
var num = submitProduct.num,
|
|
1227
1227
|
_productExtend = submitProduct._extend,
|
|
1228
1228
|
_productSurchargeFee = submitProduct.surcharge_fee,
|
|
@@ -1240,7 +1240,7 @@ function normalizeSubmitProduct(product) {
|
|
|
1240
1240
|
// 兼容历史 BigSale 编辑链路:bundle_edit 曾被写入 metadata,
|
|
1241
1241
|
// 出站时需提升到商品顶层;套餐未编辑时也必须显式提交 0。
|
|
1242
1242
|
var hasProductBundle = Array.isArray(submitProduct.product_bundle) && submitProduct.product_bundle.length > 0;
|
|
1243
|
-
var bundleEdit = (
|
|
1243
|
+
var bundleEdit = (_ref39 = (_submitProduct$bundle = submitProduct.bundle_edit) !== null && _submitProduct$bundle !== void 0 ? _submitProduct$bundle : rawMetadata.bundle_edit) !== null && _ref39 !== void 0 ? _ref39 : hasProductBundle ? 0 : undefined;
|
|
1244
1244
|
var cleanMetadata = {};
|
|
1245
1245
|
if (rawMetadata.unique_identification_number) {
|
|
1246
1246
|
cleanMetadata.unique_identification_number = rawMetadata.unique_identification_number;
|
|
@@ -1481,7 +1481,7 @@ export function resolveSubmitOrderType(params) {
|
|
|
1481
1481
|
return 'virtual';
|
|
1482
1482
|
}
|
|
1483
1483
|
export function buildSubmitPayload(params) {
|
|
1484
|
-
var _tempOrder$metadata2, _tempOrder$customer_i, _tempOrder$country_ca, _tempOrder$phone, _tempOrder$email, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_,
|
|
1484
|
+
var _tempOrder$metadata2, _tempOrder$customer_i, _tempOrder$country_ca, _tempOrder$phone, _tempOrder$email, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref41, _tempOrder$is_price_i, _tempOrder$is_deposit, _tempOrder$_extend, _enhancedPayload$summ;
|
|
1485
1485
|
var tempOrder = params.tempOrder,
|
|
1486
1486
|
cacheId = params.cacheId,
|
|
1487
1487
|
_params$now = params.now,
|
|
@@ -1496,29 +1496,29 @@ export function buildSubmitPayload(params) {
|
|
|
1496
1496
|
var scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
|
|
1497
1497
|
var bookingUuid = createUuidV4();
|
|
1498
1498
|
var virtualSettlementMode = ((_tempOrder$metadata2 = tempOrder.metadata) === null || _tempOrder$metadata2 === void 0 || (_tempOrder$metadata2 = _tempOrder$metadata2.currency_settlement_config) === null || _tempOrder$metadata2 === void 0 ? void 0 : _tempOrder$metadata2.settlement_type) === 'virtual_currency';
|
|
1499
|
-
var
|
|
1500
|
-
_extend =
|
|
1501
|
-
_relationId =
|
|
1502
|
-
_tableFormId =
|
|
1503
|
-
_resourceId =
|
|
1504
|
-
_summary =
|
|
1505
|
-
_lastOrderInfo =
|
|
1506
|
-
_paidAmount =
|
|
1507
|
-
_shopId =
|
|
1508
|
-
_shopNote =
|
|
1509
|
-
_shopServiceType =
|
|
1510
|
-
_startTime =
|
|
1511
|
-
_customer =
|
|
1512
|
-
_discountList =
|
|
1513
|
-
_orderMetaList =
|
|
1514
|
-
_rootTaxFee =
|
|
1515
|
-
_totalAmount =
|
|
1516
|
-
_totalRefundAmount =
|
|
1517
|
-
_createDate =
|
|
1518
|
-
_holderId =
|
|
1519
|
-
_paymentStatus =
|
|
1520
|
-
_notes =
|
|
1521
|
-
tempOrderRest = _objectWithoutProperties(
|
|
1499
|
+
var _ref40 = tempOrder,
|
|
1500
|
+
_extend = _ref40._extend,
|
|
1501
|
+
_relationId = _ref40.relation_id,
|
|
1502
|
+
_tableFormId = _ref40.table_form_id,
|
|
1503
|
+
_resourceId = _ref40.resource_id,
|
|
1504
|
+
_summary = _ref40.summary,
|
|
1505
|
+
_lastOrderInfo = _ref40.lastOrderInfo,
|
|
1506
|
+
_paidAmount = _ref40.paid_amount,
|
|
1507
|
+
_shopId = _ref40.shop_id,
|
|
1508
|
+
_shopNote = _ref40.shop_note,
|
|
1509
|
+
_shopServiceType = _ref40.shop_service_type,
|
|
1510
|
+
_startTime = _ref40.start_time,
|
|
1511
|
+
_customer = _ref40.customer,
|
|
1512
|
+
_discountList = _ref40.discount_list,
|
|
1513
|
+
_orderMetaList = _ref40.order_meta_list,
|
|
1514
|
+
_rootTaxFee = _ref40.tax_fee,
|
|
1515
|
+
_totalAmount = _ref40.total_amount,
|
|
1516
|
+
_totalRefundAmount = _ref40.total_refund_amount,
|
|
1517
|
+
_createDate = _ref40.create_date,
|
|
1518
|
+
_holderId = _ref40.holder_id,
|
|
1519
|
+
_paymentStatus = _ref40.payment_status,
|
|
1520
|
+
_notes = _ref40.notes,
|
|
1521
|
+
tempOrderRest = _objectWithoutProperties(_ref40, _excluded4);
|
|
1522
1522
|
var resolvedBusinessCode = businessCode !== null && businessCode !== void 0 ? businessCode : tempOrder.business_code;
|
|
1523
1523
|
var normalizedOrderMetaList = normalizeOrderMetaList(tempOrder.order_meta_list);
|
|
1524
1524
|
var submitType = resolveSubmitOrderType({
|
|
@@ -1545,7 +1545,7 @@ export function buildSubmitPayload(params) {
|
|
|
1545
1545
|
type: submitType,
|
|
1546
1546
|
business_code: resolvedBusinessCode,
|
|
1547
1547
|
sales_channel: tempOrder.sales_channel || 'my_pisel',
|
|
1548
|
-
order_sales_channel: (
|
|
1548
|
+
order_sales_channel: (_ref41 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref41 !== void 0 ? _ref41 : 'online_store',
|
|
1549
1549
|
status: tempOrder.status || 'normal'
|
|
1550
1550
|
}, params.includePaymentStatus !== false ? {
|
|
1551
1551
|
payment_status: tempOrder.payment_status || 'payment_processing'
|
|
@@ -1573,13 +1573,13 @@ export function buildSubmitPayload(params) {
|
|
|
1573
1573
|
// holder: tempOrder.holder || null,
|
|
1574
1574
|
summary: summary || tempOrder.summary || createEmptySummary(),
|
|
1575
1575
|
metadata: function () {
|
|
1576
|
-
var
|
|
1577
|
-
_collectPax =
|
|
1578
|
-
_tableOccupancyDuration =
|
|
1579
|
-
_cartSettlementKey =
|
|
1580
|
-
_cartSettlementSnapshot =
|
|
1581
|
-
_legalCurrencySnapshot =
|
|
1582
|
-
rest = _objectWithoutProperties(
|
|
1576
|
+
var _ref42 = tempOrder.metadata || {},
|
|
1577
|
+
_collectPax = _ref42.collect_pax,
|
|
1578
|
+
_tableOccupancyDuration = _ref42.table_occupancy_duration,
|
|
1579
|
+
_cartSettlementKey = _ref42.cart_settlement_key,
|
|
1580
|
+
_cartSettlementSnapshot = _ref42.cart_settlement_snapshot,
|
|
1581
|
+
_legalCurrencySnapshot = _ref42.legal_currency_snapshot,
|
|
1582
|
+
rest = _objectWithoutProperties(_ref42, _excluded5);
|
|
1583
1583
|
return _objectSpread({}, rest);
|
|
1584
1584
|
}()
|
|
1585
1585
|
}, (_tempOrder$_extend = tempOrder._extend) !== null && _tempOrder$_extend !== void 0 && (_tempOrder$_extend = _tempOrder$_extend.salesNotesState) !== null && _tempOrder$_extend !== void 0 && _tempOrder$_extend.dirty ? {
|
|
@@ -1809,8 +1809,8 @@ export function getRuntimeProductOrigin(tempOrder, product) {
|
|
|
1809
1809
|
return tempOrder._extend.productsByUid[uid].origin;
|
|
1810
1810
|
}
|
|
1811
1811
|
var matchedProduct = ((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || []).find(function (item) {
|
|
1812
|
-
var
|
|
1813
|
-
return item === product || getOrderProductLineUid(item) === uid || String((
|
|
1812
|
+
var _ref43, _item$product_id, _ref44, _product$product_id;
|
|
1813
|
+
return item === product || getOrderProductLineUid(item) === uid || String((_ref43 = (_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : item === null || item === void 0 ? void 0 : item.id) !== null && _ref43 !== void 0 ? _ref43 : '') === String((_ref44 = (_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product === null || product === void 0 ? void 0 : product.id) !== null && _ref44 !== void 0 ? _ref44 : '');
|
|
1814
1814
|
});
|
|
1815
1815
|
var matchedUid = matchedProduct ? getOrderProductLineUid(matchedProduct) : '';
|
|
1816
1816
|
return matchedUid ? (tempOrder === null || tempOrder === void 0 || (_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.productsByUid) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4[matchedUid]) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.origin) || null : null;
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "duration" | "normal" | "session";
|
|
53
53
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { Rules, RulesModuleAPI, DiscountResult, RulesFormSubject, RulesCalcDiscountOptions, UnavailableReason } from './types';
|
|
3
|
+
import { Rules, RulesModuleAPI, DiscountResult, RulesFormSubject, RulesCalcDiscountOptions, RulesCalcDiscountParams, UnavailableReason } from './types';
|
|
4
4
|
import { Discount } from '../Discount/types';
|
|
5
5
|
import { WindowPlugin } from '../../plugins';
|
|
6
6
|
export declare class RulesModule extends BaseModule implements Module, RulesModuleAPI {
|
|
@@ -44,15 +44,8 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
44
44
|
resolveDiscountListForManualOverride(discountList: Discount[]): Discount[];
|
|
45
45
|
private isItemRewardProductDiscount;
|
|
46
46
|
private getUnavailableReason;
|
|
47
|
-
calcDiscount(
|
|
48
|
-
|
|
49
|
-
productList: any[];
|
|
50
|
-
holders: {
|
|
51
|
-
form_record_id: number;
|
|
52
|
-
}[];
|
|
53
|
-
isFormSubject: RulesFormSubject;
|
|
54
|
-
orderTotalAmount: number;
|
|
55
|
-
}, options?: RulesCalcDiscountOptions): DiscountResult;
|
|
47
|
+
calcDiscount(params: RulesCalcDiscountParams, options?: RulesCalcDiscountOptions): DiscountResult;
|
|
48
|
+
private calcDiscountCore;
|
|
56
49
|
/**
|
|
57
50
|
* 检查优惠是否符合 PackageSubItemUsageRules 配置
|
|
58
51
|
* @param discount 优惠券
|