@pisell/private-materials 6.3.103 → 6.3.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +2 -2
  6. package/build/lowcode/preview.js +152 -152
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +18 -10
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +18 -10
  11. package/es/components/booking/notes/NoteBlock/index.js +3 -2
  12. package/es/components/eftposPay/store/index.d.ts +1 -1
  13. package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  14. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  15. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  16. package/es/components/pay/toC/PaymentMethods/MWCreditCard/List/index.js +32 -16
  17. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +16 -10
  18. package/es/components/shoppingCart/components/Empty/index.d.ts +0 -1
  19. package/es/hooks/usePaymentLogger.d.ts +1 -0
  20. package/es/index.d.ts +4 -2
  21. package/es/index.js +3 -1
  22. package/es/plus/contactInfo/components/SwipeAction/index.js +1 -1
  23. package/es/plus/orderList/components/HandleActions.d.ts +1 -0
  24. package/es/plus/orderList/components/HandleActions.js +5 -2
  25. package/es/plus/orderList/components/Toolbar.d.ts +1 -0
  26. package/es/plus/orderList/components/Toolbar.js +4 -2
  27. package/es/plus/orderList/index.d.ts +1 -0
  28. package/es/plus/orderList/index.js +7 -2
  29. package/es/plus/pisellSalesGrid/PisellSalesGrid.d.ts +5 -0
  30. package/es/plus/pisellSalesGrid/PisellSalesGrid.js +363 -0
  31. package/es/plus/pisellSalesGrid/PisellSalesGrid.less +16 -0
  32. package/es/plus/pisellSalesGrid/PisellSalesGrid.stories.d.ts +14 -0
  33. package/es/plus/pisellSalesGrid/PisellSalesGrid.stories.js +559 -0
  34. package/es/plus/pisellSalesGrid/hooks/useActions.d.ts +19 -0
  35. package/es/plus/pisellSalesGrid/hooks/useActions.js +723 -0
  36. package/es/plus/pisellSalesGrid/index.d.ts +4 -0
  37. package/es/plus/pisellSalesGrid/index.js +3 -0
  38. package/es/plus/pisellSalesGrid/locales.d.ts +9 -0
  39. package/es/plus/pisellSalesGrid/locales.js +8 -0
  40. package/es/plus/pisellSalesGrid/serve.d.ts +19 -0
  41. package/es/plus/pisellSalesGrid/serve.js +151 -0
  42. package/es/plus/pisellSalesGrid/types.d.ts +170 -0
  43. package/es/plus/pisellSalesGrid/types.js +1 -0
  44. package/es/plus/pisellSalesManagement/components/BookingFormsPreview.d.ts +15 -0
  45. package/es/plus/pisellSalesManagement/components/BookingFormsPreview.js +211 -0
  46. package/es/plus/pisellSalesManagement/components/BookingNotesPreview.d.ts +19 -0
  47. package/es/plus/pisellSalesManagement/components/BookingNotesPreview.js +167 -0
  48. package/es/plus/pisellSalesManagement/components/ResourceSelector.d.ts +9 -0
  49. package/es/plus/pisellSalesManagement/components/ResourceSelector.js +102 -0
  50. package/es/plus/pisellSalesManagement/config/booking.d.ts +186 -0
  51. package/es/plus/pisellSalesManagement/config/booking.js +380 -0
  52. package/es/plus/pisellSalesManagement/config/index.d.ts +2 -0
  53. package/es/plus/pisellSalesManagement/config/index.js +11 -0
  54. package/es/plus/pisellSalesManagement/config/order.d.ts +172 -0
  55. package/es/plus/pisellSalesManagement/config/order.js +460 -0
  56. package/es/plus/pisellSalesManagement/hooks/perspectiveUtils.d.ts +15 -0
  57. package/es/plus/pisellSalesManagement/hooks/perspectiveUtils.js +66 -0
  58. package/es/plus/pisellSalesManagement/hooks/useBookingPerspective.d.ts +2 -0
  59. package/es/plus/pisellSalesManagement/hooks/useBookingPerspective.js +651 -0
  60. package/es/plus/pisellSalesManagement/hooks/useOrderPerspective.d.ts +2 -0
  61. package/es/plus/pisellSalesManagement/hooks/useOrderPerspective.js +656 -0
  62. package/es/plus/pisellSalesManagement/hooks/usePerspectives.d.ts +5 -0
  63. package/es/plus/pisellSalesManagement/hooks/usePerspectives.js +12 -0
  64. package/es/plus/pisellSalesManagement/index.d.ts +10 -0
  65. package/es/plus/pisellSalesManagement/index.js +84 -0
  66. package/es/plus/pisellSalesManagement/locales.d.ts +303 -0
  67. package/es/plus/pisellSalesManagement/locales.js +302 -0
  68. package/es/plus/pisellSalesManagement/serve.d.ts +26 -0
  69. package/es/plus/pisellSalesManagement/serve.js +222 -0
  70. package/es/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
  71. package/lib/components/booking/notes/NoteBlock/index.js +2 -1
  72. package/lib/components/eftposPay/store/index.d.ts +1 -1
  73. package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  74. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  75. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  76. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/List/index.js +19 -11
  77. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +21 -22
  78. package/lib/components/shoppingCart/components/Empty/index.d.ts +0 -1
  79. package/lib/hooks/usePaymentLogger.d.ts +1 -0
  80. package/lib/index.d.ts +4 -2
  81. package/lib/index.js +8 -2
  82. package/lib/plus/contactInfo/components/SwipeAction/index.js +23 -23
  83. package/lib/plus/orderList/components/HandleActions.d.ts +1 -0
  84. package/lib/plus/orderList/components/HandleActions.js +2 -2
  85. package/lib/plus/orderList/components/Toolbar.d.ts +1 -0
  86. package/lib/plus/orderList/components/Toolbar.js +2 -2
  87. package/lib/plus/orderList/index.d.ts +1 -0
  88. package/lib/plus/orderList/index.js +3 -3
  89. package/lib/plus/pisellSalesGrid/PisellSalesGrid.d.ts +5 -0
  90. package/lib/plus/pisellSalesGrid/PisellSalesGrid.js +339 -0
  91. package/lib/plus/pisellSalesGrid/PisellSalesGrid.less +16 -0
  92. package/lib/plus/pisellSalesGrid/PisellSalesGrid.stories.d.ts +14 -0
  93. package/lib/plus/pisellSalesGrid/PisellSalesGrid.stories.js +455 -0
  94. package/lib/plus/pisellSalesGrid/hooks/useActions.d.ts +19 -0
  95. package/lib/plus/pisellSalesGrid/hooks/useActions.js +545 -0
  96. package/lib/plus/pisellSalesGrid/index.d.ts +4 -0
  97. package/lib/plus/pisellSalesGrid/index.js +42 -0
  98. package/lib/plus/pisellSalesGrid/locales.d.ts +9 -0
  99. package/lib/plus/pisellSalesGrid/locales.js +29 -0
  100. package/lib/plus/pisellSalesGrid/serve.d.ts +19 -0
  101. package/lib/plus/pisellSalesGrid/serve.js +142 -0
  102. package/lib/plus/pisellSalesGrid/types.d.ts +170 -0
  103. package/lib/plus/pisellSalesGrid/types.js +17 -0
  104. package/lib/plus/pisellSalesManagement/components/BookingFormsPreview.d.ts +15 -0
  105. package/lib/plus/pisellSalesManagement/components/BookingFormsPreview.js +250 -0
  106. package/lib/plus/pisellSalesManagement/components/BookingNotesPreview.d.ts +19 -0
  107. package/lib/plus/pisellSalesManagement/components/BookingNotesPreview.js +193 -0
  108. package/lib/plus/pisellSalesManagement/components/ResourceSelector.d.ts +9 -0
  109. package/lib/plus/pisellSalesManagement/components/ResourceSelector.js +106 -0
  110. package/lib/plus/pisellSalesManagement/config/booking.d.ts +186 -0
  111. package/lib/plus/pisellSalesManagement/config/booking.js +500 -0
  112. package/lib/plus/pisellSalesManagement/config/index.d.ts +2 -0
  113. package/lib/plus/pisellSalesManagement/config/index.js +43 -0
  114. package/lib/plus/pisellSalesManagement/config/order.d.ts +172 -0
  115. package/lib/plus/pisellSalesManagement/config/order.js +492 -0
  116. package/lib/plus/pisellSalesManagement/hooks/perspectiveUtils.d.ts +15 -0
  117. package/lib/plus/pisellSalesManagement/hooks/perspectiveUtils.js +113 -0
  118. package/lib/plus/pisellSalesManagement/hooks/useBookingPerspective.d.ts +2 -0
  119. package/lib/plus/pisellSalesManagement/hooks/useBookingPerspective.js +699 -0
  120. package/lib/plus/pisellSalesManagement/hooks/useOrderPerspective.d.ts +2 -0
  121. package/lib/plus/pisellSalesManagement/hooks/useOrderPerspective.js +700 -0
  122. package/lib/plus/pisellSalesManagement/hooks/usePerspectives.d.ts +5 -0
  123. package/lib/plus/pisellSalesManagement/hooks/usePerspectives.js +42 -0
  124. package/lib/plus/pisellSalesManagement/index.d.ts +10 -0
  125. package/lib/plus/pisellSalesManagement/index.js +113 -0
  126. package/lib/plus/pisellSalesManagement/locales.d.ts +303 -0
  127. package/lib/plus/pisellSalesManagement/locales.js +326 -0
  128. package/lib/plus/pisellSalesManagement/serve.d.ts +26 -0
  129. package/lib/plus/pisellSalesManagement/serve.js +120 -0
  130. package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
  131. package/lowcode/eco-cup-list/meta.ts +1 -1
  132. package/lowcode/eco-customer-list/meta.ts +1 -1
  133. package/lowcode/pisell-sales-management/meta.ts +88 -0
  134. package/package.json +3 -3
