|
|
@@ -2,6 +2,10 @@ import 'package:flutter/material.dart';
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
import 'package:city_pickers/city_pickers.dart';
|
|
|
import 'package:flutter_picker/flutter_picker.dart';
|
|
|
+import 'dart:async';
|
|
|
+import '../util/util.dart';
|
|
|
+import '../util/api.dart';
|
|
|
+import '../util/models.dart';
|
|
|
|
|
|
class SendExpressPage extends StatefulWidget {
|
|
|
final Widget child;
|
|
|
@@ -29,6 +33,8 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
|
|
|
bool tipStatus = true;
|
|
|
|
|
|
+ List < LikePhoneList > likePhoneList = [];
|
|
|
+ var timer;
|
|
|
//请求字段-------------------------
|
|
|
int sendCompanyId; //寄件公司Id
|
|
|
String sendCompanyName; //寄件公司名称 不能为空
|
|
|
@@ -51,18 +57,19 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
String receiptCompanyAreaName; //收件公区名称 不能为空
|
|
|
String receiptCompanyAreaCode; //收件公司区编码 不能为空
|
|
|
String receiptCompanyAddress; //收件公司地址详情 不能为空
|
|
|
- String goods; //商品名称不能为空
|
|
|
+ String goods; //商品名称 不能为空
|
|
|
int goodsQuantity; //商品数量 不能为空
|
|
|
int goodsPackingId; //商品包装ID
|
|
|
- int goodsCategoryId; //商品包装类别ID
|
|
|
+ int goodsCategoryId; //商品类别ID
|
|
|
int goodsPaymentMethod; //付款方式
|
|
|
double goodsWeight; //商品重量
|
|
|
double goodsPriceProtection; //商品保价
|
|
|
double goodsAgencyFund; //商品代收款
|
|
|
+ double goodsFreight; //商品运费 不能为空
|
|
|
String memo; //备注
|
|
|
|
|
|
|
|
|
- String sendPCA = ' ';//Text组件内容必须有空格,否则报null
|
|
|
+ String sendPCA = ' '; //Text组件内容必须有空格,否则报null
|
|
|
String getPCA = ' ';
|
|
|
|
|
|
@override
|
|
|
@@ -74,7 +81,6 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
tipStatus = true;
|
|
|
});
|
|
|
}
|
|
|
- print('滚动了');
|
|
|
if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) {}
|
|
|
});
|
|
|
}
|
|
|
@@ -120,12 +126,12 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
decoration: BoxDecoration(
|
|
|
color: Color.fromRGBO(244, 248, 251, 1),
|
|
|
),
|
|
|
- child: ListView(
|
|
|
- children: < Widget > [
|
|
|
- _tipItem(),
|
|
|
- _tipItem(),
|
|
|
- ],
|
|
|
- ),
|
|
|
+ child: ListView.builder(
|
|
|
+ itemCount: likePhoneList.length,
|
|
|
+ itemBuilder: (BuildContext context, int index) {
|
|
|
+ return _tipItem(likePhoneList[index]);
|
|
|
+ },
|
|
|
+ )
|
|
|
),
|
|
|
)
|
|
|
)
|
|
|
@@ -187,7 +193,8 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
_contentWiget("代收", 'goods'),
|
|
|
_contentWiget("保价", 'goods'),
|
|
|
_contentWiget("重量", 'goods'),
|
|
|
- _packageType(),
|
|
|
+ _packageType('包装类型'),
|
|
|
+ _packageType('商品类型'),
|
|
|
_descWidget()
|
|
|
],
|
|
|
),
|
|
|
@@ -257,41 +264,78 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
),
|
|
|
onChanged: ((value) {
|
|
|
if (tab == 'sendPhone') {
|
|
|
- if (value.length >= 4) {
|
|
|
- RenderObject sendPhoneObj = _sendPhoneKey.currentContext.findRenderObject();
|
|
|
- setState(() {
|
|
|
- tipWidth = sendPhoneObj.paintBounds.size.width;
|
|
|
- tipHeight = sendPhoneObj.paintBounds.size.height;
|
|
|
- tipPosX = sendPhoneObj.getTransformTo(null).getTranslation().x;
|
|
|
- tipPosY = sendPhoneObj.getTransformTo(null).getTranslation().y - ScreenUtil.getInstance().setHeight(90);
|
|
|
- tipStatus = false;
|
|
|
- });
|
|
|
- } else {
|
|
|
+ setState(() {
|
|
|
+ sendCompanyPhone = value;
|
|
|
+ });
|
|
|
+ timer.cancel();
|
|
|
+ if (value.length < 6) {
|
|
|
setState(() {
|
|
|
tipStatus = true;
|
|
|
});
|
|
|
}
|
|
|
+ timer = Timer(Duration(milliseconds: 500), () {
|
|
|
+ if (value.length >= 6) {
|
|
|
+ likePhone(value).then((resp) {
|
|
|
+ if (isNotError(context, resp)) {
|
|
|
+ LikePhone likePhoneObj = LikePhone.fromJson(resp.data);
|
|
|
+ likePhoneList = likePhoneObj.data;
|
|
|
+ }
|
|
|
+ if (likePhoneList.length > 0) {
|
|
|
+ RenderObject sendPhoneObj = _sendPhoneKey.currentContext.findRenderObject();
|
|
|
+ setState(() {
|
|
|
+ tipWidth = sendPhoneObj.paintBounds.size.width;
|
|
|
+ tipHeight = sendPhoneObj.paintBounds.size.height;
|
|
|
+ tipPosX = sendPhoneObj.getTransformTo(null).getTranslation().x;
|
|
|
+ tipPosY = sendPhoneObj.getTransformTo(null).getTranslation().y - ScreenUtil.getInstance().setHeight(90);
|
|
|
+ tipStatus = false;
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ setState(() {
|
|
|
+ tipStatus =true;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
// print(tipWidth);
|
|
|
// print(tipHeight);
|
|
|
// print(tipPosX);
|
|
|
// print(tipPosY);
|
|
|
} else if (tab == 'getPhone') {
|
|
|
- if (value.length >= 4) {
|
|
|
- RenderObject sendPhoneObj = _getPhoneKey.currentContext.findRenderObject();
|
|
|
- setState(() {
|
|
|
- tipWidth = sendPhoneObj.paintBounds.size.width;
|
|
|
- tipHeight = sendPhoneObj.paintBounds.size.height;
|
|
|
- tipPosX = sendPhoneObj.getTransformTo(null).getTranslation().x;
|
|
|
- tipPosY = sendPhoneObj.getTransformTo(null).getTranslation().y - ScreenUtil.getInstance().setHeight(90);
|
|
|
- tipStatus = false;
|
|
|
- });
|
|
|
- } else {
|
|
|
+ setState(() {
|
|
|
+ receiptCompanyPhone = value;
|
|
|
+ });
|
|
|
+ timer.cancel();
|
|
|
+ if (value.length < 6) {
|
|
|
setState(() {
|
|
|
tipStatus = true;
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
+ timer = Timer(Duration(milliseconds: 500), () {
|
|
|
+ if (value.length >= 6) {
|
|
|
+ likePhone(value).then((resp) {
|
|
|
+ if (isNotError(context, resp)) {
|
|
|
+ LikePhone likePhoneObj = LikePhone.fromJson(resp.data);
|
|
|
+ likePhoneList = likePhoneObj.data;
|
|
|
+ }
|
|
|
+ if (likePhoneList.length > 0) {
|
|
|
+ RenderObject getPhoneKey = _getPhoneKey.currentContext.findRenderObject();
|
|
|
+ setState(() {
|
|
|
+ tipWidth = getPhoneKey.paintBounds.size.width;
|
|
|
+ tipHeight = getPhoneKey.paintBounds.size.height;
|
|
|
+ tipPosX = getPhoneKey.getTransformTo(null).getTranslation().x;
|
|
|
+ tipPosY = getPhoneKey.getTransformTo(null).getTranslation().y - ScreenUtil.getInstance().setHeight(90);
|
|
|
+ tipStatus = false;
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ setState(() {
|
|
|
+ tipStatus =true;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
// print(tipWidth);
|
|
|
// print(tipHeight);
|
|
|
// print(tipPosX);
|
|
|
@@ -379,7 +423,7 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
} else if (key == '数量') {
|
|
|
goodsQuantity = int.parse(value);
|
|
|
} else if (key == '运费') {
|
|
|
-
|
|
|
+ goodsFreight = double.parse(value);
|
|
|
} else if (key == '代收') {
|
|
|
goodsAgencyFund = double.parse(value);
|
|
|
} else if (key == '保价') {
|
|
|
@@ -410,7 +454,6 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
}
|
|
|
|
|
|
Widget _cityWiget(String key, BuildContext context, String type) {
|
|
|
-
|
|
|
return
|
|
|
GestureDetector(
|
|
|
child: Padding(
|
|
|
@@ -568,7 +611,37 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
),
|
|
|
),
|
|
|
onTap: () {
|
|
|
- print('提交');
|
|
|
+ print('sendCompanyId---${sendCompanyId}');
|
|
|
+ print('sendCompanyName---${sendCompanyName}');
|
|
|
+ print('sendCompanyPhone---${sendCompanyPhone}');
|
|
|
+ print('sendCompanyCode---${sendCompanyCode}');
|
|
|
+ print('sendCompanyProvinceName---${sendCompanyProvinceName}');
|
|
|
+ print('sendCompanyProvinceCode---${sendCompanyProvinceCode}');
|
|
|
+ print('sendCompanyCityName---${sendCompanyCityName}');
|
|
|
+ print('sendCompanyCityCode---${sendCompanyCityCode}');
|
|
|
+ print('sendCompanyAreaName---${sendCompanyAreaName}');
|
|
|
+ print('sendCompanyAreaCode---${sendCompanyAreaCode}');
|
|
|
+ print('sendCompanyAddress---${sendCompanyAddress}');
|
|
|
+ print('receiptCompanyId---${receiptCompanyId}');
|
|
|
+ print('receiptCompanyPhone---${receiptCompanyPhone}');
|
|
|
+ print('receiptCompanyName---${receiptCompanyName}');
|
|
|
+ print('receiptCompanyProvinceName---${receiptCompanyProvinceName}');
|
|
|
+ print('receiptCompanyProvinceCode---${receiptCompanyProvinceCode}');
|
|
|
+ print('receiptCompanyCityName---${receiptCompanyCityName}');
|
|
|
+ print('receiptCompanyCityCode---${receiptCompanyCityCode}');
|
|
|
+ print('receiptCompanyAreaName---${receiptCompanyAreaName}');
|
|
|
+ print('receiptCompanyAreaCode---${receiptCompanyAreaCode}');
|
|
|
+ print('receiptCompanyAddress---${receiptCompanyAddress}');
|
|
|
+ print('goods---${goods}');
|
|
|
+ print('goodsQuantity---${goodsQuantity}');
|
|
|
+ print('goodsPackingId---${goodsPackingId}');
|
|
|
+ print('goodsCategoryId---${goodsCategoryId}');
|
|
|
+ print('goodsPaymentMethod---${goodsPaymentMethod}');
|
|
|
+ print('goodsWeight---${goodsWeight}');
|
|
|
+ print('goodsPriceProtection---${goodsPriceProtection}');
|
|
|
+ print('goodsAgencyFund---${goodsAgencyFund}');
|
|
|
+ print('goodsFreight---${goodsFreight}');
|
|
|
+ print('memo---${memo}');
|
|
|
},
|
|
|
);
|
|
|
}
|
|
|
@@ -579,7 +652,7 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- Widget _tipItem() {
|
|
|
+ Widget _tipItem(LikePhoneList obj) {
|
|
|
return Container(
|
|
|
child: Column(
|
|
|
children: < Widget > [
|
|
|
@@ -591,21 +664,21 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
children: < Widget > [
|
|
|
Padding(
|
|
|
padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(50)),
|
|
|
- child: Text("15901462275", style: TextStyle(
|
|
|
+ child: Text(obj.uzerPhone, style: TextStyle(
|
|
|
fontSize: ScreenUtil.getInstance().setSp(28),
|
|
|
color: Color.fromRGBO(74, 74, 74, 1)
|
|
|
), )
|
|
|
),
|
|
|
SizedBox(
|
|
|
width: ScreenUtil.getInstance().setWidth(185),
|
|
|
- child: Text('WX11042',
|
|
|
+ child: Text(obj.areaCode,
|
|
|
textAlign: TextAlign.left,
|
|
|
style: TextStyle(
|
|
|
fontSize: ScreenUtil.getInstance().setSp(28),
|
|
|
color: Color.fromRGBO(155, 155, 155, 1)
|
|
|
), ),
|
|
|
),
|
|
|
- Text('天华盛业',
|
|
|
+ Text(obj.companyName,
|
|
|
textAlign: TextAlign.left,
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
style: TextStyle(
|
|
|
@@ -623,7 +696,7 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- Widget _packageType() {
|
|
|
+ Widget _packageType(String key) {
|
|
|
return Padding(
|
|
|
padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
|
|
|
child: Column(
|
|
|
@@ -637,7 +710,7 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
children: < Widget > [
|
|
|
Expanded(
|
|
|
flex: 0,
|
|
|
- child: Text('包装类型', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
|
|
|
+ child: Text(key, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
|
|
|
),
|
|
|
Expanded(
|
|
|
child: Row(
|
|
|
@@ -657,7 +730,7 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
)
|
|
|
),
|
|
|
onTap: () {
|
|
|
- showPickerModal(context);
|
|
|
+ showPickerModal(context, key);
|
|
|
},
|
|
|
),
|
|
|
Expanded(
|
|
|
@@ -670,7 +743,7 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
|
|
|
|
|
|
}
|
|
|
|
|
|
- showPickerModal(BuildContext context) {
|
|
|
+ showPickerModal(BuildContext context, String type) {
|
|
|
new Picker(
|
|
|
adapter: PickerDataAdapter < String > (pickerdata: ['纸箱', '木箱']),
|
|
|
height: ScreenUtil.getInstance().setHeight(450),
|