gang_in_page.dart 77 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946
  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()
  1220. .fromJson(json.decode(response.data.toString()));
  1221. if (page == 1) {
  1222. orders.clear();
  1223. }
  1224. orders.addAll(entity.data.data);
  1225. setState(() {});
  1226. }
  1227. endRe(controller);
  1228. }, (error) {});
  1229. }
  1230. //查询未付订单
  1231. void unpaidOrder() {
  1232. var conditions = [];
  1233. if (paymentAuthority(widget.data.role)) {
  1234. conditions.add('state == $orderStatePaid');
  1235. conditions.add('shop_uid == ${widget.data.shopUid}');
  1236. } else {
  1237. conditions.add('state IN [$orderStateUnpaid,$orderStatePaying]');
  1238. conditions.add('shop_uid == ${widget.data.shopUid}');
  1239. conditions.add('buyer_uid==0');
  1240. conditions.add('buyer_name LIKE ${MyCookie().getName()}');
  1241. }
  1242. var filters;
  1243. if (paymentAuthority(widget.data.role)) {
  1244. filters = {"conditions": conditions};
  1245. } else {
  1246. filters = {
  1247. "conditions": conditions,
  1248. "or": true,
  1249. "filters": [
  1250. {
  1251. "conditions": [
  1252. "state == $orderStateUnpaid",
  1253. 'shop_uid == ${widget.data.shopUid}',
  1254. 'buyer_uid==${MyCookie().getUID()}'
  1255. ]
  1256. }
  1257. ]
  1258. };
  1259. }
  1260. MyDio().query({
  1261. "key": "order",
  1262. "filters": filters,
  1263. "dims": orderDims,
  1264. "paging": [page, 20],
  1265. "order_by": ["create_time,DESC"]
  1266. }, (response, hasError) {
  1267. if (!hasError) {
  1268. SmartOrderBeanEntity entity = SmartOrderBeanEntity()
  1269. .fromJson(json.decode(response.data.toString()));
  1270. if (page == 1) {
  1271. orders.clear();
  1272. }
  1273. orders.addAll(entity.data.data);
  1274. setState(() {});
  1275. }
  1276. endRe(controller);
  1277. }, (error) {});
  1278. }
  1279. payTheOrder() {
  1280. SmartOrderBeanDataData data = SmartOrderBeanDataData();
  1281. data.sellerUid = widget.order.sellerUID;
  1282. data.sellerName = widget.order.sellerName;
  1283. data.sellerPic = widget.order.sellerPic;
  1284. data.buyerUid = 0;
  1285. data.buyerName = widget.order.buyerName;
  1286. data.buyerPic = '';
  1287. data.amount = widget.order.amount;
  1288. data.uid = widget.order.uID;
  1289. MyTools().toPage(
  1290. context,
  1291. OrderInformationPage(
  1292. false,
  1293. orderType: orderTypeThirdPlatform,
  1294. amount: widget.order.amount,
  1295. uid: widget.order.uID,
  1296. buyerUid: MyCookie().getUID(),
  1297. buyerName: widget.order.buyerName,
  1298. buyerPic: MyCookie().getPic(),
  1299. commodityCount: 1,
  1300. commodityTitle: '第三方订单',
  1301. commodityCover: '',
  1302. sellName: widget.order.sellerName,
  1303. sellPic: widget.order.sellerPic,
  1304. sellUid: widget.order.sellerUID,
  1305. ), (then) {
  1306. controller.requestRefresh();
  1307. PopUpQueue().onShow = false;
  1308. PopUpQueue().showNext();
  1309. });
  1310. // showPayDialog(data, context, () {
  1311. // Navigator.pop(context);
  1312. // // MyTools().toPage(context,
  1313. // // PayPage(widget.order.uID, false, widget.order.amount), (then) {});
  1314. //
  1315. // });
  1316. }
  1317. List<MyShopBeanDataData> member = [];
  1318. List<MyShopBeanDataData> helper = [];
  1319. queryShopMembers(bool toOwner) {
  1320. var conditions = ["shop_uid==${store.uid}", "review_state==1"];
  1321. if (_textEditingController.text.isNotEmpty) {
  1322. conditions
  1323. .add('user_name LIKE ${_textEditingController.text.toString()}');
  1324. }
  1325. MyDio().query({
  1326. "key": "shop_user",
  1327. "filters": {"conditions": conditions},
  1328. "dims": shopUserDims,
  1329. "paging": [page, 50]
  1330. }, (response, hasError) {
  1331. if (!hasError) {
  1332. MyShopBeanEntity entity =
  1333. MyShopBeanEntity().fromJson(json.decode(response.data.toString()));
  1334. if (page == 1) {
  1335. member.clear();
  1336. }
  1337. member.addAll(entity.data.data);
  1338. if (toOwner) {
  1339. helper.clear();
  1340. member.forEach((element) {
  1341. if (element.role == shopUserStaff) {
  1342. helper.add(element);
  1343. }
  1344. });
  1345. MyShopBeanDataData chatWith;
  1346. // if (helper.length == 0) {
  1347. chatWith = member[
  1348. member.indexWhere((element) => element.role == shopUserOwner)];
  1349. // } else {
  1350. // chatWith = helper[Random().nextInt(helper.length)];
  1351. // }
  1352. MyTools().toPage(context, ChatPage(chatWith, null), (then) {});
  1353. } else {
  1354. controller.refreshCompleted();
  1355. controller.loadComplete();
  1356. setState(() {});
  1357. }
  1358. _textEditingController.clear();
  1359. }
  1360. }, (error) {});
  1361. }
  1362. void deleteOrder(SmartOrderBeanDataData order) {
  1363. MyDio().del({
  1364. 'key': 'order',
  1365. 'ids': [order.id]
  1366. }, (response, hasError) {
  1367. if (!hasError) {
  1368. orders.remove(order);
  1369. setState(() {});
  1370. }
  1371. }, (error) {});
  1372. }
  1373. StoreBeanDataData store;
  1374. bool hideMember = true;
  1375. queryStoreInformation() {
  1376. MyDio().query({
  1377. "key": "shop",
  1378. "filters": {
  1379. "conditions": ["uid == ${widget.data.shopUid}"]
  1380. },
  1381. "dims": shopDims,
  1382. "paging": [1, 5]
  1383. }, (response, hasError) {
  1384. if (!hasError) {
  1385. StoreBeanEntity entity =
  1386. StoreBeanEntity().fromJson(json.decode(response.data.toString()));
  1387. store = entity.data.data[0];
  1388. hideMember = store.hideMembers;
  1389. hideOfflinePay = store.hideOfflinePay;
  1390. //自己的公开店铺
  1391. if (!store.private && store.ownerUid == MyCookie().getUID()) {
  1392. canSendGood = true;
  1393. }
  1394. //自己在某个允许顾客间交易的私有店铺中
  1395. if (store.innerTrade && store.private) {
  1396. canSendGood = true;
  1397. }
  1398. setState(() {});
  1399. }
  1400. endRe(controller);
  1401. }, (error) {});
  1402. }
  1403. void queryWhetherThereIsANumberOfPerspectives(
  1404. MyShopBeanDataData data, StoreBeanDataData store, BuildContext context) {
  1405. MyDio().query({
  1406. "key": "user_vp",
  1407. "filters": {
  1408. "conditions": [
  1409. "user_uid == ${MyCookie().getUID()}",
  1410. "vp_key == $vpKeyXRay"
  1411. ]
  1412. },
  1413. "dims": userVpDims,
  1414. "paging": [1, 2000]
  1415. }, (response, hasError) {
  1416. UserVpBeanEntity entity =
  1417. UserVpBeanEntity().fromJson(json.decode(response.data.toString()));
  1418. if (entity.data.data.length != 0) {
  1419. MyTools().toPage(context, OtherPeopleSTurnoverPage(data), (then) {});
  1420. } else {
  1421. // showSimpleDialog('你还未获取透视道具或道具用完,请先购买次数再查看。', context, () {
  1422. // Navigator.pop(context);
  1423. // MyShopBeanDataData shop = MyShopBeanDataData();
  1424. // shop.shopUid = store.uid;
  1425. // shop.shopName = store.name;
  1426. // shop.shopPic = store.picture;
  1427. // MyTools().toPage(
  1428. // context, PrivacyProtectionPropsPage(shop, vpKeyXRay), (then) {});
  1429. // });
  1430. MyShopBeanDataData shop = MyShopBeanDataData();
  1431. shop.shopUid = store.uid;
  1432. shop.shopName = store.name;
  1433. shop.shopPic = store.picture;
  1434. MyTools().toPage(
  1435. context, PrivacyProtectionPropsPage(shop, vpKeyXRay), (then) {});
  1436. }
  1437. }, (error) {});
  1438. }
  1439. void shopInfo() {
  1440. showDialog(
  1441. context: context,
  1442. builder: (BuildContext context) {
  1443. return GestureDetector(
  1444. onTap: () {
  1445. Navigator.pop(context);
  1446. },
  1447. child: Material(
  1448. color: Colors.black12,
  1449. child: Center(
  1450. child: GestureDetector(
  1451. onTap: () {},
  1452. child: Container(
  1453. decoration: BoxDecoration(
  1454. borderRadius: BorderRadius.circular(16),
  1455. color: Colors.white,
  1456. ),
  1457. height: 510,
  1458. margin: EdgeInsets.symmetric(horizontal: 28),
  1459. padding: EdgeInsets.symmetric(horizontal: 14, vertical: 15),
  1460. child: Column(
  1461. children: [
  1462. Container(
  1463. height: MediaQuery.of(context).size.width - 71,
  1464. width: MediaQuery.of(context).size.width - 56,
  1465. child: ClipRRect(
  1466. child: MyViews().netImg(
  1467. imgURL(widget.data.shopPic),
  1468. MediaQuery.of(context).size.width - 84,
  1469. MediaQuery.of(context).size.width - 84),
  1470. borderRadius: BorderRadius.circular(4),
  1471. ),
  1472. ),
  1473. Row(
  1474. children: [
  1475. SvgPicture.asset(
  1476. 'images/svg/店铺.svg',
  1477. height: 21,
  1478. width: 21,
  1479. ),
  1480. Container(
  1481. width: 6,
  1482. ),
  1483. Expanded(
  1484. child: Text(
  1485. widget.data.shopName,
  1486. style: TextStyle(
  1487. color: MyColors.c333333, fontSize: 16),
  1488. ))
  1489. ],
  1490. ),
  1491. Container(
  1492. height: 10,
  1493. ),
  1494. Text(
  1495. store != null && store.introduction.isNotEmpty
  1496. ? '货帮介绍:${store.introduction}'
  1497. : '货帮介绍:暂无',
  1498. style: TextStyle(
  1499. color: MyColors.c333333,
  1500. fontSize: 12,
  1501. ),
  1502. maxLines: 3,
  1503. overflow: TextOverflow.ellipsis,
  1504. softWrap: true,
  1505. ),
  1506. Container(
  1507. height: 10,
  1508. ),
  1509. Row(
  1510. children: [
  1511. SvgPicture.asset(
  1512. 'images/svg/地址.svg',
  1513. color: MyColors.c666666,
  1514. height: 12,
  1515. width: 12,
  1516. ),
  1517. Container(
  1518. width: 5,
  1519. ),
  1520. Expanded(
  1521. child: Text(
  1522. store != null && store.address.isNotEmpty
  1523. ? store.address
  1524. : '暂无',
  1525. style: TextStyle(
  1526. color: MyColors.c666666, fontSize: 11),
  1527. maxLines: 1,
  1528. overflow: TextOverflow.ellipsis,
  1529. softWrap: true,
  1530. ),
  1531. ),
  1532. ],
  1533. ),
  1534. Container(
  1535. height: 10,
  1536. ),
  1537. Visibility(
  1538. visible: store != null && store.mobile.isNotEmpty,
  1539. child: GestureDetector(
  1540. onTap: () {
  1541. launch('tel:${store.mobile}');
  1542. },
  1543. behavior: HitTestBehavior.translucent,
  1544. child: Container(
  1545. decoration: BoxDecoration(
  1546. color: MyColors.cFF4233,
  1547. borderRadius: BorderRadius.circular(20),
  1548. ),
  1549. height: 40,
  1550. child: Row(
  1551. children: [
  1552. SvgPicture.asset(
  1553. 'images/svg/电话.svg',
  1554. color: Colors.white,
  1555. height: 24,
  1556. width: 24,
  1557. ),
  1558. Container(
  1559. width: 4,
  1560. ),
  1561. Text(
  1562. store == null ? '' : store.mobile,
  1563. style: TextStyle(
  1564. color: Colors.white, fontSize: 15),
  1565. ),
  1566. ],
  1567. mainAxisAlignment: MainAxisAlignment.center,
  1568. ),
  1569. alignment: Alignment.center,
  1570. ),
  1571. ),
  1572. )
  1573. ],
  1574. mainAxisAlignment: MainAxisAlignment.spaceAround,
  1575. crossAxisAlignment: CrossAxisAlignment.start,
  1576. ),
  1577. ),
  1578. ),
  1579. ),
  1580. ),
  1581. );
  1582. },
  1583. );
  1584. }
  1585. void collectionShop() {
  1586. if (!collect) {
  1587. MyDio().save({
  1588. 'key': 'shop_user',
  1589. 'object': {
  1590. 'review_state': 1,
  1591. 'user_uid': MyCookie().getUID(),
  1592. 'shop_uid': widget.data.shopUid,
  1593. 'role': shopUserMember
  1594. }
  1595. }, (response, hasError) {
  1596. if (!hasError) {
  1597. needRE = !needRE;
  1598. EventBus().emit('needRE', needRE);
  1599. showToast('收藏成功');
  1600. queryWhetherToFollow();
  1601. }
  1602. }, (error) {});
  1603. } else {
  1604. MyDio().del({
  1605. 'key': 'shop_user',
  1606. 'ids': [shopUserID]
  1607. }, (response, hasError) {
  1608. if (!hasError) {
  1609. needRE = !needRE;
  1610. EventBus().emit('needRE', needRE);
  1611. showToast('取消收藏');
  1612. collect = false;
  1613. shopUserID = null;
  1614. setState(() {});
  1615. }
  1616. }, (error) {});
  1617. }
  1618. }
  1619. int shopUserID;
  1620. void queryWhetherToFollow() {
  1621. MyDio().query({
  1622. "key": "shop_user",
  1623. "filters": {
  1624. "conditions": [
  1625. "shop_uid==${widget.data.shopUid}",
  1626. "user_uid==${MyCookie().getUID()}"
  1627. ]
  1628. },
  1629. "dims": shopUserDims,
  1630. "paging": [1, 1]
  1631. }, (response, hasError) {
  1632. if (!hasError) {
  1633. MyShopBeanEntity entity =
  1634. MyShopBeanEntity().fromJson(json.decode(response.data.toString()));
  1635. collect = entity.data.data.length != 0;
  1636. if (entity.data.data.isNotEmpty) {
  1637. shopUserID = entity.data.data[0].id;
  1638. }
  1639. setState(() {});
  1640. }
  1641. }, (error) {});
  1642. }
  1643. ScrollController _controller = ScrollController();
  1644. redEnvelopeWall() {
  1645. return Column(
  1646. children: [
  1647. Container(
  1648. height: redWallShowMore
  1649. ? 375 / 3 * ppx / 19 * 48
  1650. : 375 / 3 * ppx / 19 * 24,
  1651. child: GridView.builder(
  1652. controller: _controller,
  1653. itemBuilder: (BuildContext context, int index) {
  1654. return Stack(
  1655. children: [
  1656. Positioned(
  1657. child: Container(
  1658. width: 375 / 3 * ppx,
  1659. height: 375 / 3 * ppx / 19 * 24,
  1660. decoration: BoxDecoration(
  1661. borderRadius: BorderRadius.circular(16),
  1662. color: MyColors.cF25D4B),
  1663. alignment: Alignment.bottomCenter,
  1664. child: CustomPaint(
  1665. painter: RedEnvelope1Path(),
  1666. size: Size(375 / 3 * ppx, 375 / 171 * 24 * ppx)),
  1667. ),
  1668. ),
  1669. Positioned(
  1670. top: 375 / 185 * 43.2 * ppx,
  1671. child: GestureDetector(
  1672. onTap: () {
  1673. grabARedEnvelope(redEnvelopes[index]);
  1674. },
  1675. behavior: HitTestBehavior.translucent,
  1676. child: Container(
  1677. decoration: BoxDecoration(
  1678. color: MyColors.cF1D19B,
  1679. borderRadius: BorderRadius.circular(45 * ppx)),
  1680. height: 375 / 57 * ppx * 5,
  1681. width: 375 / 57 * ppx * 5,
  1682. child: Text(
  1683. '开',
  1684. style: TextStyle(
  1685. color: MyColors.c333333,
  1686. fontSize: 375 / 57 * ppx * 3,
  1687. decoration: TextDecoration.none,
  1688. fontWeight: FontWeight.normal),
  1689. ),
  1690. alignment: Alignment.center,
  1691. ),
  1692. ),
  1693. ),
  1694. Positioned(
  1695. top: 15,
  1696. child: Column(
  1697. children: [
  1698. ClipRRect(
  1699. child: MyViews().netImg(
  1700. imgURL(redEnvelopes[index].payerPic),
  1701. 375 / 57 * ppx * 4,
  1702. 375 / 57 * ppx * 4),
  1703. borderRadius:
  1704. BorderRadius.circular(375 / 57 * ppx * 2),
  1705. ),
  1706. Container(
  1707. child: Text(
  1708. '${redEnvelopes[index].payerName}(${hideUID(redEnvelopes[index].payerUid.toString())})',
  1709. style: TextStyle(
  1710. color: Colors.white, fontSize: 25 / 3 * ppx),
  1711. maxLines: 1,
  1712. ),
  1713. margin: EdgeInsets.symmetric(vertical: 5),
  1714. ),
  1715. Text(
  1716. '${redEnvelopes[index].title}',
  1717. style: TextStyle(
  1718. color: Colors.white, fontSize: 25 / 3 * ppx),
  1719. maxLines: 1,
  1720. )
  1721. ],
  1722. ),
  1723. ),
  1724. ],
  1725. alignment: Alignment.topCenter,
  1726. );
  1727. },
  1728. physics: redWallShowMore ? null : NeverScrollableScrollPhysics(),
  1729. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  1730. crossAxisCount: 3,
  1731. childAspectRatio: 19 / 24,
  1732. mainAxisSpacing: 8,
  1733. crossAxisSpacing: 8),
  1734. itemCount: redEnvelopes.length,
  1735. padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
  1736. ),
  1737. ),
  1738. GestureDetector(
  1739. onTap: () {
  1740. setState(() {
  1741. redWallShowMore = !redWallShowMore;
  1742. if (!redWallShowMore) {
  1743. _controller.animateTo(0.0,
  1744. duration: Duration(milliseconds: 500), curve: Curves.ease);
  1745. }
  1746. });
  1747. },
  1748. behavior: HitTestBehavior.translucent,
  1749. child: Container(
  1750. height: 30,
  1751. child: Icon(redWallShowMore
  1752. ? Icons.keyboard_arrow_up
  1753. : Icons.keyboard_arrow_down),
  1754. alignment: Alignment.center,
  1755. ),
  1756. )
  1757. ],
  1758. );
  1759. }
  1760. int rPage = 1;
  1761. void queryRedEnvelope() {
  1762. MyDio().query({
  1763. "key": "red_packet",
  1764. "filters": {
  1765. "conditions": ["shop_uid==${widget.data.shopUid}", 'left_count>0'],
  1766. },
  1767. "dims": redPacketDims,
  1768. "paging": [rPage, 10]
  1769. }, (response, hasError) {
  1770. if (!hasError) {
  1771. RedEnvelopeWallBeanEntity entity = RedEnvelopeWallBeanEntity()
  1772. .fromJson(json.decode(response.toString()));
  1773. if (rPage == 1) {
  1774. redEnvelopes.clear();
  1775. }
  1776. redEnvelopes.addAll(entity.data.data);
  1777. setState(() {});
  1778. }
  1779. }, (error) {});
  1780. }
  1781. void grabARedEnvelope(RedEnvelopeWallBeanDataData redEnvelope) {
  1782. EasyLoading.show();
  1783. MyDio().post(MyApis.getApi('applyForRedPacket2'), {
  1784. 'id': redEnvelope.id,
  1785. 'user_uid': MyCookie().getUID()
  1786. }, (response, hasError) {
  1787. if (!hasError) {
  1788. rPage = 1;
  1789. queryRedEnvelope();
  1790. ApplyForRedPacketBeanEntity entity = ApplyForRedPacketBeanEntity()
  1791. .fromJson(json.decode(response.toString()));
  1792. showResult(entity.data, redEnvelope);
  1793. EasyLoading.dismiss();
  1794. }
  1795. }, (error) {});
  1796. }
  1797. void showResult(
  1798. ApplyForRedPacketBeanData data, RedEnvelopeWallBeanDataData redEnvelope) {
  1799. showDialog<void>(
  1800. context: context,
  1801. barrierDismissible: false,
  1802. // false = user must tap button, true = tap outside dialog
  1803. builder: (BuildContext dialogContext) {
  1804. return StatefulBuilder(
  1805. builder:
  1806. (BuildContext context, void Function(void Function()) setState) {
  1807. return Container(
  1808. child: Column(
  1809. children: [
  1810. Stack(
  1811. children: [
  1812. Positioned(
  1813. child: Container(
  1814. height: 396 * ppx,
  1815. width: double.infinity,
  1816. decoration: BoxDecoration(
  1817. borderRadius: BorderRadius.circular(16),
  1818. color: MyColors.cEB4935),
  1819. margin: EdgeInsets.symmetric(horizontal: 45 * ppx),
  1820. alignment: Alignment.bottomCenter,
  1821. ),
  1822. ),
  1823. Positioned(
  1824. child: Column(
  1825. children: [
  1826. SvgPicture.asset('images/svg/logo.svg'),
  1827. Container(
  1828. margin: EdgeInsets.only(top: 67 * ppx),
  1829. child: Text(
  1830. '${double.parse(data.amount.toString()).toStringAsFixed(2)}元',
  1831. style: TextStyle(
  1832. color: MyColors.cF1D19B,
  1833. fontSize: 38 * ppx,
  1834. fontWeight: FontWeight.bold,
  1835. decoration: TextDecoration.none),
  1836. ),
  1837. ),
  1838. Container(
  1839. margin: EdgeInsets.only(top: 20 * ppx),
  1840. child: Text(
  1841. '${redEnvelope.title}',
  1842. style: TextStyle(
  1843. color: Colors.white,
  1844. fontSize: 20 * ppx,
  1845. decoration: TextDecoration.none),
  1846. ),
  1847. ),
  1848. ],
  1849. ),
  1850. top: 37 * ppx,
  1851. ),
  1852. ],
  1853. alignment: Alignment.topCenter,
  1854. ),
  1855. GestureDetector(
  1856. onTap: () {
  1857. Navigator.pop(context);
  1858. },
  1859. child: Container(
  1860. margin: EdgeInsets.only(top: 24 * ppx),
  1861. child: Icon(
  1862. Icons.clear,
  1863. color: Colors.white,
  1864. ),
  1865. height: 28 * ppx,
  1866. width: 28 * ppx,
  1867. alignment: Alignment.center,
  1868. decoration: BoxDecoration(
  1869. color: MyColors.c25E7E7E7,
  1870. borderRadius: BorderRadius.circular(14 * ppx)),
  1871. ),
  1872. )
  1873. ],
  1874. mainAxisAlignment: MainAxisAlignment.center,
  1875. ),
  1876. alignment: Alignment.center,
  1877. );
  1878. },
  1879. );
  1880. },
  1881. );
  1882. }
  1883. }
  1884. class RedEnvelope1Path extends CustomPainter {
  1885. Paint _paint = Paint()
  1886. ..color = MyColors.cF55544 //画笔颜色
  1887. ..strokeCap = StrokeCap.round //画笔笔触类型
  1888. ..isAntiAlias = true //是否启动抗锯齿
  1889. ..strokeWidth = 15.0; //画笔的宽度
  1890. @override
  1891. void paint(Canvas canvas, Size size) {
  1892. var path = Path()
  1893. ..moveTo(0, 0)
  1894. ..quadraticBezierTo(size.width / 2, 25, size.width, 0)
  1895. ..lineTo(size.width, size.height - 16)
  1896. ..quadraticBezierTo(size.width, size.height, size.width - 16, size.height)
  1897. ..lineTo(16, size.height)
  1898. ..quadraticBezierTo(0, size.height, 0, size.height - 16)
  1899. ..close();
  1900. canvas.drawPath(path, _paint);
  1901. }
  1902. @override
  1903. bool shouldRepaint(covariant CustomPainter oldDelegate) {
  1904. return false;
  1905. }
  1906. }