6.小程序页面布局 - 账单明细

news2024/11/25 2:22:43

文章目录

  • 1. 6.小程序页面布局 - 账单明细
    • 1.1. 竞品
    • 1.2. 布局分析
    • 1.3. 布局demo
    • 1.4. 页面实现-头部
    • 1.5. 账单明细
      • 1.5.1. 账单明细-竞品分析
      • 1.5.2. 账单明细-实现
        • 1.5.2.1. 账单明细-实现-mock数据
        • 1.5.2.2. 每日收支数据的聚合整理
        • 1.5.2.3. 页面scroll-view
    • 1.6. TODO

1. 6.小程序页面布局 - 账单明细

1.1. 竞品

之前已经做好了《5.小程序页面布局 - 记账页面》

现在开始进行编写账单明细的页面,还是一样的套路,我们看看竞品大概是什么样:

1.2. 布局分析

  1. 竞品主要是3大块:

    头部:显式时间、收入、支出总览

    快捷入口:一些按钮,账单、预算、资产管家等

    账单明细:按天,当月倒序排列,如果一天有多笔支出,要计算一下当日汇总。(参考上图的“4月27日”效果)

  2. 我们现在要做什么?

    头部需要:一样显式时间,增加一个“切换账簿”,来支持切换到其他的账簿合作记账

    快捷入口:暂时取消,待功能需求稳定后增加

    账单明细:参考竞品

1.3. 布局demo

直接看结果先:

整体还是一目了然的,已经把各个区域加了边框。

尽量使用了简单的布局方式,没有加样式,因为我们主要使用vView组件来做实现。

布局,主要使用的就是flex布局。

上图的源码:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        * {
            margin: 0;
        }

        body {
            width: 390px;
        }

        /* 头部区域样式 */
        .header {
            background-color: aliceblue;
            height: 150px;
            display: flex;
            align-items: center;
        }

        /* 头部的4个块,flex布局,平分 */
        .header .header-date,
        .header .header-income,
        .header .header-out,
        .header .header-switch {
            height: 100px;
            border: 1px solid black;
            /* 每个块,都占总宽度的25% */
            width: 25%;
            /* 开启flex布局 */
            display: flex;
            /* 主轴是y轴,这样,可以让里面的内容上下排布 */
            flex-direction: column;
            /* 主轴y轴居中对齐 */
            justify-content: center;
            /* 侧轴x轴居中对齐 */
            align-items: center;
            /* 每个块,都是100%宽度,不然就是靠内容撑开的宽度 */
            width: 100%;
        }

        /* 列表区域布局 */
        .content {
            background-color: antiquewhite;
            height: 644px;
        }

        /* 当日小计 */
        .content .content-day-header {
            height: 28px;
            display: flex;
            justify-content: space-between;
            margin: 0 20px;
            background-color: #808080;
            align-items: center;
        }

        .content .content-day-list {
            /* display: flex; */

        }

        /* 支出明细 */
        .content .content-day-list .content-day-list-line {
            width: 90%;
            height: 43px;
            display: flex;
            justify-content: space-between;
            margin: 0 auto;
        }

        /* 支出明细 - 左边的 图+名目 */
        .line-left {
            width: 100px;
            display: flex;
            border: 1px solid black;
            align-items: center;
        }

        .line-left img {
            width: 24px;
            height: 24px;
        }

        /* 支出明细 - 右边的 金额 */
        .line-right {
            width: 100px;
            display: flex;
            justify-content: flex-end;
            border: 1px solid black;
            align-items: center;
        }
    </style>
</head>


<body>

    <div class="header">

        <div class="header-date">
            <div>2024</div>
            <div>05月 🔽</div>
        </div>
        <div class="header-income">
            <div>收入</div>
            <div>9999.99元</div>
        </div>
        <div class="header-out">
            <div>支出</div>
            <div>8888.88元</div>
        </div>
        <div class="header-switch">
            <div>切换账单</div>
        </div>

    </div>

    <div class="content">
        <!-- 第一天 -->
        <div class="content-day-header">
            <div>04月27日 星期六</div>
            <div>-299</div>
        </div>
        <div class="content-day-list">
            <div class="content-day-list-line">
                <div class="line-left">
                    <div class="line-img">
                        <img src="礼物.png" />
                    </div>
                    <div class="line-text">餐饮</div>
                </div>
                <div class="line-right">
                    <div class="line-money">-200</div>
                </div>
            </div>
            <div class="content-day-list-line">
                <div class="line-left">
                    <div class="line-img">
                        <img src="交通.png" />
                    </div>
                    <div class="line-text">交通</div>
                </div>
                <div class="line-right">
                    <div class="line-money">-99</div>
                </div>
            </div>
        </div>

        <!-- 第二天 -->
        <div class="content-day-header">
            <div>04月27日 星期六</div>
            <div>-299</div>
        </div>
        <div class="content-day-list">
            <div class="content-day-list-line">
                <div class="line-left">
                    <div class="line-img">
                        <img src="礼物.png" />
                    </div>
                    <div class="line-text">餐饮</div>
                </div>
                <div class="line-right">
                    <div class="line-money">-200</div>
                </div>
            </div>
            <div class="content-day-list-line">
                <div class="line-left">
                    <div class="line-img">
                        <img src="交通.png" />
                    </div>
                    <div class="line-text">交通</div>
                </div>
                <div class="line-right">
                    <div class="line-money">-99</div>
                </div>
            </div>
        </div>
    </div>

