@appthen/cli 1.2.10 → 1.2.12

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 (173) hide show
  1. package/.gitignore +1 -0
  2. package/bin/main.js +92 -0
  3. package/dist/index.js +7014 -14988
  4. package/package.json +8 -1
  5. package/tests/test-app/.appthen/shadow-space-100001-test-app-e99876b1.json +1862 -0
  6. package/tests/test-app/.appthen/space-config.json +8 -0
  7. package/tests/test-app/docs/AI-Workflow.flow +112 -0
  8. package/tests/test-app/docs/Logic-1.flow +16 -0
  9. package/tests/test-app/docs/Logic.flow +16 -0
  10. package/tests/test-app/docs/Project-Blueprint-1.flow +119 -0
  11. package/tests/test-app/docs/Project-Blueprint.flow +119 -0
  12. package/tests/test-app/docs/README.md +3 -0
  13. package/tests/test-app/docs/claude.md +194 -0
  14. package/tests/test-app/docs/page_requirement_analysis.md +149 -0
  15. package/tests/test-app/docs//345/267/245/345/215/225/347/256/241/347/220/206/347/263/273/347/273/237/350/257/246/347/273/206/350/256/276/350/256/241.md +377 -0
  16. package/tests/test-app/src/apis/AddTodoPost.api.ts +42 -0
  17. package/tests/test-app/src/apis/DeleteTodoPost.api.ts +32 -0
  18. package/tests/test-app/src/apis/GetListPost.api.ts +38 -0
  19. package/tests/test-app/src/apis/TicketAttachmentUploadPost.api.ts +42 -0
  20. package/tests/test-app/src/apis/UpdateTodoPost.api.ts +46 -0
  21. package/tests/test-app/src/app.css +15 -0
  22. package/tests/test-app/src/cloud_functions/ticket|attachment|upload.node.ts +86 -0
  23. package/tests/test-app/src/cloud_functions/ticket|comment|add.node.ts +65 -0
  24. package/tests/test-app/src/cloud_functions/types|entity|Ticket.node.ts +88 -0
  25. package/tests/test-app/src/cloud_functions/types|entity|TicketAttachment.node.ts +70 -0
  26. package/tests/test-app/src/cloud_functions/types|entity|TicketCategory.node.ts +56 -0
  27. package/tests/test-app/src/cloud_functions/types|entity|TicketComment.node.ts +62 -0
  28. package/tests/test-app/src/cloud_functions/types|entity|TicketHistory.node.ts +74 -0
  29. package/tests/test-app/src/cloud_functions/types|entity|TicketPriority.node.ts +68 -0
  30. package/tests/test-app/src/cloud_functions/types|entity|TicketStatus.node.ts +63 -0
  31. package/tests/test-app/src/cloud_functions/types|models|CreateTicketParams.node.ts +20 -0
  32. package/tests/test-app/src/cloud_functions/types|models|TicketListParams.node.ts +30 -0
  33. package/tests/test-app/src/cloud_functions/types|models|UpdateTicketParams.node.ts +22 -0
  34. package/tests/test-app/src/components/Button.js +11 -0
  35. package/tests/test-app/src/components/MessageCenter.tsx +506 -0
  36. package/tests/test-app/src/components/MouduleDemoNzp.tsx +40 -0
  37. package/tests/test-app/src/components/Timeline.tsx +145 -0
  38. package/tests/test-app/src/index.ts +2 -0
  39. package/tests/test-app/src/modules/work_order_module/apis/TicketCommentAddPost.api.ts +48 -0
  40. package/tests/test-app/src/modules/work_order_module/apis/TicketCreatePost.api.ts +52 -0
  41. package/tests/test-app/src/modules/work_order_module/apis/TicketDeleteDelete.api.ts +39 -0
  42. package/tests/test-app/src/modules/work_order_module/apis/TicketDetailGet.api.ts +39 -0
  43. package/tests/test-app/src/modules/work_order_module/apis/TicketListGet.api.ts +61 -0
  44. package/tests/test-app/src/modules/work_order_module/apis/TicketUpdatePut.api.ts +57 -0
  45. package/tests/test-app/src/modules/work_order_module/apis/TrainDoorFaultListGet.ts +76 -0
  46. package/tests/test-app/src/modules/work_order_module/apis/TrainDoorListGet.ts +76 -0
  47. package/tests/test-app/src/modules/work_order_module/apis/TrainDoorOperationRecordsGet.ts +284 -0
  48. package/tests/test-app/src/modules/work_order_module/apis/TrainDoorStatisticsGet.ts +96 -0
  49. package/tests/test-app/src/modules/work_order_module/cloud_function/category|list.node.ts +40 -0
  50. package/tests/test-app/src/modules/work_order_module/cloud_function/priority|list.node.ts +26 -0
  51. package/tests/test-app/src/modules/work_order_module/cloud_function/status|list.node.ts +26 -0
  52. package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|create.node.ts +54 -0
  53. package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|delete.node.ts +55 -0
  54. package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|detail.node.ts +65 -0
  55. package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|list.node.ts +85 -0
  56. package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|update.node.ts +73 -0
  57. package/tests/test-app/src/modules/work_order_module/data_model/Ticket.m.ts +85 -0
  58. package/tests/test-app/src/modules/work_order_module/data_model/TicketCategory.m.ts +53 -0
  59. package/tests/test-app/src/modules/work_order_module/data_model/TicketStatus.m.ts +60 -0
  60. package/tests/test-app/src/modules/work_order_module//345/267/245/345/215/225/347/263/273/347/273/237/344/272/247/345/223/201/350/256/276/350/256/241/346/226/207/346/241/243.md +301 -0
  61. package/tests/test-app/src/modules/work_order_module//345/267/245/345/215/225/347/263/273/347/273/237/345/274/200/345/217/221/344/273/273/345/212/241/345/210/206/345/267/245/346/226/207/346/241/243.md +345 -0
  62. package/tests/test-app/src/pages/CustomerManagement.tsx +535 -0
  63. package/tests/test-app/src/pages/CyberpunkDashboard.tsx +348 -0
  64. package/tests/test-app/src/pages/CyberpunkProductManagement.tsx +637 -0
  65. package/tests/test-app/src/pages/CyberpunkUserList.tsx +316 -0
  66. package/tests/test-app/src/pages/DashboardV2.tsx +334 -0
  67. package/tests/test-app/src/pages/DataReport.tsx +298 -0
  68. package/tests/test-app/src/pages/DataStatistics.tsx +317 -0
  69. package/tests/test-app/src/pages/DepartmentManagement.tsx +503 -0
  70. package/tests/test-app/src/pages/FileExplorer.tsx +441 -0
  71. package/tests/test-app/src/pages/OrderDetail.tsx +393 -0
  72. package/tests/test-app/src/pages/ProductManagement.tsx +521 -0
  73. package/tests/test-app/src/pages/ProjectTimeline.tsx +395 -0
  74. package/tests/test-app/src/pages/RoleManagement.tsx +523 -0
  75. package/tests/test-app/src/pages/SLAManagement.tsx +668 -0
  76. package/tests/test-app/src/pages/StaticCyberpunkDashboard.tsx +462 -0
  77. package/tests/test-app/src/pages/StaticCyberpunkUserList.tsx +567 -0
  78. package/tests/test-app/src/pages/StudentWeaknessList.tsx +547 -0
  79. package/tests/test-app/src/pages/SystemSettings.tsx +422 -0
  80. package/tests/test-app/src/pages/TaskManagement.tsx +467 -0
  81. package/tests/test-app/src/pages/TicketCreate.tsx +27 -0
  82. package/tests/test-app/src/pages/TicketDetail.tsx +27 -0
  83. package/tests/test-app/src/pages/TicketList.tsx +27 -0
  84. package/tests/test-app/src/pages/TicketManagement.tsx +402 -0
  85. package/tests/test-app/src/pages/TicketManagementPage.tsx +1238 -0
  86. package/tests/test-app/src/pages/UserProfile.tsx +404 -0
  87. package/tests/test-app/src/pages/VisualAIIDEUpgrade.tsx +245 -0
  88. package/tests/test-app/src/pages/WorkflowDesigner.tsx +434 -0
  89. package/tests/test-app/src/pages/admin/dashboard.tsx +591 -0
  90. package/tests/test-app/src/pages/appthen_guide/ComponentTreeUnderstanding.tsx +26 -0
  91. package/tests/test-app/src/pages/appthen_guide/DataBindingLearning.tsx +26 -0
  92. package/tests/test-app/src/pages/article-list.tsx +222 -0
  93. package/tests/test-app/src/pages/babyProductRecommendationPage.tsx +168 -0
  94. package/tests/test-app/src/pages/back-end/adminRootLayout.tsx +155 -0
  95. package/tests/test-app/src/pages/back-end/adminRootLayout10.tsx +157 -0
  96. package/tests/test-app/src/pages/back-end/adminRootLayout2.tsx +156 -0
  97. package/tests/test-app/src/pages/back-end/adminRootLayout3.tsx +156 -0
  98. package/tests/test-app/src/pages/back-end/adminRootLayout4.tsx +157 -0
  99. package/tests/test-app/src/pages/back-end/adminRootLayout5.tsx +157 -0
  100. package/tests/test-app/src/pages/back-end/adminRootLayout6.tsx +157 -0
  101. package/tests/test-app/src/pages/back-end/adminRootLayout7.tsx +157 -0
  102. package/tests/test-app/src/pages/back-end/adminRootLayout8.tsx +157 -0
  103. package/tests/test-app/src/pages/back-end/adminRootLayout9.tsx +157 -0
  104. package/tests/test-app/src/pages/back-end/backgroundManagementSystem.css +5 -0
  105. package/tests/test-app/src/pages/back-end/backgroundManagementSystem.tsx +1745 -0
  106. package/tests/test-app/src/pages/category-list.tsx +179 -0
  107. package/tests/test-app/src/pages/comment-list.tsx +194 -0
  108. package/tests/test-app/src/pages/component/WorkOrderCard.tsx +140 -0
  109. package/tests/test-app/src/pages/cover.tsx +42 -0
  110. package/tests/test-app/src/pages/cyberpunk/cyberpunkCRMPage.tsx +1299 -0
  111. package/tests/test-app/src/pages/data-analytics.tsx +1872 -0
  112. package/tests/test-app/src/pages/data-overview.tsx +600 -0
  113. package/tests/test-app/src/pages/data_dashboard/blueBrightGreenTechnologyWind.css +181 -0
  114. package/tests/test-app/src/pages/data_dashboard/blueBrightGreenTechnologyWind.tsx +225 -0
  115. package/tests/test-app/src/pages/data_dashboard/blueLargeScreen.css +181 -0
  116. package/tests/test-app/src/pages/data_dashboard/blueLargeScreen.tsx +138 -0
  117. package/tests/test-app/src/pages/data_dashboard/component_library/BlueBrightGreenBorder.tsx +47 -0
  118. package/tests/test-app/src/pages/data_dashboard/component_library/FullScreenContainer.tsx +133 -0
  119. package/tests/test-app/src/pages/demo-error-page.tsx +119 -0
  120. package/tests/test-app/src/pages/department-list.tsx +183 -0
  121. package/tests/test-app/src/pages/description_of_mock_interface.md +32 -0
  122. package/tests/test-app/src/pages/digitalLargeScreen.css +181 -0
  123. package/tests/test-app/src/pages/digitalLargeScreen.tsx +1417 -0
  124. package/tests/test-app/src/pages/goods-list.tsx +233 -0
  125. package/tests/test-app/src/pages/housekeeping/adminDashboardPage.tsx +880 -0
  126. package/tests/test-app/src/pages/mobile_terminal/PersonalCenter.css +3 -0
  127. package/tests/test-app/src/pages/mobile_terminal/PersonalCenter.tsx +362 -0
  128. package/tests/test-app/src/pages/mobile_terminal/WorkOrderHomepage.tsx +337 -0
  129. package/tests/test-app/src/pages/mobile_terminal/newWorkOrder.tsx +224 -0
  130. package/tests/test-app/src/pages/mobile_terminal/tabbar.tsx +67 -0
  131. package/tests/test-app/src/pages/mobile_terminal/uiHandsOnPractice.tsx +638 -0
  132. package/tests/test-app/src/pages/mobile_terminal/workOrderDetails.tsx +346 -0
  133. package/tests/test-app/src/pages/mobile_terminal/workOrderPage.tsx +345 -0
  134. package/tests/test-app/src/pages/notice-list.tsx +217 -0
  135. package/tests/test-app/src/pages/order-detail.tsx +330 -0
  136. package/tests/test-app/src/pages/order-list.tsx +195 -0
  137. package/tests/test-app/src/pages/order-management.tsx +563 -0
  138. package/tests/test-app/src/pages/page/OrderList.tsx +230 -0
  139. package/tests/test-app/src/pages/role-list.tsx +184 -0
  140. package/tests/test-app/src/pages/simple/simplePage.tsx +92 -0
  141. package/tests/test-app/src/pages/simple-page.tsx +43 -0
  142. package/tests/test-app/src/pages/test-destructure.tsx +44 -0
  143. package/tests/test-app/src/pages/test-error-page.tsx +75 -0
  144. package/tests/test-app/src/pages/test-page-with-errors.tsx +51 -0
  145. package/tests/test-app/src/pages/test-page.tsx +101 -0
  146. package/tests/test-app/src/pages/test-render.tsx +52 -0
  147. package/tests/test-app/src/pages/test-return-type.tsx +41 -0
  148. package/tests/test-app/src/pages/test-type-assertion.tsx +37 -0
  149. package/tests/test-app/src/pages/testPage.css +3 -0
  150. package/tests/test-app/src/pages/testPage.tsx +158 -0
  151. package/tests/test-app/src/pages/ui/styleSelectorPage.tsx +1554 -0
  152. package/tests/test-app/src/pages/user-list.tsx +212 -0
  153. package/tests/test-app/src/pages/web_version/website.css +205 -0
  154. package/tests/test-app/src/pages/web_version/website.tsx +1066 -0
  155. package/tests/test-app/src/pages/wrong-page.tsx +50 -0
  156. package/tests/test-app/src/pages//345/276/205/345/212/236.apidoc.json +336 -0
  157. package/tests/test-app/src/project.json +1120 -0
  158. package/tests/test-app/src/store/global.store.ts +10 -0
  159. package/tests/test-app/src/types/CreateTicketParams.m.ts +20 -0
  160. package/tests/test-app/src/types/SLAPolicy.ts +50 -0
  161. package/tests/test-app/src/types/Ticket.ts +68 -0
  162. package/tests/test-app/src/types/TicketAttachment.m.ts +67 -0
  163. package/tests/test-app/src/types/TicketComment.m.ts +59 -0
  164. package/tests/test-app/src/types/TicketEvaluation.ts +44 -0
  165. package/tests/test-app/src/types/TicketHistory.m.ts +71 -0
  166. package/tests/test-app/src/types/TicketListParams.m.ts +30 -0
  167. package/tests/test-app/src/types/TicketPriority.m.ts +65 -0
  168. package/tests/test-app/src/types/TicketRecord.ts +47 -0
  169. package/tests/test-app/src/types/TrainDoor.ts +284 -0
  170. package/tests/test-app/src/types/UpdateTicketParams.m.ts +22 -0
  171. package/tests/test-app/src/utils/__afterRequest.util.ts +3 -0
  172. package/tests/test-app/src/utils/__beforeRequest.util.ts +10 -0
  173. package/tests/test-app/src/utils/testGlobalAction.util.ts +7 -0
