提交 457e4088 authored 作者: maodou's avatar maodou

1:订单列表搜索订单

上级 8872e6ad
...@@ -4,5 +4,5 @@ keyPassword=123456 ...@@ -4,5 +4,5 @@ keyPassword=123456
keyAlias=zijing keyAlias=zijing
storeFile=/Users/apple/zijiing_key.jks #storeFile=/Users/apple/zijiing_key.jks
#storeFile=zijiing_key.jks storeFile=zijiing_key.jks
\ No newline at end of file \ No newline at end of file
...@@ -316,14 +316,19 @@ abstract class MineAPI { ...@@ -316,14 +316,19 @@ abstract class MineAPI {
int page = 1, int page = 1,
int limit = 10, int limit = 10,
int status = 1, int status = 1,
String? keys
}) async { }) async {
Map<String, dynamic> params = {
'page': page,
'page_size': limit,
'status':status,
};
if (keys != null) {
params['keys'] = keys;
}
final result = await HttpService.to.post( final result = await HttpService.to.post(
'/v1/orders/Orders/getOrdersList', '/v1/orders/Orders/getOrdersList',
params: { params: params,
'page': page,
'page_size': limit,
'status':status,
},
); );
if (result.data is! Map && result.data['list'] is! List) return []; if (result.data is! Map && result.data['list'] is! List) return [];
return List.generate(result.data['list'].length, (index) { return List.generate(result.data['list'].length, (index) {
......
part of user_order; part of user_order;
class UserOrderPage extends StatefulWidget { class UserOrderPage extends StatefulWidget {
const UserOrderPage({ const UserOrderPage({Key? key /*, required this.userInfo*/
Key? key /*, required this.userInfo*/}) : })
super(key: key); : super(key: key);
@override @override
State<UserOrderPage> createState() => _UserOrderState(); State<UserOrderPage> createState() => _UserOrderState();
} }
int tab = 0;
class _UserOrderState extends State<UserOrderPage> { class _UserOrderState extends State<UserOrderPage> {
/* late num? selectedGender ; // 选中的性别 /* late num? selectedGender ; // 选中的性别
@override @override
...@@ -17,18 +19,11 @@ class _UserOrderState extends State<UserOrderPage> { ...@@ -17,18 +19,11 @@ class _UserOrderState extends State<UserOrderPage> {
selectedGender = widget.userInfo.sex; selectedGender = widget.userInfo.sex;
// 在这里可以使用 localVariable 进行操作 // 在这里可以使用 localVariable 进行操作
}*/ }*/
List<Tab> tabs = [
const Tab(text: '全部',),
const Tab(text: '待付款',),
const Tab(text: '已取消',),
const Tab(text: '已完成',),
const Tab(text: '已退款',),
];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GetBuilder<UserOrderController>( return GetBuilder<UserOrderController>(
init: UserOrderController(tabs[0].toString()), init: UserOrderController(tab),
builder: (controller) => Scaffold( builder: (controller) => Scaffold(
appBar: CustomAppBar( appBar: CustomAppBar(
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
...@@ -43,7 +38,10 @@ class _UserOrderState extends State<UserOrderPage> { ...@@ -43,7 +38,10 @@ class _UserOrderState extends State<UserOrderPage> {
// context.pushNamed(Routes.msgs); // context.pushNamed(Routes.msgs);
}, },
onEditingComplete: () { onEditingComplete: () {
controller.search(); controller._getOrders(
isRefresh: true,
keys: controller.searchController.text,
tabIndex: controller._tabController.index);
// FocusScope.of(context).unfocus(); // FocusScope.of(context).unfocus();
FocusNode blankNode = FocusNode(); FocusNode blankNode = FocusNode();
FocusScope.of(context).requestFocus(blankNode); //指定为空白焦点 FocusScope.of(context).requestFocus(blankNode); //指定为空白焦点
...@@ -60,7 +58,7 @@ class _UserOrderState extends State<UserOrderPage> { ...@@ -60,7 +58,7 @@ class _UserOrderState extends State<UserOrderPage> {
child: Text( child: Text(
'取消', '取消',
style: style:
TextStyle(fontSize: 14.w, height: 1.5, color: Colours.c3), TextStyle(fontSize: 14.w, height: 1.5, color: Colours.c3),
), ),
), ),
) )
...@@ -71,48 +69,56 @@ class _UserOrderState extends State<UserOrderPage> { ...@@ -71,48 +69,56 @@ class _UserOrderState extends State<UserOrderPage> {
); );
} }
Widget _buildBody(UserOrderController controller){ Widget _buildBody(UserOrderController controller) {
return DefaultTabController( return DefaultTabController(
length: tabs.length, length: controller.tabs.length,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
ClipRRect( ClipRRect(
borderRadius:const BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5)), borderRadius: const BorderRadius.only(
child: Container( topLeft: Radius.circular(5), topRight: Radius.circular(5)),
width: double.infinity, child: Container(
color: Colors.white, width: double.infinity,
height: 35.w, color: Colors.white,
child: TabBar( height: 35.w,
indicator: UnderlineTabIndicator( child: TabBar(
borderRadius: BorderRadius.circular(0.75), indicator: UnderlineTabIndicator(
borderSide: BorderSide(width: 1.5.w,color: AppTheme.primary), borderRadius: BorderRadius.circular(0.75),
insets: EdgeInsets.symmetric(horizontal: 22.w), // 设置标签下面指示器的水平内边距 borderSide:
), BorderSide(width: 1.5.w, color: AppTheme.primary),
labelPadding: EdgeInsets.symmetric(horizontal: 20.w), insets: EdgeInsets.symmetric(
indicatorSize: TabBarIndicatorSize.label, horizontal:24.w), // 设置标签下面指示器的水平内边距
indicatorColor: AppTheme.primary, ),
indicatorWeight: 1.5, labelPadding: EdgeInsets.symmetric(horizontal: 15.w),
labelStyle: TextStyle(color: AppTheme.primary,fontSize: 15.w,height: 1.5,fontWeight: Fonts.medium), indicatorSize: TabBarIndicatorSize.label,
unselectedLabelColor: Colours.c9, indicatorColor: AppTheme.primary,
unselectedLabelStyle: TextStyle(color: Colours.c9,fontSize: 15.w,height: 1.5), indicatorWeight: 1.5,
isScrollable: true, labelStyle: TextStyle(
tabs: tabs color: AppTheme.primary,
), fontSize: 15.w,
), height: 1.5,
fontWeight: Fonts.medium),
unselectedLabelColor: Colours.c9,
unselectedLabelStyle: TextStyle(
color: Colours.c9, fontSize: 15.w, height: 1.5),
isScrollable: true,
controller: controller._tabController,
tabs: controller.tabs),
), ),
Expanded( ),
child: TabBarView( Expanded(
children: List.generate(tabs.length, (index){ child: TabBarView(
return BuildListPage(tag:'$index',models:controller.orderList,context: context,); controller: controller._tabController,
}) children: List.generate(controller.tabs.length, (index) {
), tab = index;
) return BuildListPage(
], tag:
) tab, models:controller.orderList,controller: controller,/*,context: context,*/
); );
})),
)
],
));
} }
} }
part of user_order; part of user_order;
class BuildListPage extends StatefulWidget { class BuildListPage extends StatefulWidget {
final String tag; final int tag;
final List<OrderListModel> models; final List<OrderListModel> models;
final BuildContext context; final UserOrderController controller;
// final BuildContext context;
const BuildListPage({ const BuildListPage({
Key? key, Key? key,
required this.tag, required this.tag,
required this.models, required this.models,
required this.context, required this.controller,
// required this.context,
}) : super(key: key); }) : super(key: key);
@override @override
...@@ -20,15 +22,17 @@ class _BuildListPageState extends State<BuildListPage> ...@@ -20,15 +22,17 @@ class _BuildListPageState extends State<BuildListPage>
with AutomaticKeepAliveClientMixin { with AutomaticKeepAliveClientMixin {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GetBuilder<UserOrderController>( /* return GetBuilder<UserOrderController>(
tag: widget.tag, tag: widget.tag.toString(),
init: UserOrderController(widget.tag), init: UserOrderController(widget.tag),
builder: (controller) => CustomPullScrollView( builder: (controller) => CustomPullScrollView(
controller: controller.refreshController, controller: controller.refreshController,
onRefresh: controller.onRefresh,
onLoading: controller.onLoading, onLoading: controller.onLoading,
child: ListView.builder( child: ListView.builder(
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
OrderListModel model = controller.orderList[index]; OrderListModel model = controller.orderList[index];
// OrderListModel model = widget.models[index];
if (model.types == 2) { if (model.types == 2) {
return BuiltCoin(model: model,); return BuiltCoin(model: model,);
} else { } else {
...@@ -44,8 +48,36 @@ class _BuildListPageState extends State<BuildListPage> ...@@ -44,8 +48,36 @@ class _BuildListPageState extends State<BuildListPage>
} }
}, },
itemCount: controller.orderList.length, itemCount: controller.orderList.length,
// itemCount: widget.models.length,
), ),
), ),
);*/
return CustomPullScrollView(
controller: widget.controller.refreshController,
onRefresh: widget.controller.onRefresh,
onLoading: widget.controller.onLoading,
child: ListView.builder(
itemBuilder: (BuildContext context, int index) {
OrderListModel model = widget.controller.orderList[index];
// OrderListModel model = widget.models[index];
if (model.types == 2) {
return BuiltCoin(model: model,);
} else {
if (model.status == 1) {
return BuiltAwaiting(model: model,);
} else if (model.status == 2) {
return BuiltCanceled(model: model,);
} else if (model.status == 3) {
return BuiltCompleted(model: model,);
} else if (model.status == 4) {
return BuiltRefunded(model: model,);
}
}
},
itemCount: widget.controller.orderList.length,
// itemCount: widget.models.length,
),
); );
} }
......
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论