</body>

</html>

1.4. 页面实现-头部

  • 实现的效果:

    共4个块,均分。

    背景是渐变色。

  • 布局代码:

<div class="header">

			<div class="header-date">
				<div class="line1-text">2024</div>
				<div class="line2-text">05<span class="line2-text-small">月</span>
					<u-icon style="margin-left: 5px;" name="arrow-down-fill"></u-icon>
				</div>
			</div>
			<div class="header-income">
				<div class="line1-text">收入</div>
				<div class="line2-text">99999.99<span class="line2-text-small">元</span></div>
			</div>
			<div class="header-out">
				<div class="line1-text">支出</div>
				<div class="line2-text">88888.88<span class="line2-text-small">元</span></div>
			</div>
			<div class="header-switch">
				<div>
					<image style="width: 60rpx; height: 60rpx;" src="../../static/账簿.png"></image>
				</div>
				<div style="font-size: 13px;">
					切换账簿
				</div>
			</div>

		</div>
  • css代码

    /* 头部区域样式 */
    	.header {
    		/* background-color: aliceblue; */
    		background-image: linear-gradient(rgba(249, 219, 97, 1), rgba(250, 230, 200, 1));
    		height: 120px;
    		display: flex;
    		align-items: center;
    	}
    	
    	.header .line1-text {
    		color: #808080; 
    		font-size: 12px;
    	}
    	.header .line2-text {
    		color: #000000; 
    		font-size: 15px;
    		margin-top: 15rpx;
    	}
    	
    	.header .line2-text-small {
    		font-size: 12px; 
    		color: #808080;
    	}
    
    	/* 头部的4个块,flex布局,平分 */
    	.header .header-date,
    	.header .header-income,
    	.header .header-out,
    	.header .header-switch {
    		height: 100px;
    		/* border: 1px solid black; */
    		/* 每个块,都占总宽度的25% */
    		width: 25%;
    		/* 开启flex布局 */
    		display: flex;
    		/* 主轴是y轴,这样,可以让里面的内容上下排布 */
    		flex-direction: column;
    		/* 主轴y轴居中对齐 */
    		justify-content: center;
    		/* 侧轴x轴居中对齐 */
    		align-items: center;
    		/* 每个块,都是100%宽度,不然就是靠内容撑开的宽度 */
    		width: 100%;
    	}
    

1.5. 账单明细

// 计算scroll-view高度
let _this = this;
uni.getSystemInfo({
  success(res) {
    _this.phone_height = res.windowHeight
    let v = uni.createSelectorQuery().select(".h");
    v.boundingClientRect(data => {
      _this.scroll_view_height = _this.phone_height - data.height;
    }).exec();
  }
})

1.5.1. 账单明细-竞品分析

这个跟我们借鉴的布局方式差不多,大概长这个样:

分析:

  1. 账单明细部分,是一个大的块
  2. 包含了按天倒序展示的内容
  3. 如果当天有多笔数据,要做一个汇总
  4. 汇总单独占一行,显式:时间、星期几、当日支出小计、当日收入小计

1.5.2. 账单明细-实现

我们的实现:

  1. 先使用mock数据来做页面
  2. 要将每日的数据先进行计算,得到按自然天倒序排序的数组
  3. 当天数据,还要包含一个数组,这个数组里的数据,才是每天的收支记录明细。
  4. 我们使用uniapp的scroll-view来做大容器。这样可以做:下拉刷新到上月数据。触底加载下一个月数据。

看看实现的结果,再分步实现:

1.5.2.1. 账单明细-实现-mock数据

这个是好理解的,我们为了能够和后面的api部分解绑,就不在vue文件中写死数据,而是用一个外部导入的js方法来承载mock数据。

