11 changed files with 825 additions and 43 deletions
@ -0,0 +1,72 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace BBWY.Client.Models.APIModel |
|||
{ |
|||
public class TotalPackUserSalaryResponse |
|||
{ |
|||
/// <summary>
|
|||
/// 数量
|
|||
/// </summary>
|
|||
public int TotalCount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 明细
|
|||
/// </summary>
|
|||
public List<PackUserSalary> PackUserSalaries { get; set; } |
|||
} |
|||
/// <summary>
|
|||
/// 打包人日薪
|
|||
/// </summary>
|
|||
public class PackUserSalary |
|||
{ |
|||
/// <summary>
|
|||
/// 日期
|
|||
/// </summary>
|
|||
public DateTime Date { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 花名
|
|||
/// </summary>
|
|||
public string PackUserName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 总收益
|
|||
/// </summary>
|
|||
public decimal TotalIncome { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 收益项目明细
|
|||
/// </summary>
|
|||
public List<IncomeItem> IncomeItems { get; set; } |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 收益项目
|
|||
/// </summary>
|
|||
public class IncomeItem |
|||
{ |
|||
/// <summary>
|
|||
/// 项目Id
|
|||
/// </summary>
|
|||
public long ServiceId { get; set; } |
|||
/// <summary>
|
|||
/// 项目名称
|
|||
/// </summary>
|
|||
public string Name { get; set; } |
|||
/// <summary>
|
|||
/// 单价价格
|
|||
/// </summary>
|
|||
public decimal Price { get; set; } |
|||
/// <summary>
|
|||
/// 数量
|
|||
/// </summary>
|
|||
public int ServiceCount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 总计
|
|||
/// </summary>
|
|||
public decimal TotalPrice { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,185 @@ |
|||
using BBWY.Client.APIServices; |
|||
using BBWY.Client.Models.APIModel; |
|||
using BBWY.Client.Models.PackTask; |
|||
using BBWY.Common.Models; |
|||
using BBWY.Controls; |
|||
using GalaSoft.MvvmLight.Command; |
|||
using Microsoft.Win32; |
|||
using NPOI.SS.Formula.Functions; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using System.Windows.Controls; |
|||
using System.Windows.Input; |
|||
|
|||
namespace BBWY.Client.ViewModels.TotalPackTask |
|||
{ |
|||
public class PackUserSalaryViewModel : BaseVM, IDenpendency |
|||
{ |
|||
public PackTaskService packTaskService; |
|||
private bool isLoading; |
|||
private DateTime startTime; |
|||
private DateTime endTime; |
|||
private int pageIndex = 1; |
|||
private int pageSize = 20; |
|||
private int orderCount; |
|||
private List<PackUserSalary> packUserSalaryList; |
|||
|
|||
private string searchUserName; |
|||
|
|||
|
|||
public string SearchUserName { get => searchUserName; set { Set(ref searchUserName, value); } } |
|||
public List<PackUserSalary> PackUserSalaryList { get => packUserSalaryList; set { Set(ref packUserSalaryList, value); } } |
|||
|
|||
public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } |
|||
|
|||
public DateTime StartTime { get => startTime; set { Set(ref startTime, value); } } |
|||
|
|||
public DateTime EndTime { get => endTime; set { Set(ref endTime, value); } } |
|||
|
|||
public int PageIndex { get => pageIndex; set { Set(ref pageIndex, value); } } |
|||
|
|||
public int PageSize { get => pageSize; set { Set(ref pageSize, value); } } |
|||
|
|||
public int OrderCount { get => orderCount; set { Set(ref orderCount, value); } } |
|||
|
|||
public ICommand SearchPackUserSalaryCommand { get; set; } |
|||
|
|||
public ICommand ExportCommand { get; set; } |
|||
|
|||
public ICommand OrderPageIndexChangedCommand { get; set; } |
|||
|
|||
public ICommand SetSearchDateCommand { get; set; } |
|||
|
|||
public PackUserSalaryViewModel(PackTaskService packTaskService) |
|||
{ |
|||
this.packTaskService = packTaskService; |
|||
|
|||
OrderPageIndexChangedCommand = new RelayCommand<PageArgs>(p => |
|||
{ |
|||
LoadOrder(p.PageIndex); |
|||
}); |
|||
|
|||
SearchPackUserSalaryCommand = new RelayCommand(SearchPackUserSalary); |
|||
|
|||
StartTime = DateTime.Now; |
|||
EndTime = DateTime.Now; |
|||
SearchPackUserSalary(); |
|||
SetSearchDateCommand = new RelayCommand<int>(d => |
|||
{ |
|||
EndTime = d == 1 ? DateTime.Now.Date.AddDays(-1) : DateTime.Now; |
|||
StartTime = DateTime.Now.Date.AddDays(d * -1); |
|||
PageIndex = 1; |
|||
Task.Factory.StartNew(() => LoadOrder(1)); //点击日期查询订单
|
|||
}); |
|||
ExportCommand = new RelayCommand(Export); |
|||
} |
|||
|
|||
private void LoadOrder(int pageIndex) |
|||
{ |
|||
PageIndex = pageIndex; |
|||
SearchPackUserSalary(); |
|||
} |
|||
private void SearchPackUserSalary() |
|||
{ |
|||
PackUserSalaryList = new List<PackUserSalary>(); |
|||
Task.Factory.StartNew(() => |
|||
{ |
|||
IsLoading = true; |
|||
var res = packTaskService.TotalPackUserSalary(searchUserName, StartTime, EndTime, PageIndex, PageSize); |
|||
if (res != null && res.Success) |
|||
{ |
|||
OrderCount = res.Data.TotalCount; |
|||
|
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
PackUserSalaryList = res.Data.PackUserSalaries; |
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
//foreach (var packUserSalary in res.Data.PackUserSalaries)
|
|||
//{
|
|||
// App.Current.Dispatcher.Invoke(() =>
|
|||
// {
|
|||
// PackUserSalaryList.Add(packUserSalary);
|
|||
// });
|
|||
//}
|
|||
} |
|||
else |
|||
{ |
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
PackUserSalaryList = new List<PackUserSalary>(); |
|||
}); |
|||
} |
|||
|
|||
IsLoading = false; |
|||
}); |
|||
|
|||
} |
|||
|
|||
private void Export() |
|||
{ |
|||
|
|||
SaveFileDialog save = new SaveFileDialog(); |
|||
save.Filter = "csv files(*.csv)|*.csv"; |
|||
var result = save.ShowDialog(); |
|||
if (result == null || !result.Value) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
string fileName = save.FileName; |
|||
|
|||
Task.Factory.StartNew(() => |
|||
{ |
|||
IsLoading = true; |
|||
var res = packTaskService.TotalPackUserSalary(SearchUserName, StartTime, EndTime, 0, 0);//获取全部数据
|
|||
if (res.Success) |
|||
{ |
|||
//string title = "任务ID,日期,是否结清,部门,店铺,对接人,sku名称,sku数量,增值服务,打包服务,耗材服务,原价,促销折扣,结算价格,对接备注";
|
|||
List<string> exportList = new List<string>(); |
|||
string title = "日期,花名,总收益"; |
|||
if (res.Data.TotalCount > 0) |
|||
{ |
|||
foreach (var item in res.Data.PackUserSalaries[0].IncomeItems) |
|||
{ |
|||
title += $",{item.Name}"; |
|||
} |
|||
exportList.Add(title); |
|||
|
|||
foreach (var packUserSalary in res.Data.PackUserSalaries) |
|||
{ |
|||
List<string> rowList =new List<string>(); |
|||
rowList.Add(packUserSalary.Date.ToString("yyyy-MM-dd")); |
|||
rowList.Add(packUserSalary.PackUserName); |
|||
rowList.Add(packUserSalary.TotalIncome.ToString("0.00")); |
|||
foreach (var incomeItem in packUserSalary.IncomeItems) |
|||
{ |
|||
rowList.Add(incomeItem.TotalPrice.ToString() ); |
|||
} |
|||
|
|||
exportList.Add(string.Join(",", rowList)); |
|||
} |
|||
|
|||
|
|||
} |
|||
//var excelList = res.Data.ShopTotals.Select(x => x.ToString()).ToList();
|
|||
//excelList.Insert(0, title);
|
|||
System.IO.File.WriteAllLines(fileName, exportList, Encoding.UTF8); |
|||
} |
|||
IsLoading = false; |
|||
|
|||
}); |
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,10 @@ |
|||
<UserControl x:Class="BBWY.Client.Views.TotalPackTask.PackUserSalaryControl" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:local="clr-namespace:BBWY.Client.Views.TotalPackTask" |
|||
mc:Ignorable="d" Background="White" |
|||
d:DesignHeight="450" d:DesignWidth="800"> |
|||
<Grid x:Name ="gd"/> |
|||
</UserControl> |
@ -0,0 +1,234 @@ |
|||
using BBWY.Client.Models.APIModel; |
|||
using BBWY.Client.Models.APIModel.Response.PackTask; |
|||
using BBWY.Client.Views.PackTask; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
using System.Text; |
|||
using System.Windows; |
|||
using System.Windows.Controls; |
|||
using System.Windows.Data; |
|||
using System.Windows.Documents; |
|||
using System.Windows.Input; |
|||
using System.Windows.Markup; |
|||
using System.Windows.Media; |
|||
using System.Windows.Media.Imaging; |
|||
using System.Windows.Navigation; |
|||
using System.Windows.Shapes; |
|||
|
|||
namespace BBWY.Client.Views.TotalPackTask |
|||
{ |
|||
/// <summary>
|
|||
/// PackUserSalaryControl.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
public partial class PackUserSalaryControl : UserControl |
|||
{ |
|||
public PackUserSalaryControl() |
|||
{ |
|||
InitializeComponent(); |
|||
} |
|||
|
|||
|
|||
|
|||
public List<PackUserSalary> PackUserSalaries |
|||
{ |
|||
get |
|||
{ |
|||
return (List<PackUserSalary>)GetValue(PackUserSalariesProperty); |
|||
|
|||
} |
|||
set |
|||
{ |
|||
SetValue(PackUserSalariesProperty, value); |
|||
} |
|||
} |
|||
|
|||
|
|||
public static readonly DependencyProperty PackUserSalariesProperty = |
|||
DependencyProperty.Register("PackUserSalaries", typeof(List<PackUserSalary>), typeof(PackUserSalaryControl), new PropertyMetadata(ChangedProperty)); |
|||
|
|||
|
|||
|
|||
|
|||
private static void ChangedProperty(DependencyObject d, DependencyPropertyChangedEventArgs e) |
|||
{ |
|||
var control = d as PackUserSalaryControl; |
|||
// control.Str
|
|||
var newValue = e.NewValue as List<PackUserSalary>; |
|||
control.PackUserSalaries = newValue; |
|||
|
|||
control.LoadData(); |
|||
} |
|||
|
|||
string xaml = @" <Grid xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"">
|
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height=""30""/> |
|||
[:Row:] |
|||
</Grid.RowDefinitions> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width=""30""/> |
|||
<ColumnDefinition Width=""80""/> |
|||
<ColumnDefinition MinWidth=""60""/> |
|||
<ColumnDefinition MinWidth=""60""/> |
|||
[:Column:] |
|||
</Grid.ColumnDefinitions> |
|||
<CheckBox HorizontalAlignment=""Center"" Grid.Column=""0"" HorizontalContentAlignment=""Center"" /> |
|||
<TextBlock Text=""日期"" Grid.Column=""1"" Style=""{StaticResource middleTextBlock}""/> |
|||
<TextBlock Text=""花名"" Grid.Column=""2"" Style=""{StaticResource middleTextBlock}""/> |
|||
<TextBlock Text=""总收益"" Grid.Column=""3"" Style=""{StaticResource middleTextBlock}""/> |
|||
[:HeaderNameList:] |
|||
<Border Width=""1"" HorizontalAlignment=""Left"" Background=""{StaticResource Border.Brush}"" Grid.RowSpan=""[:DataCount+1:]""/> |
|||
|
|||
<Border Width=""1"" HorizontalAlignment=""Right"" Background=""{StaticResource Border.Brush}"" Grid.Column=""0"" /> |
|||
<Border Width=""1"" HorizontalAlignment=""Right"" Background=""{StaticResource Border.Brush}"" Grid.Column=""1"" /> |
|||
<Border Width=""1"" HorizontalAlignment=""Right"" Background=""{StaticResource Border.Brush}"" Grid.Column=""2"" /> |
|||
<Border Width=""1"" HorizontalAlignment=""Right"" Background=""{StaticResource Border.Brush}"" Grid.Column=""3"" /> |
|||
[:BorderHeaderList:] |
|||
<Border Width=""1"" HorizontalAlignment=""Right"" Background=""{StaticResource Border.Brush}"" Grid.Column=""[:4+DataItemCount:]"" Grid.RowSpan=""[:DataCount+1:]""/> |
|||
|
|||
<Border Height=""1"" VerticalAlignment=""Top"" Grid.ColumnSpan=""[:4+DataItemCount:]"" Background=""{StaticResource Border.Brush}"" Grid.Row=""0""/> |
|||
<Border Height=""1"" VerticalAlignment=""Top"" Grid.ColumnSpan=""[:4+DataItemCount:]"" Background=""{StaticResource Border.Brush}"" Grid.Row=""1""/> |
|||
|
|||
[:DataList:] |
|||
|
|||
</Grid>";
|
|||
|
|||
|
|||
const string rows = @"<RowDefinition Height=""30""/>"; |
|||
string columns = @"<ColumnDefinition MinWidth=""60""/>"; |
|||
string headName = @"<TextBlock Text=""[:ServiceName:]"" Grid.Column=""[:ColumnIndex:]"" Grid.Row=""[:RowIndex:]"" Style=""{StaticResource middleTextBlock}""/>"; |
|||
string borderColumns = @" <Border Width=""1"" HorizontalAlignment=""Right"" Background=""{StaticResource Border.Brush}"" Grid.Column=""[:ColumnIndex:]"" Grid.Row=""[:RowIndex:]"" />"; |
|||
/// <summary>
|
|||
/// index 从1开始 0+1
|
|||
/// </summary>
|
|||
string rowStr = @"
|
|||
<CheckBox HorizontalAlignment=""Center"" Grid.Column=""0"" Grid.Row=""[:RowIndex:]"" HorizontalContentAlignment=""Center"" /> |
|||
<TextBlock Text=""[:Date:]"" Grid.Column=""1"" Grid.Row=""[:RowIndex:]"" Style=""{StaticResource middleTextBlock}""/> |
|||
<TextBlock Text=""[:PackUserName:]"" Grid.Column=""2"" Grid.Row=""[:RowIndex:]"" Style=""{StaticResource middleTextBlock}""/> |
|||
<TextBlock Text=""[:TotalIncome:]"" Grid.Column=""3"" Grid.Row=""[:RowIndex:]"" Style=""{StaticResource middleTextBlock}""/> |
|||
[:HeaderPriceList:] |
|||
<Border Width=""1"" HorizontalAlignment=""Right"" Background=""{StaticResource Border.Brush}"" Grid.Column=""0"" Grid.Row=""[:RowIndex:]""/> |
|||
<Border Width=""1"" HorizontalAlignment=""Right"" Background=""{StaticResource Border.Brush}"" Grid.Column=""1"" Grid.Row=""[:RowIndex:]""/> |
|||
<Border Width=""1"" HorizontalAlignment=""Right"" Background=""{StaticResource Border.Brush}"" Grid.Column=""2"" Grid.Row=""[:RowIndex:]""/> |
|||
<Border Width=""1"" HorizontalAlignment=""Right"" Background=""{StaticResource Border.Brush}"" Grid.Column=""3"" Grid.Row=""[:RowIndex:]""/> |
|||
<Border Width=""1"" HorizontalAlignment=""Right"" Background=""{StaticResource Border.Brush}"" Grid.Column=""4"" Grid.Row=""[:RowIndex:]""/> |
|||
[:BorderDataList:] |
|||
<Border Height=""1"" VerticalAlignment=""Bottom"" Grid.ColumnSpan=""[:4+DataItemCount:]"" Background=""{StaticResource Border.Brush}"" Grid.Row=""[:RowIndex:]""/>";
|
|||
|
|||
|
|||
|
|||
string serviceText = @" <TextBlock Text=""[:ServicePrice:]"" Grid.Column=""[:ColumnIndex:]"" Grid.Row=""[:RowIndex:]"" Style=""{StaticResource middleTextBlock}""/>"; |
|||
string serviceBorder = @" <Border Width=""1"" HorizontalAlignment=""Right"" Background=""{StaticResource Border.Brush}"" Grid.Column=""[:ColumnIndex:]"" Grid.Row=""[:RowIndex:]""/>"; |
|||
|
|||
public void LoadData() |
|||
{ |
|||
|
|||
if (PackUserSalaries == null ) |
|||
return; |
|||
|
|||
if ( PackUserSalaries.Count <= 0) |
|||
{ |
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
gd.Children.Clear(); |
|||
}); |
|||
} |
|||
|
|||
|
|||
try |
|||
{ |
|||
|
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
gd.Children.Clear(); |
|||
}); |
|||
|
|||
|
|||
var count = PackUserSalaries.Count; |
|||
|
|||
StringBuilder sbRow =new StringBuilder(); |
|||
for (int i = 0; i < count; i++) |
|||
{ |
|||
sbRow.AppendLine(rows); |
|||
} |
|||
string rowDefinition = sbRow.ToString(); |
|||
|
|||
StringBuilder sbColumn = new StringBuilder(); |
|||
var packServices = PackUserSalaries[0].IncomeItems;//服务项目列表
|
|||
var packServiceCount = packServices.Count; //服务项目数量
|
|||
|
|||
|
|||
|
|||
StringBuilder sbHeaderNameList = new StringBuilder(); |
|||
StringBuilder sbBorderHeaderList=new StringBuilder(); |
|||
|
|||
for (int i = 0; i < packServiceCount; i++) |
|||
{ |
|||
sbColumn.AppendLine(columns); |
|||
sbHeaderNameList.AppendLine(headName.Replace("[:ServiceName:]", packServices[i].Name) |
|||
.Replace("[:ColumnIndex:]", (i+4).ToString()) |
|||
.Replace("[:RowIndex:]", "0")); |
|||
sbBorderHeaderList.AppendLine(borderColumns.Replace("[:ColumnIndex:]", (i + 4).ToString()) |
|||
.Replace("[:RowIndex:]", "0")); |
|||
} |
|||
|
|||
string columnDefinition = sbColumn.ToString(); |
|||
string HeaderNameList= sbHeaderNameList.ToString(); |
|||
|
|||
|
|||
StringBuilder dataListSB= new StringBuilder(); |
|||
for (int i = 0; i < PackUserSalaries.Count; i++) |
|||
{ |
|||
|
|||
var rowIndex = 1 + i; |
|||
StringBuilder headerPriceListSB = new StringBuilder(); |
|||
StringBuilder serviceBorderSB = new StringBuilder(); |
|||
for (int j = 0; j < PackUserSalaries[i].IncomeItems.Count; j++) |
|||
{ |
|||
var columnIndex = 4 + j;//[:HeaderPriceList:]
|
|||
headerPriceListSB.AppendLine(serviceText.Replace("[:ServicePrice:]", PackUserSalaries[i].IncomeItems[j].TotalPrice.ToString()) |
|||
.Replace("[:ColumnIndex:]", columnIndex.ToString()) |
|||
.Replace("[:RowIndex:]", rowIndex.ToString())); |
|||
|
|||
serviceBorderSB.AppendLine(serviceBorder.Replace("[:ColumnIndex:]", columnIndex.ToString()) |
|||
.Replace("[:RowIndex:]", rowIndex.ToString())); |
|||
} |
|||
dataListSB.AppendLine(rowStr.Replace("[:Date:]", PackUserSalaries[i].Date.ToString("yyyy-MM-dd")) |
|||
.Replace("[:PackUserName:]", PackUserSalaries[i].PackUserName) |
|||
.Replace("[:TotalIncome:]", PackUserSalaries[i].TotalIncome.ToString("0.00")) |
|||
.Replace("[:HeaderPriceList:]", headerPriceListSB.ToString()) |
|||
.Replace("[:BorderDataList:]", serviceBorderSB.ToString()) |
|||
.Replace("[:RowIndex:]", rowIndex.ToString()) |
|||
.Replace("[:4+DataItemCount:]", (packServiceCount+4).ToString()) |
|||
); |
|||
} |
|||
|
|||
|
|||
var newGrid = xaml.Replace("[:Row:]", rowDefinition) |
|||
.Replace("[:Column:]", columnDefinition) |
|||
.Replace("[:HeaderNameList:]", HeaderNameList) |
|||
.Replace("[:DataCount+1:]", (count+1).ToString()) |
|||
.Replace("[:4+DataItemCount:]", (packServiceCount + 4).ToString()) |
|||
.Replace("[:BorderHeaderList:]", sbBorderHeaderList.ToString()) |
|||
.Replace("[:DataList:]", dataListSB.ToString()); |
|||
|
|||
|
|||
|
|||
var grid = XamlReader.Parse(newGrid) as Grid; |
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
gd.Children.Add(grid); |
|||
}); |
|||
|
|||
} |
|||
catch |
|||
{ |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
} |
|||
} |
@ -0,0 +1,170 @@ |
|||
<Page x:Class="BBWY.Client.Views.TotalPackTask.PackUserSalaryList" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:local="clr-namespace:BBWY.Client.Views.TotalPackTask" |
|||
mc:Ignorable="d" |
|||
xmlns:b="http://schemas.microsoft.com/xaml/behaviors" |
|||
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" |
|||
Background="White" |
|||
DataContext="{Binding PackUserSalary,Source={StaticResource Locator}}" |
|||
xmlns:sys="clr-namespace:System;assembly=mscorlib" |
|||
d:DesignHeight="450" d:DesignWidth="1000" |
|||
Title="PackUserSalaryList"> |
|||
|
|||
<Page.Resources> |
|||
|
|||
<sys:Int32 x:Key="d0">0</sys:Int32> |
|||
<sys:Int32 x:Key="d1">1</sys:Int32> |
|||
<sys:Int32 x:Key="d3">2</sys:Int32> |
|||
<sys:Int32 x:Key="d7">6</sys:Int32> |
|||
<sys:Int32 x:Key="d15">14</sys:Int32> |
|||
<sys:Int32 x:Key="d30">29</sys:Int32> |
|||
|
|||
</Page.Resources> |
|||
<Grid> |
|||
<c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999"/> |
|||
<StackPanel Background="Black" Panel.ZIndex="100" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Vertical" Margin="400,13,0,0" Width="150"> |
|||
<c:BTextBox x:Name="tbUserName" Text="{Binding SearchUserName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" TextChanged="tbUserName_TextChanged" Width="150" Height="30" ></c:BTextBox> |
|||
<ListBox MaxHeight="300" x:Name="tipBoxUserName" SelectionChanged="tipBoxUserName_SelectionChanged" Background="{StaticResource Border.Background}"> |
|||
|
|||
</ListBox> |
|||
</StackPanel> |
|||
<Grid Margin="5,0"> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="90"/> |
|||
<RowDefinition/> |
|||
<RowDefinition Height="30"/> |
|||
</Grid.RowDefinitions> |
|||
<Grid Background="{StaticResource Border.Background}" HorizontalAlignment="Left" Height="75" Panel.ZIndex="999"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition Width="auto"/> |
|||
</Grid.ColumnDefinitions> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="0.5*"/> |
|||
<RowDefinition Height="5"/> |
|||
<RowDefinition Height="0.5*"/> |
|||
</Grid.RowDefinitions> |
|||
<StackPanel Orientation="Horizontal" Margin="0,5,0,0" Height="30"> |
|||
<StackPanel.Resources> |
|||
<Style TargetType="DatePickerTextBox"> |
|||
<Setter Property="IsReadOnly" Value="True"/> |
|||
</Style> |
|||
</StackPanel.Resources> |
|||
<TextBlock Text="下单时间" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<DatePicker SelectedDate="{Binding StartTime}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="5,0,0,0"/> |
|||
<DatePicker SelectedDate="{Binding EndTime}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="5,0,0,0"/> |
|||
<TextBlock Text="花名:" VerticalAlignment="Center" Margin="30,0,0,0"/> |
|||
|
|||
</StackPanel> |
|||
<StackPanel Orientation="Horizontal" Grid.Row="2" Margin="0,0,0,5" Height="30"> |
|||
<c:BButton Content="今天" Width="50" Height="25" Margin="5,0,0,0" |
|||
Command="{Binding SetSearchDateCommand}" |
|||
CommandParameter="{StaticResource d0}"/> |
|||
<c:BButton Content="昨天" Width="50" Height="25" Margin="5,0,0,0" |
|||
Command="{Binding SetSearchDateCommand}" |
|||
CommandParameter="{StaticResource d1}"/> |
|||
<c:BButton Content="近3天" Width="50" Height="25" Margin="5,0,0,0" |
|||
Command="{Binding SetSearchDateCommand}" |
|||
CommandParameter="{StaticResource d3}"/> |
|||
<c:BButton Content="近7天" Width="50" Height="24" Margin="5,0,0,0" |
|||
Command="{Binding SetSearchDateCommand}" |
|||
CommandParameter="{StaticResource d7}"/> |
|||
<c:BButton Content="近15天" Width="50" Height="25" Margin="5,0,0,0" |
|||
Command="{Binding SetSearchDateCommand}" |
|||
CommandParameter="{StaticResource d15}"/> |
|||
<c:BButton Content="近30天" Width="50" Height="25" Margin="5,0,0,0" |
|||
Command="{Binding SetSearchDateCommand}" |
|||
CommandParameter="{StaticResource d30}"/> |
|||
|
|||
</StackPanel> |
|||
|
|||
<Grid Grid.Column="1" Grid.RowSpan="3" Margin="300 0 0 0"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
<Button Content="搜索" Width="50" VerticalAlignment="Stretch" Margin="5,0,0,0" Command="{Binding SearchPackUserSalaryCommand}" |
|||
Background="#8080ff" BorderThickness="0" Foreground="White"/> |
|||
<Button Content="导出" Command="{Binding ExportCommand}" Width="50" Grid.Column="1" |
|||
Background="#02a7f0" BorderThickness="0" Foreground="White"/> |
|||
|
|||
</Grid> |
|||
</Grid> |
|||
|
|||
|
|||
|
|||
<Grid Grid.Row="1" > |
|||
<local:PackUserSalaryControl PackUserSalaries="{Binding PackUserSalaryList,Mode=TwoWay}"/> |
|||
|
|||
</Grid> |
|||
|
|||
<!--<Grid> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition Height="30"/> |
|||
|
|||
</Grid.RowDefinitions> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="30"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="80"/> |
|||
<ColumnDefinition MinWidth="80"/> |
|||
<ColumnDefinition MinWidth="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
</Grid.ColumnDefinitions> |
|||
|
|||
<CheckBox HorizontalAlignment="Center" Grid.Column="0" HorizontalContentAlignment="Center" /> |
|||
<TextBlock Text="任务ID" Grid.Column="1" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="日期" Grid.Column="2" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="花名" Grid.Column="3" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="总收益" Grid.Column="4" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="基础包装" Grid.Column="5" Style="{StaticResource middleTextBlock}"/> |
|||
<Border Width="1" HorizontalAlignment="Left" Background="{StaticResource Border.Brush}" Grid.RowSpan="2"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="0" /> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="1" /> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="2" /> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="3" /> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="4" /> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="5" Grid.RowSpan="2"/> |
|||
|
|||
<Border Height="1" VerticalAlignment="Top" Grid.ColumnSpan="18" Background="{StaticResource Border.Brush}" Grid.Row="0"/> |
|||
<Border Height="1" VerticalAlignment="Top" Grid.ColumnSpan="18" Background="{StaticResource Border.Brush}" Grid.Row="1"/> |
|||
<Border Height="1" VerticalAlignment="Bottom" Grid.ColumnSpan="18" Background="{StaticResource Border.Brush}" Grid.Row="1"/> |
|||
|
|||
<CheckBox HorizontalAlignment="Center" Grid.Row="1" HorizontalContentAlignment="Center" /> |
|||
<TextBlock Text="123456" Grid.Column="1" Grid.Row="1" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="2021-04-03" Grid.Column="2" Grid.Row="1" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="齐越苹果" Grid.Column="3" Grid.Row="1" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="100.00" Grid.Column="4" Grid.Row="1" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="20.00" Grid.Column="5" Grid.Row="1" Style="{StaticResource middleTextBlock}"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="0" Grid.Row="1"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="1" Grid.Row="1"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="2" Grid.Row="1"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="3" Grid.Row="1"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="4" Grid.Row="1"/> |
|||
|
|||
|
|||
</Grid>--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<c:PageControl PageIndex="{Binding PageIndex}" |
|||
PageSize="{Binding PageSize}" |
|||
RecordCount="{Binding OrderCount}" |
|||
Grid.Row="3" |
|||
HorizontalAlignment="Left"> |
|||
<b:Interaction.Triggers> |
|||
<b:EventTrigger EventName="OnPageIndexChanged"> |
|||
<b:InvokeCommandAction Command="{Binding OrderPageIndexChangedCommand}" PassEventArgsToCommand="True"/> |
|||
</b:EventTrigger> |
|||
</b:Interaction.Triggers> |
|||
</c:PageControl> |
|||
</Grid> |
|||
</Grid> |
|||
</Page> |
@ -0,0 +1,109 @@ |
|||
using BBWY.Client.APIServices; |
|||
using BBWY.Client.ViewModels; |
|||
using BBWY.Client.ViewModels.TotalPackTask; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Windows; |
|||
using System.Windows.Controls; |
|||
using System.Windows.Data; |
|||
using System.Windows.Documents; |
|||
using System.Windows.Input; |
|||
using System.Windows.Media; |
|||
using System.Windows.Media.Imaging; |
|||
using System.Windows.Navigation; |
|||
using System.Windows.Shapes; |
|||
|
|||
namespace BBWY.Client.Views.TotalPackTask |
|||
{ |
|||
/// <summary>
|
|||
/// PackUserSalaryList.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
public partial class PackUserSalaryList : Page |
|||
{ |
|||
public PackUserSalaryList() |
|||
{ |
|||
InitializeComponent(); |
|||
this.Loaded += PackUserSalaryList_Loaded; |
|||
} |
|||
|
|||
private void PackUserSalaryList_Loaded(object sender, RoutedEventArgs e) |
|||
{ |
|||
var packUserSalaryViewModel = new ViewModelLocator().PackUserSalary; |
|||
packTaskService = packUserSalaryViewModel.packTaskService; |
|||
var packUser = packTaskService.GetPackMembers(); |
|||
if (packUser != null && packUser.Success) users = packUser.Data.Select(p => p.UserName).ToList(); |
|||
} |
|||
List<string> users =new List<string>(); |
|||
PackTaskService packTaskService; |
|||
private void tbUserName_TextChanged(object sender, TextChangedEventArgs e) |
|||
{ |
|||
try |
|||
{ |
|||
var textBoxt = (TextBox)sender; |
|||
//创建一个ListBox
|
|||
|
|||
if (tipBoxUserName != null && tipBoxUserName.Items.Count > 0) |
|||
{ |
|||
tipBoxUserName.Items.Clear(); |
|||
|
|||
} |
|||
|
|||
if (users.Count <= 0) |
|||
{ |
|||
var packUser = packTaskService.GetPackMembers(); |
|||
if (packUser != null && packUser.Success) users = packUser.Data.Select(p => p.UserName).ToList(); |
|||
} |
|||
|
|||
if (string.IsNullOrEmpty(textBoxt.Text)) |
|||
{ |
|||
tipBoxUserName.Visibility = Visibility.Collapsed; |
|||
return; |
|||
} |
|||
foreach (var department in users) |
|||
{ |
|||
if (department.Contains(textBoxt.Text)) |
|||
{ |
|||
ListBoxItem item = new ListBoxItem(); |
|||
Label lb = new Label(); |
|||
lb.Content = department; |
|||
item.Content = lb; |
|||
tipBoxUserName.Items.Add(item); |
|||
} |
|||
|
|||
} |
|||
|
|||
tipBoxUserName.Visibility = Visibility.Visible; |
|||
} |
|||
catch (Exception) |
|||
{ |
|||
|
|||
|
|||
} |
|||
} |
|||
|
|||
private void tipBoxUserName_SelectionChanged(object sender, SelectionChangedEventArgs e) |
|||
{ |
|||
try |
|||
{ |
|||
var list = (ListBox)sender; |
|||
if (list.Items.Count <= 0) |
|||
{ |
|||
return; |
|||
} |
|||
var value = (ListBoxItem)list.SelectedValue; |
|||
var content = (Label)value.Content; |
|||
tbUserName.Text = content.Content.ToString(); |
|||
tipBoxUserName.Visibility = Visibility.Collapsed; |
|||
} |
|||
catch (Exception) |
|||
{ |
|||
|
|||
|
|||
} |
|||
} |
|||
|
|||
|
|||
} |
|||
} |
Loading…
Reference in new issue