开发钱包相关页面,调试提现接口
This commit is contained in:
@@ -4,6 +4,7 @@ import { View, Text, Input, Button } from "@tarojs/components";
|
||||
|
||||
import "./index.scss";
|
||||
import httpService from "@/services/httpService";
|
||||
import { useUserInfo } from "@/store/userStore";
|
||||
|
||||
interface FormFields {
|
||||
phone?: string;
|
||||
@@ -11,8 +12,9 @@ interface FormFields {
|
||||
}
|
||||
|
||||
const ValidPhone: React.FC = () => {
|
||||
const userInfo = useUserInfo();
|
||||
const [formData, setFormData] = useState<FormFields>({
|
||||
phone: "",
|
||||
phone: userInfo.phone || "",
|
||||
sms_code: "",
|
||||
});
|
||||
|
||||
@@ -22,21 +24,32 @@ const ValidPhone: React.FC = () => {
|
||||
|
||||
const handleConfirm = async () => {
|
||||
// TODO: 校验验证码
|
||||
Taro.navigateTo({ url: "/user_pages/setTransactionPassword/index?type=find" });
|
||||
Taro.navigateTo({ url: `/user_pages/setTransactionPassword/index?type=reset&phone=${formData.phone}&sms_code=${formData.sms_code}` });
|
||||
};
|
||||
|
||||
const getSMSCode = async () => {
|
||||
const { phone } = formData;
|
||||
try {
|
||||
await httpService.post("/wallet/send_reset_password_sms", { phone });
|
||||
Taro.showToast({ title: "验证码已发送", icon: "none" });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
Taro.showToast({ title: "获取验证码失败", icon: "none" });
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<View className="set-transaction-password-page">
|
||||
<View className="form-item">
|
||||
<Text className="form-label">手机号</Text>
|
||||
<Input defaultValue={"15708469466"} type="number" disabled></Input>
|
||||
<Input defaultValue={formData.phone} type="number" disabled></Input>
|
||||
</View>
|
||||
<View className="form-item">
|
||||
<Text className="form-label">验证码</Text>
|
||||
<Input placeholder="请输入验证码" type="number" onInput={(e) => { handleInput(e, "sms_code") }}></Input>
|
||||
<Button className="btn" >获取验证码</Button>
|
||||
<Button className="btn" onClick={getSMSCode}>获取验证码</Button>
|
||||
</View>
|
||||
<Button className="btn bottom-btn" onClick={handleConfirm}>提交</Button>
|
||||
<Button className="btn bottom-btn" disabled={!formData.sms_code} onClick={handleConfirm}>提交</Button>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user