send_express_page.dart 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/services.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. import 'package:city_pickers/city_pickers.dart';
  5. import 'package:flutter_picker/flutter_picker.dart';
  6. import 'dart:async';
  7. import 'send_express_page/order_detail_page.dart';
  8. import '../util/util.dart';
  9. import '../util/api.dart';
  10. import '../util/models.dart';
  11. import '../showAlert.dart';
  12. import '../send_Dialog.dart';
  13. import '../util/session.dart';
  14. import '../showLineModal.dart';
  15. import '../util/bluetooth_utils.dart';
  16. class SendExpressPage extends StatefulWidget {
  17. final Widget child;
  18. SendExpressPage({
  19. Key key,
  20. this.child
  21. }): super(key: key);
  22. _SendExpressPageState createState() => _SendExpressPageState();
  23. }
  24. class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeepAliveClientMixin {
  25. ScrollController _scrollController = ScrollController();
  26. //组件自用字段-----------------------------
  27. GlobalKey _sendPhoneKey = GlobalKey();
  28. GlobalKey _getPhoneKey = GlobalKey();
  29. GlobalKey _sendCompanyCodeKey = GlobalKey();
  30. GlobalKey _sendCompanyNameKey = GlobalKey();
  31. GlobalKey _getCompanyNameKey = GlobalKey();
  32. GlobalKey _goodsKey = GlobalKey();
  33. double tipWidth = 0;
  34. double tipHeight = 0;
  35. double tipPosX = 0;
  36. double tipPosY = 0;
  37. bool tipStatus = true;//是否展示公司信息匹配列表,true为不展示
  38. bool goodsTipStatus = true;//是否展示货物匹配列表,true为不展示
  39. bool lineModalStatus = false;
  40. bool submitStatus = true;
  41. bool checkedLine = false;//当收件方有多条线路时,此状态表示是否已经选择过线路了
  42. bool checkedGoodsName1 = false;//有没有选择货物
  43. String stationId;//司机端站点id
  44. List < LikePhoneList > likePhoneList = [];
  45. List <GoodsPriceList> goodsPriceList = [];
  46. var timer;
  47. bool sendPhoneOrGetPhoneTab = true; //区分电话提示层点击时填入发件信息或手机信息的标记
  48. TextEditingController sendCompanyPhoneController = TextEditingController();
  49. TextEditingController sendCompanyCodeController = TextEditingController();
  50. TextEditingController sendCompanyNameController = TextEditingController();
  51. TextEditingController receiptCompanyPhoneController = TextEditingController();
  52. TextEditingController receiptCompanyNameController = TextEditingController();
  53. TextEditingController sendCompanyAddressController = TextEditingController();
  54. TextEditingController receiptCompanyAddressController = TextEditingController();
  55. TextEditingController bankCardController = TextEditingController();
  56. TextEditingController bankNameController = TextEditingController();
  57. TextEditingController openBankNameController = TextEditingController();
  58. TextEditingController openBankPhoneController = TextEditingController();
  59. TextEditingController goodsController = TextEditingController();
  60. TextEditingController goodsQuantityController = TextEditingController();
  61. TextEditingController goodsFreightController = TextEditingController();
  62. TextEditingController goodsAgencyFundController = TextEditingController();
  63. TextEditingController goodsPriceProtectionController = TextEditingController();
  64. TextEditingController goodsWeightController = TextEditingController();
  65. TextEditingController memoController = TextEditingController();
  66. FocusNode bankCardFocusNode = FocusNode();
  67. List < dynamic > goodsCateGoryList = [];
  68. List < dynamic > goodsPackageList = [];
  69. //请求字段-------------------------
  70. String lineId = '-1';//收件公司匹配的线路id
  71. String sendCompanyId = '0'; //寄件公司Id
  72. String sendCompanyName = ''; //寄件公司名称 不能为空
  73. String sendCompanyPhone = ''; //寄件公司电话 不能为空
  74. String sendCompanyCode = ''; //寄件公司编码
  75. String sendCompanyProvinceName = ''; //寄件公司省名称 不能为空
  76. String sendCompanyProvinceCode = ''; //寄件公司省编码 不能为空
  77. String sendCompanyCityName = ''; //寄件公司市名称 不能为空
  78. String sendCompanyCityCode = ''; //寄件公司市编码 不能为空
  79. String sendCompanyAreaName = ''; //寄件公司区名称 不能为空
  80. String sendCompanyAreaCode = ''; //寄件公司区编码 不能为空
  81. String sendCompanyAddress = ''; //寄件公司详细地址,不能为空
  82. String receiptCompanyId = '0'; //收件公司id
  83. String receiptCompanyPhone = ''; //收件公司电话 不能为空
  84. String receiptCompanyName = ''; //收件公司名称 不能为空
  85. String receiptCompanyProvinceName = ''; //收件公司省名称 不能为空
  86. String receiptCompanyProvinceCode = ''; //收件公司省编码 不能为空
  87. String receiptCompanyCityName = ''; //收件公司市名称 不能为空
  88. String receiptCompanyCityCode = ''; //收件公市编码 不能为空
  89. String receiptCompanyAreaName = ''; //收件公区名称 不能为空
  90. String receiptCompanyAreaCode = ''; //收件公司区编码 不能为空
  91. String receiptCompanyAddress = ''; //收件公司地址详情 不能为空
  92. String goods = ''; //商品名称 不能为空
  93. int goodsQuantity = 1; //商品数量 不能为空
  94. int goodsPackingId; //商品包装ID
  95. int goodsCategoryId; //商品类别ID
  96. int goodsPaymentMethod = 2; //付款方式 1,现付 2 到付
  97. double goodsWeight = 0.0; //商品重量
  98. double goodsPriceProtection = 0.0; //商品保价
  99. double goodsAgencyFund = 0.0; //商品代收款
  100. double goodsFreight = 0.0; //商品运费 不能为空
  101. String memo = ''; //备注
  102. String bankCard = '';//银行卡号
  103. String bankName = '';//所属银行
  104. String openBankName = '';//开户人
  105. String openBankPhone = '';//开户电话
  106. List<CompanyOfLineList> lineList = [];
  107. String sendPCA = ' '; //Text组件内容必须有空格,否则报null
  108. String getPCA = ' ';
  109. String showTextGoodsCategory = ' ';
  110. String showTextGoodsPackage = ' ';
  111. String showTextPaymentMehod = '到付';
  112. BluetoothUtils bluetooth = BluetoothUtils();
  113. bool checkedCompanyInfo = false;//选择公司信息向sendCompanyPhoneController填充时不去模糊匹配
  114. bool checkedGoodsName = false;//选择货物名称填充时不匹配
  115. String likeWord ='';//以什么为匹配的字段用户控制高亮_tipsItem中的哪一个字段
  116. @override
  117. void initState() {
  118. super.initState();
  119. goodsCategory().then((resp) {//获取商品类型
  120. if (isNotError(context, resp) && this.mounted) {
  121. GoodsCategory goodsCategoryObj = GoodsCategory.fromJson(resp.data);
  122. setState(() {
  123. goodsCateGoryList = goodsCategoryObj.data;
  124. showTextGoodsCategory = goodsCateGoryList[0].name;
  125. goodsCategoryId = goodsCateGoryList[0].id;
  126. });
  127. }
  128. });
  129. goodsPackage().then((resp) {//获取包装类型
  130. if (isNotError(context, resp) && this.mounted) {
  131. GoodsPackage goodsPackageObj = GoodsPackage.fromJson(resp.data);
  132. setState(() {
  133. goodsPackageList = goodsPackageObj.data;
  134. showTextGoodsPackage = goodsPackageList[0].name;
  135. goodsPackingId = goodsPackageList[0].id;
  136. });
  137. }
  138. });
  139. getKey('stationId').then((resp){
  140. stationId = resp;
  141. });
  142. getKey('defaultFreightPrice').then((resp){
  143. setState(() {
  144. goodsFreightController.text = (double.parse(resp)/100).toString();
  145. });
  146. });
  147. _scrollController.addListener(() {
  148. if (!tipStatus) {
  149. setState(() {
  150. tipStatus = true;
  151. });
  152. }
  153. if(!goodsTipStatus){
  154. setState(() {
  155. goodsTipStatus = true;
  156. });
  157. }
  158. //if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) {}
  159. });
  160. //发件公司电话监听
  161. sendCompanyPhoneController.addListener(() {
  162. if(checkedCompanyInfo){
  163. return;
  164. }
  165. setState(() {
  166. sendCompanyPhone = sendCompanyPhoneController.text;
  167. });
  168. if (timer != null) {
  169. timer.cancel();
  170. }
  171. if (sendCompanyPhoneController.text.length < 6 || sendCompanyPhoneController.text.length > 11) {
  172. setState(() {
  173. tipStatus = true;
  174. });
  175. }
  176. timer = Timer(Duration(milliseconds: 250), () {
  177. if (sendCompanyPhoneController.text.length >= 6 && sendCompanyPhoneController.text.length <= 11) {
  178. likePhone(sendCompanyPhoneController.text).then((resp) {
  179. if (isNotError(context, resp) && this.mounted) {
  180. LikePhone likePhoneObj = LikePhone.fromJson(resp.data);
  181. likePhoneList = likePhoneObj.data;
  182. }
  183. if (likePhoneList.length > 0) {
  184. sendPhoneOrGetPhoneTab = true;
  185. RenderObject sendPhoneObj = _sendPhoneKey.currentContext.findRenderObject();
  186. setState(() {
  187. tipWidth = sendPhoneObj.paintBounds.size.width;
  188. tipHeight = sendPhoneObj.paintBounds.size.height;
  189. tipPosX = sendPhoneObj.getTransformTo(null).getTranslation().x;
  190. tipPosY = sendPhoneObj.getTransformTo(null).getTranslation().y - ScreenUtil.getInstance().setHeight(90);
  191. tipStatus = false;
  192. likeWord='phone';
  193. });
  194. } else {
  195. setState(() {
  196. tipStatus = true;
  197. });
  198. }
  199. });
  200. }
  201. });
  202. });
  203. //发件公司编码监听
  204. sendCompanyCodeController.addListener(() {
  205. if(checkedCompanyInfo){
  206. return;
  207. }
  208. setState(() {
  209. sendCompanyCode = sendCompanyCodeController.text;
  210. });
  211. if (timer != null) {
  212. timer.cancel();
  213. }
  214. if (sendCompanyCodeController.text.length < 2 || sendCompanyCodeController.text.length > 6) {
  215. setState(() {
  216. tipStatus = true;
  217. });
  218. }
  219. timer = Timer(Duration(milliseconds: 250), () {
  220. if (sendCompanyCodeController.text.length >= 2 && sendCompanyCodeController.text.length <= 6) {
  221. likeCompanyCode(sendCompanyCodeController.text).then((resp) {
  222. if (isNotError(context, resp) && this.mounted) {
  223. LikePhone likePhoneObj = LikePhone.fromJson(resp.data);
  224. likePhoneList = likePhoneObj.data;
  225. }
  226. if (likePhoneList.length > 0) {
  227. sendPhoneOrGetPhoneTab = true;
  228. RenderObject sendPhoneObj = _sendCompanyCodeKey.currentContext.findRenderObject();
  229. setState(() {
  230. tipWidth = sendPhoneObj.paintBounds.size.width;
  231. tipHeight = sendPhoneObj.paintBounds.size.height;
  232. tipPosX = sendPhoneObj.getTransformTo(null).getTranslation().x;
  233. tipPosY = sendPhoneObj.getTransformTo(null).getTranslation().y - ScreenUtil.getInstance().setHeight(90);
  234. tipStatus = false;
  235. likeWord='code';
  236. });
  237. } else {
  238. setState(() {
  239. tipStatus = true;
  240. });
  241. }
  242. });
  243. }
  244. });
  245. });
  246. //发件公司名字监听
  247. sendCompanyNameController.addListener(() {
  248. if(checkedCompanyInfo){
  249. return;
  250. }
  251. setState(() {
  252. sendCompanyName = sendCompanyNameController.text;
  253. });
  254. if (timer != null) {
  255. timer.cancel();
  256. }
  257. if (sendCompanyNameController.text.length < 2 || sendCompanyNameController.text.length > 11) {
  258. setState(() {
  259. tipStatus = true;
  260. });
  261. }
  262. timer = Timer(Duration(milliseconds: 250), () {
  263. if (sendCompanyNameController.text.length >= 2 && sendCompanyNameController.text.length <= 11) {
  264. likeCompanyName(sendCompanyNameController.text).then((resp) {
  265. if (isNotError(context, resp) && this.mounted) {
  266. LikePhone likePhoneObj = LikePhone.fromJson(resp.data);
  267. likePhoneList = likePhoneObj.data;
  268. }
  269. if (likePhoneList.length > 0) {
  270. sendPhoneOrGetPhoneTab = true;
  271. RenderObject sendPhoneObj = _sendCompanyNameKey.currentContext.findRenderObject();
  272. setState(() {
  273. tipWidth = sendPhoneObj.paintBounds.size.width;
  274. tipHeight = sendPhoneObj.paintBounds.size.height;
  275. tipPosX = sendPhoneObj.getTransformTo(null).getTranslation().x;
  276. tipPosY = sendPhoneObj.getTransformTo(null).getTranslation().y - ScreenUtil.getInstance().setHeight(90);
  277. tipStatus = false;
  278. likeWord='name';
  279. });
  280. } else {
  281. setState(() {
  282. tipStatus = true;
  283. });
  284. }
  285. });
  286. }
  287. });
  288. });
  289. //收件公司电话监听
  290. receiptCompanyPhoneController.addListener(() {
  291. if(checkedCompanyInfo){
  292. return;
  293. }
  294. setState(() {
  295. receiptCompanyPhone = receiptCompanyPhoneController.text;
  296. });
  297. if (timer != null) {
  298. timer.cancel();
  299. }
  300. if (receiptCompanyPhoneController.text.length < 6 || receiptCompanyPhoneController.text.length > 11) {
  301. setState(() {
  302. tipStatus = true;
  303. });
  304. }
  305. timer = Timer(Duration(milliseconds: 250), () {
  306. if (receiptCompanyPhoneController.text.length >= 6 && receiptCompanyPhoneController.text.length <= 11) {
  307. likePhone(receiptCompanyPhoneController.text).then((resp) {
  308. if (isNotError(context, resp) && this.mounted) {
  309. LikePhone likePhoneObj = LikePhone.fromJson(resp.data);
  310. likePhoneList = likePhoneObj.data;
  311. }
  312. if (likePhoneList.length > 0) {
  313. sendPhoneOrGetPhoneTab = false;
  314. RenderObject getPhoneKey = _getPhoneKey.currentContext.findRenderObject();
  315. setState(() {
  316. tipWidth = getPhoneKey.paintBounds.size.width;
  317. tipHeight = getPhoneKey.paintBounds.size.height;
  318. tipPosX = getPhoneKey.getTransformTo(null).getTranslation().x;
  319. tipPosY = getPhoneKey.getTransformTo(null).getTranslation().y - ScreenUtil.getInstance().setHeight(90);
  320. tipStatus = false;
  321. likeWord='phone';
  322. });
  323. } else {
  324. setState(() {
  325. tipStatus = true;
  326. });
  327. }
  328. });
  329. }
  330. });
  331. });
  332. //收件公司名称监听
  333. receiptCompanyNameController.addListener(() {
  334. if(checkedCompanyInfo){
  335. return;
  336. }
  337. setState(() {
  338. receiptCompanyName = receiptCompanyNameController.text;
  339. });
  340. if (timer != null) {
  341. timer.cancel();
  342. }
  343. if (receiptCompanyNameController.text.length < 2 || receiptCompanyNameController.text.length > 11) {
  344. setState(() {
  345. tipStatus = true;
  346. });
  347. }
  348. timer = Timer(Duration(milliseconds: 250), () {
  349. if (receiptCompanyNameController.text.length >= 2 && receiptCompanyNameController.text.length <= 11) {
  350. likeCompanyName(receiptCompanyNameController.text).then((resp) {
  351. if (isNotError(context, resp) && this.mounted) {
  352. LikePhone likePhoneObj = LikePhone.fromJson(resp.data);
  353. likePhoneList = likePhoneObj.data;
  354. }
  355. if (likePhoneList.length > 0) {
  356. sendPhoneOrGetPhoneTab = false;
  357. RenderObject getPhoneKey = _getCompanyNameKey.currentContext.findRenderObject();
  358. setState(() {
  359. tipWidth = getPhoneKey.paintBounds.size.width;
  360. tipHeight = getPhoneKey.paintBounds.size.height;
  361. tipPosX = getPhoneKey.getTransformTo(null).getTranslation().x;
  362. tipPosY = getPhoneKey.getTransformTo(null).getTranslation().y - ScreenUtil.getInstance().setHeight(90);
  363. tipStatus = false;
  364. likeWord='name';
  365. });
  366. } else {
  367. setState(() {
  368. tipStatus = true;
  369. });
  370. }
  371. });
  372. }
  373. });
  374. });
  375. //货物名称监听
  376. goodsController.addListener(() {
  377. if(checkedGoodsName){
  378. return;
  379. }
  380. setState(() {
  381. goods = goodsController.text;
  382. });
  383. if (timer != null) {
  384. timer.cancel();
  385. }
  386. if (goodsController.text.length < 1) {
  387. setState(() {
  388. goodsTipStatus = true;
  389. });
  390. }
  391. timer = Timer(Duration(milliseconds: 250), () {
  392. if (goodsController.text.length >= 1) {
  393. goodsNameLike(stationId,goodsController.text,lineId).then((resp) {
  394. if (isNotError(context, resp) && this.mounted) {
  395. GoodsPriceObj goodsPriceObj = GoodsPriceObj.fromJson(resp.data);
  396. goodsPriceList = goodsPriceObj.data;
  397. }
  398. if (goodsPriceList.length > 0) {
  399. RenderObject goodsKey = _goodsKey.currentContext.findRenderObject();
  400. setState(() {
  401. tipWidth = goodsKey.paintBounds.size.width;
  402. tipHeight = goodsKey.paintBounds.size.height;
  403. tipPosX = goodsKey.getTransformTo(null).getTranslation().x;
  404. tipPosY = goodsKey.getTransformTo(null).getTranslation().y - ScreenUtil.getInstance().setHeight(90);
  405. goodsTipStatus = false;
  406. });
  407. } else {
  408. setState(() {
  409. goodsTipStatus = true;
  410. });
  411. }
  412. });
  413. }
  414. });
  415. });
  416. sendCompanyAddressController.addListener(() {
  417. setState(() {
  418. sendCompanyAddress = sendCompanyAddressController.text;
  419. });
  420. });
  421. receiptCompanyAddressController.addListener(() {
  422. setState(() {
  423. receiptCompanyAddress = receiptCompanyAddressController.text;
  424. });
  425. });
  426. bankCardFocusNode.addListener((){
  427. if(!bankCardFocusNode.hasFocus){
  428. if(bankCardController.text!=''){
  429. getBankName(bankCardController.text).then((resp){
  430. if(isNotError(context, resp) && this.mounted){
  431. BankNameObj obj = BankNameObj.fromJson(resp.data);
  432. setState(() {
  433. bankNameController.text = obj.data;
  434. });
  435. }
  436. });
  437. }
  438. }
  439. });
  440. }
  441. @override
  442. bool get wantKeepAlive => true;
  443. @override
  444. Widget build(BuildContext context) {
  445. return Container(
  446. child: Scaffold(
  447. appBar: AppBar(
  448. title: Text('发件', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(36)), ),
  449. centerTitle: true,
  450. backgroundColor: Color.fromRGBO(64, 98, 254, 1),
  451. ),
  452. body:
  453. Stack(
  454. children: < Widget > [
  455. Container(
  456. color: Color.fromRGBO(246, 246, 254, 1),
  457. padding: EdgeInsets.fromLTRB(0, ScreenUtil.getInstance().setHeight(20), 0, ScreenUtil.getInstance().setHeight(20)),
  458. child: ListView(
  459. controller: _scrollController,
  460. children: < Widget > [
  461. _sendInfo(context),
  462. _getInfo(context),
  463. _itemInfoWidget(),
  464. _bankInfo(context),
  465. _submitBtn()
  466. ],
  467. ),
  468. ),
  469. Positioned(
  470. top: tipPosY,
  471. left: tipPosX,
  472. child: Offstage(
  473. offstage: tipStatus,
  474. child: Container(
  475. width: tipWidth,
  476. height: ScreenUtil.getInstance().setHeight(450),
  477. padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
  478. decoration: BoxDecoration(
  479. color: Color.fromRGBO(244, 248, 251, 1),
  480. ),
  481. child: ListView.builder(
  482. itemCount: likePhoneList.length,
  483. itemBuilder: (BuildContext context, int index) {
  484. return _tipItem(likePhoneList[index]);
  485. },
  486. )
  487. ),
  488. )
  489. ),
  490. Positioned(
  491. top: tipPosY,
  492. left: tipPosX,
  493. child: Offstage(
  494. offstage: goodsTipStatus,
  495. child: Container(
  496. width: tipWidth,
  497. height: ScreenUtil.getInstance().setHeight(450),
  498. padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
  499. decoration: BoxDecoration(
  500. color: Color.fromRGBO(244, 248, 251, 1),
  501. ),
  502. child: ListView.builder(
  503. itemCount: goodsPriceList.length,
  504. itemBuilder: (BuildContext context, int index) {
  505. return _goodsTipItem(goodsPriceList[index]);
  506. },
  507. )
  508. ),
  509. )
  510. )
  511. ],
  512. ),
  513. resizeToAvoidBottomPadding: false //键盘弹出,页面不跟随向上滑动,防止出现溢出错误
  514. ),
  515. );
  516. }
  517. Widget _sendInfo(BuildContext context) {
  518. return Container(
  519. color: Colors.white,
  520. margin: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
  521. child: Column(
  522. children: < Widget > [
  523. _titleWidget('lib/images/icon_send.png', '发件信息'),
  524. _underLine(),
  525. _inputWiget('send_phone','发件电话', _sendPhoneKey,sendCompanyPhoneController),
  526. _inputWiget('send_code','企业编码', _sendCompanyCodeKey, sendCompanyCodeController,true),
  527. _inputWiget('send_name','企业名称', _sendCompanyNameKey, sendCompanyNameController,true),
  528. _cityWiget('城市/区域', context, 'send'),
  529. _lastContentWiget('详细地址', 'send')
  530. ],
  531. )
  532. );
  533. }
  534. Widget _getInfo(BuildContext context) {
  535. return Container(
  536. color: Colors.white,
  537. margin: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
  538. child: Column(
  539. children: < Widget > [
  540. _titleWidget('lib/images/icon_shoujian.png', '收件信息'),
  541. _underLine(),
  542. _inputWiget('get_phone','收件电话', _getPhoneKey,receiptCompanyPhoneController),
  543. _inputWiget('get_name','企业名称', _getCompanyNameKey,receiptCompanyNameController ,true),
  544. _cityWiget('城市/区域', context, 'get'),
  545. _lastContentWiget('详细地址', 'get')
  546. ],
  547. )
  548. );
  549. }
  550. Widget _itemInfoWidget() {
  551. return Container(
  552. child: Container(
  553. color: Colors.white,
  554. margin: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
  555. child: Column(
  556. crossAxisAlignment: CrossAxisAlignment.start,
  557. children: < Widget > [
  558. _titleWidget('lib/images/icon_huowu.png', "货物信息"),
  559. _underLine(),
  560. _itemContentWiget("货物名称", goodsController, true),
  561. _itemContentWiget("数量", goodsQuantityController),
  562. _itemContentWiget("运费", goodsFreightController),
  563. _itemContentWiget("代收", goodsAgencyFundController),
  564. _itemContentWiget("保价", goodsPriceProtectionController),
  565. _itemContentWiget("重量", goodsWeightController),
  566. _packageType('包装类型'),
  567. _packageType('货物类型'),
  568. _packageType('付款方式'),
  569. _descWidget()
  570. ],
  571. ),
  572. )
  573. );
  574. }
  575. Widget _bankInfo(BuildContext context) {
  576. return Container(
  577. color: Colors.white,
  578. margin: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
  579. child: Column(
  580. children: < Widget > [
  581. _titleWidget('lib/images/icon_bank.png', '银行信息'),
  582. _underLine(),
  583. _contentBankWiget('银行卡号', 'bank'),
  584. _contentBankWiget('银行名称', 'bank',true),
  585. _contentBankWiget('开户人', 'bank',true),
  586. _lastBankContentWiget('开户电话', 'bank'),
  587. ],
  588. )
  589. );
  590. }
  591. Widget _titleWidget(String iconUrl, String str) {
  592. return Container(
  593. height: ScreenUtil.getInstance().setHeight(90),
  594. padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
  595. child: Center(
  596. child: Row(
  597. mainAxisAlignment: MainAxisAlignment.start,
  598. children: < Widget > [
  599. Padding(
  600. padding: EdgeInsets.only(right: ScreenUtil.getInstance().setHeight(20)),
  601. child: Image.asset(
  602. iconUrl,
  603. width: ScreenUtil.getInstance().setWidth(40),
  604. height: ScreenUtil.getInstance().setHeight(40),
  605. )
  606. ),
  607. Text(str, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(32)), )
  608. ],
  609. ),
  610. ),
  611. );
  612. }
  613. Widget _underLine() {
  614. return Container(
  615. color: Color.fromRGBO(223, 223, 223, 1),
  616. height: ScreenUtil.getInstance().setHeight(1),
  617. );
  618. }
  619. Widget _inputWiget(String key,String title ,GlobalKey tab,TextEditingController tab1,[bool keyboardType = false]) {
  620. return Padding(
  621. key: tab,
  622. padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
  623. child: Column(
  624. children: < Widget > [
  625. SizedBox(
  626. height: ScreenUtil.getInstance().setHeight(89),
  627. child: Center(
  628. child: Row(
  629. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  630. children: < Widget > [
  631. Expanded(
  632. flex: 0,
  633. child: Text(title, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
  634. ),
  635. Expanded(
  636. child: Row(
  637. mainAxisAlignment: MainAxisAlignment.end,
  638. children: < Widget > [
  639. SizedBox(
  640. width: ScreenUtil.getInstance().setWidth(500),
  641. child: Padding(
  642. padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(30)),
  643. child: TextField(
  644. controller: tab1,
  645. keyboardType: keyboardType ? TextInputType.text : TextInputType.number,
  646. textAlign: TextAlign.end,
  647. decoration: InputDecoration(
  648. border: InputBorder.none
  649. ),
  650. onEditingComplete: () {
  651. setState(() {
  652. FocusScope.of(context).requestFocus(FocusNode());
  653. tipStatus = true;
  654. });
  655. },
  656. onChanged: (value){
  657. checkedCompanyInfo = false;
  658. if(key=='send_phone'){
  659. sendCompanyCode = '';
  660. sendCompanyName = '';
  661. sendCompanyId ='0';
  662. sendCompanyCodeController.text = '';
  663. sendCompanyNameController.text = '';
  664. sendPCA = '';
  665. sendCompanyProvinceName = '';
  666. sendCompanyProvinceCode = '';
  667. sendCompanyCityName = '';
  668. sendCompanyCityCode = '';
  669. sendCompanyAreaName = '';
  670. sendCompanyAreaCode = '';
  671. bankCardController.text = '';
  672. bankNameController.text = '';
  673. openBankNameController.text = '';
  674. openBankPhoneController.text = '';
  675. sendCompanyAddressController.text = '';
  676. }else if(key=='get_phone'){
  677. receiptCompanyName = '';
  678. receiptCompanyNameController.text = '';
  679. receiptCompanyId = '0';
  680. getPCA = '';
  681. receiptCompanyProvinceName = '';
  682. receiptCompanyProvinceCode = '';
  683. receiptCompanyCityName = '';
  684. receiptCompanyCityCode = '';
  685. receiptCompanyAreaName = '';
  686. receiptCompanyAreaCode = '';
  687. receiptCompanyAddressController.text = '';
  688. }else if(key=='send_code'){
  689. sendCompanyPhone = '';
  690. sendCompanyName = '';
  691. sendCompanyId ='0';
  692. sendCompanyPhoneController.text = '';
  693. sendCompanyNameController.text = '';
  694. sendPCA = '';
  695. sendCompanyProvinceName = '';
  696. sendCompanyProvinceCode = '';
  697. sendCompanyCityName = '';
  698. sendCompanyCityCode = '';
  699. sendCompanyAreaName = '';
  700. sendCompanyAreaCode = '';
  701. bankCardController.text = '';
  702. bankNameController.text = '';
  703. openBankNameController.text = '';
  704. openBankPhoneController.text = '';
  705. sendCompanyAddressController.text = '';
  706. }else if(key=='send_name'){
  707. sendCompanyCode = '';
  708. sendCompanyPhone = '';
  709. sendCompanyId ='0';
  710. sendCompanyCodeController.text = '';
  711. sendCompanyPhoneController.text = '';
  712. sendPCA = '';
  713. sendCompanyProvinceName = '';
  714. sendCompanyProvinceCode = '';
  715. sendCompanyCityName = '';
  716. sendCompanyCityCode = '';
  717. sendCompanyAreaName = '';
  718. sendCompanyAreaCode = '';
  719. bankCardController.text = '';
  720. bankNameController.text = '';
  721. openBankNameController.text = '';
  722. openBankPhoneController.text = '';
  723. sendCompanyAddressController.text = '';
  724. }else if(key=='get_name'){
  725. receiptCompanyPhone = '';
  726. receiptCompanyPhoneController.text = '';
  727. receiptCompanyId = '0';
  728. getPCA = '';
  729. receiptCompanyProvinceName = '';
  730. receiptCompanyProvinceCode = '';
  731. receiptCompanyCityName = '';
  732. receiptCompanyCityCode = '';
  733. receiptCompanyAreaName = '';
  734. receiptCompanyAreaCode = '';
  735. receiptCompanyAddressController.text = '';
  736. }
  737. },
  738. ),
  739. )
  740. ),
  741. // Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
  742. ],
  743. )
  744. )
  745. ],
  746. ),
  747. )
  748. ),
  749. Expanded(
  750. flex: 0,
  751. child: _underLine()
  752. )
  753. ],
  754. )
  755. );
  756. }
  757. Widget _itemContentWiget(String key,TextEditingController controller, [bool keyboardType = false]) { //false是数字键盘
  758. return Padding(
  759. key: key=='货物名称'?_goodsKey:null,
  760. padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
  761. child: Column(
  762. children: < Widget > [
  763. SizedBox(
  764. height: ScreenUtil.getInstance().setHeight(89),
  765. child: Center(
  766. child: Row(
  767. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  768. children: < Widget > [
  769. Expanded(
  770. flex: 0,
  771. child: Text(key, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
  772. ),
  773. Expanded(
  774. child: Row(
  775. mainAxisAlignment: MainAxisAlignment.end,
  776. children: < Widget > [
  777. SizedBox(
  778. width: ScreenUtil.getInstance().setWidth(500),
  779. child: Padding(
  780. padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(30)),
  781. child:TextField(
  782. controller: controller,
  783. keyboardType: keyboardType ? TextInputType.text : TextInputType.number,
  784. textAlign: TextAlign.end,
  785. decoration: InputDecoration(
  786. border: InputBorder.none
  787. ),
  788. onChanged: (value) {
  789. if (key == '货物名称') {
  790. goods = value;
  791. } else if (key == '数量') {
  792. goodsQuantity = int.parse(value);
  793. } else if (key == '运费') {
  794. goodsFreight = double.parse(value);
  795. String temp = goodsFreight.toStringAsFixed(1);
  796. goodsFreight = double.parse(temp);
  797. } else if (key == '代收') {
  798. goodsAgencyFund = double.parse(value);
  799. String temp = goodsAgencyFund.toStringAsFixed(1);
  800. goodsAgencyFund = double.parse(temp);
  801. } else if (key == '保价') {
  802. goodsPriceProtection = double.parse(value);
  803. String temp = goodsPriceProtection.toStringAsFixed(1);
  804. goodsPriceProtection = double.parse(temp);
  805. } else if (key == '重量') {
  806. goodsWeight = double.parse(value);
  807. String temp = goodsWeight.toStringAsFixed(1);
  808. goodsWeight = double.parse(temp);
  809. }
  810. },
  811. ),
  812. )
  813. ),
  814. // Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
  815. ],
  816. )
  817. )
  818. ],
  819. ),
  820. )
  821. ),
  822. Expanded(
  823. flex: 0,
  824. child: _underLine()
  825. )
  826. ],
  827. )
  828. );
  829. }
  830. Widget _contentBankWiget(String key, String type, [bool keyboardType = false]) { //false是数字键盘
  831. return Padding(
  832. padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
  833. child: Column(
  834. children: < Widget > [
  835. SizedBox(
  836. height: ScreenUtil.getInstance().setHeight(89),
  837. child: Center(
  838. child: Row(
  839. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  840. children: < Widget > [
  841. Expanded(
  842. flex: 0,
  843. child: Text(key, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
  844. ),
  845. Expanded(
  846. child: Row(
  847. mainAxisAlignment: MainAxisAlignment.end,
  848. children: < Widget > [
  849. SizedBox(
  850. width: ScreenUtil.getInstance().setWidth(500),
  851. child:
  852. Padding(
  853. padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(30)),
  854. child:TextField(
  855. focusNode: key == '银行卡号'?bankCardFocusNode:null,
  856. controller: key == '银行卡号'?bankCardController:key=='银行名称'?bankNameController:openBankNameController,
  857. keyboardType: keyboardType ? TextInputType.text : TextInputType.number,
  858. textAlign: TextAlign.end,
  859. decoration: InputDecoration(
  860. border: InputBorder.none
  861. ),
  862. ),
  863. )
  864. ),
  865. // Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
  866. ],
  867. )
  868. )
  869. ],
  870. ),
  871. )
  872. ),
  873. Expanded(
  874. flex: 0,
  875. child: _underLine()
  876. )
  877. ],
  878. )
  879. );
  880. }
  881. Widget _cityWiget(String key, BuildContext context, String type) {
  882. return
  883. GestureDetector(
  884. child: Padding(
  885. padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
  886. child: Column(
  887. children: < Widget > [
  888. SizedBox(
  889. height: ScreenUtil.getInstance().setHeight(89),
  890. child: Center(
  891. child: Row(
  892. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  893. children: < Widget > [
  894. Expanded(
  895. flex: 0,
  896. child: Text(key, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
  897. ),
  898. Expanded(
  899. child: Row(
  900. mainAxisAlignment: MainAxisAlignment.end,
  901. children: < Widget > [
  902. //Text('${value}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(136, 136, 136, 1)), ),
  903. SizedBox(
  904. width: ScreenUtil.getInstance().setWidth(500),
  905. child: Text(type == 'send' ? sendPCA : getPCA, textAlign: TextAlign.end, overflow: TextOverflow.ellipsis, )
  906. ),
  907. Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
  908. ],
  909. )
  910. )
  911. ],
  912. ),
  913. )
  914. ),
  915. Expanded(
  916. flex: 0,
  917. child: _underLine()
  918. )
  919. ],
  920. )
  921. ),
  922. onTap: () {
  923. getCity(context).then((resp) {
  924. if (resp == null) {
  925. return;
  926. }
  927. print(resp.toString());
  928. setState(() {
  929. if (type == 'send') {
  930. sendPCA = resp.provinceName + ' ' + resp.cityName + ' ' + ' ' + resp.areaName;
  931. sendCompanyProvinceName = resp.provinceName;
  932. sendCompanyProvinceCode = resp.provinceId;
  933. sendCompanyCityName = resp.cityName;
  934. sendCompanyCityCode = resp.cityId;
  935. sendCompanyAreaName = resp.areaName;
  936. sendCompanyAreaCode = resp.areaId;
  937. } else {
  938. getPCA = resp.provinceName + ' ' + resp.cityName + ' ' + ' ' + resp.areaName;
  939. receiptCompanyProvinceName = resp.provinceName;
  940. receiptCompanyProvinceCode = resp.provinceId;
  941. receiptCompanyCityName = resp.cityName;
  942. receiptCompanyCityCode = resp.cityId;
  943. receiptCompanyAreaName = resp.areaName;
  944. receiptCompanyAreaCode = resp.areaId;
  945. }
  946. });
  947. //print(value);
  948. });
  949. },
  950. );
  951. }
  952. Widget _lastContentWiget(String key, String type) {
  953. return Padding(
  954. padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
  955. child: SizedBox(
  956. height: ScreenUtil.getInstance().setHeight(89),
  957. child: Center(
  958. child: Row(
  959. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  960. children: < Widget > [
  961. Expanded(
  962. flex: 0,
  963. child: Text(key, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
  964. ),
  965. Expanded(
  966. child: Row(
  967. mainAxisAlignment: MainAxisAlignment.end,
  968. children: < Widget > [
  969. //Text('${value}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(136, 136, 136, 1)), ),
  970. SizedBox(
  971. width: ScreenUtil.getInstance().setWidth(500),
  972. child: Padding(
  973. padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(30)),
  974. child: TextField(
  975. controller: type == 'send' ? sendCompanyAddressController : receiptCompanyAddressController,
  976. textAlign: TextAlign.end,
  977. decoration: InputDecoration(
  978. border: InputBorder.none
  979. ),
  980. ),
  981. )
  982. ),
  983. // Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
  984. ],
  985. )
  986. )
  987. ],
  988. ),
  989. )
  990. )
  991. );
  992. }
  993. Widget _lastBankContentWiget(String key, String type) {
  994. return Padding(
  995. padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
  996. child: SizedBox(
  997. height: ScreenUtil.getInstance().setHeight(89),
  998. child: Center(
  999. child: Row(
  1000. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1001. children: < Widget > [
  1002. Expanded(
  1003. flex: 0,
  1004. child: Text(key, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
  1005. ),
  1006. Expanded(
  1007. child: Row(
  1008. mainAxisAlignment: MainAxisAlignment.end,
  1009. children: < Widget > [
  1010. //Text('${value}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(136, 136, 136, 1)), ),
  1011. SizedBox(
  1012. width: ScreenUtil.getInstance().setWidth(500),
  1013. child: Padding(
  1014. padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(30)),
  1015. child: TextField(
  1016. controller: openBankPhoneController,
  1017. textAlign: TextAlign.end,
  1018. keyboardType: TextInputType.number,
  1019. decoration: InputDecoration(
  1020. border: InputBorder.none
  1021. ),
  1022. ),
  1023. )
  1024. ),
  1025. // Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
  1026. ],
  1027. )
  1028. )
  1029. ],
  1030. ),
  1031. )
  1032. )
  1033. );
  1034. }
  1035. Widget _descWidget() {
  1036. return
  1037. Container(
  1038. padding: EdgeInsets.all(ScreenUtil.getInstance().setWidth(30)),
  1039. //child: Text(str, maxLines: 100, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
  1040. child: TextField(
  1041. maxLines: 3,
  1042. controller: memoController,
  1043. decoration: InputDecoration(
  1044. border: InputBorder.none,
  1045. hintText: "请输入备注内容"
  1046. ),
  1047. onChanged: (value) {
  1048. setState(() {
  1049. memo = value;
  1050. });
  1051. },
  1052. ),
  1053. );
  1054. }
  1055. Widget _submitBtn() {
  1056. return GestureDetector(
  1057. child: Container(
  1058. margin: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(50), ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(40)),
  1059. height: ScreenUtil.getInstance().setHeight(88),
  1060. decoration: BoxDecoration(
  1061. borderRadius: BorderRadius.all(Radius.circular(4)),
  1062. color: Color.fromRGBO(37, 102, 242, 1),
  1063. ),
  1064. child: Center(
  1065. child: Row(
  1066. mainAxisAlignment: MainAxisAlignment.center,
  1067. children: < Widget > [
  1068. Offstage(
  1069. offstage: submitStatus,
  1070. child: SizedBox(
  1071. width: ScreenUtil.getInstance().setWidth(45),
  1072. height: ScreenUtil.getInstance().setHeight(45),
  1073. child: Image.asset('lib/images/loading.gif'),
  1074. ),
  1075. ),
  1076. Text("提交", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(32), color: Colors.white), ),
  1077. ],
  1078. )
  1079. ),
  1080. ),
  1081. onTap: () {
  1082. if (!submitStatus) {
  1083. return;
  1084. }
  1085. String errStr = '';
  1086. print('sendCompanyId---${sendCompanyId}');
  1087. print('sendCompanyName---${sendCompanyName}');
  1088. print('sendCompanyPhone---${sendCompanyPhone}');
  1089. print('sendCompanyCode---${sendCompanyCode}');
  1090. print('sendCompanyProvinceName---${sendCompanyProvinceName}');
  1091. print('sendCompanyProvinceCode---${sendCompanyProvinceCode}');
  1092. print('sendCompanyCityName---${sendCompanyCityName}');
  1093. print('sendCompanyCityCode---${sendCompanyCityCode}');
  1094. print('sendCompanyAreaName---${sendCompanyAreaName}');
  1095. print('sendCompanyAreaCode---${sendCompanyAreaCode}');
  1096. print('sendCompanyAddress---${sendCompanyAddress}');
  1097. print('receiptCompanyId---${receiptCompanyId}');
  1098. print('receiptCompanyPhone---${receiptCompanyPhone}');
  1099. print('receiptCompanyName---${receiptCompanyName}');
  1100. print('receiptCompanyProvinceName---${receiptCompanyProvinceName}');
  1101. print('receiptCompanyProvinceCode---${receiptCompanyProvinceCode}');
  1102. print('receiptCompanyCityName---${receiptCompanyCityName}');
  1103. print('receiptCompanyCityCode---${receiptCompanyCityCode}');
  1104. print('receiptCompanyAreaName---${receiptCompanyAreaName}');
  1105. print('receiptCompanyAreaCode---${receiptCompanyAreaCode}');
  1106. print('receiptCompanyAddress---${receiptCompanyAddress}');
  1107. print('goods---${goods}');
  1108. print('goodsQuantity---${goodsQuantity}');
  1109. print('goodsPackingId---${goodsPackingId}');
  1110. print('goodsCategoryId---${goodsCategoryId}');
  1111. print('goodsPaymentMethod---${goodsPaymentMethod}');
  1112. print('goodsWeight---${goodsWeight}');
  1113. print('goodsPriceProtection---${goodsPriceProtection}');
  1114. print('goodsAgencyFund---${goodsAgencyFund}');
  1115. print('goodsFreight---${goodsFreight}');
  1116. print('memo---${memo}');
  1117. if (sendCompanyPhone == '') {
  1118. errStr = '请填写发件电话';
  1119. }
  1120. if (sendCompanyName == '') {
  1121. errStr = '请填写发件企业名称';
  1122. }
  1123. if (sendCompanyProvinceName == '') {
  1124. errStr = '请填写发件城市/区域';
  1125. }
  1126. if (sendCompanyAddress == '') {
  1127. errStr = '请填写发件详细地址';
  1128. }
  1129. if (receiptCompanyPhone == '') {
  1130. errStr = '请填写收件电话';
  1131. }
  1132. if (receiptCompanyName == '') {
  1133. errStr = '请填写收件企业名称';
  1134. }
  1135. if (receiptCompanyProvinceName == '') {
  1136. errStr = '请填写收件城市/区域';
  1137. }
  1138. if (receiptCompanyAddress == '') {
  1139. errStr = '请填写收件详细地址';
  1140. }
  1141. // if (goods == '') {
  1142. // errStr = '请填写货物名称';
  1143. // }
  1144. if (goodsQuantity == 0) {
  1145. errStr = '请填写货物数量';
  1146. }
  1147. if (int.tryParse(goodsQuantity.toString()) == null) {
  1148. errStr = '货物数量格式错误';
  1149. }
  1150. if (goodsFreight < 0.0) {
  1151. errStr = '运费输入错误';
  1152. }
  1153. if (sendCompanyPhone == '' || receiptCompanyPhone == '' ) {
  1154. errStr = '请输入正确的电话';
  1155. }
  1156. if (goodsAgencyFund>0) {//如果有代收
  1157. if(bankNameController.text=='' || bankCardController.text=='' || openBankNameController.text=='' || openBankPhoneController.text==''){
  1158. errStr = "请补全银行卡信息";
  1159. }
  1160. }
  1161. if (errStr != '') {
  1162. showError(errStr);
  1163. return;
  1164. }
  1165. if(lineList.length>1 && !checkedLine &&!checkedGoodsName1){
  1166. showLineModal(lineList);
  1167. return;
  1168. }
  1169. submitOrder();
  1170. },
  1171. );
  1172. }
  1173. submitOrder(){
  1174. setState(() {
  1175. submitStatus = false;
  1176. });
  1177. getKey('stationId').then((value) {
  1178. createOrder(
  1179. lineId,//收件线路Id
  1180. value,//当前用户选择的站点id
  1181. sendCompanyId, //寄件公司Id
  1182. sendCompanyName, //寄件公司名称 不能为空
  1183. sendCompanyPhone, //寄件公司电话 不能为空
  1184. sendCompanyCode ?? '', //寄件公司编码
  1185. sendCompanyProvinceName, //寄件公司省名称 不能为空
  1186. sendCompanyProvinceCode, //寄件公司省编码 不能为空
  1187. sendCompanyCityName, //寄件公司市名称 不能为空
  1188. sendCompanyCityCode, //寄件公司市编码 不能为空
  1189. sendCompanyAreaName, //寄件公司区名称 不能为空
  1190. sendCompanyAreaCode, //寄件公司区编码 不能为空
  1191. sendCompanyAddress, //寄件公司详细地址,不能为空
  1192. receiptCompanyId, //收件公司id
  1193. receiptCompanyPhone, //收件公司电话 不能为空
  1194. receiptCompanyName, //收件公司名称 不能为空
  1195. receiptCompanyProvinceName, //收件公司省名称 不能为空
  1196. receiptCompanyProvinceCode, //收件公司省编码 不能为空
  1197. receiptCompanyCityName, //收件公司市名称 不能为空
  1198. receiptCompanyCityCode, //收件公市编码 不能为空
  1199. receiptCompanyAreaName, //收件公区名称 不能为空
  1200. receiptCompanyAreaCode, //收件公司区编码 不能为空
  1201. receiptCompanyAddress, //收件公司地址详情 不能为空
  1202. goods, //商品名称 不能为空
  1203. goodsQuantity, //商品数量 不能为空
  1204. goodsPackingId, //商品包装ID
  1205. goodsCategoryId, //商品类别ID
  1206. goodsPaymentMethod, //付款方式 1,现付 2 到付
  1207. goodsWeight, //商品重量
  1208. goodsPriceProtection * 100, //商品保价,已分为单位
  1209. goodsAgencyFund * 100, //商品代收款,已分为单位
  1210. goodsFreight * 100, //商品运费 不能为空 ,已分为单位
  1211. memo, //备注
  1212. bankCardController.text,
  1213. bankNameController.text,
  1214. openBankNameController.text,
  1215. openBankPhoneController.text
  1216. ).then((resp) {
  1217. if (isNotError(context, resp) && this.mounted) {
  1218. setState(() {
  1219. submitStatus = true;
  1220. });
  1221. OrderDetailData data = OrderDetailObj.fromJson(resp.data).data;
  1222. showDialog < Null > (
  1223. context: context, //BuildContext对象
  1224. barrierDismissible: false,
  1225. builder: (BuildContext context) {
  1226. //打印
  1227. getKey('printType').then((printType){
  1228. getKey('stationName').then((stationName){
  1229. getKey('nickName').then((nickName){
  1230. getKey('companyName').then((companyName){
  1231. getKey('companyCustomerPhone').then((companyCustomerPhone){
  1232. double goodsYs = data.goodsPaymentMethod==2?(data.goodsFreight/100)+(data.goodsAgencyFund/100):data.goodsAgencyFund/100;
  1233. String nowDate = fromatDate( DateTime.now().millisecondsSinceEpoch);//打印时间
  1234. String createTime = fromatDate(data.createTime);
  1235. double goodsAgencyFunds = data.goodsAgencyFund/100;
  1236. double goodsDFreight = data.goodsPaymentMethod==2?data.goodsFreight/100:0;
  1237. double goodsXFreight = data.goodsPaymentMethod==1?data.goodsFreight/100:0;
  1238. String receiptAddress = data.receiptCompanyAddress.length>10?data.receiptCompanyAddress.substring(0,10):data.receiptCompanyAddress;
  1239. Map<String, String> pum = {
  1240. "[logisticsNo]": "${data.orderNo ?? ''}",
  1241. "[createTime]": "$createTime",
  1242. "[sendStationName]": "$stationName",
  1243. "[dealerCode]": "${data.sendCompanyCode ?? ''}",
  1244. "[dealerName]": "${data.sendCompanyName}",
  1245. "[dealerTel]": "${data.sendCompanyPhone ?? ''}",
  1246. "[repairName]": "${data.receiptCompanyName ?? ''}",
  1247. "[repairTel]": "${data.receiptCompanyPhone ?? ''}",
  1248. "[endStationName]": "${data.receiptStationName ?? ''}",
  1249. "[goodsLineCode]": "${data.lineCode ?? ''}",
  1250. "[goodsLine]": "${data.lineName ?? ''}",
  1251. "[repairAddress]": "${receiptAddress?? ''}",
  1252. "[goodsQuantity]": "${data.goodsQuantity ?? ''}",
  1253. "[goodsInsurance]": "${data.goodsInsurance ?? ''}",
  1254. "[goodsFlatCost]": "${data.goodsFlatCost ?? ''}",
  1255. // 到付 现付 金额
  1256. "[goodsDFreight]": "$goodsDFreight",
  1257. "[goodsXFreight]": "$goodsXFreight",
  1258. "[goodsAgencyFund]": "$goodsAgencyFunds",
  1259. "[goodsYs]": "$goodsYs",
  1260. "[dealerBankAccount]": "${data.sendCompanyBankCard ?? ''}",
  1261. "[goodsRemark]": "${data.memo ?? ''}",
  1262. "[realName]": "${nickName?? ''}",
  1263. "[currentTime]": "$nowDate",
  1264. "[currentGoodNumber]": "1/1",
  1265. "[companyCustomerPhone]":"$companyCustomerPhone",
  1266. "[companyName]":"$companyName"
  1267. };
  1268. bluetooth.printOrder(pum, int.parse(printType)).then((value){
  1269. if(value==null){
  1270. showDialog <Null> (
  1271. context: context,
  1272. barrierDismissible: false,
  1273. builder: (BuildContext context) {
  1274. return MyAlertDialog(text: '未连接打印机',childCallback:(val){});
  1275. }
  1276. );
  1277. }
  1278. });
  1279. });
  1280. });
  1281. });
  1282. });
  1283. });
  1284. return SendDialog( //调用对话框
  1285. orderNo: data.orderNo,
  1286. childCallback: (val) {
  1287. if (!val) {
  1288. //跳转
  1289. Navigator.push(context, MaterialPageRoute(builder: (context) {
  1290. return OrderDetail(orderNo: data.orderNo, );
  1291. }));
  1292. }else{
  1293. setState(() {
  1294. //----------------清除信息--------------------
  1295. lineId = '-1';
  1296. sendCompanyCode = '';
  1297. sendCompanyName = '';
  1298. sendCompanyId ='0';
  1299. sendCompanyPhoneController.text= '';
  1300. sendCompanyCodeController.text = '';
  1301. sendCompanyNameController.text = '';
  1302. sendPCA = '';
  1303. sendCompanyProvinceName = '';
  1304. sendCompanyProvinceCode = '';
  1305. sendCompanyCityName = '';
  1306. sendCompanyCityCode = '';
  1307. sendCompanyAreaName = '';
  1308. sendCompanyAreaCode = '';
  1309. bankCardController.text = '';
  1310. bankNameController.text = '';
  1311. openBankNameController.text = '';
  1312. openBankPhoneController.text = '';
  1313. sendCompanyAddressController.text = '';
  1314. receiptCompanyName = '';
  1315. receiptCompanyPhoneController.text= '';
  1316. receiptCompanyNameController.text = '';
  1317. receiptCompanyId = '0';
  1318. getPCA = '';
  1319. receiptCompanyProvinceName = '';
  1320. receiptCompanyProvinceCode = '';
  1321. receiptCompanyCityName = '';
  1322. receiptCompanyCityCode = '';
  1323. receiptCompanyAreaName = '';
  1324. receiptCompanyAreaCode = '';
  1325. receiptCompanyAddressController.text = '';
  1326. goods = ''; //商品名称 不能为空
  1327. goodsQuantity = 1; //商品数量 不能为空
  1328. goodsPaymentMethod = 2; //付款方式 1,现付 2 到付
  1329. goodsWeight = 0.0; //商品重量
  1330. goodsPriceProtection = 0.0; //商品保价
  1331. goodsAgencyFund = 0.0; //商品代收款
  1332. goodsFreight = 0.0; //商品运费 不能为空
  1333. memo = ''; //备注
  1334. goodsController.text = '';
  1335. goodsQuantityController.text = '';
  1336. goodsFreightController.text = '';
  1337. goodsAgencyFundController.text = '';
  1338. goodsPriceProtectionController.text = '';
  1339. goodsWeightController.text = '';
  1340. memoController.text = '';
  1341. //---------------------------------------------
  1342. });
  1343. }
  1344. },
  1345. );
  1346. });
  1347. } else {
  1348. setState(() {
  1349. submitStatus = true;
  1350. });
  1351. }
  1352. });
  1353. });
  1354. }
  1355. showError(String str) {
  1356. showDialog < Null > (
  1357. context: context, //BuildContext对象
  1358. barrierDismissible: false,
  1359. builder: (BuildContext context) {
  1360. return MyAlertDialog( //调用对话框
  1361. text: str, childCallback: (val) {},
  1362. );
  1363. });
  1364. }
  1365. showLineModal(List<CompanyOfLineList> list){
  1366. showDialog < Null > (
  1367. context: context, //BuildContext对象
  1368. barrierDismissible: false,
  1369. builder: (BuildContext context) {
  1370. return ShowLineModal(
  1371. lineList: list, childCallback: (val) {
  1372. lineId = val;
  1373. checkedLine = true;
  1374. // goodsNameAccurate(stationId,goodsController.text,lineId).then((resp){
  1375. // if(isNotError(context, resp) && this.mounted){
  1376. // if(resp.data['data']['goods']!=null){
  1377. // GoodsPriceList tempObj = GoodsPriceObjAccurate.fromJson(resp.data).data;
  1378. // setState(() {
  1379. // goods=tempObj.goods;
  1380. // goodsController.text = tempObj.goods;
  1381. // goodsFreight = tempObj.price/100;
  1382. // goodsFreightController.text = (tempObj.price/100).toString();
  1383. // });
  1384. // }
  1385. // }
  1386. // });
  1387. },
  1388. );
  1389. });
  1390. }
  1391. Future getCity(context) async {
  1392. Result result = await CityPickers.showCityPicker(
  1393. context: context,
  1394. );
  1395. return result;
  1396. }
  1397. Widget _tipItem(LikePhoneList obj) {
  1398. return Container(
  1399. child: Column(
  1400. children: < Widget > [
  1401. InkWell(
  1402. child: Container(
  1403. height: ScreenUtil.getInstance().setHeight(89),
  1404. child: Center(
  1405. child: Row(
  1406. mainAxisAlignment: MainAxisAlignment.start,
  1407. children: < Widget > [
  1408. Padding(
  1409. padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(50)),
  1410. child: Text(obj.uzerPhone!=null?obj.uzerPhone:obj.companyPhone, style: TextStyle(
  1411. fontSize: ScreenUtil.getInstance().setSp(28),
  1412. color: likeWord=='phone'?Color.fromRGBO(74, 74, 74, 1):Color.fromRGBO(155, 155, 155, 1)
  1413. ), )
  1414. ),
  1415. SizedBox(
  1416. width: ScreenUtil.getInstance().setWidth(185),
  1417. child: Text(obj.companyCode,
  1418. textAlign: TextAlign.left,
  1419. style: TextStyle(
  1420. fontSize: ScreenUtil.getInstance().setSp(28),
  1421. color: likeWord=='code'?Color.fromRGBO(74, 74, 74, 1):Color.fromRGBO(155, 155, 155, 1)
  1422. ), ),
  1423. ),
  1424. Text(obj.companyName,
  1425. textAlign: TextAlign.left,
  1426. overflow: TextOverflow.ellipsis,
  1427. style: TextStyle(
  1428. fontSize: ScreenUtil.getInstance().setSp(28),
  1429. color: likeWord=='name'?Color.fromRGBO(74, 74, 74, 1):Color.fromRGBO(155, 155, 155, 1)
  1430. ),
  1431. )
  1432. ],
  1433. ),
  1434. ),
  1435. ),
  1436. onTap: () {
  1437. checkedCompanyInfo = true;
  1438. if (sendPhoneOrGetPhoneTab) {
  1439. sendCompanyPhone = obj.uzerPhone!=null?obj.uzerPhone:obj.companyPhone;
  1440. sendCompanyCode = obj.companyCode;
  1441. sendCompanyName = obj.companyName;
  1442. sendCompanyId = obj.id.toString();
  1443. sendCompanyPhoneController.text = obj.uzerPhone!=null?obj.uzerPhone:obj.companyPhone;
  1444. sendCompanyCodeController.text = obj.companyCode;
  1445. sendCompanyNameController.text = obj.companyName;
  1446. sendPCA = obj.provinceName + ' ' + obj.cityName + ' ' + ' ' + obj.areaName;
  1447. sendCompanyProvinceName = obj.provinceName;
  1448. sendCompanyProvinceCode = obj.provinceCode;
  1449. sendCompanyCityName = obj.cityName;
  1450. sendCompanyCityCode = obj.cityCode;
  1451. sendCompanyAreaName = obj.areaName;
  1452. sendCompanyAreaCode = obj.areaCode;
  1453. sendCompanyAddressController.text = obj.address;
  1454. bankCardController.text = obj.bankCard;
  1455. bankNameController.text = obj.bankName;
  1456. openBankNameController.text = obj.openBankName;
  1457. openBankPhoneController.text = obj.openBankPhone;
  1458. } else {
  1459. receiptCompanyPhone = obj.uzerPhone!=null?obj.uzerPhone:obj.companyPhone;
  1460. receiptCompanyName = obj.companyName;
  1461. receiptCompanyPhoneController.text = obj.uzerPhone!=null?obj.uzerPhone:obj.companyPhone;
  1462. receiptCompanyNameController.text = obj.companyName;
  1463. receiptCompanyId = obj.id.toString();
  1464. getLineOfCompanyId(receiptCompanyId).then((resp){
  1465. if(isNotError(context, resp) && this.mounted){
  1466. CompanyOfLine obj = CompanyOfLine.fromJson(resp.data);
  1467. setState(() {
  1468. lineList = obj.data;
  1469. });
  1470. }
  1471. });
  1472. getPCA = obj.provinceName + ' ' + obj.cityName + ' ' + ' ' + obj.areaName;
  1473. receiptCompanyProvinceName = obj.provinceName;
  1474. receiptCompanyProvinceCode = obj.provinceCode;
  1475. receiptCompanyCityName = obj.cityName;
  1476. receiptCompanyCityCode = obj.cityCode;
  1477. receiptCompanyAreaName = obj.areaName;
  1478. receiptCompanyAreaCode = obj.areaCode;
  1479. receiptCompanyAddressController.text = obj.address;
  1480. }
  1481. setState(() {
  1482. FocusScope.of(context).requestFocus(FocusNode());
  1483. tipStatus = true;
  1484. });
  1485. },
  1486. ),
  1487. _underLine()
  1488. ],
  1489. ),
  1490. );
  1491. }
  1492. Widget _goodsTipItem(GoodsPriceList obj){
  1493. return Container(
  1494. child: Column(
  1495. children: < Widget > [
  1496. InkWell(
  1497. child: Container(
  1498. height: ScreenUtil.getInstance().setHeight(89),
  1499. child: Center(
  1500. child: Row(
  1501. mainAxisAlignment: MainAxisAlignment.start,
  1502. children: < Widget > [
  1503. SizedBox(
  1504. width: ScreenUtil.getInstance().setWidth(250),
  1505. child: Text(obj.goods,
  1506. textAlign: TextAlign.left,
  1507. overflow: TextOverflow.ellipsis,
  1508. style: TextStyle(
  1509. fontSize: ScreenUtil.getInstance().setSp(28),
  1510. color: Color.fromRGBO(74, 74, 74, 1)
  1511. ), )
  1512. ),
  1513. SizedBox(
  1514. width: ScreenUtil.getInstance().setWidth(250),
  1515. child: Text(obj.lineName,
  1516. textAlign: TextAlign.left,
  1517. overflow: TextOverflow.ellipsis,
  1518. style: TextStyle(
  1519. fontSize: ScreenUtil.getInstance().setSp(28),
  1520. color: Color.fromRGBO(155, 155, 155, 1)
  1521. ), ),
  1522. ),
  1523. Text((obj.price/100).toString(),
  1524. textAlign: TextAlign.left,
  1525. overflow: TextOverflow.ellipsis,
  1526. style: TextStyle(
  1527. fontSize: ScreenUtil.getInstance().setSp(28),
  1528. color: Color.fromRGBO(155, 155, 155, 1)
  1529. ),
  1530. )
  1531. ],
  1532. ),
  1533. ),
  1534. ),
  1535. onTap: () {
  1536. checkedGoodsName = true;
  1537. setState(() {
  1538. FocusScope.of(context).requestFocus(FocusNode());
  1539. goodsTipStatus = true;
  1540. goods = obj.goods;
  1541. goodsController.text = obj.goods;
  1542. goodsFreight = (obj.price/100);
  1543. goodsFreightController.text = (obj.price/100).toString();
  1544. checkedGoodsName1 = true;
  1545. lineId = obj.lineId.toString();
  1546. });
  1547. },
  1548. ),
  1549. _underLine()
  1550. ],
  1551. ),
  1552. );
  1553. }
  1554. Widget _packageType(String key) {
  1555. return Padding(
  1556. padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
  1557. child: Column(
  1558. children: < Widget > [
  1559. InkWell(
  1560. child: SizedBox(
  1561. height: ScreenUtil.getInstance().setHeight(89),
  1562. child: Center(
  1563. child: Row(
  1564. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1565. children: < Widget > [
  1566. Expanded(
  1567. flex: 0,
  1568. child: Text(key, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
  1569. ),
  1570. Expanded(
  1571. child: Row(
  1572. mainAxisAlignment: MainAxisAlignment.end,
  1573. children: < Widget > [
  1574. //Text('${value}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(136, 136, 136, 1)), ),
  1575. SizedBox(
  1576. width: ScreenUtil.getInstance().setWidth(500),
  1577. child: Text(key == '包装类型' ? showTextGoodsPackage : key == '货物类型' ? showTextGoodsCategory : showTextPaymentMehod, textAlign: TextAlign.end, )
  1578. ),
  1579. Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
  1580. ],
  1581. )
  1582. )
  1583. ],
  1584. ),
  1585. )
  1586. ),
  1587. onTap: () {
  1588. showPickerModal(context, key);
  1589. },
  1590. ),
  1591. Expanded(
  1592. flex: 0,
  1593. child: _underLine()
  1594. )
  1595. ],
  1596. )
  1597. );
  1598. }
  1599. showPickerModal(BuildContext context, String type) {
  1600. List < dynamic > data = [];
  1601. if (type == '包装类型') {
  1602. for (int i = 0; i < goodsPackageList.length; i++) {
  1603. data.add(goodsPackageList[i].name);
  1604. }
  1605. } else if (type == '货物类型') {
  1606. for (int i = 0; i < goodsCateGoryList.length; i++) {
  1607. data.add(goodsCateGoryList[i].name);
  1608. }
  1609. } else if (type == '付款方式') {
  1610. data = ['现付', '到付'];
  1611. }
  1612. new Picker(
  1613. adapter: PickerDataAdapter < String > (pickerdata: data),
  1614. height: ScreenUtil.getInstance().setHeight(450),
  1615. confirmText: '确定',
  1616. confirmTextStyle: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(64, 98, 254, 1)),
  1617. cancelText: '取消',
  1618. cancelTextStyle: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(153, 153, 153, 1)),
  1619. headercolor: Color.fromRGBO(245, 245, 245, 1),
  1620. itemExtent: ScreenUtil.getInstance().setHeight(80),
  1621. textStyle: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(42, 42, 42, 1)),
  1622. changeToFirst: true,
  1623. hideHeader: false,
  1624. onConfirm: (Picker picker, List value) {
  1625. if (type == '包装类型') {
  1626. setState(() {
  1627. showTextGoodsPackage = goodsPackageList[value[0]].name;
  1628. goodsPackingId = goodsPackageList[value[0]].id;
  1629. });
  1630. } else if (type == '货物类型') {
  1631. setState(() {
  1632. showTextGoodsCategory = goodsCateGoryList[value[0]].name;
  1633. goodsCategoryId = goodsCateGoryList[value[0]].id;
  1634. });
  1635. } else if (type == '付款方式') {
  1636. setState(() {
  1637. showTextPaymentMehod = data[value[0]];
  1638. });
  1639. if (showTextPaymentMehod == '现付') {
  1640. goodsPaymentMethod = 1;
  1641. } else {
  1642. goodsPaymentMethod = 2;
  1643. }
  1644. }
  1645. }
  1646. ).showModal(this.context); //_scaffoldKey.currentState);
  1647. }
  1648. }