|
@@ -1,12 +1,15 @@
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
-
|
|
|
|
|
|
|
+import '../../util/api.dart';
|
|
|
|
|
+import '../../util/models.dart';
|
|
|
|
|
+import '../../util/util.dart';
|
|
|
|
|
+import '../../showAlert.dart';
|
|
|
class OrderDetailPage extends StatefulWidget {
|
|
class OrderDetailPage extends StatefulWidget {
|
|
|
- final int orderId;
|
|
|
|
|
|
|
+ final String orderNo;
|
|
|
|
|
|
|
|
OrderDetailPage({
|
|
OrderDetailPage({
|
|
|
Key key,
|
|
Key key,
|
|
|
- @required this.orderId
|
|
|
|
|
|
|
+ @required this.orderNo
|
|
|
}): super(key: key);
|
|
}): super(key: key);
|
|
|
|
|
|
|
|
_OrderDetailPageState createState() => _OrderDetailPageState();
|
|
_OrderDetailPageState createState() => _OrderDetailPageState();
|
|
@@ -14,31 +17,19 @@ class OrderDetailPage extends StatefulWidget {
|
|
|
|
|
|
|
|
class _OrderDetailPageState extends State < OrderDetailPage > {
|
|
class _OrderDetailPageState extends State < OrderDetailPage > {
|
|
|
|
|
|
|
|
- final Map < Object,
|
|
|
|
|
- String > sendInfo = {
|
|
|
|
|
- "icon": 'lib/images/icon_send.png',
|
|
|
|
|
- "title": "发件信息",
|
|
|
|
|
- "phone": "010-8788 6890",
|
|
|
|
|
- "code": "345678",
|
|
|
|
|
- "name": "朝阳门大阳汽贸",
|
|
|
|
|
- "address": "北京市朝阳区",
|
|
|
|
|
- "addressDetail": "朝阳门外大街28号"
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- final Map < Object,
|
|
|
|
|
- String > getInfo = {
|
|
|
|
|
- "icon": 'lib/images/icon_shoujian.png',
|
|
|
|
|
- "title": "收件信息",
|
|
|
|
|
- "name": "香河汽修厂",
|
|
|
|
|
- "phone": "010-6734 3426",
|
|
|
|
|
- "address": "河北省廊坊市",
|
|
|
|
|
- "addressDetail": "香河县东大街29号院18栋3单元206"
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ OrderDetailData orderDetailObj;
|
|
|
|
|
|
|
|
@override
|
|
@override
|
|
|
void initState() {
|
|
void initState() {
|
|
|
super.initState();
|
|
super.initState();
|
|
|
- //print(sendInfo.title);
|
|
|
|
|
|
|
+ getOrderDetail(widget.orderNo).then((resp){
|
|
|
|
|
+ if(isNotError(context, resp)){
|
|
|
|
|
+ OrderDetailObj tempObj = OrderDetailObj.fromJson(resp.data);
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ orderDetailObj =tempObj.data;
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
@override
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
@@ -51,49 +42,51 @@ class _OrderDetailPageState extends State < OrderDetailPage > {
|
|
|
body: Container(
|
|
body: Container(
|
|
|
padding: EdgeInsets.fromLTRB(0, ScreenUtil.getInstance().setHeight(20), 0, ScreenUtil.getInstance().setHeight(20)),
|
|
padding: EdgeInsets.fromLTRB(0, ScreenUtil.getInstance().setHeight(20), 0, ScreenUtil.getInstance().setHeight(20)),
|
|
|
color: Color.fromRGBO(246, 246, 254, 1),
|
|
color: Color.fromRGBO(246, 246, 254, 1),
|
|
|
- child: ListView(
|
|
|
|
|
|
|
+ child:orderDetailObj==null?Center(
|
|
|
|
|
+ child:_getMoreWidget(),
|
|
|
|
|
+ ): ListView(
|
|
|
children: < Widget > [
|
|
children: < Widget > [
|
|
|
- _sendInfo(sendInfo),
|
|
|
|
|
- _getInfo(getInfo),
|
|
|
|
|
- ItemInfoWidget(),
|
|
|
|
|
- submitBtn()
|
|
|
|
|
|
|
+ _sendInfo(),
|
|
|
|
|
+ _getInfo(),
|
|
|
|
|
+ ItemInfoWidget(obj:orderDetailObj),
|
|
|
],
|
|
],
|
|
|
)
|
|
)
|
|
|
),
|
|
),
|
|
|
|
|
+
|
|
|
//resizeToAvoidBottomPadding: false //键盘弹出,页面不跟随向上滑动,防止出现溢出错误
|
|
//resizeToAvoidBottomPadding: false //键盘弹出,页面不跟随向上滑动,防止出现溢出错误
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Widget _sendInfo(Map str) {
|
|
|
|
|
|
|
+ Widget _sendInfo() {
|
|
|
return Container(
|
|
return Container(
|
|
|
color: Colors.white,
|
|
color: Colors.white,
|
|
|
margin: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
|
|
margin: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
|
|
|
child: Column(
|
|
child: Column(
|
|
|
children: < Widget > [
|
|
children: < Widget > [
|
|
|
- titleWidget(str['icon'], str['title']),
|
|
|
|
|
|
|
+ titleWidget('lib/images/icon_send.png', '发件信息'),
|
|
|
underLine(),
|
|
underLine(),
|
|
|
- contentWiget('电话', str['phone']),
|
|
|
|
|
- contentWiget('企业编码', str['code']),
|
|
|
|
|
- contentWiget('企业名称', str['name']),
|
|
|
|
|
- contentWiget('城市/区域', str['address']),
|
|
|
|
|
- lastContentWiget('详细地址', str['addressDetail'])
|
|
|
|
|
|
|
+ contentWiget('电话', orderDetailObj.senderPhone),
|
|
|
|
|
+ contentWiget('企业编码', orderDetailObj.sendCompanyCode),
|
|
|
|
|
+ contentWiget('企业名称', orderDetailObj.sendCompanyName),
|
|
|
|
|
+ contentWiget('城市/区域', '${orderDetailObj.sendCompanyProvinceName}' '${orderDetailObj.sendCompanyCityName}' '${orderDetailObj.sendCompanyAreaName}'),
|
|
|
|
|
+ lastContentWiget('详细地址', orderDetailObj.sendCompanyAddress)
|
|
|
],
|
|
],
|
|
|
)
|
|
)
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Widget _getInfo(Map str) {
|
|
|
|
|
|
|
+ Widget _getInfo() {
|
|
|
return Container(
|
|
return Container(
|
|
|
color: Colors.white,
|
|
color: Colors.white,
|
|
|
margin: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
|
|
margin: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
|
|
|
child: Column(
|
|
child: Column(
|
|
|
children: < Widget > [
|
|
children: < Widget > [
|
|
|
- titleWidget(str['icon'], str['title']),
|
|
|
|
|
|
|
+ titleWidget('lib/images/icon_shoujian.png', '收件信息'),
|
|
|
underLine(),
|
|
underLine(),
|
|
|
- contentWiget('企业名称', str['name']),
|
|
|
|
|
- contentWiget('电话', str['phone']),
|
|
|
|
|
- contentWiget('城市/区域', str['address']),
|
|
|
|
|
- lastContentWiget('详细地址', str['addressDetail'])
|
|
|
|
|
|
|
+ contentWiget('企业名称', orderDetailObj.receiptCompanyName),
|
|
|
|
|
+ contentWiget('电话', orderDetailObj.receiptCompanyPhone),
|
|
|
|
|
+ contentWiget('城市/区域', '${orderDetailObj.receiptCompanyProvinceName}' '${orderDetailObj.receiptCompanyCityName}' '${orderDetailObj.receiptCompanyAreaName}'),
|
|
|
|
|
+ lastContentWiget('详细地址', orderDetailObj.sendCompanyAddress)
|
|
|
],
|
|
],
|
|
|
)
|
|
)
|
|
|
);
|
|
);
|
|
@@ -102,9 +95,10 @@ class _OrderDetailPageState extends State < OrderDetailPage > {
|
|
|
|
|
|
|
|
|
|
|
|
|
class ItemInfoWidget extends StatefulWidget {
|
|
class ItemInfoWidget extends StatefulWidget {
|
|
|
-
|
|
|
|
|
|
|
+ final OrderDetailData obj;
|
|
|
ItemInfoWidget({
|
|
ItemInfoWidget({
|
|
|
- Key key
|
|
|
|
|
|
|
+ Key key,
|
|
|
|
|
+ @required this.obj
|
|
|
}): super(key: key);
|
|
}): super(key: key);
|
|
|
|
|
|
|
|
_ItemInfoWidgetState createState() => _ItemInfoWidgetState();
|
|
_ItemInfoWidgetState createState() => _ItemInfoWidgetState();
|
|
@@ -112,18 +106,20 @@ class ItemInfoWidget extends StatefulWidget {
|
|
|
|
|
|
|
|
class _ItemInfoWidgetState extends State < ItemInfoWidget > {
|
|
class _ItemInfoWidgetState extends State < ItemInfoWidget > {
|
|
|
|
|
|
|
|
- Map < String,
|
|
|
|
|
- String > _itemInfo = {
|
|
|
|
|
- "icon": "lib/images/icon_huowu.png",
|
|
|
|
|
- "title": "货物信息",
|
|
|
|
|
- "itemName": "汽车轮胎",
|
|
|
|
|
- "itemNo": "4",
|
|
|
|
|
- "expressPrice": "15",
|
|
|
|
|
- "collectionPrice": "15800",
|
|
|
|
|
- "supportPrice": "5000",
|
|
|
|
|
- "weight": "600",
|
|
|
|
|
- "itemDesc": "轮胎请核对数量轮胎请"
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ double afterTransportFee=0.0;//运费
|
|
|
|
|
+ int afterGoodsNumber=0;//数量
|
|
|
|
|
+ double afterCollectingFee=0.0;//代收
|
|
|
|
|
+ bool submitStatus = true;
|
|
|
|
|
+ @override
|
|
|
|
|
+ void initState() {
|
|
|
|
|
+ super.initState();
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ afterTransportFee = widget.obj.goodsFreight/100;
|
|
|
|
|
+ afterGoodsNumber =widget.obj.goodsQuantity;
|
|
|
|
|
+ afterCollectingFee =widget.obj.goodsAgencyFund/100;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
@override
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
@@ -133,22 +129,23 @@ class _ItemInfoWidgetState extends State < ItemInfoWidget > {
|
|
|
child: Column(
|
|
child: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: < Widget > [
|
|
children: < Widget > [
|
|
|
- titleWidget(_itemInfo['icon'], "货物信息"),
|
|
|
|
|
|
|
+ titleWidget('lib/images/icon_huowu.png', "货物信息"),
|
|
|
underLine(),
|
|
underLine(),
|
|
|
- contentWiget("货物名称", _itemInfo["itemName"]),
|
|
|
|
|
- _inputWidget("数量", _itemInfo["itemNo"]),
|
|
|
|
|
- _inputWidget("运费", _itemInfo["expressPrice"]),
|
|
|
|
|
- _inputWidget("代收", _itemInfo["collectionPrice"]),
|
|
|
|
|
- contentWiget("保价", _itemInfo["supportPrice"]),
|
|
|
|
|
- contentWiget("重量", _itemInfo["weight"]),
|
|
|
|
|
- _descWidget(_itemInfo['itemDesc'])
|
|
|
|
|
|
|
+ contentWiget("货物名称",widget.obj.goods),
|
|
|
|
|
+ _inputWidget("数量", widget.obj.goodsQuantity),
|
|
|
|
|
+ _inputWidget("运费", widget.obj.goodsFreight/100),
|
|
|
|
|
+ _inputWidget("代收", widget.obj.goodsAgencyFund/100),
|
|
|
|
|
+ contentWiget("保价", widget.obj.goodsPriceProtection.toString()),
|
|
|
|
|
+ contentWiget("重量", widget.obj.goodsWeight.toStringAsFixed(1)),
|
|
|
|
|
+ _descWidget(widget.obj.memo),
|
|
|
|
|
+ submitBtn(widget.obj.orderNo)
|
|
|
],
|
|
],
|
|
|
),
|
|
),
|
|
|
)
|
|
)
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Widget _inputWidget(String key, String value) {
|
|
|
|
|
|
|
+ Widget _inputWidget(String key, num value) {
|
|
|
return Padding(
|
|
return Padding(
|
|
|
padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
|
|
padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
|
|
|
child: Column(
|
|
child: Column(
|
|
@@ -178,10 +175,19 @@ class _ItemInfoWidgetState extends State < ItemInfoWidget > {
|
|
|
),
|
|
),
|
|
|
decoration: InputDecoration(
|
|
decoration: InputDecoration(
|
|
|
border: InputBorder.none,
|
|
border: InputBorder.none,
|
|
|
- hintText: value,
|
|
|
|
|
|
|
+ hintText: value.toString(),
|
|
|
hintStyle: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(136, 136, 136, 1)),
|
|
hintStyle: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(136, 136, 136, 1)),
|
|
|
contentPadding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(20), 0, 0, 0),
|
|
contentPadding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(20), 0, 0, 0),
|
|
|
),
|
|
),
|
|
|
|
|
+ onChanged: (value){
|
|
|
|
|
+ if(key=='数量'){
|
|
|
|
|
+ afterGoodsNumber =int.parse(value);
|
|
|
|
|
+ }else if(key=='运费'){
|
|
|
|
|
+ afterTransportFee =double.parse(value);
|
|
|
|
|
+ }else if(key=='代收'){
|
|
|
|
|
+ afterCollectingFee =double.parse(value);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
),
|
|
),
|
|
|
)
|
|
)
|
|
|
),
|
|
),
|
|
@@ -209,6 +215,62 @@ class _ItemInfoWidgetState extends State < ItemInfoWidget > {
|
|
|
child: Text(str, maxLines: 100, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
|
|
child: Text(str, maxLines: 100, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ Widget submitBtn(String orderNo) {
|
|
|
|
|
+ return GestureDetector(
|
|
|
|
|
+ child: Container(
|
|
|
|
|
+ margin: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(50), ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(40)),
|
|
|
|
|
+ height: ScreenUtil.getInstance().setHeight(88),
|
|
|
|
|
+ decoration: BoxDecoration(
|
|
|
|
|
+ borderRadius: BorderRadius.all(Radius.circular(4)),
|
|
|
|
|
+ color: Color.fromRGBO(37, 102, 242, 1),
|
|
|
|
|
+ ),
|
|
|
|
|
+ child: Center(
|
|
|
|
|
+ child:Row(
|
|
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
+ children: <Widget>[
|
|
|
|
|
+ Offstage(
|
|
|
|
|
+ offstage: submitStatus,
|
|
|
|
|
+ child: SizedBox(
|
|
|
|
|
+ width: ScreenUtil.getInstance().setWidth(45),
|
|
|
|
|
+ height: ScreenUtil.getInstance().setHeight(45),
|
|
|
|
|
+ child: Image.asset('lib/images/loading.gif'),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ Text('提交', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(36), color: Colors.white)),
|
|
|
|
|
+ ],
|
|
|
|
|
+ )
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ onTap: () {
|
|
|
|
|
+ if(!submitStatus) return;
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ submitStatus = false;
|
|
|
|
|
+ });
|
|
|
|
|
+ updataOrder(orderNo,afterTransportFee,afterCollectingFee,afterGoodsNumber).then((resp){
|
|
|
|
|
+ if(isNotError(context, resp)){
|
|
|
|
|
+ showDialog < Null > (
|
|
|
|
|
+ context: context, //BuildContext对象
|
|
|
|
|
+ barrierDismissible: false,
|
|
|
|
|
+ builder: (BuildContext context) {
|
|
|
|
|
+ return MyAlertDialog( //调用对话框
|
|
|
|
|
+ text: '订单修改成功!', childCallback: (val) {
|
|
|
|
|
+ if(val){
|
|
|
|
|
+ Navigator.pop(context);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ );
|
|
|
|
|
+ });
|
|
|
|
|
+ }else{
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ submitStatus = true;
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ );
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Widget titleWidget(String iconUrl, String str) {
|
|
Widget titleWidget(String iconUrl, String str) {
|
|
@@ -292,22 +354,26 @@ Widget lastContentWiget(String key, String value) {
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+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()
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
-Widget submitBtn() {
|
|
|
|
|
- return GestureDetector(
|
|
|
|
|
- child: Container(
|
|
|
|
|
- margin: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(50), ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(40)),
|
|
|
|
|
- height: ScreenUtil.getInstance().setHeight(88),
|
|
|
|
|
- decoration: BoxDecoration(
|
|
|
|
|
- borderRadius: BorderRadius.all(Radius.circular(4)),
|
|
|
|
|
- color: Color.fromRGBO(37, 102, 242, 1),
|
|
|
|
|
- ),
|
|
|
|
|
- child: Center(
|
|
|
|
|
- child: Text("提交", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(32), color: Colors.white), ),
|
|
|
|
|
|
|
+ ],
|
|
|
|
|
+ ),
|
|
|
),
|
|
),
|
|
|
- ),
|
|
|
|
|
- onTap: () {
|
|
|
|
|
- print('提交');
|
|
|
|
|
- },
|
|
|
|
|
- );
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|