diff --git a/screeens/WebWithHeader/index.jsx b/screeens/WebWithHeader/index.jsx
index 2e74592..1674993 100644
--- a/screeens/WebWithHeader/index.jsx
+++ b/screeens/WebWithHeader/index.jsx
@@ -25,18 +25,28 @@ export default function WebWithHeader({ navigation, route }) {
const [cookies, setCookies] = useState();
useEffect(() => {
async function getCookies() {
- const token = await get("token");
- const account = await get("account");
const base = await baseRequest();
- setCookies({ token: token, account: account, base: base });
+ setCookies({
+ b_mid: base.b_mid,
+ b_did: base.b_did,
+ b_ver: base.b_ver,
+ b_dt: base.b_dt,
+ b_model: base.b_model,
+ b_nt: base.b_nt,
+ b_token: base.b_token,
+ });
}
getCookies();
}, []);
const setCookieScript = `
- document.cookie = "token=${cookies?.token} ;";
- document.cookie = "account=${cookies?.account} ;";
- document.cookie = "base=${cookies?.base} ;";
+ document.cookie = "b_mid=${cookies?.b_mid} ;";
+ document.cookie = "b_did=${cookies?.b_did} ;";
+ document.cookie = "b_ver=${cookies?.b_ver} ;";
+ document.cookie = "b_dt=${cookies?.b_dt} ;";
+ document.cookie = "b_model=${cookies?.b_model} ;";
+ document.cookie = "b_nt=${cookies?.b_nt} ;";
+ document.cookie = "b_token=${cookies?.b_token} ;";
true;
`;
diff --git a/screeens/WechatWaitingToAdd/AlreadyAddWechat/index.jsx b/screeens/WechatWaitingToAdd/AlreadyAddWechat/index.jsx
index 2f9e56b..a2881a4 100644
--- a/screeens/WechatWaitingToAdd/AlreadyAddWechat/index.jsx
+++ b/screeens/WechatWaitingToAdd/AlreadyAddWechat/index.jsx
@@ -1,10 +1,301 @@
-import { View, Text } from "react-native";
-import React from "react";
+import {
+ View,
+ Text,
+ FlatList,
+ RefreshControl,
+ Modal,
+ TouchableOpacity,
+ Image as NativeImage,
+} from "react-native";
+import { Image } from "expo-image";
+import React, { useState, useEffect } from "react";
+import { useTailwind } from "tailwind-rn";
+import { useSafeAreaInsets } from "react-native-safe-area-context";
+import Empty from "../../../components/Empty";
+import { ListItem, Button } from "@rneui/themed";
+import baseRequest from "../../../utils/baseRequest";
+import Toast from "react-native-toast-message";
+import * as Clipboard from "expo-clipboard";
+import { generateSignature } from "../../../utils/crypto";
+
+//todo:等待接口上线,完善样式,测试
+export default function AlreadyAddWechat({}) {
+ const blurhash = "LcKUTa%gOYWBYRt6xuoJo~s8V@fk";
+
+ const tailwind = useTailwind();
+ const insets = useSafeAreaInsets();
+
+ //保存获取的订单列表
+ const [orderList, setOrderList] = useState([]);
+ const [offset, setOffset] = useState(0);
+ const [more, setMore] = useState(1);
+ //获取订单数据
+ const getOrderList = async (top = false) => {
+ if (!more && top === false) return;
+ const apiUrl = process.env.EXPO_PUBLIC_API_URL;
+ try {
+ const base = await baseRequest();
+ const signature = await generateSignature({
+ tab: 2,
+ offset: top ? 0 : offset,
+ limit: 20,
+ ...base,
+ });
+ const response = await fetch(
+ `${apiUrl}/api/vas/get_add_wechat_list?signature=${signature}`,
+ {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ tab: 1,
+ offset: top ? 0 : offset, //如果是下拉刷新则更新最新数据
+ limit: 20,
+ ...base,
+ }),
+ }
+ );
+ const data = await response.json();
+ if (data.ret === -1) {
+ Toast.show({
+ type: "error",
+ text1: data.msg,
+ topOffset: 60,
+ });
+ return;
+ }
+ setOffset(data.data.offset);
+ setMore(data.data.more);
+ //如果是下拉刷新则更新最新数据
+ if (top) {
+ setOrderList(data.data.list);
+ return;
+ }
+ setOrderList([...orderList, ...data.data.list]);
+ } catch (error) {
+ console.error(error);
+ }
+ };
+
+ useEffect(() => {
+ getOrderList();
+ }, []);
+
+ //下拉刷新
+ const [refreshing, setRefreshing] = useState(false);
+ const handleRefresh = async () => {
+ setRefreshing(true);
+ await getOrderList(true);
+ setRefreshing(false);
+ };
+
+ //二次确认组件
+ const [isConfirmModalVisible, setIsConfirmModalVisible] = useState(false);
+ const [currentOrder, setCurrentOrder] = useState({});
+ const ConfirmModal = () => {
+ //保存内容到剪贴板
+ const copy = async (data) => {
+ await Clipboard.setStringAsync(data);
+ Toast.show({
+ type: "success",
+ text1: "已复制到剪贴板",
+ topOffset: 60,
+ });
+ };
+ return (
+
+ setIsConfirmModalVisible(false)}
+ style={{
+ backgroundColor: "#00000080",
+ ...tailwind("flex-1 justify-center items-center"),
+ }}
+ >
+
+ {currentOrder.consumer_wechat ? (
+
+
+
+
+ {currentOrder?.account?.name}
+
+
+
+ Ta的微信号:
+
+
+
+ {currentOrder?.consumer_wechat}
+
+ copy(currentOrder?.consumer_wechat)}
+ style={tailwind("flex flex-row")}
+ >
+
+
+ 复制
+
+
+
+
+ 添加时请备注:
+
+
+
+ {currentOrder?.consumer_note}
+
+ copy(currentOrder?.consumer_note)}
+ style={tailwind("flex flex-row")}
+ >
+
+
+ 复制
+
+
+
+
+ ) : (
+
+
+
+
+ {currentOrder.account?.name}
+
+
+
+ 请确认对方已主动添加您的微信,并您已经通过好友申请。
+
+
+ )}
+
+
+
+ );
+ };
+
+ //订单项组件
+ const renderItem = ({ item }) => {
+ return (
+
+
+
+
+
+
+ {item?.account?.name}
+
+
+ 请于72小时内添加对方微信
+
+
+ 付款时间:{new Date(item?.ct * 1000).toLocaleString()}
+
+
+
+
+
+
+
+
+ );
+ };
-export default function AlreadyAddWechat() {
return (
-
- AlreadyAddWechat
+
+
+
+ handleRefresh()}
+ />
+ }
+ onEndReached={() => getOrderList()}
+ ListEmptyComponent={}
+ />
+
);
}
diff --git a/screeens/WechatWaitingToAdd/HaveNotAddWechat/index.jsx b/screeens/WechatWaitingToAdd/HaveNotAddWechat/index.jsx
index e035e7e..8c50a5a 100644
--- a/screeens/WechatWaitingToAdd/HaveNotAddWechat/index.jsx
+++ b/screeens/WechatWaitingToAdd/HaveNotAddWechat/index.jsx
@@ -25,36 +25,6 @@ export default function HaveNotAddWechat({}) {
const tailwind = useTailwind();
const insets = useSafeAreaInsets();
- const data = [
- {
- name: "路人乙",
- avatar: "https://s2.loli.net/2023/09/14/7AoD2kQlrnNUPFS.jpg",
- pay_time: "2022-12-12 10:00",
- status: "待添加",
- },
- {
- name: "路人乙2",
- avatar: "https://s2.loli.net/2023/09/14/7AoD2kQlrnNUPFS.jpg",
- pay_time: "2022-12-12 10:10",
- status: "待添加",
- },
- ];
-
- const data2 = [
- {
- name: "路人甲",
- avatar: "https://s2.loli.net/2023/09/14/7AoD2kQlrnNUPFS.jpg",
- pay_time: "2022-12-12 10:00",
- status: "待添加",
- },
- {
- name: "路人甲2",
- avatar: "https://s2.loli.net/2023/09/14/7AoD2kQlrnNUPFS.jpg",
- pay_time: "2022-12-12 10:10",
- status: "待添加",
- },
- ];
-
//保存获取的订单列表
const [orderList, setOrderList] = useState([]);
const [offset, setOffset] = useState(0);
@@ -87,7 +57,6 @@ export default function HaveNotAddWechat({}) {
}
);
const data = await response.json();
- console.log(data);
if (data.ret === -1) {
Toast.show({
type: "error",
@@ -192,17 +161,19 @@ export default function HaveNotAddWechat({}) {
>
{currentOrder.consumer_wechat ? (
-
+
-
- {currentOrder.account?.name}
+
+ {currentOrder?.account?.name}
@@ -210,10 +181,10 @@ export default function HaveNotAddWechat({}) {
- {currentOrder.consumer_wechat}
+ {currentOrder?.consumer_wechat}
copy(currentOrder.consumer_wechat)}
+ onPress={() => copy(currentOrder?.consumer_wechat)}
style={tailwind("flex flex-row")}
>
- {currentOrder.consumer_note}
+ {currentOrder?.consumer_note}
copy(currentOrder.consumer_note)}
+ onPress={() => copy(currentOrder?.consumer_note)}
style={tailwind("flex flex-row")}
>
) : (
-
+
-
+
{currentOrder.account?.name}
-
+
请确认对方已主动添加您的微信,并您已经通过好友申请。
@@ -284,10 +261,10 @@ export default function HaveNotAddWechat({}) {
return (
-
+
- {item?.name}
-
-
- 付款时间:{item?.pay_time}
+ {item?.account?.name}
请于72小时内添加对方微信
+
+ 付款时间:{new Date(item?.ct * 1000).toLocaleString()}
+
{item.order_status === 2 ? (
@@ -327,7 +304,10 @@ export default function HaveNotAddWechat({}) {
) : (