优化占位图显示

This commit is contained in:
2024-04-19 12:51:17 +08:00
parent 6c4c2ac85d
commit 7b3676eda7
11 changed files with 47 additions and 23 deletions

View File

@@ -5,6 +5,7 @@
@on-checked='onChecked(item)'
@on-edit='args => goPath(`create?bean=${encodeURIComponent(JSON.stringify(args))}`)'
@on-delete='args => {handleDelete(args)}' />
<u-empty v-if='addressList.length === 0' text='暂无数据' margin-top='100' />
</scroll-view>
<view class='bottom-button-view'>

View File

@@ -1,8 +1,9 @@
<template>
<tabbar :titles='["全部","未使用","已使用"]' :indicator-color='"#D95554"' @change='tabChange' />
<scroll-view :scroll-y='true' class='content' @loadmore='onLoadMore'>
<coupon-item v-for='item in coupons' :item='item' />
</scroll-view>
<u-list>
<coupon-item v-for='item in coupons' :item='item' :key='item.id' />
<u-empty v-if='coupons.length === 0' text='暂无优惠券' marginTop='100' />
</u-list>
</template>
<script lang='ts' setup>

View File

@@ -8,6 +8,7 @@
<scroll-view style='margin: 10rpx 20rpx'>
<u-list @scrolltolower='loadMore'>
<integral-item v-for='(item,index) in tradeList' :key='index' :item='item' />
<u-empty v-if='tradeList.length === 0' text='暂无数据' margin-top='100' />
</u-list>
</scroll-view>
</view>

View File

@@ -4,7 +4,8 @@
<u-list-item v-for='(item,index) in orderList' :key='index'>
<order-item :item='item' @addShoppingCart='addShoppingCart' @pay='payment' />
</u-list-item>
<u-loadmore status='loading' />
<u-loadmore v-if='orderList.length>0' :status='loadingStatus' />
<u-empty v-if='orderList.length === 0' text='暂无数据' margin-top='100' />
</u-list>
<sku-dialog ref='skuDialogRef' :exists='temporaryStockBean' />
@@ -28,6 +29,7 @@ const temporaryStockBean = ref<StockBean>();
const orderList = ref<OrderBean[]>([]);
const currentPageNum = ref(1);
const payStatus = ref(0);
const loadingStatus = ref('loading');
let currentInterval = 0;
@@ -46,6 +48,7 @@ const tabChange = (index: number) => {
};
const fetchData = async (refresh: boolean = true) => {
loadingStatus.value = 'loading';
if(!refresh) {
currentPageNum.value += 1;
}
@@ -59,6 +62,7 @@ const fetchData = async (refresh: boolean = true) => {
} else {
orderList.value = orderList.value.concat(list);
}
loadingStatus.value = 'no';
handleCountdown(orderList.value.filter(item => item.payStatus == 1));
};

View File

@@ -4,7 +4,8 @@
<!-- <view class='item c-flex-column' v-for='(item,index) in 3' :key='index'>-->
<view class='c-flex-row'>
<text class='primary-text-color' style='flex: 1'>{{ item.name }}</text>
<text class='accent-text-color'>-{{ item.transactionPrice || 0 }}</text>
<text class='accent-text-color'>{{item.type===1?'-':'+'}}{{
item.transactionPrice || 0 }}</text>
</view>
<view class='c-flex-row'>
<text class='secondary-text-color' style='flex: 1'>{{ item.createTime }}</text>

View File

@@ -2,25 +2,25 @@
<tabbar :titles='["全部","充值","消费"]' @change='changeTab' :item-active-color='"#D95554"'
:indicator-color='"#D95554"' />
<view class='content'>
<view class='c-flex-row'>
<text>选择日期</text>
<picker mode='date' @change='changeDate'>
<view class='current-date c-flex-row'>
<text>{{ tradeDate }}</text>
<image :src='assetsUrl("ic_triangle_down.png")' />
</view>
</picker>
</view>
<!-- <view class='c-flex-row'>-->
<!-- <text>选择日期</text>-->
<!-- <picker mode='date' @change='changeDate'>-->
<!-- <view class='current-date c-flex-row'>-->
<!-- <text>{{ tradeDate }}</text>-->
<!-- <image :src='assetsUrl("ic_triangle_down.png")' />-->
<!-- </view>-->
<!-- </picker>-->
<!-- </view>-->
<u-list @scrolltolower='loadMore'>
<trade-item v-for='(item,index) in tradeList' :key='index' :item='item' />
<u-loadmore status='loading' />
<u-loadmore v-if='tradeList.length>0' :status='loadingStatus' />
<u-empty v-if='tradeList.length === 0' text='暂无数据' margin-top='100' />
</u-list>
</view>
</template>
<script lang='ts' setup>
import { assetsUrl } from '@/utils/assets';
import TradeItem from './components/trade-item.vue';
import { getTradeList } from '@/api/user';
import dayjs from 'dayjs';
@@ -29,6 +29,7 @@ const tradeList = ref([]);
const tradeType = ref('');
const tradeDate = ref();
const currentPageNum = ref(1);
const loadingStatus = ref('loading');
onLoad((e) => {
tradeDate.value = dayjs(Date.now()).format('YYYY-MM-DD');
@@ -57,6 +58,7 @@ const changeTab = (index: number) => {
const fetchData = async (refresh: boolean = true) => {
currentPageNum.value = refresh ? 1 : currentPageNum.value + 1;
loadingStatus.value = 'loading';
const { list } = await getTradeList({
// startDate: tradeDate.value,
// endDate: dayjs(tradeDate.value).add(1, 'day').format('YYYY-MM-DD'),
@@ -69,6 +71,7 @@ const fetchData = async (refresh: boolean = true) => {
} else {
tradeList.value = tradeList.value.concat(list);
}
loadingStatus.value = 'no';
};
const loadMore = () => {