fix:未选店铺时提示选择,不静默显示空记录
This commit is contained in:
parent
d64c9aad01
commit
bba26b1578
@ -53,7 +53,12 @@
|
||||
|
||||
<!-- 记录列表 -->
|
||||
<scroll-view class="record-scroll" scroll-y :refresher-enabled="true" :refresher-triggered="isRefreshing" @refresherrefresh="onRefresh" @scrolltolower="loadMore">
|
||||
<view class="record-list">
|
||||
<view class="empty-hint" v-if="!hasShopSelected">
|
||||
<text class="empty-hint-icon">👆</text>
|
||||
<text class="empty-hint-text">请在上方选择一个店铺</text>
|
||||
<text class="empty-hint-desc">选择店铺后即可查看该店铺的上书记录</text>
|
||||
</view>
|
||||
<view class="record-list" v-else>
|
||||
<view class="record-item" v-for="(item, index) in recordList" :key="index">
|
||||
<view class="record-main">
|
||||
<!-- 图片 -->
|
||||
@ -119,7 +124,7 @@
|
||||
</view>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<view class="empty-state" v-if="recordList.length === 0 && !isLoading">
|
||||
<view class="empty-state" v-if="recordList.length === 0 && !isLoading && hasShopSelected">
|
||||
<text class="empty-icon">📭</text>
|
||||
<text class="empty-text">暂无上书记录</text>
|
||||
</view>
|
||||
@ -160,7 +165,12 @@ export default {
|
||||
onLoad() {
|
||||
uni.setNavigationBarTitle({ title: '上书记录' })
|
||||
this.loadShopList()
|
||||
this.fetchRecords()
|
||||
},
|
||||
|
||||
computed: {
|
||||
hasShopSelected() {
|
||||
return this.shopIndex > 0
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
@ -223,15 +233,13 @@ export default {
|
||||
// 获取上书记录
|
||||
async fetchRecords() {
|
||||
if (this.isLoading || this.loadingMore) return
|
||||
if (!this.hasShopSelected) {
|
||||
this.isLoading = false
|
||||
return
|
||||
}
|
||||
this.isLoading = true
|
||||
try {
|
||||
const shopId = this.getSelectedShopId()
|
||||
if (!shopId) {
|
||||
this.isLoading = false
|
||||
this.recordList = []
|
||||
this.hasMore = false
|
||||
return
|
||||
}
|
||||
const params = {
|
||||
page: this.page,
|
||||
page_size: this.pageSize,
|
||||
@ -609,6 +617,33 @@ export default {
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* 提示选择店铺 */
|
||||
.empty-hint {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 160rpx 40rpx;
|
||||
}
|
||||
|
||||
.empty-hint-icon {
|
||||
font-size: 60rpx;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.empty-hint-text {
|
||||
font-size: 30rpx;
|
||||
color: #4e5969;
|
||||
font-weight: 500;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.empty-hint-desc {
|
||||
font-size: 26rpx;
|
||||
color: #909399;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 空状态 */
|
||||
.empty-state {
|
||||
display: flex;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user