my_views.dart 120 KB

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