Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mall-webview
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
frontend
mall-webview
Commits
21ea442b
Commit
21ea442b
authored
Apr 25, 2021
by
wykolor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 组件拆分优化
parent
06c62d01
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
544 additions
and
424 deletions
+544
-424
index.ts
src/model/bonus/index.ts
+5
-4
bonus.ts
src/server/api/bonus.ts
+1
-1
http.ts
src/server/http.ts
+0
-30
bindWXDialog.vue
src/views/bonus/bindWXDialog.vue
+90
-0
index.vue
src/views/bonus/index.vue
+18
-55
index.scss
src/views/bonus/withdraw/index.scss
+1
-148
index.vue
src/views/bonus/withdraw/index.vue
+23
-186
withdrawDialog.vue
src/views/bonus/withdraw/withdrawDialog.vue
+257
-0
withdrawSuccessDialog.vue
src/views/bonus/withdraw/withdrawSuccessDialog.vue
+149
-0
No files found.
src/model/bonus/index.ts
View file @
21ea442b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: wykolor
* @Author: wykolor
* @Date: 2021-03-23 11:44:35
* @Date: 2021-03-23 11:44:35
* @Last Modified by: mikey.zhaopeng
* @Last Modified by: mikey.zhaopeng
* @Last Modified time: 2021-04-
07 17:24:47
* @Last Modified time: 2021-04-
25 17:46:04
*/
*/
export
interface
PageParams
{
export
interface
PageParams
{
...
@@ -77,9 +77,10 @@ export interface CheckCaptchaParams {
...
@@ -77,9 +77,10 @@ export interface CheckCaptchaParams {
}
}
export
interface
WithdrawParams
{
export
interface
WithdrawParams
{
withdrawAmount
:
number
;
withdrawAmount
:
any
;
studentId
:
number
;
studentId
:
any
;
smsVerifyCode
:
string
;
smsVerifyCode
:
any
;
withdrawAccountId
:
any
;
}
}
export
interface
WithdrawResponse
{
export
interface
WithdrawResponse
{
...
...
src/server/api/bonus.ts
View file @
21ea442b
...
@@ -37,7 +37,7 @@ export const checkCaptcha = (params: CheckCaptchaParams) => {
...
@@ -37,7 +37,7 @@ export const checkCaptcha = (params: CheckCaptchaParams) => {
};
};
// 提现
// 提现
export
const
withdraw
=
(
params
:
WithdrawParams
)
=>
{
export
const
withdraw
=
(
params
:
object
)
=>
{
return
post
<
WithdrawResponse
>
(
"/api-jksxb-app/v1/withdraw"
,
params
);
return
post
<
WithdrawResponse
>
(
"/api-jksxb-app/v1/withdraw"
,
params
);
};
};
...
...
src/server/http.ts
View file @
21ea442b
...
@@ -13,36 +13,6 @@ const instance = axios.create({
...
@@ -13,36 +13,6 @@ const instance = axios.create({
withCredentials
:
true
withCredentials
:
true
});
});
// function startLoading() {
// Toast.loading({
// message: "加载中...",
// forbidClick: true,
// duration: 0
// });
// }
// function endLoading() {
// Toast.clear();
// }
// 声明一个对象用于存储请求个数
// let needLoadingRequestCount = 0;
// function showFullScreenLoading() {
// if (needLoadingRequestCount === 0) {
// startLoading();
// }
// needLoadingRequestCount++;
// }
// function tryHideFullScreenLoading() {
// if (needLoadingRequestCount <= 0) return;
// needLoadingRequestCount--;
// if (needLoadingRequestCount === 0) {
// endLoading();
// }
// }
let
globalToken
:
string
|
null
=
null
;
let
globalToken
:
string
|
null
=
null
;
// 拦截器 在请求之前拦截
// 拦截器 在请求之前拦截
...
...
src/views/bonus/bindWXDialog.vue
0 → 100644
View file @
21ea442b
<
template
>
<van-dialog
v-model:show=
"showDialog"
:show-cancel-button=
"false"
:show-confirm-button=
"false"
:title=
"withdrawAccount ? '确认换绑微信' : '绑定微信'"
class=
"bind-wechat-dialog"
>
<i
class=
"close"
@
click=
"$emit('update:show', false)"
></i>
<p
class=
"dangerous-dialog-tip"
>
{{
withdrawAccount
?
"换绑后,将提现到新绑定的微信零钱中!"
:
"绑定微信后,才可进行提现!"
}}
</p>
<div
class=
"dialog-handle-btns"
>
<van-button
type=
"default"
round
@
click=
"$emit('update:show', false)"
>
取消
</van-button
><van-button
type=
"primary"
round
@
click=
"bindWeiChatModal"
:disabled=
"binding"
:loading=
"binding"
loading-text=
"绑定中..."
>
绑定微信
</van-button
>
</div>
</van-dialog>
</
template
>
<
script
lang=
"ts"
>
import
{
defineComponent
,
ref
,
watchEffect
}
from
"vue"
import
{
Dialog
,
Button
,
Toast
}
from
"vant"
import
{
bindWeChat
}
from
"@/util/use-native-bridge"
import
{
bindWeiChat
}
from
"@/server/api/bonus"
export
default
defineComponent
({
components
:
{
[
Dialog
.
Component
.
name
]:
Dialog
.
Component
,
[
Button
.
name
]:
Button
,
},
props
:
{
show
:
Boolean
,
withdrawAccount
:
String
,
},
emits
:
[
"updateBonusAccount"
,
"update:show"
],
setup
(
props
,
context
)
{
const
binding
=
ref
(
false
)
const
showDialog
=
ref
(
false
)
watchEffect
(()
=>
{
showDialog
.
value
=
props
.
show
})
const
bindWeiChatModal
=
async
()
=>
{
binding
.
value
=
true
try
{
const
params
=
await
bindWeChat
()
await
bindWeiChat
(
params
)
Toast
(
"绑定成功"
)
context
.
emit
(
"update:show"
,
false
)
context
.
emit
(
"updateBonusAccount"
)
}
catch
(
err
)
{
Toast
(
"绑定失败"
)
}
finally
{
binding
.
value
=
false
}
}
return
{
showDialog
,
bindWeiChatModal
,
binding
}
},
})
</
script
>
<
style
lang=
"scss"
scoped
>
.dialog-handle-btns
{
display
:
flex
;
margin-top
:
48px
;
padding
:
30px
;
margin-bottom
:
30px
;
justify-content
:
space-between
;
.van-button
{
flex
:
0
.47
;
font-size
:
28px
;
}
}
.dangerous-dialog-tip
{
padding
:
0
48px
;
text-align
:
center
;
line-height
:
44px
;
}
</
style
>
src/views/bonus/index.vue
View file @
21ea442b
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<van-col
span=
"12"
style=
"opacity: 0.5;"
<van-col
span=
"12"
style=
"opacity: 0.5;"
><i
class=
"iconfont icon-qiandai"
>
</i><span>
账户余额(元)
</span></van-col
><i
class=
"iconfont icon-qiandai"
>
</i><span>
账户余额(元)
</span></van-col
>
>
<van-col
span=
"12"
style=
"text-align: right"
@
click=
"
withdrawRul
e"
<van-col
span=
"12"
style=
"text-align: right"
@
click=
"
showWithdrawRules = tru
e"
><span>
提现规则
</span>
<i
class=
"iconfont icon-tishi"
></i
><span>
提现规则
</span>
<i
class=
"iconfont icon-tishi"
></i
></van-col>
></van-col>
</van-row>
</van-row>
...
@@ -82,34 +82,12 @@
...
@@ -82,34 +82,12 @@
</div>
</div>
<!-- 规则弹窗 -->
<!-- 规则弹窗 -->
<WithdrawRulesDialog
v-model:show=
"showWithdrawRules"
/>
<WithdrawRulesDialog
v-model:show=
"showWithdrawRules"
/>
<van-dialog
<!-- 绑定微信弹窗 -->
<BindWXDialog
v-model:show=
"showBindWx"
v-model:show=
"showBindWx"
:show-cancel-button=
"false"
:withdrawAccount=
"bonusAccount?.withdrawAccount"
:show-confirm-button=
"false"
@
updateBonusAccount=
"getBonusAccountReq"
:title=
"bonusAccount?.withdrawAccount ? '确认换绑微信' : '绑定微信'"
/>
class=
"bind-wechat-dialog"
>
<i
class=
"close"
@
click=
"showBindWx = false"
></i>
<p
class=
"dangerous-dialog-tip"
>
{{
bonusAccount
?.
withdrawAccount
?
"换绑后,将提现到新绑定的微信零钱中!"
:
"绑定微信后,才可进行提现!"
}}
</p>
<div
class=
"dialog-handle-btns"
>
<van-button
type=
"default"
round
@
click=
"showBindWx = false"
>
取消
</van-button
><van-button
type=
"primary"
round
@
click=
"bindWeiChatModal"
:disabled=
"binding"
:loading=
"binding"
loading-text=
"绑定中..."
>
绑定微信
</van-button
>
</div>
</van-dialog>
<!-- 奖励金账户状态弹窗 -->
<!-- 奖励金账户状态弹窗 -->
<WithdrawableDialog
v-model:show=
"showDangerous"
:errCode=
"bonusAccount?.errCode"
/>
<WithdrawableDialog
v-model:show=
"showDangerous"
:errCode=
"bonusAccount?.errCode"
/>
</div>
</div>
...
@@ -121,10 +99,11 @@ import { computed, defineComponent, onMounted, reactive, toRefs } from "vue";
...
@@ -121,10 +99,11 @@ import { computed, defineComponent, onMounted, reactive, toRefs } from "vue";
import
{
useRoute
,
useRouter
}
from
"vue-router"
;
import
{
useRoute
,
useRouter
}
from
"vue-router"
;
import
{
useStore
}
from
"vuex"
;
import
{
useStore
}
from
"vuex"
;
import
{
Dialog
,
Button
,
Col
,
Row
,
Cell
,
Loading
,
Toast
}
from
"vant"
;
import
{
Button
,
Col
,
Row
,
Cell
,
Loading
,
Toast
}
from
"vant"
;
import
WithdrawList
from
"./withdrawList.vue"
;
import
WithdrawList
from
"./withdrawList.vue"
;
import
WithdrawRulesDialog
from
"./withdrawRulesDialog.vue"
;
import
WithdrawRulesDialog
from
"./withdrawRulesDialog.vue"
;
import
WithdrawableDialog
from
"./withdrawableDialog.vue"
;
import
WithdrawableDialog
from
"./withdrawableDialog.vue"
;
import
BindWXDialog
from
"./bindWXDialog.vue"
;
import
{
BonusAccountResponse
}
from
"@/model/bonus"
;
import
{
BonusAccountResponse
}
from
"@/model/bonus"
;
import
{
BonusAccountStatus
,
ErrCode
}
from
"@/model/bonus/constant"
;
import
{
BonusAccountStatus
,
ErrCode
}
from
"@/model/bonus/constant"
;
import
{
bindWeChat
,
useNativeBridge
}
from
"@/util/use-native-bridge"
;
import
{
bindWeChat
,
useNativeBridge
}
from
"@/util/use-native-bridge"
;
...
@@ -141,11 +120,11 @@ const Bonus = defineComponent({
...
@@ -141,11 +120,11 @@ const Bonus = defineComponent({
[
Col
.
name
]:
Col
,
[
Col
.
name
]:
Col
,
[
Row
.
name
]:
Row
,
[
Row
.
name
]:
Row
,
[
Cell
.
name
]:
Cell
,
[
Cell
.
name
]:
Cell
,
[
Dialog
.
Component
.
name
]:
Dialog
.
Component
,
[
Loading
.
name
]:
Loading
,
[
Loading
.
name
]:
Loading
,
WithdrawList
,
WithdrawList
,
WithdrawRulesDialog
,
WithdrawRulesDialog
,
WithdrawableDialog
WithdrawableDialog
,
BindWXDialog
},
},
setup
()
{
setup
()
{
const
route
=
useRoute
();
const
route
=
useRoute
();
...
@@ -156,17 +135,16 @@ const Bonus = defineComponent({
...
@@ -156,17 +135,16 @@ const Bonus = defineComponent({
store
.
commit
(
"bonus/saveStudentId"
,
studentId
);
store
.
commit
(
"bonus/saveStudentId"
,
studentId
);
store
.
commit
(
"bonus/saveToken"
,
token
);
store
.
commit
(
"bonus/saveToken"
,
token
);
store
.
commit
(
"bonus/saveUserId"
,
userId
);
store
.
commit
(
"bonus/saveUserId"
,
userId
);
const
[
sendNativeMessage
]
=
useNativeBridge
(
"test"
,
()
=>
{
//
});
const
state
=
reactive
<
BonusState
>
({
const
state
=
reactive
<
BonusState
>
({
showWithdrawRules
:
false
,
showWithdrawRules
:
false
,
showBindWx
:
false
,
showBindWx
:
false
,
showDangerous
:
false
,
showDangerous
:
false
,
bonusAccount
:
null
,
bonusAccount
:
null
,
binding
:
false
,
BonusAccountStatus
BonusAccountStatus
});
});
const
[
sendNativeMessage
]
=
useNativeBridge
(
"test"
,
function
()
{
// state.showBindWx = false;
});
// 获取奖励金信息
// 获取奖励金信息
const
getBonusAccountReq
=
async
()
=>
{
const
getBonusAccountReq
=
async
()
=>
{
...
@@ -180,6 +158,7 @@ const Bonus = defineComponent({
...
@@ -180,6 +158,7 @@ const Bonus = defineComponent({
Toast
.
clear
();
Toast
.
clear
();
}
}
};
};
onMounted
(()
=>
{
onMounted
(()
=>
{
const
message
=
{
const
message
=
{
type
:
"title"
,
type
:
"title"
,
...
@@ -188,6 +167,7 @@ const Bonus = defineComponent({
...
@@ -188,6 +167,7 @@ const Bonus = defineComponent({
sendNativeMessage
(
message
);
sendNativeMessage
(
message
);
getBonusAccountReq
();
getBonusAccountReq
();
});
});
const
withdraw
=
()
=>
{
const
withdraw
=
()
=>
{
if
(
!
state
.
bonusAccount
?.
errCode
)
{
if
(
!
state
.
bonusAccount
?.
errCode
)
{
// 都正常的状态
// 都正常的状态
...
@@ -205,24 +185,7 @@ const Bonus = defineComponent({
...
@@ -205,24 +185,7 @@ const Bonus = defineComponent({
state
.
showDangerous
=
true
;
state
.
showDangerous
=
true
;
}
}
};
};
const
withdrawRule
=
()
=>
{
state
.
showWithdrawRules
=
true
;
};
const
bindWeiChatModal
=
async
()
=>
{
state
.
binding
=
true
;
try
{
const
params
=
await
bindWeChat
();
await
bindWeiChat
(
params
);
Toast
(
"绑定成功"
);
state
.
showBindWx
=
false
;
getBonusAccountReq
();
}
catch
(
err
)
{
Toast
(
"绑定失败"
);
}
finally
{
state
.
binding
=
false
;
}
};
// 绑定或者换邦
// 绑定或者换邦
const
bindWeiChatOrUnbind
=
async
()
=>
{
const
bindWeiChatOrUnbind
=
async
()
=>
{
// 已经绑定微信
// 已经绑定微信
...
@@ -239,13 +202,13 @@ const Bonus = defineComponent({
...
@@ -239,13 +202,13 @@ const Bonus = defineComponent({
Toast
(
"绑定失败"
);
Toast
(
"绑定失败"
);
}
}
};
};
return
{
return
{
...
toRefs
(
state
),
...
toRefs
(
state
),
withdraw
,
withdraw
,
withdrawRule
,
bindWeiChatModal
,
bindWeiChatOrUnbind
,
bindWeiChatOrUnbind
,
bonusStoreState
bonusStoreState
,
getBonusAccountReq
};
};
}
}
});
});
...
...
src/views/bonus/withdraw/index.scss
View file @
21ea442b
...
@@ -138,8 +138,7 @@
...
@@ -138,8 +138,7 @@
border-radius
:
51px
;
border-radius
:
51px
;
}
}
}
}
:deep
.withdraw-dialog
,
:deep
.dialog
{
:deep
.withdraw-success-dialog
{
overflow
:
initial
;
overflow
:
initial
;
.close
{
.close
{
width
:
44px
;
width
:
44px
;
...
@@ -152,149 +151,4 @@
...
@@ -152,149 +151,4 @@
top
:
-78px
;
top
:
-78px
;
}
}
}
}
:deep
.withdraw-dialog
{
padding
:
48px
;
color
:
#fff
;
width
:
622px
;
&
-header
{
background
:
url("~@/assets/images/bonus/withdraw-bg.png")
no-repeat
;
background-size
:
100%
;
padding
:
32px
30px
;
&
-money
{
font-size
:
60px
;
font-weight
:
600
;
margin
:
40px
0
47px
;
}
}
&
-field
{
margin-top
:
80px
;
&
-input
{
display
:
flex
;
align-items
:
center
;
.van-cell
{
flex
:
1
;
padding
:
0
;
.van-field__control
{
padding
:
22px
0
22px
45px
;
border
:
2px
solid
#dcdee0
;
border-right
:
none
;
border-radius
:
8px
0px
0px
8px
;
height
:
80px
;
width
:
306px
;
}
}
.van-button
{
width
:
220px
;
height
:
80px
;
background
:
#027aff
;
border-radius
:
0px
8px
8px
0px
;
font-size
:
26px
;
box-sizing
:
border-box
;
}
}
&
-tip
{
text-align
:
center
;
color
:
#484c4f
;
font-size
:
24px
;
margin-top
:
24px
;
}
}
.handle-btns
{
margin-top
:
64px
;
.van-button
{
height
:
100px
;
}
}
}
:deep
.withdraw-success-dialog
{
padding
:
60px
51px
35px
;
background
:
url("~@/assets/images/bonus/withdraw-success.png")
no-repeat
;
background-size
:
100%
100%
;
height
:
785px
;
box-sizing
:
border-box
;
font-size
:
26px
;
&
-text
{
line-height
:
50px
;
text-align
:
center
;
li
{
&
:nth-of-type
(
1
)
{
font-size
:
55px
;
background
:
linear-gradient
(
360deg
,
#ef1237
0%
,
#fd7940
100%
);
-webkit-background-clip
:
text
;
color
:
transparent
;
font-style
:
italic
;
position
:
relative
;
font-weight
:
bold
;
margin-bottom
:
24px
;
line-height
:
63px
;
height
:
63px
;
&
:
:
after
,
&::
before
{
content
:
""
;
display
:
inline-block
;
width
:
63px
;
height
:
5px
;
background
:
linear-gradient
(
270deg
,
#fdbd99
0%
,
rgba
(
255
,
255
,
255
,
0
)
100%
);
position
:
absolute
;
top
:
50%
;
}
&
:
:
before
{
left
:
0
;
}
&
:
:
after
{
background
:
linear-gradient
(
270deg
,
rgba
(
255
,
255
,
255
,
0
)
0%
,
#fdbd99
100%
);
right
:
0
;
}
}
&
:nth-of-type
(
2
)
{
font-size
:
32px
;
font-weight
:
500
;
margin-bottom
:
16px
;
}
&
:nth-of-type
(
3
)
{
font-size
:
64px
;
font-family
:
DINAlternate-Bold
,
DINAlternate
;
font-weight
:
bold
;
color
:
#1a1a1a
;
line-height
:
63px
;
background
:
linear-gradient
(
360deg
,
#ef1237
0%
,
#fd7940
100%
);
-webkit-background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;
margin-bottom
:
39px
;
}
&
:nth-of-type
(
4
),
&
:nth-of-type
(
5
)
{
margin-bottom
:
11px
;
}
&
:nth-of-type
(
4
),
&
:nth-of-type
(
6
)
{
font-size
:
28px
;
}
&
:nth-of-type
(
6
)
{
margin-bottom
:
7px
;
}
&
:nth-of-type
(
5
),
&
:nth-of-type
(
7
)
{
opacity
:
0
.8
;
}
}
}
&
-btns
{
text-align
:
center
;
.van-button
{
margin-top
:
100px
;
padding
:
0
100px
;
height
:
100px
;
line-height
:
100px
;
width
:
380px
;
color
:
#f03d04
;
border
:
none
;
background
:
linear-gradient
(
to
bottom
,
#ffeb8c
,
#fe9f56
);
}
}
}
}
}
\ No newline at end of file
src/views/bonus/withdraw/index.vue
View file @
21ea442b
...
@@ -43,111 +43,33 @@
...
@@ -43,111 +43,33 @@
</van-button>
</van-button>
</div>
</div>
<!-- 提现弹窗 -->
<!-- 提现弹窗 -->
<
van-d
ialog
<
WithdrawD
ialog
v-model:show=
"showWithdraw"
v-model:show=
"showWithdraw"
:show-cancel-button=
"false"
:withdrawAmount=
"Number(withdrawAmount)"
:show-confirm-button=
"false"
:withdrawAccount=
"withdrawAccount"
class=
"withdraw-dialog"
@
withdrawSuccess=
"withdrawSuccess"
>
/>
<i
class=
"close"
@
click=
"closeWithdraw"
></i>
<ul
class=
"withdraw-dialog-header"
>
<li>
提现至微信账户:
{{
withdrawAccount
}}
</li>
<li
class=
"withdraw-dialog-header-money van-ellipsis"
>
¥
{{
withdrawAmount
}}
</li>
</ul>
<ul
class=
"withdraw-dialog-field"
>
<li
class=
"withdraw-dialog-field-input"
>
<van-field
v-model=
"smsVerifyCode"
type=
"digit"
label-width=
"0"
placeholder=
"请输入验证码"
>
</van-field>
<van-button
type=
"primary"
color=
"#027AFF"
:disabled=
"smsVerifyPass"
@
click=
"getSmsVerifyCode"
>
{{
showTime
}}
</van-button
>
</li>
<li
class=
"withdraw-dialog-field-tip"
v-if=
"mobileTip"
>
今日可提现已将验证码发送至
{{
mobileTip
}}
</li>
</ul>
<div
class=
"handle-btns"
>
<van-button
:loading=
"withdrawing"
:disabled=
"withdrawing || !tencentCaptchPass || !smsVerifyCode"
loading-text=
"提现中..."
round
type=
"primary"
size=
"large"
block
color=
"#027AFF;"
@
click=
"withdrawReal"
>
确定
</van-button
>
<van-button
plain
round
type=
"primary"
size=
"large"
block
color=
"#027AFF;"
style=
"border: none"
@
click=
"closeWithdraw"
>
关闭
</van-button
>
</div>
</van-dialog>
<!-- 提现成功弹窗 -->
<!-- 提现成功弹窗 -->
<
van-d
ialog
<
WithdrawSuccessD
ialog
v-model:show=
"showWithdrawSuccess"
v-model:show=
"showWithdrawSuccess"
:show-cancel-button=
"false"
:withdrawResponse=
"withdrawResponse"
:show-confirm-button=
"false"
/>
class=
"withdraw-success-dialog"
>
<i
class=
"close"
@
click=
"goBack"
></i>
<ul
class=
"withdraw-success-dialog-text"
>
<li>
提现申请成功!
</li>
<li>
提现金额:
</li>
<li>
¥
{{
withdrawResponse
?.
amount
.
toFixed
(
2
)
}}
</li>
<li>
提现至微信
</li>
<li>
{{
withdrawResponse
?.
withdrawAccount
}}
</li>
<li>
预计到账时间
</li>
<li>
{{
withdrawResponse
?.
expectedPayTime
}}
</li>
</ul>
<div
class=
"withdraw-success-dialog-btns"
>
<van-button
round
type=
"primary"
size=
"large"
@
click=
"goBack"
>
确定
</van-button>
</div>
</van-dialog>
</div>
</div>
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
declare
const
TencentCaptcha
:
any
;
import
{
computed
,
defineComponent
,
onMounted
,
reactive
,
toRefs
}
from
"vue"
;
import
{
computed
,
defineComponent
,
onMounted
,
reactive
,
toRefs
}
from
"vue"
;
import
{
Button
,
Cell
,
Dialog
,
Field
,
Toast
}
from
"vant"
;
import
{
Button
,
Cell
,
Dialog
,
Field
,
Toast
}
from
"vant"
;
import
{
useRoute
}
from
"vue-router"
;
import
{
useRoute
}
from
"vue-router"
;
import
{
useStore
}
from
"vuex"
;
import
{
useStore
}
from
"vuex"
;
import
{
sendNativeMessage
}
from
"@/util/use-native-bridge"
;
import
{
sendNativeMessage
}
from
"@/util/use-native-bridge"
;
import
{
countDown
}
from
"@/util/timer"
;
import
{
getWithdrawRisk
}
from
"@/server/api/bonus"
;
import
{
checkCaptcha
,
withdraw
,
getWithdrawRisk
}
from
"@/server/api/bonus"
;
import
{
WithdrawResponse
}
from
"@/model/bonus"
;
import
{
WithdrawResponse
}
from
"@/model/bonus"
;
import
router
from
"@/router"
;
import
WithdrawSuccessDialog
from
"./withdrawSuccessDialog.vue"
;
interface
TencentCaptchaResponse
{
import
WithdrawDialog
from
"./withdrawDialog.vue"
;
ret
:
number
;
ticket
:
string
;
appid
:
string
;
bizState
:
unknown
;
randstr
:
string
;
}
interface
State
{
interface
State
{
WithdrawResponse
?:
WithdrawResponse
|
object
;
WithdrawResponse
?:
WithdrawResponse
|
object
;
timeoutParams
?:
{
timeCounter
:
number
|
undefined
};
withdrawAccountId
:
string
;
withdrawAccountId
:
string
;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[
key
:
string
]:
number
|
string
|
boolean
|
any
;
[
key
:
string
]:
number
|
string
|
boolean
|
any
;
...
@@ -158,32 +80,30 @@ const Withdraw = defineComponent({
...
@@ -158,32 +80,30 @@ const Withdraw = defineComponent({
[
Button
.
name
]:
Button
,
[
Button
.
name
]:
Button
,
[
Cell
.
name
]:
Cell
,
[
Cell
.
name
]:
Cell
,
[
Field
.
name
]:
Field
,
[
Field
.
name
]:
Field
,
[
Dialog
.
Component
.
name
]:
Dialog
.
Component
[
Dialog
.
Component
.
name
]:
Dialog
.
Component
,
WithdrawSuccessDialog
,
WithdrawDialog
},
},
setup
()
{
setup
()
{
const
route
=
useRoute
();
const
route
=
useRoute
();
const
store
=
useStore
();
const
store
=
useStore
();
const
bonusStoreState
=
computed
(()
=>
store
.
state
.
bonus
);
const
bonusStoreState
=
computed
(()
=>
store
.
state
.
bonus
);
const
state
=
reactive
<
State
>
({
const
state
=
reactive
<
State
>
({
withdrawAmount
:
0
,
withdrawAmount
:
0
,
smsVerifyCode
:
""
,
withdrawableTotal
:
0
,
withdrawableTotal
:
0
,
showTime
:
"获取验证码"
,
showWithdraw
:
false
,
showWithdraw
:
false
,
showWithdrawSuccess
:
false
,
showWithdrawSuccess
:
false
,
mobileTip
:
""
,
withdrawAccount
:
""
,
withdrawAccount
:
""
,
withdrawAccountId
:
""
,
withdrawAccountId
:
""
,
withdrawResponse
:
{},
withdrawResponse
:
{},
studentDailyWithdrawLimit
:
0
,
// 学生单日提现上限
studentDailyWithdrawLimit
:
0
// 学生单日提现上限
withdrawing
:
false
,
tencentCaptchPass
:
false
,
// 图形验证码是否通过
smsVerifyPass
:
false
});
});
const
{
withdrawableTotal
,
withdrawAccount
,
withdrawAccountId
}
=
route
.
params
;
const
{
withdrawableTotal
,
withdrawAccount
,
withdrawAccountId
}
=
route
.
params
;
state
.
withdrawableTotal
=
Number
(
withdrawableTotal
);
state
.
withdrawableTotal
=
Number
(
withdrawableTotal
);
state
.
withdrawAccount
=
withdrawAccount
as
string
;
state
.
withdrawAccount
=
withdrawAccount
as
string
;
state
.
withdrawAccountId
=
withdrawAccountId
as
string
;
state
.
withdrawAccountId
=
withdrawAccountId
as
string
;
const
formatter
=
value
=>
{
const
formatter
=
value
=>
{
if
(
value
<=
0
)
return
""
;
if
(
value
<=
0
)
return
""
;
if
(
value
>
state
.
withdrawableTotal
)
{
if
(
value
>
state
.
withdrawableTotal
)
{
...
@@ -206,85 +126,10 @@ const Withdraw = defineComponent({
...
@@ -206,85 +126,10 @@ const Withdraw = defineComponent({
state
.
showWithdraw
=
true
;
state
.
showWithdraw
=
true
;
};
};
// 获取验证码
// 提现成功
const
getSmsVerifyCode
=
()
=>
{
const
withdrawSuccess
=
data
=>
{
const
captcha1
=
new
TencentCaptcha
(
state
.
withdrawResponse
=
data
;
"2087826974"
,
state
.
showWithdrawSuccess
=
true
;
async
(
res
:
TencentCaptchaResponse
)
=>
{
const
{
ret
,
randstr
,
ticket
}
=
res
;
if
(
ret
===
0
)
{
state
.
tencentCaptchPass
=
true
;
state
.
smsVerifyPass
=
true
;
try
{
const
data
=
await
checkCaptcha
({
randStr
:
randstr
,
ticket
});
Toast
(
"发送验证码成功"
);
state
.
mobileTip
=
data
;
state
.
timeoutParams
=
countDown
(
60
,
1000
,
(
time
:
number
)
=>
{
time
===
0
?
(
state
.
showTime
=
`获取验证码`
)
:
(
state
.
showTime
=
`
${
time
}
后再获取`
);
if
(
time
===
0
)
{
state
.
smsVerifyPass
=
false
;
}
});
}
catch
{
Toast
(
"发送验证码失败,请重试"
);
state
.
smsVerifyPass
=
false
;
}
}
},
{
needFeedBack
:
false
}
);
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
)
{
Toast
(
"请输入验证码"
);
return
;
}
state
.
withdrawing
=
true
;
try
{
const
params
=
{
studentId
:
bonusStoreState
.
value
.
studentId
,
smsVerifyCode
:
state
.
smsVerifyCode
,
withdrawAmount
:
state
.
withdrawAmount
,
withdrawAccountId
:
state
.
withdrawAccountId
};
const
data
=
await
withdraw
(
params
);
state
.
withdrawResponse
=
data
;
state
.
showWithdrawSuccess
=
true
;
state
.
showWithdraw
=
false
;
}
catch
(
err
)
{
Toast
(
err
);
}
finally
{
state
.
withdrawing
=
false
;
}
};
const
closeWithdraw
=
()
=>
{
state
.
showWithdraw
=
false
;
resetParams
();
};
const
closeWithdrawSuccess
=
()
=>
{
state
.
showWithdrawSuccess
=
false
;
resetParams
();
};
};
// 获取风控值
// 获取风控值
...
@@ -293,10 +138,6 @@ const Withdraw = defineComponent({
...
@@ -293,10 +138,6 @@ const Withdraw = defineComponent({
state
.
studentDailyWithdrawLimit
=
studentDailyWithdrawLimit
;
state
.
studentDailyWithdrawLimit
=
studentDailyWithdrawLimit
;
};
};
const
goBack
=
()
=>
{
router
.
back
();
};
onMounted
(()
=>
{
onMounted
(()
=>
{
const
message
=
{
const
message
=
{
type
:
"title"
,
type
:
"title"
,
...
@@ -308,12 +149,8 @@ const Withdraw = defineComponent({
...
@@ -308,12 +149,8 @@ const Withdraw = defineComponent({
return
{
return
{
...
toRefs
(
state
),
...
toRefs
(
state
),
formatter
,
formatter
,
getSmsVerifyCode
,
withdrawSubmit
,
withdrawSubmit
,
withdrawReal
,
withdrawSuccess
goBack
,
closeWithdraw
,
closeWithdrawSuccess
};
};
}
}
});
});
...
...
src/views/bonus/withdraw/withdrawDialog.vue
0 → 100644
View file @
21ea442b
<
template
>
<div
class=
"withdraw-validate"
>
<van-dialog
v-model:show=
"showDialog"
:show-cancel-button=
"false"
:show-confirm-button=
"false"
class=
"dialog"
>
<i
class=
"close"
@
click=
"closeWithdraw"
></i>
<ul
class=
"dialog-header"
>
<li>
提现至微信账户:
{{
withdrawAccount
}}
</li>
<li
class=
"dialog-money van-ellipsis"
>
¥
{{
withdrawAmount
}}
</li>
</ul>
<ul
class=
"dialog-field"
>
<li
class=
"dialog-field-input"
>
<van-field
v-model=
"smsVerifyCode"
type=
"digit"
label-width=
"0"
placeholder=
"请输入验证码"
>
</van-field>
<van-button
type=
"primary"
color=
"#027AFF"
:disabled=
"smsVerifyPass"
@
click=
"getSmsVerifyCode"
>
{{
showTime
}}
</van-button
>
</li>
<li
class=
"dialog-field-tip"
v-if=
"mobileTip"
>
今日可提现已将验证码发送至
{{
mobileTip
}}
</li>
</ul>
<div
class=
"handle-btns"
>
<van-button
:loading=
"withdrawing"
:disabled=
"withdrawing || !tencentCaptchPass || !smsVerifyCode"
loading-text=
"提现中..."
round
type=
"primary"
size=
"large"
block
color=
"#027AFF;"
@
click=
"withdrawReal"
>
确定
</van-button
>
<van-button
plain
round
type=
"primary"
size=
"large"
block
color=
"#027AFF;"
style=
"border: none"
@
click=
"closeWithdraw"
>
关闭
</van-button
>
</div>
</van-dialog>
</div>
</
template
>
<
script
lang=
"ts"
>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
declare
const
TencentCaptcha
:
any
;
import
{
defineComponent
,
ref
,
watchEffect
,
reactive
,
computed
,
toRefs
}
from
"vue"
;
import
{
useRoute
}
from
"vue-router"
;
import
{
useStore
}
from
"vuex"
;
import
{
Dialog
,
Button
,
Field
,
Toast
,
Cell
}
from
"vant"
;
import
{
checkCaptcha
,
withdraw
}
from
"@/server/api/bonus"
;
import
{
countDown
}
from
"@/util/timer"
;
interface
TencentCaptchaResponse
{
ret
:
number
;
ticket
:
string
;
appid
:
string
;
bizState
:
unknown
;
randstr
:
string
;
}
interface
State
{
timeoutParams
?:
{
timeCounter
:
number
|
undefined
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[
key
:
string
]:
number
|
string
|
boolean
|
any
;
}
export
default
defineComponent
({
components
:
{
[
Dialog
.
Component
.
name
]:
Dialog
.
Component
,
[
Button
.
name
]:
Button
,
[
Field
.
name
]:
Field
,
[
Cell
.
name
]:
Cell
},
props
:
{
show
:
Boolean
,
withdrawAmount
:
{
type
:
Number
,
default
:
0
},
// 提现金额
withdrawAccount
:
String
// 微信账户
},
setup
(
props
,
context
)
{
const
route
=
useRoute
();
const
store
=
useStore
();
const
bonusStoreState
=
computed
(()
=>
store
.
state
.
bonus
);
const
state
=
reactive
<
State
>
({
withdrawing
:
false
,
tencentCaptchPass
:
false
,
// 图形验证码是否通过
smsVerifyPass
:
false
,
mobileTip
:
""
,
showTime
:
"获取验证码"
,
smsVerifyCode
:
""
// 验证码
});
const
showDialog
=
ref
(
false
);
watchEffect
(()
=>
{
showDialog
.
value
=
props
.
show
;
});
// 获取验证码
const
getSmsVerifyCode
=
()
=>
{
const
captcha
=
new
TencentCaptcha
(
"2087826974"
,
async
(
res
:
TencentCaptchaResponse
)
=>
{
const
{
ret
,
randstr
,
ticket
}
=
res
;
if
(
ret
===
0
)
{
state
.
tencentCaptchPass
=
true
;
state
.
smsVerifyPass
=
true
;
try
{
const
data
=
await
checkCaptcha
({
randStr
:
randstr
,
ticket
});
Toast
(
"发送验证码成功"
);
state
.
mobileTip
=
data
;
state
.
timeoutParams
=
countDown
(
60
,
1000
,
(
time
:
number
)
=>
{
time
===
0
?
(
state
.
showTime
=
`获取验证码`
)
:
(
state
.
showTime
=
`
${
time
}
后再获取`
);
if
(
time
===
0
)
{
state
.
smsVerifyPass
=
false
;
}
});
}
catch
{
Toast
(
"发送验证码失败,请重试"
);
state
.
smsVerifyPass
=
false
;
}
}
},
{
needFeedBack
:
false
}
);
captcha
.
show
();
};
// 提现
const
withdrawReal
=
async
()
=>
{
if
(
!
state
.
smsVerifyCode
)
{
Toast
(
"请输入验证码"
);
return
;
}
state
.
withdrawing
=
true
;
try
{
const
params
=
{
studentId
:
bonusStoreState
.
value
.
studentId
,
smsVerifyCode
:
state
.
smsVerifyCode
,
withdrawAmount
:
props
.
withdrawAmount
,
withdrawAccountId
:
route
.
params
.
withdrawAccountId
as
string
};
const
data
=
await
withdraw
(
params
);
context
.
emit
(
"update:show"
,
false
);
context
.
emit
(
"withdrawSuccess"
,
data
);
}
catch
(
err
)
{
Toast
(
err
);
}
finally
{
state
.
withdrawing
=
false
;
}
};
// 重置参数
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
closeWithdraw
=
()
=>
{
context
.
emit
(
"update:show"
,
false
);
resetParams
();
};
return
{
showDialog
,
...
toRefs
(
state
),
getSmsVerifyCode
,
withdrawReal
,
closeWithdraw
};
}
});
</
script
>
<
style
lang=
"scss"
scoped
>
.withdraw-validate
{
:deep
.dialog
{
padding
:
48px
;
color
:
#fff
;
width
:
622px
;
&
-header
{
background
:
url("~@/assets/images/bonus/withdraw-bg.png")
no-repeat
;
background-size
:
100%
;
padding
:
32px
30px
;
}
.dialog-money
{
font-size
:
60px
;
font-weight
:
600
;
margin
:
40px
0
47px
;
}
&
-field
{
margin-top
:
80px
;
&
-input
{
display
:
flex
;
align-items
:
center
;
.van-cell
{
flex
:
1
;
padding
:
0
;
.van-field__control
{
padding
:
22px
0
22px
45px
;
border
:
2px
solid
#dcdee0
;
border-right
:
none
;
border-radius
:
8px
0px
0px
8px
;
height
:
80px
;
width
:
306px
;
}
}
.van-button
{
width
:
220px
;
height
:
80px
;
background
:
#027aff
;
border-radius
:
0px
8px
8px
0px
;
font-size
:
26px
;
box-sizing
:
border-box
;
}
}
&
-tip
{
text-align
:
center
;
color
:
#484c4f
;
font-size
:
24px
;
margin-top
:
24px
;
}
}
.handle-btns
{
margin-top
:
64px
;
.van-button
{
height
:
100px
;
}
}
}
}
</
style
>
src/views/bonus/withdraw/withdrawSuccessDialog.vue
0 → 100644
View file @
21ea442b
<
template
>
<div
class=
"withdraw-success"
>
<van-dialog
v-model:show=
"showDialog"
:show-cancel-button=
"false"
:show-confirm-button=
"false"
class=
"dialog"
>
<i
class=
"close"
@
click=
"goBack"
></i>
<ul
class=
"dialog-text"
>
<li>
提现申请成功!
</li>
<li>
提现金额:
</li>
<li>
¥
{{
withdrawResponse
?.
amount
||
0
}}
</li>
<li>
提现至微信
</li>
<li>
{{
withdrawResponse
?.
withdrawAccount
}}
</li>
<li>
预计到账时间
</li>
<li>
{{
withdrawResponse
?.
expectedPayTime
}}
</li>
</ul>
<div
class=
"dialog-btns"
>
<van-button
round
type=
"primary"
size=
"large"
@
click=
"goBack"
>
确定
</van-button>
</div>
</van-dialog>
</div>
</
template
>
<
script
lang=
"ts"
>
import
{
defineComponent
,
ref
,
watchEffect
}
from
"vue"
;
import
{
Dialog
,
Button
}
from
"vant"
;
import
{
useRouter
}
from
"vue-router"
;
export
default
defineComponent
({
components
:
{
[
Dialog
.
Component
.
name
]:
Dialog
.
Component
,
[
Button
.
name
]:
Button
},
props
:
{
show
:
Boolean
,
withdrawResponse
:
Object
},
setup
(
props
)
{
const
router
=
useRouter
();
const
showDialog
=
ref
(
false
);
watchEffect
(()
=>
{
showDialog
.
value
=
props
.
show
;
});
const
goBack
=
()
=>
{
router
.
back
();
};
return
{
showDialog
,
goBack
};
}
});
</
script
>
<
style
lang=
"scss"
scoped
>
.withdraw-success
{
:deep
.dialog
{
padding
:
60px
51px
35px
;
background
:
url("~@/assets/images/bonus/withdraw-success.png")
no-repeat
;
background-size
:
100%
100%
;
height
:
785px
;
box-sizing
:
border-box
;
font-size
:
26px
;
&
-text
{
line-height
:
50px
;
text-align
:
center
;
li
{
&
:nth-of-type
(
1
)
{
font-size
:
55px
;
background
:
linear-gradient
(
360deg
,
#ef1237
0%
,
#fd7940
100%
);
-webkit-background-clip
:
text
;
color
:
transparent
;
font-style
:
italic
;
position
:
relative
;
font-weight
:
bold
;
margin-bottom
:
24px
;
line-height
:
63px
;
height
:
63px
;
&
:
:
after
,
&::
before
{
content
:
""
;
display
:
inline-block
;
width
:
63px
;
height
:
5px
;
background
:
linear-gradient
(
270deg
,
#fdbd99
0%
,
rgba
(
255
,
255
,
255
,
0
)
100%
);
position
:
absolute
;
top
:
50%
;
}
&
:
:
before
{
left
:
0
;
}
&
:
:
after
{
background
:
linear-gradient
(
270deg
,
rgba
(
255
,
255
,
255
,
0
)
0%
,
#fdbd99
100%
);
right
:
0
;
}
}
&
:nth-of-type
(
2
)
{
font-size
:
32px
;
font-weight
:
500
;
margin-bottom
:
16px
;
}
&
:nth-of-type
(
3
)
{
font-size
:
64px
;
font-family
:
DINAlternate-Bold
,
DINAlternate
;
font-weight
:
bold
;
color
:
#1a1a1a
;
line-height
:
63px
;
background
:
linear-gradient
(
360deg
,
#ef1237
0%
,
#fd7940
100%
);
-webkit-background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;
margin-bottom
:
39px
;
}
&
:nth-of-type
(
4
),
&
:nth-of-type
(
5
)
{
margin-bottom
:
11px
;
}
&
:nth-of-type
(
4
),
&
:nth-of-type
(
6
)
{
font-size
:
28px
;
}
&
:nth-of-type
(
6
)
{
margin-bottom
:
7px
;
}
&
:nth-of-type
(
5
),
&
:nth-of-type
(
7
)
{
opacity
:
0
.8
;
}
}
}
&
-btns
{
text-align
:
center
;
.van-button
{
margin-top
:
100px
;
padding
:
0
100px
;
height
:
100px
;
line-height
:
100px
;
width
:
380px
;
color
:
#f03d04
;
border
:
none
;
background
:
linear-gradient
(
to
bottom
,
#ffeb8c
,
#fe9f56
);
}
}
}
}
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment