@pisell/private-materials 3.4.82 → 3.4.83

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 (162) 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/forms/sendModal/useSendModal.d.ts +0 -1
  12. package/es/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  13. package/es/components/booking/notes/NoteBlock/index.js +3 -2
  14. package/es/components/booking/utils.d.ts +2 -2
  15. package/es/components/eftpos/hooks.d.ts +0 -1
  16. package/es/components/eftposPay/amount.d.ts +1 -1
  17. package/es/components/eftposPay/app.d.ts +1 -1
  18. package/es/components/eftposPay/device.d.ts +1 -1
  19. package/es/components/eftposPay/hooks.d.ts +2 -2
  20. package/es/components/eftposPay/store/index.d.ts +6 -6
  21. package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  22. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  23. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  24. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  25. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
  26. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
  27. package/es/hooks/usePaymentLogger.d.ts +0 -1
  28. package/es/index.d.ts +4 -2
  29. package/es/index.js +3 -1
  30. package/es/plus/contactInfo/components/SwipeAction/index.js +1 -1
  31. package/es/plus/orderList/components/HandleActions.d.ts +1 -0
  32. package/es/plus/orderList/components/HandleActions.js +5 -2
  33. package/es/plus/orderList/components/Toolbar.d.ts +1 -0
  34. package/es/plus/orderList/components/Toolbar.js +4 -2
  35. package/es/plus/orderList/index.d.ts +1 -0
  36. package/es/plus/orderList/index.js +7 -2
  37. package/es/plus/pisellSalesGrid/PisellSalesGrid.d.ts +5 -0
  38. package/es/plus/pisellSalesGrid/PisellSalesGrid.js +363 -0
  39. package/es/plus/pisellSalesGrid/PisellSalesGrid.less +16 -0
  40. package/es/plus/pisellSalesGrid/PisellSalesGrid.stories.d.ts +14 -0
  41. package/es/plus/pisellSalesGrid/PisellSalesGrid.stories.js +559 -0
  42. package/es/plus/pisellSalesGrid/hooks/useActions.d.ts +19 -0
  43. package/es/plus/pisellSalesGrid/hooks/useActions.js +723 -0
  44. package/es/plus/pisellSalesGrid/index.d.ts +4 -0
  45. package/es/plus/pisellSalesGrid/index.js +3 -0
  46. package/es/plus/pisellSalesGrid/locales.d.ts +9 -0
  47. package/es/plus/pisellSalesGrid/locales.js +8 -0
  48. package/es/plus/pisellSalesGrid/serve.d.ts +19 -0
  49. package/es/plus/pisellSalesGrid/serve.js +151 -0
  50. package/es/plus/pisellSalesGrid/types.d.ts +170 -0
  51. package/es/plus/pisellSalesGrid/types.js +1 -0
  52. package/es/plus/pisellSalesManagement/components/BookingFormsPreview.d.ts +15 -0
  53. package/es/plus/pisellSalesManagement/components/BookingFormsPreview.js +211 -0
  54. package/es/plus/pisellSalesManagement/components/BookingNotesPreview.d.ts +19 -0
  55. package/es/plus/pisellSalesManagement/components/BookingNotesPreview.js +167 -0
  56. package/es/plus/pisellSalesManagement/components/ResourceSelector.d.ts +9 -0
  57. package/es/plus/pisellSalesManagement/components/ResourceSelector.js +102 -0
  58. package/es/plus/pisellSalesManagement/config/booking.d.ts +185 -0
  59. package/es/plus/pisellSalesManagement/config/booking.js +380 -0
  60. package/es/plus/pisellSalesManagement/config/index.d.ts +2 -0
  61. package/es/plus/pisellSalesManagement/config/index.js +11 -0
  62. package/es/plus/pisellSalesManagement/config/order.d.ts +172 -0
  63. package/es/plus/pisellSalesManagement/config/order.js +460 -0
  64. package/es/plus/pisellSalesManagement/hooks/perspectiveUtils.d.ts +15 -0
  65. package/es/plus/pisellSalesManagement/hooks/perspectiveUtils.js +66 -0
  66. package/es/plus/pisellSalesManagement/hooks/useBookingPerspective.d.ts +2 -0
  67. package/es/plus/pisellSalesManagement/hooks/useBookingPerspective.js +651 -0
  68. package/es/plus/pisellSalesManagement/hooks/useOrderPerspective.d.ts +2 -0
  69. package/es/plus/pisellSalesManagement/hooks/useOrderPerspective.js +656 -0
  70. package/es/plus/pisellSalesManagement/hooks/usePerspectives.d.ts +5 -0
  71. package/es/plus/pisellSalesManagement/hooks/usePerspectives.js +12 -0
  72. package/es/plus/pisellSalesManagement/index.d.ts +10 -0
  73. package/es/plus/pisellSalesManagement/index.js +84 -0
  74. package/es/plus/pisellSalesManagement/locales.d.ts +303 -0
  75. package/es/plus/pisellSalesManagement/locales.js +302 -0
  76. package/es/plus/pisellSalesManagement/serve.d.ts +26 -0
  77. package/es/plus/pisellSalesManagement/serve.js +222 -0
  78. package/es/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
  79. package/es/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  80. package/es/plus/walletPassGallery/components/passDetail/index.d.ts +0 -1
  81. package/es/plus/walletPassGallery/components/passDetail/index.js +2 -26
  82. package/es/plus/walletPassGallery/components/passList/index.js +8 -1
  83. package/es/plus/walletPassGallery/index.js +0 -31
  84. package/es/pro/Selector/Selector.d.ts +1 -1
  85. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
  86. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  87. package/lib/components/booking/notes/NoteBlock/index.js +2 -1
  88. package/lib/components/booking/utils.d.ts +2 -2
  89. package/lib/components/eftpos/hooks.d.ts +0 -1
  90. package/lib/components/eftposPay/amount.d.ts +1 -1
  91. package/lib/components/eftposPay/app.d.ts +1 -1
  92. package/lib/components/eftposPay/device.d.ts +1 -1
  93. package/lib/components/eftposPay/hooks.d.ts +2 -2
  94. package/lib/components/eftposPay/store/index.d.ts +6 -6
  95. package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  96. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  97. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  98. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  99. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
  100. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
  101. package/lib/hooks/usePaymentLogger.d.ts +0 -1
  102. package/lib/index.d.ts +4 -2
  103. package/lib/index.js +8 -2
  104. package/lib/plus/contactInfo/components/SwipeAction/index.js +23 -23
  105. package/lib/plus/orderList/components/HandleActions.d.ts +1 -0
  106. package/lib/plus/orderList/components/HandleActions.js +2 -2
  107. package/lib/plus/orderList/components/Toolbar.d.ts +1 -0
  108. package/lib/plus/orderList/components/Toolbar.js +2 -2
  109. package/lib/plus/orderList/index.d.ts +1 -0
  110. package/lib/plus/orderList/index.js +3 -3
  111. package/lib/plus/pisellSalesGrid/PisellSalesGrid.d.ts +5 -0
  112. package/lib/plus/pisellSalesGrid/PisellSalesGrid.js +339 -0
  113. package/lib/plus/pisellSalesGrid/PisellSalesGrid.less +16 -0
  114. package/lib/plus/pisellSalesGrid/PisellSalesGrid.stories.d.ts +14 -0
  115. package/lib/plus/pisellSalesGrid/PisellSalesGrid.stories.js +455 -0
  116. package/lib/plus/pisellSalesGrid/hooks/useActions.d.ts +19 -0
  117. package/lib/plus/pisellSalesGrid/hooks/useActions.js +545 -0
  118. package/lib/plus/pisellSalesGrid/index.d.ts +4 -0
  119. package/lib/plus/pisellSalesGrid/index.js +42 -0
  120. package/lib/plus/pisellSalesGrid/locales.d.ts +9 -0
  121. package/lib/plus/pisellSalesGrid/locales.js +29 -0
  122. package/lib/plus/pisellSalesGrid/serve.d.ts +19 -0
  123. package/lib/plus/pisellSalesGrid/serve.js +142 -0
  124. package/lib/plus/pisellSalesGrid/types.d.ts +170 -0
  125. package/lib/plus/pisellSalesGrid/types.js +17 -0
  126. package/lib/plus/pisellSalesManagement/components/BookingFormsPreview.d.ts +15 -0
  127. package/lib/plus/pisellSalesManagement/components/BookingFormsPreview.js +250 -0
  128. package/lib/plus/pisellSalesManagement/components/BookingNotesPreview.d.ts +19 -0
  129. package/lib/plus/pisellSalesManagement/components/BookingNotesPreview.js +193 -0
  130. package/lib/plus/pisellSalesManagement/components/ResourceSelector.d.ts +9 -0
  131. package/lib/plus/pisellSalesManagement/components/ResourceSelector.js +106 -0
  132. package/lib/plus/pisellSalesManagement/config/booking.d.ts +185 -0
  133. package/lib/plus/pisellSalesManagement/config/booking.js +500 -0
  134. package/lib/plus/pisellSalesManagement/config/index.d.ts +2 -0
  135. package/lib/plus/pisellSalesManagement/config/index.js +43 -0
  136. package/lib/plus/pisellSalesManagement/config/order.d.ts +172 -0
  137. package/lib/plus/pisellSalesManagement/config/order.js +492 -0
  138. package/lib/plus/pisellSalesManagement/hooks/perspectiveUtils.d.ts +15 -0
  139. package/lib/plus/pisellSalesManagement/hooks/perspectiveUtils.js +113 -0
  140. package/lib/plus/pisellSalesManagement/hooks/useBookingPerspective.d.ts +2 -0
  141. package/lib/plus/pisellSalesManagement/hooks/useBookingPerspective.js +699 -0
  142. package/lib/plus/pisellSalesManagement/hooks/useOrderPerspective.d.ts +2 -0
  143. package/lib/plus/pisellSalesManagement/hooks/useOrderPerspective.js +700 -0
  144. package/lib/plus/pisellSalesManagement/hooks/usePerspectives.d.ts +5 -0
  145. package/lib/plus/pisellSalesManagement/hooks/usePerspectives.js +42 -0
  146. package/lib/plus/pisellSalesManagement/index.d.ts +10 -0
  147. package/lib/plus/pisellSalesManagement/index.js +113 -0
  148. package/lib/plus/pisellSalesManagement/locales.d.ts +303 -0
  149. package/lib/plus/pisellSalesManagement/locales.js +326 -0
  150. package/lib/plus/pisellSalesManagement/serve.d.ts +26 -0
  151. package/lib/plus/pisellSalesManagement/serve.js +120 -0
  152. package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
  153. package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  154. package/lib/plus/walletPassGallery/components/passDetail/index.d.ts +0 -1
  155. package/lib/plus/walletPassGallery/components/passDetail/index.js +1 -16
  156. package/lib/plus/walletPassGallery/components/passList/index.js +9 -3
  157. package/lib/plus/walletPassGallery/index.js +0 -29
  158. package/lib/pro/Selector/Selector.d.ts +1 -1
  159. package/lowcode/eco-cup-list/meta.ts +1 -1
  160. package/lowcode/eco-customer-list/meta.ts +1 -1
  161. package/lowcode/pisell-sales-management/meta.ts +88 -0
  162. package/package.json +4 -4
