my_views.dart 120 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121
  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. if(data.state==shopStateNormal){
  1515. submitApplication(data);
  1516. }else{
  1517. showToast('该货帮暂不可加入');
  1518. }
  1519. },
  1520. behavior: HitTestBehavior.translucent,
  1521. child: Container(
  1522. alignment: Alignment.centerRight,
  1523. child: Container(
  1524. decoration: BoxDecoration(
  1525. border: Border.all(color: MyColors.cFF4233, width: 1),
  1526. borderRadius: BorderRadius.circular(14)),
  1527. height: 28,
  1528. width: 70,
  1529. child: myText('申请加入', MyColors.cFF4233, 12),
  1530. alignment: Alignment.center,
  1531. ),
  1532. ),
  1533. ),
  1534. )
  1535. ],
  1536. ),
  1537. ),
  1538. Container(
  1539. height: 0.5,
  1540. color: MyColors.cF7F7F7,
  1541. margin: EdgeInsets.only(left: 15, right: 15, top: 6),
  1542. )
  1543. ],
  1544. );
  1545. }
  1546. orderStyle(SmartOrderBeanDataData data) {
  1547. if (data.type == orderTypeThirdPlatform) {
  1548. //第三方平台订单
  1549. return Container(
  1550. margin: EdgeInsets.symmetric(horizontal: 12),
  1551. child: Row(
  1552. children: [
  1553. Container(
  1554. child: SvgPicture.asset(
  1555. 'images/svg/第三方.svg',
  1556. height: 45,
  1557. width: 45,
  1558. ),
  1559. margin: EdgeInsets.only(right: 8),
  1560. height: 60,
  1561. width: 60,
  1562. decoration: BoxDecoration(
  1563. border: Border.all(color: MyColors.cEBEBEB, width: 1)),
  1564. alignment: Alignment.center,
  1565. ),
  1566. Expanded(
  1567. child: Container(
  1568. height: 60,
  1569. child: Column(
  1570. children: [
  1571. MyViews()
  1572. .myText('第三方订单(${data.uid})', MyColors.c333333, 13),
  1573. MyViews()
  1574. .myText('付款人:${data.buyerName}', MyColors.c333333, 13),
  1575. Row(
  1576. children: [
  1577. MyViews()
  1578. .myText('¥${data.amount}', MyColors.cFF4233, 12),
  1579. MyViews().myText(
  1580. 'x${data.commodityCount}', MyColors.c999999, 12),
  1581. ],
  1582. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1583. )
  1584. ],
  1585. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1586. crossAxisAlignment: CrossAxisAlignment.start,
  1587. ),
  1588. ),
  1589. ),
  1590. ],
  1591. ),
  1592. );
  1593. } else if (data.type == orderTypeAnnualFee) {
  1594. //平台年费
  1595. return Container(
  1596. margin: EdgeInsets.symmetric(horizontal: 12),
  1597. child: Row(
  1598. children: [
  1599. Container(
  1600. child: Image.asset(
  1601. 'images/app_logo.png',
  1602. height: 45,
  1603. width: 45,
  1604. ),
  1605. margin: EdgeInsets.only(right: 8),
  1606. height: 60,
  1607. width: 60,
  1608. decoration: BoxDecoration(
  1609. border: Border.all(color: MyColors.cEBEBEB, width: 1)),
  1610. alignment: Alignment.center,
  1611. ),
  1612. Expanded(
  1613. child: Container(
  1614. height: 60,
  1615. child: Column(
  1616. children: [
  1617. MyViews().myText('平台服务费', MyColors.c333333, 13),
  1618. MyViews().myText(
  1619. '付款人:${data.buyerName}(${hideUID(data.buyerUid.toString())})',
  1620. MyColors.c333333,
  1621. 13),
  1622. Row(
  1623. children: [
  1624. MyViews()
  1625. .myText('¥${data.amount}', MyColors.cFF4233, 12),
  1626. MyViews().myText(
  1627. 'x${data.commodityCount}', MyColors.c999999, 12),
  1628. ],
  1629. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1630. )
  1631. ],
  1632. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1633. crossAxisAlignment: CrossAxisAlignment.start,
  1634. ),
  1635. ),
  1636. ),
  1637. ],
  1638. ),
  1639. );
  1640. } else if (data.type == orderTypeAdvertise) {
  1641. //平台广告订单
  1642. return Container(
  1643. margin: EdgeInsets.symmetric(horizontal: 12),
  1644. child: Row(
  1645. children: [
  1646. Container(
  1647. child: SvgPicture.asset(
  1648. 'images/svg/平台广告.svg',
  1649. height: 45,
  1650. width: 45,
  1651. ),
  1652. margin: EdgeInsets.only(right: 8),
  1653. height: 60,
  1654. width: 60,
  1655. decoration: BoxDecoration(
  1656. border: Border.all(color: MyColors.cEBEBEB, width: 1)),
  1657. alignment: Alignment.center,
  1658. ),
  1659. Expanded(
  1660. child: Container(
  1661. height: 60,
  1662. child: Column(
  1663. children: [
  1664. MyViews().myText('广告费', MyColors.c333333, 13),
  1665. MyViews().myText(
  1666. '付款人:${data.buyerName}(${hideUID(data.buyerUid.toString())})',
  1667. MyColors.c333333,
  1668. 13),
  1669. Row(
  1670. children: [
  1671. MyViews()
  1672. .myText('¥${data.amount}', MyColors.cFF4233, 12),
  1673. MyViews().myText(
  1674. 'x${data.commodityCount}', MyColors.c999999, 12),
  1675. ],
  1676. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1677. )
  1678. ],
  1679. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1680. crossAxisAlignment: CrossAxisAlignment.start,
  1681. ),
  1682. ),
  1683. ),
  1684. ],
  1685. ),
  1686. );
  1687. } else if (data.type == orderTypeCommodity) {
  1688. //商品订单
  1689. return Container(
  1690. margin: EdgeInsets.only(left: 10, right: 10),
  1691. child: Row(
  1692. children: [
  1693. MyViews().netImg(imgURL(data.commodityCover), 60, 60,
  1694. placeholder: 'images/svg/goodsDefImg.svg'),
  1695. Expanded(
  1696. child: Container(
  1697. padding: EdgeInsets.only(left: 8),
  1698. height: 60,
  1699. child: Column(
  1700. children: [
  1701. Text(
  1702. '${data.commodityTitle}',
  1703. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  1704. maxLines: 2,
  1705. overflow: TextOverflow.ellipsis,
  1706. softWrap: true,
  1707. ),
  1708. Row(
  1709. children: [
  1710. Text(
  1711. '¥${double.parse('${data.amount}').toStringAsFixed(2)}',
  1712. style:
  1713. TextStyle(color: MyColors.cFF4233, fontSize: 12),
  1714. ),
  1715. Text(
  1716. 'x${data.commodityCount}',
  1717. style:
  1718. TextStyle(color: MyColors.c999999, fontSize: 12),
  1719. ),
  1720. ],
  1721. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1722. crossAxisAlignment: CrossAxisAlignment.start,
  1723. ),
  1724. Row(
  1725. children: [
  1726. ClipRRect(
  1727. child: MyViews()
  1728. .netImg(imgURL('${data.buyerPic}'), 25, 25),
  1729. borderRadius: BorderRadius.all(Radius.circular(12.5)),
  1730. ),
  1731. Container(
  1732. margin: EdgeInsets.only(right: 5, left: 5),
  1733. child: Text(
  1734. '${data.buyerName}(${hideUID(data.buyerUid.toString())})',
  1735. style: TextStyle(
  1736. color: MyColors.c333333,
  1737. fontSize: 13,
  1738. ),
  1739. maxLines: 1,
  1740. overflow: TextOverflow.ellipsis,
  1741. softWrap: true,
  1742. ),
  1743. ),
  1744. // Container(
  1745. // decoration: BoxDecoration(
  1746. // border:
  1747. // Border.all(color: MyColors.cFF4233, width: 1),
  1748. // borderRadius: BorderRadius.all(
  1749. // Radius.circular(2),
  1750. // ),
  1751. // ),
  1752. // child: Text(
  1753. // '买家',
  1754. // style: TextStyle(
  1755. // color: MyColors.cFF4233,
  1756. // fontSize: 10,
  1757. // ),
  1758. // ),
  1759. // alignment: Alignment.center,
  1760. // padding:
  1761. // EdgeInsets.only(bottom: 2, left: 3, right: 3),
  1762. // )
  1763. ],
  1764. ),
  1765. ],
  1766. crossAxisAlignment: CrossAxisAlignment.start,
  1767. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1768. ),
  1769. ),
  1770. )
  1771. ],
  1772. ),
  1773. );
  1774. } else if (data.type == orderTypeVirtualProduct) {
  1775. //虚拟物品
  1776. return Container(
  1777. margin: EdgeInsets.only(left: 10, right: 10),
  1778. child: Row(
  1779. children: [
  1780. Container(
  1781. child: SvgPicture.asset(
  1782. 'images/svg/虚拟物品.svg',
  1783. height: 45,
  1784. width: 45,
  1785. ),
  1786. margin: EdgeInsets.only(right: 8),
  1787. height: 60,
  1788. width: 60,
  1789. decoration: BoxDecoration(
  1790. border: Border.all(color: MyColors.cEBEBEB, width: 1)),
  1791. alignment: Alignment.center,
  1792. ),
  1793. Expanded(
  1794. child: Container(
  1795. padding: EdgeInsets.only(left: 8),
  1796. height: 60,
  1797. child: Column(
  1798. children: [
  1799. Text(
  1800. '虚拟道具',
  1801. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  1802. maxLines: 2,
  1803. overflow: TextOverflow.ellipsis,
  1804. softWrap: true,
  1805. ),
  1806. Row(
  1807. children: [
  1808. Text(
  1809. '¥${double.parse('${data.amount}').toStringAsFixed(2)}',
  1810. style:
  1811. TextStyle(color: MyColors.cFF4233, fontSize: 12),
  1812. ),
  1813. Text(
  1814. 'x${data.commodityCount}',
  1815. style:
  1816. TextStyle(color: MyColors.c999999, fontSize: 12),
  1817. ),
  1818. ],
  1819. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1820. crossAxisAlignment: CrossAxisAlignment.start,
  1821. ),
  1822. Row(
  1823. children: [
  1824. ClipRRect(
  1825. child: MyViews()
  1826. .netImg(imgURL('${data.buyerPic}'), 25, 25),
  1827. borderRadius: BorderRadius.all(Radius.circular(12.5)),
  1828. ),
  1829. Container(
  1830. margin: EdgeInsets.only(right: 5, left: 5),
  1831. child: Text(
  1832. '${data.buyerName}(${hideUID(data.buyerUid.toString())})',
  1833. style: TextStyle(
  1834. color: MyColors.c333333,
  1835. fontSize: 13,
  1836. ),
  1837. maxLines: 1,
  1838. overflow: TextOverflow.ellipsis,
  1839. softWrap: true,
  1840. ),
  1841. ),
  1842. // Container(
  1843. // decoration: BoxDecoration(
  1844. // border:
  1845. // Border.all(color: MyColors.cFF4233, width: 1),
  1846. // borderRadius: BorderRadius.all(
  1847. // Radius.circular(2),
  1848. // ),
  1849. // ),
  1850. // child: Text(
  1851. // '买家',
  1852. // style: TextStyle(
  1853. // color: MyColors.cFF4233,
  1854. // fontSize: 10,
  1855. // ),
  1856. // ),
  1857. // alignment: Alignment.center,
  1858. // padding:
  1859. // EdgeInsets.only(bottom: 2, left: 3, right: 3),
  1860. // )
  1861. ],
  1862. ),
  1863. ],
  1864. crossAxisAlignment: CrossAxisAlignment.start,
  1865. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1866. ),
  1867. ),
  1868. )
  1869. ],
  1870. ),
  1871. );
  1872. } else if (data.type == orderTypeScancodeAilyPay) {
  1873. //扫码收款
  1874. return Container(
  1875. margin: EdgeInsets.only(left: 10, right: 10),
  1876. child: Row(
  1877. children: [
  1878. Container(
  1879. child: Icon(
  1880. Icons.qr_code_outlined,
  1881. color: Colors.white,
  1882. ),
  1883. margin: EdgeInsets.only(right: 8),
  1884. height: 60,
  1885. width: 60,
  1886. decoration: BoxDecoration(
  1887. color: MyColors.cFF4233,
  1888. border: Border.all(color: MyColors.cEBEBEB, width: 1)),
  1889. alignment: Alignment.center,
  1890. ),
  1891. Expanded(
  1892. child: Container(
  1893. padding: EdgeInsets.only(left: 8),
  1894. height: 60,
  1895. child: Column(
  1896. children: [
  1897. Text(
  1898. '收款码收款',
  1899. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  1900. maxLines: 2,
  1901. overflow: TextOverflow.ellipsis,
  1902. softWrap: true,
  1903. ),
  1904. Text(
  1905. '¥${double.parse('${data.amount}').toStringAsFixed(2)}',
  1906. style: TextStyle(color: MyColors.cFF4233, fontSize: 12),
  1907. ),
  1908. ],
  1909. crossAxisAlignment: CrossAxisAlignment.start,
  1910. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1911. ),
  1912. ),
  1913. )
  1914. ],
  1915. ),
  1916. );
  1917. } else if (data.type == orderTypeOfflineTransfer ||
  1918. data.type == orderTypeOfflinePay) {
  1919. //线下付款
  1920. return Container(
  1921. margin: EdgeInsets.only(left: 10, right: 10),
  1922. child: Row(
  1923. children: [
  1924. Container(
  1925. child: SvgPicture.asset(
  1926. 'images/svg/线下付款.svg',
  1927. height: 45,
  1928. width: 45,
  1929. ),
  1930. margin: EdgeInsets.only(right: 8),
  1931. height: 60,
  1932. width: 60,
  1933. decoration: BoxDecoration(
  1934. border: Border.all(color: MyColors.cEBEBEB, width: 1)),
  1935. alignment: Alignment.center,
  1936. ),
  1937. Expanded(
  1938. child: Container(
  1939. padding: EdgeInsets.only(left: 8),
  1940. height: 60,
  1941. child: Column(
  1942. children: [
  1943. Text(
  1944. data.type == orderTypeOfflineTransfer ? '到店付款' : '线下收款',
  1945. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  1946. maxLines: 2,
  1947. overflow: TextOverflow.ellipsis,
  1948. softWrap: true,
  1949. ),
  1950. Row(
  1951. children: [
  1952. Text(
  1953. '¥${double.parse('${data.amount}').toStringAsFixed(2)}',
  1954. style:
  1955. TextStyle(color: MyColors.cFF4233, fontSize: 12),
  1956. ),
  1957. Text(
  1958. 'x${data.commodityCount}',
  1959. style:
  1960. TextStyle(color: MyColors.c999999, fontSize: 12),
  1961. ),
  1962. ],
  1963. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1964. crossAxisAlignment: CrossAxisAlignment.start,
  1965. ),
  1966. Row(
  1967. children: [
  1968. ClipRRect(
  1969. child: MyViews()
  1970. .netImg(imgURL('${data.buyerPic}'), 20, 20),
  1971. borderRadius: BorderRadius.all(Radius.circular(10)),
  1972. ),
  1973. Container(
  1974. margin: EdgeInsets.only(right: 5, left: 5),
  1975. child: Text(
  1976. '${data.buyerName}(${hideUID(data.buyerUid.toString())})',
  1977. style: TextStyle(
  1978. color: MyColors.c333333,
  1979. fontSize: 13,
  1980. ),
  1981. maxLines: 1,
  1982. overflow: TextOverflow.ellipsis,
  1983. softWrap: true,
  1984. ),
  1985. ),
  1986. // Container(
  1987. // decoration: BoxDecoration(
  1988. // border:
  1989. // Border.all(color: MyColors.cFF4233, width: 1),
  1990. // borderRadius: BorderRadius.all(
  1991. // Radius.circular(2),
  1992. // ),
  1993. // ),
  1994. // child: Text(
  1995. // '买家',
  1996. // style: TextStyle(
  1997. // color: MyColors.cFF4233,
  1998. // fontSize: 10,
  1999. // ),
  2000. // ),
  2001. // alignment: Alignment.center,
  2002. // padding:
  2003. // EdgeInsets.only(bottom: 2, left: 3, right: 3),
  2004. // )
  2005. ],
  2006. ),
  2007. ],
  2008. crossAxisAlignment: CrossAxisAlignment.start,
  2009. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2010. ),
  2011. ),
  2012. )
  2013. ],
  2014. ),
  2015. );
  2016. } else {
  2017. return Container(
  2018. margin: EdgeInsets.only(left: 10, right: 10),
  2019. child: Row(
  2020. children: [
  2021. MyViews().netImg(imgURL(data.commodityCover), 82, 84,
  2022. placeholder: 'images/svg/goodsDefImg.svg'),
  2023. Expanded(
  2024. child: Container(
  2025. padding: EdgeInsets.only(left: 8),
  2026. height: 82,
  2027. child: Column(
  2028. children: [
  2029. Text(
  2030. '${data.commodityTitle}',
  2031. style: TextStyle(color: MyColors.c333333, fontSize: 13),
  2032. maxLines: 2,
  2033. overflow: TextOverflow.ellipsis,
  2034. softWrap: true,
  2035. ),
  2036. Row(
  2037. children: [
  2038. Text(
  2039. '¥${double.parse('${data.amount}').toStringAsFixed(2)}',
  2040. style:
  2041. TextStyle(color: MyColors.cFF4233, fontSize: 12),
  2042. ),
  2043. Text(
  2044. 'x${data.commodityCount}',
  2045. style:
  2046. TextStyle(color: MyColors.c999999, fontSize: 12),
  2047. ),
  2048. ],
  2049. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2050. crossAxisAlignment: CrossAxisAlignment.start,
  2051. ),
  2052. Row(
  2053. children: [
  2054. ClipRRect(
  2055. child: MyViews()
  2056. .netImg(imgURL('${data.buyerPic}'), 25, 25),
  2057. borderRadius: BorderRadius.all(Radius.circular(12.5)),
  2058. ),
  2059. Container(
  2060. margin: EdgeInsets.only(right: 5, left: 5),
  2061. child: Text(
  2062. '${data.buyerName}(${hideUID(data.buyerUid.toString())})',
  2063. style: TextStyle(
  2064. color: MyColors.c333333,
  2065. fontSize: 13,
  2066. ),
  2067. maxLines: 1,
  2068. overflow: TextOverflow.ellipsis,
  2069. softWrap: true,
  2070. ),
  2071. ),
  2072. // Container(
  2073. // decoration: BoxDecoration(
  2074. // border:
  2075. // Border.all(color: MyColors.cFF4233, width: 1),
  2076. // borderRadius: BorderRadius.all(
  2077. // Radius.circular(2),
  2078. // ),
  2079. // ),
  2080. // child: Text(
  2081. // '买家',
  2082. // style: TextStyle(
  2083. // color: MyColors.cFF4233,
  2084. // fontSize: 10,
  2085. // ),
  2086. // ),
  2087. // alignment: Alignment.center,
  2088. // padding:
  2089. // EdgeInsets.only(bottom: 2, left: 3, right: 3),
  2090. // )
  2091. ],
  2092. ),
  2093. ],
  2094. crossAxisAlignment: CrossAxisAlignment.start,
  2095. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2096. ),
  2097. ),
  2098. )
  2099. ],
  2100. ),
  2101. );
  2102. }
  2103. }
  2104. void queryWhetherThereIsANumberOfPerspectives(
  2105. MyShopBeanDataData data, StoreBeanDataData store, BuildContext context) {
  2106. MyDio().query({
  2107. "key": "user_vp",
  2108. "filters": {
  2109. "conditions": [
  2110. "user_uid == ${MyCookie().getUID()}",
  2111. "vp_key == $vpKeyXRay"
  2112. ]
  2113. },
  2114. "dims": userVpDims,
  2115. "paging": [1, 2000]
  2116. }, (response, hasError) {
  2117. UserVpBeanEntity entity =
  2118. UserVpBeanEntity().fromJson(json.decode(response.data.toString()));
  2119. if (entity.data.data.length != 0) {
  2120. MyTools().toPage(context, OtherPeopleSTurnoverPage(data), (then) {});
  2121. } else {
  2122. // showSimpleDialog('你还未获取透视道具或道具用完,请先购买次数再查看。', context, () {
  2123. // Navigator.pop(context);
  2124. // MyShopBeanDataData shop = MyShopBeanDataData();
  2125. // shop.shopUid = store.uid;
  2126. // shop.shopName = store.name;
  2127. // shop.shopPic = store.picture;
  2128. // MyTools().toPage(
  2129. // context, PrivacyProtectionPropsPage(shop, vpKeyXRay), (then) {});
  2130. // });
  2131. MyShopBeanDataData shop = MyShopBeanDataData();
  2132. shop.shopUid = store.uid;
  2133. shop.shopName = store.name;
  2134. shop.shopPic = store.picture;
  2135. MyTools().toPage(
  2136. context, PrivacyProtectionPropsPage(shop, vpKeyXRay), (then) {});
  2137. }
  2138. }, (error) {});
  2139. }
  2140. Widget pubShopItem(var data, BuildContext context) {
  2141. if (data is StoreBeanDataData) {
  2142. return GestureDetector(
  2143. onTap: () {
  2144. MyShopBeanDataData sBean = MyShopBeanDataData();
  2145. sBean.shopName = data.name;
  2146. sBean.shopPic = data.picture;
  2147. sBean.shopUid = data.uid;
  2148. sBean.ownerUid = data.ownerUid;
  2149. sBean.ownerName = data.ownerName;
  2150. sBean.ownerPic = data.ownerPic;
  2151. sBean.privateShop = data.private;
  2152. sBean.innerTrade = data.innerTrade;
  2153. sBean.shopState = data.state;
  2154. navigatorKey.currentState.push(
  2155. MaterialPageRoute(builder: (context) => GangInPage(sBean, null)));
  2156. },
  2157. behavior: HitTestBehavior.translucent,
  2158. child: Container(
  2159. decoration: BoxDecoration(
  2160. boxShadow: [
  2161. BoxShadow(
  2162. color: MyColors.c7FE1E1E1,
  2163. blurRadius: 5.0,
  2164. ),
  2165. ],
  2166. color: Colors.white,
  2167. borderRadius: BorderRadius.circular(4),
  2168. ),
  2169. margin: EdgeInsets.only(bottom: 6.5, left: 16, right: 16, top: 6.5),
  2170. child: Padding(
  2171. padding: const EdgeInsets.all(10),
  2172. child: Row(
  2173. children: [
  2174. ClipRRect(
  2175. child: MyViews().netImg(imgURL(data.picture), 70, 70,
  2176. placeholder: 'images/svg/goodsDefImg.svg'),
  2177. borderRadius: BorderRadius.circular(4),
  2178. ),
  2179. Expanded(
  2180. child: Container(
  2181. height: 70,
  2182. margin: EdgeInsets.only(left: 10),
  2183. child: Column(
  2184. children: [
  2185. myText(
  2186. '${data.name}(${data.uid})', MyColors.c333333, 14),
  2187. Text(
  2188. '货帮介绍:${data.introduction}',
  2189. style:
  2190. TextStyle(color: MyColors.c666666, fontSize: 11),
  2191. maxLines: 1,
  2192. overflow: TextOverflow.ellipsis,
  2193. softWrap: true,
  2194. ),
  2195. Row(
  2196. children: [
  2197. Expanded(
  2198. child: GestureDetector(
  2199. onTap: () {
  2200. if (data.latitude == 0) {
  2201. showToast('该店坐标有误');
  2202. return;
  2203. }
  2204. mapNavigationPopup(
  2205. data.latitude, data.longitude, context);
  2206. },
  2207. behavior: HitTestBehavior.translucent,
  2208. child: Row(
  2209. children: [
  2210. Icon(
  2211. Icons.location_on_outlined,
  2212. size: 15,
  2213. color: MyColors.c666666,
  2214. ),
  2215. Expanded(
  2216. child: Text(
  2217. '${data.address}',
  2218. style: TextStyle(
  2219. color: MyColors.c666666,
  2220. fontSize: 10),
  2221. maxLines: 1,
  2222. overflow: TextOverflow.ellipsis,
  2223. softWrap: true,
  2224. ),
  2225. ),
  2226. ],
  2227. ),
  2228. ),
  2229. ),
  2230. if (data.longitude != 0 &&
  2231. context.watch<MyLocationProvider>().myLatLng !=
  2232. null)
  2233. Text(
  2234. '${(AMapTools.distanceBetween(LatLng(data.latitude, data.longitude), LatLng(MyCookie().location.latitude, MyCookie().location.longitude)) / 1000).toStringAsFixed(3)}km',
  2235. style: TextStyle(
  2236. fontSize: 10, color: MyColors.c666666),
  2237. )
  2238. ],
  2239. ),
  2240. ],
  2241. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2242. crossAxisAlignment: CrossAxisAlignment.start,
  2243. ),
  2244. ),
  2245. )
  2246. ],
  2247. ),
  2248. ),
  2249. ),
  2250. );
  2251. } else if (data is AdBeanDataData) {
  2252. return GestureDetector(
  2253. onTap: () {
  2254. MyTools().toPage(context, AdDetailsPage(data), (then) {});
  2255. },
  2256. behavior: HitTestBehavior.translucent,
  2257. child: Container(
  2258. margin: EdgeInsets.only(bottom: 6.5, left: 16, right: 16, top: 6.5),
  2259. decoration: BoxDecoration(
  2260. boxShadow: [
  2261. BoxShadow(
  2262. color: MyColors.c7FE1E1E1,
  2263. blurRadius: 5.0,
  2264. ),
  2265. ],
  2266. color: Colors.white,
  2267. borderRadius: BorderRadius.circular(4),
  2268. ),
  2269. child: Padding(
  2270. padding: const EdgeInsets.only(top: 10, bottom: 10, left: 10),
  2271. child: Row(
  2272. children: [
  2273. ClipRRect(
  2274. child: MyViews().netImg(imgURL(data.coverPath), 70, 70,
  2275. placeholder: 'images/svg/goodsDefImg.svg'),
  2276. borderRadius: BorderRadius.circular(4),
  2277. ),
  2278. Expanded(
  2279. child: Container(
  2280. height: 70,
  2281. margin: EdgeInsets.only(left: 10),
  2282. child: Column(
  2283. children: [
  2284. Row(
  2285. children: [
  2286. Expanded(
  2287. child: myText(
  2288. '${data.title}', MyColors.c333333, 14)),
  2289. Container(
  2290. decoration: BoxDecoration(
  2291. color: MyColors.cADD358,
  2292. borderRadius: BorderRadius.only(
  2293. topLeft: Radius.circular(8),
  2294. bottomLeft: Radius.circular(8),
  2295. ),
  2296. ),
  2297. height: 16,
  2298. width: 32,
  2299. child: myText('推广', Colors.white, 9),
  2300. alignment: Alignment.center,
  2301. ),
  2302. ],
  2303. ),
  2304. Visibility(
  2305. visible: data.mobile.isNotEmpty,
  2306. child: Container(
  2307. margin: EdgeInsets.only(right: 10),
  2308. child: Text(
  2309. '联系电话:${data.mobile}',
  2310. style: TextStyle(
  2311. color: MyColors.c666666, fontSize: 11),
  2312. maxLines: 2,
  2313. overflow: TextOverflow.ellipsis,
  2314. softWrap: true,
  2315. ),
  2316. ),
  2317. ),
  2318. Container(
  2319. margin: EdgeInsets.only(right: 10),
  2320. child: Text(
  2321. '${data.description}',
  2322. style: TextStyle(
  2323. color: MyColors.c666666, fontSize: 11),
  2324. maxLines: 2,
  2325. overflow: TextOverflow.ellipsis,
  2326. softWrap: true,
  2327. ),
  2328. ),
  2329. ],
  2330. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2331. crossAxisAlignment: CrossAxisAlignment.start,
  2332. ),
  2333. ),
  2334. )
  2335. ],
  2336. ),
  2337. ),
  2338. ),
  2339. );
  2340. }
  2341. }
  2342. void mapNavigationPopup(
  2343. double latitude,
  2344. double longitude,
  2345. BuildContext context,
  2346. ) {
  2347. showModalBottomSheet(
  2348. isScrollControlled: true,
  2349. shape: RoundedRectangleBorder(
  2350. //圆角
  2351. borderRadius: BorderRadius.vertical(top: Radius.circular(15)),
  2352. ),
  2353. builder: (BuildContext context) {
  2354. return AnimatedPadding(
  2355. //showModalBottomSheet 键盘弹出时自适应
  2356. padding: MediaQuery.of(context).viewInsets, //边距(必要)
  2357. duration: const Duration(milliseconds: 100), //时常 (必要)
  2358. child: Container(
  2359. // height: 180,
  2360. constraints: BoxConstraints(
  2361. minHeight: 90, //设置最小高度(必要)
  2362. maxHeight:
  2363. MediaQuery.of(context).size.height / 1.5, //设置最大高度(必要)
  2364. ),
  2365. padding: EdgeInsets.only(top: 20, bottom: 20),
  2366. decoration: BoxDecoration(
  2367. borderRadius: BorderRadius.vertical(top: Radius.circular(15)),
  2368. color: Colors.white), //圆角
  2369. child: ListView(
  2370. padding: EdgeInsets.all(0),
  2371. shrinkWrap: true,
  2372. children: <Widget>[
  2373. Column(
  2374. mainAxisSize: MainAxisSize.min,
  2375. mainAxisAlignment: MainAxisAlignment.start,
  2376. crossAxisAlignment: CrossAxisAlignment.center,
  2377. children: <Widget>[
  2378. GestureDetector(
  2379. onTap: () {
  2380. MapUtil.gotoAMap(longitude, latitude);
  2381. },
  2382. behavior: HitTestBehavior.translucent,
  2383. child: Container(
  2384. height: 50,
  2385. child: Column(
  2386. children: [
  2387. Text(
  2388. '高德地图',
  2389. style: TextStyle(
  2390. color: MyColors.c333333, fontSize: 16),
  2391. ),
  2392. Container(
  2393. height: 0.5,
  2394. color: Colors.grey[200],
  2395. )
  2396. ],
  2397. mainAxisAlignment: MainAxisAlignment.spaceAround,
  2398. ),
  2399. ),
  2400. ),
  2401. GestureDetector(
  2402. onTap: () {
  2403. MapUtil.gotoBaiduMap(longitude, latitude);
  2404. },
  2405. behavior: HitTestBehavior.translucent,
  2406. child: Container(
  2407. height: 50,
  2408. child: Column(
  2409. children: [
  2410. Text(
  2411. '百度地图',
  2412. style: TextStyle(
  2413. color: MyColors.c333333, fontSize: 16),
  2414. ),
  2415. Container(
  2416. height: 0.5,
  2417. color: Colors.grey[200],
  2418. )
  2419. ],
  2420. mainAxisAlignment: MainAxisAlignment.spaceAround,
  2421. ),
  2422. ),
  2423. ),
  2424. GestureDetector(
  2425. onTap: () {
  2426. MapUtil.gotoTencentMap(longitude, latitude);
  2427. },
  2428. behavior: HitTestBehavior.translucent,
  2429. child: Container(
  2430. height: 50,
  2431. child: Column(
  2432. children: [
  2433. Text(
  2434. '腾讯地图',
  2435. style: TextStyle(
  2436. color: MyColors.c333333, fontSize: 16),
  2437. ),
  2438. Container(
  2439. height: 0.5,
  2440. color: Colors.grey[200],
  2441. )
  2442. ],
  2443. mainAxisAlignment: MainAxisAlignment.spaceAround,
  2444. ),
  2445. ),
  2446. ),
  2447. if (Platform.isIOS)
  2448. GestureDetector(
  2449. onTap: () {
  2450. MapUtil.gotoAppleMap(longitude, latitude);
  2451. },
  2452. behavior: HitTestBehavior.translucent,
  2453. child: Container(
  2454. height: 50,
  2455. child: Column(
  2456. children: [
  2457. Text(
  2458. '苹果地图',
  2459. style: TextStyle(
  2460. color: MyColors.c333333, fontSize: 16),
  2461. ),
  2462. Container(
  2463. height: 0.5,
  2464. color: Colors.grey[200],
  2465. )
  2466. ],
  2467. mainAxisAlignment: MainAxisAlignment.spaceAround,
  2468. ),
  2469. ),
  2470. ),
  2471. ],
  2472. )
  2473. ],
  2474. ),
  2475. ),
  2476. );
  2477. },
  2478. context: context);
  2479. }
  2480. }
  2481. Widget noData() {
  2482. return Center(
  2483. child: Column(
  2484. children: [
  2485. Container(
  2486. child: Image.asset('images/no_data.png'),
  2487. alignment: Alignment.center,
  2488. margin: EdgeInsets.only(top: 40),
  2489. ),
  2490. Container(
  2491. child: MyViews().myText('暂无信息', MyColors.c999999, 16),
  2492. height: 100,
  2493. alignment: Alignment.topCenter,
  2494. )
  2495. ],
  2496. mainAxisAlignment: MainAxisAlignment.center,
  2497. ),
  2498. );
  2499. }
  2500. showPayDialog(SmartOrderBeanDataData data, BuildContext context, onTap) {
  2501. showDialog(
  2502. context: context,
  2503. builder: (BuildContext context) {
  2504. return Material(
  2505. color: Colors.black12,
  2506. child: Center(
  2507. child: Container(
  2508. decoration: BoxDecoration(
  2509. borderRadius: BorderRadius.circular(16),
  2510. color: Colors.white,
  2511. ),
  2512. height: 207,
  2513. margin: EdgeInsets.symmetric(horizontal: 18),
  2514. padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
  2515. child: Column(
  2516. children: [
  2517. Row(
  2518. children: [
  2519. Container(
  2520. decoration: BoxDecoration(
  2521. border: Border.all(color: MyColors.cEBEBEB, width: 1),
  2522. ),
  2523. child: SvgPicture.asset(
  2524. 'images/svg/支付商品.svg',
  2525. height: 28,
  2526. width: 28,
  2527. ),
  2528. height: 45,
  2529. width: 45,
  2530. alignment: Alignment.center,
  2531. ),
  2532. Container(
  2533. height: 45,
  2534. child: Column(
  2535. children: [
  2536. MyViews().myText(
  2537. '确认支付订单(${data.uid})', MyColors.c333333, 13),
  2538. MyViews()
  2539. .myText('¥${data.amount}', MyColors.cFF4233, 12),
  2540. ],
  2541. crossAxisAlignment: CrossAxisAlignment.start,
  2542. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2543. ),
  2544. margin: EdgeInsets.only(left: 10),
  2545. )
  2546. ],
  2547. ),
  2548. Container(
  2549. height: 0.5,
  2550. color: MyColors.cE7E7E7,
  2551. ),
  2552. Row(
  2553. children: [
  2554. MyViews().myText('付款人:', MyColors.c333333, 13),
  2555. Container(
  2556. child: ClipRRect(
  2557. child: MyViews().netImg(imgURL(data.buyerPic), 23, 23),
  2558. borderRadius: BorderRadius.circular(23),
  2559. ),
  2560. margin: EdgeInsets.symmetric(horizontal: 8),
  2561. ),
  2562. MyViews().myText(
  2563. '${data.buyerName}${data.buyerUid == 0 ? '' : "(${hideUID(data.buyerUid.toString())})"}',
  2564. MyColors.c333333,
  2565. 13),
  2566. ],
  2567. ),
  2568. Container(
  2569. height: 0.5,
  2570. color: MyColors.cE7E7E7,
  2571. ),
  2572. Row(
  2573. children: [
  2574. MyViews().myText('收款人:', MyColors.c333333, 13),
  2575. Container(
  2576. child: ClipRRect(
  2577. child: MyViews().netImg(imgURL(data.sellerPic), 23, 23),
  2578. borderRadius: BorderRadius.circular(23),
  2579. ),
  2580. margin: EdgeInsets.symmetric(horizontal: 8),
  2581. ),
  2582. MyViews().myText(
  2583. '${data.sellerName}${data.sellerUid == 0 ? '' : '(${hideUID(data.sellerUid.toString())})'}',
  2584. MyColors.c333333,
  2585. 13),
  2586. ],
  2587. ),
  2588. Container(
  2589. height: 0.5,
  2590. color: MyColors.cE7E7E7,
  2591. ),
  2592. Container(
  2593. margin: EdgeInsets.symmetric(horizontal: 10),
  2594. child: Row(
  2595. children: [
  2596. Expanded(
  2597. child: GestureDetector(
  2598. onTap: () {
  2599. Navigator.pop(context);
  2600. },
  2601. behavior: HitTestBehavior.translucent,
  2602. child: Container(
  2603. decoration: BoxDecoration(
  2604. borderRadius: BorderRadius.only(
  2605. topLeft: Radius.circular(20),
  2606. bottomLeft: Radius.circular(20),
  2607. ),
  2608. border: Border.all(
  2609. color: MyColors.cFF4233, width: 1.1),
  2610. color: Colors.white),
  2611. child: MyViews().myText('取消', MyColors.cFF4233, 14),
  2612. height: 40,
  2613. alignment: Alignment.center,
  2614. ),
  2615. ),
  2616. ),
  2617. Expanded(
  2618. child: GestureDetector(
  2619. behavior: HitTestBehavior.translucent,
  2620. onTap: onTap,
  2621. child: Container(
  2622. decoration: BoxDecoration(
  2623. borderRadius: BorderRadius.only(
  2624. topRight: Radius.circular(20),
  2625. bottomRight: Radius.circular(20),
  2626. ),
  2627. color: MyColors.cFF4233),
  2628. height: 40,
  2629. child: MyViews().myText('确定', Colors.white, 14),
  2630. alignment: Alignment.center,
  2631. ),
  2632. ),
  2633. )
  2634. ],
  2635. ),
  2636. )
  2637. ],
  2638. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2639. ),
  2640. ),
  2641. ),
  2642. );
  2643. },
  2644. );
  2645. }
  2646. showSimpleDialog(String content, BuildContext context, onTap) {
  2647. showDialog(
  2648. context: context,
  2649. builder: (BuildContext context) {
  2650. return Material(
  2651. color: Colors.black12,
  2652. child: Center(
  2653. child: Container(
  2654. decoration: BoxDecoration(
  2655. borderRadius: BorderRadius.circular(16),
  2656. color: Colors.white,
  2657. ),
  2658. height: 180,
  2659. margin: EdgeInsets.symmetric(horizontal: 18),
  2660. padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
  2661. child: Column(
  2662. children: [
  2663. Expanded(
  2664. child: Center(
  2665. child: Container(
  2666. child: MyViews().myText(content, MyColors.c333333, 14),
  2667. margin: EdgeInsets.symmetric(horizontal: 20),
  2668. ),
  2669. ),
  2670. ),
  2671. Container(
  2672. height: 0.5,
  2673. color: MyColors.cE7E7E7,
  2674. margin: EdgeInsets.only(bottom: 12),
  2675. ),
  2676. Container(
  2677. margin: EdgeInsets.symmetric(horizontal: 10),
  2678. child: Row(
  2679. children: [
  2680. Expanded(
  2681. child: GestureDetector(
  2682. onTap: () {
  2683. Navigator.pop(context);
  2684. },
  2685. behavior: HitTestBehavior.translucent,
  2686. child: Container(
  2687. decoration: BoxDecoration(
  2688. borderRadius: BorderRadius.only(
  2689. topLeft: Radius.circular(20),
  2690. bottomLeft: Radius.circular(20),
  2691. ),
  2692. border: Border.all(
  2693. color: MyColors.cFF4233, width: 1.1),
  2694. color: Colors.white),
  2695. child: MyViews().myText('取消', MyColors.cFF4233, 14),
  2696. height: 40,
  2697. alignment: Alignment.center,
  2698. ),
  2699. ),
  2700. ),
  2701. Expanded(
  2702. child: GestureDetector(
  2703. behavior: HitTestBehavior.translucent,
  2704. onTap: onTap,
  2705. child: Container(
  2706. decoration: BoxDecoration(
  2707. borderRadius: BorderRadius.only(
  2708. topRight: Radius.circular(20),
  2709. bottomRight: Radius.circular(20),
  2710. ),
  2711. color: MyColors.cFF4233),
  2712. height: 40,
  2713. child: MyViews().myText('确定', Colors.white, 14),
  2714. alignment: Alignment.center,
  2715. ),
  2716. ),
  2717. )
  2718. ],
  2719. ),
  2720. )
  2721. ],
  2722. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2723. ),
  2724. ),
  2725. ),
  2726. );
  2727. },
  2728. );
  2729. }
  2730. updateDialog(AndroidAppVersionBeanData data, BuildContext context) {
  2731. bool startUpdate = false;
  2732. bool downloadCompleted = false;
  2733. String filePath = '';
  2734. int p = 0;
  2735. EventBus().off('允许安装');
  2736. EventBus().off('更新进度条');
  2737. showDialog(
  2738. context: context,
  2739. builder: (BuildContext context) {
  2740. return WillPopScope(
  2741. onWillPop: () {
  2742. return Future.value(false);
  2743. },
  2744. child: StreamBuilder<Object>(builder: (context, snapshot) {
  2745. return Material(
  2746. color: Colors.black12,
  2747. child: Center(
  2748. child: Container(
  2749. decoration: BoxDecoration(
  2750. borderRadius: BorderRadius.circular(16),
  2751. color: Colors.white,
  2752. ),
  2753. height: 165,
  2754. margin: EdgeInsets.symmetric(horizontal: 18),
  2755. padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
  2756. child: StatefulBuilder(
  2757. builder: (BuildContext context,
  2758. void Function(void Function()) setState) {
  2759. EventBus().on('更新进度条', (arg) {
  2760. p = arg;
  2761. setState(() {});
  2762. });
  2763. EventBus().on('允许安装', (arg) {
  2764. downloadCompleted = true;
  2765. filePath = arg;
  2766. setState(() {});
  2767. });
  2768. if (startUpdate) {
  2769. return Column(
  2770. children: [
  2771. Container(
  2772. height: 88,
  2773. child: Column(
  2774. children: [
  2775. Container(
  2776. child: MyViews()
  2777. .myText('更新中...', MyColors.c333333, 16),
  2778. ),
  2779. SizedBox(
  2780. height: 15,
  2781. child: ClipRRect(
  2782. borderRadius: BorderRadius.circular(7.5),
  2783. child: LinearProgressIndicator(
  2784. backgroundColor: Colors.grey[200],
  2785. valueColor: AlwaysStoppedAnimation(
  2786. MyColors.cFF4233),
  2787. value: downloadCompleted
  2788. ? 1
  2789. : NumUtil.divide(p, 100),
  2790. ),
  2791. ),
  2792. ),
  2793. ],
  2794. mainAxisAlignment: MainAxisAlignment.spaceAround,
  2795. ),
  2796. ),
  2797. Container(
  2798. height: 0.5,
  2799. color: MyColors.cE7E7E7,
  2800. margin: EdgeInsets.only(bottom: 12),
  2801. ),
  2802. Container(
  2803. margin: EdgeInsets.symmetric(horizontal: 20),
  2804. child: GestureDetector(
  2805. behavior: HitTestBehavior.translucent,
  2806. onTap: () {
  2807. if (downloadCompleted) {
  2808. installApk(filePath);
  2809. }
  2810. },
  2811. child: Container(
  2812. decoration: BoxDecoration(
  2813. borderRadius: BorderRadius.circular(20),
  2814. color: downloadCompleted
  2815. ? MyColors.cFF4233
  2816. : MyColors.c999999),
  2817. height: 40,
  2818. child: MyViews().myText('安装', Colors.white, 14),
  2819. alignment: Alignment.center,
  2820. ),
  2821. ),
  2822. )
  2823. ],
  2824. mainAxisAlignment: MainAxisAlignment.center,
  2825. );
  2826. } else {
  2827. return Column(
  2828. children: [
  2829. Container(
  2830. height: 88,
  2831. child: MyViews().myText(
  2832. data.force
  2833. ? '检查到新版本(v${data.version}),本次属于强制更新,如不同意更新,将退出APP'
  2834. : '检查到新版本(v${data.version}),请问是否更新',
  2835. MyColors.c333333,
  2836. 14),
  2837. margin: EdgeInsets.symmetric(horizontal: 20),
  2838. alignment: Alignment.center,
  2839. ),
  2840. Container(
  2841. height: 0.5,
  2842. color: MyColors.cE7E7E7,
  2843. margin: EdgeInsets.only(bottom: 12),
  2844. ),
  2845. data.force
  2846. ? Expanded(
  2847. child: GestureDetector(
  2848. behavior: HitTestBehavior.translucent,
  2849. onTap: () {
  2850. if (Platform.isAndroid) {
  2851. downloadAPK(data, context);
  2852. startUpdate = true;
  2853. setState(() {});
  2854. } else if (Platform.isIOS) {
  2855. LaunchReview.launch(
  2856. writeReview: false,
  2857. iOSAppId: appStoreID);
  2858. } else {
  2859. Navigator.pop(context);
  2860. }
  2861. },
  2862. child: Container(
  2863. margin:
  2864. EdgeInsets.symmetric(horizontal: 10),
  2865. decoration: BoxDecoration(
  2866. borderRadius:
  2867. BorderRadius.circular(20),
  2868. color: MyColors.cFF4233),
  2869. height: 40,
  2870. child: MyViews()
  2871. .myText('立即更新', Colors.white, 14),
  2872. alignment: Alignment.center,
  2873. ),
  2874. ),
  2875. )
  2876. : Row(
  2877. children: [
  2878. Expanded(
  2879. child: GestureDetector(
  2880. onTap: () {
  2881. if (data.force) {
  2882. EventBus().off('允许安装');
  2883. EventBus().off('更新进度条');
  2884. SystemNavigator.pop();
  2885. } else {
  2886. EventBus().off('允许安装');
  2887. EventBus().off('更新进度条');
  2888. Navigator.pop(context);
  2889. }
  2890. },
  2891. behavior: HitTestBehavior.translucent,
  2892. child: Container(
  2893. margin: EdgeInsets.only(left: 10),
  2894. decoration: BoxDecoration(
  2895. borderRadius: BorderRadius.only(
  2896. topLeft: Radius.circular(20),
  2897. bottomLeft: Radius.circular(20),
  2898. ),
  2899. border: Border.all(
  2900. color: MyColors.cFF4233,
  2901. width: 1.1),
  2902. color: Colors.white),
  2903. child: MyViews().myText(
  2904. '暂不更新', MyColors.cFF4233, 14),
  2905. height: 40,
  2906. alignment: Alignment.center,
  2907. ),
  2908. ),
  2909. ),
  2910. Expanded(
  2911. child: GestureDetector(
  2912. behavior: HitTestBehavior.translucent,
  2913. onTap: () {
  2914. if (Platform.isAndroid) {
  2915. downloadAPK(data, context);
  2916. startUpdate = true;
  2917. setState(() {});
  2918. } else if (Platform.isIOS) {
  2919. LaunchReview.launch(
  2920. writeReview: false,
  2921. iOSAppId: appStoreID);
  2922. } else {
  2923. Navigator.pop(context);
  2924. }
  2925. },
  2926. child: Container(
  2927. margin: EdgeInsets.only(right: 10),
  2928. decoration: BoxDecoration(
  2929. borderRadius: BorderRadius.only(
  2930. topRight: Radius.circular(20),
  2931. bottomRight:
  2932. Radius.circular(20),
  2933. ),
  2934. color: MyColors.cFF4233),
  2935. height: 40,
  2936. child: MyViews()
  2937. .myText('立即更新', Colors.white, 14),
  2938. alignment: Alignment.center,
  2939. ),
  2940. ),
  2941. )
  2942. ],
  2943. )
  2944. ],
  2945. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2946. );
  2947. }
  2948. },
  2949. ),
  2950. ),
  2951. ),
  2952. );
  2953. }),
  2954. );
  2955. },
  2956. );
  2957. }
  2958. downloadAPK(AndroidAppVersionBeanData data, BuildContext context) async {
  2959. Directory storageDir = await getExternalStorageDirectory();
  2960. String storagePath = storageDir.path;
  2961. File file = new File(
  2962. '$storagePath/${PinyinHelper.getShortPinyin(MyCookie().packageInfo.appName)}.apk');
  2963. if (!file.existsSync()) {
  2964. file.createSync();
  2965. }
  2966. print(apkURL(data.download));
  2967. Dio().download(apkURL(data.download), file.path,
  2968. onReceiveProgress: (int count, int total) {
  2969. EventBus().emit('更新进度条', ((count / (data.size)) * 100).floor());
  2970. }).then((value) {
  2971. print('下载完成');
  2972. EventBus().emit('允许安装', file.path);
  2973. }).catchError((e) {
  2974. print(e);
  2975. Navigator.pop(context);
  2976. EventBus().off('允许安装');
  2977. EventBus().off('更新进度条');
  2978. EasyLoading.showToast('下载失败');
  2979. });
  2980. }
  2981. Widget advertisingItems(BuildContext context, AdBeanDataData data) {
  2982. double w = (MediaQuery.of(context).size.width - 47) / 2;
  2983. List<Color> colors = [
  2984. MyColors.cADD358,
  2985. MyColors.cFF4233,
  2986. MyColors.cFF88B4,
  2987. MyColors.cFFCD00
  2988. ];
  2989. List<String> types = ['投放中', '未付费', '已结束', '未投放'];
  2990. int typeIndex;
  2991. if (data.paid == false) {
  2992. typeIndex = 1;
  2993. } else {
  2994. var sT = DateTime.parse(data.startDate);
  2995. var eT = sT.add(Duration(days: data.days));
  2996. if (sT.isBefore(DateTime.now()) && eT.isAfter(DateTime.now())) {
  2997. typeIndex = 0;
  2998. } else if (sT.isAfter(DateTime.now())) {
  2999. typeIndex = 3;
  3000. } else if (eT.isBefore(DateTime.now())) {
  3001. typeIndex = 2;
  3002. }
  3003. }
  3004. return Card(
  3005. child: Column(
  3006. children: [
  3007. ClipRRect(
  3008. child: Container(
  3009. child: Stack(
  3010. children: [
  3011. MyViews().netImg(imgURL(data.coverPath), w, w,
  3012. placeholder: 'images/svg/goodsDefImg.svg'),
  3013. Positioned(
  3014. right: 0,
  3015. top: 5,
  3016. child: Container(
  3017. decoration: BoxDecoration(
  3018. color: colors[typeIndex],
  3019. borderRadius: BorderRadius.only(
  3020. topLeft: Radius.circular(7),
  3021. bottomLeft: Radius.circular(7),
  3022. ),
  3023. ),
  3024. height: 14,
  3025. width: 32,
  3026. child: MyViews().myText(types[typeIndex], Colors.white, 8),
  3027. alignment: Alignment.center,
  3028. ),
  3029. )
  3030. ],
  3031. ),
  3032. height: w,
  3033. width: w,
  3034. ),
  3035. borderRadius: BorderRadius.only(
  3036. topRight: Radius.circular(4), topLeft: Radius.circular(4)),
  3037. ),
  3038. Expanded(
  3039. child: Padding(
  3040. padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 10),
  3041. child: Column(
  3042. children: [
  3043. Text(
  3044. data.title,
  3045. style: TextStyle(color: MyColors.c333333, fontSize: 12),
  3046. maxLines: 1,
  3047. overflow: TextOverflow.ellipsis,
  3048. softWrap: true,
  3049. ),
  3050. Text(
  3051. '发布时间:${data.createTime}',
  3052. style: TextStyle(color: MyColors.c999999, fontSize: 9),
  3053. maxLines: 1,
  3054. overflow: TextOverflow.ellipsis,
  3055. softWrap: true,
  3056. ),
  3057. Text(
  3058. '开始时间:${data.startDate}',
  3059. style: TextStyle(color: MyColors.c999999, fontSize: 9),
  3060. maxLines: 1,
  3061. overflow: TextOverflow.ellipsis,
  3062. softWrap: true,
  3063. ),
  3064. Text(
  3065. '结束时间:${DateTime.parse(data.startDate).add(Duration(days: data.days)).toString().substring(0, 10)}',
  3066. style: TextStyle(color: MyColors.c999999, fontSize: 9),
  3067. maxLines: 1,
  3068. overflow: TextOverflow.ellipsis,
  3069. softWrap: true,
  3070. ),
  3071. ],
  3072. crossAxisAlignment: CrossAxisAlignment.start,
  3073. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  3074. ),
  3075. ),
  3076. )
  3077. ],
  3078. crossAxisAlignment: CrossAxisAlignment.start,
  3079. ),
  3080. );
  3081. }
  3082. Future<Null> installApk(String url) async {
  3083. InstallPlugin.installApk(url, MyCookie().packageInfo.packageName)
  3084. .then((result) {
  3085. print('install apk $result');
  3086. }).catchError((error) {
  3087. print('install apk error: $error');
  3088. });
  3089. }