kaipiao.dart 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749
  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. void dispose() {
  163. // provider.dispose();
  164. super.dispose();
  165. }
  166. @override
  167. Widget build(BuildContext context) {
  168. double width = MediaQuery.of(context).size.width;
  169. return
  170. // Center(child:new Text("个人中心"));
  171. ChangeNotifierProvider<UserProvider>(
  172. create: (_) => provider,
  173. child: Scaffold(
  174. resizeToAvoidBottomPadding: false,
  175. appBar: MyAppBar(
  176. centerTitle: "开具发票",
  177. ),
  178. body: GestureDetector(
  179. onTap: () {
  180. // 点击空白页面关闭键盘
  181. FocusScope.of(context).requestFocus(blankNode);
  182. },
  183. child: Consumer<UserProvider>(
  184. builder: (_, provider, __) {
  185. return Stack(
  186. children: <Widget>[
  187. ListView(
  188. padding: EdgeInsets.all(0.0),
  189. children: <Widget>[
  190. Form(
  191. key: _formKey,
  192. child: Column(
  193. children: <Widget>[
  194. Container(
  195. width: width,
  196. padding: EdgeInsets.only(
  197. left: ScreenUtil().setWidth(15),
  198. right: ScreenUtil().setWidth(15),
  199. top: ScreenUtil().setWidth(10),
  200. bottom: ScreenUtil().setWidth(10)),
  201. color: Color(0xfff5f5f5),
  202. child: Text(
  203. '发票种类',
  204. textAlign: TextAlign.left,
  205. style: TextStyle(
  206. // fontSize:ScreenUtil().setSp(14),
  207. color: Color(0xff333333),
  208. ),
  209. ),
  210. ),
  211. Container(
  212. padding: EdgeInsets.only(
  213. left: ScreenUtil().setWidth(15),
  214. right: ScreenUtil().setWidth(5),
  215. top: ScreenUtil().setWidth(10),
  216. bottom: ScreenUtil().setWidth(10)),
  217. child: Row(
  218. mainAxisAlignment:
  219. MainAxisAlignment.spaceBetween,
  220. children: <Widget>[
  221. Column(
  222. crossAxisAlignment:
  223. CrossAxisAlignment.start,
  224. children: <Widget>[
  225. Row(
  226. children: <Widget>[
  227. GestureDetector(
  228. onTap: () {
  229. setState(() {
  230. desc = "普通发票为电子发票,可支持报销入账";
  231. piaoType = 1;
  232. piaotouId = null;
  233. // touObj = {
  234. // "piaotouStr": "请选择发票抬头",
  235. // "enterpriseNumber": "--",
  236. // "gmfDz": "--",
  237. // "gmfDh": "--",
  238. // "gmfYh": "--",
  239. // "gmfZh": "--",
  240. // };
  241. getList(2);
  242. });
  243. },
  244. child: Container(
  245. padding: EdgeInsets.only(
  246. left: ScreenUtil()
  247. .setWidth(10),
  248. right: ScreenUtil()
  249. .setWidth(10),
  250. top: 3,
  251. bottom: 3),
  252. decoration: BoxDecoration(
  253. border: Border.all(
  254. width: 1,
  255. color: piaoType == 1
  256. ? Color(0xff1B87F6)
  257. : Color(
  258. 0xffdddddd)),
  259. borderRadius:
  260. BorderRadius.circular(
  261. 5)),
  262. child: Text(
  263. "电子发票",
  264. textAlign: TextAlign.center,
  265. style: TextStyle(
  266. fontSize:
  267. ScreenUtil().setSp(14),
  268. color: piaoType == 1
  269. ? Color(0xff1B87F6)
  270. : Color(0xff666666),
  271. ),
  272. ),
  273. )),
  274. SizedBox(
  275. width: 10,
  276. ),
  277. GestureDetector(
  278. onTap: () {
  279. setState(() {
  280. desc =
  281. "增值税发票为纸质发票,邮寄信息详见收票人信息";
  282. piaoType = 2;
  283. indexNow = 2;
  284. piaotouId = null;
  285. // touObj = {
  286. // "piaotouStr": "请选择发票抬头",
  287. // "enterpriseNumber": "--",
  288. // "gmfDz": "--",
  289. // "gmfDh": "--",
  290. // "gmfYh": "--",
  291. // "gmfZh": "--",
  292. // };
  293. getList(2);
  294. });
  295. },
  296. child: Container(
  297. padding: EdgeInsets.only(
  298. left: ScreenUtil()
  299. .setWidth(10),
  300. right: ScreenUtil()
  301. .setWidth(10),
  302. top: 3,
  303. bottom: 3),
  304. decoration: BoxDecoration(
  305. border: Border.all(
  306. width: 1,
  307. color: piaoType == 2
  308. ? Color(0xff1B87F6)
  309. : Color(
  310. 0xffdddddd)),
  311. borderRadius:
  312. BorderRadius.circular(
  313. 5)),
  314. child: Text(
  315. "专用发票",
  316. textAlign: TextAlign.center,
  317. style: TextStyle(
  318. fontSize:
  319. ScreenUtil().setSp(14),
  320. color: piaoType == 2
  321. ? Color(0xff1B87F6)
  322. : Color(0xff666666),
  323. ),
  324. ),
  325. )),
  326. ],
  327. ),
  328. SizedBox(height: 5),
  329. Text(
  330. "($desc)",
  331. textAlign: TextAlign.left,
  332. style: TextStyle(
  333. fontSize: ScreenUtil().setSp(12),
  334. color: Color(0xff999999),
  335. ),
  336. ),
  337. ],
  338. ),
  339. ],
  340. ),
  341. ),
  342. Container(
  343. width: width,
  344. padding: EdgeInsets.only(
  345. left: ScreenUtil().setWidth(15),
  346. right: ScreenUtil().setWidth(15),
  347. top: ScreenUtil().setWidth(10),
  348. bottom: ScreenUtil().setWidth(10)),
  349. color: Color(0xfff5f5f5),
  350. child: Text(
  351. '发票详情',
  352. textAlign: TextAlign.left,
  353. style: TextStyle(
  354. // fontSize:ScreenUtil().setSp(14),
  355. color: Color(0xff333333),
  356. ),
  357. ),
  358. ),
  359. piaoType != 2
  360. ? Container(
  361. decoration: BoxDecoration(
  362. border: Border(
  363. bottom: BorderSide(
  364. width: 1, color: Color(0xfff5f5f5)),
  365. ),
  366. ),
  367. padding: EdgeInsets.only(
  368. left: ScreenUtil().setWidth(15),
  369. right: ScreenUtil().setWidth(15)),
  370. height: 50,
  371. child: Row(
  372. mainAxisAlignment:
  373. MainAxisAlignment.spaceBetween,
  374. children: <Widget>[
  375. Text(
  376. "发票类型",
  377. style: TextStyle(
  378. // color:Color(0xff999999),
  379. // fontSize:ScreenUtil().setSp(14)
  380. ),
  381. textAlign: TextAlign.start,
  382. ),
  383. Row(
  384. children: <Widget>[
  385. GestureDetector(
  386. child: Container(
  387. // padding: EdgeInsets.only(top:10,left:5,right:5,bottom:10),
  388. child: Row(
  389. children: <Widget>[
  390. LoadAssetImage(
  391. // image: AssetImage(i['img']),
  392. indexNow == 2
  393. ? checkTrue
  394. : checkFalse,
  395. width: ScreenUtil()
  396. .setWidth(16),
  397. height: ScreenUtil()
  398. .setWidth(16),
  399. // alignment: Alignment.centerLeft,
  400. ),
  401. Container(
  402. width: 5, child: null),
  403. Text(
  404. "企业单位",
  405. style: TextStyle(
  406. // color:Color(0xff000000),
  407. // fontSize:ScreenUtil().setSp(14)
  408. ),
  409. textAlign:
  410. TextAlign.start,
  411. ),
  412. ],
  413. ),
  414. ),
  415. onTap: () {
  416. setState(() {
  417. indexNow = 2;
  418. piaotouId = null;
  419. // touObj = {
  420. // "piaotouStr": "请选择发票抬头",
  421. // "enterpriseNumber": "--",
  422. // "gmfDz": "--",
  423. // "gmfDh": "--",
  424. // "gmfYh": "--",
  425. // "gmfZh": "--",
  426. // };
  427. getList(2);
  428. });
  429. print(indexNow);
  430. },
  431. ),
  432. Container(width: 15, child: null),
  433. GestureDetector(
  434. child: Container(
  435. // padding: EdgeInsets.only(top:10,left:5,right:5,bottom:10),
  436. child: Row(
  437. children: <Widget>[
  438. LoadAssetImage(
  439. // image: AssetImage(i['img']),
  440. indexNow == 1
  441. ? checkTrue
  442. : checkFalse,
  443. width: ScreenUtil()
  444. .setWidth(16),
  445. height: ScreenUtil()
  446. .setWidth(16),
  447. // alignment: Alignment.centerLeft,
  448. ),
  449. Container(
  450. width: 5, child: null),
  451. Text(
  452. "个人",
  453. style: TextStyle(
  454. // color:Colors.black,
  455. // fontSize:ScreenUtil().setSp(14)
  456. ),
  457. textAlign:
  458. TextAlign.start,
  459. ),
  460. ],
  461. ),
  462. ),
  463. onTap: () {
  464. setState(() {
  465. indexNow = 1;
  466. piaotouId = null;
  467. // touObj = {
  468. // "piaotouStr": "请选择发票抬头",
  469. // "enterpriseNumber": "--",
  470. // "gmfDz": "--",
  471. // "gmfDh": "--",
  472. // "gmfYh": "--",
  473. // "gmfZh": "--",
  474. // };
  475. getList(1);
  476. });
  477. print(indexNow);
  478. },
  479. ),
  480. ],
  481. ),
  482. ],
  483. ),
  484. )
  485. : Container(child: null),
  486. // TextFieldItem(
  487. // title: "发票抬头",
  488. // content: "",
  489. // controller: _nameController,
  490. // hintText: "请选择发票抬头",
  491. // onChanged: (res) {
  492. // // setState(() {});
  493. // },
  494. // ),
  495. ClickItem(
  496. title: "发票抬头",
  497. content: touObj["piaotouStr"],
  498. isMust: true,
  499. onTap: () {
  500. String type;
  501. if (indexNow == 1) {
  502. type = "1";
  503. } else {
  504. type = "2";
  505. }
  506. NavigatorUtils.push(context,
  507. "${WodeRouter.piaotou}?checkTou=checkTou&type=$type");
  508. },
  509. ),
  510. indexNow == 2
  511. ? ClickItem(
  512. title: "企业税号",
  513. content: touObj["enterpriseNumber"],
  514. )
  515. : Container(child: null),
  516. indexNow == 2
  517. ? ClickItem(
  518. title: "注册地址",
  519. content: touObj["gmfDz"],
  520. )
  521. : Container(child: null),
  522. indexNow == 2
  523. ? ClickItem(
  524. title: "注册电话",
  525. content: touObj["gmfDh"],
  526. )
  527. : Container(child: null),
  528. indexNow == 2
  529. ? ClickItem(
  530. title: "开户银行",
  531. content: touObj["gmfYh"],
  532. )
  533. : Container(child: null),
  534. indexNow == 2
  535. ? ClickItem(
  536. title: "银行账户",
  537. content: touObj["gmfZh"],
  538. )
  539. : Container(child: null),
  540. Heng(
  541. left: "发票内容",
  542. right: "咨询服务费",
  543. leftColor: 0xff666666,
  544. rightColor: 0xff000000,
  545. ),
  546. Heng(
  547. left: "发票金额",
  548. right: "${double.parse(widget.price).toStringAsFixed(2).toString()}元",
  549. leftColor: 0xff999999,
  550. rightColor: 0xff333333,
  551. ),
  552. piaoType != 2
  553. ? Column(
  554. children: <Widget>[
  555. Container(
  556. width: width,
  557. padding: EdgeInsets.only(
  558. left: ScreenUtil().setWidth(15),
  559. right: ScreenUtil().setWidth(15),
  560. top: ScreenUtil().setWidth(10),
  561. bottom: ScreenUtil().setWidth(10)),
  562. color: Color(0xfff5f5f5),
  563. child: Text(
  564. '接收方式',
  565. textAlign: TextAlign.left,
  566. style: TextStyle(
  567. // fontSize:ScreenUtil().setSp(14),
  568. color: Color(0xff333333),
  569. ),
  570. ),
  571. ),
  572. TextFieldItem(
  573. title: "电子邮箱",
  574. content: "",
  575. isMust: true,
  576. controller: _emailController,
  577. hintText: "请输入电子邮箱",
  578. onChanged: (res) {
  579. // setState(() {});
  580. },
  581. ),
  582. ],
  583. )
  584. : Container(child: null),
  585. piaoType == 2
  586. ? Column(
  587. children: <Widget>[
  588. Container(
  589. width: width,
  590. padding: EdgeInsets.only(
  591. left: ScreenUtil().setWidth(15),
  592. right: ScreenUtil().setWidth(15),
  593. top: ScreenUtil().setWidth(10),
  594. bottom: ScreenUtil().setWidth(10)),
  595. color: Color(0xfff5f5f5),
  596. child: Text(
  597. '收票人信息',
  598. textAlign: TextAlign.left,
  599. style: TextStyle(
  600. // fontSize:ScreenUtil().setSp(14),
  601. color: Color(0xff333333),
  602. ),
  603. ),
  604. ),
  605. TextFieldItem(
  606. title: "收票人",
  607. isMust: true,
  608. content: "",
  609. controller: _receiveTicketController,
  610. hintText: "请输入收票人姓名",
  611. onChanged: (res) {},
  612. ),
  613. TextFieldItem(
  614. title: "收票人电话",
  615. isMust: true,
  616. content: "",
  617. controller: _receiveMebileController,
  618. hintText: "请输入收票人电话",
  619. keyboardType: TextInputType.phone,
  620. onChanged: (res) {},
  621. ),
  622. TextFieldItem(
  623. title: "收票人地址",
  624. isMust: true,
  625. content: "",
  626. controller: _receiveAddressController,
  627. hintText: "请输入收票人地址",
  628. onChanged: (res) {},
  629. ),
  630. ],
  631. )
  632. : Container(child: null),
  633. SizedBox(height: ScreenUtil().setWidth(80))
  634. ],
  635. ),
  636. ),
  637. ],
  638. ),
  639. Positioned(
  640. bottom: 0,
  641. left: 0,
  642. child: Container(
  643. width: width,
  644. padding: EdgeInsets.only(
  645. top: ScreenUtil().setWidth(15),
  646. bottom: ScreenUtil().setWidth(15),
  647. left: ScreenUtil().setWidth(25),
  648. right: ScreenUtil().setWidth(25)),
  649. color: ThemeUtils.getDialogTextFieldColor(context),
  650. child: Container(
  651. height: ScreenUtil().setWidth(44),
  652. decoration: BoxDecoration(
  653. borderRadius:
  654. BorderRadius.circular(ScreenUtil().setWidth(22)),
  655. gradient: const LinearGradient(
  656. colors: [Color(0xFF00D9FF), Color(0xFF0287FF)]),
  657. ),
  658. child: FlatButton(
  659. // padding: EdgeInsets.all(15.0),
  660. child: Text("提交"),
  661. textColor: Colors.white,
  662. // textColor: Colors.white,
  663. onPressed: () {
  664. if(!isTi){
  665. toasts("提交中。。。");
  666. return;
  667. }
  668. isTi = false;
  669. // Navigator.pop(context);
  670. print(_emailController.text);
  671. print(555);
  672. RegExp exp = RegExp(r'^1[34578]\d{9}$');
  673. RegExp expEmail = RegExp(r"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$");
  674. if (piaotouId == null) {
  675. toasts("请选择发票抬头");
  676. return;
  677. }
  678. if (piaoType == 1 &&
  679. (_emailController.text == null ||
  680. _emailController.text.trim() == '')) {
  681. toasts("请输入电子邮箱");
  682. return;
  683. }
  684. if (piaoType == 2 &&
  685. (_receiveTicketController.text == null ||
  686. _receiveTicketController.text.trim() ==
  687. '')) {
  688. toasts("请输入收票人");
  689. return;
  690. }
  691. if (piaoType == 2 &&
  692. (_receiveMebileController.text == null ||
  693. _receiveMebileController.text.trim() ==
  694. '')) {
  695. toasts("请输入收票人电话");
  696. return;
  697. }
  698. if (piaoType == 2 &&
  699. (_receiveAddressController.text == null ||
  700. _receiveAddressController.text.trim() ==
  701. '')) {
  702. toasts("请输入收票人地址");
  703. return;
  704. }
  705. if(piaoType == 2 && !exp.hasMatch(_receiveMebileController.text)){
  706. toasts("请输入正确的收票人电话");
  707. return;
  708. }
  709. if(piaoType == 1 && !expEmail.hasMatch(_emailController.text)){
  710. toasts("请输入正确的邮箱");
  711. return;
  712. }
  713. applyInvoice();
  714. },
  715. ),
  716. ),
  717. ),
  718. )
  719. ],
  720. );
  721. },
  722. ),
  723. ),
  724. ),
  725. );
  726. }
  727. @override
  728. bool get wantKeepAlive => true;
  729. }