/js目录创建 api_bill_crud.js文件,录入以下mock内容(意思是,加载某用于某月收支明细数据):

export function getUserMonthBillList(openid, month_int) {
	return new Promise((resolve, reject) => {
		let mockMonthBills = [{"_id":"66397bf9f08210b07d2bf163","openid":"oCIe95E0U1WibyRNJ864n-okoRT0","category":"通讯","bill_id":"2024-05-07_1715043320337","收支":"支出","bill_money":-96,"年":"2024","月":"05","日":"07","time":"05月07日","week":"星期二","bill_type":"通讯","desc":"手机话费","icon":"../../static/type/通讯.png","date_str":"20240507","date_int":20240507,"full_date_str":"2024-05-07","update_time":"2024-05-07T00:55:20.336Z","date":"2024-05-07T00:55:21.339Z"},{"_id":"6639af53b9fb2360b051521e","openid":"oCIe95E0U1WibyRNJ864n-okoRT0","category":"学习","bill_id":"2024-05-07_1715056466394","收支":"支出","bill_money":-60,"年":"2024","月":"05","日":"07","time":"05月07日","week":"星期二","bill_type":"学习","desc":"unicloud云一年","icon":"../../static/type/学习.png","date_str":"20240507","date_int":20240507,"full_date_str":"2024-05-07","update_time":"2024-05-07T04:34:26.393Z","date":"2024-05-07T04:34:27.369Z"},{"_id":"663834278a5c7863b10cca32","openid":"oCIe95E0U1WibyRNJ864n-okoRT0","category":"学习","bill_id":"2024-05-06_1714959398647","收支":"支出","bill_money":-30,"年":"2024","月":"05","日":"06","time":"05月06日","week":"星期一","bill_type":"学习","desc":"小程序费用","icon":"../../static/type/学习.png","date_str":"20240506","date_int":20240506,"full_date_str":"2024-05-06","date":"2024-05-06T01:36:39.593Z"},{"_id":"6638579e3d029c65e9ceedc7","openid":"oCIe95E0U1WibyRNJ864n-okoRT0","category":"购物","bill_id":"2024-05-06_1714968477135","收支":"支出","bill_money":-40,"年":"2024","月":"05","日":"06","time":"05月06日","week":"星期一","bill_type":"购物","desc":"口罩","icon":"../../static/type/购物.png","date_str":"20240506","date_int":20240506,"full_date_str":"2024-05-06","date":"2024-05-06T04:07:58.740Z","update_time":"2024-05-06T10:05:54.923Z"},{"_id":"6638afef0d2b315faf286f70","openid":"oCIe95E0U1WibyRNJ864n-okoRT0","category":"孩子","bill_id":"2024-05-06_1714991085662","收支":"支出","bill_money":-252,"年":"2024","月":"05","日":"06","time":"05月06日","week":"星期一","bill_type":"孩子","desc":"5月份餐费","icon":"../../static/type/孩子.png","date_str":"20240506","date_int":20240506,"full_date_str":"2024-05-06","date":"2024-05-06T10:24:47.753Z","update_time":"2024-05-06T13:05:54.923Z"},{"_id":"663437948620667bb4eae083","openid":"oCIe95E0U1WibyRNJ864n-okoRT0","category":"餐饮","bill_id":"2024-05-03_1714698130514","收支":"支出","bill_money":-17.5,"年":"2024","月":"05","日":"03","time":"05月03日","week":"星期五","bill_type":"餐饮","desc":"早餐","icon":"../../static/type/餐饮.png","date_str":"20240503","date_int":20240503,"full_date_str":"2024-05-03","date":"2024-05-03T01:02:12.243Z"},{"_id":"663565d7466d41f585ec6ef8","openid":"oCIe95E0U1WibyRNJ864n-okoRT0","category":"电","bill_id":"2024-05-03_1714775509594","收支":"支出","bill_money":-84,"年":"2024","月":"05","日":"03","time":"05月03日","week":"星期五","bill_type":"电","desc":"","icon":"../../static/type/电.png","date_str":"20240503","date_int":20240503,"full_date_str":"2024-05-03","date":"2024-05-03T22:31:51.116Z"},{"_id":"663784b78a5c7863b1fd7faf","openid":"oCIe95E0U1WibyRNJ864n-okoRT0","category":"旅行","bill_id":"2024-05-03_1714914486668","收支":"支出","bill_money":-200,"年":"2024","月":"05","日":"03","time":"05月03日","week":"星期五","bill_type":"旅行","desc":"宜兴","icon":"../../static/type/旅行.png","date_str":"20240503","date_int":20240503,"full_date_str":"2024-05-03","date":"2024-05-05T13:08:06.713Z"},{"_id":"6632f2d1c3b5c96502a740d1","openid":"oCIe95E0U1WibyRNJ864n-okoRT0","category":"餐饮","bill_id":"2024-05-02_1714614991720","收支":"支出","bill_money":-10,"年":"2024","月":"05","日":"02","time":"05月02日","week":"星期四","bill_type":"餐饮","desc":"串","icon":"../../static/type/餐饮.png","date_str":"20240502","date_int":20240502,"full_date_str":"2024-05-02","date":"2024-05-02T01:56:33.398Z"},{"_id":"6632f61b0d2b315faf862e8b","openid":"oCIe95E0U1WibyRNJ864n-okoRT0","category":"零食","bill_id":"2024-05-02_1714615833865","收支":"支出","bill_money":-7,"年":"2024","月":"05","日":"02","time":"05月02日","week":"星期四","bill_type":"零食","desc":"蜜雪冰城","icon":"../../static/type/零食.png","date_str":"20240502","date_int":20240502,"full_date_str":"2024-05-02","date":"2024-05-02T02:10:35.481Z"},{"_id":"6633207a652341ed5e77f151","openid":"oCIe95E0U1WibyRNJ864n-okoRT0","category":"餐饮","bill_id":"2024-05-02_1714626680512","收支":"支出","bill_money":-127,"年":"2024","月":"05","日":"02","time":"05月02日","week":"星期四","bill_type":"餐饮","desc":"午餐","icon":"../../static/type/餐饮.png","date_str":"20240502","date_int":20240502,"full_date_str":"2024-05-02","date":"2024-05-02T05:11:22.131Z"},{"_id":"663380971c90b65e4337d32e","openid":"oCIe95E0U1WibyRNJ864n-okoRT0","category":"零食","bill_id":"2024-05-02_1714651286335","收支":"支出","bill_money":-30,"年":"2024","月":"05","日":"02","time":"05月02日","week":"星期四","bill_type":"零食","desc":"","icon":"../../static/type/零食.png","date_str":"20240502","date_int":20240502,"full_date_str":"2024-05-02","date":"2024-05-02T12:01:27.867Z"},{"_id":"66338ea29755e328304923bf","openid":"oCIe95E0U1WibyRNJ864n-okoRT0","category":"餐饮","bill_id":"2024-05-02_1714654880413","收支":"支出","bill_money":-8.5,"年":"2024","月":"05","日":"02","time":"05月02日","week":"星期四","bill_type":"餐饮","desc":"紫燕","icon":"../../static/type/餐饮.png","date_str":"20240502","date_int":20240502,"full_date_str":"2024-05-02","date":"2024-05-02T13:01:22.254Z"},{"_id":"6632f786eef9cb63bb41c538","openid":"oCIe95E0U1WibyRNJ864n-okoRT0","category":"餐饮","bill_id":"2024-05-01_1714616197749","收支":"支出","bill_money":-21,"年":"2024","月":"05","日":"01","time":"05月01日","week":"星期三","bill_type":"餐饮","desc":"猪头肉","icon":"../../static/type/餐饮.png","date_str":"20240501","date_int":20240501,"full_date_str":"2024-05-01","date":"2024-05-02T02:16:38.660Z"},{"_id":"6632f79aee97ef5896c1151f","openid":"oCIe95E0U1WibyRNJ864n-okoRT0","category":"水果","bill_id":"2024-05-01_1714616217844","收支":"支出","bill_money":-21,"年":"2024","月":"05","日":"01","time":"05月01日","week":"星期三","bill_type":"水果","desc":"西瓜","icon":"../../static/type/水果.png","date_str":"20240501","date_int":20240501,"full_date_str":"2024-05-01","date":"2024-05-02T02:16:58.130Z"},{"_id":"663108b0ee97ef58968d7957","openid":"oCIe95E0U1WibyRNJ864n-okoRT0","category":"工资","bill_id":"2024-04-30_1714489520278","收支":"收入","bill_money":7000,"年":"2024","月":"04","日":"30","time":"04月30日","week":"星期二","bill_type":"工资","desc":"","icon":"../../static/type/工资.png","date_str":"20240430","date_int":20240430,"full_date_str":"2024-04-30","date":"2024-04-30T15:05:20.363Z"}];
		resolve(mockMonthBills);
	})
}

