This commit is contained in:
魏啾
2024-11-26 15:08:03 +08:00
parent 20ece8ada5
commit d868cf7a1f

View File

@@ -28,8 +28,7 @@
</view> </view>
</view> </view>
<view class="empty-wrap"> <view class="empty-wrap">
<view class="empty" v-if="!list.length"><u-empty text="暂无数据" <u-loadmore :status="form.status" />
:icon="require('@/static/icon_empty.png')"></u-empty></view>
</view> </view>
</view> </view>
</template> </template>
@@ -38,14 +37,33 @@
export default { export default {
data() { data() {
return { return {
list: [] list: [],
count: '',
form: {
page: 1,
status: 'loadmore',
},
}; };
}, },
onShow() { onShow() {
this.storeinvoicelist() this.initial()
},
onReachBottom() {
if (this.form.status != 'nomore') {
this.form.page = ++this.form.page;
this.storeinvoicelist()
}
}, },
methods: { methods: {
initial() {
this.form = {
page: 1,
status: 'loadmore',
},
this.storeinvoicelist()
},
clickoange(e) { clickoange(e) {
if (e.status == 2 || e.status == 4 || e.status == 3) { if (e.status == 2 || e.status == 4 || e.status == 3) {
uni.pro.navigateTo('index/orderinfo', { uni.pro.navigateTo('index/orderinfo', {
@@ -61,10 +79,29 @@
} }
}, },
async storeinvoicelist() { async storeinvoicelist() {
this.form.status = 'loading';
let res = await this.api.storeinvoicelist({ let res = await this.api.storeinvoicelist({
store_id: uni.getStorageSync('userId') store_id: uni.getStorageSync('userId'),
page: this.form.page
}) })
this.list = res.data if (this.form.page == 1 && res.data.list.length == 0) {
this.form.status = 'nomore'
return false;
} else {
setTimeout(() => {
if (this.form.page == 1) {
this.list = res.data.list
} else {
this.list = [...this.list, ...res.data.list];
}
if (res.data.list.length < 10 || res.data.list.length > res.data.count) {
this.form.status = 'nomore';
} else {
this.form.status = 'loadmore';
}
}, 500)
}
console.log(this.list)
}, },
} }
} }