@pisell/pisellos 2.3.100 → 2.3.102

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.
Files changed (56) hide show
  1. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
  2. package/dist/model/strategy/adapter/dataVariant/evaluator.js +287 -101
  3. package/dist/model/strategy/adapter/dataVariant/type.d.ts +25 -0
  4. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  5. package/dist/modules/Discount/index.d.ts +2 -0
  6. package/dist/modules/Discount/index.js +38 -5
  7. package/dist/modules/Discount/types.d.ts +11 -0
  8. package/dist/modules/Order/index.d.ts +14 -0
  9. package/dist/modules/Order/index.js +617 -368
  10. package/dist/modules/Order/types.d.ts +11 -3
  11. package/dist/modules/Order/utils/virtualSettlement.d.ts +63 -0
  12. package/dist/modules/Order/utils/virtualSettlement.js +284 -0
  13. package/dist/modules/Order/utils.d.ts +1 -0
  14. package/dist/modules/Order/utils.js +63 -24
  15. package/dist/modules/Product/types.d.ts +23 -0
  16. package/dist/modules/Rules/index.d.ts +5 -0
  17. package/dist/modules/Rules/index.js +27 -12
  18. package/dist/modules/SalesSummary/index.d.ts +1 -0
  19. package/dist/modules/SalesSummary/index.js +4 -3
  20. package/dist/modules/SalesSummary/types.d.ts +1 -0
  21. package/dist/modules/SalesSummary/utils.d.ts +1 -0
  22. package/dist/modules/SalesSummary/utils.js +21 -1
  23. package/dist/solution/BaseSales/index.d.ts +10 -1
  24. package/dist/solution/BaseSales/index.js +1099 -784
  25. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  26. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +72 -9
  27. package/dist/solution/BookingByStep/index.d.ts +2 -2
  28. package/dist/solution/BookingTicket/utils/addProductDecision.js +2 -1
  29. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
  30. package/lib/model/strategy/adapter/dataVariant/evaluator.js +137 -6
  31. package/lib/model/strategy/adapter/dataVariant/type.d.ts +25 -0
  32. package/lib/modules/Discount/index.d.ts +2 -0
  33. package/lib/modules/Discount/index.js +31 -2
  34. package/lib/modules/Discount/types.d.ts +11 -0
  35. package/lib/modules/Order/index.d.ts +14 -0
  36. package/lib/modules/Order/index.js +195 -15
  37. package/lib/modules/Order/types.d.ts +11 -3
  38. package/lib/modules/Order/utils/virtualSettlement.d.ts +63 -0
  39. package/lib/modules/Order/utils/virtualSettlement.js +262 -0
  40. package/lib/modules/Order/utils.d.ts +1 -0
  41. package/lib/modules/Order/utils.js +57 -20
  42. package/lib/modules/Product/types.d.ts +23 -0
  43. package/lib/modules/Rules/index.d.ts +5 -0
  44. package/lib/modules/Rules/index.js +20 -11
  45. package/lib/modules/SalesSummary/index.d.ts +1 -0
  46. package/lib/modules/SalesSummary/index.js +4 -2
  47. package/lib/modules/SalesSummary/types.d.ts +1 -0
  48. package/lib/modules/SalesSummary/utils.d.ts +1 -0
  49. package/lib/modules/SalesSummary/utils.js +17 -1
  50. package/lib/solution/BaseSales/index.d.ts +10 -1
  51. package/lib/solution/BaseSales/index.js +211 -9
  52. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  53. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +38 -0
  54. package/lib/solution/BookingByStep/index.d.ts +2 -2
  55. package/lib/solution/BookingTicket/utils/addProductDecision.js +1 -0
  56. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  var _excluded = ["custom_product_bundle_map_id"],
2
2
  _excluded2 = ["unique_identification_number"],
3
3
  _excluded3 = ["num", "surcharge_fee", "discount_amount", "discount_type", "discountway", "product_discount_reason", "discount_per", "production_code"],
4
- _excluded4 = ["_extend", "relation_id", "table_form_id", "resource_id", "summary", "lastOrderInfo", "paid_amount", "shop_id", "shop_note", "shop_service_type", "start_time", "customer", "discount_list", "tax_fee", "total_amount", "total_refund_amount", "create_date", "holder_id", "notes"],
5
- _excluded5 = ["collect_pax", "table_occupancy_duration"];
4
+ _excluded4 = ["_extend", "relation_id", "table_form_id", "resource_id", "summary", "lastOrderInfo", "paid_amount", "shop_id", "shop_note", "shop_service_type", "start_time", "customer", "discount_list", "tax_fee", "total_amount", "total_refund_amount", "create_date", "holder_id", "payment_status", "notes"],
5
+ _excluded5 = ["collect_pax", "table_occupancy_duration", "cart_settlement_key", "cart_settlement_snapshot", "legal_currency_snapshot"];
6
6
  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; }
7
7
  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; }
