// import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:liftmanager/common/common.dart'; import 'package:liftmanager/internal/account/account_router.dart'; import 'package:liftmanager/internal/account/model/user_info_entity.dart'; import 'package:liftmanager/internal/wode/wode_router.dart'; import 'package:liftmanager/net/api_service.dart'; import 'package:liftmanager/routers/fluro_navigator.dart'; import 'package:liftmanager/utils/image_utils.dart'; import 'package:liftmanager/widgets/app_bar.dart'; import 'package:liftmanager/widgets/click_item.dart'; import 'package:liftmanager/widgets/load_image.dart'; import 'package:liftmanager/widgets/my_button.dart'; import 'package:provider/provider.dart'; import 'package:liftmanager/widgets/bbs_content.dart'; import 'package:liftmanager/internal/bbs/bbs_router.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:liftmanager/utils/toast.dart'; import 'package:liftmanager/utils/log_util.dart'; import 'dart:convert'; import 'package:liftmanager/utils/time_format.dart'; class PiaoDetail extends StatefulWidget { PiaoDetail(this.id); final String id; @override State createState() { return PiaoDetailState(); } } class PiaoDetailState extends State with AutomaticKeepAliveClientMixin { bool _hasData = false; var detailObj; @override void initState() { super.initState(); getPiaoDetail(); print(widget.id); print(123789); } Future getPiaoDetail() async { await NewApiService().getPiaoDetail(int.parse(widget.id), onSuccess: (res) { if (res != null) { _hasData = true; detailObj = res; // LogUtil.d(JsonEncoder(detailObj)); LogUtil.d(JsonEncoder().convert(detailObj)); print(9999); setState(() {}); } }, onError: (code, msg) { toasts(msg); }); } @override Widget build(BuildContext context) { double width = MediaQuery.of(context).size.width; return Scaffold( appBar: MyAppBar( centerTitle: "发票详情", ), body: _hasData ?Stack( children:[ ListView(padding: EdgeInsets.all(0.0), children: [ // detailObj.checkFlag==1?Kan(title:'电子发票已开票',time:"${detailObj.createTime!=null?DateUtils.instance.getFormartData(timeSamp: detailObj.createTime,format: "yyyy-MM-dd"):''}",fun:(){ // NavigatorUtils.push(context, WodeRouter.piaoCheck); // }): // Container( // padding: EdgeInsets.only(left:ScreenUtil().setWidth(15),right:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(10)), // child: Text("未开发票"), // ), Container( padding: EdgeInsets.only(left:ScreenUtil().setWidth(15),right:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(10)), color: Color(0xfff5f5f5), child:Text( '接收方式', textAlign: TextAlign.left, style: TextStyle( fontSize:ScreenUtil().setSp(14), color:Color(0xff333333), ), ), ), detailObj.invoiceType=="1"? Heng(left:"电子邮箱",right:"${detailObj.email??""}",leftColor:0xff999999,rightColor: 0xff333333,) :Column( children: [ Heng(left:"收票人",right:"${detailObj.receiveTicket??""}",leftColor:0xff999999,rightColor: 0xff333333,), Heng(left:"收票人电话",right:"${detailObj.receiveMebile??""}",leftColor:0xff999999,rightColor: 0xff333333,), Heng(left:"收票人地址",right:"${detailObj.receiveAddress??""}",leftColor:0xff999999,rightColor: 0xff333333,), ], ), Container( padding: EdgeInsets.only(left:ScreenUtil().setWidth(15),right:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(10)), color: Color(0xfff5f5f5), child:Text( '发票详情', textAlign: TextAlign.left, style: TextStyle( fontSize:ScreenUtil().setSp(14), color:Color(0xff333333), ), ), ), Heng(left:"发票类型",right:"${detailObj.type==1?"个人":"企业"}",leftColor:0xff999999,rightColor: 0xff333333,), Heng(left:"发票抬头",right:"${detailObj.userInvoice?.name??"咨询服务费"}",leftColor:0xff999999,rightColor: 0xff333333,), detailObj.type==2?Heng(left:"企业税号",right:"${detailObj.userInvoice?.enterpriseNumber??""}",leftColor:0xff999999,rightColor: 0xff333333,):Container(child:null), Heng(left:"发票内容",right:"${detailObj.userInvoice?.gmfMc??"咨询服务费"}",leftColor:0xff999999,rightColor: 0xff333333,), Heng(left:"发票金额",right:"${detailObj.hjje.toString()??""}",leftColor:0xff999999,rightColor: 0xff333333,), Heng(left:"申请时间",right:"${detailObj.createTime!=null?DateUtils.instance.getFormartData(timeSamp: detailObj.createTime,format: "yyyy-MM-dd HH:mm"):''}",leftColor:0xff999999,rightColor: 0xff333333,), detailObj.checkFlag==0 ?Heng(left:"驳回原因",right:"${detailObj.reason??""}",leftColor:0xff999999,rightColor: 0xff333333,):Container(child:null), Container( color: Color(0xffFAF7FA), height: ScreenUtil().setWidth(5), ), Kan(title:'查看订单',time:"",fun:(){ NavigatorUtils.push(context, "${WodeRouter.piaoOrder}?id=${detailObj.id}"); }) // Kan(title:'含两个订单',time:"2020-02-26 11:06-2020-02-26 11:06",fun:(){ // NavigatorUtils.push(context, WodeRouter.piaoOrder); // }) ]), ] ):Center( child: Text("正在加载..."), ) ); } @override bool get wantKeepAlive => true; } class Heng extends StatelessWidget { Heng({Key key,this.left,this.right,this.leftColor,this.rightColor}) : super(key: key); String left; String right; int leftColor; int rightColor; @override Widget build(BuildContext context) { double width = MediaQuery.of(context).size.width; return Container( padding: EdgeInsets.only(left:ScreenUtil().setWidth(15),right:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(10)), decoration: BoxDecoration( border: Border( bottom: BorderSide(width: .5, color:Color(0xfff5f5f5)), ), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children:[ Text( left, style: TextStyle( color:Color(leftColor), fontSize:ScreenUtil().setSp(14) ), textAlign:TextAlign.start, ), Container( width: width*0.7, child: Text( right, style: TextStyle( color:Color(rightColor), fontSize:ScreenUtil().setSp(14) ), textAlign:TextAlign.start, overflow: TextOverflow.ellipsis, ), ) ] ), ); } } class Kan extends StatelessWidget { Kan({Key key,this.title,this.time,this.fun}) : super(key: key); String title; String time; Function fun; @override Widget build(BuildContext context) { return GestureDetector( behavior: HitTestBehavior.opaque, onTap: (){ fun(); }, child:Container( padding: EdgeInsets.only(left:ScreenUtil().setWidth(15),right:ScreenUtil().setWidth(5),top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(10)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children:[ Column( crossAxisAlignment: CrossAxisAlignment.start, children:[ Text( title, textAlign: TextAlign.left, style: TextStyle( fontSize:ScreenUtil().setSp(14), color:Color(0xff666666), ), ), // SizedBox( // height:5 // ), // Text( // time, // textAlign: TextAlign.left, // style: TextStyle( // fontSize:ScreenUtil().setSp(12), // color:Color(0xff666666), // ), // ), ] ), Row( children:[ // Text( // '查看', // textAlign: TextAlign.left, // style: TextStyle( // fontSize:ScreenUtil().setSp(12), // color:Color(0xff666666), // ), // ), Icon( Icons.keyboard_arrow_right, color: Color(0xffcccccc), ), ] ) ] ), ) ); } }