@pisell/pisellos 2.3.107 → 2.3.109
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.
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/solution/BaseSales/index.d.ts +2 -0
- package/dist/solution/BaseSales/index.js +70 -42
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/solution/BaseSales/index.d.ts +2 -0
- package/lib/solution/BaseSales/index.js +22 -2
- package/package.json +1 -1
|
@@ -557,7 +557,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
557
557
|
generateIdempotencyToken(): string;
|
|
558
558
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
559
559
|
createOrder(params: CommitOrderParams['query']): {
|
|
560
|
-
type: "
|
|
560
|
+
type: "virtual" | "appointment_booking";
|
|
561
561
|
platform: string;
|
|
562
562
|
sales_channel: string;
|
|
563
563
|
order_sales_channel: string;
|
|
@@ -242,6 +242,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
242
242
|
updateTempOrderNote(note: string, sync: true): Promise<string>;
|
|
243
243
|
updateTempOrderNote(note: string, sync: boolean): string | Promise<string>;
|
|
244
244
|
updateRemoteOrderNote(orderId: number | string, note: string): void;
|
|
245
|
+
/** 存储用户自定义取餐标识到当前 tempOrder.buzzer。 */
|
|
246
|
+
setPickupRef(buzzer: string): string;
|
|
245
247
|
updateTempOrderShopDiscount(amount: string | number): string;
|
|
246
248
|
updateTempOrderDepositAmount(amount: string | number): OrderSummary;
|
|
247
249
|
setPickupReferenceMode(mode: PickupReferenceMode): ShopServiceData;
|
|
@@ -2386,6 +2386,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2386
2386
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2387
2387
|
this.store.order.syncTempOrderNoteToRemote(orderId, note);
|
|
2388
2388
|
}
|
|
2389
|
+
|
|
2390
|
+
/** 存储用户自定义取餐标识到当前 tempOrder.buzzer。 */
|
|
2391
|
+
}, {
|
|
2392
|
+
key: "setPickupRef",
|
|
2393
|
+
value: function setPickupRef(buzzer) {
|
|
2394
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2395
|
+
return this.store.order.updateTempOrderBuzzer(buzzer);
|
|
2396
|
+
}
|
|
2389
2397
|
}, {
|
|
2390
2398
|
key: "updateTempOrderShopDiscount",
|
|
2391
2399
|
value: function updateTempOrderShopDiscount(amount) {
|
|
@@ -5285,8 +5293,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5285
5293
|
key: "confirmWalletPayment",
|
|
5286
5294
|
value: (function () {
|
|
5287
5295
|
var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53() {
|
|
5288
|
-
var _this$store$order$get3, _this$store$order14, _this$store$order$
|
|
5289
|
-
var beforePayments, pendingWalletAmount, amountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
|
|
5296
|
+
var _this$store$order$get3, _this$store$order14, _this$store$order$get5, _this$store$order$get6, _this$store$order16;
|
|
5297
|
+
var beforePayments, pendingWalletAmount, amountSnapshot, _this$store$order$get4, _this$store$order15, _submitResult, _latestAmountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
|
|
5290
5298
|
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
|
5291
5299
|
while (1) switch (_context53.prev = _context53.next) {
|
|
5292
5300
|
case 0:
|
|
@@ -5298,83 +5306,103 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5298
5306
|
case 2:
|
|
5299
5307
|
beforePayments = cloneDeep(this.store.order.getOrderPayments());
|
|
5300
5308
|
pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
|
|
5309
|
+
amountSnapshot = (_this$store$order$get3 = (_this$store$order14 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order14);
|
|
5301
5310
|
if (!pendingWalletAmount.lte(0)) {
|
|
5302
|
-
_context53.next =
|
|
5311
|
+
_context53.next = 14;
|
|
5303
5312
|
break;
|
|
5304
5313
|
}
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5314
|
+
this.logWarning('confirmWalletPayment: 未发现待确认 Wallet 支付,跳过 Wallet 确认并按普通订单提交', {
|
|
5315
|
+
amountGap: amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap
|
|
5316
|
+
});
|
|
5317
|
+
_context53.next = 9;
|
|
5318
|
+
return this.submitSalesOrder({
|
|
5319
|
+
smallTicketDataFlag: 1
|
|
5320
|
+
});
|
|
5321
|
+
case 9:
|
|
5322
|
+
_submitResult = _context53.sent;
|
|
5323
|
+
if (!isRejectedSalesSubmitResult(_submitResult)) {
|
|
5324
|
+
_context53.next = 12;
|
|
5325
|
+
break;
|
|
5326
|
+
}
|
|
5327
|
+
throw new Error(getSalesSubmitErrorMessage(_submitResult, '订单提交失败'));
|
|
5328
|
+
case 12:
|
|
5329
|
+
_latestAmountSnapshot = (_this$store$order$get4 = (_this$store$order15 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.call(_this$store$order15);
|
|
5330
|
+
return _context53.abrupt("return", {
|
|
5331
|
+
submitResult: _submitResult,
|
|
5332
|
+
payments: this.store.order.getOrderPayments(),
|
|
5333
|
+
isOrderFullyPaid: new Decimal((_latestAmountSnapshot === null || _latestAmountSnapshot === void 0 ? void 0 : _latestAmountSnapshot.amountGap) || 0).lte(0)
|
|
5334
|
+
});
|
|
5335
|
+
case 14:
|
|
5308
5336
|
effectiveAmountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
|
|
5309
5337
|
if (!effectiveAmountDue.gt(0.01)) {
|
|
5310
|
-
_context53.next =
|
|
5338
|
+
_context53.next = 17;
|
|
5311
5339
|
break;
|
|
5312
5340
|
}
|
|
5313
5341
|
throw new Error('Wallet 支付尚未覆盖全部待支付金额');
|
|
5314
|
-
case
|
|
5315
|
-
beforePaymentStatus = (_this$store$order$
|
|
5316
|
-
_context53.prev =
|
|
5317
|
-
_context53.next =
|
|
5342
|
+
case 17:
|
|
5343
|
+
beforePaymentStatus = (_this$store$order$get5 = this.store.order.getTempOrder()) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.payment_status;
|
|
5344
|
+
_context53.prev = 18;
|
|
5345
|
+
_context53.next = 21;
|
|
5318
5346
|
return this.submitSalesOrder({
|
|
5319
5347
|
smallTicketDataFlag: 1,
|
|
5320
5348
|
confirmPendingVoucherPayments: true
|
|
5321
5349
|
});
|
|
5322
|
-
case
|
|
5350
|
+
case 21:
|
|
5323
5351
|
submitResult = _context53.sent;
|
|
5324
5352
|
if (!isRejectedSalesSubmitResult(submitResult)) {
|
|
5325
|
-
_context53.next =
|
|
5353
|
+
_context53.next = 24;
|
|
5326
5354
|
break;
|
|
5327
5355
|
}
|
|
5328
5356
|
throw new Error(getSalesSubmitErrorMessage(submitResult, 'Wallet 支付确认失败'));
|
|
5329
|
-
case
|
|
5330
|
-
_context53.next =
|
|
5357
|
+
case 24:
|
|
5358
|
+
_context53.next = 34;
|
|
5331
5359
|
break;
|
|
5332
|
-
case
|
|
5333
|
-
_context53.prev =
|
|
5334
|
-
_context53.t0 = _context53["catch"](
|
|
5360
|
+
case 26:
|
|
5361
|
+
_context53.prev = 26;
|
|
5362
|
+
_context53.t0 = _context53["catch"](18);
|
|
5335
5363
|
this.store.order.setOrderPayments(beforePayments);
|
|
5336
5364
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
5337
5365
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
5338
5366
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
5339
5367
|
this.store.order.persistTempOrder();
|
|
5340
5368
|
}
|
|
5341
|
-
_context53.next =
|
|
5369
|
+
_context53.next = 33;
|
|
5342
5370
|
return this.store.order.recalculateSummary({
|
|
5343
5371
|
createIfMissing: true
|
|
5344
5372
|
});
|
|
5345
|
-
case
|
|
5373
|
+
case 33:
|
|
5346
5374
|
throw _context53.t0;
|
|
5347
|
-
case
|
|
5375
|
+
case 34:
|
|
5348
5376
|
if (!this.store.payment) {
|
|
5349
|
-
_context53.next =
|
|
5377
|
+
_context53.next = 45;
|
|
5350
5378
|
break;
|
|
5351
5379
|
}
|
|
5352
|
-
_context53.prev =
|
|
5380
|
+
_context53.prev = 35;
|
|
5353
5381
|
committed = this.getCommittedWalletAssets();
|
|
5354
5382
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
5355
|
-
_context53.next =
|
|
5383
|
+
_context53.next = 40;
|
|
5356
5384
|
return this.publishWalletAssetsState(walletState, 'local');
|
|
5357
|
-
case
|
|
5358
|
-
_context53.next =
|
|
5385
|
+
case 40:
|
|
5386
|
+
_context53.next = 45;
|
|
5359
5387
|
break;
|
|
5360
|
-
case
|
|
5361
|
-
_context53.prev =
|
|
5362
|
-
_context53.t1 = _context53["catch"](
|
|
5388
|
+
case 42:
|
|
5389
|
+
_context53.prev = 42;
|
|
5390
|
+
_context53.t1 = _context53["catch"](35);
|
|
5363
5391
|
this.logWarning('confirmWalletPayment: Wallet committed 状态同步失败', {
|
|
5364
5392
|
error: _context53.t1 instanceof Error ? _context53.t1.message : String(_context53.t1)
|
|
5365
5393
|
});
|
|
5366
|
-
case
|
|
5367
|
-
latestAmountSnapshot = (_this$store$order$
|
|
5394
|
+
case 45:
|
|
5395
|
+
latestAmountSnapshot = (_this$store$order$get6 = (_this$store$order16 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get6 === void 0 ? void 0 : _this$store$order$get6.call(_this$store$order16);
|
|
5368
5396
|
return _context53.abrupt("return", {
|
|
5369
5397
|
submitResult: submitResult,
|
|
5370
5398
|
payments: this.store.order.getOrderPayments(),
|
|
5371
5399
|
isOrderFullyPaid: new Decimal((latestAmountSnapshot === null || latestAmountSnapshot === void 0 ? void 0 : latestAmountSnapshot.amountGap) || 0).lte(0)
|
|
5372
5400
|
});
|
|
5373
|
-
case
|
|
5401
|
+
case 47:
|
|
5374
5402
|
case "end":
|
|
5375
5403
|
return _context53.stop();
|
|
5376
5404
|
}
|
|
5377
|
-
}, _callee53, this, [[
|
|
5405
|
+
}, _callee53, this, [[18, 26], [35, 42]]);
|
|
5378
5406
|
}));
|
|
5379
5407
|
function confirmWalletPayment() {
|
|
5380
5408
|
return _confirmWalletPayment.apply(this, arguments);
|
|
@@ -5390,7 +5418,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5390
5418
|
key: "payCash",
|
|
5391
5419
|
value: (function () {
|
|
5392
5420
|
var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(params) {
|
|
5393
|
-
var _this$store$order$
|
|
5421
|
+
var _this$store$order$get7, _params$actualPaidAmo, _this$otherParams35, _this$window, _this$window$postMess;
|
|
5394
5422
|
var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, paymentTimestamp, actualPaidAmount, changeAmount, shopWalletPassId, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
5395
5423
|
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
5396
5424
|
while (1) switch (_context54.prev = _context54.next) {
|
|
@@ -5434,7 +5462,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5434
5462
|
throw new Error('现金支付金额超过当前待支付金额');
|
|
5435
5463
|
case 17:
|
|
5436
5464
|
beforePayments = cloneDeep(this.store.order.getOrderPayments());
|
|
5437
|
-
beforePaymentStatus = (_this$store$order$
|
|
5465
|
+
beforePaymentStatus = (_this$store$order$get7 = this.store.order.getTempOrder()) === null || _this$store$order$get7 === void 0 ? void 0 : _this$store$order$get7.payment_status;
|
|
5438
5466
|
uniquePaymentNumber = createUuidV4();
|
|
5439
5467
|
paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
5440
5468
|
actualPaidAmount = Number((_params$actualPaidAmo = params.actualPaidAmount) !== null && _params$actualPaidAmo !== void 0 ? _params$actualPaidAmo : amount);
|
|
@@ -5545,7 +5573,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5545
5573
|
key: "commitPaymentMethodPayment",
|
|
5546
5574
|
value: (function () {
|
|
5547
5575
|
var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(params) {
|
|
5548
|
-
var _this$store$order$
|
|
5576
|
+
var _this$store$order$get8, _this$store$order17, _this$store$order$get9, _params$metadata, _params$originAmount;
|
|
5549
5577
|
var amount, paymentMethods, findPaymentMethod, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, beforePayments, beforePaymentStatus, paymentTimestamp, metadata, serviceCharge, serviceFee, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
5550
5578
|
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
|
5551
5579
|
while (1) switch (_context55.prev = _context55.next) {
|
|
@@ -5589,7 +5617,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5589
5617
|
}
|
|
5590
5618
|
throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(params.paymentMethodCode || params.paymentMethodId || ''));
|
|
5591
5619
|
case 15:
|
|
5592
|
-
amountSnapshot = (_this$store$order$
|
|
5620
|
+
amountSnapshot = (_this$store$order$get8 = (_this$store$order17 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get8 === void 0 ? void 0 : _this$store$order$get8.call(_this$store$order17);
|
|
5593
5621
|
pendingWalletAmount = this.getPendingWalletPaymentAmount();
|
|
5594
5622
|
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
|
|
5595
5623
|
if (!amountDue.lte(0)) {
|
|
@@ -5605,7 +5633,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5605
5633
|
throw new Error('支付金额超过当前待支付金额');
|
|
5606
5634
|
case 22:
|
|
5607
5635
|
beforePayments = cloneDeep(this.store.order.getOrderPayments());
|
|
5608
|
-
beforePaymentStatus = (_this$store$order$
|
|
5636
|
+
beforePaymentStatus = (_this$store$order$get9 = this.store.order.getTempOrder()) === null || _this$store$order$get9 === void 0 ? void 0 : _this$store$order$get9.payment_status;
|
|
5609
5637
|
paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
5610
5638
|
metadata = _objectSpread(_objectSpread({}, params.metadata || {}), {}, {
|
|
5611
5639
|
unique_payment_number: ((_params$metadata = params.metadata) === null || _params$metadata === void 0 ? void 0 : _params$metadata.unique_payment_number) || createUuidV4()
|
|
@@ -6390,16 +6418,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6390
6418
|
}, {
|
|
6391
6419
|
key: "getUnfulfilledPromotions",
|
|
6392
6420
|
value: function getUnfulfilledPromotions() {
|
|
6393
|
-
var _this$store$
|
|
6394
|
-
return ((_this$store$
|
|
6421
|
+
var _this$store$order18;
|
|
6422
|
+
return ((_this$store$order18 = this.store.order) === null || _this$store$order18 === void 0 ? void 0 : _this$store$order18.getUnfulfilledPromotions()) || [];
|
|
6395
6423
|
}
|
|
6396
6424
|
|
|
6397
6425
|
/** 最近一次促销计算输出的赠品操作 diff。 */
|
|
6398
6426
|
}, {
|
|
6399
6427
|
key: "getLastGiftActions",
|
|
6400
6428
|
value: function getLastGiftActions() {
|
|
6401
|
-
var _this$store$
|
|
6402
|
-
return ((_this$store$
|
|
6429
|
+
var _this$store$order19;
|
|
6430
|
+
return ((_this$store$order19 = this.store.order) === null || _this$store$order19 === void 0 ? void 0 : _this$store$order19.getLastGiftActions()) || null;
|
|
6403
6431
|
}
|
|
6404
6432
|
|
|
6405
6433
|
// 获取商品列表
|
|
@@ -1 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "BUY_X_GET_Y_FREE_STRATEGY", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _examples.BUY_X_GET_Y_FREE_STRATEGY;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "ITEM_REWARD_STRATEGY", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _examples.ITEM_REWARD_STRATEGY;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "PromotionAdapter", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _adapter.PromotionAdapter;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "PromotionEvaluator", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _evaluator.PromotionEvaluator;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "X_ITEMS_FOR_Y_PRICE_STRATEGY", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _examples.X_ITEMS_FOR_Y_PRICE_STRATEGY;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "default", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _adapter.default;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
var _evaluator = require("./evaluator");
|
|
43
|
+
var _adapter = _interopRequireWildcard(require("./adapter"));
|
|
44
|
+
var _examples = require("./examples");
|
|
45
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
46
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -557,7 +557,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
557
557
|
generateIdempotencyToken(): string;
|
|
558
558
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
559
559
|
createOrder(params: CommitOrderParams['query']): {
|
|
560
|
-
type: "
|
|
560
|
+
type: "virtual" | "appointment_booking";
|
|
561
561
|
platform: string;
|
|
562
562
|
sales_channel: string;
|
|
563
563
|
order_sales_channel: string;
|
|
@@ -242,6 +242,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
242
242
|
updateTempOrderNote(note: string, sync: true): Promise<string>;
|
|
243
243
|
updateTempOrderNote(note: string, sync: boolean): string | Promise<string>;
|
|
244
244
|
updateRemoteOrderNote(orderId: number | string, note: string): void;
|
|
245
|
+
/** 存储用户自定义取餐标识到当前 tempOrder.buzzer。 */
|
|
246
|
+
setPickupRef(buzzer: string): string;
|
|
245
247
|
updateTempOrderShopDiscount(amount: string | number): string;
|
|
246
248
|
updateTempOrderDepositAmount(amount: string | number): OrderSummary;
|
|
247
249
|
setPickupReferenceMode(mode: PickupReferenceMode): ShopServiceData;
|
|
@@ -1627,6 +1627,12 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
1627
1627
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
1628
1628
|
this.store.order.syncTempOrderNoteToRemote(orderId, note);
|
|
1629
1629
|
}
|
|
1630
|
+
|
|
1631
|
+
/** 存储用户自定义取餐标识到当前 tempOrder.buzzer。 */
|
|
1632
|
+
setPickupRef(buzzer) {
|
|
1633
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
1634
|
+
return this.store.order.updateTempOrderBuzzer(buzzer);
|
|
1635
|
+
}
|
|
1630
1636
|
updateTempOrderShopDiscount(amount) {
|
|
1631
1637
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
1632
1638
|
return this.store.order.updateTempOrderShopDiscount(amount);
|
|
@@ -3276,10 +3282,24 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
3276
3282
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
3277
3283
|
const beforePayments = (0, _lodashEs.cloneDeep)(this.store.order.getOrderPayments());
|
|
3278
3284
|
const pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
|
|
3285
|
+
const amountSnapshot = this.store.order.getOrderAmountSnapshot?.();
|
|
3279
3286
|
if (pendingWalletAmount.lte(0)) {
|
|
3280
|
-
|
|
3287
|
+
this.logWarning('confirmWalletPayment: 未发现待确认 Wallet 支付,跳过 Wallet 确认并按普通订单提交', {
|
|
3288
|
+
amountGap: amountSnapshot?.amountGap
|
|
3289
|
+
});
|
|
3290
|
+
const submitResult = await this.submitSalesOrder({
|
|
3291
|
+
smallTicketDataFlag: 1
|
|
3292
|
+
});
|
|
3293
|
+
if (isRejectedSalesSubmitResult(submitResult)) {
|
|
3294
|
+
throw new Error(getSalesSubmitErrorMessage(submitResult, '订单提交失败'));
|
|
3295
|
+
}
|
|
3296
|
+
const latestAmountSnapshot = this.store.order.getOrderAmountSnapshot?.();
|
|
3297
|
+
return {
|
|
3298
|
+
submitResult,
|
|
3299
|
+
payments: this.store.order.getOrderPayments(),
|
|
3300
|
+
isOrderFullyPaid: new _decimal.default(latestAmountSnapshot?.amountGap || 0).lte(0)
|
|
3301
|
+
};
|
|
3281
3302
|
}
|
|
3282
|
-
const amountSnapshot = this.store.order.getOrderAmountSnapshot?.();
|
|
3283
3303
|
const effectiveAmountDue = _decimal.default.max(new _decimal.default(amountSnapshot?.amountGap || 0).minus(pendingWalletAmount), 0);
|
|
3284
3304
|
if (effectiveAmountDue.gt(0.01)) {
|
|
3285
3305
|
throw new Error('Wallet 支付尚未覆盖全部待支付金额');
|