feat: 收货信息实名认证

This commit is contained in:
eric
2022-11-27 11:53:15 +08:00
parent eff12ed88f
commit fa31230d84
9 changed files with 103 additions and 42 deletions

View File

@@ -480,7 +480,7 @@ const details = () => {
type={disable ? "warning" : "primary"}
block
// disabled={disable}
onClick={() => {
onClick={async() => {
if (disable) {
setShow(true);
return false;
@@ -505,7 +505,7 @@ const details = () => {
return false;
}
let isin: any = phoneLogin();
let isin: any = await phoneLogin();
if (!isin) {
//重新登录- 跳转到我的页面
Toast.fail({

View File

@@ -402,9 +402,18 @@ const Home = () => {
});
// chooseImage();
} else {
await getdetails();
Toast.fail({
message: "请先登录",
selector: "#vanToast-demo2",
duration: 2000,
onClose: () => {
// 跳转到目的页面,打开新页面
Taro.navigateTo({
url: "/pages/my/index",
});
},
});
}
}}
@@ -562,8 +571,6 @@ const Home = () => {
})
}}>订阅消息</View> */}
<Toast id="vanToast-demo2" />
<TabbarCom active={0} />

View File

@@ -39,19 +39,16 @@ const my = (props: any) => {
const [detailsData, setdetailsData] = useState<any>([]); //活动详情
const [currentIndex, setcurrentIndex] = useState(0);
const [isin, setisin] = useState(true); //0初始 1未登录 2有手机号
const [isin, setisin] = useState(false); //0初始 1未登录 2有手机号
useEffect(() => {
getok();
// let isin: any = isLogin();
// setisin(isin);
// getOpenid();
getLogin();
}, []);
const getok = async () => {
let isOk: any = await phoneLogin();
setisin(isOk);
const getLogin = async () => {
let isLogin: any = await phoneLogin();
console.log('isLogin',isLogin)
setisin(isLogin);
};
useEffect(() => {
@@ -127,7 +124,7 @@ const my = (props: any) => {
const CardCom = () => {
return (
<View>
{detailsData?.length>0 ? (
{detailsData?.length > 0 ? (
<View>
{detailsData.splice(0, 2).map((item: any, index: any) => {
return (
@@ -158,6 +155,22 @@ const my = (props: any) => {
);
};
const updateAuth =async (userRes:any) => {
let newobj = {
tableName: "userInfo",
id: userRes?.data?.[0]?._id,
objData: {
authInfo: [...(userRes?.data?.[0]?.authInfo ?? []), ...userRes],
},
okFun: async (okFunres: any) => {
console.log("添加用户认证信息", okFunres);
setisin(true);
//
},
};
await updateTableid({ ...newobj });
};
return (
<View className="myContent">
{/* <View className={styles?.myContent}> */}
@@ -176,9 +189,61 @@ const my = (props: any) => {
<Button
type="primary"
size="mini"
open-type="getPhoneNumber"
lang="zh_CN"
// open-type="getPhoneNumber"
// onGetPhoneNumber={onGetPhoneNumber}
lang="zh_CN"
onClick={async () => {
// 获取收获地址
Taro.chooseAddress({
success: function (AddressRes) {
console.log("AddressRes", AddressRes);
Taro.cloud.callFunction({
name: "getOpenid",
complete: async (opemRes: any) => {
let openid = opemRes?.result?.event?.userInfo?.openId;
console.log("openid", openid);
let postData = {
tableName: "userInfo",
keyValue: { openId: openid },
okFun: async (userRes: any) => {
console.log("userRes", userRes);
let newobj = {
tableName: "userInfo",
id: userRes?.data?.[0]?._id,
objData: {
authInfo: [...(userRes?.data?.[0]?.authInfo ?? []),AddressRes],
},
okFun: async (okFunres: any) => {
console.log("添加用户认证信息", okFunres);
setisin(true);
//
},
};
await updateTableid({ ...newobj });
},
};
// 查询openid
await getTable({ ...postData });
},
});
// 手机号
console.log(AddressRes.telNumber);
// cityName: "深圳市"
// countyName: "宝安区"
// detailInfo: "西乡街道ghhhh"
// detailInfoNew: "ghhhh"
// errMsg: "chooseAddress:ok"
// nationalCode: "440306"
// nationalCodeFull: "440306018"
// postalCode: "518101"
// provinceName: "广东省"
// streetName: "西乡街道"
// telNumber: "13135685636"
// userName: "cady"
},
});
}}
>
</Button>
@@ -193,7 +258,7 @@ const my = (props: any) => {
onClick={(e: any) => {
console.log("e", e);
getDetails(openId, e?.detail?.name);
setcurrentIndex(e?.detail?.name);
setcurrentIndex(e?.detail?.index);
}}
>
{/* <Tab title={`待审核 ${detailsData?.length??0}`} name="1"> */}
@@ -233,26 +298,11 @@ const my = (props: any) => {
}}
/>
<Cell
{/* <Cell
icon="coupon"
title="更新收货地址"
title="个人资料"
isLink
onClick={() => {
// 获取收获地址
Taro.chooseAddress({
success: function (res) {
console.log(res.userName);
console.log(res.postalCode);
console.log(res.provinceName);
console.log(res.cityName);
console.log(res.countyName);
console.log(res.detailInfo);
console.log(res.nationalCode);
console.log(res.telNumber);
},
});
}}
/>
/> */}
{/* <Cell
icon="star"

View File

@@ -220,13 +220,15 @@ export const phoneLogin = async () => {
});
} else {
//查看是否存在手机号
if (data?.[0]?.authInfo?.authPhonenum) {
if (data?.[0]?.authInfo?.[0]?.telNumber) {
resolve(true)
return true;
} else {
if(type==='people'){
resolve(true)
return true;
// resolve(true)
// return true;
resolve(false)
return false;
}else{
resolve(false)
return false;