添加项目文件。
This commit is contained in:
		
							
								
								
									
										20
									
								
								XXCpzs/App.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								XXCpzs/App.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <Application xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
|              mc:Ignorable="d" | ||||
|              x:Class="XXCpzs.App"> | ||||
|  | ||||
|     <Application.Resources> | ||||
|         <ResourceDictionary> | ||||
|             <!--Global Styles--> | ||||
|             <Color x:Key="NavigationPrimary">#2196F3</Color> | ||||
|             <Style TargetType="NavigationPage"> | ||||
|                 <Setter Property="BarBackgroundColor" Value="{StaticResource NavigationPrimary}" /> | ||||
|                 <Setter Property="BarTextColor" Value="White" /> | ||||
|             </Style> | ||||
|         </ResourceDictionary> | ||||
|     </Application.Resources> | ||||
|      | ||||
| </Application> | ||||
							
								
								
									
										43
									
								
								XXCpzs/App.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								XXCpzs/App.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,43 @@ | ||||
| using System; | ||||
| using Xamarin.Essentials; | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| using XXCpzs.IOInterface; | ||||
| using XXCpzs.Services; | ||||
| using XXCpzs.Views; | ||||
|  | ||||
| namespace XXCpzs | ||||
| { | ||||
|     public partial class App : Application | ||||
|     { | ||||
|         //TODO: Replace with *.azurewebsites.net url after deploying backend to Azure | ||||
|         //To debug on Android emulators run the web backend against .NET Core not IIS | ||||
|         //If using other emulators besides stock Google images you may need to adjust the IP address | ||||
|         public static string AzureBackendUrl = | ||||
|             DeviceInfo.Platform == DevicePlatform.Android ? "http://10.0.2.2:5000" : "http://localhost:5000"; | ||||
|         public static bool UseMockDataStore = true; | ||||
|  | ||||
|         public App() | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|  | ||||
|             if (UseMockDataStore) | ||||
|                 DependencyService.Register<MockDataStore>(); | ||||
|             else | ||||
|                 DependencyService.Register<AzureDataStore>();  | ||||
|             MainPage = new MainPage(); | ||||
|         } | ||||
|  | ||||
|         protected override void OnStart() | ||||
|         { | ||||
|         } | ||||
|  | ||||
|         protected override void OnSleep() | ||||
|         { | ||||
|         } | ||||
|  | ||||
|         protected override void OnResume() | ||||
|         { | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										3
									
								
								XXCpzs/AssemblyInfo.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								XXCpzs/AssemblyInfo.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| using Xamarin.Forms.Xaml; | ||||
|  | ||||
| [assembly: XamlCompilation(XamlCompilationOptions.Compile)] | ||||
							
								
								
									
										132
									
								
								XXCpzs/Helper/HttpHelper.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										132
									
								
								XXCpzs/Helper/HttpHelper.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,132 @@ | ||||
| using RestSharp; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Threading.Tasks; | ||||
| using XXCpzs.Models; | ||||
|  | ||||
| namespace XXCpzs.helper | ||||
|  | ||||
| { | ||||
|     public class HttpHelper | ||||
|     { | ||||
|         public static async Task<ResultModel> RequestPost(int type, Dictionary<string, string> _body = null) | ||||
|         { | ||||
|             string _domain = string.Format(@"http://cpzs.xixingwl.cn/cpzs/Api/{0}.shtml", type); | ||||
|             Console.WriteLine(">>>>" + _domain); | ||||
|             var client = new RestClient | ||||
|             { | ||||
|                 BaseUrl = new Uri(_domain), | ||||
|                 Timeout = 60000, | ||||
|                 //Authenticator = new HttpBasicAuthenticator("username", "password") | ||||
|             }; | ||||
|             var request = new RestRequest | ||||
|             { | ||||
|                 Timeout = 30000, | ||||
|                 Method = Method.POST | ||||
|             }; | ||||
|             request.AddHeader("Content-Type", "application/json"); | ||||
|             request.AddHeader("Authorization", "Bearer123456"); | ||||
|             request.AddJsonBody(_body); | ||||
|             var response = await client.ExecuteAsync<ResultModel>(request); | ||||
|             Console.WriteLine(response.Content); | ||||
|             if (response.IsSuccessful) | ||||
|             { | ||||
|                 return response.Data; | ||||
|             } | ||||
|             return  new ResultModel { Code = 500, Msg = "系统错误!" }; ; | ||||
|         } | ||||
|  | ||||
|  | ||||
|         /// send the get request based on HttpWebRequest | ||||
|         /// </summary> | ||||
|         /// <param name="requestUrl">the url you post</param> | ||||
|         /// <param name="routeParameters">the parameters you post</param> | ||||
|         /// <returns>return a response object</returns> | ||||
|         public static List<T> RefreshData<T>(int type, Method method = Method.GET, Dictionary<string, string> _body = null) | ||||
|         { | ||||
|             string _domain = string.Format(@"http://cpzs.xixingwl.cn/cpzs/Api/{0}.shtml", type); | ||||
|             Console.WriteLine(">>>>" + _domain); | ||||
|             var client = new RestClient | ||||
|             { | ||||
|                 BaseUrl = new Uri(_domain), | ||||
|                 Timeout = 60000, | ||||
|                 //Authenticator = new HttpBasicAuthenticator("username", "password") | ||||
|             }; | ||||
|             var request = new RestRequest | ||||
|             { | ||||
|                 Timeout = 30000, | ||||
|                 Method = method | ||||
|             }; | ||||
|             request.AddHeader("Content-Type", "application/json"); | ||||
|             request.AddHeader("Authorization", "Bearer123456"); | ||||
|             request.AddJsonBody(_body); | ||||
|             IRestResponse<ListModel<T>> response2 = client.Execute<ListModel<T>>(request); | ||||
|             Console.WriteLine(response2.Content); | ||||
|             if (response2.Data.Code == 200 && response2.Data.Data != null) | ||||
|             { | ||||
|                 return response2.Data.Data; | ||||
|             } | ||||
|             return null; | ||||
|  | ||||
|         } | ||||
|  | ||||
|         public static BaseModel<T> Refresh<T>(string type, Dictionary<string, string> _body = null) | ||||
|         { | ||||
|             string _domain = string.Format(@"http://cpzs.xixingwl.cn/addons/cpzs/Api/{0}.shtml", type); | ||||
|             Console.WriteLine(">>>>" + _domain); | ||||
|             var client = new RestClient | ||||
|             { | ||||
|                 BaseUrl = new Uri(_domain), | ||||
|                 Timeout = 60000, | ||||
|                 //Authenticator = new HttpBasicAuthenticator("username", "password") | ||||
|             }; | ||||
|             var request = new RestRequest | ||||
|             { | ||||
|                 Timeout = 30000, | ||||
|                 Method = Method.POST | ||||
|             }; | ||||
|             request.AddHeader("Content-Type", "application/json"); | ||||
|             request.AddHeader("Authorization", "Bearer123456"); | ||||
|             request.AddJsonBody(_body); | ||||
|             IRestResponse<BaseModel<T>> response2 = client.Execute<BaseModel<T>>(request); | ||||
|             if (response2.IsSuccessful) | ||||
|             { | ||||
|                 Console.Write(">>>" + response2.Content); | ||||
|                 return response2.Data; | ||||
|             } | ||||
|             return new BaseModel<T>() { Code = 500, Msg = "系统错误!" }; | ||||
|  | ||||
|         } | ||||
|  | ||||
|  | ||||
|     } | ||||
|     public enum RequestType { | ||||
|             /// <summary> | ||||
|             /// 授权验证 | ||||
|             /// </summary>  | ||||
|             noun, | ||||
|             /// <summary> | ||||
|             /// 设备软件验证 | ||||
|             /// </summary> | ||||
|             verb, | ||||
|             /// <summary> | ||||
|             /// 注册接口 | ||||
|             /// </summary> | ||||
|             reg ,//= "reg", | ||||
|             /// <summary> | ||||
|             /// 获取部门 | ||||
|             /// </summary> | ||||
|             getdepartment | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										35
									
								
								XXCpzs/Helper/Verification.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								XXCpzs/Helper/Verification.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
|  | ||||
| namespace XXCpzs.helper | ||||
| { | ||||
|     public class Verification | ||||
|     { | ||||
|         // 验证电话号码的主要代码如下: | ||||
|         public static bool IsTelephone(string str_telephone) | ||||
|         { | ||||
|             return System.Text.RegularExpressions.Regex.IsMatch(str_telephone, @"^(\d{3,4}-)?\d{6,8}$"); | ||||
|         } | ||||
|         //验证手机号码的主要代码如下: | ||||
|         public static bool IsHandset(string str_handset) | ||||
|         { | ||||
|             return System.Text.RegularExpressions.Regex.IsMatch(str_handset, @"^[1]+[3,5]+\d{9}"); | ||||
|         } | ||||
|         // 验证身份证号的主要代码如下: | ||||
|         public static bool IsIDcard(string str_idcard) | ||||
|         { | ||||
|             return System.Text.RegularExpressions.Regex.IsMatch(str_idcard, @"(^\d{18}$)|(^\d{15}$)"); | ||||
|         } | ||||
|         // 验证输入为数字的主要代码如下: | ||||
|         public static bool IsNumber(string str_number) | ||||
|         { | ||||
|             return System.Text.RegularExpressions.Regex.IsMatch(str_number, @"^[0-9]*$"); | ||||
|         } | ||||
|         // 验证邮编的主要代码如下: | ||||
|         public static bool IsPostalcode(string str_postalcode) | ||||
|         { | ||||
|             return System.Text.RegularExpressions.Regex.IsMatch(str_postalcode, @"^\d{6}$"); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										10
									
								
								XXCpzs/Helper/com.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								XXCpzs/Helper/com.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
|  | ||||
| namespace XXCpzs.helper | ||||
| { | ||||
|     class com | ||||
|     { | ||||
|     } | ||||
| } | ||||
							
								
								
									
										11
									
								
								XXCpzs/IOInterface/InterfaceLogincs.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								XXCpzs/IOInterface/InterfaceLogincs.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| using System; | ||||
| using XXCpzs.Models; | ||||
|  | ||||
| namespace XXCpzs.IOInterface | ||||
| { | ||||
|     public interface InterfaceLogin | ||||
|     { | ||||
|         void Loginback(UserInfo userInfo); | ||||
|         void ImageButtonLogin_Clicked(object sender, EventArgs e); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										42
									
								
								XXCpzs/Models/AuthorizeItem.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								XXCpzs/Models/AuthorizeItem.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
| using XXCpzs.Views; | ||||
|  | ||||
| namespace XXCpzs.Models | ||||
| { | ||||
|     public class AuthorizeItem | ||||
|     { | ||||
|  | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int companyId { get; set; } | ||||
|         /// <summary> | ||||
|         /// 广州恒泰 | ||||
|         /// </summary> | ||||
|         public string companyName { get; set; } | ||||
|         /// <summary> | ||||
|         /// 广州恒泰汽车传动科技有限公司 | ||||
|         /// </summary> | ||||
|         public string companyDesc { get; set; } | ||||
|  | ||||
|         public ServerVersion ServerVer  { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int  endTime { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public string createTime { get; set; } | ||||
|     } | ||||
|  | ||||
|     public class ServerVersion | ||||
|     { | ||||
|         public string Version { set; get; } | ||||
|         public string UpAddresss { set; get; } | ||||
|         public string UpTime { get; internal set; } | ||||
|         public string UpContent { get; internal set; } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										22
									
								
								XXCpzs/Models/BaseModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								XXCpzs/Models/BaseModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| namespace XXCpzs.Models | ||||
| { | ||||
|     public class BaseModel<T> | ||||
|     { | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int Code { get; set; } | ||||
|         /// <summary> | ||||
|         /// 产品使用已经到期!请上官网续费 | ||||
|         /// </summary> | ||||
|         public string Msg { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public T Data { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int Time { get; set; } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										45
									
								
								XXCpzs/Models/CauseItem.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								XXCpzs/Models/CauseItem.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
|  | ||||
| namespace XXCpzs.Models | ||||
| { | ||||
|     /// <summary> | ||||
|     /// 故障集合 | ||||
|     /// </summary> | ||||
|     public class CauseItem | ||||
|     { | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int id { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int companyId { get; set; } | ||||
|         /// <summary> | ||||
|         /// 再销 | ||||
|         /// </summary> | ||||
|         public string title { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int code { get; set; } | ||||
|         /// <summary> | ||||
|         /// 默认故障 | ||||
|         /// </summary> | ||||
|         public string content { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int type { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public string create_time { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public string update_time { get; set; } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										75
									
								
								XXCpzs/Models/CpzsPowers.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								XXCpzs/Models/CpzsPowers.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,75 @@ | ||||
| namespace XXCpzs.Models | ||||
| { | ||||
|     public class CpzsPowers | ||||
|     { | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int uid { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int companyId { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int departmentId { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public string lastdevice { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int kh { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int dd { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int cx { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int db { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int rc { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int cc { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int xs { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int rs { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int fx { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int hh { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int th { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public string create_time { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public string update_time { get; set; } | ||||
|     } | ||||
|  | ||||
| } | ||||
							
								
								
									
										14
									
								
								XXCpzs/Models/Customer.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								XXCpzs/Models/Customer.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
|  | ||||
| namespace XXCpzs.Models | ||||
| { | ||||
|     public class Customer | ||||
|     { | ||||
|         public string company { get; internal set; } | ||||
|         public string contacts { get; internal set; } | ||||
|         public int id { get; internal set; } | ||||
|         public string phone { get; internal set; } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										25
									
								
								XXCpzs/Models/DabaoBrands.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								XXCpzs/Models/DabaoBrands.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
|  | ||||
| namespace XXCpzs.Models | ||||
| { | ||||
|     /// <summary> | ||||
|     /// 打包供应商集合 | ||||
|     /// </summary> | ||||
|     public class DabaoBrands | ||||
|     { | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int id { get; set; } | ||||
|         /// <summary> | ||||
|         ///   | ||||
|         /// </summary> | ||||
|         public string name { get; set; } | ||||
|         /// <summary> | ||||
|         ///   | ||||
|         /// </summary> | ||||
|         public string company { get; set; } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										17
									
								
								XXCpzs/Models/DabaoTypes.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								XXCpzs/Models/DabaoTypes.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| namespace XXCpzs.Models | ||||
| { | ||||
|     /// <summary> | ||||
|     /// 打包 类型集合 | ||||
|     /// </summary> | ||||
|     public class DabaoTypes | ||||
|     { | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int id { get; set; } | ||||
|         /// <summary> | ||||
|         ///   | ||||
|         /// </summary> | ||||
|         public string name { get; set; } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										20
									
								
								XXCpzs/Models/HomeMenuItem.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								XXCpzs/Models/HomeMenuItem.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
|  | ||||
| namespace XXCpzs.Models | ||||
| { | ||||
|     public enum MenuItemType | ||||
|     { | ||||
|         Browse, | ||||
|         About,  | ||||
|         Upgrade, | ||||
|         CloseApp | ||||
|     } | ||||
|     public class HomeMenuItem | ||||
|     { | ||||
|         public MenuItemType Id { get; set; } | ||||
|  | ||||
|         public string Title { get; set; } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										11
									
								
								XXCpzs/Models/Item.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								XXCpzs/Models/Item.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| using System; | ||||
|  | ||||
| namespace XXCpzs.Models | ||||
| { | ||||
|     public class Item | ||||
|     { | ||||
|         public string Id { get; set; } | ||||
|         public string Text { get; set; } | ||||
|         public string Description { get; set; } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										26
									
								
								XXCpzs/Models/ListModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								XXCpzs/Models/ListModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| using System.Collections.Generic; | ||||
|  | ||||
| namespace XXCpzs.Models | ||||
| { | ||||
|     public class ListModel<T> | ||||
|     { | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int Code { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public string Msg { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public List<T> Data { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int Time { get; set; } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										13
									
								
								XXCpzs/Models/ResultModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								XXCpzs/Models/ResultModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
|  | ||||
| namespace XXCpzs.Models | ||||
| { | ||||
|     public class ResultModel | ||||
|     { | ||||
|         public int    Code { set; get; } | ||||
|         public string Data { set; get; } | ||||
|         public string Msg { set; get; } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										48
									
								
								XXCpzs/Models/UserInfo.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								XXCpzs/Models/UserInfo.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,48 @@ | ||||
| namespace XXCpzs.Models | ||||
| { | ||||
|     public class UserInfo | ||||
|     { | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int uid { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public string email { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public string mobile { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public string username { get; set; } | ||||
|         /// <summary> | ||||
|         /// 杨文西 | ||||
|         /// </summary> | ||||
|         public string realname { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int CompanyId { get; set; } | ||||
|         /// <summary> | ||||
|         /// 广州恒泰汽车传动科技有限公司 | ||||
|         /// </summary> | ||||
|         public string CompanyName { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int departmentId { get; set; } | ||||
|         /// <summary> | ||||
|         /// 开发部 | ||||
|         /// </summary> | ||||
|         public string departmentName { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public CpzsPowers CpzsPowers { get; set; } | ||||
|     } | ||||
|  | ||||
|  | ||||
| } | ||||
							
								
								
									
										84
									
								
								XXCpzs/Services/AzureDataStore.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								XXCpzs/Services/AzureDataStore.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,84 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Net.Http; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
| using Newtonsoft.Json; | ||||
| using Xamarin.Essentials; | ||||
| using XXCpzs.Models; | ||||
|  | ||||
| namespace XXCpzs.Services | ||||
| { | ||||
|     public class AzureDataStore : IDataStore<Item> | ||||
|     { | ||||
|         HttpClient client; | ||||
|         IEnumerable<Item> items; | ||||
|  | ||||
|         public AzureDataStore() | ||||
|         { | ||||
|             client = new HttpClient(); | ||||
|             client.BaseAddress = new Uri($"{App.AzureBackendUrl}/"); | ||||
|  | ||||
|             items = new List<Item>(); | ||||
|         } | ||||
|  | ||||
|         bool IsConnected => Connectivity.NetworkAccess == NetworkAccess.Internet; | ||||
|         public async Task<IEnumerable<Item>> GetItemsAsync(bool forceRefresh = false) | ||||
|         { | ||||
|             if (forceRefresh && IsConnected) | ||||
|             { | ||||
|                 var json = await client.GetStringAsync($"api/item"); | ||||
|                 items = await Task.Run(() => JsonConvert.DeserializeObject<IEnumerable<Item>>(json)); | ||||
|             } | ||||
|  | ||||
|             return items; | ||||
|         } | ||||
|  | ||||
|         public async Task<Item> GetItemAsync(string id) | ||||
|         { | ||||
|             if (id != null && IsConnected) | ||||
|             { | ||||
|                 var json = await client.GetStringAsync($"api/item/{id}"); | ||||
|                 return await Task.Run(() => JsonConvert.DeserializeObject<Item>(json)); | ||||
|             } | ||||
|  | ||||
|             return null; | ||||
|         } | ||||
|  | ||||
|         public async Task<bool> AddItemAsync(Item item) | ||||
|         { | ||||
|             if (item == null || !IsConnected) | ||||
|                 return false; | ||||
|  | ||||
|             var serializedItem = JsonConvert.SerializeObject(item); | ||||
|  | ||||
|             var response = await client.PostAsync($"api/item", new StringContent(serializedItem, Encoding.UTF8, "application/json")); | ||||
|  | ||||
|             return response.IsSuccessStatusCode; | ||||
|         } | ||||
|  | ||||
|         public async Task<bool> UpdateItemAsync(Item item) | ||||
|         { | ||||
|             if (item == null || item.Id == null || !IsConnected) | ||||
|                 return false; | ||||
|  | ||||
|             var serializedItem = JsonConvert.SerializeObject(item); | ||||
|             var buffer = Encoding.UTF8.GetBytes(serializedItem); | ||||
|             var byteContent = new ByteArrayContent(buffer); | ||||
|  | ||||
|             var response = await client.PutAsync(new Uri($"api/item/{item.Id}"), byteContent); | ||||
|  | ||||
|             return response.IsSuccessStatusCode; | ||||
|         } | ||||
|  | ||||
|         public async Task<bool> DeleteItemAsync(string id) | ||||
|         { | ||||
|             if (string.IsNullOrEmpty(id) && !IsConnected) | ||||
|                 return false; | ||||
|  | ||||
|             var response = await client.DeleteAsync($"api/item/{id}"); | ||||
|  | ||||
|             return response.IsSuccessStatusCode; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										25
									
								
								XXCpzs/Services/CustomerDataService.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								XXCpzs/Services/CustomerDataService.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using XXCpzs.Models; | ||||
|  | ||||
| namespace XXCpzs.Services | ||||
| { | ||||
|     public class CustomerDataService | ||||
|     { | ||||
|         public static List<Customer> Fruits { get; set; } = new List<Customer> | ||||
|         { | ||||
|  | ||||
|         }; | ||||
|  | ||||
|         public static List<Customer> GetSearchResults(string queryString) | ||||
|         { | ||||
|             var normalizedQuery = queryString?.ToLower() ?? ""; | ||||
|             return Fruits.Where<Customer>(f => f.company.ToLowerInvariant().Contains(normalizedQuery) || f.contacts.ToLowerInvariant().Contains(normalizedQuery) || f.phone.ToLowerInvariant().Contains(normalizedQuery)).ToList(); | ||||
|         } | ||||
|         public static void AddItem(Customer item) | ||||
|         { | ||||
|             Fruits.Add(item); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										15
									
								
								XXCpzs/Services/IDataStore.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								XXCpzs/Services/IDataStore.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| namespace XXCpzs.Services | ||||
| { | ||||
|     public interface IDataStore<T> | ||||
|     { | ||||
|         Task<bool> AddItemAsync(T item); | ||||
|         Task<bool> UpdateItemAsync(T item); | ||||
|         Task<bool> DeleteItemAsync(string id); | ||||
|         Task<T> GetItemAsync(string id); | ||||
|         Task<IEnumerable<T>> GetItemsAsync(bool forceRefresh = false); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										37
									
								
								XXCpzs/Services/IDeviceOrientationService.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								XXCpzs/Services/IDeviceOrientationService.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
| using Xamarin.Forms.Internals; | ||||
|  | ||||
| namespace XXCpzs.Services | ||||
| { | ||||
|     public enum DeviceOrientation | ||||
|     { | ||||
|         Undefined, | ||||
|         Landscape, | ||||
|         Portrait | ||||
|     } | ||||
|     public interface ICommonService | ||||
|     { | ||||
|         /// <summary> | ||||
|         /// 获取本地版本号 | ||||
|         /// </summary> | ||||
|         /// <returns></returns> | ||||
|         string GetVersion(); | ||||
|  | ||||
|         void CloseApp(); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 升级App | ||||
|         /// </summary> | ||||
|         /// <param name="DownloadUrl">升级地址</param> | ||||
|         void UpdateApp(string DownloadUrl); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 发送通知 | ||||
|         /// </summary> | ||||
|         /// <param name="title">标题</param> | ||||
|         /// <param name="content">内容</param> | ||||
|          void SendNotity(string title, string content); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										13
									
								
								XXCpzs/Services/INetworkConnection.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								XXCpzs/Services/INetworkConnection.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
|  | ||||
| namespace XXCpzs.Services | ||||
| { | ||||
|     public interface INetworkConnection | ||||
|     { | ||||
|         bool IsConnected { get; } | ||||
|         void CheckNetworkConnection(); | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								XXCpzs/Services/ITextToSpeechService.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								XXCpzs/Services/ITextToSpeechService.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| namespace XXCpzs.Services | ||||
| { | ||||
|     public interface ITextToSpeechService | ||||
|     { | ||||
|         Task SpeakAsync(string text); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										60
									
								
								XXCpzs/Services/MockDataStore.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								XXCpzs/Services/MockDataStore.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,60 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Threading.Tasks; | ||||
| using XXCpzs.Models; | ||||
|  | ||||
| namespace XXCpzs.Services | ||||
| { | ||||
|     public class MockDataStore : IDataStore<Item> | ||||
|     { | ||||
|         readonly List<Item> items; | ||||
|  | ||||
|         public MockDataStore() | ||||
|         { | ||||
|             items = new List<Item>() | ||||
|             { | ||||
|                 new Item { Id = Guid.NewGuid().ToString(), Text = "First item", Description="This is an item description." }, | ||||
|                 new Item { Id = Guid.NewGuid().ToString(), Text = "Second item", Description="This is an item description." }, | ||||
|                 new Item { Id = Guid.NewGuid().ToString(), Text = "Third item", Description="This is an item description." }, | ||||
|                 new Item { Id = Guid.NewGuid().ToString(), Text = "Fourth item", Description="This is an item description." }, | ||||
|                 new Item { Id = Guid.NewGuid().ToString(), Text = "Fifth item", Description="This is an item description." }, | ||||
|                 new Item { Id = Guid.NewGuid().ToString(), Text = "Sixth item", Description="This is an item description." } | ||||
|             }; | ||||
|         } | ||||
|  | ||||
|         public async Task<bool> AddItemAsync(Item item) | ||||
|         { | ||||
|             items.Add(item); | ||||
|  | ||||
|             return await Task.FromResult(true); | ||||
|         } | ||||
|  | ||||
|         public async Task<bool> UpdateItemAsync(Item item) | ||||
|         { | ||||
|             var oldItem = items.Where((Item arg) => arg.Id == item.Id).FirstOrDefault(); | ||||
|             items.Remove(oldItem); | ||||
|             items.Add(item); | ||||
|  | ||||
|             return await Task.FromResult(true); | ||||
|         } | ||||
|  | ||||
|         public async Task<bool> DeleteItemAsync(string id) | ||||
|         { | ||||
|             var oldItem = items.Where((Item arg) => arg.Id == id).FirstOrDefault(); | ||||
|             items.Remove(oldItem); | ||||
|  | ||||
|             return await Task.FromResult(true); | ||||
|         } | ||||
|  | ||||
|         public async Task<Item> GetItemAsync(string id) | ||||
|         { | ||||
|             return await Task.FromResult(items.FirstOrDefault(s => s.Id == id)); | ||||
|         } | ||||
|  | ||||
|         public async Task<IEnumerable<Item>> GetItemsAsync(bool forceRefresh = false) | ||||
|         { | ||||
|             return await Task.FromResult(items); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										18
									
								
								XXCpzs/ViewModels/AboutViewModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								XXCpzs/ViewModels/AboutViewModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| using System; | ||||
| using System.Windows.Input; | ||||
| using Xamarin.Essentials; | ||||
| using Xamarin.Forms; | ||||
|  | ||||
| namespace XXCpzs.ViewModels | ||||
| { | ||||
|     public class AboutViewModel : BaseViewModel | ||||
|     { | ||||
|         public AboutViewModel() | ||||
|         { | ||||
|             Title = "About"; | ||||
|             OpenWebCommand = new Command(async () => await Browser.OpenAsync("https://xamarin.com")); | ||||
|         } | ||||
|  | ||||
|         public ICommand OpenWebCommand { get; } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										15
									
								
								XXCpzs/ViewModels/AddCustomerModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								XXCpzs/ViewModels/AddCustomerModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
|  | ||||
| namespace XXCpzs.ViewModels | ||||
| { | ||||
|     class AddCustomerModel : BaseViewModel | ||||
|     { | ||||
|  | ||||
|         public AddCustomerModel(int Uid) | ||||
|         { | ||||
|             Title = "添加新的客户"; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										61
									
								
								XXCpzs/ViewModels/BaseViewModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								XXCpzs/ViewModels/BaseViewModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,61 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.ComponentModel; | ||||
| using System.Runtime.CompilerServices; | ||||
|  | ||||
| using Xamarin.Forms; | ||||
|  | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.Services; | ||||
|  | ||||
| namespace XXCpzs.ViewModels | ||||
| { | ||||
|     public class BaseViewModel : INotifyPropertyChanged | ||||
|     { | ||||
|         public IDataStore<Item> DataStore => DependencyService.Get<IDataStore<Item>>(); | ||||
|  | ||||
|         bool isBusy = false; | ||||
|         public bool IsBusy | ||||
|         { | ||||
|             get { return isBusy; } | ||||
|             set { SetProperty(ref isBusy, value); } | ||||
|         } | ||||
|  | ||||
|         string title = string.Empty; | ||||
|         public string Title | ||||
|         { | ||||
|             get { return title; } | ||||
|             set { SetProperty(ref title, value); } | ||||
|         } | ||||
|  | ||||
|         protected bool SetProperty<T>(ref T backingStore, T value, | ||||
|             [CallerMemberName]string propertyName = "", | ||||
|             Action onChanged = null) | ||||
|         { | ||||
|             if (EqualityComparer<T>.Default.Equals(backingStore, value)) | ||||
|                 return false; | ||||
|  | ||||
|             backingStore = value; | ||||
|             onChanged?.Invoke(); | ||||
|             OnPropertyChanged(propertyName); | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         #region INotifyPropertyChanged | ||||
|         public event PropertyChangedEventHandler PropertyChanged; | ||||
|         protected void OnPropertyChanged([CallerMemberName] string propertyName = "") | ||||
|         { | ||||
|             var changed = PropertyChanged; | ||||
|             if (changed == null) | ||||
|                 return; | ||||
|  | ||||
|             changed.Invoke(this, new PropertyChangedEventArgs(propertyName)); | ||||
|         } | ||||
|         #endregion | ||||
|  | ||||
|         protected void RaisePropertyChanged([CallerMemberName] string propertyName = "") | ||||
|         { | ||||
|             PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										10
									
								
								XXCpzs/ViewModels/ChaXunViewModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								XXCpzs/ViewModels/ChaXunViewModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| namespace XXCpzs.ViewModels | ||||
| { | ||||
|     class ChaXunViewModel : BaseViewModel | ||||
|     {   | ||||
|         public ChaXunViewModel( ) | ||||
|         { | ||||
|             Title = "产品查询";  | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										27
									
								
								XXCpzs/ViewModels/ChuCangViewModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								XXCpzs/ViewModels/ChuCangViewModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.ObjectModel; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.Models; | ||||
|  | ||||
| namespace XXCpzs.ViewModels | ||||
| { | ||||
|     class ChuCangViewModel : BaseViewModel | ||||
|     { | ||||
|         public ObservableCollection<DepartmentItem> CangKuItems { set; get; } = new ObservableCollection<DepartmentItem>(); | ||||
|         public ObservableCollection<ResultModel> Items { get; set; } | ||||
|         public ChuCangViewModel(UserInfo userInfo) | ||||
|         { | ||||
|             Title = "产品出仓登记"; | ||||
|             Items = new ObservableCollection<ResultModel>(); | ||||
|             Dictionary<string, string> _body = new Dictionary<string, string>{ | ||||
|                 { "companyId", userInfo.CompanyId.ToString()} | ||||
|             }; | ||||
|  | ||||
|             List<DepartmentItem> buMens = HttpHelper.RefreshData<DepartmentItem>(03, RestSharp.Method.POST, _body); | ||||
|             foreach (var item in buMens) | ||||
|             { | ||||
|                 CangKuItems.Add(item); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										14
									
								
								XXCpzs/ViewModels/CustomerViewModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								XXCpzs/ViewModels/CustomerViewModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
|  | ||||
| namespace XXCpzs.ViewModels | ||||
| { | ||||
|     class CustomerViewModel : BaseViewModel | ||||
|     { | ||||
|         public CustomerViewModel() | ||||
|         { | ||||
|             Title = "我的客户列表"; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										54
									
								
								XXCpzs/ViewModels/DabaoViewModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								XXCpzs/ViewModels/DabaoViewModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,54 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.ObjectModel; | ||||
| using System.Text; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.Models; | ||||
|  | ||||
| namespace XXCpzs.ViewModels | ||||
| { | ||||
|     class DabaoViewModel : BaseViewModel | ||||
|     { | ||||
|         private int Uid; | ||||
|  | ||||
|         public ObservableCollection<DabaoTypes> dabaoTypes { get; set; } | ||||
|  | ||||
|         public ObservableCollection<DabaoBrands> dabaoBrands { get; set; } | ||||
|  | ||||
|         public ObservableCollection<ResultModel> Items { get; set; } | ||||
|  | ||||
|         public DabaoViewModel(int uid) | ||||
|         { | ||||
|             this.Uid = uid; | ||||
|             Title = "产品入库"; | ||||
|             dabaoTypes = new ObservableCollection<DabaoTypes>(); | ||||
|             dabaoBrands = new ObservableCollection<DabaoBrands>(); | ||||
|             Items = new ObservableCollection<ResultModel>(); | ||||
|             Items.Add(new ResultModel { Code = 0, Data = "序列号", Msg = "提交结果" }); | ||||
|  | ||||
|             Dictionary<string, string> _body = new Dictionary<string, string>{ | ||||
|                 { "Uid", Uid.ToString() } | ||||
|             }; | ||||
|  | ||||
|             List<DabaoTypes> dt = HttpHelper.RefreshData<DabaoTypes>(07, RestSharp.Method.POST, _body); | ||||
|             if (dt != null) | ||||
|             { | ||||
|                 foreach (var item in dt) | ||||
|                 { | ||||
|                     dabaoTypes.Add(item); | ||||
|                 } | ||||
|             } | ||||
|             List<DabaoBrands> buMens = HttpHelper.RefreshData<DabaoBrands>(08, RestSharp.Method.POST, _body); | ||||
|             if (buMens != null) | ||||
|             { | ||||
|  | ||||
|                 foreach (var item in buMens) | ||||
|                 { | ||||
|                     dabaoBrands.Add(item); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|  | ||||
| } | ||||
							
								
								
									
										32
									
								
								XXCpzs/ViewModels/FanXiuViewModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								XXCpzs/ViewModels/FanXiuViewModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.ObjectModel; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.Models; | ||||
|  | ||||
| namespace XXCpzs.ViewModels | ||||
| { | ||||
|     class FanXiuViewModel : BaseViewModel | ||||
|     { | ||||
|         public ObservableCollection<CauseItem> CauseItems { set; get; } = new ObservableCollection<CauseItem>(); | ||||
|  | ||||
|         public ObservableCollection<ResultModel> Items { set; get; } | ||||
|         public FanXiuViewModel(int Uid) | ||||
|         { | ||||
|             Title = "产品返修登记"; | ||||
|             Items = new ObservableCollection<ResultModel> { }; | ||||
|             List<CauseItem> dt = HttpHelper.RefreshData<CauseItem>(17, | ||||
|                 RestSharp.Method.POST, | ||||
|                 new Dictionary<string, string>{ | ||||
|                 { "Uid", Uid.ToString() }, | ||||
|                 { "Type", "2" } | ||||
|             }); | ||||
|             if (dt != null) | ||||
|             { | ||||
|                 foreach (var item in dt) | ||||
|                 { | ||||
|                     CauseItems.Add(item); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										33
									
								
								XXCpzs/ViewModels/HuanHuoViewModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								XXCpzs/ViewModels/HuanHuoViewModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.ObjectModel; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.Models; | ||||
|  | ||||
| namespace XXCpzs.ViewModels | ||||
| { | ||||
|     class HuanHuoViewModel : BaseViewModel | ||||
|     { | ||||
|         public ObservableCollection<CauseItem> CauseItems { set; get; } = new ObservableCollection<CauseItem>(); | ||||
|  | ||||
|         public ObservableCollection<ResultModel> Items { set; get; } | ||||
|         public HuanHuoViewModel(int Uid) | ||||
|         { | ||||
|             Title = "产品换货登记"; | ||||
|             Items = new ObservableCollection<ResultModel> { }; | ||||
|             List<CauseItem> dt = HttpHelper.RefreshData<CauseItem>(17, | ||||
|                RestSharp.Method.POST, | ||||
|                new Dictionary<string, string>{ | ||||
|                 { "Uid", Uid.ToString() }, | ||||
|                 { "Type", "3" } | ||||
|             }); | ||||
|             if (dt != null) | ||||
|             { | ||||
|                 foreach (var item in dt) | ||||
|                 { | ||||
|                     CauseItems.Add(item); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
| } | ||||
							
								
								
									
										16
									
								
								XXCpzs/ViewModels/ItemDetailViewModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								XXCpzs/ViewModels/ItemDetailViewModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| using System; | ||||
|  | ||||
| using XXCpzs.Models; | ||||
|  | ||||
| namespace XXCpzs.ViewModels | ||||
| { | ||||
|     public class ItemDetailViewModel : BaseViewModel | ||||
|     { | ||||
|         public Item Item { get; set; } | ||||
|         public ItemDetailViewModel(Item item = null) | ||||
|         { | ||||
|             Title = item?.Text; | ||||
|             Item = item; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										61
									
								
								XXCpzs/ViewModels/LoginViewModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								XXCpzs/ViewModels/LoginViewModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,61 @@ | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.ObjectModel; | ||||
| using Xamarin.Forms; | ||||
| using XXCpzs.helper; | ||||
|  | ||||
| namespace XXCpzs.ViewModels | ||||
| { | ||||
|     class LoginViewModel : BaseViewModel | ||||
|     { | ||||
|  | ||||
|         public INavigation Navigation { get; set; } | ||||
|  | ||||
|         public ObservableCollection<DepartmentItem> BuMenItems1 { set; get; } = new ObservableCollection<DepartmentItem>(); | ||||
|         public ObservableCollection<DepartmentItem> BuMenItems | ||||
|         { | ||||
|             set { BuMenItems1 = value; } | ||||
|             get { return BuMenItems1; } | ||||
|         } | ||||
|  | ||||
|         public ObservableCollection<UserItem> UserItems1 { get; set; } = new ObservableCollection<UserItem>(); | ||||
|         public ObservableCollection<UserItem> UserItems | ||||
|         { | ||||
|             set { UserItems1 = value; } | ||||
|             get { return UserItems1; } | ||||
|         } | ||||
|         public LoginViewModel(int companyId) | ||||
|         { | ||||
|             Dictionary<string, string> _body = new Dictionary<string, string>{ | ||||
|                 { "companyId", companyId.ToString()} | ||||
|             }; | ||||
|             List<DepartmentItem> buMens = HttpHelper.RefreshData<DepartmentItem>(03, RestSharp.Method.POST, _body); | ||||
|             foreach (var item in buMens) | ||||
|             { | ||||
|                 BuMenItems.Add(item); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     public class UserItem | ||||
|     { | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int uid { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public string realname { get; set; } | ||||
|     } | ||||
|  | ||||
|     public class DepartmentItem | ||||
|     { | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public int id { get; set; } | ||||
|         /// <summary> | ||||
|         ///  | ||||
|         /// </summary> | ||||
|         public string title { get; set; } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										65
									
								
								XXCpzs/ViewModels/MainViewModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								XXCpzs/ViewModels/MainViewModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,65 @@ | ||||
| using Xamarin.Forms; | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.Views; | ||||
|  | ||||
| namespace XXCpzs.ViewModels | ||||
| { | ||||
|     class MainViewModel : BaseViewModel | ||||
|     { | ||||
|         public Command LoadItemsCommand { get; set; } | ||||
|         public AuthorizeItem Authorize { get; set; }  | ||||
|         string company = string.Empty; | ||||
|         public string CompanyName | ||||
|         { | ||||
|             set | ||||
|             { | ||||
|                 if (company != value) | ||||
|                 { | ||||
|                     company = value; | ||||
|                     RaisePropertyChanged(); | ||||
|                 } | ||||
|             } | ||||
|             get { return company; } | ||||
|  | ||||
|             //set { SetProperty(ref company, value); } | ||||
|         } | ||||
|         string department = string.Empty; | ||||
|         public string Department | ||||
|         { | ||||
|             get { return department; } | ||||
|  | ||||
|             set | ||||
|             { | ||||
|                 if (department != value) | ||||
|                 { | ||||
|                     department = value; | ||||
|                     OnPropertyChanged(nameof(Department)); | ||||
|                     //PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Department))); | ||||
|  | ||||
|                     //RaisePropertyChanged(); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         string userName = string.Empty; | ||||
|         private UserInfo userInfo; | ||||
|  | ||||
|         public string UserName | ||||
|         { | ||||
|             get { return userName; } | ||||
|             set | ||||
|             { | ||||
|                 if (userName != value) | ||||
|                 { | ||||
|                     userName = value; | ||||
|                     RaisePropertyChanged(); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         public MainViewModel() | ||||
|         { | ||||
|             Title = "产品追溯"; | ||||
|              | ||||
|  | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										19
									
								
								XXCpzs/ViewModels/OrderViewModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								XXCpzs/ViewModels/OrderViewModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.ObjectModel; | ||||
| using System.Text; | ||||
| using XXCpzs.Models; | ||||
|  | ||||
| namespace XXCpzs.ViewModels | ||||
| { | ||||
|     public class OrderViewModel : BaseViewModel | ||||
|     { | ||||
|         public ObservableCollection<ResultModel> Items { get; set; } | ||||
|         public OrderViewModel() | ||||
|         { | ||||
|             Title = "我的订单列表"; | ||||
|             Items = new ObservableCollection<ResultModel>(); | ||||
|             Items.Add(new ResultModel { Data = "序列号", Msg = "提交结果" }); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										30
									
								
								XXCpzs/ViewModels/RegisterViewModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								XXCpzs/ViewModels/RegisterViewModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.ObjectModel; | ||||
| using System.Text; | ||||
| using XXCpzs.helper; | ||||
|  | ||||
| namespace XXCpzs.ViewModels | ||||
| { | ||||
|     class RegisterViewModel : BaseViewModel | ||||
|     { | ||||
|         public ObservableCollection<DepartmentItem> BuMenItems1 { set; get; } = new ObservableCollection<DepartmentItem>(); | ||||
|         public ObservableCollection<DepartmentItem> BuMenItems | ||||
|         { | ||||
|             set { BuMenItems1 = value; } | ||||
|             get { return BuMenItems1; } | ||||
|         } | ||||
|         public RegisterViewModel(int companyId) | ||||
|         { | ||||
|             Title = "用户注册"; | ||||
|             Dictionary<string, string> _body = new Dictionary<string, string>{ | ||||
|                 { "companyId", companyId.ToString() } | ||||
|             }; | ||||
|             List<DepartmentItem> buMens = HttpHelper.RefreshData<DepartmentItem>(03, RestSharp.Method.POST, _body); | ||||
|             foreach (var item in buMens) | ||||
|             { | ||||
|                 BuMenItems.Add(item); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										35
									
								
								XXCpzs/ViewModels/ResaleViewModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								XXCpzs/ViewModels/ResaleViewModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.ObjectModel; | ||||
| using System.Text; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.Models; | ||||
|  | ||||
| namespace XXCpzs.ViewModels | ||||
| { | ||||
|     class ResaleViewModel : BaseViewModel | ||||
|     { | ||||
|  | ||||
|         public ObservableCollection<CauseItem> CauseItems { set; get; } = new ObservableCollection<CauseItem>(); | ||||
|  | ||||
|         public ObservableCollection<ResultModel> Items { set; get; } | ||||
|         public ResaleViewModel(int Uid) | ||||
|         { | ||||
|             Title = "产品再销申请"; | ||||
|             Items = new ObservableCollection<ResultModel> { }; | ||||
|             List<CauseItem> dt = HttpHelper.RefreshData<CauseItem>(17, | ||||
|                 RestSharp.Method.POST, | ||||
|                 new Dictionary<string, string>{ | ||||
|                 { "Uid", Uid.ToString() }, | ||||
|                 { "Type", "1" } | ||||
|             }); | ||||
|             if (dt != null) | ||||
|             { | ||||
|                 foreach (var item in dt) | ||||
|                 { | ||||
|                     CauseItems.Add(item); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										27
									
								
								XXCpzs/ViewModels/RuCangViewModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								XXCpzs/ViewModels/RuCangViewModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.ObjectModel; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.Models; | ||||
|  | ||||
| namespace XXCpzs.ViewModels | ||||
| { | ||||
|     class RuCangViewModel : BaseViewModel | ||||
|     { | ||||
|         public ObservableCollection<DepartmentItem> CangKuItems { set; get; } = new ObservableCollection<DepartmentItem>(); | ||||
|         public ObservableCollection<ResultModel> Items { get; set; } | ||||
|         public RuCangViewModel(UserInfo userInfo) | ||||
|         { | ||||
|             Title = "产品入仓登记"; | ||||
|             Items = new ObservableCollection<ResultModel>(); | ||||
|             Dictionary<string, string> _body = new Dictionary<string, string>{ | ||||
|                 { "companyId", userInfo.CompanyId.ToString()} | ||||
|             }; | ||||
|  | ||||
|             List<DepartmentItem> buMens = HttpHelper.RefreshData<DepartmentItem>(03, RestSharp.Method.POST, _body); | ||||
|             foreach (var item in buMens) | ||||
|             { | ||||
|                 CangKuItems.Add(item); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										38
									
								
								XXCpzs/ViewModels/SaleViewModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								XXCpzs/ViewModels/SaleViewModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.ObjectModel; | ||||
| using System.Text; | ||||
| using Xamarin.Forms; | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.Views; | ||||
|  | ||||
| namespace XXCpzs.ViewModels | ||||
| { | ||||
|     class SaleViewModel : BaseViewModel | ||||
|     { | ||||
|         public ObservableCollection<ResultModel> Items { set; get; } | ||||
|         string companyName = string.Empty; | ||||
|         public string CompanyName | ||||
|         { | ||||
|             get { return companyName; } | ||||
|             set { SetProperty(ref companyName, value); } | ||||
|         } | ||||
|  | ||||
|         public int CustomerId = 0; | ||||
|  | ||||
|         public SaleViewModel() | ||||
|         { | ||||
|             Title = "产品销售"; | ||||
|             Items = new ObservableCollection<ResultModel> | ||||
|             { | ||||
|                 new ResultModel { Data = "序列号", Msg = "提交结果" } | ||||
|             }; | ||||
|             MessagingCenter.Subscribe<PageCustomerSelect, Customer>(this, "SelectCustomer", async (obj, item) => | ||||
|             { | ||||
|                 var newItem = item as Customer; | ||||
|                 this.CompanyName = newItem.company + ">>" + newItem.contacts; | ||||
|                 this.CustomerId = newItem.id; | ||||
|             }); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										69
									
								
								XXCpzs/ViewModels/SearchViewModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								XXCpzs/ViewModels/SearchViewModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,69 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
| using System.Windows.Input; | ||||
| using Xamarin.Forms; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.Services; | ||||
| using XXCpzs.Views; | ||||
|  | ||||
| namespace XXCpzs.ViewModels | ||||
| { | ||||
|     class SearchViewModel : BaseViewModel | ||||
|     { | ||||
|  | ||||
|         public ICommand PerformSearch => new Command<string>((string query) => | ||||
|         { | ||||
|             SearchResults = CustomerDataService.GetSearchResults(query); | ||||
|         }); | ||||
|  | ||||
|         List<Customer> searchResults = CustomerDataService.Fruits; | ||||
|         public List<Customer> SearchResults | ||||
|         { | ||||
|             get | ||||
|             { | ||||
|                 return searchResults; | ||||
|             } | ||||
|             set | ||||
|             { | ||||
|                 searchResults = value; | ||||
|                 OnPropertyChanged(); | ||||
|                 //NotifyPropertyChanged(); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private int deviceId = 1; | ||||
|         private PageCustomerSelect pageCustomerSelect; | ||||
|  | ||||
|         public SearchViewModel(int Uid, PageCustomerSelect pageCustomerSelect)   | ||||
|         { | ||||
|             this.pageCustomerSelect = pageCustomerSelect; | ||||
|             Title = "客户选择"; | ||||
|             this.pageCustomerSelect = pageCustomerSelect; | ||||
|             var dt = HttpHelper.RefreshData<Customer>(15, | ||||
|                 RestSharp.Method.POST, | ||||
|                 new Dictionary<string, string>{ | ||||
|                 { "Uid", Uid.ToString() }, | ||||
|                 { "deviceId", deviceId.ToString() } | ||||
|             }); | ||||
|             if (dt != null) | ||||
|             { | ||||
|                 foreach (var item in dt) | ||||
|                 { | ||||
|                     CustomerDataService.Fruits.Add(item); | ||||
|                 } | ||||
|             } | ||||
|             MessagingCenter.Subscribe<PageAddCustomer, Customer>(this, "AddCustomer", async (obj, item) => | ||||
|             { | ||||
|                 var newItem = item as Customer; | ||||
|                 Console.WriteLine(">>>>>>>>>" + item.company); | ||||
|  | ||||
|                 CustomerDataService.AddItem(newItem); | ||||
|                 pageCustomerSelect.Refresh(); | ||||
|             }); | ||||
|  | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										34
									
								
								XXCpzs/ViewModels/TuiHuoViewModel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								XXCpzs/ViewModels/TuiHuoViewModel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.ObjectModel; | ||||
| using System.Text; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.Models; | ||||
|  | ||||
| namespace XXCpzs.ViewModels | ||||
| { | ||||
|     class TuiHuoViewModel : BaseViewModel | ||||
|     { | ||||
|         public ObservableCollection<CauseItem> CauseItems { set; get; } = new ObservableCollection<CauseItem>(); | ||||
|  | ||||
|         public ObservableCollection<ResultModel> Items { set; get; } | ||||
|         public TuiHuoViewModel(int Uid) | ||||
|         { | ||||
|             Title = "产品再销申请"; | ||||
|             Items = new ObservableCollection<ResultModel> { }; | ||||
|             List<CauseItem> dt = HttpHelper.RefreshData<CauseItem>(17, | ||||
|                 RestSharp.Method.POST, | ||||
|                 new Dictionary<string, string>{ | ||||
|                 { "Uid", Uid.ToString() }, | ||||
|                 { "Type", "4" } | ||||
|             }); | ||||
|             if (dt != null) | ||||
|             { | ||||
|                 foreach (var item in dt) | ||||
|                 { | ||||
|                     CauseItems.Add(item); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										81
									
								
								XXCpzs/Views/AboutPage.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								XXCpzs/Views/AboutPage.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,81 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
|              mc:Ignorable="d" | ||||
|              x:Class="XXCpzs.Views.AboutPage" | ||||
|              xmlns:vm="clr-namespace:XXCpzs.ViewModels" | ||||
|              Title="{Binding Title}"> | ||||
|      | ||||
|     <ContentPage.BindingContext> | ||||
|         <vm:AboutViewModel /> | ||||
|     </ContentPage.BindingContext> | ||||
|      | ||||
|     <ContentPage.Resources> | ||||
|         <ResourceDictionary> | ||||
|             <Color x:Key="Primary">#2196F3</Color> | ||||
|             <Color x:Key="Accent">#96d1ff</Color> | ||||
|             <Color x:Key="LightTextColor">#999999</Color> | ||||
|         </ResourceDictionary> | ||||
|     </ContentPage.Resources> | ||||
|  | ||||
|     <Grid> | ||||
|         <Grid.RowDefinitions> | ||||
|             <RowDefinition Height="Auto" /> | ||||
|             <RowDefinition Height="*" /> | ||||
|         </Grid.RowDefinitions> | ||||
|         <StackLayout BackgroundColor="{StaticResource Accent}" VerticalOptions="FillAndExpand" HorizontalOptions="Fill"> | ||||
|             <StackLayout Orientation="Horizontal" HorizontalOptions="Center" VerticalOptions="Center"> | ||||
|                 <ContentView Padding="0,40,0,40" VerticalOptions="FillAndExpand"> | ||||
|                     <Image Source="xamarin_logo.png" VerticalOptions="Center" HeightRequest="64" /> | ||||
|                 </ContentView> | ||||
|             </StackLayout> | ||||
|         </StackLayout> | ||||
|         <ScrollView Grid.Row="1"> | ||||
|             <StackLayout Orientation="Vertical" Padding="16,40,16,40" Spacing="10"> | ||||
|                 <Label FontSize="22"> | ||||
|                     <Label.FormattedText> | ||||
|                         <FormattedString> | ||||
|                             <FormattedString.Spans> | ||||
|                                 <Span Text="AppName" FontAttributes="Bold" FontSize="22" /> | ||||
|                                 <Span Text=" " /> | ||||
|                                 <Span Text="1.0" ForegroundColor="{StaticResource LightTextColor}" /> | ||||
|                             </FormattedString.Spans> | ||||
|                         </FormattedString> | ||||
|                     </Label.FormattedText> | ||||
|                 </Label> | ||||
|                 <Label> | ||||
|                     <Label.FormattedText> | ||||
|                         <FormattedString> | ||||
|                             <FormattedString.Spans> | ||||
|                                 <Span Text="This app is written in C# and native APIs using the" /> | ||||
|                                 <Span Text=" " /> | ||||
|                                 <Span Text="Xamarin Platform" FontAttributes="Bold" /> | ||||
|                                 <Span Text="." /> | ||||
|                             </FormattedString.Spans> | ||||
|                         </FormattedString> | ||||
|                     </Label.FormattedText> | ||||
|                 </Label> | ||||
|                 <Label> | ||||
|                     <Label.FormattedText> | ||||
|                         <FormattedString> | ||||
|                             <FormattedString.Spans> | ||||
|                                 <Span Text="It shares code with its" /> | ||||
|                                 <Span Text=" " /> | ||||
|                                 <Span Text="iOS, Android, and Windows" FontAttributes="Bold" /> | ||||
|                                 <Span Text=" " /> | ||||
|                                 <Span Text="versions." /> | ||||
|                             </FormattedString.Spans> | ||||
|                         </FormattedString> | ||||
|                     </Label.FormattedText> | ||||
|                 </Label> | ||||
|                 <Button Margin="0,10,0,0" Text="Learn more" | ||||
|                         Command="{Binding OpenWebCommand}" | ||||
|                         BackgroundColor="{StaticResource Primary}" | ||||
|                         TextColor="White" /> | ||||
|             </StackLayout> | ||||
|         </ScrollView> | ||||
|     </Grid> | ||||
|      | ||||
| </ContentPage> | ||||
							
								
								
									
										18
									
								
								XXCpzs/Views/AboutPage.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								XXCpzs/Views/AboutPage.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| using System; | ||||
| using System.ComponentModel; | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
|  | ||||
| namespace XXCpzs.Views | ||||
| { | ||||
|     // Learn more about making custom code visible in the Xamarin.Forms previewer | ||||
|     // by visiting https://aka.ms/xamarinforms-previewer | ||||
|     [DesignTimeVisible(false)] | ||||
|     public partial class AboutPage : ContentPage | ||||
|     { | ||||
|         public AboutPage() | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										26
									
								
								XXCpzs/Views/MainPage.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								XXCpzs/Views/MainPage.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|             xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
|             mc:Ignorable="d" | ||||
|             xmlns:views="clr-namespace:XXCpzs.Views" | ||||
|             x:Class="XXCpzs.Views.MainPage"> | ||||
|     <MasterDetailPage.Master> | ||||
|         <views:MenuPage /> | ||||
|     </MasterDetailPage.Master> | ||||
|  | ||||
|     <MasterDetailPage.Detail> | ||||
|         <NavigationPage> | ||||
|             <NavigationPage.Icon> | ||||
|                 <OnPlatform x:TypeArguments="FileImageSource"> | ||||
|                     <On Platform="iOS" Value="tab_feed.png"/> | ||||
|                 </OnPlatform> | ||||
|             </NavigationPage.Icon> | ||||
|             <x:Arguments> | ||||
|                 <views:PageMain /> | ||||
|             </x:Arguments> | ||||
|         </NavigationPage> | ||||
|     </MasterDetailPage.Detail> | ||||
|      | ||||
| </MasterDetailPage> | ||||
							
								
								
									
										98
									
								
								XXCpzs/Views/MainPage.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										98
									
								
								XXCpzs/Views/MainPage.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,98 @@ | ||||
| using RestSharp; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.ComponentModel; | ||||
| using System.Threading.Tasks; | ||||
| using System.Xml; | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
|  | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.Services; | ||||
|  | ||||
| namespace XXCpzs.Views | ||||
| { | ||||
|     [DesignTimeVisible(false)] | ||||
|     public partial class MainPage : MasterDetailPage | ||||
|     { | ||||
|         Dictionary<int, NavigationPage> MenuPages = new Dictionary<int, NavigationPage>(); | ||||
|         public MainPage() | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             MasterBehavior = MasterBehavior.Popover; | ||||
|             MenuPages.Add((int)MenuItemType.Browse, (NavigationPage)Detail); | ||||
|         } | ||||
|         public ServerVersion GetServerVer() | ||||
|         { | ||||
|             string version = "1.00"; | ||||
|             string upAddresss = null; | ||||
|             string upContent = null; | ||||
|             string upTime = null; | ||||
|             var client = new RestClient{ | ||||
|                 BaseUrl = new Uri("http://cpzs.xixingwl.cn/cpzs.php/index/update/t/Droid.html"), | ||||
|                 Timeout = 60000 | ||||
|             }; | ||||
|             var request = new RestRequest{ | ||||
|                 Timeout = 30000, | ||||
|                 Method = Method.POST | ||||
|             }; | ||||
|             request.AddHeader("Content-Type", "text/html,application/xhtml+xml,application/xml;q=0.9"); | ||||
|             request.AddHeader("Authorization", "Bearer123456"); | ||||
|             IRestResponse response2 = client.Execute(request); | ||||
|             if (response2.IsSuccessful){ | ||||
|                 XmlDocument sync = new XmlDocument(); | ||||
|                 sync.LoadXml(response2.Content.Trim()); | ||||
|                 XmlNode think = sync.SelectSingleNode("think"); | ||||
|                 version = think.SelectSingleNode("Version").InnerText; | ||||
|                 upAddresss = think.SelectSingleNode(" UpAddresss").InnerText; | ||||
|                 upContent  = think.SelectSingleNode(" UpContent").InnerText; | ||||
|                 upTime = think.SelectSingleNode(" UpTime").InnerText; | ||||
|             } | ||||
|             return new ServerVersion() { Version = version, UpAddresss = upAddresss ,UpContent = upContent, UpTime = upTime }; | ||||
|         } | ||||
|         public async Task NavigateFromMenu(int id) | ||||
|         { | ||||
|             if (!MenuPages.ContainsKey(id)) | ||||
|             { | ||||
|                 switch (id) | ||||
|                 { | ||||
|                     case (int)MenuItemType.Browse: | ||||
|                         MenuPages.Add(id, new NavigationPage(new PageMain())); | ||||
|                         break; | ||||
|                     case (int)MenuItemType.About: | ||||
|                         MenuPages.Add(id, new NavigationPage(new AboutPage())); | ||||
|                         break;  | ||||
|                     case (int)MenuItemType.Upgrade: | ||||
|                         // var ServerVer = GetServerVer(); | ||||
|                         //string LocaVer = DependencyService.Get<ICommonService>().GetVersion(); | ||||
|                         //if (int.Parse(ServerVer.Version)  > int.Parse(LocaVer)) | ||||
|                         //{ | ||||
|                         //    bool answer = await DisplayAlert("检测到新的版本", "是否立即更新?" + ServerVer.Version, "Yes", "No"); | ||||
|                         //    if (answer) | ||||
|                         //    { | ||||
|                         //       DependencyService.Get<ICommonService>().UpdateApp(ServerVer.UpAddresss); | ||||
|                         //   } | ||||
|                         //} | ||||
|                         break; | ||||
|                     case (int)MenuItemType.CloseApp: | ||||
|                         DependencyService.Get<ICommonService>().CloseApp(); | ||||
|                         break; | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             var newPage = MenuPages[id]; | ||||
|  | ||||
|             if (newPage != null && Detail != newPage) | ||||
|             { | ||||
|                 Detail = newPage; | ||||
|  | ||||
|                 if (Device.RuntimePlatform == Device.Android) | ||||
|                     await Task.Delay(100); | ||||
|  | ||||
|                 IsPresented = false; | ||||
|             } | ||||
|         } | ||||
|           | ||||
|     } | ||||
|    | ||||
| } | ||||
							
								
								
									
										31
									
								
								XXCpzs/Views/MenuPage.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								XXCpzs/Views/MenuPage.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
|              mc:Ignorable="d" | ||||
|              x:Class="XXCpzs.Views.MenuPage" | ||||
|              Title="Menu"> | ||||
|               | ||||
|     <StackLayout VerticalOptions="FillAndExpand"> | ||||
|         <ListView x:Name="ListViewMenu" | ||||
|                     HasUnevenRows="True"> | ||||
|             <d:ListView.ItemsSource> | ||||
|                 <x:Array Type="{x:Type x:String}"> | ||||
|                     <x:String>Item 1</x:String> | ||||
|                     <x:String>Item 2</x:String> | ||||
|                 </x:Array> | ||||
|             </d:ListView.ItemsSource> | ||||
|             <ListView.ItemTemplate> | ||||
|                 <DataTemplate> | ||||
|                     <ViewCell> | ||||
|                         <Grid Padding="10"> | ||||
|                             <Label Text="{Binding Title}" d:Text="{Binding .}" FontSize="20"/> | ||||
|                         </Grid> | ||||
|                     </ViewCell> | ||||
|                 </DataTemplate> | ||||
|             </ListView.ItemTemplate> | ||||
|         </ListView> | ||||
|     </StackLayout> | ||||
|  | ||||
| </ContentPage> | ||||
							
								
								
									
										42
									
								
								XXCpzs/Views/MenuPage.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								XXCpzs/Views/MenuPage.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | ||||
| using XXCpzs.Models; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.ComponentModel; | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
|  | ||||
| namespace XXCpzs.Views | ||||
| { | ||||
|     // Learn more about making custom code visible in the Xamarin.Forms previewer | ||||
|     // by visiting https://aka.ms/xamarinforms-previewer | ||||
|     [DesignTimeVisible(false)] | ||||
|     public partial class MenuPage : ContentPage | ||||
|     { | ||||
|         MainPage RootPage { get => Application.Current.MainPage as MainPage; } | ||||
|         List<HomeMenuItem> menuItems; | ||||
|         public MenuPage() | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|  | ||||
|             menuItems = new List<HomeMenuItem> | ||||
|             { | ||||
|                 new HomeMenuItem {Id = MenuItemType.Browse, Title="主页" }, | ||||
|                 new HomeMenuItem {Id = MenuItemType.About, Title="关于" }, | ||||
|                 new HomeMenuItem {Id = MenuItemType.Upgrade, Title="升级检测" } , | ||||
|                 new HomeMenuItem {Id = MenuItemType.CloseApp, Title="退出APP" } | ||||
|             }; | ||||
|  | ||||
|             ListViewMenu.ItemsSource = menuItems; | ||||
|  | ||||
|             ListViewMenu.SelectedItem = menuItems[0]; | ||||
|             ListViewMenu.ItemSelected += async (sender, e) => | ||||
|             { | ||||
|                 if (e.SelectedItem == null) | ||||
|                     return; | ||||
|  | ||||
|                 var id = (int)((HomeMenuItem)e.SelectedItem).Id; | ||||
|                 await RootPage.NavigateFromMenu(id); | ||||
|             }; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										38
									
								
								XXCpzs/Views/PageAddCustomer.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								XXCpzs/Views/PageAddCustomer.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
|              mc:Ignorable="d" | ||||
|              Title="{Binding Title}" | ||||
|              x:Class="XXCpzs.Views.PageAddCustomer"> | ||||
|     <ContentPage.Content> | ||||
|         <StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray"> | ||||
|                 <Label Text="  公司:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor x:Name="Company" HorizontalOptions="FillAndExpand" FontSize="25"/> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray"> | ||||
|                 <Label Text="联系人:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor x:Name="Contacts" HorizontalOptions="FillAndExpand" FontSize="25"/> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray"> | ||||
|                 <Label Text="电话:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor x:Name="Phone" HorizontalOptions="FillAndExpand" FontSize="25"/> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray"> | ||||
|                 <Label Text="邮件:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor x:Name="Email" HorizontalOptions="FillAndExpand" FontSize="25"/> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray"> | ||||
|                 <Label Text="地址:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor x:Name="Address" HorizontalOptions="FillAndExpand" FontSize="25"/> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray"> | ||||
|                 <Label Text="备注:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor x:Name="Note" HorizontalOptions="FillAndExpand" FontSize="25"/> | ||||
|             </StackLayout> | ||||
|             <Button Text="立即添加" VerticalOptions="EndAndExpand" Clicked="Button_Clicked"/> | ||||
|         </StackLayout> | ||||
|     </ContentPage.Content> | ||||
| </ContentPage> | ||||
							
								
								
									
										69
									
								
								XXCpzs/Views/PageAddCustomer.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								XXCpzs/Views/PageAddCustomer.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,69 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
|  | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.ViewModels; | ||||
|  | ||||
| namespace XXCpzs.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
|     public partial class PageAddCustomer : ContentPage | ||||
|     { | ||||
|         //id	uid	companyId	departmentId	diviceId	contacts	phone	email	address	company	note	create_time	update_time | ||||
|         private AddCustomerModel ViewModel; | ||||
|         private UserInfo userInfo; | ||||
|         private int DeviceId = 1; | ||||
|         public PageAddCustomer(UserInfo userInfo) | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             this.userInfo = userInfo; | ||||
|             this.BindingContext = ViewModel = new AddCustomerModel(userInfo.uid); | ||||
|         } | ||||
|  | ||||
|         private async void Button_Clicked(object sender, EventArgs e) | ||||
|         { | ||||
|  | ||||
|             if (Company.Text == null) | ||||
|             { | ||||
|                 await DisplayAlert("提示:", "客户企业名不能为空!", "确定"); | ||||
|                 return; | ||||
|             } | ||||
|             if (Contacts.Text == null) | ||||
|             { | ||||
|                 await DisplayAlert("提示:", "客户联系人不能为空!", "确定"); | ||||
|                 return; | ||||
|             } | ||||
|             if (Phone.Text == null) | ||||
|             { | ||||
|                 await DisplayAlert("提示:", "客户电话不能为空!", "确定"); | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
|             bool response = await DisplayAlert("提示:", "确认添加?", "Yes", "No"); | ||||
|             if (response) | ||||
|             { | ||||
|                 var request = HttpHelper.Refresh<Customer>("addcustomer", | ||||
|                     new Dictionary<string, string>{ | ||||
|                             {"Uid", userInfo.uid.ToString()}, | ||||
|                             {"Company", Company.Text.Trim()}, | ||||
|                             {"Contacts",Contacts.Text.Trim()}, | ||||
|                             {"Phone", Phone.Text.Trim()}, | ||||
|                             {"Email", Email.Text}, | ||||
|                             {"Address", Address.Text}, | ||||
|                             {"Note", Note.Text}, | ||||
|                             {"deviceId", this.DeviceId.ToString()} | ||||
|                     }); | ||||
|                 if (request.Code != 0) | ||||
|                 { | ||||
|  | ||||
|                     MessagingCenter.Send(this, "AddCustomer", request.Data as Customer); | ||||
|                     await Navigation.PopModalAsync(); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										124
									
								
								XXCpzs/Views/PageChaXun.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										124
									
								
								XXCpzs/Views/PageChaXun.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,124 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
|              mc:Ignorable="d" | ||||
|              Title="{Binding Title}" | ||||
|              x:Class="XXCpzs.Views.PageChaXun"> | ||||
|     <ContentPage.Content> | ||||
|         <ScrollView> | ||||
|             <StackLayout Spacing="0" Padding="0" BackgroundColor="GreenYellow"> | ||||
|                 <StackLayout Orientation="Horizontal" HeightRequest="50" BackgroundColor="White" Padding="5"> | ||||
|                     <StackLayout Spacing="0" Orientation="Horizontal" HorizontalOptions="Start"> | ||||
|                         <BoxView BackgroundColor="Black" WidthRequest="40" HeightRequest="40"  HorizontalOptions="StartAndExpand" VerticalOptions="Center" /> | ||||
|                         <Label FontSize="14" TextColor="Black" Text="Accent Color" HorizontalOptions="StartAndExpand" VerticalOptions="Center" /> | ||||
|                     </StackLayout> | ||||
|                     <StackLayout Spacing="0" BackgroundColor="White" Orientation="Horizontal" HorizontalOptions="EndAndExpand"> | ||||
|                         <BoxView BackgroundColor="Maroon" WidthRequest="40" HeightRequest="40" HorizontalOptions="Start" VerticalOptions="Center" /> | ||||
|                         <Label FontSize="14" TextColor="Black" Text="Primary Color" HorizontalOptions="StartAndExpand" VerticalOptions="Center" /> | ||||
|                     </StackLayout> | ||||
|                 </StackLayout> | ||||
|                 <StackLayout Orientation="Vertical"  BackgroundColor="Silver" Padding="5"> | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <Label FontSize="14" Text="S  N  码:" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100" /> | ||||
|                         <Entry HorizontalOptions="FillAndExpand" Text="35"   /> | ||||
|                     </StackLayout> | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <Label FontSize="14" Text="供应商家:"  | ||||
|                         HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100" /> | ||||
|                         <Entry HorizontalOptions="FillAndExpand" Text="Xamarin.Forms"/> | ||||
|                     </StackLayout> | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <Label FontSize="14" Text="产品名称:"  | ||||
|                         HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100"/> | ||||
|                         <Entry HorizontalOptions="FillAndExpand" Text="Xamarin, C#, .NET, Mono..."/> | ||||
|                     </StackLayout> | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <Label FontSize="14" Text="保修时长:" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100" /> | ||||
|                         <Entry HorizontalOptions="FillAndExpand" Text="35"   /> | ||||
|                     </StackLayout> | ||||
|                 </StackLayout> | ||||
|                 <StackLayout Orientation="Vertical"  BackgroundColor="White" Padding="5"> | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <Label FontSize="14" Text="入库时间:"  HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100" /> | ||||
|                         <Entry HorizontalOptions="FillAndExpand" Text="Xamarin.Forms"/> | ||||
|                     </StackLayout> | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <Label FontSize="14" Text="入库人员:"  | ||||
|                         HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100"/> | ||||
|                         <Entry HorizontalOptions="FillAndExpand" Text="Xamarin, C#, .NET, Mono..."/> | ||||
|                     </StackLayout> | ||||
|                 </StackLayout> | ||||
|                 <StackLayout Orientation="Vertical"  BackgroundColor="Silver" Padding="5"> | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <Label FontSize="14" Text="入仓时间:" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100" /> | ||||
|                         <Entry HorizontalOptions="FillAndExpand" Text="35"   /> | ||||
|                     </StackLayout> | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <Label FontSize="14" Text="入仓人员:"  | ||||
|                         HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100" /> | ||||
|                         <Entry HorizontalOptions="FillAndExpand" Text="Xamarin.Forms"/> | ||||
|                     </StackLayout> | ||||
|                 </StackLayout> | ||||
|                 <StackLayout Orientation="Vertical"  BackgroundColor="White" Padding="5"> | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <Label FontSize="14" Text="出仓日期:"  | ||||
|                         HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100"/> | ||||
|                         <Entry HorizontalOptions="FillAndExpand" Text="Xamarin, C#, .NET, Mono..."/> | ||||
|                     </StackLayout> | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <Label FontSize="14" Text="出仓人员:" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100" /> | ||||
|                         <Entry HorizontalOptions="FillAndExpand" Text="35"   /> | ||||
|                     </StackLayout> | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <Label FontSize="14" Text="出仓目标:"  | ||||
|                         HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100" /> | ||||
|                         <Entry HorizontalOptions="FillAndExpand" Text="Xamarin.Forms"/> | ||||
|                     </StackLayout> | ||||
|                 </StackLayout> | ||||
|                 <StackLayout Orientation="Vertical"  BackgroundColor="Silver" Padding="5"> | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <Label FontSize="14" Text="销售日期:"  | ||||
|                         HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100"/> | ||||
|                         <Entry HorizontalOptions="FillAndExpand" Text="Xamarin, C#, .NET, Mono..."/> | ||||
|                     </StackLayout> | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <Label FontSize="14" Text="销售人员:" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100" /> | ||||
|                         <Entry HorizontalOptions="FillAndExpand" Text="35"   /> | ||||
|                     </StackLayout> | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <Label FontSize="14" Text="购买客户:"  | ||||
|                         HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100" /> | ||||
|                         <Entry HorizontalOptions="FillAndExpand" Text="Xamarin.Forms"/> | ||||
|                     </StackLayout> | ||||
|  | ||||
|                 </StackLayout> | ||||
|                 <StackLayout Orientation="Vertical"  BackgroundColor="White" Padding="5"> | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <Label FontSize="14" Text="返修日期:"  | ||||
|                 HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100"/> | ||||
|                         <Entry HorizontalOptions="FillAndExpand" Text="Xamarin, C#, .NET, Mono..."/> | ||||
|                     </StackLayout> | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <Label FontSize="14" Text="返修人员:"  | ||||
|                 HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100"/> | ||||
|                         <Entry HorizontalOptions="FillAndExpand" Text="Xamarin, C#, .NET, Mono..."/> | ||||
|                     </StackLayout> | ||||
|                 </StackLayout> | ||||
|                 <StackLayout Orientation="Vertical"  BackgroundColor="Silver" Padding="5"> | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <Label FontSize="14" Text="换货日期:"  | ||||
|                 HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100"/> | ||||
|                         <Entry HorizontalOptions="FillAndExpand" Text="Xamarin, C#, .NET, Mono..."/> | ||||
|                     </StackLayout> | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <Label FontSize="14" Text="换货人员:"  | ||||
|                 HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100"/> | ||||
|                         <Entry HorizontalOptions="FillAndExpand" Text="Xamarin, C#, .NET, Mono..."/> | ||||
|                     </StackLayout> | ||||
|                 </StackLayout> | ||||
|             </StackLayout> | ||||
|         </ScrollView> | ||||
|     </ContentPage.Content> | ||||
| </ContentPage> | ||||
							
								
								
									
										21
									
								
								XXCpzs/Views/PageChaXun.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								XXCpzs/Views/PageChaXun.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
|  | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.ViewModels; | ||||
|  | ||||
| namespace XXCpzs.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
|     public partial class PageChaXun : ContentPage | ||||
|     { | ||||
|         private ChaXunViewModel ViewModel; | ||||
|         private  PageMain pageMain; | ||||
|  | ||||
|         public PageChaXun(UserInfo userInfo ) | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             this.BindingContext = ViewModel = new ChaXunViewModel(); | ||||
|         }  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										84
									
								
								XXCpzs/Views/PageChuCang.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								XXCpzs/Views/PageChuCang.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,84 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
|              mc:Ignorable="d" | ||||
|              Title="{Binding Title}" | ||||
|              x:Class="XXCpzs.Views.PageChuCang"> | ||||
|     <ContentPage.Content> | ||||
|         <StackLayout  Orientation="Vertical"> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray"> | ||||
|                 <Label Text="  序 列 号:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor  x:Name="SerialNumber" HorizontalOptions="FillAndExpand" /> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="Gray"> | ||||
|                 <Label Text="发货目标:" VerticalTextAlignment="Center" HorizontalOptions="Start" FontSize="25"/> | ||||
|                 <Picker x:Name="BrandPicker" | ||||
|                     ItemsSource="{Binding CangKuItems}" | ||||
|                     FontSize="20" | ||||
|                     ItemDisplayBinding="{Binding title}" | ||||
|                     Title="请选择发货目标" | ||||
|                     HorizontalOptions="FillAndExpand" | ||||
|                     SelectedIndexChanged="OnBumenPickerSelectedIndexChangedAsync" | ||||
|                     TitleColor="Red"> | ||||
|                 </Picker> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="Gray"> | ||||
|                 <Label Text="备注:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor x:Name="NewSerialNumber" HorizontalOptions="FillAndExpand" FontSize="25"/> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" VerticalOptions="FillAndExpand" BackgroundColor="SlateGray"> | ||||
|                 <ListView BackgroundColor="GreenYellow" | ||||
|                         ItemsSource="{Binding Items , Mode=OneWay}" | ||||
|                         VerticalOptions="FillAndExpand" | ||||
|                         HasUnevenRows="true" | ||||
|                         IsPullToRefreshEnabled="true" | ||||
|                         IsRefreshing="{Binding IsBusy, Mode=OneWay}" | ||||
|                         CachingStrategy="RecycleElement" > | ||||
|                     <ListView.Header> | ||||
|  | ||||
|                         <StackLayout Padding="10" Orientation="Horizontal"> | ||||
|                             <Label Text="ID" HorizontalOptions="Start" | ||||
|                                 LineBreakMode="NoWrap"    | ||||
|                                 FontSize="16" /> | ||||
|                             <Label Text="序列号"  HorizontalOptions="CenterAndExpand" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 FontSize="13" /> | ||||
|                             <Label Text="提交结果" HorizontalOptions="EndAndExpand" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 FontSize="13" /> | ||||
|                         </StackLayout> | ||||
|                     </ListView.Header> | ||||
|                     <ListView.ItemTemplate> | ||||
|  | ||||
|                         <DataTemplate> | ||||
|                             <ViewCell> | ||||
|                                 <StackLayout Padding="10" Orientation="Horizontal"> | ||||
|                                     <Label Text="{Binding Code}" HorizontalOptions="Start" | ||||
|                                 LineBreakMode="NoWrap"  d:Text="ID" | ||||
|                                 Style="{DynamicResource  ListItemTextStyle}"  | ||||
|                                 FontSize="16" /> | ||||
|                                     <Label Text="{Binding Data}"  HorizontalOptions="CenterAndExpand" | ||||
|                                 d:Text="序列号" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                                 FontSize="13" /> | ||||
|                                     <Label Text="{Binding Msg}" HorizontalOptions="EndAndExpand" | ||||
|                                 d:Text="提交结果" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                                 FontSize="13" /> | ||||
|                                 </StackLayout> | ||||
|                             </ViewCell> | ||||
|                         </DataTemplate> | ||||
|                     </ListView.ItemTemplate> | ||||
|                 </ListView> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" VerticalOptions="End" BackgroundColor="Gray"> | ||||
|                 <Button Text="提  交" HorizontalOptions="FillAndExpand" Clicked="Button_ClickedAsync"/> | ||||
|                 <Button Text="扫码提交" HorizontalOptions="FillAndExpand" Clicked="OnScan"/> | ||||
|             </StackLayout> | ||||
|         </StackLayout> | ||||
|     </ContentPage.Content> | ||||
| </ContentPage> | ||||
							
								
								
									
										90
									
								
								XXCpzs/Views/PageChuCang.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								XXCpzs/Views/PageChuCang.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,90 @@ | ||||
| using Plugin.Permissions; | ||||
| using Plugin.Permissions.Abstractions; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.ViewModels; | ||||
| using ZXing.Mobile; | ||||
|  | ||||
| namespace XXCpzs.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
|     public partial class PageChuCang : ContentPage | ||||
|     { | ||||
|         ChuCangViewModel ViewModel; | ||||
|         private int Uid = 0; | ||||
|         private int MubiaoId = 0; | ||||
|         private int deviceId = 1; | ||||
|         private UserInfo userInfo; | ||||
|         public PageChuCang(UserInfo userInfo) | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             this.Uid = userInfo.uid; | ||||
|             this.userInfo = userInfo; | ||||
|             this.BindingContext = ViewModel = new ChuCangViewModel(userInfo); | ||||
|         } | ||||
|  | ||||
|         void OnBumenPickerSelectedIndexChangedAsync(object sender, EventArgs e) | ||||
|         { | ||||
|             var picker = (Picker)sender; | ||||
|             int selectedIndex = picker.SelectedIndex; | ||||
|             if (selectedIndex != -1) | ||||
|             { | ||||
|                 MubiaoId = ViewModel.CangKuItems[selectedIndex].id; | ||||
|  | ||||
|             } | ||||
|         } | ||||
|         private async void Button_ClickedAsync(object sender, EventArgs e) | ||||
|         { | ||||
|             if (this.MubiaoId == 0) | ||||
|             { | ||||
|                 await DisplayAlert("注意", "请选择产品要发往的目的地", "OK"); return; | ||||
|             } | ||||
|             if (Uid != 0 && SerialNumber.Text != string.Empty) | ||||
|             { | ||||
|                 Dictionary<string, string> _body = new Dictionary<string, string>{ | ||||
|                     {"Sn", SerialNumber.Text}, | ||||
|                     {"Uid", this.Uid.ToString()}, | ||||
|                     {"MubiaoId", this.MubiaoId.ToString()}, | ||||
|                     {"deviceId", this.deviceId.ToString()} | ||||
|                 }; | ||||
|                 var request = await HttpHelper.RequestPost(12, _body); | ||||
|                 if (request.Code == 200){ | ||||
|                     ViewModel.Items.Add(new ResultModel() { Code = request.Code, Data = request.Data, Msg = request.Msg }); | ||||
|                 } | ||||
|                 else{ | ||||
|                     await DisplayAlert("访问出错", request.Msg, "OK"); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         private async void OnScan(object sender, EventArgs e) | ||||
|         { | ||||
|             if (await CheckPerssion()) | ||||
|             { | ||||
|                 var scanner = new MobileBarcodeScanner(); | ||||
|                 var result = await scanner.Scan(); | ||||
|                 if (result != null) | ||||
|                 { | ||||
|                     SerialNumber.Text = result.Text; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         private async Task<bool> CheckPerssion() | ||||
|         { | ||||
|             var current = CrossPermissions.Current; | ||||
|             //检查权限 | ||||
|             var status = await current.CheckPermissionStatusAsync(Permission.Camera); | ||||
|             if (status != PermissionStatus.Granted) | ||||
|             { | ||||
|                 var result = await current.RequestPermissionsAsync(Permission.Camera); | ||||
|                 status = result[Permission.Camera]; | ||||
|             } | ||||
|             return status == PermissionStatus.Granted; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										30
									
								
								XXCpzs/Views/PageCustomer.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								XXCpzs/Views/PageCustomer.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
|              mc:Ignorable="d" | ||||
|              Title="{Binding Title}" | ||||
|              x:Class="XXCpzs.Views.PageCustomer"> | ||||
|     <ContentPage.Content> | ||||
|         <StackLayout> | ||||
|             <ListView x:Name="ContextDemoList" VerticalOptions="FillAndExpand" BackgroundColor="SeaGreen"> | ||||
|                 <ListView.ItemTemplate> | ||||
|                     <DataTemplate> | ||||
|                         <ViewCell> | ||||
|                             <ViewCell.ContextActions> | ||||
|                                 <MenuItem Clicked="OnMore" CommandParameter="{Binding .}" Text="More" /> | ||||
|                                 <MenuItem Clicked="OnDelete" CommandParameter="{Binding .}" Text="Delete" IsDestructive="True" /> | ||||
|                             </ViewCell.ContextActions> | ||||
|                             <StackLayout Padding="15,0"> | ||||
|                                 <Label Text="{Binding title}" /> | ||||
|                                 <Label Text="{Binding title}" /> | ||||
|                                 <Label Text="{Binding title}" /> | ||||
|                             </StackLayout> | ||||
|                         </ViewCell> | ||||
|                     </DataTemplate> | ||||
|                 </ListView.ItemTemplate> | ||||
|             </ListView> | ||||
|         </StackLayout> | ||||
|     </ContentPage.Content> | ||||
| </ContentPage> | ||||
							
								
								
									
										35
									
								
								XXCpzs/Views/PageCustomer.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								XXCpzs/Views/PageCustomer.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | ||||
| using System; | ||||
|  | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.ViewModels; | ||||
|  | ||||
| namespace XXCpzs.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
|     public partial class PageCustomer : ContentPage | ||||
|     { | ||||
|         private CustomerViewModel ViewModel; | ||||
|  | ||||
|         public PageCustomer(UserInfo userInfo) | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             this.BindingContext = ViewModel = new CustomerViewModel(); | ||||
|         } | ||||
|  | ||||
|  | ||||
|  | ||||
|         public void OnMore(object sender, EventArgs e) | ||||
|         { | ||||
|             var mi = ((MenuItem)sender); | ||||
|             DisplayAlert("More Context Action", mi.CommandParameter + " more context action", "OK"); | ||||
|         } | ||||
|  | ||||
|         public void OnDelete(object sender, EventArgs e) | ||||
|         { | ||||
|             var mi = ((MenuItem)sender); | ||||
|             DisplayAlert("Delete Context Action", mi.CommandParameter + " delete context action", "OK"); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										57
									
								
								XXCpzs/Views/PageCustomerSelect.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								XXCpzs/Views/PageCustomerSelect.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,57 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
|              mc:Ignorable="d" | ||||
|              Title="{Binding Title}" | ||||
|              x:Class="XXCpzs.Views.PageCustomerSelect"> | ||||
|     <ContentPage.Content> | ||||
|         <StackLayout> | ||||
|             <SearchBar x:Name="searchBar" | ||||
|                    HorizontalOptions="Fill" | ||||
|                    VerticalOptions="CenterAndExpand" | ||||
|                    Placeholder="Search fruits..." | ||||
|                    CancelButtonColor="Orange" | ||||
|                    HorizontalTextAlignment="Start" | ||||
|                    TextChanged="OnTextChanged"/> | ||||
|             <ListView x:Name="searchResults" | ||||
|                   HorizontalOptions="Fill" | ||||
|                   VerticalOptions="CenterAndExpand" | ||||
|                    ItemSelected="searchResults_ItemSelectedAsync"> | ||||
|                 <ListView.Header> | ||||
|                     <StackLayout Orientation="Horizontal"> | ||||
|                         <Label Text="企业名" HorizontalOptions="Start" /> | ||||
|                         <Label Text="联系人"  HorizontalOptions="CenterAndExpand"/> | ||||
|                         <Label Text="电话"  HorizontalOptions="CenterAndExpand"/> | ||||
|                     </StackLayout> | ||||
|                 </ListView.Header> | ||||
|                 <ListView.ItemTemplate> | ||||
|                     <DataTemplate> | ||||
|                         <ViewCell> | ||||
|                             <StackLayout Padding="10" Orientation="Horizontal"> | ||||
|                                 <Label Text="{Binding company}" HorizontalOptions="Start" | ||||
|                                 LineBreakMode="NoWrap"  | ||||
|                                 Style="{DynamicResource  ListItemTextStyle}"  | ||||
|                                 FontSize="16" /> | ||||
|                                 <Label Text="{Binding contacts}"  HorizontalOptions="CenterAndExpand" | ||||
|                                 d:Text="Item descripton" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                                 FontSize="13" /> | ||||
|                                 <Label Text="{Binding  phone}" HorizontalOptions="End" | ||||
|                                 d:Text="Item descripton" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                                 FontSize="13" /> | ||||
|                             </StackLayout> | ||||
|                         </ViewCell> | ||||
|                     </DataTemplate> | ||||
|                 </ListView.ItemTemplate> | ||||
|  | ||||
|             </ListView> | ||||
|  | ||||
|             <Button Text="添加" Clicked="Button_Clicked" VerticalOptions="EndAndExpand"/> | ||||
|         </StackLayout> | ||||
|     </ContentPage.Content> | ||||
| </ContentPage> | ||||
							
								
								
									
										59
									
								
								XXCpzs/Views/PageCustomerSelect.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								XXCpzs/Views/PageCustomerSelect.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,59 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.Services; | ||||
| using XXCpzs.ViewModels; | ||||
|  | ||||
| namespace XXCpzs.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
|     public partial class PageCustomerSelect : ContentPage | ||||
|     { | ||||
|         SearchViewModel ViewModel; | ||||
|         private UserInfo userInfo; | ||||
|  | ||||
|  | ||||
|         public PageCustomerSelect(UserInfo userInfo) | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             this.userInfo = userInfo; | ||||
|             this.BindingContext = ViewModel = new SearchViewModel(userInfo.uid, this); | ||||
|             searchResults.ItemsSource = CustomerDataService.GetSearchResults(searchBar.Text); | ||||
|         } | ||||
|  | ||||
|         void OnTextChanged(object sender, TextChangedEventArgs e) | ||||
|         { | ||||
|             searchResults.ItemsSource = CustomerDataService.GetSearchResults(e.NewTextValue); | ||||
|         } | ||||
|  | ||||
|         private async void searchResults_ItemSelectedAsync(object sender, SelectedItemChangedEventArgs e) | ||||
|         { | ||||
|  | ||||
|             if (e.SelectedItem != null) | ||||
|             { | ||||
|                 Customer customer = e.SelectedItem as Customer; | ||||
|                 bool response = await DisplayAlert("Item Selected", customer.company, "Yes", "No"); | ||||
|                 if (response) | ||||
|                 { | ||||
|                     MessagingCenter.Send(this, "SelectCustomer", customer); | ||||
|                     await Navigation.PopModalAsync(); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         private async void Button_Clicked(object sender, EventArgs e) | ||||
|         { | ||||
|             await Navigation.PushModalAsync(new NavigationPage(new PageAddCustomer(userInfo))); | ||||
|         } | ||||
|  | ||||
|         public void Refresh() | ||||
|         { | ||||
|             searchResults.ItemsSource = CustomerDataService.GetSearchResults(searchBar.Text); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										79
									
								
								XXCpzs/Views/PageDaBao.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								XXCpzs/Views/PageDaBao.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,79 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
|              mc:Ignorable="d" | ||||
|              Title="{Binding Title}" | ||||
|              x:Class="XXCpzs.Views.PageDaBao"> | ||||
|     <ContentPage.Content> | ||||
|         <Grid> | ||||
|             <Grid.RowDefinitions> | ||||
|                 <RowDefinition Height="50" /> | ||||
|                 <RowDefinition Height="50" /> | ||||
|                 <RowDefinition Height="50" /> | ||||
|                 <RowDefinition Height="50" /> | ||||
|                 <RowDefinition Height="Auto" /> | ||||
|                 <RowDefinition Height="50" /> | ||||
|             </Grid.RowDefinitions> | ||||
|             <Grid.ColumnDefinitions> | ||||
|                 <ColumnDefinition Width="Auto" /> | ||||
|                 <ColumnDefinition /> | ||||
|             </Grid.ColumnDefinitions> | ||||
|             <Label Text="产品名:" VerticalTextAlignment="Center" FontSize="25" Grid.Column="0" Grid.Row="0" /> | ||||
|             <Picker x:Name="TypePicker" | ||||
|                 ItemsSource="{Binding dabaoTypes}" | ||||
|                 ItemDisplayBinding="{Binding name}" | ||||
|                 Title="请选择产品名称" | ||||
|                 SelectedIndexChanged="TypePicker_SelectedIndexChanged" | ||||
|                 FontSize="20" | ||||
|                 TitleColor="Red" | ||||
|                 Grid.Column="1" Grid.Row="0"> | ||||
|             </Picker> | ||||
|             <Label Text="供应商:" VerticalTextAlignment="Center" FontSize="25" Grid.Column="0" Grid.Row="1"/> | ||||
|             <Picker x:Name="BrandPicker" Grid.Column="1" Grid.Row="1" | ||||
|                 ItemsSource="{Binding dabaoBrands}" | ||||
|                 FontSize="20" | ||||
|                 ItemDisplayBinding="{Binding company}" | ||||
|                 Title="请选择供应商" | ||||
|                 SelectedIndexChanged="BrandPicker_SelectedIndexChanged" | ||||
|                 TitleColor="Red"> | ||||
|             </Picker> | ||||
|             <Label Text="序列号:" VerticalTextAlignment="Center" FontSize="25" Grid.Column="0" Grid.Row="2" /> | ||||
|             <Editor Grid.Column="1" x:Name="SerialNumber" FontSize="25" Grid.Row="2"/> | ||||
|             <ListView Grid.Column="0" Grid.Row="3" Grid.RowSpan="2"  Grid.ColumnSpan="2" | ||||
|                         BackgroundColor="GreenYellow" | ||||
|                         ItemsSource="{Binding Items , Mode=OneWay}" | ||||
|                         VerticalOptions="FillAndExpand" | ||||
|                         HasUnevenRows="true" | ||||
|                         IsPullToRefreshEnabled="true" | ||||
|                         IsRefreshing="{Binding IsBusy, Mode=OneWay}" | ||||
|                         CachingStrategy="RecycleElement"> | ||||
|                 <ListView.ItemTemplate> | ||||
|                     <DataTemplate> | ||||
|                         <ViewCell> | ||||
|                             <StackLayout Padding="10" Orientation="Horizontal"> | ||||
|                                 <Label Text="{Binding Code}" HorizontalOptions="Start" | ||||
|                                 LineBreakMode="NoWrap"  | ||||
|                                 Style="{DynamicResource  ListItemTextStyle}"  | ||||
|                                 FontSize="16" /> | ||||
|                                 <Label Text="{Binding Data}"  HorizontalOptions="CenterAndExpand" | ||||
|                                 d:Text="Item descripton" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                                 FontSize="13" /> | ||||
|                                 <Label Text="{Binding Msg}" HorizontalOptions="EndAndExpand" | ||||
|                                 d:Text="Item descripton" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                                 FontSize="13" /> | ||||
|                             </StackLayout> | ||||
|                         </ViewCell> | ||||
|                     </DataTemplate> | ||||
|                 </ListView.ItemTemplate> | ||||
|             </ListView> | ||||
|             <Button Text="提交" Grid.Column="0" Grid.Row="5" Clicked="Button_Clicked"/> | ||||
|             <Button Text="扫描二维码" Grid.Column="1" Grid.Row="5" Clicked="OnScan"/> | ||||
|         </Grid> | ||||
|     </ContentPage.Content> | ||||
| </ContentPage> | ||||
							
								
								
									
										115
									
								
								XXCpzs/Views/PageDaBao.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										115
									
								
								XXCpzs/Views/PageDaBao.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,115 @@ | ||||
| using Plugin.Permissions; | ||||
| using Plugin.Permissions.Abstractions; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Threading.Tasks; | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.ViewModels; | ||||
| using ZXing.Mobile; | ||||
|  | ||||
| namespace XXCpzs.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
|     public partial class PageDaBao : ContentPage | ||||
|     { | ||||
|         DabaoViewModel ViewModel; | ||||
|         private int BrandId = 0; | ||||
|         private int TypeId = 0; | ||||
|         private int Uid = 0; | ||||
|         private int deviceId = 1; | ||||
|         private UserInfo userInfo; | ||||
|  | ||||
|         public PageDaBao(UserInfo userInfo) | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             this.Uid = userInfo.uid; | ||||
|             this.userInfo = userInfo; | ||||
|             this.BindingContext = ViewModel = new DabaoViewModel(Uid); | ||||
|         } | ||||
|  | ||||
|         private void TypePicker_SelectedIndexChanged(object sender, EventArgs e) | ||||
|         { | ||||
|             var picker = (Picker)sender; | ||||
|             int selectedIndex = picker.SelectedIndex; | ||||
|             if (selectedIndex != -1) | ||||
|             { | ||||
|                 TypeId = ViewModel.dabaoTypes[selectedIndex].id; | ||||
|             } | ||||
|  | ||||
|         } | ||||
|  | ||||
|         private void BrandPicker_SelectedIndexChanged(object sender, EventArgs e) | ||||
|         { | ||||
|             var picker = (Picker)sender; | ||||
|             int selectedIndex = picker.SelectedIndex; | ||||
|             if (selectedIndex != -1) | ||||
|             { | ||||
|                 BrandId = ViewModel.dabaoBrands[selectedIndex].id; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private async void Button_Clicked(object sender, EventArgs e) | ||||
|         { | ||||
|             if (BrandId != 0 && TypeId != 0 && Uid != 0 && SerialNumber.Text != string.Empty) | ||||
|             { | ||||
|                 Dictionary<string, string> _body = new Dictionary<string, string>{ | ||||
|                     {"Sn", SerialNumber.Text}, | ||||
|                     {"typeId",this.TypeId.ToString() }, | ||||
|                     {"brandId", this.BrandId.ToString() }, | ||||
|                     {"Uid", this.Uid.ToString()}, | ||||
|                     {"deviceId", this.deviceId.ToString()} | ||||
|                 }; | ||||
|                 var request = await HttpHelper.RequestPost(09, _body); | ||||
|                 if (request.Code == 200) | ||||
|                 { | ||||
|                     ViewModel.Items.Add(new ResultModel() { Code = request.Code, Data = request.Data, Msg = request.Msg }); | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     await DisplayAlert("访问出错", request.Msg, "OK"); | ||||
|                     //Button_ClickedAsync(sender, e); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         private async void OnScan(object sender, EventArgs e) | ||||
|         { | ||||
|             if (this.BrandId == 0 ) | ||||
|             { | ||||
|                 await DisplayAlert("注意","请选择产品供应商", "OK"); return; | ||||
|             } | ||||
|  | ||||
|             if ( this.TypeId == 0) | ||||
|             { | ||||
|                 await DisplayAlert("访问出错", "请选择产品名称", "OK"); return; | ||||
|             } | ||||
|  | ||||
|             if (await CheckPerssion()) | ||||
|             { | ||||
|                 var scanner = new MobileBarcodeScanner(); | ||||
|                 var result = await scanner.Scan(); | ||||
|                 if (result != null) | ||||
|                 { | ||||
|                     SerialNumber.Text = result.Text; | ||||
|                     Button_Clicked(sender, e); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private async Task<bool> CheckPerssion() | ||||
|         { | ||||
|             var current = CrossPermissions.Current; | ||||
|             //检查权限 | ||||
|             var status = await current.CheckPermissionStatusAsync(Permission.Camera); | ||||
|             if (status != PermissionStatus.Granted) | ||||
|             { | ||||
|                 var result = await current.RequestPermissionsAsync(Permission.Camera); | ||||
|                 status = result[Permission.Camera]; | ||||
|             } | ||||
|             return status == PermissionStatus.Granted; | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										67
									
								
								XXCpzs/Views/PageFanXiu.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								XXCpzs/Views/PageFanXiu.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,67 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
|              mc:Ignorable="d" | ||||
|              Title="{Binding Title}" | ||||
|              x:Class="XXCpzs.Views.PageFanXiu"> | ||||
|     <ContentPage.Content> | ||||
|         <StackLayout  Orientation="Vertical"> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray"> | ||||
|                 <Label Text="序列号:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor  x:Name="SerialNumber" HorizontalOptions="FillAndExpand" /> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="Gray"> | ||||
|                 <Label Text="再销原因:" VerticalTextAlignment="Center" HorizontalOptions="Start" FontSize="25" Grid.Column="0" Grid.Row="1"/> | ||||
|                 <Picker x:Name="BrandPicker" FontSize="20" | ||||
|                     ItemsSource="{Binding CauseItems}" | ||||
|                     ItemDisplayBinding="{Binding title}" | ||||
|                     SelectedIndexChanged="OnCauseSelectedIndexChangedAsync" | ||||
|                     Title="默认原因" | ||||
|                     HorizontalOptions="FillAndExpand" | ||||
|                     TitleColor="Red"> | ||||
|                 </Picker> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray"> | ||||
|                 <Label Text="备注:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor  x:Name="Note" HorizontalOptions="FillAndExpand" FontSize="25"/> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" VerticalOptions="FillAndExpand" BackgroundColor="Gray"> | ||||
|                 <ListView ItemsSource="{Binding Items , Mode=OneWay}" | ||||
|                         VerticalOptions="FillAndExpand" | ||||
|                         HasUnevenRows="true" | ||||
|                         IsPullToRefreshEnabled="true" | ||||
|                         IsRefreshing="{Binding IsBusy, Mode=OneWay}" | ||||
|                         CachingStrategy="RecycleElement"> | ||||
|                     <ListView.ItemTemplate> | ||||
|                         <DataTemplate> | ||||
|                             <ViewCell> | ||||
|                                 <StackLayout Padding="10" Orientation="Horizontal"> | ||||
|                                     <Label Text="{Binding Code}" HorizontalOptions="Start" | ||||
|                                 LineBreakMode="NoWrap"  | ||||
|                                 Style="{DynamicResource  ListItemTextStyle}"  | ||||
|                                 FontSize="16" /> | ||||
|                                     <Label Text="{Binding Data}"  HorizontalOptions="CenterAndExpand" | ||||
|                                 d:Text="Item descripton" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                                 FontSize="13" /> | ||||
|                                     <Label Text="{Binding Msg}" HorizontalOptions="EndAndExpand" | ||||
|                                 d:Text="Item descripton" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                                 FontSize="13" /> | ||||
|                                 </StackLayout> | ||||
|                             </ViewCell> | ||||
|                         </DataTemplate> | ||||
|                     </ListView.ItemTemplate> | ||||
|                 </ListView> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" VerticalOptions="End" BackgroundColor="SlateGray"> | ||||
|                 <Button Text="提交" HorizontalOptions="FillAndExpand" Clicked="Button_ClickedAsync"/> | ||||
|                 <Button Text="扫码提交" HorizontalOptions="FillAndExpand" Clicked="OnScan"/> | ||||
|             </StackLayout> | ||||
|         </StackLayout> | ||||
|     </ContentPage.Content> | ||||
| </ContentPage> | ||||
							
								
								
									
										93
									
								
								XXCpzs/Views/PageFanXiu.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								XXCpzs/Views/PageFanXiu.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,93 @@ | ||||
| using Plugin.Permissions; | ||||
| using Plugin.Permissions.Abstractions; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.ViewModels; | ||||
| using ZXing.Mobile; | ||||
|  | ||||
| namespace XXCpzs.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
|     public partial class PageFanXiu : ContentPage | ||||
|     { | ||||
|         private FanXiuViewModel ViewModel; | ||||
|         private int CauseId = 1; | ||||
|         private UserInfo userInfo; | ||||
|         private int DeviceId = 1; | ||||
|  | ||||
|         public PageFanXiu(UserInfo userInfo) | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             this.userInfo = userInfo; | ||||
|             this.BindingContext = ViewModel = new FanXiuViewModel(userInfo.uid); | ||||
|         } | ||||
|  | ||||
|         void OnCauseSelectedIndexChangedAsync(object sender, EventArgs e) | ||||
|         { | ||||
|             var picker = (Picker)sender; | ||||
|             int selectedIndex = picker.SelectedIndex; | ||||
|             if (selectedIndex != -1) | ||||
|             { | ||||
|                 CauseId = ViewModel.CauseItems[selectedIndex].id; | ||||
|  | ||||
|             } | ||||
|         } | ||||
|         private async void Button_ClickedAsync(object sender, EventArgs e) | ||||
|         { | ||||
|             if (this.CauseId == 0) | ||||
|             { | ||||
|                 await DisplayAlert("注意", "请选择产品 返修的原因 ", "OK"); return; | ||||
|             } | ||||
|             if (userInfo != null  && SerialNumber.Text != null) | ||||
|             { | ||||
|                 var request = await HttpHelper.RequestPost(19, | ||||
|                     new Dictionary<string, string>{ | ||||
|                     {"Sn", SerialNumber.Text}, | ||||
|                     {"Uid", userInfo.uid.ToString()}, | ||||
|                     {"CauseId", CauseId.ToString()}, | ||||
|                     {"deviceId", this.DeviceId.ToString()} | ||||
|                     }); | ||||
|                 if (request.Code == 200) | ||||
|                 { | ||||
|                     ViewModel.Items.Add(new ResultModel() { Code = request.Code, Data = request.Data, Msg = request.Msg }); | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     await DisplayAlert("访问出错", request.Msg, "OK"); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         private async void OnScan(object sender, EventArgs e) | ||||
|         { | ||||
|              | ||||
|             if (await CheckPerssion()) | ||||
|             { | ||||
|                 var scanner = new MobileBarcodeScanner(); | ||||
|                 var result = await scanner.Scan(); | ||||
|                 if (result != null) | ||||
|                 { | ||||
|                     SerialNumber.Text = result.Text; | ||||
|                     Button_ClickedAsync(sender, e); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         private async Task<bool> CheckPerssion() | ||||
|         { | ||||
|             var current = CrossPermissions.Current; | ||||
|             //检查权限 | ||||
|             var status = await current.CheckPermissionStatusAsync(Permission.Camera); | ||||
|             if (status != PermissionStatus.Granted) | ||||
|             { | ||||
|                 var result = await current.RequestPermissionsAsync(Permission.Camera); | ||||
|                 status = result[Permission.Camera]; | ||||
|             } | ||||
|             return status == PermissionStatus.Granted; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										71
									
								
								XXCpzs/Views/PageHuanHuo.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								XXCpzs/Views/PageHuanHuo.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,71 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"  | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
|              mc:Ignorable="d" | ||||
|              x:Class="XXCpzs.Views.PageHuanHuo"> | ||||
|     <ContentPage.Content> | ||||
|         <StackLayout  Orientation="Vertical"> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray"> | ||||
|                 <Label Text="序列号:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor  x:Name="SerialNumber" HorizontalOptions="FillAndExpand" /> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray"> | ||||
|                 <Label Text="新序列号:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor  x:Name="NewSerialNumber" HorizontalOptions="FillAndExpand" /> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="Gray"> | ||||
|                 <Label Text="再销原因:" VerticalTextAlignment="Center" HorizontalOptions="Start" FontSize="25" Grid.Column="0" Grid.Row="1"/> | ||||
|                 <Picker x:Name="BrandPicker" FontSize="20" | ||||
|                     ItemsSource="{Binding CauseItems}" | ||||
|                     ItemDisplayBinding="{Binding title}" | ||||
|                     SelectedIndexChanged="OnCauseSelectedIndexChangedAsync" | ||||
|                     Title="默认原因" | ||||
|                     HorizontalOptions="FillAndExpand" | ||||
|                     TitleColor="Red"> | ||||
|                 </Picker> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray"> | ||||
|                 <Label Text="备注:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor  x:Name="Note" HorizontalOptions="FillAndExpand" FontSize="25"/> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" VerticalOptions="FillAndExpand" BackgroundColor="Gray"> | ||||
|                 <ListView ItemsSource="{Binding Items , Mode=OneWay}" | ||||
|                         VerticalOptions="FillAndExpand" | ||||
|                         HasUnevenRows="true" | ||||
|                         IsPullToRefreshEnabled="true" | ||||
|                         IsRefreshing="{Binding IsBusy, Mode=OneWay}" | ||||
|                         CachingStrategy="RecycleElement"> | ||||
|                     <ListView.ItemTemplate> | ||||
|                         <DataTemplate> | ||||
|                             <ViewCell> | ||||
|                                 <StackLayout Padding="10" Orientation="Horizontal"> | ||||
|                                     <Label Text="{Binding Code}" HorizontalOptions="Start" | ||||
|                                 LineBreakMode="NoWrap"  | ||||
|                                 Style="{DynamicResource  ListItemTextStyle}"  | ||||
|                                 FontSize="16" /> | ||||
|                                     <Label Text="{Binding Data}"  HorizontalOptions="CenterAndExpand" | ||||
|                                 d:Text="Item descripton" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                                 FontSize="13" /> | ||||
|                                     <Label Text="{Binding Msg}" HorizontalOptions="EndAndExpand" | ||||
|                                 d:Text="Item descripton" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                                 FontSize="13" /> | ||||
|                                 </StackLayout> | ||||
|                             </ViewCell> | ||||
|                         </DataTemplate> | ||||
|                     </ListView.ItemTemplate> | ||||
|                 </ListView> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" VerticalOptions="End" BackgroundColor="SlateGray"> | ||||
|                 <Button Text="提交" HorizontalOptions="FillAndExpand" Clicked="Button_ClickedAsync"/> | ||||
|                 <Button Text="扫码提交" HorizontalOptions="FillAndExpand" Clicked="OnScan"/> | ||||
|                 <Button Text="扫码提交" HorizontalOptions="FillAndExpand" Clicked="OnScan1"/> | ||||
|             </StackLayout> | ||||
|         </StackLayout> | ||||
|     </ContentPage.Content> | ||||
| </ContentPage> | ||||
							
								
								
									
										103
									
								
								XXCpzs/Views/PageHuanHuo.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										103
									
								
								XXCpzs/Views/PageHuanHuo.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,103 @@ | ||||
| using Plugin.Permissions; | ||||
| using Plugin.Permissions.Abstractions; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Threading.Tasks; | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.ViewModels; | ||||
| using ZXing.Mobile; | ||||
|  | ||||
| namespace XXCpzs.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
|     public partial class PageHuanHuo : ContentPage | ||||
|     { | ||||
|  | ||||
|         private HuanHuoViewModel ViewModel; | ||||
|         private int CauseId = 1; | ||||
|         private UserInfo userInfo; | ||||
|         private int DeviceId = 1; | ||||
|         public PageHuanHuo(UserInfo userInfo) | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             this.userInfo = userInfo; | ||||
|             this.BindingContext = ViewModel = new HuanHuoViewModel(userInfo.uid); | ||||
|         } | ||||
|  | ||||
|         private void OnCauseSelectedIndexChangedAsync(object sender, EventArgs e) | ||||
|         { | ||||
|             var picker = (Picker)sender; | ||||
|             int selectedIndex = picker.SelectedIndex; | ||||
|             if (selectedIndex != -1) | ||||
|             { | ||||
|                 CauseId = ViewModel.CauseItems[selectedIndex].id; | ||||
|  | ||||
|             } | ||||
|         } | ||||
|         private async void Button_ClickedAsync(object sender, EventArgs e) | ||||
|         { | ||||
|             if (this.CauseId == 0) | ||||
|             { | ||||
|                 await DisplayAlert("注意", "请选择产品 换货 的原因", "OK"); return; | ||||
|             } | ||||
|             if (userInfo == null && userInfo.uid != 0 && SerialNumber.Text != string.Empty && NewSerialNumber.Text != string.Empty) | ||||
|             { | ||||
|                 var request = await HttpHelper.RequestPost(20, | ||||
|                     new Dictionary<string, string>{ | ||||
|                     {"Sn", SerialNumber.Text}, | ||||
|                     {"NewSn", NewSerialNumber.Text}, | ||||
|                     {"Uid", userInfo.uid.ToString()}, | ||||
|                     {"CauseId", CauseId.ToString()}, | ||||
|                     {"deviceId", this.DeviceId.ToString()} | ||||
|                 });  | ||||
|                 if (request.Code == 200) | ||||
|                 { | ||||
|                     ViewModel.Items.Add(new ResultModel() { Code = request.Code, Data = request.Data, Msg = request.Msg }); | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     await DisplayAlert("访问出错", request.Msg, "OK"); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         private async void OnScan(object sender, EventArgs e) | ||||
|         { | ||||
|             if (await CheckPerssion()) | ||||
|             { | ||||
|                 var scanner = new MobileBarcodeScanner(); | ||||
|                 var result = await scanner.Scan(); | ||||
|                 if (result != null) | ||||
|                 { | ||||
|                     SerialNumber.Text = result.Text; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         private async void OnScan1(object sender, EventArgs e) | ||||
|         { | ||||
|             if (await CheckPerssion()) | ||||
|             { | ||||
|                 var scanner = new MobileBarcodeScanner(); | ||||
|                 var result = await scanner.Scan(); | ||||
|                 if (result != null) | ||||
|                 { | ||||
|                     NewSerialNumber.Text = result.Text; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         private async Task<bool> CheckPerssion() | ||||
|         { | ||||
|             var current = CrossPermissions.Current; | ||||
|             //检查权限 | ||||
|             var status = await current.CheckPermissionStatusAsync(Permission.Camera); | ||||
|             if (status != PermissionStatus.Granted) | ||||
|             { | ||||
|                 var result = await current.RequestPermissionsAsync(Permission.Camera); | ||||
|                 status = result[Permission.Camera]; | ||||
|             } | ||||
|             return status == PermissionStatus.Granted; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										62
									
								
								XXCpzs/Views/PageLogin.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								XXCpzs/Views/PageLogin.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,62 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <pages:PopupPage | ||||
|     xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"  | ||||
|     xmlns:animations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup" | ||||
|     xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|     xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|     xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
|     mc:Ignorable="d" | ||||
|     x:Class="XXCpzs.Views.PageLogin"> | ||||
|     <pages:PopupPage.Resources> | ||||
|         <ResourceDictionary> | ||||
|             <Color x:Key="Primary">#2196F3</Color> | ||||
|         </ResourceDictionary> | ||||
|     </pages:PopupPage.Resources> | ||||
|     <pages:PopupPage.Animation> | ||||
|         <animations:ScaleAnimation DurationIn="400" | ||||
|                                    DurationOut="300" | ||||
|                                    EasingIn="SinOut" | ||||
|                                    EasingOut="SinIn" | ||||
|                                    HasBackgroundAnimation="True" | ||||
|                                    PositionIn="Center" | ||||
|                                    PositionOut="Center" | ||||
|                                    ScaleIn="1.2" | ||||
|                                    ScaleOut="0.8" /> | ||||
|     </pages:PopupPage.Animation> | ||||
|     <Frame CornerRadius="20" BackgroundColor="White" VerticalOptions="Center" Margin="40,20" HeightRequest="400"> | ||||
|         <StackLayout > | ||||
|             <Label Text="部门:" VerticalOptions="CenterAndExpand" /> | ||||
|             <Picker x:Name="BumenPicker"  | ||||
|                 ItemDisplayBinding="{Binding title}" | ||||
|                 ItemsSource="{Binding BuMenItems}"  | ||||
|                 Title="Select a monkey" | ||||
|                 SelectedIndexChanged="OnBumenPickerSelectedIndexChangedAsync" | ||||
|                 TitleColor="Red" /> | ||||
|             <Label Text="用户名:" VerticalOptions="CenterAndExpand" /> | ||||
|             <Picker x:Name="UserPicker" | ||||
|                 ItemDisplayBinding="{Binding realname}" | ||||
|                 ItemsSource="{Binding UserItems}" | ||||
|                 Title="Select a User Name" | ||||
|                 TitleColor="Red" | ||||
|                 SelectedIndexChanged="UserPicker_SelectedIndexChanged"/> | ||||
|  | ||||
|             <Label Text="密码:" IsEnabled="False" VerticalOptions="CenterAndExpand" /> | ||||
|             <Entry x:Name="UserPass" Placeholder="" IsPassword="True" /> | ||||
|             <StackLayout Orientation="Horizontal"> | ||||
|                 <Label Text="记住密码?"  HorizontalOptions ="StartAndExpand" /> | ||||
|                 <Switch IsToggled="false"  HorizontalOptions="EndAndExpand" /> | ||||
|             </StackLayout> | ||||
|             <Label Text="{Binding ValidateMsg}" TextColor="Red" HorizontalOptions="Center"/> | ||||
|             <Button Margin="0,10,0,0"  | ||||
|                     Text="登录"  | ||||
|                     BackgroundColor="{StaticResource Primary}"  | ||||
|                     TextColor="White" | ||||
|                     HeightRequest="50" | ||||
|                     VerticalOptions="Start" | ||||
|                     Clicked="Button_ClickedAsync"/> | ||||
|             <Label Text="没有账号?请联系管理员。" HorizontalOptions="Center" FontSize="12"/> | ||||
|         </StackLayout> | ||||
|     </Frame> | ||||
|  | ||||
| </pages:PopupPage> | ||||
							
								
								
									
										88
									
								
								XXCpzs/Views/PageLogin.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										88
									
								
								XXCpzs/Views/PageLogin.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,88 @@ | ||||
| using Acr.UserDialogs; | ||||
| using Rg.Plugins.Popup.Pages; | ||||
| using Rg.Plugins.Popup.Services; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.ObjectModel; | ||||
| using System.Threading; | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.ViewModels; | ||||
|  | ||||
| namespace XXCpzs.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
|     public partial class PageLogin : PopupPage | ||||
|     { | ||||
|         LoginViewModel ViewModel; | ||||
|         private int Uid; | ||||
|         private  PageMain pageMain; | ||||
|         public PageLogin(PageMain pageMain) | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             this.pageMain = pageMain; | ||||
|             this.BindingContext = ViewModel = new LoginViewModel(pageMain.companyId); | ||||
|         } | ||||
|  | ||||
|         void OnBumenPickerSelectedIndexChangedAsync(object sender, EventArgs e) | ||||
|         { | ||||
|             var picker = (Picker)sender; | ||||
|             int selectedIndex = picker.SelectedIndex; | ||||
|             if (selectedIndex != -1) | ||||
|             { | ||||
|                 DepartmentItem buMen = ViewModel.BuMenItems[selectedIndex] as DepartmentItem; | ||||
|                 Dictionary<string, string> _body = new Dictionary<string, string>{ | ||||
|                     { "companyId", pageMain.companyId.ToString() },{"departmentId", buMen.id.ToString() } | ||||
|                 }; | ||||
|  | ||||
|                 List<UserItem> buMens = HttpHelper.RefreshData<UserItem>(04, RestSharp.Method.POST, _body); | ||||
|                 ViewModel.UserItems = new ObservableCollection<UserItem>(); | ||||
|                 foreach (var item in buMens) | ||||
|                 { | ||||
|                     ViewModel.UserItems.Add(item); | ||||
|                 } | ||||
|                 UserPicker.ItemsSource = ViewModel.UserItems; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private void UserPicker_SelectedIndexChanged(object sender, EventArgs e) | ||||
|         { | ||||
|             var picker = (Picker)sender; | ||||
|             int selectedIndex = picker.SelectedIndex; | ||||
|  | ||||
|             if (selectedIndex != -1) | ||||
|             { | ||||
|                 this.Uid = ViewModel.UserItems[selectedIndex].uid; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         async void Button_ClickedAsync(object sender, EventArgs e) | ||||
|         { | ||||
|             UserDialogs.Instance.ShowLoading("正在登录,请稍后!"); | ||||
|             new Thread(new ThreadStart(async () => | ||||
|             { | ||||
|                 Dictionary<string, string> _body = new Dictionary<string, string>{ | ||||
|                     { "Uid", this.Uid.ToString() },{"Password", UserPass.Text.Trim() } | ||||
|                 }; | ||||
|                 var Result = HttpHelper.Refresh<UserInfo>("login", _body); | ||||
|                 if (Result.Code == 200) | ||||
|                 { | ||||
|                       | ||||
|                     Device.BeginInvokeOnMainThread(() =>{ | ||||
|                         UserInfo LoginResult = Result.Data; | ||||
|                         pageMain.Loginback(LoginResult); | ||||
|                         UserDialogs.Instance.HideLoading();  | ||||
|                     }); | ||||
|                     await PopupNavigation.Instance.PopAsync(); | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     await DisplayAlert("访问出错", Result.Msg, "OK"); | ||||
|                     //Button_ClickedAsync(sender, e); | ||||
|                 } | ||||
|             })).Start(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										58
									
								
								XXCpzs/Views/PageMain.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								XXCpzs/Views/PageMain.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
|              mc:Ignorable="d" | ||||
|              Title="{Binding Title}" | ||||
|              x:Class="XXCpzs.Views.PageMain"> | ||||
|     <ContentPage.Content> | ||||
|         <StackLayout> | ||||
|             <StackLayout Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Orientation="Vertical"> | ||||
|                 <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand"> | ||||
|                     <Entry x:Name="LabelCompany" IsEnabled="False"  HorizontalTextAlignment="Center" VerticalTextAlignment="Center" HorizontalOptions="FillAndExpand" Text="{Binding CompanyName}"   /> | ||||
|                 </StackLayout> | ||||
|                 <StackLayout Orientation="Horizontal"  HorizontalOptions="FillAndExpand"> | ||||
|                     <Entry x:Name="LabelDepartment" IsEnabled="False" HorizontalOptions="FillAndExpand" Text="{Binding Department}"/> | ||||
|                     <Entry x:Name="LabelUserName" IsEnabled="False" HorizontalOptions="FillAndExpand" Text="{Binding UserName}"/> | ||||
|                 </StackLayout> | ||||
|             </StackLayout> | ||||
|             <!--定义网格行间隙为2,列间隙为2--> | ||||
|             <Grid x:Name="Grid121" VerticalOptions="FillAndExpand" RowSpacing="5" ColumnSpacing="5" BackgroundColor="#A8A8A8"> | ||||
|                 <!--定义一个5行,4列的表格--> | ||||
|                 <Grid.RowDefinitions> | ||||
|                     <!--设置行高为100--> | ||||
|                     <!--减去行高100后,按照1/10高度(此网格定义了10)计算--> | ||||
|                     <RowDefinition Height="*"></RowDefinition> | ||||
|                     <RowDefinition Height="*"></RowDefinition> | ||||
|                     <RowDefinition Height="*"></RowDefinition> | ||||
|                     <RowDefinition Height="*"></RowDefinition> | ||||
|                     <RowDefinition Height="*"></RowDefinition> | ||||
|                 </Grid.RowDefinitions> | ||||
|                 <Grid.ColumnDefinitions> | ||||
|                     <!--按照1/5宽度(此网格定义了5)计算--> | ||||
|                     <ColumnDefinition Width="*"></ColumnDefinition> | ||||
|                     <ColumnDefinition Width="*"></ColumnDefinition> | ||||
|                     <!--按照2/5宽度(此网格定义了5)计算--> | ||||
|                     <ColumnDefinition Width="*"></ColumnDefinition> | ||||
|                 </Grid.ColumnDefinitions> | ||||
|  | ||||
|                 <!--设置元素在网格的第0行0列--> | ||||
|                 <ImageButton x:Name="ImageButtonLogin" IsEnabled="False" | ||||
|                     Grid.Row="1" Grid.Column="1"  | ||||
|                     Aspect="AspectFit" | ||||
|                     Source="ico_login.png" | ||||
|                     Clicked="ImageButtonLogin_Clicked"/> | ||||
|                 <ImageButton x:Name="ImageButtonRegister" | ||||
|                     Grid.Row="2" Grid.Column="1" | ||||
|                     Aspect="AspectFit" IsEnabled="False" | ||||
|                     Clicked="ImageButtonRegister_Clicked" | ||||
|                     Source="ico_Register.png"/> | ||||
|                 <!--<ImageButton Grid.Row="3" Grid.Column="1" | ||||
|                     Aspect="AspectFit" | ||||
|                     Clicked="ImageButtonQuit_Clicked" | ||||
|                     Source="ico_Quit.png"/>--> | ||||
|             </Grid> | ||||
|         </StackLayout> | ||||
|     </ContentPage.Content> | ||||
| </ContentPage> | ||||
							
								
								
									
										252
									
								
								XXCpzs/Views/PageMain.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										252
									
								
								XXCpzs/Views/PageMain.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,252 @@ | ||||
|  | ||||
| using Acr.UserDialogs; | ||||
| using Plugin.Permissions; | ||||
| using Plugin.Permissions.Abstractions; | ||||
| using Rg.Plugins.Popup.Services; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Threading; | ||||
| using Xamarin.Essentials; | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.IOInterface; | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.Services; | ||||
| using XXCpzs.ViewModels; | ||||
|  | ||||
| namespace XXCpzs.Views | ||||
| { | ||||
|  | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
|     public partial class PageMain : ContentPage, InterfaceLogin | ||||
|     { | ||||
|         MainViewModel ViewModel; | ||||
|         public int companyId; | ||||
|         private UserInfo userInfo; | ||||
|  | ||||
|           | ||||
|         private async System.Threading.Tasks.Task<bool> CheckPerssion() | ||||
|         { | ||||
|             var current = CrossPermissions.Current; | ||||
|             //检查权限 | ||||
|             var status = await current.CheckPermissionStatusAsync(Permission .Camera ); | ||||
|             if (status != PermissionStatus.Granted) | ||||
|             { | ||||
|                 var result = await current.RequestPermissionsAsync(Permission.Camera); | ||||
|                 status = result[Permission.Camera]; | ||||
|             } | ||||
|             return status == PermissionStatus.Granted; | ||||
|         } | ||||
|         public PageMain() | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             this.BindingContext = ViewModel = new MainViewModel(); | ||||
|             if (  CheckPerssion().Result) | ||||
|             { | ||||
|                // var networkConnection = DependencyService.Get<INetworkConnection>(); | ||||
|                // networkConnection.CheckNetworkConnection(); | ||||
|               //  var networkStatus = networkConnection.IsConnected ? "链接" : "未连接"; | ||||
|                 var current = Connectivity.NetworkAccess; | ||||
|  | ||||
|                 if (current == NetworkAccess.Internet){ | ||||
|                     // IsConnected = true; | ||||
|                     //DisplayAlert("Alert", "网络连接成功", "OK"); | ||||
|                     DependencyService.Get<ICommonService>().SendNotity("通知", "网络连接成功"); | ||||
|                 } | ||||
|                 else{ | ||||
|                     DisplayAlert("Alert", "网络连接失败", "OK"); | ||||
|                 } | ||||
|             }  | ||||
|             Button refresh = new Button | ||||
|             { | ||||
|                 Text = "点击刷新", | ||||
|                 VerticalOptions = LayoutOptions.CenterAndExpand, | ||||
|                 HorizontalOptions = LayoutOptions.CenterAndExpand, | ||||
|             }; | ||||
|  | ||||
|  | ||||
|             refresh.Clicked += (sender, e) => | ||||
|             { | ||||
|                 try | ||||
|                 { | ||||
|                     if (DependencyService.Get<INetworkConnection>().IsConnected) | ||||
|                     { | ||||
|                         Navigation.PushAsync(new MainPage()); | ||||
|                     } | ||||
|                     else | ||||
|                     {  | ||||
|                     }  | ||||
|                 } | ||||
|                 catch (Exception ex) | ||||
|                 { | ||||
|                 } | ||||
|             }; | ||||
|         } | ||||
|      | ||||
|         protected override void OnAppearing() { | ||||
|  | ||||
|             base.OnAppearing(); | ||||
|             UserDialogs.Instance.ShowLoading("加载中"); | ||||
|             new Thread(new ThreadStart(() => | ||||
|             { | ||||
|                 var Result = HttpHelper.Refresh<AuthorizeItem>("noun", new Dictionary<string, string>{ | ||||
|                 { "appid", "98573393804132392" }, | ||||
|                 { "appkey", "9010137b2c292b39757f94ee434e9d5a" }, | ||||
|                 { "device", "Droid" } | ||||
|                     }); | ||||
|                 if (Result.Code == 200) | ||||
|                 { | ||||
|                     Device.BeginInvokeOnMainThread(async () => | ||||
|                     { | ||||
|                         ViewModel.Authorize = Result.Data; | ||||
|                         ViewModel.CompanyName = ViewModel.Authorize.companyName; | ||||
|                         companyId = ViewModel.Authorize.companyId; | ||||
|                         ImageButtonLogin.IsEnabled = true; | ||||
|                         ImageButtonRegister.IsEnabled = true; | ||||
|                         string LocaVer = DependencyService.Get<ICommonService>().GetVersion(); | ||||
|                         if (Convert.ToDecimal(ViewModel.Authorize.ServerVer.Version) > Convert.ToDecimal(LocaVer)) | ||||
|                         {  | ||||
|                             bool answer = await DisplayAlert("检测到新的版本", "是否立即更新?" + ViewModel.Authorize.ServerVer.UpContent, "Yes", "No"); | ||||
|                             if (answer) | ||||
|                             { | ||||
|                                 DependencyService.Get<ICommonService>().UpdateApp(ViewModel.Authorize.ServerVer.UpAddresss); | ||||
|                                  | ||||
|                             } | ||||
|                         } | ||||
|                         ITextToSpeechService service = DependencyService.Get<ITextToSpeechService>(DependencyFetchTarget.NewInstance); | ||||
|                         using (service as IDisposable) { | ||||
|                             service.SpeakAsync("Welcome to use"); | ||||
|                         } | ||||
|                         UserDialogs.Instance.HideLoading(); | ||||
|                     }); | ||||
|                 } | ||||
|             })).Start(); | ||||
|              | ||||
|         }  | ||||
|  | ||||
|         //获取权限 | ||||
|         int r = 0; | ||||
|         int c = 0; | ||||
|  | ||||
|         public void Loginback(UserInfo userInfo) | ||||
|         { | ||||
|             if (userInfo == null) | ||||
|                 return; | ||||
|             r = 0; | ||||
|             c = 0; | ||||
|             MessagingCenter.Unsubscribe<PageRegister, string>(this, "RegisteResult"); | ||||
|             Grid121.Children.Clear(); | ||||
|             this.userInfo = userInfo; | ||||
|             ViewModel.Department = this.userInfo.departmentName; | ||||
|             ViewModel.UserName = this.userInfo.realname; | ||||
|             CpzsPowers cpzsPowers = this.userInfo.CpzsPowers; | ||||
|             //{"uid":1,"cx":1,"db":1,"rc":1,"cc":1,"xs":1,"fx":1,"hh":1,"th":1,"rs":1," | ||||
|             if (cpzsPowers.cx == 1) | ||||
|                 AddImageButton("cx"); | ||||
|             if (cpzsPowers.kh == 1) | ||||
|                 AddImageButton("kh"); | ||||
|             if (cpzsPowers.dd == 1) | ||||
|                 AddImageButton("dd"); | ||||
|             if (cpzsPowers.db == 1) | ||||
|                 AddImageButton("db"); | ||||
|             if (cpzsPowers.rc == 1) | ||||
|                 AddImageButton("rc"); | ||||
|             if (cpzsPowers.cc == 1) | ||||
|                 AddImageButton("cc"); | ||||
|             if (cpzsPowers.xs == 1) | ||||
|                 AddImageButton("xs"); | ||||
|             if (cpzsPowers.rs == 1) | ||||
|                 AddImageButton("rs"); | ||||
|             if (cpzsPowers.fx == 1) | ||||
|                 AddImageButton("fx"); | ||||
|             if (cpzsPowers.hh == 1) | ||||
|                 AddImageButton("hh"); | ||||
|             if (cpzsPowers.th == 1) | ||||
|                 AddImageButton("th"); | ||||
|             ImageButton imageButton = new ImageButton | ||||
|             { | ||||
|                 Aspect = Aspect.AspectFit, | ||||
|             }; | ||||
|             Grid121.Children.Add(imageButton); | ||||
|             Grid.SetRow(imageButton, 3); | ||||
|             Grid.SetColumn(imageButton, 2); | ||||
|              | ||||
|         } | ||||
|  | ||||
|         | ||||
|         private  void AddImageButton(string fun) | ||||
|         { | ||||
|             ImageButton imageButton = new ImageButton | ||||
|             { | ||||
|                 Aspect = Aspect.AspectFit, | ||||
|             }; | ||||
|             switch (fun) | ||||
|             { | ||||
|                 case "dd": | ||||
|                     imageButton.Source = "ico_order.png"; | ||||
|                     imageButton.Clicked += async (s, args) => { await Navigation.PushAsync(new PageOrder(userInfo)); }; | ||||
|                     break; | ||||
|                 case "kh": | ||||
|                     imageButton.Source = "ico_customer.png"; | ||||
|                     imageButton.Clicked += async (s, args) => { await Navigation.PushAsync(new PageCustomer(userInfo)); }; | ||||
|                     break; | ||||
|                 case "cx": | ||||
|                     imageButton.Source = "ico_search.png"; | ||||
|                     imageButton.Clicked += async (s, args) => { await Navigation.PushAsync(new PageChaXun(userInfo)); }; | ||||
|                     break; | ||||
|                 case "db": | ||||
|                     imageButton.Source = "ico_pack.png"; | ||||
|                     imageButton.Clicked += async (s, args) => { await Navigation.PushAsync(new PageDaBao(userInfo)); }; | ||||
|                     break; | ||||
|                 case "rc": | ||||
|                     imageButton.Source = "ico_cangku.png"; | ||||
|                     imageButton.Clicked += async (s, args) => { await Navigation.PushAsync(new PageRuCang(userInfo)); }; | ||||
|                     break; | ||||
|                 case "cc": | ||||
|                     imageButton.Source = "ico_chucang.png"; | ||||
|                     imageButton.Clicked += async (s, args) => { await Navigation.PushAsync(new PageChuCang(userInfo)); }; | ||||
|                     break; | ||||
|                 case "xs": | ||||
|                     imageButton.Source = "ico_sale.png"; | ||||
|                     imageButton.Clicked += async (s, args) => { await Navigation.PushAsync(new PageSale(userInfo)); }; | ||||
|                     break; | ||||
|                 case "rs": | ||||
|                     imageButton.Source = "ico_resale.png"; | ||||
|                     imageButton.Clicked += async (s, args) => { await Navigation.PushAsync(new PageResale(userInfo)); }; | ||||
|                     break; | ||||
|                 case "fx": | ||||
|                     imageButton.Source = "ico_weixiu.png"; | ||||
|                     imageButton.Clicked += async (s, args) => { await Navigation.PushAsync(new PageFanXiu(userInfo)); }; | ||||
|                     break; | ||||
|                 case "hh": | ||||
|                     imageButton.Source = "ico_hh.png"; | ||||
|                     imageButton.Clicked += async (s, args) => { await Navigation.PushAsync(new PageHuanHuo(userInfo)); }; | ||||
|                     break; | ||||
|                 case "th": | ||||
|                     imageButton.Source = "ico_th.png"; | ||||
|                     imageButton.Clicked += async (s, args) => { await Navigation.PushAsync(new PageTuiHuo(userInfo)); }; | ||||
|                     break; | ||||
|                 default: | ||||
|                     break; | ||||
|             } | ||||
|             Grid121.Children.Add(imageButton); | ||||
|             Grid.SetRow(imageButton, r); | ||||
|             Grid.SetColumn(imageButton, c); | ||||
|             if (c < 2) { c++; } | ||||
|             else { c = 0; r++; } | ||||
|  | ||||
|         } | ||||
|         public  async void ImageButtonLogin_Clicked(object sender, EventArgs e) | ||||
|         {  | ||||
|             await PopupNavigation.Instance.PushAsync(new PageLogin(this)); | ||||
|         } | ||||
|         private async void ImageButtonRegister_Clicked(object sender, EventArgs e) | ||||
|         { | ||||
|             await PopupNavigation.Instance.PushAsync(new PageRegister(this)); | ||||
|         } | ||||
|  | ||||
|           | ||||
|     } | ||||
|     public delegate void ChangeLoadingClosd(); | ||||
| } | ||||
							
								
								
									
										30
									
								
								XXCpzs/Views/PageOrder.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								XXCpzs/Views/PageOrder.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
|              mc:Ignorable="d" | ||||
|              Title="{Binding Title}" | ||||
|              x:Class="XXCpzs.Views.PageOrder"> | ||||
|     <ContentPage.Content> | ||||
|         <StackLayout> | ||||
|             <ListView x:Name="ContextDemoList" VerticalOptions="FillAndExpand" BackgroundColor="SeaGreen"> | ||||
|                 <ListView.ItemTemplate> | ||||
|                     <DataTemplate> | ||||
|                         <ViewCell> | ||||
|                             <ViewCell.ContextActions> | ||||
|                                 <MenuItem Clicked="OnMore" CommandParameter="{Binding .}" Text="More" /> | ||||
|                                 <MenuItem Clicked="OnDelete" CommandParameter="{Binding .}" Text="Delete" IsDestructive="True" /> | ||||
|                             </ViewCell.ContextActions> | ||||
|                             <StackLayout Padding="15,0"> | ||||
|                                 <Label Text="{Binding title}" /> | ||||
|                                 <Label Text="{Binding title}" /> | ||||
|                                 <Label Text="{Binding title}" /> | ||||
|                             </StackLayout> | ||||
|                         </ViewCell> | ||||
|                     </DataTemplate> | ||||
|                 </ListView.ItemTemplate> | ||||
|             </ListView> | ||||
|         </StackLayout> | ||||
|     </ContentPage.Content> | ||||
| </ContentPage> | ||||
							
								
								
									
										35
									
								
								XXCpzs/Views/PageOrder.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								XXCpzs/Views/PageOrder.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | ||||
| using System; | ||||
|  | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.ViewModels; | ||||
|  | ||||
| namespace XXCpzs.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
|     public partial class PageOrder : ContentPage | ||||
|     {  | ||||
|         private OrderViewModel ViewModel; | ||||
|  | ||||
|  | ||||
|         public PageOrder(UserInfo userInfo) | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             this.BindingContext = ViewModel = new OrderViewModel(); | ||||
|         } | ||||
|  | ||||
|         public void OnMore(object sender, EventArgs e) | ||||
|         { | ||||
|             var mi = ((MenuItem)sender); | ||||
|             DisplayAlert("More Context Action", mi.CommandParameter + " more context action", "OK"); | ||||
|         } | ||||
|  | ||||
|         public void OnDelete(object sender, EventArgs e) | ||||
|         { | ||||
|             var mi = ((MenuItem)sender); | ||||
|             DisplayAlert("Delete Context Action", mi.CommandParameter + " delete context action", "OK"); | ||||
|         } | ||||
|     } | ||||
|     | ||||
| } | ||||
							
								
								
									
										59
									
								
								XXCpzs/Views/PageRegister.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								XXCpzs/Views/PageRegister.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,59 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <pages:PopupPage   | ||||
|     xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"            | ||||
|     xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|     xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|     xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"  | ||||
|     xmlns:animations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup" | ||||
|     mc:Ignorable="d" | ||||
|     Title="{Binding Title}" | ||||
|     x:Class="XXCpzs.Views.PageRegister"> | ||||
|     <pages:PopupPage.Animation> | ||||
|         <animations:ScaleAnimation DurationIn="400" | ||||
|                                    DurationOut="300" | ||||
|                                    EasingIn="SinOut" | ||||
|                                    EasingOut="SinIn" | ||||
|                                    HasBackgroundAnimation="True" | ||||
|                                    PositionIn="Center" | ||||
|                                    PositionOut="Center" | ||||
|                                    ScaleIn="1.2" | ||||
|                                    ScaleOut="0.8" /> | ||||
|     </pages:PopupPage.Animation> | ||||
|     <Frame CornerRadius="20" BackgroundColor="White" VerticalOptions="Center" Margin="40,10" HeightRequest="400"> | ||||
|         <StackLayout  Orientation="Vertical"> | ||||
|             <StackLayout Orientation="Horizontal"  BackgroundColor="Gray" VerticalOptions="Center"> | ||||
|                 <Label Text="部门:" VerticalTextAlignment="Center" FontSize="25" HorizontalOptions="Start"/> | ||||
|                 <Picker x:Name="Picker_Section" | ||||
|                     ItemsSource="{Binding BuMenItems}" | ||||
|                     FontSize="20"  | ||||
|                     ItemDisplayBinding="{Binding title}" | ||||
|                     Title=" 选择部门" | ||||
|                     HorizontalOptions="FillAndExpand" | ||||
|                     SelectedIndexChanged="PickerSection_SelectedIndexChanged" | ||||
|                      TitleColor="Red"> | ||||
|                 </Picker> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray" VerticalOptions="Center" > | ||||
|                 <Label Text="姓名:" VerticalTextAlignment="Center" HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor Placeholder="真实姓名" x:Name="EditorRealname" HorizontalOptions="FillAndExpand" FontSize="20"/> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="Gray" VerticalOptions="Center"> | ||||
|                 <Label Text="手机:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor x:Name="EditorMobile" HorizontalOptions="FillAndExpand" FontSize="20"/> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray" VerticalOptions="Center"> | ||||
|                 <Label Text="密码:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor x:Name="EditorPassword" HorizontalOptions="FillAndExpand" FontSize="20"/> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="Gray" VerticalOptions="Center"> | ||||
|                 <Label Text="确认:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor x:Name="EditorConfirmPass" HorizontalOptions="FillAndExpand" FontSize="20"/> | ||||
|             </StackLayout> | ||||
|  | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray" VerticalOptions="Center"> | ||||
|                 <Button Text="提  交" HorizontalOptions="FillAndExpand" Clicked="Button_Clicked"/> | ||||
|             </StackLayout> | ||||
|         </StackLayout> | ||||
|     </Frame> | ||||
| </pages:PopupPage> | ||||
							
								
								
									
										73
									
								
								XXCpzs/Views/PageRegister.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								XXCpzs/Views/PageRegister.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,73 @@ | ||||
| using Acr.UserDialogs; | ||||
| using NPinyin; | ||||
| using Rg.Plugins.Popup.Pages; | ||||
| using Rg.Plugins.Popup.Services; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Threading; | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.ViewModels; | ||||
| namespace XXCpzs.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
|     public partial class PageRegister : PopupPage | ||||
|     { | ||||
|         RegisterViewModel ViewModel; | ||||
|         private int DepartmentId;  | ||||
|         private PageMain pageMain; | ||||
|  | ||||
|         public PageRegister(PageMain pageMain) | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             this.pageMain = pageMain; | ||||
|             this.BindingContext = ViewModel = new RegisterViewModel(pageMain.companyId); | ||||
|         } | ||||
|  | ||||
|         private async void Button_Clicked(object sender, EventArgs e) | ||||
|         { | ||||
|             UserDialogs.Instance.ShowLoading("正在注册,请稍后!"); | ||||
|             new Thread(new ThreadStart(async () => | ||||
|             { | ||||
|                 Random rd = new Random(); | ||||
|                 int rdi = rd.Next(1000, 9999);   | ||||
|                 Dictionary<string, string> _body = new Dictionary<string, string>{  | ||||
|                      {"companyId", this.pageMain.companyId.ToString() } | ||||
|                     ,{"departmentId", this.DepartmentId.ToString() } | ||||
|                     ,{"deviceId", "0" } | ||||
|                     ,{"username", Pinyin.GetPinyin(EditorRealname.Text).Trim().Replace(" ","")+ rdi.ToString() } | ||||
|                     ,{"realname", EditorRealname.Text } | ||||
|                     ,{"mobile", EditorMobile.Text.Trim() } | ||||
|                     ,{"email", EditorMobile.Text.Trim() + "@163.com" } | ||||
|                     ,{"password", EditorPassword.Text.Trim() }  | ||||
|                 }; | ||||
|                 var Result = HttpHelper.RequestPost(02, _body).Result;  | ||||
|                 if (Result.Code == 200) | ||||
|                 { | ||||
|                     Device.BeginInvokeOnMainThread(async () => | ||||
|                     { | ||||
|                         UserDialogs.Instance.HideLoading(); | ||||
|                         await PopupNavigation.Instance.PopAsync(); | ||||
|                         pageMain.ImageButtonLogin_Clicked(sender, e); | ||||
|                     }); | ||||
|                 } | ||||
|                 else | ||||
|                 {  | ||||
|                     await DisplayAlert("访问出错", Result.Msg, "OK"); | ||||
|                 } | ||||
|             })).Start(); | ||||
|         } | ||||
|  | ||||
|         private void PickerSection_SelectedIndexChanged(object sender, EventArgs e) | ||||
|         { | ||||
|             var picker = (Picker)sender; | ||||
|             int selectedIndex = picker.SelectedIndex; | ||||
|  | ||||
|             if (selectedIndex != -1) | ||||
|             { | ||||
|                 DepartmentId  = ViewModel.BuMenItems[selectedIndex].id; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										67
									
								
								XXCpzs/Views/PageResale.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								XXCpzs/Views/PageResale.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,67 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
|              mc:Ignorable="d" | ||||
|              Title="{Binding Title}" | ||||
|              x:Class="XXCpzs.Views.PageResale"> | ||||
|     <ContentPage.Content> | ||||
|         <StackLayout  Orientation="Vertical"> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray"> | ||||
|                 <Label Text="序列号:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor  x:Name="SerialNumber" HorizontalOptions="FillAndExpand" /> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="Gray"> | ||||
|                 <Label Text="再销原因:" VerticalTextAlignment="Center" HorizontalOptions="Start" FontSize="25" Grid.Column="0" Grid.Row="1"/> | ||||
|                 <Picker x:Name="BrandPicker" FontSize="20" | ||||
|                     ItemsSource="{Binding CauseItems}" | ||||
|                     ItemDisplayBinding="{Binding title}" | ||||
|                     SelectedIndexChanged="OnCauseSelectedIndexChangedAsync" | ||||
|                     Title="默认原因" | ||||
|                     HorizontalOptions="FillAndExpand" | ||||
|                     TitleColor="Red"> | ||||
|                 </Picker> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray"> | ||||
|                 <Label Text="备注:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor  x:Name="Note" HorizontalOptions="FillAndExpand" FontSize="25"/> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" VerticalOptions="FillAndExpand" BackgroundColor="Gray"> | ||||
|                 <ListView ItemsSource="{Binding Items , Mode=OneWay}" | ||||
|                         VerticalOptions="FillAndExpand" | ||||
|                         HasUnevenRows="true" | ||||
|                         IsPullToRefreshEnabled="true" | ||||
|                         IsRefreshing="{Binding IsBusy, Mode=OneWay}" | ||||
|                         CachingStrategy="RecycleElement"> | ||||
|                     <ListView.ItemTemplate> | ||||
|                         <DataTemplate> | ||||
|                             <ViewCell> | ||||
|                                 <StackLayout Padding="10" Orientation="Horizontal"> | ||||
|                                     <Label Text="{Binding Code}" HorizontalOptions="Start" | ||||
|                                 LineBreakMode="NoWrap"  | ||||
|                                 Style="{DynamicResource  ListItemTextStyle}"  | ||||
|                                 FontSize="16" /> | ||||
|                                     <Label Text="{Binding Data}"  HorizontalOptions="CenterAndExpand" | ||||
|                                 d:Text="Item descripton" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                                 FontSize="13" /> | ||||
|                                     <Label Text="{Binding Msg}" HorizontalOptions="EndAndExpand" | ||||
|                                 d:Text="Item descripton" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                                 FontSize="13" /> | ||||
|                                 </StackLayout> | ||||
|                             </ViewCell> | ||||
|                         </DataTemplate> | ||||
|                     </ListView.ItemTemplate> | ||||
|                 </ListView> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" VerticalOptions="End" BackgroundColor="SlateGray"> | ||||
|                 <Button Text="提交" HorizontalOptions="FillAndExpand" Clicked="Button_ClickedAsync"/> | ||||
|                 <Button Text="扫码提交" HorizontalOptions="FillAndExpand" Clicked="OnScan"/> | ||||
|             </StackLayout> | ||||
|         </StackLayout> | ||||
|     </ContentPage.Content> | ||||
| </ContentPage> | ||||
							
								
								
									
										91
									
								
								XXCpzs/Views/PageResale.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								XXCpzs/Views/PageResale.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,91 @@ | ||||
| using Plugin.Permissions; | ||||
| using Plugin.Permissions.Abstractions; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.ViewModels; | ||||
| using ZXing.Mobile; | ||||
|  | ||||
| namespace XXCpzs.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
|     public partial class PageResale : ContentPage | ||||
|     { | ||||
|         private ResaleViewModel ViewModel; | ||||
|         private UserInfo userInfo; | ||||
|         private int CauseId = 1; | ||||
|         private int DeviceId = 1; | ||||
|  | ||||
|         public PageResale(UserInfo userInfo) | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             this.userInfo = userInfo; | ||||
|             this.BindingContext = ViewModel = new ResaleViewModel(userInfo.uid); | ||||
|         } | ||||
|         void OnCauseSelectedIndexChangedAsync(object sender, EventArgs e) | ||||
|         { | ||||
|             var picker = (Picker)sender; | ||||
|             int selectedIndex = picker.SelectedIndex; | ||||
|             if (selectedIndex != -1) | ||||
|             { | ||||
|                 CauseId = ViewModel.CauseItems[selectedIndex].id; | ||||
|  | ||||
|             } | ||||
|         } | ||||
|         private async void Button_ClickedAsync(object sender, EventArgs e) | ||||
|         { | ||||
|             if (this.CauseId == 0) | ||||
|             { | ||||
|                 await DisplayAlert("注意", "请选择产品再销售的原因", "OK"); return; | ||||
|             } | ||||
|             if (userInfo != null && SerialNumber.Text != null) | ||||
|             { | ||||
|                 Dictionary<string, string> _body = new Dictionary<string, string>{ | ||||
|                     {"Sn", SerialNumber.Text}, | ||||
|                     {"Uid", userInfo.uid.ToString()}, | ||||
|                     {"CauseId", CauseId.ToString()}, | ||||
|                     {"deviceId", this.DeviceId.ToString()} | ||||
|                 }; | ||||
|                 var request = await HttpHelper.RequestPost(18, _body); | ||||
|                 if (request.Code == 200) | ||||
|                 { | ||||
|                     ViewModel.Items.Add(new ResultModel() { Code = request.Code, Data = request.Data, Msg = request.Msg }); | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     await DisplayAlert("访问出错", request.Msg, "OK"); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         private async void OnScan(object sender, EventArgs e) | ||||
|         { | ||||
|             if (await CheckPerssion()) | ||||
|             { | ||||
|                 var scanner = new MobileBarcodeScanner(); | ||||
|                 var result = await scanner.Scan(); | ||||
|                 if (result != null) | ||||
|                 { | ||||
|                     SerialNumber.Text = result.Text; | ||||
|                     Button_ClickedAsync(sender, e); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         private async Task<bool> CheckPerssion() | ||||
|         { | ||||
|             var current = CrossPermissions.Current; | ||||
|             //检查权限 | ||||
|             var status = await current.CheckPermissionStatusAsync(Permission.Camera); | ||||
|             if (status != PermissionStatus.Granted) | ||||
|             { | ||||
|                 var result = await current.RequestPermissionsAsync(Permission.Camera); | ||||
|                 status = result[Permission.Camera]; | ||||
|             } | ||||
|             return status == PermissionStatus.Granted; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										84
									
								
								XXCpzs/Views/PageRuCang.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								XXCpzs/Views/PageRuCang.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,84 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
|              mc:Ignorable="d" | ||||
|              Title="{Binding Title}" | ||||
|              x:Class="XXCpzs.Views.PageRuCang"> | ||||
|     <ContentPage.Content> | ||||
|         <StackLayout  Orientation="Vertical"> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray"> | ||||
|                 <Label Text="序列号:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor  x:Name="SerialNumber" HorizontalOptions="FillAndExpand" /> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="Gray"> | ||||
|                 <Label Text="目标仓库:" VerticalTextAlignment="Center" HorizontalOptions="Start" FontSize="25"/> | ||||
|                 <Picker x:Name="BrandPicker" | ||||
|                     ItemsSource="{Binding CangKuItems}" | ||||
|                     FontSize="20" | ||||
|                     ItemDisplayBinding="{Binding title}" | ||||
|                     Title="请目标仓库" | ||||
|                     HorizontalOptions="FillAndExpand" | ||||
|                     SelectedIndexChanged="OnBumenPickerSelectedIndexChangedAsync" | ||||
|                     TitleColor="Red"> | ||||
|                 </Picker> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="Gray"> | ||||
|                 <Label Text="备注:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor x:Name="NewSerialNumber" HorizontalOptions="FillAndExpand" FontSize="25"/> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" VerticalOptions="FillAndExpand" BackgroundColor="SlateGray"> | ||||
|                 <ListView BackgroundColor="GreenYellow" | ||||
|                         ItemsSource="{Binding Items , Mode=OneWay}" | ||||
|                         VerticalOptions="FillAndExpand" | ||||
|                         HasUnevenRows="true" | ||||
|                         IsPullToRefreshEnabled="true" | ||||
|                         IsRefreshing="{Binding IsBusy, Mode=OneWay}" | ||||
|                         CachingStrategy="RecycleElement" > | ||||
|                     <ListView.Header> | ||||
|  | ||||
|                         <StackLayout Padding="10" Orientation="Horizontal"> | ||||
|                             <Label Text="ID" HorizontalOptions="Start" | ||||
|                                 LineBreakMode="NoWrap"    | ||||
|                                 FontSize="16" /> | ||||
|                             <Label Text="序列号"  HorizontalOptions="CenterAndExpand" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 FontSize="13" /> | ||||
|                             <Label Text="提交结果" HorizontalOptions="EndAndExpand" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 FontSize="13" /> | ||||
|                         </StackLayout> | ||||
|                     </ListView.Header> | ||||
|                     <ListView.ItemTemplate> | ||||
|  | ||||
|                         <DataTemplate> | ||||
|                             <ViewCell> | ||||
|                                 <StackLayout Padding="10" Orientation="Horizontal"> | ||||
|                                     <Label Text="{Binding Code}" HorizontalOptions="Start" | ||||
|                                 LineBreakMode="NoWrap"  d:Text="ID" | ||||
|                                 Style="{DynamicResource  ListItemTextStyle}"  | ||||
|                                 FontSize="16" /> | ||||
|                                     <Label Text="{Binding Data}"  HorizontalOptions="CenterAndExpand" | ||||
|                                 d:Text="序列号" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                                 FontSize="13" /> | ||||
|                                     <Label Text="{Binding Msg}" HorizontalOptions="EndAndExpand" | ||||
|                                 d:Text="提交结果" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                                 FontSize="13" /> | ||||
|                                 </StackLayout> | ||||
|                             </ViewCell> | ||||
|                         </DataTemplate> | ||||
|                     </ListView.ItemTemplate> | ||||
|                 </ListView> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" VerticalOptions="End" BackgroundColor="Gray"> | ||||
|                 <Button Text="提  交" HorizontalOptions="FillAndExpand" Clicked="Button_ClickedAsync"/> | ||||
|                 <Button Text="扫码提交" HorizontalOptions="FillAndExpand" Clicked="OnScan"/> | ||||
|             </StackLayout> | ||||
|         </StackLayout> | ||||
|     </ContentPage.Content> | ||||
| </ContentPage> | ||||
							
								
								
									
										93
									
								
								XXCpzs/Views/PageRuCang.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								XXCpzs/Views/PageRuCang.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,93 @@ | ||||
| using Plugin.Permissions; | ||||
| using Plugin.Permissions.Abstractions; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.ViewModels; | ||||
| using ZXing.Mobile; | ||||
|  | ||||
| namespace XXCpzs.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
|     public partial class PageRuCang : ContentPage | ||||
|     { | ||||
|         RuCangViewModel ViewModel; | ||||
|         private int Uid = 0; | ||||
|         private int deviceId = 1; | ||||
|         private UserInfo userInfo; | ||||
|  | ||||
|  | ||||
|         public PageRuCang(UserInfo userInfo) | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             this.Uid = userInfo.uid; | ||||
|             this.userInfo = userInfo; | ||||
|             this.BindingContext = ViewModel = new RuCangViewModel(userInfo); | ||||
|         } | ||||
|  | ||||
|         private int CangkuId = 0; | ||||
|         void OnBumenPickerSelectedIndexChangedAsync(object sender, EventArgs e) | ||||
|         { | ||||
|             var picker = (Picker)sender; | ||||
|             int selectedIndex = picker.SelectedIndex; | ||||
|             if (selectedIndex != -1) | ||||
|             { | ||||
|                 CangkuId = ViewModel.CangKuItems[selectedIndex].id; | ||||
|  | ||||
|             } | ||||
|         } | ||||
|         private async void Button_ClickedAsync(object sender, EventArgs e) | ||||
|         { | ||||
|             if (this.CangkuId == 0) | ||||
|             { | ||||
|                 await DisplayAlert("注意", "请选择产品要存放的仓库", "OK"); return; | ||||
|             } | ||||
|             if (Uid != 0 && SerialNumber.Text != string.Empty) | ||||
|             { | ||||
|                 Dictionary<string, string> _body = new Dictionary<string, string>{ | ||||
|                     {"Sn", SerialNumber.Text}, | ||||
|                     {"Uid", this.Uid.ToString()}, | ||||
|                     {"CangkuId", this.CangkuId.ToString()}, | ||||
|                     {"deviceId", this.deviceId.ToString()} | ||||
|                 }; | ||||
|                 var request = await HttpHelper.RequestPost(10, _body); | ||||
|                 if (request.Code == 200){ | ||||
|                     ViewModel.Items.Add(new ResultModel() { Code = request.Code, Data = request.Data, Msg = request.Msg }); | ||||
|                 } | ||||
|                 else{ | ||||
|                     await DisplayAlert("访问出错", request.Msg, "OK"); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         private async void OnScan(object sender, EventArgs e) | ||||
|         { | ||||
|             if (await CheckPerssion()) | ||||
|             { | ||||
|                 var scanner = new MobileBarcodeScanner(); | ||||
|                 var result = await scanner.Scan(); | ||||
|                 if (result != null) | ||||
|                 { | ||||
|                     SerialNumber.Text = result.Text; | ||||
|                     Button_ClickedAsync(sender, e); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         private async Task<bool> CheckPerssion() | ||||
|         { | ||||
|             var current = CrossPermissions.Current; | ||||
|             //检查权限 | ||||
|             var status = await current.CheckPermissionStatusAsync(Permission.Camera); | ||||
|             if (status != PermissionStatus.Granted) | ||||
|             { | ||||
|                 var result = await current.RequestPermissionsAsync(Permission.Camera); | ||||
|                 status = result[Permission.Camera]; | ||||
|             } | ||||
|             return status == PermissionStatus.Granted; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										57
									
								
								XXCpzs/Views/PageSale.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								XXCpzs/Views/PageSale.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,57 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
|              mc:Ignorable="d" | ||||
|              Title="{Binding Title}" | ||||
|              x:Class="XXCpzs.Views.PageSale"> | ||||
|     <ContentPage.Content> | ||||
|         <StackLayout  Orientation="Vertical"> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray"> | ||||
|                 <Label Text="序列号:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor x:Name="SerialNumber" HorizontalOptions="FillAndExpand"/> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal"  BackgroundColor="Gray"> | ||||
|                 <Button Text="{Binding CompanyName}" HorizontalOptions="FillAndExpand" x:Name="CustomerName"  /> | ||||
|                 <Button Text="选择" HorizontalOptions="EndAndExpand" x:Name="ButtonCustomerSelect" Clicked="ButtonCustomerSelect_Clicked"/> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" VerticalOptions="FillAndExpand" BackgroundColor="SlateGray"> | ||||
|                 <ListView ItemsSource="{Binding Items}" | ||||
|                         VerticalOptions="FillAndExpand" | ||||
|                         HasUnevenRows="true" | ||||
|                         IsPullToRefreshEnabled="true" | ||||
|                         IsRefreshing="{Binding IsBusy, Mode=OneWay}" | ||||
|                         CachingStrategy="RecycleElement"> | ||||
|                     <ListView.ItemTemplate> | ||||
|                         <DataTemplate> | ||||
|                             <ViewCell> | ||||
|                                 <StackLayout Padding="10" Orientation="Horizontal"> | ||||
|                                     <Label Text="{Binding Code}" HorizontalOptions="Start" | ||||
|                                 LineBreakMode="NoWrap"  | ||||
|                                 Style="{DynamicResource  ListItemTextStyle}"  | ||||
|                                 FontSize="16" /> | ||||
|                                     <Label Text="{Binding Data}"  HorizontalOptions="CenterAndExpand" | ||||
|                                 d:Text="Item descripton" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                                 FontSize="13" /> | ||||
|                                     <Label Text="{Binding Msg}" HorizontalOptions="EndAndExpand" | ||||
|                                 d:Text="Item descripton" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                                 FontSize="13" /> | ||||
|                                 </StackLayout> | ||||
|                             </ViewCell> | ||||
|                         </DataTemplate> | ||||
|                     </ListView.ItemTemplate> | ||||
|                 </ListView> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" VerticalOptions="End" BackgroundColor="Gray"> | ||||
|                 <Button Text="提交" HorizontalOptions="FillAndExpand" Clicked="Button_ClickedAsync"/> | ||||
|                 <Button Text="扫码提交" HorizontalOptions="FillAndExpand" Clicked="OnScan"/> | ||||
|             </StackLayout> | ||||
|         </StackLayout> | ||||
|  | ||||
|     </ContentPage.Content> | ||||
| </ContentPage> | ||||
							
								
								
									
										85
									
								
								XXCpzs/Views/PageSale.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								XXCpzs/Views/PageSale.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,85 @@ | ||||
| using Plugin.Permissions; | ||||
| using Plugin.Permissions.Abstractions; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.ViewModels; | ||||
| using ZXing.Mobile; | ||||
|  | ||||
| namespace XXCpzs.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
|     public partial class PageSale : ContentPage | ||||
|     { | ||||
|         private SaleViewModel ViewModel; | ||||
|         private int deviceId = 1; | ||||
|         private UserInfo userInfo; | ||||
|  | ||||
|         public PageSale(UserInfo userInfo) | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             this.userInfo = userInfo; | ||||
|             this.BindingContext = ViewModel = new SaleViewModel(); | ||||
|         } | ||||
|         private async void ButtonCustomerSelect_Clicked(object sender, EventArgs e) | ||||
|         { | ||||
|             await Navigation.PushModalAsync(new NavigationPage(new PageCustomerSelect(userInfo))); | ||||
|         } | ||||
|         private async void Button_ClickedAsync(object sender, EventArgs e) | ||||
|         { | ||||
|             if (userInfo != null && ViewModel.CustomerId != 0 && SerialNumber.Text != null) | ||||
|             { | ||||
|                 Dictionary<string, string> _body = new Dictionary<string, string>{ | ||||
|                     {"Sn", SerialNumber.Text}, | ||||
|                     {"Uid", userInfo.uid.ToString()}, | ||||
|                     {"CustomerId", ViewModel.CustomerId.ToString()}, | ||||
|                     {"deviceId", this.deviceId.ToString()} | ||||
|                 }; | ||||
|                 var request = await HttpHelper.RequestPost(16, _body); | ||||
|                 if (request.Code == 200){ | ||||
|                     ViewModel.Items.Add(new ResultModel() { Code = request.Code, Data = request.Data, Msg = request.Msg }); | ||||
|                 } | ||||
|                 else{ | ||||
|                     await DisplayAlert("访问出错", request.Msg, "OK"); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         private async void OnScan(object sender, EventArgs e) | ||||
|         { | ||||
|             if (this.ViewModel.CustomerId == 0) | ||||
|             { | ||||
|                 await DisplayAlert("注意", "请选择产品 购买的客户", "OK"); return; | ||||
|             } | ||||
|             if (await CheckPerssion()) | ||||
|             { | ||||
|                 var scanner = new MobileBarcodeScanner(); | ||||
|                 var result = await scanner.Scan(); | ||||
|                 if (result != null) | ||||
|                 { | ||||
|                     SerialNumber.Text = result.Text; | ||||
|                     Button_ClickedAsync(sender, e); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         private async Task<bool> CheckPerssion() | ||||
|         { | ||||
|             var current = CrossPermissions.Current; | ||||
|             //检查权限 | ||||
|             var status = await current.CheckPermissionStatusAsync(Permission.Camera); | ||||
|             if (status != PermissionStatus.Granted) | ||||
|             { | ||||
|                 var result = await current.RequestPermissionsAsync(Permission.Camera); | ||||
|                 status = result[Permission.Camera]; | ||||
|             } | ||||
|             return status == PermissionStatus.Granted; | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										67
									
								
								XXCpzs/Views/PageTuiHuo.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								XXCpzs/Views/PageTuiHuo.xaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,67 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||
| <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||||
|              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||||
|              xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||||
|              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
|              mc:Ignorable="d" | ||||
|              Title="{Binding Title}"  | ||||
|              x:Class="XXCpzs.Views.PageTuiHuo"> | ||||
|     <ContentPage.Content> | ||||
|         <StackLayout  Orientation="Vertical"> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray"> | ||||
|                 <Label Text="序列号:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor  x:Name="SerialNumber" HorizontalOptions="FillAndExpand" /> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="Gray"> | ||||
|                 <Label Text="再销原因:" VerticalTextAlignment="Center" HorizontalOptions="Start" FontSize="25" Grid.Column="0" Grid.Row="1"/> | ||||
|                 <Picker x:Name="BrandPicker" FontSize="20" | ||||
|                     ItemsSource="{Binding CauseItems}" | ||||
|                     ItemDisplayBinding="{Binding title}" | ||||
|                     SelectedIndexChanged="OnCauseSelectedIndexChangedAsync" | ||||
|                     Title="默认原因" | ||||
|                     HorizontalOptions="FillAndExpand" | ||||
|                     TitleColor="Red"> | ||||
|                 </Picker> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" BackgroundColor="SlateGray"> | ||||
|                 <Label Text="备注:" VerticalTextAlignment="Center"  HorizontalOptions="Start" FontSize="25" /> | ||||
|                 <Editor  x:Name="Note" HorizontalOptions="FillAndExpand" FontSize="25"/> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" VerticalOptions="FillAndExpand" BackgroundColor="Gray"> | ||||
|                 <ListView ItemsSource="{Binding Items , Mode=OneWay}" | ||||
|                         VerticalOptions="FillAndExpand" | ||||
|                         HasUnevenRows="true" | ||||
|                         IsPullToRefreshEnabled="true" | ||||
|                         IsRefreshing="{Binding IsBusy, Mode=OneWay}" | ||||
|                         CachingStrategy="RecycleElement"> | ||||
|                     <ListView.ItemTemplate> | ||||
|                         <DataTemplate> | ||||
|                             <ViewCell> | ||||
|                                 <StackLayout Padding="10" Orientation="Horizontal"> | ||||
|                                     <Label Text="{Binding Code}" HorizontalOptions="Start" | ||||
|                                 LineBreakMode="NoWrap"  | ||||
|                                 Style="{DynamicResource  ListItemTextStyle}"  | ||||
|                                 FontSize="16" /> | ||||
|                                     <Label Text="{Binding Data}"  HorizontalOptions="CenterAndExpand" | ||||
|                                 d:Text="Item descripton" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                                 FontSize="13" /> | ||||
|                                     <Label Text="{Binding Msg}" HorizontalOptions="EndAndExpand" | ||||
|                                 d:Text="Item descripton" | ||||
|                                 LineBreakMode="NoWrap" | ||||
|                                 Style="{DynamicResource ListItemDetailTextStyle}" | ||||
|                                 FontSize="13" /> | ||||
|                                 </StackLayout> | ||||
|                             </ViewCell> | ||||
|                         </DataTemplate> | ||||
|                     </ListView.ItemTemplate> | ||||
|                 </ListView> | ||||
|             </StackLayout> | ||||
|             <StackLayout Orientation="Horizontal" VerticalOptions="End" BackgroundColor="SlateGray"> | ||||
|                 <Button Text="提交" HorizontalOptions="FillAndExpand" Clicked="Button_ClickedAsync"/> | ||||
|                 <Button Text="扫码提交" HorizontalOptions="FillAndExpand" Clicked="OnScan"/> | ||||
|             </StackLayout> | ||||
|         </StackLayout> | ||||
|     </ContentPage.Content> | ||||
| </ContentPage> | ||||
							
								
								
									
										93
									
								
								XXCpzs/Views/PageTuiHuo.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								XXCpzs/Views/PageTuiHuo.xaml.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,93 @@ | ||||
| using Plugin.Permissions; | ||||
| using Plugin.Permissions.Abstractions; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| using Xamarin.Forms; | ||||
| using Xamarin.Forms.Xaml; | ||||
| using XXCpzs.helper; | ||||
| using XXCpzs.Models; | ||||
| using XXCpzs.ViewModels; | ||||
| using ZXing.Mobile; | ||||
|  | ||||
| namespace XXCpzs.Views | ||||
| { | ||||
|     [XamlCompilation(XamlCompilationOptions.Compile)] | ||||
|     public partial class PageTuiHuo : ContentPage | ||||
|     { | ||||
|         private TuiHuoViewModel ViewModel; | ||||
|         private UserInfo userInfo; | ||||
|         private int CauseId = 1; | ||||
|         private int DeviceId = 1; | ||||
|  | ||||
|         public PageTuiHuo(UserInfo userInfo) | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             this.userInfo = userInfo; | ||||
|             this.BindingContext = ViewModel = new TuiHuoViewModel(userInfo.uid); | ||||
|         } | ||||
|  | ||||
|         void OnCauseSelectedIndexChangedAsync(object sender, EventArgs e) | ||||
|         { | ||||
|             var picker = (Picker)sender; | ||||
|             int selectedIndex = picker.SelectedIndex; | ||||
|             if (selectedIndex != -1) | ||||
|             { | ||||
|                 CauseId = ViewModel.CauseItems[selectedIndex].id; | ||||
|  | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private async void Button_ClickedAsync(object sender, EventArgs e) | ||||
|         { | ||||
|             if (this.CauseId == 0) | ||||
|             { | ||||
|                 await DisplayAlert("注意", "请选择产品 退货 的原因", "OK"); return; | ||||
|             } | ||||
|             if (userInfo != null && CauseId != 0 && SerialNumber.Text != null) | ||||
|             { | ||||
|                 Dictionary<string, string> _body = new Dictionary<string, string>{ | ||||
|                     {"Sn", SerialNumber.Text}, | ||||
|                     {"Uid", userInfo.uid.ToString()}, | ||||
|                     {"CauseId", CauseId.ToString()}, | ||||
|                     {"deviceId", this.DeviceId.ToString()} | ||||
|                 }; | ||||
|                 var request = await HttpHelper.RequestPost(21, _body); | ||||
|                 if (request.Code == 200) | ||||
|                 { | ||||
|                     ViewModel.Items.Add(new ResultModel() { Code = request.Code, Data = request.Data, Msg = request.Msg }); | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     await DisplayAlert("访问出错", request.Msg, "OK"); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         private async void OnScan(object sender, EventArgs e) | ||||
|         { | ||||
|             if (await CheckPerssion()) | ||||
|             { | ||||
|                 var scanner = new MobileBarcodeScanner(); | ||||
|                 var result = await scanner.Scan(); | ||||
|                 if (result != null) | ||||
|                 { | ||||
|                     SerialNumber.Text = result.Text; | ||||
|                     Button_ClickedAsync(sender, e); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         private async Task<bool> CheckPerssion() | ||||
|         { | ||||
|             var current = CrossPermissions.Current; | ||||
|             //检查权限 | ||||
|             var status = await current.CheckPermissionStatusAsync(Permission.Camera); | ||||
|             if (status != PermissionStatus.Granted) | ||||
|             { | ||||
|                 var result = await current.RequestPermissionsAsync(Permission.Camera); | ||||
|                 status = result[Permission.Camera]; | ||||
|             } | ||||
|             return status == PermissionStatus.Granted; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										81
									
								
								XXCpzs/XXCpzs.csproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								XXCpzs/XXCpzs.csproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,81 @@ | ||||
| <Project Sdk="Microsoft.NET.Sdk"> | ||||
|  | ||||
|   <PropertyGroup> | ||||
|     <TargetFramework>netstandard2.0</TargetFramework> | ||||
|     <ProduceReferenceAssembly>true</ProduceReferenceAssembly> | ||||
|   </PropertyGroup> | ||||
|  | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | ||||
|     <DebugType>portable</DebugType> | ||||
|     <DebugSymbols>true</DebugSymbols> | ||||
|   </PropertyGroup> | ||||
|  | ||||
|   <ItemGroup> | ||||
|     <PackageReference Include="Acr.UserDialogs" Version="7.1.0.440" /> | ||||
|     <PackageReference Include="NPinyin.Core" Version="3.0.0" /> | ||||
|     <PackageReference Include="Plugin.Permissions" Version="3.0.0.12" /> | ||||
|     <PackageReference Include="RestSharp" Version="106.10.1" /> | ||||
|     <PackageReference Include="Rg.Plugins.Popup" Version="1.2.0.223" /> | ||||
|     <PackageReference Include="Xamarin.Forms" Version="4.3.0.908675" />   | ||||
|     <PackageReference Include="Xamarin.Essentials" Version="1.3.1" /> | ||||
|     <PackageReference Include="Newtonsoft.Json" Version="11.0.2" /> | ||||
|     <PackageReference Include="ZXing.Net.Mobile" Version="2.4.1" /> | ||||
|   </ItemGroup> | ||||
|  | ||||
|   <ItemGroup> | ||||
|     <Compile Update="Views\PageMain.xaml.cs"> | ||||
|       <DependentUpon>PageMain.xaml</DependentUpon> | ||||
|     </Compile> | ||||
|   </ItemGroup> | ||||
|  | ||||
|   <ItemGroup> | ||||
|     <EmbeddedResource Update="Views\PageCustomerSelect.xaml"> | ||||
|       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||
|     </EmbeddedResource> | ||||
|     <EmbeddedResource Update="Views\PageMain.xaml"> | ||||
|       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||
|     </EmbeddedResource> | ||||
|     <EmbeddedResource Update="Views\PageAddCustomer.xaml"> | ||||
|       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||
|     </EmbeddedResource> | ||||
|     <EmbeddedResource Update="Views\PageChaXun.xaml"> | ||||
|       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||
|     </EmbeddedResource> | ||||
|     <EmbeddedResource Update="Views\PageChuCang.xaml"> | ||||
|       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||
|     </EmbeddedResource> | ||||
|     <EmbeddedResource Update="Views\PageCustomer.xaml"> | ||||
|       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||
|     </EmbeddedResource> | ||||
|     <EmbeddedResource Update="Views\PageDaBao.xaml"> | ||||
|       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||
|     </EmbeddedResource> | ||||
|     <EmbeddedResource Update="Views\PageFanXiu.xaml"> | ||||
|       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||
|     </EmbeddedResource> | ||||
|     <EmbeddedResource Update="Views\PageHuanHuo.xaml"> | ||||
|       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||
|     </EmbeddedResource> | ||||
|     <EmbeddedResource Update="Views\PageLogin.xaml"> | ||||
|       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||
|     </EmbeddedResource> | ||||
|     <EmbeddedResource Update="Views\PageOrder.xaml"> | ||||
|       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||
|     </EmbeddedResource> | ||||
|     <EmbeddedResource Update="Views\PageRegister.xaml"> | ||||
|       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||
|     </EmbeddedResource> | ||||
|     <EmbeddedResource Update="Views\PageResale.xaml"> | ||||
|       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||
|     </EmbeddedResource> | ||||
|     <EmbeddedResource Update="Views\PageRuCang.xaml"> | ||||
|       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||
|     </EmbeddedResource> | ||||
|     <EmbeddedResource Update="Views\PageSale.xaml"> | ||||
|       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||
|     </EmbeddedResource> | ||||
|     <EmbeddedResource Update="Views\PageTuiHuo.xaml"> | ||||
|       <Generator>MSBuild:UpdateDesignTimeXaml</Generator> | ||||
|     </EmbeddedResource> | ||||
|   </ItemGroup> | ||||
| </Project> | ||||
		Reference in New Issue
	
	Block a user