gang_in_page.dart 55 KB

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