From 1abc1bd0be5b95d2482fb05dbb0309828778a1e7 Mon Sep 17 00:00:00 2001 From: PH2 <1293456824@qq.com> Date: Wed, 28 Apr 2021 10:40:04 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=96=B0=E5=A2=9E=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../orders_page/bloc/order_content_bloc.dart | 7 +++++- lib/pages/orders_page/order_content_page.dart | 5 ++-- lib/pages/orders_page/orders_page.dart | 25 +++++++++++++------ lib/register.dart | 4 +++ 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/lib/pages/orders_page/bloc/order_content_bloc.dart b/lib/pages/orders_page/bloc/order_content_bloc.dart index ae62586..0fdb46d 100644 --- a/lib/pages/orders_page/bloc/order_content_bloc.dart +++ b/lib/pages/orders_page/bloc/order_content_bloc.dart @@ -7,6 +7,10 @@ import 'package:zhiying_comm/util/base_bloc.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; class OrderContentBloc extends BlocBase { + + final String skipIdentifier; + OrderContentBloc({this.skipIdentifier}); + List _orders = List(); StreamController> _ordersController = @@ -35,7 +39,8 @@ class OrderContentBloc extends BlocBase { Map params = _filter.toJson(); params.removeWhere((key, value) => value == null || value == ''); params['state'] = _state; - NetUtil.request('/api/v1/order', method: NetMethod.POST, params: params, + String reqUrl = skipIdentifier == 'pub.flutter.order_by_userlvup' ? '/api/v1/order_by_userlvup' : '/api/v1/order'; + NetUtil.request(reqUrl, method: NetMethod.POST, params: params, onCache: (data) { //_parseData(data); }, onSuccess: (data) { diff --git a/lib/pages/orders_page/order_content_page.dart b/lib/pages/orders_page/order_content_page.dart index d95c741..d90d3ee 100644 --- a/lib/pages/orders_page/order_content_page.dart +++ b/lib/pages/orders_page/order_content_page.dart @@ -17,9 +17,10 @@ class OrderContentPage extends StatefulWidget { final OrderFilterModel filter; final int index; final EventBus eventBus; + final String skipIdentifier; const OrderContentPage(this.state, - {Key key, this.filter, this.style, this.index, this.eventBus}) + {Key key, this.filter, this.style, this.index, this.eventBus, this.skipIdentifier}) : super(key: key); @override @@ -30,7 +31,7 @@ class _OrderContentPageState extends State { @override Widget build(BuildContext context) { return BlocProvider( - bloc: OrderContentBloc(), + bloc: OrderContentBloc(skipIdentifier: widget?.skipIdentifier), child: OrderContentContainer( widget.state, widget.filter, diff --git a/lib/pages/orders_page/orders_page.dart b/lib/pages/orders_page/orders_page.dart index 5804d33..6cf96ab 100644 --- a/lib/pages/orders_page/orders_page.dart +++ b/lib/pages/orders_page/orders_page.dart @@ -142,20 +142,27 @@ class _OrdersContainerState extends State<_OrdersContainer> filter: _filter, index: index, eventBus: _eventBus, + skipIdentifier: widget.data['skip_identifier'], ), ); return Column( children: [ - GestureDetector( - child: OrderSearchWidget(model), - onTap: () { - Navigator.of(context) - .push(CupertinoPageRoute(builder: (BuildContext context) { - return OrderSearchPage(model); - })); - }, + /// TODO 只有我的订单才显示搜索 + /// 搜索框 + Visibility( + visible: widget.data['skip_identifier'] == 'pub.flutter.my_order', + child: GestureDetector( + child: OrderSearchWidget(model), + onTap: () { + Navigator.of(context) + .push(CupertinoPageRoute(builder: (BuildContext context) { + return OrderSearchPage(model); + })); + }, + ), ), + /// TabBar 分类导航 OrderTabbarWidget( model, _tabController, @@ -167,6 +174,7 @@ class _OrdersContainerState extends State<_OrdersContainer> }); }, ), + /// TabView 子视图 Expanded( child: Stack( children: [ @@ -174,6 +182,7 @@ class _OrdersContainerState extends State<_OrdersContainer> children: _contents, controller: _tabController, ), + /// 筛选视图 Visibility( visible: _isFilterShow, child: OrderFilterWidget( diff --git a/lib/register.dart b/lib/register.dart index 7687509..d59174e 100644 --- a/lib/register.dart +++ b/lib/register.dart @@ -262,7 +262,11 @@ class BaseWidgetRegister { /// 订单页面 PageFactory.regist('pub.flutter.my_order', (model) => OrdersPage(model)); + /// 会员订单页面 + PageFactory.regist('pub.flutter.order_by_userlvup', (model) => OrdersPage(model)); + /// 账号安全页面 PageFactory.regist('pub.flutter.account_security', (model) => SecurityPage(model)); + /// 绑定支付宝页面 PageFactory.regist('pub.flutter.account_security_alipay', (model) => SecurityBindAlipayPage(model)); /// 登录密码