kaipiao.dart 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:liftmanager/common/common.dart';
  4. import 'package:liftmanager/internal/account/account_router.dart';
  5. import 'package:liftmanager/internal/account/model/user_info_entity.dart';
  6. import 'package:liftmanager/internal/account/provider/user_provider.dart';
  7. import 'package:liftmanager/internal/wode/wode_router.dart';
  8. import 'package:liftmanager/net/api_service.dart';
  9. import 'package:liftmanager/routers/fluro_navigator.dart';
  10. import 'package:liftmanager/utils/image_utils.dart';
  11. import 'package:liftmanager/widgets/app_bar.dart';
  12. import 'package:liftmanager/widgets/click_item.dart';
  13. import 'package:liftmanager/widgets/load_image.dart';
  14. import 'package:liftmanager/widgets/my_button.dart';
  15. import 'package:provider/provider.dart';
  16. import 'package:liftmanager/widgets/bbs_content.dart';
  17. import 'package:liftmanager/internal/bbs/bbs_router.dart';
  18. import 'package:flutter_screenutil/flutter_screenutil.dart';
  19. import 'package:liftmanager/res/resources.dart';
  20. import 'package:liftmanager/widgets/text_field_item.dart';
  21. import 'package:liftmanager/utils/toast.dart';
  22. import 'package:liftmanager/utils/fast_notification.dart';
  23. import 'package:flustars/flustars.dart' as FlutterStars;
  24. import 'dart:math';
  25. import 'dart:convert';
  26. import 'package:liftmanager/utils/theme_utils.dart';
  27. class Kaipiao extends StatefulWidget {
  28. Kaipiao(this.ids, this.price);
  29. final String ids;
  30. final String price;
  31. @override
  32. State<StatefulWidget> createState() {
  33. return KaipiaoState();
  34. }
  35. }
  36. class KaipiaoState extends State<Kaipiao> with AutomaticKeepAliveClientMixin {
  37. UserProvider provider = UserProvider();
  38. FocusNode blankNode = FocusNode();
  39. /**
  40. * 发票类型
  41. */
  42. bool isTi = true;
  43. int indexNow = 2;
  44. int piaoType = 1;
  45. String checkFalse = "tab_first/check_false";
  46. String checkTrue = "tab_first/check_true";
  47. String desc = "普通发票为电子发票,可支持报销入账";
  48. int piaotouId;
  49. dynamic touObj = {
  50. "piaotouStr": "请选择发票抬头",
  51. "enterpriseNumber": "--",
  52. "gmfDz": "--",
  53. "gmfDh": "--",
  54. "gmfYh": "--",
  55. "gmfZh": "--",
  56. };
  57. var piaoObj = {
  58. "receiveTicket": "请输入",
  59. "receiveMebile": "请输入",
  60. "receiveAddress": "请输入",
  61. "gmfZh": "请输入",
  62. };
  63. GlobalKey _formKey = new GlobalKey<FormState>();
  64. TextEditingController _receiveTicketController = new TextEditingController();
  65. TextEditingController _receiveMebileController = new TextEditingController();
  66. TextEditingController _receiveAddressController = new TextEditingController();
  67. TextEditingController _emailController = new TextEditingController();
  68. String touChiose = "";
  69. List<String> touListChiose = ['tou1', 'tou2'];
  70. @override
  71. void initState() {
  72. // TODO: implement initState
  73. super.initState();
  74. getList(2);
  75. FastNotification.addListener("piaoTou", (piaoTouObj) {
  76. print(piaoTouObj);
  77. print(333);
  78. setState(() {
  79. touObj["piaotouStr"] = piaoTouObj.name;
  80. touObj["enterpriseNumber"] = piaoTouObj.enterpriseNumber;
  81. touObj["gmfDz"] = piaoTouObj.gmfDz;
  82. touObj["gmfDh"] = piaoTouObj.gmfDh;
  83. touObj["gmfYh"] = piaoTouObj.gmfYh;
  84. touObj["gmfZh"] = piaoTouObj.gmfZh;
  85. piaotouId = piaoTouObj.id;
  86. });
  87. });
  88. }
  89. Future getList(type) async {
  90. await NewApiService().getPiaoTouListPage(1, 10, null,1, onSuccess: (res) {
  91. print(JsonEncoder().convert(res.records));
  92. if(res.records.length>0 && res.records[0].type == type){
  93. touObj["piaotouStr"] = res.records[0].name;
  94. touObj["enterpriseNumber"] = res.records[0].enterpriseNumber;
  95. touObj["gmfDz"] = res.records[0].gmfDz;
  96. touObj["gmfDh"] = res.records[0].gmfDh;
  97. touObj["gmfYh"] = res.records[0].gmfYh;
  98. touObj["gmfZh"] = res.records[0].gmfZh;
  99. piaotouId = res.records[0].id;
  100. }else {
  101. touObj = {
  102. "piaotouStr": "请选择发票抬头",
  103. "enterpriseNumber": "--",
  104. "gmfDz": "--",
  105. "gmfDh": "--",
  106. "gmfYh": "--",
  107. "gmfZh": "--",
  108. };
  109. }
  110. print(12345689);
  111. setState(() {});
  112. }, onError: (code, msg) {
  113. toasts(msg);
  114. });
  115. }
  116. randomInt(int min, int max) {
  117. return new Random().nextInt(max) % (max - min + 1) + min;
  118. }
  119. void applyInvoice() {
  120. if ((_formKey.currentState as FormState).validate()) {
  121. List<String> ids = widget.ids.split(',');
  122. List<dynamic> invoiceItem = [];
  123. for (var i = 0; i < ids.length; i++) {
  124. if (ids[i] != null && ids[i] != "") {
  125. invoiceItem.add({"id": int.parse(ids[i])});
  126. }
  127. }
  128. dynamic invoiceInfo = {
  129. "type": indexNow == 1 ? 1 : 2,
  130. "invoiceType": piaoType == 1 ? 1 : 2,
  131. "gmfMc": "咨询服务费",
  132. // "gmfNsrsbm": _taxidController.text,
  133. // "gmfYh": _bankController.text,
  134. // "gmfZh": _bankAccountController.text,
  135. // "gmfDz": _addressController.text,
  136. // "gmfDh": _telController.text,
  137. "email": _emailController.text,
  138. "hjje": double.parse(widget.price),
  139. "invoiceItem": invoiceItem,
  140. "userId": int.parse(FlutterStars.SpUtil.getString(Constant.userId)),
  141. "userInvoiceId": piaotouId,
  142. "receiveTicket": _receiveTicketController.text,
  143. "receiveMebile": _receiveMebileController.text,
  144. "receiveAddress": _receiveAddressController.text,
  145. };
  146. NewApiService().applyInvoice(invoiceInfo, onSuccess: (res) {
  147. toasts("发票申请成功");
  148. isTi = true;
  149. // NavigatorUtils.goBackWithParams(context, true);
  150. String initThisStringPiao = randomInt(1111, 9999).toString() +
  151. DateTime.now().millisecondsSinceEpoch.toString();
  152. FastNotification.push("initThisPiao", initThisStringPiao);
  153. Navigator.pop(context);
  154. setState(() {});
  155. }, onError: (code, msg) {
  156. isTi = true;
  157. toasts(msg);
  158. });
  159. }
  160. }
  161. @override
  162. Widget build(BuildContext context) {
  163. double width = MediaQuery.of(context).size.width;
  164. return
  165. // Center(child:new Text("个人中心"));
  166. ChangeNotifierProvider<UserProvider>(
  167. create: (_) => provider,
  168. child: Scaffold(
  169. resizeToAvoidBottomPadding: false,
  170. appBar: MyAppBar(
  171. centerTitle: "开具发票",
  172. ),
  173. body: GestureDetector(
  174. onTap: () {
  175. // 点击空白页面关闭键盘
  176. FocusScope.of(context).requestFocus(blankNode);
  177. },
  178. child: Consumer<UserProvider>(
  179. builder: (_, provider, __) {
  180. return Stack(
  181. children: <Widget>[
  182. ListView(
  183. padding: EdgeInsets.all(0.0),
  184. children: <Widget>[
  185. Form(
  186. key: _formKey,
  187. child: Column(
  188. children: <Widget>[
  189. Container(
  190. width: width,
  191. padding: EdgeInsets.only(
  192. left: ScreenUtil().setWidth(15),
  193. right: ScreenUtil().setWidth(15),
  194. top: ScreenUtil().setWidth(10),
  195. bottom: ScreenUtil().setWidth(10)),
  196. color: Color(0xfff5f5f5),
  197. child: Text(
  198. '发票种类',
  199. textAlign: TextAlign.left,
  200. style: TextStyle(
  201. // fontSize:ScreenUtil().setSp(14),
  202. color: Color(0xff333333),
  203. ),
  204. ),
  205. ),
  206. Container(
  207. padding: EdgeInsets.only(
  208. left: ScreenUtil().setWidth(15),
  209. right: ScreenUtil().setWidth(5),
  210. top: ScreenUtil().setWidth(10),
  211. bottom: ScreenUtil().setWidth(10)),
  212. child: Row(
  213. mainAxisAlignment:
  214. MainAxisAlignment.spaceBetween,
  215. children: <Widget>[
  216. Column(
  217. crossAxisAlignment:
  218. CrossAxisAlignment.start,
  219. children: <Widget>[
  220. Row(
  221. children: <Widget>[
  222. GestureDetector(
  223. onTap: () {
  224. setState(() {
  225. desc = "普通发票为电子发票,可支持报销入账";
  226. piaoType = 1;
  227. piaotouId = null;
  228. // touObj = {
  229. // "piaotouStr": "请选择发票抬头",
  230. // "enterpriseNumber": "--",
  231. // "gmfDz": "--",
  232. // "gmfDh": "--",
  233. // "gmfYh": "--",
  234. // "gmfZh": "--",
  235. // };
  236. getList(2);
  237. });
  238. },
  239. child: Container(
  240. padding: EdgeInsets.only(
  241. left: ScreenUtil()
  242. .setWidth(10),
  243. right: ScreenUtil()
  244. .setWidth(10),
  245. top: 3,
  246. bottom: 3),
  247. decoration: BoxDecoration(
  248. border: Border.all(
  249. width: 1,
  250. color: piaoType == 1
  251. ? Color(0xff1B87F6)
  252. : Color(
  253. 0xffdddddd)),
  254. borderRadius:
  255. BorderRadius.circular(
  256. 5)),
  257. child: Text(
  258. "电子发票",
  259. textAlign: TextAlign.center,
  260. style: TextStyle(
  261. fontSize:
  262. ScreenUtil().setSp(14),
  263. color: piaoType == 1
  264. ? Color(0xff1B87F6)
  265. : Color(0xff666666),
  266. ),
  267. ),
  268. )),
  269. SizedBox(
  270. width: 10,
  271. ),
  272. GestureDetector(
  273. onTap: () {
  274. setState(() {
  275. desc =
  276. "增值税发票为纸质发票,邮寄信息详见收票人信息";
  277. piaoType = 2;
  278. indexNow = 2;
  279. piaotouId = null;
  280. // touObj = {
  281. // "piaotouStr": "请选择发票抬头",
  282. // "enterpriseNumber": "--",
  283. // "gmfDz": "--",
  284. // "gmfDh": "--",
  285. // "gmfYh": "--",
  286. // "gmfZh": "--",
  287. // };
  288. getList(2);
  289. });
  290. },
  291. child: Container(
  292. padding: EdgeInsets.only(
  293. left: ScreenUtil()
  294. .setWidth(10),
  295. right: ScreenUtil()
  296. .setWidth(10),
  297. top: 3,
  298. bottom: 3),
  299. decoration: BoxDecoration(
  300. border: Border.all(
  301. width: 1,
  302. color: piaoType == 2
  303. ? Color(0xff1B87F6)
  304. : Color(
  305. 0xffdddddd)),
  306. borderRadius:
  307. BorderRadius.circular(
  308. 5)),
  309. child: Text(
  310. "专用发票",
  311. textAlign: TextAlign.center,
  312. style: TextStyle(
  313. fontSize:
  314. ScreenUtil().setSp(14),
  315. color: piaoType == 2
  316. ? Color(0xff1B87F6)
  317. : Color(0xff666666),
  318. ),
  319. ),
  320. )),
  321. ],
  322. ),
  323. SizedBox(height: 5),
  324. Text(
  325. "($desc)",
  326. textAlign: TextAlign.left,
  327. style: TextStyle(
  328. fontSize: ScreenUtil().setSp(12),
  329. color: Color(0xff999999),
  330. ),
  331. ),
  332. ],
  333. ),
  334. ],
  335. ),
  336. ),
  337. Container(
  338. width: width,
  339. padding: EdgeInsets.only(
  340. left: ScreenUtil().setWidth(15),
  341. right: ScreenUtil().setWidth(15),
  342. top: ScreenUtil().setWidth(10),
  343. bottom: ScreenUtil().setWidth(10)),
  344. color: Color(0xfff5f5f5),
  345. child: Text(
  346. '发票详情',
  347. textAlign: TextAlign.left,
  348. style: TextStyle(
  349. // fontSize:ScreenUtil().setSp(14),
  350. color: Color(0xff333333),
  351. ),
  352. ),
  353. ),
  354. piaoType != 2
  355. ? Container(
  356. decoration: BoxDecoration(
  357. border: Border(
  358. bottom: BorderSide(
  359. width: 1, color: Color(0xfff5f5f5)),
  360. ),
  361. ),
  362. padding: EdgeInsets.only(
  363. left: ScreenUtil().setWidth(15),
  364. right: ScreenUtil().setWidth(15)),
  365. height: 50,
  366. child: Row(
  367. mainAxisAlignment:
  368. MainAxisAlignment.spaceBetween,
  369. children: <Widget>[
  370. Text(
  371. "发票类型",
  372. style: TextStyle(
  373. // color:Color(0xff999999),
  374. // fontSize:ScreenUtil().setSp(14)
  375. ),
  376. textAlign: TextAlign.start,
  377. ),
  378. Row(
  379. children: <Widget>[
  380. GestureDetector(
  381. child: Container(
  382. // padding: EdgeInsets.only(top:10,left:5,right:5,bottom:10),
  383. child: Row(
  384. children: <Widget>[
  385. LoadAssetImage(
  386. // image: AssetImage(i['img']),
  387. indexNow == 2
  388. ? checkTrue
  389. : checkFalse,
  390. width: ScreenUtil()
  391. .setWidth(16),
  392. height: ScreenUtil()
  393. .setWidth(16),
  394. // alignment: Alignment.centerLeft,
  395. ),
  396. Container(
  397. width: 5, child: null),
  398. Text(
  399. "企业单位",
  400. style: TextStyle(
  401. // color:Color(0xff000000),
  402. // fontSize:ScreenUtil().setSp(14)
  403. ),
  404. textAlign:
  405. TextAlign.start,
  406. ),
  407. ],
  408. ),
  409. ),
  410. onTap: () {
  411. setState(() {
  412. indexNow = 2;
  413. piaotouId = null;
  414. // touObj = {
  415. // "piaotouStr": "请选择发票抬头",
  416. // "enterpriseNumber": "--",
  417. // "gmfDz": "--",
  418. // "gmfDh": "--",
  419. // "gmfYh": "--",
  420. // "gmfZh": "--",
  421. // };
  422. getList(2);
  423. });
  424. print(indexNow);
  425. },
  426. ),
  427. Container(width: 15, child: null),
  428. GestureDetector(
  429. child: Container(
  430. // padding: EdgeInsets.only(top:10,left:5,right:5,bottom:10),
  431. child: Row(
  432. children: <Widget>[
  433. LoadAssetImage(
  434. // image: AssetImage(i['img']),
  435. indexNow == 1
  436. ? checkTrue
  437. : checkFalse,
  438. width: ScreenUtil()
  439. .setWidth(16),
  440. height: ScreenUtil()
  441. .setWidth(16),
  442. // alignment: Alignment.centerLeft,
  443. ),
  444. Container(
  445. width: 5, child: null),
  446. Text(
  447. "个人",
  448. style: TextStyle(
  449. // color:Colors.black,
  450. // fontSize:ScreenUtil().setSp(14)
  451. ),
  452. textAlign:
  453. TextAlign.start,
  454. ),
  455. ],
  456. ),
  457. ),
  458. onTap: () {
  459. setState(() {
  460. indexNow = 1;
  461. piaotouId = null;
  462. // touObj = {
  463. // "piaotouStr": "请选择发票抬头",
  464. // "enterpriseNumber": "--",
  465. // "gmfDz": "--",
  466. // "gmfDh": "--",
  467. // "gmfYh": "--",
  468. // "gmfZh": "--",
  469. // };
  470. getList(1);
  471. });
  472. print(indexNow);
  473. },
  474. ),
  475. ],
  476. ),
  477. ],
  478. ),
  479. )
  480. : Container(child: null),
  481. // TextFieldItem(
  482. // title: "发票抬头",
  483. // content: "",
  484. // controller: _nameController,
  485. // hintText: "请选择发票抬头",
  486. // onChanged: (res) {
  487. // // setState(() {});
  488. // },
  489. // ),
  490. ClickItem(
  491. title: "发票抬头",
  492. content: touObj["piaotouStr"],
  493. isMust: true,
  494. onTap: () {
  495. String type;
  496. if (indexNow == 1) {
  497. type = "1";
  498. } else {
  499. type = "2";
  500. }
  501. NavigatorUtils.push(context,
  502. "${WodeRouter.piaotou}?checkTou=checkTou&type=$type");
  503. },
  504. ),
  505. indexNow == 2
  506. ? ClickItem(
  507. title: "企业税号",
  508. content: touObj["enterpriseNumber"],
  509. )
  510. : Container(child: null),
  511. indexNow == 2
  512. ? ClickItem(
  513. title: "注册地址",
  514. content: touObj["gmfDz"],
  515. )
  516. : Container(child: null),
  517. indexNow == 2
  518. ? ClickItem(
  519. title: "注册电话",
  520. content: touObj["gmfDh"],
  521. )
  522. : Container(child: null),
  523. indexNow == 2
  524. ? ClickItem(
  525. title: "开户银行",
  526. content: touObj["gmfYh"],
  527. )
  528. : Container(child: null),
  529. indexNow == 2
  530. ? ClickItem(
  531. title: "银行账户",
  532. content: touObj["gmfZh"],
  533. )
  534. : Container(child: null),
  535. Heng(
  536. left: "发票内容",
  537. right: "咨询服务费",
  538. leftColor: 0xff666666,
  539. rightColor: 0xff000000,
  540. ),
  541. Heng(
  542. left: "发票金额",
  543. right: "${double.parse(widget.price).toStringAsFixed(2).toString()}元",
  544. leftColor: 0xff999999,
  545. rightColor: 0xff333333,
  546. ),
  547. piaoType != 2
  548. ? Column(
  549. children: <Widget>[
  550. Container(
  551. width: width,
  552. padding: EdgeInsets.only(
  553. left: ScreenUtil().setWidth(15),
  554. right: ScreenUtil().setWidth(15),
  555. top: ScreenUtil().setWidth(10),
  556. bottom: ScreenUtil().setWidth(10)),
  557. color: Color(0xfff5f5f5),
  558. child: Text(
  559. '接收方式',
  560. textAlign: TextAlign.left,
  561. style: TextStyle(
  562. // fontSize:ScreenUtil().setSp(14),
  563. color: Color(0xff333333),
  564. ),
  565. ),
  566. ),
  567. TextFieldItem(
  568. title: "电子邮箱",
  569. content: "",
  570. isMust: true,
  571. controller: _emailController,
  572. hintText: "请输入电子邮箱",
  573. onChanged: (res) {
  574. // setState(() {});
  575. },
  576. ),
  577. ],
  578. )
  579. : Container(child: null),
  580. piaoType == 2
  581. ? Column(
  582. children: <Widget>[
  583. Container(
  584. width: width,
  585. padding: EdgeInsets.only(
  586. left: ScreenUtil().setWidth(15),
  587. right: ScreenUtil().setWidth(15),
  588. top: ScreenUtil().setWidth(10),
  589. bottom: ScreenUtil().setWidth(10)),
  590. color: Color(0xfff5f5f5),
  591. child: Text(
  592. '收票人信息',
  593. textAlign: TextAlign.left,
  594. style: TextStyle(
  595. // fontSize:ScreenUtil().setSp(14),
  596. color: Color(0xff333333),
  597. ),
  598. ),
  599. ),
  600. TextFieldItem(
  601. title: "收票人",
  602. isMust: true,
  603. content: "",
  604. controller: _receiveTicketController,
  605. hintText: "请输入收票人姓名",
  606. onChanged: (res) {},
  607. ),
  608. TextFieldItem(
  609. title: "收票人电话",
  610. isMust: true,
  611. content: "",
  612. controller: _receiveMebileController,
  613. hintText: "请输入收票人电话",
  614. keyboardType: TextInputType.phone,
  615. onChanged: (res) {},
  616. ),
  617. TextFieldItem(
  618. title: "收票人地址",
  619. isMust: true,
  620. content: "",
  621. controller: _receiveAddressController,
  622. hintText: "请输入收票人地址",
  623. onChanged: (res) {},
  624. ),
  625. ],
  626. )
  627. : Container(child: null),
  628. SizedBox(height: ScreenUtil().setWidth(80))
  629. ],
  630. ),
  631. ),
  632. ],
  633. ),
  634. Positioned(
  635. bottom: 0,
  636. left: 0,
  637. child: Container(
  638. width: width,
  639. padding: EdgeInsets.only(
  640. top: ScreenUtil().setWidth(15),
  641. bottom: ScreenUtil().setWidth(15),
  642. left: ScreenUtil().setWidth(25),
  643. right: ScreenUtil().setWidth(25)),
  644. color: ThemeUtils.getDialogTextFieldColor(context),
  645. child: Container(
  646. height: ScreenUtil().setWidth(44),
  647. decoration: BoxDecoration(
  648. borderRadius:
  649. BorderRadius.circular(ScreenUtil().setWidth(22)),
  650. gradient: const LinearGradient(
  651. colors: [Color(0xFF00D9FF), Color(0xFF0287FF)]),
  652. ),
  653. child: FlatButton(
  654. // padding: EdgeInsets.all(15.0),
  655. child: Text("提交"),
  656. textColor: Colors.white,
  657. // textColor: Colors.white,
  658. onPressed: () {
  659. if(!isTi){
  660. toasts("提交中。。。");
  661. return;
  662. }
  663. isTi = false;
  664. // Navigator.pop(context);
  665. print(_emailController.text);
  666. print(555);
  667. RegExp exp = RegExp(r'^1[34578]\d{9}$');
  668. RegExp expEmail = RegExp(r"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$");
  669. if (piaotouId == null) {
  670. toasts("请选择发票抬头");
  671. return;
  672. }
  673. if (piaoType == 1 &&
  674. (_emailController.text == null ||
  675. _emailController.text.trim() == '')) {
  676. toasts("请输入电子邮箱");
  677. return;
  678. }
  679. if (piaoType == 2 &&
  680. (_receiveTicketController.text == null ||
  681. _receiveTicketController.text.trim() ==
  682. '')) {
  683. toasts("请输入收票人");
  684. return;
  685. }
  686. if (piaoType == 2 &&
  687. (_receiveMebileController.text == null ||
  688. _receiveMebileController.text.trim() ==
  689. '')) {
  690. toasts("请输入收票人电话");
  691. return;
  692. }
  693. if (piaoType == 2 &&
  694. (_receiveAddressController.text == null ||
  695. _receiveAddressController.text.trim() ==
  696. '')) {
  697. toasts("请输入收票人地址");
  698. return;
  699. }
  700. if(piaoType == 2 && !exp.hasMatch(_receiveMebileController.text)){
  701. toasts("请输入正确的收票人电话");
  702. return;
  703. }
  704. if(piaoType == 1 && !expEmail.hasMatch(_emailController.text)){
  705. toasts("请输入正确的邮箱");
  706. return;
  707. }
  708. applyInvoice();
  709. },
  710. ),
  711. ),
  712. ),
  713. )
  714. ],
  715. );
  716. },
  717. ),
  718. ),
  719. ),
  720. );
  721. }
  722. @override
  723. bool get wantKeepAlive => true;
  724. }