gang_in_page.dart 59 KB

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