gang_in_page.dart 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615
  1. import 'dart:async';
  2. import 'dart:convert';
  3. import 'dart:io';
  4. import 'dart:math';
  5. import 'package:azlistview/azlistview.dart';
  6. import 'package:bbyyy/beans/goods_bean_entity.dart';
  7. import 'package:bbyyy/beans/my_shop_bean_entity.dart';
  8. import 'package:bbyyy/beans/new_order_bean_entity.dart';
  9. import 'package:bbyyy/beans/smart_order_bean_entity.dart';
  10. import 'package:bbyyy/beans/store_bean_entity.dart';
  11. import 'package:bbyyy/beans/user_vp_bean_entity.dart';
  12. import 'package:bbyyy/https/MyDio.dart';
  13. import 'package:bbyyy/https/url.dart';
  14. import 'package:bbyyy/my_tools/const.dart';
  15. import 'package:bbyyy/my_tools/dims.dart';
  16. import 'package:bbyyy/my_tools/easy_loading/easy_loading.dart';
  17. import 'package:bbyyy/my_tools/event_bus.dart';
  18. import 'package:bbyyy/my_tools/map_util.dart';
  19. import 'package:bbyyy/my_tools/my_colors.dart';
  20. import 'package:bbyyy/my_tools/my_cookie.dart';
  21. import 'package:bbyyy/my_tools/my_tools.dart';
  22. import 'package:bbyyy/my_tools/my_views.dart';
  23. import 'package:bbyyy/my_tools/pop_up_queue.dart';
  24. import 'package:bbyyy/my_tools/role_permissions.dart';
  25. import 'package:bbyyy/paegs/chat_page/chat_page.dart';
  26. import 'package:bbyyy/paegs/gang_page/gang_in_page/gang_information_page/add_member_page/add_member_page.dart';
  27. import 'package:bbyyy/paegs/gang_page/gang_in_page/pay_to_the_helper_page/pay_to_the_helper_page.dart';
  28. import 'package:bbyyy/paegs/gang_page/gang_in_page/qr_pay_page/set_amount_page.dart';
  29. import 'package:bbyyy/paegs/gang_page/gang_in_page/shop_flow_page/shop_flow_page.dart';
  30. import 'package:bbyyy/paegs/gang_page/qr_code_for_store_payment_page/qr_code_for_store_payment_page.dart';
  31. import 'package:bbyyy/paegs/mine_page/privacy_protection_props_page/privacy_protection_props_page.dart';
  32. import 'package:bbyyy/paegs/mine_page/referrer_page/referrer_page.dart';
  33. import 'package:bbyyy/paegs/other_people_s_turnover_page/other_people_s_turnover_page.dart';
  34. import 'package:bbyyy/paegs/pay_page/order_information_page.dart';
  35. import 'package:bbyyy/paegs/release_goods_page/release_goods_page.dart';
  36. import 'package:flutter/cupertino.dart';
  37. import 'package:flutter/material.dart';
  38. import 'package:flutter_slidable/flutter_slidable.dart';
  39. import 'package:flutter_svg/svg.dart';
  40. import 'package:pull_to_refresh/pull_to_refresh.dart';
  41. import 'package:url_launcher/url_launcher.dart';
  42. import 'gang_information_page/gang_information_page.dart';
  43. import 'gang_information_page/member_list_page/member_details_page.dart';
  44. import 'initiate_collection_page/initiate_collection_page.dart';
  45. import 'scan_page/scan_page.dart';
  46. class GangInPage extends StatefulWidget {
  47. MyShopBeanDataData data;
  48. NewOrderBeanContent order;
  49. GangInPage(this.data, this.order);
  50. @override
  51. _GangInPageState createState() => _GangInPageState();
  52. }
  53. class _GangInPageState extends State<GangInPage> {
  54. int selectedIndex = 0;
  55. RefreshController controller = RefreshController(initialRefresh: true);
  56. int page = 1;
  57. bool collect = false;
  58. bool needRE = false;
  59. bool canSendGood = false;
  60. _GangInPageState();
  61. List<GoodsBeanDataData> goods = [];
  62. List<SmartOrderBeanDataData> orders = [];
  63. @override
  64. void initState() {
  65. // TODO: implement initState
  66. super.initState();
  67. EventBus().on('payAnOrder', (arg) {
  68. controller.requestRefresh();
  69. });
  70. EventBus().on('reNoPayOrder', (arg) {
  71. controller.requestRefresh();
  72. });
  73. EventBus().on('刷新未付订单', (arg) {
  74. controller.requestRefresh();
  75. });
  76. Future.delayed(Duration.zero, () {
  77. if (widget.order != null) {
  78. setState(() {
  79. selectedIndex = 2;
  80. payTheOrder();
  81. });
  82. }
  83. });
  84. if (paymentAuthority(widget.data.role)) {
  85. selectedIndex = 1;
  86. }
  87. queryWhetherToFollow();
  88. queryStoreInformation();
  89. }
  90. @override
  91. void dispose() {
  92. // TODO: implement dispose
  93. super.dispose();
  94. EventBus().off('payAnOrder');
  95. EventBus().off('reNoPayOrder');
  96. EventBus().off('刷新未付订单');
  97. }
  98. @override
  99. Widget build(BuildContext context) {
  100. return Scaffold(
  101. body: Column(
  102. children: [
  103. MyViews().myAppBar(widget.data.shopName, context, [
  104. Visibility(
  105. visible: false,
  106. child: IconButton(
  107. icon: Icon(Icons.qr_code_scanner),
  108. onPressed: () async {
  109. MyTools().toPage(context, ScanPage(), (then) {
  110. if (then is String) {
  111. if (then.isNotEmpty &&
  112. then != null &&
  113. then.length == 8) {
  114. Timer(Duration(milliseconds: 200), () {
  115. StoreBeanDataData store = StoreBeanDataData();
  116. store.ownerUid = widget.data.ownerUid;
  117. store.ownerName = widget.data.ownerName;
  118. store.uid = widget.data.shopUid;
  119. MyTools().toPage(
  120. context,
  121. AddMemberPage(
  122. store: store,
  123. qrUID: then,
  124. ),
  125. (then) {});
  126. MyTools().hideKeyboard(context);
  127. controller.requestRefresh();
  128. });
  129. }
  130. }
  131. });
  132. }),
  133. ),
  134. Visibility(
  135. visible: false,
  136. child: IconButton(
  137. icon: Icon(Icons.more_horiz),
  138. onPressed: () {
  139. MyTools().toPage(context, GangInformationPage(widget.data),
  140. (then) {
  141. if (then == '删除货帮') {
  142. Navigator.pop(context, '删除货帮');
  143. }
  144. });
  145. }),
  146. ),
  147. PopupMenuButton<String>(
  148. icon: Icon(Icons.more_horiz),
  149. onSelected: (v) {
  150. switch (v) {
  151. case '扫一扫':
  152. MyTools().toPage(context, ScanPage(), (then) {
  153. if (then is String) {
  154. if (then.isNotEmpty &&
  155. then != null &&
  156. then.length == 8) {
  157. Timer(Duration(milliseconds: 200), () {
  158. StoreBeanDataData store = StoreBeanDataData();
  159. store.ownerUid = widget.data.ownerUid;
  160. store.ownerName = widget.data.ownerName;
  161. store.uid = widget.data.shopUid;
  162. MyTools().toPage(
  163. context,
  164. AddMemberPage(
  165. store: store,
  166. qrUID: then,
  167. ),
  168. (then) {});
  169. MyTools().hideKeyboard(context);
  170. controller.requestRefresh();
  171. });
  172. }
  173. }
  174. });
  175. break;
  176. case '发布商品':
  177. MyTools().toPage(
  178. context, ReleaseGoodsPage(null, widget.data.shopName),
  179. (then) {
  180. controller.requestRefresh();
  181. });
  182. break;
  183. case '货帮详情':
  184. MyTools().toPage(context, GangInformationPage(widget.data),
  185. (then) {
  186. if (then == '删除货帮') {
  187. Navigator.pop(context, '删除货帮');
  188. }
  189. });
  190. break;
  191. case '收款二维码':
  192. MyTools().toPage(context,
  193. QRCodeForStorePaymentPage(widget.data), (then) {});
  194. break;
  195. case '货帮流水':
  196. MyTools()
  197. .toPage(context, ShopFlowPage(widget.data), (then) {});
  198. break;
  199. case '推荐人':
  200. MyTools().toPage(
  201. context, ReferrerPage(data: widget.data), (then) {});
  202. break;
  203. default:
  204. break;
  205. }
  206. },
  207. itemBuilder: (context) {
  208. return <PopupMenuEntry<String>>[
  209. if (canSendGood)
  210. PopupMenuItem<String>(
  211. value: '发布商品',
  212. child: Row(
  213. children: [
  214. SvgPicture.asset(
  215. 'images/svg/发布商品_icon.svg',
  216. height: 22,
  217. width: 22,
  218. ),
  219. Container(
  220. child: Text(
  221. '发布商品',
  222. style: TextStyle(
  223. fontSize: 14, color: MyColors.c333333),
  224. ),
  225. margin: EdgeInsets.only(left: 5),
  226. ),
  227. ],
  228. ),
  229. ),
  230. PopupMenuItem<String>(
  231. value: '货帮详情',
  232. child: Row(
  233. children: [
  234. SvgPicture.asset(
  235. 'images/svg/货帮详情_icon.svg',
  236. height: 20,
  237. width: 20,
  238. ),
  239. Container(
  240. child: Text(
  241. '货帮详情',
  242. style: TextStyle(
  243. fontSize: 14, color: MyColors.c333333),
  244. ),
  245. margin: EdgeInsets.only(left: 5),
  246. ),
  247. ],
  248. ),
  249. ),
  250. if (addMemberPermissions(widget.data.role))
  251. PopupMenuItem<String>(
  252. value: '扫一扫',
  253. child: Row(
  254. children: [
  255. SvgPicture.asset(
  256. 'images/svg/扫一扫_icon.svg',
  257. height: 20,
  258. width: 20,
  259. ),
  260. Container(
  261. child: Text(
  262. '扫一扫',
  263. style: TextStyle(
  264. fontSize: 14, color: MyColors.c333333),
  265. ),
  266. margin: EdgeInsets.only(left: 5),
  267. ),
  268. ],
  269. ),
  270. ),
  271. if (MyCookie().getUID() == widget.data.ownerUid &&
  272. !widget.data.privateShop)
  273. PopupMenuItem<String>(
  274. value: '收款二维码',
  275. child: Row(
  276. children: [
  277. SvgPicture.asset(
  278. 'images/svg/二维码.svg',
  279. height: 20,
  280. width: 20,
  281. ),
  282. Container(
  283. child: Text(
  284. '收款二维码',
  285. style: TextStyle(
  286. fontSize: 14, color: MyColors.c333333),
  287. ),
  288. margin: EdgeInsets.only(left: 5),
  289. ),
  290. ],
  291. ),
  292. ),
  293. if (checkStoreFlowPermissions(widget.data.role))
  294. PopupMenuItem<String>(
  295. value: '货帮流水',
  296. child: Row(
  297. children: [
  298. SvgPicture.asset(
  299. 'images/svg/流水.svg',
  300. height: 20,
  301. width: 20,
  302. ),
  303. Container(
  304. child: Text(
  305. '货帮流水',
  306. style: TextStyle(
  307. fontSize: 14, color: MyColors.c333333),
  308. ),
  309. margin: EdgeInsets.only(left: 5),
  310. ),
  311. ],
  312. ),
  313. ),
  314. if (viewReferralAuthority(widget.data.role))
  315. PopupMenuItem<String>(
  316. value: '推荐人',
  317. child: Row(
  318. children: [
  319. SvgPicture.asset(
  320. 'images/svg/推荐人.svg',
  321. height: 20,
  322. width: 20,
  323. ),
  324. Container(
  325. child: Text(
  326. '推荐人',
  327. style: TextStyle(
  328. fontSize: 14, color: MyColors.c333333),
  329. ),
  330. margin: EdgeInsets.only(left: 5),
  331. ),
  332. ],
  333. ),
  334. ),
  335. ];
  336. },
  337. )
  338. ]),
  339. Container(
  340. color: MyColors.cF7F7F7,
  341. child: Container(
  342. decoration: BoxDecoration(
  343. borderRadius: BorderRadius.circular(4), color: Colors.white),
  344. margin: EdgeInsets.all(10),
  345. child: Column(
  346. children: [
  347. Row(
  348. children: [
  349. Container(
  350. margin: EdgeInsets.only(
  351. right: 10, top: 6, left: 6, bottom: 6),
  352. child: GestureDetector(
  353. onTap: () {
  354. shopInfo();
  355. },
  356. behavior: HitTestBehavior.translucent,
  357. child: ClipRRect(
  358. child: MyViews()
  359. .netImg(imgURL(widget.data.shopPic), 65, 65),
  360. borderRadius: BorderRadius.circular(4),
  361. ),
  362. ),
  363. ),
  364. Expanded(
  365. child: Container(
  366. height: 65,
  367. margin: EdgeInsets.only(right: 6),
  368. child: Column(
  369. children: [
  370. Row(
  371. children: [
  372. Text(
  373. widget.data.shopName,
  374. style: TextStyle(
  375. color: MyColors.c333333, fontSize: 13),
  376. maxLines: 1,
  377. overflow: TextOverflow.ellipsis,
  378. softWrap: true,
  379. ),
  380. ],
  381. mainAxisAlignment:
  382. MainAxisAlignment.spaceBetween,
  383. ),
  384. Row(
  385. children: [
  386. Expanded(
  387. child: Text(
  388. store != null &&
  389. store.introduction.isNotEmpty
  390. ? '货帮介绍:${store.introduction}'
  391. : '货帮介绍:暂无',
  392. style: TextStyle(
  393. color: MyColors.c666666,
  394. fontSize: 11),
  395. maxLines: 1,
  396. overflow: TextOverflow.ellipsis,
  397. softWrap: true,
  398. ),
  399. ),
  400. ],
  401. crossAxisAlignment: CrossAxisAlignment.center,
  402. ),
  403. GestureDetector(
  404. onTap: (){
  405. mapNavigationPopup();
  406. },
  407. behavior:
  408. HitTestBehavior.translucent,
  409. child: Row(
  410. children: [
  411. SvgPicture.asset(
  412. 'images/svg/地址.svg',
  413. color: MyColors.c666666,
  414. height: 12,
  415. width: 12,
  416. ),
  417. Container(
  418. width: 5,
  419. ),
  420. Expanded(
  421. child: Text(
  422. store != null && store.address.isNotEmpty
  423. ? store.address
  424. : '暂无',
  425. style: TextStyle(
  426. color: MyColors.c666666,
  427. fontSize: 11),
  428. maxLines: 1,
  429. overflow: TextOverflow.ellipsis,
  430. softWrap: true,
  431. ),
  432. ),
  433. ],
  434. ),
  435. ),
  436. ],
  437. crossAxisAlignment: CrossAxisAlignment.start,
  438. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  439. ),
  440. ),
  441. ),
  442. Visibility(
  443. visible: !widget.data.privateShop,
  444. child: GestureDetector(
  445. child: Container(
  446. margin: EdgeInsets.all(12),
  447. child: SvgPicture.asset(
  448. collect
  449. ? 'images/svg/已收藏.svg'
  450. : 'images/svg/未收藏.svg',
  451. height: 20,
  452. width: 20,
  453. ),
  454. ),
  455. onTap: () {
  456. if (MyCookie().getUID() == widget.data.ownerUid) {
  457. return;
  458. }
  459. EasyLoading.show();
  460. collectionShop();
  461. },
  462. ),
  463. ),
  464. ],
  465. ),
  466. Container(
  467. height: 0.5,
  468. color: MyColors.cE7E7E7,
  469. ),
  470. Visibility(
  471. visible: store != null && store.mobile.isNotEmpty,
  472. child: Container(
  473. margin: EdgeInsets.all(6),
  474. child: Row(
  475. children: [
  476. Row(
  477. children: [
  478. SvgPicture.asset(
  479. 'images/svg/电话.svg',
  480. height: 18,
  481. width: 18,
  482. ),
  483. Container(
  484. width: 5,
  485. ),
  486. Text(
  487. store == null ? '暂无' : store.mobile,
  488. style: TextStyle(
  489. color: MyColors.cFF4233, fontSize: 12),
  490. ),
  491. ],
  492. ),
  493. GestureDetector(
  494. onTap: () {
  495. launch('tel:${store.mobile}');
  496. },
  497. behavior: HitTestBehavior.translucent,
  498. child: Container(
  499. decoration: BoxDecoration(
  500. color: MyColors.cFF4233,
  501. borderRadius: BorderRadius.circular(10),
  502. ),
  503. height: 20,
  504. width: 50,
  505. child: MyViews().myText('点击拨打', Colors.white, 9),
  506. alignment: Alignment.center,
  507. ),
  508. )
  509. ],
  510. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  511. ),
  512. ),
  513. )
  514. ],
  515. ),
  516. ),
  517. ),
  518. Visibility(
  519. visible: widget.data.privateShop ||
  520. paymentAuthority(widget.data.role),
  521. child: Container(
  522. height: 40,
  523. color: Colors.white,
  524. child: Row(
  525. children: [
  526. Expanded(
  527. flex: 1,
  528. child: GestureDetector(
  529. onTap: () {
  530. setState(() {
  531. selectedIndex = 0;
  532. controller.requestRefresh();
  533. });
  534. },
  535. behavior: HitTestBehavior.translucent,
  536. child: Padding(
  537. padding: EdgeInsets.only(left: 10, right: 10),
  538. child: Column(
  539. children: [
  540. Text(
  541. '货帮商品',
  542. style: TextStyle(
  543. color: selectedIndex == 0
  544. ? MyColors.cFF4233
  545. : MyColors.c666666,
  546. fontSize: 15),
  547. ),
  548. Container(
  549. height: 10,
  550. child: Visibility(
  551. child: SvgPicture.asset('images/svg/tab.svg'),
  552. visible: selectedIndex == 0,
  553. ),
  554. )
  555. ],
  556. mainAxisAlignment: MainAxisAlignment.end,
  557. ),
  558. ),
  559. ),
  560. ),
  561. Expanded(
  562. flex: 1,
  563. child: GestureDetector(
  564. onTap: () {
  565. setState(() {
  566. selectedIndex = 1;
  567. controller.requestRefresh();
  568. });
  569. },
  570. behavior: HitTestBehavior.translucent,
  571. child: Padding(
  572. padding: EdgeInsets.only(left: 10, right: 10),
  573. child: Column(
  574. children: [
  575. Text(
  576. paymentAuthority(widget.data.role)
  577. ? '未付订单'
  578. : '未收订单',
  579. style: TextStyle(
  580. color: selectedIndex == 1
  581. ? MyColors.cFF4233
  582. : MyColors.c666666,
  583. fontSize: 15),
  584. ),
  585. Container(
  586. height: 10,
  587. child: Visibility(
  588. child: SvgPicture.asset('images/svg/tab.svg'),
  589. visible: selectedIndex == 1,
  590. ),
  591. )
  592. ],
  593. mainAxisAlignment: MainAxisAlignment.end,
  594. ),
  595. ),
  596. ),
  597. ),
  598. Expanded(
  599. flex: 1,
  600. child: GestureDetector(
  601. onTap: () {
  602. setState(() {
  603. selectedIndex = 2;
  604. controller.requestRefresh();
  605. });
  606. },
  607. behavior: HitTestBehavior.translucent,
  608. child: Padding(
  609. padding: EdgeInsets.only(left: 10, right: 10),
  610. child: Column(
  611. children: [
  612. Text(
  613. paymentAuthority(widget.data.role)
  614. ? '已付订单'
  615. : '未付订单',
  616. style: TextStyle(
  617. color: selectedIndex == 2
  618. ? MyColors.cFF4233
  619. : MyColors.c666666,
  620. fontSize: 15),
  621. ),
  622. Container(
  623. height: 10,
  624. child: Visibility(
  625. child: SvgPicture.asset('images/svg/tab.svg'),
  626. visible: selectedIndex == 2,
  627. ),
  628. )
  629. ],
  630. mainAxisAlignment: MainAxisAlignment.end,
  631. ),
  632. ),
  633. ),
  634. ),
  635. Expanded(
  636. flex: MyCookie().getUID() == widget.data.ownerUid ||
  637. !hideMember
  638. ? 1
  639. : 0,
  640. child: Visibility(
  641. visible: MyCookie().getUID() == widget.data.ownerUid ||
  642. !hideMember,
  643. child: GestureDetector(
  644. onTap: () {
  645. setState(() {
  646. selectedIndex = 3;
  647. controller.requestRefresh();
  648. });
  649. },
  650. behavior: HitTestBehavior.translucent,
  651. child: Padding(
  652. padding: EdgeInsets.only(left: 10, right: 10),
  653. child: Column(
  654. children: [
  655. Text(
  656. '货帮成员',
  657. style: TextStyle(
  658. color: selectedIndex == 3
  659. ? MyColors.cFF4233
  660. : MyColors.c666666,
  661. fontSize: 15),
  662. ),
  663. Container(
  664. height: 10,
  665. child: Visibility(
  666. child: SvgPicture.asset('images/svg/tab.svg'),
  667. visible: selectedIndex == 3,
  668. ),
  669. )
  670. ],
  671. mainAxisAlignment: MainAxisAlignment.end,
  672. ),
  673. ),
  674. ),
  675. ),
  676. )
  677. ],
  678. ),
  679. ),
  680. ),
  681. body(),
  682. Container(
  683. color: Colors.white,
  684. child: SafeArea(
  685. top: false,
  686. child: Container(
  687. padding: EdgeInsets.symmetric(horizontal: 37),
  688. color: Colors.white,
  689. width: double.infinity,
  690. height: 60,
  691. child: Row(
  692. children: [
  693. Expanded(
  694. child: GestureDetector(
  695. onTap: () {
  696. if (!widget.data.privateShop &&
  697. MyCookie().getUID() == widget.data.ownerUid) {
  698. MyTools().toPage(
  699. context, SetAmountPage(widget.data), (then) {});
  700. } else {
  701. queryShopMembers(true);
  702. }
  703. },
  704. behavior: HitTestBehavior.translucent,
  705. child: Container(
  706. decoration: BoxDecoration(
  707. borderRadius: BorderRadius.only(
  708. topLeft: Radius.circular(20),
  709. bottomLeft: Radius.circular(20),
  710. ),
  711. border: Border.all(
  712. color: MyColors.cFF4233, width: 1)),
  713. height: 40,
  714. child: MyViews().myText(
  715. !widget.data.privateShop &&
  716. MyCookie().getUID() ==
  717. widget.data.ownerUid
  718. ? '扫码收款'
  719. : '联系帮主',
  720. MyColors.cFF4233,
  721. 14),
  722. alignment: Alignment.center),
  723. ),
  724. ),
  725. Expanded(
  726. child: GestureDetector(
  727. onTap: () {
  728. if (MyCookie().getUID() == widget.data.ownerUid) {
  729. MyTools().toPage(
  730. context, InitiateCollectionPage(widget.data),
  731. (then) {
  732. if (then is String && then == '发起收款') {
  733. controller.requestRefresh();
  734. }
  735. });
  736. } else {
  737. MyTools().toPage(context,
  738. PayToTheHelperPage(widget.data), (then) {});
  739. }
  740. },
  741. behavior: HitTestBehavior.translucent,
  742. child: Container(
  743. decoration: BoxDecoration(
  744. borderRadius: BorderRadius.only(
  745. topRight: Radius.circular(20),
  746. bottomRight: Radius.circular(20),
  747. ),
  748. color: MyColors.cFF4233),
  749. height: 40,
  750. child: MyViews().myText(
  751. MyCookie().getUID() == widget.data.ownerUid
  752. ? '发起收款'
  753. : '到店付款',
  754. Colors.white,
  755. 14),
  756. alignment: Alignment.center),
  757. ),
  758. )
  759. ],
  760. ),
  761. ),
  762. ),
  763. )
  764. ],
  765. ),
  766. );
  767. }
  768. body() {
  769. if (selectedIndex == 0) {
  770. return Expanded(
  771. child: SmartRefresher(
  772. controller: controller,
  773. onRefresh: onRefresh,
  774. onLoading: onLoading,
  775. enablePullDown: true,
  776. enablePullUp: true,
  777. child: goods.length == 0
  778. ? SingleChildScrollView(child: noData())
  779. : GridView.builder(
  780. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  781. crossAxisCount: 2, //每行三列
  782. childAspectRatio: 164 / 261, //显示区域宽高相等
  783. mainAxisSpacing: 8,
  784. crossAxisSpacing: 8),
  785. itemCount: goods.length,
  786. padding:
  787. EdgeInsets.only(left: 14, right: 14, top: 14, bottom: 65),
  788. itemBuilder: (context, index) {
  789. return MyViews().getGoodsItem(goods[index], context);
  790. }),
  791. ),
  792. );
  793. } else if (selectedIndex == 1) {
  794. return Expanded(
  795. child: SmartRefresher(
  796. controller: controller,
  797. onRefresh: onRefresh,
  798. onLoading: onLoading,
  799. enablePullDown: true,
  800. enablePullUp: true,
  801. child: orders.length == 0
  802. ? SingleChildScrollView(child: noData())
  803. : ListView.builder(
  804. itemBuilder: (c, index) {
  805. return Slidable(
  806. child: MyViews().getNoPayGoodsItem(
  807. orders[index], context, widget.data.ownerUid,widget.data.role),
  808. actionPane: SlidableDrawerActionPane(),
  809. enabled: paymentAuthority(widget.data.role),
  810. actionExtentRatio: 0.25,
  811. secondaryActions: <Widget>[
  812. SlideAction(
  813. child: Container(
  814. child: Container(
  815. decoration: BoxDecoration(
  816. borderRadius: BorderRadius.circular(30),
  817. color: MyColors.cFF4233,
  818. ),
  819. height: 60,
  820. width: 60,
  821. child: SvgPicture.asset(
  822. 'images/svg/del.svg',
  823. height: 40,
  824. width: 40,
  825. ),
  826. alignment: Alignment.center,
  827. ),
  828. ),
  829. onTap: () {
  830. showSimpleDialog(
  831. '将删除订单(${orders[index].uid})', context, () {
  832. Navigator.pop(context);
  833. deleteOrder(orders[index]);
  834. });
  835. },
  836. )
  837. ],
  838. );
  839. },
  840. itemCount: orders.length,
  841. padding: EdgeInsets.only(left: 10, right: 10, top: 10),
  842. ),
  843. ),
  844. );
  845. } else if (selectedIndex == 2) {
  846. return Expanded(
  847. child: SmartRefresher(
  848. controller: controller,
  849. onRefresh: onRefresh,
  850. onLoading: onLoading,
  851. enablePullDown: true,
  852. enablePullUp: true,
  853. child: orders.length == 0
  854. ? SingleChildScrollView(child: noData())
  855. : ListView.builder(
  856. itemBuilder: (c, index) {
  857. return Slidable(
  858. child: MyViews().getNoPayGoodsItem(
  859. orders[index], context, widget.data.ownerUid,widget.data.role),
  860. actionPane: SlidableDrawerActionPane(),
  861. enabled: orders[index].type == orderTypeOfflineTransfer &&
  862. orders[index].buyerUid == MyCookie().getUID(),
  863. actionExtentRatio: 0.25,
  864. secondaryActions: <Widget>[
  865. SlideAction(
  866. child: Container(
  867. child: Container(
  868. decoration: BoxDecoration(
  869. borderRadius: BorderRadius.circular(30),
  870. color: MyColors.cFF4233,
  871. ),
  872. height: 60,
  873. width: 60,
  874. child: SvgPicture.asset(
  875. 'images/svg/del.svg',
  876. height: 40,
  877. width: 40,
  878. ),
  879. alignment: Alignment.center,
  880. ),
  881. ),
  882. onTap: () {
  883. showSimpleDialog(
  884. '将删除订单(${orders[index].uid})', context, () {
  885. Navigator.pop(context);
  886. deleteOrder(orders[index]);
  887. });
  888. },
  889. )
  890. ],
  891. );
  892. },
  893. itemCount: orders.length,
  894. padding: EdgeInsets.only(left: 10, right: 10, top: 10),
  895. ),
  896. ),
  897. );
  898. } else if (selectedIndex == 3) {
  899. return Expanded(
  900. child: SmartRefresher(
  901. controller: controller,
  902. onRefresh: onRefresh,
  903. onLoading: onLoading,
  904. enablePullDown: true,
  905. enablePullUp: true,
  906. child: member.length == 0
  907. ? SingleChildScrollView(child: noData())
  908. : Container(
  909. margin: EdgeInsets.only(top: 10),
  910. child: AzListView(
  911. itemBuilder: (c, index) {
  912. return GestureDetector(
  913. onTap: () {
  914. if (permissionToModifyCustomerName(widget.data.role)) {
  915. if (MyCookie().getUID() != member[index].userUid) {
  916. MyTools().toPage(
  917. context, MemberDetailsPage(member[index]),
  918. (then) {
  919. controller.requestRefresh();
  920. });
  921. }
  922. } else {
  923. return;
  924. }
  925. },
  926. behavior: HitTestBehavior.translucent,
  927. child: Container(
  928. padding: EdgeInsets.only(left: 15, right: 15),
  929. color: Colors.white,
  930. child: Column(
  931. children: [
  932. Container(
  933. margin: EdgeInsets.only(top: 8, bottom: 6),
  934. child: Row(
  935. children: [
  936. Row(
  937. children: [
  938. Container(
  939. margin: EdgeInsets.only(right: 6),
  940. child: ClipRRect(
  941. child: MyViews().netImg(
  942. imgURL(member[index].userPic),
  943. 42,
  944. 42),
  945. borderRadius:
  946. BorderRadius.circular(21),
  947. ),
  948. ),
  949. MyViews().myText(
  950. '${member[index].userName} ${store.ownerUid == MyCookie().getUID() ? '(${member[index].userUid})' : ''}',
  951. MyColors.c333333,
  952. 15),
  953. Visibility(
  954. visible: member[index].role !=
  955. shopUserMember,
  956. child: Container(
  957. decoration: BoxDecoration(
  958. color: MyColors.cFFCD00,
  959. borderRadius:
  960. BorderRadius.circular(8)),
  961. height: 16,
  962. padding: EdgeInsets.symmetric(
  963. horizontal: 5),
  964. child: MyViews().myText(
  965. roleText(member[index].role),
  966. Colors.white,
  967. 10),
  968. alignment: Alignment.center,
  969. margin: EdgeInsets.only(left: 5),
  970. ),
  971. )
  972. ],
  973. ),
  974. Visibility(
  975. visible:
  976. member[index].role != shopUserOwner &&
  977. member[index].userUid !=
  978. MyCookie().getUID(),
  979. child: GestureDetector(
  980. child: Container(
  981. margin: EdgeInsets.only(right: 10),
  982. child: SvgPicture.asset(
  983. 'images/svg/透视.svg',
  984. height: 25,
  985. width: 25,
  986. ),
  987. ),
  988. onTap: () {
  989. queryWhetherThereIsANumberOfPerspectives(
  990. member[index], store, context);
  991. },
  992. behavior: HitTestBehavior.translucent,
  993. ),
  994. ),
  995. ],
  996. mainAxisAlignment:
  997. MainAxisAlignment.spaceBetween,
  998. ),
  999. ),
  1000. Container(
  1001. height: 0.5,
  1002. color: MyColors.cE7E7E7,
  1003. )
  1004. ],
  1005. ),
  1006. ),
  1007. );
  1008. },
  1009. itemCount: member.length,
  1010. data: member,
  1011. ),
  1012. ),
  1013. ),
  1014. );
  1015. } else {
  1016. return SingleChildScrollView(child: noData());
  1017. }
  1018. }
  1019. void onRefresh() {
  1020. page = 1;
  1021. if (selectedIndex == 0) {
  1022. queryProducts();
  1023. } else if (selectedIndex == 1) {
  1024. unreceivedOrder();
  1025. } else if (selectedIndex == 3) {
  1026. queryShopMembers(false);
  1027. } else {
  1028. unpaidOrder();
  1029. }
  1030. }
  1031. void onLoading() {
  1032. page++;
  1033. if (selectedIndex == 0) {
  1034. queryProducts();
  1035. } else if (selectedIndex == 1) {
  1036. unreceivedOrder();
  1037. } else if (selectedIndex == 3) {
  1038. queryShopMembers(false);
  1039. } else {
  1040. unpaidOrder();
  1041. }
  1042. }
  1043. //查询商品
  1044. void queryProducts() {
  1045. MyDio().query({
  1046. "key": "commodity",
  1047. "filters": {
  1048. "conditions": ["shop_uid == ${widget.data.shopUid}", "on_sale == true"]
  1049. },
  1050. "dims": commodityDims,
  1051. "order_by": ["id,desc", "no,desc"],
  1052. "paging": [page, 20]
  1053. }, (response, hasError) {
  1054. if (!hasError) {
  1055. GoodsBeanEntity entity =
  1056. GoodsBeanEntity().fromJson(json.decode(response.data.toString()));
  1057. if (page == 1) {
  1058. goods.clear();
  1059. }
  1060. goods.addAll(entity.data.data);
  1061. }
  1062. setState(() {
  1063. endRe(controller);
  1064. });
  1065. }, (error) {
  1066. setState(() {
  1067. endRe(controller);
  1068. });
  1069. });
  1070. }
  1071. //查询未收订单
  1072. void unreceivedOrder() {
  1073. var conditions = [];
  1074. if (paymentAuthority(widget.data.role)) {
  1075. conditions.add('state == $orderStateUnpaid');
  1076. conditions.add('shop_uid == ${widget.data.shopUid}');
  1077. } else {
  1078. conditions.add('state == $orderStateUnpaid');
  1079. conditions.add('shop_uid == ${widget.data.shopUid}');
  1080. conditions.add('seller_uid == ${MyCookie().getUID()}');
  1081. }
  1082. MyDio().query({
  1083. "key": "order",
  1084. "filters": {"conditions": conditions},
  1085. "dims": orderDims,
  1086. "paging": [page, 20],
  1087. "order_by": ["create_time,DESC"]
  1088. }, (response, hasError) {
  1089. if (!hasError) {
  1090. SmartOrderBeanEntity entity = SmartOrderBeanEntity()
  1091. .fromJson(json.decode(response.data.toString()));
  1092. if (page == 1) {
  1093. orders.clear();
  1094. }
  1095. orders.addAll(entity.data.data);
  1096. setState(() {});
  1097. }
  1098. endRe(controller);
  1099. }, (error) {});
  1100. }
  1101. //查询未付订单
  1102. void unpaidOrder() {
  1103. var conditions = [];
  1104. if (paymentAuthority(widget.data.role)) {
  1105. conditions.add('state == $orderStatePaid');
  1106. conditions.add('shop_uid == ${widget.data.shopUid}');
  1107. } else {
  1108. conditions.add('state == $orderStateUnpaid');
  1109. conditions.add('shop_uid == ${widget.data.shopUid}');
  1110. conditions.add('buyer_name LIKE ${MyCookie().getName()}');
  1111. }
  1112. MyDio().query({
  1113. "key": "order",
  1114. "filters": {"conditions": conditions},
  1115. "dims": orderDims,
  1116. "paging": [page, 20],
  1117. "order_by": ["create_time,DESC"]
  1118. }, (response, hasError) {
  1119. if (!hasError) {
  1120. SmartOrderBeanEntity entity = SmartOrderBeanEntity()
  1121. .fromJson(json.decode(response.data.toString()));
  1122. if (page == 1) {
  1123. orders.clear();
  1124. }
  1125. orders.addAll(entity.data.data);
  1126. setState(() {});
  1127. }
  1128. endRe(controller);
  1129. }, (error) {});
  1130. }
  1131. payTheOrder() {
  1132. SmartOrderBeanDataData data = SmartOrderBeanDataData();
  1133. data.sellerUid = widget.order.sellerUID;
  1134. data.sellerName = widget.order.sellerName;
  1135. data.sellerPic = widget.order.sellerPic;
  1136. data.buyerUid = 0;
  1137. data.buyerName = widget.order.buyerName;
  1138. data.buyerPic = '';
  1139. data.amount = widget.order.amount;
  1140. data.uid = widget.order.uID;
  1141. MyTools().toPage(
  1142. context,
  1143. OrderInformationPage(
  1144. false,
  1145. orderType: orderTypeThirdPlatform,
  1146. amount: widget.order.amount,
  1147. uid: widget.order.uID,
  1148. buyerUid: MyCookie().getUID(),
  1149. buyerName: widget.order.buyerName,
  1150. buyerPic: MyCookie().getPic(),
  1151. commodityCount: 1,
  1152. commodityTitle: '第三方订单',
  1153. commodityCover: '',
  1154. sellName: widget.order.sellerName,
  1155. sellPic: widget.order.sellerPic,
  1156. sellUid: widget.order.sellerUID,
  1157. ), (then) {
  1158. controller.requestRefresh();
  1159. PopUpQueue().onShow = false;
  1160. PopUpQueue().showNext();
  1161. });
  1162. // showPayDialog(data, context, () {
  1163. // Navigator.pop(context);
  1164. // // MyTools().toPage(context,
  1165. // // PayPage(widget.order.uID, false, widget.order.amount), (then) {});
  1166. //
  1167. // });
  1168. }
  1169. List<MyShopBeanDataData> member = [];
  1170. List<MyShopBeanDataData> helper = [];
  1171. queryShopMembers(bool toOwner) {
  1172. MyDio().query({
  1173. "key": "shop_user",
  1174. "filters": {
  1175. "conditions": ["shop_uid==${widget.data.shopUid}", "review_state==1"]
  1176. },
  1177. "dims": shopUserDims,
  1178. "paging": [1, 2000]
  1179. }, (response, hasError) {
  1180. if (!hasError) {
  1181. MyShopBeanEntity entity =
  1182. MyShopBeanEntity().fromJson(json.decode(response.data.toString()));
  1183. member = entity.data.data;
  1184. if (toOwner) {
  1185. helper.clear();
  1186. member.forEach((element) {
  1187. if (element.role == shopUserStaff) {
  1188. helper.add(element);
  1189. }
  1190. });
  1191. MyShopBeanDataData chatWith;
  1192. // if (helper.length == 0) {
  1193. chatWith = member[
  1194. member.indexWhere((element) => element.role == shopUserOwner)];
  1195. // } else {
  1196. // chatWith = helper[Random().nextInt(helper.length)];
  1197. // }
  1198. MyTools().toPage(context, ChatPage(chatWith, null), (then) {});
  1199. } else {
  1200. controller.refreshCompleted();
  1201. controller.loadComplete();
  1202. setState(() {});
  1203. }
  1204. }
  1205. }, (error) {});
  1206. }
  1207. void deleteOrder(SmartOrderBeanDataData order) {
  1208. MyDio().del({
  1209. 'key': 'order',
  1210. 'ids': [order.id]
  1211. }, (response, hasError) {
  1212. if (!hasError) {
  1213. orders.remove(order);
  1214. setState(() {});
  1215. }
  1216. }, (error) {});
  1217. }
  1218. StoreBeanDataData store;
  1219. bool hideMember = true;
  1220. queryStoreInformation() {
  1221. MyDio().query({
  1222. "key": "shop",
  1223. "filters": {
  1224. "conditions": ["uid == ${widget.data.shopUid}"]
  1225. },
  1226. "dims": shopDims,
  1227. "paging": [1, 5]
  1228. }, (response, hasError) {
  1229. if (!hasError) {
  1230. StoreBeanEntity entity =
  1231. StoreBeanEntity().fromJson(json.decode(response.data.toString()));
  1232. store = entity.data.data[0];
  1233. hideMember = store.hideMembers;
  1234. //自己的公开店铺
  1235. if (!store.private && store.ownerUid == MyCookie().getUID()) {
  1236. canSendGood = true;
  1237. }
  1238. //自己在某个允许顾客间交易的私有店铺中
  1239. if (store.innerTrade) {
  1240. canSendGood = true;
  1241. }
  1242. setState(() {});
  1243. }
  1244. endRe(controller);
  1245. }, (error) {});
  1246. }
  1247. void queryWhetherThereIsANumberOfPerspectives(
  1248. MyShopBeanDataData data, StoreBeanDataData store, BuildContext context) {
  1249. MyDio().query({
  1250. "key": "user_vp",
  1251. "filters": {
  1252. "conditions": [
  1253. "user_uid == ${MyCookie().getUID()}",
  1254. "vp_key == $vpKeyXRay"
  1255. ]
  1256. },
  1257. "dims": userVpDims,
  1258. "paging": [1, 2000]
  1259. }, (response, hasError) {
  1260. UserVpBeanEntity entity =
  1261. UserVpBeanEntity().fromJson(json.decode(response.data.toString()));
  1262. if (entity.data.data.length != 0) {
  1263. MyTools().toPage(context, OtherPeopleSTurnoverPage(data), (then) {});
  1264. } else {
  1265. // showSimpleDialog('你还未获取透视道具或道具用完,请先购买次数再查看。', context, () {
  1266. // Navigator.pop(context);
  1267. // MyShopBeanDataData shop = MyShopBeanDataData();
  1268. // shop.shopUid = store.uid;
  1269. // shop.shopName = store.name;
  1270. // shop.shopPic = store.picture;
  1271. // MyTools().toPage(
  1272. // context, PrivacyProtectionPropsPage(shop, vpKeyXRay), (then) {});
  1273. // });
  1274. MyShopBeanDataData shop = MyShopBeanDataData();
  1275. shop.shopUid = store.uid;
  1276. shop.shopName = store.name;
  1277. shop.shopPic = store.picture;
  1278. MyTools().toPage(
  1279. context, PrivacyProtectionPropsPage(shop, vpKeyXRay), (then) {});
  1280. }
  1281. }, (error) {});
  1282. }
  1283. void shopInfo() {
  1284. showDialog(
  1285. context: context,
  1286. builder: (BuildContext context) {
  1287. return GestureDetector(
  1288. onTap: () {
  1289. Navigator.pop(context);
  1290. },
  1291. child: Material(
  1292. color: Colors.black12,
  1293. child: Center(
  1294. child: GestureDetector(
  1295. onTap: () {},
  1296. child: Container(
  1297. decoration: BoxDecoration(
  1298. borderRadius: BorderRadius.circular(16),
  1299. color: Colors.white,
  1300. ),
  1301. height: 510,
  1302. margin: EdgeInsets.symmetric(horizontal: 28),
  1303. padding: EdgeInsets.symmetric(horizontal: 14, vertical: 15),
  1304. child: Column(
  1305. children: [
  1306. Container(
  1307. height: MediaQuery.of(context).size.width - 71,
  1308. width: MediaQuery.of(context).size.width - 56,
  1309. child: ClipRRect(
  1310. child: MyViews().netImg(
  1311. imgURL(widget.data.shopPic),
  1312. MediaQuery.of(context).size.width - 84,
  1313. MediaQuery.of(context).size.width - 84),
  1314. borderRadius: BorderRadius.circular(4),
  1315. ),
  1316. ),
  1317. Row(
  1318. children: [
  1319. SvgPicture.asset(
  1320. 'images/svg/店铺.svg',
  1321. height: 21,
  1322. width: 21,
  1323. ),
  1324. Container(
  1325. width: 6,
  1326. ),
  1327. Expanded(
  1328. child: Text(
  1329. widget.data.shopName,
  1330. style: TextStyle(
  1331. color: MyColors.c333333, fontSize: 16),
  1332. ))
  1333. ],
  1334. ),
  1335. Container(
  1336. height: 10,
  1337. ),
  1338. Text(
  1339. store != null && store.introduction.isNotEmpty
  1340. ? '货帮介绍:${store.introduction}'
  1341. : '货帮介绍:暂无',
  1342. style: TextStyle(
  1343. color: MyColors.c333333,
  1344. fontSize: 12,
  1345. ),
  1346. maxLines: 3,
  1347. overflow: TextOverflow.ellipsis,
  1348. softWrap: true,
  1349. ),
  1350. Container(
  1351. height: 10,
  1352. ),
  1353. Row(
  1354. children: [
  1355. SvgPicture.asset(
  1356. 'images/svg/地址.svg',
  1357. color: MyColors.c666666,
  1358. height: 12,
  1359. width: 12,
  1360. ),
  1361. Container(
  1362. width: 5,
  1363. ),
  1364. Expanded(
  1365. child: Text(
  1366. store != null && store.address.isNotEmpty
  1367. ? store.address
  1368. : '暂无',
  1369. style: TextStyle(
  1370. color: MyColors.c666666, fontSize: 11),
  1371. maxLines: 1,
  1372. overflow: TextOverflow.ellipsis,
  1373. softWrap: true,
  1374. ),
  1375. ),
  1376. ],
  1377. ),
  1378. Container(
  1379. height: 10,
  1380. ),
  1381. Visibility(
  1382. visible: store != null && store.mobile.isNotEmpty,
  1383. child: GestureDetector(
  1384. onTap: () {
  1385. launch('tel:${store.mobile}');
  1386. },
  1387. behavior: HitTestBehavior.translucent,
  1388. child: Container(
  1389. decoration: BoxDecoration(
  1390. color: MyColors.cFF4233,
  1391. borderRadius: BorderRadius.circular(20),
  1392. ),
  1393. height: 40,
  1394. child: Row(
  1395. children: [
  1396. SvgPicture.asset(
  1397. 'images/svg/电话.svg',
  1398. color: Colors.white,
  1399. height: 24,
  1400. width: 24,
  1401. ),
  1402. Container(
  1403. width: 4,
  1404. ),
  1405. Text(
  1406. store == null ? '' : store.mobile,
  1407. style: TextStyle(
  1408. color: Colors.white, fontSize: 15),
  1409. ),
  1410. ],
  1411. mainAxisAlignment: MainAxisAlignment.center,
  1412. ),
  1413. alignment: Alignment.center,
  1414. ),
  1415. ),
  1416. )
  1417. ],
  1418. mainAxisAlignment: MainAxisAlignment.spaceAround,
  1419. crossAxisAlignment: CrossAxisAlignment.start,
  1420. ),
  1421. ),
  1422. ),
  1423. ),
  1424. ),
  1425. );
  1426. },
  1427. );
  1428. }
  1429. void collectionShop() {
  1430. if (!collect) {
  1431. MyDio().save({
  1432. 'key': 'shop_user',
  1433. 'object': {
  1434. 'review_state': 1,
  1435. 'user_uid': MyCookie().getUID(),
  1436. 'shop_uid': widget.data.shopUid,
  1437. 'role': shopUserMember
  1438. }
  1439. }, (response, hasError) {
  1440. if (!hasError) {
  1441. needRE = !needRE;
  1442. EventBus().emit('needRE', needRE);
  1443. showToast('收藏成功');
  1444. queryWhetherToFollow();
  1445. }
  1446. }, (error) {});
  1447. } else {
  1448. MyDio().del({
  1449. 'key': 'shop_user',
  1450. 'ids': [shopUserID]
  1451. }, (response, hasError) {
  1452. if (!hasError) {
  1453. needRE = !needRE;
  1454. EventBus().emit('needRE', needRE);
  1455. showToast('取消收藏');
  1456. collect = false;
  1457. shopUserID = null;
  1458. setState(() {});
  1459. }
  1460. }, (error) {});
  1461. }
  1462. }
  1463. int shopUserID;
  1464. void queryWhetherToFollow() {
  1465. MyDio().query({
  1466. "key": "shop_user",
  1467. "filters": {
  1468. "conditions": [
  1469. "shop_uid==${widget.data.shopUid}",
  1470. "user_uid==${MyCookie().getUID()}"
  1471. ]
  1472. },
  1473. "dims": shopUserDims,
  1474. "paging": [1, 1]
  1475. }, (response, hasError) {
  1476. if (!hasError) {
  1477. MyShopBeanEntity entity =
  1478. MyShopBeanEntity().fromJson(json.decode(response.data.toString()));
  1479. collect = entity.data.data.length != 0;
  1480. if (entity.data.data.isNotEmpty) {
  1481. shopUserID = entity.data.data[0].id;
  1482. }
  1483. setState(() {});
  1484. }
  1485. }, (error) {});
  1486. }
  1487. void mapNavigationPopup() {
  1488. showModalBottomSheet(
  1489. isScrollControlled: true,
  1490. shape: RoundedRectangleBorder(
  1491. //圆角
  1492. borderRadius: BorderRadius.vertical(top: Radius.circular(15)),
  1493. ),
  1494. builder: (BuildContext context) {
  1495. return AnimatedPadding(
  1496. //showModalBottomSheet 键盘弹出时自适应
  1497. padding: MediaQuery.of(context).viewInsets, //边距(必要)
  1498. duration: const Duration(milliseconds: 100), //时常 (必要)
  1499. child: Container(
  1500. // height: 180,
  1501. constraints: BoxConstraints(
  1502. minHeight: 90, //设置最小高度(必要)
  1503. maxHeight: MediaQuery.of(context).size.height / 1.5, //设置最大高度(必要)
  1504. ),
  1505. padding: EdgeInsets.only(top: 20, bottom: 20),
  1506. decoration: BoxDecoration(borderRadius: BorderRadius.vertical(top: Radius.circular(15)), color: Colors.white), //圆角
  1507. child: ListView(
  1508. padding: EdgeInsets.all(0),
  1509. shrinkWrap: true,
  1510. children: <Widget>[
  1511. Column(
  1512. mainAxisSize: MainAxisSize.min,
  1513. mainAxisAlignment: MainAxisAlignment.start,
  1514. crossAxisAlignment: CrossAxisAlignment.center,
  1515. children: <Widget>[
  1516. GestureDetector(
  1517. onTap: (){
  1518. MapUtil.gotoAMap(store.longitude, store.latitude);
  1519. },
  1520. behavior: HitTestBehavior.translucent,
  1521. child: Container(
  1522. height: 50,
  1523. child: Column(
  1524. children: [
  1525. Text('高德地图',style: TextStyle(color: MyColors.c333333,fontSize: 16),),
  1526. Container(height: 0.5,color: Colors.grey[200],)
  1527. ],mainAxisAlignment: MainAxisAlignment.spaceAround,
  1528. ),
  1529. ),
  1530. ),
  1531. GestureDetector(onTap: (){
  1532. MapUtil.gotoBaiduMap(store.longitude, store.latitude);
  1533. },
  1534. behavior: HitTestBehavior.translucent,
  1535. child: Container(
  1536. height: 50,
  1537. child: Column(
  1538. children: [
  1539. Text('百度地图',style: TextStyle(color: MyColors.c333333,fontSize: 16),),
  1540. Container(height: 0.5,color: Colors.grey[200],)
  1541. ],mainAxisAlignment: MainAxisAlignment.spaceAround,
  1542. ),
  1543. ),
  1544. ),
  1545. GestureDetector(onTap: (){
  1546. MapUtil.gotoTencentMap(store.longitude, store.latitude);
  1547. },
  1548. behavior: HitTestBehavior.translucent,
  1549. child: Container(
  1550. height: 50,
  1551. child: Column(
  1552. children: [
  1553. Text('腾讯地图',style: TextStyle(color: MyColors.c333333,fontSize: 16),),
  1554. Container(height: 0.5,color: Colors.grey[200],)
  1555. ],mainAxisAlignment: MainAxisAlignment.spaceAround,
  1556. ),
  1557. ),
  1558. ),
  1559. if(Platform.isIOS)
  1560. GestureDetector(
  1561. onTap: (){
  1562. MapUtil.gotoAppleMap(store.longitude, store.latitude);
  1563. },
  1564. behavior: HitTestBehavior.translucent,
  1565. child: Container(
  1566. height: 50,
  1567. child: Column(
  1568. children: [
  1569. Text('苹果地图',style: TextStyle(color: MyColors.c333333,fontSize: 16),),
  1570. Container(height: 0.5,color: Colors.grey[200],)
  1571. ],mainAxisAlignment: MainAxisAlignment.spaceAround,
  1572. ),
  1573. ),
  1574. ),
  1575. ],
  1576. )
  1577. ],
  1578. ),
  1579. ),
  1580. );
  1581. },
  1582. context: context);
  1583. }
  1584. }