@@ -21,10 +21,10 @@ namespace HKCardIN.Helper | |||||
/// <summary> | /// <summary> | ||||
/// 拉取用户和卡信息 | /// 拉取用户和卡信息 | ||||
/// </summary> | /// </summary> | ||||
public static string PullUserAndCardInfo = DataBus.SaasRoute + ""; | |||||
public static string PullUserAndCardInfo = DataBus.SaasRoute + "api/member-helper/membercardinfo/"; | |||||
/// <summary> | /// <summary> | ||||
/// 推送充值到服务器 | /// 推送充值到服务器 | ||||
/// </summary> | /// </summary> | ||||
public static string PushMoneyToServer = DataBus.SaasRoute + ""; | |||||
public static string PushMoneyToServer = DataBus.SaasRoute + "api/member-helper/memberconsumptionorrecharge"; | |||||
} | } | ||||
} | } |
@@ -1,10 +1,15 @@ | |||||
using HKCardIN.Helper; | using HKCardIN.Helper; | ||||
using HKCardIN.Logic.Model; | |||||
using Newtonsoft.Json.Linq; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Linq; | using System.Linq; | ||||
using System.Security.Policy; | |||||
using System.Text; | using System.Text; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using XExten.Advance.HttpFramework.MultiCommon; | |||||
using XExten.Advance.HttpFramework.MultiFactory; | using XExten.Advance.HttpFramework.MultiFactory; | ||||
using XExten.Advance.LinqFramework; | |||||
namespace HKCardIN.Logic | namespace HKCardIN.Logic | ||||
{ | { | ||||
@@ -14,24 +19,27 @@ namespace HKCardIN.Logic | |||||
/// 同步用户和卡信息 | /// 同步用户和卡信息 | ||||
/// </summary> | /// </summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
public async Task<dynamic> PullUserAndCardInfo() | |||||
public UserAndCardInfo PullUserAndCardInfo(string CardNo) | |||||
{ | { | ||||
return await IHttpMultiClient.HttpMulti.AddNode(t => | |||||
{ | |||||
t.NodePath = ApiRoute.PullUserAndCardInfo; | |||||
}).Build().RunStringFirstAsync(); | |||||
return IHttpMultiClient.HttpMulti.AddNode(t => | |||||
{ | |||||
t.NodePath = ApiRoute.PullUserAndCardInfo + CardNo; | |||||
}).Build().RunStringFirst().ToModel<JObject>()["data"].ToJson().ToModel<UserAndCardInfo>(); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 同步充值记录 | /// 同步充值记录 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="input"></param> | /// <param name="input"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
public async Task<dynamic> PushMoneyToServer(dynamic input) | |||||
public bool PushMoneyToServer(string CardNo, decimal Money) | |||||
{ | { | ||||
return await IHttpMultiClient.HttpMulti.AddNode(t => | |||||
var data = IHttpMultiClient.HttpMulti.AddNode(t => | |||||
{ | { | ||||
t.NodePath = ApiRoute.PushMoneyToServer; | t.NodePath = ApiRoute.PushMoneyToServer; | ||||
}).Build().RunStringFirstAsync(); | |||||
t.ReqType = MultiType.POST; | |||||
t.JsonParam = (new { Money, Type = 1, CardNum = CardNo }).ToJson(); | |||||
}).Build().RunStringFirst(); | |||||
return bool.Parse(data.ToModel<JObject>()["data"].ToString()); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -0,0 +1,20 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace HKCardIN.Logic.Model | |||||
{ | |||||
public class UserAndCardInfo | |||||
{ | |||||
public string MemberName { get; set; } | |||||
public string MemberPhone { get; set; } | |||||
public string MemberCardId { get; set; } | |||||
public string MemberHeadImgUrl { get; set; } | |||||
public string CardNum { get; set; } | |||||
public int CardState { get; set; } | |||||
public string Stutas => CardState == 0 ? "禁用" : (CardState == 1 ? "正常" : (CardState == 2 ? "挂失" : "作废")); | |||||
public decimal Money { get; set; } | |||||
} | |||||
} |
@@ -1,4 +1,6 @@ | |||||
using HKCardIN.Helper; | using HKCardIN.Helper; | ||||
using HKCardIN.Logic; | |||||
using HKCardIN.Logic.Model; | |||||
using Stylet; | using Stylet; | ||||
using System; | using System; | ||||
using System.Threading; | using System.Threading; | ||||
@@ -53,6 +55,12 @@ namespace HKCardIN.ViewModels | |||||
get => _CardNo; | get => _CardNo; | ||||
set => SetAndNotify(ref _CardNo, value); | set => SetAndNotify(ref _CardNo, value); | ||||
} | } | ||||
UserAndCardInfo _Info; | |||||
public UserAndCardInfo Info | |||||
{ | |||||
get => _Info; | |||||
set => SetAndNotify(ref _Info, value); | |||||
} | |||||
#endregion | #endregion | ||||
#region 命令 | #region 命令 | ||||
@@ -78,18 +86,22 @@ namespace HKCardIN.ViewModels | |||||
} | } | ||||
public void SaveAction() | public void SaveAction() | ||||
{ | { | ||||
var c = CardNo; | |||||
var m = ShowMoney; | |||||
if (!DataBus.NetWordState) | if (!DataBus.NetWordState) | ||||
{ | { | ||||
HandyControl.Controls.Growl.InfoGlobal("系统已离线,请连接网络!!!"); | HandyControl.Controls.Growl.InfoGlobal("系统已离线,请连接网络!!!"); | ||||
return; | return; | ||||
} | } | ||||
if (BaseLogic.GetInstance().PushMoneyToServer(CardNo, ShowMoney)) | |||||
HandyControl.Controls.Growl.SuccessGlobal($"【{CardNo}】充值成功"); | |||||
else | |||||
HandyControl.Controls.Growl.InfoGlobal($"【{CardNo}】充值失败"); | |||||
} | } | ||||
#endregion | #endregion | ||||
#region 方法 | #region 方法 | ||||
private void MainThread() { | |||||
private void MainThread() | |||||
{ | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
try | try | ||||
@@ -116,7 +116,7 @@ | |||||
<Image | <Image | ||||
Width="100" | Width="100" | ||||
Height="120" | Height="120" | ||||
Source="/HKResouces/头像.png" | |||||
Source="{Binding Info.MemberHeadImgUrl}" | |||||
Stretch="UniformToFill" /> | Stretch="UniformToFill" /> | ||||
</Border> | </Border> | ||||
<StackPanel Grid.Column="1"> | <StackPanel Grid.Column="1"> | ||||
@@ -129,7 +129,7 @@ | |||||
FontSize="18" | FontSize="18" | ||||
Foreground="Red" | Foreground="Red" | ||||
Style="{StaticResource TextBlockDefaultBold}" | Style="{StaticResource TextBlockDefaultBold}" | ||||
Text="李四" /> | |||||
Text="{Binding Info.MemberName}" /> | |||||
</WrapPanel> | </WrapPanel> | ||||
<WrapPanel Margin="0,20,0,0"> | <WrapPanel Margin="0,20,0,0"> | ||||
<TextBlock | <TextBlock | ||||
@@ -140,18 +140,18 @@ | |||||
FontSize="18" | FontSize="18" | ||||
Foreground="Red" | Foreground="Red" | ||||
Style="{StaticResource TextBlockDefaultBold}" | Style="{StaticResource TextBlockDefaultBold}" | ||||
Text="13812345678" /> | |||||
Text="{Binding Info.MemberPhone}" /> | |||||
</WrapPanel> | </WrapPanel> | ||||
<WrapPanel Margin="0,20,0,0"> | <WrapPanel Margin="0,20,0,0"> | ||||
<TextBlock | <TextBlock | ||||
FontSize="18" | FontSize="18" | ||||
Style="{StaticResource Title}" | Style="{StaticResource Title}" | ||||
Text="员工号:" /> | |||||
Text="身份证:" /> | |||||
<TextBlock | <TextBlock | ||||
FontSize="18" | FontSize="18" | ||||
Foreground="Red" | Foreground="Red" | ||||
Style="{StaticResource TextBlockDefaultBold}" | Style="{StaticResource TextBlockDefaultBold}" | ||||
Text="001" /> | |||||
Text="{Binding Info.MemberCardId}" /> | |||||
</WrapPanel> | </WrapPanel> | ||||
</StackPanel> | </StackPanel> | ||||
</Grid> | </Grid> | ||||
@@ -170,7 +170,7 @@ | |||||
FontSize="18" | FontSize="18" | ||||
Foreground="Red" | Foreground="Red" | ||||
Style="{StaticResource TextBlockDefaultBold}" | Style="{StaticResource TextBlockDefaultBold}" | ||||
Text="123456" /> | |||||
Text="{Binding Info.CardNum}" /> | |||||
</WrapPanel> | </WrapPanel> | ||||
<WrapPanel Margin="0,20,0,0"> | <WrapPanel Margin="0,20,0,0"> | ||||
<TextBlock | <TextBlock | ||||
@@ -181,7 +181,7 @@ | |||||
FontSize="18" | FontSize="18" | ||||
Foreground="Red" | Foreground="Red" | ||||
Style="{StaticResource TextBlockDefaultBold}" | Style="{StaticResource TextBlockDefaultBold}" | ||||
Text="正常" /> | |||||
Text="{Binding Info.Stutas}" /> | |||||
</WrapPanel> | </WrapPanel> | ||||
<WrapPanel Margin="0,20,0,0"> | <WrapPanel Margin="0,20,0,0"> | ||||
<TextBlock | <TextBlock | ||||
@@ -192,7 +192,7 @@ | |||||
FontSize="18" | FontSize="18" | ||||
Foreground="Red" | Foreground="Red" | ||||
Style="{StaticResource TextBlockDefaultBold}" | Style="{StaticResource TextBlockDefaultBold}" | ||||
Text="123456" /> | |||||
Text="{Binding Info.Money}" /> | |||||
</WrapPanel> | </WrapPanel> | ||||
<WrapPanel Margin="0,20,0,0"> | <WrapPanel Margin="0,20,0,0"> | ||||
<TextBlock | <TextBlock | ||||