feat: 添加跳转链接、提现跳转实名认证

This commit is contained in:
2026-06-22 16:10:17 +08:00
parent 5dc1823786
commit 90fc557ac8
5 changed files with 122 additions and 8 deletions
+28 -6
View File
@@ -92,6 +92,7 @@
const smsCountdown = ref(0);
const smsScene = 7;
let smsTimer = null;
const submitting = ref(false);
const sanitizeAmountInput = (val) => {
let next = String(val ?? '').replace(/[^\d.]/g, '');
@@ -136,6 +137,7 @@
};
const submit = async () => {
if (submitting.value) return;
const amt = amountNumber.value;
if (!amt) {
sheep.$helper.toast('请输入去变现数量');
@@ -154,12 +156,32 @@
if (!mobile) return;
const money = Math.round(amt * 100);
const payload = { money, mobile, scene: smsScene, code: smsCode.value };
const res = await incrementApi.walletLiquidation(payload).catch(() => ({ code: -1 }));
if (res?.code === 0) {
sheep.$helper.toast('变现成功,请等待审核');
amount.value = '';
smsCode.value = '';
refreshWallet();
submitting.value = true;
try {
const res = await incrementApi.walletLiquidation(payload).catch(() => ({ code: -1 }));
if (res?.code === 0) {
sheep.$helper.toast('变现成功,请等待审核');
amount.value = '';
smsCode.value = '';
refreshWallet();
return;
}
if (res?.code === 1006001000) {
uni.showModal({
title: '提示',
content: '您还未实名认证,是否前往实名认证?',
cancelText: '取消',
confirmText: '去认证',
success: (modalRes) => {
if (!modalRes?.confirm) return;
uni.navigateTo({
url: '/pages/public/realname',
});
},
});
}
} finally {
submitting.value = false;
}
};
+78
View File
@@ -7,6 +7,7 @@
style="height: 150rpx"
v-for="(v, i) in detailList"
:key="i"
@tap.stop="onRecordTap(v)"
>
<view class="c0">
<view class="size28"> 发起变现 </view>
@@ -35,13 +36,90 @@
import card_mescroll from '@/components/card_pages/card_mescroll.vue';
import { fen2yuan } from '@/sheep/hooks/useGoods';
import * as api from '@/sheep/api/increment';
import { getTokenPhone } from '@/sheep/api/infra/trade';
let detailList = ref([]);
let height = ref('100%');
const tokenLoading = ref(false);
let sysInfo = uni.getSystemInfoSync();
height.value = sysInfo.windowHeight - sysInfo.statusBarHeight - uni.upx2px(88) + 'px';
let cardPages = ref(null);
const resolvePhone = (record) => {
const raw =
record?.phone ??
record?.mobile ??
record?.userMobile ??
record?.memberMobile ??
record?.memberPhone ??
record?.userPhone ??
'';
return String(raw || '').trim();
};
const requestLinkByPhone = async (phone) => {
const payload = await getTokenPhone(phone).catch(() => null);
if (!payload) throw new Error('请求失败');
if (payload?.code !== 0) {
throw new Error(payload?.msg || payload?.message || '请求失败');
}
const link = payload?.data?.link;
return String(link || '').trim();
};
const normalizeLink = (input) => {
let url = String(input || '').trim();
if (!url) return '';
url = url.replace(/[`"']/g, '').trim();
return url;
};
const openExternal = (url) => {
const nextUrl = normalizeLink(url);
if (!nextUrl) return false;
if (typeof plus !== 'undefined' && plus.runtime && typeof plus.runtime.openURL === 'function') {
plus.runtime.openURL(nextUrl);
return true;
}
if (typeof window !== 'undefined' && typeof window.open === 'function') {
window.open(nextUrl, '_blank');
return true;
}
uni.setClipboardData({
data: nextUrl,
success: () => {
uni.showModal({
content: '链接已复制,请在浏览器打开',
showCancel: false,
});
},
});
return true;
};
const onRecordTap = async (record) => {
const phone = resolvePhone(record);
if (!phone) {
sheep.$helper.toast('该记录未包含手机号');
return;
}
if (tokenLoading.value) return;
tokenLoading.value = true;
try {
const link = await requestLinkByPhone(phone);
const nextLink = normalizeLink(link);
if (!nextLink) {
sheep.$helper.toast('接口未返回 link');
return;
}
openExternal(nextLink);
} catch (e) {
sheep.$helper.toast(e?.message || '请求失败');
} finally {
tokenLoading.value = false;
}
};
const getList = async (mescroll) => {
const res = await api.walletLiquidationRecordPage({
pageNo: mescroll.num,