Browse Source

6.17 增加店铺收藏 未付订单按钮 二维码移到我的里面 电话不在我的界面显示,在个人信息详情中显示

huxiaoqiang 4 years ago
parent
commit
f275a0cfbc

+ 16 - 0
images/svg/二维码.svg

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="19px" height="19px" viewBox="0 0 19 19" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <!-- Generator: Sketch 54.1 (76490) - https://sketchapp.com -->
+    <title>二维码</title>
+    <desc>Created with Sketch.</desc>
+    <g id="二维码" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round">
+        <g id="编组" transform="translate(1.000000, 1.000000)" stroke="#333333" stroke-width="1.25">
+            <path d="M6.0352527,7.41228035 L1.1289723,7.41228035 C0.521337162,7.41228035 0.0287391892,6.90066982 0.0287391892,6.26958211 L0.0287391892,1.17393649 C0.0287391892,0.542789123 0.521337162,0.0311785965 1.1289723,0.0311785965 L6.0352527,0.0311785965 C6.64288784,0.0311785965 7.13548581,0.542789123 7.13548581,1.17393649 L7.13548581,6.26958211 C7.13548581,6.90066982 6.64288784,7.41228035 6.0352527,7.41228035 Z" id="Stroke-1"></path>
+            <path d="M6.0352527,16.9508372 L1.1289723,16.9508372 C0.521337162,16.9508372 0.0287391892,16.4392267 0.0287391892,15.8081389 L0.0287391892,10.7124933 C0.0287391892,10.081346 0.521337162,9.56973544 1.1289723,9.56973544 L6.0352527,9.56973544 C6.64288784,9.56973544 7.13548581,10.081346 7.13548581,10.7124933 L7.13548581,15.8081389 C7.13548581,16.4392267 6.64288784,16.9508372 6.0352527,16.9508372 Z" id="Stroke-3"></path>
+            <path d="M15.8616375,7.41093825 L10.9552997,7.41093825 C10.3476645,7.41093825 9.85506655,6.89932772 9.85506655,6.26818035 L9.85506655,1.17259439 C9.85506655,0.541447018 10.3476645,0.0298364912 10.9552997,0.0298364912 L15.8616375,0.0298364912 C16.4692726,0.0298364912 16.9618706,0.541447018 16.9618706,1.17259439 L16.9618706,6.26818035 C16.9618706,6.89932772 16.4692726,7.41093825 15.8616375,7.41093825 Z" id="Stroke-5"></path>
+            <path d="M10.1709507,10.0723449 L10.1709507,16.4131063" id="Stroke-7"></path>
+            <path d="M13.4509916,10.0723449 L13.4509916,16.4131063" id="Stroke-9"></path>
+            <path d="M16.7310324,10.0723449 L16.7310324,16.4131063" id="Stroke-11"></path>
+        </g>
+    </g>
+</svg>

+ 2 - 0
lib/beans/my_shop_bean_entity.dart

@@ -45,6 +45,8 @@ class MyShopBeanDataData extends ISuspensionBean  with JsonConvert<MyShopBeanDat
   bool privateShop;
   @JSONField(name: "inner_trade")
   bool innerTrade;
+  @JSONField(name: "collected")
+  bool collected;
   bool canSend = false;
 
   String tagIndex;

+ 4 - 0
lib/generated/json/my_shop_bean_entity_helper.dart

@@ -103,6 +103,9 @@ myShopBeanDataDataFromJson(MyShopBeanDataData data, Map<String, dynamic> json) {
 	if (json['inner_trade'] != null) {
 		data.innerTrade = json['inner_trade'];
 	}
+	if (json['collected'] != null) {
+		data.collected = json['collected'];
+	}
 	if (json['canSend'] != null) {
 		data.canSend = json['canSend'];
 	}
@@ -131,6 +134,7 @@ Map<String, dynamic> myShopBeanDataDataToJson(MyShopBeanDataData entity) {
 	data['shop_state'] = entity.shopState;
 	data['private_shop'] = entity.privateShop;
 	data['inner_trade'] = entity.innerTrade;
+	data['collected'] = entity.collected;
 	data['canSend'] = entity.canSend;
 	data['tagIndex'] = entity.tagIndex;
 	return data;

+ 23 - 1
lib/https/my_request.dart

@@ -3,7 +3,10 @@ import 'dart:io';
 
 import 'package:bbyyy/beans/android_app_version_bean_entity.dart';
 import 'package:bbyyy/beans/home_carousel_bean_entity.dart';
+import 'package:bbyyy/beans/smart_order_bean_entity.dart';
 import 'package:bbyyy/beans/store_bean_entity.dart';
+import 'package:bbyyy/my_tools/const.dart';
+import 'package:bbyyy/my_tools/dims.dart';
 import 'package:bbyyy/my_tools/event_bus.dart';
 import 'package:bbyyy/my_tools/my_cookie.dart';
 import 'package:bbyyy/my_tools/my_tools.dart';
@@ -62,7 +65,8 @@ checkLogin(SCallBack sCallBack, FCallBack fCallBack) {
       '/ap/checkLogin',
       {
         '__user__': MyCookie().getUser(),
-        'version': MyCookie().packageInfo.version
+        'version': MyCookie().packageInfo.version,
+        'phone': Platform.isAndroid?'Android':'IOS'
       },
       sCallBack,
       fCallBack);
@@ -180,3 +184,21 @@ grabACoupon(int id) {
       (response, hasError) {},
       (error) {});
 }
+
+//查询第三方未付订单
+void checkUnpaidThirdPartyOrders() {
+  MyDio().query({
+    "key": "order",
+    "filters": {"conditions": ["state == $orderStateUnpaid",'buyer_name LIKE ${MyCookie().getName()}']},
+    "dims": orderDims,
+    "paging": [1, 20],
+    "order_by": ["create_time,DESC"]
+  }, (response, hasError) {
+    if(!hasError){
+      SmartOrderBeanEntity entity = SmartOrderBeanEntity()
+          .fromJson(json.decode(response.data.toString()));
+      MyCookie().haveNoPay = entity.data.data.isNotEmpty;
+      EventBus().emit('hasNoPay');
+    }
+  }, (error) { });
+}

+ 3 - 0
lib/main.dart

@@ -136,6 +136,7 @@ class MyApp extends StatelessWidget with WidgetsBindingObserver {
     EventBus().on('检查粘贴板', (arg) {
       Timer(Duration(seconds: 1), () {
         getClipboardData();
+        checkUnpaidThirdPartyOrders();
       });
     });
     EventBus().on('hasCoupon', (arg) {
@@ -202,6 +203,8 @@ class MyApp extends StatelessWidget with WidgetsBindingObserver {
           getClipboardData();
         });
       }
+
+      checkUnpaidThirdPartyOrders();
     }
   }
 

+ 2 - 1
lib/my_tools/dims.dart

@@ -15,7 +15,8 @@ var shopUserDims = [
   "owner_pic",
   "private_shop",
   "shop_state",
-  "inner_trade"
+  "inner_trade",
+  "collected"
 ];
 
 var shopDims = [

+ 1 - 0
lib/my_tools/my_cookie.dart

@@ -29,6 +29,7 @@ class MyCookie {
   UserBeanDataData userBean;
   DisableScreenshots plugin;
   MyLocation location;
+  bool haveNoPay = false;
 
   getUT() {
     return 'user=${loginInformation.data.user}&token=${loginInformation.data.token}';

+ 389 - 274
lib/paegs/gang_page/gang_in_page/gang_in_page.dart

@@ -13,6 +13,7 @@ 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';
@@ -52,6 +53,9 @@ 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();
 
@@ -82,6 +86,7 @@ class _GangInPageState extends State<GangInPage> {
     if (widget.data.ownerUid == MyCookie().getUID()) {
       selectedIndex = 1;
     }
+    queryWhetherToFollow();
     queryStoreInformation();
   }
 
@@ -145,8 +150,8 @@ class _GangInPageState extends State<GangInPage> {
             ),
             PopupMenuButton<String>(
               icon: Icon(Icons.more_horiz),
-              onSelected: (v){
-                switch(v){
+              onSelected: (v) {
+                switch (v) {
                   case '扫一扫':
                     MyTools().toPage(context, ScanPage(), (then) {
                       if (then is String) {
@@ -164,7 +169,7 @@ class _GangInPageState extends State<GangInPage> {
                                   store: store,
                                   qrUID: then,
                                 ),
-                                    (then) {});
+                                (then) {});
                             MyTools().hideKeyboard(context);
                             controller.requestRefresh();
                           });
@@ -173,17 +178,19 @@ class _GangInPageState extends State<GangInPage> {
                     });
                     break;
                   case '发布商品':
-                    MyTools().toPage(context, ReleaseGoodsPage(null,widget.data.shopName), (then) {
+                    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, '删除货帮');
-                          }
-                        });
+                        (then) {
+                      if (then == '删除货帮') {
+                        Navigator.pop(context, '删除货帮');
+                      }
+                    });
                     break;
                   default:
                     break;
@@ -191,12 +198,24 @@ class _GangInPageState extends State<GangInPage> {
               },
               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),),
+                        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),
+                        ),
                       ],
                     ),
                   ),
@@ -204,8 +223,19 @@ class _GangInPageState extends State<GangInPage> {
                     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),),
+                        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),
+                        ),
                       ],
                     ),
                   ),
@@ -214,8 +244,19 @@ class _GangInPageState extends State<GangInPage> {
                       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),),
+                          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),
+                          ),
                         ],
                       ),
                     ),
@@ -231,276 +272,114 @@ class _GangInPageState extends State<GangInPage> {
               margin: EdgeInsets.all(10),
               child: Column(
                 children: [
-                  GestureDetector(
-                    onTap: () {
-                      showDialog(
-                        context: context,
-                        builder: (BuildContext context) {
-                          return Material(
-                            color: Colors.black12,
-                            child: Center(
-                              child: Column(
+                  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: [
-                                  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,
+                                  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(
-                                    margin: EdgeInsets.only(top: 20),
-                                    child: IconButton(
-                                        icon: Icon(
-                                          Icons.cancel,
-                                          color: MyColors.cC9C9C9,
-                                          size: 24,
-                                        ),
-                                        onPressed: () {
-                                          Navigator.pop(context);
-                                        }),
-                                  )
+                                    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,
+                                    ),
+                                  ),
                                 ],
-                                mainAxisAlignment: MainAxisAlignment.center,
                               ),
-                            ),
-                          );
-                        },
-                      );
-                    },
-                    behavior: HitTestBehavior.translucent,
-                    child: Row(
-                      children: [
-                        Container(
-                          margin: EdgeInsets.only(
-                              right: 10, top: 6, left: 6, bottom: 6),
-                          child: ClipRRect(
-                            child: MyViews()
-                                .netImg(imgURL(widget.data.shopPic), 65, 65),
-                            borderRadius: BorderRadius.circular(4),
+                            ],
+                            crossAxisAlignment: CrossAxisAlignment.start,
+                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                           ),
                         ),
-                        Expanded(
+                      ),
+                      Visibility(
+                        visible: !widget.data.privateShop,
+                        child: GestureDetector(
                           child: Container(
-                            height: 65,
-                            margin: EdgeInsets.only(right: 6),
-                            child: Column(
-                              children: [
-                                Text(
-                                  widget.data.shopName,
-                                  style: TextStyle(
-                                      color: MyColors.c333333, fontSize: 13),
-                                  maxLines: 1,
-                                  overflow: TextOverflow.ellipsis,
-                                  softWrap: true,
-                                ),
-                                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,
-                                      ),
-                                    ),
-                                    SvgPicture.asset(
-                                      'images/svg/箭头.svg',
-                                      color: MyColors.c666666,
-                                      height: 10,
-                                      width: 10,
-                                    )
-                                  ],
-                                  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,
+                            margin: EdgeInsets.all(12),
+                            child: SvgPicture.asset(
+                              collect
+                                  ? 'images/svg/已收藏.svg'
+                                  : 'images/svg/未收藏.svg',
+                              height: 20,
+                              width: 20,
                             ),
                           ),
-                        )
-                      ],
-                    ),
+                          onTap: () {
+                            EasyLoading.show();
+                            collectionShop();
+                          },
+                        ),
+                      ),
+                    ],
                   ),
                   Container(
                     height: 0.5,
@@ -1276,6 +1155,16 @@ class _GangInPageState extends State<GangInPage> {
             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);
@@ -1318,4 +1207,230 @@ class _GangInPageState extends State<GangInPage> {
       }
     }, (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) {});
+    }
+
+    // MyDio().update({
+    //   "key": "shop_user",
+    //   "values": {"collected": !widget.data.collected, "id": widget.data.id}
+    // }, (response, hasError) {
+    //   if (!hasError) {
+    //     if (collect) {
+    //       showToast('取消收藏');
+    //     } else {
+    //       showToast('收藏成功');
+    //     }
+    //     collect = !collect;
+    //
+    //     setState(() {});
+    //   }
+    // }, (error) {
+    //   showToast('收藏失败');
+    // });
+  }
+
+  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) {});
+  }
 }

+ 190 - 75
lib/paegs/gang_page/gang_page.dart

@@ -6,6 +6,7 @@ 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/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';
@@ -13,6 +14,7 @@ import 'package:bbyyy/my_tools/my_views.dart';
 import 'package:bbyyy/paegs/gang_page/create_a_gang_page/create_a_gang_page.dart';
 import 'package:bbyyy/paegs/gang_page/gang_in_page/gang_in_page.dart';
 import 'package:bbyyy/paegs/gang_page/join_the_gang_page/join_the_gang_page.dart';
+import 'package:bbyyy/paegs/gang_page/query_gang_page/query_gang_page.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter_svg/svg.dart';
@@ -33,11 +35,17 @@ class _GangPageState extends State<GangPage>
   List<MyShopBeanDataData> applications = [];
   int page = 1;
   RefreshController controller = RefreshController(initialRefresh: true);
