my_views.dart 121 KB

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