@pisell/pisellos 2.2.265 → 2.2.267

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 (66) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
  3. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
  4. package/dist/modules/Order/index.d.ts +8 -27
  5. package/dist/modules/Order/index.js +490 -743
  6. package/dist/modules/Order/types.d.ts +1 -33
  7. package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
  8. package/dist/modules/Order/utils.js +5 -8
  9. package/dist/modules/Payment/index.d.ts +0 -2
  10. package/dist/modules/Payment/index.js +50 -79
  11. package/dist/modules/Payment/types.d.ts +27 -29
  12. package/dist/modules/Payment/types.js +3 -5
  13. package/dist/server/index.d.ts +0 -16
  14. package/dist/server/index.js +1036 -1933
  15. package/dist/server/modules/order/index.d.ts +4 -49
  16. package/dist/server/modules/order/index.js +695 -1574
  17. package/dist/server/modules/order/types.d.ts +3 -11
  18. package/dist/server/modules/order/types.js +1 -1
  19. package/dist/solution/BaseSales/index.d.ts +11 -42
  20. package/dist/solution/BaseSales/index.js +385 -676
  21. package/dist/solution/BaseSales/utils/cartPromotion.js +5 -3
  22. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  23. package/dist/solution/BookingTicket/index.d.ts +1 -1
  24. package/dist/solution/BookingTicket/index.js +1 -2
  25. package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
  26. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  27. package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
  28. package/dist/solution/Sales/index.d.ts +0 -1
  29. package/dist/solution/Sales/index.js +2 -10
  30. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  31. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
  32. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
  33. package/lib/modules/Order/index.d.ts +8 -27
  34. package/lib/modules/Order/index.js +69 -184
  35. package/lib/modules/Order/types.d.ts +1 -33
  36. package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
  37. package/lib/modules/Order/utils.js +3 -5
  38. package/lib/modules/Payment/index.d.ts +0 -2
  39. package/lib/modules/Payment/index.js +13 -34
  40. package/lib/modules/Payment/types.d.ts +27 -29
  41. package/lib/modules/Payment/types.js +3 -3
  42. package/lib/server/index.d.ts +0 -16
  43. package/lib/server/index.js +18 -670
  44. package/lib/server/modules/order/index.d.ts +4 -49
  45. package/lib/server/modules/order/index.js +66 -657
  46. package/lib/server/modules/order/types.d.ts +3 -11
  47. package/lib/solution/BaseSales/index.d.ts +11 -42
  48. package/lib/solution/BaseSales/index.js +35 -214
  49. package/lib/solution/BaseSales/utils/cartPromotion.js +5 -2
  50. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  51. package/lib/solution/BookingTicket/index.d.ts +1 -1
  52. package/lib/solution/BookingTicket/index.js +1 -2
  53. package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
  54. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  55. package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
  56. package/lib/solution/Sales/index.d.ts +0 -1
  57. package/lib/solution/Sales/index.js +3 -5
  58. package/package.json +2 -2
  59. package/dist/modules/Order/payment-utils.d.ts +0 -26
  60. package/dist/modules/Order/payment-utils.js +0 -225
  61. package/dist/utils/payment-number.d.ts +0 -9
  62. package/dist/utils/payment-number.js +0 -69
  63. package/lib/modules/Order/payment-utils.d.ts +0 -26
  64. package/lib/modules/Order/payment-utils.js +0 -224
  65. package/lib/utils/payment-number.d.ts +0 -9
  66. package/lib/utils/payment-number.js +0 -64
@@ -426,11 +426,13 @@ function getProductLineNoteSignature(product) {
426
426
  }
427
427
 
428
428
  /**
429
- * 编辑订单时,历史行仍参与整车促销评估,但不能与本次新增行合并。
430
- * 以历史行 uid 作为促销前后的行边界;新增行返回空边界,仍保留原有合并语义。
429
+ * 称重行以及编辑订单历史行都有各自的促销合并边界。
431
430
  */
