@pisell/pisellos 0.0.231 → 0.0.232

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.
@@ -170,7 +170,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
170
170
  value: (function () {
171
171
  var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
172
172
  var _params$bookings, _params$relation_prod, _params$payments;
173
- var _orderData$bookings, _orderData$relation_p, _orderData$payments, _orderData$payments2, _response$data, orderData, response;
173
+ var _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3, _response$data, orderData, response;
174
174
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
175
175
  while (1) switch (_context3.prev = _context3.next) {
176
176
  case 0:
@@ -196,6 +196,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
196
196
  relation_forms: [],
197
197
  payments: []
198
198
  }, params);
199
+ if ((_orderData$payments = orderData.payments) !== null && _orderData$payments !== void 0 && _orderData$payments.length) {
200
+ orderData.small_ticket_data_flag = 1;
201
+ }
202
+
203
+ // 如果进来的order_id 是真实的,则不需要再传递 bookings 和 relation_products
204
+ if (params.order_id) {
205
+ orderData.bookings = [];
206
+ orderData.relation_products = [];
207
+ }
199
208
  console.log('[Order] 调用后端接口创建订单:', {
200
209
  url: '/order/checkout',
201
210
  orderType: orderData.type,
@@ -204,32 +213,32 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
204
213
  customerId: orderData.customer_id,
205
214
  bookingsCount: ((_orderData$bookings = orderData.bookings) === null || _orderData$bookings === void 0 ? void 0 : _orderData$bookings.length) || 0,
206
215
  relationProductsCount: ((_orderData$relation_p = orderData.relation_products) === null || _orderData$relation_p === void 0 ? void 0 : _orderData$relation_p.length) || 0,
207
- paymentsCount: ((_orderData$payments = orderData.payments) === null || _orderData$payments === void 0 ? void 0 : _orderData$payments.length) || 0,
208
- paymentsMethods: ((_orderData$payments2 = orderData.payments) === null || _orderData$payments2 === void 0 ? void 0 : _orderData$payments2.map(function (p) {
216
+ paymentsCount: ((_orderData$payments2 = orderData.payments) === null || _orderData$payments2 === void 0 ? void 0 : _orderData$payments2.length) || 0,
217
+ paymentsMethods: ((_orderData$payments3 = orderData.payments) === null || _orderData$payments3 === void 0 ? void 0 : _orderData$payments3.map(function (p) {
209
218
  return p.code;
210
219
  })) || []
211
220
  });
212
221
 
213
222
  // 调用后端接口
214
- _context3.next = 6;
223
+ _context3.next = 8;
215
224
  return this.request.post('/order/checkout', orderData);
216
- case 6:
225
+ case 8:
217
226
  response = _context3.sent;
218
227
  console.log('[Order] 订单创建成功,后端响应:', {
219
228
  success: !!response,
220
229
  hasOrderId: !!(response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.order_id || response !== null && response !== void 0 && response.order_id)
221
230
  });
222
231
  return _context3.abrupt("return", response);
223
- case 11:
224
- _context3.prev = 11;
232
+ case 13:
233
+ _context3.prev = 13;
225
234
  _context3.t0 = _context3["catch"](1);
226
235
  console.error('[Order] createOrderByCheckout 创建订单失败:', _context3.t0);
227
236
  throw _context3.t0;
228
- case 15:
237
+ case 17:
229
238
  case "end":
230
239
  return _context3.stop();
231
240
  }
232
- }, _callee3, this, [[1, 11]]);
241
+ }, _callee3, this, [[1, 13]]);
233
242
  }));
234
243
  function createOrderByCheckout(_x4) {
235
244
  return _createOrderByCheckout.apply(this, arguments);
@@ -53,6 +53,8 @@ export interface CheckoutOrderParams {
53
53
  relation_forms?: any[];
54
54
  payments?: PaymentItemData[];
55
55
  customer_id?: string;
56
+ /** 小票数据标记,当有支付项时设置为1 */
57
+ small_ticket_data_flag?: number;
56
58
  [key: string]: any;
57
59
  }
58
60
  /**
@@ -509,7 +509,7 @@ export interface WalletDeductionRecommendParams {
509
509
  /** 前端设置只想要的字段 */
510
510
  expect_columns?: string[];
511
511
  /** 客户id */
512
- customer_id: number;
512
+ customer_id?: number;
513
513
  /** 订单总计金额 */
514
514
  order_expect_amount: number;
515
515
  /** 订单小计金额 */
@@ -61,7 +61,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
61
61
  var totalAmount = Number(amountInfo.subTotal) || Number(amountInfo.totalAmount);
62
62
  var walletParams = {
63
63
  sale_channel: 'kiosk',
64
- customer_id: 9752 || customer_id,
64
+ customer_id: customer_id,
65
65
  order_expect_amount: totalAmount,
66
66
  order_product_amount: totalAmount,
67
67
  order_wait_pay_amount: totalAmount,
@@ -95,6 +95,10 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
95
95
  * 强制重新从服务器获取支付方式列表,更新本地缓存
96
96
  */
97
97
  refreshPaymentMethodsAsync(): Promise<PaymentMethod[]>;
98
+ /**
99
+ * 获取订单原始数据
100
+ */
101
+ getOrderOriginalData(): any;
98
102
  /**
99
103
  * 获取当前订单基础信息
100
104
  *
@@ -411,5 +415,19 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
411
415
  setOtherParams(params: Record<string, any>, { cover }?: {
412
416
  cover?: boolean;
413
417
  }): Promise<void>;
418
+ /**
419
+ * 通过订单ID编辑订单备注
420
+ *
421
+ * 用于修改已同步到后端的订单备注,通常在支付成功后的弹窗中使用
422
+ *
423
+ * @param orderId 后端订单ID
424
+ * @param note 新的订单备注
425
+ * @returns 修改结果
426
+ */
427
+ editOrderNoteByOrderIdAsync(orderId: string | number, note: string): Promise<{
428
+ success: boolean;
429
+ message?: string;
430
+ orderId?: string | number;
431
+ }>;
414
432
  destroy(): Promise<void>;
415
433
  }
@@ -987,12 +987,22 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
987
987
  }
