my_views.dart 120 KB

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