123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373 |
- // import 'package:flutter/cupertino.dart';
- import 'dart:convert';
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:liftmanager/internal/wode/wode_router.dart';
- import 'package:liftmanager/net/api_service.dart';
- import 'package:liftmanager/res/colors.dart';
- import 'package:liftmanager/routers/fluro_navigator.dart';
- import 'package:liftmanager/utils/log_util.dart';
- import 'package:liftmanager/utils/time_format.dart';
- import 'package:liftmanager/utils/toast.dart';
- import 'package:liftmanager/widgets/app_bar.dart';
- class PiaoDetail extends StatefulWidget {
- PiaoDetail(this.id);
- final String id;
- @override
- State<StatefulWidget> createState() {
- return PiaoDetailState();
- }
- }
- class PiaoDetailState extends State<PiaoDetail>
- 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: <Widget>[
- ListView(padding: EdgeInsets.all(0.0), children: <Widget>[
- Kan(
- titleType: detailObj.invoiceType == '1' ? '电子发票' : '专用发票',
- statusType: detailObj.checkFlag == 1 ? '已开票' : '未开票',
- time:
- "${detailObj.createTime != null ? DateUtils.instance.getFormartData(timeSamp: detailObj.createTime, format: "yyyy-MM-dd HH:mm") : ''}",
- 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)),
- // color: Color(0xfff5f5f5),
- // child: Text(
- // '接收方式',
- // textAlign: TextAlign.left,
- // style: TextStyle(
- // fontSize: ScreenUtil().setSp(14),
- // color: Color(0xff333333),
- // ),
- // ),
- // ),
- Container(
- color: Color(0xffFAF7FA),
- height: ScreenUtil().setWidth(5),
- ),
- detailObj.invoiceType == "1"
- ? Heng(
- left: "电子邮箱",
- right: "${detailObj.email ?? ""}",
- leftColor: 0xff333333,
- rightColor: 0xff333333,
- )
- : Column(
- children: <Widget>[
- Heng(
- left: "收票人",
- right: "${detailObj.receiveTicket ?? ""}",
- leftColor: 0xff333333,
- rightColor: 0xff333333,
- ),
- Heng(
- left: "收票人电话",
- right: "${detailObj.receiveMebile ?? ""}",
- leftColor: 0xff333333,
- rightColor: 0xff333333,
- ),
- Heng(
- left: "收票人地址",
- right: "${detailObj.receiveAddress ?? ""}",
- leftColor: 0xff333333,
- 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),
- // ),
- // ),
- // ),
- Container(
- color: Color(0xffFAF7FA),
- height: ScreenUtil().setWidth(5),
- ),
- Heng(
- left: "发票类型",
- right: "${detailObj.type == 1 ? "个人" : "企业"}",
- leftColor: 0xff333333,
- rightColor: 0xff333333,
- ),
- Heng(
- left: "发票抬头",
- right: "${detailObj.userInvoice?.name ?? "咨询服务费"}",
- leftColor: 0xff333333,
- rightColor: 0xff333333,
- ),
- detailObj.type == 2
- ? Heng(
- left: "企业税号",
- right:
- "${detailObj.userInvoice?.enterpriseNumber ?? ""}",
- leftColor: 0xff333333,
- rightColor: 0xff333333,
- )
- : Container(child: null),
- Heng(
- left: "发票内容",
- right: "${detailObj.userInvoice?.gmfMc ?? "咨询服务费"}",
- leftColor: 0xff333333,
- rightColor: 0xff333333,
- ),
- Heng(
- left: "发票金额",
- right: "${detailObj.hjje.toString() ?? ""}",
- leftColor: 0xff333333,
- rightColor: 0xff333333,
- ),
- Heng(
- left: "申请时间",
- right:
- "${detailObj.createTime != null ? DateUtils.instance.getFormartData(timeSamp: detailObj.createTime, format: "yyyy-MM-dd HH:mm") : ''}",
- leftColor: 0xff333333,
- rightColor: 0xff333333,
- ),
- detailObj.checkFlag == 0
- ? Heng(
- left: "驳回原因",
- right: "${detailObj.reason ?? ""}",
- leftColor: 0xff333333,
- rightColor: 0xff333333,
- )
- : Container(child: null),
- Container(
- color: Color(0xffFAF7FA),
- height: ScreenUtil().setWidth(5),
- ),
- Kan(
- title: '查看订单(${detailObj.invoiceItem.length})',
- time: "",
- fun: () {
- NavigatorUtils.push(context,
- "${WodeRouter.piaoOrder}?id=${detailObj.id}");
- }),
- Container(
- color: Color(0xffFAF7FA),
- height: ScreenUtil().setWidth(5),
- ),
- // 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: <Widget>[
- 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.end,
- overflow: TextOverflow.ellipsis,
- ),
- )
- ]),
- );
- }
- }
- class Kan extends StatelessWidget {
- Kan(
- {Key key,
- this.title,
- this.titleType,
- this.statusType,
- this.time,
- this.fun})
- : super(key: key);
- String title;
- String titleType;
- String statusType;
- 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: <Widget>[
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- title != null
- ? Text(
- title,
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(14),
- color: Color(0xff666666),
- ),
- )
- : Container(),
- title == null
- ? Row(
- children: [
- Text(
- '$titleType: ',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(14),
- color: Color(0xff666666),
- ),
- ),
- Text(
- statusType,
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(14),
- color: Colours.blue_app_main,
- ),
- ),
- //
- ],
- )
- : Container(),
- title == null ? SizedBox(height: 5) : Container(),
- title == null
- ? Row(
- children: [
- Text(
- '申请日期: ',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(14),
- color: Color(0xff666666),
- ),
- ),
- Text(
- time,
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(14),
- color: Color(0xff999999),
- ),
- ),
- //
- ],
- )
- : Container(),
- ]),
- // Row(children: <Widget>[
- // Text(
- // '查看',
- // textAlign: TextAlign.left,
- // style: TextStyle(
- // fontSize: ScreenUtil().setSp(12),
- // color:
- // title != null ? Color(0xff999999) : Color(0xffFDAF2C),
- // ),
- // ),
- // Icon(
- // Icons.keyboard_arrow_right,
- // color: Color(0xffcccccc),
- // ),
- // ])
- ]),
- ));
- }
- }
|