Commit 5a192a24 authored by wykolor's avatar wykolor

fix: 修复bug

parent e7715141
......@@ -7,7 +7,7 @@
<meta name="format-detection" content="telephone=yes">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link rel="stylesheet" href="//at.alicdn.com/t/font_2425189_lvk0clvlo2.css">
<title><%= htmlWebpackPlugin.options.title %></title>
<title>我的奖励金</title>
<script src="https://ssl.captcha.qq.com/TCaptcha.js"></script>
<script>
(function flexible (window, document) {
......
......@@ -8,17 +8,17 @@ export function formatBonusTipTxt(errCode: string): string {
break;
case ErrCode.USER_FREEZE:
case ErrCode.ACCOUNT_FREEZE:
tip = '当前账号存在风险,无法进行提现操作!';
tip = '当前账号存在风险,无法进行提现操作!如需帮助请联系:400-8777389';
break;
case ErrCode.USER_UP_LIMIT:
case ErrCode.SYSTEM_UP_LIMIT:
tip = '今日已达到提现次数/提现金额上限,无法进行提现操作,请明日进行提现操作!';
tip = '今日已达到提现次数/提现金额上限,无法进行提现操作,请明日进行提现操作!如需帮助请联系:400-8777389';
break;
case ErrCode.STUDENT_WITHDRAWING:
tip = '您当前有一笔资金处于提现中,待该笔资金完成提现后,再进行提现操作!';
tip = '您当前有一笔资金处于提现中,待该笔资金完成提现后,再进行提现操作!如需帮助请联系:400-8777389';
break;
case ErrCode.BALANCE_NOT_ENOUGH:
tip = '提现金额至少为:1.00元。当前奖励金账户余额不足,多多转介绍吧!';
tip = '提现金额至少为:1.00元。今日可提现金额不足,烦请明日再来提现!如需帮助请联系:400-8777389';
break;
default:
tip = ''
......
export function countDown(times: number, interval: number, callback: Function) {
export function countDown(times: number, interval = 1000, callback?: Function) {
let count = 0;
let timeCounter;
const timeoutParams: {timeCounter: number | undefined} = { timeCounter: undefined }
function _countDownStart() {
if (timeCounter == null) {
return false;
if (!timeoutParams.timeCounter) {
return;
}
count++;
callback(times - count + 1);
callback && callback(times - count + 1);
if (count > times) {
clearTimeout(timeCounter);
clearTimeout(timeoutParams.timeCounter);
} else {
timeCounter = setTimeout(_countDownStart, interval);
timeoutParams.timeCounter = setTimeout(_countDownStart, interval);
}
}
timeCounter = setTimeout(_countDownStart, interval);
timeoutParams.timeCounter = setTimeout(_countDownStart, interval);
return timeoutParams;
}
......@@ -12,11 +12,10 @@
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
<van-list
v-model:loading="loading"
v-model:error="error"
:finished="finished"
finished-text="~暂无更多数据~"
:immediate-check="false"
@load="onLoad"
:immediate-check="false"
>
<van-tab name="REDUCE" title="支出" class="bonus-detail-pay-list">
<template v-if="reduceList.length">
......@@ -121,7 +120,6 @@ const BonusDetail = defineComponent({
active: route.query.active || "REDUCE",
loading: false,
finished: false,
error: false,
refreshing: false,
BizType
});
......@@ -153,10 +151,11 @@ const BonusDetail = defineComponent({
const {
data: { total, list }
} = await getBonusList(params);
if (total === 0) {
if (!list || total === 0) {
state.finished = true;
return;
}
state.loading = false;
if (state.active === FlowType.REDUCE) {
bonusList.reduceList = bonusList.reduceList.concat(list);
pageReduce.finished = bonusList.reduceList.length === total;
......
......@@ -12,7 +12,7 @@
<van-row class="bonus-account-money" align="center">
<van-col span="12" class="money-desc">
<span style="position: relative"
>¥{{ bonusAccount?.balanceTotal || 0 }}
>¥{{ bonusAccount?.balanceTotal.toFixed(2) || 0.0 }}
<label
class="frozen"
v-if="bonusAccount?.status && bonusAccount?.status === BonusAccountStatus.FREEZE"
......@@ -34,15 +34,15 @@
<van-row class="bonus-account-status">
<van-col span="8">
<label>累计收入</label>
<span>¥{{ bonusAccount?.addTotal || 0 }}</span>
<span>¥{{ bonusAccount?.addTotal.toFixed(2) || 0.0 }}</span>
</van-col>
<van-col span="8">
<label>累计提现</label>
<span>¥{{ bonusAccount?.withdrawedTotal || 0 }}</span>
<span>¥{{ bonusAccount?.withdrawedTotal.toFixed(2) || 0.0 }}</span>
</van-col>
<van-col span="8">
<label>提现中</label>
<span>¥{{ bonusAccount?.withdrawing || 0 }}</span>
<span>¥{{ bonusAccount?.withdrawing.toFixed(2) || 0.0 }}</span>
</van-col>
</van-row>
</div>
......@@ -64,7 +64,7 @@
</van-cell>
<van-cell
center
:title="`可提现金额:¥${bonusAccount?.withdrawableTotal || 0}`"
:title="`今日可提现金额:¥${bonusAccount?.withdrawableTotal.toFixed(2) || 0.0}`"
size="large"
class="withdrawable-money"
:border="false"
......@@ -75,7 +75,7 @@
<van-row>
<van-col span="12" class="tip">&emsp;奖励金提现金额</van-col>
<van-col span="12" class="tip-money" style="text-align: right; font-weight: 550"
>总计:{{ bonusAccount?.withdrawedTotal || 0 }}元&nbsp;</van-col
>总计:{{ bonusAccount?.withdrawedTotal.toFixed(2) || 0.0 }}元&nbsp;</van-col
>
</van-row>
......@@ -118,7 +118,9 @@
<label v-if="item.status === WithdrawStatus.WITHDRAWING">请耐心等候~</label>
</div>
<p class="bonus-record-item-apply-money">
{{ item.status === WithdrawStatus.RECEIVED ? "-" : "" }}¥{{ item.withdrawAmount }}
{{ item.status === WithdrawStatus.RECEIVED ? "-" : "" }}¥{{
item.withdrawAmount.toFixed(2)
}}
</p>
</div>
<ul class="bonus-record-item-detail">
......@@ -431,6 +433,11 @@ export default Bonus;
.bind-wechat {
margin-bottom: 16px;
border-radius: 9px;
justify-content: space-between;
:deep(.van-cell__title),
:deep(.van-cell__value) {
flex: initial;
}
.van-button {
height: 56px;
width: 160px;
......@@ -438,6 +445,11 @@ export default Bonus;
}
.withdrawable-money {
border-radius: 9px;
justify-content: space-between;
:deep(.van-cell__title),
:deep(.van-cell__value) {
flex: initial;
}
.van-button {
height: 56px;
width: 120px;
......@@ -516,8 +528,8 @@ export default Bonus;
}
}
}
::v-deep .bunus-rule-dialog,
::v-deep .bind-wechat-dialog {
:deep(.bunus-rule-dialog),
:deep(.bind-wechat-dialog) {
overflow: initial;
.close {
width: 44px;
......@@ -536,8 +548,8 @@ export default Bonus;
color: #fff;
font-weight: bold;
font-size: 36px;
border-top-left-radius: 28px;
border-top-right-radius: 28px;
border-top-left-radius: 16px;
border-top-right-radius: 16px;
}
}
::v-deep .bunus-rule-dialog {
......
......@@ -42,14 +42,14 @@
<div class="withdraw-tips">预计24小时内到账</div>
</van-button>
</div>
<!-- -->
<!-- 提现弹窗 -->
<van-dialog
v-model:show="showWithdraw"
:show-cancel-button="false"
:show-confirm-button="false"
class="withdraw-dialog"
>
<i class="close" @click="showWithdraw = false"></i>
<i class="close" @click="closeWithdraw"></i>
<ul class="withdraw-dialog-header">
<li>提现至微信账户:{{ withdrawAccount }}</li>
<li class="withdraw-dialog-header-money van-ellipsis">¥{{ withdrawAmount }}</li>
......@@ -96,20 +96,20 @@
block
color="#027AFF;"
style="border: none"
@click="showWithdraw = false"
@click="closeWithdraw"
>关闭</van-button
>
</div>
</van-dialog>
<!-- 提现成功 -->
<!-- 提现成功弹窗 -->
<van-dialog
v-model:show="showWithdrawSuccess"
:show-cancel-button="false"
:show-confirm-button="false"
class="withdraw-success-dialog"
>
<i class="close" @click="showWithdrawSuccess = false"></i>
<i class="close" @click="goBack"></i>
<ul class="withdraw-success-dialog-text">
<li>提现申请成功!</li>
<li>提现金额:</li>
......@@ -135,7 +135,6 @@ import { useRoute } from "vue-router";
import { useStore } from "vuex";
import { useNativeBridge } from "@/util/use-native-bridge";
import { countDown } from "@/util/timer";
// import { debounce } from "@/util/debounce";
import { checkCaptcha, withdraw, getWithdrawRisk } from "@/server/api/bonus";
import { WithdrawResponse } from "@/model/bonus";
import router from "@/router";
......@@ -147,8 +146,10 @@ interface TencentCaptchaResponse {
randstr: string;
}
interface State {
WithdrawResponse: WithdrawResponse | object;
[key: string]: unknown;
WithdrawResponse?: WithdrawResponse | object;
timeoutParams?: { timeCounter: number | undefined };
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: number | string | boolean | any;
}
const Withdraw = defineComponent({
......@@ -165,10 +166,10 @@ const Withdraw = defineComponent({
const route = useRoute();
const store = useStore();
const bonusStoreState = computed(() => store.state.bonus);
const state = reactive({
const state = reactive<State>({
withdrawAmount: 0,
smsVerifyCode: "",
withdrawableTotal: 500.32,
withdrawableTotal: 0,
showTime: "获取验证码",
showWithdraw: false,
showWithdrawSuccess: false,
......@@ -218,7 +219,7 @@ const Withdraw = defineComponent({
const { data } = await checkCaptcha({ randStr: randstr, ticket });
Toast("发送验证码成功");
state.mobileTip = data;
countDown(60, 1000, (time: number) => {
state.timeoutParams = countDown(60, 1000, (time: number) => {
time === 0
? (state.showTime = `获取验证码`)
: (state.showTime = `${time} 后再获取`);
......@@ -239,6 +240,18 @@ const Withdraw = defineComponent({
captcha1.show();
};
// 重置参数
const resetParams = () => {
if (state.timeoutParams && state.timeoutParams.timeCounter) {
clearTimeout(state.timeoutParams.timeCounter);
}
state.tencentCaptchPass = false;
state.smsVerifyPass = false;
state.smsVerifyCode = "";
state.mobileTip = "";
state.showTime = "获取验证码";
};
// 提现
const withdrawReal = async () => {
if (!state.smsVerifyCode) {
......@@ -255,6 +268,7 @@ const Withdraw = defineComponent({
const { data } = await withdraw(params);
state.withdrawResponse = data;
state.showWithdrawSuccess = true;
state.showWithdraw = false;
} catch (err) {
Toast(err);
} finally {
......@@ -262,6 +276,16 @@ const Withdraw = defineComponent({
}
};
const closeWithdraw = () => {
state.showWithdraw = false;
resetParams();
};
const closeWithdrawSuccess = () => {
state.showWithdrawSuccess = false;
resetParams();
};
// 获取风控值
const getWithdrawRiskReq = async () => {
const {
......@@ -288,7 +312,9 @@ const Withdraw = defineComponent({
getSmsVerifyCode,
withdrawSubmit,
withdrawReal,
goBack
goBack,
closeWithdraw,
closeWithdrawSuccess
};
}
});
......@@ -342,29 +368,30 @@ export default Withdraw;
::-webkit-input-placeholder {
/* Chrome/Opera/Safari */
font-size: 30px;
color: #9FA1A3;
color: #9fa1a3;
// opacity: 0.5;
}
::-moz-placeholder {
/* Firefox 19+ */
font-size: 30px;
color: #9FA1A3;
color: #9fa1a3;
}
:-ms-input-placeholder {
/* IE 10+ */
font-size: 30px;
color: #9FA1A3;
color: #9fa1a3;
}
:-moz-placeholder {
/* Firefox 18- */
font-size: 30px;
color: #9FA1A3;
color: #9fa1a3;
}
}
.all {
width: 107px;
height: 56px;
line-height: 56px;
position: absolute;
right: 0;
}
......@@ -387,7 +414,7 @@ export default Withdraw;
height: 36px;
margin-bottom: 80px;
vertical-align: middle;
color: #9FA1A3;
color: #9fa1a3;
vertical-align: middle;
line-height: 36px;
text-align: left;
......@@ -403,6 +430,11 @@ export default Withdraw;
padding-right: 2px;
border-top: 1px solid #ececec;
border-bottom: 1px solid #ececec;
justify-content: space-between;
:deep(.van-cell__title),
:deep(.van-cell__value) {
flex: initial;
}
.slot-value {
display: flex;
align-items: center;
......@@ -519,6 +551,8 @@ export default Withdraw;
position: relative;
font-weight: bold;
margin-bottom: 24px;
line-height: 63px;
height: 63px;
&::after,
&::before {
content: "";
......
......@@ -24,7 +24,7 @@ module.exports = {
changOrigin: true //允许跨域
},
"/api": {
target: "http://172.10.62.92",
target: "http://192.168.32.31",
ws: true,
changOrigin: true //允许跨域
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment