using System;
|
using Shared;
|
using HDL_ON.UI.CSS;
|
using HDL_ON.Stan;
|
|
namespace HDL_ON.UI
|
{
|
/// <summary>
|
/// 过户输入账号界面
|
/// </summary>
|
public class TransferInputPage : EditorCommonForm
|
{
|
#region ■ 变量声明___________________________
|
|
#endregion
|
|
#region ■ 初始化_____________________________
|
|
/// <summary>
|
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
/// </summary>
|
public void ShowForm()
|
{
|
//过户
|
base.SetTitleText(Language.StringByID(StringId.Transfer));
|
|
//初始化中部信息
|
this.InitMiddleFrame();
|
}
|
|
/// <summary>
|
/// 初始化中部信息
|
/// </summary>
|
private void InitMiddleFrame()
|
{
|
//清空bodyFrame
|
this.ClearBodyFrame();
|
|
//白色背景
|
var frameBack = new FrameLayout();
|
frameBack.Y = Application.GetRealHeight(8);
|
frameBack.BackgroundColor = CSS_Color.MainBackgroundColor;
|
bodyFrameLayout.AddChidren(frameBack);
|
|
//请输入接收方账号
|
var rowInput = new FrameRowControl();
|
rowInput.Height = Application.GetRealHeight(50);
|
frameBack.AddChidren(rowInput);
|
//图标
|
rowInput.AddLeftIcon(24, "LoginIcon/AccountIcon.png");
|
//输入框
|
var txtInput = rowInput.AddLeftInput(string.Empty, 300);
|
txtInput.PlaceholderText = Language.StringByID(StringId.PleaseInputReceiverAccount);
|
//底线
|
rowInput.AddBottomLine();
|
//变更容器高度
|
frameBack.Height = rowInput.Bottom + Application.GetRealHeight(10);
|
|
//过户
|
var btnMigrate = new BottomClickButton(220);
|
btnMigrate.TextID = StringId.Transfer;
|
btnMigrate.Y = frameBack.Bottom + Application.GetRealHeight(79);
|
bodyFrameLayout.AddChidren(btnMigrate);
|
btnMigrate.ButtonClickEvent += (sender, e) =>
|
{
|
string account = txtInput.Text.Trim();
|
if (account == string.Empty)
|
{
|
return;
|
}
|
if (account == UserInfo.Current.userEmailInfo || account == UserInfo.Current.userMobileInfo)
|
{
|
//不能自己过户给自己
|
HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Language.StringByID(StringId.YouCannotTransferOwnershipToYourself));
|
return;
|
}
|
//搜索账号信息
|
var accountInfo = this.SearchAccountInfoByAccount(account);
|
if (accountInfo == null)
|
{
|
return;
|
}
|
|
this.CloseForm();
|
|
var form = new TransferUserConfirmPage();
|
form.AddForm(accountInfo);
|
};
|
|
//扫描二维码
|
var btnQrcode = new NormalViewControl(220, 32, true);
|
btnQrcode.Y = btnMigrate.Bottom + Application.GetRealWidth(6);
|
btnQrcode.TextColor = CSS_Color.MainColor;
|
btnQrcode.Gravity = Gravity.CenterHorizontal;
|
btnQrcode.TextAlignment = TextAlignment.Center;
|
btnQrcode.TextID = StringId.ScanQRCoden;
|
bodyFrameLayout.AddChidren(btnQrcode);
|
btnQrcode.ButtonClickEvent += (sender, e) =>
|
{
|
Scan.Ins.OpenScan((scanString) =>
|
{
|
if (string.IsNullOrEmpty(scanString) == true)
|
{
|
return;
|
}
|
if (scanString == UserInfo.Current.userEmailInfo || scanString == UserInfo.Current.userMobileInfo)
|
{
|
//不能自己过户给自己
|
HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Language.StringByID(StringId.YouCannotTransferOwnershipToYourself));
|
return;
|
}
|
//搜索账号信息
|
var accountInfo = this.SearchAccountInfoByAccount(scanString);
|
if (accountInfo == null)
|
{
|
return;
|
}
|
this.CloseForm();
|
|
var form = new TransferUserConfirmPage();
|
form.AddForm(accountInfo);
|
});
|
};
|
}
|
|
#endregion
|
|
#region ■ 搜索账号___________________________
|
|
/// <summary>
|
/// 搜索账号信息
|
/// </summary>
|
/// <param name="i_account">搜索的账号</param>
|
/// <returns></returns>
|
private AccountInfoResult SearchAccountInfoByAccount(string i_account)
|
{
|
var result = new DAL.Server.HttpServerRequest().GetMemberInfoByAccount(i_account);
|
if (result.Code == DAL.Server.StateCode.ACCOUNT_NOT_EXIST)
|
{
|
//目标账号并不存在
|
HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Language.StringByID(StringId.TargetAcountDoesNotExist));
|
return null;
|
}
|
if (result.Code != DAL.Server.StateCode.SUCCESS)
|
{
|
DAL.Server.IMessageCommon.Current.ShowErrorInfoAlter(result.Code);
|
return null;
|
}
|
var accountInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<AccountInfoResult>(result.Data.ToString());
|
accountInfo.Account = i_account;
|
if (accountInfo.MemberName == string.Empty)
|
{
|
accountInfo.MemberName = accountInfo.Account;
|
}
|
return accountInfo;
|
}
|
|
#endregion
|
}
|
}
|