| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515 |
- import 'dart:async';
- import 'dart:convert';
- import 'dart:math';
- import 'package:azlistview/azlistview.dart';
- import 'package:bbyyy/beans/goods_bean_entity.dart';
- import 'package:bbyyy/beans/my_shop_bean_entity.dart';
- import 'package:bbyyy/beans/new_order_bean_entity.dart';
- import 'package:bbyyy/beans/smart_order_bean_entity.dart';
- import 'package:bbyyy/beans/store_bean_entity.dart';
- import 'package:bbyyy/beans/user_vp_bean_entity.dart';
- import 'package:bbyyy/https/MyDio.dart';
- import 'package:bbyyy/https/url.dart';
- import 'package:bbyyy/my_tools/const.dart';
- import 'package:bbyyy/my_tools/dims.dart';
- import 'package:bbyyy/my_tools/easy_loading/easy_loading.dart';
- import 'package:bbyyy/my_tools/event_bus.dart';
- import 'package:bbyyy/my_tools/my_colors.dart';
- import 'package:bbyyy/my_tools/my_cookie.dart';
- import 'package:bbyyy/my_tools/my_tools.dart';
- import 'package:bbyyy/my_tools/my_views.dart';
- import 'package:bbyyy/my_tools/pop_up_queue.dart';
- import 'package:bbyyy/paegs/chat_page/chat_page.dart';
- import 'package:bbyyy/paegs/gang_page/gang_in_page/gang_information_page/add_member_page/add_member_page.dart';
- import 'package:bbyyy/paegs/gang_page/gang_in_page/pay_to_the_helper_page/pay_to_the_helper_page.dart';
- import 'package:bbyyy/paegs/gang_page/gang_in_page/qr_pay_page/set_amount_page.dart';
- import 'package:bbyyy/paegs/gang_page/gang_in_page/shop_flow_page/shop_flow_page.dart';
- import 'package:bbyyy/paegs/gang_page/qr_code_for_store_payment_page/qr_code_for_store_payment_page.dart';
- import 'package:bbyyy/paegs/mine_page/privacy_protection_props_page/privacy_protection_props_page.dart';
- import 'package:bbyyy/paegs/mine_page/referrer_page/referrer_page.dart';
- import 'package:bbyyy/paegs/other_people_s_turnover_page/other_people_s_turnover_page.dart';
- import 'package:bbyyy/paegs/pay_page/order_information_page.dart';
- import 'package:bbyyy/paegs/release_goods_page/release_goods_page.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_slidable/flutter_slidable.dart';
- import 'package:flutter_svg/svg.dart';
- import 'package:pull_to_refresh/pull_to_refresh.dart';
- import 'package:url_launcher/url_launcher.dart';
- import 'gang_information_page/gang_information_page.dart';
- import 'gang_information_page/member_list_page/member_details_page.dart';
- import 'initiate_collection_page/initiate_collection_page.dart';
- import 'scan_page/scan_page.dart';
- class GangInPage extends StatefulWidget {
- MyShopBeanDataData data;
- NewOrderBeanContent order;
- GangInPage(this.data, this.order);
- @override
- _GangInPageState createState() => _GangInPageState();
- }
- class _GangInPageState extends State<GangInPage> {
- int selectedIndex = 0;
- RefreshController controller = RefreshController(initialRefresh: true);
- int page = 1;
- bool collect = false;
- bool needRE = false;
- bool canSendGood = false;
- _GangInPageState();
- List<GoodsBeanDataData> goods = [];
- List<SmartOrderBeanDataData> orders = [];
- @override
- void initState() {
- // TODO: implement initState
- super.initState();
- EventBus().on('payAnOrder', (arg) {
- controller.requestRefresh();
- });
- EventBus().on('reNoPayOrder', (arg) {
- controller.requestRefresh();
- });
- EventBus().on('刷新未付订单', (arg) {
- controller.requestRefresh();
- });
- Future.delayed(Duration.zero, () {
- if (widget.order != null) {
- setState(() {
- selectedIndex = 2;
- payTheOrder();
- });
- }
- });
- if (widget.data.ownerUid == MyCookie().getUID()) {
- selectedIndex = 1;
- }
- queryWhetherToFollow();
- queryStoreInformation();
- }
- @override
- void dispose() {
- // TODO: implement dispose
- super.dispose();
- EventBus().off('payAnOrder');
- EventBus().off('reNoPayOrder');
- EventBus().off('刷新未付订单');
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: Column(
- children: [
- MyViews().myAppBar(widget.data.shopName, context, [
- Visibility(
- visible: false,
- child: IconButton(
- icon: Icon(Icons.qr_code_scanner),
- onPressed: () async {
- MyTools().toPage(context, ScanPage(), (then) {
- if (then is String) {
- if (then.isNotEmpty &&
- then != null &&
- then.length == 8) {
- Timer(Duration(milliseconds: 200), () {
- StoreBeanDataData store = StoreBeanDataData();
- store.ownerUid = widget.data.ownerUid;
- store.ownerName = widget.data.ownerName;
- store.uid = widget.data.shopUid;
- MyTools().toPage(
- context,
- AddMemberPage(
- store: store,
- qrUID: then,
- ),
- (then) {});
- MyTools().hideKeyboard(context);
- controller.requestRefresh();
- });
- }
- }
- });
- }),
- ),
- Visibility(
- visible: false,
- child: IconButton(
- icon: Icon(Icons.more_horiz),
- onPressed: () {
- MyTools().toPage(context, GangInformationPage(widget.data),
- (then) {
- if (then == '删除货帮') {
- Navigator.pop(context, '删除货帮');
- }
- });
- }),
- ),
- PopupMenuButton<String>(
- icon: Icon(Icons.more_horiz),
- onSelected: (v) {
- switch (v) {
- case '扫一扫':
- MyTools().toPage(context, ScanPage(), (then) {
- if (then is String) {
- if (then.isNotEmpty &&
- then != null &&
- then.length == 8) {
- Timer(Duration(milliseconds: 200), () {
- StoreBeanDataData store = StoreBeanDataData();
- store.ownerUid = widget.data.ownerUid;
- store.ownerName = widget.data.ownerName;
- store.uid = widget.data.shopUid;
- MyTools().toPage(
- context,
- AddMemberPage(
- store: store,
- qrUID: then,
- ),
- (then) {});
- MyTools().hideKeyboard(context);
- controller.requestRefresh();
- });
- }
- }
- });
- break;
- case '发布商品':
- MyTools().toPage(
- context, ReleaseGoodsPage(null, widget.data.shopName),
- (then) {
- controller.requestRefresh();
- });
- break;
- case '货帮详情':
- MyTools().toPage(context, GangInformationPage(widget.data),
- (then) {
- if (then == '删除货帮') {
- Navigator.pop(context, '删除货帮');
- }
- });
- break;
- case '收款二维码':
- MyTools().toPage(context,
- QRCodeForStorePaymentPage(widget.data), (then) {});
- break;
- case '货帮流水':
- MyTools()
- .toPage(context, ShopFlowPage(widget.data), (then) {});
- break;
- case '推荐人':
- MyTools().toPage(
- context, ReferrerPage(data: widget.data), (then) {});
- break;
- default:
- break;
- }
- },
- itemBuilder: (context) {
- return <PopupMenuEntry<String>>[
- if (canSendGood)
- PopupMenuItem<String>(
- value: '发布商品',
- child: Row(
- children: [
- SvgPicture.asset(
- 'images/svg/发布商品_icon.svg',
- height: 22,
- width: 22,
- ),
- Container(
- child: Text(
- '发布商品',
- style: TextStyle(
- fontSize: 14, color: MyColors.c333333),
- ),
- margin: EdgeInsets.only(left: 5),
- ),
- ],
- ),
- ),
- PopupMenuItem<String>(
- value: '货帮详情',
- child: Row(
- children: [
- SvgPicture.asset(
- 'images/svg/货帮详情_icon.svg',
- height: 20,
- width: 20,
- ),
- Container(
- child: Text(
- '货帮详情',
- style: TextStyle(
- fontSize: 14, color: MyColors.c333333),
- ),
- margin: EdgeInsets.only(left: 5),
- ),
- ],
- ),
- ),
- if (MyCookie().getUID() == widget.data.ownerUid)
- PopupMenuItem<String>(
- value: '扫一扫',
- child: Row(
- children: [
- SvgPicture.asset(
- 'images/svg/扫一扫_icon.svg',
- height: 20,
- width: 20,
- ),
- Container(
- child: Text(
- '扫一扫',
- style: TextStyle(
- fontSize: 14, color: MyColors.c333333),
- ),
- margin: EdgeInsets.only(left: 5),
- ),
- ],
- ),
- ),
- if (MyCookie().getUID() == widget.data.ownerUid &&
- !widget.data.privateShop)
- PopupMenuItem<String>(
- value: '收款二维码',
- child: Row(
- children: [
- SvgPicture.asset(
- 'images/svg/二维码.svg',
- height: 20,
- width: 20,
- ),
- Container(
- child: Text(
- '收款二维码',
- style: TextStyle(
- fontSize: 14, color: MyColors.c333333),
- ),
- margin: EdgeInsets.only(left: 5),
- ),
- ],
- ),
- ),
- if (MyCookie().getUID() == widget.data.ownerUid ||
- widget.data.role == shopUserPartner)
- PopupMenuItem<String>(
- value: '货帮流水',
- child: Row(
- children: [
- SvgPicture.asset(
- 'images/svg/流水.svg',
- height: 20,
- width: 20,
- ),
- Container(
- child: Text(
- '货帮流水',
- style: TextStyle(
- fontSize: 14, color: MyColors.c333333),
- ),
- margin: EdgeInsets.only(left: 5),
- ),
- ],
- ),
- ),
- if (MyCookie().getUID() == widget.data.ownerUid ||
- widget.data.role == shopUserPartner)
- PopupMenuItem<String>(
- value: '推荐人',
- child: Row(
- children: [
- SvgPicture.asset(
- 'images/svg/推荐人.svg',
- height: 20,
- width: 20,
- ),
- Container(
- child: Text(
- '推荐人',
- style: TextStyle(
- fontSize: 14, color: MyColors.c333333),
- ),
- margin: EdgeInsets.only(left: 5),
- ),
- ],
- ),
- ),
- ];
- },
- )
- ]),
- Container(
- color: MyColors.cF7F7F7,
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(4), color: Colors.white),
- margin: EdgeInsets.all(10),
- child: Column(
- children: [
- Row(
- children: [
- Container(
- margin: EdgeInsets.only(
- right: 10, top: 6, left: 6, bottom: 6),
- child: GestureDetector(
- onTap: () {
- shopInfo();
- },
- behavior: HitTestBehavior.translucent,
- child: ClipRRect(
- child: MyViews()
- .netImg(imgURL(widget.data.shopPic), 65, 65),
- borderRadius: BorderRadius.circular(4),
- ),
- ),
- ),
- Expanded(
- child: Container(
- height: 65,
- margin: EdgeInsets.only(right: 6),
- child: Column(
- children: [
- Row(
- children: [
- Text(
- widget.data.shopName,
- style: TextStyle(
- color: MyColors.c333333, fontSize: 13),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- softWrap: true,
- ),
- ],
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- ),
- Row(
- children: [
- Expanded(
- child: Text(
- store != null &&
- store.introduction.isNotEmpty
- ? '货帮介绍:${store.introduction}'
- : '货帮介绍:暂无',
- style: TextStyle(
- color: MyColors.c666666,
- fontSize: 11),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- softWrap: true,
- ),
- ),
- ],
- crossAxisAlignment: CrossAxisAlignment.center,
- ),
- Row(
- children: [
- SvgPicture.asset(
- 'images/svg/地址.svg',
- color: MyColors.c666666,
- height: 12,
- width: 12,
- ),
- Container(
- width: 5,
- ),
- Expanded(
- child: Text(
- store != null && store.address.isNotEmpty
- ? store.address
- : '暂无',
- style: TextStyle(
- color: MyColors.c666666,
- fontSize: 11),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- softWrap: true,
- ),
- ),
- ],
- ),
- ],
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- ),
- ),
- Visibility(
- visible: !widget.data.privateShop,
- child: GestureDetector(
- child: Container(
- margin: EdgeInsets.all(12),
- child: SvgPicture.asset(
- collect
- ? 'images/svg/已收藏.svg'
- : 'images/svg/未收藏.svg',
- height: 20,
- width: 20,
- ),
- ),
- onTap: () {
- if (MyCookie().getUID() == widget.data.ownerUid) {
- return;
- }
- EasyLoading.show();
- collectionShop();
- },
- ),
- ),
- ],
- ),
- Container(
- height: 0.5,
- color: MyColors.cE7E7E7,
- ),
- Visibility(
- visible: store != null && store.mobile.isNotEmpty,
- child: Container(
- margin: EdgeInsets.all(6),
- child: Row(
- children: [
- Row(
- children: [
- SvgPicture.asset(
- 'images/svg/电话.svg',
- height: 18,
- width: 18,
- ),
- Container(
- width: 5,
- ),
- Text(
- store == null ? '暂无' : store.mobile,
- style: TextStyle(
- color: MyColors.cFF4233, fontSize: 12),
- ),
- ],
- ),
- GestureDetector(
- onTap: () {
- launch('tel:${store.mobile}');
- },
- behavior: HitTestBehavior.translucent,
- child: Container(
- decoration: BoxDecoration(
- color: MyColors.cFF4233,
- borderRadius: BorderRadius.circular(10),
- ),
- height: 20,
- width: 50,
- child: MyViews().myText('点击拨打', Colors.white, 9),
- alignment: Alignment.center,
- ),
- )
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- ),
- )
- ],
- ),
- ),
- ),
- Visibility(
- visible: widget.data.privateShop ||
- widget.data.ownerUid == MyCookie().getUID(),
- child: Container(
- height: 40,
- color: Colors.white,
- child: Row(
- children: [
- Expanded(
- flex: 1,
- child: GestureDetector(
- onTap: () {
- setState(() {
- selectedIndex = 0;
- controller.requestRefresh();
- });
- },
- behavior: HitTestBehavior.translucent,
- child: Padding(
- padding: EdgeInsets.only(left: 10, right: 10),
- child: Column(
- children: [
- Text(
- '货帮商品',
- style: TextStyle(
- color: selectedIndex == 0
- ? MyColors.cFF4233
- : MyColors.c666666,
- fontSize: 15),
- ),
- Container(
- height: 10,
- child: Visibility(
- child: SvgPicture.asset('images/svg/tab.svg'),
- visible: selectedIndex == 0,
- ),
- )
- ],
- mainAxisAlignment: MainAxisAlignment.end,
- ),
- ),
- ),
- ),
- Expanded(
- flex: 1,
- child: GestureDetector(
- onTap: () {
- setState(() {
- selectedIndex = 1;
- controller.requestRefresh();
- });
- },
- behavior: HitTestBehavior.translucent,
- child: Padding(
- padding: EdgeInsets.only(left: 10, right: 10),
- child: Column(
- children: [
- Text(
- widget.data.ownerUid == MyCookie().getUID()
- ? '未付订单'
- : '未收订单',
- style: TextStyle(
- color: selectedIndex == 1
- ? MyColors.cFF4233
- : MyColors.c666666,
- fontSize: 15),
- ),
- Container(
- height: 10,
- child: Visibility(
- child: SvgPicture.asset('images/svg/tab.svg'),
- visible: selectedIndex == 1,
- ),
- )
- ],
- mainAxisAlignment: MainAxisAlignment.end,
- ),
- ),
- ),
- ),
- Expanded(
- flex: 1,
- child: GestureDetector(
- onTap: () {
- setState(() {
- selectedIndex = 2;
- controller.requestRefresh();
- });
- },
- behavior: HitTestBehavior.translucent,
- child: Padding(
- padding: EdgeInsets.only(left: 10, right: 10),
- child: Column(
- children: [
- Text(
- widget.data.ownerUid == MyCookie().getUID()
- ? '已付订单'
- : '未付订单',
- style: TextStyle(
- color: selectedIndex == 2
- ? MyColors.cFF4233
- : MyColors.c666666,
- fontSize: 15),
- ),
- Container(
- height: 10,
- child: Visibility(
- child: SvgPicture.asset('images/svg/tab.svg'),
- visible: selectedIndex == 2,
- ),
- )
- ],
- mainAxisAlignment: MainAxisAlignment.end,
- ),
- ),
- ),
- ),
- Expanded(
- flex: MyCookie().getUID() == widget.data.ownerUid ||
- !hideMember
- ? 1
- : 0,
- child: Visibility(
- visible: MyCookie().getUID() == widget.data.ownerUid ||
- !hideMember,
- child: GestureDetector(
- onTap: () {
- setState(() {
- selectedIndex = 3;
- controller.requestRefresh();
- });
- },
- behavior: HitTestBehavior.translucent,
- child: Padding(
- padding: EdgeInsets.only(left: 10, right: 10),
- child: Column(
- children: [
- Text(
- '货帮成员',
- style: TextStyle(
- color: selectedIndex == 3
- ? MyColors.cFF4233
- : MyColors.c666666,
- fontSize: 15),
- ),
- Container(
- height: 10,
- child: Visibility(
- child: SvgPicture.asset('images/svg/tab.svg'),
- visible: selectedIndex == 3,
- ),
- )
- ],
- mainAxisAlignment: MainAxisAlignment.end,
- ),
- ),
- ),
- ),
- )
- ],
- ),
- ),
- ),
- body(),
- Container(
- color: Colors.white,
- child: SafeArea(
- top: false,
- child: Container(
- padding: EdgeInsets.symmetric(horizontal: 37),
- color: Colors.white,
- width: double.infinity,
- height: 60,
- child: Row(
- children: [
- Expanded(
- child: GestureDetector(
- onTap: () {
- if (!widget.data.privateShop &&
- MyCookie().getUID() == widget.data.ownerUid) {
- MyTools().toPage(
- context, SetAmountPage(widget.data), (then) {});
- } else {
- queryShopMembers(true);
- }
- },
- behavior: HitTestBehavior.translucent,
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(20),
- bottomLeft: Radius.circular(20),
- ),
- border: Border.all(
- color: MyColors.cFF4233, width: 1)),
- height: 40,
- child: MyViews().myText(
- !widget.data.privateShop &&
- MyCookie().getUID() ==
- widget.data.ownerUid
- ? '扫码收款'
- : '联系帮主',
- MyColors.cFF4233,
- 14),
- alignment: Alignment.center),
- ),
- ),
- Expanded(
- child: GestureDetector(
- onTap: () {
- if (MyCookie().getUID() == widget.data.ownerUid) {
- MyTools().toPage(
- context, InitiateCollectionPage(widget.data),
- (then) {
- if (then is String && then == '发起收款') {
- controller.requestRefresh();
- }
- });
- } else {
- MyTools().toPage(context,
- PayToTheHelperPage(widget.data), (then) {});
- }
- },
- behavior: HitTestBehavior.translucent,
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.only(
- topRight: Radius.circular(20),
- bottomRight: Radius.circular(20),
- ),
- color: MyColors.cFF4233),
- height: 40,
- child: MyViews().myText(
- MyCookie().getUID() == widget.data.ownerUid
- ? '发起收款'
- : '到店付款',
- Colors.white,
- 14),
- alignment: Alignment.center),
- ),
- )
- ],
- ),
- ),
- ),
- )
- ],
- ),
- );
- }
- body() {
- if (selectedIndex == 0) {
- return Expanded(
- child: SmartRefresher(
- controller: controller,
- onRefresh: onRefresh,
- onLoading: onLoading,
- enablePullDown: true,
- enablePullUp: true,
- child: goods.length == 0
- ? SingleChildScrollView(child: noData())
- : GridView.builder(
- gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
- crossAxisCount: 2, //每行三列
- childAspectRatio: 164 / 261, //显示区域宽高相等
- mainAxisSpacing: 8,
- crossAxisSpacing: 8),
- itemCount: goods.length,
- padding:
- EdgeInsets.only(left: 14, right: 14, top: 14, bottom: 65),
- itemBuilder: (context, index) {
- return MyViews().getGoodsItem(goods[index], context);
- }),
- ),
- );
- } else if (selectedIndex == 1) {
- return Expanded(
- child: SmartRefresher(
- controller: controller,
- onRefresh: onRefresh,
- onLoading: onLoading,
- enablePullDown: true,
- enablePullUp: true,
- child: orders.length == 0
- ? SingleChildScrollView(child: noData())
- : ListView.builder(
- itemBuilder: (c, index) {
- return Slidable(
- child: MyViews().getNoPayGoodsItem(
- orders[index], context, widget.data.ownerUid),
- actionPane: SlidableDrawerActionPane(),
- enabled: widget.data.ownerUid == MyCookie().getUID(),
- actionExtentRatio: 0.25,
- secondaryActions: <Widget>[
- SlideAction(
- child: Container(
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(30),
- color: MyColors.cFF4233,
- ),
- height: 60,
- width: 60,
- child: SvgPicture.asset(
- 'images/svg/del.svg',
- height: 40,
- width: 40,
- ),
- alignment: Alignment.center,
- ),
- ),
- onTap: () {
- showSimpleDialog(
- '将删除订单(${orders[index].uid})', context, () {
- Navigator.pop(context);
- deleteOrder(orders[index]);
- });
- },
- )
- ],
- );
- },
- itemCount: orders.length,
- padding: EdgeInsets.only(left: 10, right: 10, top: 10),
- ),
- ),
- );
- } else if (selectedIndex == 2) {
- return Expanded(
- child: SmartRefresher(
- controller: controller,
- onRefresh: onRefresh,
- onLoading: onLoading,
- enablePullDown: true,
- enablePullUp: true,
- child: orders.length == 0
- ? SingleChildScrollView(child: noData())
- : ListView.builder(
- itemBuilder: (c, index) {
- return Slidable(
- child: MyViews().getNoPayGoodsItem(
- orders[index], context, widget.data.ownerUid),
- actionPane: SlidableDrawerActionPane(),
- enabled: orders[index].type == orderTypeOfflineTransfer &&
- orders[index].buyerUid == MyCookie().getUID(),
- actionExtentRatio: 0.25,
- secondaryActions: <Widget>[
- SlideAction(
- child: Container(
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(30),
- color: MyColors.cFF4233,
- ),
- height: 60,
- width: 60,
- child: SvgPicture.asset(
- 'images/svg/del.svg',
- height: 40,
- width: 40,
- ),
- alignment: Alignment.center,
- ),
- ),
- onTap: () {
- showSimpleDialog(
- '将删除订单(${orders[index].uid})', context, () {
- Navigator.pop(context);
- deleteOrder(orders[index]);
- });
- },
- )
- ],
- );
- },
- itemCount: orders.length,
- padding: EdgeInsets.only(left: 10, right: 10, top: 10),
- ),
- ),
- );
- } else if (selectedIndex == 3) {
- return Expanded(
- child: SmartRefresher(
- controller: controller,
- onRefresh: onRefresh,
- onLoading: onLoading,
- enablePullDown: true,
- enablePullUp: true,
- child: member.length == 0
- ? SingleChildScrollView(child: noData())
- : Container(
- margin: EdgeInsets.only(top: 10),
- child: AzListView(
- itemBuilder: (c, index) {
- return GestureDetector(
- onTap: () {
- if (MyCookie().getUID() == store.ownerUid) {
- if (MyCookie().getUID() != member[index].userUid) {
- MyTools().toPage(
- context, MemberDetailsPage(member[index]),
- (then) {
- controller.requestRefresh();
- });
- }
- } else {
- return;
- }
- },
- behavior: HitTestBehavior.translucent,
- child: Container(
- padding: EdgeInsets.only(left: 15, right: 15),
- color: Colors.white,
- child: Column(
- children: [
- Container(
- margin: EdgeInsets.only(top: 8, bottom: 6),
- child: Row(
- children: [
- Row(
- children: [
- Container(
- margin: EdgeInsets.only(right: 6),
- child: ClipRRect(
- child: MyViews().netImg(
- imgURL(member[index].userPic),
- 42,
- 42),
- borderRadius:
- BorderRadius.circular(21),
- ),
- ),
- MyViews().myText(
- '${member[index].userName} ${store.ownerUid == MyCookie().getUID() ? '(${member[index].userUid})' : ''}',
- MyColors.c333333,
- 15),
- Visibility(
- visible: member[index].role !=
- shopUserMember,
- child: Container(
- decoration: BoxDecoration(
- color: member[index].role ==
- shopUserStaff
- ? MyColors.cFF4233
- : MyColors.cFFCD00,
- borderRadius:
- BorderRadius.circular(8)),
- height: 16,
- padding: EdgeInsets.symmetric(
- horizontal: 5),
- child: MyViews().myText(
- member[index].role ==
- shopUserOwner
- ? "帮主"
- : "合伙人",
- Colors.white,
- 10),
- alignment: Alignment.center,
- margin: EdgeInsets.only(left: 5),
- ),
- )
- ],
- ),
- Visibility(
- visible:
- member[index].role != shopUserOwner &&
- member[index].userUid !=
- MyCookie().getUID(),
- child: GestureDetector(
- child: Container(
- margin: EdgeInsets.only(right: 10),
- child: SvgPicture.asset(
- 'images/svg/透视.svg',
- height: 25,
- width: 25,
- ),
- ),
- onTap: () {
- queryWhetherThereIsANumberOfPerspectives(
- member[index], store, context);
- },
- behavior: HitTestBehavior.translucent,
- ),
- ),
- ],
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- ),
- ),
- Container(
- height: 0.5,
- color: MyColors.cE7E7E7,
- )
- ],
- ),
- ),
- );
- },
- itemCount: member.length,
- data: member,
- ),
- ),
- ),
- );
- } else {
- return SingleChildScrollView(child: noData());
- }
- }
- void onRefresh() {
- page = 1;
- if (selectedIndex == 0) {
- queryProducts();
- } else if (selectedIndex == 1) {
- unreceivedOrder();
- } else if (selectedIndex == 3) {
- queryShopMembers(false);
- } else {
- unpaidOrder();
- }
- }
- void onLoading() {
- page++;
- if (selectedIndex == 0) {
- queryProducts();
- } else if (selectedIndex == 1) {
- unreceivedOrder();
- } else if (selectedIndex == 3) {
- queryShopMembers(false);
- } else {
- unpaidOrder();
- }
- }
- //查询商品
- void queryProducts() {
- MyDio().query({
- "key": "commodity",
- "filters": {
- "conditions": ["shop_uid == ${widget.data.shopUid}", "on_sale == true"]
- },
- "dims": commodityDims,
- "order_by": ["id,desc", "no,desc"],
- "paging": [page, 20]
- }, (response, hasError) {
- if (!hasError) {
- GoodsBeanEntity entity =
- GoodsBeanEntity().fromJson(json.decode(response.data.toString()));
- if (page == 1) {
- goods.clear();
- }
- goods.addAll(entity.data.data);
- }
- setState(() {
- endRe(controller);
- });
- }, (error) {
- setState(() {
- endRe(controller);
- });
- });
- }
- //查询未收订单
- void unreceivedOrder() {
- var conditions = [];
- if (widget.data.ownerUid == MyCookie().getUID()) {
- conditions.add('state == $orderStateUnpaid');
- conditions.add('shop_uid == ${widget.data.shopUid}');
- } else {
- conditions.add('state == $orderStateUnpaid');
- conditions.add('shop_uid == ${widget.data.shopUid}');
- conditions.add('seller_uid == ${MyCookie().getUID()}');
- }
- MyDio().query({
- "key": "order",
- "filters": {"conditions": conditions},
- "dims": orderDims,
- "paging": [page, 20],
- "order_by": ["create_time,DESC"]
- }, (response, hasError) {
- if (!hasError) {
- SmartOrderBeanEntity entity = SmartOrderBeanEntity()
- .fromJson(json.decode(response.data.toString()));
- if (page == 1) {
- orders.clear();
- }
- orders.addAll(entity.data.data);
- setState(() {});
- }
- endRe(controller);
- }, (error) {});
- }
- //查询未付订单
- void unpaidOrder() {
- var conditions = [];
- if (widget.data.ownerUid == MyCookie().getUID()) {
- conditions.add('state == $orderStatePaid');
- conditions.add('shop_uid == ${widget.data.shopUid}');
- } else {
- conditions.add('state == $orderStateUnpaid');
- conditions.add('shop_uid == ${widget.data.shopUid}');
- conditions.add('buyer_name LIKE ${MyCookie().getName()}');
- }
- MyDio().query({
- "key": "order",
- "filters": {"conditions": conditions},
- "dims": orderDims,
- "paging": [page, 20],
- "order_by": ["create_time,DESC"]
- }, (response, hasError) {
- if (!hasError) {
- SmartOrderBeanEntity entity = SmartOrderBeanEntity()
- .fromJson(json.decode(response.data.toString()));
- if (page == 1) {
- orders.clear();
- }
- orders.addAll(entity.data.data);
- setState(() {});
- }
- endRe(controller);
- }, (error) {});
- }
- payTheOrder() {
- SmartOrderBeanDataData data = SmartOrderBeanDataData();
- data.sellerUid = widget.order.sellerUID;
- data.sellerName = widget.order.sellerName;
- data.sellerPic = widget.order.sellerPic;
- data.buyerUid = 0;
- data.buyerName = widget.order.buyerName;
- data.buyerPic = '';
- data.amount = widget.order.amount;
- data.uid = widget.order.uID;
- MyTools().toPage(
- context,
- OrderInformationPage(
- false,
- orderType: orderTypeThirdPlatform,
- amount: widget.order.amount,
- uid: widget.order.uID,
- buyerUid: MyCookie().getUID(),
- buyerName: widget.order.buyerName,
- buyerPic: MyCookie().getPic(),
- commodityCount: 1,
- commodityTitle: '第三方订单',
- commodityCover: '',
- sellName: widget.order.sellerName,
- sellPic: widget.order.sellerPic,
- sellUid: widget.order.sellerUID,
- ), (then) {
- controller.requestRefresh();
- PopUpQueue().onShow = false;
- PopUpQueue().showNext();
- });
- // showPayDialog(data, context, () {
- // Navigator.pop(context);
- // // MyTools().toPage(context,
- // // PayPage(widget.order.uID, false, widget.order.amount), (then) {});
- //
- // });
- }
- List<MyShopBeanDataData> member = [];
- List<MyShopBeanDataData> helper = [];
- queryShopMembers(bool toOwner) {
- MyDio().query({
- "key": "shop_user",
- "filters": {
- "conditions": ["shop_uid==${widget.data.shopUid}", "review_state==1"]
- },
- "dims": shopUserDims,
- "paging": [1, 2000]
- }, (response, hasError) {
- if (!hasError) {
- MyShopBeanEntity entity =
- MyShopBeanEntity().fromJson(json.decode(response.data.toString()));
- member = entity.data.data;
- if (toOwner) {
- helper.clear();
- member.forEach((element) {
- if (element.role == shopUserStaff) {
- helper.add(element);
- }
- });
- MyShopBeanDataData chatWith;
- if (helper.length == 0) {
- chatWith = member[
- member.indexWhere((element) => element.role == shopUserOwner)];
- } else {
- chatWith = helper[Random().nextInt(helper.length)];
- }
- MyTools().toPage(context, ChatPage(chatWith, null), (then) {});
- } else {
- controller.refreshCompleted();
- controller.loadComplete();
- setState(() {});
- }
- }
- }, (error) {});
- }
- void deleteOrder(SmartOrderBeanDataData order) {
- MyDio().del({
- 'key': 'order',
- 'ids': [order.id]
- }, (response, hasError) {
- if (!hasError) {
- orders.remove(order);
- setState(() {});
- }
- }, (error) {});
- }
- StoreBeanDataData store;
- bool hideMember = true;
- queryStoreInformation() {
- MyDio().query({
- "key": "shop",
- "filters": {
- "conditions": ["uid == ${widget.data.shopUid}"]
- },
- "dims": shopDims,
- "paging": [1, 5]
- }, (response, hasError) {
- if (!hasError) {
- StoreBeanEntity entity =
- StoreBeanEntity().fromJson(json.decode(response.data.toString()));
- store = entity.data.data[0];
- hideMember = store.hideMembers;
- //自己的公开店铺
- if (!store.private && store.ownerUid == MyCookie().getUID()) {
- canSendGood = true;
- }
- //自己在某个允许顾客间交易的私有店铺中
- if (store.innerTrade) {
- canSendGood = true;
- }
- setState(() {});
- }
- endRe(controller);
- }, (error) {});
- }
- void queryWhetherThereIsANumberOfPerspectives(
- MyShopBeanDataData data, StoreBeanDataData store, BuildContext context) {
- MyDio().query({
- "key": "user_vp",
- "filters": {
- "conditions": [
- "user_uid == ${MyCookie().getUID()}",
- "vp_key == $vpKeyXRay"
- ]
- },
- "dims": userVpDims,
- "paging": [1, 2000]
- }, (response, hasError) {
- UserVpBeanEntity entity =
- UserVpBeanEntity().fromJson(json.decode(response.data.toString()));
- if (entity.data.data.length != 0) {
- MyTools().toPage(context, OtherPeopleSTurnoverPage(data), (then) {});
- } else {
- // showSimpleDialog('你还未获取透视道具或道具用完,请先购买次数再查看。', context, () {
- // Navigator.pop(context);
- // MyShopBeanDataData shop = MyShopBeanDataData();
- // shop.shopUid = store.uid;
- // shop.shopName = store.name;
- // shop.shopPic = store.picture;
- // MyTools().toPage(
- // context, PrivacyProtectionPropsPage(shop, vpKeyXRay), (then) {});
- // });
- MyShopBeanDataData shop = MyShopBeanDataData();
- shop.shopUid = store.uid;
- shop.shopName = store.name;
- shop.shopPic = store.picture;
- MyTools().toPage(
- context, PrivacyProtectionPropsPage(shop, vpKeyXRay), (then) {});
- }
- }, (error) {});
- }
- void shopInfo() {
- showDialog(
- context: context,
- builder: (BuildContext context) {
- return GestureDetector(
- onTap: () {
- Navigator.pop(context);
- },
- child: Material(
- color: Colors.black12,
- child: Center(
- child: GestureDetector(
- onTap: () {},
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(16),
- color: Colors.white,
- ),
- height: 510,
- margin: EdgeInsets.symmetric(horizontal: 28),
- padding: EdgeInsets.symmetric(horizontal: 14, vertical: 15),
- child: Column(
- children: [
- Container(
- height: MediaQuery.of(context).size.width - 71,
- width: MediaQuery.of(context).size.width - 56,
- child: ClipRRect(
- child: MyViews().netImg(
- imgURL(widget.data.shopPic),
- MediaQuery.of(context).size.width - 84,
- MediaQuery.of(context).size.width - 84),
- borderRadius: BorderRadius.circular(4),
- ),
- ),
- Row(
- children: [
- SvgPicture.asset(
- 'images/svg/店铺.svg',
- height: 21,
- width: 21,
- ),
- Container(
- width: 6,
- ),
- Expanded(
- child: Text(
- widget.data.shopName,
- style: TextStyle(
- color: MyColors.c333333, fontSize: 16),
- ))
- ],
- ),
- Container(
- height: 10,
- ),
- Text(
- store != null && store.introduction.isNotEmpty
- ? '货帮介绍:${store.introduction}'
- : '货帮介绍:暂无',
- style: TextStyle(
- color: MyColors.c333333,
- fontSize: 12,
- ),
- maxLines: 3,
- overflow: TextOverflow.ellipsis,
- softWrap: true,
- ),
- Container(
- height: 10,
- ),
- Row(
- children: [
- SvgPicture.asset(
- 'images/svg/地址.svg',
- color: MyColors.c666666,
- height: 12,
- width: 12,
- ),
- Container(
- width: 5,
- ),
- Expanded(
- child: Text(
- store != null && store.address.isNotEmpty
- ? store.address
- : '暂无',
- style: TextStyle(
- color: MyColors.c666666, fontSize: 11),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- softWrap: true,
- ),
- ),
- ],
- ),
- Container(
- height: 10,
- ),
- Visibility(
- visible: store != null && store.mobile.isNotEmpty,
- child: GestureDetector(
- onTap: () {
- launch('tel:${store.mobile}');
- },
- behavior: HitTestBehavior.translucent,
- child: Container(
- decoration: BoxDecoration(
- color: MyColors.cFF4233,
- borderRadius: BorderRadius.circular(20),
- ),
- height: 40,
- child: Row(
- children: [
- SvgPicture.asset(
- 'images/svg/电话.svg',
- color: Colors.white,
- height: 24,
- width: 24,
- ),
- Container(
- width: 4,
- ),
- Text(
- store == null ? '' : store.mobile,
- style: TextStyle(
- color: Colors.white, fontSize: 15),
- ),
- ],
- mainAxisAlignment: MainAxisAlignment.center,
- ),
- alignment: Alignment.center,
- ),
- ),
- )
- ],
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- crossAxisAlignment: CrossAxisAlignment.start,
- ),
- ),
- ),
- ),
- ),
- );
- },
- );
- }
- void collectionShop() {
- if (!collect) {
- MyDio().save({
- 'key': 'shop_user',
- 'object': {
- 'review_state': 1,
- 'user_uid': MyCookie().getUID(),
- 'shop_uid': widget.data.shopUid,
- 'role': shopUserMember
- }
- }, (response, hasError) {
- if (!hasError) {
- needRE = !needRE;
- EventBus().emit('needRE', needRE);
- showToast('收藏成功');
- queryWhetherToFollow();
- }
- }, (error) {});
- } else {
- MyDio().del({
- 'key': 'shop_user',
- 'ids': [shopUserID]
- }, (response, hasError) {
- if (!hasError) {
- needRE = !needRE;
- EventBus().emit('needRE', needRE);
- showToast('取消收藏');
- collect = false;
- shopUserID = null;
- setState(() {});
- }
- }, (error) {});
- }
- }
- int shopUserID;
- void queryWhetherToFollow() {
- MyDio().query({
- "key": "shop_user",
- "filters": {
- "conditions": [
- "shop_uid==${widget.data.shopUid}",
- "user_uid==${MyCookie().getUID()}"
- ]
- },
- "dims": shopUserDims,
- "paging": [1, 1]
- }, (response, hasError) {
- if (!hasError) {
- MyShopBeanEntity entity =
- MyShopBeanEntity().fromJson(json.decode(response.data.toString()));
- collect = entity.data.data.length != 0;
- if (entity.data.data.isNotEmpty) {
- shopUserID = entity.data.data[0].id;
- }
- setState(() {});
- }
- }, (error) {});
- }
- }
|