Browse Source

获取卡信息

Lishi
xxe 2 years ago
parent
commit
88f3b4b6a2
5 changed files with 43 additions and 15 deletions
  1. +1
    -1
      HKCardIN/Helper/DataBus.cs
  2. +7
    -6
      HKCardIN/Logic/BaseLogic.cs
  3. +20
    -0
      HKCardIN/Logic/Model/UserAndCardInfo.cs
  4. +7
    -0
      HKCardIN/ViewModels/RootViewModel.cs
  5. +8
    -8
      HKCardIN/Views/RootView.xaml

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

@@ -21,7 +21,7 @@ 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>


+ 7
- 6
HKCardIN/Logic/BaseLogic.cs View File

@@ -1,4 +1,5 @@
using HKCardIN.Helper; using HKCardIN.Helper;
using HKCardIN.Logic.Model;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -18,12 +19,12 @@ namespace HKCardIN.Logic
/// 同步用户和卡信息 /// 同步用户和卡信息
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public async Task<dynamic> PullUserAndCardInfo(string CardNo)
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>
/// 同步充值记录 /// 同步充值记录
@@ -36,7 +37,7 @@ namespace HKCardIN.Logic
{ {
t.NodePath = ApiRoute.PushMoneyToServer; t.NodePath = ApiRoute.PushMoneyToServer;
t.ReqType = MultiType.POST; t.ReqType = MultiType.POST;
t.JsonParam = (new { Money, Type = 1, No = CardNo }).ToJson();
t.JsonParam = (new { Money, Type = 1, CardNum = CardNo }).ToJson();
}).Build().RunStringFirst(); }).Build().RunStringFirst();
return bool.Parse(data.ToModel<JObject>()["data"].ToString()); 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; }
}
}

+ 7
- 0
HKCardIN/ViewModels/RootViewModel.cs View File

@@ -1,5 +1,6 @@
using HKCardIN.Helper; using HKCardIN.Helper;
using HKCardIN.Logic; using HKCardIN.Logic;
using HKCardIN.Logic.Model;
using Stylet; using Stylet;
using System; using System;
using System.Threading; using System.Threading;
@@ -54,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 命令


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

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


Loading…
Cancel
Save