123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_easyrefresh/easy_refresh.dart';
- import 'package:ysairplane2/base/YSBase.dart';
- import 'package:ysairplane2/tools/YSNetWorking.dart';
- import 'package:ysairplane2/tools/YSTools.dart';
- class YSIncome extends StatefulWidget {
- const YSIncome({Key key}) : super(key: key);
- @override
- _YSIncomeState createState() => _YSIncomeState();
- }
- class _YSIncomeState extends State<YSIncome> {
- String _timeSrt = '';
- List _dataArray = [];
- int _page = 1;
- @override
- void initState() {
- Future.delayed(Duration(seconds: 0)).then((value){
- _refreshData();
- });
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- return YSBase(
- ystitle: '收入明细',
- yscolor: Color(0xFFF5F6F8),
- yschild: Container(
- width: MediaQuery.of(context).size.width,
- child: Column(
- children: [
- Container(
- height: hsp(80),
- padding: EdgeInsets.only(left: hsp(20),right: hsp(20)),
- child: GestureDetector(
- onTap: (){
- showModalBottomSheet(
- context: context,
- builder: (context){
- return YSDatePicker(isDate: true,choose: (value){
- print(value);
- _timeSrt = value.substring(0,7);
- _refreshData();
- },);
- }
- );
- },
- child: Row(
- children: [
- Text(_timeSrt.isEmpty?'全部':_timeSrt,style: TextStyle(fontSize: zsp(30),color: Colors.black),),
- Icon(Icons.keyboard_arrow_down,size: hsp(40),color: Color(0xFFCCCCCC),)
- ],
- ),
- )
- ),
- Container(
- height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44-hsp(80),
- color: Colors.white,
- child: EasyRefresh(
- onRefresh: _refreshData,
- onLoad: _loadMoreData,
- header: TaurusHeader(
- ),
- footer: TaurusFooter(
- ),
- child: ListView.separated(
- padding: EdgeInsets.only(left: hsp(20),right: hsp(20)),
- itemBuilder: (context,index){
- Map item = _dataArray[index];
- return GestureDetector(
- onTap: (){
- Navigator.of(context).push(
- CupertinoPageRoute(
- builder: (context){
- return YSIncomeDetail(income: item,);
- }
- )
- );
- },
- child: Container(
- padding: EdgeInsets.only(top: hsp(30),bottom: hsp(30)),
- child: LayoutBuilder(
- builder: (context,listSize){
- return Row(
- children: [
- Container(
- width: listSize.maxWidth-hsp(150),
- child: RichText(
- text: TextSpan(
- text: '${item['orderName']}',
- style: TextStyle(fontSize: zsp(28),color: Colors.black),
- children: [
- if(item['orderSn']!=null)TextSpan(
- text: '[订单编号: ${item['orderSn']}]',
- style: TextStyle(color: Color(0xFF999999))
- )
- ]
- ),
- ),
- ),
- Container(
- width: hsp(110),
- child: Text('${item['status']}',style: TextStyle(fontSize: zsp(28),
- color: Color(item['status']=='冻结中'?0xFFFFAE00:0xFF999999)),),
- alignment: Alignment.centerRight,
- ),
- Icon(Icons.chevron_right,size: hsp(40),color: Color(0xFF999999),)
- ],
- );
- },
- ),
- ),
- );
- },
- separatorBuilder: (context,index){
- return Divider(height: hsp(1),thickness: hsp(1),color: Color(0xFFF5F6F8),);
- },
- itemCount: _dataArray.length,
- ),
- ),
- )
- ],
- ),
- ),
- );
- }
- Future<void> _refreshData() async{
- _page = 1;
- if(_timeSrt.isEmpty)_timeSrt = '${DateTime.now().year}-'+'${DateTime.now().month}'.padLeft(2,'0');
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/servants/incomeList',parameter: {'pageNum':_page,'date':_timeSrt},isLoading: false,isToken: true);
- if(dict!=null){
- setState(() {
- _dataArray = dict['data']['resultList'];
- });
- }
- }
- Future<void> _loadMoreData() async{
- _page++;
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/servants/incomeList',parameter: {'pageNum':_page,'date':_timeSrt},isLoading: false,isToken: true);
- if(dict!=null){
- setState(() {
- _dataArray.addAll(dict['data']['resultList']);
- });
- }
- }
- }
- class YSIncomeDetail extends StatefulWidget {
- final Map income;
- const YSIncomeDetail({Key key, this.income}) : super(key: key);
- @override
- _YSIncomeDetailState createState() => _YSIncomeDetailState();
- }
- class _YSIncomeDetailState extends State<YSIncomeDetail> {
- List _titleArray = [];
- @override
- void initState() {
- if(widget.income!=null){
- if(widget.income['type']==1){
- _titleArray = [{'title':'','content':''},{'title':'订单编号','content':''},{'title':'佣金状态','content':''},{'title':'佣金金额','content':''}
- ,{'title':'订单状态','content':''},{'title':'订单金额','content':''}];
- _titleArray[0]['title'] = widget.income['orderName'];
- _titleArray[1]['content'] = widget.income['orderSn'];
- _titleArray[2]['content'] = widget.income['status'];
- _titleArray[3]['content'] = '${widget.income['servantsPrice']??'0.00'}';
- _titleArray[4]['content'] = widget.income['orderStatus'];
- _titleArray[5]['content'] = '${widget.income['orderPrice']??'0.00'}';
- }else{
- _titleArray = [{'title':'','content':''},{'title':'提现状态','content':''},{'title':'提现方式','content':''}
- ,{'title':'提现账号','content':''},{'title':'提现金额','content':''},{'title':'提现时间','content':''}];
- _titleArray[0]['title'] = widget.income['orderName'];
- _titleArray[1]['content'] = widget.income['status'];
- _titleArray[2]['content'] = widget.income['accountName'];
- _titleArray[3]['content'] = widget.income['account'];
- _titleArray[4]['content'] = '${widget.income['price']??'0.00'}';
- _titleArray[5]['content'] = widget.income['createTime'];
- }
- }
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- return YSBase(
- ystitle: '收入明细详情',
- yscolor: Color(0xFFF5F6F8),
- yschild: Container(
- color: Colors.white,
- width: MediaQuery.of(context).size.width,
- child: ListView.separated(
- padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
- itemBuilder: (context,index){
- Map item = _titleArray[index];
- return Container(
- padding: EdgeInsets.only(top: hsp(30),bottom: hsp(30)),
- child: LayoutBuilder(
- builder: (context,listSize){
- return Row(
- children: [
- Container(
- width: hsp(200),
- child: Text(item['title'],style: TextStyle(fontSize: zsp(28),color: Colors.black,fontWeight: index==0?FontWeight.bold:FontWeight.normal),),
- ),
- Container(
- width: listSize.maxWidth-hsp(200),
- child: Text(item['content'],style: TextStyle(fontSize: zsp(28),color: Color(0xFF999999)),),
- alignment: Alignment.centerRight,
- )
- ],
- );
- },
- ),
- );
- },
- separatorBuilder: (context,index){
- return Divider(height: hsp(1),thickness: hsp(1),color: Color(0xFFF5F6F8),);
- },
- itemCount: _titleArray.length,
- shrinkWrap: true,
- physics: NeverScrollableScrollPhysics(),
- ),
- ),
- );
- }
- }
|