gang_in_page.dart 59 KB

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