From 77d58f369164de5bc4b4ff2823517944db141695 Mon Sep 17 00:00:00 2001 From: gwbvipvip Date: Mon, 24 Apr 2023 15:11:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.js | 6 + src/app.jsx | 7 + src/pages/order/DailyReport/index.css | 43 ++++++ src/pages/order/DailyReport/index.jsx | 151 ++++++++++++++++++++ src/pages/order/DailyReport/service.js | 15 ++ src/pages/order/order-flow-manage/index.jsx | 3 + 6 files changed, 225 insertions(+) create mode 100644 src/pages/order/DailyReport/index.css create mode 100644 src/pages/order/DailyReport/index.jsx create mode 100644 src/pages/order/DailyReport/service.js diff --git a/config/routes.js b/config/routes.js index 70706f2..150a0da 100644 --- a/config/routes.js +++ b/config/routes.js @@ -775,6 +775,12 @@ export default [ component: './order/ordersalescountbyday', access: 'k32', }, + { + name: '营业报表', + path: '/order/DailyReport', + component: './order/DailyReport', + access: 'k32', + }, { name: '异常订单信息', path: '/order/exOrder', diff --git a/src/app.jsx b/src/app.jsx index cf3322c..ae8e235 100644 --- a/src/app.jsx +++ b/src/app.jsx @@ -743,6 +743,13 @@ export async function getInitialState() { component: './order/ordersalescountbyday', access: 'k32', }, + { + code: 'DailyReport', + name: '营业报表', + path: '/order/DailyReport', + component: './order/DailyReport', + access: 'k32', + }, { code: 'ExOrder', name: '异常订单', diff --git a/src/pages/order/DailyReport/index.css b/src/pages/order/DailyReport/index.css new file mode 100644 index 0000000..6c64a79 --- /dev/null +++ b/src/pages/order/DailyReport/index.css @@ -0,0 +1,43 @@ +.welcome-head { + display: flex; + align-items: center; + justify-content: space-between; +} + +.welcome-head-org { + flex-shrink: 0; + margin-left: 10px; + width: 300px !important; + cursor: pointer; + +} + +.echarts-card-choose { + display: flex; + align-items: center; +} + + +.my-loading { + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + z-index: 999; +} + +.device-list { + width: 200px; + margin-left: 30px; +} + +.my-range-picker { + flex-shrink: 0; + width: 300px; +} + +.tabs-title { + font-size: 20px; + font-weight: 600; +} \ No newline at end of file diff --git a/src/pages/order/DailyReport/index.jsx b/src/pages/order/DailyReport/index.jsx new file mode 100644 index 0000000..fd82c2f --- /dev/null +++ b/src/pages/order/DailyReport/index.jsx @@ -0,0 +1,151 @@ +import { useEffect, useState, useRef } from 'react'; +import { DatePicker, Radio, Space, Tabs, Button, Table, Col, Row, Spin, Card } from 'antd'; +import { PageContainer } from '@ant-design/pro-layout'; +import styles from './index.css'; +import moment from 'moment'; +import api from './service'; +import { nanoid } from 'nanoid'; +const { TabPane } = Tabs; +const { RangePicker } = DatePicker; + +const App = () => { + const [tabPosition, setTabPosition] = useState('left'); + const [tabIndex, setTabIndex] = useState(1); + const [tableData, setTableData] = useState([]); + const [timeRange, setTimeRange] = useState([ + moment(moment(new Date(Date.now())).format('YYYY-MM-DD 00:00:00')), + moment(moment(new Date(Date.now())).format('YYYY-MM-DD 23:59:59')), + ]); //日期选择器 + + const [loading, setLoading] = useState(false); + + const columns = [ + { + title: '名称', + dataIndex: 'name', + width:100, + hideInSearch: true, + }, + { + title: '金额', + dataIndex: 'saleMoney', + hideInSearch: true, + }, + // { + // title: '销售金额', + // dataIndex: 'saleMoney', + // hideInSearch: true, + // }, + // { + // title: '实收金额', + // dataIndex: 'realityMoney', + // hideInSearch: true, + // }, + // { + // title: '优惠金额', + // dataIndex: 'discountMoney', + // hideInSearch: true, + // }, + ] + + + useEffect(() => { + initData(); + }, [tabIndex]); + + const initData = async () => { + setLoading(true); + const startTime = moment(timeRange[0]).format('YYYY-MM-DD HH:mm:ss'); + const endTime = moment(timeRange[1]).format('YYYY-MM-DD HH:mm:ss'); + var data = await api.GetSalesReport({ "type": tabIndex, "startTime": startTime, "endTime": endTime }); + data.forEach(item => { + item.key = nanoid(); + }) + setTableData(data); + setLoading(false); + } + return ( + <> + + + + +
+
+ 起止时间: +
+ { + let tempDate = [ + moment(moment(new Date(dateStrings[0])).format('YYYY-MM-DD 00:00:00')), + moment(moment(new Date(dateStrings[1])).format('YYYY-MM-DD 23:59:59')), + ] + setTimeRange(tempDate); + }} /> +
+ + + + + +
+
+ + + + { setTabIndex(value); }} + + items={new Array(2).fill(null).map((_, i) => { + const id = String(i + 1); + return { + label: id == 1 ? `银收总览` : `支付渠道`, + key: id, + children: , + }; + })} + + /> + + + {/* { setTabIndex(value); }}> + + { + tabIndex == 1 && <> + +
+ 分类统计 +
+
+
+ + } + , + + { + tabIndex == 1 && <> + +
+ 单品统计 +
+
+
+ + } + + */} + + + + ); +}; +export default App; \ No newline at end of file diff --git a/src/pages/order/DailyReport/service.js b/src/pages/order/DailyReport/service.js new file mode 100644 index 0000000..0dd34a6 --- /dev/null +++ b/src/pages/order/DailyReport/service.js @@ -0,0 +1,15 @@ +// @ts-ignore + +/* eslint-disable */ +import { request } from 'umi'; + +export default { + /** 获取订单流水信息*/ + GetSalesReport(data) { + return request(`/kitchen/api/Order/GetDailyReport`, { + method: 'Post', + data: data, + }); + } + +} diff --git a/src/pages/order/order-flow-manage/index.jsx b/src/pages/order/order-flow-manage/index.jsx index 536018f..c6e95a7 100644 --- a/src/pages/order/order-flow-manage/index.jsx +++ b/src/pages/order/order-flow-manage/index.jsx @@ -161,6 +161,9 @@ const Manage = () => { 3: { text: '银联', }, + 4: { + text: '现金', + }, }, }, {