kitchendDevice/pageTwo/me/record.vue

155 lines
2.8 KiB
Vue
Raw Permalink Normal View History

2023-09-08 15:17:21 +08:00
<template>
<view class="content">
<!-- 列表 -->
<view class="box">
2025-03-25 10:17:30 +08:00
<view class="list" v-for="(item,ind) in infoList" :key="ind" @click="handleDetail(item)">
2023-09-08 15:17:21 +08:00
<view class="time">{{item.time}}</view>
<view class="kcal">
2025-03-25 10:17:30 +08:00
<view>摄入卡路里<text>{{item.val}}</text>{{item.unit}}</view>
2023-09-08 15:17:21 +08:00
<view class="status">
2025-11-08 16:50:26 +08:00
<text class="quan0" :style="'background:'+item.color"></text>
2025-03-25 10:17:30 +08:00
{{item.describe}}
2023-09-08 15:17:21 +08:00
</view>
2025-03-25 10:17:30 +08:00
<uni-icons type="forward" size="20" color="#666"></uni-icons>
2023-09-08 15:17:21 +08:00
</view>
</view>
2025-11-08 16:50:26 +08:00
<view class="endtext" v-if="!lastPage || page >= lastPage"> 到底了看看别的吧 </view>
2025-03-25 10:17:30 +08:00
<view v-if="!infoList.length" class="nolist">
<icon class="iconfont icon-wancan"></icon>
<text>还没有记录哦</text>
</view>
2023-09-08 15:17:21 +08:00
</view>
</view>
</template>
<script>
import {
mapState
} from "vuex";
export default {
data() {
return {
2025-03-25 10:17:30 +08:00
page: 1,
lastPage: '',
infoList: []
2023-09-08 15:17:21 +08:00
}
},
computed: {
...mapState(["user"]),
end() {
return this.$tools.getTime()
},
2025-03-25 10:17:30 +08:00
endDate() {
return this.$tools.getDate("start")
},
2023-09-08 15:17:21 +08:00
},
onLoad() {
let that = this
2025-03-25 10:17:30 +08:00
that.page = 1
that.handleList()
},
onReachBottom() {
let that = this
if (!this.lastPage || this.page >= this.lastPage) {
uni.showToast({
title: '没有更多数据!',
icon: 'none'
})
return
}
this.page++
this.handleList(this.page)
2023-09-08 15:17:21 +08:00
},
methods: {
2025-03-25 10:17:30 +08:00
handleList() {
let that = this
that.$model.getMyLogList({
aud_id: that.user.aud_id,
page: that.page,
}).then(res => {
2025-12-29 14:17:58 +08:00
if (res.code == 0) {
2026-01-27 16:10:01 +08:00
that.infoList = that.infoList.concat(res.data.content_list)
that.lastPage = res.data.page_total
2025-03-25 10:17:30 +08:00
}
})
},
2023-09-08 15:17:21 +08:00
handleDetail(item) {
2025-11-25 14:21:22 +08:00
this.$store.dispatch("getCountFoodInfo", {
aud_id: this.user.aud_id,
time: item.time
})
2023-09-08 15:17:21 +08:00
uni.switchTab({
2025-03-25 10:17:30 +08:00
url: '/pages/count/count'
2023-09-08 15:17:21 +08:00
});
}
}
}
</script>
<style scoped="scoped" lang="scss">
.content {
2025-11-25 14:21:22 +08:00
padding: 0 30rpx;
2023-09-08 15:17:21 +08:00
}
.calendar {
text-align: center;
background: #fff;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 20;
2025-11-25 14:21:22 +08:00
height: 80rpx;
line-height: 80rpx;
2023-09-08 15:17:21 +08:00
box-shadow: 0px 1px 5px 2px #dfe2e1fc;
}
.box {
2025-11-25 14:21:22 +08:00
margin-top: 30rpx;
2023-09-08 15:17:21 +08:00
width: 100%;
}
.list {
color: #999;
2025-11-25 14:21:22 +08:00
width: calc(100% - 60rpx);
2023-09-08 15:17:21 +08:00
background: #fff;
2025-11-25 14:21:22 +08:00
margin-bottom: 30rpx;
border-radius: 30rpx;
padding: 20rpx 30rpx;
2023-09-08 15:17:21 +08:00
.time {
width: 100%;
2025-11-25 14:21:22 +08:00
height: 60rpx;
line-height: 60rpx;
2023-09-08 15:17:21 +08:00
}
.kcal {
display: flex;
justify-content: space-between;
align-items: center;
text {
font-size: 16px;
font-weight: bold;
margin: 0 3px;
color: #000;
}
.status {
width: 85px;
}
2025-11-08 16:50:26 +08:00
.quan0 {
2025-11-25 14:21:22 +08:00
width: 24rpx;
height: 24rpx;
2023-09-08 15:17:21 +08:00
background: $uni-color-warning;
display: inline-block;
border-radius: 50%;
margin-right: 5px;
}
}
}
2025-03-25 10:17:30 +08:00
</style>