Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
h5
/
vite-integral
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b9203ea2
authored
Aug 12, 2022
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'huy_v2.8.1' of
http://192.168.3.233:8090/h5/vite-integral
into huy_v2.8.1
2 parents
dfbf3cd0
0c173db7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
38 deletions
src/views/home/index.vue
src/views/home/useHistory.vue
src/views/home/index.vue
View file @
b9203ea
...
...
@@ -4,7 +4,7 @@
<div
class=
"wrapper-content"
>
<div
class=
"wrapper-integral"
>
<span>
可用积分
</span>
<span
class=
"integral"
>
{{
data
.
userInfo
.
integral
}}
</span>
<span
class=
"integral"
>
{{
data
.
integral
}}
</span>
<img
class=
"coin-img"
src=
"@/assets/images/coin.png"
alt=
""
/>
</div>
<div
class=
"wrapper-userinfo"
>
...
...
@@ -48,13 +48,13 @@
class=
"van-list-box"
:style=
"
{ height: data.innerHeight - (280 + 10 + 28 + 68) + 'px' }"
>
<!-- -->
<van-list
finished-text=
"- 没有更多啦 -"
loading-text=
"加载中..."
v-model:loading=
"loading"
:finished=
"finished"
@
load=
"onLoad"
:immediate-check=
"false"
>
<!-- 没有历史数据 -->
<template
v-if=
"!list.length"
>
...
...
@@ -119,32 +119,35 @@ type UserInfo = {
name
?:
string
;
mobile
?:
string
;
plateNo
?:
string
;
authStatus
?:
number
;
integral
?:
number
;
authStatus
?:
number
};
interface
page
{
pageNum
:
number
;
pageSize
:
number
;
}
const
userStore
=
useUserStore
();
const
router
=
useRouter
();
const
data
:
{
innerHeight
:
number
;
userInfo
:
UserInfo
;
list
:
listStyle
;
integral
:
number
}
=
reactive
({
innerHeight
:
window
.
innerHeight
,
// 获取可视区高度
userInfo
:
{
name
:
""
,
mobile
:
""
,
plateNo
:
""
,
authStatus
:
0
,
integral
:
0
authStatus
:
0
},
integral
:
0
});
// 积分历史明细列表
const
list
=
reactive
<
listStyle
>
([]);
const
loading
=
ref
<
boolean
>
(
true
);
const
finished
=
ref
<
boolean
>
(
false
);
// 分页加载数据
let
pageData
:
object
=
{
let
pageData
:
page
=
{
pageNum
:
0
,
pageSize
:
10
,
};
...
...
@@ -152,10 +155,20 @@ let total = ref<number>(1);
// 校验是否登录
const
hasSession
=
()
=>
{
console
.
log
(
userStore
.
getSession
);
console
.
log
(
"123"
);
const
sessionId
=
userStore
.
getSession
;
if
(
!
sessionId
)
Toast
(
"请先登录"
);
sessionId
?
getUserInfo
()
:
logout
();
if
(
sessionId
)
{
onLoad
()
getUserInfo
()
getIntegral
()
}
else
{
Toast
(
"请先登录"
)
logout
()
}
// if (!sessionId) Toast("请先登录");
// // onLoad
// sessionId ? getUserInfo() : logout();
};
// 获取用户信息
const
getUserInfo
=
async
()
=>
{
...
...
@@ -166,8 +179,8 @@ const getUserInfo = async () => {
// 查询可用积分
const
getIntegral
=
async
()
=>
{
const
res
=
await
req
(
'scrm.api.renewal.h5.integral.get'
)
console
.
log
(
res
)
data
.
userInfo
.
integral
=
res
.
amount
console
.
log
(
res
.
amount
,
'-------'
)
data
.
integral
=
res
.
amount
}
// 路由跳转,value:跳转页面路径
...
...
@@ -183,6 +196,7 @@ const logout = () => {
// 下拉加载积分历史明细数据
const
onLoad
=
async
()
=>
{
console
.
log
(
"456"
);
loading
.
value
=
true
;
let
params
:
{
pageNum
?:
number
;
...
...
@@ -190,9 +204,8 @@ const onLoad = async () => {
}
=
{};
params
.
pageNum
=
pageData
.
pageNum
+
1
;
params
.
pageSize
=
pageData
.
pageSize
;
console
.
log
(
pageData
.
pageNum
,
total
.
value
);
// 如果列表长度小于总长度下拉刷新
if
(
pageData
.
pageNum
<
total
.
value
)
{
if
(
pageData
.
pageNum
<
=
total
.
value
)
{
const
res
=
await
req
(
"scrm.api.renewal.h5.integral.record.list"
,
params
,
...
...
@@ -202,19 +215,18 @@ const onLoad = async () => {
list
.
push
(...
res
.
data
.
list
);
total
.
value
=
res
.
data
.
pages
;
}
else
{
Toast
.
fail
(
"获取积分历史明细失败"
);
Toast
(
"获取积分历史明细失败"
);
}
pageData
.
pageNum
++
;
if
(
pageData
.
pageNum
==
total
.
value
)
{
finished
.
value
=
true
;
}
}
if
((
pageData
.
pageNum
=
total
.
value
))
{
finished
.
value
=
true
;
}
pageData
.
pageNum
++
;
loading
.
value
=
false
;
};
// 组件挂载完成
onBeforeMount
(()
=>
{
hasSession
();
// getIntegral()
// onLoad();
});
</
script
>
...
...
src/views/home/useHistory.vue
View file @
b9203ea
...
...
@@ -18,7 +18,7 @@
<div
class=
"info-content-list"
>
<div
class=
"info-content-list-left"
>
<div
class=
"info-content-left"
>
<div
class=
"info-content-left-top"
>
{{
item
.
jifen
}}
</div>
<div
class=
"info-content-left-top"
>
{{
item
.
amount
}}
</div>
<div
class=
"info-content-left-bottom"
>
兑换积分
</div>
</div>
</div>
...
...
@@ -26,9 +26,9 @@
<div
class=
"info-content-list-right"
>
<div
class=
"info-content-right"
>
<div
class=
"info-content-right-top"
>
{{
item
.
name
}}
</div>
<div
class=
"info-content-right-middle"
>
{{
item
.
bank
}}
</div>
<div
class=
"info-content-right-middle"
>
{{
item
.
bank
Name
}}
</div>
<div
class=
"info-content-right-bottom"
>
处理时间:
{{
item
.
ti
me
}}
处理时间:
{{
item
.
cardNa
me
}}
</div>
</div>
</div>
...
...
@@ -45,11 +45,19 @@ import { ref, reactive, onBeforeMount } from "vue";
import
{
Toast
}
from
"vant"
;
import
req
from
"../../utils/request"
;
type
historyList
=
{
id
?:
number
;
jifen
?:
number
;
amount
?:
number
;
approverDate
?:
string
;
approverUserName
?:
string
;
bankName
?:
string
;
bankNo
?:
string
;
cardName
?:
string
;
id
?:
any
;
mobile
?:
string
;
name
?:
string
;
bank
?:
string
;
time
?:
string
;
orderCode
?:
string
;
plateN
?:
string
;
status
?:
number
;
userId
?:
null
;
};
// 获取可视区高度
const
innerHeight
=
ref
<
number
>
(
window
.
innerHeight
);
...
...
@@ -81,26 +89,23 @@ const getHistoryList = async () => {
params
,
true
);
console
.
log
(
res
);
if
(
res
.
code
==
0
)
{
useList
.
push
(...
res
.
data
.
list
);
total
.
value
=
res
.
data
.
pages
;
}
else
{
Toast
.
fail
(
"获取积分使用记录失败"
);
Toast
(
"获取积分使用记录失败"
);
}
pageData
.
pageNum
++
;
if
(
pageData
.
pageNum
==
total
.
value
)
{
finished
.
value
=
true
;
}
}
if
((
pageData
.
pageNum
=
total
.
value
))
{
finished
.
value
=
true
;
}
pageData
.
pageNum
++
;
loading
.
value
=
false
;
};
// 组件挂载完成
onBeforeMount
(()
=>
{
getHistoryList
();
});
onBeforeMount
(()
=>
{});
</
script
>
<
style
lang=
"scss"
scoped
>
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment