Ver código fonte

模糊匹配电话

daxu0403 7 anos atrás
pai
commit
1cc80a58e3

+ 2 - 1
.gitignore

@@ -1 +1,2 @@
-/build/*
+/build/*
+.packages

BIN
android/.gradle/4.10.2/fileHashes/fileHashes.bin


BIN
android/.gradle/4.10.2/fileHashes/fileHashes.lock


BIN
android/.gradle/4.10.2/taskHistory/taskHistory.bin


BIN
android/.gradle/4.10.2/taskHistory/taskHistory.lock


BIN
android/.gradle/buildOutputCleanup/buildOutputCleanup.lock


+ 0 - 1
lib/pages/my_page.dart

@@ -283,7 +283,6 @@ class _MyPageState extends State < MyPage > with AutomaticKeepAliveClientMixin {
                     value: this.check,
                     activeColor: Colors.blue,
                     onChanged: (bool val) {
-                      print("val:${val}");
                       this.setState(() {
                         this.check = val;
                       });

+ 4 - 4
lib/pages/order_management_page/order_detail_page.dart

@@ -254,8 +254,8 @@ Widget contentWiget(String key, String value) {
               child: Row(
                 mainAxisAlignment: MainAxisAlignment.spaceBetween,
                 children: < Widget > [
-                  Text('${key}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
-                  Text('${value}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(136, 136, 136, 1)), ),
+                  Text(key, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
+                  Text(value, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(136, 136, 136, 1)), ),
                 ],
               ),
             )
@@ -282,8 +282,8 @@ Widget lastContentWiget(String key, String value) {
           child: Row(
             mainAxisAlignment: MainAxisAlignment.spaceBetween,
             children: < Widget > [
-              Text('${key}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
-              Text('${value}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(136, 136, 136, 1)), ),
+              Text(key, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
+              Text(value, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(136, 136, 136, 1)), ),
             ],
           ),
         )

+ 2 - 2
lib/pages/order_taking_page.dart

@@ -513,7 +513,7 @@ Widget orderDetailInfo(OrderList obj) { //卡片展开信息
   );
 }
 
-Widget orderItem(String key, String value, int marginBottom) { //货物名称,件数
+Widget orderItem(String key, String value, double marginBottom) { //货物名称,件数
   return Container(
     margin: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(marginBottom)),
     child: Row(children: < Widget > [
@@ -522,7 +522,7 @@ Widget orderItem(String key, String value, int marginBottom) { //货物名称,
   );
 }
 
-Widget orderPhone(String key, String value, int marginBottom) {
+Widget orderPhone(String key, String value, double marginBottom) {
   return InkWell(
     child: Container(
       margin: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(marginBottom)),

+ 116 - 43
lib/pages/send_express_page.dart

@@ -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),

+ 9 - 1
lib/util/api.dart

@@ -71,11 +71,12 @@ Future createOrder(
   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//备注
 ) async{
   var response = await Http().post('app/order/logistics_order_create',data:{
@@ -108,7 +109,14 @@ Future createOrder(
     'goodsWeight':goodsWeight,
     'goodsPriceProtection':goodsPriceProtection,
     'goodsAgencyFund':goodsAgencyFund,
+    'goodsFreight':goodsFreight,
     'memo':memo
   });
   return response;
+}
+
+//模糊匹配手机号
+Future likePhone(String phone){
+  var response  =Http().get('app/uzer_company/uzer_company_like',data:{'phone':phone});
+  return response;
 }

+ 73 - 0
lib/util/models.dart

@@ -267,4 +267,77 @@ class UpdataPasswrod {
       data: json['data']
     );
   }
+}
+
+//手机号模糊匹配
+class LikePhone{
+  bool success;
+  int code;
+  String msg;
+  List<LikePhoneList> data;
+
+  LikePhone({
+    this.success,
+    this.code,
+    this.msg,
+    this.data
+  });
+  
+  factory LikePhone.fromJson(Map<String,dynamic> json){
+     List list = json['data'] as List;
+     List<LikePhoneList> tempList = list.map((i) => LikePhoneList.fromJson(i)).toList();
+     return LikePhone(
+       success: json['success'],
+       code: json['code'],
+       msg:json['msg'],
+       data:tempList
+     );
+  }
+}
+
+class LikePhoneList{
+  String address;
+  String areaCode;
+  String areaName;
+  String cityCode;
+  String cityName;
+  String companyCode;
+  String companyName;
+  String companyPhone;
+  int id;
+  String provinceCode;
+  String provinceName;
+  String uzerPhone;
+
+  LikePhoneList({
+    this.address,
+    this.areaCode,
+    this.areaName,
+    this.cityCode,
+    this.cityName,
+    this.companyCode,
+    this.companyName,
+    this.companyPhone,
+    this.id,
+    this.provinceCode,
+    this.provinceName,
+    this.uzerPhone
+  });
+
+  factory LikePhoneList.fromJson(Map<String,dynamic> json){
+    return LikePhoneList(
+      address:json['address'],
+      areaCode:json['areaCode'],
+      areaName:json['areaName'],
+      cityCode:json['cityCode'],
+      cityName:json['cityName'],
+      companyCode:json['companyCode'],
+      companyName:json['companyName'],
+      companyPhone:json['companyPhone'],
+      id:json['id'],
+      provinceCode:json['provinceCode'],
+      provinceName:json['provinceName'],
+      uzerPhone:json['uzerPhone']
+    );
+  }
 }

+ 1 - 1
lib/util/util.dart

@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
 import 'package:dio/dio.dart';
 import '../showAlert.dart';
 bool isNotError(BuildContext context,json){
-  print('-----------${json}----------');
+  //print('-----------'+json+'----------');
   if(json is DioError){
     alertError(context, json.toString());
     return false;