8
8
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
@@ -823,6 +823,7 @@ function normalizeSubmitProductionCode(value) {
823
823
 
824
824
  // 后端 checkout 协议字段 option_group_item_id;tempOrder 内部也保持同一字段名。
825
825
  function formatSubmitOptionItems(options) {
826
+ var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
826
827
  if (!Array.isArray(options)) return [];
827
828
  return options.map(function (d) {
828
829
  var _d$add_price;
@@ -835,7 +836,11 @@ function formatSubmitOptionItems(options) {
835
836
  delete option.production_code;
836
837
  if (productionCode !== undefined) option.production_code = productionCode;
837
838
  var addPrice = (_d$add_price = d === null || d === void 0 ? void 0 : d.add_price) !== null && _d$add_price !== void 0 ? _d$add_price : d === null || d === void 0 ? void 0 : d.price;
838
- if (addPrice !== undefined) option.add_price = String(addPrice);
839
+ if (formatOptions.virtualSettlementMode) {
840
+ option.add_price = 0;
841
+ } else if (addPrice !== undefined) {
842
+ option.add_price = String(addPrice);
843
+ }
839
844
  delete option.price;
840
845
  return option;
841
846
  });
@@ -854,6 +859,7 @@ function toMoneyString(value) {
854
859
 
855
860
  // 出站补齐:只输出后端 checkout 协议字段,运行时/详情展示字段不进入 bundle payload。
856
861
  function formatSubmitBundleItems(bundle) {
862
+ var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
857
863
  if (!Array.isArray(bundle)) return [];
858
864
  return bundle.map(function (b) {
859
865
  var _ref25, _rawBundle$price, _rawBundle$surcharge_, _rawBundle$num, _rawBundle$is_charge_, _rawBundle$bundle_var, _rawBundle$quantity, _rawBundle$extension_, _rawBundle$extension_2, _ref26, _rawBundle$price_type, _ref27, _rawBundle$price_type2, _rawBundle$bundle_gro, _rawBundle$bundle_id, _rawBundle$bundle_pro;
@@ -864,10 +870,10 @@ function formatSubmitBundleItems(bundle) {
864
870
 
865
871
  // bundle_selling_price 出站存「正净额」:markdown 为 |price| − Σoptions(如 3.70),
866
872
  // markup/原价维持原值;与后端口径一致(price 仍为毛价)。
867
- var sellingPrice = getBundleSellingMagnitude(rawBundle).toFixed(2);
873
+ var sellingPrice = formatOptions.virtualSettlementMode ? '0.00' : getBundleSellingMagnitude(rawBundle).toFixed(2);
868
874
  // payment 价由整单折扣均摊层产出;缺省(无折扣)时与 selling 净额同义。
869
- var paymentPrice = rawBundle.bundle_payment_price !== undefined && rawBundle.bundle_payment_price !== null && rawBundle.bundle_payment_price !== '' ? toMoneyString(rawBundle.bundle_payment_price) : sellingPrice;
870
- var priceValue = (_ref25 = (_rawBundle$price = rawBundle.price) !== null && _rawBundle$price !== void 0 ? _rawBundle$price : rawBundle.custom_price) !== null && _ref25 !== void 0 ? _ref25 : rawBundle.bundle_selling_price;
875
+ 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;
876
+ var priceValue = formatOptions.virtualSettlementMode ? 0 : (_ref25 = (_rawBundle$price = rawBundle.price) !== null && _rawBundle$price !== void 0 ? _rawBundle$price : rawBundle.custom_price) !== null && _ref25 !== void 0 ? _ref25 : rawBundle.bundle_selling_price;
871
877
  var relationSurchargeIds = Array.isArray(rawBundle.relation_surcharge_ids) ? rawBundle.relation_surcharge_ids : Array.isArray(existedMetadata.relation_surcharge_ids) ? existedMetadata.relation_surcharge_ids : [];
872
878
  var surchargeFee = toMoneyString((_rawBundle$surcharge_ = rawBundle.surcharge_fee) !== null && _rawBundle$surcharge_ !== void 0 ? _rawBundle$surcharge_ : existedMetadata.surcharge_fee);
873
879
  var productDiscountDifference = toBundleNumber(existedMetadata.product_discount_difference, 0);
@@ -876,7 +882,7 @@ function formatSubmitBundleItems(bundle) {
876
882
  var hasSubmitBundleDiscounts = Array.isArray(rawBundle.discount_list) && rawBundle.discount_list.length > 0;
877
883
  var productionCode = normalizeSubmitProductionCode(rawBundle.production_code);
878
884
  return _objectSpread(_objectSpread({
879
- is_charge_tax: (_rawBundle$is_charge_ = rawBundle.is_charge_tax) !== null && _rawBundle$is_charge_ !== void 0 ? _rawBundle$is_charge_ : 0,
885
+ is_charge_tax: formatOptions.virtualSettlementMode ? 0 : (_rawBundle$is_charge_ = rawBundle.is_charge_tax) !== null && _rawBundle$is_charge_ !== void 0 ? _rawBundle$is_charge_ : 0,
880
886
  bundle_variant_id: (_rawBundle$bundle_var = rawBundle.bundle_variant_id) !== null && _rawBundle$bundle_var !== void 0 ? _rawBundle$bundle_var : 0
881
887
  }, productionCode !== undefined ? {
882
888
  production_code: productionCode
@@ -890,7 +896,7 @@ function formatSubmitBundleItems(bundle) {
890
896
  price_type_ext: (_ref27 = (_rawBundle$price_type2 = rawBundle.price_type_ext) !== null && _rawBundle$price_type2 !== void 0 ? _rawBundle$price_type2 : rawBundle.custom_price_type_ext) !== null && _ref27 !== void 0 ? _ref27 : '',
891
897
  bundle_selling_price: sellingPrice,
892
898
  bundle_payment_price: paymentPrice,
893
- option: formatSubmitOptionItems(rawBundle.option),
899
+ option: formatSubmitOptionItems(rawBundle.option, formatOptions),
894
900
  bundle_group_id: (_rawBundle$bundle_gro = rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle.bundle_group_id) !== null && _rawBundle$bundle_gro !== void 0 ? _rawBundle$bundle_gro : rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle.group_id,
895
901
  bundle_id: (_rawBundle$bundle_id = rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle.bundle_id) !== null && _rawBundle$bundle_id !== void 0 ? _rawBundle$bundle_id : rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle.id,
896
902
  bundle_product_id: (_rawBundle$bundle_pro = rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle.bundle_product_id) !== null && _rawBundle$bundle_pro !== void 0 ? _rawBundle$bundle_pro : rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle._bundle_product_id,
@@ -898,9 +904,9 @@ function formatSubmitBundleItems(bundle) {
898
904
  metadata: _objectSpread(_objectSpread(_objectSpread({}, submitMetadata), hasSubmitBundleDiscounts && bundleMapId !== undefined ? {
899
905
  custom_product_bundle_map_id: bundleMapId
900
906
  } : {}), {}, {
901
- surcharge_fee: surchargeFee,
902
- relation_surcharge_ids: relationSurchargeIds,
903
- product_discount_difference: productDiscountDifference
907
+ surcharge_fee: formatOptions.virtualSettlementMode ? '0.00' : surchargeFee,
908
+ relation_surcharge_ids: formatOptions.virtualSettlementMode ? [] : relationSurchargeIds,
909
+ product_discount_difference: formatOptions.virtualSettlementMode ? '' : productDiscountDifference
904
910
  })
905
911
  });
906
912
  });
@@ -920,10 +926,11 @@ function formatSubmitBundleItems(bundle) {
920
926
  * - `metadata.main_product_selling_price`:含 option、含主商品折扣。
921
927
  * - `metadata.price_schema_version`:schema 版本号(当前 = 2),用于跨端协商价格口径。
922
928
  *
923
- * 本函数不再改造价格字段形状,仅做字段/metadata 裁剪。
929
+ * 法币仅做字段/metadata 裁剪;虚拟币在出站前再次执行零加价与固定单价断言。
924
930
  */
925
931
  function normalizeSubmitProduct(product) {
926
- var _ref29, _submitProduct$bundle, _rawMetadata$product_, _submitProduct$produc, _submitProduct$paymen;
932
+ var _ref29, _submitProduct$bundle, _rawMetadata$product_, _rawMetadata$selected, _rawMetadata$selected2, _submitProduct$produc, _submitProduct$paymen;
933
+ var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
927
934
  var _ref28 = product,
928
935
  _runtimeUid = _ref28.unique_identification_number,
929
936
  submitProduct = _objectWithoutProperties(_ref28, _excluded2);
@@ -948,7 +955,7 @@ function normalizeSubmitProduct(product) {
948
955
  if (rawMetadata.unique_identification_number) {
949
956
  cleanMetadata.unique_identification_number = rawMetadata.unique_identification_number;
950
957
  }
951
- var priceMetaKeys = ['main_product_original_price', 'main_product_selling_price', 'main_product_attached_bundle_selling_price', 'main_product_attached_bundle_payment_price', 'average_discount_amount_rate', 'source_product_price', 'main_product_attached_bundle_surcharge_fee', 'main_product_attached_bundle_tax_fee', 'surcharge_rounding_remainder', 'tax_fee_rounding_remainder', 'relation_surcharge_ids', 'discountable_flag', 'parent_unique_identification_number', 'product_add_schedule_time'];
958
+ var priceMetaKeys = ['main_product_original_price', 'main_product_selling_price', 'main_product_attached_bundle_selling_price', 'main_product_attached_bundle_payment_price', 'average_discount_amount_rate', 'source_product_price', 'main_product_attached_bundle_surcharge_fee', 'main_product_attached_bundle_tax_fee', 'surcharge_rounding_remainder', 'tax_fee_rounding_remainder', 'relation_surcharge_ids', 'discountable_flag', 'price_schema_version', 'parent_unique_identification_number', 'product_add_schedule_time', 'data_variant_ids'];
952
959
  for (var _i = 0, _priceMetaKeys = priceMetaKeys; _i < _priceMetaKeys.length; _i++) {
953
960
  var key = _priceMetaKeys[_i];
954
961
  if (rawMetadata[key] !== undefined) {
@@ -965,10 +972,33 @@ function normalizeSubmitProduct(product) {
965
972
  if (rawMetadata.holder_config !== undefined) {
966
973
  cleanMetadata.holder_config = rawMetadata.holder_config;
967
974
  }
975
+ var virtualPrice = toMoneyString((_rawMetadata$selected = (_rawMetadata$selected2 = rawMetadata.selected_settlement_snapshot) === null || _rawMetadata$selected2 === void 0 ? void 0 : _rawMetadata$selected2.price) !== null && _rawMetadata$selected !== void 0 ? _rawMetadata$selected : submitProduct.selling_price);
976
+ if (formatOptions.virtualSettlementMode) {
977
+ Object.assign(cleanMetadata, {
978
+ source_product_price: virtualPrice,
979
+ main_product_original_price: virtualPrice,
980
+ main_product_selling_price: virtualPrice,
981
+ main_product_attached_bundle_selling_price: virtualPrice,
982
+ main_product_attached_bundle_payment_price: virtualPrice,
983
+ main_product_attached_bundle_surcharge_fee: '0.00',
984
+ main_product_attached_bundle_tax_fee: '0.00',
985
+ surcharge_rounding_remainder: '0.00',
986
+ tax_fee_rounding_remainder: '0.00',
987
+ relation_surcharge_ids: [],
988
+ average_discount_amount_rate: '1',
989
+ product_discount_difference: '',
990
+ discountable_flag: 0,
991
+ price_schema_version: 2
992
+ });
993
+ }
968
994
  var productSku = _objectSpread(_objectSpread({}, submitProduct.product_sku && _typeof(submitProduct.product_sku) === 'object' ? submitProduct.product_sku : {}), {}, {
969
- option: formatSubmitOptionItems((_submitProduct$produc = submitProduct.product_sku) === null || _submitProduct$produc === void 0 ? void 0 : _submitProduct$produc.option)
995
+ option: formatSubmitOptionItems((_submitProduct$produc = submitProduct.product_sku) === null || _submitProduct$produc === void 0 ? void 0 : _submitProduct$produc.option, formatOptions)
970
996
  });
971
- return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, productRest), productionCode !== undefined ? {
997
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, productRest), formatOptions.virtualSettlementMode ? {
998
+ selling_price: virtualPrice,
999
+ original_price: virtualPrice,
1000
+ is_charge_tax: 0
1001
+ } : {}), productionCode !== undefined ? {
972
1002
  production_code: productionCode
973
1003
  } : {}), bookingUid ? {
974
1004
  booking_uid: bookingUid
@@ -977,12 +1007,12 @@ function normalizeSubmitProduct(product) {
977
1007
  } : {}), {}, {
978
1008
  product_quantity: toBundleNumber(num !== null && num !== void 0 ? num : submitProduct.product_quantity, 1),
979
1009
  product_sku: productSku,
980
- discount_list: collectSubmitProductDiscountList(submitProduct),
981
- product_bundle: formatSubmitBundleItems(submitProduct.product_bundle),
1010
+ discount_list: formatOptions.virtualSettlementMode ? [] : collectSubmitProductDiscountList(submitProduct),
1011
+ product_bundle: formatSubmitBundleItems(submitProduct.product_bundle, formatOptions),
982
1012
  metadata: cleanMetadata,
983
1013
  // 出站兼容:后端消费 payment_price 字段(行 composite 已减整单折扣均摊)。
984
1014
  // 由整单折扣均摊层产出;缺省(无折扣)时与 selling_price 同义。
985
- payment_price: (_submitProduct$paymen = submitProduct.payment_price) !== null && _submitProduct$paymen !== void 0 ? _submitProduct$paymen : submitProduct.selling_price
1015
+ payment_price: formatOptions.virtualSettlementMode ? virtualPrice : (_submitProduct$paymen = submitProduct.payment_price) !== null && _submitProduct$paymen !== void 0 ? _submitProduct$paymen : submitProduct.selling_price
986
1016
  });
987
1017
  }
988
1018
  var SUBMIT_BOOKING_METADATA_WHITELIST = ['unique_identification_number', 'collect_pax', 'capacity', 'holder_id', 'resource_select_type', 'holder'];
@@ -1151,7 +1181,7 @@ export function resolveSubmitOrderType(params) {
1151
1181
  return 'virtual';
1152
1182
  }
1153
1183
  export function buildSubmitPayload(params) {
1154
- var _tempOrder$customer_i, _tempOrder$country_ca, _tempOrder$phone, _tempOrder$email, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref31, _tempOrder$is_price_i, _tempOrder$is_deposit, _tempOrder$_extend, _enhancedPayload$summ;
1184
+ var _tempOrder$metadata2, _tempOrder$customer_i, _tempOrder$country_ca, _tempOrder$phone, _tempOrder$email, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref31, _tempOrder$is_price_i, _tempOrder$is_deposit, _tempOrder$_extend, _enhancedPayload$summ;
1155
1185
  var tempOrder = params.tempOrder,
1156
1186
  cacheId = params.cacheId,
1157
1187
  _params$now = params.now,
@@ -1164,6 +1194,7 @@ export function buildSubmitPayload(params) {
1164
1194
  enhance = params.enhance;
1165
1195
  var scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
1166
1196
  var bookingUuid = createUuidV4();
1197
+ 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';
1167
1198
  var _ref30 = tempOrder,
1168
1199
  _extend = _ref30._extend,
1169
1200
  _relationId = _ref30.relation_id,
@@ -1183,6 +1214,7 @@ export function buildSubmitPayload(params) {
1183
1214
  _totalRefundAmount = _ref30.total_refund_amount,
1184
1215
  _createDate = _ref30.create_date,
1185
1216
  _holderId = _ref30.holder_id,
1217
+ _paymentStatus = _ref30.payment_status,
1186
1218
  _notes = _ref30.notes,
1187
1219
  tempOrderRest = _objectWithoutProperties(_ref30, _excluded4);
1188
1220
  var resolvedBusinessCode = businessCode !== null && businessCode !== void 0 ? businessCode : tempOrder.business_code;
@@ -1194,7 +1226,7 @@ export function buildSubmitPayload(params) {
1194
1226
  tempOrderBusinessCode: tempOrder.business_code,
1195
1227
  bookings: tempOrder.bookings
1196
1228
  });
1197
- var payload = _objectSpread(_objectSpread(_objectSpread({}, tempOrderRest), {}, {
1229
+ var payload = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, tempOrderRest), {}, {
1198
1230
  customer_id: (_tempOrder$customer_i = tempOrder.customer_id) !== null && _tempOrder$customer_i !== void 0 ? _tempOrder$customer_i : 1,
1199
1231
  customer_name: tempOrder.customer_name || 'Walk-In',
1200
1232
  country_calling_code: String((_tempOrder$country_ca = tempOrder.country_calling_code) !== null && _tempOrder$country_ca !== void 0 ? _tempOrder$country_ca : ''),
@@ -1209,8 +1241,10 @@ export function buildSubmitPayload(params) {
1209
1241
  business_code: resolvedBusinessCode,
1210
1242
  sales_channel: tempOrder.sales_channel || 'my_pisel',
1211
1243
  order_sales_channel: (_ref31 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref31 !== void 0 ? _ref31 : 'online_store',
1212
- status: tempOrder.status || 'normal',
1213
- payment_status: tempOrder.payment_status || 'payment_processing',
1244
+ status: tempOrder.status || 'normal'
1245
+ }, params.includePaymentStatus !== false ? {
1246
+ payment_status: tempOrder.payment_status || 'payment_processing'
1247
+ } : {}), {}, {
1214
1248
  // shipping_status: tempOrder.shipping_status || 'unfulfilled',
1215
1249
  is_price_include_tax: (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : 1,
1216
1250
  currency_format: tempOrder.currency_format || 'symbol_first',
@@ -1237,6 +1271,9 @@ export function buildSubmitPayload(params) {
1237
1271
  var _ref32 = tempOrder.metadata || {},
1238
1272
  _collectPax = _ref32.collect_pax,
1239
1273
  _tableOccupancyDuration = _ref32.table_occupancy_duration,
1274
+ _cartSettlementKey = _ref32.cart_settlement_key,
1275
+ _cartSettlementSnapshot = _ref32.cart_settlement_snapshot,
1276
+ _legalCurrencySnapshot = _ref32.legal_currency_snapshot,
1240
1277
  rest = _objectWithoutProperties(_ref32, _excluded5);
1241
1278
  return _objectSpread({}, rest);
1242
1279
  }()
@@ -1246,7 +1283,9 @@ export function buildSubmitPayload(params) {
1246
1283
  })
1247
1284
  } : {}), {}, {
1248
1285
  products: (tempOrder.products || []).map(function (product) {
1249
- return normalizeSubmitProduct(product);
1286
+ return normalizeSubmitProduct(product, {
1287
+ virtualSettlementMode: virtualSettlementMode
1288
+ });
1250
1289
  })
1251
1290
  });
1252
1291
  if (!enhance) return payload;
@@ -23,12 +23,25 @@ export interface ProductDataVariant {
23
23
  module_data_id: number;
24
24
  /** 关联 data_variant_rule.id */
25
25
  data_variant_rule_id: number;
26
+ /** 多货币结算等业务类型 */
27
+ business_type?: 'multi_currency_settlement' | string;
28
+ /** 数据状态;多货币结算仅处理 enable 记录 */
29
+ status?: 'enable' | 'disable' | string;
26
30
  /** 命中策略后覆盖到商品上的字段 */
27
31
  data: Record<string, any>;
28
32
  created_at: string | null;
29
33
  updated_at: string | null;
30
34
  deleted_at: string | null;
31
35
  }
36
+ export interface ProductSettlementOption extends Record<string, any> {
37
+ settlement_type: 'legal_currency' | 'virtual_currency' | string;
38
+ currency_product_id?: number;
39
+ price: string;
40
+ data_variant_id?: number;
41
+ data_variant_rule_id: number | string;
42
+ available: boolean;
43
+ disabled_reason?: string;
44
+ }
32
45
  /**
33
46
  * 商品基本信息接口
34
47
  */
@@ -61,6 +74,8 @@ export interface ProductData {
61
74
  sum_stock: number;
62
75
  /** 商品价格 */
63
76
  price: string;
77
+ /** 当前上下文解析出的可选结算货币 */
78
+ available_settlement_options?: ProductSettlementOption[];
64
79
  /** 商品原价 */
65
80
  original_price: string;
66
81
  /** 商品成本价 */
@@ -239,6 +254,14 @@ export interface ProductData {
239
254
  option_group_count: number;
240
255
  /** 智能定价变体列表,/product/query with dataVariants 返回 */
241
256
  data_variants?: ProductDataVariant[];
257
+ /**
258
+ * 商品接口规则计算结果;data_variant_ids 按优先级从高到低排列。
259
+ * 空数组表示规则已经计算完成但没有命中 Data Variant。
260
+ */
261
+ metadata?: {
262
+ data_variant_ids?: Array<number | string>;
263
+ [key: string]: any;
264
+ };
242
265
  /** 服务时长 */
243
266
  service_times?: any;
244
267
  }
@@ -14,6 +14,11 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
14
14
  setRulesList(rulesList: Rules[]): Promise<void>;
15
15
  getRulesList(): Rules[];
16
16
  getWalletPassEvaluator(): import("../..").WalletPassEvaluator | undefined;
17
+ private normalizeHolderRecordIds;
18
+ /**
19
+ * 特定 form Holder 卡只授权给绑定同一 Holder Record 的商品行。
20
+ * required/isNeedHolder 仅控制是否强制选择 Holder,不参与优惠资格。
21
+ */
17
22
  private checkHolderMatch;
18
23
  isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, orderTotalAmount, holders, isFormSubject, }: {
19
24
  oldDiscountList: Discount[];
@@ -1,6 +1,5 @@
1
1
  var _excluded = ["_original_add_price"],
2
2
  _excluded2 = ["_original_price", "_original_add_price"];
3
- 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); }
4
3
  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; }
5
4
  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; }
6
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; }
@@ -12,6 +11,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
12
11
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
13
12
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
14
13
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
14
+ 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); }
15
15
  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; }
16
16
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
17
17
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -109,24 +109,39 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
109
109
  var _this$window$getWalle, _this$window;
110
110
  return (_this$window$getWalle = (_this$window = this.window).getWalletPassEvaluator) === null || _this$window$getWalle === void 0 ? void 0 : _this$window$getWalle.call(_this$window);
111
111
  }
112
+ }, {
113
+ key: "normalizeHolderRecordIds",
114
+ value: function normalizeHolderRecordIds(value) {
115
+ var records = Array.isArray(value) ? value : [value];
116
+ return Array.from(new Set(records.map(function (record) {
117
+ if (record && _typeof(record) === 'object') {
118
+ return record.form_record_id;
119
+ }
120
+ return record;
121
+ }).filter(function (record) {
122
+ return record !== undefined && record !== null && record !== '' && record !== 0 && record !== '0';
123
+ }).map(String)));
124
+ }
112
125
 
113
- // 商品不需要holder,则不需要判断,直接返回true,商品需要holder但是还没填写,那么暂时不使用带有holder的券,直到填写才去匹配
126
+ /**
127
+ * 特定 form Holder 卡只授权给绑定同一 Holder Record 的商品行。
128
+ * required/isNeedHolder 仅控制是否强制选择 Holder,不参与优惠资格。
129
+ */
114
130
  }, {
115
131
  key: "checkHolderMatch",
116
132
  value: function checkHolderMatch(discount, product, holders) {
117
133
  var _discount$holder;
118
134
  // 非表单类型 holder 视为匹配
119
135
  if (((_discount$holder = discount.holder) === null || _discount$holder === void 0 ? void 0 : _discount$holder.holder_type) !== 'form') return true;
120
- // 主预约holder, 目前(20251124)默认只考虑单个holder的情况
121
- // 旧版 holders[0].form_record_id 新版 holders[0]
122
- var orderHolderId = Array.isArray(holders) && holders.length > 0 ? holders[0].form_record_id || holders[0] : undefined;
123
- var productHolderId = Array.isArray(product.holder_id) ? product.holder_id[0] : product.holder_id;
124
- // 商品不需要选holder,则不对比holder,直接返回true,
125
- if (!product.isNeedHolder) return true;
126
- // 商品需要holder,但父预约及商品都无holder,返回false
127
- if (!orderHolderId && !productHolderId) return false;
128
- // 最终直接匹配 holder 是否相同
129
- return (productHolderId || orderHolderId) === discount.holder.holder_id;
136
+ var discountHolderIds = this.normalizeHolderRecordIds(discount.holder.holder_id);
137
+ if (!discountHolderIds.length) return false;
138
+ var productHolderIds = this.normalizeHolderRecordIds(product.holder_id);
139
+ var candidateHolderIds = productHolderIds.length ? productHolderIds : this.normalizeHolderRecordIds(holders);
140
+ if (!candidateHolderIds.length) return false;
141
+ var discountHolderIdSet = new Set(discountHolderIds);
142
+ return candidateHolderIds.some(function (holderId) {
143
+ return discountHolderIdSet.has(holderId);
144
+ });
130
145
  }
131
146
 
132
147
  // 判断discountList 是否可以对当前productList生效
@@ -30,6 +30,7 @@ export declare class SalesSummaryModule extends BaseModule implements Module, Sa
30
30
  taxRate?: number;
31
31
  shopDiscount?: string | number;
32
32
  channel?: string;
33
+ virtualSettlementMode?: boolean;
33
34
  }): Promise<{
34
35
  tax_title: string;
35
36
  tax_rate: number | undefined;
@@ -213,11 +213,11 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
213
213
  value: function () {
214
214
  var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
215
215
  var _this$otherParams2, _this$store$surcharge, _ref;
216
- var _params$products, products, isPriceIncludeTax, taxRate, shopDiscount, channel, summaryChannel, taxConfig, fatherModuleName, scheduleModuleName, summarySchedule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary, summaryWithTaxMeta;
216
+ var _params$products, products, isPriceIncludeTax, taxRate, shopDiscount, channel, _params$virtualSettle, virtualSettlementMode, summaryChannel, taxConfig, fatherModuleName, scheduleModuleName, summarySchedule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary, summaryWithTaxMeta;
217
217
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
218
218
  while (1) switch (_context4.prev = _context4.next) {
219
219
  case 0:
220
- _params$products = params.products, products = _params$products === void 0 ? [] : _params$products, isPriceIncludeTax = params.isPriceIncludeTax, taxRate = params.taxRate, shopDiscount = params.shopDiscount, channel = params.channel;
220
+ _params$products = params.products, products = _params$products === void 0 ? [] : _params$products, isPriceIncludeTax = params.isPriceIncludeTax, taxRate = params.taxRate, shopDiscount = params.shopDiscount, channel = params.channel, _params$virtualSettle = params.virtualSettlementMode, virtualSettlementMode = _params$virtualSettle === void 0 ? false : _params$virtualSettle;
221
221
  summaryChannel = channel || this.resolveChannel();
222
222
  if (!(summaryChannel !== this.surchargeListChannel)) {
223
223
  _context4.next = 5;
@@ -257,7 +257,8 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
257
257
  surchargeList: this.store.surchargeList,
258
258
  scheduleById: scheduleById,
259
259
  isInScheduleByDate: ScheduleModule.isInScheduleByDate,
260
- shopDiscount: shopDiscount
260
+ shopDiscount: shopDiscount,
261
+ virtualSettlementMode: virtualSettlementMode
261
262
  });
262
263
  summaryWithTaxMeta = _objectSpread(_objectSpread({}, summary), {}, {
263
264
  tax_title: taxConfig.taxTitle || '',
@@ -64,5 +64,6 @@ export interface SalesSummaryModuleAPI {
64
64
  taxRate?: number;
65
65
  shopDiscount?: string | number;
66
66
  channel?: string;
67
+ virtualSettlementMode?: boolean;
67
68
  }): Promise<SalesSummaryData>;
68
69
  }
@@ -8,4 +8,5 @@ export declare function calculateSalesSummary(params: {
8
8
  scheduleById?: Record<string, any>;
9
9
  isInScheduleByDate?: any;
10
10
  shopDiscount?: string | number;
11
+ virtualSettlementMode?: boolean;
11
12
  }): SalesSummaryData;
@@ -1039,12 +1039,32 @@ export function calculateSalesSummary(params) {
1039
1039
  _params$scheduleById = params.scheduleById,
1040
1040
  scheduleById = _params$scheduleById === void 0 ? {} : _params$scheduleById,
1041
1041
  isInScheduleByDate = params.isInScheduleByDate,
1042
- shopDiscount = params.shopDiscount;
1042
+ shopDiscount = params.shopDiscount,
1043
+ _params$virtualSettle = params.virtualSettlementMode,
1044
+ virtualSettlementMode = _params$virtualSettle === void 0 ? false : _params$virtualSettle;
1043
1045
  if (!(products !== null && products !== void 0 && products.length)) return createEmptySalesSummary();
1044
1046
  var summaryProducts = products.filter(function (product) {
1045
1047
  return !isGeneratedVoucherProduct(product);
1046
1048
  });
1047
1049
  if (!summaryProducts.length) return createEmptySalesSummary();
1050
+ if (virtualSettlementMode) {
1051
+ var _productQuantity = summaryProducts.reduce(function (sum, item) {
1052
+ return sum + getSafeNum(item.num);
1053
+ }, 0);
1054
+ var _productAmount = summaryProducts.reduce(function (sum, item) {
1055
+ return sum.plus(toDecimal(item.selling_price).times(getSafeNum(item.num)));
1056
+ }, new Decimal(0));
1057
+ var amount = toFixed2(_productAmount);
1058
+ return _objectSpread(_objectSpread({}, createEmptySalesSummary()), {}, {
1059
+ product_quantity: _productQuantity,
1060
+ product_original_amount: amount,
1061
+ product_amount: amount,
1062
+ product_expect_amount: amount,
1063
+ expect_amount: amount,
1064
+ total_amount: amount,
1065
+ is_price_include_tax: isPriceIncludeTax
1066
+ });
1067
+ }
1048
1068
  var productQuantity = summaryProducts.reduce(function (sum, item) {
1049
1069
  return sum + getSafeNum(item.num);
1050
1070
  }, 0);
@@ -4,7 +4,7 @@ import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentS
4
4
  import { OrderModule } from '../../modules/Order';
5
5
  import type { AddProductBookingInput, AddProductToOrderOptions, LoadSalesDetailParams, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, ReplaceTempOrderOptions, SalesNote, SalesNotesMutationSnapshot, SetSalesNoteInput, PickupReferenceMode, ShopServiceData, ShopServiceType } from '../../modules/Order/types';
6
6
  import type { SubmitPayloadEnhancer } from '../../modules/Order/utils';
7
- import type { Discount } from '../../modules/Discount/types';
7
+ import type { Discount, VirtualCurrencyAsset } from '../../modules/Discount/types';
8
8
  import { RequestPlugin, WindowPlugin } from '../../plugins';
9
9
  export * from './types';
10
10
  import { ProductList } from '../../modules/ProductList';
@@ -193,6 +193,9 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
193
193
  protected setPaymentNumberDevicePrefix(prefix: unknown): void;
194
194
  private getPaymentNumberDevicePrefixSync;
195
195
  private getPaymentNumberDevicePrefixAsync;
196
+ private isMultiCurrencySettlementEnabled;
197
+ private isActiveVirtualSettlementOrder;
198
+ private isHistoricalVirtualSettlementOrder;
196
199
  private syncAppDataToTempOrder;
197
200
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
198
201
  destroy(): Promise<void>;
@@ -253,6 +256,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
253
256
  * 同步清空内存中的 salesDetail 商品/预约视图,避免编辑态仍读到旧 bookings。
254
257
  */
255
258
  clearOrderCartLines(): Promise<OrderTempOrder>;
259
+ /** 切换法币 / WalletPass 单位时清空商品、折扣与支付状态,保留客户。 */
260
+ clearOrderForSettlementSwitch(): Promise<OrderTempOrder>;
256
261
  getOrderProducts(): import("../../modules/Order/types").OrderProduct[];
257
262
  getSummary(): Promise<OrderSummary>;
258
263
  private getHistoricalProductDiscountList;
@@ -263,12 +268,15 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
263
268
  loadDiscountConfig(params?: {
264
269
  customerId?: number;
265
270
  action?: 'create' | 'edit';
271
+ force?: boolean;
266
272
  }): Promise<{
267
273
  productList: Record<string, any>[];
268
274
  discountList: Discount[];
269
275
  availableWalletIds: number[];
276
+ virtualCurrencyList: VirtualCurrencyAsset[];
270
277
  }>;
271
278
  getAvailableWalletIds(): number[];
279
+ getVirtualCurrencyList(): VirtualCurrencyAsset[];
272
280
  bestDiscount(cb?: (result: any) => void): Promise<{
273
281
  productList: Record<string, any>[];
274
282
  discountList: Discount[];
@@ -300,6 +308,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
300
308
  confirmPendingVoucherPayments?: boolean;
301
309
  enhancePayload?: SubmitPayloadEnhancer;
302
310
  }): Promise<T>;
311
+ private buildVirtualSettlementSubmitData;
303
312
  /**
304
313
  * 提交当前 Sales 订单。
305
314
  *