my_views.dart 120 KB

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