"use client"; import React, { useState } from "react"; import { Image, InfiniteScroll, List, Toast, Modal } from "antd-mobile"; import Empty from "@/components/Empty"; import requireAPI from "@/utils/requireAPI"; import { useRouter } from "next/navigation"; import clipboard from "copy-to-clipboard"; export default function HaveNotAddWechat({ zid, currentIndex }) { const [offset, setOffset] = useState(0); const [more, setMore] = useState(1); const [data, setData] = useState([]); const router = useRouter(); const getData = async (refresh) => { if (zid === undefined || !more || currentIndex != 0) return; try { const body = { tab: 1, offset: refresh ? 0 : offset, //如果是下拉刷新则更新最新数据 limit: 20, }; const _data = await requireAPI("POST", "/api/vas/get_add_wechat_list", { body, }); if (_data.ret === -1) { Toast.show({ icon: "fail", content: _data.msg, position: "top", }); return; } setData((old) => [...old, ..._data.data.list]); setOffset(_data.data.offset); setMore(_data.data.more); } catch (error) { console.error(error); } }; const handleConfirm = async (item, modal) => { try { const _data = await requireAPI("POST", "/api/vas/confirm_add_wechat", { body: { order_id: item.order_id }, }); if (_data.ret === -1) { Toast.show({ icon: "fail", content: _data.msg, position: "top", }); return; } modal.close(); router.refresh(); } catch (error) { console.error(error); } }; //保存内容到剪贴板 const copy = (_data) => { // console.log("_data", _data); clipboard(_data); Toast.show({ icon: "success", content: "已复制到剪贴板", position: "top", }); }; //单个成员组件 const RenderItem = ({ item }) => { return (

{item?.account?.name}

{item?.account?.user_id}

请于72小时内添加对方微信

付款时间:{new Date(item?.ct * 1000).toLocaleString()}

{item.order_status === 2 ? ( 等待用户填写微信 ) : (
{ // setCurrentOrder(item); // setIsConfirmModalVisible(!isConfirmModalVisible); const modal = Modal.show({ closeOnMaskClick: true, bodyStyle: { background: "none", }, content: (
{item.consumer_wechat ? (
{item?.account?.name}
Ta的微信号:
{item?.consumer_wechat}
copy(item?.consumer_wechat)} className="flex" > 复制
添加时请备注:
{item?.consumer_note}
copy(item?.consumer_note)} className="flex" > 复制
) : (
{item.account?.name}

请确认对方已主动添加您的微信,并您已经通过好友申请。

)}
handleConfirm(item, modal)} className="flex justify-center" > 我已完成添加
), }); }} className="text-[14px] font-medium px-4 py-2 bg-[#FF669E] rounded-full whitespace-nowrap" > 添加微信
)}
); }; return (
{data.length == 0 && (
)} {data.map((item, index) => ( ))} {null}
); }