Browse Source

报表查询条件优化

tags/小炒逻辑变更前
yangwenhua 2 years ago
parent
commit
d531ebe375
3 changed files with 126 additions and 136 deletions
  1. +54
    -58
      src/pages/order/cost-of-sales/index.jsx
  2. +34
    -36
      src/pages/order/gross-profit-store-sales/index.jsx
  3. +38
    -42
      src/pages/order/sales-gross-profit/index.jsx

+ 54
- 58
src/pages/order/cost-of-sales/index.jsx View File

@@ -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 (
<div className={styles['loading-card']}>
@@ -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 <span>{findGoods.name}</span>
} else {
return <span>暂无商品名称</span>
}

},
},
{
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() {
<div className={styles['data-search-prefix']}>
门店
</div>
<Select
<TreeSelect
className={styles['data-search-sufixx']}
value={storeIdArray}
showSearch
mode="tags"
size="middle"
allowClear
dropdownStyle={{
maxHeight: 400,
overflow: 'auto',
}}
treeData={storeSelect}
placeholder="请选择门店"
treeDefaultExpandAll
onChange={(values) => setStoreIdArray(values)}
filterOption={(input, option) => option.children.toLowerCase().includes(input.toLowerCase())}
>
{
storeSelect.map((item) => {
return (
<Option key={item.key}>{item.title}</Option>
)
})
}
</Select>
/>
</Col>
<Col xs={24} sm={24} md={12} lg={12} xl={6} className={styles['data-search-item']}>
<div className={styles['data-search-prefix']}>


+ 34
- 36
src/pages/order/gross-profit-store-sales/index.jsx View File

@@ -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 <span>{findGoods.name}</span>
} else {
return <span>暂无门店名称</span>
}
},
},
{
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() {
<div className={styles['data-search-prefix']}>
门店
</div>
<Select
value={storeIdArray}
<TreeSelect
className={styles['data-search-sufixx']}
showSearch
mode="tags"
size="middle"
allowClear
value={storeIdArray}
dropdownStyle={{
maxHeight: 400,
overflow: 'auto',
}}
treeData={storeSelect}
placeholder="请选择门店"
treeDefaultExpandAll
onChange={(values) => setStoreIdArray(values)}
filterOption={(input, option) => option.children.toLowerCase().includes(input.toLowerCase())}
>
{
storeSelect.map((item) => {
return (
<Option key={item.key}>{item.title}</Option>
)
})
}
</Select>
/>
</Col>
<Col xs={24} sm={24} md={12} lg={12} xl={8} className={styles['data-search-item']}>
<div className={styles['data-search-prefix']}>


+ 38
- 42
src/pages/order/sales-gross-profit/index.jsx View File

@@ -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 (
<div className={styles['loading-card']}>
@@ -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 <span>{findGoods.name}</span>
} else {
return <span>暂无商品名称</span>
}
},
},
{
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() {
<div className={styles['data-search-prefix']}>
门店
</div>
<Select
<TreeSelect
className={styles['data-search-sufixx']}
value={storeIdArray}
showSearch
mode="tags"
size="middle"
allowClear
dropdownStyle={{
maxHeight: 400,
overflow: 'auto',
}}
treeData={storeSelect}
placeholder="请选择门店"
treeDefaultExpandAll
onChange={(values) => setStoreIdArray(values)}
filterOption={(input, option) => option.children.toLowerCase().includes(input.toLowerCase())}
>
{
storeSelect.map((item) => {
return (
<Option key={item.key}>{item.title}</Option>
)
})
}
</Select>
/>
</Col>
<Col xs={24} sm={24} md={12} lg={12} xl={6} className={styles['data-search-item']}>
<div className={styles['data-search-prefix']}>


Loading…
Cancel
Save