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
1a638212
Commit
1a638212
authored
Apr 22, 2021
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 优化
parent
d4a945f7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
606 additions
and
302 deletions
+606
-302
index.ts
src/model/bonus/index.ts
+8
-6
bonus.ts
src/server/api/bonus.ts
+54
-52
add.vue
src/views/bonus/bonus-detail/add.vue
+114
-0
bak.vue
src/views/bonus/bonus-detail/bak.vue
+257
-0
index.vue
src/views/bonus/bonus-detail/index.vue
+28
-244
reduce.vue
src/views/bonus/bonus-detail/reduce.vue
+145
-0
No files found.
src/model/bonus/index.ts
View file @
1a638212
...
...
@@ -17,11 +17,13 @@ export interface BaseResponse<T = object> {
}
export
interface
Paging
<
T
=
object
>
{
total
:
number
;
pageNum
:
number
;
pageSize
:
number
;
list
:
T
[];
isLoad
:
boolean
;
loading
:
boolean
;
refreshing
:
boolean
;
hasNextPage
:
boolean
;
list
:
Array
<
T
>
;
error
:
null
|
string
;
total
:
number
;
}
export
interface
BonusListResponse
{
...
...
@@ -38,8 +40,8 @@ export interface BonusListResponse {
}
export
interface
BonusListParams
extends
PageParams
{
studentId
:
number
;
flowType
:
string
;
studentId
?
:
number
;
flowType
?
:
string
;
}
export
interface
BonusAccountResponse
{
...
...
src/server/api/bonus.ts
View file @
1a638212
import
{
BonusAccountResponse
,
BonusListParams
,
BonusListResponse
,
CheckCaptchaParams
,
Paging
,
WithdrawListParams
,
WithdrawListResponse
,
WithdrawParams
,
WithdrawResponse
,
WithdrawRiskResponse
}
from
"@/model/bonus"
;
import
{
get
,
post
}
from
"../request"
;
// 奖励金收支列表
export
const
getBonusList
=
(
params
:
BonusListParams
)
=>
{
return
get
<
Paging
<
BonusListResponse
>>
(
`/api-jksxb-app/v1/marketingAccount/bonus/flow/list`
,
params
);
};
// 奖励金账户信息
export
const
getBonusAccount
=
(
studentId
:
string
)
=>
{
return
get
<
BonusAccountResponse
>
(
`/api-jksxb-app/v1/marketingAccount/bonus/count`
,
{
studentId
});
};
// 提现记录列表
export
const
getWithdrawList
=
(
params
:
WithdrawListParams
)
=>
{
return
get
<
Paging
<
WithdrawListResponse
>>
(
`/api-jksxb-app/v1/withdraw/query`
,
params
);
};
// 检验图形验证码
export
const
checkCaptcha
=
(
params
:
CheckCaptchaParams
)
=>
{
return
post
<
string
>
(
`/api-jksxb-app/v1/withdraw/checkCaptcha`
,
params
);
};
// 提现
export
const
withdraw
=
(
params
:
WithdrawParams
)
=>
{
return
post
<
WithdrawResponse
>
(
"/api-jksxb-app/v1/withdraw"
,
params
);
};
// 绑定微信
export
const
bindWeiChat
=
(
params
:
{
code
:
string
})
=>
{
return
post
(
"/api-jksxb-app/v1/withdraw/bind/wx/parent"
,
params
)
}
// 获取用户风控值
export
const
getWithdrawRisk
=
(
studentId
:
string
)
=>
{
return
get
<
WithdrawRiskResponse
>
(
"/api-jksxb-app/v1/risk/getWithdrawRisk"
,
{
studentId
})
}
\ No newline at end of file
BonusAccountResponse
,
BonusListParams
,
BonusListResponse
,
CheckCaptchaParams
,
Paging
,
WithdrawListParams
,
WithdrawListResponse
,
WithdrawParams
,
WithdrawResponse
,
WithdrawRiskResponse
}
from
"@/model/bonus"
;
import
{
get
,
post
}
from
"../request"
;
// 奖励金收支列表
export
const
getBonusList
=
(
params
:
Partial
<
BonusListParams
>
)
=>
{
return
get
<
Paging
<
BonusListResponse
>>
(
`/api-jksxb-app/v1/marketingAccount/bonus/flow/list`
,
params
);
};
export
const
getBonusPaging
=
(
params
:
Partial
<
BonusListParams
>
)
=>
getBonusList
(
params
).
then
(
res
=>
res
.
data
);
// 奖励金账户信息
export
const
getBonusAccount
=
(
studentId
:
string
)
=>
{
return
get
<
BonusAccountResponse
>
(
`/api-jksxb-app/v1/marketingAccount/bonus/count`
,
{
studentId
});
};
// 提现记录列表
export
const
getWithdrawList
=
(
params
:
WithdrawListParams
)
=>
{
return
get
<
Paging
<
WithdrawListResponse
>>
(
`/api-jksxb-app/v1/withdraw/query`
,
params
);
};
// 检验图形验证码
export
const
checkCaptcha
=
(
params
:
CheckCaptchaParams
)
=>
{
return
post
<
string
>
(
`/api-jksxb-app/v1/withdraw/checkCaptcha`
,
params
);
};
// 提现
export
const
withdraw
=
(
params
:
WithdrawParams
)
=>
{
return
post
<
WithdrawResponse
>
(
"/api-jksxb-app/v1/withdraw"
,
params
);
};
// 绑定微信
export
const
bindWeiChat
=
(
params
:
{
code
:
string
})
=>
{
return
post
(
"/api-jksxb-app/v1/withdraw/bind/wx/parent"
,
params
);
};
// 获取用户风控值
export
const
getWithdrawRisk
=
(
studentId
:
string
)
=>
{
return
get
<
WithdrawRiskResponse
>
(
"/api-jksxb-app/v1/risk/getWithdrawRisk"
,
{
studentId
});
};
src/views/bonus/bonus-detail/add.vue
0 → 100644
View file @
1a638212
<
template
>
<div
class=
"tab-add"
>
<van-pull-refresh
:modelValue=
"paging.refreshing"
@
refresh=
"refresh"
>
<van-list
:modelValue=
"paging.loading"
:finished=
"!paging.hasNextPage"
:finished-text=
"finishText"
@
load=
"loadMore"
>
<div
v-for=
"item in paging.list"
:key=
"item.id"
class=
"add-item"
>
<div
class=
"flex"
>
<span>
{{
item
.
bizTypeName
}}
</span>
<label
class=
"gray"
v-if=
"item.bizType === BizType.ORDER_RETURN"
>
订单号:
{{
item
.
relationNo
}}
</label
>
</div>
<div
class=
"flex add-item-desc-money"
>
<span
class=
"gray"
>
{{
item
.
creationTime
}}
</span>
<label>
+¥
{{
item
.
amountChange
}}
</label>
</div>
</div>
<van-empty
v-if=
"paging.isLoad && paging.total
<
1
"
/>
<div
class=
"list-footer"
>
<van-loading
v-if=
"paging.loading"
color=
"#1989fa"
/>
</div>
</van-list>
</van-pull-refresh>
</div>
</
template
>
<
script
lang=
"ts"
>
import
{
defineComponent
,
computed
,
onMounted
}
from
"vue"
;
import
{
List
,
PullRefresh
,
Empty
,
Loading
}
from
"vant"
;
import
{
usePaging
}
from
"@/util/use-paging"
;
import
{
getBonusPaging
}
from
"@/server/api/bonus"
;
import
{
FlowType
,
BizType
}
from
"@/model/bonus/constant"
;
import
{
useStore
}
from
"vuex"
;
export
default
defineComponent
({
components
:
{
[
List
.
name
]:
List
,
[
PullRefresh
.
name
]:
PullRefresh
,
[
Empty
.
name
]:
Empty
,
[
Loading
.
name
]:
Loading
},
setup
()
{
const
store
=
useStore
();
const
bonusStoreState
=
computed
(()
=>
store
.
state
.
bonus
);
const
[
paging
,
loadMore
,
refresh
]
=
usePaging
(
getBonusPaging
,
()
=>
({
studentId
:
bonusStoreState
.
value
.
studentId
,
flowType
:
"ADD"
}));
const
finishText
=
computed
(()
=>
{
const
{
total
,
isLoad
}
=
paging
;
if
(
!
isLoad
)
return
""
;
if
(
total
<
1
)
return
"暂无相关数据"
;
if
(
total
>
10
)
{
return
"没有更多了"
;
}
return
""
;
});
onMounted
(
refresh
);
return
{
finishText
,
paging
,
loadMore
,
refresh
,
FlowType
,
BizType
};
}
});
</
script
>
<
style
lang=
"scss"
scoped
>
.tab-add
{
::deep
(
.van-pull-refresh
)
{
min-height
:
calc
(
100vh
-
80px
);
}
}
.list-footer
{
display
:
flex
;
justify-content
:
center
;
}
// @supports (bottom: constant(safe-area-inset-bottom)) or (bottom: env(safe-area-inset-bottom)) {
// .list-footer {
// padding-bottom: constant(safe-area-inset-bottom);
// padding-bottom: env(safe-area-inset-bottom);
// }
// }
.flex
{
line-height
:
47px
;
display
:
flex
;
justify-content
:
space-between
;
}
.gray
{
color
:
#bdc4d1
;
font-size
:
24px
;
}
.add-item
{
background
:
#fff
;
margin
:
26px
20px
;
padding
:
20px
;
border-radius
:
10px
;
box-shadow
:
0px
10px
20px
0px
rgba
(
221
,
221
,
221
,
0
.3
);
&
-desc-money
{
label
{
color
:
#f1551e
;
font-size
:
28px
;
font-weight
:
600
;
}
}
}
</
style
>
src/views/bonus/bonus-detail/bak.vue
0 → 100644
View file @
1a638212
<
template
>
<div
class=
"bonus-detail"
>
<van-tabs
color=
"#027AFF"
title-active-color=
"#027AFF"
title-inactive-color=
"#4C4E4F"
line-width=
"150"
:sticky=
"true"
v-model:active=
"active"
@
change=
"changeTabs"
>
<van-pull-refresh
v-model=
"refreshing"
@
refresh=
"onRefresh"
>
<van-list
v-model:loading=
"loading"
:finished=
"finished"
finished-text=
"~暂无更多数据~"
@
load=
"onLoad"
:immediate-check=
"false"
>
<van-tab
name=
"REDUCE"
title=
"支出"
class=
"bonus-detail-pay-list"
>
<template
v-if=
"reduceList.length"
>
<div
v-for=
"item in reduceList"
:key=
"item.id"
class=
"bonus-detail-pay-item"
>
<ul>
<li
style=
"color: #000"
>
{{
item
.
bizTypeName
}}
</li>
<li
class=
"flex gray"
>
<span>
{{
item
.
creationTime
}}
</span>
<label
>
{{
item
.
bizType
===
BizType
.
WITHDRAW
?
"流水号:"
:
"订单号:"
}}{{
item
.
relationNo
}}
</label
>
</li>
</ul>
<ul
class=
"bonus-detail-pay-item-desc"
>
<li
v-if=
"item.bizType === BizType.WITHDRAW"
class=
"bonus-detail-pay-item-desc-money flex"
>
<span>
申请时间:
{{
item
.
withdrawApplyTime
}}
</span>
<label
v-if=
"!item.withdrawPayTime"
>
-¥
{{
item
.
amountChange
}}
</label>
</li>
<li
v-if=
"item.bizType === BizType.WITHDRAW && item.withdrawPayTime"
class=
"bonus-detail-pay-item-desc-money flex"
>
<span>
到账时间:
{{
item
.
withdrawPayTime
}}
</span>
<label>
-¥
{{
item
.
amountChange
}}
</label>
</li>
<li
v-if=
"item.bizType === BizType.ORDER"
>
<div
v-for=
"(className, index) in item.className"
:key=
"className + index"
>
{{
className
}}
</div>
</li>
<li
v-if=
"item.bizType === BizType.ORDER"
class=
"bonus-detail-pay-item-desc-money flex"
>
<span>
{{
item
.
schoolAreaName
}}
</span
><label
v-if=
"item.bizType === BizType.ORDER"
>
-¥
{{
item
.
amountChange
}}
</label>
</li>
</ul>
</div>
</
template
>
<van-empty
v-else
/>
</van-tab>
<van-tab
name=
"ADD"
title=
"收入"
class=
"bonus-detail-income-list"
>
<
template
v-if=
"addList.length"
>
<div
class=
"bonus-detail-income-item"
v-for=
"item in addList"
:key=
"item.id"
>
<ul>
<li
class=
"flex "
>
<span>
{{
item
.
bizTypeName
}}
</span>
<label
class=
"gray"
v-if=
"item.bizType === BizType.ORDER_RETURN"
>
订单号:
{{
item
.
relationNo
}}
</label
>
</li>
<li
class=
"flex bonus-detail-pay-item-desc-money"
>
<span
class=
"gray"
>
{{
item
.
creationTime
}}
</span>
<label>
+¥
{{
item
.
amountChange
}}
</label>
</li>
</ul>
</div>
</
template
>
<van-empty
v-else
/>
</van-tab>
</van-list>
</van-pull-refresh>
</van-tabs>
</div>
</template>
<
script
lang=
"ts"
>
import
{
BonusListResponse
}
from
"@/model/bonus"
;
import
{
FlowType
,
BizType
}
from
"@/model/bonus/constant"
;
import
{
NavBar
,
Tab
,
Tabs
,
Cell
,
Empty
,
List
,
PullRefresh
}
from
"vant"
;
import
{
computed
,
defineComponent
,
onMounted
,
reactive
,
toRefs
}
from
"vue"
;
import
{
getBonusList
}
from
"@/server/api/bonus"
;
import
{
useStore
}
from
"vuex"
;
import
{
sendNativeMessage
}
from
"@/util/use-native-bridge"
;
import
{
useRoute
}
from
"vue-router"
;
interface
BonusList
{
addList
:
BonusListResponse
[];
reduceList
:
BonusListResponse
[];
}
const
BonusDetail
=
defineComponent
({
setup
()
{
const
store
=
useStore
();
const
route
=
useRoute
();
const
bonusStoreState
=
computed
(()
=>
store
.
state
.
bonus
);
const
pageAdd
=
reactive
({
pageSize
:
10
,
pageNum
:
1
,
finished
:
false
});
const
pageReduce
=
reactive
({
pageSize
:
10
,
pageNum
:
1
,
finished
:
false
});
const
state
=
reactive
({
active
:
route
.
query
.
active
||
"REDUCE"
,
loading
:
false
,
finished
:
false
,
refreshing
:
false
,
BizType
});
const
bonusList
=
reactive
<
BonusList
>
({
addList
:
[],
reduceList
:
[]
});
const
onLoad
=
async
()
=>
{
state
.
loading
=
true
;
if
(
state
.
refreshing
)
{
if
(
state
.
active
===
FlowType
.
ADD
)
{
pageAdd
.
pageNum
=
1
;
bonusList
.
addList
=
[];
}
else
{
pageReduce
.
pageNum
=
1
;
bonusList
.
reduceList
=
[];
}
state
.
refreshing
=
false
;
}
const
params
=
{
studentId
:
route
.
query
.
studentId
||
bonusStoreState
.
value
.
studentId
,
flowType
:
state
.
active
===
FlowType
.
ADD
?
"ADD"
:
"REDUCE"
,
pageSize
:
state
.
active
===
FlowType
.
ADD
?
pageAdd
.
pageSize
:
pageReduce
.
pageSize
,
pageNum
:
state
.
active
===
FlowType
.
ADD
?
pageAdd
.
pageNum
:
pageReduce
.
pageNum
};
try
{
const
{
data
:
{
total
,
list
}
}
=
await
getBonusList
(
params
);
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
;
state
.
finished
=
pageReduce
.
finished
;
pageReduce
.
pageNum
++
;
}
else
{
bonusList
.
addList
=
bonusList
.
addList
.
concat
(
list
);
pageAdd
.
finished
=
bonusList
.
addList
.
length
===
total
;
state
.
finished
=
pageAdd
.
finished
;
pageAdd
.
pageNum
++
;
}
}
catch
{
state
.
finished
=
true
;
}
};
const
onRefresh
=
()
=>
{
// 清空列表数据
state
.
finished
=
false
;
// 重新加载数据
state
.
loading
=
true
;
onLoad
();
};
const
changeTabs
=
name
=>
{
state
.
finished
=
name
===
FlowType
.
ADD
?
pageAdd
.
finished
:
pageReduce
.
finished
;
if
(
name
===
FlowType
.
ADD
&&
pageAdd
.
pageNum
===
1
)
{
state
.
loading
=
true
;
onLoad
();
}
else
if
(
name
===
FlowType
.
REDUCE
&&
pageReduce
.
pageNum
===
1
)
{
state
.
loading
=
true
;
onLoad
();
}
};
onMounted
(()
=>
{
sendNativeMessage
({
type
:
"title"
,
data
:
"奖励金明细"
});
onLoad
();
});
return
{
...
toRefs
(
state
),
...
toRefs
(
bonusList
),
onLoad
,
onRefresh
,
changeTabs
};
},
components
:
{
[
NavBar
.
name
]:
NavBar
,
[
Tab
.
name
]:
Tab
,
[
Tabs
.
name
]:
Tabs
,
[
Cell
.
name
]:
Cell
,
[
Empty
.
name
]:
Empty
,
[
List
.
name
]:
List
,
[
PullRefresh
.
name
]:
PullRefresh
}
});
export
default
BonusDetail
;
</
script
>
<
style
lang=
"scss"
scoped
>
.bonus-detail
{
.bonus-detail-pay-list
,
.bonus-detail-income-list
{
padding
:
30px
;
.bonus-detail-pay-item
,
.bonus-detail-income-item
{
background
:
#fff
;
margin-bottom
:
26px
;
padding
:
20px
;
border-radius
:
10px
;
box-shadow
:
0px
10px
20px
0px
rgba
(
221
,
221
,
221
,
0
.3
);
ul
{
li
{
line-height
:
47px
;
}
}
.flex
{
display
:
flex
;
justify-content
:
space-between
;
}
.gray
{
color
:
#bdc4d1
;
font-size
:
24px
;
}
.bonus-detail-pay-item-desc
{
background
:
#f5faff
;
padding
:
20px
;
color
:
#606263
;
}
.bonus-detail-pay-item-desc-money
{
label
{
color
:
#f1551e
;
font-size
:
28px
;
font-weight
:
600
;
}
}
}
}
}
</
style
>
src/views/bonus/bonus-detail/index.vue
View file @
1a638212
<
template
>
<div
class=
"bonus-detail"
>
<van-tabs
color=
"#027AFF"
title-active-color=
"#027AFF"
title-inactive-color=
"#4C4E4F"
line-width=
"150"
:sticky=
"true"
v-model:active=
"active"
@
change=
"changeTabs"
>
<van-pull-refresh
v-model=
"refreshing"
@
refresh=
"onRefresh"
>
<van-list
v-model:loading=
"loading"
:finished=
"finished"
finished-text=
"~暂无更多数据~"
@
load=
"onLoad"
:immediate-check=
"false"
>
<van-tab
name=
"REDUCE"
title=
"支出"
class=
"bonus-detail-pay-list"
>
<template
v-if=
"reduceList.length"
>
<div
v-for=
"item in reduceList"
:key=
"item.id"
class=
"bonus-detail-pay-item"
>
<ul>
<li
style=
"color: #000"
>
{{
item
.
bizTypeName
}}
</li>
<li
class=
"flex gray"
>
<span>
{{
item
.
creationTime
}}
</span>
<label
>
{{
item
.
bizType
===
BizType
.
WITHDRAW
?
"流水号:"
:
"订单号:"
}}{{
item
.
relationNo
}}
</label
>
</li>
</ul>
<ul
class=
"bonus-detail-pay-item-desc"
>
<li
v-if=
"item.bizType === BizType.WITHDRAW"
class=
"bonus-detail-pay-item-desc-money flex"
>
<span>
申请时间:
{{
item
.
withdrawApplyTime
}}
</span>
<label
v-if=
"!item.withdrawPayTime"
>
-¥
{{
item
.
amountChange
}}
</label>
</li>
<li
v-if=
"item.bizType === BizType.WITHDRAW && item.withdrawPayTime"
class=
"bonus-detail-pay-item-desc-money flex"
>
<span>
到账时间:
{{
item
.
withdrawPayTime
}}
</span>
<label>
-¥
{{
item
.
amountChange
}}
</label>
</li>
<li
v-if=
"item.bizType === BizType.ORDER"
>
<div
v-for=
"(className, index) in item.className"
:key=
"className + index"
>
{{
className
}}
</div>
</li>
<li
v-if=
"item.bizType === BizType.ORDER"
class=
"bonus-detail-pay-item-desc-money flex"
>
<span>
{{
item
.
schoolAreaName
}}
</span
><label
v-if=
"item.bizType === BizType.ORDER"
>
-¥
{{
item
.
amountChange
}}
</label>
</li>
</ul>
</div>
</
template
>
<van-empty
v-else
/>
</van-tab>
<van-tab
name=
"ADD"
title=
"收入"
class=
"bonus-detail-income-list"
>
<
template
v-if=
"addList.length"
>
<div
class=
"bonus-detail-income-item"
v-for=
"item in addList"
:key=
"item.id"
>
<ul>
<li
class=
"flex "
>
<span>
{{
item
.
bizTypeName
}}
</span>
<label
class=
"gray"
v-if=
"item.bizType === BizType.ORDER_RETURN"
>
订单号:
{{
item
.
relationNo
}}
</label
>
</li>
<li
class=
"flex bonus-detail-pay-item-desc-money"
>
<span
class=
"gray"
>
{{
item
.
creationTime
}}
</span>
<label>
+¥
{{
item
.
amountChange
}}
</label>
</li>
</ul>
</div>
</
template
>
<van-empty
v-else
/>
</van-tab>
</van-list>
</van-pull-refresh>
</van-tabs>
</div>
<van-tabs
color=
"#027AFF"
title-active-color=
"#027AFF"
title-inactive-color=
"#4C4E4F"
line-width=
"150"
:sticky=
"true"
v-model:active=
"currentTab"
>
<van-tab
name=
"REDUCE"
title=
"支出"
>
<BonusReduceList
/>
</van-tab>
<van-tab
name=
"ADD"
title=
"收入"
>
<BonusAddList
/>
</van-tab>
</van-tabs>
</
template
>
<
script
lang=
"ts"
>
import
{
BonusListResponse
}
from
"@/model/bonus"
;
import
{
FlowType
,
BizType
}
from
"@/model/bonus/constant"
;
import
{
NavBar
,
Tab
,
Tabs
,
Cell
,
Empty
,
List
,
PullRefresh
}
from
"vant"
;
import
{
computed
,
defineComponent
,
onMounted
,
reactive
,
toRefs
}
from
"vue"
;
import
{
getBonusList
}
from
"@/server/api/bonus"
;
import
{
useStore
}
from
"vuex"
;
import
{
sendNativeMessage
}
from
"@/util/use-native-bridge"
;
import
{
defineComponent
,
ref
}
from
"vue"
;
import
{
Tab
,
Tabs
,
List
,
PullRefresh
}
from
"vant"
;
import
{
useRoute
}
from
"vue-router"
;
import
BonusReduceList
from
"./reduce.vue"
;
import
BonusAddList
from
"./add.vue"
;
interface
BonusList
{
addList
:
BonusListResponse
[];
reduceList
:
BonusListResponse
[];
}
const
BonusDetail
=
defineComponent
({
setup
()
{
const
store
=
useStore
();
const
route
=
useRoute
();
const
bonusStoreState
=
computed
(()
=>
store
.
state
.
bonus
);
const
pageAdd
=
reactive
({
pageSize
:
10
,
pageNum
:
1
,
finished
:
false
});
const
pageReduce
=
reactive
({
pageSize
:
10
,
pageNum
:
1
,
finished
:
false
});
const
state
=
reactive
({
active
:
route
.
query
.
active
||
"REDUCE"
,
loading
:
false
,
finished
:
false
,
refreshing
:
false
,
BizType
});
const
bonusList
=
reactive
<
BonusList
>
({
addList
:
[],
reduceList
:
[]
});
const
onLoad
=
async
()
=>
{
state
.
loading
=
true
;
if
(
state
.
refreshing
)
{
if
(
state
.
active
===
FlowType
.
ADD
)
{
pageAdd
.
pageNum
=
1
;
bonusList
.
addList
=
[];
}
else
{
pageReduce
.
pageNum
=
1
;
bonusList
.
reduceList
=
[];
}
state
.
refreshing
=
false
;
}
const
params
=
{
studentId
:
route
.
query
.
studentId
||
bonusStoreState
.
value
.
studentId
,
flowType
:
state
.
active
===
FlowType
.
ADD
?
"ADD"
:
"REDUCE"
,
pageSize
:
state
.
active
===
FlowType
.
ADD
?
pageAdd
.
pageSize
:
pageReduce
.
pageSize
,
pageNum
:
state
.
active
===
FlowType
.
ADD
?
pageAdd
.
pageNum
:
pageReduce
.
pageNum
};
try
{
const
{
data
:
{
total
,
list
}
}
=
await
getBonusList
(
params
);
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
;
state
.
finished
=
pageReduce
.
finished
;
pageReduce
.
pageNum
++
;
}
else
{
bonusList
.
addList
=
bonusList
.
addList
.
concat
(
list
);
pageAdd
.
finished
=
bonusList
.
addList
.
length
===
total
;
state
.
finished
=
pageAdd
.
finished
;
pageAdd
.
pageNum
++
;
}
}
catch
{
state
.
finished
=
true
;
}
};
const
onRefresh
=
()
=>
{
// 清空列表数据
state
.
finished
=
false
;
// 重新加载数据
state
.
loading
=
true
;
onLoad
();
};
const
changeTabs
=
name
=>
{
state
.
finished
=
name
===
FlowType
.
ADD
?
pageAdd
.
finished
:
pageReduce
.
finished
;
if
(
name
===
FlowType
.
ADD
&&
pageAdd
.
pageNum
===
1
)
{
state
.
loading
=
true
;
onLoad
();
}
else
if
(
name
===
FlowType
.
REDUCE
&&
pageReduce
.
pageNum
===
1
)
{
state
.
loading
=
true
;
onLoad
();
}
};
onMounted
(()
=>
{
sendNativeMessage
({
type
:
"title"
,
data
:
"奖励金明细"
});
onLoad
();
});
return
{
...
toRefs
(
state
),
...
toRefs
(
bonusList
),
onLoad
,
onRefresh
,
changeTabs
};
},
export
default
defineComponent
({
components
:
{
[
NavBar
.
name
]:
NavBar
,
[
Tab
.
name
]:
Tab
,
[
Tabs
.
name
]:
Tabs
,
[
Cell
.
name
]:
Cell
,
[
Empty
.
name
]:
Empty
,
[
List
.
name
]:
List
,
[
PullRefresh
.
name
]:
PullRefresh
[
PullRefresh
.
name
]:
PullRefresh
,
BonusAddList
,
BonusReduceList
},
setup
()
{
const
route
=
useRoute
();
const
currentTab
=
ref
(
route
.
query
.
active
||
"REDUCE"
);
return
{
currentTab
};
}
});
export
default
BonusDetail
;
</
script
>
<
style
lang=
"scss"
scoped
>
.bonus-detail
{
.bonus-detail-pay-list
,
.bonus-detail-income-list
{
padding
:
30px
;
.bonus-detail-pay-item
,
.bonus-detail-income-item
{
background
:
#fff
;
margin-bottom
:
26px
;
padding
:
20px
;
border-radius
:
10px
;
box-shadow
:
0px
10px
20px
0px
rgba
(
221
,
221
,
221
,
0
.3
);
ul
{
li
{
line-height
:
47px
;
}
}
.flex
{
display
:
flex
;
justify-content
:
space-between
;
}
.gray
{
color
:
#bdc4d1
;
font-size
:
24px
;
}
.bonus-detail-pay-item-desc
{
background
:
#f5faff
;
padding
:
20px
;
color
:
#606263
;
}
.bonus-detail-pay-item-desc-money
{
label
{
color
:
#f1551e
;
font-size
:
28px
;
font-weight
:
600
;
}
}
}
}
}
</
style
>
src/views/bonus/bonus-detail/reduce.vue
0 → 100644
View file @
1a638212
<
template
>
<div
class=
"tab-add"
>
<van-pull-refresh
:modelValue=
"paging.refreshing"
@
refresh=
"refresh"
>
<van-list
:modelValue=
"paging.loading"
:finished=
"!paging.hasNextPage"
:finished-text=
"finishText"
@
load=
"loadMore"
>
<div
v-for=
"item in paging.list"
:key=
"item.id"
class=
"reduce-item"
>
<ul>
<li
style=
"color: #000"
>
{{
item
.
bizTypeName
}}
</li>
<li
class=
"flex gray"
>
<span>
{{
item
.
creationTime
}}
</span>
<label
>
{{
item
.
bizType
===
BizType
.
WITHDRAW
?
"流水号:"
:
"订单号:"
}}{{
item
.
relationNo
}}
</label
>
</li>
</ul>
<ul
class=
"reduce-item-desc"
>
<li
v-if=
"item.bizType === BizType.WITHDRAW"
class=
"reduce-item-desc-money flex"
>
<span>
申请时间:
{{
item
.
withdrawApplyTime
}}
</span>
<label
v-if=
"!item.withdrawPayTime"
>
-¥
{{
item
.
amountChange
}}
</label>
</li>
<li
v-if=
"item.bizType === BizType.WITHDRAW && item.withdrawPayTime"
class=
"reduce-item-desc-money flex"
>
<span>
到账时间:
{{
item
.
withdrawPayTime
}}
</span>
<label>
-¥
{{
item
.
amountChange
}}
</label>
</li>
<li
v-if=
"item.bizType === BizType.ORDER"
>
<div
v-for=
"(className, index) in item.className"
:key=
"className + index"
>
{{
className
}}
</div>
</li>
<li
v-if=
"item.bizType === BizType.ORDER"
class=
"reduce-item-desc-money flex"
>
<span>
{{
item
.
schoolAreaName
}}
</span
><label
v-if=
"item.bizType === BizType.ORDER"
>
-¥
{{
item
.
amountChange
}}
</label>
</li>
</ul>
</div>
<van-empty
v-if=
"paging.isLoad && paging.total
<
1
"
/>
<div
class=
"list-footer"
>
<van-loading
v-if=
"paging.loading"
color=
"#1989fa"
/>
</div>
</van-list>
</van-pull-refresh>
</div>
</
template
>
<
script
lang=
"ts"
>
import
{
defineComponent
,
computed
,
onMounted
}
from
"vue"
;
import
{
List
,
PullRefresh
,
Empty
,
Loading
}
from
"vant"
;
import
{
usePaging
}
from
"@/util/use-paging"
;
import
{
getBonusPaging
}
from
"@/server/api/bonus"
;
import
{
FlowType
,
BizType
}
from
"@/model/bonus/constant"
;
import
{
useStore
}
from
"vuex"
;
export
default
defineComponent
({
components
:
{
[
List
.
name
]:
List
,
[
PullRefresh
.
name
]:
PullRefresh
,
[
Empty
.
name
]:
Empty
,
[
Loading
.
name
]:
Loading
},
setup
()
{
const
store
=
useStore
();
const
bonusStoreState
=
computed
(()
=>
store
.
state
.
bonus
);
const
[
paging
,
loadMore
,
refresh
]
=
usePaging
(
getBonusPaging
,
()
=>
({
studentId
:
bonusStoreState
.
value
.
studentId
,
flowType
:
"REDUCE"
}));
const
finishText
=
computed
(()
=>
{
const
{
total
,
isLoad
}
=
paging
;
if
(
!
isLoad
)
return
""
;
if
(
total
<
1
)
return
"暂无相关数据"
;
if
(
total
>
10
)
{
return
"没有更多了"
;
}
return
""
;
});
onMounted
(
refresh
);
return
{
finishText
,
paging
,
loadMore
,
refresh
,
FlowType
,
BizType
};
}
});
</
script
>
<
style
lang=
"scss"
scoped
>
.tab-add
{
::v-deep
(
.van-pull-refresh
)
{
min-height
:
calc
(
100vh
-
80px
);
}
}
.list-footer
{
display
:
flex
;
justify-content
:
center
;
}
// @supports (bottom: constant(safe-area-inset-bottom)) or (bottom: env(safe-area-inset-bottom)) {
// .list-footer {
// padding-bottom: constant(safe-area-inset-bottom);
// padding-bottom: env(safe-area-inset-bottom);
// }
// }
.flex
{
line-height
:
47px
;
display
:
flex
;
justify-content
:
space-between
;
}
.gray
{
color
:
#bdc4d1
;
font-size
:
24px
;
}
.reduce-item
{
background
:
#fff
;
margin
:
26px
20px
;
padding
:
20px
;
border-radius
:
10px
;
box-shadow
:
0px
10px
20px
0px
rgba
(
221
,
221
,
221
,
0
.3
);
li
{
line-height
:
47px
;
}
&
-desc
{
background
:
#f5faff
;
padding
:
20px
;
color
:
#606263
;
}
&
-desc-money
{
label
{
color
:
#f1551e
;
font-size
:
28px
;
font-weight
:
600
;
}
}
}
</
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