@pisell/pisellos 2.2.168 → 2.2.170
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/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +51 -15
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +11 -1
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +26 -2
- package/dist/modules/Customer/index.d.ts +6 -0
- package/dist/modules/Customer/index.js +122 -77
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Order/index.d.ts +3 -2
- package/dist/modules/Order/index.js +47 -7
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +212 -0
- package/dist/modules/Order/utils.d.ts +4 -0
- package/dist/modules/Order/utils.js +26 -10
- package/dist/modules/Rules/index.d.ts +4 -0
- package/dist/modules/Rules/index.js +26 -10
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +37 -6
- package/dist/solution/BaseSales/utils.js +11 -2
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +4 -4
- package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -1
- package/dist/solution/ScanOrder/utils.js +11 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +42 -9
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +11 -1
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +22 -1
- package/lib/modules/Customer/index.d.ts +6 -0
- package/lib/modules/Customer/index.js +18 -3
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Order/index.d.ts +3 -2
- package/lib/modules/Order/index.js +46 -3
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +207 -0
- package/lib/modules/Order/utils.d.ts +4 -0
- package/lib/modules/Order/utils.js +46 -9
- package/lib/modules/Rules/index.d.ts +4 -0
- package/lib/modules/Rules/index.js +22 -14
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +42 -4
- package/lib/solution/BaseSales/utils.js +10 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +2 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.js +3 -1
- package/lib/solution/ScanOrder/utils.js +10 -2
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// 导出评估器
|
|
2
|
+
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
+
|
|
4
|
+
// 导出适配器
|
|
5
|
+
export { PromotionAdapter } from "./adapter";
|
|
6
|
+
export { default } from "./adapter";
|
|
7
|
+
|
|
8
|
+
// 导出策略配置示例常量
|
|
9
|
+
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
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); }
|
|
2
1
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
2
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
3
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
4
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
5
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
6
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
+
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); }
|
|
8
8
|
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; }
|
|
9
9
|
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; }
|
|
10
10
|
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; }
|
|
11
11
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
12
12
|
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); }
|
|
13
13
|
import dayjs from 'dayjs';
|
|
14
|
+
import { resolveManualDiscountMessage } from "../../Order/utils/manualProductDiscount";
|
|
14
15
|
function safeFormat(value, fmt) {
|
|
15
16
|
if (value === undefined || value === null) return undefined;
|
|
16
17
|
var d = dayjs(value);
|
|
@@ -52,16 +53,37 @@ function unflattenResourceMap(resources) {
|
|
|
52
53
|
});
|
|
53
54
|
return map;
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 从 booking.metadata.capacity 还原 `_extend.capacity`(与 info2 ticketBooking getCapacity 对齐)。
|
|
59
|
+
* 勿用 resources[].relation_id 反推人数维度 id。
|
|
60
|
+
*/
|
|
61
|
+
function resolveCapacityFromBooking(booking) {
|
|
62
|
+
var _booking$metadata;
|
|
63
|
+
var metaCap = (_booking$metadata = booking.metadata) === null || _booking$metadata === void 0 ? void 0 : _booking$metadata.capacity;
|
|
64
|
+
if (Array.isArray(metaCap) && metaCap.length > 0) {
|
|
65
|
+
return metaCap.map(function (item) {
|
|
66
|
+
var _item$value;
|
|
67
|
+
if (!item || _typeof(item) !== 'object') return null;
|
|
68
|
+
if (item.id === undefined || item.id === null) return null;
|
|
69
|
+
var row = {
|
|
70
|
+
id: item.id,
|
|
71
|
+
value: Number((_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : 0)
|
|
72
|
+
};
|
|
73
|
+
if (item.name !== undefined) row.name = item.name;
|
|
74
|
+
return row;
|
|
75
|
+
}).filter(function (item) {
|
|
76
|
+
return item != null;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (typeof metaCap === 'number' && Number.isFinite(metaCap)) {
|
|
80
|
+
return [{
|
|
81
|
+
id: 0,
|
|
82
|
+
value: metaCap,
|
|
83
|
+
name: ''
|
|
84
|
+
}];
|
|
85
|
+
}
|
|
86
|
+
return [];
|
|
65
87
|
}
|
|
66
88
|
function resolveDurationForExtend(booking) {
|
|
67
89
|
var duration = booking.duration;
|
|
@@ -81,7 +103,7 @@ function resolveDurationForExtend(booking) {
|
|
|
81
103
|
* 调用方须传入与该行关联的 booking(通常 bookings[].product_uid === product.metadata.unique_identification_number)。
|
|
82
104
|
*/
|
|
83
105
|
export function buildCacheItemFromOrderLine(input) {
|
|
84
|
-
var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$
|
|
106
|
+
var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$product_vari, _product$num, _ref, _ref2, _title, _booking$product, _booking$detail, _ref3, _product$note, _booking$detail2, _product$metadata, _product$metadata2, _ref4, _extension_type, _booking$product2, _title2, _booking$product3, _price, _product$order_detail, _ref5, _booking$id;
|
|
85
107
|
var product = input.product,
|
|
86
108
|
booking = input.booking,
|
|
87
109
|
sourceProduct = input.sourceProduct;
|
|
@@ -93,8 +115,8 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
93
115
|
var startTime = normalizeTimeString(booking.start_time);
|
|
94
116
|
var endTime = normalizeTimeString(booking.end_time);
|
|
95
117
|
var resource = unflattenResourceMap(booking.resources);
|
|
96
|
-
var capacity =
|
|
97
|
-
var holderId = (_booking$metadata$hol = (_booking$
|
|
118
|
+
var capacity = resolveCapacityFromBooking(booking);
|
|
119
|
+
var holderId = (_booking$metadata$hol = (_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.holder_id) !== null && _booking$metadata$hol !== void 0 ? _booking$metadata$hol : booking.holder_id;
|
|
98
120
|
var other = {
|
|
99
121
|
product_variant_id: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : 0,
|
|
100
122
|
option: Array.isArray(product.product_option_item) ? _toConsumableArray(product.product_option_item) : [],
|
|
@@ -119,8 +141,22 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
119
141
|
capacity: capacity,
|
|
120
142
|
holder_id: holderId,
|
|
121
143
|
other: other,
|
|
122
|
-
like_status: booking.like_status || 'common'
|
|
144
|
+
like_status: booking.like_status || 'common',
|
|
145
|
+
discount_reason: resolveManualDiscountMessage(product.discount_list, (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.product_discount_reason) || undefined
|
|
123
146
|
};
|
|
147
|
+
var manualDiscount = (product.discount_list || []).find(function (d) {
|
|
148
|
+
return (d === null || d === void 0 ? void 0 : d.type) === 'product';
|
|
149
|
+
});
|
|
150
|
+
if (manualDiscount && extend.origin_total === selling) {
|
|
151
|
+
var _manualDiscount$amoun;
|
|
152
|
+
var manualAmount = Number((_manualDiscount$amoun = manualDiscount.amount) !== null && _manualDiscount$amoun !== void 0 ? _manualDiscount$amoun : 0);
|
|
153
|
+
if (Number.isFinite(manualAmount) && manualAmount > 0) {
|
|
154
|
+
extend.origin_total = selling + manualAmount;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (((_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.price_override) != null || manualDiscount) {
|
|
158
|
+
extend.priceOverride = selling;
|
|
159
|
+
}
|
|
124
160
|
if (booking.holder !== undefined) {
|
|
125
161
|
extend.holder = booking.holder;
|
|
126
162
|
}
|
|
@@ -50,11 +50,21 @@ export interface BookingResourceInput {
|
|
|
50
50
|
metadata?: Record<string, any>;
|
|
51
51
|
children?: any[];
|
|
52
52
|
}
|
|
53
|
+
/** custom / package 人数维度快照,与 info2 `_extend.capacity` / `metadata.capacity` 对齐。 */
|
|
54
|
+
export interface BookingCapacityMetadataItem {
|
|
55
|
+
id: string | number;
|
|
56
|
+
value: number;
|
|
57
|
+
name?: Record<string, any> | string;
|
|
58
|
+
}
|
|
53
59
|
export interface BookingMetadataInput {
|
|
54
60
|
/** 由 OS createLinkedProductAndBooking 统一改写,这里不生成。 */
|
|
55
61
|
unique_identification_number?: string;
|
|
56
62
|
collect_pax?: number;
|
|
57
|
-
|
|
63
|
+
/**
|
|
64
|
+
* 资源容量快照:custom 多维度时为 `{ id, value, name? }[]`;
|
|
65
|
+
* 仅总和场景可为 number(capacity_snapshot 兼容)。
|
|
66
|
+
*/
|
|
67
|
+
capacity?: number | BookingCapacityMetadataItem[];
|
|
58
68
|
/** 协议要求始终提交(即使为 null)。 */
|
|
59
69
|
holder_id: any;
|
|
60
70
|
resource_select_type?: 'single' | 'multiple' | string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
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); }
|
|
2
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; }
|
|
3
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; }
|
|
4
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; }
|
|
5
4
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
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
7
|
import dayjs from 'dayjs';
|
|
8
8
|
import { isMultiDayProduct, isSessionProduct, getDays } from "./serviceTimes";
|
|
9
9
|
import { getSumCapacity } from "./resources";
|
|
@@ -28,6 +28,26 @@ import { flexibleObj } from "./flexible";
|
|
|
28
28
|
* 由 UI 在 `cart.confirmDetail` 之外通过辅助 API 处理。
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
+
/** custom / package 人数维度快照,与 info2 `_extend.capacity` / `metadata.capacity` 对齐。 */
|
|
32
|
+
|
|
33
|
+
/** 将 UI `_extend.capacity[]` 规范化为 booking.metadata.capacity。 */
|
|
34
|
+
function normalizeExtendCapacityForMetadata(capacity) {
|
|
35
|
+
if (!Array.isArray(capacity) || capacity.length === 0) return undefined;
|
|
36
|
+
var normalized = capacity.map(function (item) {
|
|
37
|
+
var _item$value;
|
|
38
|
+
if (!item || _typeof(item) !== 'object') return null;
|
|
39
|
+
if (item.id === undefined || item.id === null) return null;
|
|
40
|
+
var row = {
|
|
41
|
+
id: item.id,
|
|
42
|
+
value: Number((_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : 0)
|
|
43
|
+
};
|
|
44
|
+
if (item.name !== undefined) row.name = item.name;
|
|
45
|
+
return row;
|
|
46
|
+
}).filter(function (item) {
|
|
47
|
+
return item != null;
|
|
48
|
+
});
|
|
49
|
+
return normalized.length > 0 ? normalized : undefined;
|
|
50
|
+
}
|
|
31
51
|
function safeFormat(value, fmt) {
|
|
32
52
|
if (value === undefined || value === null) return undefined;
|
|
33
53
|
var d = dayjs(value);
|
|
@@ -174,7 +194,11 @@ export function cacheItemToBookingInput(cacheItem, options) {
|
|
|
174
194
|
metadata.holder_id = ext.holder_id;
|
|
175
195
|
}
|
|
176
196
|
if (ext.collect_pax !== undefined) metadata.collect_pax = ext.collect_pax;
|
|
177
|
-
|
|
197
|
+
// 与 info2 formatMetaData 一致:优先写入完整人数维度数组,供编辑回显 / 详情回灌。
|
|
198
|
+
var extendCapacity = normalizeExtendCapacityForMetadata(ext.capacity);
|
|
199
|
+
if (extendCapacity) {
|
|
200
|
+
metadata.capacity = extendCapacity;
|
|
201
|
+
} else if (ext.capacity_snapshot !== undefined) {
|
|
178
202
|
metadata.capacity = ext.capacity_snapshot;
|
|
179
203
|
}
|
|
180
204
|
var selectType = deriveResourceSelectType(cacheItem) || (options === null || options === void 0 || (_options$bookingConfi = options.bookingConfig) === null || _options$bookingConfi === void 0 ? void 0 : _options$bookingConfi.resource_select_type);
|
|
@@ -24,6 +24,12 @@ export declare class CustomerModule extends BaseModule implements Module, Custom
|
|
|
24
24
|
* @param operation 操作名称
|
|
25
25
|
*/
|
|
26
26
|
private handleCustomerListError;
|
|
27
|
+
/**
|
|
28
|
+
* 查询客户列表但不写入 customerList / pagination 状态。
|
|
29
|
+
*
|
|
30
|
+
* 用于按 ID 补齐客户等内部查询,避免把临时的 num/searchParams 污染到滚动列表。
|
|
31
|
+
*/
|
|
32
|
+
queryCustomerList(params?: ShopGetCustomerListParams): Promise<ICustomerListResponse>;
|
|
27
33
|
/**
|
|
28
34
|
* 获取客户列表
|
|
29
35
|
* @param params 查询参数
|
|
@@ -95,7 +95,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
95
95
|
} else {
|
|
96
96
|
this.store.currentPage = 1;
|
|
97
97
|
}
|
|
98
|
-
if (typeof (options === null || options === void 0 || (_options$initialState5 = options.initialState) === null || _options$initialState5 === void 0 ? void 0 : _options$initialState5.pageSize) === 'number') {
|
|
98
|
+
if (typeof (options === null || options === void 0 || (_options$initialState5 = options.initialState) === null || _options$initialState5 === void 0 ? void 0 : _options$initialState5.pageSize) === 'number' && options.initialState.pageSize > 1) {
|
|
99
99
|
this.store.pageSize = options.initialState.pageSize;
|
|
100
100
|
} else {
|
|
101
101
|
this.store.pageSize = DEFAULT_PAGE_SIZE;
|
|
@@ -236,6 +236,52 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
236
236
|
}
|
|
237
237
|
return handleCustomerListError;
|
|
238
238
|
}()
|
|
239
|
+
/**
|
|
240
|
+
* 查询客户列表但不写入 customerList / pagination 状态。
|
|
241
|
+
*
|
|
242
|
+
* 用于按 ID 补齐客户等内部查询,避免把临时的 num/searchParams 污染到滚动列表。
|
|
243
|
+
*/
|
|
244
|
+
)
|
|
245
|
+
}, {
|
|
246
|
+
key: "queryCustomerList",
|
|
247
|
+
value: (function () {
|
|
248
|
+
var _queryCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
249
|
+
var params,
|
|
250
|
+
_yield$this$fetchCust,
|
|
251
|
+
customerList,
|
|
252
|
+
total,
|
|
253
|
+
page,
|
|
254
|
+
pageSize,
|
|
255
|
+
_args4 = arguments;
|
|
256
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
257
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
258
|
+
case 0:
|
|
259
|
+
params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
|
|
260
|
+
_context4.next = 3;
|
|
261
|
+
return this.fetchCustomerListData(params);
|
|
262
|
+
case 3:
|
|
263
|
+
_yield$this$fetchCust = _context4.sent;
|
|
264
|
+
customerList = _yield$this$fetchCust.customerList;
|
|
265
|
+
total = _yield$this$fetchCust.total;
|
|
266
|
+
page = _yield$this$fetchCust.page;
|
|
267
|
+
pageSize = _yield$this$fetchCust.pageSize;
|
|
268
|
+
return _context4.abrupt("return", {
|
|
269
|
+
list: customerList,
|
|
270
|
+
total: total,
|
|
271
|
+
page: page,
|
|
272
|
+
pageSize: pageSize
|
|
273
|
+
});
|
|
274
|
+
case 9:
|
|
275
|
+
case "end":
|
|
276
|
+
return _context4.stop();
|
|
277
|
+
}
|
|
278
|
+
}, _callee4, this);
|
|
279
|
+
}));
|
|
280
|
+
function queryCustomerList() {
|
|
281
|
+
return _queryCustomerList.apply(this, arguments);
|
|
282
|
+
}
|
|
283
|
+
return queryCustomerList;
|
|
284
|
+
}()
|
|
239
285
|
/**
|
|
240
286
|
* 获取客户列表
|
|
241
287
|
* @param params 查询参数
|
|
@@ -245,9 +291,9 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
245
291
|
}, {
|
|
246
292
|
key: "getCustomerList",
|
|
247
293
|
value: (function () {
|
|
248
|
-
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
294
|
+
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
249
295
|
var params,
|
|
250
|
-
_yield$this$
|
|
296
|
+
_yield$this$fetchCust2,
|
|
251
297
|
customerList,
|
|
252
298
|
total,
|
|
253
299
|
page,
|
|
@@ -256,22 +302,22 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
256
302
|
num,
|
|
257
303
|
searchParams,
|
|
258
304
|
response,
|
|
259
|
-
|
|
260
|
-
return _regeneratorRuntime().wrap(function
|
|
261
|
-
while (1) switch (
|
|
305
|
+
_args5 = arguments;
|
|
306
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
307
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
262
308
|
case 0:
|
|
263
|
-
params =
|
|
264
|
-
|
|
309
|
+
params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
|
|
310
|
+
_context5.prev = 1;
|
|
265
311
|
this.store.loading = true;
|
|
266
312
|
this.store.error = null;
|
|
267
|
-
|
|
313
|
+
_context5.next = 6;
|
|
268
314
|
return this.fetchCustomerListData(params);
|
|
269
315
|
case 6:
|
|
270
|
-
_yield$this$
|
|
271
|
-
customerList = _yield$this$
|
|
272
|
-
total = _yield$this$
|
|
273
|
-
page = _yield$this$
|
|
274
|
-
pageSize = _yield$this$
|
|
316
|
+
_yield$this$fetchCust2 = _context5.sent;
|
|
317
|
+
customerList = _yield$this$fetchCust2.customerList;
|
|
318
|
+
total = _yield$this$fetchCust2.total;
|
|
319
|
+
page = _yield$this$fetchCust2.page;
|
|
320
|
+
pageSize = _yield$this$fetchCust2.pageSize;
|
|
275
321
|
// 保存搜索条件(排除skip和num)
|
|
276
322
|
skip = params.skip, num = params.num, searchParams = _objectWithoutProperties(params, _excluded2);
|
|
277
323
|
this.store.searchParams = cloneDeep(searchParams);
|
|
@@ -300,27 +346,27 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
300
346
|
page: page,
|
|
301
347
|
pageSize: pageSize
|
|
302
348
|
};
|
|
303
|
-
return
|
|
349
|
+
return _context5.abrupt("return", response);
|
|
304
350
|
case 23:
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
return this.handleCustomerListError(
|
|
351
|
+
_context5.prev = 23;
|
|
352
|
+
_context5.t0 = _context5["catch"](1);
|
|
353
|
+
_context5.next = 27;
|
|
354
|
+
return this.handleCustomerListError(_context5.t0, 'fetch customer list');
|
|
309
355
|
case 27:
|
|
310
|
-
throw
|
|
356
|
+
throw _context5.t0;
|
|
311
357
|
case 28:
|
|
312
|
-
|
|
358
|
+
_context5.prev = 28;
|
|
313
359
|
this.store.loading = false;
|
|
314
360
|
this.storeChange();
|
|
315
|
-
|
|
361
|
+
_context5.next = 33;
|
|
316
362
|
return this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), this.store);
|
|
317
363
|
case 33:
|
|
318
|
-
return
|
|
364
|
+
return _context5.finish(28);
|
|
319
365
|
case 34:
|
|
320
366
|
case "end":
|
|
321
|
-
return
|
|
367
|
+
return _context5.stop();
|
|
322
368
|
}
|
|
323
|
-
},
|
|
369
|
+
}, _callee5, this, [[1, 23, 28, 34]]);
|
|
324
370
|
}));
|
|
325
371
|
function getCustomerList() {
|
|
326
372
|
return _getCustomerList.apply(this, arguments);
|
|
@@ -494,10 +540,10 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
494
540
|
}, {
|
|
495
541
|
key: "changeCustomerPage",
|
|
496
542
|
value: (function () {
|
|
497
|
-
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
543
|
+
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(page, pageSize) {
|
|
498
544
|
var targetPageSize, skip, num;
|
|
499
|
-
return _regeneratorRuntime().wrap(function
|
|
500
|
-
while (1) switch (
|
|
545
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
546
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
501
547
|
case 0:
|
|
502
548
|
targetPageSize = pageSize || this.store.pageSize; // 先更新分页状态
|
|
503
549
|
this.setPaginationInfo(page, targetPageSize);
|
|
@@ -505,18 +551,18 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
505
551
|
// skip直接使用page,num使用pageSize
|
|
506
552
|
skip = page;
|
|
507
553
|
num = targetPageSize; // 自动调用获取客户列表,使用存储的搜索条件
|
|
508
|
-
|
|
554
|
+
_context6.next = 6;
|
|
509
555
|
return this.getCustomerList(_objectSpread({
|
|
510
556
|
skip: skip,
|
|
511
557
|
num: num
|
|
512
558
|
}, this.store.searchParams));
|
|
513
559
|
case 6:
|
|
514
|
-
return
|
|
560
|
+
return _context6.abrupt("return", _context6.sent);
|
|
515
561
|
case 7:
|
|
516
562
|
case "end":
|
|
517
|
-
return
|
|
563
|
+
return _context6.stop();
|
|
518
564
|
}
|
|
519
|
-
},
|
|
565
|
+
}, _callee6, this);
|
|
520
566
|
}));
|
|
521
567
|
function changeCustomerPage(_x5, _x6) {
|
|
522
568
|
return _changeCustomerPage.apply(this, arguments);
|
|
@@ -531,16 +577,16 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
531
577
|
}, {
|
|
532
578
|
key: "loadMoreCustomers",
|
|
533
579
|
value: (function () {
|
|
534
|
-
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
535
|
-
var nextPage, _yield$this$
|
|
536
|
-
return _regeneratorRuntime().wrap(function
|
|
537
|
-
while (1) switch (
|
|
580
|
+
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
581
|
+
var nextPage, loadMoreParams, _yield$this$fetchCust3, newCustomers, total, page, pageSize, updatedCustomerList, response;
|
|
582
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
583
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
538
584
|
case 0:
|
|
539
585
|
if (!(!this.store.hasMore || this.store.loadingMore)) {
|
|
540
|
-
|
|
586
|
+
_context7.next = 2;
|
|
541
587
|
break;
|
|
542
588
|
}
|
|
543
|
-
return
|
|
589
|
+
return _context7.abrupt("return", {
|
|
544
590
|
list: [],
|
|
545
591
|
total: this.store.total,
|
|
546
592
|
page: this.store.currentPage,
|
|
@@ -549,22 +595,21 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
549
595
|
case 2:
|
|
550
596
|
// 计算下一页
|
|
551
597
|
nextPage = this.store.currentPage + 1;
|
|
552
|
-
|
|
598
|
+
_context7.prev = 3;
|
|
553
599
|
this.store.loadingMore = true;
|
|
554
600
|
this.store.error = null;
|
|
555
|
-
|
|
556
|
-
// 使用公共方法获取数据,传入存储的搜索条件
|
|
557
|
-
_context6.next = 8;
|
|
558
|
-
return this.fetchCustomerListData(_objectSpread({
|
|
601
|
+
loadMoreParams = _objectSpread({
|
|
559
602
|
skip: nextPage,
|
|
560
603
|
num: this.store.pageSize
|
|
561
|
-
}, this.store.searchParams)
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
604
|
+
}, this.store.searchParams); // 使用公共方法获取数据,传入存储的搜索条件
|
|
605
|
+
_context7.next = 9;
|
|
606
|
+
return this.fetchCustomerListData(loadMoreParams);
|
|
607
|
+
case 9:
|
|
608
|
+
_yield$this$fetchCust3 = _context7.sent;
|
|
609
|
+
newCustomers = _yield$this$fetchCust3.customerList;
|
|
610
|
+
total = _yield$this$fetchCust3.total;
|
|
611
|
+
page = _yield$this$fetchCust3.page;
|
|
612
|
+
pageSize = _yield$this$fetchCust3.pageSize;
|
|
568
613
|
// 将新数据追加到现有列表(追加模式)
|
|
569
614
|
updatedCustomerList = [].concat(_toConsumableArray(this.store.customerList), _toConsumableArray(cloneDeep(newCustomers))); // 更新状态
|
|
570
615
|
this.store.customerList = updatedCustomerList;
|
|
@@ -573,14 +618,14 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
573
618
|
this.store.hasMore = page * pageSize < total;
|
|
574
619
|
|
|
575
620
|
// 触发滚动加载特定事件
|
|
576
|
-
|
|
621
|
+
_context7.next = 21;
|
|
577
622
|
return this.core.effects.emit("".concat(this.name, ":onScrollLoadMore"), {
|
|
578
623
|
newCustomers: newCustomers,
|
|
579
624
|
allCustomers: this.store.customerList,
|
|
580
625
|
currentPage: page,
|
|
581
626
|
hasMore: this.store.hasMore
|
|
582
627
|
});
|
|
583
|
-
case
|
|
628
|
+
case 21:
|
|
584
629
|
// 触发分页变化事件
|
|
585
630
|
this.triggerPaginationChange({
|
|
586
631
|
page: page,
|
|
@@ -595,27 +640,27 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
595
640
|
page: page,
|
|
596
641
|
pageSize: pageSize
|
|
597
642
|
};
|
|
598
|
-
return
|
|
599
|
-
case
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
return this.handleCustomerListError(
|
|
604
|
-
case 29:
|
|
605
|
-
throw _context6.t0;
|
|
643
|
+
return _context7.abrupt("return", response);
|
|
644
|
+
case 26:
|
|
645
|
+
_context7.prev = 26;
|
|
646
|
+
_context7.t0 = _context7["catch"](3);
|
|
647
|
+
_context7.next = 30;
|
|
648
|
+
return this.handleCustomerListError(_context7.t0, 'load more customers');
|
|
606
649
|
case 30:
|
|
607
|
-
|
|
650
|
+
throw _context7.t0;
|
|
651
|
+
case 31:
|
|
652
|
+
_context7.prev = 31;
|
|
608
653
|
this.store.loadingMore = false;
|
|
609
654
|
this.storeChange();
|
|
610
|
-
|
|
655
|
+
_context7.next = 36;
|
|
611
656
|
return this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), this.store);
|
|
612
|
-
case 35:
|
|
613
|
-
return _context6.finish(30);
|
|
614
657
|
case 36:
|
|
658
|
+
return _context7.finish(31);
|
|
659
|
+
case 37:
|
|
615
660
|
case "end":
|
|
616
|
-
return
|
|
661
|
+
return _context7.stop();
|
|
617
662
|
}
|
|
618
|
-
},
|
|
663
|
+
}, _callee7, this, [[3, 26, 31, 37]]);
|
|
619
664
|
}));
|
|
620
665
|
function loadMoreCustomers() {
|
|
621
666
|
return _loadMoreCustomers.apply(this, arguments);
|
|
@@ -631,15 +676,15 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
631
676
|
}, {
|
|
632
677
|
key: "resetAndLoadCustomers",
|
|
633
678
|
value: (function () {
|
|
634
|
-
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
679
|
+
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
635
680
|
var params,
|
|
636
681
|
resetParams,
|
|
637
682
|
response,
|
|
638
|
-
|
|
639
|
-
return _regeneratorRuntime().wrap(function
|
|
640
|
-
while (1) switch (
|
|
683
|
+
_args8 = arguments;
|
|
684
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
685
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
641
686
|
case 0:
|
|
642
|
-
params =
|
|
687
|
+
params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
|
|
643
688
|
// 重置状态
|
|
644
689
|
this.store.customerList = [];
|
|
645
690
|
this.store.currentPage = 1;
|
|
@@ -651,23 +696,23 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
651
696
|
skip: 1,
|
|
652
697
|
num: params.num || this.store.pageSize
|
|
653
698
|
}); // 调用普通的获取列表方法
|
|
654
|
-
|
|
699
|
+
_context8.next = 8;
|
|
655
700
|
return this.getCustomerList(resetParams);
|
|
656
701
|
case 8:
|
|
657
|
-
response =
|
|
658
|
-
|
|
702
|
+
response = _context8.sent;
|
|
703
|
+
_context8.next = 11;
|
|
659
704
|
return this.core.effects.emit("".concat(this.name, ":onScrollLoadComplete"), {
|
|
660
705
|
customers: this.store.customerList,
|
|
661
706
|
total: this.store.total,
|
|
662
707
|
hasMore: this.store.hasMore
|
|
663
708
|
});
|
|
664
709
|
case 11:
|
|
665
|
-
return
|
|
710
|
+
return _context8.abrupt("return", response);
|
|
666
711
|
case 12:
|
|
667
712
|
case "end":
|
|
668
|
-
return
|
|
713
|
+
return _context8.stop();
|
|
669
714
|
}
|
|
670
|
-
},
|
|
715
|
+
}, _callee8, this);
|
|
671
716
|
}));
|
|
672
717
|
function resetAndLoadCustomers() {
|
|
673
718
|
return _resetAndLoadCustomers.apply(this, arguments);
|
|
@@ -110,6 +110,8 @@ export interface CustomerState {
|
|
|
110
110
|
export interface CustomerModuleAPI {
|
|
111
111
|
/** 获取客户列表 */
|
|
112
112
|
getCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
|
|
113
|
+
/** 查询客户列表但不更新列表分页状态 */
|
|
114
|
+
queryCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
|
|
113
115
|
/** 设置客户列表 */
|
|
114
116
|
setCustomerList: (customers: ShopCustomer[], total?: number) => void;
|
|
115
117
|
/** 设置当前选择的客户 */
|
|
@@ -103,10 +103,11 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
103
103
|
updateTempOrderShopDiscount(amount: string | number): string;
|
|
104
104
|
updateTempOrderBuzzer(buzzer: string): string;
|
|
105
105
|
updateTempOrderContactsInfo(contactsInfo: Record<string, any> | null): Record<string, any> | null;
|
|
106
|
+
private buildTempOrderCustomer;
|
|
106
107
|
/**
|
|
107
108
|
* 更新当前 tempOrder 的客户协议字段。
|
|
108
109
|
*
|
|
109
|
-
* PaymentModal
|
|
110
|
+
* PaymentModal 只需要修改订单里的客户事实;如果外部还有客户模块需要同步,
|
|
110
111
|
* 应由调用方通过回调处理,不能把外部 UI 状态写进 tempOrder。
|
|
111
112
|
*/
|
|
112
113
|
updateTempOrderCustomer(customer: UpdateTempOrderCustomerInput): OrderSnapshot['customer'];
|
|
@@ -184,7 +185,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
184
185
|
private logSubmitBackendRejected;
|
|
185
186
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
186
187
|
createOrder(params: CommitOrderParams['query']): {
|
|
187
|
-
type: "
|
|
188
|
+
type: "virtual" | "appointment_booking";
|
|
188
189
|
platform: string;
|
|
189
190
|
sales_channel: string;
|
|
190
191
|
order_sales_channel: string;
|