@@ -0,0 +1,656 @@
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 { PisellTags, PisellDateTimeDisplay } from '@pisell/materials';
9
+ import { locales } from '@pisell/utils';
10
+ import useEngineContext from "../../../hooks/useEngineContext";
11
+ import ClientName from "../../clientName";
12
+ import { FULFILLMENT_STATUS_COLOR_MAP, DELIVERY_TYPE_COLOR_MAP, getOrderHeaderLabels, getShippingStatusMap, ORDER_STATUS_COLOR_MAP, SHOP_SERVICE_TYPE_COLOR_MAP, getOrderStatusMap, PAYMENT_STATUS_COLOR_MAP, getPaymentStatusMap, getPlatformMap, getDeliveryTypeMap, getShopServiceTypeMap, getFilterButtonList, getSortList } from "../config/order";
13
+ import { getBusinessLabelMap, BUSINESS_COLOR_MAP } from "../config";
14
+ import { Tag, formatAmount, getDisplayLines, textStyles, formatPhone } from "./perspectiveUtils";
15
+ import BookingNotesPreview from "../components/BookingNotesPreview";
16
+ import { createNoteApis } from "../serve";
17
+ export var useOrderPerspective = function useOrderPerspective() {
18
+ var _context$appHelper, _context$appHelper$ge, _context$engine;
19
+ var context = useEngineContext();
20
+ var app = context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper$ge = _context$appHelper.getApp) === null || _context$appHelper$ge === void 0 ? void 0 : _context$appHelper$ge.call(_context$appHelper);
21
+ /** 监听 locale,切换语言时重新计算 label/filter/sort 等文案 */
22
+ 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;
23
+
24
+ /**
25
+ * 静态部分:label maps 等只需计算一次的数据。
26
+ */
27
+ var staticData = useMemo(function () {
28
+ var PAYMENT_STATUS_LABEL_MAP = getPaymentStatusMap();
29
+ var PLATFORM_LABEL_MAP = getPlatformMap();
30
+ var ORDER_STATUS_LABEL_MAP = getOrderStatusMap();
31
+ var SHIPPING_STATUS_LABEL_MAP = getShippingStatusMap();
32
+ var DELIVERY_TYPE_LABEL_MAP = getDeliveryTypeMap();
33
+ var SHOP_SERVICE_TYPE_LABEL_MAP = getShopServiceTypeMap();
34
+ var BUSINESS_LABEL_MAP = getBusinessLabelMap();
35
+ var orderLabels = getOrderHeaderLabels();
36
+ var amountLabels = {
37
+ total: locales.getText('pisell2.orderList.common.totalAmount'),
38
+ paid: locales.getText('pisell2.orderList.common.paidAmount'),
39
+ due: locales.getText('pisell2.orderList.common.dueAmount'),
40
+ refunded: locales.getText('pisell2.orderList.common.refundedAmount'),
41
+ items: locales.getText('pisell2.orderList.common.itemsCount')
42
+ };
43
+ return {
44
+ PAYMENT_STATUS_LABEL_MAP: PAYMENT_STATUS_LABEL_MAP,
45
+ PLATFORM_LABEL_MAP: PLATFORM_LABEL_MAP,
46
+ ORDER_STATUS_LABEL_MAP: ORDER_STATUS_LABEL_MAP,
47
+ SHIPPING_STATUS_LABEL_MAP: SHIPPING_STATUS_LABEL_MAP,
48
+ DELIVERY_TYPE_LABEL_MAP: DELIVERY_TYPE_LABEL_MAP,
49
+ SHOP_SERVICE_TYPE_LABEL_MAP: SHOP_SERVICE_TYPE_LABEL_MAP,
50
+ BUSINESS_LABEL_MAP: BUSINESS_LABEL_MAP,
51
+ orderLabels: orderLabels,
52
+ amountLabels: amountLabels
53
+ };
54
+ }, [locale]);
55
+
56
+ /**
57
+ * 构建 columns 的工厂:接收 runtimeContext,使列渲染可访问 refresh 等运行时能力。
58
+ */
59
+ var buildColumns = useCallback(function (ctx) {
60
+ var PAYMENT_STATUS_LABEL_MAP = staticData.PAYMENT_STATUS_LABEL_MAP,
61
+ PLATFORM_LABEL_MAP = staticData.PLATFORM_LABEL_MAP,
62
+ ORDER_STATUS_LABEL_MAP = staticData.ORDER_STATUS_LABEL_MAP,
63
+ SHIPPING_STATUS_LABEL_MAP = staticData.SHIPPING_STATUS_LABEL_MAP,
64
+ DELIVERY_TYPE_LABEL_MAP = staticData.DELIVERY_TYPE_LABEL_MAP,
65
+ SHOP_SERVICE_TYPE_LABEL_MAP = staticData.SHOP_SERVICE_TYPE_LABEL_MAP,
66
+ BUSINESS_LABEL_MAP = staticData.BUSINESS_LABEL_MAP,
67
+ orderLabels = staticData.orderLabels,
68
+ amountLabels = staticData.amountLabels;
69
+ return [{
70
+ title: orderLabels.saleBrief,
71
+ key: 'sale_brief',
72
+ width: 225,
73
+ // fixed: 'left',
74
+ render: function render(_, record) {
75
+ var orderCode = record === null || record === void 0 ? void 0 : record.shop_full_order_number;
76
+ var currencySymbol = record === null || record === void 0 ? void 0 : record.currency_symbol;
77
+ var totalAmount = record === null || record === void 0 ? void 0 : record.total_amount;
78
+ var paymentStatus = record === null || record === void 0 ? void 0 : record.payment_status;
79
+ var orderNote = record === null || record === void 0 ? void 0 : record.note;
80
+ var internalNotes = record === null || record === void 0 ? void 0 : record.internal_note;
81
+ var noteApis = createNoteApis((record === null || record === void 0 ? void 0 : record.id) || (record === null || record === void 0 ? void 0 : record.order_id) || (record === null || record === void 0 ? void 0 : record.orderId));
82
+ var tags = (record === null || record === void 0 ? void 0 : record.tag) || (record === null || record === void 0 ? void 0 : record.tags) || [];
83
+ var paymentLabel = PAYMENT_STATUS_LABEL_MAP[paymentStatus] || paymentStatus || '-';
84
+ var paymentColor = PAYMENT_STATUS_COLOR_MAP[paymentStatus] || '';
85
+ return /*#__PURE__*/React.createElement("div", {
86
+ style: {
87
+ display: 'flex',
88
+ flexDirection: 'column'
89
+ }
90
+ }, /*#__PURE__*/React.createElement("div", {
91
+ style: {
92
+ fontWeight: 'bold',
93
+ textDecoration: 'underline',
94
+ color: 'var(--theme-color, #7f56d9)'
95
+ }
96
+ }, orderCode), Array.isArray(tags) && tags.length > 0 ? /*#__PURE__*/React.createElement("div", {
97
+ style: {
98
+ display: 'flex',
99
+ gap: 4,
100
+ flexWrap: 'wrap'
101
+ }
102
+ }, tags.map(function (item) {
103
+ return /*#__PURE__*/React.createElement(Tag, {
104
+ key: "".concat(item === null || item === void 0 ? void 0 : item.id),
105
+ style: {
106
+ margin: 0,
107
+ maxWidth: 160,
108
+ whiteSpace: 'nowrap',
109
+ overflow: 'hidden',
110
+ textOverflow: 'ellipsis',
111
+ fontWeight: 500
112
+ }
113
+ }, item === null || item === void 0 ? void 0 : item.name);
114
+ })) : null, /*#__PURE__*/React.createElement("div", {
115
+ style: {
116
+ fontWeight: 'bold'
117
+ }
118
+ }, /*#__PURE__*/React.createElement("span", {
119
+ style: {
120
+ marginRight: 6
121
+ }
122
+ }, amountLabels.total, ":"), /*#__PURE__*/React.createElement("span", null, formatAmount(totalAmount, currencySymbol))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Tag, {
123
+ style: {
124
+ backgroundColor: paymentColor,
125
+ whiteSpace: 'nowrap',
126
+ border: 'none',
127
+ fontWeight: 500
128
+ }
129
+ }, paymentLabel)), /*#__PURE__*/React.createElement(BookingNotesPreview, {
130
+ dataSource: {
131
+ note: orderNote,
132
+ internalNotes: internalNotes,
133
+ apis: noteApis,
134
+ onChange: function onChange(value, type, noteType) {
135
+ ctx.refresh();
136
+ }
137
+ },
138
+ labels: {
139
+ orderNote: orderLabels.orderNote,
140
+ internalNote: orderLabels.internalNote
141
+ },
142
+ style: {
143
+ maxWidth: 160
144
+ }
145
+ }));
146
+ }
147
+ }, {
148
+ title: orderLabels.customer,
149
+ key: 'customer',
150
+ align: 'center',
151
+ width: 150,
152
+ uniformCompare: function uniformCompare(value, record) {
153
+ var customer = record === null || record === void 0 ? void 0 : record.customer;
154
+ if (!customer) return '-';
155
+ var guestCode = customer === null || customer === void 0 ? void 0 : customer.guest_code;
156
+ if (guestCode) return "".concat(guestCode);
157
+ if (customer.user_id === 1) return 'walk-in'; // 返回任意固定值即可
158
+ return customer;
159
+ },
160
+ render: function render(_, record) {
161
+ var customer = record === null || record === void 0 ? void 0 : record.customer;
162
+ if (!customer) return '-';
163
+ var guestCode = customer === null || customer === void 0 ? void 0 : customer.guest_code;
164
+ if (guestCode) {
165
+ return /*#__PURE__*/React.createElement("div", {
166
+ style: {
167
+ display: 'flex',
168
+ flexDirection: 'column',
169
+ alignItems: 'center',
170
+ textAlign: 'center'
171
+ }
172
+ }, /*#__PURE__*/React.createElement("div", {
173
+ style: {
174
+ fontWeight: 'bold'
175
+ }
176
+ }, orderLabels.guest));
177
+ }
178
+ 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));
179
+ var lines = getDisplayLines([phone, customer === null || customer === void 0 ? void 0 : customer.email]);
180
+ return /*#__PURE__*/React.createElement("div", {
181
+ style: {
182
+ display: 'flex',
183
+ flexDirection: 'column',
184
+ alignItems: 'center',
185
+ textAlign: 'center'
186
+ }
187
+ }, /*#__PURE__*/React.createElement(ClientName, {
188
+ dataSource: customer,
189
+ style: {
190
+ fontSize: 14
191
+ }
192
+ }), lines.map(function (line, index) {
193
+ return /*#__PURE__*/React.createElement("div", {
194
+ key: "".concat(line, "-").concat(index),
195
+ style: textStyles.text
196
+ }, line);
197
+ }));
198
+ }
199
+ }, {
200
+ title: orderLabels.contact,
201
+ dataIndex: 'contacts_info',
202
+ key: 'contacts_info',
203
+ align: 'center',
204
+ width: 150,
205
+ uniformCompare: function uniformCompare(value, record) {
206
+ if (!value) return '-';
207
+ return value;
208
+ },
209
+ render: function render(value) {
210
+ if (!value) return '-';
211
+ var info = (value === null || value === void 0 ? void 0 : value.value) || {};
212
+ var phone = formatPhone(info === null || info === void 0 ? void 0 : info.phone);
213
+ var lines = getDisplayLines([phone, info === null || info === void 0 ? void 0 : info.email]);
214
+ return /*#__PURE__*/React.createElement("div", {
215
+ style: {
216
+ display: 'flex',
217
+ flexDirection: 'column',
218
+ alignItems: 'center',
219
+ textAlign: 'center'
220
+ }
221
+ }, /*#__PURE__*/React.createElement(ClientName, {
222
+ dataSource: info,
223
+ style: {
224
+ fontSize: 14
225
+ }
226
+ }), lines.map(function (line, index) {
227
+ return /*#__PURE__*/React.createElement("div", {
228
+ key: "".concat(line, "-").concat(index),
229
+ style: textStyles.text
230
+ }, line);
231
+ }));
232
+ }
233
+ }, {
234
+ title: orderLabels.paymentInfo,
235
+ key: 'payment_info',
236
+ width: 124,
237
+ align: 'center',
238
+ render: function render(_, record) {
239
+ var value = record === null || record === void 0 ? void 0 : record.payment_status;
240
+ var currencySymbol = record === null || record === void 0 ? void 0 : record.currency_symbol;
241
+ var totalAmount = Number((record === null || record === void 0 ? void 0 : record.total_amount) || 0);
242
+ var paidAmount = Number((record === null || record === void 0 ? void 0 : record.paid_amount) || 0);
243
+ var refundedAmount = Number((record === null || record === void 0 ? void 0 : record.total_refund_amount) || 0);
244
+ var dueAmount = totalAmount - paidAmount;
245
+ var amountStyles = {
246
+ due: {
247
+ fontWeight: 'bold',
248
+ color: '#D92D20'
249
+ },
250
+ refunded: {
251
+ color: '#CA8504',
252
+ fontWeight: 'bold'
253
+ }
254
+ };
255
+ var lines = [];
256
+ if (['payment_processing', 'unpaid'].includes(value)) {
257
+ lines.push({
258
+ label: amountLabels.due,
259
+ value: formatAmount(dueAmount, currencySymbol),
260
+ bold: true,
261
+ kind: 'due'
262
+ });
263
+ lines.push({
264
+ label: amountLabels.total,
265
+ value: formatAmount(totalAmount, currencySymbol),
266
+ kind: 'total'
267
+ });
268
+ } else if (value === 'partially_paid') {
269
+ lines.push({
270
+ label: amountLabels.due,
271
+ value: formatAmount(dueAmount, currencySymbol),
272
+ bold: true,
273
+ kind: 'due'
274
+ });
275
+ lines.push({
276
+ label: amountLabels.paid,
277
+ value: formatAmount(paidAmount, currencySymbol),
278
+ kind: 'paid'
279
+ });
280
+ lines.push({
281
+ label: amountLabels.total,
282
+ value: formatAmount(totalAmount, currencySymbol),
283
+ kind: 'total'
284
+ });
285
+ } else if (value === 'paid') {
286
+ lines.push({
287
+ label: amountLabels.paid,
288
+ value: formatAmount(paidAmount, currencySymbol),
289
+ bold: true,
290
+ kind: 'paid'
291
+ });
292
+ lines.push({
293
+ label: amountLabels.total,
294
+ value: formatAmount(totalAmount, currencySymbol),
295
+ kind: 'total'
296
+ });
297
+ } else if (['partially_refunded', 'refunded'].includes(value)) {
298
+ lines.push({
299
+ label: amountLabels.refunded,
300
+ value: formatAmount(refundedAmount, currencySymbol),
301
+ bold: true,
302
+ kind: 'refunded'
303
+ });
304
+ lines.push({
305
+ label: amountLabels.paid,
306
+ value: formatAmount(paidAmount, currencySymbol),
307
+ kind: 'paid'
308
+ });
309
+ lines.push({
310
+ label: amountLabels.total,
311
+ value: formatAmount(totalAmount, currencySymbol),
312
+ kind: 'total'
313
+ });
314
+ } else if (['voided', 'authorized'].includes(value)) {
315
+ lines.push({
316
+ label: amountLabels.total,
317
+ value: formatAmount(totalAmount, currencySymbol),
318
+ bold: true,
319
+ kind: 'total'
320
+ });
321
+ } else {
322
+ lines.push({
323
+ label: amountLabels.total,
324
+ value: formatAmount(totalAmount, currencySymbol),
325
+ bold: true,
326
+ kind: 'total'
327
+ });
328
+ }
329
+ return /*#__PURE__*/React.createElement("div", {
330
+ style: {
331
+ display: 'flex',
332
+ flexDirection: 'column',
333
+ gap: 4,
334
+ alignItems: 'flex-start'
335
+ }
336
+ }, lines.map(function (line) {
337
+ return /*#__PURE__*/React.createElement("div", {
338
+ key: line.label,
339
+ style: textStyles.text
340
+ }, /*#__PURE__*/React.createElement("span", {
341
+ style: _objectSpread({
342
+ whiteSpace: 'nowrap'
343
+ }, line.kind && amountStyles[line.kind] ? amountStyles[line.kind] : {})
344
+ }, line.label, ": ", line.value));
345
+ }));
346
+ }
347
+ }, {
348
+ title: orderLabels.items,
349
+ key: 'product_quantity',
350
+ align: 'center',
351
+ width: 120,
352
+ render: function render(_, record) {
353
+ var count = (record === null || record === void 0 ? void 0 : record.product_quantity) || 0;
354
+ return /*#__PURE__*/React.createElement("span", {
355
+ style: _objectSpread(_objectSpread({}, textStyles.text), {}, {
356
+ textAlign: 'center'
357
+ })
358
+ }, count, amountLabels.items);
359
+ }
360
+ }, {
361
+ title: orderLabels.orderOrigin,
362
+ key: 'order_origin',
363
+ width: 138,
364
+ align: 'center',
365
+ render: function render(_, record) {
366
+ var channel = PLATFORM_LABEL_MAP[record === null || record === void 0 ? void 0 : record.order_sales_channel] || PLATFORM_LABEL_MAP[record === null || record === void 0 ? void 0 : record.order_platform] || (record === null || record === void 0 ? void 0 : record.order_sales_channel) || (record === null || record === void 0 ? void 0 : record.order_platform);
367
+ 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);
368
+ var time = (record === null || record === void 0 ? void 0 : record.created_at) || (record === null || record === void 0 ? void 0 : record.order_time);
369
+ var lines = getDisplayLines([channel, device]);
370
+ if (lines.length === 0) {
371
+ return null;
372
+ }
373
+ var businessLabel = BUSINESS_LABEL_MAP[record.business_code];
374
+ return /*#__PURE__*/React.createElement("div", {
375
+ style: {
376
+ display: 'flex',
377
+ flexDirection: 'column',
378
+ alignItems: 'flex-start'
379
+ }
380
+ }, businessLabel ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Tag, {
381
+ color: BUSINESS_COLOR_MAP[record.business_code],
382
+ style: {
383
+ color: 'black',
384
+ fontWeight: 500
385
+ }
386
+ }, businessLabel)) : null, lines.map(function (line, index) {
387
+ return /*#__PURE__*/React.createElement("div", {
388
+ key: "".concat(line, "-").concat(index),
389
+ style: textStyles.text
390
+ }, line);
391
+ }), /*#__PURE__*/React.createElement("div", {
392
+ style: {
393
+ display: 'flex',
394
+ alignItems: 'center',
395
+ whiteSpace: 'nowrap'
396
+ }
397
+ }, /*#__PURE__*/React.createElement("span", null, orderLabels.createdBy, ":"), /*#__PURE__*/React.createElement(ClientName, {
398
+ dataSource: record.create_account,
399
+ style: {
400
+ fontSize: 14
401
+ }
402
+ })), /*#__PURE__*/React.createElement(PisellDateTimeDisplay, {
403
+ value: time,
404
+ layout: "inline",
405
+ textAlign: "left",
406
+ timeFormat: {
407
+ padHour: true
408
+ },
409
+ dateFormat: {
410
+ showYear: false,
411
+ shortMonth: true,
412
+ showRelativeDay: true,
413
+ useCommaBeforeYear: false
414
+ },
415
+ fields: {
416
+ fieldOrder: ['time', 'weekday', 'date']
417
+ // inlineSeparators: [' ', ', '],
418
+ },
419
+ style: {
420
+ whiteSpace: 'nowrap'
421
+ }
422
+ }));
423
+ }
424
+ }, {
425
+ title: orderLabels.paymentStatus,
426
+ dataIndex: 'payment_status',
427
+ key: 'payment_status',
428
+ align: 'center',
429
+ width: 160,
430
+ render: function render(value) {
431
+ var label = PAYMENT_STATUS_LABEL_MAP[value] || value || '-';
432
+ var color = PAYMENT_STATUS_COLOR_MAP[value] || '';
433
+ return /*#__PURE__*/React.createElement("div", {
434
+ style: {
435
+ textAlign: 'center'
436
+ }
437
+ }, /*#__PURE__*/React.createElement(PisellTags, {
438
+ style: {
439
+ backgroundColor: color,
440
+ whiteSpace: 'nowrap'
441
+ }
442
+ }, label));
443
+ }
444
+ }, {
445
+ title: orderLabels.shippingMethod,
446
+ key: 'delivery_type',
447
+ align: 'center',
448
+ width: 160,
449
+ render: function render(_, record) {
450
+ var _record$metadata;
451
+ var deliveryType = record === null || record === void 0 ? void 0 : record.delivery_type;
452
+ var serverType = record === null || record === void 0 || (_record$metadata = record.metadata) === null || _record$metadata === void 0 || (_record$metadata = _record$metadata.shop_service_type) === null || _record$metadata === void 0 ? void 0 : _record$metadata.server_type;
453
+ if (!deliveryType && !serverType) return '-';
454
+ var isShopService = deliveryType === 'shop_service';
455
+ var label = isShopService ? SHOP_SERVICE_TYPE_LABEL_MAP[serverType] : DELIVERY_TYPE_LABEL_MAP[deliveryType];
456
+ if (!label || !isShopService && deliveryType === 'nil') return '-';
457
+ var color = isShopService ? SHOP_SERVICE_TYPE_COLOR_MAP[serverType] : DELIVERY_TYPE_COLOR_MAP[deliveryType];
458
+ return /*#__PURE__*/React.createElement("div", {
459
+ style: {
460
+ textAlign: 'center'
461
+ }
462
+ }, /*#__PURE__*/React.createElement(Tag, {
463
+ style: {
464
+ whiteSpace: 'nowrap',
465
+ fontWeight: 500
466
+ },
467
+ color: color
468
+ }, label));
469
+ },
470
+ uniformCompare: function uniformCompare(_, record) {
471
+ var _record$metadata2;
472
+ var deliveryType = (record === null || record === void 0 ? void 0 : record.delivery_type) || '';
473
+ var serverType = (record === null || record === void 0 || (_record$metadata2 = record.metadata) === null || _record$metadata2 === void 0 || (_record$metadata2 = _record$metadata2.shop_service_type) === null || _record$metadata2 === void 0 ? void 0 : _record$metadata2.server_type) || '';
474
+ return "".concat(deliveryType, "|").concat(serverType);
475
+ }
476
+ }, {
477
+ title: orderLabels.orderStatus,
478
+ dataIndex: 'status',
479
+ key: 'status',
480
+ align: 'center',
481
+ width: 150,
482
+ render: function render(value) {
483
+ var color = ORDER_STATUS_COLOR_MAP[value];
484
+ var label = ORDER_STATUS_LABEL_MAP[value] || value || '-';
485
+ return /*#__PURE__*/React.createElement("div", {
486
+ style: {
487
+ textAlign: 'center'
488
+ }
489
+ }, /*#__PURE__*/React.createElement(PisellTags, {
490
+ style: {
491
+ whiteSpace: 'nowrap',
492
+ borderColor: color === null || color === void 0 ? void 0 : color.borderColor,
493
+ color: color === null || color === void 0 ? void 0 : color.textColor
494
+ }
495
+ }, label));
496
+ }
497
+ }, {
498
+ title: orderLabels.fulfillmentStatus,
499
+ dataIndex: 'shipping_status',
500
+ key: 'shipping_status',
501
+ align: 'center',
502
+ width: 160,
503
+ render: function render(value) {
504
+ var color = FULFILLMENT_STATUS_COLOR_MAP[value];
505
+ var label = SHIPPING_STATUS_LABEL_MAP[value] || value || '-';
506
+ return /*#__PURE__*/React.createElement("div", {
507
+ style: {
508
+ textAlign: 'center'
509
+ }
510
+ }, /*#__PURE__*/React.createElement(PisellTags, {
511
+ style: {
512
+ whiteSpace: 'nowrap',
513
+ borderColor: color === null || color === void 0 ? void 0 : color.borderColor,
514
+ color: color === null || color === void 0 ? void 0 : color.textColor
515
+ }
516
+ }, label));
517
+ }
518
+ }, {
519
+ title: orderLabels.updated,
520
+ key: 'last_edit_account',
521
+ width: 132,
522
+ align: 'center',
523
+ render: function render(_, record) {
524
+ var editor = record === null || record === void 0 ? void 0 : record.last_edit_account;
525
+ var time = (editor === null || editor === void 0 ? void 0 : editor.created_at) || (record === null || record === void 0 ? void 0 : record.updated_at);
526
+ var channel = PLATFORM_LABEL_MAP[record === null || record === void 0 ? void 0 : record.order_platform] || (record === null || record === void 0 ? void 0 : record.order_platform);
527
+ var lines = getDisplayLines([channel]);
528
+ return /*#__PURE__*/React.createElement("div", {
529
+ style: {
530
+ display: 'flex',
531
+ flexDirection: 'column',
532
+ alignItems: 'flex-start'
533
+ }
534
+ }, /*#__PURE__*/React.createElement(ClientName, {
535
+ dataSource: editor || record.create_account,
536
+ style: {
537
+ fontSize: 14
538
+ }
539
+ }), /*#__PURE__*/React.createElement(PisellDateTimeDisplay, {
540
+ value: time,
541
+ layout: "inline",
542
+ textAlign: "left",
543
+ timeFormat: {
544
+ padHour: true
545
+ },
546
+ dateFormat: {
547
+ showYear: false,
548
+ shortMonth: true,
549
+ showRelativeDay: true,
550
+ useCommaBeforeYear: false
551
+ },
552
+ fields: {
553
+ fieldOrder: ['time', 'weekday', 'date']
554
+ // inlineSeparators: [' ', ', '],
555
+ },
556
+ style: {
557
+ whiteSpace: 'nowrap'
558
+ }
559
+ }), lines.map(function (line, index) {
560
+ return /*#__PURE__*/React.createElement("div", {
561
+ key: "".concat(line, "-").concat(index),
562
+ style: textStyles.text
563
+ }, line);
564
+ }));
565
+ }
566
+ }, {
567
+ title: orderLabels.orderId,
568
+ dataIndex: 'id',
569
+ key: 'id',
570
+ align: 'center',
571
+ width: 100,
572
+ render: function render(value) {
573
+ return /*#__PURE__*/React.createElement("span", {
574
+ style: _objectSpread(_objectSpread({}, textStyles.text), {}, {
575
+ textAlign: 'center'
576
+ })
577
+ }, value);
578
+ }
579
+ }];
580
+ }, [staticData]);
581
+
582
+ /**
583
+ * 最终 perspective 配置:
584
+ * 使用 getChildComponentProps 工厂函数,使 onRow、columns 等可访问运行时上下文。
585
+ */
586
+ var _perspective = useMemo(function () {
587
+ return {
588
+ key: 'handle',
589
+ label: 'Handle',
590
+ getChildComponentProps: function getChildComponentProps(ctx) {
591
+ return {
592
+ grid: {
593
+ bordered: true,
594
+ collapseUniformColumns: true,
595
+ columns: buildColumns(ctx),
596
+ defaultHiddenColumnKeys: ['order_origin', 'payment_status', 'delivery_type', 'status', 'shipping_status', 'last_edit_account', 'id'],
597
+ scroll: {
598
+ x: 'max-content',
599
+ autoCalc: true,
600
+ scrollToFirstRowOnChange: true
601
+ },
602
+ rowSelection: {
603
+ fixed: true,
604
+ columnWidth: 48
605
+ },
606
+ onRow: function onRow(record) {
607
+ return {
608
+ onClick: function onClick() {
609
+ var _app$history, _app$history2;
610
+ var pathname = encodeURIComponent((app === null || app === void 0 || (_app$history = app.history) === null || _app$history === void 0 || (_app$history = _app$history.instance) === null || _app$history === void 0 || (_app$history = _app$history.location) === null || _app$history === void 0 ? void 0 : _app$history.pathname) || '');
611
+ app === null || app === void 0 || (_app$history2 = app.history) === null || _app$history2 === void 0 || _app$history2.push("/order-detail?id=".concat(record.id, "&goback=").concat(pathname));
612
+ }
613
+ };
614
+ }
615
+ },
616
+ toolBar: {
617
+ search: {
618
+ showConfirmButton: false
619
+ },
620
+ sort: {
621
+ list: getSortList()
622
+ },
623
+ quickFilter: {
624
+ filterList: [{
625
+ type: 'rangePicker',
626
+ name: 'orderDate',
627
+ key: 'orderDate',
628
+ props: {
629
+ placeholder: locales.getText('pisell2.orderList.quickFilter.orderDate.label')
630
+ }
631
+ }]
632
+ },
633
+ filter: {
634
+ hiddenQuickFilter: true,
635
+ defaultFilterValue: {
636
+ quickFilter: [],
637
+ otherFilter: getFilterButtonList(),
638
+ values: {}
639
+ }
640
+ }
641
+ },
642
+ batchActionBar: {
643
+ overflowThreshold: 2,
644
+ defaultActions: {
645
+ showSelectAll: false,
646
+ showClear: false,
647
+ showInvert: false,
648
+ showDelete: false
649
+ }
650
+ }
651
+ };
652
+ }
653
+ };
654
+ }, [buildColumns, app, locale]);
655
+ return _perspective;
656
+ };
@@ -0,0 +1,5 @@
1
+ import { useOrderPerspective } from './useOrderPerspective';
2
+ import { useBookingPerspective } from './useBookingPerspective';
3
+ declare const usePerspectives: (params: any) => import("../../pisellSalesGrid").SalesGridPerspectiveConfig[];
4
+ export { useOrderPerspective, useBookingPerspective };
5
+ export default usePerspectives;
@@ -0,0 +1,12 @@
1
+ import { useMemo } from 'react';
2
+ import { useOrderPerspective } from "./useOrderPerspective";
3
+ import { useBookingPerspective } from "./useBookingPerspective";
4
+ var usePerspectives = function usePerspectives(params) {
5
+ var orderPerspective = useOrderPerspective();
6
+ var bookingPerspective = useBookingPerspective(params);
7
+ return useMemo(function () {
8
+ return [orderPerspective, bookingPerspective];
9
+ }, [orderPerspective, bookingPerspective]);
10
+ };
11
+ export { useOrderPerspective, useBookingPerspective };
12
+ export default usePerspectives;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface IProps {
3
+ perspective: 'monitor' | 'handle';
4
+ biz?: string;
5
+ style?: React.CSSProperties;
6
+ /** 实例 id,透传 SalesGrid/RecordBoard 用于列显隐持久化(localStorage) */
7
+ __id?: string;
8
+ }
9
+ declare const PisellSalesManagement: (props: IProps) => React.JSX.Element;
10
+ export default PisellSalesManagement;