@pisell/pisellos 2.2.189 → 2.2.191

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 (65) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
  3. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -7
  4. package/dist/modules/Cart/utils/cartProduct.js +13 -2
  5. package/dist/modules/Order/index.d.ts +1 -3
  6. package/dist/modules/Order/index.js +88 -114
  7. package/dist/modules/Order/types.d.ts +10 -6
  8. package/dist/modules/Order/utils.d.ts +9 -2
  9. package/dist/modules/Order/utils.js +36 -13
  10. package/dist/modules/SalesSummary/types.d.ts +3 -1
  11. package/dist/modules/SalesSummary/utils.js +7 -3
  12. package/dist/server/modules/order/index.d.ts +126 -6
  13. package/dist/server/modules/order/index.js +1204 -285
  14. package/dist/server/modules/order/types.d.ts +0 -2
  15. package/dist/server/modules/products/index.d.ts +90 -6
  16. package/dist/server/modules/products/index.js +1017 -361
  17. package/dist/solution/BaseSales/index.js +54 -39
  18. package/dist/solution/BaseSales/types.d.ts +8 -5
  19. package/dist/solution/BaseSales/types.js +2 -3
  20. package/dist/solution/BaseSales/utils/cartPromotion.js +7 -7
  21. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  22. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +29 -14
  23. package/dist/solution/BaseSales/utils.d.ts +1 -1
  24. package/dist/solution/BaseSales/utils.js +22 -19
  25. package/dist/solution/BookingByStep/index.d.ts +1 -1
  26. package/dist/solution/ScanOrder/index.js +7 -5
  27. package/dist/solution/ScanOrder/types.d.ts +8 -5
  28. package/dist/solution/ScanOrder/types.js +2 -3
  29. package/dist/solution/ScanOrder/utils.d.ts +1 -1
  30. package/dist/solution/ScanOrder/utils.js +26 -23
  31. package/dist/solution/VenueBooking/index.js +5 -3
  32. package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  33. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  34. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
  35. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
  36. package/lib/modules/Cart/utils/cartProduct.js +9 -2
  37. package/lib/modules/Order/index.d.ts +1 -3
  38. package/lib/modules/Order/index.js +50 -63
  39. package/lib/modules/Order/types.d.ts +10 -6
  40. package/lib/modules/Order/utils.d.ts +9 -2
  41. package/lib/modules/Order/utils.js +41 -10
  42. package/lib/modules/SalesSummary/types.d.ts +3 -1
  43. package/lib/modules/SalesSummary/utils.js +5 -3
  44. package/lib/server/modules/order/index.d.ts +126 -6
  45. package/lib/server/modules/order/index.js +722 -42
  46. package/lib/server/modules/order/types.d.ts +0 -2
  47. package/lib/server/modules/products/index.d.ts +90 -6
  48. package/lib/server/modules/products/index.js +492 -30
  49. package/lib/solution/BaseSales/index.js +26 -8
  50. package/lib/solution/BaseSales/types.d.ts +8 -5
  51. package/lib/solution/BaseSales/utils/cartPromotion.js +6 -6
  52. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  53. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +32 -16
  54. package/lib/solution/BaseSales/utils.d.ts +1 -1
  55. package/lib/solution/BaseSales/utils.js +11 -7
  56. package/lib/solution/BookingByStep/index.d.ts +1 -1
  57. package/lib/solution/ScanOrder/index.js +4 -4
  58. package/lib/solution/ScanOrder/types.d.ts +8 -5
  59. package/lib/solution/ScanOrder/utils.d.ts +1 -1
  60. package/lib/solution/ScanOrder/utils.js +12 -8
  61. package/lib/solution/VenueBooking/index.js +2 -2
  62. package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  63. package/package.json +1 -1
  64. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  65. package/lib/solution/Checkout/appointmentDemo.json +0 -1
@@ -31,7 +31,7 @@ import { BaseSalesHookNames } from "./types";
31
31
  import { OrderModule } from "../../modules/Order";
32
32
  import Decimal from 'decimal.js';
33
33
  import { createModule } from "../BookingByStep/types";
34
- import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
34
+ import { composeLinePrice, createUuidV4, ensureProductSku, getProductSkuOptions, sumOptionUnitPrice } from "../../modules/Order/utils";
35
35
  import dayjs from 'dayjs';
36
36
  export * from "./types";
37
37
  import { QuotationModule } from "../../modules/Quotation";
@@ -342,7 +342,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
342
342
  _product$num,
343
343
  _ref8,
344
344
  _product$quantity,
345
- _product$product_opti,
346
345
  _product$metadata;
347
346
  if (!authoritativeProduct) return product;
348
347
  var selectedBundles = Array.isArray(product.product_bundle) ? product.product_bundle : [];
@@ -365,7 +364,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
365
364
  product_variant_id: (_ref6 = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : authoritativeProduct.product_variant_id) !== null && _ref6 !== void 0 ? _ref6 : 0,