432
431
  function getPromotionLineMergeBoundary(product) {
433
- var _product$metadata3;
432
+ var _product$product_sku, _product$metadata3;
433
+ if (Number((product === null || product === void 0 || (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.open_sold_weight) || 0) === 1) {
434
+ return "weighing:".concat(getOrderProductUid(product));
435
+ }
434
436
  if ((product === null || product === void 0 || (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.is_edit_for_runtime) !== true) return '';
435
437
  return "edit:".concat(getOrderProductUid(product));
436
438
  }
@@ -82,13 +82,8 @@ export interface ISalesBooking {
82
82
  metadata?: Record<string, any> | null;
83
83
  [key: string]: any;
84
84
  }
85
- export interface ISalesPaymentMetadata extends Record<string, any> {
86
- /** 刷卡机设备快照;OS 不解析内部字段 */
87
- card_reader_snapshot?: Record<string, unknown>;
88
- }
89
85
  export interface ISalesPayment {
90
86
  order_payment_id?: number | null;
91
- payment_number?: string;
92
87
  custom_payment_id?: number;
93
88
  code?: string;
94
89
  name?: string;
@@ -100,7 +95,7 @@ export interface ISalesPayment {
100
95
  status?: string;
101
96
  payment_time?: string | null;
102
97
  service_charge?: Record<string, any> | null;
103
- metadata?: ISalesPaymentMetadata | null;
98
+ metadata?: Record<string, any> | null;
104
99
  [key: string]: any;
105
100
  }
106
101
  export interface ISalesSurcharge {
@@ -322,7 +322,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
322
322
  * 获取当前的客户搜索条件
323
323
  * @returns 当前搜索条件
324
324
  */
325
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
325
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
326
326
  /**
327
327
  * 获取客户列表状态(包含滚动加载相关状态)
328
328
  * @returns 客户状态
@@ -1993,8 +1993,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1993
1993
  }, {
1994
1994
  key: "getBookingConfig",
1995
1995
  value: function getBookingConfig() {
1996
- var _this$store$bookingCo;
1997
- return (_this$store$bookingCo = this.store.bookingContext) === null || _this$store$bookingCo === void 0 ? void 0 : _this$store$bookingCo.getBookingConfig();
1996
+ return this.store.bookingContext.getBookingConfig();
1998
1997
  }
1999
1998
 
2000
1999
  /** 写入资源全集(来源:`/form/schedule`),同步派生 resourcesOriginMap。 */
@@ -7,6 +7,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
7
7
  import dayjs from 'dayjs';
8
8
  import { cacheItemToBookingInput, derivePresetStartTimeFromDate, getProductExtend, getIsAutoClose, isSessionProduct, isBookingProduct, applySessionTimesToExtend, hasActualResourceSelection, productNeedsResourceExtend } from "../../../modules/BookingContext";
9
9
  import { transformBaseProductToOrderProduct } from "../../BaseSales/utils/transformBaseProductToOrderProduct";
10
+ import { buildProductSkuFromCacheItem } from "./weighingProductSku";
10
11
 
11
12
  /**
12
13
  * cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
@@ -322,11 +323,16 @@ function buildBasePayloadFromCacheItem(cacheItem, ctx) {
322
323
  var quantity = (ctx === null || ctx === void 0 ? void 0 : ctx.quantity) != null && ctx.quantity > 0 ? ctx.quantity : (_cacheItem$_extend$qu = cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.quantity) !== null && _cacheItem$_extend$qu !== void 0 ? _cacheItem$_extend$qu : 1;
323
324
  var resolvedPid = (_cacheItem$product_id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id) !== null && _cacheItem$product_id !== void 0 ? _cacheItem$product_id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id;
324
325
  var extend = (cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem._extend) || {};
326
+ var productSku = buildProductSkuFromCacheItem(cacheItem);
325
327
  return {
326
328
  id: (_cacheItem$id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id) !== null && _cacheItem$id !== void 0 ? _cacheItem$id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id,
327
329
  product_id: resolvedPid,
328
330
  variant_id: (_ref5 = (_other$product_varian = other === null || other === void 0 ? void 0 : other.product_variant_id) !== null && _other$product_varian !== void 0 ? _other$product_varian : other === null || other === void 0 ? void 0 : other.variant_id) !== null && _ref5 !== void 0 ? _ref5 : 0,
329
331
  quantity: quantity,
332
+ // 规格弹窗本次选择是 option 权威源,避免目录/旧订单里的空 option 覆盖它。
333
+ product_sku: productSku ? _objectSpread(_objectSpread({}, productSku), {}, {
334
+ option: (other === null || other === void 0 ? void 0 : other.option) || []
335
+ }) : undefined,
330
336
  option: (other === null || other === void 0 ? void 0 : other.option) || [],
331
337
  bundle: (other === null || other === void 0 ? void 0 : other.bundle) || (extend === null || extend === void 0 || (_extend$skuValue = extend.skuValue) === null || _extend$skuValue === void 0 ? void 0 : _extend$skuValue.bundle) || (extend === null || extend === void 0 || (_extend$_skuValue = extend._skuValue) === null || _extend$_skuValue === void 0 ? void 0 : _extend$_skuValue.bundle) || [],
332
338
  unique: other === null || other === void 0 ? void 0 : other.unique,
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 将规格弹窗的称重结果写入订单行权威字段 product_sku。
3
+ * 商品目录已有的 SKU 字段会保留,本次称重结果只覆盖运行态称重字段。
4
+ */
5
+ export declare function buildProductSkuFromCacheItem(cacheItem: Record<string, any> | null | undefined): Record<string, any> | undefined;
@@ -0,0 +1,45 @@
1
+ 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; }
2
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
+ 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; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
5
+ 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); }
6
+ 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); }
7
+ var WEIGHT_UNIT_MAP = {
8
+ KILOGRAMS: 'kg',
9
+ GRAMS: 'g',
10
+ POUNDS: 'lb',
11
+ OUNCES: 'oz'
12
+ };
13
+ function isRecord(value) {
14
+ return Boolean(value) && _typeof(value) === 'object' && !Array.isArray(value);
15
+ }
16
+
17
+ /**
18
+ * 将规格弹窗的称重结果写入订单行权威字段 product_sku。
19
+ * 商品目录已有的 SKU 字段会保留,本次称重结果只覆盖运行态称重字段。
20
+ */
21
+ export function buildProductSkuFromCacheItem(cacheItem) {
22
+ var _cacheItem$_extend, _cacheItem$_extend2, _weighing$unit_weight, _weighing$tare$label, _weighing$tare, _weighing$tare$value, _weighing$tare2, _weighing$weight, _weighing$net_weight;
23
+ var currentSku = isRecord(cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_sku) ? cacheItem.product_sku : undefined;
24
+ var weighing = isRecord(cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.weighing) ? cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.weighing : undefined;
25
+ var hasRuntimeWeighingSku = Number((currentSku === null || currentSku === void 0 ? void 0 : currentSku.open_sold_weight) || 0) === 1 && ((currentSku === null || currentSku === void 0 ? void 0 : currentSku.weight) !== undefined || (currentSku === null || currentSku === void 0 ? void 0 : currentSku.net_weight) !== undefined || (currentSku === null || currentSku === void 0 ? void 0 : currentSku.weight_source) !== undefined);
26
+ var isWeighingSku = Number((currentSku === null || currentSku === void 0 ? void 0 : currentSku.open_sold_weight) || 0) === 1;
27
+
28
+ // 普通商品维持旧转换行为,不把目录侧完整 SKU 引入订单行。
29
+ if (!isWeighingSku && !weighing) return undefined;
30
+ // 新版 SkuDetailModal 已直接生成 product_sku;_extend.weighing 只作为旧调用方回退。
31
+ if (hasRuntimeWeighingSku) return _objectSpread({}, currentSku);
32
+ if (!weighing) return currentSku ? _objectSpread({}, currentSku) : undefined;
33
+ return _objectSpread(_objectSpread({}, currentSku || {}), {}, {
34
+ open_sold_weight: 1,
35
+ unit_data_snapshot: weighing.scalePriceProduct,
36
+ unit: WEIGHT_UNIT_MAP[String(weighing.unit)] || weighing.unit,
37
+ unit_weight: (_weighing$unit_weight = weighing.unit_weight) !== null && _weighing$unit_weight !== void 0 ? _weighing$unit_weight : '1.000',
38
+ unit_price: weighing.unit_price,
39
+ weight_source: weighing.mode,
40
+ tare_name: (_weighing$tare$label = (_weighing$tare = weighing.tare) === null || _weighing$tare === void 0 ? void 0 : _weighing$tare.label) !== null && _weighing$tare$label !== void 0 ? _weighing$tare$label : '',
41
+ tare_weight: (_weighing$tare$value = (_weighing$tare2 = weighing.tare) === null || _weighing$tare2 === void 0 ? void 0 : _weighing$tare2.value) !== null && _weighing$tare$value !== void 0 ? _weighing$tare$value : 0,
42
+ weight: (_weighing$weight = weighing.weight) !== null && _weighing$weight !== void 0 ? _weighing$weight : 0,
43
+ net_weight: (_weighing$net_weight = weighing.net_weight) !== null && _weighing$net_weight !== void 0 ? _weighing$net_weight : 0
44
+ });
45
+ }
@@ -83,7 +83,6 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
83
83
  private getBookingAppointmentStatus;
