Commit ff6064b7 authored by XieZhiXiong's avatar XieZhiXiong

对接完评论相关已有接口

parent 28439d0a
...@@ -2,33 +2,37 @@ ...@@ -2,33 +2,37 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-09-23 09:55:40 * @Date: 2020-09-23 09:55:40
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-09-23 11:12:37 * @LastEditTime: 2020-10-21 14:58:09
* @Description: * @Description: 评价管理相关路由
*/ */
const commentRoutes = { const commentRoutes = {
path: '/comment', path: '/comment',
name: 'comment', name: 'comment',
icon: 'SmileOutlined', icon: 'SmileOutlined',
routes: [ routes: [
// 会员评价查询
{ {
path: '/comment/query', path: '/comment/query',
name: 'query', name: 'query',
component: '@/pages/comment/query/index', component: '@/pages/comment/query/index',
}, },
// 会员评价详情
{ {
path: '/comment/query/detailed', path: '/comment/query/detail',
name: 'queryDetailed', name: 'queryDetail',
component: '@/pages/comment/query/detailed/index', component: '@/pages/comment/query/detailed/index',
hideInMenu: true, hideInMenu: true,
}, },
// 评价管理
{ {
path: '/comment/manage', path: '/comment/manage',
name: 'manage', name: 'manage',
component: '@/pages/comment/manage/index', component: '@/pages/comment/manage/index',
}, },
// 评价管理-详情
{ {
path: '/comment/manage/detailed', path: '/comment/manage/detail',
name: 'manageDetailed', name: 'manageDetail',
component: '@/pages/comment/manage/detailed/index', component: '@/pages/comment/manage/detailed/index',
hideInMenu: true, hideInMenu: true,
hidePageHeader: true, hidePageHeader: true,
......
/* /*
* @Author: LeeJiancong * @Author: LeeJiancong
* @Date: 2020-08-04 15:47:40 * @Date: 2020-08-04 15:47:40
* @LastEditors: Please set LastEditors * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-10-20 18:19:02 * @LastEditTime: 2020-10-21 14:48:29
*/ */
/** /**
...@@ -19,8 +19,21 @@ import memberAbility from './memberAbility' ...@@ -19,8 +19,21 @@ import memberAbility from './memberAbility'
import ruleSettingRoutes from './ruleSettingRoutes' import ruleSettingRoutes from './ruleSettingRoutes'
import authConfig from './authConfig' import authConfig from './authConfig'
import rfqRoute from './rfqRoute' // 询价单路由 import rfqRoute from './rfqRoute' // 询价单路由
import commentRoutes from './commentRoutes';
import contentRoute from './contentRoute'; import contentRoute from './contentRoute';
const routeList = [pageCustomized, calssPropertyRoute, trademarkRoute, commodity, rfqRoute, logisticsRoutes, memberAbility, ruleSettingRoutes, authConfig, contentRoute] const routeList = [
pageCustomized,
calssPropertyRoute,
trademarkRoute,
commodity,
rfqRoute,
logisticsRoutes,
memberAbility,
ruleSettingRoutes,
authConfig,
commentRoutes,
contentRoute,
]
const router = [ const router = [
{ {
path: '/login', path: '/login',
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-08-21 11:13:55 * @Date: 2020-08-21 11:13:55
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-08-25 10:05:19 * @LastEditTime: 2020-10-21 16:39:54
* @Description: * @Description:
*/ */
import { TableProps, TablePaginationConfig, ColumnType } from 'antd/lib/table'; import { TableProps, TablePaginationConfig, ColumnType } from 'antd/lib/table';
export interface StandardTableProps extends TableProps<any> { export interface StandardTableProps extends TableProps<any> {
pagination?: TablePaginationConfig; pagination?: TablePaginationConfig | false;
onPaginationChange?: (page: number, size: number) => void; onPaginationChange?: (page: number, size: number) => void;
} }
......
...@@ -159,9 +159,9 @@ export default { ...@@ -159,9 +159,9 @@ export default {
// 评论管理 // 评论管理
'menu.comment': '评论管理', 'menu.comment': '评论管理',
'menu.comment.query': '会员评价查询', 'menu.comment.query': '会员评价查询',
'menu.comment.queryDetailed': '评价统计', 'menu.comment.queryDetail': '评价统计',
'menu.comment.manage': '评价管理', 'menu.comment.manage': '评价管理',
'menu.comment.manageDetailed': '评价管理', 'menu.comment.manageDetail': '评价管理',
// 订单管理 // 订单管理
'menu.orderSystem': '订单管理', 'menu.orderSystem': '订单管理',
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-09-23 11:02:03 * @Date: 2020-09-23 11:02:03
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-10-20 14:26:49 * @LastEditTime: 2020-10-21 15:19:00
* @Description: * @Description:
*/ */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
...@@ -16,6 +16,7 @@ import { ...@@ -16,6 +16,7 @@ import {
} from 'antd'; } from 'antd';
import { history } from 'umi'; import { history } from 'umi';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { GetOrderPlatformOrderDetailsResponse } from '@/services/OrderApi';
import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { createFormActions } from '@formily/antd'; import { createFormActions } from '@formily/antd';
import { usePageStatus } from '@/hooks/usePageStatus'; import { usePageStatus } from '@/hooks/usePageStatus';
...@@ -31,27 +32,48 @@ import styles from './evaluate.less'; ...@@ -31,27 +32,48 @@ import styles from './evaluate.less';
const formActions = createFormActions(); const formActions = createFormActions();
const CommentManageDetailed: React.FC = () => { const CommentManageDetailed: React.FC = () => {
const { id } = usePageStatus(); const { id, orderId } = usePageStatus();
const [commentInfo, seCommentInfo] = useState<Unevaluated[]>([]); const [orderInfo, setOrderInfo] = useState<GetOrderPlatformOrderDetailsResponse>();
const [infoLoading, setInfoLoading] = useState(false); const [orderInfoLoading, setOrderInfoLoading] = useState(false);
const [commentInfo, setCommentInfo] = useState<Unevaluated[]>([]);
const [commentInfoLoading, setCommentInfoLoading] = useState(false);
// 获取订单详情
const getOrderInfo = () => {
if (!orderId || orderId === 'undefined') {
return;
}
setOrderInfoLoading(true);
PublicApi.getOrderPlatformOrderDetails({
id: orderId,
}).then(res => {
if (res.code === 1000) {
setOrderInfo(res.data);
}
}).finally(() => {
setOrderInfoLoading(false);
});
};
// 获取评论详情
const getCommentInfo = () => { const getCommentInfo = () => {
if (!id) { if (!id) {
return; return;
} }
setInfoLoading(true); setCommentInfoLoading(true);
PublicApi.getMemberPlatformCommentOrderTradeHistoryGet({ PublicApi.getMemberPlatformCommentOrderTradeHistoryGet({
id, id,
}).then(res => { }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
seCommentInfo(normalizeUnevaluatedList(res.data)); setCommentInfo(normalizeUnevaluatedList([res.data]));
} }
}).finally(() => { }).finally(() => {
setInfoLoading(false); setCommentInfoLoading(false);
}); });
}; };
useEffect(() => { useEffect(() => {
getOrderInfo();
getCommentInfo(); getCommentInfo();
}, []); }, []);
...@@ -78,7 +100,7 @@ const CommentManageDetailed: React.FC = () => { ...@@ -78,7 +100,7 @@ const CommentManageDetailed: React.FC = () => {
); );
return ( return (
<Spin spinning={infoLoading}> <Spin spinning={commentInfoLoading || orderInfoLoading}>
<PageHeaderWrapper <PageHeaderWrapper
title={ title={
<> <>
...@@ -88,8 +110,8 @@ const CommentManageDetailed: React.FC = () => { ...@@ -88,8 +110,8 @@ const CommentManageDetailed: React.FC = () => {
title={ title={
<AvatarWrap <AvatarWrap
info={{ info={{
aloneTxt: '单', aloneTxt: '单',
name: '订单号:DPTY12' name: orderInfo? orderInfo.orderNo : '',
}} }}
/> />
} }
...@@ -101,8 +123,7 @@ const CommentManageDetailed: React.FC = () => { ...@@ -101,8 +123,7 @@ const CommentManageDetailed: React.FC = () => {
padding: '0 32px', padding: '0 32px',
}} }}
> >
<Descriptions.Item label="采购会员">BPTY12</Descriptions.Item> <Descriptions.Item label="下单时间" span={2}>{orderInfo?.createTime}</Descriptions.Item>
<Descriptions.Item label="下单时间" span={2}>2020-08-25 08:49</Descriptions.Item>
</Descriptions> </Descriptions>
</PageHeader> </PageHeader>
</> </>
...@@ -113,6 +134,7 @@ const CommentManageDetailed: React.FC = () => { ...@@ -113,6 +134,7 @@ const CommentManageDetailed: React.FC = () => {
initialValues={{ initialValues={{
comments: commentInfo, comments: commentInfo,
}} }}
editable={false}
expressionScope={{ expressionScope={{
UploadTip, UploadTip,
beforeUpload, beforeUpload,
......
...@@ -5,10 +5,12 @@ import { Link } from 'umi'; ...@@ -5,10 +5,12 @@ 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';
import { createFormActions } from '@formily/antd'; import { createFormActions } from '@formily/antd';
import moment from 'moment';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'; import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'; import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
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';
...@@ -28,7 +30,7 @@ const CommentManage: React.FC = () => { ...@@ -28,7 +30,7 @@ const CommentManage: React.FC = () => {
align: 'center', align: 'center',
render: (text, record) => ( render: (text, record) => (
<EyePreview <EyePreview
url={`/comment/manage/detailed`} url={`/comment/manage/detail?orderId=${record.orderId}&id=${record.id}`}
> >
{text} {text}
</EyePreview> </EyePreview>
...@@ -38,15 +40,22 @@ const CommentManage: React.FC = () => { ...@@ -38,15 +40,22 @@ const CommentManage: React.FC = () => {
title: '交易商品/交易时间', title: '交易商品/交易时间',
dataIndex: 'product', dataIndex: 'product',
align: 'center', align: 'center',
render: (text, record) => ( render: (text, record) => {
<> const product = isJSONStr(text) || {};
<div>{text}</div> return (
<div> <>
<ClockCircleOutlined /> <div>{product.productName}</div>
{record.dealTime} <div
</div> style={{
</> marginTop: 4,
), }}
>
<ClockCircleOutlined />
{` ${record.dealTime}`}
</div>
</>
)
},
}, },
{ {
title: '被评价方', title: '被评价方',
...@@ -89,8 +98,15 @@ const CommentManage: React.FC = () => { ...@@ -89,8 +98,15 @@ const CommentManage: React.FC = () => {
]; ];
const fetchListData = (params: any) => { const fetchListData = (params: any) => {
const { createTimeStart, createTimeEnd, dealTimeStart, dealTimeEnd, ...rest } = params;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
PublicApi.getMemberPlatformCommentOrderTradeHistoryPage(params) PublicApi.getMemberPlatformCommentOrderTradeHistoryPage({
...rest,
createTimeStart: createTimeStart ? moment(+createTimeStart).format('YYYY-MM-DD HH:mm:ss') : null,
createTimeEnd: createTimeEnd ? moment(+createTimeEnd).format('YYYY-MM-DD HH:mm:ss') : null,
dealTimeStart: dealTimeStart ? moment(+dealTimeStart).format('YYYY-MM-DD HH:mm:ss') : null,
dealTimeEnd: dealTimeEnd ? moment(+dealTimeEnd).format('YYYY-MM-DD HH:mm:ss') : null,
})
.then(res => { .then(res => {
if (res.code === 1000) { if (res.code === 1000) {
resolve(res.data); resolve(res.data);
...@@ -125,7 +141,7 @@ const CommentManage: React.FC = () => { ...@@ -125,7 +141,7 @@ const CommentManage: React.FC = () => {
<Card> <Card>
<StandardTable <StandardTable
tableProps={{ tableProps={{
rowKey: 'orderNo', rowKey: 'id',
}} }}
columns={columns} columns={columns}
currentRef={ref} currentRef={ref}
......
...@@ -44,25 +44,44 @@ export const listSearchSchema: ISchema = { ...@@ -44,25 +44,44 @@ export const listSearchSchema: ISchema = {
subMemberName: { subMemberName: {
type: 'string', type: 'string',
default: undefined, default: undefined,
enum: [],
'x-component-props': { 'x-component-props': {
placeholder: '被评价方(全部)', placeholder: '被评价方',
allowClear: true, allowClear: true,
}, },
}, },
memberName: { memberName: {
type: 'string', type: 'string',
default: undefined, default: undefined,
enum: [],
'x-component-props': { 'x-component-props': {
placeholder: '评价方(全部)', placeholder: '评价方',
allowClear: true, allowClear: true,
}, },
}, },
star: { star: {
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,
......
...@@ -135,28 +135,23 @@ const EvaluationList = props => { ...@@ -135,28 +135,23 @@ const EvaluationList = props => {
return ( return (
<RowStyleLayout {...componentProps} key={index}> <RowStyleLayout {...componentProps} key={index}>
<Row align="middle"> <Row align="middle">
<Col span={10}> <Col span={8}>
<div className="goodInfo"> <div className="goodInfo">
<div className="goodInfo-left"> <div className="goodInfo-left">
<img src={item.good ? item.good.pic : ''} /> <img src={item.good ? item.good.pic : ''} />
</div> </div>
<div className="goodInfo-right"> <div className="goodInfo-right">
<div className="goodInfo-title">进口头层黄牛皮荔枝纹/红色/XL</div> <div className="goodInfo-title">{item.good.productName}</div>
<div className="goodInfo-desc">20 平方英尺</div> <div className="goodInfo-desc">X {item.good.purchaseCount || ''}</div>
<div className="goodInfo-price">¥ 400.00</div> <div className="goodInfo-price">{`¥ ${item.good.price}`}</div>
</div> </div>
</div> </div>
</Col> </Col>
<Col span={10}> <Col span={16}>
<div className="main"> <div className="main">
<SchemaField path={FormPath.parse(path).concat(index)} /> <SchemaField path={FormPath.parse(path).concat(index)} />
</div> </div>
</Col> </Col>
<Col span={4}>
<div style={{ textAlign: 'right' }}>
<SmilingFace value={2} />
</div>
</Col>
</Row> </Row>
</RowStyleLayout> </RowStyleLayout>
) )
......
/* /*
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-09-22 20:34:49 * @Date: 2020-10-19 18:08:51
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-09-22 20:52:53 * @LastEditTime: 2020-10-21 13:58:50
* @Description: * @Description:
*/ */
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
...@@ -19,7 +19,28 @@ export const searchSchema: ISchema = { ...@@ -19,7 +19,28 @@ export const searchSchema: ISchema = {
properties: { properties: {
star: { star: {
type: 'string', type: 'string',
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,
...@@ -28,7 +49,7 @@ export const searchSchema: ISchema = { ...@@ -28,7 +49,7 @@ export const searchSchema: ISchema = {
}, },
}, },
}, },
'[startDate, endDate]': { '[dealTimeStart, dealTimeEnd]': {
type: 'string', type: 'string',
default: '', default: '',
'x-component': 'dateSelect', 'x-component': 'dateSelect',
...@@ -40,7 +61,7 @@ export const searchSchema: ISchema = { ...@@ -40,7 +61,7 @@ export const searchSchema: ISchema = {
}, },
}, },
}, },
name: { memberName: {
type: 'string', type: 'string',
'x-component': 'Search', 'x-component': 'Search',
'x-component-props': { 'x-component-props': {
......
import React from 'react'; import React, { useState, useEffect } from 'react';
import { Tabs, Row, Col, Button } from 'antd'; import { Tabs, Row, Col, Button } from 'antd';
import { createFormActions } from '@formily/antd'; import { history } from 'umi';
import { PublicApi } from '@/services/api';
import { isJSONStr } from '@/utils';
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';
import { Pie } from '@/components/Charts'; import { Pie } from '@/components/Charts';
import Mood from '@/components/Mood'; import Mood from '@/components/Mood';
import NiceForm from '@/components/NiceForm';
import { searchSchema } from './schema';
import Shelves from './components/Shelves'; import Shelves from './components/Shelves';
import RecordList from './components/RecordList'; import RecordList, { ListParams, RecordRes } from './components/RecordList';
import styles from './index.less'; import styles from './index.less';
const { TabPane } = Tabs; const { TabPane } = Tabs;
const receivedFormActions = createFormActions(); interface EstimateSumItems {
id?: number,
title?: JSX.Element,
star?: number,
last7days?: number,
last30days?: number,
last180days?: number,
before180days?: number,
sum?: number,
};
const CommentDetailed: React.FC = () => { const CommentDetailed: React.FC = () => {
const [evaluateSum, setEvaluateSum] = useState<EstimateSumItems[]>([]);
const [evaluatePie, setEvaluatePie] = useState<{ x: string, y: number }[]>([]);
const summaryEvaluate = (items: EstimateSumItems[]): EstimateSumItems[] => {
// 顺序写死的 1:表示好评,2:表示中评,3:表示差评
// 根据 1、2星级为差评,3星级为中评,4、5星级为好评往里边塞数据
const source = items || [];
const ret = [
{
id: 1,
title: (<Mood type="smile" />),
},
{
id: 2,
title: (<Mood type="notBad" />),
},
{
id: 3,
title: (<Mood type="sad" />),
},
];
for (let i = 0; i < source.length; i++) {
const item = source[i];
const { star, ...rest } = item;
let target = {};
switch (item.star) {
case 1:
case 2: {
target = ret[0];
break;
}
case 3: {
target = ret[1];
break;
}
case 4:
case 5: {
target = ret[2];
break;
}
default:
break;
}
if (!target) {
continue;
}
// 大于 2 表示已经添加过一次数据,之后就累加上去,否则直接赋值
if (Object.keys(target).length <= 2) {
target = Object.assign(target, rest);
} else {
for (const key in target) {
if (!Object.prototype.hasOwnProperty.call(target, key)) {
continue;
}
// 排除 id、title 固定的 key
if (key !== 'id' && key !== 'title') {
target[key] += item[key];
}
}
}
}
return ret;
};
// 取得评价统计 Pie 饼图数据
const getSummaryEvaluatePie = (data: EstimateSumItems[]) => {
const source = data || [];
const count = source.reduce((pre, now: any) => now.sum + pre, 0);
const good = source[0] && source[0].sum ? source[0].sum : 0;
const notBad = source[1] && source[1].sum ? source[1].sum : 0;
const bad = source[2] && source[2].sum ? source[2].sum : 0;
const ret = [
{
x: `好评 ${count > 0 ? (good / count * 100).toFixed(2) : '0'}%`,
y: good,
},
{
x: `中评 ${count > 0 ? (notBad / count * 100).toFixed(2) : 0}%`,
y: notBad,
},
{
x: `差评 ${count > 0 ? (bad / count * 100).toFixed(2) : 0}%`,
y: bad,
},
];
return ret;
};
// 获取评价汇总
const getTradeSummary = () => {
PublicApi.getMemberPlatformCommentCountSupplyTradeSummary().then(res => {
if (res.code === 1000) {
const evaluate = summaryEvaluate(res.data.rows);
const evaluatePieData = getSummaryEvaluatePie(evaluate);
setEvaluateSum(evaluate);
setEvaluatePie(evaluatePieData);
}
});
};
// 获取评价记录
const getTradeHistory = (params: ListParams): Promise<RecordRes> => {
const { star, ...rest } = params;
return new Promise((resolve, reject) => {
PublicApi.getMemberPlatformCommentCountSupplyTradeHistoryPage({
...rest,
starLevel: params.star,
}).then(res => {
if (res.code === 1000) {
const { data, totalCount } = res.data;
resolve({
data: data.map(item => {
const product = isJSONStr(item.product) || {};
return {
id: item.id,
star: item.star,
comment: item.comment,
productName: product.productName || '',
price: product.price,
quantity: product.purchaseCount,
created: item.createTime,
target: item.byMemberName,
orderId: product.orderId,
};
}),
totalCount,
});
}
reject(res.data);
}).catch(err => {
reject(err);
});
});
};
const evaluateColumns: EditableColumns[] = [ const evaluateColumns: EditableColumns[] = [
{ {
title: ' ', title: ' ',
...@@ -45,47 +199,9 @@ const CommentDetailed: React.FC = () => { ...@@ -45,47 +199,9 @@ const CommentDetailed: React.FC = () => {
}, },
]; ];
const evaluatePie = [ useEffect(() => {
{ getTradeSummary();
x: `好评 30%`, }, []);
y: 100,
},
{
x: `中评 20%`,
y: 50,
},
{
x: `差评 10%`,
y: 10,
},
];
const evaluate = [
{
id: 1,
title: (<Mood type="smile" />),
last7days: 10,
last30days: 20,
last180days: 30,
before180days: 30,
},
{
id: 2,
title: (<Mood type="notBad" />),
last7days: 10,
last30days: 20,
last180days: 30,
before180days: 30,
},
{
id: 3,
title: (<Mood type="sad" />),
last7days: 10,
last30days: 20,
last180days: 30,
before180days: 30,
},
];
return ( return (
<MellowCard <MellowCard
...@@ -113,10 +229,10 @@ const CommentDetailed: React.FC = () => { ...@@ -113,10 +229,10 @@ const CommentDetailed: React.FC = () => {
<Col flex="auto"> <Col flex="auto">
<PolymericTable <PolymericTable
dataSource={evaluate} dataSource={evaluateSum}
columns={evaluateColumns} columns={evaluateColumns}
loading={false} loading={false}
pagination={null} pagination={false}
rowClassName={() => styles['record-row']} rowClassName={() => styles['record-row']}
/> />
</Col> </Col>
...@@ -124,30 +240,13 @@ const CommentDetailed: React.FC = () => { ...@@ -124,30 +240,13 @@ const CommentDetailed: React.FC = () => {
</Shelves> </Shelves>
<Shelves title="评价记录"> <Shelves title="评价记录">
<RecordList list={[]} /> <RecordList
fetchList={getTradeHistory}
<div paginationType="button"
style={{ searchable={false}
padding: '24px 0', />
textAlign: 'center',
}}
>
<Button>查看更多评论</Button>
</div>
</Shelves> </Shelves>
</TabPane> </TabPane>
<TabPane tab="收到的评价" key="2">
<NiceForm
actions={receivedFormActions}
onSubmit={values => {}}
effects={($, actions) => {
}}
schema={searchSchema}
/>
<RecordList list={[]} />
</TabPane>
</Tabs> </Tabs>
</MellowCard> </MellowCard>
); );
......
...@@ -7,6 +7,7 @@ import { createFormActions } from '@formily/antd'; ...@@ -7,6 +7,7 @@ import { createFormActions } from '@formily/antd';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'; import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'; import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { PublicApi } from '@/services/api';
import { Link } from 'umi'; import { Link } from 'umi';
import EyePreview from '@/components/EyePreview'; import EyePreview from '@/components/EyePreview';
import NiceForm from '@/components/NiceForm'; import NiceForm from '@/components/NiceForm';
...@@ -55,7 +56,7 @@ const CommentQuery = () => { ...@@ -55,7 +56,7 @@ const CommentQuery = () => {
align: 'center', align: 'center',
render: (text, record) => ( render: (text, record) => (
<EyePreview <EyePreview
url={`/comment/query/detailed`} url={`/comment/query/detail`}
> >
{text} {text}
</EyePreview> </EyePreview>
...@@ -102,9 +103,23 @@ const CommentQuery = () => { ...@@ -102,9 +103,23 @@ const CommentQuery = () => {
]; ];
const fetchListData = (params: any) => { const fetchListData = (params: any) => {
return Promise.resolve({ // return new Promise((resolve, reject) => {
total: 2, // PublicApi.getMemberPlatformCommentOrderTradeHistoryPage(params)
data: mock, // .then(res => {
// if (res.code === 1000) {
// resolve(res.data);
// }
// reject();
// })
// .catch(() => {
// reject();
// });
// });
return new Promise((resolve, reject) => {
resolve({
data: mock,
totalCount: 2,
});
}); });
}; };
......
...@@ -75,62 +75,4 @@ export const listSearchSchema: ISchema = { ...@@ -75,62 +75,4 @@ export const listSearchSchema: ISchema = {
}, },
}, },
}, },
};
export const evaluateSchema: ISchema = {
type: 'object',
properties: {
comments: {
type: 'array',
'x-component': 'EvaluationList',
default: [
{
name: '杰尼',
age: 24,
small: 1,
},
],
items: {
type: 'object',
properties: {
MEGA_LADYOUT: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
labelCol: 6,
labelAlign: 'left',
},
properties: {
star: {
title: '满意程度',
required: true,
'x-component': 'Rating',
'x-component-props': {
allowHalf: false,
},
},
comment: {
type: 'string',
title: '评价',
required: true,
'x-component': 'TextArea',
'x-component-props': {
rows: 4,
},
},
picture: {
type: 'string',
title: '图片',
required: true,
'x-component': 'CustomUpload',
'x-component-props': {
},
},
},
},
},
},
},
},
}; };
\ No newline at end of file
...@@ -304,6 +304,38 @@ export function normalizeFiledata(url: any): any { ...@@ -304,6 +304,38 @@ export function normalizeFiledata(url: any): any {
}; };
}; };
/**
* 检查是否还有更多
* @param {Number} curPage 当前页码
* @param {Number} curSize 当前页数
* @param {Number} dataLen 当前数据长度
* @param {Number} dataTotal 数据总长度
*/
export const checkMore = (curPage: number, curSize: number, dataLen: number, dataTotal: number) => {
let hasMore = true;
if (!dataLen || dataLen + (curPage - 1) * curSize >= +dataTotal) {
hasMore = false;
}
return hasMore;
};
/**
*
* @param {string} str 需要判断是否是 JSON字符串的 字符串
*/
export const isJSONStr = str => {
if (typeof str === 'string') {
try {
const complete = JSON.parse(str);
return complete;
} catch(e) {
return null;
}
}
return str;
}
export default { export default {
isArray, isArray,
isObject, isObject,
......
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