gang_in_page.dart 51 KB

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