import './ItemDetail.less' import closeIcon from '@/assets/brand/closeIcon.png' import { Button, Col, DatePicker, Drawer, Row, Spin, Image, Upload, Popconfirm, message, Modal, Input } from "antd"; import React, { useEffect, useImperativeHandle, useRef, useState } from "react"; import type { tabType } from "@/pages/DataVerification/list/data"; import ProForm, { ProFormText, ProFormTextArea } from "@ant-design/pro-form"; import Dragger from "antd/es/upload/Dragger"; import { InboxOutlined } from "@ant-design/icons"; import ProTable from "@ant-design/pro-table"; import PayDetail from "@/pages/DataVerification/list/components/PayDetail"; import FlowFlush from "@/pages/DataVerification/list/components/FlowFlush"; import allRealMoney from '@/assets/DataVerification/allRealMoney.png' import north from '@/assets/DataVerification/north.png' import south from '@/assets/DataVerification/south.png' import west from '@/assets/DataVerification/west.png' import east from '@/assets/DataVerification/east.png' import waitCheck from '@/assets/DataVerification/waitCheck.png' import activeWaitCheck from '@/assets/DataVerification/activeWaitCheck.png' import successCheck from '@/assets/DataVerification/successCheck.png' import activeSuccessCheck from '@/assets/DataVerification/activeSuccessCheck.png' import billBasic from '@/assets/DataVerification/billBasic.png' import billSale from '@/assets/DataVerification/billSale.png' import billCheck from '@/assets/DataVerification/billCheck.png' import auditFeedback from '@/assets/DataVerification/auditFeedback.png' import productDataImg from '@/assets/DataVerification/productData.png' import mobilePay from '@/assets/DataVerification/mobilePay.png' import upLoad from '@/assets/DataVerification/upLoad.png' import fixed from '@/assets/DataVerification/fixed.png' import noData from '@/assets/DataVerification/noData.svg' import defaultIcon from '@/assets/brand/defaultIcon.png' import moment from "moment/moment"; import { handleDetailList, handleDetail, handleBrandDetailList, handleGetShopData, handleGetPictureList, handleSaveEndAccount, handleSaveAddShopData, handleExamine } from "@/pages/DataVerification/list/service"; import ReportDetail from "@/pages/DataVerification/list/components/reportDetail"; import { uploadFile } from "@/pages/supplier/supplierList/service"; import ProductData from "@/pages/DataVerification/list/components/ProductData"; import AuditDetail from "@/pages/DataVerification/list/components/auditDetail"; import DetailBasicInfo from './detailBasicInfo'; const { REACT_APP_ENV } = process.env; const ItemDetail: React.FC<{ currentItem?: any, showDetail?: any, currentRow?: any, searchTimeParent?: any, currentUser: any, onRef?: any, handleKnowChildrenTabChange: any, pageVersion?: any }> = ({ currentItem, showDetail, currentRow, searchTimeParent, currentUser, onRef, handleKnowChildrenTabChange, pageVersion }) => { const formRef = useRef() const examineForm = useRef() const flowFlushBigRef = useRef() const auditDetailRef = useRef() const productDataRef = useRef() const { RangePicker } = DatePicker; const [selectTab, setSelectTab] = useState(1) const [payDetail, setPayDetail] = useState(false)// 支付明细的抽屉 const [flowFlush, setFlowFlush] = useState(false) const [tabList, setTabList] = useState([ { label: '待我校验', icon: waitCheck, selectIcon: activeWaitCheck, number: 0, value: 1 }, { label: '我已校验', icon: successCheck, selectIcon: activeSuccessCheck, number: 0, value: 2 }]) const [searchTime, setSearchTime] = useState(searchTimeParent || [moment().subtract(1, 'day'), moment().subtract(1, 'day')]) const [leftTimeAllList, setLeftTimeAllList] = useState() const [showChangeLoading, setShowChangeLoading] = useState(false)// 切换左侧页面 相信信息的的loading const [leftTimeList, setLeftTimeList] = useState()// 左侧时间列表 const [selectLeftTime, setSelectLeftTime] = useState() const [currentDetail, setCurrentDetail] = useState() const [topDetail, setTopDetail] = useState() // 审核悬浮框 const [examineModal, setExamineModal] = useState(false) // 上传文件的悬浮框 const [upLoadModal, setUpLoadModal] = useState(false) // 禁用操作按钮 const [disableBtn, setDisableBtn] = useState(true) // 稽查反馈的列表数据 const [auditTableData, setAuditTableData] = useState() // 稽查反馈的抽屉 const [showAuditDrawer, setShowAuditDrawer] = useState(false) // 稽查反馈点击的那行数据 const [auditRowDetail, setAuditRowDetail] = useState() // 添加单品 const [productsDrawer, setProductsDrawer] = useState(false) // 文件列表 const [fileList, setFileList] = useState() const columns: any = [ { dataIndex: 'Check_Info', title: '稽核反馈', }, { dataIndex: 'Error_Rate', title: '稽核误差率', render: (_, record) => { return 0.2 ? 'red' : '' }}>{`${record.Error_Rate}%`} } }, { dataIndex: 'Difference_Amount', title: '长短款/流水冲正', render: (_, record) => { return 0 ? 'green' : 'red' }}> {`${record.Difference_Amount} / ${record.Supplement_Amount}`} } }, { dataIndex: 'Audit_Date', title: '稽查时间', }, { dataIndex: 'Audit_Type', title: '稽查类型', }, { dataIndex: 'Audit_Id', title: '稽查内码', hideInTable: true }, ] // 图片数组 const [imgList, setImgList] = useState() const [productData, setProductData] = useState()// 单品数据 1 const [mobilePayment, setMobilePayment] = useState()// 移动支付 3 const [cigarettePayment, setCigarettePayment] = useState()// 香烟支付 2 // 三个查询报表的抽屉 const [queryRecords, setQueryRecords] = useState(false) // 三个查询报表记录 选择的哪个 const [selectQueryType, setSelectQueryType] = useState(0) // 整个抽屉的校验loading const [itemDetailLoading, setItemDetailLoading] = useState(false) const fmoney = (s: number, n?: number) => { /* * 参数说明: * s:要格式化的数字 * n:保留几位小数 * */ n = n > 0 && n <= 20 ? n : s.toString().indexOf('.') === -1 ? 0 : s.toString().indexOf('.') > -1 ? s.toString().split('.')[1].length : 2; let fuhao = ''; // 如果数字小于零则值为- if (s < 0) { s = Math.abs(s); fuhao = '-' } s = `${parseFloat((`${s}`).replace(/[^\d\.-]/g, "")).toFixed(n)}`; const l = s.split(".")[0].split("").reverse(); const r = s.split(".")[1]; let t = ""; for (let i = 0; i < l.length; i++) { t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : ""); } if (n === 0) { return s } return `${fuhao + [...t].reverse().join("")}.${r}`; } const handleGetItemDetail = async () => { setShowChangeLoading(true) const req = { RoleType: 1, ServerpartId: currentRow.Serverpart_Id, ServerpartShopCode: currentRow.ServerpartShop_Code, StartDate: moment(searchTime[0]).format('YYYY-MM-DD'), EndDate: moment(searchTime[1]).format('YYYY-MM-DD'), } const data = await handleBrandDetailList(req) const resultData = JSON.parse(JSON.stringify(data)) setTopDetail(resultData) if (resultData.VerifyList && resultData.VerifyList.length > 0) { resultData.VerifyList.forEach((item: any) => { item.name = resultData.ServerpartShop_Name }) } if (resultData.VerifiedList && resultData.VerifiedList.length > 0) { resultData.VerifiedList.forEach((item: any) => { item.name = resultData.ServerpartShop_Name }) } setLeftTimeAllList([resultData.VerifyList, resultData.VerifiedList]) console.log('resultData323', resultData); const selectTabList: any = JSON.parse(JSON.stringify(tabList)) selectTabList.forEach((item: any) => { if (item.label === '待我校验') { item.number = data.VerifyList.length } else { item.number = data.VerifiedList.length } }) setLeftTimeList([resultData.VerifyList, resultData.VerifiedList][selectTab - 1]) if (selectTabList[0].number === 0) { setSelectTab(2) setLeftTimeList([resultData.VerifyList, resultData.VerifiedList][1]) } else { setLeftTimeList([resultData.VerifyList, resultData.VerifiedList][selectTab - 1]) } setTabList(selectTabList) // 如果未校验有值 那默认显示数组第一个 没值就显示第二个 const leftList: any = [resultData.VerifyList, resultData.VerifiedList][selectTabList[0].number === 0 ? 1 : 0] console.log('leftList', leftList); if (leftList && leftList.length > 0) { // setSelectLeftTime(leftList[0].value) // handleGetDetail(leftList[0].value, selectTab) setSelectLeftTime(currentRow?.Endaccount_Id) handleGetDetail(currentRow?.Endaccount_Id, selectTab) } else { formRef.current?.resetFields() } setShowChangeLoading(false) } useEffect(async () => { if (showDetail && currentRow) { // 抽屉顶部显示内容调用的接口 handleGetItemDetail() } }, [showDetail]); // 拿到校验说明 const handleGetApprovedInfo = () => { const data = formRef.current?.getFieldsValue() return data } // 校验表单方法 const handleForm = async () => { let flag: boolean = false const res = await formRef.current?.validateFields() console.log('res', res) if (res) { flag = true } return flag } // 改变最大的抽屉loading const showDetailLoading = (type: boolean) => { setItemDetailLoading(type) } useImperativeHandle(onRef, () => ({ selectTab, handleGetApprovedInfo, currentDetail, auditTableData, handleLeftListChange, handleForm, handleGetItemDetail, showDetailLoading })); const handleLeftListChange = () => { if (leftTimeList && leftTimeList.length === 0 && selectTab === 1) { return true } return false } useEffect(() => { handleKnowChildrenTabChange(selectTab, leftTimeList && leftTimeList.length > 0 ? leftTimeList.length : 0, disableBtn) }, [selectTab]); useEffect(() => { handleKnowChildrenTabChange(selectTab, leftTimeList && leftTimeList.length > 0 ? leftTimeList.length : 0, disableBtn) }, [leftTimeList]); useEffect(() => { handleKnowChildrenTabChange(selectTab, leftTimeList && leftTimeList.length > 0 ? leftTimeList.length : 0, disableBtn) }, [disableBtn]); const handleGetDetail = async (id: number, tabSelect?: number) => { const req = { EndaccountId: id } const data = await handleDetail(req) setAuditTableData(data.AuditInfoList) if (tabSelect !== 2) { handleGetShopPriceData(1, data.Endaccount_Id) handleGetShopPriceData(3, data.Endaccount_Id) if (data.ShowCigarette) { handleGetShopPriceData(2, data.Endaccount_Id, data.CigaretteType) } } setCurrentDetail(data) formRef.current?.setFieldsValue( { ...data, AvgTicketPrice: data.Ticket_Count ? fmoney(data.TotalSell_Amount / data.Ticket_Count, 2) : '' } ) setShowChangeLoading(false) getPictureList(data.Endaccount_Id) } const handleGetShopPriceData = async (type: number, id: number, CigaretteType?: any) => { // type 为数据类型 1单品数据 2香烟数据 3移动支付 id 为日结账期内码 let req = {} if (type === 1) { req = { Data_Type: 1, Endaccount_ID: id, } } else if (type === 2) { req = { Data_Type: 2, Endaccount_ID: id, CigaretteType } } else { req = { Data_Type: 3, Endaccount_ID: id, ReloadType: 1 } } const data = await handleGetShopData(req) if (type === 1) { setProductData(data) formRef?.current?.setFieldsValue({ ...data, SellCount_Sale: data.count, FactAmount_Sale: data.amount }) } else if (type === 2) { setCigarettePayment(data) formRef?.current?.setFieldsValue({ ...data, FactAmount_Cigarette: data.amount, SellCount_Cigarette: data.count }) } else if (type === 3) { setMobilePayment(data) formRef?.current?.setFieldsValue({ ...data, FactAmount_Mobilepayment: data.amount }) } setShowChangeLoading(false) } const getPictureList = (id: any) => { setShowChangeLoading(true) const req = { TableId: id, TableName: "ENDACCOUNT", } handleGetPictureList(req).then((data: any) => { console.log('setImgList', data) if (data && data.List && data.List.length > 0) { data.List.forEach((item: any) => { item.url = item.ImageUrl item.status = 'done' }) setImgList(data.List) } setShowChangeLoading(false) }) } // 单品报表 香烟记录 支付记录 按钮点击调用的方法 // 1 为单品报表 2为香烟记录 3为支付记录 const handleGetQueryRecords = async (type: number) => { setQueryRecords(true) setSelectQueryType(type) } return (
{ itemDetailLoading ?
{'校验中.....'}
: '' } {/* 抽屉顶部的品牌信息 */}

品牌信息

{ pageVersion === 'new' ?
{/* 蓝色带图标的详情框 */}
{currentRow?.ServerpartShop_Name} {/* {currentRow?.Business_Type} */}
{currentRow?.Treatment_MarkState === -1 ? '未上传' : currentRow?.Treatment_MarkState === 0 ? '待处理' : currentRow?.Treatment_MarkState === 1 ? '已处理' : ''}
{currentRow?.Serverpart_Name}
{`${currentRow?.Deal_Count}/${currentRow?.Total_Count}`}
{'总实收金额/元'}
{topDetail?.Revenue_Amount ? fmoney(topDetail?.Revenue_Amount, 2) : '0'}
{ topDetail?.ShopRegion_Name_A ?
{`${topDetail?.ShopRegion_Name_A}实收金额/元`}
{topDetail?.Revenue_Amount_A ? fmoney(topDetail?.Revenue_Amount_A, 2) : '0'}
: '' } { topDetail?.ShopRegion_Name_B ?
{`${topDetail?.ShopRegion_Name_B}实收金额/元`}
{topDetail?.Revenue_Amount_B ? fmoney(topDetail?.Revenue_Amount_B, 2) : '0'}
: '' }
{/* tab选项卡和搜索时间框 */}
{ tabList.map((item: tabType) => { return item.number === 0 ? '' :
{ setSelectTab(item.value) setLeftTimeList(leftTimeAllList[item.value - 1]) setShowChangeLoading(true) if (leftTimeAllList[item.value - 1] && leftTimeAllList[item.value - 1].length > 0) { setSelectLeftTime(leftTimeAllList[item.value - 1][0].value) handleGetDetail(leftTimeAllList[item.value - 1][0].value, item.value) } else { setShowChangeLoading(false) formRef.current?.resetFields() } }}> {item.label} {`(${item.number})`}
}) }
{ if (e && e.length > 0) { setSearchTime([moment(e[0]._d), moment(e[1]._d)]) } else { setSearchTime([]) } }} />
{ leftTimeList && leftTimeList.length > 0 ? leftTimeList.map((item: any) => { return
{ setSelectLeftTime(item.value) setImgList([]) if (item.type !== 0) { setShowChangeLoading(true) handleGetDetail(item.value) } if (item.type === 0) { formRef.current?.resetFields() setDisableBtn(false) } else { setDisableBtn(true) } }}>{`${item.label}【${item.key}】`}
}) : '' }
{showChangeLoading ?
{'加载中'}
: '' } { leftTimeList && leftTimeList.length > 0 ?
{ return [] } }}>
{'账单基础信息'}
{'账单销售信息'}
{ disableBtn ? : '' }
{'='}
{'+'}
{'+'}
{'='}
{'-'}
{/* {'+'} */}
{'账单校验说明'}{'必填项'}
{ disableBtn ? : '' }
{'='}
{'+'}
{ currentDetail?.Approved_Info ? {`${currentDetail?.Approved_Staff || '-'}【${currentDetail?.Approved_Date || '-'}】:${currentDetail?.Approved_Info || '-'}`} : '' }
{ disableBtn ? <> { auditTableData && auditTableData.length > 0 ? <>
{'稽核反馈'}
{ return { onClick: (event) => { setAuditRowDetail(record) setShowAuditDrawer(true) }, } }} > : '' }
{'单品数据'}
{ disableBtn ?
{ selectTab === 1 ? : '' }
: '' }
{ currentDetail?.ShowCigarette ? <>
{'香烟数据'}
{ disableBtn ?
{ selectTab === 1 ? : '' }
: '' }
: '' }
{'移动支付'}
{ disableBtn ?
{ selectTab === 1 ? : '' }
: '' }
{'上传单据'}
{ selectTab === 1 ?