366
365
  num: (_ref7 = (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : product.quantity) !== null && _ref7 !== void 0 ? _ref7 : authoritativeProduct.num,
367
366
  quantity: (_ref8 = (_product$quantity = product.quantity) !== null && _product$quantity !== void 0 ? _product$quantity : product.num) !== null && _ref8 !== void 0 ? _ref8 : authoritativeProduct.quantity,
368
- product_option_item: (_product$product_opti = product.product_option_item) !== null && _product$product_opti !== void 0 ? _product$product_opti : authoritativeProduct.product_option_item,
367
+ product_sku: function () {
368
+ var authoritativeSku = ensureProductSku(authoritativeProduct);
369
+ var productSku = ensureProductSku(product);
370
+ var hasProductSku = product.product_sku && _typeof(product.product_sku) === 'object';
371
+ return _objectSpread(_objectSpread(_objectSpread({}, authoritativeSku), productSku), {}, {
372
+ option: hasProductSku ? productSku.option : authoritativeSku.option
373
+ });
374
+ }(),
369
375
  product_bundle: productBundle,
370
376
  metadata: (_product$metadata = product.metadata) !== null && _product$metadata !== void 0 ? _product$metadata : authoritativeProduct.metadata
371
377
  });
@@ -1319,7 +1325,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1319
1325
  totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
1320
1326
  return sum + Number(pd.amount || 0);
1321
1327
  }, 0);
1322
- optionSum = sumOptionUnitPrice(product.product_option_item);
1328
+ optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
1323
1329
  sourcePrice = (_product$metadata$sou = (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : '0';
1324
1330
  newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
1325
1331
  newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
@@ -1635,7 +1641,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1635
1641
  totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
1636
1642
  return sum + (pd.amount || 0);
1637
1643
  }, 0); // TODO 这块逻辑需要拿掉
1638
- optionSum = sumOptionUnitPrice(product.product_option_item);
1644
+ optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
1639
1645
  sourcePrice = (_product$metadata$sou2 = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.source_product_price) !== null && _product$metadata$sou2 !== void 0 ? _product$metadata$sou2 : ((_product$metadata9 = product.metadata) === null || _product$metadata9 === void 0 ? void 0 : _product$metadata9.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri2 = product.original_price) !== null && _product$original_pri2 !== void 0 ? _product$original_pri2 : '0';
1640
1646
  newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
1641
1647
  newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
@@ -1789,7 +1795,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1789
1795
  key: "submitSalesOrder",
1790
1796
  value: (function () {
1791
1797
  var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
1792
- var _this$otherParams6, _this$otherParams7, _this$otherParams8;
1798
+ var _this$otherParams6, _this$otherParams7, _this$otherParams8, _this$otherParams9;
1793
1799
  var inferredPaymentStatus, submitParams;
1794
1800
  return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1795
1801
  while (1) switch (_context18.prev = _context18.next) {
@@ -1805,9 +1811,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1805
1811
  submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
1806
1812
  cacheId: this.cacheId,
1807
1813
  platform: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.platform,
1808
- businessCode: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.businessCode,
1814
+ businessCode: ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.businessCode) || ((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.business_code),
1809
1815
  channel: this.getSubmitOrderSalesChannel(),
1810
- type: (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.type
1816
+ type: (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.type
1811
1817
  }, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
1812
1818
  payments: params.payments
1813
1819
  } : {}), inferredPaymentStatus !== undefined ? {
@@ -1847,8 +1853,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1847
1853
  key: "syncPaymentsToOrder",
1848
1854
  value: function () {
1849
1855
  var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
1850
- var _params$channel;
1851
- var channel, syncParams, syncState, payments, syncResult;
1856
+ var _ref9, _params$businessCode, _this$otherParams10, _this$otherParams11, _params$channel;
1857
+ var businessCode, channel, syncParams, syncState, payments, syncResult;
1852
1858
  return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1853
1859
  while (1) switch (_context19.prev = _context19.next) {
1854
1860
  case 0:
@@ -1858,32 +1864,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1858
1864
  }
1859
1865
  throw new Error('order 模块未初始化');
1860
1866
  case 2:
1867
+ businessCode = (_ref9 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.businessCode) !== null && _ref9 !== void 0 ? _ref9 : (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.business_code;
1861
1868
  channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
1862
- syncParams = _objectSpread(_objectSpread({}, params), channel !== undefined ? {
1869
+ syncParams = _objectSpread(_objectSpread(_objectSpread({}, params), businessCode !== undefined ? {
1870
+ businessCode: businessCode
1871
+ } : {}), channel !== undefined ? {
1863
1872
  channel: channel
1864
1873
  } : {});
1865
1874
  syncState = this.store.order.getOrderSyncState();
1866
1875
  if (!(params.submitWhenPaid && syncState === 'submitting')) {
1867
- _context19.next = 7;
1876
+ _context19.next = 8;
1868
1877
  break;
1869
1878
  }
1870
1879
  return _context19.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
1871
- case 7:
1880
+ case 8:
1872
1881
  payments = params.payments || [];
1873
- _context19.next = 10;
1882
+ _context19.next = 11;
1874
1883
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
1875
1884
  payments: payments,
1876
1885
  params: syncParams,
1877
1886
  amountSnapshot: this.store.order.getOrderAmountSnapshot(),
1878
1887
  orderSnapshot: this.store.order.getOrderSnapshot()
1879
1888
  });
1880
- case 10:
1881
- _context19.prev = 10;
1882
- _context19.next = 13;
1889
+ case 11:
1890
+ _context19.prev = 11;
1891
+ _context19.next = 14;
1883
1892
  return this.store.order.syncPaymentsToOrder(syncParams);
1884
- case 13:
1893
+ case 14:
1885
1894
  syncResult = _context19.sent;
1886
- _context19.next = 16;
1895
+ _context19.next = 17;
1887
1896
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
1888
1897
  ok: true,
1889
1898
  syncResult: syncResult,
@@ -1892,12 +1901,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1892
1901
  amountSnapshot: this.store.order.getOrderAmountSnapshot(),
1893
1902
  orderSnapshot: this.store.order.getOrderSnapshot()
1894
1903
  });
1895
- case 16:
1904
+ case 17:
1896
1905
  return _context19.abrupt("return", syncResult);
1897
- case 19:
1898
- _context19.prev = 19;
1899
- _context19.t0 = _context19["catch"](10);
1900
- _context19.next = 23;
1906
+ case 20:
1907
+ _context19.prev = 20;
1908
+ _context19.t0 = _context19["catch"](11);
1909
+ _context19.next = 24;
1901
1910
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
1902
1911
  ok: false,
1903
1912
  error: _context19.t0,
@@ -1906,13 +1915,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1906
1915
  amountSnapshot: this.store.order.getOrderAmountSnapshot(),
1907
1916
  orderSnapshot: this.store.order.getOrderSnapshot()
1908
1917
  });
1909
- case 23:
1910
- throw _context19.t0;
1911
1918
  case 24:
1919
+ throw _context19.t0;
1920
+ case 25:
1912
1921
  case "end":
1913
1922
  return _context19.stop();
1914
1923
  }
