|
|
@@ -0,0 +1,454 @@ |
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
import 'package:flutter/gestures.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter/services.dart'; |
|
|
|
import 'package:zhiying_base_widget/pages/order_found_page/order_found_result/order_found_result_bloc.dart'; |
|
|
|
import 'package:zhiying_base_widget/pages/order_found_page/order_found_result/order_found_result_model.dart'; |
|
|
|
|
|
|
|
import 'package:zhiying_comm/zhiying_comm.dart'; |
|
|
|
|
|
|
|
class OrderFoundResultPage extends StatefulWidget { |
|
|
|
//有数据的model |
|
|
|
final OrderFoundResultModel orderFoundResultModel; |
|
|
|
|
|
|
|
//没有订单数据的空页面的title |
|
|
|
final String emptyOrderTitle; |
|
|
|
|
|
|
|
//没有订单数据的空页面的内容 |
|
|
|
final String emptyOrderContent; |
|
|
|
|
|
|
|
//没有订单数据的空页面的图片 |
|
|
|
final String emptyOrderPic; |
|
|
|
|
|
|
|
const OrderFoundResultPage( |
|
|
|
{Key key, |
|
|
|
this.orderFoundResultModel, |
|
|
|
this.emptyOrderTitle, |
|
|
|
this.emptyOrderContent, |
|
|
|
this.emptyOrderPic}) |
|
|
|
: super(key: key); |
|
|
|
|
|
|
|
@override |
|
|
|
_OrderFoundResultPageState createState() => _OrderFoundResultPageState(); |
|
|
|
} |
|
|
|
|
|
|
|
class _OrderFoundResultPageState extends State<OrderFoundResultPage> { |
|
|
|
// OrderFoundResultBloc _bloc; |
|
|
|
bool hasData = true; |
|
|
|
|
|
|
|
OrderFoundResultModel model; |
|
|
|
|
|
|
|
String emptyOrderTitle; |
|
|
|
String emptyOrderContent; |
|
|
|
String emptyOrderPic; |
|
|
|
|
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
// TODO: implement initState |
|
|
|
super.initState(); |
|
|
|
model = widget.orderFoundResultModel; |
|
|
|
if (!EmptyUtil.isEmpty(model)) { |
|
|
|
hasData = true; |
|
|
|
} else { |
|
|
|
hasData = false; |
|
|
|
} |
|
|
|
emptyOrderTitle = widget.emptyOrderTitle; |
|
|
|
emptyOrderContent = widget.emptyOrderContent; |
|
|
|
emptyOrderPic = widget.emptyOrderPic; |
|
|
|
// _bloc = OrderFoundResultBloc(); |
|
|
|
// _bloc.getData(); |
|
|
|
} |
|
|
|
|
|
|
|
retrieveOrderClick() { |
|
|
|
print("是我的,找回该订单点击"); |
|
|
|
Map<String, dynamic> params = {}; |
|
|
|
params['oid'] = model?.ordId; |
|
|
|
NetUtil.request('/api/v1/order/find', |
|
|
|
method: NetMethod.POST, params: params, onSuccess: (data) {}); |
|
|
|
} |
|
|
|
|
|
|
|
continueToQuery() { |
|
|
|
print("继续查询点击"); |
|
|
|
Navigator.pop(context); |
|
|
|
} |
|
|
|
|
|
|
|
//复制订单号 |
|
|
|
copyOrderCode() { |
|
|
|
ClipboardData data = new ClipboardData(text: model?.ordId); |
|
|
|
Clipboard.setData(data); |
|
|
|
} |
|
|
|
|
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return Scaffold( |
|
|
|
appBar: AppBar( |
|
|
|
elevation: 0, |
|
|
|
brightness: Brightness.light, |
|
|
|
backgroundColor: Colors.white, |
|
|
|
title: Text( |
|
|
|
"订单查询", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 16, |
|
|
|
color: HexColor.fromHex("#FF333333"), |
|
|
|
fontWeight: FontWeight.w600), |
|
|
|
), |
|
|
|
centerTitle: true, |
|
|
|
leading: Navigator.canPop(context) |
|
|
|
? IconButton( |
|
|
|
icon: Icon( |
|
|
|
Icons.arrow_back_ios, |
|
|
|
size: 18, |
|
|
|
color: HexColor.fromHex("#FF444444"), |
|
|
|
), |
|
|
|
onPressed: () { |
|
|
|
Navigator.pop(context); |
|
|
|
}) |
|
|
|
: Container(), |
|
|
|
), |
|
|
|
body: Container( |
|
|
|
child: hasData ? hasOrderView() : emptyView(), |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
//有订单数据的页面 |
|
|
|
hasOrderView() { |
|
|
|
return Column( |
|
|
|
children: [ |
|
|
|
Expanded( |
|
|
|
child: Column( |
|
|
|
children: [ |
|
|
|
orderTip(), //提示文字 |
|
|
|
orderMsg(), //订单数据 |
|
|
|
], |
|
|
|
)), |
|
|
|
//继续查询按钮 |
|
|
|
GestureDetector( |
|
|
|
onTap: () { |
|
|
|
continueToQuery(); |
|
|
|
}, |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
child: Container( |
|
|
|
padding: EdgeInsets.all(12), |
|
|
|
child: Text( |
|
|
|
"不是我的,继续查询", |
|
|
|
style: TextStyle(fontSize: 14, color: HexColor.fromHex("#FF999999")), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
//找回订单按钮 |
|
|
|
GestureDetector( |
|
|
|
onTap: () { |
|
|
|
retrieveOrderClick(); |
|
|
|
}, |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
child: Container( |
|
|
|
height: 50, |
|
|
|
width: double.infinity, |
|
|
|
margin: EdgeInsets.only(left: 24, right: 24, bottom: 24), |
|
|
|
decoration: |
|
|
|
BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.red), |
|
|
|
alignment: Alignment.center, |
|
|
|
child: Text( |
|
|
|
"是我的,找回该订单", |
|
|
|
style: TextStyle(fontSize: 14, color: Colors.white), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
//提示文字 |
|
|
|
orderTip() { |
|
|
|
return Container( |
|
|
|
margin: EdgeInsets.only(top: 15, left: 12), |
|
|
|
child: Row( |
|
|
|
children: [ |
|
|
|
Container( |
|
|
|
margin: EdgeInsets.only(right: 5), |
|
|
|
width: 4, |
|
|
|
height: 15, |
|
|
|
decoration: |
|
|
|
BoxDecoration(borderRadius: BorderRadius.circular(2), color: Colors.red), |
|
|
|
), |
|
|
|
Text( |
|
|
|
"是否为这笔订单?", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 15, |
|
|
|
color: HexColor.fromHex("#FF333333"), |
|
|
|
fontWeight: FontWeight.bold), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
//订单数据 |
|
|
|
orderMsg() { |
|
|
|
return Container( |
|
|
|
height: 150, |
|
|
|
margin: EdgeInsets.only(top: 10, left: 12, right: 12), |
|
|
|
padding: EdgeInsets.only(top: 10, left: 10, right: 10), |
|
|
|
decoration: |
|
|
|
BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), |
|
|
|
child: Column( |
|
|
|
children: [ |
|
|
|
Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
"自购订单", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 12, |
|
|
|
color: HexColor.fromHex("#FF333333"), |
|
|
|
fontWeight: FontWeight.w600), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
Container( |
|
|
|
child: Row( |
|
|
|
children: [ |
|
|
|
Container( |
|
|
|
margin: EdgeInsets.only(top: 10, bottom: 10), |
|
|
|
width: 97, |
|
|
|
height: 97, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.circular(7.5), |
|
|
|
image: DecorationImage( |
|
|
|
image: NetworkImage(model?.thumbnail ?? ""), fit: BoxFit.fill)), |
|
|
|
), |
|
|
|
Expanded( |
|
|
|
child: Container( |
|
|
|
margin: EdgeInsets.only(left: 10), |
|
|
|
height: 100, |
|
|
|
child: Column( |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
Row( |
|
|
|
children: [ |
|
|
|
Container( |
|
|
|
margin: EdgeInsets.only(right: 4), |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.circular(2.5), |
|
|
|
color: Colors.red), |
|
|
|
padding: EdgeInsets.only(left: 10, right: 10), |
|
|
|
child: Text( |
|
|
|
model?.provider, |
|
|
|
style: TextStyle(fontSize: 10, color: Colors.white), |
|
|
|
), |
|
|
|
), |
|
|
|
Expanded( |
|
|
|
child: Text( |
|
|
|
model?.itemTitle, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 13, |
|
|
|
color: HexColor.fromHex("#FF333333"), |
|
|
|
), |
|
|
|
maxLines: 1, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
Row( |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
"订单编号:${model?.ordId}", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 10, |
|
|
|
color: HexColor.fromHex("#FF999999"), |
|
|
|
), |
|
|
|
), |
|
|
|
GestureDetector( |
|
|
|
onTap: () { |
|
|
|
copyOrderCode(); |
|
|
|
}, |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
child: Container( |
|
|
|
width: 40, |
|
|
|
margin: EdgeInsets.only(left: 4), |
|
|
|
decoration: BoxDecoration( |
|
|
|
border: new Border.all( |
|
|
|
color: HexColor.fromHex("#FFD6D6D6"), width: 0.5), |
|
|
|
borderRadius: BorderRadius.circular(2.5), |
|
|
|
color: HexColor.fromHex("#FFF5F5F5")), |
|
|
|
alignment: Alignment.center, |
|
|
|
child: Text( |
|
|
|
"复制", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 9, color: HexColor.fromHex("#FF999999")), |
|
|
|
), |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
Text( |
|
|
|
"下单时间:${model?.createAt}", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 10, |
|
|
|
color: HexColor.fromHex("#FF999999"), |
|
|
|
), |
|
|
|
), |
|
|
|
Text( |
|
|
|
"完成时间:${model?.updateAt}", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 10, |
|
|
|
color: HexColor.fromHex("#FF999999"), |
|
|
|
), |
|
|
|
), |
|
|
|
Row( |
|
|
|
children: [ |
|
|
|
Expanded( |
|
|
|
child: Text( |
|
|
|
"订单金额:¥ ${model?.paidPrice}", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 10, |
|
|
|
color: HexColor.fromHex("#FF333333"), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
// RichText( |
|
|
|
// text: TextSpan(children: [ |
|
|
|
// TextSpan( |
|
|
|
// text: "收益:¥ ", |
|
|
|
// style: TextStyle( |
|
|
|
// fontSize: 11, |
|
|
|
// color: Colors.red, |
|
|
|
// fontWeight: FontWeight.w600)), |
|
|
|
// TextSpan( |
|
|
|
// text: "10.19", |
|
|
|
// style: TextStyle( |
|
|
|
// fontSize: 18, |
|
|
|
// color: Colors.red, |
|
|
|
// fontWeight: FontWeight.w600)) |
|
|
|
// ]), |
|
|
|
// ) |
|
|
|
], |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
// Container( |
|
|
|
// padding: EdgeInsets.only(left: 6), |
|
|
|
// height: 25, |
|
|
|
// alignment: Alignment.centerLeft, |
|
|
|
// decoration: BoxDecoration( |
|
|
|
// borderRadius: BorderRadius.circular(2.5), |
|
|
|
// color: HexColor.fromHex("#FFF9F9F9")), |
|
|
|
// child: RichText( |
|
|
|
// text: TextSpan(children: [ |
|
|
|
// TextSpan( |
|
|
|
// text: "补贴于", |
|
|
|
// style: TextStyle( |
|
|
|
// fontSize: 10, color: HexColor.fromHex("#FF666666"))), |
|
|
|
// TextSpan( |
|
|
|
// text: "2020年07月23日", |
|
|
|
// style: TextStyle( |
|
|
|
// fontSize: 10, color: HexColor.fromHex("#FFFF4242"))), |
|
|
|
// TextSpan( |
|
|
|
// text: "到账,注意查收", |
|
|
|
// style: TextStyle( |
|
|
|
// fontSize: 10, color: HexColor.fromHex("#FF666666"))) |
|
|
|
// ]), |
|
|
|
// ), |
|
|
|
// ) |
|
|
|
], |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
//没有订单数据的空页面 |
|
|
|
emptyView() { |
|
|
|
return Column( |
|
|
|
children: [ |
|
|
|
Expanded( |
|
|
|
child: Column( |
|
|
|
children: [ |
|
|
|
Container( |
|
|
|
width: double.infinity, |
|
|
|
margin: EdgeInsets.only(top: 8, left: 12, right: 12), |
|
|
|
padding: EdgeInsets.only(bottom: 16, left: 12, right: 12, top: 28), |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.circular(12), color: Colors.white), |
|
|
|
child: Column( |
|
|
|
children: [ |
|
|
|
CachedNetworkImage( |
|
|
|
imageUrl: emptyOrderPic ?? "", |
|
|
|
width: 152, |
|
|
|
fit: BoxFit.fitWidth, |
|
|
|
), |
|
|
|
Container( |
|
|
|
margin: EdgeInsets.only(top: 16), |
|
|
|
child: Text( |
|
|
|
"未查询到该订单", |
|
|
|
style: |
|
|
|
TextStyle(fontSize: 15, color: HexColor.fromHex("#FF999999")), |
|
|
|
), |
|
|
|
), |
|
|
|
Container( |
|
|
|
margin: EdgeInsets.only(top: 24), |
|
|
|
color: HexColor.fromHex("#FFF9F9F9"), |
|
|
|
), |
|
|
|
Container( |
|
|
|
margin: EdgeInsets.only(top: 16), |
|
|
|
child: Row( |
|
|
|
children: [ |
|
|
|
Container( |
|
|
|
margin: EdgeInsets.only(right: 5), |
|
|
|
width: 4, |
|
|
|
height: 15, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.circular(2), color: Colors.red), |
|
|
|
), |
|
|
|
Text( |
|
|
|
emptyOrderTitle ?? "", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 15, |
|
|
|
color: HexColor.fromHex("#FF333333"), |
|
|
|
fontWeight: FontWeight.bold), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
Container( |
|
|
|
alignment: Alignment.topLeft, |
|
|
|
margin: EdgeInsets.only(top: 8), |
|
|
|
child: Text( |
|
|
|
emptyOrderContent ?? "", |
|
|
|
style: |
|
|
|
TextStyle(fontSize: 12, color: HexColor.fromHex("#FF999999")), |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
)), |
|
|
|
GestureDetector( |
|
|
|
onTap: () { |
|
|
|
continueToQuery(); |
|
|
|
}, |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
child: Container( |
|
|
|
height: 50, |
|
|
|
width: double.infinity, |
|
|
|
margin: EdgeInsets.only(left: 24, right: 24, bottom: 24), |
|
|
|
decoration: |
|
|
|
BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.red), |
|
|
|
alignment: Alignment.center, |
|
|
|
child: Text( |
|
|
|
"重新查询", |
|
|
|
style: TextStyle(fontSize: 14, color: Colors.white), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
); |
|
|
|
} |
|
|
|
} |