@@ -0,0 +1,651 @@
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
+ 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
+ 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
+ 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
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ 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); }
7
+ import React, { useCallback, useMemo } from 'react';
8
+ import { PisellDateTimeDisplay, PisellTimeRangeDisplay } from '@pisell/materials';
9
+ import { locales } from '@pisell/utils';
10
+ import ClientName from "../../clientName";
11
+ import { BOOKING_STATUS_COLOR_MAP, getFilterButtonList, getBookingStatusMap, getBookingPlatformMap, getBookingHeaderLabels, getSortList } from "../config/booking";
12
+ import { getPaymentStatusMap, PAYMENT_STATUS_COLOR_MAP } from "../config/order";
13
+ import { getBusinessLabelMap, BUSINESS_COLOR_MAP } from "../config";
14
+ import { Tag, formatAmount, getDisplayLines, textStyles, buildDateTime, normalizeList, parseJson, formatPhone } from "./perspectiveUtils";
15
+ import useEngineContext from "../../../hooks/useEngineContext";
16
+ import BookingNotesPreview from "../components/BookingNotesPreview";
17
+ import BookingFormsPreview from "../components/BookingFormsPreview";
18
+ import { createNoteApis } from "../serve";
19
+ function getBookingType(record) {
20
+ var _record$metadata;
21
+ if (record !== null && record !== void 0 && (_record$metadata = record.metadata) !== null && _record$metadata !== void 0 && _record$metadata.multiple_resource_flag) {
22
+ return 'pisell2';
23
+ }
24
+ if (record.parent_id > 0 && record.item_type !== 'recurring_booking') {
25
+ return 'pisell2';
26
+ }
27
+ return 'pisell1';
28
+ }
29
+ export var useBookingPerspective = function useBookingPerspective(params) {
30
+ var _context$appHelper, _context$engine;
31
+ var context = useEngineContext();
32
+ var utils = context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils;
33
+ /** 监听 locale,切换语言时重新计算 label/filter/sort 等文案 */
34
+ var locale = context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale;
35
+
36
+ /**
37
+ * 静态部分:label maps、uniqueTables 等重计算量大的数据,
38
+ * 仅在 relationTables 变化时重新计算。
39
+ */
40
+ var staticData = useMemo(function () {
41
+ var BOOKING_STATUS_LABEL_MAP = getBookingStatusMap();
42
+ var BOOKING_PLATFORM_LABEL_MAP = getBookingPlatformMap();
43
+ var PAYMENT_STATUS_LABEL_MAP = getPaymentStatusMap();
44
+ var BUSINESS_LABEL_MAP = getBusinessLabelMap();
45
+ var bookingLabels = getBookingHeaderLabels();
46
+ var _ref = params || {},
47
+ relationTables = _ref.relationTables;
48
+ var _relationTables = (relationTables || []).filter(function (item) {
49
+ return ['appointment_booking', 'ticket', 'party_room', 'therapist', 'table-order', 'voucher_ticket', 'mobile_order'].includes(item.relation_type);
50
+ });
51
+ var uniqueTables = _relationTables.reduce(function (pre, cur) {
52
+ var exists = pre.some(function (obj) {
53
+ return obj.form_id === cur.form_id;
54
+ });
55
+ if (!exists) {
56
+ pre.push(cur);
57
+ }
58
+ return pre;
59
+ }, []);
60
+ return {
61
+ BOOKING_STATUS_LABEL_MAP: BOOKING_STATUS_LABEL_MAP,
62
+ BOOKING_PLATFORM_LABEL_MAP: BOOKING_PLATFORM_LABEL_MAP,
63
+ PAYMENT_STATUS_LABEL_MAP: PAYMENT_STATUS_LABEL_MAP,
64
+ BUSINESS_LABEL_MAP: BUSINESS_LABEL_MAP,
65
+ bookingLabels: bookingLabels,
66
+ uniqueTables: uniqueTables
67
+ };
68
+ }, [params === null || params === void 0 ? void 0 : params.relationTables, locale]);
69
+ var buildColumns = useCallback(function (ctx) {
70
+ var BOOKING_STATUS_LABEL_MAP = staticData.BOOKING_STATUS_LABEL_MAP,
71
+ BOOKING_PLATFORM_LABEL_MAP = staticData.BOOKING_PLATFORM_LABEL_MAP,
72
+ PAYMENT_STATUS_LABEL_MAP = staticData.PAYMENT_STATUS_LABEL_MAP,
73
+ BUSINESS_LABEL_MAP = staticData.BUSINESS_LABEL_MAP,
74
+ bookingLabels = staticData.bookingLabels,
75
+ uniqueTables = staticData.uniqueTables;
76
+ return [{
77
+ title: bookingLabels.bookingBrief,
78
+ key: 'booking_brief',
79
+ width: 225,
80
+ render: function render(_, record) {
81
+ var _record$order, _record$order2, _record$order3;
82
+ var startAt = buildDateTime(record === null || record === void 0 ? void 0 : record.start_date, record === null || record === void 0 ? void 0 : record.start_time) || (record === null || record === void 0 ? void 0 : record.start_at);
83
+ var status = record === null || record === void 0 ? void 0 : record.appointment_status;
84
+ var statusLabel = BOOKING_STATUS_LABEL_MAP[status] || status || '-';
85
+ var statusColor = BOOKING_STATUS_COLOR_MAP[status] || '';
86
+ var orderNote = record === null || record === void 0 || (_record$order = record.order) === null || _record$order === void 0 ? void 0 : _record$order.note;
87
+ var internalNotes = record === null || record === void 0 ? void 0 : record.notes;
88
+ var noteApis = createNoteApis(record === null || record === void 0 || (_record$order2 = record.order) === null || _record$order2 === void 0 ? void 0 : _record$order2.id);
89
+ return /*#__PURE__*/React.createElement("div", {
90
+ style: {
91
+ display: 'flex',
92
+ flexDirection: 'column'
93
+ }
94
+ }, /*#__PURE__*/React.createElement(ClientName, {
95
+ dataSource: record === null || record === void 0 || (_record$order3 = record.order) === null || _record$order3 === void 0 ? void 0 : _record$order3.customer
96
+ }), startAt ? /*#__PURE__*/React.createElement(PisellDateTimeDisplay, {
97
+ value: startAt,
98
+ layout: "inline",
99
+ textAlign: "left",
100
+ timeFormat: {
101
+ padHour: true
102
+ },
103
+ dateFormat: {
104
+ order: 'DMY',
105
+ showYear: false,
106
+ shortMonth: true,
107
+ showRelativeDay: true,
108
+ useCommaBeforeYear: false
109
+ },
110
+ fields: {
111
+ fieldOrder: ['time', 'weekday', 'date']
112
+ // inlineSeparators: [' ', ', '],
113
+ }
114
+ }) : null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Tag, {
115
+ style: {
116
+ backgroundColor: statusColor,
117
+ whiteSpace: 'nowrap',
118
+ border: 'none',
119
+ fontWeight: 500
120
+ }
121
+ }, statusLabel)), /*#__PURE__*/React.createElement(BookingNotesPreview, {
122
+ dataSource: {
123
+ note: orderNote,
124
+ internalNotes: internalNotes,
125
+ apis: noteApis,
126
+ bookingId: record === null || record === void 0 ? void 0 : record.id,
127
+ onChange: function onChange(value, type, noteType) {
128
+ ctx.refresh();
129
+ }
130
+ },
131
+ labels: {
132
+ orderNote: bookingLabels.orderNote,
133
+ internalNote: bookingLabels.internalNote,
134
+ more: bookingLabels.more
135
+ },
136
+ style: {
137
+ maxWidth: 160
138
+ }
139
+ }));
140
+ }
141
+ }, {
142
+ title: bookingLabels.serviceTime,
143
+ key: 'service_time',
144
+ align: 'center',
145
+ width: 165,
146
+ render: function render(_, record) {
147
+ var startAt = buildDateTime(record === null || record === void 0 ? void 0 : record.start_date, record === null || record === void 0 ? void 0 : record.start_time) || (record === null || record === void 0 ? void 0 : record.start_at);
148
+ var endAt = buildDateTime(record === null || record === void 0 ? void 0 : record.end_date, record === null || record === void 0 ? void 0 : record.end_time) || (record === null || record === void 0 ? void 0 : record.end_at);
149
+ if (!startAt || !endAt) {
150
+ return null;
151
+ }
152
+ return /*#__PURE__*/React.createElement("div", {
153
+ style: {
154
+ textAlign: 'center'
155
+ }
156
+ }, /*#__PURE__*/React.createElement(PisellTimeRangeDisplay, {
157
+ startAt: startAt,
158
+ endAt: endAt
159
+ }));
160
+ },
161
+ uniformCompare: function uniformCompare(_, record) {
162
+ var _record$start_date = record.start_date,
163
+ start_date = _record$start_date === void 0 ? '' : _record$start_date,
164
+ _record$start_time = record.start_time,
165
+ start_time = _record$start_time === void 0 ? '' : _record$start_time,
166
+ _record$end_date = record.end_date,
167
+ end_date = _record$end_date === void 0 ? '' : _record$end_date,
168
+ _record$end_time = record.end_time,
169
+ end_time = _record$end_time === void 0 ? '' : _record$end_time;
170
+ return "".concat(start_date).concat(start_time).concat(end_date).concat(end_time);
171
+ }
172
+ }, {
173
+ title: bookingLabels.customer,
174
+ key: 'customer',
175
+ align: 'center',
176
+ width: 150,
177
+ uniformCompare: function uniformCompare(_, record) {
178
+ var value = record.order;
179
+ var customer = value === null || value === void 0 ? void 0 : value.customer;
180
+ if (!customer) return '-';
181
+ var guestCode = customer === null || customer === void 0 ? void 0 : customer.guest_code;
182
+ if (guestCode) return "".concat(guestCode);
183
+ if (customer.user_id === 1) return 'walk-in'; // 返回任意固定值即可
184
+ return customer;
185
+ },
186
+ render: function render(_, record) {
187
+ var value = record.order;
188
+ var customer = value === null || value === void 0 ? void 0 : value.customer;
189
+ var guestCode = customer === null || customer === void 0 ? void 0 : customer.guest_code;
190
+ if (guestCode) {
191
+ return /*#__PURE__*/React.createElement("div", {
192
+ style: {
193
+ display: 'flex',
194
+ flexDirection: 'column',
195
+ alignItems: 'center',
196
+ textAlign: 'center'
197
+ }
198
+ }, /*#__PURE__*/React.createElement("div", {
199
+ style: {
200
+ fontWeight: 'bold'
201
+ }
202
+ }, bookingLabels.guest));
203
+ }
204
+ var phone = formatPhone((customer === null || customer === void 0 ? void 0 : customer.phone) || (record === null || record === void 0 ? void 0 : record.phone), (customer === null || customer === void 0 ? void 0 : customer.country_calling_code) || (record === null || record === void 0 ? void 0 : record.country_calling_code));
205
+ var email = customer === null || customer === void 0 ? void 0 : customer.email;
206
+ var lines = getDisplayLines([phone, email]);
207
+ return /*#__PURE__*/React.createElement("div", {
208
+ style: {
209
+ display: 'flex',
210
+ flexDirection: 'column',
211
+ alignItems: 'center',
212
+ textAlign: 'center'
213
+ }
214
+ }, /*#__PURE__*/React.createElement(ClientName, {
215
+ dataSource: customer,
216
+ style: {
217
+ fontSize: 14
218
+ }
219
+ }), lines.map(function (line, index) {
220
+ return /*#__PURE__*/React.createElement("div", {
221
+ key: "".concat(line, "-").concat(index),
222
+ style: textStyles.text
223
+ }, line);
224
+ }));
225
+ }
226
+ }, {
227
+ title: bookingLabels.contact,
228
+ key: 'contact',
229
+ align: 'center',
230
+ width: 150,
231
+ uniformCompare: function uniformCompare(_, record) {
232
+ var value = record.order;
233
+ var contactValue = value === null || value === void 0 ? void 0 : value.contacts_info;
234
+ if (!contactValue) return '-';
235
+ return contactValue;
236
+ },
237
+ render: function render(_, record) {
238
+ var value = record.order;
239
+ var contactValue = value === null || value === void 0 ? void 0 : value.contacts_info;
240
+ if (!contactValue) return '-';
241
+ var phone = formatPhone(contactValue === null || contactValue === void 0 ? void 0 : contactValue.phone);
242
+ var lines = getDisplayLines([phone, contactValue === null || contactValue === void 0 ? void 0 : contactValue.email]);
243
+ return /*#__PURE__*/React.createElement("div", {
244
+ style: {
245
+ display: 'flex',
246
+ flexDirection: 'column',
247
+ alignItems: 'center',
248
+ textAlign: 'center'
249
+ }
250
+ }, /*#__PURE__*/React.createElement(ClientName, {
251
+ dataSource: contactValue,
252
+ style: {
253
+ fontSize: 14
254
+ }
255
+ }), lines.map(function (line, index) {
256
+ return /*#__PURE__*/React.createElement("div", {
257
+ key: "".concat(line, "-").concat(index),
258
+ style: textStyles.text
259
+ }, line);
260
+ }));
261
+ }
262
+ }, {
263
+ title: bookingLabels.holder,
264
+ dataIndex: 'holder_data',
265
+ key: 'holder_data',
266
+ align: 'center',
267
+ width: 110,
268
+ uniformCompare: function uniformCompare(value, record) {
269
+ if (!value) return '-';
270
+ return value;
271
+ },
272
+ render: function render(value, record) {
273
+ var _holderValue$data;
274
+ if (!value) return '-';
275
+ var holderValue = Array.isArray(value) ? value[0] : value;
276
+ if (!holderValue) return '-';
277
+ var holderPhone;
278
+ if (holderValue !== null && holderValue !== void 0 && (_holderValue$data = holderValue.data) !== null && _holderValue$data !== void 0 && _holderValue$data.customer_phone) {
279
+ holderPhone = formatPhone(holderValue === null || holderValue === void 0 ? void 0 : holderValue.phone);
280
+ }
281
+ var lines = getDisplayLines([holderPhone]);
282
+ return /*#__PURE__*/React.createElement("div", {
283
+ style: {
284
+ display: 'flex',
285
+ flexDirection: 'column',
286
+ alignItems: 'center',
287
+ textAlign: 'center'
288
+ }
289
+ }, /*#__PURE__*/React.createElement(ClientName, {
290
+ dataSource: {
291
+ display_name: holderValue.main_field
292
+ },
293
+ style: {
294
+ fontSize: 14
295
+ }
296
+ }), lines.map(function (line, index) {
297
+ return /*#__PURE__*/React.createElement("div", {
298
+ key: "".concat(line, "-").concat(index),
299
+ style: textStyles.text
300
+ }, line);
301
+ }));
302
+ }
303
+ }, {
304
+ title: bookingLabels.services,
305
+ key: 'services',
306
+ align: 'center',
307
+ width: 120,
308
+ render: function render(_, record) {
309
+ var detail = parseJson(record === null || record === void 0 ? void 0 : record.order_detail);
310
+ var items = normalizeList(detail);
311
+ var displayItems = items.slice(0, 3);
312
+ var moreCount = items.length - displayItems.length;
313
+ var lines = displayItems.map(function (item) {
314
+ var title = utils.translation(item.product_title);
315
+ var qty = item === null || item === void 0 ? void 0 : item.product_quantity;
316
+ if (!title) return null;
317
+ return qty ? "".concat(title, " x").concat(qty) : String(title);
318
+ }).filter(function (item) {
319
+ return item;
320
+ });
321
+ if (moreCount > 0) {
322
+ lines.push("+".concat(moreCount, " ").concat(bookingLabels.more));
323
+ }
324
+ if (lines.length === 0) return null;
325
+ return /*#__PURE__*/React.createElement("div", {
326
+ style: {
327
+ display: 'flex',
328
+ flexDirection: 'column',
329
+ alignItems: 'center',
330
+ textAlign: 'center'
331
+ }
332
+ }, lines.map(function (line, index) {
333
+ return /*#__PURE__*/React.createElement("div", {
334
+ key: "".concat(line, "-").concat(index),
335
+ style: textStyles.text
336
+ }, line);
337
+ }));
338
+ },
339
+ uniformCompare: function uniformCompare(_value, record) {
340
+ return (record === null || record === void 0 ? void 0 : record.order_detail) || '';
341
+ }
342
+ }, {
343
+ title: bookingLabels.pax,
344
+ dataIndex: 'number',
345
+ key: 'number',
346
+ align: 'center',
347
+ width: 110,
348
+ render: function render(_, record) {
349
+ var count = record === null || record === void 0 ? void 0 : record.number;
350
+ return /*#__PURE__*/React.createElement("span", {
351
+ style: _objectSpread(_objectSpread({}, textStyles.text), {}, {
352
+ textAlign: 'center'
353
+ })
354
+ }, count !== null && count !== void 0 ? count : '-');
355
+ }
356
+ }, {
357
+ title: bookingLabels.resource,
358
+ dataIndex: 'relation_form_name',
359
+ key: 'relation_form_name',
360
+ align: 'center',
361
+ width: 100,
362
+ render: function render(value) {
363
+ if (!value) return '-';
364
+ return /*#__PURE__*/React.createElement("div", {
365
+ style: textStyles.text
366
+ }, value);
367
+ }
368
+ }, {
369
+ title: bookingLabels.forms,
370
+ key: 'appointment_form',
371
+ // width: 128,
372
+ align: 'center',
373
+ render: function render(_, record) {
374
+ var _record$order4;
375
+ return /*#__PURE__*/React.createElement(BookingFormsPreview, {
376
+ value: record === null || record === void 0 ? void 0 : record.appointment_form,
377
+ uniqueTables: uniqueTables,
378
+ bookingLabels: bookingLabels,
379
+ textStyles: textStyles,
380
+ relationId: record.parent_id || record.id,
381
+ relationType: record.item_type,
382
+ customer: (_record$order4 = record.order) === null || _record$order4 === void 0 ? void 0 : _record$order4.customer
383
+ });
384
+ }
385
+ }, {
386
+ title: bookingLabels.orderInfo,
387
+ key: 'order_info',
388
+ width: 124,
389
+ align: 'center',
390
+ render: function render(_, record) {
391
+ var order = (record === null || record === void 0 ? void 0 : record.order) || {};
392
+ var orderCode = order === null || order === void 0 ? void 0 : order.shop_full_order_number;
393
+ var totalAmount = order === null || order === void 0 ? void 0 : order.total_amount;
394
+ var currencySymbol = order === null || order === void 0 ? void 0 : order.currency_symbol;
395
+ var paymentStatus = order === null || order === void 0 ? void 0 : order.payment_status;
396
+ var paymentLabel = PAYMENT_STATUS_LABEL_MAP[paymentStatus] || '-';
397
+ var paymentColor = PAYMENT_STATUS_COLOR_MAP[paymentStatus] || '';
398
+ return /*#__PURE__*/React.createElement("div", {
399
+ style: {
400
+ display: 'flex',
401
+ flexDirection: 'column',
402
+ alignItems: 'flex-start'
403
+ }
404
+ }, /*#__PURE__*/React.createElement("div", {
405
+ style: {
406
+ fontWeight: 600,
407
+ textDecoration: 'underline',
408
+ color: 'var(--theme-color, #7f56d9)'
409
+ }
410
+ }, orderCode || '-'), totalAmount != null ? /*#__PURE__*/React.createElement("div", {
411
+ style: textStyles.text
412
+ }, formatAmount(totalAmount, currencySymbol)) : null, paymentLabel ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Tag, {
413
+ style: {
414
+ backgroundColor: paymentColor,
415
+ whiteSpace: 'nowrap',
416
+ border: 'none',
417
+ fontWeight: 500
418
+ }
419
+ }, paymentLabel)) : null);
420
+ }
421
+ }, {
422
+ title: bookingLabels.bookingId,
423
+ dataIndex: 'booking_id',
424
+ key: 'booking_id',
425
+ align: 'center',
426
+ width: 120,
427
+ render: function render(value) {
428
+ return /*#__PURE__*/React.createElement("span", {
429
+ style: _objectSpread(_objectSpread({}, textStyles.text), {}, {
430
+ textAlign: 'center',
431
+ fontSize: 14,
432
+ fontWeight: 400
433
+ })
434
+ }, value);
435
+ }
436
+ }, {
437
+ title: bookingLabels.orderOrigin,
438
+ key: 'order_origin',
439
+ width: 160,
440
+ align: 'center',
441
+ render: function render(_, record) {
442
+ var _record$order5, _record$order6, _record$order7, _record$order8, _record$order9, _record$order10;
443
+ var businessKey = (record === null || record === void 0 || (_record$order5 = record.order) === null || _record$order5 === void 0 ? void 0 : _record$order5.business_code) || (record === null || record === void 0 ? void 0 : record.business_code);
444
+ var businessLabel = BUSINESS_LABEL_MAP[businessKey];
445
+ var channel = BOOKING_PLATFORM_LABEL_MAP[record === null || record === void 0 || (_record$order6 = record.order) === null || _record$order6 === void 0 ? void 0 : _record$order6.order_sales_channel] || BOOKING_PLATFORM_LABEL_MAP[record === null || record === void 0 ? void 0 : record.order_platform] || BOOKING_PLATFORM_LABEL_MAP[record === null || record === void 0 || (_record$order7 = record.order) === null || _record$order7 === void 0 ? void 0 : _record$order7.order_platform] || (record === null || record === void 0 || (_record$order8 = record.order) === null || _record$order8 === void 0 ? void 0 : _record$order8.order_sales_channel) || (record === null || record === void 0 ? void 0 : record.order_platform);
446
+ var device = (record === null || record === void 0 ? void 0 : record.device_name) || (record === null || record === void 0 ? void 0 : record.device) || (record === null || record === void 0 ? void 0 : record.terminal);
447
+ var time = (record === null || record === void 0 ? void 0 : record.created_at) || (record === null || record === void 0 || (_record$order9 = record.order) === null || _record$order9 === void 0 ? void 0 : _record$order9.created_at);
448
+ var actor = (record === null || record === void 0 || (_record$order10 = record.order) === null || _record$order10 === void 0 ? void 0 : _record$order10.create_account) || (record === null || record === void 0 ? void 0 : record.create_account) || (record === null || record === void 0 ? void 0 : record.operator_name);
449
+ var lines = getDisplayLines([channel, device]);
450
+ return /*#__PURE__*/React.createElement("div", {
451
+ style: {
452
+ display: 'flex',
453
+ flexDirection: 'column',
454
+ alignItems: 'flex-start'
455
+ }
456
+ }, businessLabel ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Tag, {
457
+ color: BUSINESS_COLOR_MAP[businessKey],
458
+ style: {
459
+ color: 'black',
460
+ fontWeight: 500
461
+ }
462
+ }, businessLabel)) : null, lines.map(function (line, index) {
463
+ return /*#__PURE__*/React.createElement("div", {
464
+ key: "".concat(line, "-").concat(index),
465
+ style: textStyles.text
466
+ }, line);
467
+ }), actor ? /*#__PURE__*/React.createElement("div", {
468
+ style: _objectSpread({
469
+ display: 'flex',
470
+ alignItems: 'center'
471
+ }, textStyles.text)
472
+ }, /*#__PURE__*/React.createElement("span", null, bookingLabels.createdBy, ":"), /*#__PURE__*/React.createElement(ClientName, {
473
+ dataSource: actor,
474
+ style: {
475
+ fontSize: 12
476
+ }
477
+ })) : null, /*#__PURE__*/React.createElement(PisellDateTimeDisplay, {
478
+ value: time,
479
+ layout: "inline",
480
+ textAlign: "left",
481
+ timeFormat: {
482
+ padHour: true
483
+ },
484
+ dateFormat: {
485
+ order: 'DMY',
486
+ showYear: false,
487
+ shortMonth: true,
488
+ showRelativeDay: true,
489
+ useCommaBeforeYear: false
490
+ },
491
+ fields: {
492
+ fieldOrder: ['time', 'weekday', 'date']
493
+ // inlineSeparators: [' ', ', '],
494
+ },
495
+ style: {
496
+ whiteSpace: 'nowrap'
497
+ }
498
+ }));
499
+ }
500
+ }, {
501
+ title: bookingLabels.updated,
502
+ key: 'updated',
503
+ width: 132,
504
+ align: 'center',
505
+ render: function render(_, record) {
506
+ var _record$order11;
507
+ var time = (record === null || record === void 0 ? void 0 : record.updated_at) || (record === null || record === void 0 || (_record$order11 = record.order) === null || _record$order11 === void 0 ? void 0 : _record$order11.updated_at);
508
+ var channel = BOOKING_PLATFORM_LABEL_MAP[record === null || record === void 0 ? void 0 : record.order_platform] || (record === null || record === void 0 ? void 0 : record.order_platform);
509
+ var lines = getDisplayLines([channel]);
510
+ return /*#__PURE__*/React.createElement("div", {
511
+ style: {
512
+ display: 'flex',
513
+ flexDirection: 'column',
514
+ alignItems: 'flex-start'
515
+ }
516
+ }, /*#__PURE__*/React.createElement(PisellDateTimeDisplay, {
517
+ value: time,
518
+ layout: "inline",
519
+ textAlign: "left",
520
+ timeFormat: {
521
+ padHour: true
522
+ },
523
+ dateFormat: {
524
+ order: 'DMY',
525
+ showYear: false,
526
+ shortMonth: true,
527
+ showRelativeDay: true,
528
+ useCommaBeforeYear: false
529
+ },
530
+ fields: {
531
+ fieldOrder: ['time', 'weekday', 'date']
532
+ // inlineSeparators: [' ', ', '],
533
+ },
534
+ style: {
535
+ whiteSpace: 'nowrap'
536
+ }
537
+ }), lines.map(function (line, index) {
538
+ return /*#__PURE__*/React.createElement("div", {
539
+ key: "".concat(line, "-").concat(index),
540
+ style: textStyles.text
541
+ }, line);
542
+ }));
543
+ }
544
+ }];
545
+ }, [staticData]);
546
+
547
+ /**
548
+ * 最终 perspective 配置:
549
+ * - 使用 getChildComponentProps 工厂函数,在运行时接收 ctx 后构建完整配置。
550
+ * - onRow 中通过 ctx.refresh() 实现弹窗关闭后刷新列表。
551
+ * - columns 中通过 ctx.refresh() 实现备注编辑后刷新列表。
552
+ */
553
+ var _perspective = useMemo(function () {
554
+ return {
555
+ key: 'monitor',
556
+ label: 'Monitor',
557
+ getChildComponentProps: function getChildComponentProps(ctx) {
558
+ return {
559
+ grid: {
560
+ bordered: true,
561
+ collapseUniformColumns: true,
562
+ columns: buildColumns(ctx),
563
+ defaultHiddenColumnKeys: ['order_origin', 'updated'],
564
+ scroll: {
565
+ // x: '1800px',
566
+ x: 'max-content',
567
+ autoCalc: true,
568
+ scrollToFirstRowOnChange: true
569
+ },
570
+ rowSelection: false,
571
+ onRow: function onRow(record) {
572
+ return {
573
+ onClick: function onClick() {
574
+ var _record$order12, _record$order13;
575
+ if (!record.id) return;
576
+ var time = new Date();
577
+ utils === null || utils === void 0 || utils.action({
578
+ type: 'pisell1.bookingDetail',
579
+ data: {
580
+ component_type: getBookingType(record),
581
+ booking_id: record.order.id,
582
+ type: record.parent_id === 0 ? 'list' : 'detail',
583
+ id: record.id,
584
+ isParallelResourcesBooking: record.relation_id === 0 && record.relation_type === '',
585
+ preliminaryBookingDetail: {
586
+ customer: record === null || record === void 0 || (_record$order12 = record.order) === null || _record$order12 === void 0 ? void 0 : _record$order12.customer,
587
+ id: record.order.id,
588
+ order_sales_channel: record === null || record === void 0 || (_record$order13 = record.order) === null || _record$order13 === void 0 ? void 0 : _record$order13.order_sales_channel,
589
+ bookings: {
590
+ booking_id: record === null || record === void 0 ? void 0 : record.booking_id,
591
+ appointment_status: record === null || record === void 0 ? void 0 : record.appointment_status,
592
+ list: [{
593
+ start_date: record === null || record === void 0 ? void 0 : record.start_date,
594
+ start_time: record === null || record === void 0 ? void 0 : record.start_time
595
+ }]
596
+ }
597
+ }
598
+ },
599
+ callback: function callback(cbParams) {
600
+ var _ref2 = cbParams || {},
601
+ type = _ref2.type;
602
+ // 打开弹窗前会先调用关闭,打开前调用的关闭不需要响应
603
+ if (Date.now() - time.getTime() < 500) {
604
+ return;
605
+ }
606
+ if (type === 'close') {
607
+ return;
608
+ }
609
+ ctx.refresh();
610
+ }
611
+ });
612
+ }
613
+ };
614
+ }
615
+ },
616
+ toolBar: {
617
+ search: {
618
+ showConfirmButton: false
619
+ },
620
+ sort: {
621
+ list: getSortList()
622
+ },
623
+ filter: {
624
+ hiddenQuickFilter: true,
625
+ defaultFilterValue: {
626
+ quickFilter: [],
627
+ otherFilter: getFilterButtonList(),
628
+ values: {}
629
+ }
630
+ },
631
+ quickFilter: {
632
+ filterList: [{
633
+ type: 'rangePicker',
634
+ name: 'booking_time_start_between',
635
+ key: 'bookingTimeStartBetween',
636
+ props: {
637
+ placeholder: locales.getText('pisell2.salesManagement.booking.filter.bookingDate.label'),
638
+ showTime: true
639
+ }
640
+ }]
641
+ }
642
+ },
643
+ batchActionBar: {
644
+ overflowThreshold: 2
645
+ }
646
+ };
647
+ }
648
+ };
649
+ }, [buildColumns, utils, locale]);
650
+ return _perspective;
651
+ };
@@ -0,0 +1,2 @@
1
+ import { SalesGridPerspectiveConfig } from '../../pisellSalesGrid';
2
+ export declare const useOrderPerspective: () => SalesGridPerspectiveConfig;