gang_in_page.dart 77 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942
  1. import 'dart:async';
  2. import 'dart:convert';
  3. import 'package:bbyyy/beans/apply_for_red_packet_bean_entity.dart';
  4. import 'package:bbyyy/beans/goods_bean_entity.dart';
  5. import 'package:bbyyy/beans/my_shop_bean_entity.dart';
  6. import 'package:bbyyy/beans/new_order_bean_entity.dart';
  7. import 'package:bbyyy/beans/red_envelope_wall_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_apis.dart';
  18. import 'package:bbyyy/my_tools/my_colors.dart';
  19. import 'package:bbyyy/my_tools/my_cookie.dart';
  20. import 'package:bbyyy/my_tools/my_tools.dart';
  21. import 'package:bbyyy/my_tools/my_views.dart';
  22. import 'package:bbyyy/my_tools/pop_up_queue.dart';
  23. import 'package:bbyyy/my_tools/role_permissions.dart';
  24. import 'package:bbyyy/paegs/chat_page/chat_page.dart';
  25. import 'package:bbyyy/paegs/gang_page/gang_in_page/gang_information_page/add_member_page/add_member_page.dart';
  26. import 'package:bbyyy/paegs/gang_page/gang_in_page/pay_to_the_helper_page/pay_to_the_helper_page.dart';
  27. import 'package:bbyyy/paegs/gang_page/gang_in_page/qr_pay_page/set_amount_page.dart';
  28. import 'package:bbyyy/paegs/gang_page/gang_in_page/send_red_envelope_page/send_red_envelope_page.dart';
  29. import 'package:bbyyy/paegs/gang_page/gang_in_page/shop_flow_page/shop_flow_page.dart';
  30. import 'package:bbyyy/paegs/gang_page/qr_code_for_store_payment_page/qr_code_for_store_payment_page.dart';
  31. import 'package:bbyyy/paegs/home_page/qr_code_payment/new_qr_code_payment_page.dart';
  32. import 'package:bbyyy/paegs/mine_page/privacy_protection_props_page/privacy_protection_props_page.dart';
  33. import 'package:bbyyy/paegs/mine_page/referrer_page/referrer_page.dart';
  34. import 'package:bbyyy/paegs/other_people_s_turnover_page/other_people_s_turnover_page.dart';
  35. import 'package:bbyyy/paegs/pay_page/order_information_page.dart';
  36. import 'package:bbyyy/paegs/release_goods_page/release_goods_page.dart';
  37. import 'package:flutter/cupertino.dart';
  38. import 'package:flutter/material.dart';
  39. import 'package:flutter_slidable/flutter_slidable.dart';
  40. import 'package:flutter_svg/svg.dart';
  41. import 'package:pull_to_refresh/pull_to_refresh.dart';
  42. import 'package:url_launcher/url_launcher.dart';
  43. import 'gang_information_page/gang_information_page.dart';
  44. import 'gang_information_page/member_list_page/member_details_page.dart';
  45. import 'initiate_collection_page/initiate_collection_page.dart';
  46. import 'scan_page/scan_page.dart';
  47. class GangInPage extends StatefulWidget {
  48. MyShopBeanDataData data;
  49. NewOrderBeanContent order;
  50. GangInPage(this.data, this.order);
  51. @override
  52. _GangInPageState createState() => _GangInPageState();
  53. }
  54. class _GangInPageState extends State<GangInPage> {
  55. int selectedIndex = 0;
  56. RefreshController controller = RefreshController(initialRefresh: true);
  57. int page = 1;
  58. bool collect = false;
  59. bool needRE = false;
  60. bool canSendGood = false;
  61. bool hideOfflinePay = true;
  62. bool showMore = false;
  63. List<RedEnvelopeWallBeanDataData> redEnvelopes = [];
  64. _GangInPageState();
  65. List<GoodsBeanDataData> goods = [];
  66. List<SmartOrderBeanDataData> orders = [];
  67. double ppx;
  68. bool redWallShowMore = false;
  69. TextEditingController _textEditingController = TextEditingController();
  70. @override
  71. void initState() {
  72. // TODO: implement initState
  73. super.initState();
  74. EventBus().on('payAnOrder', (arg) {
  75. controller.requestRefresh();
  76. });
  77. EventBus().on('reNoPayOrder', (arg) {
  78. controller.requestRefresh();
  79. });
  80. EventBus().on('刷新未付订单', (arg) {
  81. controller.requestRefresh();
  82. });
  83. Future.delayed(Duration.zero, () {
  84. if (widget.order != null) {
  85. setState(() {
  86. selectedIndex = 2;
  87. payTheOrder();
  88. });
  89. }
  90. });
  91. if (paymentAuthority(widget.data.role)) {
  92. selectedIndex = 1;
  93. }
  94. Future.delayed(Duration.zero, () {
  95. // queryRedEnvelope();
  96. queryWhetherToFollow();
  97. queryStoreInformation();
  98. });
  99. }
  100. @override
  101. void dispose() {
  102. // TODO: implement dispose
  103. super.dispose();
  104. EventBus().off('payAnOrder');
  105. EventBus().off('reNoPayOrder');
  106. EventBus().off('刷新未付订单');
  107. }
  108. @override
  109. Widget build(BuildContext context) {
  110. ppx = MediaQuery.of(context).size.width / 375;
  111. return GestureDetector(
  112. onTap: () {
  113. MyTools().hideKeyboard(context);
  114. },
  115. child: Scaffold(
  116. body: Column(
  117. children: [
  118. MyViews().myAppBar(widget.data.shopName, context, [
  119. Visibility(
  120. visible: false,
  121. child: IconButton(
  122. icon: Icon(Icons.qr_code_scanner),
  123. onPressed: () async {
  124. MyTools().toPage(context, ScanPage(), (then) {
  125. if (then is String) {
  126. if (then.isNotEmpty &&
  127. then != null &&
  128. then.length == 8) {
  129. Timer(Duration(milliseconds: 200), () {
  130. StoreBeanDataData store = StoreBeanDataData();
  131. store.ownerUid = widget.data.ownerUid;
  132. store.ownerName = widget.data.ownerName;
  133. store.uid = widget.data.shopUid;
  134. MyTools().toPage(
  135. context,
  136. AddMemberPage(
  137. store: store,
  138. qrUID: then,
  139. ),
  140. (then) {});
  141. MyTools().hideKeyboard(context);
  142. controller.requestRefresh();
  143. });
  144. }
  145. }
  146. });
  147. }),
  148. ),
  149. Visibility(
  150. visible: false,
  151. child: IconButton(
  152. icon: Icon(Icons.more_horiz),
  153. onPressed: () {
  154. MyTools().toPage(
  155. context, GangInformationPage(widget.data), (then) {
  156. if (then == '删除货帮') {
  157. Navigator.pop(context, '删除货帮');
  158. }
  159. });
  160. }),
  161. ),
  162. PopupMenuButton<String>(
  163. icon: Icon(Icons.more_horiz),
  164. onSelected: (v) {
  165. switch (v) {
  166. case '扫一扫':
  167. MyTools().toPage(context, ScanPage(), (then) {
  168. if (then is String) {
  169. if (then.isNotEmpty &&
  170. then != null &&
  171. then.length == 8) {
  172. Timer(Duration(milliseconds: 200), () {
  173. StoreBeanDataData store = StoreBeanDataData();
  174. store.ownerUid = widget.data.ownerUid;
  175. store.ownerName = widget.data.ownerName;
  176. store.uid = widget.data.shopUid;
  177. MyTools().toPage(
  178. context,
  179. AddMemberPage(
  180. store: store,
  181. qrUID: then,
  182. ),
  183. (then) {});
  184. MyTools().hideKeyboard(context);
  185. controller.requestRefresh();
  186. });
  187. }
  188. }
  189. });
  190. break;
  191. case '发布商品':
  192. MyTools().toPage(
  193. context, ReleaseGoodsPage(null, widget.data.shopName),
  194. (then) {
  195. controller.requestRefresh();
  196. });
  197. break;
  198. case '货帮详情':
  199. MyTools().toPage(
  200. context, GangInformationPage(widget.data), (then) {
  201. queryStoreInformation();
  202. if (then == '删除货帮') {
  203. Navigator.pop(context, '删除货帮');
  204. }
  205. });
  206. break;
  207. case '收款二维码':
  208. MyTools().toPage(context,
  209. QRCodeForStorePaymentPage(widget.data), (then) {});
  210. break;
  211. case '货帮流水':
  212. MyTools().toPage(
  213. context, ShopFlowPage(widget.data), (then) {});
  214. break;
  215. // case '推荐人':
  216. // MyTools().toPage(
  217. // context, ReferrerPage(data: widget.data), (then) {});
  218. // break;
  219. case '发送红包':
  220. MyTools().toPage(
  221. context, SendRedEnvelopePage(widget.data), (then) {
  222. queryRedEnvelope();
  223. });
  224. break;
  225. default:
  226. break;
  227. }
  228. },
  229. itemBuilder: (context) {
  230. return <PopupMenuEntry<String>>[
  231. if (canSendGood)
  232. PopupMenuItem<String>(
  233. value: '发布商品',
  234. child: Row(
  235. children: [
  236. SvgPicture.asset(
  237. 'images/svg/发布商品_icon.svg',
  238. height: 22,
  239. width: 22,
  240. ),
  241. Container(
  242. child: Text(
  243. '发布商品',
  244. style: TextStyle(
  245. fontSize: 14, color: MyColors.c333333),
  246. ),
  247. margin: EdgeInsets.only(left: 5),
  248. ),
  249. ],
  250. ),
  251. ),
  252. PopupMenuItem<String>(
  253. value: '货帮详情',
  254. child: Row(
  255. children: [
  256. SvgPicture.asset(
  257. 'images/svg/货帮详情_icon.svg',
  258. height: 20,
  259. width: 20,
  260. ),
  261. Container(
  262. child: Text(
  263. '货帮详情',
  264. style: TextStyle(
  265. fontSize: 14, color: MyColors.c333333),
  266. ),
  267. margin: EdgeInsets.only(left: 5),
  268. ),
  269. ],
  270. ),
  271. ),
  272. if (addMemberPermissions(widget.data.role))
  273. PopupMenuItem<String>(
  274. value: '扫一扫',
  275. child: Row(
  276. children: [
  277. SvgPicture.asset(
  278. 'images/svg/扫一扫_icon.svg',
  279. height: 20,
  280. width: 20,
  281. ),
  282. Container(
  283. child: Text(
  284. '扫一扫',
  285. style: TextStyle(
  286. fontSize: 14, color: MyColors.c333333),
  287. ),
  288. margin: EdgeInsets.only(left: 5),
  289. ),
  290. ],
  291. ),
  292. ),
  293. if (MyCookie().getUID() == widget.data.ownerUid)
  294. PopupMenuItem<String>(
  295. value: '收款二维码',
  296. child: Row(
  297. children: [
  298. SvgPicture.asset(
  299. 'images/svg/二维码.svg',
  300. height: 20,
  301. width: 20,
  302. ),
  303. Container(
  304. child: Text(
  305. '收款二维码',
  306. style: TextStyle(
  307. fontSize: 14, color: MyColors.c333333),
  308. ),
  309. margin: EdgeInsets.only(left: 5),
  310. ),
  311. ],
  312. ),
  313. ),
  314. if (checkStoreFlowPermissions(widget.data.role))
  315. PopupMenuItem<String>(
  316. value: '货帮流水',
  317. child: Row(
  318. children: [
  319. SvgPicture.asset(
  320. 'images/svg/流水.svg',
  321. height: 20,
  322. width: 20,
  323. ),
  324. Container(
  325. child: Text(
  326. '货帮流水',
  327. style: TextStyle(
  328. fontSize: 14, color: MyColors.c333333),
  329. ),
  330. margin: EdgeInsets.only(left: 5),
  331. ),
  332. ],
  333. ),
  334. ),
  335. // if (viewReferralAuthority(widget.data.role))
  336. // PopupMenuItem<String>(
  337. // value: '推荐人',
  338. // child: Row(
  339. // children: [
  340. // SvgPicture.asset(
  341. // 'images/svg/推荐人.svg',
  342. // height: 20,
  343. // width: 20,
  344. // ),
  345. // Container(
  346. // child: Text(
  347. // '推荐人',
  348. // style: TextStyle(
  349. // fontSize: 14, color: MyColors.c333333),
  350. // ),
  351. // margin: EdgeInsets.only(left: 5),
  352. // ),
  353. // ],
  354. // ),
  355. // ),
  356. // PopupMenuItem<String>(
  357. // value: '发送红包',
  358. // child: Row(
  359. // children: [
  360. // SvgPicture.asset(
  361. // 'images/svg/红包_icon.svg',
  362. // height: 20,
  363. // width: 20,
  364. // ),
  365. // Container(
  366. // child: Text(
  367. // '发送红包',
  368. // style: TextStyle(
  369. // fontSize: 14, color: MyColors.c333333),
  370. // ),
  371. // margin: EdgeInsets.only(left: 5),
  372. // ),
  373. // ],
  374. // ),
  375. // ),
  376. ];
  377. },
  378. )
  379. ]),
  380. Container(
  381. color: MyColors.cF7F7F7,
  382. child: Container(
  383. decoration: BoxDecoration(
  384. borderRadius: BorderRadius.circular(4),
  385. color: Colors.white),
  386. margin: EdgeInsets.only(top: 10, left: 10, right: 10),
  387. child: Column(
  388. children: [
  389. Row(
  390. children: [
  391. Container(
  392. margin: EdgeInsets.only(
  393. right: 10, top: 6, left: 6, bottom: 6),
  394. child: GestureDetector(
  395. onTap: () {
  396. shopInfo();
  397. },
  398. behavior: HitTestBehavior.translucent,
  399. child: Container(
  400. decoration: BoxDecoration(
  401. border: Border.all(color: MyColors.cE7E7E7),
  402. borderRadius: BorderRadius.circular(4)
  403. ),
  404. child: ClipRRect(
  405. child: MyViews()
  406. .netImg(imgURL(widget.data.shopPic), 65, 65),
  407. borderRadius: BorderRadius.circular(4),
  408. ),
  409. ),
  410. ),
  411. ),
  412. Expanded(
  413. child: Container(
  414. height: 65,
  415. margin: EdgeInsets.only(right: 6),
  416. child: Column(
  417. children: [
  418. Row(
  419. children: [
  420. Text(
  421. widget.data.shopName,
  422. style: TextStyle(
  423. color: MyColors.c333333,
  424. fontSize: 13),
  425. maxLines: 1,
  426. overflow: TextOverflow.ellipsis,
  427. softWrap: true,
  428. ),
  429. ],
  430. mainAxisAlignment:
  431. MainAxisAlignment.spaceBetween,
  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. ],
  450. crossAxisAlignment: CrossAxisAlignment.center,
  451. ),
  452. GestureDetector(
  453. onTap: () {
  454. MyViews().mapNavigationPopup(store.latitude,
  455. store.longitude, context);
  456. },
  457. behavior: HitTestBehavior.translucent,
  458. child: 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. ],
  487. crossAxisAlignment: CrossAxisAlignment.start,
  488. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  489. ),
  490. ),
  491. ),
  492. Visibility(
  493. visible: !widget.data.privateShop,
  494. child: GestureDetector(
  495. child: Container(
  496. margin: EdgeInsets.all(12),
  497. child: SvgPicture.asset(
  498. collect
  499. ? 'images/svg/已收藏.svg'
  500. : 'images/svg/未收藏.svg',
  501. height: 20,
  502. width: 20,
  503. ),
  504. ),
  505. onTap: () {
  506. if (MyCookie().getUID() == widget.data.ownerUid) {
  507. return;
  508. }
  509. EasyLoading.show();
  510. collectionShop();
  511. },
  512. ),
  513. ),
  514. ],
  515. ),
  516. Container(
  517. height: 0.5,
  518. color: MyColors.cE7E7E7,
  519. ),
  520. Visibility(
  521. visible: store != null && store.mobile.isNotEmpty,
  522. child: Container(
  523. margin: EdgeInsets.all(6),
  524. child: Row(
  525. children: [
  526. Row(
  527. children: [
  528. SvgPicture.asset(
  529. 'images/svg/电话.svg',
  530. height: 18,
  531. width: 18,
  532. ),
  533. Container(
  534. width: 5,
  535. ),
  536. Text(
  537. store == null ? '暂无' : store.mobile,
  538. style: TextStyle(
  539. color: MyColors.cFF4233, fontSize: 12),
  540. ),
  541. ],
  542. ),
  543. GestureDetector(
  544. onTap: () {
  545. launch('tel:${store.mobile}');
  546. },
  547. behavior: HitTestBehavior.translucent,
  548. child: Container(
  549. decoration: BoxDecoration(
  550. color: MyColors.cFF4233,
  551. borderRadius: BorderRadius.circular(10),
  552. ),
  553. height: 20,
  554. width: 50,
  555. child:
  556. MyViews().myText('点击拨打', Colors.white, 9),
  557. alignment: Alignment.center,
  558. ),
  559. )
  560. ],
  561. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  562. ),
  563. ),
  564. )
  565. ],
  566. ),
  567. ),
  568. ),
  569. if (store != null && store.notice.isNotEmpty)
  570. GestureDetector(
  571. onTap: () {
  572. setState(() {
  573. showMore = !showMore;
  574. });
  575. },
  576. behavior: HitTestBehavior.translucent,
  577. child: AnimatedContainer(
  578. child: showMore
  579. ? Text(
  580. '货帮公告 : ${store.notice.isEmpty ? '暂无' : store.notice}',
  581. )
  582. : Text(
  583. '货帮公告 : ${store.notice.isEmpty ? '暂无' : store.notice}',
  584. maxLines: 1,
  585. overflow: TextOverflow.ellipsis,
  586. softWrap: true,
  587. ),
  588. color: Colors.white,
  589. width: double.infinity,
  590. padding: EdgeInsets.all(12),
  591. margin: EdgeInsets.only(top: 10),
  592. duration: Duration(seconds: 1),
  593. ),
  594. ),
  595. if (/*redEnvelopes.isNotEmpty*/ false) redEnvelopeWall(),
  596. Visibility(
  597. visible:
  598. widget.data.privateShop || paymentAuthority(widget.data.role),
  599. child: Container(
  600. height: 40,
  601. margin: EdgeInsets.only(top: 10),
  602. color: Colors.white,
  603. child: Row(
  604. children: [
  605. Expanded(
  606. flex: 1,
  607. child: GestureDetector(
  608. onTap: () {
  609. setState(() {
  610. selectedIndex = 0;
  611. });
  612. controller.requestRefresh();
  613. },
  614. behavior: HitTestBehavior.translucent,
  615. child: Padding(
  616. padding: EdgeInsets.only(left: 10, right: 10),
  617. child: Column(
  618. children: [
  619. Text(
  620. '货帮商品',
  621. style: TextStyle(
  622. color: selectedIndex == 0
  623. ? MyColors.cFF4233
  624. : MyColors.c666666,
  625. fontSize: 15),
  626. ),
  627. Container(
  628. height: 10,
  629. child: Visibility(
  630. child: SvgPicture.asset('images/svg/tab.svg'),
  631. visible: selectedIndex == 0,
  632. ),
  633. )
  634. ],
  635. mainAxisAlignment: MainAxisAlignment.end,
  636. ),
  637. ),
  638. ),
  639. ),
  640. Expanded(
  641. flex: 1,
  642. child: GestureDetector(
  643. onTap: () {
  644. setState(() {
  645. selectedIndex = 1;
  646. });
  647. controller.requestRefresh();
  648. },
  649. behavior: HitTestBehavior.translucent,
  650. child: Padding(
  651. padding: EdgeInsets.only(left: 10, right: 10),
  652. child: Column(
  653. children: [
  654. Text(
  655. paymentAuthority(widget.data.role)
  656. ? '未付订单'
  657. : '未收订单',
  658. style: TextStyle(
  659. color: selectedIndex == 1
  660. ? MyColors.cFF4233
  661. : MyColors.c666666,
  662. fontSize: 15),
  663. ),
  664. Container(
  665. height: 10,
  666. child: Visibility(
  667. child: SvgPicture.asset('images/svg/tab.svg'),
  668. visible: selectedIndex == 1,
  669. ),
  670. )
  671. ],
  672. mainAxisAlignment: MainAxisAlignment.end,
  673. ),
  674. ),
  675. ),
  676. ),
  677. Expanded(
  678. flex: 1,
  679. child: GestureDetector(
  680. onTap: () {
  681. setState(() {
  682. selectedIndex = 2;
  683. });
  684. controller.requestRefresh();
  685. },
  686. behavior: HitTestBehavior.translucent,
  687. child: Padding(
  688. padding: EdgeInsets.only(left: 10, right: 10),
  689. child: Column(
  690. children: [
  691. Text(
  692. paymentAuthority(widget.data.role)
  693. ? '已付订单'
  694. : '未付订单',
  695. style: TextStyle(
  696. color: selectedIndex == 2
  697. ? MyColors.cFF4233
  698. : MyColors.c666666,
  699. fontSize: 15),
  700. ),
  701. Container(
  702. height: 10,
  703. child: Visibility(
  704. child: SvgPicture.asset('images/svg/tab.svg'),
  705. visible: selectedIndex == 2,
  706. ),
  707. )
  708. ],
  709. mainAxisAlignment: MainAxisAlignment.end,
  710. ),
  711. ),
  712. ),
  713. ),
  714. Expanded(
  715. flex: addMemberPermissions(widget.data.role) ||
  716. !hideMember
  717. ? 1
  718. : 0,
  719. child: Visibility(
  720. visible: addMemberPermissions(widget.data.role) ||
  721. !hideMember,
  722. child: GestureDetector(
  723. onTap: () {
  724. setState(() {
  725. selectedIndex = 3;
  726. });
  727. controller.requestRefresh();
  728. },
  729. behavior: HitTestBehavior.translucent,
  730. child: Padding(
  731. padding: EdgeInsets.only(left: 10, right: 10),
  732. child: Column(
  733. children: [
  734. Text(
  735. '货帮成员',
  736. style: TextStyle(
  737. color: selectedIndex == 3
  738. ? MyColors.cFF4233
  739. : MyColors.c666666,
  740. fontSize: 15),
  741. ),
  742. Container(
  743. height: 10,
  744. child: Visibility(
  745. child:
  746. SvgPicture.asset('images/svg/tab.svg'),
  747. visible: selectedIndex == 3,
  748. ),
  749. )
  750. ],
  751. mainAxisAlignment: MainAxisAlignment.end,
  752. ),
  753. ),
  754. ),
  755. ),
  756. )
  757. ],
  758. ),
  759. ),
  760. ),
  761. Expanded(
  762. child: Column(
  763. children: [
  764. if (selectedIndex == 3)
  765. Container(
  766. height: 40,
  767. decoration: BoxDecoration(
  768. borderRadius: BorderRadius.circular(20),
  769. color: Colors.white),
  770. margin: EdgeInsets.only(left: 15, right: 15, top: 10),
  771. child: Row(
  772. children: [
  773. Expanded(
  774. child: TextField(
  775. controller: _textEditingController,
  776. decoration: InputDecoration(
  777. border: InputBorder.none,
  778. disabledBorder: InputBorder.none,
  779. enabledBorder: InputBorder.none,
  780. focusedBorder: InputBorder.none,
  781. isDense: true,
  782. hintText: '请输入信息',
  783. hintStyle: TextStyle(
  784. color: MyColors.c999999, fontSize: 16),
  785. contentPadding:
  786. const EdgeInsets.fromLTRB(14, 4.5, 8, 4.5),
  787. ),
  788. ),
  789. ),
  790. GestureDetector(
  791. onTap: () {
  792. controller.requestRefresh();
  793. MyTools().hideKeyboard(context);
  794. },
  795. behavior: HitTestBehavior.translucent,
  796. child: Container(
  797. decoration: BoxDecoration(
  798. borderRadius: BorderRadius.circular(20),
  799. color: MyColors.cFF4233),
  800. height: 40,
  801. width: 80,
  802. child: Text(
  803. '搜 索',
  804. style: TextStyle(
  805. color: Colors.white, fontSize: 14),
  806. ),
  807. alignment: Alignment.center,
  808. ),
  809. ),
  810. if(addMemberPermissions(widget.data.role))
  811. GestureDetector(
  812. onTap: () {
  813. MyTools().toPage(
  814. context, AddMemberPage(store: store),
  815. (then) {
  816. controller.requestRefresh(needMove: false);
  817. });
  818. },
  819. behavior: HitTestBehavior.translucent,
  820. child: Container(
  821. decoration: BoxDecoration(
  822. borderRadius: BorderRadius.circular(20),
  823. color: MyColors.cFF4233),
  824. height: 40,
  825. width: 40,
  826. margin: EdgeInsets.only(left: 10),
  827. child:SvgPicture.asset('images/svg/添加成员.svg',height: 18,width: 18,color: Colors.white,),
  828. alignment: Alignment.center,
  829. ),
  830. ),
  831. ],
  832. ),
  833. ),
  834. Expanded(
  835. child: SmartRefresher(
  836. controller: controller,
  837. onRefresh: onRefresh,
  838. onLoading: onLoading,
  839. enablePullDown: true,
  840. enablePullUp: true,
  841. child: body(),
  842. ),
  843. ),
  844. ],
  845. ),
  846. ),
  847. Container(
  848. color: Colors.white,
  849. child: SafeArea(
  850. top: false,
  851. child: Container(
  852. padding: EdgeInsets.symmetric(horizontal: 37),
  853. color: Colors.white,
  854. width: double.infinity,
  855. height: 60,
  856. child: Row(
  857. children: [
  858. Expanded(
  859. child: GestureDetector(
  860. onTap: () {
  861. if (!widget.data.privateShop &&
  862. MyCookie().getUID() == widget.data.ownerUid) {
  863. MyTools().toPage(context,
  864. SetAmountPage(widget.data), (then) {});
  865. } else {
  866. queryShopMembers(true);
  867. }
  868. },
  869. behavior: HitTestBehavior.translucent,
  870. child: Container(
  871. decoration: BoxDecoration(
  872. borderRadius: !hideOfflinePay
  873. ? BorderRadius.only(
  874. topLeft: Radius.circular(20),
  875. bottomLeft: Radius.circular(20),
  876. )
  877. : BorderRadius.circular(20),
  878. border: Border.all(
  879. color: MyColors.cFF4233, width: 1)),
  880. height: 40,
  881. child: MyViews().myText(
  882. !widget.data.privateShop &&
  883. MyCookie().getUID() ==
  884. widget.data.ownerUid
  885. ? '扫码收款'
  886. : '联系帮主',
  887. MyColors.cFF4233,
  888. 14),
  889. alignment: Alignment.center),
  890. ),
  891. ),
  892. if (!hideOfflinePay)
  893. Expanded(
  894. child: GestureDetector(
  895. onTap: () {
  896. if (MyCookie().getUID() == widget.data.ownerUid) {
  897. MyTools().toPage(context,
  898. InitiateCollectionPage(widget.data),
  899. (then) {
  900. if (then is String && then == '发起收款') {
  901. controller.requestRefresh();
  902. }
  903. });
  904. } else {
  905. // MyTools().toPage(context,
  906. // PayToTheHelperPage(widget.data), (then) {});
  907. MyTools().toPage(context,
  908. NewPayToTheGangPage(widget.data.shopUid,orderTypeOfflineTransfer), (then) {});
  909. }
  910. },
  911. behavior: HitTestBehavior.translucent,
  912. child: Container(
  913. decoration: BoxDecoration(
  914. borderRadius: BorderRadius.only(
  915. topRight: Radius.circular(20),
  916. bottomRight: Radius.circular(20),
  917. ),
  918. color: MyColors.cFF4233),
  919. height: 40,
  920. child: MyViews().myText(
  921. MyCookie().getUID() == widget.data.ownerUid
  922. ? '发起收款'
  923. : '到店付款',
  924. Colors.white,
  925. 14),
  926. alignment: Alignment.center),
  927. ),
  928. )
  929. ],
  930. ),
  931. ),
  932. ),
  933. )
  934. ],
  935. ),
  936. ),
  937. );
  938. }
  939. body() {
  940. if (selectedIndex == 0) {
  941. return goods.length == 0
  942. ? SingleChildScrollView(child: noData())
  943. : GridView.builder(
  944. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  945. crossAxisCount: 2, //每行三列
  946. childAspectRatio: 164 / 261, //显示区域宽高相等
  947. mainAxisSpacing: 8,
  948. crossAxisSpacing: 8),
  949. itemCount: goods.length,
  950. padding:
  951. EdgeInsets.only(left: 14, right: 14, top: 14, bottom: 65),
  952. itemBuilder: (context, index) {
  953. return MyViews().getGoodsItem(goods[index], context);
  954. });
  955. } else if (selectedIndex == 1) {
  956. return orders.length == 0
  957. ? SingleChildScrollView(child: noData())
  958. : ListView.builder(
  959. itemBuilder: (c, index) {
  960. return Slidable(
  961. child: MyViews().getNoPayGoodsItem(orders[index], context,
  962. widget.data.ownerUid, widget.data.role),
  963. actionPane: SlidableDrawerActionPane(),
  964. enabled: paymentAuthority(widget.data.role)&&orders[index].state!=orderStatePaying,
  965. actionExtentRatio: 0.25,
  966. secondaryActions: <Widget>[
  967. SlideAction(
  968. child: Container(
  969. child: Container(
  970. decoration: BoxDecoration(
  971. borderRadius: BorderRadius.circular(30),
  972. color: MyColors.cFF4233,
  973. ),
  974. height: 60,
  975. width: 60,
  976. child: SvgPicture.asset(
  977. 'images/svg/del.svg',
  978. height: 40,
  979. width: 40,
  980. ),
  981. alignment: Alignment.center,
  982. ),
  983. ),
  984. onTap: () {
  985. showSimpleDialog('将删除订单(${orders[index].uid})', context,
  986. () {
  987. Navigator.pop(context);
  988. deleteOrder(orders[index]);
  989. });
  990. },
  991. )
  992. ],
  993. );
  994. },
  995. itemCount: orders.length,
  996. padding: EdgeInsets.only(left: 10, right: 10, top: 10),
  997. );
  998. } else if (selectedIndex == 2) {
  999. return orders.length == 0
  1000. ? SingleChildScrollView(child: noData())
  1001. : ListView.builder(
  1002. itemBuilder: (c, index) {
  1003. return Slidable(
  1004. child: MyViews().getNoPayGoodsItem(orders[index], context,
  1005. widget.data.ownerUid, widget.data.role),
  1006. actionPane: SlidableDrawerActionPane(),
  1007. enabled: orders[index].type == orderTypeOfflineTransfer &&
  1008. orders[index].buyerUid == MyCookie().getUID()&&orders[index].state!=orderStatePaying,
  1009. actionExtentRatio: 0.25,
  1010. secondaryActions: <Widget>[
  1011. SlideAction(
  1012. child: Container(
  1013. child: Container(
  1014. decoration: BoxDecoration(
  1015. borderRadius: BorderRadius.circular(30),
  1016. color: MyColors.cFF4233,
  1017. ),
  1018. height: 60,
  1019. width: 60,
  1020. child: SvgPicture.asset(
  1021. 'images/svg/del.svg',
  1022. height: 40,
  1023. width: 40,
  1024. ),
  1025. alignment: Alignment.center,
  1026. ),
  1027. ),
  1028. onTap: () {
  1029. showSimpleDialog('将删除订单(${orders[index].uid})', context,
  1030. () {
  1031. Navigator.pop(context);
  1032. deleteOrder(orders[index]);
  1033. });
  1034. },
  1035. )
  1036. ],
  1037. );
  1038. },
  1039. itemCount: orders.length,
  1040. padding: EdgeInsets.only(left: 10, right: 10, top: 10),
  1041. );
  1042. } else if (selectedIndex == 3) {
  1043. return member.length == 0
  1044. ? SingleChildScrollView(child: noData())
  1045. : ListView.builder(
  1046. itemBuilder: (BuildContext context, int index) {
  1047. return GestureDetector(
  1048. onTap: () {
  1049. if (permissionToModifyCustomerName(widget.data.role)) {
  1050. if (MyCookie().getUID() != member[index].userUid) {
  1051. MyTools().toPage(
  1052. context, MemberDetailsPage(member[index]), (then) {
  1053. controller.requestRefresh();
  1054. });
  1055. }
  1056. } else {
  1057. return;
  1058. }
  1059. },
  1060. behavior: HitTestBehavior.translucent,
  1061. child: Container(
  1062. padding: EdgeInsets.only(left: 15, right: 15),
  1063. color: Colors.white,
  1064. child: Column(
  1065. children: [
  1066. Container(
  1067. margin: EdgeInsets.only(top: 8, bottom: 6),
  1068. child: Row(
  1069. children: [
  1070. Row(
  1071. children: [
  1072. Container(
  1073. margin: EdgeInsets.only(right: 6),
  1074. child: ClipRRect(
  1075. child: MyViews().netImg(
  1076. imgURL(member[index].userPic),
  1077. 42,
  1078. 42),
  1079. borderRadius: BorderRadius.circular(21),
  1080. ),
  1081. ),
  1082. MyViews().myText(
  1083. '${member[index].userName} ${store.ownerUid == MyCookie().getUID() ? '(${member[index].userUid})' : ''}',
  1084. MyColors.c333333,
  1085. 15),
  1086. Visibility(
  1087. visible:
  1088. member[index].role != shopUserMember,
  1089. child: Container(
  1090. decoration: BoxDecoration(
  1091. color: MyColors.cFFCD00,
  1092. borderRadius:
  1093. BorderRadius.circular(8)),
  1094. height: 16,
  1095. padding:
  1096. EdgeInsets.symmetric(horizontal: 5),
  1097. child: MyViews().myText(
  1098. roleText(member[index].role),
  1099. Colors.white,
  1100. 10),
  1101. alignment: Alignment.center,
  1102. margin: EdgeInsets.only(left: 5),
  1103. ),
  1104. )
  1105. ],
  1106. ),
  1107. Visibility(
  1108. // visible: member[index].role != shopUserOwner &&
  1109. // member[index].userUid !=
  1110. // MyCookie().getUID(),
  1111. visible: false,
  1112. child: GestureDetector(
  1113. child: Container(
  1114. margin: EdgeInsets.only(right: 10),
  1115. child: SvgPicture.asset(
  1116. 'images/svg/透视.svg',
  1117. height: 25,
  1118. width: 25,
  1119. ),
  1120. ),
  1121. onTap: () {
  1122. queryWhetherThereIsANumberOfPerspectives(
  1123. member[index], store, context);
  1124. },
  1125. behavior: HitTestBehavior.translucent,
  1126. ),
  1127. ),
  1128. ],
  1129. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1130. ),
  1131. ),
  1132. Container(
  1133. height: 0.5,
  1134. color: MyColors.cE7E7E7,
  1135. )
  1136. ],
  1137. ),
  1138. ),
  1139. );
  1140. },
  1141. itemCount: member.length,
  1142. padding: EdgeInsets.only(top: 10),
  1143. );
  1144. } else {
  1145. return SingleChildScrollView(child: noData());
  1146. }
  1147. }
  1148. void onRefresh() {
  1149. page = 1;
  1150. if (selectedIndex == 0) {
  1151. queryProducts();
  1152. } else if (selectedIndex == 1) {
  1153. unreceivedOrder();
  1154. } else if (selectedIndex == 3) {
  1155. queryShopMembers(false);
  1156. } else {
  1157. unpaidOrder();
  1158. }
  1159. }
  1160. void onLoading() {
  1161. page++;
  1162. if (selectedIndex == 0) {
  1163. queryProducts();
  1164. } else if (selectedIndex == 1) {
  1165. unreceivedOrder();
  1166. } else if (selectedIndex == 3) {
  1167. queryShopMembers(false);
  1168. } else {
  1169. unpaidOrder();
  1170. }
  1171. }
  1172. //查询商品
  1173. void queryProducts() {
  1174. MyDio().query({
  1175. "key": "commodity",
  1176. "filters": {
  1177. "conditions": ["shop_uid == ${widget.data.shopUid}", "on_sale == true"]
  1178. },
  1179. "dims": commodityDims,
  1180. "order_by": ["id,desc", "no,desc"],
  1181. "paging": [page, 20]
  1182. }, (response, hasError) {
  1183. if (!hasError) {
  1184. GoodsBeanEntity entity =
  1185. GoodsBeanEntity.fromJson(json.decode(response.data.toString()));
  1186. if (page == 1) {
  1187. goods.clear();
  1188. }
  1189. goods.addAll(entity.data.data);
  1190. }
  1191. setState(() {
  1192. endRe(controller);
  1193. });
  1194. }, (error) {
  1195. setState(() {
  1196. endRe(controller);
  1197. });
  1198. });
  1199. }
  1200. //查询未收订单
  1201. void unreceivedOrder() {
  1202. var conditions = [];
  1203. if (paymentAuthority(widget.data.role)) {
  1204. conditions.add('state IN [$orderStateUnpaid,$orderStatePaying]');
  1205. conditions.add('shop_uid == ${widget.data.shopUid}');
  1206. } else {
  1207. conditions.add('state IN [$orderStateUnpaid,$orderStatePaying]');
  1208. conditions.add('shop_uid == ${widget.data.shopUid}');
  1209. conditions.add('seller_uid == ${MyCookie().getUID()}');
  1210. }
  1211. MyDio().query({
  1212. "key": "order",
  1213. "filters": {"conditions": conditions},
  1214. "dims": orderDims,
  1215. "paging": [page, 20],
  1216. "order_by": ["create_time,DESC"]
  1217. }, (response, hasError) {
  1218. if (!hasError) {
  1219. SmartOrderBeanEntity entity = SmartOrderBeanEntity.fromJson(json.decode(response.data.toString()));
  1220. if (page == 1) {
  1221. orders.clear();
  1222. }
  1223. orders.addAll(entity.data.data);
  1224. setState(() {});
  1225. }
  1226. endRe(controller);
  1227. }, (error) {});
  1228. }
  1229. //查询未付订单
  1230. void unpaidOrder() {
  1231. var conditions = [];
  1232. if (paymentAuthority(widget.data.role)) {
  1233. conditions.add('state == $orderStatePaid');
  1234. conditions.add('shop_uid == ${widget.data.shopUid}');
  1235. } else {
  1236. conditions.add('state IN [$orderStateUnpaid,$orderStatePaying]');
  1237. conditions.add('shop_uid == ${widget.data.shopUid}');
  1238. conditions.add('buyer_uid==0');
  1239. conditions.add('buyer_name LIKE ${MyCookie().getName()}');
  1240. }
  1241. var filters;
  1242. if (paymentAuthority(widget.data.role)) {
  1243. filters = {"conditions": conditions};
  1244. } else {
  1245. filters = {
  1246. "conditions": conditions,
  1247. "or": true,
  1248. "filters": [
  1249. {
  1250. "conditions": [
  1251. "state == $orderStateUnpaid",
  1252. 'shop_uid == ${widget.data.shopUid}',
  1253. 'buyer_uid==${MyCookie().getUID()}'
  1254. ]
  1255. }
  1256. ]
  1257. };
  1258. }
  1259. MyDio().query({
  1260. "key": "order",
  1261. "filters": filters,
  1262. "dims": orderDims,
  1263. "paging": [page, 20],
  1264. "order_by": ["create_time,DESC"]
  1265. }, (response, hasError) {
  1266. if (!hasError) {
  1267. SmartOrderBeanEntity entity = SmartOrderBeanEntity.fromJson(json.decode(response.data.toString()));
  1268. if (page == 1) {
  1269. orders.clear();
  1270. }
  1271. orders.addAll(entity.data.data);
  1272. setState(() {});
  1273. }
  1274. endRe(controller);
  1275. }, (error) {});
  1276. }
  1277. payTheOrder() {
  1278. SmartOrderBeanDataData data = SmartOrderBeanDataData();
  1279. data.sellerUid = widget.order.sellerUID;
  1280. data.sellerName = widget.order.sellerName;
  1281. data.sellerPic = widget.order.sellerPic;
  1282. data.buyerUid = 0;
  1283. data.buyerName = widget.order.buyerName;
  1284. data.buyerPic = '';
  1285. data.amount = widget.order.amount;
  1286. data.uid = widget.order.uID;
  1287. MyTools().toPage(
  1288. context,
  1289. OrderInformationPage(
  1290. false,
  1291. orderType: orderTypeThirdPlatform,
  1292. amount: widget.order.amount,
  1293. uid: widget.order.uID,
  1294. buyerUid: MyCookie().getUID(),
  1295. buyerName: widget.order.buyerName,
  1296. buyerPic: MyCookie().getPic(),
  1297. commodityCount: 1,
  1298. commodityTitle: '第三方订单',
  1299. commodityCover: '',
  1300. sellName: widget.order.sellerName,
  1301. sellPic: widget.order.sellerPic,
  1302. sellUid: widget.order.sellerUID,
  1303. ), (then) {
  1304. controller.requestRefresh();
  1305. PopUpQueue().onShow = false;
  1306. PopUpQueue().showNext();
  1307. });
  1308. // showPayDialog(data, context, () {
  1309. // Navigator.pop(context);
  1310. // // MyTools().toPage(context,
  1311. // // PayPage(widget.order.uID, false, widget.order.amount), (then) {});
  1312. //
  1313. // });
  1314. }
  1315. List<MyShopBeanDataData> member = [];
  1316. List<MyShopBeanDataData> helper = [];
  1317. queryShopMembers(bool toOwner) {
  1318. var conditions = ["shop_uid==${store.uid}", "review_state==1"];
  1319. if (_textEditingController.text.isNotEmpty) {
  1320. conditions
  1321. .add('user_name LIKE ${_textEditingController.text.toString()}');
  1322. }
  1323. MyDio().query({
  1324. "key": "shop_user",
  1325. "filters": {"conditions": conditions},
  1326. "dims": shopUserDims,
  1327. "paging": [page, 50]
  1328. }, (response, hasError) {
  1329. if (!hasError) {
  1330. MyShopBeanEntity entity =
  1331. MyShopBeanEntity.fromJson(json.decode(response.data.toString()));
  1332. if (page == 1) {
  1333. member.clear();
  1334. }
  1335. member.addAll(entity.data.data);
  1336. if (toOwner) {
  1337. helper.clear();
  1338. member.forEach((element) {
  1339. if (element.role == shopUserStaff) {
  1340. helper.add(element);
  1341. }
  1342. });
  1343. MyShopBeanDataData chatWith;
  1344. // if (helper.length == 0) {
  1345. chatWith = member[
  1346. member.indexWhere((element) => element.role == shopUserOwner)];
  1347. // } else {
  1348. // chatWith = helper[Random().nextInt(helper.length)];
  1349. // }
  1350. MyTools().toPage(context, ChatPage(chatWith, null), (then) {});
  1351. } else {
  1352. controller.refreshCompleted();
  1353. controller.loadComplete();
  1354. setState(() {});
  1355. }
  1356. _textEditingController.clear();
  1357. }
  1358. }, (error) {});
  1359. }
  1360. void deleteOrder(SmartOrderBeanDataData order) {
  1361. MyDio().del({
  1362. 'key': 'order',
  1363. 'ids': [order.id]
  1364. }, (response, hasError) {
  1365. if (!hasError) {
  1366. orders.remove(order);
  1367. setState(() {});
  1368. }
  1369. }, (error) {});
  1370. }
  1371. StoreBeanDataData store;
  1372. bool hideMember = true;
  1373. queryStoreInformation() {
  1374. MyDio().query({
  1375. "key": "shop",
  1376. "filters": {
  1377. "conditions": ["uid == ${widget.data.shopUid}"]
  1378. },
  1379. "dims": shopDims,
  1380. "paging": [1, 5]
  1381. }, (response, hasError) {
  1382. if (!hasError) {
  1383. StoreBeanEntity entity =
  1384. StoreBeanEntity.fromJson(json.decode(response.data.toString()));
  1385. store = entity.data.data[0];
  1386. hideMember = store.hideMembers;
  1387. hideOfflinePay = store.hideOfflinePay;
  1388. //自己的公开店铺
  1389. if (!store.private && store.ownerUid == MyCookie().getUID()) {
  1390. canSendGood = true;
  1391. }
  1392. //自己在某个允许顾客间交易的私有店铺中
  1393. if (store.innerTrade && store.private) {
  1394. canSendGood = true;
  1395. }
  1396. setState(() {});
  1397. }
  1398. endRe(controller);
  1399. }, (error) {});
  1400. }
  1401. void queryWhetherThereIsANumberOfPerspectives(
  1402. MyShopBeanDataData data, StoreBeanDataData store, BuildContext context) {
  1403. MyDio().query({
  1404. "key": "user_vp",
  1405. "filters": {
  1406. "conditions": [
  1407. "user_uid == ${MyCookie().getUID()}",
  1408. "vp_key == $vpKeyXRay"
  1409. ]
  1410. },
  1411. "dims": userVpDims,
  1412. "paging": [1, 2000]
  1413. }, (response, hasError) {
  1414. UserVpBeanEntity entity =
  1415. UserVpBeanEntity.fromJson(json.decode(response.data.toString()));
  1416. if (entity.data.data.length != 0) {
  1417. MyTools().toPage(context, OtherPeopleSTurnoverPage(data), (then) {});
  1418. } else {
  1419. // showSimpleDialog('你还未获取透视道具或道具用完,请先购买次数再查看。', context, () {
  1420. // Navigator.pop(context);
  1421. // MyShopBeanDataData shop = MyShopBeanDataData();
  1422. // shop.shopUid = store.uid;
  1423. // shop.shopName = store.name;
  1424. // shop.shopPic = store.picture;
  1425. // MyTools().toPage(
  1426. // context, PrivacyProtectionPropsPage(shop, vpKeyXRay), (then) {});
  1427. // });
  1428. MyShopBeanDataData shop = MyShopBeanDataData();
  1429. shop.shopUid = store.uid;
  1430. shop.shopName = store.name;
  1431. shop.shopPic = store.picture;
  1432. MyTools().toPage(
  1433. context, PrivacyProtectionPropsPage(shop, vpKeyXRay), (then) {});
  1434. }
  1435. }, (error) {});
  1436. }
  1437. void shopInfo() {
  1438. showDialog(
  1439. context: context,
  1440. builder: (BuildContext context) {
  1441. return GestureDetector(
  1442. onTap: () {
  1443. Navigator.pop(context);
  1444. },
  1445. child: Material(
  1446. color: Colors.black12,
  1447. child: Center(
  1448. child: GestureDetector(
  1449. onTap: () {},
  1450. child: Container(
  1451. decoration: BoxDecoration(
  1452. borderRadius: BorderRadius.circular(16),
  1453. color: Colors.white,
  1454. ),
  1455. height: 510,
  1456. margin: EdgeInsets.symmetric(horizontal: 28),
  1457. padding: EdgeInsets.symmetric(horizontal: 14, vertical: 15),
  1458. child: Column(
  1459. children: [
  1460. Container(
  1461. height: MediaQuery.of(context).size.width - 71,
  1462. width: MediaQuery.of(context).size.width - 56,
  1463. child: ClipRRect(
  1464. child: MyViews().netImg(
  1465. imgURL(widget.data.shopPic),
  1466. MediaQuery.of(context).size.width - 84,
  1467. MediaQuery.of(context).size.width - 84),
  1468. borderRadius: BorderRadius.circular(4),
  1469. ),
  1470. ),
  1471. Row(
  1472. children: [
  1473. SvgPicture.asset(
  1474. 'images/svg/店铺.svg',
  1475. height: 21,
  1476. width: 21,
  1477. ),
  1478. Container(
  1479. width: 6,
  1480. ),
  1481. Expanded(
  1482. child: Text(
  1483. widget.data.shopName,
  1484. style: TextStyle(
  1485. color: MyColors.c333333, fontSize: 16),
  1486. ))
  1487. ],
  1488. ),
  1489. Container(
  1490. height: 10,
  1491. ),
  1492. Text(
  1493. store != null && store.introduction.isNotEmpty
  1494. ? '货帮介绍:${store.introduction}'
  1495. : '货帮介绍:暂无',
  1496. style: TextStyle(
  1497. color: MyColors.c333333,
  1498. fontSize: 12,
  1499. ),
  1500. maxLines: 3,
  1501. overflow: TextOverflow.ellipsis,
  1502. softWrap: true,
  1503. ),
  1504. Container(
  1505. height: 10,
  1506. ),
  1507. Row(
  1508. children: [
  1509. SvgPicture.asset(
  1510. 'images/svg/地址.svg',
  1511. color: MyColors.c666666,
  1512. height: 12,
  1513. width: 12,
  1514. ),
  1515. Container(
  1516. width: 5,
  1517. ),
  1518. Expanded(
  1519. child: Text(
  1520. store != null && store.address.isNotEmpty
  1521. ? store.address
  1522. : '暂无',
  1523. style: TextStyle(
  1524. color: MyColors.c666666, fontSize: 11),
  1525. maxLines: 1,
  1526. overflow: TextOverflow.ellipsis,
  1527. softWrap: true,
  1528. ),
  1529. ),
  1530. ],
  1531. ),
  1532. Container(
  1533. height: 10,
  1534. ),
  1535. Visibility(
  1536. visible: store != null && store.mobile.isNotEmpty,
  1537. child: GestureDetector(
  1538. onTap: () {
  1539. launch('tel:${store.mobile}');
  1540. },
  1541. behavior: HitTestBehavior.translucent,
  1542. child: Container(
  1543. decoration: BoxDecoration(
  1544. color: MyColors.cFF4233,
  1545. borderRadius: BorderRadius.circular(20),
  1546. ),
  1547. height: 40,
  1548. child: Row(
  1549. children: [
  1550. SvgPicture.asset(
  1551. 'images/svg/电话.svg',
  1552. color: Colors.white,
  1553. height: 24,
  1554. width: 24,
  1555. ),
  1556. Container(
  1557. width: 4,
  1558. ),
  1559. Text(
  1560. store == null ? '' : store.mobile,
  1561. style: TextStyle(
  1562. color: Colors.white, fontSize: 15),
  1563. ),
  1564. ],
  1565. mainAxisAlignment: MainAxisAlignment.center,
  1566. ),
  1567. alignment: Alignment.center,
  1568. ),
  1569. ),
  1570. )
  1571. ],
  1572. mainAxisAlignment: MainAxisAlignment.spaceAround,
  1573. crossAxisAlignment: CrossAxisAlignment.start,
  1574. ),
  1575. ),
  1576. ),
  1577. ),
  1578. ),
  1579. );
  1580. },
  1581. );
  1582. }
  1583. void collectionShop() {
  1584. if (!collect) {
  1585. MyDio().save({
  1586. 'key': 'shop_user',
  1587. 'object': {
  1588. 'review_state': 1,
  1589. 'user_uid': MyCookie().getUID(),
  1590. 'shop_uid': widget.data.shopUid,
  1591. 'role': shopUserMember
  1592. }
  1593. }, (response, hasError) {
  1594. if (!hasError) {
  1595. needRE = !needRE;
  1596. EventBus().emit('needRE', needRE);
  1597. showToast('收藏成功');
  1598. queryWhetherToFollow();
  1599. }
  1600. }, (error) {});
  1601. } else {
  1602. MyDio().del({
  1603. 'key': 'shop_user',
  1604. 'ids': [shopUserID]
  1605. }, (response, hasError) {
  1606. if (!hasError) {
  1607. needRE = !needRE;
  1608. EventBus().emit('needRE', needRE);
  1609. showToast('取消收藏');
  1610. collect = false;
  1611. shopUserID = null;
  1612. setState(() {});
  1613. }
  1614. }, (error) {});
  1615. }
  1616. }
  1617. int shopUserID;
  1618. void queryWhetherToFollow() {
  1619. MyDio().query({
  1620. "key": "shop_user",
  1621. "filters": {
  1622. "conditions": [
  1623. "shop_uid==${widget.data.shopUid}",
  1624. "user_uid==${MyCookie().getUID()}"
  1625. ]
  1626. },
  1627. "dims": shopUserDims,
  1628. "paging": [1, 1]
  1629. }, (response, hasError) {
  1630. if (!hasError) {
  1631. MyShopBeanEntity entity =
  1632. MyShopBeanEntity.fromJson(json.decode(response.data.toString()));
  1633. collect = entity.data.data.length != 0;
  1634. if (entity.data.data.isNotEmpty) {
  1635. shopUserID = entity.data.data[0].id;
  1636. }
  1637. setState(() {});
  1638. }
  1639. }, (error) {});
  1640. }
  1641. ScrollController _controller = ScrollController();
  1642. redEnvelopeWall() {
  1643. return Column(
  1644. children: [
  1645. Container(
  1646. height: redWallShowMore
  1647. ? 375 / 3 * ppx / 19 * 48
  1648. : 375 / 3 * ppx / 19 * 24,
  1649. child: GridView.builder(
  1650. controller: _controller,
  1651. itemBuilder: (BuildContext context, int index) {
  1652. return Stack(
  1653. children: [
  1654. Positioned(
  1655. child: Container(
  1656. width: 375 / 3 * ppx,
  1657. height: 375 / 3 * ppx / 19 * 24,
  1658. decoration: BoxDecoration(
  1659. borderRadius: BorderRadius.circular(16),
  1660. color: MyColors.cF25D4B),
  1661. alignment: Alignment.bottomCenter,
  1662. child: CustomPaint(
  1663. painter: RedEnvelope1Path(),
  1664. size: Size(375 / 3 * ppx, 375 / 171 * 24 * ppx)),
  1665. ),
  1666. ),
  1667. Positioned(
  1668. top: 375 / 185 * 43.2 * ppx,
  1669. child: GestureDetector(
  1670. onTap: () {
  1671. grabARedEnvelope(redEnvelopes[index]);
  1672. },
  1673. behavior: HitTestBehavior.translucent,
  1674. child: Container(
  1675. decoration: BoxDecoration(
  1676. color: MyColors.cF1D19B,
  1677. borderRadius: BorderRadius.circular(45 * ppx)),
  1678. height: 375 / 57 * ppx * 5,
  1679. width: 375 / 57 * ppx * 5,
  1680. child: Text(
  1681. '开',
  1682. style: TextStyle(
  1683. color: MyColors.c333333,
  1684. fontSize: 375 / 57 * ppx * 3,
  1685. decoration: TextDecoration.none,
  1686. fontWeight: FontWeight.normal),
  1687. ),
  1688. alignment: Alignment.center,
  1689. ),
  1690. ),
  1691. ),
  1692. Positioned(
  1693. top: 15,
  1694. child: Column(
  1695. children: [
  1696. ClipRRect(
  1697. child: MyViews().netImg(
  1698. imgURL(redEnvelopes[index].payerPic),
  1699. 375 / 57 * ppx * 4,
  1700. 375 / 57 * ppx * 4),
  1701. borderRadius:
  1702. BorderRadius.circular(375 / 57 * ppx * 2),
  1703. ),
  1704. Container(
  1705. child: Text(
  1706. '${redEnvelopes[index].payerName}(${hideUID(redEnvelopes[index].payerUid.toString())})',
  1707. style: TextStyle(
  1708. color: Colors.white, fontSize: 25 / 3 * ppx),
  1709. maxLines: 1,
  1710. ),
  1711. margin: EdgeInsets.symmetric(vertical: 5),
  1712. ),
  1713. Text(
  1714. '${redEnvelopes[index].title}',
  1715. style: TextStyle(
  1716. color: Colors.white, fontSize: 25 / 3 * ppx),
  1717. maxLines: 1,
  1718. )
  1719. ],
  1720. ),
  1721. ),
  1722. ],
  1723. alignment: Alignment.topCenter,
  1724. );
  1725. },
  1726. physics: redWallShowMore ? null : NeverScrollableScrollPhysics(),
  1727. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  1728. crossAxisCount: 3,
  1729. childAspectRatio: 19 / 24,
  1730. mainAxisSpacing: 8,
  1731. crossAxisSpacing: 8),
  1732. itemCount: redEnvelopes.length,
  1733. padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
  1734. ),
  1735. ),
  1736. GestureDetector(
  1737. onTap: () {
  1738. setState(() {
  1739. redWallShowMore = !redWallShowMore;
  1740. if (!redWallShowMore) {
  1741. _controller.animateTo(0.0,
  1742. duration: Duration(milliseconds: 500), curve: Curves.ease);
  1743. }
  1744. });
  1745. },
  1746. behavior: HitTestBehavior.translucent,
  1747. child: Container(
  1748. height: 30,
  1749. child: Icon(redWallShowMore
  1750. ? Icons.keyboard_arrow_up
  1751. : Icons.keyboard_arrow_down),
  1752. alignment: Alignment.center,
  1753. ),
  1754. )
  1755. ],
  1756. );
  1757. }
  1758. int rPage = 1;
  1759. void queryRedEnvelope() {
  1760. MyDio().query({
  1761. "key": "red_packet",
  1762. "filters": {
  1763. "conditions": ["shop_uid==${widget.data.shopUid}", 'left_count>0'],
  1764. },
  1765. "dims": redPacketDims,
  1766. "paging": [rPage, 10]
  1767. }, (response, hasError) {
  1768. if (!hasError) {
  1769. RedEnvelopeWallBeanEntity entity = RedEnvelopeWallBeanEntity.fromJson(json.decode(response.toString()));
  1770. if (rPage == 1) {
  1771. redEnvelopes.clear();
  1772. }
  1773. redEnvelopes.addAll(entity.data.data);
  1774. setState(() {});
  1775. }
  1776. }, (error) {});
  1777. }
  1778. void grabARedEnvelope(RedEnvelopeWallBeanDataData redEnvelope) {
  1779. EasyLoading.show();
  1780. MyDio().post(MyApis.getApi('applyForRedPacket2'), {
  1781. 'id': redEnvelope.id,
  1782. 'user_uid': MyCookie().getUID()
  1783. }, (response, hasError) {
  1784. if (!hasError) {
  1785. rPage = 1;
  1786. queryRedEnvelope();
  1787. ApplyForRedPacketBeanEntity entity = ApplyForRedPacketBeanEntity.fromJson(json.decode(response.toString()));
  1788. showResult(entity.data, redEnvelope);
  1789. EasyLoading.dismiss();
  1790. }
  1791. }, (error) {});
  1792. }
  1793. void showResult(
  1794. ApplyForRedPacketBeanData data, RedEnvelopeWallBeanDataData redEnvelope) {
  1795. showDialog<void>(
  1796. context: context,
  1797. barrierDismissible: false,
  1798. // false = user must tap button, true = tap outside dialog
  1799. builder: (BuildContext dialogContext) {
  1800. return StatefulBuilder(
  1801. builder:
  1802. (BuildContext context, void Function(void Function()) setState) {
  1803. return Container(
  1804. child: Column(
  1805. children: [
  1806. Stack(
  1807. children: [
  1808. Positioned(
  1809. child: Container(
  1810. height: 396 * ppx,
  1811. width: double.infinity,
  1812. decoration: BoxDecoration(
  1813. borderRadius: BorderRadius.circular(16),
  1814. color: MyColors.cEB4935),
  1815. margin: EdgeInsets.symmetric(horizontal: 45 * ppx),
  1816. alignment: Alignment.bottomCenter,
  1817. ),
  1818. ),
  1819. Positioned(
  1820. child: Column(
  1821. children: [
  1822. SvgPicture.asset('images/svg/logo.svg'),
  1823. Container(
  1824. margin: EdgeInsets.only(top: 67 * ppx),
  1825. child: Text(
  1826. '${double.parse(data.amount.toString()).toStringAsFixed(2)}元',
  1827. style: TextStyle(
  1828. color: MyColors.cF1D19B,
  1829. fontSize: 38 * ppx,
  1830. fontWeight: FontWeight.bold,
  1831. decoration: TextDecoration.none),
  1832. ),
  1833. ),
  1834. Container(
  1835. margin: EdgeInsets.only(top: 20 * ppx),
  1836. child: Text(
  1837. '${redEnvelope.title}',
  1838. style: TextStyle(
  1839. color: Colors.white,
  1840. fontSize: 20 * ppx,
  1841. decoration: TextDecoration.none),
  1842. ),
  1843. ),
  1844. ],
  1845. ),
  1846. top: 37 * ppx,
  1847. ),
  1848. ],
  1849. alignment: Alignment.topCenter,
  1850. ),
  1851. GestureDetector(
  1852. onTap: () {
  1853. Navigator.pop(context);
  1854. },
  1855. child: Container(
  1856. margin: EdgeInsets.only(top: 24 * ppx),
  1857. child: Icon(
  1858. Icons.clear,
  1859. color: Colors.white,
  1860. ),
  1861. height: 28 * ppx,
  1862. width: 28 * ppx,
  1863. alignment: Alignment.center,
  1864. decoration: BoxDecoration(
  1865. color: MyColors.c25E7E7E7,
  1866. borderRadius: BorderRadius.circular(14 * ppx)),
  1867. ),
  1868. )
  1869. ],
  1870. mainAxisAlignment: MainAxisAlignment.center,
  1871. ),
  1872. alignment: Alignment.center,
  1873. );
  1874. },
  1875. );
  1876. },
  1877. );
  1878. }
  1879. }
  1880. class RedEnvelope1Path extends CustomPainter {
  1881. Paint _paint = Paint()
  1882. ..color = MyColors.cF55544 //画笔颜色
  1883. ..strokeCap = StrokeCap.round //画笔笔触类型
  1884. ..isAntiAlias = true //是否启动抗锯齿
  1885. ..strokeWidth = 15.0; //画笔的宽度
  1886. @override
  1887. void paint(Canvas canvas, Size size) {
  1888. var path = Path()
  1889. ..moveTo(0, 0)
  1890. ..quadraticBezierTo(size.width / 2, 25, size.width, 0)
  1891. ..lineTo(size.width, size.height - 16)
  1892. ..quadraticBezierTo(size.width, size.height, size.width - 16, size.height)
  1893. ..lineTo(16, size.height)
  1894. ..quadraticBezierTo(0, size.height, 0, size.height - 16)
  1895. ..close();
  1896. canvas.drawPath(path, _paint);
  1897. }
  1898. @override
  1899. bool shouldRepaint(covariant CustomPainter oldDelegate) {
  1900. return false;
  1901. }
  1902. }