|
|
@@ -189,32 +189,30 @@
|
|
|
<!--收款账户-->
|
|
|
<div class="content-section" v-if="activeTab === 'receivingAccount'">
|
|
|
<div class="content-wrapper">
|
|
|
- <el-button type="primary" class="auth-button" @click="handleGoZFB" v-if="!userInfo.alipayAccount">
|
|
|
- 添加支付宝账号
|
|
|
- </el-button>
|
|
|
- <div class="zfb-wrapper" v-if="userInfo.alipayAccount">
|
|
|
+ <el-button type="primary" class="auth-button" @click="handleGoZFB" v-if="!alipayAccount"> 添加支付宝账号 </el-button>
|
|
|
+ <div class="zfb-wrapper" v-if="alipayAccount">
|
|
|
<div style="width: 100%">
|
|
|
<div style="display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 10px">
|
|
|
<div class="zfb-left">
|
|
|
<el-image :src="zfbIcon" class="zfbIcon" />
|
|
|
<div>
|
|
|
<div>支付宝</div>
|
|
|
- <div>{{ userInfo.alipayAccount }}</div>
|
|
|
+ <div>{{ alipayAccount }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="operate">
|
|
|
- <div @click="getEditZfb">编辑</div>
|
|
|
- <div @click="getDelZfb">删除</div>
|
|
|
+ <div @click="getEditZfb" style="cursor: pointer">编辑</div>
|
|
|
+ <div @click="getDelZfb" style="cursor: pointer">删除</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <el-button
|
|
|
+ <!-- <el-button
|
|
|
type="primary"
|
|
|
@click="goToCashApply"
|
|
|
class="submit-button"
|
|
|
style=" position: relative; left: -10%; width: 20%;margin-top: 90px; margin-left: 50%"
|
|
|
>
|
|
|
去提现
|
|
|
- </el-button>
|
|
|
+ </el-button> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -264,7 +262,7 @@
|
|
|
clearable
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="确认密码" prop="newPassword">
|
|
|
+ <el-form-item label="确认密码" prop="confireNewPassword">
|
|
|
<el-input
|
|
|
v-model="forgotPasswordForm.confireNewPassword"
|
|
|
type="password"
|
|
|
@@ -277,7 +275,7 @@
|
|
|
<template #footer>
|
|
|
<span class="dialog-footer">
|
|
|
<el-button @click="handleCancelZFB">取消</el-button>
|
|
|
- <el-button type="primary" :loading="loading" @click="handleConfirmZFB">确认</el-button>
|
|
|
+ <el-button type="primary" :loading="loading" @click="handleForgetConfirmZFB">确认111</el-button>
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
@@ -288,13 +286,30 @@
|
|
|
import { ref, reactive, computed, onMounted } from "vue";
|
|
|
import { useRouter } from "vue-router";
|
|
|
import { ElMessage, type FormInstance, ElMessageBox, type FormRules } from "element-plus";
|
|
|
-import { verifyIdInfo, checkPayPassword, setPayPassword, getMerchantByPhone, addAlipayAccount } from "@/api/modules/homeEntry";
|
|
|
+import {
|
|
|
+ verifyIdInfo,
|
|
|
+ checkPayPassword,
|
|
|
+ setPayPassword,
|
|
|
+ getMerchantByPhone,
|
|
|
+ addAlipayAccount,
|
|
|
+ deleteAlipayAccount,
|
|
|
+ getCheckPayPasswordTwo
|
|
|
+} from "@/api/modules/homeEntry";
|
|
|
import { localGet, localSet } from "@/utils/index";
|
|
|
import homeIcon from "../../assets/images/home-icon.png";
|
|
|
import zfbIcon from "../../assets/financial/zfb-icon.png";
|
|
|
import { lo } from "element-plus/es/locale";
|
|
|
-import { getPhoneCode } from "@/api/modules/newLoginApi";
|
|
|
-const userInfo = ref(localGet("geeker-user")?.userInfo || {});
|
|
|
+import { getPhoneCode, getCheckSmsCode } from "@/api/modules/newLoginApi";
|
|
|
+// 初始化用户信息,统一处理支付宝账号字段名(兼容 aliPayAccount 和 alipayAccount)
|
|
|
+const initUserInfo = () => {
|
|
|
+ const cachedUserInfo = localGet("geeker-user")?.userInfo || {};
|
|
|
+ // 统一使用 alipayAccount 字段,兼容 aliPayAccount(驼峰命名)
|
|
|
+ if (cachedUserInfo.aliPayAccount && !cachedUserInfo.alipayAccount) {
|
|
|
+ cachedUserInfo.alipayAccount = cachedUserInfo.aliPayAccount;
|
|
|
+ }
|
|
|
+ return cachedUserInfo;
|
|
|
+};
|
|
|
+const userInfo = ref(initUserInfo());
|
|
|
const router = useRouter();
|
|
|
const activeTab = ref("realName");
|
|
|
const dialogVisible = ref(false);
|
|
|
@@ -352,11 +367,27 @@ const handleConfirm = async () => {
|
|
|
};
|
|
|
const res1: any = await getMerchantByPhone(param);
|
|
|
if (res1.code == 200) {
|
|
|
+ // 统一处理支付宝账号字段名
|
|
|
+ const updatedData = res1.data || {};
|
|
|
+ if (updatedData.aliPayAccount && !updatedData.alipayAccount) {
|
|
|
+ updatedData.alipayAccount = updatedData.aliPayAccount;
|
|
|
+ }
|
|
|
dialogVisible.value = false;
|
|
|
goAuth.value = false;
|
|
|
// 重置表单
|
|
|
authFormRef.value?.resetFields();
|
|
|
- shimingInfo.value = res1.data;
|
|
|
+ shimingInfo.value = updatedData;
|
|
|
+ userInfo.value = { ...userInfo.value, ...updatedData };
|
|
|
+ // 更新本地存储
|
|
|
+ const geekerUser = localGet("geeker-user");
|
|
|
+ if (geekerUser) {
|
|
|
+ geekerUser.userInfo = { ...geekerUser.userInfo, ...updatedData };
|
|
|
+ if (updatedData.alipayAccount) {
|
|
|
+ geekerUser.userInfo.alipayAccount = updatedData.alipayAccount;
|
|
|
+ geekerUser.userInfo.aliPayAccount = updatedData.alipayAccount;
|
|
|
+ }
|
|
|
+ localSet("geeker-user", geekerUser);
|
|
|
+ }
|
|
|
// 这里可以更新认证状态或刷新页面数据
|
|
|
}
|
|
|
} else {
|
|
|
@@ -507,7 +538,7 @@ const getForgetPassword = async () => {
|
|
|
};
|
|
|
// 发送短信验证码
|
|
|
const sendForgotCode = async () => {
|
|
|
- let phoneCode: any = await getPhoneCode({ phone: userInfo.value.phone, appType: "2", businessType: "6" });
|
|
|
+ let phoneCode: any = await getPhoneCode({ phone: userInfo.value.phone, appType: "2", businessType: "7" });
|
|
|
if (phoneCode.code === 200) {
|
|
|
ElMessage.success("验证码已发送");
|
|
|
// 开始倒计时
|
|
|
@@ -535,10 +566,25 @@ const oldTwoPasswordForm = reactive({
|
|
|
});
|
|
|
|
|
|
const nextStept = async () => {
|
|
|
- if (oldPasswordForm.password === userInfo.value.payPassword) {
|
|
|
- currentStep.value = 2;
|
|
|
+ const res: any = await getCheckPayPasswordTwo({
|
|
|
+ password: oldPasswordForm.password,
|
|
|
+ storeUserId: userInfo.value.id
|
|
|
+ });
|
|
|
+ if (res.data.data == "false") {
|
|
|
+ ElMessage.error(res.data.message);
|
|
|
} else {
|
|
|
- ElMessage.error("原密码错误");
|
|
|
+ ElMessage.success(res.msg);
|
|
|
+ currentStep.value = 2;
|
|
|
+ // 更新本地存储中的提现密码
|
|
|
+ try {
|
|
|
+ const geekerUser = localGet("geeker-user");
|
|
|
+ if (geekerUser && geekerUser.userInfo) {
|
|
|
+ geekerUser.userInfo.payPassword = oldTwoPasswordForm.password;
|
|
|
+ localSet("geeker-user", geekerUser);
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error("更新本地存储失败:", error);
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
|
|
|
@@ -556,7 +602,7 @@ const handlePasswordTwoSubmit = async () => {
|
|
|
});
|
|
|
if (res.code == 200) {
|
|
|
ElMessage.success(res.msg || "提现密码修改成功");
|
|
|
-
|
|
|
+ activeTab.value = "receivingAccount";
|
|
|
// 更新本地存储中的提现密码
|
|
|
try {
|
|
|
const geekerUser = localGet("geeker-user");
|
|
|
@@ -615,11 +661,12 @@ const handleConfirmZFB = async () => {
|
|
|
const res: any = await addAlipayAccount(params);
|
|
|
if (res && res.code == 200) {
|
|
|
ElMessage.success(res.msg || "添加支付宝账号成功");
|
|
|
- // 更新本地存储中的支付宝账号
|
|
|
+ // 更新本地存储中的支付宝账号(统一使用 alipayAccount 字段)
|
|
|
try {
|
|
|
const geekerUser = localGet("geeker-user");
|
|
|
if (geekerUser && geekerUser.userInfo) {
|
|
|
- geekerUser.userInfo.aliPayAccount = authForm1.zfbName;
|
|
|
+ geekerUser.userInfo.alipayAccount = authForm1.zfbName;
|
|
|
+ geekerUser.userInfo.aliPayAccount = authForm1.zfbName; // 兼容旧字段名
|
|
|
localSet("geeker-user", geekerUser);
|
|
|
// 更新响应式的 userInfo
|
|
|
userInfo.value.alipayAccount = authForm1.zfbName;
|
|
|
@@ -647,25 +694,109 @@ const handleConfirmZFB = async () => {
|
|
|
const getEditZfb = async () => {
|
|
|
zfbTitle.value = "编辑支付宝账号";
|
|
|
dialogVisibleZFB.value = true;
|
|
|
- authForm1.zfbName = userInfo.value.alipayAccount || userInfo.value.phone;
|
|
|
+ // 兼容两种字段名:alipayAccount 和 aliPayAccount
|
|
|
+ authForm1.zfbName = userInfo.value.alipayAccount || userInfo.value.aliPayAccount || userInfo.value.phone;
|
|
|
};
|
|
|
const getDelZfb = async () => {
|
|
|
ElMessageBox.confirm("确定要删除该账号,删除后无法进行提现操作", "删除账号", {
|
|
|
confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消"
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
})
|
|
|
- .then(() => {})
|
|
|
- .catch(() => {});
|
|
|
+ .then(async () => {
|
|
|
+ try {
|
|
|
+ loading.value = true;
|
|
|
+ const res: any = await deleteAlipayAccount();
|
|
|
+ if (res && res.code == 200) {
|
|
|
+ ElMessage.success(res.msg || "删除成功");
|
|
|
+ // 立即更新响应式的 userInfo,清空支付宝账号
|
|
|
+ userInfo.value.alipayAccount = null;
|
|
|
+ userInfo.value.aliPayAccount = null;
|
|
|
+ // 更新本地存储中的支付宝账号
|
|
|
+ try {
|
|
|
+ const geekerUser = localGet("geeker-user");
|
|
|
+ if (geekerUser && geekerUser.userInfo) {
|
|
|
+ geekerUser.userInfo.alipayAccount = null;
|
|
|
+ geekerUser.userInfo.aliPayAccount = null;
|
|
|
+ localSet("geeker-user", geekerUser);
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error("更新本地存储失败:", error);
|
|
|
+ }
|
|
|
+ // 重新获取用户信息
|
|
|
+ try {
|
|
|
+ const param = {
|
|
|
+ phone: userInfo.value.phone
|
|
|
+ };
|
|
|
+ const res1: any = await getMerchantByPhone(param);
|
|
|
+ if (res1.code == 200) {
|
|
|
+ // 统一处理支付宝账号字段名
|
|
|
+ const updatedData = res1.data || {};
|
|
|
+ // 如果后端返回的支付宝账号为空或null,确保两个字段都是null
|
|
|
+ if (!updatedData.alipayAccount && !updatedData.aliPayAccount) {
|
|
|
+ updatedData.alipayAccount = null;
|
|
|
+ updatedData.aliPayAccount = null;
|
|
|
+ } else if (updatedData.aliPayAccount && !updatedData.alipayAccount) {
|
|
|
+ updatedData.alipayAccount = updatedData.aliPayAccount;
|
|
|
+ }
|
|
|
+ // 更新响应式数据
|
|
|
+ userInfo.value = { ...userInfo.value, ...updatedData };
|
|
|
+ // 确保支付宝账号字段正确
|
|
|
+ userInfo.value.alipayAccount = updatedData.alipayAccount || null;
|
|
|
+ userInfo.value.aliPayAccount = updatedData.aliPayAccount || null;
|
|
|
+ // 更新本地存储
|
|
|
+ const geekerUser = localGet("geeker-user");
|
|
|
+ if (geekerUser) {
|
|
|
+ geekerUser.userInfo = { ...geekerUser.userInfo, ...updatedData };
|
|
|
+ // 确保两个字段名都保存(如果为null也要保存)
|
|
|
+ geekerUser.userInfo.alipayAccount = updatedData.alipayAccount || null;
|
|
|
+ geekerUser.userInfo.aliPayAccount = updatedData.aliPayAccount || null;
|
|
|
+ localSet("geeker-user", geekerUser);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error("获取用户信息失败:", error);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ElMessage.error(res.msg || "删除失败,请重试");
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error("删除支付宝账号失败:", error);
|
|
|
+ ElMessage.error("删除失败,请重试");
|
|
|
+ } finally {
|
|
|
+ loading.value = false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ // 用户取消删除
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
// 跳转到提现申请页面
|
|
|
-const goToCashApply = () => {
|
|
|
- router.push("/financialManagement/cashApply");
|
|
|
-};
|
|
|
+// const goToCashApply = () => {
|
|
|
+// router.push("/financialManagement/cashApply");
|
|
|
+// };
|
|
|
|
|
|
// 忘记密码表单验证规则
|
|
|
const forgotPasswordRules: FormRules = {
|
|
|
- verificationCode: [{ required: true, message: "请输入验证码", trigger: "blur" }]
|
|
|
+ verificationCode: [{ required: true, message: "请输入验证码", trigger: "blur" }],
|
|
|
+ newPassword: [
|
|
|
+ { required: true, message: "请输入新密码", trigger: "blur" },
|
|
|
+ { pattern: /^\d{6}$/, message: "提现密码必须为6位数字", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ confireNewPassword: [
|
|
|
+ { required: true, message: "请确认密码", trigger: "blur" },
|
|
|
+ {
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (value !== forgotPasswordForm.newPassword) {
|
|
|
+ callback(new Error("两次输入的密码不一致"));
|
|
|
+ } else {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ trigger: "blur"
|
|
|
+ }
|
|
|
+ ]
|
|
|
};
|
|
|
|
|
|
// 检查提现密码状态
|
|
|
@@ -733,6 +864,10 @@ const maskedPhone = computed(() => {
|
|
|
}
|
|
|
return userPhone.value.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
|
|
|
});
|
|
|
+// 获取支付宝账号(兼容两种字段名)
|
|
|
+const alipayAccount = computed(() => {
|
|
|
+ return userInfo.value.alipayAccount || userInfo.value.aliPayAccount || null;
|
|
|
+});
|
|
|
|
|
|
const handleTabClick = async (tab: any) => {
|
|
|
// 根据不同的标签页可以跳转到不同的页面或显示不同的内容
|
|
|
@@ -751,6 +886,84 @@ const handleCancel = () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+const handleForgetConfirmZFB = async () => {
|
|
|
+ if (!forgotPasswordFormRef.value) return;
|
|
|
+
|
|
|
+ // 表单验证
|
|
|
+ await forgotPasswordFormRef.value.validate(async valid => {
|
|
|
+ if (valid) {
|
|
|
+ // 验证新密码和确认密码是否一致
|
|
|
+ if (forgotPasswordForm.newPassword !== forgotPasswordForm.confireNewPassword) {
|
|
|
+ ElMessage.error("两次输入的密码不一致");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 验证密码长度
|
|
|
+ if (forgotPasswordForm.newPassword.length !== 6) {
|
|
|
+ ElMessage.error("提现密码必须为6位数字");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ loading.value = true;
|
|
|
+ try {
|
|
|
+ // 第一步:验证短信验证码
|
|
|
+ const checkCodeRes: any = await getCheckSmsCode({
|
|
|
+ phone: userInfo.value.phone,
|
|
|
+ appType: "2",
|
|
|
+ businessType: "7",
|
|
|
+ code: forgotPasswordForm.verificationCode
|
|
|
+ });
|
|
|
+
|
|
|
+ if (checkCodeRes.code !== 200) {
|
|
|
+ ElMessage.error(checkCodeRes.msg || "验证码验证失败");
|
|
|
+ loading.value = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 第二步:设置提现密码
|
|
|
+ const res: any = await setPayPassword({
|
|
|
+ payPassword: forgotPasswordForm.newPassword,
|
|
|
+ id: userInfo.value.id
|
|
|
+ });
|
|
|
+
|
|
|
+ if (res.code == 200) {
|
|
|
+ ElMessage.success(res.msg || "提现密码设置成功");
|
|
|
+
|
|
|
+ // 更新本地存储中的提现密码
|
|
|
+ try {
|
|
|
+ const geekerUser = localGet("geeker-user");
|
|
|
+ if (geekerUser && geekerUser.userInfo) {
|
|
|
+ geekerUser.userInfo.payPassword = forgotPasswordForm.newPassword;
|
|
|
+ localSet("geeker-user", geekerUser);
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error("更新本地存储失败:", error);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 关闭对话框并重置表单
|
|
|
+ forgotPasswordVisible.value = false;
|
|
|
+ forgotPasswordFormRef.value?.resetFields();
|
|
|
+
|
|
|
+ // 重置表单数据
|
|
|
+ forgotPasswordForm.newPassword = "";
|
|
|
+ forgotPasswordForm.confireNewPassword = "";
|
|
|
+ forgotPasswordForm.verificationCode = "";
|
|
|
+
|
|
|
+ // 刷新密码状态
|
|
|
+ await checkPasswordStatus();
|
|
|
+ } else {
|
|
|
+ ElMessage.error(res.msg || "设置提现密码失败");
|
|
|
+ }
|
|
|
+ } catch (error: any) {
|
|
|
+ console.error("设置提现密码失败:", error);
|
|
|
+ ElMessage.error(error?.response?.data?.msg || error?.message || "设置提现密码失败,请稍后重试");
|
|
|
+ } finally {
|
|
|
+ loading.value = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
const handleCancelZFB = () => {
|
|
|
dialogVisibleZFB.value = false;
|
|
|
// 重置表单
|
|
|
@@ -771,7 +984,7 @@ const handleCancelZFB = () => {
|
|
|
// 头部区域
|
|
|
.header-section {
|
|
|
padding: 16px 24px;
|
|
|
- background: linear-gradient(90deg, #6c8ff8 0%, rgb(255 255 255 / 0%) 100%);
|
|
|
+ background: linear-gradient(90deg, #7f9dff 0%, rgb(255 255 255 / 0%) 100%);
|
|
|
border-bottom: 1px solid #e4e7ed;
|
|
|
border-radius: 10px;
|
|
|
.header-content {
|
|
|
@@ -817,7 +1030,7 @@ const handleCancelZFB = () => {
|
|
|
border-radius: 39px;
|
|
|
}
|
|
|
.status-badge-success {
|
|
|
- background: #6c8ff8;
|
|
|
+ background: #7f9dff;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -871,7 +1084,7 @@ const handleCancelZFB = () => {
|
|
|
padding: 22px 35px;
|
|
|
font-size: 16px;
|
|
|
font-weight: 500;
|
|
|
- background-color: #6c8ff8;
|
|
|
+ background-color: #7f9dff;
|
|
|
border: none;
|
|
|
border-radius: 6px;
|
|
|
transition: all 0.3s;
|
|
|
@@ -915,7 +1128,7 @@ const handleCancelZFB = () => {
|
|
|
.operate {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
- color: #6c8ff8;
|
|
|
+ color: #7f9dff;
|
|
|
div {
|
|
|
margin-left: 20px;
|
|
|
}
|
|
|
@@ -954,7 +1167,7 @@ const handleCancelZFB = () => {
|
|
|
margin-top: 20px;
|
|
|
font-size: 16px;
|
|
|
font-weight: 500;
|
|
|
- background-color: #6c8ff8;
|
|
|
+ background-color: #7f9dff;
|
|
|
border: none;
|
|
|
border-radius: 6px;
|
|
|
}
|
|
|
@@ -966,7 +1179,7 @@ const handleCancelZFB = () => {
|
|
|
}
|
|
|
.forget-password {
|
|
|
font-size: 14px;
|
|
|
- color: #6c8ff8;
|
|
|
+ color: #7f9dff;
|
|
|
text-align: right;
|
|
|
cursor: pointer;
|
|
|
}
|