gang_in_page.dart 60 KB

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