From cc3ec131569e429c5a5b779bb9af3af01bd30e56 Mon Sep 17 00:00:00 2001 From: cll <931958862@qq.com> Date: Wed, 23 Jul 2025 17:29:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E8=AF=84=E6=98=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Customer/List/index.tsx | 35 ++++++++++++++++++++++++++++++- src/servers/api/customer.ts | 15 +++++++++++++ src/servers/api/typings.d.ts | 2 ++ 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/src/pages/Customer/List/index.tsx b/src/pages/Customer/List/index.tsx index 3851c5a..e9c8b03 100644 --- a/src/pages/Customer/List/index.tsx +++ b/src/pages/Customer/List/index.tsx @@ -4,6 +4,7 @@ import { customercontrollerDeltag, customercontrollerGetcustomerlist, customercontrollerGettags, + customercontrollerSetrate, } from '@/servers/api/customer'; import { ActionType, @@ -13,12 +14,13 @@ import { ProFormSelect, ProTable, } from '@ant-design/pro-components'; -import { App, Button, Space, Tag } from 'antd'; +import { App, Button, Rate, Space, Tag } from 'antd'; import dayjs from 'dayjs'; import { useRef, useState } from 'react'; const ListPage: React.FC = () => { const actionRef = useRef(); + const { message } = App.useApp(); const columns: ProColumns[] = [ { title: '用户名', @@ -89,6 +91,37 @@ const ListPage: React.FC = () => { hideInSearch: true, sorter: true, }, + { + title: '等级', + hideInSearch: true, + render: (_, record) => { + if(!record.yoone_orders || !record.yoone_total) return '-' + if(Number(record.yoone_orders) === 1 && Number(record.yoone_total) > 0 ) return 'B' + return '-' + } + }, + { + title: '评星', + dataIndex: 'rate', + width: 200, + render: (_, record) => { + return { + try{ + const { success, message: msg } = await customercontrollerSetrate({ + id: record.customerId, + rate: val + }); + if (success) { + message.success(msg); + actionRef.current?.reload(); + } + }catch(e){ + message.error(e.message); + + } + }} value={record.rate} /> + }, + }, { title: 'phone', dataIndex: 'phone', diff --git a/src/servers/api/customer.ts b/src/servers/api/customer.ts index bc68dbe..de2d398 100644 --- a/src/servers/api/customer.ts +++ b/src/servers/api/customer.ts @@ -17,6 +17,21 @@ export async function customercontrollerGetcustomerlist( }); } +/** 此处后端没有提供注释 PUT /customer/rate */ +export async function customercontrollerSetrate( + body: Record, + options?: { [key: string]: any }, +) { + return request('/customer/rate', { + method: 'PUT', + headers: { + 'Content-Type': 'text/plain', + }, + data: body, + ...(options || {}), + }); +} + /** 此处后端没有提供注释 POST /customer/tag/add */ export async function customercontrollerAddtag( body: API.CustomerTagDTO, diff --git a/src/servers/api/typings.d.ts b/src/servers/api/typings.d.ts index 00f3bb1..04c7855 100644 --- a/src/servers/api/typings.d.ts +++ b/src/servers/api/typings.d.ts @@ -110,6 +110,7 @@ declare namespace API { sorterValue?: string; state?: string; first_purchase_date?: string; + customerId?: number; }; type CustomerTagDTO = { @@ -798,6 +799,7 @@ declare namespace API { sorterValue?: string; state?: string; first_purchase_date?: string; + customerId?: number; }; type QueryFlavorsDTO = {