gang_in_page.dart 56 KB

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