|
|
@@ -11,6 +11,7 @@ import '../util/models.dart';
|
|
|
import '../showAlert.dart';
|
|
|
import '../send_Dialog.dart';
|
|
|
import '../util/session.dart';
|
|
|
+import '../showLineModal.dart';
|
|
|
class SendExpressPage extends StatefulWidget {
|
|
|
final Widget child;
|
|
|
|
|
|
@@ -36,6 +37,7 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
double tipPosY = 0;
|
|
|
|
|
|
bool tipStatus = true;
|
|
|
+ bool lineModalStatus = false;
|
|
|
bool submitStatus = true;
|
|
|
|
|
|
List < LikePhoneList > likePhoneList = [];
|
|
|
@@ -58,6 +60,7 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
List < dynamic > goodsCateGoryList = [];
|
|
|
List < dynamic > goodsPackageList = [];
|
|
|
//请求字段-------------------------
|
|
|
+ String lineId = '-1';//收件公司匹配的线路id
|
|
|
String sendCompanyId = '0'; //寄件公司Id
|
|
|
String sendCompanyName = ''; //寄件公司名称 不能为空
|
|
|
String sendCompanyPhone = ''; //寄件公司电话 不能为空
|
|
|
@@ -90,6 +93,7 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
double goodsFreight = 0.0; //商品运费 不能为空
|
|
|
String memo = ''; //备注
|
|
|
|
|
|
+ List<CompanyOfLineList> lineList = [];
|
|
|
|
|
|
String sendPCA = ' '; //Text组件内容必须有空格,否则报null
|
|
|
String getPCA = ' ';
|
|
|
@@ -719,9 +723,6 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
print('goodsFreight---${goodsFreight}');
|
|
|
print('memo---${memo}');
|
|
|
|
|
|
- // if (!isChinaPhoneLegal(sendCompanyPhone)) {
|
|
|
-
|
|
|
- // }
|
|
|
if (sendCompanyPhone == '') {
|
|
|
errStr = '请填写发件电话';
|
|
|
}
|
|
|
@@ -765,11 +766,25 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
showError(errStr);
|
|
|
return;
|
|
|
}
|
|
|
- setState(() {
|
|
|
- submitStatus = false;
|
|
|
- });
|
|
|
- getKey('stationId').then((value) {
|
|
|
+
|
|
|
+ if(lineList.length==1){
|
|
|
+ lineId = lineList[0].lineId.toString();
|
|
|
+ }else if(lineList.length>1){
|
|
|
+ showLineModal(lineList);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ submitOrder();
|
|
|
+ },
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ submitOrder(){
|
|
|
+ setState(() {
|
|
|
+ submitStatus = false;
|
|
|
+ });
|
|
|
+ getKey('stationId').then((value) {
|
|
|
createOrder(
|
|
|
+ lineId,
|
|
|
value,
|
|
|
sendCompanyId, //寄件公司Id
|
|
|
sendCompanyName, //寄件公司名称 不能为空
|
|
|
@@ -831,10 +846,7 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
- },
|
|
|
- );
|
|
|
}
|
|
|
-
|
|
|
showError(String str) {
|
|
|
showDialog < Null > (
|
|
|
context: context, //BuildContext对象
|
|
|
@@ -845,6 +857,19 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
);
|
|
|
});
|
|
|
}
|
|
|
+ showLineModal(List<CompanyOfLineList> list){
|
|
|
+ showDialog < Null > (
|
|
|
+ context: context, //BuildContext对象
|
|
|
+ barrierDismissible: false,
|
|
|
+ builder: (BuildContext context) {
|
|
|
+ return ShowLineModal(
|
|
|
+ lineList: list, childCallback: (val) {
|
|
|
+ lineId = val;
|
|
|
+ submitOrder();
|
|
|
+ },
|
|
|
+ );
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
Future getCity(context) async {
|
|
|
Result result = await CityPickers.showCityPicker(
|
|
|
@@ -866,7 +891,7 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
children: < Widget > [
|
|
|
Padding(
|
|
|
padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(50)),
|
|
|
- child: Text(obj.uzerPhone, style: TextStyle(
|
|
|
+ child: Text(obj.uzerPhone!=null?obj.uzerPhone:obj.companyPhone, style: TextStyle(
|
|
|
fontSize: ScreenUtil.getInstance().setSp(28),
|
|
|
color: Color.fromRGBO(74, 74, 74, 1)
|
|
|
), )
|
|
|
@@ -894,11 +919,11 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
),
|
|
|
onTap: () {
|
|
|
if (sendPhoneOrGetPhoneTab) {
|
|
|
- sendCompanyPhone = obj.uzerPhone;
|
|
|
+ sendCompanyPhone = obj.uzerPhone!=null?obj.uzerPhone:obj.companyPhone;
|
|
|
sendCompanyCode = obj.companyCode;
|
|
|
sendCompanyName = obj.companyName;
|
|
|
sendCompanyId = obj.id.toString();
|
|
|
- sendCompanyPhoneController.text = obj.uzerPhone;
|
|
|
+ sendCompanyPhoneController.text = obj.uzerPhone!=null?obj.uzerPhone:obj.companyPhone;
|
|
|
sendCompanyCodeController.text = obj.companyCode;
|
|
|
sendCompanyNameController.text = obj.companyName;
|
|
|
|
|
|
@@ -912,12 +937,19 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
|
|
|
sendCompanyAddressController.text = obj.address;
|
|
|
} else {
|
|
|
- receiptCompanyPhone = obj.uzerPhone;
|
|
|
+ receiptCompanyPhone = obj.uzerPhone!=null?obj.uzerPhone:obj.companyPhone;
|
|
|
receiptCompanyName = obj.companyName;
|
|
|
- receiptCompanyPhoneController.text = obj.uzerPhone;
|
|
|
+ receiptCompanyPhoneController.text = obj.uzerPhone!=null?obj.uzerPhone:obj.companyPhone;
|
|
|
receiptCompanyNameController.text = obj.companyName;
|
|
|
receiptCompanyId = obj.id.toString();
|
|
|
-
|
|
|
+ getLineOfCompanyId(receiptCompanyId).then((resp){
|
|
|
+ if(isNotError(context, resp)){
|
|
|
+ CompanyOfLine obj = CompanyOfLine.fromJson(resp.data);
|
|
|
+ setState(() {
|
|
|
+ lineList = obj.data;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
getPCA = obj.provinceName + ' ' + obj.cityName + ' ' + ' ' + obj.areaName;
|
|
|
receiptCompanyProvinceName = obj.provinceName;
|
|
|
receiptCompanyProvinceCode = obj.provinceCode;
|