@@ -0,0 +1,535 @@
1
+ /**
2
+ * 客户管理
3
+ * 客户信息管理和跟进
4
+ *
5
+ * @type Page
6
+ * @route /customers
7
+ * @screen 1920w
8
+ * @frames web
9
+ */
10
+ import React from 'react';
11
+
12
+
13
+
14
+ class IProps {
15
+ customerId?: number;
16
+ }
17
+
18
+ /*
19
+ * 数据与接口请求定义
20
+ */
21
+ class IState {
22
+ customers?: {
23
+ /* @example 1 */id?: number,
24
+ /* @example 张三 */name?: string,
25
+ /* @example ABC公司 */company?: string,
26
+ /* @example 13800138000 */phone?: string,
27
+ /* @example zhangsan@abc.com */email?: string,
28
+ /* @example active */status?: string,
29
+ /* @example VIP */level?: string,
30
+ /* @example 25 */totalOrders?: number,
31
+ /* @example 125000 */totalAmount?: number,
32
+ /* @example 2024-01-15 */lastContact?: string,
33
+ }[];
34
+ loading?: boolean;
35
+ selectedCustomer?: any;
36
+ showEditModal?: boolean;
37
+ searchKeyword?: string;
38
+ statusFilter?: string;
39
+ formData?: any;
40
+ }
41
+
42
+ class Document extends React.Component<IProps, IState> {
43
+ state = {
44
+ customers: [
45
+ {
46
+ id: 1,
47
+ name: '张三',
48
+ company: 'ABC公司',
49
+ phone: '13800138000',
50
+ email: 'zhangsan@abc.com',
51
+ status: 'active',
52
+ level: 'VIP',
53
+ totalOrders: 25,
54
+ totalAmount: 125000,
55
+ lastContact: '2024-01-15',
56
+ },
57
+ {
58
+ id: 2,
59
+ name: '李四',
60
+ company: 'XYZ公司',
61
+ phone: '13900139000',
62
+ email: 'lisi@xyz.com',
63
+ status: 'active',
64
+ level: '普通',
65
+ totalOrders: 10,
66
+ totalAmount: 32000,
67
+ lastContact: '2024-01-14',
68
+ },
69
+ {
70
+ id: 3,
71
+ name: '王五',
72
+ company: 'DEF公司',
73
+ phone: '13700137000',
74
+ email: 'wangwu@def.com',
75
+ status: 'inactive',
76
+ level: 'VIP',
77
+ totalOrders: 50,
78
+ totalAmount: 250000,
79
+ lastContact: '2024-01-10',
80
+ },
81
+ {
82
+ id: 4,
83
+ name: '赵六',
84
+ company: 'GHI公司',
85
+ phone: '13600136000',
86
+ email: 'zhaoliu@ghi.com',
87
+ status: 'active',
88
+ level: '普通',
89
+ totalOrders: 8,
90
+ totalAmount: 18000,
91
+ lastContact: '2024-01-13',
92
+ },
93
+ {
94
+ id: 5,
95
+ name: '钱七',
96
+ company: 'JKL公司',
97
+ phone: '13500135000',
98
+ email: 'qianqi@jkl.com',
99
+ status: 'active',
100
+ level: 'VIP',
101
+ totalOrders: 30,
102
+ totalAmount: 180000,
103
+ lastContact: '2024-01-12',
104
+ },
105
+ ],
106
+ loading: false,
107
+ selectedCustomer: null,
108
+ showEditModal: false,
109
+ searchKeyword: '',
110
+ statusFilter: 'all',
111
+ formData: {},
112
+ };
113
+
114
+ handleSearch(keyword) {
115
+ this.setState({
116
+ searchKeyword: keyword,
117
+ });
118
+ }
119
+
120
+ handleStatusFilter(status) {
121
+ this.setState({
122
+ statusFilter: status,
123
+ });
124
+ }
125
+
126
+ getCustomerById(id) {
127
+ return this.state.customers.find(customer => customer.id === id);
128
+ }
129
+
130
+ getActiveCustomers() {
131
+ return this.state.customers.filter(
132
+ customer => customer.status === 'active'
133
+ );
134
+ }
135
+
136
+ getVipCustomers() {
137
+ return this.state.customers.filter(customer => customer.level === 'VIP');
138
+ }
139
+
140
+ handleEdit(customer) {
141
+ this.setState({
142
+ selectedCustomer: customer,
143
+ formData: {
144
+ ...customer,
145
+ },
146
+ showEditModal: true,
147
+ });
148
+ }
149
+
150
+ handleSave(id, data) {
151
+ console.log('保存客户:', id, data);
152
+ this.setState({
153
+ customers: this.state.customers.map(c => {
154
+ if (c.id === id) {
155
+ return {
156
+ ...c,
157
+ ...data,
158
+ };
159
+ }
160
+ return c;
161
+ }),
162
+ showEditModal: false,
163
+ });
164
+ }
165
+
166
+ handleDelete(id) {
167
+ this.setState({
168
+ customers: this.state.customers.filter(c => c.id !== id),
169
+ });
170
+ }
171
+
172
+ handleContact(customer) {
173
+ console.log('联系客户:', customer);
174
+ }
175
+
176
+ exportCustomers(format) {
177
+ console.log('导出客户:', format, this.state.customers);
178
+ }
179
+
180
+ calculateCustomerValue(customer) {
181
+ return customer.totalAmount / Math.max(customer.totalOrders, 1);
182
+ }
183
+
184
+ renderStatus(status) {
185
+ const config = {
186
+ active: {
187
+ color: 'green',
188
+ label: '活跃',
189
+ },
190
+ inactive: {
191
+ color: 'gray',
192
+ label: '非活跃',
193
+ },
194
+ };
195
+ return (
196
+ <Tag color={config[status]?.color || 'default'}>
197
+ {config[status]?.label || status}
198
+ </Tag>
199
+ );
200
+ }
201
+
202
+ renderLevel(level) {
203
+ const config = {
204
+ VIP: {
205
+ color: 'gold',
206
+ label: 'VIP',
207
+ },
208
+ 普通: {
209
+ color: 'blue',
210
+ label: '普通',
211
+ },
212
+ };
213
+ return (
214
+ <Tag color={config[level]?.color || 'default'}>
215
+ {config[level]?.label || level}
216
+ </Tag>
217
+ );
218
+ }
219
+
220
+ refreshData() {
221
+ this.setState({
222
+ loading: true,
223
+ });
224
+ setTimeout(() => {
225
+ this.setState({
226
+ loading: false,
227
+ });
228
+ }, 1000);
229
+ }
230
+
231
+ render() {
232
+ const customers = this.state.customers;
233
+ const loading = this.state.loading;
234
+ const selectedCustomer = this.state.selectedCustomer;
235
+ const showEditModal = this.state.showEditModal;
236
+ const searchKeyword = this.state.searchKeyword;
237
+ const statusFilter = this.state.statusFilter;
238
+ const formData = this.state.formData;
239
+ const filteredCustomers = customers.filter(customer => {
240
+ const matchSearch =
241
+ customer.name.includes(searchKeyword) ||
242
+ customer.company.includes(searchKeyword);
243
+ const matchStatus =
244
+ statusFilter === 'all' || customer.status === statusFilter;
245
+ return matchSearch && matchStatus;
246
+ });
247
+ const columns = [
248
+ {
249
+ title: '客户姓名',
250
+ dataIndex: 'name',
251
+ key: 'name',
252
+ render: text => <Text className="font-bold">{text}</Text>,
253
+ },
254
+ {
255
+ title: '公司',
256
+ dataIndex: 'company',
257
+ key: 'company',
258
+ },
259
+ {
260
+ title: '联系方式',
261
+ key: 'contact',
262
+ render: record => (
263
+ <View>
264
+ <Text block>{record.phone}</Text>
265
+ <Text className="text-gray-500 text-sm">{record.email}</Text>
266
+ </View>
267
+ ),
268
+ },
269
+ {
270
+ title: '状态',
271
+ dataIndex: 'status',
272
+ key: 'status',
273
+ render: status => this.renderStatus(status),
274
+ },
275
+ {
276
+ title: '等级',
277
+ dataIndex: 'level',
278
+ key: 'level',
279
+ render: level => this.renderLevel(level),
280
+ },
281
+ {
282
+ title: '订单数',
283
+ dataIndex: 'totalOrders',
284
+ key: 'totalOrders',
285
+ render: value => <Text>{value} 单</Text>,
286
+ },
287
+ {
288
+ title: '总金额',
289
+ dataIndex: 'totalAmount',
290
+ key: 'totalAmount',
291
+ render: value => <Text>¥{value.toLocaleString()}</Text>,
292
+ },
293
+ {
294
+ title: '平均客单价',
295
+ key: 'avgValue',
296
+ render: record => (
297
+ <Text>¥{this.calculateCustomerValue(record).toFixed(2)}</Text>
298
+ ),
299
+ },
300
+ {
301
+ title: '操作',
302
+ key: 'action',
303
+ render: (text, record) => (
304
+ <View>
305
+ <Button type="link" onClick={() => this.handleEdit(record)}>
306
+ 编辑
307
+ </Button>
308
+ <Button type="link" onClick={() => this.handleContact(record)}>
309
+ 联系
310
+ </Button>
311
+ <Button
312
+ type="link"
313
+ danger
314
+ onClick={() => this.handleDelete(record.id)}
315
+ >
316
+ 删除
317
+ </Button>
318
+ </View>
319
+ ),
320
+ },
321
+ ];
322
+ if (loading) {
323
+ return <View className="p-6">加载中...</View>;
324
+ }
325
+ return (
326
+ <Page className="p-[24px] bg-[var(--gray-50)] min-h-screen">
327
+ <View className="mb-[24px]">
328
+ <Text className="text-2xl font-bold text-[#1f2937]">客户管理</Text>
329
+ <Text className="text-[#6b7280] text-sm mt-[4px]">
330
+ 客户信息管理和跟进
331
+ </Text>
332
+ </View>
333
+ <Card className="mb-[24px]">
334
+ <View className="gap-4 grid grid-cols-4">
335
+ <View className="text-[var(--center)] p-[16px] bg-[var(--blue-50)] rounded">
336
+ <Text className="text-3xl font-bold text-[var(--blue-600)]">
337
+ {customers.length}
338
+ </Text>
339
+ <Text className="block text-sm text-[#4b5563] mt-[4px]">
340
+ 总客户数
341
+ </Text>
342
+ </View>
343
+ <View className="text-[var(--center)] p-[16px] bg-[var(--green-50)] rounded">
344
+ <Text className="text-3xl font-bold text-[var(--green-600)]">
345
+ {this.getActiveCustomers().length}
346
+ </Text>
347
+ <Text className="block text-sm text-[#4b5563] mt-[4px]">
348
+ 活跃客户
349
+ </Text>
350
+ </View>
351
+ <View className="text-[var(--center)] p-[16px] bg-[var(--orange-50)] rounded">
352
+ <Text className="text-3xl font-bold text-[var(--orange-600)]">
353
+ {this.getVipCustomers().length}
354
+ </Text>
355
+ <Text className="block text-sm text-[#4b5563] mt-[4px]">
356
+ VIP客户
357
+ </Text>
358
+ </View>
359
+ <View className="text-[var(--center)] p-[16px] bg-[var(--purple-50)] rounded">
360
+ <Text className="text-3xl font-bold text-[var(--purple-600)]">
361
+ {customers
362
+ .reduce((sum, c) => sum + c.totalAmount, 0)
363
+ .toLocaleString()}
364
+ </Text>
365
+ <Text className="block text-sm text-[#4b5563] mt-[4px]">
366
+ 总消费金额
367
+ </Text>
368
+ </View>
369
+ </View>
370
+ </Card>
371
+ <Card className="mb-[24px]">
372
+ <View className="flex items-center justify-between">
373
+ <View className="gap-4 flex items-center">
374
+ <Input
375
+ placeholder="搜索客户"
376
+ value={searchKeyword}
377
+ onChange={e => this.handleSearch(e.target.value)}
378
+ className=""
379
+ />
380
+ <Select
381
+ value={statusFilter}
382
+ onChange={value => this.handleStatusFilter(value)}
383
+ className=""
384
+ >
385
+ <Select.Option value="all">全部状态</Select.Option>
386
+ <Select.Option value="active">活跃</Select.Option>
387
+ <Select.Option value="inactive">非活跃</Select.Option>
388
+ </Select>
389
+ </View>
390
+ <View className="gap-2 flex">
391
+ <Button onClick={() => this.refreshData()}>刷新</Button>
392
+ <Button type="primary">+ 新增客户</Button>
393
+ </View>
394
+ </View>
395
+ </Card>
396
+ <Card>
397
+ <Table
398
+ columns={columns}
399
+ dataSource={filteredCustomers}
400
+ rowKey="id"
401
+ pagination={{
402
+ pageSize: 10,
403
+ showTotal: function (total) {
404
+ return `共 ${total} 条`;
405
+ },
406
+ }}
407
+ />
408
+ </Card>
409
+ <Modal
410
+ animate="pop"
411
+ visible={showEditModal}
412
+ renderView={() => (
413
+ <View className="bg-[#ffffff] w-[600px] h-[500px] p-[24px]">
414
+ <Text className="text-xl font-bold mb-[16px]">编辑客户</Text>
415
+ <View className="space-y-4">
416
+ <View>
417
+ <Text className="block mb-[8px]">姓名</Text>
418
+ <Input
419
+ value={formData?.name}
420
+ onChange={e =>
421
+ this.setState({
422
+ formData: {
423
+ ...formData,
424
+ name: e.target.value,
425
+ },
426
+ })
427
+ }
428
+ />
429
+ </View>
430
+ <View>
431
+ <Text className="block mb-[8px]">公司</Text>
432
+ <Input
433
+ value={formData?.company}
434
+ onChange={e =>
435
+ this.setState({
436
+ formData: {
437
+ ...formData,
438
+ company: e.target.value,
439
+ },
440
+ })
441
+ }
442
+ />
443
+ </View>
444
+ <View>
445
+ <Text className="block mb-[8px]">手机号</Text>
446
+ <Input
447
+ value={formData?.phone}
448
+ onChange={e =>
449
+ this.setState({
450
+ formData: {
451
+ ...formData,
452
+ phone: e.target.value,
453
+ },
454
+ })
455
+ }
456
+ />
457
+ </View>
458
+ <View>
459
+ <Text className="block mb-[8px]">邮箱</Text>
460
+ <Input
461
+ value={formData?.email}
462
+ onChange={e =>
463
+ this.setState({
464
+ formData: {
465
+ ...formData,
466
+ email: e.target.value,
467
+ },
468
+ })
469
+ }
470
+ />
471
+ </View>
472
+ <View>
473
+ <Text className="block mb-[8px]">状态</Text>
474
+ <Select
475
+ value={formData?.status}
476
+ onChange={value =>
477
+ this.setState({
478
+ formData: {
479
+ ...formData,
480
+ status: value,
481
+ },
482
+ })
483
+ }
484
+ className="w-full"
485
+ >
486
+ <Select.Option value="active">活跃</Select.Option>
487
+ <Select.Option value="inactive">非活跃</Select.Option>
488
+ </Select>
489
+ </View>
490
+ <View>
491
+ <Text className="block mb-[8px]">等级</Text>
492
+ <Select
493
+ value={formData?.level}
494
+ onChange={value =>
495
+ this.setState({
496
+ formData: {
497
+ ...formData,
498
+ level: value,
499
+ },
500
+ })
501
+ }
502
+ className="w-full"
503
+ >
504
+ <Select.Option value="VIP">VIP</Select.Option>
505
+ <Select.Option value="普通">普通</Select.Option>
506
+ </Select>
507
+ </View>
508
+ <View className="gap-2 flex justify-end mt-[24px]">
509
+ <Button
510
+ onClick={() =>
511
+ this.setState({
512
+ showEditModal: false,
513
+ })
514
+ }
515
+ >
516
+ 取消
517
+ </Button>
518
+ <Button
519
+ type="primary"
520
+ onClick={() => this.handleSave(formData?.id || 0, formData)}
521
+ >
522
+ 保存
523
+ </Button>
524
+ </View>
525
+ </View>
526
+ </View>
527
+ )}
528
+ maskClosable={true}
529
+ />
530
+ </Page>
531
+ );
532
+ }
533
+ }
534
+
535
+ export default Document;