- {item.goodName}
-
- ¥{item.originalMoney}
-
- x1份
-
- {item.order_Status === 0 ? '等待制作' : ''}
- {item.order_Status === 1 ? '制作中' : ''}
- {item.order_Status === 2 ? '等待取餐' : ''}
- {item.order_Status === 3 ? '取餐完成' : ''}
- {item.order_Status === 99998 ? '正常订单' : ''}
- {item.order_Status === 99999 ? '异常订单' : ''}
+ {/* 商品信息 */}
+
+
+ 商品信息
+
+
+ {
+ orderInfo.goodsInfo.map(item => {
+ return (
+
+
+
+
+
+ {item.goodsName || '暂无名称'}
+
+
+ ¥{item.memberPrice}
+
+
+ x{item.count}份
+
-
- )
- })
- }
-
- {/* 小计 */}
-
-
小计
-
-
优惠金额
-
¥{orderInfo.discountMoney}
+ )
+ })
+ }
-
-
支付金额
-
¥{orderInfo.orderRealMoney}
+ {/* 小计 */}
+
+
小计
+
+
优惠金额
+
¥{orderInfo.discountMoney}
+
+
+
支付金额
+
¥{orderInfo.orderRealMoney}
+
-
- {/* 售后信息 */}
-
-
- 售后信息
+ {/* 售后信息 */}
+
+
+ 售后信息
+
+
+ {
+ saleAfterInfo.map(item => {
+ return (
+
+
+ {item.createdAt} {item.stutasStr}
+
+
+ )
+ })
+ }
+
-
- {
- saleAfterInfo.map(item => {
- return (
-
-
- {item.createdAt} {item.stutasStr}
-
-
- )
- })
- }
-
-
+
+
)
}
diff --git a/src/pages/order/order-report-detail/index.less b/src/pages/order/order-report-detail/index.less
index f6a5d24..474bef4 100644
--- a/src/pages/order/order-report-detail/index.less
+++ b/src/pages/order/order-report-detail/index.less
@@ -18,10 +18,10 @@
width: 0;
height: 0;
top: 0;
- left: 70px;
- border-top: 25px solid transparent;
- border-bottom: 25px solid transparent;
- border-left: 25px solid rgb(88, 91, 110);
+ left: 50px;
+ border-top: 20px solid transparent;
+ border-bottom: 20px solid transparent;
+ border-left: 20px solid rgb(88, 91, 110);
}
.order-number {
@@ -29,23 +29,23 @@
align-items: center;
justify-content: center;
position: absolute;
- width: 90px;
- height: 50px;
+ width: 70px;
+ height: 40px;
left: -20px;
top: 0;
background-color: rgb(88, 91, 110);
color: #FFF;
- font-size: 35px;
+ font-size: 26px;
}
.order-cook-state {
- font-size: 30px;
- margin-left: 130px;
+ font-size: 22px;
+ margin-left: 100px;
margin-right: 20px;
}
.order-cook-date {
- font-size: 20px;
+ font-size: 16px;
color: rgb(246, 152, 38);
}
@@ -55,18 +55,9 @@
}
.member-info-img {
- width: 100px;
- height: 100px;
margin-right: 20px;
}
-.member-info-img img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- border-radius: 50%;
-}
-
.member-info-row {
display: flex;
flex-direction: column;
@@ -74,12 +65,12 @@
}
.member-info-head {
- font-size: 30px;
+ font-size: 22px;
margin-right: 10px;
}
.member-info-label {
- font-size: 20px;
+ font-size: 16px;
color: #999;
}
@@ -98,20 +89,20 @@
}
.member-info-prefix {
- font-size: 20px;
+ font-size: 16px;
color: rgb(88, 91, 110);
margin-right: 10px;
}
.member-info-suffix {
- font-size: 20px;
+ font-size: 16px;
color: #222;
}
// 备餐状态
.prepare-meals {
margin-top: 20px;
- font-size: 20px;
+ font-size: 16px;
color: #222;
}
@@ -125,7 +116,7 @@
}
.goods-title {
- font-size: 30px;
+ font-size: 22px;
font-weight: 700;
margin-bottom: 10px;
}
@@ -135,62 +126,19 @@
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
- font-size: 20px;
+ font-size: 16px;
color: #222;
}
-.goods-item-img {
- width: 80px;
- height: 80px;
-}
-
-.goods-item-img img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- border-radius: 10px;
-}
-
-.product-show-state {
- border: 1px solid;
- padding: 0px 30px;
-}
-
-.product-show-0 {
- border-color: #51A97D;
- color: #51A97D;
-}
-
-.product-show-1 {
- border-color: #F84352;
- color: #F84352;
-}
-
-.product-show-2 {
- border-color: #800080;
- color: #800080;
-}
-
-.product-show-3 {
- border-color: #4169E1;
- color: #4169E1;
-}
-
-.product-show-99999,
-.product-show-99998 {
- border-color: #FFA500;
- color: #FFA500;
-}
-
// 小计
.goods-calc {
padding-top: 10px;
border-top: 1px dashed #dedede;
- font-size: 20px;
+ font-size: 16px;
}
.goods-calc-title {
- font-size: 20px;
+ font-size: 16px;
font-weight: 700;
}
@@ -198,7 +146,7 @@
display: flex;
align-items: center;
justify-content: space-between;
- font-size: 20px;
+ font-size: 16px;
}
.goods-calc-pay .goods-calc-sufix {
@@ -207,7 +155,7 @@
// 订单信息
.sale-after-line {
- font-size: 18px;
+ font-size: 16px;
}
@media screen and (min-width: 1200px) {
@@ -219,7 +167,6 @@
background-color: #FFF;
width: 49.5%;
box-sizing: border-box;
- margin-bottom: 10px;
}
}
@@ -232,6 +179,5 @@
background-color: #FFF;
width: 100%;
box-sizing: border-box;
- margin-bottom: 10px;
}
}
\ No newline at end of file
diff --git a/src/pages/order/order-report-detail/service.js b/src/pages/order/order-report-detail/service.js
new file mode 100644
index 0000000..bc9b448
--- /dev/null
+++ b/src/pages/order/order-report-detail/service.js
@@ -0,0 +1,9 @@
+import { request } from 'umi';
+
+export default {
+ getOrderReporByNumber(orderNumber) {
+ return request(`/kitchen/api/report-statistics/order-info-report/${orderNumber}`, {
+ method: 'GET',
+ });
+ }
+};
diff --git a/src/pages/order/order-report/index.jsx b/src/pages/order/order-report/index.jsx
index dcd0de6..d8cf635 100644
--- a/src/pages/order/order-report/index.jsx
+++ b/src/pages/order/order-report/index.jsx
@@ -1,27 +1,122 @@
-import React from 'react';
+import React, { useState, useEffect } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
-import { Button, Card, DatePicker } from 'antd';
+import { Button, Card, DatePicker, Table, message, Pagination, Space } from 'antd';
import styles from './index.less';
const { RangePicker } = DatePicker;
+import orderReportAPI from "./service";
+import moment from 'moment';
+import { history } from "umi";
+
+const columns = [
+ {
+ title: '店铺名称',
+ dataIndex: 'shopName',
+ key: 'shopName',
+ },
+ {
+ title: '原价(¥)',
+ dataIndex: 'orderOriginalMoney',
+ key: 'orderOriginalMoney',
+ },
+ {
+ title: '优惠(¥)',
+ dataIndex: 'discountMoney',
+ key: 'discountMoney',
+ },
+ {
+ title: '实际支付(¥)',
+ dataIndex: 'orderRealMoney',
+ key: 'orderRealMoney',
+ },
+ {
+ title: '创建时间',
+ dataIndex: 'createdAt',
+ key: 'createdAt',
+ },
+ {
+ title: '操作',
+ key: 'action',
+ render: (_, record) => (
+
+ {
+ history.push({
+ pathname: '/order/order-report/order-report-detail',
+ query: {
+ orderNumber: record.orderNumber
+ }
+ });
+ }}>详情
+
+ ),
+ },
+];
+
/**
* 订单报表
* @returns
*/
export default function Index() {
+ //订单报表列表
+ const [orderReportList, setOrderReportList] = useState([]);
+ const [current, setCurrent] = useState(1);
+ const [pageSize, setPageSize] = useState(10);
+ const [total, setTotal] = useState(0);
+
+ const [timeRange, setTimeRange] = useState([
+ moment(moment(new Date(Date.now() - 24 * 60 * 60 * 1000 * 7)).format('YYYY-MM-DD 00:00:00')),
+ moment(moment(new Date(Date.now())).format('YYYY-MM-DD 23:59:59')),
+ ]); //日期选择器
+
+ useEffect(() => {
+ onQueryOrderReportList();
+ }, [current, pageSize]);
+
+
+
+ //获取订单列表
+ const onQueryOrderReportList = async () => {
+ const jsonData = {
+ current,
+ pageSize
+ }
+ const response = await orderReportAPI.getOrderReportList(jsonData);
+ if (response.statusCode === 200) {
+ setOrderReportList(response.data.data);
+ setTotal(response.data.total)
+ } else {
+ message.error(response.errors || '获取订单报表列表失败');
+ }
+ }
+
+ //页码变化
+ const onPageChange = (current, pageSize) => {
+ setCurrent(current);
+ setPageSize(pageSize);
+ }
+
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);
+ }} />
-
+
- 订单报表
+
+
)
diff --git a/src/pages/order/order-report/index.less b/src/pages/order/order-report/index.less
index 74d0c92..9487917 100644
--- a/src/pages/order/order-report/index.less
+++ b/src/pages/order/order-report/index.less
@@ -12,5 +12,9 @@
margin-left: 20px;
}
-.table-card {
+.table-page {
+ display: flex;
+ justify-content: flex-end;
+ align-items: center;
+ height: 50px;
}
\ No newline at end of file
diff --git a/src/pages/order/order-report/service.js b/src/pages/order/order-report/service.js
new file mode 100644
index 0000000..11107ef
--- /dev/null
+++ b/src/pages/order/order-report/service.js
@@ -0,0 +1,10 @@
+import { request } from 'umi';
+
+export default {
+ getOrderReportList(data) {
+ return request(`/kitchen/api/report-statistics/order-report`, {
+ method: 'Post',
+ data: data,
+ });
+ }
+};
From 7396a32fba2184e47eb429b931325e5f1c20c9b2 Mon Sep 17 00:00:00 2001
From: yangwenhua <1289978696@qq.com>
Date: Sat, 25 Jun 2022 16:32:07 +0800
Subject: [PATCH 07/14] =?UTF-8?q?=E8=90=A5=E9=94=80=E6=8A=A5=E8=A1=A8?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E7=94=A8=EF=BC=8C=E6=96=B0=E5=A2=9E?=
=?UTF-8?q?=E5=AF=BC=E5=87=BAExcel?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/pages/order/order-market-report/index.jsx | 239 +++++++++---------
.../order/order-market-report/index.less | 6 +-
.../order/order-market-report/service.js | 10 +
3 files changed, 133 insertions(+), 122 deletions(-)
create mode 100644 src/pages/order/order-market-report/service.js
diff --git a/src/pages/order/order-market-report/index.jsx b/src/pages/order/order-market-report/index.jsx
index 259adbe..36c3116 100644
--- a/src/pages/order/order-market-report/index.jsx
+++ b/src/pages/order/order-market-report/index.jsx
@@ -1,7 +1,12 @@
import React, { useEffect, useState } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
-import { Button, Table, Card, DatePicker } from 'antd';
+import { DownloadOutlined } from '@ant-design/icons';
+import { Button, Table, Card, DatePicker, message, Pagination } from 'antd';
import styles from './index.less';
+import moment from 'moment';
+import marketAPI from "./service";
+
+import ExportJsonExcel from "js-export-excel"
const { RangePicker } = DatePicker;
const columns = [
@@ -15,8 +20,8 @@ const columns = [
},
{
title: '店铺',
- dataIndex: 'storeName',
- key: 'storeName',
+ dataIndex: 'shopName',
+ key: 'shopName',
width: 170,
align: 'center',
fixed: 'left',
@@ -30,7 +35,7 @@ const columns = [
value: '四川白菠萝科技',
}
],
- onFilter: (value, record) => record.storeName.indexOf(value) === 0,
+ onFilter: (value, record) => record.shopName.indexOf(value) === 0,
},
{
title: '营收',
@@ -44,15 +49,15 @@ const columns = [
children: [
{
title: '流水',
- dataIndex: 'flowingWater',
- key: 'flowingWater',
+ dataIndex: 'revenueFlow',
+ key: 'revenueFlow',
width: 100,
align: 'center',
},
{
title: '实收',
- dataIndex: 'netReceipts',
- key: 'netReceipts',
+ dataIndex: 'paidAmount',
+ key: 'paidAmount',
width: 100,
align: 'center',
},
@@ -65,22 +70,22 @@ const columns = [
children: [
{
title: '会员价',
- dataIndex: 'membershipPrice',
- key: 'membershipPrice',
+ dataIndex: 'discountMember',
+ key: 'discountMember',
width: 100,
align: 'center',
},
{
title: '优惠券',
- dataIndex: 'coupon',
- key: 'coupon',
+ dataIndex: 'discountCoupon',
+ key: 'discountCoupon',
width: 100,
align: 'center',
},
{
title: '活动',
- dataIndex: 'activity',
- key: 'activity',
+ dataIndex: 'discountActivity',
+ key: 'discountActivity',
width: 100,
align: 'center',
}
@@ -184,15 +189,15 @@ const columns = [
children: [
{
title: '流水单价',
- dataIndex: 'unitPriceOfWater',
- key: 'unitPriceOfWater',
+ dataIndex: 'customerRevenueFlow',
+ key: 'customerRevenueFlow',
width: 100,
align: 'center',
},
{
title: '实收单价',
- dataIndex: 'paidInUnitPrice',
- key: 'paidInUnitPrice',
+ dataIndex: 'customerPaidAmount',
+ key: 'customerPaidAmount',
width: 100,
align: 'center',
}
@@ -205,15 +210,15 @@ const columns = [
children: [
{
title: '流水单价',
- dataIndex: 'singleUnitPriceOfWater',
- key: 'singleUnitPriceOfWater',
+ dataIndex: 'orderRevenueFlow',
+ key: 'orderRevenueFlow',
width: 100,
align: 'center',
},
{
title: '实收单价',
- dataIndex: 'singlePaidInUnitPrice',
- key: 'singlePaidInUnitPrice',
+ dataIndex: 'orderPaidAmount',
+ key: 'orderPaidAmount',
width: 100,
align: 'center',
}
@@ -228,15 +233,15 @@ const columns = [
children: [
{
title: '现金',
- dataIndex: 'numCash',
- key: 'numCash',
+ dataIndex: 'sourceCashCount',
+ key: 'sourceCashCount',
width: 100,
align: 'center',
},
{
title: '微信支付',
- dataIndex: 'numWechatPayment',
- key: 'numWechatPayment',
+ dataIndex: 'sourceWeChatCount',
+ key: 'sourceWeChatCount',
width: 100,
align: 'center',
},
@@ -289,15 +294,15 @@ const columns = [
children: [
{
title: '会员',
- dataIndex: 'incomeMember',
- key: 'incomeMember',
+ dataIndex: 'memberIncomeMoney',
+ key: 'memberIncomeMoney',
width: 100,
align: 'center',
},
{
title: '非会员',
- dataIndex: 'incomeNonMember',
- key: 'incomeNonMember',
+ dataIndex: 'nonMemberIncomeMoney',
+ key: 'nonMemberIncomeMoney',
width: 100,
align: 'center',
},
@@ -324,15 +329,15 @@ const columns = [
children: [
{
title: '微信支付',
- dataIndex: 'incomeWechatPay',
- key: 'incomeWechatPay',
+ dataIndex: 'sourceWeChatMoney',
+ key: 'sourceWeChatMoney',
width: 100,
align: 'center',
},
{
title: '现金支付',
- dataIndex: 'incomeCashPay',
- key: 'incomeCashPay',
+ dataIndex: 'sourceCashMoney',
+ key: 'sourceCashMoney',
width: 100,
align: 'center',
},
@@ -383,91 +388,25 @@ const columns = [
*/
export default function Index() {
- const [data, setData] = useState([
- {
- date: '2022-6-22 14:01:53',
- storeName: '四川黑菠萝科技',
- flowingWater: 10010,
- netReceipts: 8848,
- membershipPrice: 6000,
- coupon: 2848,
- activity: 998,
- takeOutRevenue: 10086,
- meituanTakeout: 5500,
- hungryTakeOut: 5600,
- freshWaterInTheHall: 10010,
- paidInFood: 10010,
- publicComments: 8000,
- wordOfMouth: 1000,
- tiktok: 2000,
- unitPriceOfWater: 68,
- paidInUnitPrice: 70,
- singleUnitPriceOfWater: 99,
- singlePaidInUnitPrice: 88,
- numCash: 10,
- numWechatPayment: 100,
- numPublicComments: 99,
- numWordOfMouth: 88,
- numTiktok: 77,
- numMeituanTakeout: 66,
- numHungryTakeOut: 55,
- incomeMember: 50,
- incomeNonMember: 50,
- incomeTakeOut: 70,
- incomeGroupPurchase: 90,
- incomeWechatPay: 10,
- incomeCashPay: 30,
- incomePublicComments: 20,
- incomeWordOfMouth: 50,
- incomeTiktok: 30,
- incomeMeituan: 80,
- incomeHungry: 100
- },
- {
- date: '2022-6-22 15:58:43',
- storeName: '四川白菠萝科技',
- flowingWater: 10010,
- netReceipts: 8848,
- membershipPrice: 6000,
- coupon: 2848,
- activity: 998,
- takeOutRevenue: 10086,
- meituanTakeout: 5500,
- hungryTakeOut: 5600,
- freshWaterInTheHall: 10010,
- paidInFood: 10010,
- publicComments: 8000,
- wordOfMouth: 1000,
- tiktok: 2000,
- unitPriceOfWater: 68,
- paidInUnitPrice: 70,
- singleUnitPriceOfWater: 99,
- singlePaidInUnitPrice: 88,
- numCash: 10,
- numWechatPayment: 100,
- numPublicComments: 99,
- numWordOfMouth: 88,
- numTiktok: 77,
- numMeituanTakeout: 66,
- numHungryTakeOut: 55,
- incomeMember: 50,
- incomeNonMember: 50,
- incomeTakeOut: 70,
- incomeGroupPurchase: 90,
- incomeWechatPay: 10,
- incomeCashPay: 30,
- incomePublicComments: 20,
- incomeWordOfMouth: 50,
- incomeTiktok: 30,
- incomeMeituan: 80,
- incomeHungry: 100
- }
- ])
+ const [data, setData] = useState([]);
+ const [current, setCurrent] = useState(1);
+ const [pageSize, setPageSize] = useState(10);
+ const [total, setTotal] = useState(0);
+
+ const [timeRange, setTimeRange] = useState([
+ moment(moment(new Date(Date.now() - 24 * 60 * 60 * 1000 * 7)).format('YYYY-MM-DD 00:00:00')),
+ moment(moment(new Date(Date.now())).format('YYYY-MM-DD 23:59:59')),
+ ]); //日期选择器
useEffect(() => {
- calcTotal();
- }, []);
+ queryMarketReport();
+ }, [current, pageSize, timeRange]);
+ // useEffect(() => {
+ // calcTotal();
+ // }, [data]);
+
+ //计算总计
const calcTotal = () => {
const originData = JSON.parse(JSON.stringify(data));
const totalData = {}
@@ -475,8 +414,8 @@ export default function Index() {
Object.keys(dataObj).forEach(key => {
if (key === 'date') {
totalData.date = '合计';
- } else if (key == 'storeName') {
- totalData.storeName = '';
+ } else if (key == 'shopName') {
+ totalData.shopName = '';
} else if (typeof dataObj[key] === 'number') {
if (totalData[key] && typeof totalData[key] === 'number') {
totalData[key] += dataObj[key];
@@ -490,24 +429,82 @@ export default function Index() {
});
});
originData.push(totalData);
- console.log('originData', originData);
setData(originData);
}
+ const queryMarketReport = async () => {
+ const jsonData = {
+ current: current,
+ pageSize: pageSize
+ }
+ const response = await marketAPI.getMarketReportList(jsonData);
+ if (response.statusCode === 200) {
+ setData(response.data.data);
+ setTotal(response.data.total);
+ } else {
+ message.error(response.errors || '获取营销报表失败');
+ }
+ }
+
+ //页码变化
+ const onPageChange = (current, pageSize) => {
+ setCurrent(current);
+ setPageSize(pageSize);
+ }
+
+ //下载Excel
+ const onDownloadExcel = () => {
+ let option = {}; //option代表的就是excel文件
+ const date = new Date();
+ const excelName = "营销报表-" + date.toLocaleString().replaceAll('\/', '-');
+ option.fileName = excelName; //excel文件名称
+ const sheetHeader = [];
+ Object.keys(data[0]).forEach(item => {
+ sheetHeader.push(item);
+ });
+ console.log('sheetHeader', sheetHeader);
+ option.datas = [
+ {
+ sheetData: data, //excel文件中的数据源
+ sheetName: excelName, //excel文件中sheet页名称
+ sheetFilter: sheetHeader, //excel文件中需显示的列数据
+ sheetHeader: ['ID', '时间', '店铺名称', '店铺ID', '营收流水',
+ '实际营收', '会员价', '优惠券', '活动折扣', '营收流水',
+ '营收流水', '客单价-流水单价', '客单价-实收单价', '单单价-总流水', '单单价-总实收',
+ '现金-交易笔数', '现金收入', '微信-交易笔数', '微信收入', '会员收入', '非会员收入'
+ ] //excel文件中每列的表头名称
+ }
+ ]
+ let toExcel = new ExportJsonExcel(option); //生成excel文件
+ toExcel.saveExcel();
+ }
+
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);
+ }} />
+ } size='middle' onClick={onDownloadExcel}>
+ 下载
+
-
+
+
)
diff --git a/src/pages/order/order-market-report/index.less b/src/pages/order/order-market-report/index.less
index 74d0c92..9487917 100644
--- a/src/pages/order/order-market-report/index.less
+++ b/src/pages/order/order-market-report/index.less
@@ -12,5 +12,9 @@
margin-left: 20px;
}
-.table-card {
+.table-page {
+ display: flex;
+ justify-content: flex-end;
+ align-items: center;
+ height: 50px;
}
\ No newline at end of file
diff --git a/src/pages/order/order-market-report/service.js b/src/pages/order/order-market-report/service.js
new file mode 100644
index 0000000..e5a3880
--- /dev/null
+++ b/src/pages/order/order-market-report/service.js
@@ -0,0 +1,10 @@
+import { request } from 'umi';
+
+export default {
+ getMarketReportList(data) {
+ return request(`/kitchen/api/report-statistics/marketing-report`, {
+ method: 'Post',
+ data: data,
+ });
+ }
+};
From 656841e57b7d056329fdf82cea94b899533d4007 Mon Sep 17 00:00:00 2001
From: yangwenhua <1289978696@qq.com>
Date: Mon, 27 Jun 2022 18:06:29 +0800
Subject: [PATCH 08/14] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=AE=A2=E5=8D=95?=
=?UTF-8?q?=E7=8A=B6=E6=80=81=E3=80=81=E5=94=AE=E5=90=8E=E4=BF=A1=E6=81=AF?=
=?UTF-8?q?=E3=80=81=E6=8A=98=E6=89=A3=E4=BF=A1=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/pages/order/order-report-detail/index.jsx | 98 ++++++++++++-------
.../order/order-report-detail/index.less | 22 ++++-
src/pages/order/order-report/index.jsx | 77 ++++++++++++---
src/pages/order/order-report/index.less | 16 +++
4 files changed, 165 insertions(+), 48 deletions(-)
diff --git a/src/pages/order/order-report-detail/index.jsx b/src/pages/order/order-report-detail/index.jsx
index 1761009..14e19c3 100644
--- a/src/pages/order/order-report-detail/index.jsx
+++ b/src/pages/order/order-report-detail/index.jsx
@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react';
-import { Button, Card, Image, Timeline, message } from 'antd';
+import { Button, Card, Image, Timeline, message, Tag } from 'antd';
import styles from './index.less';
-import { ExclamationCircleOutlined } from '@ant-design/icons';
+import { ExclamationCircleOutlined, UserOutlined, RedEnvelopeOutlined, WhatsAppOutlined } from '@ant-design/icons';
import { history } from 'umi';
import orderReportAPI from "./service";
import { PageContainer } from '@ant-design/pro-layout';
@@ -15,34 +15,46 @@ const orderNumber = history.location.query.orderNumber;
export default function Index() {
const [orderInfo, setOrderInfo] = useState({
- memberInfo: {},
- goodsInfo: []
+ memberInfo: {}, //用户信息
+ goodsInfo: [], //商品信息
+ informationRefundInfo: [], //售后信息
+ discountInfo: [] //优惠信息
});
- const [saleAfterInfo, setSaleAfterInfo] = useState([
- {
- id: "acc670f8-317f-4c2d-94f5-f7af12c80ebd",
- createdAt: "2022-05-18 07:52:09",
- stutasStr: "申请退款"
- },
- {
- id: "acc670f8-317f-4c2d-94f5-f7af12c80eb1",
- createdAt: "2022-05-18 09:52:09",
- stutasStr: "已退款"
- },
- ]);
+ const [orderStatus, setOrderStatus] = useState(true);
const onQueryOrderDetail = async () => {
if (orderNumber) {
const response = await orderReportAPI.getOrderReporByNumber(orderNumber);
if (response.statusCode === 200) {
setOrderInfo(response.data);
+ orderIsNormal(response.data);
} else {
message.error(response.errors || '订单详情获取失败');
}
}
}
+ const orderIsNormal = (order) => {
+ let isNormal = true;
+ if (!(order.payMoneyEx === '正常' &&
+ order.payOrderTimeEx === '正常' &&
+ order.payOrderEx === '正常')
+ ) {
+ isNormal = false;
+ }
+ if (!(order.refundMoneyEx === '正常' || order.refundMoneyEx === '' || order.refundMoneyEx === null)) {
+ isNormal = false;
+ }
+ if (!(order.refundOrderTimeEx === '正常' || order.refundOrderTimeEx === '' || order.refundOrderTimeEx === null)) {
+ isNormal = false;
+ }
+ if (!(order.refundOrderEx === '正常' || order.refundOrderEx === '' || order.refundOrderEx === null)) {
+ isNormal = false;
+ }
+ setOrderStatus(isNormal);
+ }
+
useEffect(() => {
onQueryOrderDetail();
}, []);
@@ -54,10 +66,12 @@ export default function Index() {
- #0
+ #{orderInfo.sortId}
- 订单时间
+ {
+ orderStatus ?
正常订单
:
异常订单
+ }
{orderInfo.createdAt}
@@ -94,14 +108,25 @@ export default function Index() {
{orderInfo.memberInfo.phone || '暂无电话'}
- {/*
-
- 备餐状态
-
-
- 制作中
+
+
+ 优惠信息
+
+
+ {
+ orderInfo.discountInfo?.map(discountItem => {
+ return (
+
+ {discountItem.type === 1 ? } color="#f50">{discountItem.name}:{discountItem.value} : null}
+ {discountItem.type === 2 ? } color="#87d068">{discountItem.name}:{discountItem.value} : null}
+ {discountItem.type === 3 ? } color="#108ee9">{discountItem.name}:{discountItem.value} : null}
+
+ )
+ })
+ }
+
+
-
*/}
{/* 订单数据 */}
@@ -181,15 +206,20 @@ export default function Index() {
{
- saleAfterInfo.map(item => {
- return (
-
-
- {item.createdAt} {item.stutasStr}
-
-
- )
- })
+ orderInfo.informationRefundInfo.length > 0 ?
+ orderInfo.informationRefundInfo.map(item => {
+ return (
+
+
+ {item.createdAt} {item.refundDesc}
+
+
+ )
+ })
+ :
+
+ 暂无售后信息
+
}
diff --git a/src/pages/order/order-report-detail/index.less b/src/pages/order/order-report-detail/index.less
index 474bef4..6768071 100644
--- a/src/pages/order/order-report-detail/index.less
+++ b/src/pages/order/order-report-detail/index.less
@@ -17,7 +17,8 @@
content: '';
width: 0;
height: 0;
- top: 0;
+ top: 50%;
+ transform: translateY(-50%);
left: 50px;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
@@ -32,12 +33,27 @@
width: 70px;
height: 40px;
left: -20px;
- top: 0;
+ top: 50%;
+ transform: translateY(-50%);
background-color: rgb(88, 91, 110);
color: #FFF;
font-size: 26px;
}
+.order-status-true {
+ font-size: 14px;
+ padding: 5px 20px;
+ background-color: #2db7f5;
+ color: #FFF;
+}
+
+.order-status-false {
+ font-size: 14px;
+ padding: 5px 20px;
+ background-color: #F84352;
+ color: #FFF;
+}
+
.order-cook-state {
font-size: 22px;
margin-left: 100px;
@@ -110,6 +126,8 @@
font-weight: 700;
}
+
+
// 商品信息
.goods-card {
// margin-top: 20px;
diff --git a/src/pages/order/order-report/index.jsx b/src/pages/order/order-report/index.jsx
index d8cf635..b6c4d07 100644
--- a/src/pages/order/order-report/index.jsx
+++ b/src/pages/order/order-report/index.jsx
@@ -1,13 +1,19 @@
import React, { useState, useEffect } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
-import { Button, Card, DatePicker, Table, message, Pagination, Space } from 'antd';
+import { Button, Card, DatePicker, Table, message, Pagination, Space, Tag, Spin } from 'antd';
import styles from './index.less';
const { RangePicker } = DatePicker;
import orderReportAPI from "./service";
import moment from 'moment';
import { history } from "umi";
+import { CheckCircleOutlined, CloseCircleOutlined } from '@ant-design/icons';
const columns = [
+ {
+ title: '交易单号',
+ dataIndex: 'transactionId',
+ key: 'transactionId',
+ },
{
title: '店铺名称',
dataIndex: 'shopName',
@@ -33,24 +39,67 @@ const columns = [
dataIndex: 'createdAt',
key: 'createdAt',
},
+ {
+ title: '订单状态',
+ key: 'orderStatus',
+ render: (record) => {
+ let isNormal = true;
+ if (!(record.payMoneyEx === '正常' &&
+ record.payOrderTimeEx === '正常' &&
+ record.payOrderEx === '正常')
+ ) {
+ isNormal = false;
+ }
+ if (!(record.refundMoneyEx === '正常' || record.refundMoneyEx === '' || record.refundMoneyEx === null)) {
+ isNormal = false;
+ }
+ if (!(record.refundOrderTimeEx === '正常' || record.refundOrderTimeEx === '' || record.refundOrderTimeEx === null)) {
+ isNormal = false;
+ }
+ if (!(record.refundOrderEx === '正常' || record.refundOrderEx === '' || record.refundOrderEx === null)) {
+ isNormal = false;
+ }
+ return (
+ <>
+ {
+ isNormal ?
} color="success">
+ 正常
+
+ :
+
} color="error">
+ 异常
+
+ }
+ >
+ )
+ }
+ },
{
title: '操作',
key: 'action',
render: (_, record) => (
-
- {
- history.push({
- pathname: '/order/order-report/order-report-detail',
- query: {
- orderNumber: record.orderNumber
- }
- });
- }}>详情
-
+
+ {
+ history.push({
+ pathname: '/order/order-report/order-report-detail',
+ query: {
+ orderNumber: record.orderNumber
+ }
+ });
+ }}>详情
+
),
- },
+ },
];
+const LoadingCard = () => {
+ return (
+
+
+
+ )
+}
+
/**
* 订单报表
* @returns
@@ -62,6 +111,7 @@ export default function Index() {
const [current, setCurrent] = useState(1);
const [pageSize, setPageSize] = useState(10);
const [total, setTotal] = useState(0);
+ const [showLoading, setShowLoading] = useState(false);
const [timeRange, setTimeRange] = useState([
moment(moment(new Date(Date.now() - 24 * 60 * 60 * 1000 * 7)).format('YYYY-MM-DD 00:00:00')),
@@ -80,7 +130,9 @@ export default function Index() {
current,
pageSize
}
+ setShowLoading(true);
const response = await orderReportAPI.getOrderReportList(jsonData);
+ setShowLoading(false);
if (response.statusCode === 200) {
setOrderReportList(response.data.data);
setTotal(response.data.total)
@@ -97,6 +149,7 @@ export default function Index() {
return (
+ {showLoading ? : null}
{
diff --git a/src/pages/order/order-report/index.less b/src/pages/order/order-report/index.less
index 9487917..c33fc6a 100644
--- a/src/pages/order/order-report/index.less
+++ b/src/pages/order/order-report/index.less
@@ -17,4 +17,20 @@
justify-content: flex-end;
align-items: center;
height: 50px;
+}
+
+// 加载中
+.loading-card {
+ position: fixed;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 100vw;
+ height: 100vh;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ z-index: 999;
+ background-color: rgba(0, 0, 0, 0.5);
}
\ No newline at end of file
From 5b3413ebfad6a5ffb470e1de0e38949d295b4ccd Mon Sep 17 00:00:00 2001
From: yangwenhua <1289978696@qq.com>
Date: Tue, 28 Jun 2022 18:14:11 +0800
Subject: [PATCH 09/14] =?UTF-8?q?=E8=90=A5=E9=94=80=E6=8A=A5=E8=A1=A8?=
=?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BB=84=E7=BB=87=E6=9C=BA=E6=9E=84=E9=80=89?=
=?UTF-8?q?=E6=8B=A9=E3=80=81=E5=AF=BC=E5=87=BA=E6=89=80=E6=9C=89=E6=8A=A5?=
=?UTF-8?q?=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/pages/order/order-market-report/index.jsx | 152 +++++++++++++-----
.../order/order-market-report/index.less | 21 +++
.../order/order-market-report/service.js | 16 ++
3 files changed, 152 insertions(+), 37 deletions(-)
diff --git a/src/pages/order/order-market-report/index.jsx b/src/pages/order/order-market-report/index.jsx
index 36c3116..deca9b1 100644
--- a/src/pages/order/order-market-report/index.jsx
+++ b/src/pages/order/order-market-report/index.jsx
@@ -1,13 +1,13 @@
import React, { useEffect, useState } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
import { DownloadOutlined } from '@ant-design/icons';
-import { Button, Table, Card, DatePicker, message, Pagination } from 'antd';
+import { Button, Table, Card, DatePicker, message, Pagination, Spin, TreeSelect } from 'antd';
import styles from './index.less';
import moment from 'moment';
import marketAPI from "./service";
-
import ExportJsonExcel from "js-export-excel"
+const { TreeNode } = TreeSelect;
const { RangePicker } = DatePicker;
const columns = [
{
@@ -382,6 +382,14 @@ const columns = [
}
]
+const LoadingCard = () => {
+ return (
+
+
+
+ )
+}
+
/**
* 营销报表
* @returns
@@ -392,19 +400,21 @@ export default function Index() {
const [current, setCurrent] = useState(1);
const [pageSize, setPageSize] = useState(10);
const [total, setTotal] = useState(0);
-
+ const [orgTree, setOrgTree] = useState([]);
+ const [showLoading, setShowLoading] = useState(false);
const [timeRange, setTimeRange] = useState([
moment(moment(new Date(Date.now() - 24 * 60 * 60 * 1000 * 7)).format('YYYY-MM-DD 00:00:00')),
moment(moment(new Date(Date.now())).format('YYYY-MM-DD 23:59:59')),
]); //日期选择器
+ const [currentOrg, setCurrentOrg] = useState('');
useEffect(() => {
queryMarketReport();
}, [current, pageSize, timeRange]);
- // useEffect(() => {
- // calcTotal();
- // }, [data]);
+ useEffect(() => {
+ onGetOrgTree();
+ }, []);
//计算总计
const calcTotal = () => {
@@ -434,10 +444,15 @@ export default function Index() {
const queryMarketReport = async () => {
const jsonData = {
+ startTime: timeRange[0],
+ endTime: timeRange[1],
current: current,
pageSize: pageSize
}
+ currentOrg.key && (jsonData.shopId = currentOrg.key);
+ setShowLoading(true);
const response = await marketAPI.getMarketReportList(jsonData);
+ setShowLoading(false);
if (response.statusCode === 200) {
setData(response.data.data);
setTotal(response.data.total);
@@ -453,49 +468,112 @@ export default function Index() {
}
//下载Excel
- const onDownloadExcel = () => {
- let option = {}; //option代表的就是excel文件
- const date = new Date();
- const excelName = "营销报表-" + date.toLocaleString().replaceAll('\/', '-');
- option.fileName = excelName; //excel文件名称
- const sheetHeader = [];
- Object.keys(data[0]).forEach(item => {
- sheetHeader.push(item);
- });
- console.log('sheetHeader', sheetHeader);
- option.datas = [
- {
- sheetData: data, //excel文件中的数据源
- sheetName: excelName, //excel文件中sheet页名称
- sheetFilter: sheetHeader, //excel文件中需显示的列数据
- sheetHeader: ['ID', '时间', '店铺名称', '店铺ID', '营收流水',
- '实际营收', '会员价', '优惠券', '活动折扣', '营收流水',
- '营收流水', '客单价-流水单价', '客单价-实收单价', '单单价-总流水', '单单价-总实收',
- '现金-交易笔数', '现金收入', '微信-交易笔数', '微信收入', '会员收入', '非会员收入'
- ] //excel文件中每列的表头名称
+ const onDownloadExcel = async () => {
+ const jsonData = {
+ startTime: timeRange[0],
+ endTime: timeRange[1],
+ }
+ currentOrg.key && (jsonData.shopId = currentOrg.key);
+ setShowLoading(true);
+ const response = await marketAPI.marketingReportExport(jsonData);
+ setShowLoading(false);
+ if (response.statusCode === 200) {
+ let option = {}; //option代表的就是excel文件
+ const date = new Date();
+ const excelName = "营销报表-" + date.toLocaleString().replaceAll('\/', '-');
+ option.fileName = excelName; //excel文件名称
+ const sheetHeader = [];
+ Object.keys(response.data[0]).forEach(item => {
+ sheetHeader.push(item);
+ });
+ console.log('sheetHeader', sheetHeader);
+ option.datas = [
+ {
+ sheetData: response.data, //excel文件中的数据源
+ sheetName: excelName, //excel文件中sheet页名称
+ sheetFilter: sheetHeader, //excel文件中需显示的列数据
+ sheetHeader: ['ID', '时间', '店铺名称', '店铺ID', '营收流水',
+ '实际营收', '会员折扣', '优惠券折扣', '活动折扣','客单价-流水单价', '客单价-实收单价',
+ '单单价-总流水', '单单价-总实收',
+ '现金-交易笔数', '现金收入', '微信-交易笔数', '微信收入', '会员收入', '非会员收入'
+ ] //excel文件中每列的表头名称
+ }
+ ]
+ let toExcel = new ExportJsonExcel(option); //生成excel文件
+ toExcel.saveExcel();
+ } else {
+ message.error(response.errors || '导出失败');
+ }
+ }
+
+ //获取组织树
+ const onGetOrgTree = async () => {
+ setShowLoading(true);
+ const response = await marketAPI.getOrgTree();
+ setShowLoading(false);
+ if (response.statusCode === 200) {
+ const originTree = response.data;
+ onSetOrgTreeStatus(originTree);
+ setOrgTree(originTree);
+ } else {
+ message.error(response.errors || '获取组织树出错');
+ }
+ }
+
+ //设置组织树不可选择状态
+ const onSetOrgTreeStatus = (originTree) => {
+ originTree.forEach(treeItem => {
+ if (treeItem.children && treeItem.children.length > 0) {
+ onSetOrgTreeStatus(treeItem.children);
+ } else {
+ if (treeItem.type === 2 || treeItem.type === 3) {
+ treeItem.disabled = false;
+ } else {
+ treeItem.disabled = true;
+ }
}
- ]
- let toExcel = new ExportJsonExcel(option); //生成excel文件
- toExcel.saveExcel();
+ });
}
return (
+ {showLoading ? : null}
-
{
- 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);
- }} />
+
+ {
+ 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);
+ }} />
+ {
+ if (node.type === 2 || node === 3) {
+ setCurrentOrg(node);
+ }
+ }}
+ placeholder="请选择组织架构"
+ treeDefaultExpandAll
+ />
+
+
} size='middle' onClick={onDownloadExcel}>
下载
-
+
diff --git a/src/pages/order/order-market-report/index.less b/src/pages/order/order-market-report/index.less
index 9487917..ed50ea4 100644
--- a/src/pages/order/order-market-report/index.less
+++ b/src/pages/order/order-market-report/index.less
@@ -17,4 +17,25 @@
justify-content: flex-end;
align-items: center;
height: 50px;
+}
+
+.data-search-left {
+ display: flex;
+ align-items: center;
+}
+
+// 加载中
+.loading-card {
+ position: fixed;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 100vw;
+ height: 100vh;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ z-index: 999;
+ background-color: rgba(0, 0, 0, 0.5);
}
\ No newline at end of file
diff --git a/src/pages/order/order-market-report/service.js b/src/pages/order/order-market-report/service.js
index e5a3880..7820383 100644
--- a/src/pages/order/order-market-report/service.js
+++ b/src/pages/order/order-market-report/service.js
@@ -1,10 +1,26 @@
import { request } from 'umi';
export default {
+ //获取分页数据
getMarketReportList(data) {
return request(`/kitchen/api/report-statistics/marketing-report`, {
method: 'Post',
data: data,
});
+ },
+
+ //获取组织架构
+ getOrgTree() {
+ return request(`/kitchen/api/report-statistics/org-tree`, {
+ method: 'GET',
+ });
+ },
+
+ //下载报表
+ marketingReportExport(data) {
+ return request(`/kitchen/api/report-statistics/marketing-report-export`, {
+ method: 'Post',
+ data: data,
+ });
}
};
From ff7f6d8bca5ca068df670435f4bb5ca94f949053 Mon Sep 17 00:00:00 2001
From: yangwenhua <1289978696@qq.com>
Date: Wed, 29 Jun 2022 10:09:12 +0800
Subject: [PATCH 10/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AE=A2=E5=8D=95?=
=?UTF-8?q?=E6=8A=A5=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/pages/order/order-market-report/index.jsx | 2 +
src/pages/order/order-report/index.jsx | 122 ++++++++++++++++--
src/pages/order/order-report/service.js | 15 +++
3 files changed, 130 insertions(+), 9 deletions(-)
diff --git a/src/pages/order/order-market-report/index.jsx b/src/pages/order/order-market-report/index.jsx
index deca9b1..b9403b5 100644
--- a/src/pages/order/order-market-report/index.jsx
+++ b/src/pages/order/order-market-report/index.jsx
@@ -561,6 +561,8 @@ export default function Index() {
onSelect={(value, node) => {
if (node.type === 2 || node === 3) {
setCurrentOrg(node);
+ } else {
+ setCurrentOrg("");
}
}}
placeholder="请选择组织架构"
diff --git a/src/pages/order/order-report/index.jsx b/src/pages/order/order-report/index.jsx
index b6c4d07..bdf566c 100644
--- a/src/pages/order/order-report/index.jsx
+++ b/src/pages/order/order-report/index.jsx
@@ -1,12 +1,13 @@
import React, { useState, useEffect } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
-import { Button, Card, DatePicker, Table, message, Pagination, Space, Tag, Spin } from 'antd';
+import { Button, Card, DatePicker, Table, message, Pagination, Space, Tag, Spin, TreeSelect } from 'antd';
import styles from './index.less';
const { RangePicker } = DatePicker;
import orderReportAPI from "./service";
import moment from 'moment';
import { history } from "umi";
-import { CheckCircleOutlined, CloseCircleOutlined } from '@ant-design/icons';
+import { CheckCircleOutlined, CloseCircleOutlined, DownloadOutlined } from '@ant-design/icons';
+import ExportJsonExcel from "js-export-excel"
const columns = [
{
@@ -112,6 +113,9 @@ export default function Index() {
const [pageSize, setPageSize] = useState(10);
const [total, setTotal] = useState(0);
const [showLoading, setShowLoading] = useState(false);
+ const [currentOrg, setCurrentOrg] = useState('');
+ const [orgTree, setOrgTree] = useState([]);
+
const [timeRange, setTimeRange] = useState([
moment(moment(new Date(Date.now() - 24 * 60 * 60 * 1000 * 7)).format('YYYY-MM-DD 00:00:00')),
@@ -123,13 +127,20 @@ export default function Index() {
}, [current, pageSize]);
+ useEffect(() => {
+ onGetOrgTree();
+ }, []);
+
//获取订单列表
const onQueryOrderReportList = async () => {
const jsonData = {
+ startTime: timeRange[0],
+ endTime: timeRange[1],
current,
pageSize
}
+ currentOrg.key && (jsonData.shopId = currentOrg.key);
setShowLoading(true);
const response = await orderReportAPI.getOrderReportList(jsonData);
setShowLoading(false);
@@ -147,19 +158,112 @@ export default function Index() {
setPageSize(pageSize);
}
+ //获取组织树
+ const onGetOrgTree = async () => {
+ setShowLoading(true);
+ const response = await orderReportAPI.getOrgTree();
+ setShowLoading(false);
+ if (response.statusCode === 200) {
+ const originTree = response.data;
+ onSetOrgTreeStatus(originTree);
+ setOrgTree(originTree);
+ } else {
+ message.error(response.errors || '获取组织树出错');
+ }
+ }
+
+ //设置组织树不可选择状态
+ const onSetOrgTreeStatus = (originTree) => {
+ originTree.forEach(treeItem => {
+ if (treeItem.children && treeItem.children.length > 0) {
+ onSetOrgTreeStatus(treeItem.children);
+ } else {
+ if (treeItem.type === 2 || treeItem.type === 3) {
+ treeItem.disabled = false;
+ } else {
+ treeItem.disabled = true;
+ }
+ }
+ });
+ }
+
+ //下载Excel
+ const onDownloadExcel = async () => {
+ const jsonData = {
+ startTime: timeRange[0],
+ endTime: timeRange[1],
+ }
+ currentOrg.key && (jsonData.shopId = currentOrg.key);
+ setShowLoading(true);
+ const response = await orderReportAPI.orderReportExport(jsonData);
+ setShowLoading(false);
+ if (response.statusCode === 200) {
+ let option = {}; //option代表的就是excel文件
+ const date = new Date();
+ const excelName = "订单报表-" + date.toLocaleString().replaceAll('\/', '-');
+ option.fileName = excelName; //excel文件名称
+ const sheetHeader = [];
+ Object.keys(response.data[0]).forEach(item => {
+ sheetHeader.push(item);
+ });
+ option.datas = [
+ {
+ sheetData: response.data, //excel文件中的数据源
+ sheetName: excelName, //excel文件中sheet页名称
+ sheetFilter: sheetHeader, //excel文件中需显示的列数据
+ sheetHeader: ['ID', '取餐号', '用户Id', '优惠合集', '订单号(本系统)',
+ '交易号', '店铺ID', '店铺名字', '商品总价','优惠金额', '实付金额',
+ '创建时间', '支付金额异常',
+ '订单支付时间异常', '订单异常', '售后金额异常', '售后时间异常', '售后订单异常'
+ ] //excel文件中每列的表头名称
+ }
+ ]
+ let toExcel = new ExportJsonExcel(option); //生成excel文件
+ toExcel.saveExcel();
+ } else {
+ message.error(response.errors || '导出失败');
+ }
+ }
+
return (
{showLoading ? : null}
-
{
- 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);
- }} />
+
+ {
+ 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);
+ }} />
+ {
+ console.log('node>>>', node);
+ if (node.type === 2 || node === 3) {
+ setCurrentOrg(node);
+ } else {
+ setCurrentOrg("");
+ }
+ }}
+ placeholder="请选择组织架构"
+ treeDefaultExpandAll
+ />
+
+ } size='middle' onClick={onDownloadExcel}>
+ 下载
+
diff --git a/src/pages/order/order-report/service.js b/src/pages/order/order-report/service.js
index 11107ef..777cde2 100644
--- a/src/pages/order/order-report/service.js
+++ b/src/pages/order/order-report/service.js
@@ -6,5 +6,20 @@ export default {
method: 'Post',
data: data,
});
+ },
+
+ //获取组织架构
+ getOrgTree() {
+ return request(`/kitchen/api/report-statistics/org-tree`, {
+ method: 'GET',
+ });
+ },
+
+ //下载报表
+ orderReportExport(data) {
+ return request(`/kitchen/api/report-statistics/order-report-export`, {
+ method: 'Post',
+ data: data,
+ });
}
};
From da4edd44f94dccece3225f427dff28c74346efd4 Mon Sep 17 00:00:00 2001
From: yangwenhua <1289978696@qq.com>
Date: Wed, 29 Jun 2022 10:35:39 +0800
Subject: [PATCH 11/14] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=AF=A6=E7=BB=86?=
=?UTF-8?q?=E5=BC=82=E5=B8=B8=E4=BF=A1=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/pages/order/order-report-detail/index.jsx | 43 +++++++++++++------
1 file changed, 29 insertions(+), 14 deletions(-)
diff --git a/src/pages/order/order-report-detail/index.jsx b/src/pages/order/order-report-detail/index.jsx
index 14e19c3..e3df461 100644
--- a/src/pages/order/order-report-detail/index.jsx
+++ b/src/pages/order/order-report-detail/index.jsx
@@ -21,7 +21,9 @@ export default function Index() {
discountInfo: [] //优惠信息
});
- const [orderStatus, setOrderStatus] = useState(true);
+ const [orderStatus, setOrderStatus] = useState({
+ isTrue: true
+ });
const onQueryOrderDetail = async () => {
if (orderNumber) {
@@ -36,22 +38,35 @@ export default function Index() {
}
const orderIsNormal = (order) => {
- let isNormal = true;
- if (!(order.payMoneyEx === '正常' &&
- order.payOrderTimeEx === '正常' &&
- order.payOrderEx === '正常')
- ) {
- isNormal = false;
+ let isNormal = {
+ isTrue: true,
+ msg: '正常订单'
+ };
+ if (!(order.payMoneyEx === '正常')) {
+ isNormal.isTrue = false;
+ isNormal.msg = '订单支付金额异常';
+ }
+ else if (!(order.payOrderTimeEx === '正常')) {
+ isNormal.isTrue = false;
+ isNormal.msg = '订单支付时间异常';
+ }
+ else if (!(order.payOrderEx === '正常')) {
+ isNormal.isTrue = false;
+ isNormal.msg = '订单支付异常';
}
- if (!(order.refundMoneyEx === '正常' || order.refundMoneyEx === '' || order.refundMoneyEx === null)) {
- isNormal = false;
+ else if (!(order.refundMoneyEx === '正常' || order.refundMoneyEx === '' || order.refundMoneyEx === null)) {
+ isNormal.isTrue = false;
+ isNormal.msg = '订单退款金额异常';
}
- if (!(order.refundOrderTimeEx === '正常' || order.refundOrderTimeEx === '' || order.refundOrderTimeEx === null)) {
- isNormal = false;
+ else if (!(order.refundOrderTimeEx === '正常' || order.refundOrderTimeEx === '' || order.refundOrderTimeEx === null)) {
+ isNormal.isTrue = false;
+ isNormal.msg = '订单退款时间异常';
}
- if (!(order.refundOrderEx === '正常' || order.refundOrderEx === '' || order.refundOrderEx === null)) {
- isNormal = false;
+ else if (!(order.refundOrderEx === '正常' || order.refundOrderEx === '' || order.refundOrderEx === null)) {
+ isNormal.isTrue = false;
+ isNormal.msg = '订单退款异常';
}
+ console.log('isNormal', isNormal);
setOrderStatus(isNormal);
}
@@ -70,7 +85,7 @@ export default function Index() {
{
- orderStatus ?
正常订单
:
异常订单
+ orderStatus.isTrue ?
正常订单
:
{orderStatus.msg}
}
From 0e0d286e9a1be93a9059fa8b894f5b736c228bff Mon Sep 17 00:00:00 2001
From: yangwenhua <1289978696@qq.com>
Date: Wed, 29 Jun 2022 16:32:28 +0800
Subject: [PATCH 12/14] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=94=80=E5=94=AE?=
=?UTF-8?q?=E6=88=90=E6=9C=AC=E3=80=81=E9=94=80=E5=94=AE=E6=AF=9B=E5=88=A9?=
=?UTF-8?q?=E3=80=81=E9=97=A8=E5=BA=97=E9=94=80=E5=94=AE=E6=AF=9B=E5=88=A9?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/routes.js | 18 ++
src/pages/order/cost-of-sales/index.jsx | 162 ++++++++++++++++++
src/pages/order/cost-of-sales/index.less | 36 ++++
src/pages/order/cost-of-sales/service.js | 10 ++
.../order/gross-profit-store-sales/index.jsx | 110 ++++++++++++
.../order/gross-profit-store-sales/index.less | 36 ++++
.../order/gross-profit-store-sales/service.js | 10 ++
src/pages/order/sales-gross-profit/index.jsx | 141 +++++++++++++++
src/pages/order/sales-gross-profit/index.less | 36 ++++
src/pages/order/sales-gross-profit/service.js | 10 ++
10 files changed, 569 insertions(+)
create mode 100644 src/pages/order/cost-of-sales/index.jsx
create mode 100644 src/pages/order/cost-of-sales/index.less
create mode 100644 src/pages/order/cost-of-sales/service.js
create mode 100644 src/pages/order/gross-profit-store-sales/index.jsx
create mode 100644 src/pages/order/gross-profit-store-sales/index.less
create mode 100644 src/pages/order/gross-profit-store-sales/service.js
create mode 100644 src/pages/order/sales-gross-profit/index.jsx
create mode 100644 src/pages/order/sales-gross-profit/index.less
create mode 100644 src/pages/order/sales-gross-profit/service.js
diff --git a/config/routes.js b/config/routes.js
index cc29f64..a5c011c 100644
--- a/config/routes.js
+++ b/config/routes.js
@@ -622,6 +622,24 @@ export default [
component: './order/order-member-statement',
access: 'k31',
},
+ {
+ name: '销售成本分析',
+ path: '/order/cost-of-sales',
+ component: './order/cost-of-sales',
+ access: 'k31',
+ },
+ {
+ name: '销售毛利分析',
+ path: '/order/sales-gross-profit',
+ component: './order/sales-gross-profit',
+ access: 'k31',
+ },
+ {
+ name: '门店销售毛利分析',
+ path: '/order/gross-profit-store-sales',
+ component: './order/gross-profit-store-sales',
+ access: 'k31',
+ },
],
},
{
diff --git a/src/pages/order/cost-of-sales/index.jsx b/src/pages/order/cost-of-sales/index.jsx
new file mode 100644
index 0000000..4cc723d
--- /dev/null
+++ b/src/pages/order/cost-of-sales/index.jsx
@@ -0,0 +1,162 @@
+import React, { useState, useEffect } from 'react';
+import { PageContainer } from '@ant-design/pro-layout';
+import { Button, Card, DatePicker, Table, Pagination, Spin, Select } from 'antd';
+import styles from './index.less';
+const { RangePicker } = DatePicker;
+import costSalesAPI from "./service";
+import moment from 'moment';
+
+const columns = [
+ {
+ title: '门店名称',
+ dataIndex: 'storeName',
+ key: 'storeName',
+ },
+ {
+ title: '商品名称',
+ dataIndex: 'goodsName',
+ key: 'storeName',
+ },
+ {
+ title: '销售收入',
+ dataIndex: 'salesRevenue',
+ key: 'salesRevenue',
+ },
+ {
+ title: '销售成本',
+ dataIndex: 'costOfSale',
+ key: 'costOfSale',
+ },
+ {
+ title: '销售数量',
+ dataIndex: 'salesVolumes',
+ key: 'salesVolumes',
+ },
+ {
+ title: '成本率',
+ dataIndex: 'costRate',
+ key: 'costRate',
+ }
+];
+
+const LoadingCard = () => {
+ return (
+
+
+
+ )
+}
+
+const children = [];
+
+for (let i = 10; i < 36; i++) {
+ children.push(
);
+}
+
+/**
+ * 销售成本分析
+ * @returns
+ */
+export default function Index() {
+
+ //订单报表列表
+ const [orderReportList, setOrderReportList] = useState([]);
+ const [current, setCurrent] = useState(1);
+ const [pageSize, setPageSize] = useState(10);
+ const [total, setTotal] = useState(0);
+ const [showLoading, setShowLoading] = useState(false);
+ const [timeRange, setTimeRange] = useState([
+ moment(moment(new Date(Date.now() - 24 * 60 * 60 * 1000 * 7)).format('YYYY-MM-DD 00:00:00')),
+ moment(moment(new Date(Date.now())).format('YYYY-MM-DD 23:59:59')),
+ ]); //日期选择器
+
+ //页码变化
+ const onPageChange = (current, pageSize) => {
+ setCurrent(current);
+ setPageSize(pageSize);
+ }
+
+ //查询
+ const onQueryOrderReportList = () => {
+
+ }
+
+ //选择门店
+ const handleStoreChange = () => {
+
+ }
+
+ return (
+
+ {showLoading ? : null}
+
+
+
+
+
+
+ {
+ 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);
+ }} />
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+}
diff --git a/src/pages/order/cost-of-sales/index.less b/src/pages/order/cost-of-sales/index.less
new file mode 100644
index 0000000..c33fc6a
--- /dev/null
+++ b/src/pages/order/cost-of-sales/index.less
@@ -0,0 +1,36 @@
+.data-search-card {
+ margin-bottom: 20px;
+}
+
+.data-search-box {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+}
+
+.search-btn-item {
+ margin-left: 20px;
+}
+
+.table-page {
+ display: flex;
+ justify-content: flex-end;
+ align-items: center;
+ height: 50px;
+}
+
+// 加载中
+.loading-card {
+ position: fixed;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 100vw;
+ height: 100vh;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ z-index: 999;
+ background-color: rgba(0, 0, 0, 0.5);
+}
\ No newline at end of file
diff --git a/src/pages/order/cost-of-sales/service.js b/src/pages/order/cost-of-sales/service.js
new file mode 100644
index 0000000..11107ef
--- /dev/null
+++ b/src/pages/order/cost-of-sales/service.js
@@ -0,0 +1,10 @@
+import { request } from 'umi';
+
+export default {
+ getOrderReportList(data) {
+ return request(`/kitchen/api/report-statistics/order-report`, {
+ method: 'Post',
+ data: data,
+ });
+ }
+};
diff --git a/src/pages/order/gross-profit-store-sales/index.jsx b/src/pages/order/gross-profit-store-sales/index.jsx
new file mode 100644
index 0000000..6cd88e8
--- /dev/null
+++ b/src/pages/order/gross-profit-store-sales/index.jsx
@@ -0,0 +1,110 @@
+import React, { useState, useEffect } from 'react';
+import { PageContainer } from '@ant-design/pro-layout';
+import { Button, Card, DatePicker, Table, Pagination, Spin, Select } from 'antd';
+import styles from './index.less';
+const { RangePicker } = DatePicker;
+import costSalesAPI from "./service";
+import moment from 'moment';
+
+const columns = [
+ {
+ title: '门店名称',
+ dataIndex: 'storeName',
+ key: 'storeName',
+ },
+ {
+ title: '毛利率',
+ dataIndex: 'grossProfitMargin',
+ key: 'salesRevenue',
+ }
+];
+
+const LoadingCard = () => {
+ return (
+
+
+
+ )
+}
+
+const children = [];
+
+for (let i = 10; i < 36; i++) {
+ children.push(
);
+}
+
+/**
+ * 门店销售毛利分析
+ * @returns
+ */
+export default function Index() {
+
+ //订单报表列表
+ const [orderReportList, setOrderReportList] = useState([]);
+ const [current, setCurrent] = useState(1);
+ const [pageSize, setPageSize] = useState(10);
+ const [total, setTotal] = useState(0);
+ const [showLoading, setShowLoading] = useState(false);
+ const [timeRange, setTimeRange] = useState([
+ moment(moment(new Date(Date.now() - 24 * 60 * 60 * 1000 * 7)).format('YYYY-MM-DD 00:00:00')),
+ moment(moment(new Date(Date.now())).format('YYYY-MM-DD 23:59:59')),
+ ]); //日期选择器
+
+ //页码变化
+ const onPageChange = (current, pageSize) => {
+ setCurrent(current);
+ setPageSize(pageSize);
+ }
+
+ //查询
+ const onQueryOrderReportList = () => {
+
+ }
+
+ //选择门店
+ const handleStoreChange = () => {
+
+ }
+
+ return (
+
+ {showLoading ? : null}
+
+
+
+
+ {
+ 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);
+ }} />
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+}
diff --git a/src/pages/order/gross-profit-store-sales/index.less b/src/pages/order/gross-profit-store-sales/index.less
new file mode 100644
index 0000000..c33fc6a
--- /dev/null
+++ b/src/pages/order/gross-profit-store-sales/index.less
@@ -0,0 +1,36 @@
+.data-search-card {
+ margin-bottom: 20px;
+}
+
+.data-search-box {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+}
+
+.search-btn-item {
+ margin-left: 20px;
+}
+
+.table-page {
+ display: flex;
+ justify-content: flex-end;
+ align-items: center;
+ height: 50px;
+}
+
+// 加载中
+.loading-card {
+ position: fixed;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 100vw;
+ height: 100vh;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ z-index: 999;
+ background-color: rgba(0, 0, 0, 0.5);
+}
\ No newline at end of file
diff --git a/src/pages/order/gross-profit-store-sales/service.js b/src/pages/order/gross-profit-store-sales/service.js
new file mode 100644
index 0000000..11107ef
--- /dev/null
+++ b/src/pages/order/gross-profit-store-sales/service.js
@@ -0,0 +1,10 @@
+import { request } from 'umi';
+
+export default {
+ getOrderReportList(data) {
+ return request(`/kitchen/api/report-statistics/order-report`, {
+ method: 'Post',
+ data: data,
+ });
+ }
+};
diff --git a/src/pages/order/sales-gross-profit/index.jsx b/src/pages/order/sales-gross-profit/index.jsx
new file mode 100644
index 0000000..7d1c768
--- /dev/null
+++ b/src/pages/order/sales-gross-profit/index.jsx
@@ -0,0 +1,141 @@
+import React, { useState, useEffect } from 'react';
+import { PageContainer } from '@ant-design/pro-layout';
+import { Button, Card, DatePicker, Table, Pagination, Spin, Select } from 'antd';
+import styles from './index.less';
+const { RangePicker } = DatePicker;
+import costSalesAPI from "./service";
+import moment from 'moment';
+
+const columns = [
+ {
+ title: '门店名称',
+ dataIndex: 'storeName',
+ key: 'storeName',
+ },
+ {
+ title: '商品名称',
+ dataIndex: 'goodsName',
+ key: 'storeName',
+ },
+ {
+ title: '毛利率',
+ dataIndex: 'grossProfitMargin',
+ key: 'salesRevenue',
+ }
+];
+
+const LoadingCard = () => {
+ return (
+
+
+
+ )
+}
+
+const children = [];
+
+for (let i = 10; i < 36; i++) {
+ children.push(
);
+}
+
+/**
+ * 销售毛利分析
+ * @returns
+ */
+export default function Index() {
+
+ //订单报表列表
+ const [orderReportList, setOrderReportList] = useState([]);
+ const [current, setCurrent] = useState(1);
+ const [pageSize, setPageSize] = useState(10);
+ const [total, setTotal] = useState(0);
+ const [showLoading, setShowLoading] = useState(false);
+ const [timeRange, setTimeRange] = useState([
+ moment(moment(new Date(Date.now() - 24 * 60 * 60 * 1000 * 7)).format('YYYY-MM-DD 00:00:00')),
+ moment(moment(new Date(Date.now())).format('YYYY-MM-DD 23:59:59')),
+ ]); //日期选择器
+
+ //页码变化
+ const onPageChange = (current, pageSize) => {
+ setCurrent(current);
+ setPageSize(pageSize);
+ }
+
+ //查询
+ const onQueryOrderReportList = () => {
+
+ }
+
+ //选择门店
+ const handleStoreChange = () => {
+
+ }
+
+ return (
+
+ {showLoading ? : null}
+
+
+
+
+
+
+ {
+ 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);
+ }} />
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+}
diff --git a/src/pages/order/sales-gross-profit/index.less b/src/pages/order/sales-gross-profit/index.less
new file mode 100644
index 0000000..c33fc6a
--- /dev/null
+++ b/src/pages/order/sales-gross-profit/index.less
@@ -0,0 +1,36 @@
+.data-search-card {
+ margin-bottom: 20px;
+}
+
+.data-search-box {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+}
+
+.search-btn-item {
+ margin-left: 20px;
+}
+
+.table-page {
+ display: flex;
+ justify-content: flex-end;
+ align-items: center;
+ height: 50px;
+}
+
+// 加载中
+.loading-card {
+ position: fixed;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 100vw;
+ height: 100vh;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ z-index: 999;
+ background-color: rgba(0, 0, 0, 0.5);
+}
\ No newline at end of file
diff --git a/src/pages/order/sales-gross-profit/service.js b/src/pages/order/sales-gross-profit/service.js
new file mode 100644
index 0000000..11107ef
--- /dev/null
+++ b/src/pages/order/sales-gross-profit/service.js
@@ -0,0 +1,10 @@
+import { request } from 'umi';
+
+export default {
+ getOrderReportList(data) {
+ return request(`/kitchen/api/report-statistics/order-report`, {
+ method: 'Post',
+ data: data,
+ });
+ }
+};
From a91cf6af2c4f80d316740a9a77eb135b2d500b26 Mon Sep 17 00:00:00 2001
From: yangwenhua <1289978696@qq.com>
Date: Wed, 29 Jun 2022 17:00:00 +0800
Subject: [PATCH 13/14] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=98=BE=E7=A4=BA?=
=?UTF-8?q?=E5=94=AE=E5=90=8E=E4=BF=A1=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/pages/order/order-report/index.jsx | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/pages/order/order-report/index.jsx b/src/pages/order/order-report/index.jsx
index bdf566c..d58951b 100644
--- a/src/pages/order/order-report/index.jsx
+++ b/src/pages/order/order-report/index.jsx
@@ -73,7 +73,26 @@ const columns = [
}
>
)
- }
+ },
+ },
+ {
+ title: '售后信息',
+ key: 'orderStatus',
+ render: (record) => {
+ return (
+ <>
+ {
+ record.isRefund ?
+ 有
+
+ :
+
+ 无
+
+ }
+ >
+ )
+ },
},
{
title: '操作',
@@ -212,7 +231,7 @@ export default function Index() {
sheetName: excelName, //excel文件中sheet页名称
sheetFilter: sheetHeader, //excel文件中需显示的列数据
sheetHeader: ['ID', '取餐号', '用户Id', '优惠合集', '订单号(本系统)',
- '交易号', '店铺ID', '店铺名字', '商品总价','优惠金额', '实付金额',
+ '交易号', '店铺ID', '店铺名字', '商品总价', '优惠金额', '实付金额',
'创建时间', '支付金额异常',
'订单支付时间异常', '订单异常', '售后金额异常', '售后时间异常', '售后订单异常'
] //excel文件中每列的表头名称
From 66ea28cdd51e93b1c5338383ea66f719e519449e Mon Sep 17 00:00:00 2001
From: yangwenhua <1289978696@qq.com>
Date: Thu, 30 Jun 2022 16:09:24 +0800
Subject: [PATCH 14/14] =?UTF-8?q?=E6=88=90=E6=9C=AC=E5=88=86=E6=9E=90?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E7=94=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/pages/order/cost-of-sales/index.jsx | 141 ++++++++++++++----
src/pages/order/cost-of-sales/service.js | 34 ++++-
.../order/gross-profit-store-sales/index.jsx | 83 ++++++++---
.../order/gross-profit-store-sales/service.js | 15 +-
src/pages/order/sales-gross-profit/index.jsx | 140 +++++++++++++----
src/pages/order/sales-gross-profit/service.js | 33 +++-
6 files changed, 363 insertions(+), 83 deletions(-)
diff --git a/src/pages/order/cost-of-sales/index.jsx b/src/pages/order/cost-of-sales/index.jsx
index 4cc723d..f815970 100644
--- a/src/pages/order/cost-of-sales/index.jsx
+++ b/src/pages/order/cost-of-sales/index.jsx
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
-import { Button, Card, DatePicker, Table, Pagination, Spin, Select } from 'antd';
+import { Button, Card, DatePicker, Table, Pagination, Spin, Select, message } from 'antd';
import styles from './index.less';
const { RangePicker } = DatePicker;
import costSalesAPI from "./service";
@@ -9,28 +9,28 @@ import moment from 'moment';
const columns = [
{
title: '门店名称',
- dataIndex: 'storeName',
- key: 'storeName',
+ dataIndex: 'storeId',
+ key: 'storeId',
},
{
title: '商品名称',
- dataIndex: 'goodsName',
- key: 'storeName',
+ dataIndex: 'goodsId',
+ key: 'goodsId',
},
{
title: '销售收入',
- dataIndex: 'salesRevenue',
- key: 'salesRevenue',
+ dataIndex: 'salesPrice',
+ key: 'salesPrice',
},
{
title: '销售成本',
- dataIndex: 'costOfSale',
- key: 'costOfSale',
+ dataIndex: 'costPrice',
+ key: 'costPrice',
},
{
title: '销售数量',
- dataIndex: 'salesVolumes',
- key: 'salesVolumes',
+ dataIndex: 'salesNum',
+ key: 'salesNum',
},
{
title: '成本率',
@@ -47,12 +47,6 @@ const LoadingCard = () => {
)
}
-const children = [];
-
-for (let i = 10; i < 36; i++) {
- children.push(
);
-}
-
/**
* 销售成本分析
* @returns
@@ -60,7 +54,7 @@ for (let i = 10; i < 36; i++) {
export default function Index() {
//订单报表列表
- const [orderReportList, setOrderReportList] = useState([]);
+ const [costSalesData, setCostSalesData] = useState([]);
const [current, setCurrent] = useState(1);
const [pageSize, setPageSize] = useState(10);
const [total, setTotal] = useState(0);
@@ -69,6 +63,15 @@ export default function Index() {
moment(moment(new Date(Date.now() - 24 * 60 * 60 * 1000 * 7)).format('YYYY-MM-DD 00:00:00')),
moment(moment(new Date(Date.now())).format('YYYY-MM-DD 23:59:59')),
]); //日期选择器
+ //门店
+ const [storeIdArray, setStoreIdArray] = useState([]);
+ const [storeSelect, setStoreSelect] = useState([]);
+ //商品
+ const [goodsIdArray, setGoodsIdArray] = useState([]);
+ const [goodsIdSelect, setGoodsIdSelect] = useState([]);
+ //商品类型
+ const [goodsTypeArray, setGoodsTypeArray] = useState([]);
+ const [goodsTypeSelect, setGoodsTypeSelect] = useState([]);
//页码变化
const onPageChange = (current, pageSize) => {
@@ -77,15 +80,77 @@ export default function Index() {
}
//查询
- const onQueryOrderReportList = () => {
+ const onQueryReportSalescost = async () => {
+ const jsonData = {
+ "storeId": storeIdArray,
+ "goodsId": goodsIdArray,
+ "goodsTypeId": goodsTypeArray,
+ "begintime": timeRange[0],
+ "endtime": timeRange[1],
+ current,
+ pageSize
+ }
+ setShowLoading(true);
+ const response = await costSalesAPI.getReportSalescost({});
+ setShowLoading(false);
+ if (response.statusCode === 200) {
+ setCostSalesData(response.data.data);
+ } else {
+ message.error(response.errors || '获取销售成本失败');
+ }
+ }
+ /**
+ * 查询店铺列表
+ */
+ const onQueryStoreList = async () => {
+ setShowLoading(true);
+ 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);
+ } else {
+ message.error('查询店铺列表失败');
+ }
}
- //选择门店
- const handleStoreChange = () => {
+ //查询商品列表
+ const onQueryGoodsList = async () => {
+ setShowLoading(true);
+ const response = await costSalesAPI.goodsList({});
+ setShowLoading(false);
+ if (response.statusCode === 200) {
+ setGoodsIdSelect(response.data);
+ } else {
+ message.error('查询商品列表失败');
+ }
+ }
+ //查询商品分类类型列表
+ const onQueryGoodsType = async () => {
+ setShowLoading(true);
+ const response = await costSalesAPI.goodsTypeList({});
+ setShowLoading(false);
+ if (response.statusCode === 200) {
+ setGoodsTypeSelect(response.data);
+ } else {
+ message.error('查询商品分类列表失败');
+ }
}
+ useEffect(() => {
+ onQueryReportSalescost();
+ onQueryStoreList();
+ onQueryGoodsList();
+ onQueryGoodsType();
+ }, []);
+
return (
{showLoading ? : null}
@@ -98,14 +163,20 @@ export default function Index() {
size="middle"
allowClear
placeholder="请选择门店"
- onChange={handleStoreChange}
+ onChange={(values) => setStoreIdArray(values)}
filterOption={(input, option) => option.children.toLowerCase().includes(input.toLowerCase())}
style={{
width: '300px',
marginRight: '50px'
}}
>
- {children}
+ {
+ storeSelect.map( (item) => {
+ return (
+
+ )
+ })
+ }
{
let tempDate = [
@@ -147,12 +230,12 @@ export default function Index() {
-
+
-
+
diff --git a/src/pages/order/cost-of-sales/service.js b/src/pages/order/cost-of-sales/service.js
index 11107ef..bb2fdb4 100644
--- a/src/pages/order/cost-of-sales/service.js
+++ b/src/pages/order/cost-of-sales/service.js
@@ -1,10 +1,40 @@
import { request } from 'umi';
export default {
- getOrderReportList(data) {
- return request(`/kitchen/api/report-statistics/order-report`, {
+ getReportSalescost(data) {
+ return request(`/kitchen/api/report/salescost`, {
method: 'Post',
data: data,
});
+ },
+ /**
+ * 查询商品信息
+ */
+ goodsList(data) {
+ return request(`/kitchen/api/goodes/list`, {
+ method: 'Post',
+ data: data,
+ });
+ },
+ /**
+ * 查询商品类型
+ */
+ goodsTypeList(data) {
+ return request(`/kitchen/api/goodstype/list`, {
+ method: 'Post',
+ data: data,
+ });
+ },
+
+ /**
+ * 查询门店列表
+ */
+ gettree(params) {
+ return request('/kitchen/api/sysOrg/tree', {
+ data: {
+ ...params,
+ },
+ });
}
+
};
diff --git a/src/pages/order/gross-profit-store-sales/index.jsx b/src/pages/order/gross-profit-store-sales/index.jsx
index 6cd88e8..5d5b1f7 100644
--- a/src/pages/order/gross-profit-store-sales/index.jsx
+++ b/src/pages/order/gross-profit-store-sales/index.jsx
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
-import { Button, Card, DatePicker, Table, Pagination, Spin, Select } from 'antd';
+import { Button, Card, DatePicker, Table, Pagination, Spin, Select, message } from 'antd';
import styles from './index.less';
const { RangePicker } = DatePicker;
import costSalesAPI from "./service";
@@ -9,13 +9,13 @@ import moment from 'moment';
const columns = [
{
title: '门店名称',
- dataIndex: 'storeName',
- key: 'storeName',
+ dataIndex: 'storeId',
+ key: 'storeId',
},
{
title: '毛利率',
- dataIndex: 'grossProfitMargin',
- key: 'salesRevenue',
+ dataIndex: 'marginRatio',
+ key: 'marginRatio',
}
];
@@ -27,12 +27,6 @@ const LoadingCard = () => {
)
}
-const children = [];
-
-for (let i = 10; i < 36; i++) {
- children.push();
-}
-
/**
* 门店销售毛利分析
* @returns
@@ -40,7 +34,7 @@ for (let i = 10; i < 36; i++) {
export default function Index() {
//订单报表列表
- const [orderReportList, setOrderReportList] = useState([]);
+ const [costSalesData, setCostSalesData] = useState([]);
const [current, setCurrent] = useState(1);
const [pageSize, setPageSize] = useState(10);
const [total, setTotal] = useState(0);
@@ -49,6 +43,9 @@ export default function Index() {
moment(moment(new Date(Date.now() - 24 * 60 * 60 * 1000 * 7)).format('YYYY-MM-DD 00:00:00')),
moment(moment(new Date(Date.now())).format('YYYY-MM-DD 23:59:59')),
]); //日期选择器
+ //门店
+ const [storeIdArray, setStoreIdArray] = useState([]);
+ const [storeSelect, setStoreSelect] = useState([]);
//页码变化
const onPageChange = (current, pageSize) => {
@@ -57,33 +54,75 @@ export default function Index() {
}
//查询
- const onQueryOrderReportList = () => {
-
+ const onQueryReportSalescost = async () => {
+ const jsonData = {
+ "storeId": storeIdArray,
+ "begintime": timeRange[0],
+ "endtime": timeRange[1],
+ current,
+ pageSize
+ }
+ setShowLoading(true);
+ const response = await costSalesAPI.getReportOrgsalesmargin({});
+ setShowLoading(false);
+ if (response.statusCode === 200) {
+ setCostSalesData(response.data.data);
+ } else {
+ message.error(response.errors || '获取销售成本失败');
+ }
}
- //选择门店
- const handleStoreChange = () => {
-
+ /**
+ * 查询店铺列表
+ */
+ const onQueryStoreList = async () => {
+ setShowLoading(true);
+ 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);
+ } else {
+ message.error('查询店铺列表失败');
+ }
}
+ useEffect(() => {
+ onQueryReportSalescost();
+ onQueryStoreList();
+ }, []);
+
return (
{showLoading ? : null}
-
{
let tempDate = [
@@ -95,12 +134,12 @@ export default function Index() {
-
+
-
+
diff --git a/src/pages/order/gross-profit-store-sales/service.js b/src/pages/order/gross-profit-store-sales/service.js
index 11107ef..d25abba 100644
--- a/src/pages/order/gross-profit-store-sales/service.js
+++ b/src/pages/order/gross-profit-store-sales/service.js
@@ -1,10 +1,21 @@
import { request } from 'umi';
export default {
- getOrderReportList(data) {
- return request(`/kitchen/api/report-statistics/order-report`, {
+ getReportOrgsalesmargin(data) {
+ return request(`/kitchen/api/report/orgsalesmargin`, {
method: 'Post',
data: data,
});
+ },
+
+ /**
+ * 查询门店列表
+ */
+ gettree(params) {
+ return request('/kitchen/api/sysOrg/tree', {
+ data: {
+ ...params,
+ },
+ });
}
};
diff --git a/src/pages/order/sales-gross-profit/index.jsx b/src/pages/order/sales-gross-profit/index.jsx
index 7d1c768..6ef8a2a 100644
--- a/src/pages/order/sales-gross-profit/index.jsx
+++ b/src/pages/order/sales-gross-profit/index.jsx
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
-import { Button, Card, DatePicker, Table, Pagination, Spin, Select } from 'antd';
+import { Button, Card, DatePicker, Table, Pagination, Spin, Select, message } from 'antd';
import styles from './index.less';
const { RangePicker } = DatePicker;
import costSalesAPI from "./service";
@@ -9,18 +9,18 @@ import moment from 'moment';
const columns = [
{
title: '门店名称',
- dataIndex: 'storeName',
- key: 'storeName',
+ dataIndex: 'storeId',
+ key: 'storeId',
},
{
title: '商品名称',
- dataIndex: 'goodsName',
- key: 'storeName',
+ dataIndex: 'goodsId',
+ key: 'goodsId',
},
{
title: '毛利率',
- dataIndex: 'grossProfitMargin',
- key: 'salesRevenue',
+ dataIndex: 'marginRatio',
+ key: 'marginRatio',
}
];
@@ -32,12 +32,6 @@ const LoadingCard = () => {
)
}
-const children = [];
-
-for (let i = 10; i < 36; i++) {
- children.push();
-}
-
/**
* 销售毛利分析
* @returns
@@ -45,7 +39,7 @@ for (let i = 10; i < 36; i++) {
export default function Index() {
//订单报表列表
- const [orderReportList, setOrderReportList] = useState([]);
+ const [costSalesData, setCostSalesData] = useState([]);
const [current, setCurrent] = useState(1);
const [pageSize, setPageSize] = useState(10);
const [total, setTotal] = useState(0);
@@ -54,6 +48,15 @@ export default function Index() {
moment(moment(new Date(Date.now() - 24 * 60 * 60 * 1000 * 7)).format('YYYY-MM-DD 00:00:00')),
moment(moment(new Date(Date.now())).format('YYYY-MM-DD 23:59:59')),
]); //日期选择器
+ //门店
+ const [storeIdArray, setStoreIdArray] = useState([]);
+ const [storeSelect, setStoreSelect] = useState([]);
+ //商品
+ const [goodsIdArray, setGoodsIdArray] = useState([]);
+ const [goodsIdSelect, setGoodsIdSelect] = useState([]);
+ //商品类型
+ const [goodsTypeArray, setGoodsTypeArray] = useState([]);
+ const [goodsTypeSelect, setGoodsTypeSelect] = useState([]);
//页码变化
const onPageChange = (current, pageSize) => {
@@ -62,59 +65,144 @@ export default function Index() {
}
//查询
- const onQueryOrderReportList = () => {
+ const onQueryReportSalescost = async () => {
+ const jsonData = {
+ "storeId": storeIdArray,
+ "goodsId": goodsIdArray,
+ "goodsTypeId": goodsTypeArray,
+ "begintime": timeRange[0],
+ "endtime": timeRange[1],
+ current,
+ pageSize
+ }
+ setShowLoading(true);
+ const response = await costSalesAPI.getReportSalesmargin({});
+ setShowLoading(false);
+ if (response.statusCode === 200) {
+ setCostSalesData(response.data.data);
+ } else {
+ message.error(response.errors || '获取销售成本失败');
+ }
+ }
+ /**
+ * 查询店铺列表
+ */
+ const onQueryStoreList = async () => {
+ setShowLoading(true);
+ 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);
+ } else {
+ message.error('查询店铺列表失败');
+ }
}
- //选择门店
- const handleStoreChange = () => {
+ //查询商品列表
+ const onQueryGoodsList = async () => {
+ setShowLoading(true);
+ const response = await costSalesAPI.goodsList({});
+ setShowLoading(false);
+ if (response.statusCode === 200) {
+ setGoodsIdSelect(response.data);
+ } else {
+ message.error('查询商品列表失败');
+ }
+ }
+ //查询商品分类类型列表
+ const onQueryGoodsType = async () => {
+ setShowLoading(true);
+ const response = await costSalesAPI.goodsTypeList({});
+ setShowLoading(false);
+ if (response.statusCode === 200) {
+ setGoodsTypeSelect(response.data);
+ } else {
+ message.error('查询商品分类列表失败');
+ }
}
+ useEffect(() => {
+ onQueryReportSalescost();
+ onQueryStoreList();
+ onQueryGoodsList();
+ onQueryGoodsType();
+ }, []);
return (
{showLoading ? : null}
-
{
let tempDate = [
@@ -126,12 +214,12 @@ export default function Index() {
-
+
-
+
diff --git a/src/pages/order/sales-gross-profit/service.js b/src/pages/order/sales-gross-profit/service.js
index 11107ef..7537b2e 100644
--- a/src/pages/order/sales-gross-profit/service.js
+++ b/src/pages/order/sales-gross-profit/service.js
@@ -1,10 +1,39 @@
import { request } from 'umi';
export default {
- getOrderReportList(data) {
- return request(`/kitchen/api/report-statistics/order-report`, {
+ getReportSalesmargin(data) {
+ return request(`/kitchen/api/report/salesmargin`, {
method: 'Post',
data: data,
});
+ },
+ /**
+ * 查询商品信息
+ */
+ goodsList(data) {
+ return request(`/kitchen/api/goodes/list`, {
+ method: 'Post',
+ data: data,
+ });
+ },
+ /**
+ * 查询商品类型
+ */
+ goodsTypeList(data) {
+ return request(`/kitchen/api/goodstype/list`, {
+ method: 'Post',
+ data: data,
+ });
+ },
+
+ /**
+ * 查询门店列表
+ */
+ gettree(params) {
+ return request('/kitchen/api/sysOrg/tree', {
+ data: {
+ ...params,
+ },
+ });
}
};