客户评星
This commit is contained in:
parent
f32d2d2879
commit
cc3ec13156
|
|
@ -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<ActionType>();
|
||||
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 <Rate onChange={async(val)=>{
|
||||
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',
|
||||
|
|
|
|||
|
|
@ -17,6 +17,21 @@ export async function customercontrollerGetcustomerlist(
|
|||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 PUT /customer/rate */
|
||||
export async function customercontrollerSetrate(
|
||||
body: Record<string, any>,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.BooleanRes>('/customer/rate', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 POST /customer/tag/add */
|
||||
export async function customercontrollerAddtag(
|
||||
body: API.CustomerTagDTO,
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue