import './pay-cert.scss'
import {useEffect, useState} from "react";
import {useRouter} from '@tarojs/taro'
import dayjs from 'dayjs'
import {getBszxPay} from "@/api/bszx/bszxPay";
import {BszxPay} from "@/api/bszx/bszxPay/model";
function CertQuery() {
  const {params} = useRouter();
  const [nickName, setNickName] = useState<string>()
  const [payLog, setPayLog] = useState<BszxPay>()

  const reload = () => {
    if (params.id) {
      getBszxPay(Number(params.id)).then(res => {
        if(res){
          setNickName(res.name)
          setPayLog(res);
          console.log(nickName)
          console.log(res,'log.....')
        }
      })
    }
  }
  useEffect(() => {
    reload()
  }, []);
  return (
      <div className={'cert-bg flex justify-center'}>
        <div className={'cert-content'}>
          <p className={'py-2'}>亲爱的 { payLog?.name || '匿名'} :</p>
          感谢您支持捐赠百色市百色中学温暖校园项目!您捐赠金额:{payLog?.price || 0}元，单号:{payLog?.id}，时间:{payLog?.createTime}。对您的奉献表示诚挚的敬意，特此证明!
          <p className={'mt-2 text-right'}>百色市百色中学</p>
          <p className={'text-right'}>{dayjs(payLog?.createTime).format('YYYY-MM-DD')}</p>
        </div>
      </div>
  )
}

export default CertQuery;