+  bool needRE = false;
+  int sIndex = 0;
 
   @override
   void initState() {
     // TODO: implement initState
     super.initState();
+    EventBus().on('needRE', (arg) {
+      print(arg);
+      needRE = arg;
+    });
     popItems.add(PopupMenuItem(
       child: Text(
         '创建货帮',
@@ -54,61 +62,19 @@ class _GangPageState extends State<GangPage>
     ));
   }
 
+  @override
+  void dispose() {
+    // TODO: implement dispose
+    super.dispose();
+    EventBus().off('needRE');
+  }
+
   @override
   Widget build(BuildContext context) {
     return Scaffold(
       body: Stack(
         children: [
-          Container(
-            decoration: BoxDecoration(
-              gradient: LinearGradient(
-                colors: MyColors.lg,
-              ),
-            ),
-            height: 152,
-            child: SafeArea(
-              bottom: false,
-              child: Stack(
-                children: [
-                  Container(
-                    height: 50,
-                    child: Text(
-                      '货帮',
-                      style: TextStyle(color: Colors.white, fontSize: 16),
-                    ),
-                    alignment: Alignment.center,
-                  ),
-                  Container(
-                    height: 50,
-                    child: PopupMenuButton(
-                      itemBuilder: (BuildContext context) {
-                        return popItems;
-                      },
-                      onSelected: (v) {
-                        if (v == '加入货帮') {
-                          MyTools().toPage(context, JoinTheGangPage(), (then) {
-                            controller.requestRefresh();
-                          });
-                        } else if (v == '创建货帮') {
-                          MyTools().toPage(context, CreateAGangPage(), (then) {
-                            controller.requestRefresh();
-                          });
-                        }
-                      },
-                      child: Container(
-                        padding: EdgeInsets.all(8),
-                        margin: EdgeInsets.only(right: 6),
-                        child: SvgPicture.asset('images/svg/添加.svg'),
-                      ),
-                    ),
-                    alignment: Alignment.centerRight,
-                  )
-                ],
-                alignment: Alignment.topCenter,
-              ),
-            ),
-            alignment: Alignment.topCenter,
-          ),
+          appBar(context),
           Container(
             margin:
                 EdgeInsets.only(top: MediaQuery.of(context).padding.top + 50),
@@ -138,8 +104,119 @@ class _GangPageState extends State<GangPage>
     );
   }
 
+  Container appBar(BuildContext context) {
+    return Container(
+      decoration: BoxDecoration(
+        gradient: LinearGradient(
+          colors: MyColors.lg,
+        ),
+      ),
+      height: 152,
+      child: SafeArea(
+        bottom: false,
+        child: Stack(
+          children: [
+            Container(
+              height: 50,
+              child: Row(
+                children: [
+                  GestureDetector(
+                    onTap: () {
+                      setState(() {
+                        sIndex = 0;
+                        controller.requestRefresh();
+                      });
+                    },
+                    child: Text(
+                      '货帮',
+                      style: TextStyle(
+                          color: Colors.white,
+                          fontSize: sIndex == 0 ? 16 : 15,
+                          fontWeight: sIndex == 0
+                              ? FontWeight.bold
+                              : FontWeight.normal),
+                    ),
+                  ),
+                  Container(
+                    width: 56,
+                  ),
+                  GestureDetector(
+                    onTap: () {
+                      setState(() {
+                        sIndex = 1;
+                        controller.requestRefresh();
+                      });
+                    },
+                    child: Text(
+                      '关注',
+                      style: TextStyle(
+                          color: Colors.white,
+                          fontSize: sIndex == 1 ? 16 : 15,
+                          fontWeight: sIndex == 1
+                              ? FontWeight.bold
+                              : FontWeight.normal),
+                    ),
+                  ),
+                ],
+                mainAxisAlignment: MainAxisAlignment.center,
+              ),
+              alignment: Alignment.center,
+            ),
+            Row(
+              children: [
+                GestureDetector(
+                  onTap: (){
+                    MyTools().toPage(context, QueryGangPage(), (then){});
+                  },
+                  behavior: HitTestBehavior.translucent,
+                  child: Container(
+                    child: SvgPicture.asset(
+                      'images/svg/搜索.svg',
+                      color: Colors.white,
+                    ),
+                    width: 50,
+                    height: 50,
+                    padding: EdgeInsets.all(15),
+                  ),
+                ),
+                Container(
+                  height: 50,
+                  child: PopupMenuButton(
+                    itemBuilder: (BuildContext context) {
+                      return popItems;
+                    },
+                    onSelected: (v) {
+                      if (v == '加入货帮') {
+                        MyTools().toPage(context, JoinTheGangPage(), (then) {
+                          controller.requestRefresh();
+                        });
+                      } else if (v == '创建货帮') {
+                        MyTools().toPage(context, CreateAGangPage(), (then) {
+                          controller.requestRefresh();
+                        });
+                      }
+                    },
+                    child: Container(
+                      padding: EdgeInsets.all(8),
+                      margin: EdgeInsets.only(right: 6),
+                      child: SvgPicture.asset('images/svg/添加.svg'),
+                    ),
+                  ),
+                  alignment: Alignment.centerRight,
+                ),
+              ],
+              mainAxisAlignment: MainAxisAlignment.end,
+            )
+          ],
+          alignment: Alignment.topCenter,
+        ),
+      ),
+      alignment: Alignment.topCenter,
+    );
+  }
+
   Widget getGangItem(MyShopBeanDataData data) {
-    if (data.shopPic==null) {
+    if (data.shopPic == null) {
       return GestureDetector(
         onTap: () {
           MyTools().toPage(context, ApplicationPage(), (then) {
@@ -236,7 +313,10 @@ class _GangPageState extends State<GangPage>
       return GestureDetector(
         onTap: () {
           MyTools().toPage(context, GangInPage(data, null), (then) {
-            if(then=='删除货帮'){
+            if (then == '删除货帮') {
+              controller.requestRefresh();
+            } else if (needRE) {
+              needRE = false;
               controller.requestRefresh();
             }
           });
@@ -288,7 +368,7 @@ class _GangPageState extends State<GangPage>
                                     alignment: Alignment.center,
                                     padding: EdgeInsets.only(bottom: 2),
                                   ),
-                                  visible: data.role == shopUserOwner,
+                                  visible: data.ownerUid == MyCookie().getUID(),
                                 ),
                               ],
                             ),
@@ -348,31 +428,55 @@ class _GangPageState extends State<GangPage>
   bool get wantKeepAlive => true;
 
   queryGang() {
-    MyDio().query({
-      "key": "shop_user",
-      "filters": {
-        "or": true,
-        "conditions": [
-          "role!=$shopUserOwner",
-          "user_uid==${MyCookie().getUID()}",
-          "review_state==1"
-        ],
-        "filters": [
-          {
-            "conditions": ["role==$shopUserOwner", "user_uid==${MyCookie().getUID()}"]
-          }
-        ]
-      },
-      "dims": shopUserDims,
-      "paging": [page, 1000],
-      "order_by": ["shop_name,DESC"]
-    }, (response, hasError) {
+    var dJson;
+    var conditions1 = [
+      "role!=$shopUserOwner",
+      "user_uid==${MyCookie().getUID()}",
+      "review_state==1"
+    ];
+    var conditions2 = [
+      "role==$shopUserOwner",
+      "user_uid==${MyCookie().getUID()}"
+    ];
+    if(sIndex == 0){
+      conditions1.add('private_shop==true');
+      dJson = {
+        "key": "shop_user",
+        "filters": {
+          "or": true,
+          "conditions": conditions1,
+          "filters": [
+            {"conditions": conditions2}
+          ]
+        },
+        "dims": shopUserDims,
+        "paging": [page, 1000],
+        "order_by": ["shop_name,DESC"]
+      };
+    }else{
+      conditions1.add('private_shop==false');
+      dJson = {
+        "key": "shop_user",
+        "filters": {
+          "conditions": conditions1
+        },
+        "dims": shopUserDims,
+        "paging": [page, 1000],
+        "order_by": ["shop_name,DESC"]
+      };
+    }
+
+
+    // if (sIndex == 1) {
+    //   conditions1.add('collected == true');
+    //   conditions2.add('collected == true');
+    // }
+    MyDio().query(dJson, (response, hasError) {
       if (!hasError) {
         MyShopBeanEntity entity =
             MyShopBeanEntity().fromJson(json.decode(response.data.toString()));
         if (page == 1) {
           data.clear();
-
         }
 
         data.addAll(entity.data.data);
@@ -390,6 +494,16 @@ class _GangPageState extends State<GangPage>
   }
 
   void _handleList(List<MyShopBeanDataData> list) {
+
+    List<MyShopBeanDataData> selfBuilt = [];
+    list.forEach((element) {
+      if(element.ownerUid==MyCookie().getUID()){
+        selfBuilt.add(element);
+      }
+    });
+    selfBuilt.forEach((element) {
+      list.removeWhere((data) => data.id==element.id);
+    });
     if (list.isEmpty) return;
     for (int i = 0, length = list.length; i < length; i++) {
       String pinyin = PinyinHelper.getPinyinE(list[i].shopName);
@@ -402,11 +516,12 @@ class _GangPageState extends State<GangPage>
     }
     // A-Z sort.
     SuspensionUtil.sortListBySuspensionTag(list);
-
-    if(applications.isNotEmpty){
+    data.insertAll(0, selfBuilt);
+    if (applications.isNotEmpty) {
       MyShopBeanDataData shopB = MyShopBeanDataData();
       shopB.shopName = '★';
       // add hotCityList.
+
       data.insert(0, shopB);
     }
 

+ 263 - 0
lib/paegs/gang_page/query_gang_page/query_gang_page.dart

@@ -0,0 +1,263 @@
+import 'dart:convert';
+
+import 'package:bbyyy/beans/my_shop_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/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/paegs/gang_page/gang_in_page/gang_in_page.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:pull_to_refresh/pull_to_refresh.dart';
+
+class QueryGangPage extends StatefulWidget {
+  @override
+  _QueryGangPageState createState() => _QueryGangPageState();
+}
+
+class _QueryGangPageState extends State<QueryGangPage> {
+  TextEditingController _textEditingController = TextEditingController();
+  RefreshController _refreshController = RefreshController();
+  List<MyShopBeanDataData> data = [];
+
+  @override
+  Widget build(BuildContext context) {
+    return GestureDetector(
+      onTap: () {
+        MyTools().hideKeyboard(context);
+      },
+      behavior: HitTestBehavior.translucent,
+      child: Scaffold(
+        body: Column(
+          children: [
+            MyViews().myAppBar('货帮查询', context, []),
+            Container(
+              height: 0.5,
+              color: MyColors.cF0F0F0,
+            ),
+            Container(
+              color: Colors.white,
+              padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),
+              child: Container(
+                decoration: BoxDecoration(
+                  color: Colors.white,
+                  borderRadius: BorderRadius.circular(20),
+                  border: Border.all(color: Colors.grey, width: 1),
+                ),
+                height: 40,
+                width: double.infinity,
+                child: Row(
+                  children: [
+                    Expanded(
+                        child: TextField(
+                      controller: _textEditingController,
+                      cursorColor: MyColors.cFF4233,
+                      cursorWidth: 1.0,
+                      onTap: () {},
+                      decoration: InputDecoration(
+                        border: InputBorder.none,
+                        disabledBorder: InputBorder.none,
+                        enabledBorder: InputBorder.none,
+                        focusedBorder: InputBorder.none,
+                        isDense: true,
+                        hintText: '请输入货帮名称',
+                        hintStyle:
+                            TextStyle(color: MyColors.c999999, fontSize: 16),
+                        contentPadding:
+                            const EdgeInsets.fromLTRB(14, 4.5, 8, 4.5),
+                      ),
+                      maxLines: 1,
+                      style: TextStyle(
+                          color: MyColors.c333333,
+                          fontSize: 16,
+                          height: 1.3,
+                          letterSpacing: 0.2),
+                      keyboardType: TextInputType.text,
+                      onChanged: (t) {},
+                    )),
+                    GestureDetector(
+                      onTap: () {
+                        if (_textEditingController.text.isEmpty) {
+                          return;
+                        } else {
+                          _refreshController.requestRefresh();
+                        }
+                      },
+                      behavior: HitTestBehavior.translucent,
+                      child: Container(
+                        decoration: BoxDecoration(
+                            color: MyColors.cFF4233,
+                            borderRadius: BorderRadius.circular(20)),
+                        height: 40,
+                        width: 70,
+                        child: Text(
+                          '搜索',
+                          style: TextStyle(color: Colors.white, fontSize: 14),
+                        ),
+                        alignment: Alignment.center,
+                      ),
+                    )
+                  ],
+                ),
+              ),
+            ),
+            Expanded(
+              flex: 1,
+              child: SmartRefresher(
+                controller: _refreshController,
+                onRefresh: onRefresh,
+                child:data.length == 0
+                    ? SingleChildScrollView(child: noData())
+                    : ListView.builder(
+                  itemBuilder: (BuildContext context, int index) {
+                    return gangItem(context, index);
+                  },
+                  itemCount: data.length,
+                ),
+              ),
+            )
+          ],
+        ),
+      ),
+    );
+  }
+
+  GestureDetector gangItem(BuildContext context, int index) {
+    return GestureDetector(
+      onTap: () {
+        MyTools().toPage(context, GangInPage(data[index], null), (then) {});
+      },
+      behavior: HitTestBehavior.translucent,
+      child: Container(
+        height: 73,
+        child: Column(
+          children: [
+            Expanded(
+              child: Row(
+                children: [
+                  Container(
+                    margin: EdgeInsets.only(left: 14, right: 14),
+                    child: ClipRRect(
+                      child: MyViews().netImg(
+                          imgURL(data[index].shopPic), 45, 45,
+                          placeholder: 'images/svg/占位图.svg'),
+                      borderRadius: BorderRadius.all(Radius.circular(4)),
+                    ),
+                  ),
+                  Expanded(
+                    child: Container(
+                      height: 45,
+                      padding: EdgeInsets.only(right: 14),
+                      child: Column(
+                        children: [
+                          Row(
+                            children: [
+                              Expanded(
+                                  child: Text(
+                                data[index].shopName,
+                                style: TextStyle(
+                                    color: MyColors.c333333, fontSize: 15),
+                              )),
+                              Visibility(
+                                child: Container(
+                                  decoration: BoxDecoration(
+                                      color: MyColors.cFFCD00,
+                                      borderRadius: BorderRadius.only(
+                                          topLeft: Radius.circular(6),
+                                          bottomRight: Radius.circular(6))),
+                                  height: 18,
+                                  width: 30,
+                                  child: Text(
+                                    '自建',
+                                    style: TextStyle(
+                                        color: Colors.white, fontSize: 10),
+                                  ),
+                                  alignment: Alignment.center,
+                                  padding: EdgeInsets.only(bottom: 2),
+                                ),
+                                visible:
+                                    data[index].ownerUid == MyCookie().getUID(),
+                              ),
+                            ],
+                          ),
+                          Row(
+                            children: [
+                              Expanded(
+                                child: Text(
+                                  'ID:${data[index].shopUid}',
+                                  style: TextStyle(
+                                      color: MyColors.c888888, fontSize: 12),
+                                ),
+                              ),
+                              Visibility(
+                                child: Container(
+                                  decoration: BoxDecoration(
+                                      color: MyColors.cFF4233,
+                                      borderRadius: BorderRadius.only(
+                                          topLeft: Radius.circular(6),
+                                          bottomRight: Radius.circular(6))),
+                                  height: 18,
+                                  width: 30,
+                                  child: Text(
+                                    '欠费',
+                                    style: TextStyle(
+                                        color: Colors.white, fontSize: 10),
+                                  ),
+                                  alignment: Alignment.center,
+                                  padding: EdgeInsets.only(bottom: 2),
+                                ),
+                                visible:
+                                    data[index].shopState == shopStateArrearage,
+                              ),
+                            ],
+                          )
+                        ],
+                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                      ),
+                    ),
+                  )
+                ],
+              ),
+            ),
+            Container(
+              margin: EdgeInsets.only(left: 73, right: 14),
+              height: 0.5,
+              color: MyColors.cE7E7E7,
+            )
+          ],
+          mainAxisAlignment: MainAxisAlignment.spaceBetween,
+        ),
+      ),
+    );
+  }
+
+  void onRefresh() {
+    MyDio().query({
+      "key": "shop_user",
+      "filters": {
+        "conditions": [
+          "user_uid==${MyCookie().getUID()}",
+          "review_state==1",
+          "shop_name LIKE ${_textEditingController.text.toString()}"
+        ]
+      },
+      "dims": shopUserDims,
+      "paging": [1, 1000],
+      "order_by": ["shop_name,DESC"]
+    }, (response, hasError) {
+      if (!hasError) {
+        MyShopBeanEntity entity =
+            MyShopBeanEntity().fromJson(json.decode(response.data.toString()));
+        data.clear();
+        data.addAll(entity.data.data);
+        setState(() {
+          _refreshController.refreshCompleted();
+        });
+      }
+    }, (error) {});
+  }
+}

+ 2 - 2
lib/paegs/login_page/login_page.dart

@@ -357,7 +357,8 @@ class _LoginPageState extends State<LoginPage> {
     loginAccount({
       'user': _phoneNum.text,
       'password': MyTools.base64Encode(_pw.text),
-      'version':MyCookie().packageInfo.version
+      'version':MyCookie().packageInfo.version,
+      'phone': Platform.isAndroid?'Android':'IOS'
     }, (r, hE) {
       if (!hE) {
         LoginInformationBeanEntity entity = LoginInformationBeanEntity()
@@ -365,7 +366,6 @@ class _LoginPageState extends State<LoginPage> {
         MyCookie().saveLoginInformationBeanEntity(entity);
         MyDio().initDio();
         MyTools().toPage(context, RootPage(), (then) {}, noBack: true);
-
       }
     }, (e) {});
   }

+ 65 - 40
lib/paegs/mine_page/mine_page.dart

@@ -28,6 +28,7 @@ import 'advertising_page/advertising_page.dart';
 import 'bind_alipay_page/bind_alipay_page.dart';
 import 'bind_alipay_page/set_alipay_page.dart';
 import 'coupon_page/coupon_page.dart';
+import 'my_information_page/my_qr_page.dart';
 
 class MinePage extends StatefulWidget {
   @override
@@ -79,10 +80,7 @@ class _MinePageState extends State<MinePage> {
                       ),
                       child: GestureDetector(
                         onTap: () {
-                          MyTools().toPage(context, MyInformationPage(),
-                              (then) {
-                            queryPersonalInformation();
-                          });
+
                         },
                         behavior: HitTestBehavior.translucent,
                         child: Row(
@@ -117,31 +115,39 @@ class _MinePageState extends State<MinePage> {
                                 height: 68,
                                 child: Column(
                                   children: [
-                                    Row(
-                                      children: [
-                                        Container(
-                                          margin: EdgeInsets.only(right: 10),
-                                          child: Text(
-                                            MyCookie()
-                                                .loginInformation
-                                                .data
-                                                .extra
-                                                .name,
-                                            style: TextStyle(
-                                                color: Colors.white,
-                                                fontSize: 18),
-                                            maxLines: 1,
-                                            overflow: TextOverflow.ellipsis,
-                                            softWrap: true,
+                                    GestureDetector(
+                                      onTap: (){
+                                        MyTools().toPage(context, MyInformationPage(),
+                                                (then) {
+                                              queryPersonalInformation();
+                                            });
+                                      },
+                                      child: Row(
+                                        children: [
+                                          Container(
+                                            margin: EdgeInsets.only(right: 10),
+                                            child: Text(
+                                              MyCookie()
+                                                  .loginInformation
+                                                  .data
+                                                  .extra
+                                                  .name,
+                                              style: TextStyle(
+                                                  color: Colors.white,
+                                                  fontSize: 18),
+                                              maxLines: 1,
+                                              overflow: TextOverflow.ellipsis,
+                                              softWrap: true,
+                                            ),
                                           ),
-                                        ),
-                                        SvgPicture.asset(
-                                          'images/svg/箭头.svg',
-                                          color: Colors.white,
-                                          width: 6,
-                                          height: 11,
-                                        )
-                                      ],
+                                          SvgPicture.asset(
+                                            'images/svg/箭头.svg',
+                                            color: Colors.white,
+                                            width: 6,
+                                            height: 11,
+                                          )
+                                        ],
+                                      ),
                                     ),
                                     Text(
                                       'ID:${MyCookie().getUID()}',
@@ -153,16 +159,16 @@ class _MinePageState extends State<MinePage> {
                                       overflow: TextOverflow.ellipsis,
                                       softWrap: true,
                                     ),
-                                    Text(
-                                      '电话:${MyCookie().userBean.mobile}',
-                                      style: TextStyle(
-                                        color: Colors.white,
-                                        fontSize: 14,
-                                      ),
-                                      maxLines: 1,
-                                      overflow: TextOverflow.ellipsis,
-                                      softWrap: true,
-                                    )
+                                    // Text(
+                                    //   '电话:${MyCookie().userBean.mobile}',
+                                    //   style: TextStyle(
+                                    //     color: Colors.white,
+                                    //     fontSize: 14,
+                                    //   ),
+                                    //   maxLines: 1,
+                                    //   overflow: TextOverflow.ellipsis,
+                                    //   softWrap: true,
+                                    // )
                                   ],
                                   crossAxisAlignment: CrossAxisAlignment.start,
                                   mainAxisAlignment:
@@ -170,8 +176,27 @@ class _MinePageState extends State<MinePage> {
                                 ),
                               ),
                             ),
-                            MyViews().myText('¥${MyCookie().userBean.balance}',
-                                Colors.white, 24)
+                            Container(
+                              height: 68,
+                              child: Column(
+                                children: [
+                                  MyViews().myText('¥${MyCookie().userBean.balance}',
+                                      Colors.white, 24),
+                                  GestureDetector(
+                                    onTap: (){
+                                      MyTools().toPage(context, MyQRPage(), (then){});
+                                    },
+                                    child: Row(
+                                      children: [
+                                        SvgPicture.asset('images/svg/二维码.svg',color: Colors.white,),
+                                        Container(width: 10,),
+                                        SvgPicture.asset('images/svg/箭头.svg',color: Colors.white,height: 12,width: 8,)
+                                      ],
+                                    ),
+                                  )
+                                ],mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                              ),
+                            )
                           ],
                         ),
                       ),

+ 52 - 8
lib/paegs/mine_page/my_information_page/my_information_page.dart

@@ -227,15 +227,59 @@ class _MyInformationPageState extends State<MyInformationPage> {
                                     )
                                   ],
                                 ),
-                                IconButton(
-                                  onPressed: () {
-                                    MyTools().toPage(context, MyQRPage(), (then){});
-                                  },
-                                  icon: Icon(
-                                    Icons.qr_code,
-                                    color: MyColors.c333333,
+                                GestureDetector(
+                                  child: SvgPicture.asset(
+                                    'images/svg/二维码.svg',
+                                    color:MyColors.c333333,
                                   ),
-                                )
+                                  onTap: () {
+                                    MyTools()
+                                        .toPage(context, MyQRPage(), (then) {});
+                                  },
+                                ),
+                                // IconButton(
+                                //   onPressed: () {
+                                //
+                                //   },
+                                //   icon: Icon(
+                                //     Icons.qr_code,
+                                //     color: MyColors.c333333,
+                                //   ),
+                                // )
+                              ],
+                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                            ),
+                          ),
+                          Container(
+                            height: 0.5,
+                            margin: EdgeInsets.symmetric(horizontal: 15),
+                            color: MyColors.cE7E7E7,
+                          ),
+                          Container(
+                            height: 55,
+                            alignment: Alignment.center,
+                            padding: EdgeInsets.symmetric(horizontal: 15),
+                            child: Row(
+                              children: [
+                                Row(
+                                  children: [
+                                    Container(
+                                      child: Text(
+                                        '电话',
+                                        style: TextStyle(
+                                            color: MyColors.c333333,
+                                            fontSize: 15),
+                                      ),
+                                      margin: EdgeInsets.only(right: 28),
+                                    ),
+                                    Text(
+                                      '${MyCookie().userBean.mobile}',
+                                      style: TextStyle(
+                                          color: MyColors.c999999,
+                                          fontSize: 15),
+                                    )
+                                  ],
+                                ),
                               ],
                               mainAxisAlignment: MainAxisAlignment.spaceBetween,
                             ),

+ 8 - 1
lib/paegs/mine_page/order_page/order_page.dart

@@ -2,6 +2,7 @@ import 'dart:convert';
 
 import 'package:bbyyy/beans/smart_order_bean_entity.dart';
 import 'package:bbyyy/https/MyDio.dart';
+import 'package:bbyyy/https/my_request.dart';
 import 'package:bbyyy/my_tools/const.dart';
 import 'package:bbyyy/my_tools/dims.dart';
 import 'package:bbyyy/my_tools/event_bus.dart';
@@ -15,6 +16,10 @@ import 'package:flutter_svg/svg.dart';
 import 'package:pull_to_refresh/pull_to_refresh.dart';
 
 class OrderPage extends StatefulWidget {
+  int index;
+
+  OrderPage({this.index = 0});
+
   @override
   _OrderPageState createState() => _OrderPageState();
 }
@@ -30,6 +35,7 @@ class _OrderPageState extends State<OrderPage> {
     // TODO: implement initState
     super.initState();
     EventBus().on('刷新未付订单', (arg) { controller.requestRefresh();});
+    selectedIndex = widget.index;
   }
 
   @override
@@ -37,6 +43,7 @@ class _OrderPageState extends State<OrderPage> {
     // TODO: implement dispose
     super.dispose();
     EventBus().off('刷新未付订单');
+    checkUnpaidThirdPartyOrders();
   }
 
   @override
@@ -169,7 +176,7 @@ class _OrderPageState extends State<OrderPage> {
                           child: MyViews()
                               .getNoPayGoodsItem(orders[index], context, -1),
                           actionPane: SlidableDrawerActionPane(),
-                          enabled: selectedIndex == 0 || (orders[index].type == orderTypeOfflineTransfer && orders[index].buyerUid == MyCookie().getUID()),
+                          enabled: selectedIndex == 0 || (orders[index].type == orderTypeOfflineTransfer && orders[index].buyerUid == MyCookie().getUID())||orders[index].buyerUid==MyCookie().getUID(),
                           actionExtentRatio: 0.25,
                           secondaryActions: <Widget>[
                             SlideAction(

+ 7 - 0
lib/paegs/pay_page/pay_page.dart

@@ -60,6 +60,13 @@ class _PayPageState extends State<PayPage> with WidgetsBindingObserver {
     });
   }
 
+  @override
+  void dispose() {
+    // TODO: implement dispose
+    super.dispose();
+    checkUnpaidThirdPartyOrders();
+  }
+
   @override
   Widget build(BuildContext context) {
     return WillPopScope(

+ 62 - 10
lib/paegs/root_page/root_page.dart

@@ -18,10 +18,13 @@ import 'package:bbyyy/nsq/nsq.dart' as Nsq;
 import 'package:bbyyy/paegs/gang_page/gang_page.dart';
 import 'package:bbyyy/paegs/home_page/home_page.dart';
 import 'package:bbyyy/paegs/mine_page/mine_page.dart';
+import 'package:bbyyy/paegs/mine_page/order_page/order_page.dart';
 import 'package:bbyyy/paegs/msg_page/msg_page.dart';
 import 'package:bbyyy/paegs/root_page/root_page_view.dart';
+import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
+import 'package:flutter_svg/flutter_svg.dart';
 import 'package:permission_handler/permission_handler.dart';
 
 class RootPage extends StatefulWidget {
@@ -61,6 +64,11 @@ class _RootPageState extends State<RootPage> {
       pageController.jumpToPage(RootPageView().bNIndex);
       setState(() {});
     });
+    EventBus().on('hasNoPay', (arg) {
+      setState(() {
+
+      });
+    });
     MyData().init(context);
     queryPersonalInformation();
     checkForUpdates(context);
@@ -73,6 +81,7 @@ class _RootPageState extends State<RootPage> {
   void dispose() {
     // TODO: implement dispose
     EventBus().off('ChangePage');
+    EventBus().off('hasNoPay');
     AMapLocationClient.stopLocation();
     super.dispose();
   }
@@ -94,16 +103,60 @@ class _RootPageState extends State<RootPage> {
       child: Scaffold(
         resizeToAvoidBottomInset: false,
         backgroundColor: Colors.transparent,
-        body: Column(
+        body: Stack(
           children: [
-            Expanded(
-              child: PageView(
-                controller: pageController,
-                children: [HomePage(), GangPage(), MsgPage(), MinePage()],
-                physics: NeverScrollableScrollPhysics(),
-              ),
+            Column(
+              children: [
+                Expanded(
+                  child: PageView(
+                    controller: pageController,
+                    children: [HomePage(), GangPage(), MsgPage(), MinePage()],
+                    physics: NeverScrollableScrollPhysics(),
+                  ),
+                ),
+                RootPageView().bottomNavigationBar(),
+              ],
             ),
-            RootPageView().bottomNavigationBar(),
+            if (MyCookie().haveNoPay)
+              Positioned(
+                bottom: 60,
+                right: 0,
+                child: GestureDetector(
+                  onTap: (){
+                    MyTools().toPage(context, OrderPage(index: 2,), (then) {
+                      queryPersonalInformation();
+                    });
+                  },
+                  behavior: HitTestBehavior.translucent,
+                  child: Container(
+                    height: 44,
+                    width: 100,
+                    padding: EdgeInsets.symmetric(horizontal: 10),
+                    child: Row(
+                      children: [
+                        SvgPicture.asset(
+                          'images/svg/订单.svg',
+                          color: Colors.white,
+                          height: 15,
+                          width: 15,
+                        ),
+                        Text(
+                          '未付订单',
+                          style: TextStyle(color: Colors.white, fontSize: 14),
+                        )
+                      ],
+                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                    ),
+                    decoration: BoxDecoration(
+                      color: Colors.amber,
+                      borderRadius: BorderRadius.only(
+                        topLeft: Radius.circular(22),
+                        bottomLeft: Radius.circular(22),
+                      ),
+                    ),
+                  ),
+                ),
+              ),
           ],
         ),
       ),
@@ -169,8 +222,7 @@ class _RootPageState extends State<RootPage> {
               district: value.district,
               latitude: value.latitude,
               longitude: value.longitude);
-          if ( value.province!= '四川省' ||
-              value.city!= '成都市') {
+          if (value.province != '四川省' || value.city != '成都市') {
             EventBus().emit('getLocation');
           }
         } else if (Platform.isIOS) {