优化
This commit is contained in:
@@ -17,21 +17,33 @@ import { CouponBean } from '@/api/user/types';
|
|||||||
const store = useUserStore();
|
const store = useUserStore();
|
||||||
const { userInfo } = storeToRefs(store);
|
const { userInfo } = storeToRefs(store);
|
||||||
|
|
||||||
|
const couponStatus = ref<number | any>(undefined);
|
||||||
const coupons = ref<CouponBean[]>([]);
|
const coupons = ref<CouponBean[]>([]);
|
||||||
|
|
||||||
onLoad(async () => {
|
onLoad(async () => {
|
||||||
await fetchData(0);
|
await fetchData();
|
||||||
});
|
});
|
||||||
|
|
||||||
const tabChange = (index: number) => {
|
const tabChange = (index: number) => {
|
||||||
fetchData(index);
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
couponStatus.value = undefined;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
couponStatus.value = 0;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
couponStatus.value = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fetchData();
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchData = async (status: number) => {
|
const fetchData = async () => {
|
||||||
const { list } = await getCouponList({
|
const { list } = await getCouponList({
|
||||||
companyId: getCompanyId(),
|
companyId: getCompanyId(),
|
||||||
memberId: userInfo.value?.id,
|
memberId: userInfo.value?.id,
|
||||||
status: status,
|
status: couponStatus.value,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 20
|
pageSize: 20
|
||||||
});
|
});
|
||||||
@@ -42,7 +54,7 @@ const onLoadMore = () => {
|
|||||||
if(coupons.value.length >= 20) {
|
if(coupons.value.length >= 20) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fetchData(0);
|
fetchData();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<view class='top-card-view'>
|
<view class='top-card-view'>
|
||||||
<image class='bg-image' :src='companyConfigInfo.userbgcover' />
|
<image class='bg-image' :src='companyConfigInfo.userbgcover' />
|
||||||
<image class='avatar-image' :src='params.image' />
|
<image class='avatar-image' :src='params.image' />
|
||||||
<text>{{ userInfo.name }}</text>
|
<text>{{ userInfo.nickName }}</text>
|
||||||
<text>{{ userInfo.levelName }}</text>
|
<text>{{ userInfo.levelName }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user