Commit 3605e4d7 authored by XieZhiXiong's avatar XieZhiXiong

调整评价相关路由

parent 250e77e0
......@@ -231,6 +231,13 @@ const TranactionRoute = {
component: '@/pages/transaction/supplierEvaluation/unevaluated/evaluate/index',
hideInMenu: true,
},
// 待评价订单-订单详情
{
path: '/memberCenter/tranactionAbility/supplierEvaluation/unevaluated/order',
name: 'orderPreview',
hideInMenu: true,
component: '@/pages/transaction/saleOrder/orderPreview',
},
// 评价统计
{
path: '/memberCenter/tranactionAbility/supplierEvaluation/analysis',
......@@ -248,14 +255,14 @@ const TranactionRoute = {
{
path: '/memberCenter/tranactionAbility/supplierEvaluation/sent/detail',
name: 'sentDetail',
component: '@/pages/transaction/supplierEvaluation/sent/detail/index',
component: '@/pages/transaction/supplierEvaluation/sent/detail',
hideInMenu: true,
},
// 发出的评价-编辑
{
path: '/memberCenter/tranactionAbility/supplierEvaluation/sent/edit',
name: 'editSent',
component: '@/pages/transaction/supplierEvaluation/sent/detail/index',
component: '@/pages/transaction/supplierEvaluation/sent/edit',
hideInMenu: true,
},
// 收到的评价(UI合并到评价统计了,暂时不需要)
......@@ -284,13 +291,20 @@ const TranactionRoute = {
name: 'unevaluated',
component: '@/pages/transaction/purchaserEvaluation/unevaluated',
},
// 评价
// 评价订单
{
path: '/memberCenter/tranactionAbility/purchaserEvaluation/unevaluated/evaluate',
name: 'evaluate',
component: '@/pages/transaction/purchaserEvaluation/unevaluated/evaluate/index',
hideInMenu: true,
},
// 待评价订单-订单详情
{
path: '/memberCenter/tranactionAbility/purchaserEvaluation/unevaluated/order',
name: 'orderPreview',
hideInMenu: true,
component: '@/pages/transaction/saleOrder/orderPreview',
},
// 评价统计
{
path: '/memberCenter/tranactionAbility/purchaserEvaluation/analysis',
......@@ -308,14 +322,14 @@ const TranactionRoute = {
{
path: '/memberCenter/tranactionAbility/purchaserEvaluation/sent/detail',
name: 'sentDetail',
component: '@/pages/transaction/purchaserEvaluation/sent/detail/index',
component: '@/pages/transaction/purchaserEvaluation/sent/detail',
hideInMenu: true,
},
// 发出的评价-编辑
{
path: '/memberCenter/tranactionAbility/purchaserEvaluation/sent/edit',
name: 'editSent',
component: '@/pages/transaction/purchaserEvaluation/sent/detail/index',
component: '@/pages/transaction/purchaserEvaluation/sent/edit',
hideInMenu: true,
},
// 收到的评价(UI合并到评价统计了,暂时不需要)
......
......@@ -5,7 +5,7 @@
* @LastEditors: XieZhiXiong
<<<<<<< HEAD
<<<<<<< HEAD
* @LastEditTime: 2020-10-28 20:14:50
* @LastEditTime: 2020-10-29 11:32:24
=======
* @LastEditors: Please set LastEditors
<<<<<<< HEAD
......@@ -341,22 +341,26 @@ export default {
'menu.tranactionAbility.supplierEvaluation.unevaluated': '待评价订单',
'menu.tranactionAbility.supplierEvaluation.evaluate': '评价',
'menu.tranactionAbility.supplierEvaluation.analysis': '评价统计',
'menu.tranactionAbility.supplierEvaluation.received': '收到的评价',
'menu.tranactionAbility.supplierEvaluation.analysis.main': '评价统计详情',
'menu.tranactionAbility.supplierEvaluation.analysis.received': '收到的评价',
'menu.tranactionAbility.supplierEvaluation.receivedDetail': '查看收到的评价',
'menu.tranactionAbility.supplierEvaluation.analysis.sent': '发出的评价',
'menu.tranactionAbility.supplierEvaluation.sentDetail': '查看发出的评价',
'menu.tranactionAbility.supplierEvaluation.editSent': '编辑发出的评价',
'menu.tranactionAbility.supplierEvaluation.sent': '发出的评价',
'menu.tranactionAbility.supplierEvaluation.orderPreview': '查看订单',
// 采购商评价
'menu.tranactionAbility.purchaserEvaluation': '采购会员评价管理',
'menu.tranactionAbility.purchaserEvaluation.unevaluated': '待评价订单',
'menu.tranactionAbility.purchaserEvaluation.evaluate': '评价',
'menu.tranactionAbility.purchaserEvaluation.analysis': '评价统计',
'menu.tranactionAbility.purchaserEvaluation.received': '收到的评价',
'menu.tranactionAbility.purchaserEvaluation.analysis.main': '评价统计详情',
'menu.tranactionAbility.purchaserEvaluation.analysis.received': '收到的评价',
'menu.tranactionAbility.purchaserEvaluation.receivedDetail': '查看收到的评价',
'menu.tranactionAbility.purchaserEvaluation.analysis.sent': '发出的评价',
'menu.tranactionAbility.purchaserEvaluation.sentDetail': '查看发出的评价',
'menu.tranactionAbility.purchaserEvaluation.editSent': '编辑发出的评价',
'menu.tranactionAbility.purchaserEvaluation.sent': '发出的评价',
'menu.tranactionAbility.purchaserEvaluation.orderPreview': '查看订单',
// 物流能力
'menu.logisticsAbility': '物流',
......
export interface IEvaluationModule {
// 供应会员评价管理
supplier: {
activeKey: string,
};
// 采购会员评价管理
purchaser: {
activeKey: string,
};
setSupplierActiveKey(key: string): void;
setPurchaserActiveKey(key: string): void;
}
\ No newline at end of file
import React, { useEffect, useState } from 'react';
import { Tabs, Row, Col, Button } from 'antd';
import { history } from 'umi';
import { observer, inject } from 'mobx-react';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { PublicApi } from '@/services/api';
import { isJSONStr } from '@/utils';
import { IEvaluationModule } from '@/module/evaluationModule';
import MellowCard from '@/components/MellowCard';
import PolymericTable from '@/components/PolymericTable';
import { EditableColumns } from '@/components/PolymericTable/interface';
......@@ -45,10 +47,18 @@ interface EstimateSumItems {
sum?: number,
};
const Analysis: React.FC = () => {
interface AnalysisProps {
EvaluationStore?: IEvaluationModule;
};
const Analysis: React.FC<AnalysisProps> = ({
EvaluationStore,
}) => {
const [evaluateSum, setEvaluateSum] = useState([]);
const [evaluatePie, setEvaluatePie] = useState([]);
const { purchaser, setPurchaserActiveKey } = EvaluationStore;
const summaryEvaluate = (items: EstimateSumItems[]): EstimateSumItems[] => {
// 顺序写死的 1:表示好评,2:表示中评,3:表示差评
// 根据 1、2星级为差评,3星级为中评,4、5星级为好评往里边塞数据
......@@ -292,15 +302,15 @@ const Analysis: React.FC = () => {
}, []);
const handleJumpReceived = record => {
history.push(`/memberCenter/tranactionAbility/purchaserEvaluation/received/detail?orderId=${record.orderId}&id=${record.id}&preview=1`);
history.push(`/memberCenter/tranactionAbility/purchaserEvaluation/received/detail?orderId=${record.orderId}&id=${record.id}`);
};
const handleEditSent = record => {
history.push(`/memberCenter/tranactionAbility/purchaserEvaluation/sent/edit?orderId=${record.orderId}&id=${record.id}&preview=0`);
history.push(`/memberCenter/tranactionAbility/purchaserEvaluation/sent/edit?orderId=${record.orderId}&id=${record.id}`);
};
const handleJumpSent = record => {
history.push(`/memberCenter/tranactionAbility/purchaserEvaluation/sent/detail?orderId=${record.orderId}&id=${record.id}&preview=1`);
history.push(`/memberCenter/tranactionAbility/purchaserEvaluation/sent/detail?orderId=${record.orderId}&id=${record.id}`);
};
return (
......@@ -312,6 +322,8 @@ const Analysis: React.FC = () => {
>
<Tabs
className={styles.tabs}
activeKey={purchaser.activeKey}
onChange={setPurchaserActiveKey}
>
<TabPane tab="概览" key="1">
<Shelves title="评价统计">
......@@ -374,4 +386,4 @@ const Analysis: React.FC = () => {
);
};
export default Analysis;
\ No newline at end of file
export default inject('EvaluationStore')(observer(Analysis));
\ No newline at end of file
......@@ -14,13 +14,13 @@ import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd';
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus';
import { PublicApi } from '@/services/api';
import { GetOrderPurchaseOrderDetailsResponse } from '@/services/OrderApi';
import { normalizeFiledata, isJSONStr } from '@/utils';
import { normalizeFiledata, FileData, isJSONStr } from '@/utils';
import AvatarWrap from '@/components/AvatarWrap';
import NiceForm from '@/components/NiceForm';
import { normalizeUnevaluatedList } from '../../utils';
import { normalizeUnevaluatedList } from '../../../utils';
import { evaluateSchema } from './schema';
import { createEffects } from './effects';
import EvaluationList from '../../components/EvaluationList';
import EvaluationList from '../../../components/EvaluationList';
import styles from './index.less';
const formActions = createFormActions();
......@@ -37,12 +37,23 @@ interface Unevaluated {
};
star: number;
comment: string;
picture: string[];
picture: FileData[];
smile: number;
};
const SentDetail: React.FC = () => {
const { orderId, id, pageStatus } = usePageStatus();
interface DetailInfoProps {
orderId: string;
// 评论id
id: string;
// 是否可编辑的
isEdit?: boolean;
};
const DetailInfo: React.FC<DetailInfoProps> = ({
orderId,
id,
isEdit = false,
}) => {
const [orderInfo, setOrderInfo] = useState<GetOrderPurchaseOrderDetailsResponse>(null);
const [orderInfoLoading, setOrderInfoLoading] = useState(false);
const [evaluationInfo, setEvaluationInfo] = useState<Unevaluated>(null);
......@@ -175,7 +186,7 @@ const SentDetail: React.FC = () => {
extra={(
<>
{
pageStatus === PageStatus.EDIT && (
isEdit && (
<Button
type="primary"
icon={<FormOutlined />}
......@@ -209,9 +220,9 @@ const SentDetail: React.FC = () => {
initialValues={{
comments: [evaluationInfo],
}}
editable={pageStatus === PageStatus.EDIT}
editable={isEdit}
expressionScope={{
UploadTip: pageStatus === PageStatus.EDIT ? UploadTip : null,
UploadTip: isEdit ? UploadTip : null,
beforeUpload,
}}
onSubmit={handleSubmit}
......@@ -222,7 +233,7 @@ const SentDetail: React.FC = () => {
createEffects($, actions);
onFormInit$().subscribe(() => {
if (pageStatus === PageStatus.EDIT) {
if (isEdit) {
actions.setFieldState(
'comments.*.picture',
state => {
......@@ -239,4 +250,4 @@ const SentDetail: React.FC = () => {
);
};
export default SentDetail;
\ No newline at end of file
export default DetailInfo;
\ No newline at end of file
import React from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import DetailInfo from './components/DetailInfo';
const SentDetail: React.FC = () => {
const { orderId, id } = usePageStatus();
return (
<DetailInfo
orderId={orderId}
id={id}
/>
);
};
export default SentDetail;
\ No newline at end of file
import React from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import DetailInfo from './components/DetailInfo';
const SentEdit: React.FC = () => {
const { orderId, id } = usePageStatus();
return (
<DetailInfo
orderId={orderId}
id={id}
isEdit
/>
);
};
export default SentEdit;
\ No newline at end of file
......@@ -29,7 +29,7 @@ const Unevaluated: React.FC = () => {
align: 'center',
render: (text, record) => (
<EyePreview
url={``}
url={`/memberCenter/tranactionAbility/purchaserEvaluation/unevaluated/order?id=${record.id}`}
>
{text}
</EyePreview>
......
import React, { useEffect, useState } from 'react';
import { Tabs, Row, Col, Button } from 'antd';
import { history } from 'umi';
import { observer, inject } from 'mobx-react';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { PublicApi } from '@/services/api';
import { isJSONStr } from '@/utils';
import { IEvaluationModule } from '@/module/evaluationModule';
import MellowCard from '@/components/MellowCard';
import PolymericTable from '@/components/PolymericTable';
import { EditableColumns } from '@/components/PolymericTable/interface';
......@@ -45,10 +47,18 @@ interface EstimateSumItems {
sum?: number,
};
const Analysis: React.FC = () => {
interface AnalysisProps {
EvaluationStore?: IEvaluationModule;
};
const Analysis: React.FC<AnalysisProps> = ({
EvaluationStore,
}) => {
const [evaluateSum, setEvaluateSum] = useState([]);
const [evaluatePie, setEvaluatePie] = useState([]);
const { supplier, setSupplierActiveKey } = EvaluationStore;
const summaryEvaluate = (items: EstimateSumItems[]): EstimateSumItems[] => {
// 顺序写死的 1:表示好评,2:表示中评,3:表示差评
// 根据 1、2星级为差评,3星级为中评,4、5星级为好评往里边塞数据
......@@ -292,15 +302,15 @@ const Analysis: React.FC = () => {
}, []);
const handleJumpReceived = record => {
history.push(`/memberCenter/tranactionAbility/supplierEvaluation/received/detail?orderId=${record.orderId}&id=${record.id}&preview=1`);
history.push(`/memberCenter/tranactionAbility/supplierEvaluation/received/detail?orderId=${record.orderId}&id=${record.id}`);
};
const handleEditSent = record => {
history.push(`/memberCenter/tranactionAbility/supplierEvaluation/sent/edit?orderId=${record.orderId}&id=${record.id}&preview=0`);
history.push(`/memberCenter/tranactionAbility/supplierEvaluation/sent/edit?orderId=${record.orderId}&id=${record.id}`);
};
const handleJumpSent = record => {
history.push(`/memberCenter/tranactionAbility/supplierEvaluation/sent/detail?orderId=${record.orderId}&id=${record.id}&preview=1`);
history.push(`/memberCenter/tranactionAbility/supplierEvaluation/sent/detail?orderId=${record.orderId}&id=${record.id}`);
};
return (
......@@ -312,6 +322,8 @@ const Analysis: React.FC = () => {
>
<Tabs
className={styles.tabs}
activeKey={supplier.activeKey}
onChange={setSupplierActiveKey}
>
<TabPane tab="概览" key="1">
<Shelves title="评价统计">
......@@ -374,4 +386,4 @@ const Analysis: React.FC = () => {
);
};
export default Analysis;
\ No newline at end of file
export default inject('EvaluationStore')(observer(Analysis));
\ No newline at end of file
......@@ -11,16 +11,15 @@ import { FormOutlined } from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { history } from 'umi';
import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd';
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus';
import { PublicApi } from '@/services/api';
import { GetOrderPurchaseOrderDetailsResponse } from '@/services/OrderApi';
import { normalizeFiledata, isJSONStr } from '@/utils';
import { normalizeFiledata, FileData, isJSONStr } from '@/utils';
import AvatarWrap from '@/components/AvatarWrap';
import NiceForm from '@/components/NiceForm';
import { normalizeUnevaluatedList } from '../../utils';
import { normalizeUnevaluatedList } from '../../../utils';
import { evaluateSchema } from './schema';
import { createEffects } from './effects';
import EvaluationList from '../../components/EvaluationList';
import EvaluationList from '../../../components/EvaluationList';
import styles from './index.less';
const formActions = createFormActions();
......@@ -37,12 +36,23 @@ interface Unevaluated {
};
star: number;
comment: string;
picture: string[];
picture: FileData[];
smile: number;
};
const SentDetail: React.FC = () => {
const { orderId, id, pageStatus } = usePageStatus();
interface DetailInfoProps {
orderId: string;
// 评论id
id: string;
// 是否可编辑的
isEdit?: boolean;
};
const DetailInfo: React.FC<DetailInfoProps> = ({
orderId,
id,
isEdit = false,
}) => {
const [orderInfo, setOrderInfo] = useState<GetOrderPurchaseOrderDetailsResponse>(null);
const [orderInfoLoading, setOrderInfoLoading] = useState(false);
const [evaluationInfo, setEvaluationInfo] = useState<Unevaluated>(null);
......@@ -175,7 +185,7 @@ const SentDetail: React.FC = () => {
extra={(
<>
{
pageStatus === PageStatus.EDIT && (
isEdit && (
<Button
type="primary"
icon={<FormOutlined />}
......@@ -209,9 +219,9 @@ const SentDetail: React.FC = () => {
initialValues={{
comments: [evaluationInfo],
}}
editable={pageStatus === PageStatus.EDIT}
editable={isEdit}
expressionScope={{
UploadTip: pageStatus === PageStatus.EDIT ? UploadTip : null,
UploadTip: isEdit ? UploadTip : null,
beforeUpload,
}}
onSubmit={handleSubmit}
......@@ -222,7 +232,7 @@ const SentDetail: React.FC = () => {
createEffects($, actions);
onFormInit$().subscribe(() => {
if (pageStatus === PageStatus.EDIT) {
if (isEdit) {
actions.setFieldState(
'comments.*.picture',
state => {
......@@ -239,4 +249,4 @@ const SentDetail: React.FC = () => {
);
};
export default SentDetail;
\ No newline at end of file
export default DetailInfo;
\ No newline at end of file
import React from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import DetailInfo from './components/DetailInfo';
const SentDetail: React.FC = () => {
const { orderId, id } = usePageStatus();
return (
<DetailInfo
orderId={orderId}
id={id}
/>
);
};
export default SentDetail;
\ No newline at end of file
import React from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import DetailInfo from './components/DetailInfo';
const SentEdit: React.FC = () => {
const { orderId, id } = usePageStatus();
return (
<DetailInfo
orderId={orderId}
id={id}
isEdit
/>
);
};
export default SentEdit;
\ No newline at end of file
......@@ -29,7 +29,7 @@ const Unevaluated: React.FC = () => {
align: 'center',
render: (text, record) => (
<EyePreview
url={``}
url={`/memberCenter/tranactionAbility/supplierEvaluation/unevaluated/order?id=${record.id}`}
>
{text}
</EyePreview>
......
/*
* @Author: XieZhiXiong
* @Date: 2020-10-29 14:08:28
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-10-29 14:19:19
* @Description:
*/
import { action, observable} from 'mobx'
import { IEvaluationModule } from '@/module/evaluationModule';
/**
* 供应会员评价、采购会员评价管理会员管理
*/
class EvaluationStore implements IEvaluationModule {
@observable public supplier = {
activeKey: '1',
};
@observable public purchaser = {
activeKey: '1',
};
@action.bound
public setSupplierActiveKey(key: string) {
this.supplier.activeKey = key;
}
@action.bound
public setPurchaserActiveKey(key: string) {
this.purchaser.activeKey = key;
}
}
export default EvaluationStore;
......@@ -9,10 +9,12 @@ import SiteStore from './site'
import CategoryStore from './category'
import FilterStore from './filter'
import MemberStore from './member'
import EvaluationStore from './evaluation';
import { ILoginModule } from '@/module/userModule';
import { IProductModule } from '@/module/productModule'
import { IChannelProductModule } from '@/module/channelProductModule'
import { IMemberModule } from '@/module/memberModule';
import { IEvaluationModule } from '@/module/evaluationModule';
// import { ProductContext } from '@/pages/commodity/products/addProducts';
......@@ -37,6 +39,7 @@ export interface IStore {
ProductStore: IProductModule;
ChannelProudctStore: IChannelProductModule;
MemberModuleStore: IMemberModule;
EvaluationModule: IEvaluationModule;
}
export const store = {
......@@ -48,7 +51,8 @@ export const store = {
CategoryStore: new CategoryStore,
FilterStore: new FilterStore,
MemberStore: new MemberStore,
OrderStore: new OrderStore
OrderStore: new OrderStore,
EvaluationStore: new EvaluationStore,
}
const MobxProvider: React.FC = (props) => {
......
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