my_views.dart 120 KB

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