| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267 |
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import '../order_management_page/order_detail_page.dart';
- import '../../showDialog.dart';
- import '../../util/api.dart';
- import '../../util/models.dart';
- import '../../util/util.dart';
- class OrderDetail extends StatefulWidget {
- final String orderId;
- OrderDetail({
- Key key,
- @required this.orderId
- }): super(key: key);
- _OrderDetailState createState() => _OrderDetailState();
- }
- class _OrderDetailState extends State < OrderDetail > {
- OrderDetailData data;
- @override
- void initState() {
- super.initState();
- getOrderDetail(widget.orderId).then((resp) {
- if (isNotError(context, resp)) {
- OrderDetailObj orderDetailObj = OrderDetailObj.fromJson(resp.data);
- setState(() {
- data = orderDetailObj.data;
- });
- }
- });
- }
- @override
- Widget build(BuildContext context) {
- return Container(
- child: Scaffold(
- appBar: AppBar(
- title: Text('订单详情'),
- centerTitle: true,
- backgroundColor: Color.fromRGBO(64, 98, 254, 1),
- ),
- body: Container(
- child: data==null?_getMoreWidget():_cardWiget()
- ),
- )
- );
- }
- Widget _cardWiget() {
- return GestureDetector(
- child: Card(
- color: Colors.white,
- child: Container(
- padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(20)),
- child: Column(
- children: < Widget > [
- Padding(
- padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(30)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: < Widget > [
- Text('订单号:${data.orderNo}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(102, 102, 102, 1)), ),
- Text("运输中", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(126, 211, 33, 1)), ),
- ],
- )
- ),
- Padding(
- padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
- child: Row(
- children: < Widget > [
- Text('${data.sendCompanyName} --> ${data.receiptCompanyName}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30)), ),
- ],
- )
- ),
- Padding(
- padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(15)),
- child: Row(
- children: < Widget > [
- SizedBox(
- width: ScreenUtil.getInstance().setWidth(355),
- child: Text('货物名称:${data.goods}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
- ),
- Text('代收款:${data.goodsAgencyFund/100}元', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
- ],
- ),
- ),
- Padding(
- padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(30)),
- child: Row(
- children: < Widget > [
- SizedBox(
- width: ScreenUtil.getInstance().setWidth(355),
- child: Text('货物件数:${data.goodsQuantity}件', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
- ),
- Text('运费:${data.goodsFreight/100}元', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
- ],
- ),
- ),
- Padding(
- padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
- child: Container(
- height: ScreenUtil.getInstance().setHeight(1),
- color: Color.fromRGBO(223, 223, 223, 1),
- ),
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: < Widget > [
- GestureDetector(
- child: Offstage(
- offstage: false,
- child: Container(
- width: ScreenUtil.getInstance().setWidth(94),
- height: ScreenUtil.getInstance().setHeight(48),
- decoration: BoxDecoration(
- color: Color.fromRGBO(239, 243, 249, 1),
- borderRadius: BorderRadius.all(Radius.circular(4.0))
- ),
- child: Center(
- child: Text('作废', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
- ),
- ),
- ),
- onTap: () {
- showDialog < Null > (
- context: context, //BuildContext对象
- barrierDismissible: false,
- builder: (BuildContext context) {
- return new LoadingDialog( //调用对话框
- text: '是否确认作废', childCallback: (val) {
- if (val) {
- myUpdataOrder(5);
- } else {
- return;
- }
- },
- );
- });
- print("作废");
- },
- ),
- GestureDetector(
- child: Offstage(
- offstage: false,
- child: Container(
- width: ScreenUtil.getInstance().setWidth(94),
- height: ScreenUtil.getInstance().setHeight(48),
- decoration: BoxDecoration(
- color: Color.fromRGBO(239, 243, 249, 1),
- borderRadius: BorderRadius.all(Radius.circular(4.0))
- ),
- child: Center(
- child: Text('改单', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
- ),
- ),
- ),
- onTap: () {
- showDialog < Null > (
- context: context, //BuildContext对象
- barrierDismissible: false,
- builder: (BuildContext context) {
- return new LoadingDialog( //调用对话框
- text: '是否确认改单', childCallback: (val) {
- if (val) {
- print(val);
- Navigator.push(context, MaterialPageRoute(builder: (context) {
- return OrderDetailPage(orderNo: '${data.orderNo}', );
- })).then((resp){
- if(resp==true){
- getOrderDetail(widget.orderId).then((resp) {
- if (isNotError(context, resp)) {
- OrderDetailObj orderDetailObj = OrderDetailObj.fromJson(resp.data);
- setState(() {
- data = orderDetailObj.data;
- });
- }
- });
- }
- });
- } else {
- return;
- }
- },
- );
- });
- print("改单");
- },
- ),
- GestureDetector(
- child: Offstage(
- offstage: false,
- child: Container(
- width: ScreenUtil.getInstance().setWidth(94),
- height: ScreenUtil.getInstance().setHeight(48),
- decoration: BoxDecoration(
- color: Color.fromRGBO(239, 243, 249, 1),
- borderRadius: BorderRadius.all(Radius.circular(4.0))
- ),
- child: Center(
- child: Text('打印', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
- ),
- ),
- ),
- onTap: () {
- showDialog < Null > (
- context: context, //BuildContext对象
- barrierDismissible: false,
- builder: (BuildContext context) {
- return new LoadingDialog( //调用对话框
- text: '是否确认打印', childCallback: (val) {
- if (val) {
- //widget.callback(widget.index);
- } else {
- return;
- }
- },
- );
- });
- print("打印");
- },
- ),
- ],
- )
- ],
- ),
- )
- ),
- onTap: () {
- },
- );
- }
- Widget _getMoreWidget() {
- return Center(
- child: Padding(
- padding: EdgeInsets.all(10.0),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: < Widget > [
- Text(
- '加载中...',
- style: TextStyle(fontSize: 16.0),
- ),
- Container(
- width: ScreenUtil.getInstance().setWidth(50),
- height: ScreenUtil.getInstance().setHeight(50),
- child: CircularProgressIndicator()
- )
- ],
- ),
- ),
- );
- }
- myUpdataOrder(int myOrderStatus) {
- updataOrderStatus(data.orderNo, myOrderStatus).then((resp) {
- if (isNotError(context, resp)) {
-
- }
- });
- }
- }
|