84
84
  private isBookingIncludedInStats;
85
85
  private getBookingOrderPaymentStatus;
86
- private isUnpaidBooking;
87
86
  private countBookingOrders;
88
87
  private countCompletedBookings;
89
88
  private groupBookingsByResource;
@@ -29,7 +29,6 @@ import dayjs from 'dayjs';
29
29
  import { BaseModule } from "../../modules/BaseModule";
30
30
  import { SalesHooks } from "./types";
31
31
  export * from "./types";
32
- var UNPAID_PAYMENT_STATUSES = new Set(['unpaid', 'partially_paid', 'payment_processing']);
33
32
 
34
33
  /**
35
34
  * Sales 解决方案基础骨架
@@ -416,11 +415,6 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
416
415
  var _booking$order$paymen, _booking$order;
417
416
  return String((_booking$order$paymen = (_booking$order = booking.order) === null || _booking$order === void 0 ? void 0 : _booking$order.payment_status) !== null && _booking$order$paymen !== void 0 ? _booking$order$paymen : '');
418
417
  }
419
- }, {
420
- key: "isUnpaidBooking",
421
- value: function isUnpaidBooking(booking) {
422
- return UNPAID_PAYMENT_STATUSES.has(this.getBookingOrderPaymentStatus(booking));
423
- }
424
418
  }, {
425
419
  key: "countBookingOrders",
426
420
  value: function countBookingOrders(bookings) {
@@ -901,11 +895,9 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
901
895
  });
902
896
  completedBookingList = matchedBookingList.filter(function (booking) {
903
897
  return _this7.getBookingAppointmentStatus(booking) === 'completed';
904
- }); // const unpaidBookingList = matchedBookingList.filter(
905
- // (booking) => this.getBookingOrderPaymentStatus(booking) === 'unpaid' || this.getBookingOrderPaymentStatus(booking) === 'payment_processing',
906
- // );
898
+ });
907
899
  unpaidBookingList = matchedBookingList.filter(function (booking) {
908
- return _this7.isUnpaidBooking(booking);
900
+ return _this7.getBookingOrderPaymentStatus(booking) === 'unpaid' || _this7.getBookingOrderPaymentStatus(booking) === 'payment_processing';
909
901
  });
910
902
  bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList));
911
903
  completedBookings = completedBookingList.map(function (booking) {
@@ -1,49 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/model/strategy/adapter/promotion/index.ts
30
- var promotion_exports = {};
31
- __export(promotion_exports, {
32
- BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
33
- PromotionAdapter: () => import_adapter.PromotionAdapter,
34
- PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
35
- X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
36
- default: () => import_adapter2.default
37
- });
38
- module.exports = __toCommonJS(promotion_exports);
39
- var import_evaluator = require("./evaluator");
40
- var import_adapter = require("./adapter");
41
- var import_adapter2 = __toESM(require("./adapter"));
42
- var import_examples = require("./examples");
43
- // Annotate the CommonJS export names for ESM import in node:
44
- 0 && (module.exports = {
45
- BUY_X_GET_Y_FREE_STRATEGY,
46
- PromotionAdapter,
47
- PromotionEvaluator,
48
- X_ITEMS_FOR_Y_PRICE_STRATEGY
49
- });
@@ -184,7 +184,7 @@ function synthesizeProductResourceFromBooking(booking) {
184
184
  };
185
185
  }
186
186
  function buildCacheItemFromOrderLine(input) {
187
- var _a, _b, _c, _d, _e, _f;
187
+ var _a, _b, _c, _d, _e, _f, _g;
188
188
  const { product, booking, sourceProduct } = input;
189
189
  const resolvedId = product.product_id ?? (sourceProduct == null ? void 0 : sourceProduct.id);
190
190
  const selling = Number(product.selling_price ?? 0);
@@ -259,6 +259,7 @@ function buildCacheItemFromOrderLine(input) {
259
259
  price: (sourceProduct == null ? void 0 : sourceProduct.price) ?? selling,
260
260
  selling_price: product.selling_price,
261
261
  original_price: product.original_price,
262
+ ...Number(((_g = product.product_sku) == null ? void 0 : _g.open_sold_weight) || 0) === 1 ? { product_sku: JSON.parse(JSON.stringify(product.product_sku)) } : {},
262
263
  ...productOptionString ? { product_option_string: productOptionString } : {},
263
264
  _extend: extend,
264
265
  new: 0,
@@ -78,7 +78,7 @@ function mapOrderBundleToOtherBundle(bundle) {
78
78
  });
79
79
  }
80
80
  function buildNormalProductCacheItemFromOrderLine(input) {
81
- var _a, _b, _c, _d, _e;
81
+ var _a, _b, _c, _d, _e, _f;
82
82
  const { product, sourceProduct } = input;
83
83
  const resolvedId = product.product_id ?? (sourceProduct == null ? void 0 : sourceProduct.id);
84
84
  const sourcePrice = resolveSourceProductPrice(product, sourceProduct);
@@ -144,6 +144,7 @@ function buildNormalProductCacheItemFromOrderLine(input) {
144
144
  note: product.note,
145
145
  order_detail_id: product.order_detail_id ?? null,
146
146
  discount_list: discountList,
147
+ ...Number(((_f = product.product_sku) == null ? void 0 : _f.open_sold_weight) || 0) === 1 ? { product_sku: JSON.parse(JSON.stringify(product.product_sku)) } : {},
147
148
  new: 0,
148
149
  autoClose: true,
149
150
  _extend: extend
@@ -3,7 +3,7 @@ import { BaseModule } from '../BaseModule';
3
3
  import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CheckoutOrderParams, CancelOrderParams, ChangeBookingStatusParams } from './types';
4
4
  import { CartItem } from '../Cart/types';
5
5
  import { type SubmitPayloadEnhancer } from './utils';
6
- import type { OrderAmountSnapshot, AddProductBookingInput, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from './types';
6
+ import type { OrderAmountSnapshot, AddProductBookingInput, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from './types';
7
7
  import type { ICustomer } from '../AccountList/types';
8
8
  import type { Discount } from '../Discount/types';
9
9
  import { UnavailableReason } from '../Rules/types';
@@ -14,7 +14,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
14
14
  private request;
15
15
  private logger;
16
16
  private window;
17
- private appPlugin;
18
17
  private cacheId;
19
18
  private salesSummaryModuleName;
20
19
  private rulesHooksOverride?;
@@ -177,9 +176,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
177
176
  };
178
177
  private calculateDepositPaidAmount;
179
178
  private resolveNextOrderPaymentType;
180
- private getPaymentNumberAppData;
181
- private getPaymentNumberDevicePrefixSync;
182
- private getPaymentNumberDevicePrefixAsync;
183
179
  private normalizePaymentSource;
184
180
  private updateTempOrderPaymentStatus;
185
181
  private shouldKeepPaymentStatusAfterAmountRecalc;
@@ -311,20 +307,19 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
311
307
  * 用一组支付来源覆盖当前订单支付项。
312
308
  *
313
309
  * 入参允许来自 PaymentModule 的 PaymentItem,内部统一映射为 Sales 协议:
314
- * 新支付来源的 uuid 会作为 payment_number 的唯一号段,id -> custom_payment_id,
310
+ * uuid -> metadata.unique_payment_number,id -> custom_payment_id,
315
311
  * isSynced 等运行态字段不会进入 tempOrder.payments。
316
312
  */
