"use client";

import React, { useState, useEffect, useMemo, Fragment } from "react";
import { Switch, Space, Checkbox, Button, Toast, TextArea } from "antd-mobile";
import { useRouter, useSearchParams } from "next/navigation";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faAngleLeft, faSquareCheck } from "@fortawesome/free-solid-svg-icons";
import requireAPI from "@/utils/requireAPI";
export default function AfterSubmitStreamerVerification() {
  const router = useRouter();
  const [wechatList, setWechatList] = useState([]);
  useEffect(() => {
    const getWechat = async () => {
      try {
        const data = await requireAPI("POST", "/api/support_wx_id/list", null);
        if (data.ret === -1) {
          Toast.show({
            icon: "fail",
            content: data.msg,
            position: "top",
          });
          return;
        }
        const temWechat = Object.entries(data.data);
        const temWechatList = temWechat.map((item) => item[1]);
        setWechatList(temWechatList);
      } catch (error) {
        console.error(error);
      }
    };
    getWechat();
  }, []);
  return (
    <div>
      {/* 头部标题 */}
      <div className="p-4 fixed top-0 z-10 w-full bg-black">
        <div className="w-9 h-9 flex items-center justify-center bg-[#FFFFFF1A] rounded-full absolute">
          <FontAwesomeIcon
            icon={faAngleLeft}
            style={{ maxWidth: "12px" }}
            size="xl"
            onClick={() => {
              router.back();
            }}
          />
        </div>
        <p className="text-base text-center leading-9">空间付费设置</p>
      </div>
      {/* 内容 */}
      <div className="pt-16 p-4">
        <div className="flex flex-col items-center p-4">
          <FontAwesomeIcon
            icon={faSquareCheck}
            style={{ maxWidth: "100px", width: "100px", height: "100px" }}
            // size={"100px"}
            color="#27F5B7"
          />
          <span className="text-2xl text-white font-medium mb-2">提交成功</span>
          <p className="text-base text-center text-white font-medium">
            请添加工作人员
            <span className="text-[#F53030]">微信：{wechatList[0]}</span>
            直接商讨合作事宜，如未添加可能影响审核进度，请及时添加。您可以选择继续完善资料，这将加快您的审核进度。
          </p>
          <div className="mt-4">
            {wechatList.map((item, index) => {
              if (index === 0) return;
              return (
                <span key={index} className="text-base text-[#F53030]">
                  备用微信{index}：{item}
                </span>
              );
            })}
          </div>
          <div className="grid grid-rows-2 gap-4 px-4 mt-6">
            <Button
              size="middle"
              shape="rounded"
              style={{
                "--background-color": "#FF669E",
                paddingLeft: "32px",
                paddingRight: "32px",
              }}
              onClick={() => () =>
                router.replace(
                  "my/streamerVerification/completeStreamerInformation"
                )}
            >
              <div className="flex flex-col items-center text-base">
                <span>前往完善资料</span>
                <span className="text-xs">（一次填完更快审核哦～）</span>
              </div>
            </Button>
            <Button
              size="middle"
              shape="rounded"
              style={{
                "--background-color": "#FFFFFF1A",
                paddingLeft: "32px",
                paddingRight: "32px",
              }}
              onClick={() => router.back()}
            >
              <div className="flex flex-col items-center text-base">
                <span>返回主页</span>
                <span className="text-xs">（可在“我的”继续完善资料）</span>
              </div>
            </Button>
          </div>
        </div>
      </div>
    </div>
  );
}