这里用到了Promise,其实主要作用了是为了让后面的api接口异步调用操作变为同步等待,减少回调地域问题。

使用时,在使用此方法前加async即可。

// 测试数据,用以验证页面布局及样式
let result = await getUserMonthBillList('1332', 5);
console.log('获取用户x月份账单成功');
this.month_bills = result;
1.5.2.2. 每日收支数据的聚合整理

按照前面的分析:

2. 要将每日的数据先进行计算,得到按自然天倒序排序的数组
3. 当天数据,还要包含一个数组,这个数组里的数据,才是每天的收支记录明细。 

然后我们已经有了mock数据,最好还是也封装一个方法,进行收支数据的处理:

/js目录创建 bill_calculate.js文件,录入以下内容:

/**
 * @param {Object} month_bill_list  某月的所有收支明细数据
 * @return {number} income_month 此月收入合计
 * @@return {number} expenditure_month 此月支出合计
 * @@return {Array} user_bill_list 按天为item的数组,每个item是当天发生的收支明细
 */
export function transformBills(month_bill_list) {
	// 先按照时间进行排序,然后将数据按天汇总。
	let sorted_detail_list = Array.from(month_bill_list).sort((a, b) => b['date_int'] - a[
					'date_int']);
	// sorted_detail_list = sorted_detail_list.filter(item => item['月'] == this.month);
	let user_bill_list = []
	let income_month = 0
	let expenditure_month = 0
	sorted_detail_list.map(function(this_bill) {
		let today_summary = user_bill_list.find(item => item['日'] == this_bill['日']);
		if (today_summary == undefined) {
			let expenditure = this_bill['收支'] == '支出' ? Math.abs(this_bill['bill_money']) : 0;
			let income = this_bill['收支'] == '收入' ? this_bill['bill_money'] : 0;
			expenditure_month = this_bill['收支'] == '支出' ? expenditure_month+this_bill['bill_money']: expenditure_month;
			income_month = this_bill['收支'] == '收入' ? income_month+this_bill['bill_money']: income_month;
			today_summary = {
				expenditure: parseFloat(expenditure),
				income: parseFloat(income),
				list: [this_bill],
				time: this_bill.time,
				week: this_bill.week,
				full_date: this_bill.date_str,
				'日': this_bill['日']
			};
			user_bill_list.push(today_summary);  // 后来的放后面
		} else {
			// 计算对应日期的消费、收入汇总
			let expenditure = this_bill['收支'] == '支出' ? today_summary.expenditure + Math.abs(this_bill['bill_money']) : today_summary.expenditure;
			let income = this_bill['收支'] == '收入' ? today_summary.income + this_bill['bill_money'] :
				today_summary.income;
			expenditure_month = this_bill['收支'] == '支出' ? expenditure_month+this_bill['bill_money']: expenditure_month;
			income_month = this_bill['收支'] == '收入' ? income_month+this_bill['bill_money']: income_month;
			today_summary.expenditure = expenditure;
			today_summary.income = income;
			today_summary.list = [this_bill, ...today_summary.list];
		}
	});
	return [income_month.toFixed(2), expenditure_month.toFixed(2), user_bill_list]
}
1.5.2.3. 页面scroll-view

