Commit 69917da4 authored by Bill's avatar Bill

Merge branch 'dev' of 10.0.0.22:lingxi/lingxi-business-system into dev

parents d1370cdf b215bcda
...@@ -61,12 +61,17 @@ export const UserDetailSchema:ISchema = { ...@@ -61,12 +61,17 @@ export const UserDetailSchema:ISchema = {
required: true, required: true,
properties: { properties: {
countryCode: { countryCode: {
required: true,
type: 'string', type: 'string',
enum: ['+86'], enum: ['+86'],
"x-mega-props": { "x-mega-props": {
wrapperCol: 24 wrapperCol: 24
}, },
"x-rules": [
{
required: true,
message: '请选择'
},
],
"x-component-props": { "x-component-props": {
flexcol: { flexcol: {
span: 6 span: 6
...@@ -75,13 +80,16 @@ export const UserDetailSchema:ISchema = { ...@@ -75,13 +80,16 @@ export const UserDetailSchema:ISchema = {
}, },
phone: { phone: {
type: 'number', type: 'number',
required: true,
"x-mega-props": { "x-mega-props": {
wrapperCol: 24, wrapperCol: 24,
full: true full: true
}, },
"x-rules": [ "x-rules": [
{ {
required: true,
message: '请输入手机号'
},
{
pattern: PATTERN_MAPS.phone, pattern: PATTERN_MAPS.phone,
message: '请输入正确的手机号' message: '请输入正确的手机号'
} }
...@@ -127,25 +135,35 @@ export const UserDetailSchema:ISchema = { ...@@ -127,25 +135,35 @@ export const UserDetailSchema:ISchema = {
orgName: { orgName: {
type: 'string', type: 'string',
title: '所属组织机构', title: '所属组织机构',
required: true,
'x-component-props': { 'x-component-props': {
disabled: true, disabled: true,
addonAfter: "{{connectCategory}}" addonAfter: "{{connectCategory}}"
}, },
"x-rules": [
{
required: true,
message: '请关联组织机构'
}
]
}, },
orgId: { orgId: {
type: 'string', type: 'string',
visible: false visible: false
}, },
memberRoleIds: { memberRoleIds: {
required: true,
type: 'array:string', type: 'array:string',
"x-component": 'tableTagList', "x-component": 'tableTagList',
"x-component-props": { "x-component-props": {
extra: "{{addRoles}}", extra: "{{addRoles}}",
callback: "{{callback}}" callback: "{{callback}}"
}, },
title: '关联角色' title: '关联角色',
"x-rules": [
{
required: true,
message: '请选择关联角色'
}
]
}, },
} }
......
// 评论状态
export const COMMENT_STATUS_VISIBLE = 1; // 可见的
export const COMMENT_STATUS_INVISIBLE = 2; // 被屏蔽的
\ No newline at end of file
import React, { useState, useRef } from 'react'; import React, { useState, useRef } from 'react';
import { Card, Rate, Button, Space } from 'antd'; import { Card, Rate, Button, Space, Modal, message } from 'antd';
import { ClockCircleOutlined } from '@ant-design/icons'; import { ClockCircleOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { Link } from 'umi'; import { Link } from 'umi';
import { StandardTable } from 'god'; import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface'; import { ColumnType } from 'antd/lib/table/interface';
...@@ -14,14 +14,34 @@ import { isJSONStr } from '@/utils'; ...@@ -14,14 +14,34 @@ import { isJSONStr } from '@/utils';
import EyePreview from '@/components/EyePreview'; import EyePreview from '@/components/EyePreview';
import NiceForm from '@/components/NiceForm'; import NiceForm from '@/components/NiceForm';
import { listSearchSchema } from './schema'; import { listSearchSchema } from './schema';
import { COMMENT_STATUS_VISIBLE, COMMENT_STATUS_INVISIBLE } from '../constants';
import styles from './index.less'; import styles from './index.less';
const { confirm } = Modal;
const formActions = createFormActions(); const formActions = createFormActions();
const CommentManage: React.FC = () => { const CommentManage: React.FC = () => {
const ref = useRef<any>({}); const ref = useRef<any>({});
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]); const [selectedRowKeys, setSelectedRowKeys] = useState<Array<number>>([]);
const handleVisibleComment = (status, id) => {
const msg = message.loading({
content: '正在操作,请稍候...',
duration: 0,
});
PublicApi.postMemberPlatformCommentOrderTradeHistoryUpdateStatus({
id,
status,
}).then(res => {
if (res.code === 1000) {
ref.current.reload();
}
}).finally(() => {
msg();
});
};
const columns: ColumnType<any>[] = [ const columns: ColumnType<any>[] = [
{ {
...@@ -82,7 +102,7 @@ const CommentManage: React.FC = () => { ...@@ -82,7 +102,7 @@ const CommentManage: React.FC = () => {
}, },
{ {
title: '评价时间', title: '评价时间',
dataIndex: 'created', dataIndex: 'createTime',
align: 'center', align: 'center',
}, },
{ {
...@@ -91,7 +111,12 @@ const CommentManage: React.FC = () => { ...@@ -91,7 +111,12 @@ const CommentManage: React.FC = () => {
align: 'center', align: 'center',
render: (_, record) => ( render: (_, record) => (
<> <>
<Button type="link">屏蔽</Button> <Button
type="link"
onClick={() => handleVisibleComment((record.status === COMMENT_STATUS_VISIBLE || !record.status) ? COMMENT_STATUS_INVISIBLE : COMMENT_STATUS_VISIBLE, record.id)}
>
{(record.status === COMMENT_STATUS_VISIBLE || !record.status) ? '屏蔽' : '已屏蔽'}
</Button>
</> </>
), ),
}, },
...@@ -124,9 +149,39 @@ const CommentManage: React.FC = () => { ...@@ -124,9 +149,39 @@ const CommentManage: React.FC = () => {
return {}; return {};
}; };
const handleBatchDelete = () => {
if (!selectedRowKeys.length) {
message.warning('未选择任何评论');
return;
}
confirm({
title: '提示',
icon: <QuestionCircleOutlined />,
content: '确定要删除选中的评论吗?',
onOk() {
return new Promise((resolve, reject) => {
PublicApi.postMemberPlatformCommentOrderTradeHistoryDelete({
ids: selectedRowKeys,
})
.then(res => {
if (res.code === 1000) {
ref.current.reload();
setSelectedRowKeys([]);
resolve();
}
reject();
})
.catch(() => {
reject();
});
});
},
});
};
const controllerBtns = ( const controllerBtns = (
<Space> <Space>
<Button>批量删除</Button> <Button onClick={handleBatchDelete}>批量删除</Button>
</Space> </Space>
); );
......
...@@ -19,15 +19,15 @@ export interface Search { ...@@ -19,15 +19,15 @@ export interface Search {
/** /**
* 交易时间开始 * 交易时间开始
*/ */
dealTimeStart: string | null // dealTimeStart: string | null
/** /**
* 交易时间结束 * 交易时间结束
*/ */
dealTimeEnd: string | null // dealTimeEnd: string | null
/** /**
* 评价方名称 * 评价方名称
*/ */
memberName: string | null // memberName: string | null
}; };
export interface ListParams extends Search { export interface ListParams extends Search {
......
...@@ -3,6 +3,7 @@ import { Tabs, Row, Col, Button } from 'antd'; ...@@ -3,6 +3,7 @@ import { Tabs, Row, Col, Button } from 'antd';
import { history } from 'umi'; import { history } from 'umi';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { isJSONStr } from '@/utils'; import { isJSONStr } from '@/utils';
import { usePageStatus } from '@/hooks/usePageStatus';
import MellowCard from '@/components/MellowCard'; import MellowCard from '@/components/MellowCard';
import PolymericTable from '@/components/PolymericTable'; import PolymericTable from '@/components/PolymericTable';
import { EditableColumns } from '@/components/PolymericTable/interface'; import { EditableColumns } from '@/components/PolymericTable/interface';
...@@ -26,6 +27,7 @@ interface EstimateSumItems { ...@@ -26,6 +27,7 @@ interface EstimateSumItems {
}; };
const CommentDetailed: React.FC = () => { const CommentDetailed: React.FC = () => {
const { memberId, roleId } = usePageStatus();
const [evaluateSum, setEvaluateSum] = useState<EstimateSumItems[]>([]); const [evaluateSum, setEvaluateSum] = useState<EstimateSumItems[]>([]);
const [evaluatePie, setEvaluatePie] = useState<{ x: string, y: number }[]>([]); const [evaluatePie, setEvaluatePie] = useState<{ x: string, y: number }[]>([]);
...@@ -126,7 +128,10 @@ const CommentDetailed: React.FC = () => { ...@@ -126,7 +128,10 @@ const CommentDetailed: React.FC = () => {
// 获取评价汇总 // 获取评价汇总
const getTradeSummary = () => { const getTradeSummary = () => {
PublicApi.getMemberPlatformCommentCountSupplyTradeSummary().then(res => { PublicApi.getMemberPlatformCommentTradeSummary({
memberId,
roleId,
}).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
const evaluate = summaryEvaluate(res.data.rows); const evaluate = summaryEvaluate(res.data.rows);
const evaluatePieData = getSummaryEvaluatePie(evaluate); const evaluatePieData = getSummaryEvaluatePie(evaluate);
...@@ -140,9 +145,11 @@ const CommentDetailed: React.FC = () => { ...@@ -140,9 +145,11 @@ const CommentDetailed: React.FC = () => {
const getTradeHistory = (params: ListParams): Promise<RecordRes> => { const getTradeHistory = (params: ListParams): Promise<RecordRes> => {
const { star, ...rest } = params; const { star, ...rest } = params;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
PublicApi.getMemberPlatformCommentCountSupplyTradeHistoryPage({ PublicApi.getMemberPlatformCommentTradeHistoryPage({
memberId,
roleId,
...rest, ...rest,
starLevel: params.star, starLevel: params.star as string,
}).then(res => { }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
const { data, totalCount } = res.data; const { data, totalCount } = res.data;
......
...@@ -16,38 +16,13 @@ import styles from './index.less'; ...@@ -16,38 +16,13 @@ import styles from './index.less';
const formActions = createFormActions(); const formActions = createFormActions();
const mock = [
{
id: '1',
memberName: 'JUJUONTHEBEAT',
memberType: '企业会员',
memberRole: '采购商',
memberLevel: '白金会员',
satisfaction: 4,
count: 180,
day7: 10,
day180: 20,
},
{
id: '2',
memberName: 'JUJUONTHEBEAT',
memberType: '企业会员',
memberRole: '采购商',
memberLevel: '白金会员',
satisfaction: 3,
count: 180,
day7: 10,
day180: 20,
},
];
const CommentQuery = () => { const CommentQuery = () => {
const ref = useRef<any>({}); const ref = useRef<any>({});
const columns: ColumnType<any>[] = [ const columns: ColumnType<any>[] = [
{ {
title: 'ID', title: 'ID',
dataIndex: 'id', dataIndex: 'memberId',
align: 'center', align: 'center',
}, },
{ {
...@@ -64,67 +39,75 @@ const CommentQuery = () => { ...@@ -64,67 +39,75 @@ const CommentQuery = () => {
}, },
{ {
title: '会员类型', title: '会员类型',
dataIndex: 'memberType', dataIndex: 'memberTypeName',
align: 'center', align: 'center',
}, },
{ {
title: '会员角色', title: '会员角色',
dataIndex: 'memberRole', dataIndex: 'roleName',
align: 'center', align: 'center',
render: (text, record) => <>{text}</>,
}, },
{ {
title: '会员等级', title: '会员等级',
dataIndex: 'memberLevel', dataIndex: 'levelTag',
align: 'center', align: 'center',
render: (text, record) => <>{text}</>,
}, },
{ {
title: '交易满意度', title: '交易满意度',
dataIndex: 'satisfaction', dataIndex: 'avgStar',
align: 'center', align: 'center',
render: text => <Rate value={text} disabled />, render: text => <Rate value={text} disabled />,
}, },
{ {
title: '收到评价总数', title: '收到评价总数',
dataIndex: 'count', dataIndex: 'receiveCountTotal',
align: 'center', align: 'center',
}, },
{ {
title: '最近7天评价数', title: '最近7天评价数',
dataIndex: 'day7', dataIndex: 'receiveCount7',
align: 'center', align: 'center',
}, },
{ {
title: '最近180天评价数', title: '最近180天评价数',
dataIndex: 'day180', dataIndex: 'receiveCount180',
align: 'center', align: 'center',
}, },
]; ];
const fetchListData = (params: any) => { const fetchListData = (params: any) => {
// return new Promise((resolve, reject) => {
// PublicApi.getMemberPlatformCommentOrderTradeHistoryPage(params)
// .then(res => {
// if (res.code === 1000) {
// resolve(res.data);
// }
// reject();
// })
// .catch(() => {
// reject();
// });
// });
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
resolve({ PublicApi.getMemberPlatformCommentTradePage(params)
data: mock, .then(res => {
totalCount: 2, if (res.code === 1000) {
}); resolve(res.data);
}
reject();
})
.catch(() => {
reject();
});
}); });
}; };
// 初始化高级筛选选项 // 初始化高级筛选选项
const fetchSelectOptions = async () => { const fetchSearchItems = async () => {
const res = await PublicApi.getMemberManagePageitems();
if (res.code === 1000) {
const { data = {} }: any = res;
const {
memberTypes = [],
roles = [],
levels = [],
} = data;
return {
memberTypeId: memberTypes.map(item => ({ label: item.memberTypeName, value: item.memberTypeId })),
roleId: roles.map(item => ({ label: item.roleName, value: item.roleId })),
level: levels.map(item => ({ label: item.levelTag, value: item.level })),
};
}
return {}; return {};
}; };
...@@ -132,7 +115,7 @@ const CommentQuery = () => { ...@@ -132,7 +115,7 @@ const CommentQuery = () => {
<Card> <Card>
<StandardTable <StandardTable
tableProps={{ tableProps={{
rowKey: 'id', rowKey: record => `${record.memberId}+${record.roleId}`,
}} }}
columns={columns} columns={columns}
currentRef={ref} currentRef={ref}
...@@ -145,12 +128,12 @@ const CommentQuery = () => { ...@@ -145,12 +128,12 @@ const CommentQuery = () => {
useStateFilterSearchLinkageEffect( useStateFilterSearchLinkageEffect(
$, $,
actions, actions,
'name', 'memberName',
FORM_FILTER_PATH, FORM_FILTER_PATH,
); );
useAsyncInitSelect( useAsyncInitSelect(
['innerStatus', 'outerStatus'], ['memberTypeId', 'roleId', 'level'],
fetchSelectOptions, fetchSearchItems,
); );
}} }}
schema={listSearchSchema} schema={listSearchSchema}
......
...@@ -8,7 +8,7 @@ export const listSearchSchema: ISchema = { ...@@ -8,7 +8,7 @@ export const listSearchSchema: ISchema = {
type: 'object', type: 'object',
'x-component': 'mega-layout', 'x-component': 'mega-layout',
properties: { properties: {
name: { memberName: {
type: 'string', type: 'string',
'x-component': 'Search', 'x-component': 'Search',
'x-component-props': { 'x-component-props': {
...@@ -29,12 +29,13 @@ export const listSearchSchema: ISchema = { ...@@ -29,12 +29,13 @@ export const listSearchSchema: ISchema = {
memberTypeId: { memberTypeId: {
type: 'string', type: 'string',
default: undefined, default: undefined,
enum: [],
'x-component-props': { 'x-component-props': {
placeholder: '会员类型(全部)', placeholder: '会员类型(全部)',
allowClear: true, allowClear: true,
}, },
}, },
orderType: { roleId: {
type: 'string', type: 'string',
default: undefined, default: undefined,
enum: [], enum: [],
...@@ -43,7 +44,7 @@ export const listSearchSchema: ISchema = { ...@@ -43,7 +44,7 @@ export const listSearchSchema: ISchema = {
allowClear: true, allowClear: true,
}, },
}, },
outerStatus: { level: {
type: 'string', type: 'string',
default: undefined, default: undefined,
enum: [], enum: [],
...@@ -52,10 +53,31 @@ export const listSearchSchema: ISchema = { ...@@ -52,10 +53,31 @@ export const listSearchSchema: ISchema = {
allowClear: true, allowClear: true,
}, },
}, },
innerStatus: { avgStar: {
type: 'string', type: 'string',
default: undefined, default: undefined,
enum: [], enum: [
{
label: '一星',
value: 1,
},
{
label: '二星',
value: 2,
},
{
label: '三星',
value: 3,
},
{
label: '四星',
value: 4,
},
{
label: '五星',
value: 5,
},
],
'x-component-props': { 'x-component-props': {
placeholder: '交易满意度(全部)', placeholder: '交易满意度(全部)',
allowClear: true, allowClear: true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment