Commit 9a9e326e authored by Facius's avatar Facius

feat: 首页明细列表封装

parent 73944e45
<template>
<view class="bill-list">
<view class="list-view" v-if="list && list.length > 0">
<view
class="list-day-view"
v-for="(items, index) in list"
:key="index"
>
<view class="cell-head">
<view class="left-view">
<view class="week-view">{{}}</view>
<view class="day-view">{{}}</view>
</view>
<view class="right-view">
<view
><text>收:</text><text class="count-view">{{}}</text></view
>
<view
><text>支:</text><text class="count-view">{{}}</text></view
>
</view>
</view>
<view
class="item-view"
v-for="(item, ind) in items.list"
:key="ind"
>
<CellBill @select="handleSelect" :info="item" :isLast="ind + 1 >= items.list.length"></CellBill>
</view>
</view>
</view>
<NoData v-else-if="!loading" imageWidth="374" text="当前暂无收支明细"/>
</view>
</template>
<script>
import CellBill from '@/components/cell-bill-list/index.vue'
import NoData from '@/components/no-data'
export default {
components: {
CellBill,
NoData
},
props: {
list: {
type: Array,
default() {
return []
},
}
},
data() {
return {
loading: true
}
},
watch: {
list() {
console.log('----------')
this.loading = false
}
},
computed: {
},
methods: {
handleSelect(id) {
this.$emit('select', id)
},
},
}
</script>
<style scoped lang="scss">
.bill-list {
.list-view {
.list-day-view {
background-color: #ffffff;
border-radius: 16rpx;
margin-top: 24rpx;
.cell-head {
display: flex;
justify-content: space-between;
align-items: center;
padding: 24rpx 24rpx 8rpx 24rpx;
.left-view {
display: flex;
align-items: center;
.week-view {
font-size: 28rpx;
font-weight: bold;
color: #333333;
}
.day-view {
color: #8d8d8d;
font-size: 24rpx;
}
}
.right-view {
display: flex;
align-items: center;
color: #8d8d8d;
font-size: 24rpx;
.count-view {
font-weight: bold;
color: #333333;
}
}
}
}
}
}
</style>
......@@ -19,6 +19,7 @@
<view class="time-view">{{ info.time }}</view>
</view>
</view>
<view v-if="!isLast" class="line-view"></view>
</view>
</template>
......@@ -31,6 +32,10 @@ export default {
return {}
},
},
isLast: {
type: Boolean,
default: false
}
},
data() {
return {}
......@@ -46,11 +51,11 @@ export default {
</script>
<style scoped lang="scss">
.cell-bill-list {
padding: 32rpx 24rpx;
.content-view {
display: flex;
justify-content: space-between;
align-items: flex-start;
padding: 32rpx 24rpx;
.left-view {
flex: 1;
display: flex;
......@@ -88,5 +93,10 @@ export default {
}
}
}
.line-view {
height: 2rpx;
background-color: #F6F7FA;
margin: 0 24rpx;
}
}
</style>
<template>
<view class="no-data-view" :style="customStyle">
<image
v-if="imageName"
class="no-data-image"
mode="widthFix"
:style="'width:' + imageWidth + 'rpx'"
:src="wudingdanImage"
></image>
<text v-if="text" class="text-view" :style="'color:' + textColor">{{ text }}</text>
<slot></slot>
</view>
</template>
<script>
export default {
props: {
customStyle: {
type: String,
default: 'background-color: transparent',
},
imageName: {
// 图片
type: [String, Boolean],
default: 'wushouzhiquesheng@3x.png',
},
imageWidth: {
type: [Number, String],
default: '',
},
text: {
// 提示文字
type: [String,Boolean],
default: '当前暂无数据',
},
textColor: {
type: String,
default: '#8D8D8D'
}
},
computed: {
wudingdanImage() {
return process.uniEnv.qn_base_url + this.imageName
},
},
}
</script>
<style lang="scss" scoped>
.no-data-view {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: #999999;
font-size: 26rpx;
padding: 30rpx;
border-radius: 12rpx;
min-height: 460rpx;
margin-top: 50rpx;
.no-data-image {
width: 240rpx;
height: 240rpx;
margin: 50rpx auto 48rpx;
}
.text-view {
}
}
</style>
......@@ -87,7 +87,8 @@
<view class="title-view">收支明细</view>
<view class="tip-view">展示近3天数据</view>
</view>
<view class="list-view">
<BillList :list="list" @select="handleSelectCell"/>
<!-- <view class="list-view" v-if="list.length > 0">
<view
class="list-day-view"
v-for="(items, index) in list"
......@@ -112,10 +113,11 @@
v-for="(item, ind) in items.list"
:key="ind"
>
<CellBill :info="item"></CellBill>
<CellBill :info="item" :isLast="ind + 1 >= items.list.length"></CellBill>
</view>
</view>
</view>
<NoData v-else imageWidth="374" text="当前暂无收支明细"/> -->
</view>
</view>
<mid-popup ref="midPopup"></mid-popup>
......@@ -130,13 +132,17 @@
<script>
import MidPopup from '@/components/mid-popup/mid-popup.vue'
import CellBill from '@/components/cell-bill-list/index.vue'
// import CellBill from '@/components/cell-bill-list/index.vue'
// import NoData from '@/components/no-data'
import BillList from '@/components/bill-list'
import { tabbar } from '@/utils/settings.js'
import { addBind } from '@/api/login/index.js'
export default {
components: {
MidPopup,
CellBill
BillList,
// CellBill,
// NoData
},
data() {
return {
......@@ -248,6 +254,7 @@ export default {
handleSelectDate() {},
handleClickTool(path) {},
handleClickOperate(path) {},
handleSelectCell(id) {},
formatCount(count) {
return (Math.trunc(count * 100) / 100).toFixed(2)
},
......@@ -451,42 +458,42 @@ export default {
margin-top: 6rpx;
}
}
.list-view {
.list-day-view {
background-color: #ffffff;
border-radius: 16rpx;
margin-top: 24rpx;
.cell-head {
display: flex;
justify-content: space-between;
align-items: center;
padding: 24rpx 24rpx 8rpx 24rpx;
.left-view {
display: flex;
align-items: center;
.week-view {
font-size: 28rpx;
font-weight: bold;
color: #333333;
}
.day-view {
color: #8d8d8d;
font-size: 24rpx;
}
}
.right-view {
display: flex;
align-items: center;
color: #8d8d8d;
font-size: 24rpx;
.count-view {
font-weight: bold;
color: #333333;
}
}
}
}
}
// .list-view {
// .list-day-view {
// background-color: #ffffff;
// border-radius: 16rpx;
// margin-top: 24rpx;
// .cell-head {
// display: flex;
// justify-content: space-between;
// align-items: center;
// padding: 24rpx 24rpx 8rpx 24rpx;
// .left-view {
// display: flex;
// align-items: center;
// .week-view {
// font-size: 28rpx;
// font-weight: bold;
// color: #333333;
// }
// .day-view {
// color: #8d8d8d;
// font-size: 24rpx;
// }
// }
// .right-view {
// display: flex;
// align-items: center;
// color: #8d8d8d;
// font-size: 24rpx;
// .count-view {
// font-weight: bold;
// color: #333333;
// }
// }
// }
// }
// }
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment