diff --git a/src/pages/order/cost-of-sales/index.jsx b/src/pages/order/cost-of-sales/index.jsx
index dbb0d50..332b3ef 100644
--- a/src/pages/order/cost-of-sales/index.jsx
+++ b/src/pages/order/cost-of-sales/index.jsx
@@ -1,44 +1,11 @@
import React, { useState, useEffect } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
-import { Button, Card, DatePicker, Table, Pagination, Spin, Select, message, Col, Row } from 'antd';
+import { Button, Card, DatePicker, Table, Pagination, Spin, Select, message, Col, Row, TreeSelect } from 'antd';
import styles from './index.less';
const { RangePicker } = DatePicker;
import costSalesAPI from "./service";
import moment from 'moment';
-const columns = [
- {
- title: '门店名称',
- dataIndex: 'storeId',
- key: 'storeId',
- },
- {
- title: '商品名称',
- dataIndex: 'goodsId',
- key: 'goodsId',
- },
- {
- title: '销售收入',
- dataIndex: 'salesPrice',
- key: 'salesPrice',
- },
- {
- title: '销售成本',
- dataIndex: 'costPrice',
- key: 'costPrice',
- },
- {
- title: '销售数量',
- dataIndex: 'salesNum',
- key: 'salesNum',
- },
- {
- title: '成本率',
- dataIndex: 'costRate',
- key: 'costRate',
- }
-];
-
const LoadingCard = () => {
return (
@@ -64,7 +31,7 @@ export default function Index() {
moment(moment(new Date(Date.now())).format('YYYY-MM-DD 23:59:59')),
]); //日期选择器
//门店
- const [storeIdArray, setStoreIdArray] = useState([]);
+ const [storeIdArray, setStoreIdArray] = useState("");
const [storeSelect, setStoreSelect] = useState([]);
//商品
const [goodsIdArray, setGoodsIdArray] = useState([]);
@@ -79,10 +46,52 @@ export default function Index() {
setPageSize(pageSize);
}
+ const columns = [
+ {
+ title: '门店名称',
+ dataIndex: 'storeId',
+ key: 'storeId',
+ },
+ {
+ title: '商品名称',
+ dataIndex: 'goodsId',
+ key: 'goodsId',
+ render: (text) => {
+ const findGoods = goodsIdSelect.find(item => item.id === text);
+ if (findGoods) {
+ return
{findGoods.name}
+ } else {
+ return
暂无商品名称
+ }
+
+ },
+ },
+ {
+ title: '销售收入',
+ dataIndex: 'salesPrice',
+ key: 'salesPrice',
+ },
+ {
+ title: '销售成本',
+ dataIndex: 'costPrice',
+ key: 'costPrice',
+ },
+ {
+ title: '销售数量',
+ dataIndex: 'salesNum',
+ key: 'salesNum',
+ },
+ {
+ title: '成本率(%)',
+ dataIndex: 'costRate',
+ key: 'costRate',
+ }
+ ];
+
//查询
const onQueryReportSalescost = async () => {
const jsonData = {
- "storeId": storeIdArray[0],
+ "storeId": storeIdArray,
"goodsId": goodsIdArray[0],
"goodsTypeId": goodsTypeArray[0],
"begintime": timeRange[0],
@@ -108,13 +117,7 @@ export default function Index() {
const response = await costSalesAPI.gettree({});
setShowLoading(false);
if (response.statusCode === 200) {
- const storeList = [];
- response.data.forEach(item => {
- if (item.type === 2 || item.type === 3) {
- storeList.push(item)
- }
- })
- setStoreSelect(storeList);
+ setStoreSelect(response.data);
} else {
message.error('查询店铺列表失败');
}
@@ -171,25 +174,18 @@ export default function Index() {
门店
-
+ />
diff --git a/src/pages/order/gross-profit-store-sales/index.jsx b/src/pages/order/gross-profit-store-sales/index.jsx
index fb4e013..2797e12 100644
--- a/src/pages/order/gross-profit-store-sales/index.jsx
+++ b/src/pages/order/gross-profit-store-sales/index.jsx
@@ -1,23 +1,12 @@
import React, { useState, useEffect } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
-import { Button, Card, DatePicker, Table, Pagination, Spin, Select, message, Col, Row } from 'antd';
+import { Button, Card, DatePicker, Table, Pagination, Spin, TreeSelect, message, Col, Row } from 'antd';
import styles from './index.less';
const { RangePicker } = DatePicker;
import costSalesAPI from "./service";
import moment from 'moment';
-const columns = [
- {
- title: '门店名称',
- dataIndex: 'storeId',
- key: 'storeId',
- },
- {
- title: '毛利率',
- dataIndex: 'marginRatio',
- key: 'marginRatio',
- }
-];
+
const LoadingCard = () => {
return (
@@ -47,6 +36,28 @@ export default function Index() {
const [storeIdArray, setStoreIdArray] = useState([]);
const [storeSelect, setStoreSelect] = useState([]);
+ const columns = [
+ {
+ title: '门店名称',
+ dataIndex: 'storeId',
+ key: 'storeId',
+ render: (text) => {
+ const findGoods = storeSelect.find(item => item.id === text);
+ if (findGoods) {
+ return
{findGoods.name}
+ } else {
+ return
暂无门店名称
+ }
+
+ },
+ },
+ {
+ title: '毛利率(%)',
+ dataIndex: 'marginRatio',
+ key: 'marginRatio',
+ }
+ ];
+
//页码变化
const onPageChange = (current, pageSize) => {
setCurrent(current);
@@ -80,13 +91,7 @@ export default function Index() {
const response = await costSalesAPI.gettree({});
setShowLoading(false);
if (response.statusCode === 200) {
- const storeList = [];
- response.data.forEach(item => {
- if (item.type === 2 || item.type === 3) {
- storeList.push(item)
- }
- })
- setStoreSelect(storeList);
+ setStoreSelect(response.data);
} else {
message.error('查询店铺列表失败');
}
@@ -115,25 +120,18 @@ export default function Index() {
门店
-
+ />
diff --git a/src/pages/order/sales-gross-profit/index.jsx b/src/pages/order/sales-gross-profit/index.jsx
index 33f4a63..df4703d 100644
--- a/src/pages/order/sales-gross-profit/index.jsx
+++ b/src/pages/order/sales-gross-profit/index.jsx
@@ -1,29 +1,11 @@
import React, { useState, useEffect } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
-import { Button, Card, DatePicker, Table, Pagination, Spin, Select, message, Col, Row } from 'antd';
+import { Button, Card, DatePicker, Table, Pagination, Spin, Select, message, Col, Row, TreeSelect } from 'antd';
import styles from './index.less';
const { RangePicker } = DatePicker;
import costSalesAPI from "./service";
import moment from 'moment';
-const columns = [
- {
- title: '门店名称',
- dataIndex: 'storeId',
- key: 'storeId',
- },
- {
- title: '商品名称',
- dataIndex: 'goodsId',
- key: 'goodsId',
- },
- {
- title: '毛利率',
- dataIndex: 'marginRatio',
- key: 'marginRatio',
- }
-];
-
const LoadingCard = () => {
return (
@@ -58,6 +40,33 @@ export default function Index() {
const [goodsTypeArray, setGoodsTypeArray] = useState([]);
const [goodsTypeSelect, setGoodsTypeSelect] = useState([]);
+ const columns = [
+ {
+ title: '门店名称',
+ dataIndex: 'storeId',
+ key: 'storeId',
+ },
+ {
+ title: '商品名称',
+ dataIndex: 'goodsId',
+ key: 'goodsId',
+ render: (text) => {
+ const findGoods = goodsIdSelect.find(item => item.id === text);
+ if (findGoods) {
+ return
{findGoods.name}
+ } else {
+ return
暂无商品名称
+ }
+
+ },
+ },
+ {
+ title: '毛利率',
+ dataIndex: 'marginRatio',
+ key: 'marginRatio',
+ }
+ ];
+
//页码变化
const onPageChange = (current, pageSize) => {
setCurrent(current);
@@ -67,7 +76,7 @@ export default function Index() {
//查询
const onQueryReportSalescost = async () => {
const jsonData = {
- "storeId": storeIdArray[0],
+ "storeId": storeIdArray,
"goodsId": goodsIdArray[0],
"goodsTypeId": goodsTypeArray[0],
"begintime": timeRange[0],
@@ -93,13 +102,7 @@ export default function Index() {
const response = await costSalesAPI.gettree({});
setShowLoading(false);
if (response.statusCode === 200) {
- const storeList = [];
- response.data.forEach(item => {
- if (item.type === 2 || item.type === 3) {
- storeList.push(item)
- }
- })
- setStoreSelect(storeList);
+ setStoreSelect(response.data);
} else {
message.error('查询店铺列表失败');
}
@@ -155,25 +158,18 @@ export default function Index() {
门店
-
+ />