@pisell/pisellos 0.10.8 → 0.10.9

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 (98) hide show
  1. package/dist/core/index.js +0 -1
  2. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
  3. package/dist/model/strategy/adapter/dataVariant/evaluator.js +287 -101
  4. package/dist/model/strategy/adapter/dataVariant/type.d.ts +25 -0
  5. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  6. package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
  7. package/dist/model/strategy/adapter/walletPass/type.d.ts +5 -0
  8. package/dist/model/strategy/adapter/walletPass/utils.js +57 -26
  9. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +7 -3
  10. package/dist/modules/BookingContext/utils/productExtend.js +5 -9
  11. package/dist/modules/BookingContext/utils/timeSlices.js +24 -3
  12. package/dist/modules/Customer/index.d.ts +4 -0
  13. package/dist/modules/Customer/index.js +91 -59
  14. package/dist/modules/Customer/types.d.ts +2 -0
  15. package/dist/modules/Discount/index.d.ts +2 -0
  16. package/dist/modules/Discount/index.js +38 -5
  17. package/dist/modules/Discount/types.d.ts +11 -0
  18. package/dist/modules/Order/index.d.ts +20 -1
  19. package/dist/modules/Order/index.js +976 -730
  20. package/dist/modules/Order/types.d.ts +6 -1
  21. package/dist/modules/Order/utils/virtualSettlement.d.ts +56 -0
  22. package/dist/modules/Order/utils/virtualSettlement.js +271 -0
  23. package/dist/modules/Order/utils.js +89 -48
  24. package/dist/modules/Payment/types.d.ts +2 -0
  25. package/dist/modules/Payment/utils.js +4 -1
  26. package/dist/modules/Payment/walletpass.d.ts +11 -0
  27. package/dist/modules/Payment/walletpass.js +235 -60
  28. package/dist/modules/Product/types.d.ts +23 -0
  29. package/dist/modules/ProductList/index.d.ts +15 -2
  30. package/dist/modules/ProductList/index.js +92 -13
  31. package/dist/modules/SalesSummary/index.d.ts +1 -0
  32. package/dist/modules/SalesSummary/index.js +4 -3
  33. package/dist/modules/SalesSummary/types.d.ts +1 -0
  34. package/dist/modules/SalesSummary/utils.d.ts +1 -0
  35. package/dist/modules/SalesSummary/utils.js +21 -1
  36. package/dist/server/index.d.ts +9 -0
  37. package/dist/server/index.js +90 -58
  38. package/dist/server/modules/order/index.d.ts +1 -0
  39. package/dist/server/modules/order/index.js +252 -94
  40. package/dist/server/utils/small-ticket.js +2 -1
  41. package/dist/solution/BaseSales/index.d.ts +26 -2
  42. package/dist/solution/BaseSales/index.js +1310 -931
  43. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  44. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +78 -12
  45. package/dist/solution/BookingByStep/index.d.ts +3 -3
  46. package/dist/solution/BookingTicket/index.d.ts +5 -1
  47. package/dist/solution/BookingTicket/index.js +221 -159
  48. package/dist/solution/BookingTicket/utils/addProductDecision.js +2 -1
  49. package/dist/solution/ScanOrder/index.js +25 -64
  50. package/lib/core/index.js +0 -1
  51. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
  52. package/lib/model/strategy/adapter/dataVariant/evaluator.js +170 -7
  53. package/lib/model/strategy/adapter/dataVariant/type.d.ts +25 -0
  54. package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
  55. package/lib/model/strategy/adapter/walletPass/type.d.ts +5 -0
  56. package/lib/model/strategy/adapter/walletPass/utils.js +62 -11
  57. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -0
  58. package/lib/modules/BookingContext/utils/productExtend.js +4 -3
  59. package/lib/modules/BookingContext/utils/timeSlices.js +18 -3
  60. package/lib/modules/Customer/index.d.ts +4 -0
  61. package/lib/modules/Customer/index.js +11 -0
  62. package/lib/modules/Customer/types.d.ts +2 -0
  63. package/lib/modules/Discount/index.d.ts +2 -0
  64. package/lib/modules/Discount/index.js +37 -3
  65. package/lib/modules/Discount/types.d.ts +11 -0
  66. package/lib/modules/Order/index.d.ts +20 -1
  67. package/lib/modules/Order/index.js +393 -128
  68. package/lib/modules/Order/types.d.ts +6 -1
  69. package/lib/modules/Order/utils/virtualSettlement.d.ts +56 -0
  70. package/lib/modules/Order/utils/virtualSettlement.js +300 -0
  71. package/lib/modules/Order/utils.js +65 -21
  72. package/lib/modules/Payment/types.d.ts +2 -0
  73. package/lib/modules/Payment/utils.js +5 -1
  74. package/lib/modules/Payment/walletpass.d.ts +11 -0
  75. package/lib/modules/Payment/walletpass.js +198 -17
  76. package/lib/modules/Product/types.d.ts +23 -0
  77. package/lib/modules/ProductList/index.d.ts +15 -2
  78. package/lib/modules/ProductList/index.js +85 -3
  79. package/lib/modules/SalesSummary/index.d.ts +1 -0
  80. package/lib/modules/SalesSummary/index.js +10 -2
  81. package/lib/modules/SalesSummary/types.d.ts +1 -0
  82. package/lib/modules/SalesSummary/utils.d.ts +1 -0
  83. package/lib/modules/SalesSummary/utils.js +25 -1
  84. package/lib/server/index.d.ts +9 -0
  85. package/lib/server/index.js +54 -14
  86. package/lib/server/modules/order/index.d.ts +1 -0
  87. package/lib/server/modules/order/index.js +66 -2
  88. package/lib/server/utils/small-ticket.js +1 -1
  89. package/lib/solution/BaseSales/index.d.ts +26 -2
  90. package/lib/solution/BaseSales/index.js +261 -23
  91. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  92. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +61 -11
  93. package/lib/solution/BookingByStep/index.d.ts +3 -3
  94. package/lib/solution/BookingTicket/index.d.ts +5 -1
  95. package/lib/solution/BookingTicket/index.js +30 -2
  96. package/lib/solution/BookingTicket/utils/addProductDecision.js +2 -1
  97. package/lib/solution/ScanOrder/index.js +17 -54
  98. package/package.json +1 -1
