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
81db3e94
Commit
81db3e94
authored
Mar 24, 2021
by
wykolor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: bonus store module
parent
6977ae15
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
24 deletions
+61
-24
index.ts
src/store/index.ts
+10
-3
bonus.ts
src/store/module/bonus.ts
+21
-0
index.vue
src/views/bonus/index.vue
+10
-7
index.vue
src/views/bonus/withdraw/index.vue
+20
-14
No files found.
src/store/index.ts
View file @
81db3e94
import
{
createStore
}
from
"vuex"
;
import
{
createStore
}
from
"vuex"
;
import
bonus
from
'./module/bonus'
export
default
createStore
({
export
default
createStore
({
state
:
{},
state
:
{
studentName
:
'wangyan'
},
getters
:
{
studentFullName
:
state
=>
state
.
studentName
+
'WANG'
},
mutations
:
{},
mutations
:
{},
actions
:
{},
actions
:
{},
modules
:
{}
modules
:
{
bonus
:
bonus
}
});
});
src/store/module/bonus.ts
0 → 100644
View file @
81db3e94
const
bonus
=
{
namespaced
:
true
,
state
:
()
=>
({
studentId
:
12
,
userId
:
'color'
}),
getters
:
{
studentId
:
state
=>
state
.
studentId
+
1
,
userName
:
state
=>
state
.
userId
+
'wangyan'
,
studentFullName
:
state
=>
state
.
studentId
+
state
.
userId
},
mutations
:
{
},
actions
:
{
}
}
export
default
bonus
\ No newline at end of file
src/views/bonus/index.vue
View file @
81db3e94
...
@@ -154,12 +154,17 @@
...
@@ -154,12 +154,17 @@
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
import
{
defineComponent
,
reactive
}
from
"vue"
;
import
{
computed
,
defineComponent
,
reactive
}
from
"vue"
;
import
{
Dialog
,
Button
,
Col
,
Row
,
Cell
,
List
}
from
"vant"
;
import
{
Dialog
,
Button
,
Col
,
Row
,
Cell
,
List
}
from
"vant"
;
import
{
BonusAccountResponse
,
WithdrawListResponse
}
from
"@/model/bonus"
;
import
{
BonusAccountResponse
,
WithdrawListResponse
}
from
"@/model/bonus"
;
import
{
useStore
}
from
"vuex"
;
const
Bonus
=
defineComponent
({
const
Bonus
=
defineComponent
({
setup
(
props
)
{
setup
()
{
const
store
=
useStore
();
const
bonusStoreState
=
computed
(()
=>
store
.
state
.
bonus
);
const
getters
=
computed
(()
=>
store
.
getters
);
console
.
log
(
getters
);
const
state
=
reactive
({
const
state
=
reactive
({
loading
:
false
,
loading
:
false
,
finished
:
false
finished
:
false
...
@@ -224,7 +229,8 @@ const Bonus = defineComponent({
...
@@ -224,7 +229,8 @@ const Bonus = defineComponent({
state
,
state
,
bonusAccount
,
bonusAccount
,
withdrawList
,
withdrawList
,
onLoad
onLoad
,
bonusStoreState
};
};
},
},
components
:
{
components
:
{
...
@@ -244,12 +250,9 @@ const Bonus = defineComponent({
...
@@ -244,12 +250,9 @@ const Bonus = defineComponent({
};
};
},
},
methods
:
{
methods
:
{
onClickLeft
()
{
console
.
log
(
"返回"
);
},
withdrawRule
()
{
withdrawRule
()
{
this
.
showDialog
=
true
;
this
.
showDialog
=
true
;
// console.log(this.$store.state.studentId);
},
},
withdraw
()
{
withdraw
()
{
...
...
src/views/bonus/withdraw/index.vue
View file @
81db3e94
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<div
class=
"bonus-withdraw-input"
>
<div
class=
"bonus-withdraw-input"
>
<van-field
<van-field
class=
"bonus-withdraw-input-field"
class=
"bonus-withdraw-input-field"
v-model=
"
money
"
v-model=
"
withdrawAmount
"
center
center
clearable
clearable
label=
"¥"
label=
"¥"
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
type=
"primary"
type=
"primary"
round
round
color=
"#F1551E"
color=
"#F1551E"
@
click=
"
money
= maxMoney"
@
click=
"
withdrawAmount
= maxMoney"
>
全部
</van-button
>
全部
</van-button
>
>
</
template
>
</
template
>
...
@@ -53,23 +53,28 @@
...
@@ -53,23 +53,28 @@
>
>
<ul
class=
"withdraw-dialog-header"
>
<ul
class=
"withdraw-dialog-header"
>
<li>
提现至微信账户:k~k~kolor
</li>
<li>
提现至微信账户:k~k~kolor
</li>
<li
class=
"withdraw-dialog-header-money"
>
¥{{
money
}}
</li>
<li
class=
"withdraw-dialog-header-money"
>
¥{{
withdrawAmount
}}
</li>
</ul>
</ul>
<ul
class=
"withdraw-dialog-field"
>
<ul
class=
"withdraw-dialog-field"
>
<li>
<li>
<van-field
v-model=
"sms"
type=
"digit"
label-width=
"0"
placeholder=
"请输入验证码"
>
<van-field
v-model=
"smsVerifyCode"
type=
"digit"
label-width=
"0"
placeholder=
"请输入验证码"
>
<
template
#
button
>
<
template
#
button
>
<van-button
<van-button
type=
"primary"
type=
"primary"
color=
"#027AFF"
color=
"#027AFF"
@
click=
"getSms"
@
click=
"getSms
VerifyCode
"
:disabled=
"showTime != '获取验证码'"
:disabled=
"showTime != '获取验证码'"
>
{{
showTime
}}
</van-button
>
{{
showTime
}}
</van-button
>
>
</
template
>
</
template
>
</van-field>
</van-field>
</li>
</li>
<li
class=
"withdraw-dialog-field-tip"
>
今日可提现已将验证码发送至
191****1273
</li>
<li
class=
"withdraw-dialog-field-tip"
>
今日可提现已将验证码发送至
{{ mobileTip }}
</li>
</ul>
</ul>
<div
class=
"handle-btns"
>
<div
class=
"handle-btns"
>
<van-button
round
type=
"primary"
size=
"large"
block
color=
"#027AFF;"
@
click=
"withdrawReal"
<van-button
round
type=
"primary"
size=
"large"
block
color=
"#027AFF;"
@
click=
"withdrawReal"
...
@@ -143,12 +148,13 @@ const Withdraw = defineComponent({
...
@@ -143,12 +148,13 @@ const Withdraw = defineComponent({
},
},
setup
()
{
setup
()
{
const
state
=
reactive
({
const
state
=
reactive
({
money
:
""
,
withdrawAmount
:
""
,
sms
:
""
,
sms
VerifyCode
:
""
,
maxMoney
:
500.32
,
maxMoney
:
500.32
,
showTime
:
"获取验证码"
,
showTime
:
"获取验证码"
,
showWithdraw
:
false
,
showWithdraw
:
false
,
showWithdrawSuccess
:
false
showWithdrawSuccess
:
false
,
mobileTip
:
"191****1273"
});
});
const
formatter
=
value
=>
{
const
formatter
=
value
=>
{
if
(
value
>
state
.
maxMoney
)
{
if
(
value
>
state
.
maxMoney
)
{
...
@@ -159,18 +165,18 @@ const Withdraw = defineComponent({
...
@@ -159,18 +165,18 @@ const Withdraw = defineComponent({
};
};
// 确认提现
// 确认提现
const
withdrawSubmit
=
()
=>
{
const
withdrawSubmit
=
()
=>
{
if
(
!
state
.
money
)
{
if
(
!
state
.
withdrawAmount
)
{
Toast
(
"请输入提现金额"
);
Toast
(
"请输入提现金额"
);
return
false
;
return
false
;
}
}
if
(
Number
(
state
.
money
)
<
1
)
{
if
(
Number
(
state
.
withdrawAmount
)
<
1
)
{
Toast
(
"金额必须大于等于1元"
);
Toast
(
"金额必须大于等于1元"
);
return
false
;
return
false
;
}
}
state
.
showWithdraw
=
true
;
state
.
showWithdraw
=
true
;
};
};
const
getSms
=
()
=>
{
const
getSms
VerifyCode
=
()
=>
{
const
captcha1
=
new
TencentCaptcha
(
const
captcha1
=
new
TencentCaptcha
(
"2087826974"
,
"2087826974"
,
(
res
:
TencentCaptchaResponse
)
=>
{
(
res
:
TencentCaptchaResponse
)
=>
{
...
@@ -189,7 +195,7 @@ const Withdraw = defineComponent({
...
@@ -189,7 +195,7 @@ const Withdraw = defineComponent({
};
};
const
withdrawReal
=
()
=>
{
const
withdrawReal
=
()
=>
{
if
(
!
state
.
sms
)
{
if
(
!
state
.
sms
VerifyCode
)
{
Toast
(
"请输入验证码"
);
Toast
(
"请输入验证码"
);
return
;
return
;
}
}
...
@@ -198,7 +204,7 @@ const Withdraw = defineComponent({
...
@@ -198,7 +204,7 @@ const Withdraw = defineComponent({
return
{
return
{
...
toRefs
(
state
),
...
toRefs
(
state
),
formatter
,
formatter
,
getSms
,
getSms
VerifyCode
,
withdrawSubmit
,
withdrawSubmit
,
withdrawReal
withdrawReal
};
};
...
...
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