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