gang_in_page.dart 58 KB

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