pry 2 years ago
parent
commit
9b758d1ab6
5 changed files with 61 additions and 21 deletions
  1. +2
    -2
      HKCardIN/Helper/DataBus.cs
  2. +16
    -8
      HKCardIN/Logic/BaseLogic.cs
  3. +20
    -0
      HKCardIN/Logic/Model/UserAndCardInfo.cs
  4. +15
    -3
      HKCardIN/ViewModels/RootViewModel.cs
  5. +8
    -8
      HKCardIN/Views/RootView.xaml

+ 2
- 2
HKCardIN/Helper/DataBus.cs View File

@@ -21,10 +21,10 @@ namespace HKCardIN.Helper
/// <summary>
/// 拉取用户和卡信息
/// </summary>
public static string PullUserAndCardInfo = DataBus.SaasRoute + "";
public static string PullUserAndCardInfo = DataBus.SaasRoute + "api/member-helper/membercardinfo/";
/// <summary>
/// 推送充值到服务器
/// </summary>
public static string PushMoneyToServer = DataBus.SaasRoute + "";
public static string PushMoneyToServer = DataBus.SaasRoute + "api/member-helper/memberconsumptionorrecharge";
}
}

+ 16
- 8
HKCardIN/Logic/BaseLogic.cs View File

@@ -1,10 +1,15 @@
using HKCardIN.Helper;
using HKCardIN.Logic.Model;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using XExten.Advance.HttpFramework.MultiCommon;
using XExten.Advance.HttpFramework.MultiFactory;
using XExten.Advance.LinqFramework;

namespace HKCardIN.Logic
{
@@ -14,24 +19,27 @@ namespace HKCardIN.Logic
/// 同步用户和卡信息
/// </summary>
/// <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>
/// <param name="input"></param>
/// <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;
}).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());
}
}
}

+ 20
- 0
HKCardIN/Logic/Model/UserAndCardInfo.cs View File

@@ -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; }
}
}

+ 15
- 3
HKCardIN/ViewModels/RootViewModel.cs View File

@@ -1,4 +1,6 @@
using HKCardIN.Helper;
using HKCardIN.Logic;
using HKCardIN.Logic.Model;
using Stylet;
using System;
using System.Threading;
@@ -53,6 +55,12 @@ namespace HKCardIN.ViewModels
get => _CardNo;
set => SetAndNotify(ref _CardNo, value);
}
UserAndCardInfo _Info;
public UserAndCardInfo Info
{
get => _Info;
set => SetAndNotify(ref _Info, value);
}
#endregion

#region 命令
@@ -78,18 +86,22 @@ namespace HKCardIN.ViewModels
}
public void SaveAction()
{
var c = CardNo;
var m = ShowMoney;
if (!DataBus.NetWordState)
{
HandyControl.Controls.Growl.InfoGlobal("系统已离线,请连接网络!!!");
return;
}

if (BaseLogic.GetInstance().PushMoneyToServer(CardNo, ShowMoney))
HandyControl.Controls.Growl.SuccessGlobal($"【{CardNo}】充值成功");
else
HandyControl.Controls.Growl.InfoGlobal($"【{CardNo}】充值失败");
}
#endregion

#region 方法
private void MainThread() {
private void MainThread()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
try


+ 8
- 8
HKCardIN/Views/RootView.xaml View File

@@ -116,7 +116,7 @@
<Image
Width="100"
Height="120"
Source="/HKResouces/头像.png"
Source="{Binding Info.MemberHeadImgUrl}"
Stretch="UniformToFill" />
</Border>
<StackPanel Grid.Column="1">
@@ -129,7 +129,7 @@
FontSize="18"
Foreground="Red"
Style="{StaticResource TextBlockDefaultBold}"
Text="李四" />
Text="{Binding Info.MemberName}" />
</WrapPanel>
<WrapPanel Margin="0,20,0,0">
<TextBlock
@@ -140,18 +140,18 @@
FontSize="18"
Foreground="Red"
Style="{StaticResource TextBlockDefaultBold}"
Text="13812345678" />
Text="{Binding Info.MemberPhone}" />
</WrapPanel>
<WrapPanel Margin="0,20,0,0">
<TextBlock
FontSize="18"
Style="{StaticResource Title}"
Text="员工号:" />
Text="身份证:" />
<TextBlock
FontSize="18"
Foreground="Red"
Style="{StaticResource TextBlockDefaultBold}"
Text="001" />
Text="{Binding Info.MemberCardId}" />
</WrapPanel>
</StackPanel>
</Grid>
@@ -170,7 +170,7 @@
FontSize="18"
Foreground="Red"
Style="{StaticResource TextBlockDefaultBold}"
Text="123456" />
Text="{Binding Info.CardNum}" />
</WrapPanel>
<WrapPanel Margin="0,20,0,0">
<TextBlock
@@ -181,7 +181,7 @@
FontSize="18"
Foreground="Red"
Style="{StaticResource TextBlockDefaultBold}"
Text="正常" />
Text="{Binding Info.Stutas}" />
</WrapPanel>
<WrapPanel Margin="0,20,0,0">
<TextBlock
@@ -192,7 +192,7 @@
FontSize="18"
Foreground="Red"
Style="{StaticResource TextBlockDefaultBold}"
Text="123456" />
Text="{Binding Info.Money}" />
</WrapPanel>
<WrapPanel Margin="0,20,0,0">
<TextBlock


Loading…
Cancel
Save