|
@@ -10,6 +10,7 @@ import '../util/api.dart';
|
|
|
import '../util/models.dart';
|
|
import '../util/models.dart';
|
|
|
import '../showAlert.dart';
|
|
import '../showAlert.dart';
|
|
|
import '../send_Dialog.dart';
|
|
import '../send_Dialog.dart';
|
|
|
|
|
+import '../util/session.dart';
|
|
|
class SendExpressPage extends StatefulWidget {
|
|
class SendExpressPage extends StatefulWidget {
|
|
|
final Widget child;
|
|
final Widget child;
|
|
|
|
|
|
|
@@ -51,8 +52,8 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
TextEditingController sendCompanyAddressController = TextEditingController();
|
|
TextEditingController sendCompanyAddressController = TextEditingController();
|
|
|
TextEditingController receiptCompanyAddressController = TextEditingController();
|
|
TextEditingController receiptCompanyAddressController = TextEditingController();
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
List < dynamic > goodsCateGoryList = [];
|
|
List < dynamic > goodsCateGoryList = [];
|
|
|
List < dynamic > goodsPackageList = [];
|
|
List < dynamic > goodsPackageList = [];
|
|
@@ -132,11 +133,11 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
//if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) {}
|
|
//if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) {}
|
|
|
});
|
|
});
|
|
|
sendCompanyPhoneController.addListener(() {
|
|
sendCompanyPhoneController.addListener(() {
|
|
|
-
|
|
|
|
|
- setState(() {
|
|
|
|
|
- sendCompanyPhone = sendCompanyPhoneController.text;
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ sendCompanyPhone = sendCompanyPhoneController.text;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
if (timer != null) {
|
|
if (timer != null) {
|
|
|
timer.cancel();
|
|
timer.cancel();
|
|
|
}
|
|
}
|
|
@@ -173,11 +174,11 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
receiptCompanyPhoneController.addListener(() {
|
|
receiptCompanyPhoneController.addListener(() {
|
|
|
-
|
|
|
|
|
- setState(() {
|
|
|
|
|
- receiptCompanyPhone = receiptCompanyPhoneController.text;
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ receiptCompanyPhone = receiptCompanyPhoneController.text;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
|
|
|
if (timer != null) {
|
|
if (timer != null) {
|
|
|
timer.cancel();
|
|
timer.cancel();
|
|
@@ -429,7 +430,7 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
)
|
|
)
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
Widget _contentWiget(String key, String type, [bool keyboardType = false]) { //false是数字键盘
|
|
Widget _contentWiget(String key, String type, [bool keyboardType = false]) { //false是数字键盘
|
|
|
return Padding(
|
|
return Padding(
|
|
|
padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
|
|
padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
|
|
@@ -486,19 +487,19 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
goodsQuantity = int.parse(value);
|
|
goodsQuantity = int.parse(value);
|
|
|
} else if (key == '运费') {
|
|
} else if (key == '运费') {
|
|
|
goodsFreight = double.parse(value);
|
|
goodsFreight = double.parse(value);
|
|
|
- String temp =goodsFreight.toStringAsFixed(1);
|
|
|
|
|
|
|
+ String temp = goodsFreight.toStringAsFixed(1);
|
|
|
goodsFreight = double.parse(temp);
|
|
goodsFreight = double.parse(temp);
|
|
|
} else if (key == '代收') {
|
|
} else if (key == '代收') {
|
|
|
goodsAgencyFund = double.parse(value);
|
|
goodsAgencyFund = double.parse(value);
|
|
|
- String temp =goodsAgencyFund.toStringAsFixed(1);
|
|
|
|
|
|
|
+ String temp = goodsAgencyFund.toStringAsFixed(1);
|
|
|
goodsAgencyFund = double.parse(temp);
|
|
goodsAgencyFund = double.parse(temp);
|
|
|
} else if (key == '保价') {
|
|
} else if (key == '保价') {
|
|
|
goodsPriceProtection = double.parse(value);
|
|
goodsPriceProtection = double.parse(value);
|
|
|
- String temp =goodsPriceProtection.toStringAsFixed(1);
|
|
|
|
|
|
|
+ String temp = goodsPriceProtection.toStringAsFixed(1);
|
|
|
goodsPriceProtection = double.parse(temp);
|
|
goodsPriceProtection = double.parse(temp);
|
|
|
} else if (key == '重量') {
|
|
} else if (key == '重量') {
|
|
|
goodsWeight = double.parse(value);
|
|
goodsWeight = double.parse(value);
|
|
|
- String temp =goodsWeight.toStringAsFixed(1);
|
|
|
|
|
|
|
+ String temp = goodsWeight.toStringAsFixed(1);
|
|
|
goodsWeight = double.parse(temp);
|
|
goodsWeight = double.parse(temp);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -750,15 +751,15 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
}
|
|
}
|
|
|
if (goodsQuantity == 0) {
|
|
if (goodsQuantity == 0) {
|
|
|
errStr = '请填写货物数量';
|
|
errStr = '请填写货物数量';
|
|
|
- }
|
|
|
|
|
- if(int.tryParse(goodsQuantity.toString())==null){
|
|
|
|
|
- errStr='货物数量格式错误';
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ if (int.tryParse(goodsQuantity.toString()) == null) {
|
|
|
|
|
+ errStr = '货物数量格式错误';
|
|
|
}
|
|
}
|
|
|
if (goodsFreight == 0.0) {
|
|
if (goodsFreight == 0.0) {
|
|
|
errStr = '请填写运费';
|
|
errStr = '请填写运费';
|
|
|
}
|
|
}
|
|
|
- if(int.tryParse(sendCompanyPhone)==null || int.tryParse(receiptCompanyPhone)==null || sendCompanyPhone.length!=11 || receiptCompanyPhone.length!=11){
|
|
|
|
|
- errStr='请输入正确的电话';
|
|
|
|
|
|
|
+ if (int.tryParse(sendCompanyPhone) == null || int.tryParse(receiptCompanyPhone) == null || sendCompanyPhone.length != 11 || receiptCompanyPhone.length != 11) {
|
|
|
|
|
+ errStr = '请输入正确的电话';
|
|
|
}
|
|
}
|
|
|
if (errStr != '') {
|
|
if (errStr != '') {
|
|
|
showError(errStr);
|
|
showError(errStr);
|
|
@@ -767,65 +768,68 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
setState(() {
|
|
setState(() {
|
|
|
submitStatus = false;
|
|
submitStatus = false;
|
|
|
});
|
|
});
|
|
|
- createOrder(
|
|
|
|
|
- sendCompanyId, //寄件公司Id
|
|
|
|
|
- sendCompanyName, //寄件公司名称 不能为空
|
|
|
|
|
- sendCompanyPhone, //寄件公司电话 不能为空
|
|
|
|
|
- sendCompanyCode ?? '', //寄件公司编码
|
|
|
|
|
- sendCompanyProvinceName, //寄件公司省名称 不能为空
|
|
|
|
|
- sendCompanyProvinceCode, //寄件公司省编码 不能为空
|
|
|
|
|
- sendCompanyCityName, //寄件公司市名称 不能为空
|
|
|
|
|
- sendCompanyCityCode, //寄件公司市编码 不能为空
|
|
|
|
|
- sendCompanyAreaName, //寄件公司区名称 不能为空
|
|
|
|
|
- sendCompanyAreaCode, //寄件公司区编码 不能为空
|
|
|
|
|
- sendCompanyAddress, //寄件公司详细地址,不能为空
|
|
|
|
|
- receiptCompanyId, //收件公司id
|
|
|
|
|
- receiptCompanyPhone, //收件公司电话 不能为空
|
|
|
|
|
- receiptCompanyName, //收件公司名称 不能为空
|
|
|
|
|
- receiptCompanyProvinceName, //收件公司省名称 不能为空
|
|
|
|
|
- receiptCompanyProvinceCode, //收件公司省编码 不能为空
|
|
|
|
|
- receiptCompanyCityName, //收件公司市名称 不能为空
|
|
|
|
|
- receiptCompanyCityCode, //收件公市编码 不能为空
|
|
|
|
|
- receiptCompanyAreaName, //收件公区名称 不能为空
|
|
|
|
|
- receiptCompanyAreaCode, //收件公司区编码 不能为空
|
|
|
|
|
- receiptCompanyAddress, //收件公司地址详情 不能为空
|
|
|
|
|
- goods, //商品名称 不能为空
|
|
|
|
|
- goodsQuantity, //商品数量 不能为空
|
|
|
|
|
- goodsPackingId, //商品包装ID
|
|
|
|
|
- goodsCategoryId, //商品类别ID
|
|
|
|
|
- goodsPaymentMethod, //付款方式 1,现付 2 到付
|
|
|
|
|
- goodsWeight, //商品重量
|
|
|
|
|
- goodsPriceProtection * 100, //商品保价,已分为单位
|
|
|
|
|
- goodsAgencyFund * 100, //商品代收款,已分为单位
|
|
|
|
|
- goodsFreight * 100, //商品运费 不能为空 ,已分为单位
|
|
|
|
|
- memo, //备注
|
|
|
|
|
- ).then((resp) {
|
|
|
|
|
- if (isNotError(context, resp)) {
|
|
|
|
|
- setState(() {
|
|
|
|
|
- submitStatus = true;
|
|
|
|
|
- });
|
|
|
|
|
- CreateOrder orderObj = CreateOrder.fromJson(resp.data);
|
|
|
|
|
- showDialog < Null > (
|
|
|
|
|
- context: context, //BuildContext对象
|
|
|
|
|
- barrierDismissible: false,
|
|
|
|
|
- builder: (BuildContext context) {
|
|
|
|
|
- return SendDialog( //调用对话框
|
|
|
|
|
- orderNo: orderObj.orderNo,
|
|
|
|
|
- childCallback: (val) {
|
|
|
|
|
- if (!val) {
|
|
|
|
|
- //跳转
|
|
|
|
|
- Navigator.push(context, MaterialPageRoute(builder: (context) {
|
|
|
|
|
- return OrderDetail(orderId: orderObj.orderNo, );
|
|
|
|
|
- }));
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ getKey('stationId').then((value) {
|
|
|
|
|
+ createOrder(
|
|
|
|
|
+ value,
|
|
|
|
|
+ sendCompanyId, //寄件公司Id
|
|
|
|
|
+ sendCompanyName, //寄件公司名称 不能为空
|
|
|
|
|
+ sendCompanyPhone, //寄件公司电话 不能为空
|
|
|
|
|
+ sendCompanyCode ?? '', //寄件公司编码
|
|
|
|
|
+ sendCompanyProvinceName, //寄件公司省名称 不能为空
|
|
|
|
|
+ sendCompanyProvinceCode, //寄件公司省编码 不能为空
|
|
|
|
|
+ sendCompanyCityName, //寄件公司市名称 不能为空
|
|
|
|
|
+ sendCompanyCityCode, //寄件公司市编码 不能为空
|
|
|
|
|
+ sendCompanyAreaName, //寄件公司区名称 不能为空
|
|
|
|
|
+ sendCompanyAreaCode, //寄件公司区编码 不能为空
|
|
|
|
|
+ sendCompanyAddress, //寄件公司详细地址,不能为空
|
|
|
|
|
+ receiptCompanyId, //收件公司id
|
|
|
|
|
+ receiptCompanyPhone, //收件公司电话 不能为空
|
|
|
|
|
+ receiptCompanyName, //收件公司名称 不能为空
|
|
|
|
|
+ receiptCompanyProvinceName, //收件公司省名称 不能为空
|
|
|
|
|
+ receiptCompanyProvinceCode, //收件公司省编码 不能为空
|
|
|
|
|
+ receiptCompanyCityName, //收件公司市名称 不能为空
|
|
|
|
|
+ receiptCompanyCityCode, //收件公市编码 不能为空
|
|
|
|
|
+ receiptCompanyAreaName, //收件公区名称 不能为空
|
|
|
|
|
+ receiptCompanyAreaCode, //收件公司区编码 不能为空
|
|
|
|
|
+ receiptCompanyAddress, //收件公司地址详情 不能为空
|
|
|
|
|
+ goods, //商品名称 不能为空
|
|
|
|
|
+ goodsQuantity, //商品数量 不能为空
|
|
|
|
|
+ goodsPackingId, //商品包装ID
|
|
|
|
|
+ goodsCategoryId, //商品类别ID
|
|
|
|
|
+ goodsPaymentMethod, //付款方式 1,现付 2 到付
|
|
|
|
|
+ goodsWeight, //商品重量
|
|
|
|
|
+ goodsPriceProtection * 100, //商品保价,已分为单位
|
|
|
|
|
+ goodsAgencyFund * 100, //商品代收款,已分为单位
|
|
|
|
|
+ goodsFreight * 100, //商品运费 不能为空 ,已分为单位
|
|
|
|
|
+ memo, //备注
|
|
|
|
|
+ ).then((resp) {
|
|
|
|
|
+ if (isNotError(context, resp)) {
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ submitStatus = true;
|
|
|
});
|
|
});
|
|
|
- } else {
|
|
|
|
|
- setState(() {
|
|
|
|
|
- submitStatus = true;
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ CreateOrder orderObj = CreateOrder.fromJson(resp.data);
|
|
|
|
|
+ showDialog < Null > (
|
|
|
|
|
+ context: context, //BuildContext对象
|
|
|
|
|
+ barrierDismissible: false,
|
|
|
|
|
+ builder: (BuildContext context) {
|
|
|
|
|
+ return SendDialog( //调用对话框
|
|
|
|
|
+ orderNo: orderObj.orderNo,
|
|
|
|
|
+ childCallback: (val) {
|
|
|
|
|
+ if (!val) {
|
|
|
|
|
+ //跳转
|
|
|
|
|
+ Navigator.push(context, MaterialPageRoute(builder: (context) {
|
|
|
|
|
+ return OrderDetail(orderId: orderObj.orderNo, );
|
|
|
|
|
+ }));
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ );
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ submitStatus = true;
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
);
|
|
);
|