为什么使用scroll-view,前面已经提到:

4. 我们使用uniapp的scroll-view来做大容器。这样可以做:下拉刷新到上月数据。触底加载下一个月数据。

实现起来,主要就是页面、js、css

  • 页面

    <view v-if="transfromedBills.length > 0">
    			<scroll-view scroll-y="true" :style="{height:scroll_view_height+'px'}" refresher-enabled="true"
    				:refresher-triggered="refresherTriggered" @refresherrefresh="refresher()"
    				@scrolltolower="loadMore">
    				<view>
    					<view v-for="(item, index) in transfromedBills" :key="index">
    						<view class="u-flex list-box day_summary">
    							<view class="u-m-r-10 u-flex-1">
    								<view class="header-text"> {{item.time}} {{item.week}}</view>
    							</view>
    							<view class="u-m-r-10 u-flex-1">
    								<view class="header-text">{{income_str}} {{item.income}}</view>
    							</view>
    							<view class="u-m-r-10 u-flex-1">
    								<view class="header-text">{{expenditure_str}} {{item.expenditure}}</view>
    							</view>
    						</view>
    		
    						<view class="list-box-children" v-for="(item1, index1) in item.list" :key="index1"
    							@click="toDetail(item1)">
    							<view class="u-flex">
    								<image slot="icon" class="box-icon" :src="item1.icon" mode="" :lazy-load="lazy_load">
    								</image>
    							</view>
    							<view class="box-left">
    								{{item1.bill_type}}
    							</view>
    							<view class="box-desc">
    								{{item1.desc}}
    							</view>
    							<view class="u-flex-1 box-right">
    								{{item1.bill_money}}
    							</view>
    						</view>
    					</view>
    				</view>
    			</scroll-view>
    		</view>
    
  • js

    <script>
    	import {
    		useStore
    	} from 'vuex';
    	import {
    		getUserMonthBillList
    	} from '@/js/api_bill_crud.js';
    	import {
    		transformBills
    	} from '@/js/bill_calculate.js';
    
    	export default {
    		data() {
    			return {
    				current_year: new Date().getFullYear(),
    				current_month: new Date().getMonth() + 1,
    				tabbar: [],
    				month_bills: [],
    				
    				transfromedBills: [],
    				income: 0,
    				expenditure: 0,
    				
    				expenditure_str: '', // ??
    				lazy_load: true, //?
    				refresherTriggered: false, // 设置当前下拉刷新状态,true 表示下拉刷新已经被触发,false 表示下拉刷新未被触发
    				scroll_view_height: 0,
    				income_str: '',
    			}
    		},
    		methods: {
    			refresher() {
    				console.log('下拉刷新');
    				if (this._refresherTriggered) {
    					return;
    				}
    				// 去加载上一个月的数据
    				if (this.current_month == 1) {
    					this.current_month = 12;
    					this.current_year = this.current_year - 1;
    				}
    				else {
    					this.current_month = this.current_month - 1;
    				}
    				console.log('要去加载上个月的年{}月{}', this.current_year, this.current_month);
    				var that = this;
    				if (!this.refresherTriggered) {
    					//下拉刷新,先变true再变false才能关闭
    					this.refresherTriggered = true;
    					//关掉圈圈,需要先执行完刷新操作
    					setTimeout(() => {
    					  that.refresherTriggered = false;
    					}, 1000);
    				}
    			},
    			loadMore() {
    				console.log('加载更多loadMore');
    				// 去加载下一个月的数据
    				if (this.current_month == 12) {
    					this.current_month = 1;
    					this.current_year = this.current_year + 1;
    				}
    				else {
    					this.current_month = this.current_month + 1;
    				}
    				console.log('要去加载下个月的年{}月{}', this.current_year, this.current_month);
    			}
    		},
    		async onShow() {
    			let [income, expenditure, transfromedBills] = transformBills(this.month_bills);
    			this.transfromedBills = transfromedBills;
    			this.income = income;
    			this.expenditure = expenditure;
    			console.log('账单计算成功');
    			// console.log(income);
    			// console.log(expenditure);
    			// console.log(transfromedBills);
    		},
    		async onLoad() {
    			const store = useStore(); //获取store对象
    			/**
    			 * 示例中为每个tabbar页面都写了一遍tabbar变量,您可以将tabbar数组写入到vuex中,这样可以全局引用
    			 */
    			this.tabbar = store.getters.getTabbar;
    			
    			// scroll-view高度,暂不计算。
    			this.scroll_view_height = 600
    			
    			// 测试数据,用以验证页面布局及样式
    			let result = await getUserMonthBillList('1332', 5);
    			console.log('获取用户x月份账单成功');
    			this.month_bills = result;
    			
    			let [income, expenditure, transfromedBills] = transformBills(this.month_bills);
    			this.transfromedBills = transfromedBills;
    			this.income = income;
    			this.expenditure = expenditure;
    			console.log('账单计算成功');
    		}
    	}
    </script>
    
  • css

    <style lang="scss">
    	.u-flex {
    		display: flex;
    		flex-direction: row;
    		align-items: center;
    	}
    	
    	.day_summary {
    		background-color: #f7f7f7;
    	}
    	
    	.list-box {
    		padding: 18rpx 18rpx 18rpx 40rpx;
    	}
    	
    	.list-box-children {
    		display: -webkit-box;
    		display: -webkit-flex;
    		display: flex;
    		-webkit-box-orient: horizontal;
    		-webkit-box-direction: normal;
    		-webkit-flex-direction: row;
    		flex-direction: row;
    		-webkit-box-align: center;
    		-webkit-align-items: center;
    		align-items: center;
    		position: relative;
    		box-sizing: border-box;
    		width: 100%;
    		padding: 26rpx 32rpx;
    		font-size: 28rpx;
    		line-height: 50rpx;
    		color: #606266;
    		background-color: #fff;
    		text-align: left;
    	
    		.box-icon {
    			width: 50rpx;
    			height: 50rpx;
    			margin-right: 35rpx;
    		}
    	
    		.box-left {
    			width: auto;
    			font-weight: 500;
    			font-size: 28rpx;
    		}
    	
    		.box-right {
    			overflow: hidden;
    			text-align: right;
    			vertical-align: middle;
    			color: #909399;
    			font-size: 26rpx;
    		}
    	
    		.box-desc {
    			font-weight: 500;
    			width: 300rpx;
    			margin-left: 50rpx;
    			overflow: hidden;
    			text-overflow: ellipsis;
    			-ms-text-overflow: ellipsis;
    			display: -webkit-box;
    			line-clamp: 1;
    			-webkit-line-clamp: 1;
    			-webkit-box-orient: vertical;
    		}
    	}
    	
    	.u-m-r-10 {
    		margin-right: 10rpx !important;
    	}
    	
    	.u-flex-1 {
    		flex: 1;
    	}
    	
    	.header-text {
    		font-size: 25rpx;
    		color: #7a7a7a;
    	}
    </style>
    

    通过下拉刷新和触底加载更多,页面能正确的处理调用,后面通过api再完善真是数据的处理

