feat: 变现添加输入手机号
This commit is contained in:
+33
-19
@@ -32,7 +32,18 @@
|
||||
</view>
|
||||
<view class="tip-text">请输入去变现数量</view>
|
||||
</view>
|
||||
|
||||
<view class="card code-card">
|
||||
<view class="code-row code-row--mobile">
|
||||
<uni-easyinput
|
||||
v-model="smsMobile"
|
||||
type="number"
|
||||
placeholder="请输入手机号"
|
||||
placeholder-style="font-size: 28rpx;color:#C6C6C6;"
|
||||
:inputBorder="false"
|
||||
:maxlength="11"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="card code-card">
|
||||
<view class="code-row">
|
||||
<uni-easyinput
|
||||
@@ -76,6 +87,7 @@
|
||||
const walletBalanceCents = ref(0);
|
||||
const amount = ref('');
|
||||
const smsCode = ref('');
|
||||
const smsMobile = ref('');
|
||||
const smsCountdown = ref(0);
|
||||
const smsScene = 7;
|
||||
let smsTimer = null;
|
||||
@@ -137,15 +149,8 @@
|
||||
sheep.$helper.toast('请输入验证码');
|
||||
return;
|
||||
}
|
||||
const userStore = sheep.$store('user');
|
||||
if (!userStore?.userInfo?.mobile) {
|
||||
await userStore?.getInfo?.().catch(() => {});
|
||||
}
|
||||
const mobile = userStore?.userInfo?.mobile;
|
||||
if (!mobile) {
|
||||
sheep.$helper.toast('未绑定手机号');
|
||||
return;
|
||||
}
|
||||
const mobile = resolveMobile();
|
||||
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 }));
|
||||
@@ -157,6 +162,15 @@
|
||||
}
|
||||
};
|
||||
|
||||
const resolveMobile = () => {
|
||||
const mobile = String(smsMobile.value || '').trim();
|
||||
if (!/^1\d{10}$/.test(mobile)) {
|
||||
sheep.$helper.toast('请输入正确手机号');
|
||||
return '';
|
||||
}
|
||||
return mobile;
|
||||
};
|
||||
|
||||
const sendSmsCode = async () => {
|
||||
if (smsCountdown.value > 0) return;
|
||||
const amt = amountNumber.value;
|
||||
@@ -168,15 +182,8 @@
|
||||
sheep.$helper.toast('变现金额不能大于钱包余额');
|
||||
return;
|
||||
}
|
||||
const userStore = sheep.$store('user');
|
||||
if (!userStore?.userInfo?.mobile) {
|
||||
await userStore?.getInfo?.().catch(() => {});
|
||||
}
|
||||
const mobile = userStore?.userInfo?.mobile;
|
||||
if (!mobile) {
|
||||
sheep.$helper.toast('未绑定手机号');
|
||||
return;
|
||||
}
|
||||
const mobile = resolveMobile();
|
||||
if (!mobile) return;
|
||||
const res = await AuthUtil.sendSmsCode({ mobile, scene: smsScene }).catch(() => ({ code: -1 }));
|
||||
if (res?.code !== 0) return;
|
||||
smsCountdown.value = 60;
|
||||
@@ -199,6 +206,9 @@
|
||||
|
||||
onShow(() => {
|
||||
refreshWallet();
|
||||
const userStore = sheep.$store('user');
|
||||
const mobile = userStore?.userInfo?.mobile;
|
||||
if (!smsMobile.value && mobile) smsMobile.value = mobile;
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -283,6 +293,10 @@
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.code-row--mobile {
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.code-btn {
|
||||
margin-left: 18rpx;
|
||||
min-width: 168rpx;
|
||||
|
||||
Reference in New Issue
Block a user