988
988
  return refreshPaymentMethodsAsync;
989
989
  }()
990
+ /**
991
+ * 获取订单原始数据
992
+ */
993
+ )
994
+ }, {
995
+ key: "getOrderOriginalData",
996
+ value: function getOrderOriginalData() {
997
+ var _this$store$currentOr4;
998
+ return (_this$store$currentOr4 = this.store.currentOrder) === null || _this$store$currentOr4 === void 0 ? void 0 : _this$store$currentOr4.order_info;
999
+ }
1000
+
990
1001
  /**
991
1002
  * 获取当前订单基础信息
992
1003
  *
993
1004
  * 返回当前订单的基础信息,包括订单状态、金额、支付状态等
994
1005
  */
995
- )
996
1006
  }, {
997
1007
  key: "getCurrentOrderInfo",
998
1008
  value: function getCurrentOrderInfo() {
@@ -2058,7 +2068,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2058
2068
  key: "needsManualSync",
2059
2069
  value: function needsManualSync() {
2060
2070
  try {
2061
- var _this$store$currentOr4;
2071
+ var _this$store$currentOr5;
2062
2072
  // 检查基础条件
2063
2073
  if (!this.store.currentOrder || this.store.isOrderSynced) {
2064
2074
  return false;
@@ -2079,7 +2089,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2079
2089
  orderUuid: this.store.currentOrder.uuid,
2080
2090
  isOrderSynced: this.store.isOrderSynced,
2081
2091
  remainingAmount: remainingAmount,
2082
- hasPayments: ((_this$store$currentOr4 = this.store.currentOrder.payment) === null || _this$store$currentOr4 === void 0 ? void 0 : _this$store$currentOr4.length) > 0,
2092
+ hasPayments: ((_this$store$currentOr5 = this.store.currentOrder.payment) === null || _this$store$currentOr5 === void 0 ? void 0 : _this$store$currentOr5.length) > 0,
2083
2093
  allPaymentsHaveVoucherId: allPaymentsHaveVoucherId,
2084
2094
  needsManualSync: allPaymentsHaveVoucherId
2085
2095
  });
@@ -2099,7 +2109,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2099
2109
  key: "manualSyncOrderAsync",
2100
2110
  value: (function () {
2101
2111
  var _manualSyncOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
2102
- var orderUuid, oldOrderId, realOrderId, finalOrderId, finalIsVirtual, _this$store$currentOr5, errorMessage;
2112
+ var orderUuid, oldOrderId, realOrderId, finalOrderId, finalIsVirtual, _this$store$currentOr6, errorMessage;
2103
2113
  return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2104
2114
  while (1) switch (_context27.prev = _context27.next) {
2105
2115
  case 0:
@@ -2168,7 +2178,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2168
2178
  return _context27.abrupt("return", {
2169
2179
  success: false,
2170
2180
  message: "\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(errorMessage),
2171
- orderUuid: (_this$store$currentOr5 = this.store.currentOrder) === null || _this$store$currentOr5 === void 0 ? void 0 : _this$store$currentOr5.uuid
2181
+ orderUuid: (_this$store$currentOr6 = this.store.currentOrder) === null || _this$store$currentOr6 === void 0 ? void 0 : _this$store$currentOr6.uuid
2172
2182
  });
2173
2183
  case 24:
2174
2184
  case "end":
@@ -2221,7 +2231,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2221
2231
  key: "saveForLaterPaymentAsync",
2222
2232
  value: (function () {
2223
2233
  var _saveForLaterPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2224
- var orderUuid, currentOrderId, allPaymentItems, filteredPaymentItems, voucherItems, realOrderId, finalOrderId, _this$store$currentOr6, errorMessage;
2234
+ var orderUuid, currentOrderId, allPaymentItems, filteredPaymentItems, voucherItems, realOrderId, finalOrderId, _this$store$currentOr7, errorMessage;
2225
2235
  return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2226
2236
  while (1) switch (_context28.prev = _context28.next) {
2227
2237
  case 0:
@@ -2311,7 +2321,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2311
2321
  return _context28.abrupt("return", {
2312
2322
  success: false,
2313
2323
  message: "\u8BA2\u5355\u4FDD\u5B58\u5931\u8D25: ".concat(errorMessage),
2314
- orderUuid: (_this$store$currentOr6 = this.store.currentOrder) === null || _this$store$currentOr6 === void 0 ? void 0 : _this$store$currentOr6.uuid
2324
+ orderUuid: (_this$store$currentOr7 = this.store.currentOrder) === null || _this$store$currentOr7 === void 0 ? void 0 : _this$store$currentOr7.uuid
2315
2325
  });
2316
2326
  case 26:
2317
2327
  case "end":
@@ -2362,14 +2372,14 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2362
2372
  key: "updateShopDiscountAsync",
2363
2373
  value: (function () {
2364
2374
  var _updateShopDiscountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(discountAmount) {
2365
- var _this$store$currentOr7, _this$store$currentOr8, oldDiscount, shopDiscountItem, updatedAmountInfo;
2375
+ var _this$store$currentOr8, _this$store$currentOr9, oldDiscount, shopDiscountItem, updatedAmountInfo;
2366
2376
  return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2367
2377
  while (1) switch (_context29.prev = _context29.next) {
2368
2378
  case 0:
2369
2379
  _context29.prev = 0;
2370
2380
  oldDiscount = this.getShopDiscount();
2371
2381
  console.log('[Checkout] 更新商店折扣:', {
2372
- orderUuid: (_this$store$currentOr7 = this.store.currentOrder) === null || _this$store$currentOr7 === void 0 ? void 0 : _this$store$currentOr7.uuid,
2382
+ orderUuid: (_this$store$currentOr8 = this.store.currentOrder) === null || _this$store$currentOr8 === void 0 ? void 0 : _this$store$currentOr8.uuid,
2373
2383
  oldDiscount: oldDiscount,
2374
2384
  newDiscount: discountAmount
2375
2385
  });
@@ -2419,7 +2429,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2419
2429
  case 8:
2420
2430
  _context29.next = 10;
2421
2431
  return this.core.effects.emit(CheckoutHooks.OnShopDiscountChanged, {
2422
- orderUuid: (_this$store$currentOr8 = this.store.currentOrder) === null || _this$store$currentOr8 === void 0 ? void 0 : _this$store$currentOr8.uuid,
2432
+ orderUuid: (_this$store$currentOr9 = this.store.currentOrder) === null || _this$store$currentOr9 === void 0 ? void 0 : _this$store$currentOr9.uuid,
2423
2433
  oldDiscount: oldDiscount,
2424
2434
  newDiscount: discountAmount,
2425
2435
  timestamp: Date.now()
@@ -2460,7 +2470,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2460
2470
  key: "updateOrderNoteAsync",
2461
2471
  value: (function () {
2462
2472
  var _updateOrderNoteAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(note) {
2463
- var _this$store$currentOr9, _this$store$currentOr10, oldNote, orderInPayment;
2473
+ var _this$store$currentOr10, _this$store$currentOr11, oldNote, orderInPayment;
2464
2474
  return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2465
2475
  while (1) switch (_context30.prev = _context30.next) {
2466
2476
  case 0:
@@ -2472,7 +2482,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2472
2482
  throw createCheckoutError(CheckoutErrorType.ValidationFailed, '没有本地订单数据,无法更新备注');
2473
2483
  case 3:
2474
2484
  console.log('[Checkout] 更新订单备注:', {
2475
- orderUuid: (_this$store$currentOr9 = this.store.currentOrder) === null || _this$store$currentOr9 === void 0 ? void 0 : _this$store$currentOr9.uuid,
2485
+ orderUuid: (_this$store$currentOr10 = this.store.currentOrder) === null || _this$store$currentOr10 === void 0 ? void 0 : _this$store$currentOr10.uuid,
2476
2486
  oldNote: this.store.localOrderData.shop_note,
2477
2487
  newNote: note
2478
2488
  });
@@ -2505,7 +2515,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2505
2515
  case 17:
2506
2516
  _context30.next = 19;
2507
2517
  return this.core.effects.emit(CheckoutHooks.OnOrderNoteChanged, {
2508
- orderUuid: (_this$store$currentOr10 = this.store.currentOrder) === null || _this$store$currentOr10 === void 0 ? void 0 : _this$store$currentOr10.uuid,
2518
+ orderUuid: (_this$store$currentOr11 = this.store.currentOrder) === null || _this$store$currentOr11 === void 0 ? void 0 : _this$store$currentOr11.uuid,
2509
2519
  oldNote: oldNote,
2510
2520
  newNote: note,
2511
2521
  timestamp: Date.now()
@@ -2645,7 +2655,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2645
2655
  key: "handlePaymentSuccess",
2646
2656
  value: (function () {
2647
2657
  var _handlePaymentSuccess = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(data) {
2648
- var _this$store$currentOr11;
2658
+ var _this$store$currentOr12;
2649
2659
  return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2650
2660
  while (1) switch (_context34.prev = _context34.next) {
2651
2661
  case 0:
@@ -2659,7 +2669,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2659
2669
  return this.core.effects.emit(CheckoutHooks.OnPaymentSuccess, {
2660
2670
  orderUuid: data.orderUuid,
2661
2671
  paymentMethodCode: '',
2662
- amount: ((_this$store$currentOr11 = this.store.currentOrder) === null || _this$store$currentOr11 === void 0 ? void 0 : _this$store$currentOr11.total_amount) || '0',
2672
+ amount: ((_this$store$currentOr12 = this.store.currentOrder) === null || _this$store$currentOr12 === void 0 ? void 0 : _this$store$currentOr12.total_amount) || '0',
2663
2673
  timestamp: data.timestamp
2664
2674
  });
2665
2675
  case 6:
@@ -2684,7 +2694,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2684
2694
  key: "handlePaymentError",
2685
2695
  value: (function () {
2686
2696
  var _handlePaymentError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(data) {
2687
- var _this$store$currentOr12;
2697
+ var _this$store$currentOr13;
2688
2698
  var error;
2689
2699
  return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2690
2700
  while (1) switch (_context35.prev = _context35.next) {
@@ -2697,7 +2707,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2697
2707
  return this.core.effects.emit(CheckoutHooks.OnPaymentFailed, {
2698
2708
  orderUuid: data.orderUuid,
2699
2709
  paymentMethodCode: '',
2700
- amount: ((_this$store$currentOr12 = this.store.currentOrder) === null || _this$store$currentOr12 === void 0 ? void 0 : _this$store$currentOr12.total_amount) || '0',
2710
+ amount: ((_this$store$currentOr13 = this.store.currentOrder) === null || _this$store$currentOr13 === void 0 ? void 0 : _this$store$currentOr13.total_amount) || '0',
2701
2711
  timestamp: data.timestamp
2702
2712
  });
2703
2713
  case 5:
@@ -2991,7 +3001,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
2991
3001
  key: "updateStateAmountToRemaining",
2992
3002
  value: (function () {
2993
3003
  var _updateStateAmountToRemaining = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
2994
- var _this$store$currentOr13, remainingAmount, currentStateAmount;
3004
+ var _this$store$currentOr14, remainingAmount, currentStateAmount;
2995
3005
  return _regeneratorRuntime().wrap(function _callee39$(_context39) {
2996
3006
  while (1) switch (_context39.prev = _context39.next) {
2997
3007
  case 0:
@@ -3002,7 +3012,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3002
3012
  calculatedRemainingAmount: remainingAmount,
3003
3013
  currentStateAmount: currentStateAmount,
3004
3014
  needsUpdate: remainingAmount !== currentStateAmount,
3005
- orderUuid: (_this$store$currentOr13 = this.store.currentOrder) === null || _this$store$currentOr13 === void 0 ? void 0 : _this$store$currentOr13.uuid
3015
+ orderUuid: (_this$store$currentOr14 = this.store.currentOrder) === null || _this$store$currentOr14 === void 0 ? void 0 : _this$store$currentOr14.uuid
3006
3016
  });
3007
3017
 
3008
3018
  // 只有当剩余金额与当前 stateAmount 不同时才更新
@@ -3062,7 +3072,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3062
3072
  key: "checkOrderPaymentCompletion",
3063
3073
  value: (function () {
3064
3074
  var _checkOrderPaymentCompletion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
3065
- var remainingAmount, remainingValue, _this$store$currentOr14, _this$store$currentOr15, totalAmount, paidAmount, allPaymentsHaveVoucherId;
3075
+ var remainingAmount, remainingValue, _this$store$currentOr15, _this$store$currentOr16, totalAmount, paidAmount, allPaymentsHaveVoucherId;
3066
3076
  return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3067
3077
  while (1) switch (_context40.prev = _context40.next) {
3068
3078
  case 0:
@@ -3095,9 +3105,9 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3095
3105
  return item.status !== 'voided' && item.voucher_id;
3096
3106
  });
3097
3107
  console.log('[Checkout] 支付项voucher_id检查:', {
3098
- paymentCount: ((_this$store$currentOr14 = this.store.currentOrder.payment) === null || _this$store$currentOr14 === void 0 ? void 0 : _this$store$currentOr14.length) || 0,
3108
+ paymentCount: ((_this$store$currentOr15 = this.store.currentOrder.payment) === null || _this$store$currentOr15 === void 0 ? void 0 : _this$store$currentOr15.length) || 0,
3099
3109
  allHaveVoucherId: allPaymentsHaveVoucherId,
3100
- paymentItems: (_this$store$currentOr15 = this.store.currentOrder.payment) === null || _this$store$currentOr15 === void 0 ? void 0 : _this$store$currentOr15.map(function (p) {
3110
+ paymentItems: (_this$store$currentOr16 = this.store.currentOrder.payment) === null || _this$store$currentOr16 === void 0 ? void 0 : _this$store$currentOr16.map(function (p) {
3101
3111
  return {
3102
3112
  uuid: p.uuid,
3103
3113
  code: p.code,
@@ -3218,7 +3228,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3218
3228
  key: "syncOrderToBackendWithReturn",
3219
3229
  value: (function () {
3220
3230
  var _syncOrderToBackendWithReturn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
3221
- var _this$store$currentCu2, _this$store$currentOr16, _this$store$currentOr17;
3231
+ var _this$store$currentCu2, _this$store$currentOr17, _this$store$currentOr18;
3222
3232
  var isManual,
3223
3233
  customPaymentItems,
3224
3234
  syncType,
@@ -3336,8 +3346,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3336
3346
  currency_code: this.otherParams.currency_code,
3337
3347
  currency_symbol: this.otherParams.currency_symbol,
3338
3348
  currency_format: this.otherParams.currency_format,
3339
- is_deposit: ((_this$store$currentOr16 = this.store.currentOrder) === null || _this$store$currentOr16 === void 0 ? void 0 : _this$store$currentOr16.is_deposit) || 0,
3340
- deposit_amount: ((_this$store$currentOr17 = this.store.currentOrder) === null || _this$store$currentOr17 === void 0 ? void 0 : _this$store$currentOr17.deposit_amount) || '0.00',
3349
+ is_deposit: ((_this$store$currentOr17 = this.store.currentOrder) === null || _this$store$currentOr17 === void 0 ? void 0 : _this$store$currentOr17.is_deposit) || 0,
3350
+ deposit_amount: ((_this$store$currentOr18 = this.store.currentOrder) === null || _this$store$currentOr18 === void 0 ? void 0 : _this$store$currentOr18.deposit_amount) || '0.00',
3341
3351
  // surcharge_fee: this.otherParams.surcharge_fee,
3342
3352
  // surcharges: ,
3343
3353
  note: this.store.localOrderData.shop_note
@@ -3463,7 +3473,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3463
3473
  realOrderId: realOrderId,
3464
3474
  virtualOrderId: this.store.currentOrder.order_id,
3465
3475
  timestamp: Date.now(),
3466
- isManual: isManual
3476
+ isManual: isManual,
3477
+ response: checkoutResponse
3467
3478
  });
3468
3479
  case 55:
3469
3480
  // 验证最终状态
@@ -3582,13 +3593,128 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3582
3593
  }
3583
3594
  return setOtherParams;
3584
3595
  }()
3596
+ /**
3597
+ * 通过订单ID编辑订单备注
3598
+ *
3599
+ * 用于修改已同步到后端的订单备注,通常在支付成功后的弹窗中使用
3600
+ *
3601
+ * @param orderId 后端订单ID
3602
+ * @param note 新的订单备注
3603
+ * @returns 修改结果
3604
+ */
3605
+ }, {
3606
+ key: "editOrderNoteByOrderIdAsync",
3607
+ value: (function () {
3608
+ var _editOrderNoteByOrderIdAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(orderId, note) {
3609
+ var response, previousNote, errorMessage, _errorMessage;
3610
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3611
+ while (1) switch (_context44.prev = _context44.next) {
3612
+ case 0:
3613
+ _context44.prev = 0;
3614
+ console.log('[Checkout] 开始编辑订单备注:', {
3615
+ orderId: orderId,
3616
+ note: note,
3617
+ noteLength: note.length
3618
+ });
3619
+
3620
+ // 参数验证
3621
+ if (orderId) {
3622
+ _context44.next = 4;
3623
+ break;
3624
+ }
3625
+ return _context44.abrupt("return", {
3626
+ success: false,
3627
+ message: '订单ID不能为空',
3628
+ orderId: orderId
3629
+ });
3630
+ case 4:
3631
+ _context44.next = 6;
3632
+ return this.request.put("/shop/order/order/".concat(orderId, "/note"), {
3633
+ note: note
3634
+ });
3635
+ case 6:
3636
+ response = _context44.sent;
3637
+ console.log('[Checkout] 订单备注编辑响应:', {
3638
+ orderId: orderId,
3639
+ status: response.status,
3640
+ message: response.message,
3641
+ response: response
3642
+ });
3643
+
3644
+ // 检查响应状态
3645
+ if (!(response.status === true || response.status === 200)) {
3646
+ _context44.next = 19;
3647
+ break;
3648
+ }
3649
+ console.log("[Checkout] \u8BA2\u5355 ".concat(orderId, " \u5907\u6CE8\u4FEE\u6539\u6210\u529F"));
3650
+
3651
+ // 如果当前订单就是被修改的订单,同时更新本地状态
3652
+ if (!(this.store.currentOrder && (String(this.store.currentOrder.order_id) === String(orderId) || String(this.store.currentOrder.id) === String(orderId)))) {
3653
+ _context44.next = 16;
3654
+ break;
3655
+ }
3656
+ console.log('[Checkout] 更新本地订单备注状态');
3657
+
3658
+ // 获取修改前的备注用于事件
3659
+ previousNote = this.getOrderNote(); // 更新本地订单数据中的备注
3660
+ if (this.store.localOrderData) {
3661
+ this.store.localOrderData.shop_note = note;
3662
+ }
3663
+
3664
+ // 触发订单备注变更事件
3665
+ _context44.next = 16;
3666
+ return this.core.effects.emit(CheckoutHooks.OnOrderNoteChanged, {
3667
+ orderUuid: this.store.currentOrder.uuid,
3668
+ oldNote: previousNote,
3669
+ newNote: note,
3670
+ timestamp: Date.now()
3671
+ });
3672
+ case 16:
3673
+ return _context44.abrupt("return", {
3674
+ success: true,
3675
+ message: response.message || '订单备注修改成功',
3676
+ orderId: orderId
3677
+ });
3678
+ case 19:
3679
+ // API返回失败状态
3680
+ errorMessage = response.message || '订单备注修改失败';
3681
+ console.error("[Checkout] \u8BA2\u5355 ".concat(orderId, " \u5907\u6CE8\u4FEE\u6539\u5931\u8D25:"), errorMessage);
3682
+ return _context44.abrupt("return", {
3683
+ success: false,
3684
+ message: errorMessage,
3685
+ orderId: orderId
3686
+ });
3687
+ case 22:
3688
+ _context44.next = 29;
3689
+ break;
3690
+ case 24:
3691
+ _context44.prev = 24;
3692
+ _context44.t0 = _context44["catch"](0);
3693
+ console.error('[Checkout] 编辑订单备注失败:', _context44.t0);
3694
+ _errorMessage = _context44.t0 instanceof Error ? _context44.t0.message : '网络错误或服务器异常';
3695
+ return _context44.abrupt("return", {
3696
+ success: false,
3697
+ message: "\u7F16\u8F91\u8BA2\u5355\u5907\u6CE8\u5931\u8D25: ".concat(_errorMessage),
3698
+ orderId: orderId
3699
+ });
3700
+ case 29:
3701
+ case "end":
3702
+ return _context44.stop();
3703
+ }
3704
+ }, _callee44, this, [[0, 24]]);
3705
+ }));
3706
+ function editOrderNoteByOrderIdAsync(_x29, _x30) {
3707
+ return _editOrderNoteByOrderIdAsync.apply(this, arguments);
3708
+ }
3709
+ return editOrderNoteByOrderIdAsync;
3710
+ }())
3585
3711
  }, {
3586
3712
  key: "destroy",
3587
3713
  value: function () {
3588
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
3714
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
3589
3715
  var _this$order, _this$order$destroy, _this$payment, _this$payment$destroy;
3590
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3591
- while (1) switch (_context44.prev = _context44.next) {
3716
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
3717
+ while (1) switch (_context45.prev = _context45.next) {
3592
3718
  case 0:
3593
3719
  // 清理钱包模块的所有缓存数据
3594
3720
  this.payment.wallet.clearAllCache();
@@ -3597,10 +3723,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3597
3723
  this.core.effects.offByModuleDestroy(this.name);
3598
3724
 
3599
3725
  // 销毁子模块
3600
- _context44.next = 4;
3726
+ _context45.next = 4;
3601
3727
  return (_this$order = this.order) === null || _this$order === void 0 || (_this$order$destroy = _this$order.destroy) === null || _this$order$destroy === void 0 ? void 0 : _this$order$destroy.call(_this$order);
3602
3728
  case 4:
3603
- _context44.next = 6;
3729
+ _context45.next = 6;
3604
3730
  return (_this$payment = this.payment) === null || _this$payment === void 0 || (_this$payment$destroy = _this$payment.destroy) === null || _this$payment$destroy === void 0 ? void 0 : _this$payment$destroy.call(_this$payment);
3605
3731
  case 6:
3606
3732
  // 取消注册模块
@@ -3608,9 +3734,9 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
3608
3734
  console.log('[Checkout] 已销毁');
3609
3735
  case 8:
3610
3736
  case "end":
3611
- return _context44.stop();
3737
+ return _context45.stop();
3612
3738
  }
3613
- }, _callee44, this);
3739
+ }, _callee45, this);
3614
3740
  }));
3615
3741
  function destroy() {
3616
3742
  return _destroy.apply(this, arguments);
@@ -661,6 +661,20 @@ export interface CheckoutModuleAPI extends Module {
661
661
  orderId?: string;
662
662
  orderUuid?: string;
663
663
  }>;
664
+ /**
665
+ * 通过订单ID编辑订单备注
666
+ *
667
+ * 用于修改已同步到后端的订单备注,通常在支付成功后的弹窗中使用
668
+ *
669
+ * @param orderId 后端订单ID
670
+ * @param note 新的订单备注
671
+ * @returns 修改结果
672
+ */
673
+ editOrderNoteByOrderIdAsync(orderId: string | number, note: string): Promise<{
674
+ success: boolean;
675
+ message?: string;
676
+ orderId?: string | number;
677
+ }>;
664
678
  }
665
679
  /**
666
680
  * 结账事件数据类型
@@ -112,7 +112,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
112
112
  * @returns 后端返回的订单数据(包含订单ID等)
113
113
  */
114
114
  async createOrderByCheckout(params) {
115
- var _a, _b, _c, _d, _e, _f, _g, _h;
115
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
116
116
  console.log("[Order] createOrderByCheckout 开始创建订单:", {
117
117
  type: params.type,
118
118
  platform: params.platform,
@@ -136,21 +136,28 @@ var OrderModule = class extends import_BaseModule.BaseModule {
136
136
  ...params
137
137
  // 使用传入的参数覆盖默认值
138
138
  };
139
+ if ((_d = orderData.payments) == null ? void 0 : _d.length) {
140
+ orderData.small_ticket_data_flag = 1;
141
+ }
142
+ if (params.order_id) {
143
+ orderData.bookings = [];
144
+ orderData.relation_products = [];
145
+ }
139
146
  console.log("[Order] 调用后端接口创建订单:", {
140
147
  url: "/order/checkout",
141
148
  orderType: orderData.type,
142
149
  platform: orderData.platform,
143
150
  isDeposit: orderData.is_deposit,
144
151
  customerId: orderData.customer_id,
145
- bookingsCount: ((_d = orderData.bookings) == null ? void 0 : _d.length) || 0,
146
- relationProductsCount: ((_e = orderData.relation_products) == null ? void 0 : _e.length) || 0,
147
- paymentsCount: ((_f = orderData.payments) == null ? void 0 : _f.length) || 0,
148
- paymentsMethods: ((_g = orderData.payments) == null ? void 0 : _g.map((p) => p.code)) || []
152
+ bookingsCount: ((_e = orderData.bookings) == null ? void 0 : _e.length) || 0,
153
+ relationProductsCount: ((_f = orderData.relation_products) == null ? void 0 : _f.length) || 0,
154
+ paymentsCount: ((_g = orderData.payments) == null ? void 0 : _g.length) || 0,
155
+ paymentsMethods: ((_h = orderData.payments) == null ? void 0 : _h.map((p) => p.code)) || []
149
156
  });
150
157
  const response = await this.request.post("/order/checkout", orderData);
151
158
  console.log("[Order] 订单创建成功,后端响应:", {
152
159
  success: !!response,
153
- hasOrderId: !!(((_h = response == null ? void 0 : response.data) == null ? void 0 : _h.order_id) || (response == null ? void 0 : response.order_id))
160
+ hasOrderId: !!(((_i = response == null ? void 0 : response.data) == null ? void 0 : _i.order_id) || (response == null ? void 0 : response.order_id))
154
161
  });
155
162
  return response;
156
163
  } catch (error) {
@@ -53,6 +53,8 @@ export interface CheckoutOrderParams {
53
53
  relation_forms?: any[];
54
54
  payments?: PaymentItemData[];
55
55
  customer_id?: string;
56
+ /** 小票数据标记,当有支付项时设置为1 */
57
+ small_ticket_data_flag?: number;
56
58
  [key: string]: any;
57
59
  }
58
60
  /**
@@ -509,7 +509,7 @@ export interface WalletDeductionRecommendParams {
509
509
  /** 前端设置只想要的字段 */
510
510
  expect_columns?: string[];
511
511
  /** 客户id */
512
- customer_id: number;
512
+ customer_id?: number;
513
513
  /** 订单总计金额 */
514
514
  order_expect_amount: number;
515
515
  /** 订单小计金额 */
@@ -52,7 +52,7 @@ var WalletPassPaymentImpl = class {
52
52
  const totalAmount = Number(amountInfo.subTotal) || Number(amountInfo.totalAmount);
53
53
  const walletParams = {
54
54
  sale_channel: "kiosk",
55
- customer_id: 9752,
55
+ customer_id,
56
56
  order_expect_amount: totalAmount,
57
57
  order_product_amount: totalAmount,
58
58
  order_wait_pay_amount: totalAmount,
@@ -95,6 +95,10 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
95
95
  * 强制重新从服务器获取支付方式列表,更新本地缓存
96
96
  */
97
97
  refreshPaymentMethodsAsync(): Promise<PaymentMethod[]>;
98
+ /**
99
+ * 获取订单原始数据
100
+ */
101
+ getOrderOriginalData(): any;
98
102
  /**
99
103
  * 获取当前订单基础信息
100
104
  *
@@ -411,5 +415,19 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
411
415
  setOtherParams(params: Record<string, any>, { cover }?: {
412
416
  cover?: boolean;
413
417
  }): Promise<void>;
418
+ /**
419
+ * 通过订单ID编辑订单备注
420
+ *
421
+ * 用于修改已同步到后端的订单备注,通常在支付成功后的弹窗中使用
422
+ *
423
+ * @param orderId 后端订单ID
424
+ * @param note 新的订单备注
425
+ * @returns 修改结果
426
+ */
427
+ editOrderNoteByOrderIdAsync(orderId: string | number, note: string): Promise<{
428
+ success: boolean;
429
+ message?: string;
430
+ orderId?: string | number;
431
+ }>;
414
432
  destroy(): Promise<void>;
415
433
  }
@@ -523,6 +523,13 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
523
523
  await this.preloadPaymentMethods();
524
524
  return this.store.paymentMethods;
525
525
  }
526
+ /**
527
+ * 获取订单原始数据
528
+ */
529
+ getOrderOriginalData() {
530
+ var _a;
531
+ return (_a = this.store.currentOrder) == null ? void 0 : _a.order_info;
532
+ }
526
533
  /**
527
534
  * 获取当前订单基础信息
528
535
  *
@@ -2029,7 +2036,8 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2029
2036
  realOrderId,
2030
2037
  virtualOrderId: this.store.currentOrder.order_id,
2031
2038
  timestamp: Date.now(),
2032
- isManual
2039
+ isManual,
2040
+ response: checkoutResponse
2033
2041
  });
2034
2042
  const finalOrderId = this.store.currentOrder.order_id;
2035
2043
  const finalIsVirtual = this.isVirtualOrderId(finalOrderId || "");
@@ -2090,6 +2098,77 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2090
2098
  this.otherParams = { ...this.otherParams, ...params };
2091
2099
  }
2092
2100
  }
2101
+ /**
2102
+ * 通过订单ID编辑订单备注
2103
+ *
2104
+ * 用于修改已同步到后端的订单备注,通常在支付成功后的弹窗中使用
2105
+ *
2106
+ * @param orderId 后端订单ID
2107
+ * @param note 新的订单备注
2108
+ * @returns 修改结果
2109
+ */
2110
+ async editOrderNoteByOrderIdAsync(orderId, note) {
2111
+ try {
2112
+ console.log("[Checkout] 开始编辑订单备注:", {
2113
+ orderId,
2114
+ note,
2115
+ noteLength: note.length
2116
+ });
2117
+ if (!orderId) {
2118
+ return {
2119
+ success: false,
2120
+ message: "订单ID不能为空",
2121
+ orderId
2122
+ };
2123
+ }
2124
+ const response = await this.request.put(`/shop/order/order/${orderId}/note`, {
2125
+ note
2126
+ });
2127
+ console.log("[Checkout] 订单备注编辑响应:", {
2128
+ orderId,
2129
+ status: response.status,
2130
+ message: response.message,
2131
+ response
2132
+ });
2133
+ if (response.status === true || response.status === 200) {
2134
+ console.log(`[Checkout] 订单 ${orderId} 备注修改成功`);
2135
+ if (this.store.currentOrder && (String(this.store.currentOrder.order_id) === String(orderId) || String(this.store.currentOrder.id) === String(orderId))) {
2136
+ console.log("[Checkout] 更新本地订单备注状态");
2137
+ const previousNote = this.getOrderNote();
2138
+ if (this.store.localOrderData) {
2139
+ this.store.localOrderData.shop_note = note;
2140
+ }
2141
+ await this.core.effects.emit(import_types.CheckoutHooks.OnOrderNoteChanged, {
2142
+ orderUuid: this.store.currentOrder.uuid,
2143
+ oldNote: previousNote,
2144
+ newNote: note,
2145
+ timestamp: Date.now()
2146
+ });
2147
+ }
2148
+ return {
2149
+ success: true,
2150
+ message: response.message || "订单备注修改成功",
2151
+ orderId
2152
+ };
2153
+ } else {
2154
+ const errorMessage = response.message || "订单备注修改失败";
2155
+ console.error(`[Checkout] 订单 ${orderId} 备注修改失败:`, errorMessage);
2156
+ return {
2157
+ success: false,
2158
+ message: errorMessage,
2159
+ orderId
2160
+ };
2161
+ }
2162
+ } catch (error) {
2163
+ console.error("[Checkout] 编辑订单备注失败:", error);
2164
+ const errorMessage = error instanceof Error ? error.message : "网络错误或服务器异常";
2165
+ return {
2166
+ success: false,
2167
+ message: `编辑订单备注失败: ${errorMessage}`,
2168
+ orderId
2169
+ };
2170
+ }
2171
+ }
2093
2172
  async destroy() {
2094
2173
  var _a, _b, _c, _d;
2095
2174
  this.payment.wallet.clearAllCache();
@@ -661,6 +661,20 @@ export interface CheckoutModuleAPI extends Module {
661
661
  orderId?: string;
662
662
  orderUuid?: string;
663
663
  }>;
664
+ /**
665
+ * 通过订单ID编辑订单备注
666
+ *
667
+ * 用于修改已同步到后端的订单备注,通常在支付成功后的弹窗中使用
668
+ *
669
+ * @param orderId 后端订单ID
670
+ * @param note 新的订单备注
671
+ * @returns 修改结果
672
+ */
673
+ editOrderNoteByOrderIdAsync(orderId: string | number, note: string): Promise<{
674
+ success: boolean;
675
+ message?: string;
676
+ orderId?: string | number;
677
+ }>;
664
678
  }
665
679
  /**
666
680
  * 结账事件数据类型
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.231",
4
+ "version": "0.0.232",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",