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
5317fc5e
Commit
5317fc5e
authored
Apr 06, 2021
by
hewenhao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/2021_03_12_bonus' of…
Merge branch 'feature/2021_03_12_bonus' of
https://dev.jiuaoedu.com/wykolor/GeekBonusH5
into feature/2021_03_12_bonus
parents
c41dbd09
bfbe5096
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
23 deletions
+38
-23
use-native-bridge.ts
src/util/use-native-bridge.ts
+2
-2
index.vue
src/views/bonus/bonus-detail/index.vue
+4
-2
index.vue
src/views/bonus/index.vue
+32
-19
No files found.
src/util/use-native-bridge.ts
View file @
5317fc5e
...
@@ -118,13 +118,13 @@ function invokeNativeMethod<T = any, P = any>(arg: { type: string; data?: P }):
...
@@ -118,13 +118,13 @@ function invokeNativeMethod<T = any, P = any>(arg: { type: string; data?: P }):
/**
/**
* 微信登录
* 微信登录
*/
*/
export
function
bindWe
c
hat
()
{
export
function
bindWe
C
hat
()
{
return
invokeNativeMethod
<
{
code
:
string
;
userId
:
string
}
>
({
type
:
"bindWechat"
});
return
invokeNativeMethod
<
{
code
:
string
;
userId
:
string
}
>
({
type
:
"bindWechat"
});
}
}
/**
/**
* 打电话
* 打电话
*/
*/
export
function
make
c
all
(
phone
:
string
)
{
export
function
make
C
all
(
phone
:
string
)
{
return
invokeNativeMethod
<
null
,
string
>
({
type
:
"makecall"
,
data
:
phone
});
return
invokeNativeMethod
<
null
,
string
>
({
type
:
"makecall"
,
data
:
phone
});
}
}
src/views/bonus/bonus-detail/index.vue
View file @
5317fc5e
...
@@ -87,6 +87,7 @@ import { computed, defineComponent, onMounted, reactive, toRefs } from "vue";
...
@@ -87,6 +87,7 @@ import { computed, defineComponent, onMounted, reactive, toRefs } from "vue";
import
{
bonusModel
}
from
"@/server/api"
;
import
{
bonusModel
}
from
"@/server/api"
;
import
{
useStore
}
from
"vuex"
;
import
{
useStore
}
from
"vuex"
;
import
{
useNativeBridge
}
from
"@/util/use-native-bridge"
;
import
{
useNativeBridge
}
from
"@/util/use-native-bridge"
;
import
{
useRoute
}
from
"vue-router"
;
interface
BonusList
{
interface
BonusList
{
addList
:
BonusListResponse
[];
addList
:
BonusListResponse
[];
...
@@ -95,6 +96,7 @@ interface BonusList {
...
@@ -95,6 +96,7 @@ interface BonusList {
const
BonusDetail
=
defineComponent
({
const
BonusDetail
=
defineComponent
({
setup
()
{
setup
()
{
const
store
=
useStore
();
const
store
=
useStore
();
const
route
=
useRoute
();
const
bonusStoreState
=
computed
(()
=>
store
.
state
.
bonus
);
const
bonusStoreState
=
computed
(()
=>
store
.
state
.
bonus
);
const
pageAdd
=
reactive
({
const
pageAdd
=
reactive
({
pageSize
:
10
,
pageSize
:
10
,
...
@@ -107,7 +109,7 @@ const BonusDetail = defineComponent({
...
@@ -107,7 +109,7 @@ const BonusDetail = defineComponent({
finished
:
false
finished
:
false
});
});
const
state
=
reactive
({
const
state
=
reactive
({
active
:
"REDUCE"
,
active
:
route
.
query
.
active
||
"REDUCE"
,
loading
:
false
,
loading
:
false
,
finished
:
false
,
finished
:
false
,
error
:
false
,
error
:
false
,
...
@@ -131,7 +133,7 @@ const BonusDetail = defineComponent({
...
@@ -131,7 +133,7 @@ const BonusDetail = defineComponent({
state
.
refreshing
=
false
;
state
.
refreshing
=
false
;
}
}
const
params
=
{
const
params
=
{
studentId
:
bonusStoreState
.
value
.
studentId
,
studentId
:
route
.
query
.
studentId
||
bonusStoreState
.
value
.
studentId
,
flowType
:
state
.
active
===
FlowType
.
ADD
?
"ADD"
:
"REDUCE"
,
flowType
:
state
.
active
===
FlowType
.
ADD
?
"ADD"
:
"REDUCE"
,
pageSize
:
state
.
active
===
FlowType
.
ADD
?
pageAdd
.
pageSize
:
pageReduce
.
pageSize
,
pageSize
:
state
.
active
===
FlowType
.
ADD
?
pageAdd
.
pageSize
:
pageReduce
.
pageSize
,
pageNum
:
state
.
active
===
FlowType
.
ADD
?
pageAdd
.
pageNum
:
pageReduce
.
pageNum
pageNum
:
state
.
active
===
FlowType
.
ADD
?
pageAdd
.
pageNum
:
pageReduce
.
pageNum
...
...
src/views/bonus/index.vue
View file @
5317fc5e
...
@@ -139,7 +139,10 @@
...
@@ -139,7 +139,10 @@
>
>
<div
class=
"dialog-handle-btns"
>
<div
class=
"dialog-handle-btns"
>
<van-button
type=
"default"
round
@
click=
"showBindWx = false"
>
取消
</van-button
<van-button
type=
"default"
round
@
click=
"showBindWx = false"
>
取消
</van-button
><van-button
type=
"primary"
round
@
click=
"bindWeChat"
>
绑定微信
</van-button>
><van-button
type=
"primary"
round
@
click=
"bindWeiChat"
:disabled=
"binding"
><van-loading
v-if=
"binding"
size=
"20px"
color=
"#ccc"
>
绑定中...
</van-loading
><span
v-else
>
绑定微信
</span></van-button
>
</div>
</div>
</van-dialog>
</van-dialog>
<van-dialog
<van-dialog
...
@@ -164,12 +167,12 @@ import { computed, defineComponent, onMounted, reactive, toRefs } from "vue";
...
@@ -164,12 +167,12 @@ 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
,
List
,
Toast
}
from
"vant"
;
import
{
Dialog
,
Button
,
Col
,
Row
,
Cell
,
List
,
Loading
}
from
"vant"
;
import
{
BonusAccountResponse
,
WithdrawListParams
,
WithdrawListResponse
}
from
"@/model/bonus"
;
import
{
BonusAccountResponse
,
WithdrawListParams
,
WithdrawListResponse
}
from
"@/model/bonus"
;
import
{
bonusModel
}
from
"@/server/api"
;
import
{
bonusModel
}
from
"@/server/api"
;
import
{
BonusAccountStatus
,
ErrCode
}
from
"@/model/bonus/constant"
;
import
{
BonusAccountStatus
,
ErrCode
}
from
"@/model/bonus/constant"
;
import
{
useNativeBridge
,
makec
all
}
from
"@/util/use-native-bridge"
;
import
{
bindWeChat
,
useNativeBridge
,
makeC
all
}
from
"@/util/use-native-bridge"
;
import
{
formatBonusTipTxt
}
from
"@/util/formatBonusTipTxt"
;
import
{
formatBonusTipTxt
}
from
"@/util/formatBonusTipTxt"
;
interface
BonusState
{
interface
BonusState
{
...
@@ -195,17 +198,23 @@ const Bonus = defineComponent({
...
@@ -195,17 +198,23 @@ const Bonus = defineComponent({
showBindWx
:
false
,
showBindWx
:
false
,
showDangerous
:
false
,
showDangerous
:
false
,
bonusAccount
:
null
,
bonusAccount
:
null
,
binding
:
false
,
BonusAccountStatus
,
BonusAccountStatus
,
withdrawList
:
[]
withdrawList
:
[]
});
});
const
[
sendNativeMessage
]
=
useNativeBridge
(
"
bindWeChatChange
"
,
function
()
{
const
[
sendNativeMessage
]
=
useNativeBridge
(
"
test
"
,
function
()
{
state
.
showBindWx
=
false
;
//
state.showBindWx = false;
});
});
// 获取奖励金信息
// 获取奖励金信息
const
getBonusAccount
=
()
=>
{
bonusModel
.
getBonusAccount
(
bonusStoreState
.
value
.
studentId
).
then
(
res
=>
{
bonusModel
.
getBonusAccount
(
bonusStoreState
.
value
.
studentId
).
then
(
res
=>
{
const
{
data
}
=
res
;
const
{
data
}
=
res
;
state
.
bonusAccount
=
data
;
state
.
bonusAccount
=
data
;
});
});
};
getBonusAccount
();
const
withdrawListParams
=
reactive
<
WithdrawListParams
>
({
const
withdrawListParams
=
reactive
<
WithdrawListParams
>
({
pageSize
:
10
,
pageSize
:
10
,
pageNum
:
1
,
pageNum
:
1
,
...
@@ -230,29 +239,32 @@ const Bonus = defineComponent({
...
@@ -230,29 +239,32 @@ const Bonus = defineComponent({
onLoad
();
onLoad
();
});
});
const
withdraw
=
()
=>
{
const
withdraw
=
()
=>
{
if
(
!
state
.
bonusAccount
?.
errCode
)
{
// 都正常的状态
router
.
push
(
"withdraw"
);
}
else
if
(
state
.
bonusAccount
?.
errCode
===
ErrCode
.
NOT_BIND
)
{
state
.
showBindWx
=
true
;
state
.
showBindWx
=
true
;
}
else
{
// if (!state.bonusAccount?.errCode) {
state
.
showDangerous
=
true
;
// // 都正常的状态
}
// router.push("withdraw");
// } else if (state.bonusAccount?.errCode === ErrCode.NOT_BIND) {
// state.showBindWx = true;
// } else {
// state.showDangerous = true;
// }
};
};
const
withdrawRule
=
()
=>
{
const
withdrawRule
=
()
=>
{
state
.
showWithdrawRules
=
true
;
state
.
showWithdrawRules
=
true
;
};
};
const
phoneCall
=
()
=>
{
const
phoneCall
=
()
=>
{
make
call
(
'400—8777389'
)
make
Call
(
"400—8777389"
)
// sendNativeMessage({
// sendNativeMessage({
// type: "phoneCall",
// type: "phoneCall",
// data: "400—8777389"
// data: "400—8777389"
// });
// });
};
};
const
bindWeChat
=
()
=>
{
const
bindWeiChat
=
()
=>
{
sendNativeMessage
({
state
.
binding
=
true
;
type
:
"bindWeChat"
,
bindWeChat
().
then
(()
=>
{
data
:
"bindWeChat"
state
.
showBindWx
=
false
;
state
.
binding
=
false
;
getBonusAccount
();
});
});
};
};
return
{
return
{
...
@@ -261,7 +273,7 @@ const Bonus = defineComponent({
...
@@ -261,7 +273,7 @@ const Bonus = defineComponent({
withdraw
,
withdraw
,
withdrawRule
,
withdrawRule
,
phoneCall
,
phoneCall
,
bindWeChat
,
bindWe
i
Chat
,
bonusStoreState
,
bonusStoreState
,
formatBonusTipTxt
formatBonusTipTxt
};
};
...
@@ -272,7 +284,8 @@ const Bonus = defineComponent({
...
@@ -272,7 +284,8 @@ const Bonus = defineComponent({
[
Row
.
name
]:
Row
,
[
Row
.
name
]:
Row
,
[
Cell
.
name
]:
Cell
,
[
Cell
.
name
]:
Cell
,
[
List
.
name
]:
List
,
[
List
.
name
]:
List
,
[
Dialog
.
Component
.
name
]:
Dialog
.
Component
[
Dialog
.
Component
.
name
]:
Dialog
.
Component
,
[
Loading
.
name
]:
Loading
}
}
});
});
export
default
Bonus
;
export
default
Bonus
;
...
...
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