lanan-repair/pages/myReservation/myReservation.vue

164 lines
4.4 KiB
Vue
Raw Normal View History

2024-09-22 15:07:01 +08:00
<template>
<view class="container">
<VNavigationBar titleColor="rgba(0,0,0,0.9)" backgroundColor="transparent" title="我的预约">
</VNavigationBar>
<view class="body">
<view class="orderList">
2024-10-26 16:57:01 +08:00
<scroll-view style="height: 100%;" scroll-y="true" class="itemContent" @scrolltolower="onReachBottomCus"
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
<reservationOrderVue v-for="(item, index) in orderList" :key="index" :orderInfo="item">
</reservationOrderVue>
2024-11-05 18:27:16 +08:00
<view class="no-data" v-if="orderList.length==0">
<image class="" src="@/static/images/nothing.png" ></image>
</view>
2024-10-26 16:57:01 +08:00
</scroll-view>
2024-09-22 15:07:01 +08:00
</view>
</view>
</view>
</template>
<script>
import VNavigationBar from '@/components/VNavigationBar.vue'
import tabBarVue from '@/components/tabBar/tabBar.vue'
import reservationOrderVue from '../../components/reservationOrder/reservationOrder.vue'
2024-09-24 14:08:50 +08:00
import request from "@/utils/request";
2024-10-14 18:36:20 +08:00
import {getToken} from '@/utils/auth.js'
2024-09-22 15:07:01 +08:00
export default {
components: {
tabBarVue,
VNavigationBar,
reservationOrderVue
},
data() {
return {
2024-10-26 16:57:01 +08:00
pageNo: 1,
pageSize: 10,
total: 0,
//下来刷新状态
isTriggered:false,
2024-09-24 14:08:50 +08:00
// orderList: [{
// title: '顺捷汽车维修搭电救援补胎中心',
// status: '1',
// address: '济南市历下区福瑞达历下护理院东南门旁',
// phone: '15726506879',
// busiTypeStr: '汽车维修'
// },
// {
// title: '顺捷汽车维修搭电救援补胎中心',
// status: '1',
// address: '济南市历下区福瑞达历下护理院东南门旁',
// phone: '15726506879',
// busiTypeStr: '汽车维修'
// }
// ]
orderList:[]
2024-09-22 15:07:01 +08:00
}
},
2024-09-24 14:08:50 +08:00
onShow() {
2024-09-27 17:21:10 +08:00
if(!getToken()){
uni.reLaunch({
url: '/pages/login/login'
})
}else{
console.log("已登录")
}
2024-09-24 14:08:50 +08:00
this.getBookingPage()
},
2024-09-22 15:07:01 +08:00
methods: {
2024-10-26 16:57:01 +08:00
/**
* 上滑加载数据
*/
onReachBottomCus() {
//判断 如果页码*页容量大于等于总条数,提示该页数据加载完毕
if (this.pageNo * this.pageSize >= this.total) {
uni.$u.toast('没有更多数据了')
return
}
//页码+1,调用获取数据的方法获取第二页数据
this.pageNo++
//此处调用自己获取数据列表的方法
this.getBookingPage()
},
/**
* 下拉刷新数据
*/
onRefresherrefresh(){
this.isTriggered = true
this.pageNo = 1
this.total = 0
this.orderList = []
this.getBookingPage()
},
2024-09-24 14:08:50 +08:00
async getBookingPage(){
const res = await request({
url: "/userClient/repair/booking/page",
method: "get",
params:{
2024-10-26 16:57:01 +08:00
pageNo: this.pageNo,
pageSize: this.pageSize
2024-09-24 14:08:50 +08:00
}
})
const data = res.data.records
const ids = data.map(item => item.id)
const response = await request({
url: "/userClient/repair/booking/map?ids=" + ids,
method: "get",
})
const list = response.data
2024-10-26 16:57:01 +08:00
let thisDataList = list.map(item => {
2024-09-24 14:08:50 +08:00
return {
...item,
title: item.company.corpName,
address: item.company.address,
phone: item.company.mobilePhone,
2024-11-05 18:27:16 +08:00
busiTypeStr: item.repairTypeText?item.repairTypeText:"",
2024-09-24 14:08:50 +08:00
status: item.bookingStatus
}
})
2024-10-26 16:57:01 +08:00
if (this.pageNo != 1) {
this.orderList = this.orderList.concat(thisDataList)
} else {
this.orderList = thisDataList
}
2024-11-05 18:27:16 +08:00
console.log(this.orderList,"demo")
2024-10-26 16:57:01 +08:00
//将获取的总条数赋值
this.total = res.data.total
this.isTriggered = false
2024-09-24 14:08:50 +08:00
}
2024-09-22 15:07:01 +08:00
}
}
</script>
<style scoped lang="less">
.container {
height: 100%;
background: #F3F5F7;
background: linear-gradient(180deg, #C1DEFF 0%, rgba(#F3F5F7, 0) 100%);
background-size: 100% 600rpx;
background-repeat: no-repeat;
display: flex;
flex-direction: column;
color: #333333;
.body {
flex: 1;
height: 0;
padding: 16rpx 0 30rpx;
overflow: auto;
}
.orderList {
2024-10-26 16:57:01 +08:00
height: 100%;
2024-09-22 15:07:01 +08:00
display: flex;
flex-direction: column;
row-gap: 20rpx;
2024-10-26 16:57:01 +08:00
margin: 0 40rpx;
2024-09-22 15:07:01 +08:00
}
2024-10-14 18:06:55 +08:00
.no-data{
text-align: center;
}
2024-09-22 15:07:01 +08:00
}
2024-09-24 14:08:50 +08:00
</style>