1.6. TODO

内容较多,下一节再处理:

  1. 点击更新或删除明细账单
  2. 头部数据的联动,不再是固定数据
  3. 月份可以点击下拉箭头自行快速选择
  4. 每日的收支汇总,布局要再优化一下。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1694206.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

非整数倍数据位宽转换24to128

描述 实现数据位宽转换电路&#xff0c;实现24bit数据输入转换为128bit数据输出。其中&#xff0c;先到的数据应置于输出的高bit位。 电路的接口如下图所示。valid_in用来指示数据输入data_in的有效性&#xff0c;valid_out用来指示数据输出data_out的有效性&#xff1b;clk是时…

LeetCode:279.完全平方数

class Solution:def numSquares(self, n: int) -> int:dp[i for i in range(n1)]for i in range(2,n1):for j in range(1,int(i**(0.5))1):dp[i]min(dp[i],dp[i-j*j]1)return dp[-1]代码解释 初始化 DP 数组&#xff1a; dp [i for i in range(n1)] 这里&#xff0c;dp[i]…

C#【进阶】迭代器

迭代器 文章目录 1、迭代器概念2、标准迭代器的实现方法3、用yield return 语法糖实现迭代器4、用yield return 语法糖为泛型类实现迭代器 1、迭代器概念 迭代器&#xff08;iterator&#xff09; 又称光标&#xff08;cursor&#xff09; 是程序设计的软件设计模式 迭代器提供…

