import React, { useCallback, useEffect, useState } from 'react' import styles from './index.module.scss' import { A2SonListType } from './type' import { A1_APIgetInfo, A1_APIupdate } from '@/store/action/A1list' import { MessageFu } from '@/utils/message' type Props = { sId: number closeFu: () => void type: '查看' | '核销' upTable: () => void } function A2look({ sId, closeFu, type, upTable }: Props) { const [list, setList] = useState([]) const [info, setInfo] = useState({ createTime: '', bookDate: '', time: '', type: '', pcs: 0, teamDesc: '' }) const getInfoFu = useCallback( async (id: number) => { const res = await A1_APIgetInfo(id) if (res.code === 0) { if (res.data.status === 1 && type === '核销') { MessageFu.success('此二维码已经核销') upTable() closeFu() return } setInfo(res.data) setList(JSON.parse(res.data.rtf)) } }, [closeFu, type, upTable] ) useEffect(() => { getInfoFu(sId) }, [getInfoFu, sId]) // 核销 const updateFu = useCallback( async (id: number, status: 0 | 1) => { const res = await A1_APIupdate(id, status) if (res.code === 0) { MessageFu.success('核销成功!') upTable() closeFu() } }, [closeFu, upTable] ) return (

预约详情

预约类型:
{info.type === 'person' ? '个人预约' : '团队预约'}
申请时间:
{info.createTime}
预约日期:
{info.bookDate}
预约时段:
{info.time}
{list.map((item, index) => (
{info.type === 'person' ? '参观人' : '负责人'}姓名:
{item.name}
{info.type === 'person' ? '参观人' : '负责人'}电话:
{item.phone}
{item.papers || '证件号码'}:{item.identity}
))} {info.type === 'team' ? (
参团人数:
{info.pcs}
{info.teamDesc ? (
团队描述:
{info.teamDesc}
) : null}
) : null}
{/* 按钮 */}
{type === '查看' ? null : (
updateFu(sId, 1)}> 核销
)}
{type === '查看' ? '返回' : '取消'}
) } const MemoA2look = React.memo(A2look) export default MemoA2look