Commit b9203ea2 by 胡悦

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
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="wrapper-content"> <div class="wrapper-content">
<div class="wrapper-integral"> <div class="wrapper-integral">
<span>可用积分</span> <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="" /> <img class="coin-img" src="@/assets/images/coin.png" alt="" />
</div> </div>
<div class="wrapper-userinfo"> <div class="wrapper-userinfo">
...@@ -48,13 +48,13 @@ ...@@ -48,13 +48,13 @@
class="van-list-box" class="van-list-box"
:style="{ height: data.innerHeight - (280 + 10 + 28 + 68) + 'px' }" :style="{ height: data.innerHeight - (280 + 10 + 28 + 68) + 'px' }"
> >
<!-- -->
<van-list <van-list
finished-text="- 没有更多啦 -" finished-text="- 没有更多啦 -"
loading-text="加载中..." loading-text="加载中..."
v-model:loading="loading" v-model:loading="loading"
:finished="finished" :finished="finished"
@load="onLoad" @load="onLoad"
:immediate-check="false"
> >
<!-- 没有历史数据 --> <!-- 没有历史数据 -->
<template v-if="!list.length"> <template v-if="!list.length">
...@@ -119,32 +119,35 @@ type UserInfo = { ...@@ -119,32 +119,35 @@ type UserInfo = {
name?: string; name?: string;
mobile?: string; mobile?: string;
plateNo?: string; plateNo?: string;
authStatus?: number; authStatus?: number
integral?: number;
}; };
interface page {
pageNum: number;
pageSize: number;
}
const userStore = useUserStore(); const userStore = useUserStore();
const router = useRouter(); const router = useRouter();
const data: { const data: {
innerHeight: number; innerHeight: number;
userInfo: UserInfo; userInfo: UserInfo;
list: listStyle; integral: number
} = reactive({ } = reactive({
innerHeight: window.innerHeight, // 获取可视区高度 innerHeight: window.innerHeight, // 获取可视区高度
userInfo: { userInfo: {
name: "", name: "",
mobile: "", mobile: "",
plateNo: "", plateNo: "",
authStatus: 0, authStatus: 0
integral: 0
}, },
integral: 0
}); });
// 积分历史明细列表 // 积分历史明细列表
const list = reactive<listStyle>([]); const list = reactive<listStyle>([]);
const loading = ref<boolean>(true); const loading = ref<boolean>(true);
const finished = ref<boolean>(false); const finished = ref<boolean>(false);
// 分页加载数据 // 分页加载数据
let pageData: object = { let pageData: page = {
pageNum: 0, pageNum: 0,
pageSize: 10, pageSize: 10,
}; };
...@@ -152,10 +155,20 @@ let total = ref<number>(1); ...@@ -152,10 +155,20 @@ let total = ref<number>(1);
// 校验是否登录 // 校验是否登录
const hasSession = () => { const hasSession = () => {
console.log(userStore.getSession); console.log("123");
const sessionId = userStore.getSession; const sessionId = userStore.getSession;
if (!sessionId) Toast("请先登录"); if (sessionId) {
sessionId ? getUserInfo() : logout(); onLoad()
getUserInfo()
getIntegral()
} else {
Toast("请先登录")
logout()
}
// if (!sessionId) Toast("请先登录");
// // onLoad
// sessionId ? getUserInfo() : logout();
}; };
// 获取用户信息 // 获取用户信息
const getUserInfo = async () => { const getUserInfo = async () => {
...@@ -166,8 +179,8 @@ const getUserInfo = async () => { ...@@ -166,8 +179,8 @@ const getUserInfo = async () => {
// 查询可用积分 // 查询可用积分
const getIntegral = async() => { const getIntegral = async() => {
const res = await req('scrm.api.renewal.h5.integral.get') const res = await req('scrm.api.renewal.h5.integral.get')
console.log(res) console.log(res.amount, '-------')
data.userInfo.integral = res.amount data.integral = res.amount
} }
// 路由跳转,value:跳转页面路径 // 路由跳转,value:跳转页面路径
...@@ -183,6 +196,7 @@ const logout = () => { ...@@ -183,6 +196,7 @@ const logout = () => {
// 下拉加载积分历史明细数据 // 下拉加载积分历史明细数据
const onLoad = async () => { const onLoad = async () => {
console.log("456");
loading.value = true; loading.value = true;
let params: { let params: {
pageNum?: number; pageNum?: number;
...@@ -190,9 +204,8 @@ const onLoad = async () => { ...@@ -190,9 +204,8 @@ const onLoad = async () => {
} = {}; } = {};
params.pageNum = pageData.pageNum + 1; params.pageNum = pageData.pageNum + 1;
params.pageSize = pageData.pageSize; params.pageSize = pageData.pageSize;
console.log(pageData.pageNum, total.value);
// 如果列表长度小于总长度下拉刷新 // 如果列表长度小于总长度下拉刷新
if (pageData.pageNum < total.value) { if (pageData.pageNum <= total.value) {
const res = await req( const res = await req(
"scrm.api.renewal.h5.integral.record.list", "scrm.api.renewal.h5.integral.record.list",
params, params,
...@@ -202,19 +215,18 @@ const onLoad = async () => { ...@@ -202,19 +215,18 @@ const onLoad = async () => {
list.push(...res.data.list); list.push(...res.data.list);
total.value = res.data.pages; total.value = res.data.pages;
} else { } 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; loading.value = false;
}; };
// 组件挂载完成 // 组件挂载完成
onBeforeMount(() => { onBeforeMount(() => {
hasSession(); hasSession();
// getIntegral()
// onLoad(); // onLoad();
}); });
</script> </script>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<div class="info-content-list"> <div class="info-content-list">
<div class="info-content-list-left"> <div class="info-content-list-left">
<div class="info-content-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 class="info-content-left-bottom">兑换积分</div>
</div> </div>
</div> </div>
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
<div class="info-content-list-right"> <div class="info-content-list-right">
<div class="info-content-right"> <div class="info-content-right">
<div class="info-content-right-top">{{ item.name }}</div> <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.bankName }}</div>
<div class="info-content-right-bottom"> <div class="info-content-right-bottom">
处理时间:{{ item.time }} 处理时间:{{ item.cardName }}
</div> </div>
</div> </div>
</div> </div>
...@@ -45,11 +45,19 @@ import { ref, reactive, onBeforeMount } from "vue"; ...@@ -45,11 +45,19 @@ import { ref, reactive, onBeforeMount } from "vue";
import { Toast } from "vant"; import { Toast } from "vant";
import req from "../../utils/request"; import req from "../../utils/request";
type historyList = { type historyList = {
id?: number; amount?: number;
jifen?: number; approverDate?: string;
approverUserName?: string;
bankName?: string;
bankNo?: string;
cardName?: string;
id?: any;
mobile?: string;
name?: string; name?: string;
bank?: string; orderCode?: string;
time?: string; plateN?: string;
status?: number;
userId?: null;
}; };
// 获取可视区高度 // 获取可视区高度
const innerHeight = ref<number>(window.innerHeight); const innerHeight = ref<number>(window.innerHeight);
...@@ -81,26 +89,23 @@ const getHistoryList = async () => { ...@@ -81,26 +89,23 @@ const getHistoryList = async () => {
params, params,
true true
); );
console.log(res);
if (res.code == 0) { if (res.code == 0) {
useList.push(...res.data.list); useList.push(...res.data.list);
total.value = res.data.pages; total.value = res.data.pages;
} else { } 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; loading.value = false;
}; };
// 组件挂载完成 // 组件挂载完成
onBeforeMount(() => { onBeforeMount(() => {});
getHistoryList();
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!