WSL2添加桌面显示

编译 autoscan && aclocal && autoconf && automake --add-missing 自动 #!/bin/shrun () {echo "running: $*"eval $*if test $? ! 0 ; thenecho "error: while running $*"exit 1fi }run aclocal run autoheader run automak…

xcode按下delete键不能删除不能使用,解决办法

有可能是按键冲突导致的问题&#xff0c;就是你不小心把delete键绑定了不同的快捷键&#xff0c;所以需要恢复所有的偏好设置和快捷键才可以&#xff0c;我这里就是这样的提示内容&#xff0c;在xcode中按delete键完全无效&#xff1a; 而且还会报红色提示&#xff1a;意思是不…

vue深度选择器(:deep​)

处于 scoped 样式中的选择器如果想要做更“深度”的选择&#xff0c;也即&#xff1a;影响到子组件&#xff0c;可以使用 :deep() 这个伪类&#xff1a; <style lang"scss" scoped> .evaluation-situation-details :deep .cl-icon-arrow-right {display: none…

C# 结合 JS 暴改腾讯 IM SDK Demo

目录 关于腾讯 IM SDK Demo 范例运行环境 设计思路 服务端生成地址 IM 服务端接收 IM 客户端程序 小结 关于腾讯 IM SDK Demo 腾讯云即时通信 IM SDK 提供了单聊、群聊、关系链、消息漫游、群组管理、资料管理、直播弹幕等功能&#xff0c;并提供完备的 App 接入及管…

Win10版本TDengine使用分享

软件介绍 TDengine是一款开源、高性能、可扩展的时间序列数据库&#xff08;TSDB&#xff09;。它由涛思数据公司开发&#xff0c;专为处理大规模时间序列数据而设计。时间序列数据是指按时间顺序排列的数据点序列&#xff0c;广泛应用于物联网、大数据分析、金融等领域。TDen…

YonBuilder移动开发基础教程——云修复

1 使用场景 在项目开发中&#xff0c;我们经常会遇到一种场景&#xff0c;对于一些已经上架应用市场对外发布的应用&#xff0c;我们需要修改其中部分页面的部分内容样式或功能逻辑&#xff0c;通常的做法是我们修改后&#xff0c;重新编译一个新的版本&#xff0c;然后提交应…

