my_views.dart 120 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114
  1. import 'dart:convert';
  2. import 'dart:io';
  3. import 'dart:math' as math;
  4. import 'package:amap_flutter_base/amap_flutter_base.dart';
  5. import 'package:bbyyy/beans/ad_bean_entity.dart';
  6. import 'package:bbyyy/beans/android_app_version_bean_entity.dart';
  7. import 'package:bbyyy/beans/flow_bean_entity.dart';
  8. import 'package:bbyyy/beans/goods_bean_entity.dart';
  9. import 'package:bbyyy/beans/my_shop_bean_entity.dart';
  10. import 'package:bbyyy/beans/smart_order_bean_entity.dart';
  11. import 'package:bbyyy/beans/store_bean_entity.dart';
  12. import 'package:bbyyy/beans/user_bean_entity.dart';
  13. import 'package:bbyyy/beans/user_vp_bean_entity.dart';
  14. import 'package:bbyyy/https/MyDio.dart';
  15. import 'package:bbyyy/https/my_request.dart';
  16. import 'package:bbyyy/https/url.dart';
  17. import 'package:bbyyy/my_tools/easy_loading/easy_loading.dart';
  18. import 'package:bbyyy/my_tools/event_bus.dart';
  19. import 'package:bbyyy/my_tools/global.dart';
  20. import 'package:bbyyy/my_tools/my_colors.dart';
  21. import 'package:bbyyy/my_tools/my_cookie.dart';
  22. import 'package:bbyyy/my_tools/my_tools.dart';
  23. import 'package:bbyyy/my_tools/providers.dart';
  24. import 'package:bbyyy/my_tools/role_permissions.dart';
  25. import 'package:bbyyy/paegs/gang_page/application_details_page/application_details_page.dart';
  26. import 'package:bbyyy/paegs/gang_page/gang_in_page/gang_in_page.dart';
  27. import 'package:bbyyy/paegs/mine_page/order_page/apply_for_compensation_page/apply_for_compensation_page.dart';
  28. import 'package:bbyyy/paegs/mine_page/privacy_protection_props_page/privacy_protection_props_page.dart';
  29. import 'package:bbyyy/paegs/pay_page/order_information_page.dart';
  30. import 'package:bbyyy/paegs/product_details_page/product_details_page.dart';
  31. import 'package:bbyyy/paegs/release_goods_page/release_goods_page.dart';
  32. import 'package:cached_network_image/cached_network_image.dart';
  33. import 'package:dio/dio.dart';
  34. import 'package:flustars/flustars.dart';
  35. import 'package:flutter/cupertino.dart';
  36. import 'package:flutter/material.dart';
  37. import 'package:flutter/services.dart';
  38. import 'package:flutter_svg/svg.dart';
  39. import 'package:install_plugin/install_plugin.dart';
  40. import 'package:launch_review/launch_review.dart';
  41. import 'package:lpinyin/lpinyin.dart';
  42. import 'package:path_provider/path_provider.dart';
  43. import 'package:provider/provider.dart';
  44. import '../beans/complain_bean_entity.dart';
  45. import '../paegs/ad_details_page/ad_details_page.dart';
  46. import '../paegs/other_people_s_turnover_page/other_people_s_turnover_page.dart';
  47. import 'const.dart';
  48. import 'dims.dart';
  49. import 'map_util.dart';
  50. class MyViews {
  51. Widget netImg(String path, double h, double w,
  52. {String placeholder = 'images/svg/缺省头像.svg'}) {
  53. return CachedNetworkImage(
  54. imageUrl: path,
  55. height: h,
  56. width: w,
  57. fit: BoxFit.cover,
  58. placeholder: (context, url) => SvgPicture.asset(
  59. placeholder,
  60. fit: BoxFit.cover,
  61. height: h,
  62. width: w,
  63. ),
  64. errorWidget: (context, url, error) => SvgPicture.asset(
  65. placeholder,
  66. height: h,
  67. fit: BoxFit.cover,
  68. width: w,
  69. ),
  70. );
  71. }
  72. Widget myText(String content, Color color, double fs, {double height = 1.4}) {
  73. return Text(
  74. content,
  75. style: TextStyle(color: color, fontSize: fs, height: height),
  76. );
  77. }
  78. Widget myAppBar(String title, BuildContext context, List<Widget> rW) {
  79. return Container(
  80. color: Colors.white,
  81. child: SafeArea(
  82. bottom: false,
  83. child: Container(
  84. height: 45,
  85. width: double.infinity,
  86. color: Colors.white,
  87. child: Stack(
  88. children: [
  89. Text(
  90. title,
  91. style: TextStyle(color: MyColors.c333333, fontSize: 16),
  92. ),
  93. Positioned(
  94. left: 0,
  95. child: GestureDetector(
  96. onTap: () {
  97. Navigator.pop(context);
  98. },
  99. behavior: HitTestBehavior.translucent,
  100. child: Transform.rotate(
  101. angle: math.pi,
  102. child: Padding(
  103. padding: EdgeInsets.only(
  104. left: 16, right: 16, top: 8, bottom: 8),
  105. child: SvgPicture.asset(
  106. 'images/svg/箭头.svg',
  107. color: MyColors.c333333,
  108. height: 14,
  109. ),
  110. ),
  111. ),
  112. ),
  113. ),
  114. Row(
  115. children: rW,
  116. mainAxisAlignment: MainAxisAlignment.end,
  117. )
  118. ],
  119. alignment: Alignment.center,
  120. ),
  121. ),
  122. ),
  123. );
  124. }
  125. Widget getGoodsItem(var data, BuildContext context) {
  126. double w = (MediaQuery.of(context).size.width - 28 - 8) / 2;
  127. if (data is GoodsBeanDataData) {
  128. return GestureDetector(
  129. onTap: () {
  130. MyTools().toPage(context, ProductDetailsPage(data), (then) {});
  131. },
  132. behavior: HitTestBehavior.translucent,
  133. child: Card(
  134. elevation: 2,
  135. shadowColor: MyColors.c21333333,
  136. child: Column(
  137. children: [
  138. Padding(
  139. padding: EdgeInsets.only(left: 6, top: 6, bottom: 3),
  140. child: Row(
  141. children: [
  142. ClipRRect(
  143. child: MyViews().netImg(imgURL(data.shopPic), 20, 20),
  144. borderRadius: BorderRadius.all(Radius.circular(10)),
  145. ),
  146. Expanded(
  147. child: Container(
  148. margin: EdgeInsets.only(right: 5, left: 5),
  149. child: Text(
  150. data.shopName,
  151. style: TextStyle(
  152. color: MyColors.c999999,
  153. fontSize: 10,
  154. ),
  155. maxLines: 1,
  156. overflow: TextOverflow.ellipsis,
  157. softWrap: true,
  158. ),
  159. ),
  160. ),
  161. // Container(
  162. // decoration: BoxDecoration(
  163. // borderRadius: BorderRadius.only(
  164. // topLeft: Radius.circular(7),
  165. // bottomLeft: Radius.circular(7),
  166. // ),
  167. // color: data.onSale ? MyColors.cFF4233 : MyColors.cADD358,
  168. // ),
  169. // height: 14,
  170. // width: 28,
  171. // child: Text(
  172. // data.onSale ? '找货' : '有货',
  173. // style: TextStyle(color: Colors.white, fontSize: 8),
  174. // ),
  175. // alignment: Alignment.center,
  176. // padding: EdgeInsets.only(bottom: 0.8),
  177. // )
  178. ],
  179. ),
  180. ),
  181. MyViews().netImg(imgURL(data.coverPath), w, w,
  182. placeholder: 'images/svg/goodsDefImg.svg'),
  183. Container(
  184. padding: EdgeInsets.only(right: 6, left: 6, top: 8),
  185. child: Text(
  186. '${data.title}\n${data.description}',
  187. style: TextStyle(color: Colors.black, fontSize: 12),
  188. maxLines: 1,
  189. overflow: TextOverflow.ellipsis,
  190. softWrap: true,
  191. ),
  192. ),
  193. Container(
  194. padding: EdgeInsets.only(right: 6, left: 6, top: 7),
  195. child: Row(
  196. children: [
  197. Expanded(
  198. child: Text(
  199. '¥${data.price}',
  200. style: TextStyle(color: MyColors.cFF4233, fontSize: 15),
  201. ),
  202. ),
  203. Container(
  204. child: Text(
  205. '详情',
  206. style: TextStyle(color: MyColors.cFF4233, fontSize: 12),
  207. ),
  208. alignment: Alignment.center,
  209. padding: EdgeInsets.only(bottom: 2),
  210. decoration: BoxDecoration(
  211. border: Border.all(color: MyColors.cFF4233, width: 1),
  212. borderRadius: BorderRadius.all(Radius.circular(10))),
  213. height: 20,
  214. width: 50,
  215. )
  216. ],
  217. ),
  218. )
  219. ],
  220. crossAxisAlignment: CrossAxisAlignment.start,
  221. ),
  222. ),
  223. );
  224. } else if (data is AdBeanDataData) {
  225. return GestureDetector(
  226. onTap: () {
  227. MyTools().toPage(context, AdDetailsPage(data), (then) {});
  228. },
  229. behavior: HitTestBehavior.translucent,
  230. child: Card(
  231. elevation: 2,
  232. shadowColor: MyColors.c21333333,
  233. child: Column(
  234. children: [
  235. Padding(
  236. padding: EdgeInsets.only(left: 6, top: 6, bottom: 3),
  237. child: Row(
  238. children: [
  239. ClipRRect(
  240. child: Container(
  241. height: 20,
  242. ),
  243. borderRadius: BorderRadius.all(Radius.circular(10)),
  244. ),
  245. Expanded(
  246. child: Container(
  247. margin: EdgeInsets.only(right: 5, left: 5),
  248. child: Text(
  249. '',
  250. style: TextStyle(
  251. color: MyColors.c999999,
  252. fontSize: 10,
  253. ),
  254. maxLines: 1,
  255. overflow: TextOverflow.ellipsis,
  256. softWrap: true,
  257. ),
  258. ),
  259. ),
  260. ],
  261. ),
  262. ),
  263. MyViews().netImg(imgURL(data.coverPath), w, w,
  264. placeholder: 'images/svg/goodsDefImg.svg'),
  265. Container(
  266. padding: EdgeInsets.only(right: 6, left: 6, top: 8),
  267. child: Text(
  268. '${data.title}\n${data.description}',
  269. style: TextStyle(color: Colors.black, fontSize: 12),
  270. maxLines: 1,
  271. overflow: TextOverflow.ellipsis,
  272. softWrap: true,
  273. ),
  274. ),
  275. Container(
  276. padding: EdgeInsets.only(right: 6, top: 7),
  277. child: Row(
  278. children: [
  279. Container(
  280. decoration: BoxDecoration(
  281. color: MyColors.cADD358,
  282. borderRadius: BorderRadius.only(
  283. topRight: Radius.circular(8),
  284. bottomRight: Radius.circular(8),
  285. ),
  286. ),
  287. height: 16,
  288. width: 32,
  289. child: myText('推广', Colors.white, 9),
  290. alignment: Alignment.center,
  291. ),
  292. Container(
  293. child: Text(
  294. '详情',
  295. style: TextStyle(color: MyColors.cFF4233, fontSize: 12),
  296. ),
  297. alignment: Alignment.center,
  298. padding: EdgeInsets.only(bottom: 2),
  299. decoration: BoxDecoration(
  300. border: Border.all(color: MyColors.cFF4233, width: 1),
  301. borderRadius: BorderRadius.all(Radius.circular(10))),
  302. height: 20,
  303. width: 50,
  304. )
  305. ],
  306. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  307. ),
  308. )
  309. ],
  310. crossAxisAlignment: CrossAxisAlignment.start,
  311. ),
  312. ),
  313. );
  314. }
  315. }
  316. //我的订单、店铺订单item
  317. Widget getNoPayGoodsItem(SmartOrderBeanDataData data, BuildContext context,
  318. int ownerUid, int role) {
  319. return Container(
  320. margin: EdgeInsets.only(bottom: 10),
  321. decoration: BoxDecoration(
  322. color: Colors.white,
  323. borderRadius: BorderRadius.all(
  324. Radius.circular(4),
  325. ),
  326. ),
  327. child: Column(
  328. children: [
  329. Container(
  330. margin: EdgeInsets.only(left: 10, top: 16),
  331. child: Row(
  332. children: [
  333. ClipRRect(
  334. child: data.type == orderTypeAnnualFee || data.sellerUid == 0
  335. ? Image.asset(
  336. 'images/app_logo.png',
  337. height: 25,
  338. width: 25,
  339. )
  340. : MyViews().netImg(imgURL(data.sellerPic), 25, 25),
  341. borderRadius: BorderRadius.all(Radius.circular(12.5)),
  342. ),
  343. Container(
  344. margin: EdgeInsets.only(right: 5, left: 5),
  345. child: Text(
  346. data.type == orderTypeAnnualFee || data.sellerUid == 0
  347. ? '$appName'
  348. : '${data.sellerName}(${hideUID(data.sellerUid.toString())})',
  349. style: TextStyle(
  350. color: MyColors.c333333,
  351. fontSize: 14,
  352. ),
  353. maxLines: 1,
  354. overflow: TextOverflow.ellipsis,
  355. softWrap: true,
  356. ),
  357. ),
  358. ],
  359. ),
  360. ),
  361. Container(
  362. height: 0.5,
  363. color: MyColors.cE7E7E7,
  364. margin: EdgeInsets.only(left: 10, right: 10, top: 11, bottom: 11),
  365. ),
  366. orderStyle(data),
  367. Container(
  368. height: 0.5,
  369. color: MyColors.cE7E7E7,
  370. margin: EdgeInsets.only(left: 10, right: 10, top: 11, bottom: 11),
  371. ),
  372. Container(
  373. padding: EdgeInsets.only(left: 10, right: 10, bottom: 11),
  374. child: Row(
  375. children: [
  376. Text(
  377. '下单时间:${data.createTime}',
  378. style: TextStyle(color: MyColors.c666666, fontSize: 11),
  379. ),
  380. GestureDetector(
  381. onTap: () {
  382. if (data.buyerName.contains(MyCookie().getName()) ||
  383. MyCookie().getName().contains(data.buyerName) ||
  384. paymentAuthority(role)) {
  385. MyTools().toPage(
  386. context,
  387. OrderInformationPage(
  388. false,
  389. orderType: data.type,
  390. amount: data.amount,
  391. uid: data.uid,
  392. buyerUid: data.buyerUid,
  393. buyerName: data.buyerName,
  394. buyerPic: data.buyerPic,
  395. commodityCount: data.commodityCount,
  396. commodityTitle: data.commodityTitle,
  397. commodityCover: data.commodityCover,
  398. sellName: data.sellerName,
  399. sellPic: data.sellerPic,
  400. sellUid: data.sellerUid,
  401. ), (then) {
  402. if (then is int) {
  403. EventBus().emit('刷新未付订单');
  404. }
  405. });
  406. // showPayDialog(data, context, () {
  407. // Navigator.pop(context);
  408. //
  409. // // MyTools().toPage(context,
  410. // // PayPage(data.uid, false, data.amount), (then) {});
  411. // });
  412. } else {
  413. showToast('该订单与你无关');
  414. }
  415. },
  416. behavior: HitTestBehavior.translucent,
  417. child: Visibility(
  418. visible: data.state == orderStateUnpaid &&
  419. data.sellerUid != MyCookie().getUID(),
  420. child: Container(
  421. height: 26,
  422. width: 70,
  423. decoration: BoxDecoration(
  424. color: MyColors.cFF4233,
  425. borderRadius: BorderRadius.all(Radius.circular(13))),
  426. child: Text(
  427. '去支付',
  428. style: TextStyle(color: Colors.white, fontSize: 12),
  429. ),
  430. alignment: Alignment.center,
  431. padding: EdgeInsets.only(bottom: 2),
  432. ),
  433. ),
  434. )
  435. ],
  436. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  437. ),
  438. )
  439. ],
  440. ),
  441. );
  442. }
  443. Widget getMembersItem(MyShopBeanDataData data, BuildContext context) {
  444. return Column(
  445. children: [
  446. ClipRRect(
  447. child: netImg(imgURL(data.userPic), 40, 40),
  448. borderRadius: BorderRadius.all(Radius.circular(20)),
  449. ),
  450. Container(
  451. child: Text(
  452. data.userName,
  453. style: TextStyle(
  454. color: MyColors.c666666,
  455. fontSize: 12,
  456. ),
  457. maxLines: 1,
  458. overflow: TextOverflow.ellipsis,
  459. softWrap: true,
  460. ),
  461. margin: EdgeInsets.only(top: 8),
  462. )
  463. ],
  464. );
  465. }
  466. Widget getUserItem(UserBeanDataData data, BuildContext context) {
  467. return Container(
  468. padding: EdgeInsets.only(left: 15, right: 15),
  469. color: Colors.white,
  470. child: Column(
  471. children: [
  472. Container(
  473. margin: EdgeInsets.only(top: 8, bottom: 6),
  474. child: Row(
  475. children: [
  476. Container(
  477. margin: EdgeInsets.only(right: 6),
  478. child: ClipRRect(
  479. child: netImg(imgURL(data.picture), 42, 42),
  480. borderRadius: BorderRadius.circular(21),
  481. ),
  482. ),
  483. myText('${data.name} (${data.uid})', MyColors.c333333, 15),
  484. Expanded(
  485. child: Container(
  486. child: GestureDetector(
  487. onTap: () {
  488. EventBus().emit('addMember', data);
  489. },
  490. behavior: HitTestBehavior.translucent,
  491. child: Container(
  492. decoration: BoxDecoration(
  493. border: Border.all(color: MyColors.cFF4233, width: 1),
  494. borderRadius: BorderRadius.circular(14),
  495. ),
  496. height: 28,
  497. width: 70,
  498. child: myText('邀请入帮', MyColors.cFF4233, 12),
  499. alignment: Alignment.center,
  500. ),
  501. ),
  502. alignment: Alignment.centerRight,
  503. ),
  504. ),
  505. ],
  506. ),
  507. ),
  508. Container(
  509. height: 0.5,
  510. color: MyColors.cE7E7E7,
  511. )
  512. ],
  513. ),
  514. );
  515. }
  516. Widget getRemoveMemberItem(MyShopBeanDataData data, BuildContext context) {
  517. return Container(
  518. padding: EdgeInsets.only(left: 15, right: 15),
  519. color: Colors.white,
  520. child: Column(
  521. children: [
  522. Container(
  523. margin: EdgeInsets.only(top: 8, bottom: 6),
  524. child: Row(
  525. children: [
  526. Container(
  527. margin: EdgeInsets.only(right: 6),
  528. child: ClipRRect(
  529. child: netImg(imgURL(data.userPic), 42, 42),
  530. borderRadius: BorderRadius.circular(21),
  531. ),
  532. ),
  533. myText(
  534. '${data.userName} (${data.userUid})', MyColors.c333333, 15),
  535. Expanded(
  536. child: Container(
  537. child: GestureDetector(
  538. onTap: () {
  539. EventBus().emit('removeMember', data);
  540. },
  541. behavior: HitTestBehavior.translucent,
  542. child: Container(
  543. decoration: BoxDecoration(
  544. border: Border.all(color: MyColors.cFF4233, width: 1),
  545. borderRadius: BorderRadius.circular(14),
  546. ),
  547. height: 28,
  548. width: 70,
  549. child: myText('移除成员', MyColors.cFF4233, 12),
  550. alignment: Alignment.center,
  551. ),
  552. ),
  553. alignment: Alignment.centerRight,
  554. ),
  555. ),
  556. ],
  557. ),
  558. ),
  559. Container(
  560. height: 0.5,
  561. color: MyColors.cE7E7E7,
  562. )
  563. ],
  564. ),
  565. );
  566. }
  567. Widget getWalletItem(FlowBeanDataDataRecords flow, BuildContext context) {
  568. return Container(
  569. padding: EdgeInsets.symmetric(horizontal: 15),
  570. child: Column(
  571. children: [
  572. Row(
  573. children: [
  574. Container(
  575. child: ClipRRect(
  576. child: flow.traderUid == 0
  577. ? Image.asset(
  578. 'images/app_logo.png',
  579. width: 50,
  580. height: 50,
  581. )
  582. : MyViews().netImg(imgURL(flow.traderPic), 50, 50),
  583. borderRadius: BorderRadius.all(Radius.circular(25)),
  584. ),
  585. margin: EdgeInsets.only(right: 12),
  586. ),
  587. Expanded(
  588. child: Column(
  589. children: [
  590. Row(
  591. children: [
  592. Expanded(
  593. child: Text(
  594. flow.traderUid == 0 ? '平台' : flow.traderName,
  595. style: TextStyle(
  596. color: MyColors.c333333, fontSize: 14),
  597. maxLines: 1,
  598. overflow: TextOverflow.ellipsis,
  599. softWrap: true,
  600. ),
  601. ),
  602. Text(
  603. '${flow.paidAmount}',
  604. style: TextStyle(
  605. color: flow.paidAmount > 0
  606. ? MyColors.cff3646
  607. : MyColors.c237C02,
  608. fontSize: 15,
  609. fontWeight: FontWeight.bold),
  610. ),
  611. ],
  612. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  613. ),
  614. Row(
  615. children: [
  616. Text(
  617. flow.traderUid == 0
  618. ? ""
  619. : 'ID:${hideUID(flow.traderUid.toString())}',
  620. style:
  621. TextStyle(color: MyColors.c666666, fontSize: 12),
  622. ),
  623. Text(
  624. flow.payTime,
  625. style:
  626. TextStyle(color: MyColors.c666666, fontSize: 11),
  627. ),
  628. ],
  629. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  630. ),
  631. Row(
  632. children: [
  633. Text(
  634. '${flowType(flow.type)}',
  635. style:
  636. TextStyle(color: MyColors.c666666, fontSize: 12),
  637. ),
  638. Text(
  639. '${flow.userBalance}',
  640. style:
  641. TextStyle(color: MyColors.c666666, fontSize: 11),
  642. ),
  643. ],
  644. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  645. )
  646. ],
  647. ),
  648. )
  649. ],
  650. ),
  651. Container(
  652. color: MyColors.cE7E7E7,
  653. height: 0.5,
  654. margin: EdgeInsets.only(top: 14, bottom: 12),
  655. )
  656. ],
  657. ),
  658. );
  659. }
  660. Widget getMyGoodsItem(GoodsBeanDataData data, BuildContext context) {
  661. return Container(
  662. padding: EdgeInsets.only(left: 8, right: 8, bottom: 7, top: 18),
  663. decoration: BoxDecoration(
  664. color: Colors.white,
  665. borderRadius: BorderRadius.all(
  666. Radius.circular(4),
  667. ),
  668. ),
  669. margin: EdgeInsets.only(left: 10, right: 10, bottom: 10),
  670. child: Column(
  671. children: [
  672. Row(
  673. children: [
  674. ClipRRect(
  675. child: MyViews().netImg(imgURL(data.shopPic), 25, 25),
  676. borderRadius: BorderRadius.circular(12.5),
  677. ),
  678. Container(
  679. margin: EdgeInsets.only(left: 10),
  680. child: Text(
  681. data.shopName,
  682. style: TextStyle(color: MyColors.c333333, fontSize: 14),
  683. ),
  684. ),
  685. ],
  686. ),
  687. Container(
  688. height: 0.5,
  689. color: MyColors.cE7E7E7,
  690. margin: EdgeInsets.only(top: 14),
  691. ),
  692. Row(
  693. children: [
  694. Container(
  695. child: MyViews().netImg(imgURL(data.coverPath), 84, 82,
  696. placeholder: 'images/svg/goodsDefImg.svg'),
  697. margin: EdgeInsets.only(right: 8, top: 11, bottom: 11),
  698. ),
  699. Expanded(
  700. child: Container(
  701. child: Column(
  702. children: [
  703. Text(
  704. '${data.title}\n${data.description}',
  705. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  706. ),
  707. Row(
  708. children: [
  709. Text(
  710. '¥${data.price}',
  711. style: TextStyle(
  712. color: MyColors.cFF4233, fontSize: 12),
  713. ),
  714. Row(
  715. children: [
  716. GestureDetector(
  717. onTap: () {
  718. MyDio().update({
  719. 'key': 'commodity',
  720. 'values': {
  721. 'id': data.id,
  722. 'on_sale': !data.onSale,
  723. }
  724. }, (response, hasError) {
  725. if (!hasError) {
  726. EventBus().emit('updateProduct');
  727. }
  728. }, (error) {});
  729. },
  730. behavior: HitTestBehavior.translucent,
  731. child: Container(
  732. margin: EdgeInsets.only(left: 10),
  733. child: Text(
  734. data.onSale ? '下架' : '上架',
  735. style: TextStyle(
  736. color: data.onSale
  737. ? MyColors.c999999
  738. : MyColors.cFF4233,
  739. fontSize: 12),
  740. ),
  741. alignment: Alignment.center,
  742. decoration: BoxDecoration(
  743. color: Colors.white,
  744. borderRadius: BorderRadius.circular(13),
  745. border: Border.all(
  746. color: data.onSale
  747. ? MyColors.c999999
  748. : MyColors.cFF4233,
  749. width: 1)),
  750. height: 26,
  751. width: 70,
  752. ),
  753. ),
  754. GestureDetector(
  755. onTap: () {
  756. MyTools().toPage(
  757. context, ReleaseGoodsPage(data, ''),
  758. (then) {
  759. EventBus().emit('updateProduct');
  760. });
  761. },
  762. behavior: HitTestBehavior.translucent,
  763. child: Container(
  764. margin: EdgeInsets.only(left: 10),
  765. child: Text(
  766. '修改',
  767. style: TextStyle(
  768. color: Colors.white, fontSize: 12),
  769. ),
  770. alignment: Alignment.center,
  771. decoration: BoxDecoration(
  772. color: MyColors.cFF4233,
  773. borderRadius: BorderRadius.circular(13)),
  774. height: 26,
  775. width: 70,
  776. ),
  777. ),
  778. ],
  779. )
  780. ],
  781. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  782. )
  783. ],
  784. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  785. crossAxisAlignment: CrossAxisAlignment.start,
  786. ),
  787. height: 84,
  788. ),
  789. )
  790. ],
  791. ),
  792. ],
  793. ),
  794. );
  795. }
  796. Widget getCompensateItem(int index, BuildContext context) {
  797. return Container(
  798. decoration: BoxDecoration(
  799. color: Colors.white,
  800. borderRadius: BorderRadius.circular(4),
  801. ),
  802. margin: EdgeInsets.only(bottom: 10, left: 10, right: 10),
  803. padding: EdgeInsets.only(left: 8, right: 8, top: 14, bottom: 8),
  804. child: Column(
  805. children: [
  806. Row(
  807. children: [
  808. ClipRRect(
  809. child: MyViews().netImg('path', 25, 25),
  810. borderRadius: BorderRadius.circular(12.5),
  811. ),
  812. Container(
  813. child: Text(
  814. '一颗带货达人小星星(21548679)',
  815. style: TextStyle(color: MyColors.c333333, fontSize: 14),
  816. ),
  817. margin: EdgeInsets.only(left: 7),
  818. )
  819. ],
  820. ),
  821. Container(
  822. color: MyColors.cE7E7E7,
  823. height: 0.5,
  824. margin: EdgeInsets.only(top: 13, bottom: 9),
  825. ),
  826. Text(
  827. '所属货帮:全球顶尖带货达人团',
  828. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  829. ),
  830. Container(
  831. color: MyColors.cE7E7E7,
  832. height: 0.5,
  833. margin: EdgeInsets.only(top: 9, bottom: 9),
  834. ),
  835. Text(
  836. '订单金额:¥200.00',
  837. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  838. ),
  839. Container(
  840. color: MyColors.cE7E7E7,
  841. height: 0.5,
  842. margin: EdgeInsets.only(top: 9, bottom: 9),
  843. ),
  844. Text(
  845. '申请时间:2020-08-24 10:00:00',
  846. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  847. ),
  848. Container(
  849. color: MyColors.cE7E7E7,
  850. height: 0.5,
  851. margin: EdgeInsets.only(top: 9, bottom: 9),
  852. ),
  853. Text(
  854. '申请理由',
  855. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  856. ),
  857. Container(
  858. margin: EdgeInsets.only(top: 6),
  859. decoration: BoxDecoration(
  860. color: MyColors.c19FF4233,
  861. borderRadius: BorderRadius.circular(4)),
  862. constraints: BoxConstraints(minHeight: 60),
  863. child: Text(
  864. '产品质量有问题,希望获得一定的金额的赔付',
  865. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  866. ),
  867. padding: EdgeInsets.symmetric(vertical: 8, horizontal: 7),
  868. alignment: Alignment.topLeft,
  869. ),
  870. Container(
  871. color: MyColors.cE7E7E7,
  872. height: 0.5,
  873. margin: EdgeInsets.only(top: 9, bottom: 9),
  874. ),
  875. Row(
  876. children: [
  877. Text(
  878. '处理结果:',
  879. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  880. ),
  881. Text(
  882. '已处理',
  883. style: TextStyle(color: MyColors.c2B9C77, fontSize: 13),
  884. ),
  885. Text(
  886. '/',
  887. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  888. ),
  889. Text(
  890. '处理中',
  891. style: TextStyle(color: MyColors.c3D6CD5, fontSize: 13),
  892. ),
  893. Text(
  894. '/',
  895. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  896. ),
  897. Text(
  898. '已处理',
  899. style: TextStyle(color: MyColors.cFF4233, fontSize: 13),
  900. ),
  901. ],
  902. ),
  903. Container(
  904. margin: EdgeInsets.only(top: 6),
  905. decoration: BoxDecoration(
  906. color: MyColors.c19FF6700,
  907. borderRadius: BorderRadius.circular(4)),
  908. constraints: BoxConstraints(minHeight: 60),
  909. child: Text(
  910. '赔偿买家20元现金(赔付成功/失败结果 )',
  911. style: TextStyle(color: MyColors.cFF9249, fontSize: 13),
  912. ),
  913. padding: EdgeInsets.symmetric(vertical: 8, horizontal: 7),
  914. alignment: Alignment.topLeft,
  915. ),
  916. Container(
  917. color: MyColors.cE7E7E7,
  918. height: 0.5,
  919. margin: EdgeInsets.only(top: 9, bottom: 9),
  920. ),
  921. Text(
  922. '处理时间:2020-08-25 10:00:00',
  923. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  924. ),
  925. Container(
  926. color: MyColors.cE7E7E7,
  927. height: 0.5,
  928. margin: EdgeInsets.only(top: 9, bottom: 9),
  929. ),
  930. Row(
  931. children: [
  932. Container(
  933. decoration: BoxDecoration(
  934. border: Border.all(color: MyColors.cFF4233, width: 1),
  935. borderRadius: BorderRadius.circular(13)),
  936. height: 26,
  937. width: 70,
  938. child: Text(
  939. '查看申请',
  940. style: TextStyle(color: MyColors.cFF4233, fontSize: 12),
  941. ),
  942. alignment: Alignment.center,
  943. ),
  944. Container(
  945. margin: EdgeInsets.only(left: 10),
  946. decoration: BoxDecoration(
  947. color: MyColors.cFF4233,
  948. borderRadius: BorderRadius.circular(13)),
  949. height: 26,
  950. width: 70,
  951. child: Text(
  952. '查看订单',
  953. style: TextStyle(color: Colors.white, fontSize: 12),
  954. ),
  955. alignment: Alignment.center,
  956. )
  957. ],
  958. mainAxisAlignment: MainAxisAlignment.end,
  959. )
  960. ],
  961. crossAxisAlignment: CrossAxisAlignment.start,
  962. ),
  963. );
  964. }
  965. List<String> states = ['未支付', '已支付', '支付中', '支付失败', '已代付', '已取消'];
  966. //暂时没有用
  967. Widget getOrdersItem(SmartOrderBeanDataData data, BuildContext context) {
  968. return Container(
  969. decoration: BoxDecoration(
  970. color: Colors.white, borderRadius: BorderRadius.circular(4)),
  971. margin: EdgeInsets.only(bottom: 10, left: 10, right: 10),
  972. padding: EdgeInsets.only(left: 10, right: 10, top: 16, bottom: 7),
  973. child: Column(
  974. children: [
  975. Row(
  976. children: [
  977. Row(
  978. children: [
  979. ClipRRect(
  980. borderRadius: BorderRadius.circular(12.5),
  981. child: MyViews().netImg(imgURL(data.sellerPic), 25, 25),
  982. ),
  983. Container(
  984. margin: EdgeInsets.only(left: 7, right: 7),
  985. child: Text(
  986. data.sellerName,
  987. style: TextStyle(color: MyColors.c333333, fontSize: 14),
  988. ),
  989. ),
  990. // Container(
  991. // decoration: BoxDecoration(
  992. // border: Border.all(color: MyColors.cFF4233, width: 1),
  993. // borderRadius: BorderRadius.circular(2),
  994. // ),
  995. // width: 26,
  996. // height: 14,
  997. // child: Text(
  998. // '卖家',
  999. // style: TextStyle(
  1000. // color: MyColors.cFF4233, fontSize: 10, height: 1.0),
  1001. // ),
  1002. // alignment: Alignment.center,
  1003. // padding: EdgeInsets.only(top: 1),
  1004. // ),
  1005. ],
  1006. ),
  1007. Text(
  1008. states[data.state],
  1009. style: TextStyle(
  1010. color:
  1011. data.state == 1 ? MyColors.c2B9C77 : MyColors.cFF4233),
  1012. )
  1013. ],
  1014. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1015. ),
  1016. Container(
  1017. height: 0.5,
  1018. color: MyColors.cE7E7E7,
  1019. margin: EdgeInsets.only(top: 11, bottom: 11),
  1020. ),
  1021. data.type == orderTypeThirdPlatform
  1022. ? Container(
  1023. child: Row(
  1024. children: [
  1025. Container(
  1026. child: SvgPicture.asset(
  1027. 'images/svg/第三方.svg',
  1028. height: 45,
  1029. width: 45,
  1030. ),
  1031. margin: EdgeInsets.only(right: 8),
  1032. height: 60,
  1033. width: 60,
  1034. decoration: BoxDecoration(
  1035. border:
  1036. Border.all(color: MyColors.cEBEBEB, width: 1)),
  1037. alignment: Alignment.center,
  1038. ),
  1039. Expanded(
  1040. child: Container(
  1041. height: 60,
  1042. child: Column(
  1043. children: [
  1044. MyViews().myText(
  1045. '第三方订单(${data.uid})', MyColors.c333333, 13),
  1046. MyViews().myText('付款人:${data.buyerName}',
  1047. MyColors.c333333, 13),
  1048. Row(
  1049. children: [
  1050. MyViews().myText(
  1051. '¥${data.amount}', MyColors.cFF4233, 12),
  1052. MyViews().myText('x${data.commodityCount}',
  1053. MyColors.c999999, 12),
  1054. ],
  1055. mainAxisAlignment:
  1056. MainAxisAlignment.spaceBetween,
  1057. crossAxisAlignment: CrossAxisAlignment.start,
  1058. )
  1059. ],
  1060. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1061. crossAxisAlignment: CrossAxisAlignment.start,
  1062. ),
  1063. ),
  1064. ),
  1065. ],
  1066. ),
  1067. )
  1068. : Row(
  1069. children: [
  1070. Container(
  1071. child: MyViews().netImg(
  1072. imgURL(data.commodityCover), 84, 82,
  1073. placeholder: 'images/svg/goodsDefImg.svg'),
  1074. margin: EdgeInsets.only(right: 8),
  1075. ),
  1076. Expanded(
  1077. child: Container(
  1078. height: 84,
  1079. child: Column(
  1080. children: [
  1081. Text(
  1082. data.commodityTitle,
  1083. style: TextStyle(
  1084. color: MyColors.c333333, fontSize: 13),
  1085. maxLines: 2,
  1086. overflow: TextOverflow.ellipsis,
  1087. softWrap: true,
  1088. ),
  1089. Row(
  1090. children: [
  1091. Text(
  1092. '¥${data.amount}',
  1093. style: TextStyle(
  1094. color: MyColors.cFF4233, fontSize: 12),
  1095. ),
  1096. Text(
  1097. 'x1',
  1098. style: TextStyle(
  1099. color: MyColors.c999999, fontSize: 12),
  1100. )
  1101. ],
  1102. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1103. crossAxisAlignment: CrossAxisAlignment.start,
  1104. ),
  1105. Row(
  1106. children: [
  1107. ClipRRect(
  1108. borderRadius: BorderRadius.circular(12.5),
  1109. child: MyViews().netImg('path', 25, 25),
  1110. ),
  1111. Container(
  1112. child: Text(
  1113. data.buyerName,
  1114. style: TextStyle(
  1115. color: MyColors.c333333, fontSize: 13),
  1116. ),
  1117. margin: EdgeInsets.only(left: 8, right: 8),
  1118. ),
  1119. // Container(
  1120. // decoration: BoxDecoration(
  1121. // border: Border.all(
  1122. // color: MyColors.cFF4233, width: 1),
  1123. // borderRadius: BorderRadius.circular(2),
  1124. // ),
  1125. // width: 26,
  1126. // height: 14,
  1127. // child: Text(
  1128. // '买家',
  1129. // style: TextStyle(
  1130. // color: MyColors.cFF4233,
  1131. // fontSize: 10,
  1132. // height: 1.0),
  1133. // ),
  1134. // alignment: Alignment.center,
  1135. // padding: EdgeInsets.only(top: 1),
  1136. // ),
  1137. ],
  1138. ),
  1139. ],
  1140. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1141. ),
  1142. ),
  1143. )
  1144. ],
  1145. ),
  1146. Container(
  1147. height: 0.5,
  1148. color: MyColors.cE7E7E7,
  1149. margin: EdgeInsets.only(top: 11, bottom: 7),
  1150. ),
  1151. Row(
  1152. children: [
  1153. Text(
  1154. '下单时间:${data.createTime}',
  1155. style: TextStyle(color: MyColors.c666666, fontSize: 11),
  1156. ),
  1157. GestureDetector(
  1158. onTap: () {
  1159. if (data.state == 0) {
  1160. MyTools()
  1161. .toPage(context, ApplyForCompensationPage(), (then) {});
  1162. }
  1163. },
  1164. behavior: HitTestBehavior.translucent,
  1165. child: Container(
  1166. decoration: BoxDecoration(
  1167. color:
  1168. data.state == 1 ? MyColors.cFFCD00 : MyColors.cFF4233,
  1169. borderRadius: BorderRadius.circular(13),
  1170. ),
  1171. height: 26,
  1172. width: 70,
  1173. child: Text(
  1174. data.state == 1 ? '申请赔付' : '立即支付',
  1175. style: TextStyle(color: Colors.white, fontSize: 12),
  1176. ),
  1177. alignment: Alignment.center,
  1178. ),
  1179. )
  1180. ],
  1181. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1182. )
  1183. ],
  1184. ),
  1185. );
  1186. }
  1187. getPunishItem(BuildContext context, ComplainBeanDataData data) {
  1188. return Container(
  1189. decoration: BoxDecoration(
  1190. color: Colors.white,
  1191. borderRadius: BorderRadius.circular(4),
  1192. ),
  1193. margin: EdgeInsets.only(left: 10, right: 10, bottom: 10),
  1194. padding: EdgeInsets.only(left: 6, right: 6, bottom: 8, top: 12),
  1195. child: Column(
  1196. children: [
  1197. Row(
  1198. children: [
  1199. Row(
  1200. children: [
  1201. Container(
  1202. child: ClipRRect(
  1203. child: netImg(imgURL(data.shopPic), 25, 25),
  1204. borderRadius: BorderRadius.circular(12.5),
  1205. ),
  1206. margin: EdgeInsets.only(right: 7),
  1207. ),
  1208. myText('${data.shopName}(${data.shopUid})', MyColors.c333333,
  1209. 14),
  1210. ],
  1211. ),
  1212. myText(data.handled ? '已处理' : '正在处理',
  1213. data.handled ? MyColors.cADD358 : MyColors.c3D6CD5, 11)
  1214. ],
  1215. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1216. ),
  1217. Container(
  1218. decoration: BoxDecoration(
  1219. color: MyColors.c19FF4233,
  1220. borderRadius: BorderRadius.circular(4),
  1221. ),
  1222. constraints: BoxConstraints(minHeight: 97),
  1223. width: double.infinity,
  1224. padding: EdgeInsets.only(left: 11, right: 11, top: 8, bottom: 8),
  1225. margin: EdgeInsets.only(top: 12, bottom: 0),
  1226. child: Column(
  1227. children: [
  1228. myText(data.content, MyColors.c333333, 13),
  1229. Visibility(
  1230. visible: data.handled,
  1231. child: Container(
  1232. child: myText(
  1233. '处罚结果:${data.handleResult}', MyColors.c333333, 11),
  1234. margin: EdgeInsets.only(top: 3, bottom: 3),
  1235. ),
  1236. ),
  1237. myText('投诉时间:${data.complainTime}', MyColors.c333333, 11),
  1238. myText('处理时间:${data.handled ? data.handleTime : '正在处理'}',
  1239. MyColors.c333333, 11),
  1240. ],
  1241. crossAxisAlignment: CrossAxisAlignment.start,
  1242. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1243. ),
  1244. ),
  1245. ],
  1246. crossAxisAlignment: CrossAxisAlignment.start,
  1247. ),
  1248. );
  1249. }
  1250. Widget getApplicationItems(MyShopBeanDataData data, BuildContext context) {
  1251. return Container(
  1252. padding: EdgeInsets.only(left: 15, right: 15),
  1253. color: Colors.white,
  1254. child: Column(
  1255. children: [
  1256. Container(
  1257. margin: EdgeInsets.only(top: 8, bottom: 6),
  1258. child: Row(
  1259. children: [
  1260. Container(
  1261. margin: EdgeInsets.only(right: 6),
  1262. child: ClipRRect(
  1263. child: netImg(imgURL(data.userPic), 42, 42),
  1264. borderRadius: BorderRadius.circular(21),
  1265. ),
  1266. ),
  1267. Expanded(
  1268. child: Text(
  1269. '${data.userName} 申请加入你的货帮',
  1270. style: TextStyle(color: MyColors.c333333, fontSize: 15),
  1271. overflow: TextOverflow.ellipsis,
  1272. softWrap: true,
  1273. maxLines: 1,
  1274. ),
  1275. ),
  1276. Container(
  1277. child: GestureDetector(
  1278. onTap: () {
  1279. MyTools().toPage(context, ApplicationDetailsPage(data),
  1280. (then) {
  1281. EventBus().emit('申请页面返回');
  1282. });
  1283. },
  1284. behavior: HitTestBehavior.translucent,
  1285. child: Container(
  1286. decoration: BoxDecoration(
  1287. border: Border.all(color: MyColors.cFF4233, width: 1),
  1288. borderRadius: BorderRadius.circular(14),
  1289. ),
  1290. height: 28,
  1291. width: 70,
  1292. child: myText('前往验证', MyColors.cFF4233, 12),
  1293. alignment: Alignment.center,
  1294. ),
  1295. ),
  1296. alignment: Alignment.centerRight,
  1297. ),
  1298. ],
  1299. ),
  1300. ),
  1301. Container(
  1302. height: 0.5,
  1303. color: MyColors.cE7E7E7,
  1304. )
  1305. ],
  1306. ),
  1307. );
  1308. }
  1309. Widget getAddAssistantItems(
  1310. MyShopBeanDataData data, BuildContext context, bool checked) {
  1311. return Container(
  1312. padding: EdgeInsets.only(left: 15, right: 15),
  1313. color: Colors.white,
  1314. child: Column(
  1315. children: [
  1316. Container(
  1317. margin: EdgeInsets.only(top: 8, bottom: 6),
  1318. child: Row(
  1319. children: [
  1320. Checkbox(
  1321. activeColor: MyColors.cFF4233,
  1322. checkColor: Colors.white,
  1323. value: checked,
  1324. onChanged: (v) {
  1325. EventBus().emit('selectChanges', [data, v]);
  1326. }),
  1327. Container(
  1328. margin: EdgeInsets.only(right: 6),
  1329. child: ClipRRect(
  1330. child: netImg(imgURL(data.userPic), 42, 42),
  1331. borderRadius: BorderRadius.circular(21),
  1332. ),
  1333. ),
  1334. myText(
  1335. '${data.userName} (${data.userUid})', MyColors.c333333, 15),
  1336. // Expanded(
  1337. // child: Container(
  1338. // child: GestureDetector(
  1339. // onTap: () {},
  1340. // behavior: HitTestBehavior.translucent,
  1341. // child: Container(
  1342. // decoration: BoxDecoration(
  1343. // border: Border.all(color: MyColors.cFF4233, width: 1),
  1344. // borderRadius: BorderRadius.circular(14),
  1345. // ),
  1346. // height: 28,
  1347. // width: 70,
  1348. // child: myText('设为助手', MyColors.cFF4233, 12),
  1349. // alignment: Alignment.center,
  1350. // ),
  1351. // ),
  1352. // alignment: Alignment.centerRight,
  1353. // ),
  1354. // ),
  1355. ],
  1356. ),
  1357. ),
  1358. Container(
  1359. height: 0.5,
  1360. color: MyColors.cE7E7E7,
  1361. )
  1362. ],
  1363. ),
  1364. );
  1365. }
  1366. Widget getGangTransferItems(
  1367. MyShopBeanDataData data, BuildContext context, bool checked) {
  1368. return Container(
  1369. padding: EdgeInsets.only(left: 15, right: 15),
  1370. color: Colors.white,
  1371. child: Column(
  1372. children: [
  1373. Container(
  1374. margin: EdgeInsets.only(top: 8, bottom: 6),
  1375. child: Row(
  1376. children: [
  1377. Checkbox(
  1378. value: checked,
  1379. activeColor: MyColors.cFF4233,
  1380. checkColor: Colors.white,
  1381. onChanged: (v) {
  1382. EventBus().emit('GangTransfer', [data, v]);
  1383. }),
  1384. Container(
  1385. margin: EdgeInsets.only(right: 6),
  1386. child: ClipRRect(
  1387. child: netImg(imgURL(data.userPic), 42, 42),
  1388. borderRadius: BorderRadius.circular(21),
  1389. ),
  1390. ),
  1391. myText(
  1392. '${data.userName} (${data.userUid})', MyColors.c333333, 15),
  1393. // Expanded(
  1394. // child: Container(
  1395. // child: GestureDetector(
  1396. // onTap: () {},
  1397. // behavior: HitTestBehavior.translucent,
  1398. // child: Container(
  1399. // decoration: BoxDecoration(
  1400. // border: Border.all(color: MyColors.cFF4233, width: 1),
  1401. // borderRadius: BorderRadius.circular(14),
  1402. // ),
  1403. // height: 28,
  1404. // width: 70,
  1405. // child: myText('设为助手', MyColors.cFF4233, 12),
  1406. // alignment: Alignment.center,
  1407. // ),
  1408. // ),
  1409. // alignment: Alignment.centerRight,
  1410. // ),
  1411. // ),
  1412. ],
  1413. ),
  1414. ),
  1415. Container(
  1416. height: 0.5,
  1417. color: MyColors.cE7E7E7,
  1418. )
  1419. ],
  1420. ),
  1421. );
  1422. }
  1423. Widget getMemberListItems(
  1424. StoreBeanDataData store, MyShopBeanDataData data, BuildContext context) {
  1425. return Container(
  1426. padding: EdgeInsets.only(left: 15, right: 15),
  1427. color: Colors.white,
  1428. child: Column(
  1429. children: [
  1430. Container(
  1431. margin: EdgeInsets.only(top: 8, bottom: 6),
  1432. child: Row(
  1433. children: [
  1434. Row(
  1435. children: [
  1436. Container(
  1437. margin: EdgeInsets.only(right: 6),
  1438. child: ClipRRect(
  1439. child: netImg(imgURL(data.userPic), 42, 42),
  1440. borderRadius: BorderRadius.circular(21),
  1441. ),
  1442. ),
  1443. myText(
  1444. '${data.userName} ${store.ownerUid == MyCookie().getUID() ? '(${data.userUid})' : ''}',
  1445. MyColors.c333333,
  1446. 15),
  1447. Visibility(
  1448. visible: data.role != shopUserMember,
  1449. child: Container(
  1450. decoration: BoxDecoration(
  1451. color: MyColors.cFFCD00,
  1452. borderRadius: BorderRadius.circular(8)),
  1453. height: 16,
  1454. padding: EdgeInsets.symmetric(horizontal: 4),
  1455. child: myText(roleText(data.role), Colors.white, 10),
  1456. alignment: Alignment.center,
  1457. margin: EdgeInsets.only(left: 5),
  1458. ),
  1459. )
  1460. ],
  1461. ),
  1462. Visibility(
  1463. visible: data.role != shopUserOwner &&
  1464. data.userUid != MyCookie().getUID(),
  1465. child: GestureDetector(
  1466. child: Container(
  1467. margin: EdgeInsets.only(right: 10),
  1468. child: SvgPicture.asset(
  1469. 'images/svg/透视.svg',
  1470. height: 25,
  1471. width: 25,
  1472. ),
  1473. ),
  1474. onTap: () {
  1475. queryWhetherThereIsANumberOfPerspectives(
  1476. data, store, context);
  1477. },
  1478. behavior: HitTestBehavior.translucent,
  1479. ),
  1480. ),
  1481. ],
  1482. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1483. ),
  1484. ),
  1485. Container(
  1486. height: 0.5,
  1487. color: MyColors.cE7E7E7,
  1488. )
  1489. ],
  1490. ),
  1491. );
  1492. }
  1493. Widget getGangsItem(StoreBeanDataData data, BuildContext context) {
  1494. return Column(
  1495. children: [
  1496. Container(
  1497. margin: EdgeInsets.only(left: 15, right: 15, top: 7),
  1498. child: Row(
  1499. children: [
  1500. Container(
  1501. margin: EdgeInsets.only(right: 6),
  1502. child: ClipRRect(
  1503. child: netImg(imgURL(data.picture), 40, 40),
  1504. borderRadius: BorderRadius.circular(20),
  1505. ),
  1506. ),
  1507. myText('${data.name}(${data.uid})', MyColors.c333333, 15),
  1508. Expanded(
  1509. child: GestureDetector(
  1510. onTap: () {
  1511. submitApplication(data);
  1512. },
  1513. behavior: HitTestBehavior.translucent,
  1514. child: Container(
  1515. alignment: Alignment.centerRight,
  1516. child: Container(
  1517. decoration: BoxDecoration(
  1518. border: Border.all(color: MyColors.cFF4233, width: 1),
  1519. borderRadius: BorderRadius.circular(14)),
  1520. height: 28,
  1521. width: 70,
  1522. child: myText('申请加入', MyColors.cFF4233, 12),
  1523. alignment: Alignment.center,
  1524. ),
  1525. ),
  1526. ),
  1527. )
  1528. ],
  1529. ),
  1530. ),
  1531. Container(
  1532. height: 0.5,
  1533. color: MyColors.cF7F7F7,
  1534. margin: EdgeInsets.only(left: 15, right: 15, top: 6),
  1535. )
  1536. ],
  1537. );
  1538. }
  1539. orderStyle(SmartOrderBeanDataData data) {
  1540. if (data.type == orderTypeThirdPlatform) {
  1541. //第三方平台订单
  1542. return Container(
  1543. margin: EdgeInsets.symmetric(horizontal: 12),
  1544. child: Row(
  1545. children: [
  1546. Container(
  1547. child: SvgPicture.asset(
  1548. 'images/svg/第三方.svg',
  1549. height: 45,
  1550. width: 45,
  1551. ),
  1552. margin: EdgeInsets.only(right: 8),
  1553. height: 60,
  1554. width: 60,
  1555. decoration: BoxDecoration(
  1556. border: Border.all(color: MyColors.cEBEBEB, width: 1)),
  1557. alignment: Alignment.center,
  1558. ),
  1559. Expanded(
  1560. child: Container(
  1561. height: 60,
  1562. child: Column(
  1563. children: [
  1564. MyViews()
  1565. .myText('第三方订单(${data.uid})', MyColors.c333333, 13),
  1566. MyViews()
  1567. .myText('付款人:${data.buyerName}', MyColors.c333333, 13),
  1568. Row(
  1569. children: [
  1570. MyViews()
  1571. .myText('¥${data.amount}', MyColors.cFF4233, 12),
  1572. MyViews().myText(
  1573. 'x${data.commodityCount}', MyColors.c999999, 12),
  1574. ],
  1575. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1576. )
  1577. ],
  1578. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1579. crossAxisAlignment: CrossAxisAlignment.start,
  1580. ),
  1581. ),
  1582. ),
  1583. ],
  1584. ),
  1585. );
  1586. } else if (data.type == orderTypeAnnualFee) {
  1587. //平台年费
  1588. return Container(
  1589. margin: EdgeInsets.symmetric(horizontal: 12),
  1590. child: Row(
  1591. children: [
  1592. Container(
  1593. child: Image.asset(
  1594. 'images/app_logo.png',
  1595. height: 45,
  1596. width: 45,
  1597. ),
  1598. margin: EdgeInsets.only(right: 8),
  1599. height: 60,
  1600. width: 60,
  1601. decoration: BoxDecoration(
  1602. border: Border.all(color: MyColors.cEBEBEB, width: 1)),
  1603. alignment: Alignment.center,
  1604. ),
  1605. Expanded(
  1606. child: Container(
  1607. height: 60,
  1608. child: Column(
  1609. children: [
  1610. MyViews().myText('平台年费', MyColors.c333333, 13),
  1611. MyViews().myText(
  1612. '付款人:${data.buyerName}(${hideUID(data.buyerUid.toString())})',
  1613. MyColors.c333333,
  1614. 13),
  1615. Row(
  1616. children: [
  1617. MyViews()
  1618. .myText('¥${data.amount}', MyColors.cFF4233, 12),
  1619. MyViews().myText(
  1620. 'x${data.commodityCount}', MyColors.c999999, 12),
  1621. ],
  1622. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1623. )
  1624. ],
  1625. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1626. crossAxisAlignment: CrossAxisAlignment.start,
  1627. ),
  1628. ),
  1629. ),
  1630. ],
  1631. ),
  1632. );
  1633. } else if (data.type == orderTypeAdvertise) {
  1634. //平台广告订单
  1635. return Container(
  1636. margin: EdgeInsets.symmetric(horizontal: 12),
  1637. child: Row(
  1638. children: [
  1639. Container(
  1640. child: SvgPicture.asset(
  1641. 'images/svg/平台广告.svg',
  1642. height: 45,
  1643. width: 45,
  1644. ),
  1645. margin: EdgeInsets.only(right: 8),
  1646. height: 60,
  1647. width: 60,
  1648. decoration: BoxDecoration(
  1649. border: Border.all(color: MyColors.cEBEBEB, width: 1)),
  1650. alignment: Alignment.center,
  1651. ),
  1652. Expanded(
  1653. child: Container(
  1654. height: 60,
  1655. child: Column(
  1656. children: [
  1657. MyViews().myText('广告费', MyColors.c333333, 13),
  1658. MyViews().myText(
  1659. '付款人:${data.buyerName}(${hideUID(data.buyerUid.toString())})',
  1660. MyColors.c333333,
  1661. 13),
  1662. Row(
  1663. children: [
  1664. MyViews()
  1665. .myText('¥${data.amount}', MyColors.cFF4233, 12),
  1666. MyViews().myText(
  1667. 'x${data.commodityCount}', MyColors.c999999, 12),
  1668. ],
  1669. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1670. )
  1671. ],
  1672. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1673. crossAxisAlignment: CrossAxisAlignment.start,
  1674. ),
  1675. ),
  1676. ),
  1677. ],
  1678. ),
  1679. );
  1680. } else if (data.type == orderTypeCommodity) {
  1681. //商品订单
  1682. return Container(
  1683. margin: EdgeInsets.only(left: 10, right: 10),
  1684. child: Row(
  1685. children: [
  1686. MyViews().netImg(imgURL(data.commodityCover), 60, 60,
  1687. placeholder: 'images/svg/goodsDefImg.svg'),
  1688. Expanded(
  1689. child: Container(
  1690. padding: EdgeInsets.only(left: 8),
  1691. height: 60,
  1692. child: Column(
  1693. children: [
  1694. Text(
  1695. '${data.commodityTitle}',
  1696. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  1697. maxLines: 2,
  1698. overflow: TextOverflow.ellipsis,
  1699. softWrap: true,
  1700. ),
  1701. Row(
  1702. children: [
  1703. Text(
  1704. '¥${double.parse('${data.amount}').toStringAsFixed(2)}',
  1705. style:
  1706. TextStyle(color: MyColors.cFF4233, fontSize: 12),
  1707. ),
  1708. Text(
  1709. 'x${data.commodityCount}',
  1710. style:
  1711. TextStyle(color: MyColors.c999999, fontSize: 12),
  1712. ),
  1713. ],
  1714. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1715. crossAxisAlignment: CrossAxisAlignment.start,
  1716. ),
  1717. Row(
  1718. children: [
  1719. ClipRRect(
  1720. child: MyViews()
  1721. .netImg(imgURL('${data.buyerPic}'), 25, 25),
  1722. borderRadius: BorderRadius.all(Radius.circular(12.5)),
  1723. ),
  1724. Container(
  1725. margin: EdgeInsets.only(right: 5, left: 5),
  1726. child: Text(
  1727. '${data.buyerName}(${hideUID(data.buyerUid.toString())})',
  1728. style: TextStyle(
  1729. color: MyColors.c333333,
  1730. fontSize: 13,
  1731. ),
  1732. maxLines: 1,
  1733. overflow: TextOverflow.ellipsis,
  1734. softWrap: true,
  1735. ),
  1736. ),
  1737. // Container(
  1738. // decoration: BoxDecoration(
  1739. // border:
  1740. // Border.all(color: MyColors.cFF4233, width: 1),
  1741. // borderRadius: BorderRadius.all(
  1742. // Radius.circular(2),
  1743. // ),
  1744. // ),
  1745. // child: Text(
  1746. // '买家',
  1747. // style: TextStyle(
  1748. // color: MyColors.cFF4233,
  1749. // fontSize: 10,
  1750. // ),
  1751. // ),
  1752. // alignment: Alignment.center,
  1753. // padding:
  1754. // EdgeInsets.only(bottom: 2, left: 3, right: 3),
  1755. // )
  1756. ],
  1757. ),
  1758. ],
  1759. crossAxisAlignment: CrossAxisAlignment.start,
  1760. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1761. ),
  1762. ),
  1763. )
  1764. ],
  1765. ),
  1766. );
  1767. } else if (data.type == orderTypeVirtualProduct) {
  1768. //虚拟物品
  1769. return Container(
  1770. margin: EdgeInsets.only(left: 10, right: 10),
  1771. child: Row(
  1772. children: [
  1773. Container(
  1774. child: SvgPicture.asset(
  1775. 'images/svg/虚拟物品.svg',
  1776. height: 45,
  1777. width: 45,
  1778. ),
  1779. margin: EdgeInsets.only(right: 8),
  1780. height: 60,
  1781. width: 60,
  1782. decoration: BoxDecoration(
  1783. border: Border.all(color: MyColors.cEBEBEB, width: 1)),
  1784. alignment: Alignment.center,
  1785. ),
  1786. Expanded(
  1787. child: Container(
  1788. padding: EdgeInsets.only(left: 8),
  1789. height: 60,
  1790. child: Column(
  1791. children: [
  1792. Text(
  1793. '虚拟道具',
  1794. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  1795. maxLines: 2,
  1796. overflow: TextOverflow.ellipsis,
  1797. softWrap: true,
  1798. ),
  1799. Row(
  1800. children: [
  1801. Text(
  1802. '¥${double.parse('${data.amount}').toStringAsFixed(2)}',
  1803. style:
  1804. TextStyle(color: MyColors.cFF4233, fontSize: 12),
  1805. ),
  1806. Text(
  1807. 'x${data.commodityCount}',
  1808. style:
  1809. TextStyle(color: MyColors.c999999, fontSize: 12),
  1810. ),
  1811. ],
  1812. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1813. crossAxisAlignment: CrossAxisAlignment.start,
  1814. ),
  1815. Row(
  1816. children: [
  1817. ClipRRect(
  1818. child: MyViews()
  1819. .netImg(imgURL('${data.buyerPic}'), 25, 25),
  1820. borderRadius: BorderRadius.all(Radius.circular(12.5)),
  1821. ),
  1822. Container(
  1823. margin: EdgeInsets.only(right: 5, left: 5),
  1824. child: Text(
  1825. '${data.buyerName}(${hideUID(data.buyerUid.toString())})',
  1826. style: TextStyle(
  1827. color: MyColors.c333333,
  1828. fontSize: 13,
  1829. ),
  1830. maxLines: 1,
  1831. overflow: TextOverflow.ellipsis,
  1832. softWrap: true,
  1833. ),
  1834. ),
  1835. // Container(
  1836. // decoration: BoxDecoration(
  1837. // border:
  1838. // Border.all(color: MyColors.cFF4233, width: 1),
  1839. // borderRadius: BorderRadius.all(
  1840. // Radius.circular(2),
  1841. // ),
  1842. // ),
  1843. // child: Text(
  1844. // '买家',
  1845. // style: TextStyle(
  1846. // color: MyColors.cFF4233,
  1847. // fontSize: 10,
  1848. // ),
  1849. // ),
  1850. // alignment: Alignment.center,
  1851. // padding:
  1852. // EdgeInsets.only(bottom: 2, left: 3, right: 3),
  1853. // )
  1854. ],
  1855. ),
  1856. ],
  1857. crossAxisAlignment: CrossAxisAlignment.start,
  1858. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1859. ),
  1860. ),
  1861. )
  1862. ],
  1863. ),
  1864. );
  1865. } else if (data.type == orderTypeScancodeAilyPay) {
  1866. //扫码收款
  1867. return Container(
  1868. margin: EdgeInsets.only(left: 10, right: 10),
  1869. child: Row(
  1870. children: [
  1871. Container(
  1872. child: Icon(
  1873. Icons.qr_code_outlined,
  1874. color: Colors.white,
  1875. ),
  1876. margin: EdgeInsets.only(right: 8),
  1877. height: 60,
  1878. width: 60,
  1879. decoration: BoxDecoration(
  1880. color: MyColors.cFF4233,
  1881. border: Border.all(color: MyColors.cEBEBEB, width: 1)),
  1882. alignment: Alignment.center,
  1883. ),
  1884. Expanded(
  1885. child: Container(
  1886. padding: EdgeInsets.only(left: 8),
  1887. height: 60,
  1888. child: Column(
  1889. children: [
  1890. Text(
  1891. '收款码收款',
  1892. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  1893. maxLines: 2,
  1894. overflow: TextOverflow.ellipsis,
  1895. softWrap: true,
  1896. ),
  1897. Text(
  1898. '¥${double.parse('${data.amount}').toStringAsFixed(2)}',
  1899. style: TextStyle(color: MyColors.cFF4233, fontSize: 12),
  1900. ),
  1901. ],
  1902. crossAxisAlignment: CrossAxisAlignment.start,
  1903. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1904. ),
  1905. ),
  1906. )
  1907. ],
  1908. ),
  1909. );
  1910. } else if (data.type == orderTypeOfflineTransfer ||
  1911. data.type == orderTypeOfflinePay) {
  1912. //线下付款
  1913. return Container(
  1914. margin: EdgeInsets.only(left: 10, right: 10),
  1915. child: Row(
  1916. children: [
  1917. Container(
  1918. child: SvgPicture.asset(
  1919. 'images/svg/线下付款.svg',
  1920. height: 45,
  1921. width: 45,
  1922. ),
  1923. margin: EdgeInsets.only(right: 8),
  1924. height: 60,
  1925. width: 60,
  1926. decoration: BoxDecoration(
  1927. border: Border.all(color: MyColors.cEBEBEB, width: 1)),
  1928. alignment: Alignment.center,
  1929. ),
  1930. Expanded(
  1931. child: Container(
  1932. padding: EdgeInsets.only(left: 8),
  1933. height: 60,
  1934. child: Column(
  1935. children: [
  1936. Text(
  1937. data.type == orderTypeOfflineTransfer ? '到店付款' : '线下收款',
  1938. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  1939. maxLines: 2,
  1940. overflow: TextOverflow.ellipsis,
  1941. softWrap: true,
  1942. ),
  1943. Row(
  1944. children: [
  1945. Text(
  1946. '¥${double.parse('${data.amount}').toStringAsFixed(2)}',
  1947. style:
  1948. TextStyle(color: MyColors.cFF4233, fontSize: 12),
  1949. ),
  1950. Text(
  1951. 'x${data.commodityCount}',
  1952. style:
  1953. TextStyle(color: MyColors.c999999, fontSize: 12),
  1954. ),
  1955. ],
  1956. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1957. crossAxisAlignment: CrossAxisAlignment.start,
  1958. ),
  1959. Row(
  1960. children: [
  1961. ClipRRect(
  1962. child: MyViews()
  1963. .netImg(imgURL('${data.buyerPic}'), 20, 20),
  1964. borderRadius: BorderRadius.all(Radius.circular(10)),
  1965. ),
  1966. Container(
  1967. margin: EdgeInsets.only(right: 5, left: 5),
  1968. child: Text(
  1969. '${data.buyerName}(${hideUID(data.buyerUid.toString())})',
  1970. style: TextStyle(
  1971. color: MyColors.c333333,
  1972. fontSize: 13,
  1973. ),
  1974. maxLines: 1,
  1975. overflow: TextOverflow.ellipsis,
  1976. softWrap: true,
  1977. ),
  1978. ),
  1979. // Container(
  1980. // decoration: BoxDecoration(
  1981. // border:
  1982. // Border.all(color: MyColors.cFF4233, width: 1),
  1983. // borderRadius: BorderRadius.all(
  1984. // Radius.circular(2),
  1985. // ),
  1986. // ),
  1987. // child: Text(
  1988. // '买家',
  1989. // style: TextStyle(
  1990. // color: MyColors.cFF4233,
  1991. // fontSize: 10,
  1992. // ),
  1993. // ),
  1994. // alignment: Alignment.center,
  1995. // padding:
  1996. // EdgeInsets.only(bottom: 2, left: 3, right: 3),
  1997. // )
  1998. ],
  1999. ),
  2000. ],
  2001. crossAxisAlignment: CrossAxisAlignment.start,
  2002. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2003. ),
  2004. ),
  2005. )
  2006. ],
  2007. ),
  2008. );
  2009. } else {
  2010. return Container(
  2011. margin: EdgeInsets.only(left: 10, right: 10),
  2012. child: Row(
  2013. children: [
  2014. MyViews().netImg(imgURL(data.commodityCover), 82, 84,
  2015. placeholder: 'images/svg/goodsDefImg.svg'),
  2016. Expanded(
  2017. child: Container(
  2018. padding: EdgeInsets.only(left: 8),
  2019. height: 82,
  2020. child: Column(
  2021. children: [
  2022. Text(
  2023. '${data.commodityTitle}',
  2024. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  2025. maxLines: 2,
  2026. overflow: TextOverflow.ellipsis,
  2027. softWrap: true,
  2028. ),
  2029. Row(
  2030. children: [
  2031. Text(
  2032. '¥${double.parse('${data.amount}').toStringAsFixed(2)}',
  2033. style:
  2034. TextStyle(color: MyColors.cFF4233, fontSize: 12),
  2035. ),
  2036. Text(
  2037. 'x${data.commodityCount}',
  2038. style:
  2039. TextStyle(color: MyColors.c999999, fontSize: 12),
  2040. ),
  2041. ],
  2042. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2043. crossAxisAlignment: CrossAxisAlignment.start,
  2044. ),
  2045. Row(
  2046. children: [
  2047. ClipRRect(
  2048. child: MyViews()
  2049. .netImg(imgURL('${data.buyerPic}'), 25, 25),
  2050. borderRadius: BorderRadius.all(Radius.circular(12.5)),
  2051. ),
  2052. Container(
  2053. margin: EdgeInsets.only(right: 5, left: 5),
  2054. child: Text(
  2055. '${data.buyerName}(${hideUID(data.buyerUid.toString())})',
  2056. style: TextStyle(
  2057. color: MyColors.c333333,
  2058. fontSize: 13,
  2059. ),
  2060. maxLines: 1,
  2061. overflow: TextOverflow.ellipsis,
  2062. softWrap: true,
  2063. ),
  2064. ),
  2065. // Container(
  2066. // decoration: BoxDecoration(
  2067. // border:
  2068. // Border.all(color: MyColors.cFF4233, width: 1),
  2069. // borderRadius: BorderRadius.all(
  2070. // Radius.circular(2),
  2071. // ),
  2072. // ),
  2073. // child: Text(
  2074. // '买家',
  2075. // style: TextStyle(
  2076. // color: MyColors.cFF4233,
  2077. // fontSize: 10,
  2078. // ),
  2079. // ),
  2080. // alignment: Alignment.center,
  2081. // padding:
  2082. // EdgeInsets.only(bottom: 2, left: 3, right: 3),
  2083. // )
  2084. ],
  2085. ),
  2086. ],
  2087. crossAxisAlignment: CrossAxisAlignment.start,
  2088. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2089. ),
  2090. ),
  2091. )
  2092. ],
  2093. ),
  2094. );
  2095. }
  2096. }
  2097. void queryWhetherThereIsANumberOfPerspectives(
  2098. MyShopBeanDataData data, StoreBeanDataData store, BuildContext context) {
  2099. MyDio().query({
  2100. "key": "user_vp",
  2101. "filters": {
  2102. "conditions": [
  2103. "user_uid == ${MyCookie().getUID()}",
  2104. "vp_key == $vpKeyXRay"
  2105. ]
  2106. },
  2107. "dims": userVpDims,
  2108. "paging": [1, 2000]
  2109. }, (response, hasError) {
  2110. UserVpBeanEntity entity =
  2111. UserVpBeanEntity().fromJson(json.decode(response.data.toString()));
  2112. if (entity.data.data.length != 0) {
  2113. MyTools().toPage(context, OtherPeopleSTurnoverPage(data), (then) {});
  2114. } else {
  2115. // showSimpleDialog('你还未获取透视道具或道具用完,请先购买次数再查看。', context, () {
  2116. // Navigator.pop(context);
  2117. // MyShopBeanDataData shop = MyShopBeanDataData();
  2118. // shop.shopUid = store.uid;
  2119. // shop.shopName = store.name;
  2120. // shop.shopPic = store.picture;
  2121. // MyTools().toPage(
  2122. // context, PrivacyProtectionPropsPage(shop, vpKeyXRay), (then) {});
  2123. // });
  2124. MyShopBeanDataData shop = MyShopBeanDataData();
  2125. shop.shopUid = store.uid;
  2126. shop.shopName = store.name;
  2127. shop.shopPic = store.picture;
  2128. MyTools().toPage(
  2129. context, PrivacyProtectionPropsPage(shop, vpKeyXRay), (then) {});
  2130. }
  2131. }, (error) {});
  2132. }
  2133. Widget pubShopItem(var data, BuildContext context) {
  2134. if (data is StoreBeanDataData) {
  2135. return GestureDetector(
  2136. onTap: () {
  2137. MyShopBeanDataData sBean = MyShopBeanDataData();
  2138. sBean.shopName = data.name;
  2139. sBean.shopPic = data.picture;
  2140. sBean.shopUid = data.uid;
  2141. sBean.ownerUid = data.ownerUid;
  2142. sBean.ownerName = data.ownerName;
  2143. sBean.ownerPic = data.ownerPic;
  2144. sBean.privateShop = data.private;
  2145. sBean.innerTrade = data.innerTrade;
  2146. sBean.shopState = data.state;
  2147. navigatorKey.currentState.push(
  2148. MaterialPageRoute(builder: (context) => GangInPage(sBean, null)));
  2149. },
  2150. behavior: HitTestBehavior.translucent,
  2151. child: Container(
  2152. decoration: BoxDecoration(
  2153. boxShadow: [
  2154. BoxShadow(
  2155. color: MyColors.c7FE1E1E1,
  2156. blurRadius: 5.0,
  2157. ),
  2158. ],
  2159. color: Colors.white,
  2160. borderRadius: BorderRadius.circular(4),
  2161. ),
  2162. margin: EdgeInsets.only(bottom: 6.5, left: 16, right: 16, top: 6.5),
  2163. child: Padding(
  2164. padding: const EdgeInsets.all(10),
  2165. child: Row(
  2166. children: [
  2167. ClipRRect(
  2168. child: MyViews().netImg(imgURL(data.picture), 70, 70,
  2169. placeholder: 'images/svg/goodsDefImg.svg'),
  2170. borderRadius: BorderRadius.circular(4),
  2171. ),
  2172. Expanded(
  2173. child: Container(
  2174. height: 70,
  2175. margin: EdgeInsets.only(left: 10),
  2176. child: Column(
  2177. children: [
  2178. myText(
  2179. '${data.name}(${data.uid})', MyColors.c333333, 14),
  2180. Text(
  2181. '货帮介绍:${data.introduction}',
  2182. style:
  2183. TextStyle(color: MyColors.c666666, fontSize: 11),
  2184. maxLines: 1,
  2185. overflow: TextOverflow.ellipsis,
  2186. softWrap: true,
  2187. ),
  2188. Row(
  2189. children: [
  2190. Expanded(
  2191. child: GestureDetector(
  2192. onTap: () {
  2193. if (data.latitude == 0) {
  2194. showToast('该店坐标有误');
  2195. return;
  2196. }
  2197. mapNavigationPopup(
  2198. data.latitude, data.longitude, context);
  2199. },
  2200. behavior: HitTestBehavior.translucent,
  2201. child: Row(
  2202. children: [
  2203. Icon(
  2204. Icons.location_on_outlined,
  2205. size: 15,
  2206. color: MyColors.c666666,
  2207. ),
  2208. Expanded(
  2209. child: Text(
  2210. '${data.address}',
  2211. style: TextStyle(
  2212. color: MyColors.c666666,
  2213. fontSize: 10),
  2214. maxLines: 1,
  2215. overflow: TextOverflow.ellipsis,
  2216. softWrap: true,
  2217. ),
  2218. ),
  2219. ],
  2220. ),
  2221. ),
  2222. ),
  2223. if (data.longitude != 0 &&
  2224. context.watch<MyLocationProvider>().myLatLng !=
  2225. null)
  2226. Text(
  2227. '${(AMapTools.distanceBetween(LatLng(data.latitude, data.longitude), LatLng(MyCookie().location.latitude, MyCookie().location.longitude)) / 1000).toStringAsFixed(3)}km',
  2228. style: TextStyle(
  2229. fontSize: 10, color: MyColors.c666666),
  2230. )
  2231. ],
  2232. ),
  2233. ],
  2234. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2235. crossAxisAlignment: CrossAxisAlignment.start,
  2236. ),
  2237. ),
  2238. )
  2239. ],
  2240. ),
  2241. ),
  2242. ),
  2243. );
  2244. } else if (data is AdBeanDataData) {
  2245. return GestureDetector(
  2246. onTap: () {
  2247. MyTools().toPage(context, AdDetailsPage(data), (then) {});
  2248. },
  2249. behavior: HitTestBehavior.translucent,
  2250. child: Container(
  2251. margin: EdgeInsets.only(bottom: 6.5, left: 16, right: 16, top: 6.5),
  2252. decoration: BoxDecoration(
  2253. boxShadow: [
  2254. BoxShadow(
  2255. color: MyColors.c7FE1E1E1,
  2256. blurRadius: 5.0,
  2257. ),
  2258. ],
  2259. color: Colors.white,
  2260. borderRadius: BorderRadius.circular(4),
  2261. ),
  2262. child: Padding(
  2263. padding: const EdgeInsets.only(top: 10, bottom: 10, left: 10),
  2264. child: Row(
  2265. children: [
  2266. ClipRRect(
  2267. child: MyViews().netImg(imgURL(data.coverPath), 70, 70,
  2268. placeholder: 'images/svg/goodsDefImg.svg'),
  2269. borderRadius: BorderRadius.circular(4),
  2270. ),
  2271. Expanded(
  2272. child: Container(
  2273. height: 70,
  2274. margin: EdgeInsets.only(left: 10),
  2275. child: Column(
  2276. children: [
  2277. Row(
  2278. children: [
  2279. Expanded(
  2280. child: myText(
  2281. '${data.title}', MyColors.c333333, 14)),
  2282. Container(
  2283. decoration: BoxDecoration(
  2284. color: MyColors.cADD358,
  2285. borderRadius: BorderRadius.only(
  2286. topLeft: Radius.circular(8),
  2287. bottomLeft: Radius.circular(8),
  2288. ),
  2289. ),
  2290. height: 16,
  2291. width: 32,
  2292. child: myText('推广', Colors.white, 9),
  2293. alignment: Alignment.center,
  2294. ),
  2295. ],
  2296. ),
  2297. Visibility(
  2298. visible: data.mobile.isNotEmpty,
  2299. child: Container(
  2300. margin: EdgeInsets.only(right: 10),
  2301. child: Text(
  2302. '联系电话:${data.mobile}',
  2303. style: TextStyle(
  2304. color: MyColors.c666666, fontSize: 11),
  2305. maxLines: 2,
  2306. overflow: TextOverflow.ellipsis,
  2307. softWrap: true,
  2308. ),
  2309. ),
  2310. ),
  2311. Container(
  2312. margin: EdgeInsets.only(right: 10),
  2313. child: Text(
  2314. '${data.description}',
  2315. style: TextStyle(
  2316. color: MyColors.c666666, fontSize: 11),
  2317. maxLines: 2,
  2318. overflow: TextOverflow.ellipsis,
  2319. softWrap: true,
  2320. ),
  2321. ),
  2322. ],
  2323. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2324. crossAxisAlignment: CrossAxisAlignment.start,
  2325. ),
  2326. ),
  2327. )
  2328. ],
  2329. ),
  2330. ),
  2331. ),
  2332. );
  2333. }
  2334. }
  2335. void mapNavigationPopup(
  2336. double latitude,
  2337. double longitude,
  2338. BuildContext context,
  2339. ) {
  2340. showModalBottomSheet(
  2341. isScrollControlled: true,
  2342. shape: RoundedRectangleBorder(
  2343. //圆角
  2344. borderRadius: BorderRadius.vertical(top: Radius.circular(15)),
  2345. ),
  2346. builder: (BuildContext context) {
  2347. return AnimatedPadding(
  2348. //showModalBottomSheet 键盘弹出时自适应
  2349. padding: MediaQuery.of(context).viewInsets, //边距(必要)
  2350. duration: const Duration(milliseconds: 100), //时常 (必要)
  2351. child: Container(
  2352. // height: 180,
  2353. constraints: BoxConstraints(
  2354. minHeight: 90, //设置最小高度(必要)
  2355. maxHeight:
  2356. MediaQuery.of(context).size.height / 1.5, //设置最大高度(必要)
  2357. ),
  2358. padding: EdgeInsets.only(top: 20, bottom: 20),
  2359. decoration: BoxDecoration(
  2360. borderRadius: BorderRadius.vertical(top: Radius.circular(15)),
  2361. color: Colors.white), //圆角
  2362. child: ListView(
  2363. padding: EdgeInsets.all(0),
  2364. shrinkWrap: true,
  2365. children: <Widget>[
  2366. Column(
  2367. mainAxisSize: MainAxisSize.min,
  2368. mainAxisAlignment: MainAxisAlignment.start,
  2369. crossAxisAlignment: CrossAxisAlignment.center,
  2370. children: <Widget>[
  2371. GestureDetector(
  2372. onTap: () {
  2373. MapUtil.gotoAMap(longitude, latitude);
  2374. },
  2375. behavior: HitTestBehavior.translucent,
  2376. child: Container(
  2377. height: 50,
  2378. child: Column(
  2379. children: [
  2380. Text(
  2381. '高德地图',
  2382. style: TextStyle(
  2383. color: MyColors.c333333, fontSize: 16),
  2384. ),
  2385. Container(
  2386. height: 0.5,
  2387. color: Colors.grey[200],
  2388. )
  2389. ],
  2390. mainAxisAlignment: MainAxisAlignment.spaceAround,
  2391. ),
  2392. ),
  2393. ),
  2394. GestureDetector(
  2395. onTap: () {
  2396. MapUtil.gotoBaiduMap(longitude, latitude);
  2397. },
  2398. behavior: HitTestBehavior.translucent,
  2399. child: Container(
  2400. height: 50,
  2401. child: Column(
  2402. children: [
  2403. Text(
  2404. '百度地图',
  2405. style: TextStyle(
  2406. color: MyColors.c333333, fontSize: 16),
  2407. ),
  2408. Container(
  2409. height: 0.5,
  2410. color: Colors.grey[200],
  2411. )
  2412. ],
  2413. mainAxisAlignment: MainAxisAlignment.spaceAround,
  2414. ),
  2415. ),
  2416. ),
  2417. GestureDetector(
  2418. onTap: () {
  2419. MapUtil.gotoTencentMap(longitude, latitude);
  2420. },
  2421. behavior: HitTestBehavior.translucent,
  2422. child: Container(
  2423. height: 50,
  2424. child: Column(
  2425. children: [
  2426. Text(
  2427. '腾讯地图',
  2428. style: TextStyle(
  2429. color: MyColors.c333333, fontSize: 16),
  2430. ),
  2431. Container(
  2432. height: 0.5,
  2433. color: Colors.grey[200],
  2434. )
  2435. ],
  2436. mainAxisAlignment: MainAxisAlignment.spaceAround,
  2437. ),
  2438. ),
  2439. ),
  2440. if (Platform.isIOS)
  2441. GestureDetector(
  2442. onTap: () {
  2443. MapUtil.gotoAppleMap(longitude, latitude);
  2444. },
  2445. behavior: HitTestBehavior.translucent,
  2446. child: Container(
  2447. height: 50,
  2448. child: Column(
  2449. children: [
  2450. Text(
  2451. '苹果地图',
  2452. style: TextStyle(
  2453. color: MyColors.c333333, fontSize: 16),
  2454. ),
  2455. Container(
  2456. height: 0.5,
  2457. color: Colors.grey[200],
  2458. )
  2459. ],
  2460. mainAxisAlignment: MainAxisAlignment.spaceAround,
  2461. ),
  2462. ),
  2463. ),
  2464. ],
  2465. )
  2466. ],
  2467. ),
  2468. ),
  2469. );
  2470. },
  2471. context: context);
  2472. }
  2473. }
  2474. Widget noData() {
  2475. return Center(
  2476. child: Column(
  2477. children: [
  2478. Container(
  2479. child: Image.asset('images/no_data.png'),
  2480. alignment: Alignment.center,
  2481. margin: EdgeInsets.only(top: 40),
  2482. ),
  2483. Container(
  2484. child: MyViews().myText('暂无信息', MyColors.c999999, 16),
  2485. height: 100,
  2486. alignment: Alignment.topCenter,
  2487. )
  2488. ],
  2489. mainAxisAlignment: MainAxisAlignment.center,
  2490. ),
  2491. );
  2492. }
  2493. showPayDialog(SmartOrderBeanDataData data, BuildContext context, onTap) {
  2494. showDialog(
  2495. context: context,
  2496. builder: (BuildContext context) {
  2497. return Material(
  2498. color: Colors.black12,
  2499. child: Center(
  2500. child: Container(
  2501. decoration: BoxDecoration(
  2502. borderRadius: BorderRadius.circular(16),
  2503. color: Colors.white,
  2504. ),
  2505. height: 207,
  2506. margin: EdgeInsets.symmetric(horizontal: 18),
  2507. padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
  2508. child: Column(
  2509. children: [
  2510. Row(
  2511. children: [
  2512. Container(
  2513. decoration: BoxDecoration(
  2514. border: Border.all(color: MyColors.cEBEBEB, width: 1),
  2515. ),
  2516. child: SvgPicture.asset(
  2517. 'images/svg/支付商品.svg',
  2518. height: 28,
  2519. width: 28,
  2520. ),
  2521. height: 45,
  2522. width: 45,
  2523. alignment: Alignment.center,
  2524. ),
  2525. Container(
  2526. height: 45,
  2527. child: Column(
  2528. children: [
  2529. MyViews().myText(
  2530. '确认支付订单(${data.uid})', MyColors.c333333, 13),
  2531. MyViews()
  2532. .myText('¥${data.amount}', MyColors.cFF4233, 12),
  2533. ],
  2534. crossAxisAlignment: CrossAxisAlignment.start,
  2535. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2536. ),
  2537. margin: EdgeInsets.only(left: 10),
  2538. )
  2539. ],
  2540. ),
  2541. Container(
  2542. height: 0.5,
  2543. color: MyColors.cE7E7E7,
  2544. ),
  2545. Row(
  2546. children: [
  2547. MyViews().myText('付款人:', MyColors.c333333, 13),
  2548. Container(
  2549. child: ClipRRect(
  2550. child: MyViews().netImg(imgURL(data.buyerPic), 23, 23),
  2551. borderRadius: BorderRadius.circular(23),
  2552. ),
  2553. margin: EdgeInsets.symmetric(horizontal: 8),
  2554. ),
  2555. MyViews().myText(
  2556. '${data.buyerName}${data.buyerUid == 0 ? '' : "(${hideUID(data.buyerUid.toString())})"}',
  2557. MyColors.c333333,
  2558. 13),
  2559. ],
  2560. ),
  2561. Container(
  2562. height: 0.5,
  2563. color: MyColors.cE7E7E7,
  2564. ),
  2565. Row(
  2566. children: [
  2567. MyViews().myText('收款人:', MyColors.c333333, 13),
  2568. Container(
  2569. child: ClipRRect(
  2570. child: MyViews().netImg(imgURL(data.sellerPic), 23, 23),
  2571. borderRadius: BorderRadius.circular(23),
  2572. ),
  2573. margin: EdgeInsets.symmetric(horizontal: 8),
  2574. ),
  2575. MyViews().myText(
  2576. '${data.sellerName}${data.sellerUid == 0 ? '' : '(${hideUID(data.sellerUid.toString())})'}',
  2577. MyColors.c333333,
  2578. 13),
  2579. ],
  2580. ),
  2581. Container(
  2582. height: 0.5,
  2583. color: MyColors.cE7E7E7,
  2584. ),
  2585. Container(
  2586. margin: EdgeInsets.symmetric(horizontal: 10),
  2587. child: Row(
  2588. children: [
  2589. Expanded(
  2590. child: GestureDetector(
  2591. onTap: () {
  2592. Navigator.pop(context);
  2593. },
  2594. behavior: HitTestBehavior.translucent,
  2595. child: Container(
  2596. decoration: BoxDecoration(
  2597. borderRadius: BorderRadius.only(
  2598. topLeft: Radius.circular(20),
  2599. bottomLeft: Radius.circular(20),
  2600. ),
  2601. border: Border.all(
  2602. color: MyColors.cFF4233, width: 1.1),
  2603. color: Colors.white),
  2604. child: MyViews().myText('取消', MyColors.cFF4233, 14),
  2605. height: 40,
  2606. alignment: Alignment.center,
  2607. ),
  2608. ),
  2609. ),
  2610. Expanded(
  2611. child: GestureDetector(
  2612. behavior: HitTestBehavior.translucent,
  2613. onTap: onTap,
  2614. child: Container(
  2615. decoration: BoxDecoration(
  2616. borderRadius: BorderRadius.only(
  2617. topRight: Radius.circular(20),
  2618. bottomRight: Radius.circular(20),
  2619. ),
  2620. color: MyColors.cFF4233),
  2621. height: 40,
  2622. child: MyViews().myText('确定', Colors.white, 14),
  2623. alignment: Alignment.center,
  2624. ),
  2625. ),
  2626. )
  2627. ],
  2628. ),
  2629. )
  2630. ],
  2631. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2632. ),
  2633. ),
  2634. ),
  2635. );
  2636. },
  2637. );
  2638. }
  2639. showSimpleDialog(String content, BuildContext context, onTap) {
  2640. showDialog(
  2641. context: context,
  2642. builder: (BuildContext context) {
  2643. return Material(
  2644. color: Colors.black12,
  2645. child: Center(
  2646. child: Container(
  2647. decoration: BoxDecoration(
  2648. borderRadius: BorderRadius.circular(16),
  2649. color: Colors.white,
  2650. ),
  2651. height: 180,
  2652. margin: EdgeInsets.symmetric(horizontal: 18),
  2653. padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
  2654. child: Column(
  2655. children: [
  2656. Expanded(
  2657. child: Center(
  2658. child: Container(
  2659. child: MyViews().myText(content, MyColors.c333333, 14),
  2660. margin: EdgeInsets.symmetric(horizontal: 20),
  2661. ),
  2662. ),
  2663. ),
  2664. Container(
  2665. height: 0.5,
  2666. color: MyColors.cE7E7E7,
  2667. margin: EdgeInsets.only(bottom: 12),
  2668. ),
  2669. Container(
  2670. margin: EdgeInsets.symmetric(horizontal: 10),
  2671. child: Row(
  2672. children: [
  2673. Expanded(
  2674. child: GestureDetector(
  2675. onTap: () {
  2676. Navigator.pop(context);
  2677. },
  2678. behavior: HitTestBehavior.translucent,
  2679. child: Container(
  2680. decoration: BoxDecoration(
  2681. borderRadius: BorderRadius.only(
  2682. topLeft: Radius.circular(20),
  2683. bottomLeft: Radius.circular(20),
  2684. ),
  2685. border: Border.all(
  2686. color: MyColors.cFF4233, width: 1.1),
  2687. color: Colors.white),
  2688. child: MyViews().myText('取消', MyColors.cFF4233, 14),
  2689. height: 40,
  2690. alignment: Alignment.center,
  2691. ),
  2692. ),
  2693. ),
  2694. Expanded(
  2695. child: GestureDetector(
  2696. behavior: HitTestBehavior.translucent,
  2697. onTap: onTap,
  2698. child: Container(
  2699. decoration: BoxDecoration(
  2700. borderRadius: BorderRadius.only(
  2701. topRight: Radius.circular(20),
  2702. bottomRight: Radius.circular(20),
  2703. ),
  2704. color: MyColors.cFF4233),
  2705. height: 40,
  2706. child: MyViews().myText('确定', Colors.white, 14),
  2707. alignment: Alignment.center,
  2708. ),
  2709. ),
  2710. )
  2711. ],
  2712. ),
  2713. )
  2714. ],
  2715. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2716. ),
  2717. ),
  2718. ),
  2719. );
  2720. },
  2721. );
  2722. }
  2723. updateDialog(AndroidAppVersionBeanData data, BuildContext context) {
  2724. bool startUpdate = false;
  2725. bool downloadCompleted = false;
  2726. String filePath = '';
  2727. int p = 0;
  2728. EventBus().off('允许安装');
  2729. EventBus().off('更新进度条');
  2730. showDialog(
  2731. context: context,
  2732. builder: (BuildContext context) {
  2733. return WillPopScope(
  2734. onWillPop: () {
  2735. return Future.value(false);
  2736. },
  2737. child: StreamBuilder<Object>(builder: (context, snapshot) {
  2738. return Material(
  2739. color: Colors.black12,
  2740. child: Center(
  2741. child: Container(
  2742. decoration: BoxDecoration(
  2743. borderRadius: BorderRadius.circular(16),
  2744. color: Colors.white,
  2745. ),
  2746. height: 165,
  2747. margin: EdgeInsets.symmetric(horizontal: 18),
  2748. padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
  2749. child: StatefulBuilder(
  2750. builder: (BuildContext context,
  2751. void Function(void Function()) setState) {
  2752. EventBus().on('更新进度条', (arg) {
  2753. p = arg;
  2754. setState(() {});
  2755. });
  2756. EventBus().on('允许安装', (arg) {
  2757. downloadCompleted = true;
  2758. filePath = arg;
  2759. setState(() {});
  2760. });
  2761. if (startUpdate) {
  2762. return Column(
  2763. children: [
  2764. Container(
  2765. height: 88,
  2766. child: Column(
  2767. children: [
  2768. Container(
  2769. child: MyViews()
  2770. .myText('更新中...', MyColors.c333333, 16),
  2771. ),
  2772. SizedBox(
  2773. height: 15,
  2774. child: ClipRRect(
  2775. borderRadius: BorderRadius.circular(7.5),
  2776. child: LinearProgressIndicator(
  2777. backgroundColor: Colors.grey[200],
  2778. valueColor: AlwaysStoppedAnimation(
  2779. MyColors.cFF4233),
  2780. value: downloadCompleted
  2781. ? 1
  2782. : NumUtil.divide(p, 100),
  2783. ),
  2784. ),
  2785. ),
  2786. ],
  2787. mainAxisAlignment: MainAxisAlignment.spaceAround,
  2788. ),
  2789. ),
  2790. Container(
  2791. height: 0.5,
  2792. color: MyColors.cE7E7E7,
  2793. margin: EdgeInsets.only(bottom: 12),
  2794. ),
  2795. Container(
  2796. margin: EdgeInsets.symmetric(horizontal: 20),
  2797. child: GestureDetector(
  2798. behavior: HitTestBehavior.translucent,
  2799. onTap: () {
  2800. if (downloadCompleted) {
  2801. installApk(filePath);
  2802. }
  2803. },
  2804. child: Container(
  2805. decoration: BoxDecoration(
  2806. borderRadius: BorderRadius.circular(20),
  2807. color: downloadCompleted
  2808. ? MyColors.cFF4233
  2809. : MyColors.c999999),
  2810. height: 40,
  2811. child: MyViews().myText('安装', Colors.white, 14),
  2812. alignment: Alignment.center,
  2813. ),
  2814. ),
  2815. )
  2816. ],
  2817. mainAxisAlignment: MainAxisAlignment.center,
  2818. );
  2819. } else {
  2820. return Column(
  2821. children: [
  2822. Container(
  2823. height: 88,
  2824. child: MyViews().myText(
  2825. data.force
  2826. ? '检查到新版本(v${data.version}),本次属于强制更新,如不同意更新,将退出APP'
  2827. : '检查到新版本(v${data.version}),请问是否更新',
  2828. MyColors.c333333,
  2829. 14),
  2830. margin: EdgeInsets.symmetric(horizontal: 20),
  2831. alignment: Alignment.center,
  2832. ),
  2833. Container(
  2834. height: 0.5,
  2835. color: MyColors.cE7E7E7,
  2836. margin: EdgeInsets.only(bottom: 12),
  2837. ),
  2838. data.force
  2839. ? Expanded(
  2840. child: GestureDetector(
  2841. behavior: HitTestBehavior.translucent,
  2842. onTap: () {
  2843. if (Platform.isAndroid) {
  2844. downloadAPK(data, context);
  2845. startUpdate = true;
  2846. setState(() {});
  2847. } else if (Platform.isIOS) {
  2848. LaunchReview.launch(
  2849. writeReview: false,
  2850. iOSAppId: appStoreID);
  2851. } else {
  2852. Navigator.pop(context);
  2853. }
  2854. },
  2855. child: Container(
  2856. margin:
  2857. EdgeInsets.symmetric(horizontal: 10),
  2858. decoration: BoxDecoration(
  2859. borderRadius:
  2860. BorderRadius.circular(20),
  2861. color: MyColors.cFF4233),
  2862. height: 40,
  2863. child: MyViews()
  2864. .myText('立即更新', Colors.white, 14),
  2865. alignment: Alignment.center,
  2866. ),
  2867. ),
  2868. )
  2869. : Row(
  2870. children: [
  2871. Expanded(
  2872. child: GestureDetector(
  2873. onTap: () {
  2874. if (data.force) {
  2875. EventBus().off('允许安装');
  2876. EventBus().off('更新进度条');
  2877. SystemNavigator.pop();
  2878. } else {
  2879. EventBus().off('允许安装');
  2880. EventBus().off('更新进度条');
  2881. Navigator.pop(context);
  2882. }
  2883. },
  2884. behavior: HitTestBehavior.translucent,
  2885. child: Container(
  2886. margin: EdgeInsets.only(left: 10),
  2887. decoration: BoxDecoration(
  2888. borderRadius: BorderRadius.only(
  2889. topLeft: Radius.circular(20),
  2890. bottomLeft: Radius.circular(20),
  2891. ),
  2892. border: Border.all(
  2893. color: MyColors.cFF4233,
  2894. width: 1.1),
  2895. color: Colors.white),
  2896. child: MyViews().myText(
  2897. '暂不更新', MyColors.cFF4233, 14),
  2898. height: 40,
  2899. alignment: Alignment.center,
  2900. ),
  2901. ),
  2902. ),
  2903. Expanded(
  2904. child: GestureDetector(
  2905. behavior: HitTestBehavior.translucent,
  2906. onTap: () {
  2907. if (Platform.isAndroid) {
  2908. downloadAPK(data, context);
  2909. startUpdate = true;
  2910. setState(() {});
  2911. } else if (Platform.isIOS) {
  2912. LaunchReview.launch(
  2913. writeReview: false,
  2914. iOSAppId: appStoreID);
  2915. } else {
  2916. Navigator.pop(context);
  2917. }
  2918. },
  2919. child: Container(
  2920. margin: EdgeInsets.only(right: 10),
  2921. decoration: BoxDecoration(
  2922. borderRadius: BorderRadius.only(
  2923. topRight: Radius.circular(20),
  2924. bottomRight:
  2925. Radius.circular(20),
  2926. ),
  2927. color: MyColors.cFF4233),
  2928. height: 40,
  2929. child: MyViews()
  2930. .myText('立即更新', Colors.white, 14),
  2931. alignment: Alignment.center,
  2932. ),
  2933. ),
  2934. )
  2935. ],
  2936. )
  2937. ],
  2938. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2939. );
  2940. }
  2941. },
  2942. ),
  2943. ),
  2944. ),
  2945. );
  2946. }),
  2947. );
  2948. },
  2949. );
  2950. }
  2951. downloadAPK(AndroidAppVersionBeanData data, BuildContext context) async {
  2952. Directory storageDir = await getExternalStorageDirectory();
  2953. String storagePath = storageDir.path;
  2954. File file = new File(
  2955. '$storagePath/${PinyinHelper.getShortPinyin(MyCookie().packageInfo.appName)}.apk');
  2956. if (!file.existsSync()) {
  2957. file.createSync();
  2958. }
  2959. print(apkURL(data.download));
  2960. Dio().download(apkURL(data.download), file.path,
  2961. onReceiveProgress: (int count, int total) {
  2962. EventBus().emit('更新进度条', ((count / (data.size)) * 100).floor());
  2963. }).then((value) {
  2964. print('下载完成');
  2965. EventBus().emit('允许安装', file.path);
  2966. }).catchError((e) {
  2967. print(e);
  2968. Navigator.pop(context);
  2969. EventBus().off('允许安装');
  2970. EventBus().off('更新进度条');
  2971. EasyLoading.showToast('下载失败');
  2972. });
  2973. }
  2974. Widget advertisingItems(BuildContext context, AdBeanDataData data) {
  2975. double w = (MediaQuery.of(context).size.width - 47) / 2;
  2976. List<Color> colors = [
  2977. MyColors.cADD358,
  2978. MyColors.cFF4233,
  2979. MyColors.cFF88B4,
  2980. MyColors.cFFCD00
  2981. ];
  2982. List<String> types = ['投放中', '未付费', '已结束', '未投放'];
  2983. int typeIndex;
  2984. if (data.paid == false) {
  2985. typeIndex = 1;
  2986. } else {
  2987. var sT = DateTime.parse(data.startDate);
  2988. var eT = sT.add(Duration(days: data.days));
  2989. if (sT.isBefore(DateTime.now()) && eT.isAfter(DateTime.now())) {
  2990. typeIndex = 0;
  2991. } else if (sT.isAfter(DateTime.now())) {
  2992. typeIndex = 3;
  2993. } else if (eT.isBefore(DateTime.now())) {
  2994. typeIndex = 2;
  2995. }
  2996. }
  2997. return Card(
  2998. child: Column(
  2999. children: [
  3000. ClipRRect(
  3001. child: Container(
  3002. child: Stack(
  3003. children: [
  3004. MyViews().netImg(imgURL(data.coverPath), w, w,
  3005. placeholder: 'images/svg/goodsDefImg.svg'),
  3006. Positioned(
  3007. right: 0,
  3008. top: 5,
  3009. child: Container(
  3010. decoration: BoxDecoration(
  3011. color: colors[typeIndex],
  3012. borderRadius: BorderRadius.only(
  3013. topLeft: Radius.circular(7),
  3014. bottomLeft: Radius.circular(7),
  3015. ),
  3016. ),
  3017. height: 14,
  3018. width: 32,
  3019. child: MyViews().myText(types[typeIndex], Colors.white, 8),
  3020. alignment: Alignment.center,
  3021. ),
  3022. )
  3023. ],
  3024. ),
  3025. height: w,
  3026. width: w,
  3027. ),
  3028. borderRadius: BorderRadius.only(
  3029. topRight: Radius.circular(4), topLeft: Radius.circular(4)),
  3030. ),
  3031. Expanded(
  3032. child: Padding(
  3033. padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 10),
  3034. child: Column(
  3035. children: [
  3036. Text(
  3037. data.title,
  3038. style: TextStyle(color: MyColors.c333333, fontSize: 12),
  3039. maxLines: 1,
  3040. overflow: TextOverflow.ellipsis,
  3041. softWrap: true,
  3042. ),
  3043. Text(
  3044. '发布时间:${data.createTime}',
  3045. style: TextStyle(color: MyColors.c999999, fontSize: 9),
  3046. maxLines: 1,
  3047. overflow: TextOverflow.ellipsis,
  3048. softWrap: true,
  3049. ),
  3050. Text(
  3051. '开始时间:${data.startDate}',
  3052. style: TextStyle(color: MyColors.c999999, fontSize: 9),
  3053. maxLines: 1,
  3054. overflow: TextOverflow.ellipsis,
  3055. softWrap: true,
  3056. ),
  3057. Text(
  3058. '结束时间:${DateTime.parse(data.startDate).add(Duration(days: data.days)).toString().substring(0, 10)}',
  3059. style: TextStyle(color: MyColors.c999999, fontSize: 9),
  3060. maxLines: 1,
  3061. overflow: TextOverflow.ellipsis,
  3062. softWrap: true,
  3063. ),
  3064. ],
  3065. crossAxisAlignment: CrossAxisAlignment.start,
  3066. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  3067. ),
  3068. ),
  3069. )
  3070. ],
  3071. crossAxisAlignment: CrossAxisAlignment.start,
  3072. ),
  3073. );
  3074. }
  3075. Future<Null> installApk(String url) async {
  3076. InstallPlugin.installApk(url, MyCookie().packageInfo.packageName)
  3077. .then((result) {
  3078. print('install apk $result');
  3079. }).catchError((error) {
  3080. print('install apk error: $error');
  3081. });
  3082. }