@pisell/pisellos 2.2.166 → 2.2.168
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/Discount/types.d.ts +1 -0
- package/dist/modules/Order/index.d.ts +2 -8
- package/dist/modules/Order/index.js +34 -16
- package/dist/modules/Order/types.d.ts +8 -0
- package/dist/modules/Order/utils.js +1 -1
- package/dist/server/modules/order/utils/filterOrders.js +20 -6
- package/dist/solution/BaseSales/index.js +81 -11
- package/dist/solution/BaseSales/types.d.ts +2 -0
- package/dist/solution/BaseSales/types.js +3 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +10 -1
- package/dist/solution/BookingTicket/index.js +369 -189
- package/dist/solution/VenueBooking/index.d.ts +1 -6
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Order/index.d.ts +2 -8
- package/lib/modules/Order/index.js +21 -9
- package/lib/modules/Order/types.d.ts +8 -0
- package/lib/modules/Order/utils.js +1 -1
- package/lib/server/modules/order/utils/filterOrders.js +12 -4
- package/lib/solution/BaseSales/index.js +60 -4
- package/lib/solution/BaseSales/types.d.ts +2 -0
- package/lib/solution/BaseSales/types.js +3 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +10 -1
- package/lib/solution/BookingTicket/index.js +77 -0
- package/lib/solution/VenueBooking/index.d.ts +1 -6
- package/package.json +1 -1
|
@@ -135,6 +135,7 @@ export interface Discount {
|
|
|
135
135
|
appliedProductDetails: ApplicableProductDetails[];
|
|
136
136
|
isDisabledForProductUsed?: boolean;
|
|
137
137
|
amount?: number;
|
|
138
|
+
customer_id?: number | string | null;
|
|
138
139
|
extension_data?: ExtensionData[];
|
|
139
140
|
total_order_behavior_count?: number;
|
|
140
141
|
today_order_behavior_count?: number;
|
|
@@ -3,10 +3,9 @@ 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, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions } from './types';
|
|
6
|
+
import type { OrderAmountSnapshot, AddProductBookingInput, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, OrderScanCodeResult, ReplaceTempOrderOptions } from './types';
|
|
7
7
|
import type { ICustomer } from '../AccountList/types';
|
|
8
8
|
import type { Discount } from '../Discount/types';
|
|
9
|
-
import { UnavailableReason } from '../Rules/types';
|
|
10
9
|
export declare class OrderModule extends BaseModule implements Module, OrderModuleAPI {
|
|
11
10
|
protected defaultName: string;
|
|
12
11
|
protected defaultVersion: string;
|
|
@@ -48,12 +47,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
48
47
|
apply?: boolean;
|
|
49
48
|
}): Promise<Discount[]>;
|
|
50
49
|
getDiscountList(): Discount[];
|
|
51
|
-
scanCode(code: string, customerId?: number): Promise<
|
|
52
|
-
isAvailable: boolean;
|
|
53
|
-
discountList: Discount[];
|
|
54
|
-
type: 'server' | 'clientCalc';
|
|
55
|
-
unavailableReason?: UnavailableReason;
|
|
56
|
-
}>;
|
|
50
|
+
scanCode(code: string, customerId?: number): Promise<OrderScanCodeResult>;
|
|
57
51
|
applyDiscount(): void;
|
|
58
52
|
initTempOrder(params: {
|
|
59
53
|
cacheId?: string;
|
|
@@ -277,6 +277,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
277
277
|
type: 'clientCalc',
|
|
278
278
|
isAvailable: false,
|
|
279
279
|
discountList: this.getDiscountList(),
|
|
280
|
+
scannedDiscountList: resultDiscountList,
|
|
280
281
|
unavailableReason: UnavailableReason.Unknown
|
|
281
282
|
});
|
|
282
283
|
case 9:
|
|
@@ -287,7 +288,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
287
288
|
return _context3.abrupt("return", {
|
|
288
289
|
type: 'server',
|
|
289
290
|
isAvailable: false,
|
|
290
|
-
discountList: this.getDiscountList()
|
|
291
|
+
discountList: this.getDiscountList(),
|
|
292
|
+
scannedDiscountList: resultDiscountList
|
|
291
293
|
});
|
|
292
294
|
case 11:
|
|
293
295
|
withScanList = resultDiscountList.map(function (item) {
|
|
@@ -309,7 +311,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
309
311
|
return _context3.abrupt("return", {
|
|
310
312
|
type: 'clientCalc',
|
|
311
313
|
isAvailable: true,
|
|
312
|
-
discountList: this.getDiscountList()
|
|
314
|
+
discountList: this.getDiscountList(),
|
|
315
|
+
scannedDiscountList: resultDiscountList
|
|
313
316
|
});
|
|
314
317
|
case 15:
|
|
315
318
|
tempOrder = this.store.tempOrder;
|
|
@@ -335,6 +338,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
335
338
|
type: 'clientCalc',
|
|
336
339
|
isAvailable: isAvailable || false,
|
|
337
340
|
discountList: newDiscountList || this.getDiscountList(),
|
|
341
|
+
scannedDiscountList: resultDiscountList,
|
|
338
342
|
unavailableReason: unavailableReason
|
|
339
343
|
});
|
|
340
344
|
case 20:
|
|
@@ -829,6 +833,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
829
833
|
this.store.tempOrder = freshTempOrder;
|
|
830
834
|
this.store.summary = createEmptySummary();
|
|
831
835
|
this.store.lastOrderInfo = undefined;
|
|
836
|
+
this.store.syncState = undefined;
|
|
832
837
|
void ((_this$store$discount9 = this.store.discount) === null || _this$store$discount9 === void 0 ? void 0 : _this$store$discount9.setOriginalDiscountList([]));
|
|
833
838
|
void ((_this$store$discount10 = this.store.discount) === null || _this$store$discount10 === void 0 ? void 0 : _this$store$discount10.setDiscountList([]));
|
|
834
839
|
this.persistTempOrder();
|
|
@@ -1411,6 +1416,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1411
1416
|
}, {
|
|
1412
1417
|
key: "addOrderPayment",
|
|
1413
1418
|
value: function addOrderPayment(payment) {
|
|
1419
|
+
this.logInfo('addOrderPayment', {
|
|
1420
|
+
payment: payment
|
|
1421
|
+
});
|
|
1414
1422
|
var tempOrder = this.ensureTempOrder();
|
|
1415
1423
|
var mapped = mapPaymentItemsToOrderPayments([payment]);
|
|
1416
1424
|
tempOrder.payments = [].concat(_toConsumableArray(tempOrder.payments || []), _toConsumableArray(mapped));
|
|
@@ -2115,43 +2123,53 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2115
2123
|
key: "syncPaymentsToOrder",
|
|
2116
2124
|
value: function () {
|
|
2117
2125
|
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
2118
|
-
var tempOrder, mappedPayments, paymentTotal, targetAmount, isFullyPaid, submitResult;
|
|
2126
|
+
var tempOrder, mappedPayments, paymentTotal, targetAmount, isFullyPaid, paymentStatus, submitResult;
|
|
2119
2127
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2120
2128
|
while (1) switch (_context22.prev = _context22.next) {
|
|
2121
2129
|
case 0:
|
|
2122
2130
|
tempOrder = this.ensureTempOrder();
|
|
2123
2131
|
mappedPayments = mapPaymentItemsToOrderPayments(params.payments || []);
|
|
2124
|
-
tempOrder.payments = mappedPayments;
|
|
2125
|
-
if (params.paymentStatus) tempOrder.payment_status = params.paymentStatus;
|
|
2126
|
-
this.persistTempOrder();
|
|
2127
|
-
_context22.next = 7;
|
|
2128
|
-
return this.saveDraft();
|
|
2129
|
-
case 7:
|
|
2130
2132
|
paymentTotal = this.calculatePaymentTotal(mappedPayments);
|
|
2131
2133
|
targetAmount = this.getPaymentTargetAmount();
|
|
2132
2134
|
isFullyPaid = targetAmount.lte(0) ? false : paymentTotal.gte(targetAmount);
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
+
paymentStatus = isFullyPaid ? params.paymentStatus || 'paid' : 'partially_paid';
|
|
2136
|
+
tempOrder.payments = mappedPayments;
|
|
2137
|
+
tempOrder.payment_status = paymentStatus;
|
|
2138
|
+
this.persistTempOrder();
|
|
2139
|
+
_context22.next = 11;
|
|
2140
|
+
return this.saveDraft();
|
|
2141
|
+
case 11:
|
|
2142
|
+
if (params.submitWhenPaid) {
|
|
2143
|
+
_context22.next = 13;
|
|
2135
2144
|
break;
|
|
2136
2145
|
}
|
|
2137
2146
|
return _context22.abrupt("return", {
|
|
2138
2147
|
isFullyPaid: isFullyPaid
|
|
2139
2148
|
});
|
|
2140
|
-
case
|
|
2141
|
-
|
|
2149
|
+
case 13:
|
|
2150
|
+
if (!(this.store.syncState === 'submitting')) {
|
|
2151
|
+
_context22.next = 15;
|
|
2152
|
+
break;
|
|
2153
|
+
}
|
|
2154
|
+
return _context22.abrupt("return", {
|
|
2155
|
+
isFullyPaid: isFullyPaid
|
|
2156
|
+
});
|
|
2157
|
+
case 15:
|
|
2158
|
+
this.store.syncState = 'submitting';
|
|
2159
|
+
_context22.next = 18;
|
|
2142
2160
|
return this.submitTempOrder({
|
|
2143
2161
|
payments: mappedPayments,
|
|
2144
|
-
paymentStatus:
|
|
2162
|
+
paymentStatus: paymentStatus,
|
|
2145
2163
|
smallTicketDataFlag: params.smallTicketDataFlag,
|
|
2146
2164
|
channel: params.channel
|
|
2147
2165
|
});
|
|
2148
|
-
case
|
|
2166
|
+
case 18:
|
|
2149
2167
|
submitResult = _context22.sent;
|
|
2150
2168
|
return _context22.abrupt("return", {
|
|
2151
2169
|
isFullyPaid: isFullyPaid,
|
|
2152
2170
|
submitResult: submitResult
|
|
2153
2171
|
});
|
|
2154
|
-
case
|
|
2172
|
+
case 20:
|
|
2155
2173
|
case "end":
|
|
2156
2174
|
return _context22.stop();
|
|
2157
2175
|
}
|
|
@@ -2,6 +2,7 @@ import { CartItem } from '../Cart/types';
|
|
|
2
2
|
import type { DiscountModule } from '../Discount';
|
|
3
3
|
import type { RulesModule } from '../Rules';
|
|
4
4
|
import type { Discount } from '../Discount/types';
|
|
5
|
+
import type { UnavailableReason } from '../Rules/types';
|
|
5
6
|
import type { SubmitPayloadEnhancer } from './utils';
|
|
6
7
|
import type { PaymentItem } from '../Payment/types';
|
|
7
8
|
import type { ICustomer } from '../AccountList/types';
|
|
@@ -48,6 +49,13 @@ export interface OrderCustomerChangePayload {
|
|
|
48
49
|
patch: OrderCustomerView;
|
|
49
50
|
snapshot: ICustomer | null;
|
|
50
51
|
}
|
|
52
|
+
export interface OrderScanCodeResult {
|
|
53
|
+
isAvailable: boolean;
|
|
54
|
+
discountList: Discount[];
|
|
55
|
+
scannedDiscountList: Discount[];
|
|
56
|
+
type: 'server' | 'clientCalc';
|
|
57
|
+
unavailableReason?: UnavailableReason;
|
|
58
|
+
}
|
|
51
59
|
export interface OrderProductIdentity {
|
|
52
60
|
product_id: number | null;
|
|
53
61
|
product_variant_id: number;
|
|
@@ -655,7 +655,7 @@ export function buildSubmitPayload(params) {
|
|
|
655
655
|
note: tempOrder.note || '',
|
|
656
656
|
delivery_type: tempOrder.delivery_type || 'nil',
|
|
657
657
|
schedule_date: scheduleDate,
|
|
658
|
-
created_at: tempOrder.created_at || formatDateTime(now),
|
|
658
|
+
// created_at: tempOrder.created_at || formatDateTime(now), 和后端协定这个字段先不提交到接口
|
|
659
659
|
bookings: (tempOrder.bookings || []).filter(function (booking) {
|
|
660
660
|
return Number(booking.parent_id) !== 0;
|
|
661
661
|
}).map(function (booking) {
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
|
+
/** 从订单 payments 提取支付方式 code,与 UI 筛选选项及 filterBookings 一致 */
|
|
3
|
+
function getOrderPaymentCodes(order) {
|
|
4
|
+
var payments = order.payments;
|
|
5
|
+
if (!Array.isArray(payments) || payments.length === 0) {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
return payments.map(function (item) {
|
|
9
|
+
return item === null || item === void 0 ? void 0 : item.code;
|
|
10
|
+
}).filter(function (code) {
|
|
11
|
+
return typeof code === 'string' && code.length > 0;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
2
15
|
/**
|
|
3
16
|
* 订单过滤函数
|
|
4
17
|
* @param orders 原始订单列表
|
|
@@ -126,22 +139,23 @@ export function filterOrders(orders, filters) {
|
|
|
126
139
|
}
|
|
127
140
|
}
|
|
128
141
|
|
|
129
|
-
// payment_methods -
|
|
142
|
+
// payment_methods - 支付方式(按 payments[].code 匹配,不再使用 order.payment_methods)
|
|
130
143
|
if (safeFilters.payment_methods && safeFilters.payment_methods.length > 0) {
|
|
131
|
-
|
|
144
|
+
var orderPaymentCodes = getOrderPaymentCodes(order);
|
|
145
|
+
if (orderPaymentCodes.length === 0) {
|
|
132
146
|
rejected.push({
|
|
133
147
|
order_id: order.order_id,
|
|
134
148
|
order_number: order.order_number,
|
|
135
149
|
reason: {
|
|
136
150
|
field: 'payment_methods',
|
|
137
|
-
actual: order.
|
|
151
|
+
actual: order.payments,
|
|
138
152
|
expected: safeFilters.payment_methods
|
|
139
153
|
}
|
|
140
154
|
});
|
|
141
155
|
return false;
|
|
142
156
|
}
|
|
143
|
-
var hasMatch =
|
|
144
|
-
return safeFilters.payment_methods.includes(
|
|
157
|
+
var hasMatch = orderPaymentCodes.some(function (code) {
|
|
158
|
+
return safeFilters.payment_methods.includes(code);
|
|
145
159
|
});
|
|
146
160
|
if (!hasMatch) {
|
|
147
161
|
rejected.push({
|
|
@@ -149,7 +163,7 @@ export function filterOrders(orders, filters) {
|
|
|
149
163
|
order_number: order.order_number,
|
|
150
164
|
reason: {
|
|
151
165
|
field: 'payment_methods',
|
|
152
|
-
actual:
|
|
166
|
+
actual: orderPaymentCodes,
|
|
153
167
|
expected: safeFilters.payment_methods
|
|
154
168
|
}
|
|
155
169
|
});
|
|
@@ -27,6 +27,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
27
27
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
28
28
|
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); }
|
|
29
29
|
import { BaseModule } from "../../modules/BaseModule";
|
|
30
|
+
import { BaseSalesHookNames } from "./types";
|
|
30
31
|
import { OrderModule } from "../../modules/Order";
|
|
31
32
|
import Decimal from 'decimal.js';
|
|
32
33
|
import { createModule } from "../BookingByStep/types";
|
|
@@ -1347,17 +1348,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1347
1348
|
});
|
|
1348
1349
|
case 48:
|
|
1349
1350
|
this.store.order.persistTempOrder();
|
|
1350
|
-
|
|
1351
|
+
this.effectsEmit('onDiscountApplied', {
|
|
1352
|
+
productList: tempOrder.products,
|
|
1353
|
+
discountList: nextDiscountList,
|
|
1354
|
+
selectedDiscountList: tempOrder.discount_list,
|
|
1355
|
+
tempOrder: tempOrder
|
|
1356
|
+
});
|
|
1357
|
+
_context14.next = 55;
|
|
1351
1358
|
break;
|
|
1352
|
-
case
|
|
1353
|
-
_context14.prev =
|
|
1359
|
+
case 52:
|
|
1360
|
+
_context14.prev = 52;
|
|
1354
1361
|
_context14.t1 = _context14["catch"](0);
|
|
1355
1362
|
throw _context14.t1;
|
|
1356
|
-
case
|
|
1363
|
+
case 55:
|
|
1357
1364
|
case "end":
|
|
1358
1365
|
return _context14.stop();
|
|
1359
1366
|
}
|
|
1360
|
-
}, _callee14, this, [[0,
|
|
1367
|
+
}, _callee14, this, [[0, 52], [16, 36, 39, 42]]);
|
|
1361
1368
|
}));
|
|
1362
1369
|
function setDiscountSelected(_x9) {
|
|
1363
1370
|
return _setDiscountSelected.apply(this, arguments);
|
|
@@ -1500,7 +1507,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1500
1507
|
value: function () {
|
|
1501
1508
|
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
|
|
1502
1509
|
var _params$channel;
|
|
1503
|
-
var channel;
|
|
1510
|
+
var channel, syncParams, syncState, payments, syncResult;
|
|
1504
1511
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1505
1512
|
while (1) switch (_context18.prev = _context18.next) {
|
|
1506
1513
|
case 0:
|
|
@@ -1511,14 +1518,60 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1511
1518
|
throw new Error('order 模块未初始化');
|
|
1512
1519
|
case 2:
|
|
1513
1520
|
channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
|
|
1514
|
-
|
|
1521
|
+
syncParams = _objectSpread(_objectSpread({}, params), channel !== undefined ? {
|
|
1515
1522
|
channel: channel
|
|
1516
|
-
} : {})
|
|
1517
|
-
|
|
1523
|
+
} : {});
|
|
1524
|
+
syncState = this.store.order.getOrderSyncState();
|
|
1525
|
+
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
1526
|
+
_context18.next = 7;
|
|
1527
|
+
break;
|
|
1528
|
+
}
|
|
1529
|
+
return _context18.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
1530
|
+
case 7:
|
|
1531
|
+
payments = params.payments || [];
|
|
1532
|
+
_context18.next = 10;
|
|
1533
|
+
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
1534
|
+
payments: payments,
|
|
1535
|
+
params: syncParams,
|
|
1536
|
+
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
1537
|
+
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
1538
|
+
});
|
|
1539
|
+
case 10:
|
|
1540
|
+
_context18.prev = 10;
|
|
1541
|
+
_context18.next = 13;
|
|
1542
|
+
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
1543
|
+
case 13:
|
|
1544
|
+
syncResult = _context18.sent;
|
|
1545
|
+
_context18.next = 16;
|
|
1546
|
+
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
1547
|
+
ok: true,
|
|
1548
|
+
syncResult: syncResult,
|
|
1549
|
+
payments: this.store.order.getOrderPayments(),
|
|
1550
|
+
params: syncParams,
|
|
1551
|
+
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
1552
|
+
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
1553
|
+
});
|
|
1554
|
+
case 16:
|
|
1555
|
+
return _context18.abrupt("return", syncResult);
|
|
1556
|
+
case 19:
|
|
1557
|
+
_context18.prev = 19;
|
|
1558
|
+
_context18.t0 = _context18["catch"](10);
|
|
1559
|
+
_context18.next = 23;
|
|
1560
|
+
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
1561
|
+
ok: false,
|
|
1562
|
+
error: _context18.t0,
|
|
1563
|
+
payments: this.store.order.getOrderPayments(),
|
|
1564
|
+
params: syncParams,
|
|
1565
|
+
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
1566
|
+
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
1567
|
+
});
|
|
1568
|
+
case 23:
|
|
1569
|
+
throw _context18.t0;
|
|
1570
|
+
case 24:
|
|
1518
1571
|
case "end":
|
|
1519
1572
|
return _context18.stop();
|
|
1520
1573
|
}
|
|
1521
|
-
}, _callee18, this);
|
|
1574
|
+
}, _callee18, this, [[10, 19]]);
|
|
1522
1575
|
}));
|
|
1523
1576
|
function syncPaymentsToOrder(_x13) {
|
|
1524
1577
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
@@ -1544,8 +1597,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1544
1597
|
}, {
|
|
1545
1598
|
key: "addOrderPayment",
|
|
1546
1599
|
value: function addOrderPayment(payment) {
|
|
1600
|
+
var _this5 = this;
|
|
1547
1601
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
1548
|
-
|
|
1602
|
+
var payments = this.store.order.addOrderPayment(payment);
|
|
1603
|
+
var amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
1604
|
+
var syncState = this.store.order.getOrderSyncState();
|
|
1605
|
+
if (amountSnapshot && syncState !== 'submitting') {
|
|
1606
|
+
var paymentStatus = Number(amountSnapshot.amountGap || 0) <= 0 ? 'paid' : 'partially_paid';
|
|
1607
|
+
void this.syncPaymentsToOrder({
|
|
1608
|
+
payments: payments,
|
|
1609
|
+
paymentStatus: paymentStatus,
|
|
1610
|
+
submitWhenPaid: true,
|
|
1611
|
+
smallTicketDataFlag: 1
|
|
1612
|
+
}).catch(function (error) {
|
|
1613
|
+
_this5.logError('auto sync payments failed', {
|
|
1614
|
+
error: error instanceof Error ? error.message : String(error)
|
|
1615
|
+
});
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1618
|
+
return payments;
|
|
1549
1619
|
}
|
|
1550
1620
|
|
|
1551
1621
|
/** 更新当前订单中的指定支付项。 */
|
|
@@ -11,6 +11,8 @@ export declare const BaseSalesHookNames: {
|
|
|
11
11
|
readonly onRetryInit: "onRetryInit";
|
|
12
12
|
readonly onRefresh: "onRefresh";
|
|
13
13
|
readonly onCartValidationChanged: "onCartValidationChanged";
|
|
14
|
+
readonly onPaymentSyncStart: "onPaymentSyncStart";
|
|
15
|
+
readonly onPaymentSyncEnd: "onPaymentSyncEnd";
|
|
14
16
|
};
|
|
15
17
|
export type BaseSalesHookName = typeof BaseSalesHookNames[keyof typeof BaseSalesHookNames];
|
|
16
18
|
export declare function createBaseSalesHook(moduleName: string, hookName: BaseSalesHookName): string;
|
|
@@ -7,7 +7,9 @@ export var BaseSalesHookNames = {
|
|
|
7
7
|
onDestroy: 'onDestroy',
|
|
8
8
|
onRetryInit: 'onRetryInit',
|
|
9
9
|
onRefresh: 'onRefresh',
|
|
10
|
-
onCartValidationChanged: 'onCartValidationChanged'
|
|
10
|
+
onCartValidationChanged: 'onCartValidationChanged',
|
|
11
|
+
onPaymentSyncStart: 'onPaymentSyncStart',
|
|
12
|
+
onPaymentSyncEnd: 'onPaymentSyncEnd'
|
|
11
13
|
};
|
|
12
14
|
export function createBaseSalesHook(moduleName, hookName) {
|
|
13
15
|
return "".concat(moduleName, ":").concat(hookName);
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 |
|
|
314
|
+
weekNum: 0 | 1 | 2 | 6 | 3 | 5 | 4;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -4,6 +4,7 @@ import type { ProductData } from '../../modules';
|
|
|
4
4
|
import { type BookingContextConfig, type BookingContextDateInput, type BookingContextResource, type BookingContextResourceMap, type BookingContextState, type InitBookingContextParams, type LoadBookingConfigParams, type LoadBookingResourcesParams, type ResourceError, type BookingCalcContext } from '../../modules/BookingContext';
|
|
5
5
|
import type { OrderCustomerView } from '../../modules/Order/types';
|
|
6
6
|
import { BaseSalesImpl } from '../BaseSales';
|
|
7
|
+
import type { BaseSalesScanCodeResult } from '../BaseSales/types';
|
|
7
8
|
import type { ISalesDetail } from '../BaseSales/utils/parseSalesResponse';
|
|
8
9
|
import type { LoadSalesDetailParams } from '../../modules/Order/types';
|
|
9
10
|
import { AddProductDecideContext, AddProductRequiresDetailPayload } from './utils/addProductDecision';
|
|
@@ -43,6 +44,14 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
43
44
|
* 让现有 setActiveCustomer / getActiveCustomer 调用方零成本拿到详情态客户。
|
|
44
45
|
*/
|
|
45
46
|
loadSalesDetail(orderIdOrParams: number | string | LoadSalesDetailParams): Promise<ISalesDetail>;
|
|
47
|
+
scanPromotionCode(code: string, customerId?: number): Promise<BaseSalesScanCodeResult>;
|
|
48
|
+
private hydrateOrderCustomerFromScanDiscounts;
|
|
49
|
+
private getDiscountCustomerId;
|
|
50
|
+
private resolveCustomerByDiscountCustomerId;
|
|
51
|
+
private findCustomerById;
|
|
52
|
+
private normalizeCustomer;
|
|
53
|
+
private getRawCustomerId;
|
|
54
|
+
private hasUsableCustomerDetails;
|
|
46
55
|
/**
|
|
47
56
|
* 更新当前预约的 appointment_status。
|
|
48
57
|
*
|
|
@@ -251,7 +260,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
251
260
|
* 获取当前的客户搜索条件
|
|
252
261
|
* @returns 当前搜索条件
|
|
253
262
|
*/
|
|
254
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
263
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
255
264
|
/**
|
|
256
265
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
257
266
|
* @returns 客户状态
|