海康威视硬盘录像机NVR连接公网视频监控平台,注册失败,抓包发现有403 forbidden的问题解决

目录 一、问题描述 二、问题定位 1、查看DVR的配置 2、查看需要使用的端口是否开放 3、查看日志 4、抓包 &#xff08;1&#xff09;找出错误 &#xff08;2&#xff09;查看数据包内容 三、问题分析 1、国标28181中的域的概念 2、域应该如何定义 &#xff08;1&am…

docker- 镜像 导出导入

文章目录 前言docker- 镜像 导出导入1. 导出2. 删除镜像3. 导入镜像 前言 如果您觉得有用的话&#xff0c;记得给博主点个赞&#xff0c;评论&#xff0c;收藏一键三连啊&#xff0c;写作不易啊^ _ ^。   而且听说点赞的人每天的运气都不会太差&#xff0c;实在白嫖的话&…

基于51单片机的盆栽自动浇花系统

一.硬件方案 工作原理是湿度传感器将采集到的数据直接传送到ADC0832的IN端作为输入的模拟信号。选用湿度传感器和AD转换&#xff0c;电路内部包含有湿度采集、AD转换、单片机译码显示等功能。单片机需要采集数据时&#xff0c;发出指令启动A/D转换器工作&#xff0c;ADC0832根…

二叉树基于队列实现的操作详解

一、队列知识补充 有关队列的知识请详见博主的另一篇博客&#xff1a;http://t.csdnimg.cn/3PwO4 本文仅仅附上需要的队列操作供读者参考 //结构体定义 typedef struct BinaryTreeNode* QDataType;typedef struct QueueNode {struct QueueNode* next;QDataType val; }QNode;…

多线程事务

一、业务场景 我们在工作中经常会到往数据库里插入大量数据的工作&#xff0c;但是既需要保证数据的一致性&#xff0c;又要保证程序执行的效率。因此需要在多线程中使用事务&#xff0c;这样既可以保证数据的一致性&#xff0c;又能保证程序的执行效率。但是spring自带的Trans…

【机器学习系列】使用高斯贝叶斯模型进行数据分类的完整流程

目录 一、导入数据 二、选择特征 三、十折交叉验证 四、划分训练集和测试集 五、训练高斯贝叶斯模型 六、预测测试集 七、查看训练集和测试集上的分数 八、查看混合矩阵 九、输出评估指标 一、导入数据 # 根据商户数据预测其是否续约案例 import pandas #读取数据到 da…

【PostgreSQL001】比较开发生产2个数据库结构方法

1.一直以来想写下基于PostgreSQL的系列文章&#xff0c;作为较火的数据ETL工具&#xff0c;也是日常项目开发中常用的一款工具&#xff0c;最近刚好挤时间梳理、总结下这块儿的知识体系。 2.熟悉、梳理、总结下PostgreSQL数据库相关知识体系。 3.欢迎批评指正&#xff0c;欢迎关…

《AI学习笔记》大模型-微调/训练区别以及流程

阿丹&#xff1a; 之前一直对于大模型的微调和训练这两个名词不是很清晰&#xff0c;所有找了一个时间来弄明白到底有什么区别以及到底要怎么去使用去做。并且上手实践一下。 大模型业务全流程&#xff1a; 大模型为啥要微调&#xff1f;有哪些微调方式&#xff1f; 模型参数…

【机器学习】大模型在机器学习中的应用:从深度学习到生成式人工智能的演进

&#x1f512;文章目录&#xff1a; &#x1f4a5;1.引言 ☔2.大模型概述 &#x1f6b2;3.大模型在深度学习中的应用 &#x1f6f4;4.大模型在生成式人工智能中的应用 &#x1f44a;5.大模型的挑战与未来展望 &#x1f4a5;1.引言 随着数据量的爆炸性增长和计算能力的提…

电信光猫的USB存储对外网开放访问

前提条件当然是要有公网IP地址了&#xff0c;没有的话去找电信索要&#xff0c;然后可以使用动态域名正常访问。 我的电信光猫发现共享访问速度还可以&#xff0c;会有31M/s左右的写入速度 但是有一个不方便的是&#xff0c;无法从外网提供访问&#xff0c;SMB协议所用的445端…

国产信创数据库:使用MySQL等开源产品能做信创替换吗?

随着信创关键行业替代加速推进&#xff0c;多数企业习惯原来标配即&#xff1a;centosmysql等开源产品&#xff0c;而大家讨论核心焦点在于“什么是信创数据库”&#xff0c;使用 MySQL 能做信创替换吗&#xff1f;基于开源二开的数据库算信创库吗&#xff1f;等等。想来这个问…