317
313
  setOrderPayments(payments: OrderPaymentSource[]): OrderPaymentData[];
318
- /** 同步兼容入口:按调用当下的 device_id 或 LOCAL 生成支付编号。 */
314
+ /** 追加单个支付项,并立即持久化当前 tempOrder。 */
319
315
  addOrderPayment(payment: OrderPaymentSource): OrderPaymentData[];
320
- /** 异步入口:创建支付项时读取最新 IoT 设备短号。 */
321
- addOrderPaymentAsync(payment: OrderPaymentSource): Promise<OrderPaymentData[]>;
322
- private addOrderPaymentWithDevicePrefix;
323
316
  /**
324
- * 默认按支付唯一号精确更新;仅显式指定 legacy 时兼容历史支付标识。
325
- * metadata 与 transactions 会分别合并,避免覆盖支付会话号和已有交易记录。
317
+ * 按支付唯一号、后端支付 ID、自定义支付方式 ID 或旧 uuid 更新支付项。
318
+ *
319
+ * 该方法服务 PaymentModal 的 void / 编辑场景;更新 metadata 时会做浅合并,
320
+ * 避免覆盖 unique_payment_number、现金实付/找零等已有元数据。
326
321
  */
327
- updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>, options?: OrderPaymentUpdateOptions): Promise<OrderPaymentUpdateResult>;
322
+ updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>): OrderPaymentData[];
328
323
  /** 从当前订单支付项中移除指定支付项。 */
