From 4861cc9eb9f466eb9aa8d05ecb69de3d454b608a Mon Sep 17 00:00:00 2001 From: xuan Date: Thu, 13 Oct 2022 19:40:53 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(=E9=94=80=E5=94=AE=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1):=20=E6=96=B0=E5=A2=9E=E6=8E=92=E8=A1=8C=E6=8C=87?= =?UTF-8?q?=E6=A0=87=E7=AD=9B=E9=80=89=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.ts | 11 +- src/api/statistic/index.ts | 2 +- src/api/statistic/saleStatistic.ts | 22 +- .../SelectSaleRankingIndicators/index.tsx | 4 +- src/pages/saleStatistic/index.tsx | 644 ++++++++++-------- 5 files changed, 397 insertions(+), 286 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index c9504df..1192e7f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -38,7 +38,16 @@ export { } from './takeDelivery/index' // 关于销售统计 -export { EnumMarketingDepartmentApi, EnumSalesTypeApi, SalesmanRankApi, ProductRankApi, PurchaserRankApi, SupplierRankApi, CensusApi } from './statistic/index' +export { + EnumMarketingDepartmentApi, + EnumSalesTypeApi, + SalesmanRankApi, + ProductRankApi, + PurchaserRankApi, + SupplierRankApi, + SaleOrderDataFormdataFormStatus, + SaleOrderDataFormApi, +} from './statistic/index' import { useRequest } from '@/use/useHttp' /** diff --git a/src/api/statistic/index.ts b/src/api/statistic/index.ts index a97bcaf..af5f463 100644 --- a/src/api/statistic/index.ts +++ b/src/api/statistic/index.ts @@ -1,2 +1,2 @@ export { EnumSalesTypeApi, EnumMarketingDepartmentApi } from './enum' -export { CensusApi, ProductRankApi, PurchaserRankApi, SupplierRankApi, SalesmanRankApi } from './saleStatistic' +export { SaleOrderDataFormdataFormStatus, SaleOrderDataFormApi, ProductRankApi, PurchaserRankApi, SupplierRankApi, SalesmanRankApi } from './saleStatistic' diff --git a/src/api/statistic/saleStatistic.ts b/src/api/statistic/saleStatistic.ts index a78ca82..da68312 100644 --- a/src/api/statistic/saleStatistic.ts +++ b/src/api/statistic/saleStatistic.ts @@ -1,14 +1,14 @@ import { useRequest } from '@/use/useHttp' /** - * 客户列表 - * @returns + * 销售统计数据 + * @returns */ -export const CensusApi = () => { - return useRequest({ - url: `/v1/mp/saleOrderDataForm`, - method: "get" - }) +export const SaleOrderDataFormApi = () => { + return useRequest({ + url: `/v1/mp/saleOrderDataForm`, + method: 'get', + }) } /** @@ -54,3 +54,11 @@ export const SalesmanRankApi = () => { method: 'get', }) } + +//获取排行指标枚举 +export const SaleOrderDataFormdataFormStatus = () => { + return useRequest({ + url: `/v1/mp/saleOrderDataForm/dataFormStatus`, + method: 'get', + }) +} diff --git a/src/components/SelectSaleRankingIndicators/index.tsx b/src/components/SelectSaleRankingIndicators/index.tsx index 8770dc5..9417fdb 100644 --- a/src/components/SelectSaleRankingIndicators/index.tsx +++ b/src/components/SelectSaleRankingIndicators/index.tsx @@ -1,7 +1,7 @@ import { FC, useEffect, useMemo, useState } from 'react' import DropDownItem from '../dropDown-item' import FilterButton from '../filterButton' -import { EnumMarketingDepartmentApi } from '@/api/index' +import { SaleOrderDataFormdataFormStatus } from '@/api/index' import { View } from '@tarojs/components' import styles from './index.module.scss' import classnames from 'classnames' @@ -24,7 +24,7 @@ const SelectSaleRankingIndicators: FC = props => { const { onChange } = props console.log(props) - const { fetchData } = EnumMarketingDepartmentApi() + const { fetchData } = SaleOrderDataFormdataFormStatus() const getData = async () => { const res = await fetchData() diff --git a/src/pages/saleStatistic/index.tsx b/src/pages/saleStatistic/index.tsx index 9a93d48..965a2de 100644 --- a/src/pages/saleStatistic/index.tsx +++ b/src/pages/saleStatistic/index.tsx @@ -1,7 +1,7 @@ -import AtCalendar from '@/components/calendar' +import { SaleOrderDataFormApi } from '@/api/statistic/saleStatistic' +import { getFilterData } from '@/common/util' import Cell from '@/components/cell' import Divider from '@/components/Divider' -import DropDownItem, { DropDownOptions } from '@/components/dropDown-item' import Iconfont from '@/components/iconfont/iconfont' import LayoutBlock from '@/components/layoutBlock' import SelectMarketingDepartment from '@/components/SelectMarketingDepartment' @@ -9,136 +9,295 @@ import SelectSaleRankingIndicators from '@/components/SelectSaleRankingIndicator import SelectSaleType from '@/components/SelectSaleType' import SelectTimePicker, { ChangedValue } from '@/components/SelectTimePicker' import Table from '@/components/table' -import TimePicker from '@/components/timePicker' import ToolTip from '@/components/toolTips' import { View, Text } from '@tarojs/components' +import { useDidShow } from '@tarojs/taro' import classnames from 'classnames' -import dayjs from 'dayjs' -import { useState } from 'react' +import { useCallback, useState } from 'react' import styles from './index.module.scss' +//需要传进来的数据示例 +const exampledataSource = [ + { + key: '1', + username: '小红', + count: '123打发手动阀手动阀啊手动阀', + gb: '321', + dbd: '¥6634.93w', + }, + { + key: '2', + username: '小红', + count: '123', + gb: '321', + dbd: '¥6634.93w', + }, + { + key: '3', + username: '小红', + count: '123', + gb: '321', + dbd: '¥6634.93w', + }, + { + key: '4', + username: '小红', + count: '123', + gb: '321', + dbd: '¥6634.93w', + }, + { + key: '5', + username: '小红', + count: '123', + gb: '321', + dbd: '¥6634.93w', + }, + { + key: '6', + username: '小红', + count: '123', + gb: '321', + dbd: '¥6634.93w', + }, + { + key: '7', + username: '小红', + count: '123', + gb: '321', + dbd: '¥6634.93w', + }, + { + key: '8', + username: '小红', + count: '123', + gb: '321', + dbd: '¥6634.93w', + }, + { + key: '9', + username: '小红', + count: '123', + gb: '321', + dbd: '¥6634.93w', + }, + { + key: '10', + username: '小红', + count: '123', + gb: '321', + dbd: '¥6634.93w', + }, +] + +//需要传进来的表头数据示例 +const examplecolumns = [ + { + key: 'username', + title: '编号', + dataIndex: 'username', + width: '20%', + }, + { + key: 'count', + title: '面料名称', + dataIndex: 'count', + width: '20%', + ellipsis: { + isEllipsis: true, + rows: 2, + }, + }, + { + key: 'gb', + title: '匹数', + dataIndex: 'gb', + width: '30%', + }, + { + key: 'dbd', + title: '交易金额', + dataIndex: 'dbd', + width: '30%', + render: (text: string) => {text}, + }, +] +// 销售统计 const saleStatistic = () => { - const onChangeTimePicker = (value: ChangedValue) => { + // 订单 + const OrderForm = { + summary: { + summaryTitle: '订单总数', + tips: '已成功下单的总单数', + value: '51321', + total: '231231', + }, + form: { + processing_order_number: { + cellTitle: '待配布订单', + tips: '已经预约和正在配布的订单数', + value: '5132', + }, + processed_order_number: { + cellTitle: '已配布订单', + tips: '所有配完布、已批准发货、已经发货的订单总单数', + value: '564651', + }, + }, + } + // 配布 + const ArrangedForm = { + summary: { + summaryTitle: '已配布匹数', + tips: '所有配完布、已批准发货、已经发货的订单总匹数', + value: '53453', + total: '456345', + }, + form: { + wait_collect_order_number: { + cellTitle: '待收款单数', + tips: '已配完布但未批准发货的所有订单总单数', + value: '45634', + }, + wait_collect_number: { + cellTitle: '待收款匹数', + tips: '已配完布但未批准发货的所有订单总匹数', + value: '463', + }, + wait_collect_amount_sum: { + cellTitle: '待收款金额', + tips: '已配完布但未批准发货的所有订单总金额', + value: '4563', + }, + not_shipped_order_number: { + cellTitle: '待发货单数', + tips: '已批准发货但未发货出库的所有订单总单数', + value: '4563', + }, + not_shipped_number: { + cellTitle: '待发货匹数', + tips: '已批准发货但未发货出库的所有订单总匹数', + value: '4563', + }, + not_shipped_amount_sum: { + cellTitle: '待发货金额', + tips: '已批准发货但未发货出库的所有订单总金额', + value: '4563', + }, + shipped_order_number: { + cellTitle: '已发货单数', + tips: '已经发货出库的所有订单总单数', + value: '4563', + }, + shipped_number: { + cellTitle: '已发货匹数', + tips: '已经发货出库的所有订单总匹数', + value: '463', + }, + shipped_amount_sum: { + cellTitle: '已发货金额', + tips: '已经发货出库的所有订单总金额', + value: '4563', + }, + }, + } + // 货款 + const paymentAmountForm = { + summary: { + summaryTitle: '货款金额', + tips: '已经发货出库的所有订单总金额', + value: '456345', + total: '45634', + }, + form: { + amount_unreceived_sum: { + cellTitle: '未收金额', + tips: '已经批准发货出库但未收到货款的所有订单总金额', + value: '4563', + }, + amount_received_sum: { + cellTitle: '已收金额', + tips: '已收且已经发货出库的所有订单总金额', + value: '4563', + }, + }, + } + // 退货 + const ReturnGoodsOrderForm = { + summary: { + summaryTitle: '退货单数', + tips: '已经完成退货入库的退货单总单数', + value: '4563', + total: '4563', + }, + form: { + return_goods_number: { + cellTitle: '退货匹数', + tips: '已经完成退货入库的退货单总匹数', + value: '4563', + }, + return_amount_sum: { + cellTitle: '退货金额', + tips: '已经完成退货入库的退货单总金额', + value: '4563', + }, + }, + } + + const { fetchData } = SaleOrderDataFormApi() + + const [saleType, setSaleType] = useState(null) + const [saleDepartmentId, setSaleDepartmentId] = useState(null) + const [dateRange, setDateRange] = useState({ + date_min: '', + date_max: '', + }) + + const getData = async () => { + // console.log( + // 'getFilterData', + // getFilterData({ + // sale_type: saleType, + // sale_department_id: saleDepartmentId, + // date_min: dateRange.date_min, + // date_max: dateRange.date_max, + // }), + // ) + // const res = await fetchData(getFilterData({ + // sale_type: saleType, + // sale_department_id: saleDepartmentId, + // date_min: dateRange.date_min, + // date_max: dateRange.date_max, + // })) + // if(res.data){ + + // } + } + + useDidShow(()=>{ + getData() + }) + + const onChangeTimePicker = useCallback((value: ChangedValue) => { console.log(value) - } - const onChangeSaleType = (saleType: number) => { + setDateRange({ + date_max: value[0], + date_min: value[1], + }) + }, []) + const onChangeSaleType = useCallback((saleType: number) => { console.log('saleType', saleType) - } - const onChangeDepartment = (department: number) => { + setSaleType(saleType) + }, []) + const onChangeDepartment = useCallback((department: number) => { console.log('department', department) - } + setSaleDepartmentId(department) + }, []) const onChangeIndicators = (indicators: number) => { console.log('indicators', indicators) } - //需要传进来的数据示例 - const exampledataSource = [ - { - key: '1', - username: '小红', - count: '123打发手动阀手动阀啊手动阀', - gb: '321', - dbd: '¥6634.93w', - }, - { - key: '2', - username: '小红', - count: '123', - gb: '321', - dbd: '¥6634.93w', - }, - { - key: '3', - username: '小红', - count: '123', - gb: '321', - dbd: '¥6634.93w', - }, - { - key: '4', - username: '小红', - count: '123', - gb: '321', - dbd: '¥6634.93w', - }, - { - key: '5', - username: '小红', - count: '123', - gb: '321', - dbd: '¥6634.93w', - }, - { - key: '6', - username: '小红', - count: '123', - gb: '321', - dbd: '¥6634.93w', - }, - { - key: '7', - username: '小红', - count: '123', - gb: '321', - dbd: '¥6634.93w', - }, - { - key: '8', - username: '小红', - count: '123', - gb: '321', - dbd: '¥6634.93w', - }, - { - key: '9', - username: '小红', - count: '123', - gb: '321', - dbd: '¥6634.93w', - }, - { - key: '10', - username: '小红', - count: '123', - gb: '321', - dbd: '¥6634.93w', - }, - ] - - //需要传进来的表头数据示例 - const examplecolumns = [ - { - key: 'username', - title: '编号', - dataIndex: 'username', - width: '20%', - }, - { - key: 'count', - title: '面料名称', - dataIndex: 'count', - width: '20%', - ellipsis: { - isEllipsis: true, - rows: 2, - }, - }, - { - key: 'gb', - title: '匹数', - dataIndex: 'gb', - width: '30%', - }, - { - key: 'dbd', - title: '交易金额', - dataIndex: 'dbd', - width: '30%', - render: (text: string) => {text}, - }, - ] - const tabsConfig = [ { name: '面料', @@ -178,33 +337,31 @@ const saleStatistic = () => { - + - 订单总数 + {OrderForm.summary.summaryTitle} - 3425 - (共432423匹) + {OrderForm.summary.value} + (共 {OrderForm.summary.total} 匹) - - 待配布订单 - - - } - desc={'323'} - customClassName={styles['cell-desc']}> - - 已配布订单 - - - } - desc={'2972'} - customClassName={styles['cell-desc']}> + {Object.entries(OrderForm.form).map(([key, value]) => { + return ( + + + {value.cellTitle} + + + + } + desc={value.value} + customClassName={styles['cell-desc']}> + ) + })} @@ -213,96 +370,34 @@ const saleStatistic = () => { - - 已配布匹数 - - - 3425 - (共计 ¥231.23w) + + + {ArrangedForm.summary.summaryTitle} + + + + {ArrangedForm.summary.value} + (共计 {ArrangedForm.summary.total}) - - 待收款单数 - - - } - desc={'323'} - customClassName={styles['cell-desc']}> - - 待收款匹数 - - - } - desc={'2972'} - customClassName={styles['cell-desc']}> - - 待收款金额 - - - } - desc={'2972'} - customClassName={styles['cell-desc']}> - - - 待发货单数 - - - } - desc={'323'} - customClassName={styles['cell-desc']}> - - 待发货匹数 - - - } - desc={'2972'} - customClassName={styles['cell-desc']}> - - 待发货金额 - - - } - desc={'2972'} - customClassName={styles['cell-desc']}> - - - 已发货单数 - - - } - desc={'2972'} - customClassName={styles['cell-desc']}> - - 已发货匹数 - - - } - desc={'2972'} - customClassName={styles['cell-desc']}> - - 已发货金额 - - - } - desc={'2972'} - customClassName={styles['cell-desc']}> + {Object.entries(ArrangedForm.form).map(([key, value], index) => { + return ( + <> + + + {value.cellTitle} + + + + } + desc={value.value} + customClassName={styles['cell-desc']}> + {(index + 1) % 3 === 0 && } + + ) + })} @@ -311,30 +406,29 @@ const saleStatistic = () => { - - 货款金额 - - - 56133.32 + + + {paymentAmountForm.summary.summaryTitle} + + + - - 未收金额 - - - } - desc={'2972'} - customClassName={styles['cell-desc']}> - - 已收金额 - - - } - desc={'2972'} - customClassName={styles['cell-desc']}> + {Object.entries(paymentAmountForm.form).map(([key, value]) => { + return ( + + + {value.cellTitle} + + + + } + desc={value.value} + customClassName={styles['cell-desc']}> + ) + })} @@ -343,30 +437,30 @@ const saleStatistic = () => { - - 退货单数 - - - 42 + + + {ReturnGoodsOrderForm.summary.summaryTitle} + + + + {ReturnGoodsOrderForm.summary.value} - - 退货匹数 - - - } - desc={'2972'} - customClassName={styles['cell-desc']}> - - 退货金额 - - - } - desc={'2972'} - customClassName={styles['cell-desc']}> + {Object.entries(ReturnGoodsOrderForm.form).map(([key, value]) => { + return ( + + + {value.cellTitle} + + + + } + desc={value.value} + customClassName={styles['cell-desc']}> + ) + })} {/* 销售排行 */}