send_express_page.dart 71 KB

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