329
324
  deleteOrderPayment(paymentIdentity: string | number): OrderPaymentData[];
330
325
  private confirmPendingVoucherPaymentsInList;
@@ -347,11 +342,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
347
342
  */
348
343
  updateVoucherOrderPayments(payments: OrderPaymentSource[], options?: {
349
344
  status?: 'paid' | 'payment_pending';
350
- devicePrefix?: string;
351
345
  }): OrderPaymentData[];
352
- updateVoucherOrderPaymentsAsync(payments: OrderPaymentSource[], options?: {
353
- status?: 'paid' | 'payment_pending';
354
- }): Promise<OrderPaymentData[]>;
355
346
  private shouldMergeProductToOrder;
356
347
  private hasOrderProductLineNote;
357
348
  /**
@@ -436,14 +427,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
436
427
  type?: string;
437
428
  }): import("./types").OrderSubmitPayload;
438
429
  applyLocalPrintOrderNumbers(order?: Record<string, any> | null): Promise<OrderTempOrder>;
439
- saveTempOrderAsDraft<T = any>(params?: {
440
- cacheId?: string;
441
- platform?: string;
442
- businessCode?: string;
443
- channel?: string;
444
- type?: string;
445
- enhancePayload?: SubmitPayloadEnhancer;
446
- }): Promise<T>;
447
430
  /**
448
431
  * 提交当前 Sales tempOrder。
449
432
  *
@@ -548,8 +531,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
548
531
  */
549
532
  private seedAnonymousBookingUidsFromProducts;
550
533
  private normalizeTempOrderForRuntime;
551
- private isSyntheticDraftOrderIdForRuntime;
552
- private withoutSyntheticDraftOrderIdForRuntime;
553
534
  private hydrateLinkedBookingIdentity;
554
535
  private pickHydratedDisplayText;
555
536
  private formatHydratedNamePair;