@@ -2,7 +2,7 @@ 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"],
4
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"],
5
- _excluded5 = ["collect_pax", "table_occupancy_duration"];
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(); }
@@ -814,9 +814,9 @@ function normalizeSubmitPlatform(platform) {
814
814
  if (lower === 'h5') return 'H5';
815
815
  return value;
816
816
  }
817
-
818
817
  // 后端 checkout 协议字段 option_group_item_id;tempOrder 内部也保持同一字段名。
819
818
  function formatSubmitOptionItems(options) {
819
+ var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
820
820
  if (!Array.isArray(options)) return [];
821
821
  return options.map(function (d) {
822
822
  var _d$add_price;
@@ -826,7 +826,11 @@ function formatSubmitOptionItems(options) {
826
826
  option_group_id: d === null || d === void 0 ? void 0 : d.option_group_id
827
827
  });
828
828
  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;
829
- if (addPrice !== undefined) option.add_price = String(addPrice);
829
+ if (formatOptions.virtualSettlementMode) {
830
+ option.add_price = 0;
831
+ } else if (addPrice !== undefined) {
832
+ option.add_price = String(addPrice);
833
+ }
830
834
  delete option.price;
831
835
  return option;
832
836
  });
@@ -845,6 +849,7 @@ function toMoneyString(value) {
845
849
 
846
850
  // 出站补齐:只输出后端 checkout 协议字段,运行时/详情展示字段不进入 bundle payload。
847
851
  function formatSubmitBundleItems(bundle) {
852
+ var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
848
853
  if (!Array.isArray(bundle)) return [];
849
854
  return bundle.map(function (b) {
850
855
  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;
@@ -855,10 +860,10 @@ function formatSubmitBundleItems(bundle) {
855
860
 
856
861
  // bundle_selling_price 出站存「正净额」:markdown 为 |price| − Σoptions(如 3.70),
857
862
  // markup/原价维持原值;与后端口径一致(price 仍为毛价)。
858
- var sellingPrice = getBundleSellingMagnitude(rawBundle).toFixed(2);
863
+ var sellingPrice = formatOptions.virtualSettlementMode ? '0.00' : getBundleSellingMagnitude(rawBundle).toFixed(2);
859
864
  // payment 价由整单折扣均摊层产出;缺省(无折扣)时与 selling 净额同义。
860
- var paymentPrice = rawBundle.bundle_payment_price !== undefined && rawBundle.bundle_payment_price !== null && rawBundle.bundle_payment_price !== '' ? toMoneyString(rawBundle.bundle_payment_price) : sellingPrice;
861
- 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;
865
+ 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;
866
+ 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;
862
867
  var relationSurchargeIds = Array.isArray(rawBundle.relation_surcharge_ids) ? rawBundle.relation_surcharge_ids : Array.isArray(existedMetadata.relation_surcharge_ids) ? existedMetadata.relation_surcharge_ids : [];
863
868
  var surchargeFee = toMoneyString((_rawBundle$surcharge_ = rawBundle.surcharge_fee) !== null && _rawBundle$surcharge_ !== void 0 ? _rawBundle$surcharge_ : existedMetadata.surcharge_fee);
864
869
  var productDiscountDifference = toBundleNumber(existedMetadata.product_discount_difference, 0);
@@ -866,7 +871,7 @@ function formatSubmitBundleItems(bundle) {
866
871
  var bundleMapId = resolveSubmitBundleMapId(rawBundle);
867
872
  var hasSubmitBundleDiscounts = Array.isArray(rawBundle.discount_list) && rawBundle.discount_list.length > 0;
868
873
  return {
869
- is_charge_tax: (_rawBundle$is_charge_ = rawBundle.is_charge_tax) !== null && _rawBundle$is_charge_ !== void 0 ? _rawBundle$is_charge_ : 0,
874
+ is_charge_tax: formatOptions.virtualSettlementMode ? 0 : (_rawBundle$is_charge_ = rawBundle.is_charge_tax) !== null && _rawBundle$is_charge_ !== void 0 ? _rawBundle$is_charge_ : 0,
870
875
  bundle_variant_id: (_rawBundle$bundle_var = rawBundle.bundle_variant_id) !== null && _rawBundle$bundle_var !== void 0 ? _rawBundle$bundle_var : 0,
871
876
  num: num,
872
877
  quantity: toBundleNumber((_rawBundle$quantity = rawBundle.quantity) !== null && _rawBundle$quantity !== void 0 ? _rawBundle$quantity : rawBundle.num, num),
@@ -877,7 +882,7 @@ function formatSubmitBundleItems(bundle) {
877
882
  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 : '',
878
883
  bundle_selling_price: sellingPrice,
879
884
  bundle_payment_price: paymentPrice,
880
- option: formatSubmitOptionItems(rawBundle.option),
885
+ option: formatSubmitOptionItems(rawBundle.option, formatOptions),
881
886
  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,
882
887
  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,
883
888
  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,
@@ -885,9 +890,9 @@ function formatSubmitBundleItems(bundle) {
885
890
  metadata: _objectSpread(_objectSpread(_objectSpread({}, submitMetadata), hasSubmitBundleDiscounts && bundleMapId !== undefined ? {
886
891
  custom_product_bundle_map_id: bundleMapId
887
892
  } : {}), {}, {
888
- surcharge_fee: surchargeFee,
889
- relation_surcharge_ids: relationSurchargeIds,
890
- product_discount_difference: productDiscountDifference
893
+ surcharge_fee: formatOptions.virtualSettlementMode ? '0.00' : surchargeFee,
894
+ relation_surcharge_ids: formatOptions.virtualSettlementMode ? [] : relationSurchargeIds,
895
+ product_discount_difference: formatOptions.virtualSettlementMode ? '' : productDiscountDifference
891
896
  })
892
897
  };
893
898
  });
@@ -907,10 +912,11 @@ function formatSubmitBundleItems(bundle) {
907
912
  * - `metadata.main_product_selling_price`:含 option、含主商品折扣。
908
913
  * - `metadata.price_schema_version`:schema 版本号(当前 = 2),用于跨端协商价格口径。
909
914
  *
910
- * 本函数不再改造价格字段形状,仅做字段/metadata 裁剪。
915
+ * 法币仅做字段/metadata 裁剪;虚拟币在出站前再次执行零加价与固定单价断言。
911
916
  */
912
917
  function normalizeSubmitProduct(product) {
913
- var _rawMetadata$product_, _submitProduct$produc, _submitProduct$paymen;
918
+ var _ref29, _submitProduct$bundle, _rawMetadata$product_, _rawMetadata$selected, _rawMetadata$selected2, _submitProduct$produc, _submitProduct$paymen;
919
+ var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
914
920
  var _ref28 = product,
915
921
  _runtimeUid = _ref28.unique_identification_number,
916
922
  submitProduct = _objectWithoutProperties(_ref28, _excluded2);
@@ -925,11 +931,15 @@ function normalizeSubmitProduct(product) {
925
931
  delete productRest["product_".concat('option', "_item")];
926
932
  var rawMetadata = submitProduct.metadata || {};
927
933
  var bookingUid = rawMetadata.booking_uid;
934
+ // 兼容历史 BigSale 编辑链路:bundle_edit 曾被写入 metadata,
935
+ // 出站时需提升到商品顶层;套餐未编辑时也必须显式提交 0。
936
+ var hasProductBundle = Array.isArray(submitProduct.product_bundle) && submitProduct.product_bundle.length > 0;
937
+ var bundleEdit = (_ref29 = (_submitProduct$bundle = submitProduct.bundle_edit) !== null && _submitProduct$bundle !== void 0 ? _submitProduct$bundle : rawMetadata.bundle_edit) !== null && _ref29 !== void 0 ? _ref29 : hasProductBundle ? 0 : undefined;
928
938
  var cleanMetadata = {};
929
939
  if (rawMetadata.unique_identification_number) {
930
940
  cleanMetadata.unique_identification_number = rawMetadata.unique_identification_number;
931
941
  }
932
- 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'];
942
+ 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'];
933
943
  for (var _i = 0, _priceMetaKeys = priceMetaKeys; _i < _priceMetaKeys.length; _i++) {
934
944
  var key = _priceMetaKeys[_i];
935
945
  if (rawMetadata[key] !== undefined) {
@@ -946,20 +956,45 @@ function normalizeSubmitProduct(product) {
946
956
  if (rawMetadata.holder_config !== undefined) {
947
957
  cleanMetadata.holder_config = rawMetadata.holder_config;
948
958
  }
959
+ 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);
960
+ if (formatOptions.virtualSettlementMode) {
961
+ Object.assign(cleanMetadata, {
962
+ source_product_price: virtualPrice,
963
+ main_product_original_price: virtualPrice,
964
+ main_product_selling_price: virtualPrice,
965
+ main_product_attached_bundle_selling_price: virtualPrice,
966
+ main_product_attached_bundle_payment_price: virtualPrice,
967
+ main_product_attached_bundle_surcharge_fee: '0.00',
968
+ main_product_attached_bundle_tax_fee: '0.00',
969
+ surcharge_rounding_remainder: '0.00',
970
+ tax_fee_rounding_remainder: '0.00',
971
+ relation_surcharge_ids: [],
972
+ average_discount_amount_rate: '1',
973
+ product_discount_difference: '',
974
+ discountable_flag: 0,
975
+ price_schema_version: 2
976
+ });
977
+ }
949
978
  var productSku = _objectSpread(_objectSpread({}, submitProduct.product_sku && _typeof(submitProduct.product_sku) === 'object' ? submitProduct.product_sku : {}), {}, {
950
- option: formatSubmitOptionItems((_submitProduct$produc = submitProduct.product_sku) === null || _submitProduct$produc === void 0 ? void 0 : _submitProduct$produc.option)
979
+ option: formatSubmitOptionItems((_submitProduct$produc = submitProduct.product_sku) === null || _submitProduct$produc === void 0 ? void 0 : _submitProduct$produc.option, formatOptions)
951
980
  });
952
- return _objectSpread(_objectSpread(_objectSpread({}, productRest), bookingUid ? {
981
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, productRest), formatOptions.virtualSettlementMode ? {
982
+ selling_price: virtualPrice,
983
+ original_price: virtualPrice,
984
+ is_charge_tax: 0
985
+ } : {}), bookingUid ? {
953
986
  booking_uid: bookingUid
987
+ } : {}), bundleEdit !== undefined ? {
988
+ bundle_edit: bundleEdit
954
989
  } : {}), {}, {
955
990
  product_quantity: toBundleNumber(num !== null && num !== void 0 ? num : submitProduct.product_quantity, 1),
956
991
  product_sku: productSku,
957
- discount_list: collectSubmitProductDiscountList(submitProduct),
958
- product_bundle: formatSubmitBundleItems(submitProduct.product_bundle),
992
+ discount_list: formatOptions.virtualSettlementMode ? [] : collectSubmitProductDiscountList(submitProduct),
993
+ product_bundle: formatSubmitBundleItems(submitProduct.product_bundle, formatOptions),
959
994
  metadata: cleanMetadata,
960
995
  // 出站兼容:后端消费 payment_price 字段(行 composite 已减整单折扣均摊)。
961
996
  // 由整单折扣均摊层产出;缺省(无折扣)时与 selling_price 同义。
962
- payment_price: (_submitProduct$paymen = submitProduct.payment_price) !== null && _submitProduct$paymen !== void 0 ? _submitProduct$paymen : submitProduct.selling_price
997
+ payment_price: formatOptions.virtualSettlementMode ? virtualPrice : (_submitProduct$paymen = submitProduct.payment_price) !== null && _submitProduct$paymen !== void 0 ? _submitProduct$paymen : submitProduct.selling_price
963
998
  });
964
999
  }
965
1000
  var SUBMIT_BOOKING_METADATA_WHITELIST = ['unique_identification_number', 'collect_pax', 'capacity', 'holder_id', 'resource_select_type', 'holder'];
@@ -1080,7 +1115,7 @@ export function createDefaultTempOrder(params) {
1080
1115
  };
1081
1116
  }
1082
1117
  export function buildSubmitPayload(params) {
1083
- var _tempOrder$customer_i, _tempOrder$country_ca, _tempOrder$phone, _tempOrder$email, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref30, _tempOrder$is_price_i, _tempOrder$is_deposit, _enhancedPayload$summ;
1118
+ 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, _enhancedPayload$summ;
1084
1119
  var tempOrder = params.tempOrder,
1085
1120
  cacheId = params.cacheId,
1086
1121
  _params$now = params.now,
@@ -1093,26 +1128,27 @@ export function buildSubmitPayload(params) {
1093
1128
  enhance = params.enhance;
1094
1129
  var scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
1095
1130
  var bookingUuid = createUuidV4();
1096
- var _ref29 = tempOrder,
1097
- _extend = _ref29._extend,
1098
- _relationId = _ref29.relation_id,
1099
- _tableFormId = _ref29.table_form_id,
1100
- _resourceId = _ref29.resource_id,
1101
- _summary = _ref29.summary,
1102
- _lastOrderInfo = _ref29.lastOrderInfo,
1103
- _paidAmount = _ref29.paid_amount,
1104
- _shopId = _ref29.shop_id,
1105
- _shopNote = _ref29.shop_note,
1106
- _shopServiceType = _ref29.shop_service_type,
1107
- _startTime = _ref29.start_time,
1108
- _customer = _ref29.customer,
1109
- _discountList = _ref29.discount_list,
1110
- _rootTaxFee = _ref29.tax_fee,
1111
- _totalAmount = _ref29.total_amount,
1112
- _totalRefundAmount = _ref29.total_refund_amount,
1113
- _createDate = _ref29.create_date,
1114
- _holderId = _ref29.holder_id,
1115
- tempOrderRest = _objectWithoutProperties(_ref29, _excluded4);
1131
+ 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';
1132
+ var _ref30 = tempOrder,
1133
+ _extend = _ref30._extend,
1134
+ _relationId = _ref30.relation_id,
1135
+ _tableFormId = _ref30.table_form_id,
1136
+ _resourceId = _ref30.resource_id,
1137
+ _summary = _ref30.summary,
1138
+ _lastOrderInfo = _ref30.lastOrderInfo,
1139
+ _paidAmount = _ref30.paid_amount,
1140
+ _shopId = _ref30.shop_id,
1141
+ _shopNote = _ref30.shop_note,
1142
+ _shopServiceType = _ref30.shop_service_type,
1143
+ _startTime = _ref30.start_time,
1144
+ _customer = _ref30.customer,
1145
+ _discountList = _ref30.discount_list,
1146
+ _rootTaxFee = _ref30.tax_fee,
1147
+ _totalAmount = _ref30.total_amount,
1148
+ _totalRefundAmount = _ref30.total_refund_amount,
1149
+ _createDate = _ref30.create_date,
1150
+ _holderId = _ref30.holder_id,
1151
+ tempOrderRest = _objectWithoutProperties(_ref30, _excluded4);
1116
1152
  var submitType = type !== null && type !== void 0 ? type : tempOrder.type;
1117
1153
  if (!submitType) {
1118
1154
  var _tempOrder$bookings;
@@ -1137,7 +1173,7 @@ export function buildSubmitPayload(params) {
1137
1173
  type: submitType,
1138
1174
  business_code: businessCode !== null && businessCode !== void 0 ? businessCode : tempOrder.business_code,
1139
1175
  sales_channel: tempOrder.sales_channel || 'my_pisel',
1140
- order_sales_channel: (_ref30 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref30 !== void 0 ? _ref30 : 'online_store',
1176
+ order_sales_channel: (_ref31 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref31 !== void 0 ? _ref31 : 'online_store',
1141
1177
  status: tempOrder.status || 'normal',
1142
1178
  payment_status: tempOrder.payment_status || 'payment_processing',
1143
1179
  // shipping_status: tempOrder.shipping_status || 'unfulfilled',
@@ -1163,14 +1199,19 @@ export function buildSubmitPayload(params) {
1163
1199
  // holder: tempOrder.holder || null,
1164
1200
  summary: summary || tempOrder.summary || createEmptySummary(),
1165
1201
  metadata: function () {
1166
- var _ref31 = tempOrder.metadata || {},
1167
- _collectPax = _ref31.collect_pax,
1168
- _tableOccupancyDuration = _ref31.table_occupancy_duration,
1169
- rest = _objectWithoutProperties(_ref31, _excluded5);
1202
+ var _ref32 = tempOrder.metadata || {},
1203
+ _collectPax = _ref32.collect_pax,
1204
+ _tableOccupancyDuration = _ref32.table_occupancy_duration,
1205
+ _cartSettlementKey = _ref32.cart_settlement_key,
1206
+ _cartSettlementSnapshot = _ref32.cart_settlement_snapshot,
1207
+ _legalCurrencySnapshot = _ref32.legal_currency_snapshot,
1208
+ rest = _objectWithoutProperties(_ref32, _excluded5);
1170
1209
  return _objectSpread({}, rest);
1171
1210
  }(),
1172
1211
  products: (tempOrder.products || []).map(function (product) {
1173
- return normalizeSubmitProduct(product);
1212
+ return normalizeSubmitProduct(product, {
1213
+ virtualSettlementMode: virtualSettlementMode
1214
+ });
1174
1215
  })
1175
1216
  });
1176
1217
  if (!enhance) return payload;
@@ -1374,8 +1415,8 @@ export function getRuntimeProductOrigin(tempOrder, product) {
1374
1415
  return tempOrder._extend.productsByUid[uid].origin;
1375
1416
  }
1376
1417
  var matchedProduct = ((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || []).find(function (item) {
1377
- var _ref32, _item$product_id, _ref33, _product$product_id;
1378
- return item === product || getOrderProductLineUid(item) === uid || String((_ref32 = (_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 && _ref32 !== void 0 ? _ref32 : '') === String((_ref33 = (_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 && _ref33 !== void 0 ? _ref33 : '');
1418
+ var _ref33, _item$product_id, _ref34, _product$product_id;
1419
+ return item === product || getOrderProductLineUid(item) === uid || String((_ref33 = (_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 && _ref33 !== void 0 ? _ref33 : '') === String((_ref34 = (_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 && _ref34 !== void 0 ? _ref34 : '');
1379
1420
  });
1380
1421
  var matchedUid = matchedProduct ? getOrderProductLineUid(matchedProduct) : '';
1381
1422
  return matchedUid ? (tempOrder === null || tempOrder === void 0 || (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3[matchedUid]) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.origin) || null : null;
@@ -486,6 +486,8 @@ export interface WalletPassPayment {
486
486
  importWalletAssetsSnapshot: (snapshot: WalletAssetsSnapshot) => WalletAssetsState;
487
487
  /** 设置单张钱包资产的选择状态并重新计算其实际抵扣额。 */
488
488
  selectWalletAsset: (assetId: WalletAssetId, options: SelectWalletAssetOptions) => WalletAssetsState;
489
+ /** 更新已选钱包资产的手动使用金额,并保持原有选择顺序重新计算。 */
490
+ updateWalletAssetAmount: (assetId: WalletAssetId, amount: number) => WalletAssetsState;
489
491
  /** 精确搜索钱包资产;仅当前券可用时自动选择。 */
490
492
  scanWalletAssetAsync: (code: string) => Promise<ScanWalletAssetResult>;
491
493
  /** 清空未确认的钱包资产选择。 */
@@ -12,9 +12,12 @@ export var getAvailableMaxAmount = function getAvailableMaxAmount(data) {
12
12
  */
13
13
  export var formatWalletPassList2PreparePayments = function formatWalletPassList2PreparePayments(list) {
14
14
  var formatted = (list || []).map(function (item) {
15
+ var _ref, _item$actualDeduction;
15
16
  return {
16
17
  voucher_id: item.id || 0,
17
- amount: Number(item.edit_current_amount || getAvailableMaxAmount(item)) || 0,
18
+ // 前端策略重算后的 actualDeduction 才是最终可同步金额;
19
+ // edit_current_amount 只是用户请求值,仍可能被策略和订单剩余金额裁剪。
20
+ amount: Number((_ref = (_item$actualDeduction = item.actualDeduction) !== null && _item$actualDeduction !== void 0 ? _item$actualDeduction : item.edit_current_amount) !== null && _ref !== void 0 ? _ref : getAvailableMaxAmount(item)) || 0,
18
21
  tag: item.tag || '',
19
22
  wallet_pass_usage_unit: item.wallet_pass_usage_unit || {},
20
23
  wallet_pass_use_value: item.wallet_pass_use_value || undefined
@@ -24,6 +24,11 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
24
24
  private emitEvent;
25
25
  private publishWalletAssetsState;
26
26
  private recalculateWalletAssets;
27
+ /**
28
+ * 搜索接口只返回后端 Wallet Pass 数据,不包含前端策略 config。
29
+ * 在资产进入共享选择状态前补齐策略结果,避免增量重算回退到接口状态。
30
+ */
31
+ private formatSearchedWalletPaymentAssets;
27
32
  /** 获取当前缓存中所有支付类 Wallet 资产的扫码 code。 */
28
33
  private getSearchedWalletAssetCodes;
29
34
  /**
@@ -106,7 +111,13 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
106
111
  getWalletAssetsState(): WalletAssetsState;
107
112
  exportWalletAssetsSnapshot(): WalletAssetsSnapshot;
108
113
  importWalletAssetsSnapshot(snapshot: WalletAssetsSnapshot): WalletAssetsState;
114
+ private updateWalletAssetEditAmountInCaches;
109
115
  selectWalletAsset(assetId: WalletAssetId, options: SelectWalletAssetOptions): WalletAssetsState;
116
+ /**
117
+ * 更新已选资产的手动金额。只允许在当前实际抵扣额内向下调整,
118
+ * 金额为 0 时沿用 legacy 行为取消选择。
119
+ */
120
+ updateWalletAssetAmount(assetId: WalletAssetId, amount: number): WalletAssetsState;
110
121
  scanWalletAssetAsync(code: string): Promise<ScanWalletAssetResult>;
111
122
  clearWalletAssetSelection(): WalletAssetsState;
112
123
  setCommittedWalletAssets(committedIds: WalletAssetId[], committedAssets?: any[]): WalletAssetsState;