1915
- }, _callee19, this, [[10, 19]]);
1924
+ }, _callee19, this, [[11, 20]]);
1916
1925
  }));
1917
1926
  function syncPaymentsToOrder(_x15) {
1918
1927
  return _syncPaymentsToOrder.apply(this, arguments);
@@ -1938,10 +1947,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1938
1947
  }, {
1939
1948
  key: "addOrderPayment",
1940
1949
  value: function addOrderPayment(payment) {
1941
- var _this6 = this;
1950
+ var _this$otherParams12,
1951
+ _this6 = this;
1942
1952
  if (!this.store.order) throw new Error('order 模块未初始化');
1943
1953
  var paymentRecord = payment;
1944
1954
  var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
1955
+ debugger;
1956
+ var shopWalletPassId = (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.shop_wallet_pass_id;
1957
+ if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
1958
+ metadata.shop_wallet_pass_id = shopWalletPassId;
1959
+ }
1945
1960
  if (!metadata.unique_identification_number) {
1946
1961
  metadata.unique_identification_number = createUuidV4();
1947
1962
  }
@@ -2050,7 +2065,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2050
2065
  key: "initWalletData",
2051
2066
  value: function () {
2052
2067
  var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
2053
- var _params$order_wait_pa, _ref9, _tempOrder$is_price_i;
2068
+ var _params$order_wait_pa, _ref10, _tempOrder$is_price_i;
2054
2069
  var snapshot, tempOrder, amount, walletBusinessData, result;
2055
2070
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2056
2071
  while (1) switch (_context20.prev = _context20.next) {
@@ -2093,7 +2108,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2093
2108
  },
2094
2109
  products: this.getWalletProductList(),
2095
2110
  order_wait_pay_amount: (_params$order_wait_pa = params === null || params === void 0 ? void 0 : params.order_wait_pay_amount) !== null && _params$order_wait_pa !== void 0 ? _params$order_wait_pa : Number(amount.amountGap || 0),
2096
- is_price_include_tax: (_ref9 = (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : this.otherParams.is_price_include_tax) !== null && _ref9 !== void 0 ? _ref9 : 1
2111
+ is_price_include_tax: (_ref10 = (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : this.otherParams.is_price_include_tax) !== null && _ref10 !== void 0 ? _ref10 : 1
2097
2112
  }, snapshot.identity.orderId ? {
2098
2113
  payment_order_id: String(snapshot.identity.orderId)
2099
2114
  } : {});
@@ -2209,7 +2224,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2209
2224
  key: "sendCustomerPayLink",
2210
2225
  value: (function () {
2211
2226
  var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
2212
- var orderIds, _ref10, _ref11, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
2227
+ var orderIds, _ref11, _ref12, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
2213
2228
  return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2214
2229
  while (1) switch (_context22.prev = _context22.next) {
2215
2230
  case 0:
@@ -2230,7 +2245,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2230
2245
  });
2231
2246
  case 6:
2232
2247
  submitResult = _context22.sent;
2233
- orderId = (_ref10 = (_ref11 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref11 !== void 0 ? _ref11 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref10 !== void 0 ? _ref10 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
2248
+ orderId = (_ref11 = (_ref12 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref12 !== void 0 ? _ref12 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref11 !== void 0 ? _ref11 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
2234
2249
  if (orderId) {
2235
2250
  _context22.next = 10;
2236
2251
  break;
@@ -2439,8 +2454,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2439
2454
  if (identity.unique_identification_number !== undefined) {
2440
2455
  params.unique_identification_number = identity.unique_identification_number;
2441
2456
  }
2442
- if (identity.product_option_item !== undefined) {
2443
- params.product_option_item = identity.product_option_item;
2457
+ if (identity.product_sku !== undefined) {
2458
+ params.product_sku = identity.product_sku;
2444
2459
  }
2445
2460
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
2446
2461
  _context27.next = 7;
@@ -2587,13 +2602,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2587
2602
  key: "getProductList",
2588
2603
  value: function () {
2589
2604
  var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2590
- var _this$otherParams9;
2605
+ var _this$otherParams13;
2591
2606
  var menu_list_ids, _this$store$products, res;
2592
2607
  return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2593
2608
  while (1) switch (_context30.prev = _context30.next) {
2594
2609
  case 0:
2595
2610
  // 可以直接通过配置里的 menu 读取
2596
- menu_list_ids = ((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 || (_this$otherParams9 = _this$otherParams9.dineInConfig) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9['menu.associated_menus'].map(function (n) {
2611
+ menu_list_ids = ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 || (_this$otherParams13 = _this$otherParams13.dineInConfig) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13['menu.associated_menus'].map(function (n) {
2597
2612
  return Number(n.value);
2598
2613
  })) || [];
2599
2614
  _context30.prev = 1;
@@ -2631,14 +2646,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2631
2646
  key: "setOtherParams",
2632
2647
  value: function () {
2633
2648
  var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
2634
- var _ref12,
2635
- _ref12$cover,
2649
+ var _ref13,
2650
+ _ref13$cover,
2636
2651
  cover,
2637
2652
  _args31 = arguments;
2638
2653
  return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2639
2654
  while (1) switch (_context31.prev = _context31.next) {
2640
2655
  case 0:
2641
- _ref12 = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : {}, _ref12$cover = _ref12.cover, cover = _ref12$cover === void 0 ? false : _ref12$cover;
2656
+ _ref13 = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : {}, _ref13$cover = _ref13.cover, cover = _ref13$cover === void 0 ? false : _ref13$cover;
2642
2657
  if (cover) {
2643
2658
  this.otherParams = params;
2644
2659
  } else {
@@ -41,16 +41,20 @@ export interface BaseSalesOrderProductIdentity {
41
41
  identity_key?: string;
42
42
  unique_identification_number?: string;
43
43
  /** 参与合并/匹配;与 remove 通配语义见 isSkuOnlyDeleteIdentity */
44
- product_option_item?: any[];
44
+ product_sku?: BaseSalesProductSku;
45
45
  product_bundle?: any[];
46
46
  }
47
+ export interface BaseSalesProductSku {
48
+ option: any[];
49
+ [key: string]: any;
50
+ }
47
51
  export interface BaseSalesUpdateOrderProductQuantityParams extends BaseSalesOrderProductIdentity {
48
52
  num: number;
49
53
  }
50
54
  export interface BaseSalesOrderProduct extends BaseSalesOrderProductIdentity {
51
55
  order_detail_id: number | null;
52
56
  num: number;
53
- product_option_item: any[];
57
+ product_sku: BaseSalesProductSku;
54
58
  /**
55
59
  * 券后 **行 composite 单价** = `metadata.main_product_selling_price`
56
60
  * + Σ((bundle.bundle_selling_price ?? bundle.price) × (bundle.num ?? 1))
@@ -96,9 +100,8 @@ export interface BaseSalesOrderProduct extends BaseSalesOrderProductIdentity {
96
100
  * 出站 payload 版本的商品行。
97
101
  *
98
102
  * 与 tempOrder 内部 `BaseSalesOrderProduct` 的字段差异:
99
- * - `product_option_item[*]`:内部为 `{ option_group_item_id, option_group_id, num, price, ... }`,
100
- * 出站保留 `{ option_group_item_id, option_group_id, num }`
101
- * (后端 checkout 协议;丢弃 `price` 等运行时辅助字段)。
103
+ * - `product_sku.option[*]`:内部直接维护统一 Sales 协议字段;
104
+ * 提交时仅规范 `add_price`,保留传入/恢复得到的展示字段。
102
105
  * - `product_bundle[*].option[*]`:同上重命名规则。
103
106
  *
104
107
  * 运行时(UI 显示、加购合并、指纹、持久化)与提交边界统一消费字段名
@@ -19,9 +19,8 @@ export function createBaseSalesHook(moduleName, hookName) {
19
19
  * 出站 payload 版本的商品行。
20
20
  *
21
21
  * 与 tempOrder 内部 `BaseSalesOrderProduct` 的字段差异:
22
- * - `product_option_item[*]`:内部为 `{ option_group_item_id, option_group_id, num, price, ... }`,
23
- * 出站保留 `{ option_group_item_id, option_group_id, num }`
24
- * (后端 checkout 协议;丢弃 `price` 等运行时辅助字段)。
22
+ * - `product_sku.option[*]`:内部直接维护统一 Sales 协议字段;
23
+ * 提交时仅规范 `add_price`,保留传入/恢复得到的展示字段。
25
24
  * - `product_bundle[*].option[*]`:同上重命名规则。
26
25
  *
27
26
  * 运行时(UI 显示、加购合并、指纹、持久化)与提交边界统一消费字段名
@@ -20,7 +20,7 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
20
20
  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; }
21
21
  import Decimal from 'decimal.js';
22
22
  import { cloneDeep } from 'lodash-es';
23
- import { composeLinePrice, sumOptionUnitPrice, createUuidV4 } from "../../../modules/Order/utils";
23
+ import { composeLinePrice, createUuidV4, getProductSkuOptions, sumOptionUnitPrice } from "../../../modules/Order/utils";
24
24
  import { buildProductLineFingerprint, getSafeProductNum } from "../../ScanOrder/utils";
25
25
 
26
26
  /**
@@ -78,7 +78,7 @@ import { buildProductLineFingerprint, getSafeProductNum } from "../../ScanOrder/
78
78
  export function getOrderProductBasePrice(product) {
79
79
  var _ref, _product$original_pri;
80
80
  var metadata = (product === null || product === void 0 ? void 0 : product.metadata) || {};
81
- var optionSum = sumOptionUnitPrice(product === null || product === void 0 ? void 0 : product.product_option_item).toNumber();
81
+ var optionSum = sumOptionUnitPrice(getProductSkuOptions(product)).toNumber();
82
82
  if (metadata.source_product_price !== undefined) {
83
83
  var _v = Number(metadata.source_product_price);
84
84
  return Number.isFinite(_v) ? _v : 0;
@@ -104,7 +104,7 @@ export function getOrderProductBasePrice(product) {
104
104
  export function getOrderProductOriginalPriceForPromotion(product) {
105
105
  var _metadata$_promotion;
106
106
  var metadata = (product === null || product === void 0 ? void 0 : product.metadata) || {};
107
- var optionSum = sumOptionUnitPrice(product === null || product === void 0 ? void 0 : product.product_option_item).toNumber();
107
+ var optionSum = sumOptionUnitPrice(getProductSkuOptions(product)).toNumber();
108
108
  if (metadata.main_product_original_price !== undefined && metadata.main_product_original_price !== null && metadata.main_product_original_price !== '') {
109
109
  var v = Number(metadata.main_product_original_price) - optionSum;
110
110
  if (Number.isFinite(v) && v >= 0) return v;
@@ -160,7 +160,7 @@ var BUY_X_GET_Y_FREE = 'BUY_X_GET_Y_FREE';
160
160
  */
161
161
  function applyPromoUnitPriceToLine(item, input) {
162
162
  var metadata = item.metadata || (item.metadata = {});
163
- var optionSum = sumOptionUnitPrice(item.product_option_item).toNumber();
163
+ var optionSum = sumOptionUnitPrice(getProductSkuOptions(item)).toNumber();
164
164
  var promoUnitPrice = new Decimal(Number(input.promoUnitPrice) || 0).toDecimalPlaces(2).toFixed(2);
165
165
  var mainSelling = new Decimal(Number(promoUnitPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
166
166
  var catalogSource = new Decimal(input.originalBasePrice).toDecimalPlaces(2).toFixed(2);
@@ -241,7 +241,7 @@ export function mergeIdenticalPromotionCartLines(products) {
241
241
  merged.push(line);
242
242
  continue;
243
243
  }
244
- var fingerprint = buildProductLineFingerprint(line.product_option_item, line.product_bundle);
244
+ var fingerprint = buildProductLineFingerprint(getProductSkuOptions(line), line.product_bundle);
245
245
  var unitPrice = String((_ref2 = (_line$metadata$source = (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.source_product_price) !== null && _line$metadata$source !== void 0 ? _line$metadata$source : line.selling_price) !== null && _ref2 !== void 0 ? _ref2 : '');
246
246
  var promoUnitPrice = String((_ref3 = (_promotion$finalPrice = promotion.finalPrice) !== null && _promotion$finalPrice !== void 0 ? _promotion$finalPrice : (_line$metadata3 = line.metadata) === null || _line$metadata3 === void 0 ? void 0 : _line$metadata3.main_product_selling_price) !== null && _ref3 !== void 0 ? _ref3 : '');
247
247
  var bookingUid = (_line$booking_uid = line === null || line === void 0 ? void 0 : line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : line === null || line === void 0 || (_line$metadata4 = line.metadata) === null || _line$metadata4 === void 0 ? void 0 : _line$metadata4.booking_uid;
@@ -452,7 +452,7 @@ function getProductBundleForEvaluator(product) {
452
452
  */
453
453
  export function buildConsolidateKeyForPromotion(item) {
454
454
  var _item$booking_uid, _item$metadata, _item$order_detail_id, _item$product_variant3;
455
- var fingerprint = buildProductLineFingerprint(item.product_option_item, item.product_bundle);
455
+ var fingerprint = buildProductLineFingerprint(getProductSkuOptions(item), item.product_bundle);
456
456
  var bookingUid = (_item$booking_uid = item === null || item === void 0 ? void 0 : item.booking_uid) !== null && _item$booking_uid !== void 0 ? _item$booking_uid : item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.booking_uid;
457
457
  var orderDetailId = (_item$order_detail_id = item === null || item === void 0 ? void 0 : item.order_detail_id) !== null && _item$order_detail_id !== void 0 ? _item$order_detail_id : item === null || item === void 0 ? void 0 : item.orderDetailId;
458
458
  if (orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '') {
@@ -1225,7 +1225,7 @@ export function processCartPromotion(list, evaluator, options) {
1225
1225
  });
1226
1226
  } else {
1227
1227
  // 撤销上一轮促销:还原 selling_price 到 main_product_original_price 派生值
1228
- var optionSum = sumOptionUnitPrice(newItem.product_option_item).toNumber();
1228
+ var optionSum = sumOptionUnitPrice(getProductSkuOptions(newItem)).toNumber();
1229
1229
  var sourceRestore = new Decimal(originalBasePrice).toDecimalPlaces(2).toFixed(2);
1230
1230
  var mainRestore = new Decimal(Number(sourceRestore) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
1231
1231
  metadata.source_product_price = sourceRestore;
@@ -23,6 +23,7 @@ export interface BaseProductDetailPayload {
23
23
  option?: BaseProductDetailOptionItem[];
24
24
  options?: BaseProductDetailOptionItem[];
25
25
  product_option_item?: BaseProductDetailOptionItem[];
26
+ product_sku?: Record<string, any>;
26
27
  bundle?: BaseProductDetailBundleItem[];
27
28
  product_bundle?: BaseProductDetailBundleItem[];
28
29
  unique?: string;
@@ -4,6 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ import { composeLinePrice, normalizeProductSkuOptions, sumOptionUnitPrice } from "../../../modules/Order/utils";
7
8
  import { buildManualProductDiscountItem, mergeManualProductDiscountIntoList, resolveManualDiscountOriginTotal, resolveManualDiscountReasonFromSources, shouldBuildManualProductDiscount } from "../../../modules/Order/utils/manualProductDiscount";
8
9
  function toNumber(value) {
9
10
  var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
@@ -32,15 +33,16 @@ function toPriceString(value) {
32
33
  function normalizeOptionItems(optionItems) {
33
34
  if (!Array.isArray(optionItems)) return [];
34
35
  return optionItems.map(function (optionItem) {
35
- var _ref, _optionItem$price, _optionItem$num;
36
- var optionGroupItemId = toNumber(optionItem === null || optionItem === void 0 ? void 0 : optionItem.id);
36
+ var _optionItem$option_gr, _ref, _optionItem$price, _optionItem$num;
37
+ var optionGroupItemId = toNumber((_optionItem$option_gr = optionItem === null || optionItem === void 0 ? void 0 : optionItem.option_group_item_id) !== null && _optionItem$option_gr !== void 0 ? _optionItem$option_gr : optionItem === null || optionItem === void 0 ? void 0 : optionItem.id);
37
38
  var price = (_ref = (_optionItem$price = optionItem === null || optionItem === void 0 ? void 0 : optionItem.price) !== null && _optionItem$price !== void 0 ? _optionItem$price : optionItem === null || optionItem === void 0 ? void 0 : optionItem.add_price) !== null && _ref !== void 0 ? _ref : 0;
38
- return {
39
+ return _objectSpread(_objectSpread({}, optionItem), {}, {
39
40
  option_group_item_id: optionGroupItemId,
40
41
  option_group_id: toNumber(optionItem === null || optionItem === void 0 ? void 0 : optionItem.option_group_id),
41
42
  num: toSafePositiveInt((_optionItem$num = optionItem === null || optionItem === void 0 ? void 0 : optionItem.num) !== null && _optionItem$num !== void 0 ? _optionItem$num : optionItem === null || optionItem === void 0 ? void 0 : optionItem.quantity, 1),
42
- price: toNumber(price, 0)
43
- };
43
+ add_price: toNumber(price, 0),
44
+ price: undefined
45
+ });
44
46
  });
45
47
  }
46
48
  function normalizeBundleItems(bundleItems) {
@@ -75,7 +77,7 @@ function findVariantById(origin, variantId) {
75
77
  * 注意:这里不生成 identity,缺省时由 OrderModule 自动补齐。
76
78
  */
77
79
  export function transformBaseProductToOrderProduct(params) {
78
- var _ref10, _ref11, _ref12, _payload$product_id, _ref13, _ref14, _payload$product_vari, _payload$_origin, _payload$_origin2, _ref15, _findVariantById, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _payload$price, _ref23, _payload$line_total, _payload$_extend, _ref24, _payload$option, _payload$bundle, _payload$quantity, _payload$_extend2, _extend, _extend2, _ref25, _ref26, _origin$base_price, _ref27, _ref28, _payload$line_total2, _payload$_extend3, _payload$_extend4, _extend3, _payload$_extend5, _payload$_extend6, _ref29, _ref30, _payload$tax_fee, _ref31, _ref32, _payload$is_charge_ta;
80
+ var _ref10, _ref11, _ref12, _payload$product_id, _ref13, _ref14, _payload$product_vari, _payload$_origin, _payload$_origin2, _ref15, _findVariantById, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _payload$price, _ref23, _payload$line_total, _payload$_extend, _ref24, _ref25, _payload$product_sku$, _payload$product_sku, _payload$bundle, _payload$quantity, _payload$_extend2, _extend, _extend2, _ref26, _ref27, _origin$base_price, _ref28, _ref29, _payload$line_total2, _payload$_extend3, _payload$_extend4, _extend3, _payload$_extend5, _payload$_extend6, _ref30, _ref31, _payload$tax_fee, _ref32, _ref33, _payload$is_charge_ta;
79
81
  var payload = params.payload,
80
82
  _params$fallbackProdu = params.fallbackProductId,
81
83
  fallbackProductId = _params$fallbackProdu === void 0 ? null : _params$fallbackProdu;
@@ -90,7 +92,7 @@ export function transformBaseProductToOrderProduct(params) {
90
92
  var sourceProductPrice = toPriceString((_ref16 = (_ref17 = (_ref18 = (_ref19 = (_ref20 = (_ref21 = (_ref22 = (_payload$price = payload.price) !== null && _payload$price !== void 0 ? _payload$price : payload.selling_price) !== null && _ref22 !== void 0 ? _ref22 : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.price) !== null && _ref21 !== void 0 ? _ref21 : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.base_price) !== null && _ref20 !== void 0 ? _ref20 : origin === null || origin === void 0 ? void 0 : origin.price) !== null && _ref19 !== void 0 ? _ref19 : origin === null || origin === void 0 ? void 0 : origin.base_price) !== null && _ref18 !== void 0 ? _ref18 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _ref17 !== void 0 ? _ref17 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.selling_price) !== null && _ref16 !== void 0 ? _ref16 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price, '0.00');
91
93
  var lineCompositeTotal = toPriceString((_ref23 = (_payload$line_total = payload.line_total) !== null && _payload$line_total !== void 0 ? _payload$line_total : payload.total) !== null && _ref23 !== void 0 ? _ref23 : (_payload$_extend = payload._extend) === null || _payload$_extend === void 0 ? void 0 : _payload$_extend.total, sourceProductPrice);
92
94
  var hasPriceOverride = payload.price_override !== undefined && payload.price_override !== null && payload.price_override !== '';
93
- var productOptionItem = normalizeOptionItems((_ref24 = (_payload$option = payload.option) !== null && _payload$option !== void 0 ? _payload$option : payload.options) !== null && _ref24 !== void 0 ? _ref24 : payload.product_option_item);
95
+ var productOptionItem = normalizeProductSkuOptions(normalizeOptionItems((_ref24 = (_ref25 = (_payload$product_sku$ = (_payload$product_sku = payload.product_sku) === null || _payload$product_sku === void 0 ? void 0 : _payload$product_sku.option) !== null && _payload$product_sku$ !== void 0 ? _payload$product_sku$ : payload.option) !== null && _ref25 !== void 0 ? _ref25 : payload.options) !== null && _ref24 !== void 0 ? _ref24 : payload.product_option_item));
94
96
  var productBundle = normalizeBundleItems((_payload$bundle = payload.bundle) !== null && _payload$bundle !== void 0 ? _payload$bundle : payload.product_bundle, hasPriceOverride);
95
97
  // `payload.unique` 是业务侧商品/票务标识,可能在连续加同一商品时重复;
96
98
  // 行级唯一值只接受显式协议字段,缺省交给 OrderModule 生成。
@@ -101,10 +103,10 @@ export function transformBaseProductToOrderProduct(params) {
101
103
  extendOriginTotal: (_payload$_extend2 = payload._extend) === null || _payload$_extend2 === void 0 ? void 0 : _payload$_extend2.origin_total,
102
104
  originExtendOriginTotal: origin === null || origin === void 0 || (_extend = origin._extend) === null || _extend === void 0 ? void 0 : _extend.origin_total,
103
105
  sourceExtendOriginTotal: sourceProduct === null || sourceProduct === void 0 || (_extend2 = sourceProduct._extend) === null || _extend2 === void 0 ? void 0 : _extend2.origin_total,
104
- catalogUnitPrice: (_ref25 = (_ref26 = (_origin$base_price = origin === null || origin === void 0 ? void 0 : origin.base_price) !== null && _origin$base_price !== void 0 ? _origin$base_price : origin === null || origin === void 0 ? void 0 : origin.price) !== null && _ref26 !== void 0 ? _ref26 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price) !== null && _ref25 !== void 0 ? _ref25 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price,
106
+ catalogUnitPrice: (_ref26 = (_ref27 = (_origin$base_price = origin === null || origin === void 0 ? void 0 : origin.base_price) !== null && _origin$base_price !== void 0 ? _origin$base_price : origin === null || origin === void 0 ? void 0 : origin.price) !== null && _ref27 !== void 0 ? _ref27 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price) !== null && _ref26 !== void 0 ? _ref26 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price,
105
107
  quantity: resolvedQuantity
106
108
  });
107
- var sellingTotal = Number((_ref27 = (_ref28 = (_payload$line_total2 = payload.line_total) !== null && _payload$line_total2 !== void 0 ? _payload$line_total2 : payload.total) !== null && _ref28 !== void 0 ? _ref28 : (_payload$_extend3 = payload._extend) === null || _payload$_extend3 === void 0 ? void 0 : _payload$_extend3.total) !== null && _ref27 !== void 0 ? _ref27 : lineCompositeTotal);
109
+ var sellingTotal = Number((_ref28 = (_ref29 = (_payload$line_total2 = payload.line_total) !== null && _payload$line_total2 !== void 0 ? _payload$line_total2 : payload.total) !== null && _ref29 !== void 0 ? _ref29 : (_payload$_extend3 = payload._extend) === null || _payload$_extend3 === void 0 ? void 0 : _payload$_extend3.total) !== null && _ref28 !== void 0 ? _ref28 : lineCompositeTotal);
108
110
  var discountReason = resolveManualDiscountReasonFromSources({
109
111
  discountReason: payload.discount_reason,
110
112
  extendDiscountReason: (_payload$_extend4 = payload._extend) === null || _payload$_extend4 === void 0 ? void 0 : _payload$_extend4.discount_reason,
@@ -123,6 +125,16 @@ export function transformBaseProductToOrderProduct(params) {
123
125
  discountway: (_payload$_extend5 = payload._extend) === null || _payload$_extend5 === void 0 ? void 0 : _payload$_extend5.discountway,
124
126
  discount_per: (_payload$_extend6 = payload._extend) === null || _payload$_extend6 === void 0 ? void 0 : _payload$_extend6.discount_per
125
127
  })) : payload.discount_list || [];
128
+
129
+ // v2:source 不含 option;main_product_* 含 option(与 normalizeOrderProduct 一致)
130
+ var optionSum = sumOptionUnitPrice(productOptionItem).toNumber();
131
+ var mainProductOriginalPrice = toPriceString(Number(sourceProductPrice) + optionSum);
132
+ var bundleOnlyComposite = composeLinePrice({
133
+ mainPrice: 0,
134
+ bundle: productBundle
135
+ });
136
+ var derivedMainSelling = Number(lineCompositeTotal) - Number(bundleOnlyComposite);
137
+ var mainProductSellingPrice = toPriceString(Number.isFinite(derivedMainSelling) && derivedMainSelling >= 0 ? derivedMainSelling : Number(mainProductOriginalPrice));
126
138
  var metadata = _objectSpread(_objectSpread({
127
139
  unique: payload.unique,
128
140
  session: payload.session,
@@ -135,8 +147,9 @@ export function transformBaseProductToOrderProduct(params) {
135
147
  source_shop_id: payload.source_shop_id,
136
148
  origin: origin,
137
149
  source_product_price: sourceProductPrice,
138
- main_product_selling_price: sourceProductPrice,
139
- main_product_original_price: sourceProductPrice
150
+ main_product_selling_price: mainProductSellingPrice,
151
+ main_product_original_price: mainProductOriginalPrice,
152
+ price_schema_version: 2
140
153
  }, hasPriceOverride ? {
141
154
  price_override: String(payload.price_override),
142
155
  is_manual_discount: 1
@@ -151,14 +164,16 @@ export function transformBaseProductToOrderProduct(params) {
151
164
  product_variant_id: productVariantId,
152
165
  unique_identification_number: uniqueIdentificationNumber ? String(uniqueIdentificationNumber) : undefined,
153
166
  num: resolvedQuantity,
154
- product_option_item: productOptionItem,
167
+ product_sku: _objectSpread(_objectSpread({}, payload.product_sku && _typeof(payload.product_sku) === 'object' ? payload.product_sku : {}), {}, {
168
+ option: productOptionItem
169
+ }),
155
170
  product_bundle: productBundle,
156
171
  discount_list: manualDiscountList,
157
172
  // 折后行价由 normalizeOrderProduct 按 main + bundle 合成;手动改价时 bundle 已为分摊后单价
158
173
  selling_price: lineCompositeTotal,
159
174
  original_price: lineOriginalPrice,
160
- tax_fee: toPriceString((_ref29 = (_ref30 = (_payload$tax_fee = payload.tax_fee) !== null && _payload$tax_fee !== void 0 ? _payload$tax_fee : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.tax_fee) !== null && _ref30 !== void 0 ? _ref30 : origin === null || origin === void 0 ? void 0 : origin.tax_fee) !== null && _ref29 !== void 0 ? _ref29 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.tax_fee, '0.00'),
161
- is_charge_tax: toNumber((_ref31 = (_ref32 = (_payload$is_charge_ta = payload.is_charge_tax) !== null && _payload$is_charge_ta !== void 0 ? _payload$is_charge_ta : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.is_charge_tax) !== null && _ref32 !== void 0 ? _ref32 : origin === null || origin === void 0 ? void 0 : origin.is_charge_tax) !== null && _ref31 !== void 0 ? _ref31 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.is_charge_tax, 0),
175
+ tax_fee: toPriceString((_ref30 = (_ref31 = (_payload$tax_fee = payload.tax_fee) !== null && _payload$tax_fee !== void 0 ? _payload$tax_fee : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.tax_fee) !== null && _ref31 !== void 0 ? _ref31 : origin === null || origin === void 0 ? void 0 : origin.tax_fee) !== null && _ref30 !== void 0 ? _ref30 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.tax_fee, '0.00'),
176
+ is_charge_tax: toNumber((_ref32 = (_ref33 = (_payload$is_charge_ta = payload.is_charge_tax) !== null && _payload$is_charge_ta !== void 0 ? _payload$is_charge_ta : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.is_charge_tax) !== null && _ref33 !== void 0 ? _ref33 : origin === null || origin === void 0 ? void 0 : origin.is_charge_tax) !== null && _ref32 !== void 0 ? _ref32 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.is_charge_tax, 0),
162
177
  metadata: metadata,
163
178
  note: payload.note != null ? String(payload.note) : '',
164
179
  _origin: _objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
@@ -12,7 +12,7 @@ export declare function buildProductLineFingerprint(productOptionItem?: unknown,
12
12
  export declare function getSafeProductNum(num?: number): number;
13
13
  /**
14
14
  * removeProductFromOrder 仅传 SKU 时的通配 identity(对象上未声明选项键)。
15
- * 与显式 `product_option_item: []` 区分:后者只匹配「无选项」行。
15
+ * 与显式 `product_sku: { option: [] }` 区分:后者只匹配「无选项」行。
16
16
  */
17
17
  export declare function isSkuOnlyDeleteIdentity(x: BaseSalesOrderProductIdentity): boolean;
18
18
  /**