piao_detail.dart 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. // import 'package:flutter/cupertino.dart';
  2. import 'dart:convert';
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter_screenutil/flutter_screenutil.dart';
  5. import 'package:liftmanager/internal/wode/wode_router.dart';
  6. import 'package:liftmanager/net/api_service.dart';
  7. import 'package:liftmanager/res/colors.dart';
  8. import 'package:liftmanager/routers/fluro_navigator.dart';
  9. import 'package:liftmanager/utils/log_util.dart';
  10. import 'package:liftmanager/utils/time_format.dart';
  11. import 'package:liftmanager/utils/toast.dart';
  12. import 'package:liftmanager/widgets/app_bar.dart';
  13. class PiaoDetail extends StatefulWidget {
  14. PiaoDetail(this.id);
  15. final String id;
  16. @override
  17. State<StatefulWidget> createState() {
  18. return PiaoDetailState();
  19. }
  20. }
  21. class PiaoDetailState extends State<PiaoDetail>
  22. with AutomaticKeepAliveClientMixin {
  23. bool _hasData = false;
  24. var detailObj;
  25. @override
  26. void initState() {
  27. super.initState();
  28. getPiaoDetail();
  29. print(widget.id);
  30. print(123789);
  31. }
  32. Future getPiaoDetail() async {
  33. await NewApiService().getPiaoDetail(int.parse(widget.id), onSuccess: (res) {
  34. if (res != null) {
  35. _hasData = true;
  36. detailObj = res;
  37. // LogUtil.d(JsonEncoder(detailObj));
  38. LogUtil.d(JsonEncoder().convert(detailObj));
  39. print(9999);
  40. setState(() {});
  41. }
  42. }, onError: (code, msg) {
  43. toasts(msg);
  44. });
  45. }
  46. @override
  47. Widget build(BuildContext context) {
  48. double width = MediaQuery.of(context).size.width;
  49. return Scaffold(
  50. appBar: MyAppBar(
  51. centerTitle: "发票详情",
  52. ),
  53. body: _hasData
  54. ? Stack(children: <Widget>[
  55. ListView(padding: EdgeInsets.all(0.0), children: <Widget>[
  56. Kan(
  57. titleType: detailObj.invoiceType == '1' ? '电子发票' : '专用发票',
  58. statusType: detailObj.checkFlag == 1 ? '已开票' : '未开票',
  59. time:
  60. "${detailObj.createTime != null ? DateUtils.instance.getFormartData(timeSamp: detailObj.createTime, format: "yyyy-MM-dd HH:mm") : ''}",
  61. fun: () {
  62. // NavigatorUtils.push(context, WodeRouter.piaoCheck);
  63. }),
  64. // Container(
  65. // padding: EdgeInsets.only(
  66. // left: ScreenUtil().setWidth(15),
  67. // right: ScreenUtil().setWidth(15),
  68. // top: ScreenUtil().setWidth(10),
  69. // bottom: ScreenUtil().setWidth(10)),
  70. // color: Color(0xfff5f5f5),
  71. // child: Text(
  72. // '接收方式',
  73. // textAlign: TextAlign.left,
  74. // style: TextStyle(
  75. // fontSize: ScreenUtil().setSp(14),
  76. // color: Color(0xff333333),
  77. // ),
  78. // ),
  79. // ),
  80. Container(
  81. color: Color(0xffFAF7FA),
  82. height: ScreenUtil().setWidth(5),
  83. ),
  84. detailObj.invoiceType == "1"
  85. ? Heng(
  86. left: "电子邮箱",
  87. right: "${detailObj.email ?? ""}",
  88. leftColor: 0xff333333,
  89. rightColor: 0xff333333,
  90. )
  91. : Column(
  92. children: <Widget>[
  93. Heng(
  94. left: "收票人",
  95. right: "${detailObj.receiveTicket ?? ""}",
  96. leftColor: 0xff333333,
  97. rightColor: 0xff333333,
  98. ),
  99. Heng(
  100. left: "收票人电话",
  101. right: "${detailObj.receiveMebile ?? ""}",
  102. leftColor: 0xff333333,
  103. rightColor: 0xff333333,
  104. ),
  105. Heng(
  106. left: "收票人地址",
  107. right: "${detailObj.receiveAddress ?? ""}",
  108. leftColor: 0xff333333,
  109. rightColor: 0xff333333,
  110. ),
  111. ],
  112. ),
  113. // Container(
  114. // padding: EdgeInsets.only(
  115. // left: ScreenUtil().setWidth(15),
  116. // right: ScreenUtil().setWidth(15),
  117. // top: ScreenUtil().setWidth(10),
  118. // bottom: ScreenUtil().setWidth(10)),
  119. // color: Color(0xfff5f5f5),
  120. // child: Text(
  121. // '发票详情',
  122. // textAlign: TextAlign.left,
  123. // style: TextStyle(
  124. // fontSize: ScreenUtil().setSp(14),
  125. // color: Color(0xff333333),
  126. // ),
  127. // ),
  128. // ),
  129. Container(
  130. color: Color(0xffFAF7FA),
  131. height: ScreenUtil().setWidth(5),
  132. ),
  133. Heng(
  134. left: "发票类型",
  135. right: "${detailObj.type == 1 ? "个人" : "企业"}",
  136. leftColor: 0xff333333,
  137. rightColor: 0xff333333,
  138. ),
  139. Heng(
  140. left: "发票抬头",
  141. right: "${detailObj.userInvoice?.name ?? "咨询服务费"}",
  142. leftColor: 0xff333333,
  143. rightColor: 0xff333333,
  144. ),
  145. detailObj.type == 2
  146. ? Heng(
  147. left: "企业税号",
  148. right:
  149. "${detailObj.userInvoice?.enterpriseNumber ?? ""}",
  150. leftColor: 0xff333333,
  151. rightColor: 0xff333333,
  152. )
  153. : Container(child: null),
  154. Heng(
  155. left: "发票内容",
  156. right: "${detailObj.userInvoice?.gmfMc ?? "咨询服务费"}",
  157. leftColor: 0xff333333,
  158. rightColor: 0xff333333,
  159. ),
  160. Heng(
  161. left: "发票金额",
  162. right: "${detailObj.hjje.toString() ?? ""}",
  163. leftColor: 0xff333333,
  164. rightColor: 0xff333333,
  165. ),
  166. Heng(
  167. left: "申请时间",
  168. right:
  169. "${detailObj.createTime != null ? DateUtils.instance.getFormartData(timeSamp: detailObj.createTime, format: "yyyy-MM-dd HH:mm") : ''}",
  170. leftColor: 0xff333333,
  171. rightColor: 0xff333333,
  172. ),
  173. detailObj.checkFlag == 0
  174. ? Heng(
  175. left: "驳回原因",
  176. right: "${detailObj.reason ?? ""}",
  177. leftColor: 0xff333333,
  178. rightColor: 0xff333333,
  179. )
  180. : Container(child: null),
  181. Container(
  182. color: Color(0xffFAF7FA),
  183. height: ScreenUtil().setWidth(5),
  184. ),
  185. Kan(
  186. title: '查看订单(${detailObj.invoiceItem.length})',
  187. time: "",
  188. fun: () {
  189. NavigatorUtils.push(context,
  190. "${WodeRouter.piaoOrder}?id=${detailObj.id}");
  191. }),
  192. Container(
  193. color: Color(0xffFAF7FA),
  194. height: ScreenUtil().setWidth(5),
  195. ),
  196. // Kan(title:'含两个订单',time:"2020-02-26 11:06-2020-02-26 11:06",fun:(){
  197. // NavigatorUtils.push(context, WodeRouter.piaoOrder);
  198. // })
  199. ]),
  200. ])
  201. : Center(
  202. child: Text("正在加载..."),
  203. ));
  204. }
  205. @override
  206. bool get wantKeepAlive => true;
  207. }
  208. class Heng extends StatelessWidget {
  209. Heng({Key key, this.left, this.right, this.leftColor, this.rightColor})
  210. : super(key: key);
  211. String left;
  212. String right;
  213. int leftColor;
  214. int rightColor;
  215. @override
  216. Widget build(BuildContext context) {
  217. double width = MediaQuery.of(context).size.width;
  218. return Container(
  219. padding: EdgeInsets.only(
  220. left: ScreenUtil().setWidth(15),
  221. right: ScreenUtil().setWidth(15),
  222. top: ScreenUtil().setWidth(10),
  223. bottom: ScreenUtil().setWidth(10)),
  224. decoration: BoxDecoration(
  225. border: Border(
  226. bottom: BorderSide(width: .5, color: Color(0xfff5f5f5)),
  227. ),
  228. ),
  229. child: Row(
  230. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  231. children: <Widget>[
  232. Text(
  233. left,
  234. style: TextStyle(
  235. color: Color(leftColor), fontSize: ScreenUtil().setSp(14)),
  236. textAlign: TextAlign.start,
  237. ),
  238. Container(
  239. width: width * 0.7,
  240. child: Text(
  241. right,
  242. style: TextStyle(
  243. color: Color(rightColor), fontSize: ScreenUtil().setSp(14)),
  244. textAlign: TextAlign.end,
  245. overflow: TextOverflow.ellipsis,
  246. ),
  247. )
  248. ]),
  249. );
  250. }
  251. }
  252. class Kan extends StatelessWidget {
  253. Kan(
  254. {Key key,
  255. this.title,
  256. this.titleType,
  257. this.statusType,
  258. this.time,
  259. this.fun})
  260. : super(key: key);
  261. String title;
  262. String titleType;
  263. String statusType;
  264. String time;
  265. Function fun;
  266. @override
  267. Widget build(BuildContext context) {
  268. return GestureDetector(
  269. behavior: HitTestBehavior.opaque,
  270. onTap: () {
  271. fun();
  272. },
  273. child: Container(
  274. padding: EdgeInsets.only(
  275. left: ScreenUtil().setWidth(15),
  276. right: ScreenUtil().setWidth(5),
  277. top: ScreenUtil().setWidth(10),
  278. bottom: ScreenUtil().setWidth(10)),
  279. child: Row(
  280. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  281. children: <Widget>[
  282. Column(
  283. crossAxisAlignment: CrossAxisAlignment.start,
  284. children: <Widget>[
  285. title != null
  286. ? Text(
  287. title,
  288. textAlign: TextAlign.left,
  289. style: TextStyle(
  290. fontSize: ScreenUtil().setSp(14),
  291. color: Color(0xff666666),
  292. ),
  293. )
  294. : Container(),
  295. title == null
  296. ? Row(
  297. children: [
  298. Text(
  299. '$titleType: ',
  300. textAlign: TextAlign.left,
  301. style: TextStyle(
  302. fontSize: ScreenUtil().setSp(14),
  303. color: Color(0xff666666),
  304. ),
  305. ),
  306. Text(
  307. statusType,
  308. textAlign: TextAlign.left,
  309. style: TextStyle(
  310. fontSize: ScreenUtil().setSp(14),
  311. color: Colours.blue_app_main,
  312. ),
  313. ),
  314. //
  315. ],
  316. )
  317. : Container(),
  318. title == null ? SizedBox(height: 5) : Container(),
  319. title == null
  320. ? Row(
  321. children: [
  322. Text(
  323. '申请日期: ',
  324. textAlign: TextAlign.left,
  325. style: TextStyle(
  326. fontSize: ScreenUtil().setSp(14),
  327. color: Color(0xff666666),
  328. ),
  329. ),
  330. Text(
  331. time,
  332. textAlign: TextAlign.left,
  333. style: TextStyle(
  334. fontSize: ScreenUtil().setSp(14),
  335. color: Color(0xff999999),
  336. ),
  337. ),
  338. //
  339. ],
  340. )
  341. : Container(),
  342. ]),
  343. // Row(children: <Widget>[
  344. // Text(
  345. // '查看',
  346. // textAlign: TextAlign.left,
  347. // style: TextStyle(
  348. // fontSize: ScreenUtil().setSp(12),
  349. // color:
  350. // title != null ? Color(0xff999999) : Color(0xffFDAF2C),
  351. // ),
  352. // ),
  353. // Icon(
  354. // Icons.keyboard_arrow_right,
  355. // color: Color(0xffcccccc),
  356. // ),
  357. // ])
  358. ]),
  359. ));
  360. }
  361. }