3493 changed files with 169707 additions and 0 deletions
@ -0,0 +1,4 @@ |
|||
[*.cs] |
|||
|
|||
# CS1591: 缺少对公共可见类型或成员的 XML 注释 |
|||
dotnet_diagnostic.CS1591.severity = none |
@ -0,0 +1,58 @@ |
|||
using BBWY.Common.Http; |
|||
using BBWY.Common.Models; |
|||
using Newtonsoft.Json; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Net.Http; |
|||
using Microsoft.Extensions.Configuration; |
|||
namespace BBWY.Client.APIServices |
|||
{ |
|||
public class BaseApiService |
|||
{ |
|||
private RestApiService restApiService; |
|||
|
|||
protected GlobalContext globalContext; |
|||
|
|||
public BaseApiService(RestApiService restApiService, GlobalContext globalContext) |
|||
{ |
|||
this.restApiService = restApiService; |
|||
this.globalContext = globalContext; |
|||
} |
|||
|
|||
protected ApiResponse<T> SendRequest<T>(string apiHost, |
|||
string apiPath, |
|||
object param, |
|||
IDictionary<string, string> headers, |
|||
HttpMethod httpMethod, |
|||
string contentType = RestApiService.ContentType_Json, |
|||
ParamPosition paramPosition = ParamPosition.Body, |
|||
bool enableRandomTimeStamp = false) |
|||
{ |
|||
try |
|||
{ |
|||
if (headers == null) |
|||
headers = new Dictionary<string, string>(); |
|||
if (!headers.ContainsKey("ClientCode")) |
|||
headers.Add("ClientCode", "BBWY"); |
|||
if (!headers.ContainsKey("ClientVersion")) |
|||
headers.Add("ClientVersion", "1.0.0.0"); |
|||
if (!headers.ContainsKey("Authorization") && !string.IsNullOrEmpty(globalContext.User?.Token)) |
|||
headers.Add("Authorization", $"Bearer {globalContext.User.Token}"); |
|||
if (!headers.ContainsKey("qy")) |
|||
headers.Add("qy", "qy"); |
|||
|
|||
var result = restApiService.SendRequest(apiHost, apiPath, param, headers, httpMethod, contentType, paramPosition, enableRandomTimeStamp); |
|||
if (result.StatusCode != System.Net.HttpStatusCode.OK && |
|||
result.Content.Contains("\"Success\"") && |
|||
result.Content.Contains("\"Msg\"") && |
|||
result.Content.Contains("\"Data\"")) |
|||
throw new BusinessException($"{result.StatusCode} {result.Content}") { Code = (int)result.StatusCode }; |
|||
return JsonConvert.DeserializeObject<ApiResponse<T>>(result.Content); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
return ApiResponse<T>.Error((ex is BusinessException) ? (ex as BusinessException).Code : 0, ex.Message); |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,32 @@ |
|||
using BBWY.Client.Models; |
|||
using BBWY.Common.Http; |
|||
using BBWY.Common.Models; |
|||
using System.Collections.Generic; |
|||
using System.Net.Http; |
|||
|
|||
namespace BBWY.Client.APIServices |
|||
{ |
|||
public class MdsApiService : BaseApiService, IDenpendency |
|||
{ |
|||
public MdsApiService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public ApiResponse<MDSUserResponse> GetUserInfo(string userToken) |
|||
{ |
|||
return SendRequest<MDSUserResponse>(globalContext.MDSApiHost, |
|||
"/TaskList/User/GetUserInfo", |
|||
null, |
|||
new Dictionary<string, string>() |
|||
{ |
|||
{ "Authorization", $"Bearer {userToken}" } |
|||
}, HttpMethod.Get); |
|||
} |
|||
|
|||
public ApiResponse<IList<ShopResponse>> GetShopsByUserId(long userId) |
|||
{ |
|||
return SendRequest<IList<ShopResponse>>(globalContext.MDSApiHost, "TaskList/Shop/GetShopsByUserId", $"userId={userId}", null, System.Net.Http.HttpMethod.Get); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,50 @@ |
|||
using BBWY.Common.Http; |
|||
using BBWY.Common.Models; |
|||
using Newtonsoft.Json.Linq; |
|||
using System; |
|||
using System.Net.Http; |
|||
|
|||
namespace BBWY.Client.APIServices |
|||
{ |
|||
public class OneBoundAPIService : IDenpendency |
|||
{ |
|||
private RestApiService restApiService; |
|||
private string key = "t5060712539"; |
|||
private string secret = "20211103"; |
|||
|
|||
public OneBoundAPIService(RestApiService restApiService) |
|||
{ |
|||
this.restApiService = restApiService; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 产品详细信息接口
|
|||
/// </summary>
|
|||
/// <param name="platform">1699/jd/taobao 更多值参阅https://open.onebound.cn/help/api/</param>
|
|||
/// <param name="key"></param>
|
|||
/// <param name="secret"></param>
|
|||
/// <param name="productId"></param>
|
|||
/// <returns></returns>
|
|||
public ApiResponse<JObject> GetProductInfo(string platform, string productId) |
|||
{ |
|||
try |
|||
{ |
|||
var result = restApiService.SendRequest("https://api-gw.onebound.cn/", $"{platform}/item_get", $"key={key}&secret={secret}&num_iid={productId}&lang=zh-CN", null, HttpMethod.Get, paramPosition: ParamPosition.Query, enableRandomTimeStamp: true); |
|||
if (result.StatusCode != System.Net.HttpStatusCode.OK) |
|||
throw new Exception($"{result.StatusCode} {result.Content}"); |
|||
|
|||
var j = JObject.Parse(result.Content); |
|||
return new ApiResponse<JObject>() |
|||
{ |
|||
Data = j, |
|||
Code = j.Value<string>("error_code") == "0000" ? 200 : 0, |
|||
Msg = j.Value<string>("error") |
|||
}; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
return ApiResponse<JObject>.Error(0, ex.Message); |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,129 @@ |
|||
using BBWY.Client.Models; |
|||
using BBWY.Common.Http; |
|||
using BBWY.Common.Models; |
|||
using System; |
|||
using System.Net.Http; |
|||
|
|||
namespace BBWY.Client.APIServices |
|||
{ |
|||
public class OrderService : BaseApiService, IDenpendency |
|||
{ |
|||
public OrderService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public ApiResponse<OrderListResponse> GetOrderList(string orderId, |
|||
DateTime startDate, |
|||
DateTime endDate, |
|||
OrderState? orderState, |
|||
string sku, |
|||
string productNo, |
|||
string waybill, |
|||
string contactName, |
|||
int pageIndex, int pageSize, |
|||
long shopId) |
|||
{ |
|||
return SendRequest<OrderListResponse>(globalContext.BBYWApiHost, "api/order/getOrderList", new |
|||
{ |
|||
orderId, |
|||
startDate, |
|||
EndDate = endDate.Date.AddDays(1).AddSeconds(-1), |
|||
orderState, |
|||
pageIndex, |
|||
pageSize, |
|||
shopId, |
|||
sku, |
|||
productNo, |
|||
waybill, |
|||
contactName |
|||
}, null, HttpMethod.Post); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 解密收货人信息
|
|||
/// </summary>
|
|||
/// <param name="orderId"></param>
|
|||
/// <returns></returns>
|
|||
public ApiResponse<ConsigneeSimpleResponse> DecodeConsignee(string orderId) |
|||
{ |
|||
return SendRequest<ConsigneeSimpleResponse>(globalContext.BBYWApiHost, "Api/Order/DecryptConsignee", new |
|||
{ |
|||
globalContext.User.Shop.Platform, |
|||
globalContext.User.Shop.AppKey, |
|||
globalContext.User.Shop.AppSecret, |
|||
globalContext.User.Shop.AppToken, |
|||
saveResponseLog = true, |
|||
orderId, |
|||
saveDb = true |
|||
}, null, HttpMethod.Post); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 自动计算成本
|
|||
/// </summary>
|
|||
/// <param name="orderId"></param>
|
|||
/// <param name="isSetStorageType">是否设置仓储类型</param>
|
|||
/// <param name="storageType"></param>
|
|||
/// <returns></returns>
|
|||
public ApiResponse<object> AutoCalculationCost(string orderId, bool isSetStorageType, StorageType storageType) |
|||
{ |
|||
return SendRequest<object>(globalContext.BBYWApiHost, "api/order/AutoCalculationCost", new { orderId, isSetStorageType, storageType }, null, HttpMethod.Post); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 手动计算成本
|
|||
/// </summary>
|
|||
/// <param name="orderId"></param>
|
|||
/// <param name="isSetStorageType">是否设置仓储类型</param>
|
|||
/// <param name="storageType"></param>
|
|||
/// <returns></returns>
|
|||
public ApiResponse<object> ManualCalculationCost(string orderId, bool isSetStorageType, StorageType storageType, decimal purchaseCost, decimal deliveryExpressFreight) |
|||
{ |
|||
return SendRequest<object>(globalContext.BBYWApiHost, "api/order/ManualCalculationCost", |
|||
new |
|||
{ |
|||
orderId, |
|||
isSetStorageType, |
|||
storageType, |
|||
purchaseCost, |
|||
deliveryExpressFreight |
|||
}, null, HttpMethod.Post); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 设置刷单成本
|
|||
/// </summary>
|
|||
/// <param name="orderId"></param>
|
|||
/// <param name="isSetStorageType"></param>
|
|||
/// <param name="sdCommissionAmount"></param>
|
|||
/// <param name="deliveryExpressFreight"></param>
|
|||
/// <param name="sdType"></param>
|
|||
/// <param name="flag"></param>
|
|||
/// <param name="venderRemark"></param>
|
|||
/// <returns></returns>
|
|||
public ApiResponse<object> SDCalculationCost(string orderId, |
|||
bool isSetStorageType, |
|||
decimal sdCommissionAmount, |
|||
decimal deliveryExpressFreight, |
|||
SDType sdType, |
|||
string flag, |
|||
string venderRemark) |
|||
{ |
|||
return SendRequest<object>(globalContext.BBYWApiHost, "api/order/SDCalculationCost", new |
|||
{ |
|||
orderId, |
|||
isSetStorageType, |
|||
flag, |
|||
venderRemark, |
|||
sdType, |
|||
sdCommissionAmount, |
|||
deliveryExpressFreight, |
|||
Platform = globalContext.User.Shop.Platform, |
|||
AppKey = globalContext.User.Shop.AppKey, |
|||
AppSecret = globalContext.User.Shop.AppSecret, |
|||
AppToken = globalContext.User.Shop.AppToken |
|||
}, null, HttpMethod.Post); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,49 @@ |
|||
using BBWY.Client.Models; |
|||
using BBWY.Common.Http; |
|||
using BBWY.Common.Models; |
|||
using System.Collections.Generic; |
|||
using System.Net.Http; |
|||
|
|||
namespace BBWY.Client.APIServices |
|||
{ |
|||
public class ProductService : BaseApiService, IDenpendency |
|||
{ |
|||
public ProductService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) { } |
|||
|
|||
public ApiResponse<ProductListResponse> GetProductList(string spu, string productName, string productItem, int pageIndex) |
|||
{ |
|||
return SendRequest<ProductListResponse>(globalContext.BBYWApiHost, |
|||
"api/product/GetProductList", |
|||
new |
|||
{ |
|||
Spu = spu, |
|||
ProductName = productName, |
|||
ProductItem = productItem, |
|||
PageIndex = pageIndex, |
|||
Platform = globalContext.User.Shop.Platform, |
|||
AppKey = globalContext.User.Shop.AppKey, |
|||
AppSecret = globalContext.User.Shop.AppSecret, |
|||
AppToken = globalContext.User.Shop.AppToken |
|||
}, |
|||
null, |
|||
HttpMethod.Post); |
|||
} |
|||
|
|||
public ApiResponse<IList<ProductSku>> GetProductSkuList(string spu, string sku) |
|||
{ |
|||
return SendRequest<IList<ProductSku>>(globalContext.BBYWApiHost, |
|||
"api/product/GetProductSkuList", |
|||
new |
|||
{ |
|||
Spu = spu, |
|||
Sku = sku, |
|||
Platform = globalContext.User.Shop.Platform, |
|||
AppKey = globalContext.User.Shop.AppKey, |
|||
AppSecret = globalContext.User.Shop.AppSecret, |
|||
AppToken = globalContext.User.Shop.AppToken |
|||
}, |
|||
null, |
|||
HttpMethod.Post); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,52 @@ |
|||
using BBWY.Client.Models; |
|||
using BBWY.Common.Http; |
|||
using BBWY.Common.Models; |
|||
using System.Collections.Generic; |
|||
using System.Net.Http; |
|||
|
|||
namespace BBWY.Client.APIServices |
|||
{ |
|||
public class PurchaseOrderService : BaseApiService, IDenpendency |
|||
{ |
|||
public PurchaseOrderService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public ApiResponse<object> AddPurchaseOrder(PurchaseOrder purchaseOrder) |
|||
{ |
|||
return SendRequest<object>(globalContext.BBYWApiHost, |
|||
"api/PurchaseOrder/AddPurchaseOrder", |
|||
purchaseOrder, |
|||
null, |
|||
HttpMethod.Post); |
|||
} |
|||
|
|||
public ApiResponse<object> EditPurchaseOrder(PurchaseOrder purchaseOrder) |
|||
{ |
|||
return SendRequest<object>(globalContext.BBYWApiHost, |
|||
"api/PurchaseOrder/EditPurchaseOrder", |
|||
purchaseOrder, |
|||
null, |
|||
HttpMethod.Put); |
|||
} |
|||
|
|||
public ApiResponse<IList<PurchaseOrderResponse>> GetList(IList<string> skuIdList, StorageType storageType, long shopId) |
|||
{ |
|||
return SendRequest<IList<PurchaseOrderResponse>>(globalContext.BBYWApiHost, |
|||
"api/PurchaseOrder/GetList", |
|||
new { SkuIdList = skuIdList, StorageType = storageType, ShopId = shopId }, |
|||
null, |
|||
HttpMethod.Post); |
|||
} |
|||
|
|||
public ApiResponse<object> DeletePurchaseOrder(long id) |
|||
{ |
|||
return SendRequest<object>(globalContext.BBYWApiHost, |
|||
$"api/purchaseOrder/deletePurchaseOrder/{id}", |
|||
null, |
|||
null, |
|||
HttpMethod.Delete); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,50 @@ |
|||
using BBWY.Client.Models; |
|||
using BBWY.Common.Http; |
|||
using BBWY.Common.Models; |
|||
using System.Collections.Generic; |
|||
using System.Net.Http; |
|||
|
|||
namespace BBWY.Client.APIServices |
|||
{ |
|||
public class PurchaseService : BaseApiService, IDenpendency |
|||
{ |
|||
public PurchaseService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) { } |
|||
|
|||
/// <summary>
|
|||
/// 获取采购方案
|
|||
/// </summary>
|
|||
/// <param name="productIdList">产品Id</param>
|
|||
/// <param name="purchaserId">采购商Id</param>
|
|||
/// <returns></returns>
|
|||
public ApiResponse<IList<PurchaseSchemeResponse>> GetPurchaseSchemeList(IList<string> productIdList, string purchaserId, long shopId) |
|||
{ |
|||
return SendRequest<IList<PurchaseSchemeResponse>>(globalContext.BBYWApiHost, |
|||
"api/PurchaseScheme/GetPurchaseSchemeList", |
|||
new { productIdList, purchaserId, shopId }, |
|||
null, |
|||
HttpMethod.Post); |
|||
} |
|||
|
|||
public ApiResponse<object> EditPurchaseScheme(IList<PurchaseScheme> addPurchaseSchemeList, IList<PurchaseScheme> editPurchaseSchemeList) |
|||
{ |
|||
return SendRequest<object>(globalContext.BBYWApiHost, |
|||
"api/purchasescheme/EditPurchaseScheme", |
|||
new |
|||
{ |
|||
AddPurchaseSchemeList = addPurchaseSchemeList, |
|||
EditPurchaseSchemeList = editPurchaseSchemeList |
|||
}, |
|||
null, |
|||
HttpMethod.Post); |
|||
} |
|||
|
|||
public ApiResponse<object> DeletePurchaser(string productId, string purchaserId) |
|||
{ |
|||
return SendRequest<object>(globalContext.BBYWApiHost, |
|||
"api/purchasescheme/DeletePurchaser", |
|||
new { productId, purchaserId }, |
|||
null, |
|||
HttpMethod.Delete); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,28 @@ |
|||
using BBWY.Client.Models; |
|||
using BBWY.Common.Http; |
|||
using BBWY.Common.Models; |
|||
using System.Net.Http; |
|||
|
|||
namespace BBWY.Client.APIServices |
|||
{ |
|||
public class StatisticsService : BaseApiService, IDenpendency |
|||
{ |
|||
public StatisticsService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) |
|||
{ |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 今日业绩统计
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
public ApiResponse<ToDayOrderAchievementResponse> GetTodayAchievementStatistics() |
|||
{ |
|||
return SendRequest<ToDayOrderAchievementResponse>(globalContext.BBYWApiHost, "Api/Statistics/GetTodayAchievementStatistics", new |
|||
{ |
|||
ShopId = globalContext.User.Shop.ShopId |
|||
}, |
|||
null, HttpMethod.Post); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,25 @@ |
|||
<Application x:Class="BBWY.Client.App" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:local="clr-namespace:BBWY.Client" |
|||
xmlns:vm="clr-namespace:BBWY.Client.ViewModels" |
|||
xmlns:ctr="clr-namespace:BBWY.Client.Converters" |
|||
StartupUri="/Views/MainWindow.xaml" |
|||
ShutdownMode="OnExplicitShutdown"> |
|||
<Application.Resources> |
|||
<ResourceDictionary> |
|||
<ResourceDictionary.MergedDictionaries> |
|||
<ResourceDictionary Source="/Resources/Themes/Color.xaml"/> |
|||
<ResourceDictionary Source="/Resources/Themes/Path.xaml"/> |
|||
<ResourceDictionary Source="/Resources/Themes/Generic.xaml"/> |
|||
<ResourceDictionary Source="/Resources/Themes/DataTemplate.xaml"/> |
|||
</ResourceDictionary.MergedDictionaries> |
|||
|
|||
<vm:ViewModelLocator x:Key="Locator"/> |
|||
<ctr:ObjectConverter x:Key="objConverter"/> |
|||
<ctr:MultiObjectConverter x:Key="mobjConverter"/> |
|||
<ctr:WidthConveter x:Key="widthConverter"/> |
|||
<ctr:InputNumberConverter x:Key="inputNumberConverter"/> |
|||
</ResourceDictionary> |
|||
</Application.Resources> |
|||
</Application> |
@ -0,0 +1,72 @@ |
|||
using BBWY.Client.Models; |
|||
using BBWY.Common.Extensions; |
|||
using BBWY.Common.Http; |
|||
using BBWY.Common.Models; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using System; |
|||
using System.IO; |
|||
using System.Reflection; |
|||
using System.Threading.Tasks; |
|||
using System.Windows; |
|||
|
|||
namespace BBWY.Client |
|||
{ |
|||
/// <summary>
|
|||
/// Interaction logic for App.xaml
|
|||
/// </summary>
|
|||
public partial class App : Application |
|||
{ |
|||
public IServiceProvider ServiceProvider { get; private set; } |
|||
public IConfiguration Configuration { get; private set; } |
|||
|
|||
protected override void OnStartup(StartupEventArgs e) |
|||
{ |
|||
var gl = new GlobalContext(); |
|||
|
|||
#region 注册全局异常
|
|||
this.DispatcherUnhandledException += App_DispatcherUnhandledException; ; |
|||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; ; |
|||
TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; ; |
|||
#endregion
|
|||
|
|||
var applicationPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); |
|||
var builder = new ConfigurationBuilder().SetBasePath(applicationPath).AddJsonFile("BBWYAppSettings.json", false, true); |
|||
Configuration = builder.Build(); |
|||
gl.BBYWApiHost = Configuration.GetSection("BBWYApiHost").Value; |
|||
gl.MDSApiHost = Configuration.GetSection("MDSApiHost").Value; |
|||
gl.JOSApiHost = Configuration.GetSection("JOSApiHost").Value; |
|||
gl._1688ApiHost = Configuration.GetSection("1688ApiHost").Value; |
|||
|
|||
IServiceCollection serviceCollection = new ServiceCollection(); |
|||
serviceCollection.AddHttpClient(); |
|||
serviceCollection.AddSingleton<RestApiService>(); |
|||
serviceCollection.AddSingleton(gl); |
|||
//serviceCollection.AddSingleton<MainViewModel>();
|
|||
//serviceCollection.AddSingleton<WareManagerViewModel>();
|
|||
//serviceCollection.AddSingleton<WareStockViewModel>();
|
|||
serviceCollection.BatchRegisterServices(new Assembly[] { Assembly.Load("BBWY.Client") }, typeof(IDenpendency)); |
|||
|
|||
serviceCollection.AddMapper(new MappingProfile()); |
|||
|
|||
ServiceProvider = serviceCollection.BuildServiceProvider(); |
|||
base.OnStartup(e); |
|||
} |
|||
|
|||
private void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e) |
|||
{ |
|||
Console.WriteLine(e.Exception); |
|||
e.SetObserved(); |
|||
} |
|||
|
|||
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) |
|||
{ |
|||
Console.WriteLine(e.Exception); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,10 @@ |
|||
using System.Windows; |
|||
|
|||
[assembly: ThemeInfo( |
|||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
|||
//(used if a resource is not found in the page,
|
|||
// or application resource dictionaries)
|
|||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
|||
//(used if a resource is not found in the page,
|
|||
// app, or any theme specific resource dictionaries)
|
|||
)] |
@ -0,0 +1,58 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> |
|||
|
|||
<PropertyGroup> |
|||
<OutputType>WinExe</OutputType> |
|||
<TargetFramework>netcoreapp3.1</TargetFramework> |
|||
<UseWPF>true</UseWPF> |
|||
<ApplicationIcon>Resources\Images\bbwylogo.ico</ApplicationIcon> |
|||
</PropertyGroup> |
|||
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> |
|||
<PlatformTarget>x64</PlatformTarget> |
|||
</PropertyGroup> |
|||
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> |
|||
<PlatformTarget>x64</PlatformTarget> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<None Remove="BBWYAppSettings.json" /> |
|||
<None Remove="Resources\Images\defaultItem.png" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<Content Include="BBWYAppSettings.json"> |
|||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
|||
</Content> |
|||
<Resource Include="Resources\Images\bbwylogo.ico" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" /> |
|||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="5.0.0" /> |
|||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" /> |
|||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" /> |
|||
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" /> |
|||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.37" /> |
|||
<PackageReference Include="MvvmLightLibsStd10" Version="5.4.1.1" /> |
|||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> |
|||
<PackageReference Include="NLog" Version="4.7.12" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\BBWY.Common\BBWY.Common.csproj" /> |
|||
<ProjectReference Include="..\BBWY.Controls\BBWY.Controls.csproj" /> |
|||
<ProjectReference Include="..\BBWY.JDSDK\BBWY.JDSDK.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<Resource Include="Resources\Images\defaultItem.png"> |
|||
<CopyToOutputDirectory>Never</CopyToOutputDirectory> |
|||
</Resource> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<Folder Include="Extensions\" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
@ -0,0 +1,7 @@ |
|||
{ |
|||
//"BBWYApiHost": "http://localhost:5000", |
|||
"BBWYApiHost": "http://bbwytest.qiyue666.com", |
|||
"MDSApiHost": "http://mdsapi.qiyue666.com", |
|||
"JOSApiHost": "", |
|||
"1688ApiHost": "" |
|||
} |
@ -0,0 +1,26 @@ |
|||
using System; |
|||
using System.Globalization; |
|||
using System.Windows; |
|||
using System.Windows.Data; |
|||
|
|||
namespace BBWY.Client.Converters |
|||
{ |
|||
public class InputNumberConverter : IValueConverter |
|||
{ |
|||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
|||
{ |
|||
return value; |
|||
} |
|||
|
|||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) |
|||
{ |
|||
string strValue = value as string; |
|||
if (string.IsNullOrEmpty(strValue)) |
|||
return null; |
|||
decimal result; |
|||
if (strValue.IndexOf('.') == strValue.Length - 1 || !decimal.TryParse(strValue, out result)) |
|||
return DependencyProperty.UnsetValue; |
|||
return result; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,23 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Globalization; |
|||
using System.Text; |
|||
using System.Windows.Data; |
|||
|
|||
namespace BBWY.Client.Converters |
|||
{ |
|||
public class ItemHeightConverter : IValueConverter |
|||
{ |
|||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
|||
{ |
|||
int.TryParse(value.ToString(), out int itemCount); |
|||
int.TryParse(parameter.ToString(), out int itemHeight); |
|||
return itemCount * itemHeight; |
|||
} |
|||
|
|||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,78 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Windows; |
|||
using System.Windows.Data; |
|||
|
|||
namespace BBWY.Client.Converters |
|||
{ |
|||
public class MultiObjectConverter : IMultiValueConverter |
|||
{ |
|||
/// <summary>
|
|||
/// 多值转换器
|
|||
/// </summary>
|
|||
/// <param name="values">参数值数组</param>
|
|||
/// <param name="parameter">
|
|||
/// <para>参数</para>
|
|||
/// <para>各组比较值:比较条件(&或|):true返回值:false返回值:返回值类型枚举</para>
|
|||
/// <para>v1;v2-1|v2-2;v3:&:Visible:Collapsed:1</para>
|
|||
/// </param>
|
|||
/// <returns></returns>
|
|||
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
|||
{ |
|||
string[] param = parameter.ToString().ToLower().Split(':'); //将参数字符串分段
|
|||
string[] compareValues = param[0].Split(';'); //将比较值段分割为数组
|
|||
if (values.Length != compareValues.Length) //比较源数据和比较参数个数是否一致
|
|||
return ConvertValue(param[3], param[4]); |
|||
var trueCount = 0; //满足条件的结果数量
|
|||
var currentValue = string.Empty; |
|||
IList<string> currentParamArray = null; |
|||
for (var i = 0; i < values.Length; i++) |
|||
{ |
|||
currentValue = values[i] != null ? values[i].ToString().ToLower() : string.Empty; |
|||
if (compareValues[i].Contains("|")) |
|||
{ |
|||
//当前比较值段包含多个比较值
|
|||
currentParamArray = compareValues[i].Split('|'); |
|||
trueCount += currentParamArray.Contains(currentValue) ? 1 : 0; //满足条件,结果+1
|
|||
} |
|||
else |
|||
{ |
|||
trueCount += compareValues[i].Equals(currentValue) ? 1 : 0; //满足条件,结果+1
|
|||
} |
|||
} |
|||
currentParamArray = null; |
|||
currentValue = string.Empty; |
|||
var compareResult = param[1].Equals("&") ? |
|||
trueCount == values.Length : |
|||
trueCount > 0; //判断比较结果
|
|||
return ConvertValue(compareResult ? param[2] : param[3], param[4]); |
|||
} |
|||
|
|||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
private object ConvertValue(string result, string enumStr) |
|||
{ |
|||
var convertResult = (ConvertResult)int.Parse(enumStr); |
|||
if (convertResult == ConvertResult.显示类型) |
|||
return result.Equals("collapsed") ? Visibility.Collapsed : Visibility.Visible; |
|||
if (convertResult == ConvertResult.布尔类型) |
|||
return System.Convert.ToBoolean(result); |
|||
return null; //后续自行扩展
|
|||
} |
|||
|
|||
private enum ConvertResult |
|||
{ |
|||
显示类型 = 1, |
|||
布尔类型 = 2, |
|||
字符串类型 = 3, |
|||
整型 = 4, |
|||
小数型 = 5, |
|||
画刷类型 = 6, |
|||
样式类型 = 7, |
|||
模板类型 = 8 |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,22 @@ |
|||
using System; |
|||
using System.Globalization; |
|||
using System.Windows.Data; |
|||
|
|||
namespace BBWY.Client.Converters |
|||
{ |
|||
/// <summary>
|
|||
/// Command多参数传递类
|
|||
/// </summary>
|
|||
public class MultiParameterTransferConverter : IMultiValueConverter |
|||
{ |
|||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) |
|||
{ |
|||
return values.Clone(); |
|||
} |
|||
|
|||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,55 @@ |
|||
using System; |
|||
using System.Globalization; |
|||
using System.Linq; |
|||
using System.Windows.Data; |
|||
|
|||
namespace BBWY.Client.Converters |
|||
{ |
|||
public class ObjectConverter : IValueConverter |
|||
{ |
|||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
|||
{ |
|||
string[] parray = parameter.ToString().ToLower().Split(':'); |
|||
string valueStr = value == null ? string.Empty : value.ToString().ToLower(); |
|||
string returnValue = string.Empty; |
|||
try |
|||
{ |
|||
if (string.IsNullOrEmpty(valueStr)) |
|||
{ |
|||
returnValue = parray[0].Contains("#null") ? parray[1] : parray[2]; |
|||
} |
|||
else if (parray[0].Contains("|")) |
|||
{ |
|||
returnValue = parray[0].Split('|').Contains(valueStr) ? parray[1] : parray[2]; |
|||
} |
|||
else |
|||
{ |
|||
returnValue = parray[0].Equals(valueStr) ? parray[1] : parray[2]; |
|||
} |
|||
if (returnValue.Equals("#source", StringComparison.CurrentCultureIgnoreCase)) |
|||
return value; |
|||
return returnValue; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
Console.ForegroundColor = ConsoleColor.Red; |
|||
Console.WriteLine($"ObjectConverter {ex.Message} {parameter}"); |
|||
Console.ResetColor(); |
|||
} |
|||
return parray[2]; |
|||
} |
|||
|
|||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) |
|||
{ |
|||
var returnValue = "otherValue"; |
|||
string[] parray = parameter.ToString().ToLower().Split(':'); |
|||
if (value == null) |
|||
return returnValue; |
|||
var valueStr = value.ToString().ToLower(); |
|||
if (valueStr != parray[1]) |
|||
return returnValue; |
|||
else |
|||
return parray[0].Contains('|') ? parray[0].Split('|')[0] : parray[0]; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,40 @@ |
|||
using BBWY.Client.Models; |
|||
using System; |
|||
using System.Globalization; |
|||
using System.Windows.Data; |
|||
|
|||
namespace BBWY.Client.Converters |
|||
{ |
|||
public class OrderStorageTypeOptionConverter : IMultiValueConverter |
|||
{ |
|||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) |
|||
{ |
|||
try |
|||
{ |
|||
var currentStorageType = (StorageType)values[0]; |
|||
var selectedStorageType = (StorageType?)values[1]; |
|||
|
|||
if (selectedStorageType == null && (currentStorageType == StorageType.京仓 || currentStorageType == StorageType.云仓)) |
|||
{ |
|||
//当未选中值时,京仓云仓不能选
|
|||
return false; |
|||
} |
|||
if (selectedStorageType != null && selectedStorageType.Value != currentStorageType) |
|||
{ |
|||
//当选中值时,不能选择其他类型
|
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
catch |
|||
{ |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,21 @@ |
|||
using System; |
|||
using System.Globalization; |
|||
using System.Windows.Data; |
|||
|
|||
namespace BBWY.Client.Converters |
|||
{ |
|||
public class ProfitRatioConverter : IMultiValueConverter |
|||
{ |
|||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) |
|||
{ |
|||
decimal.TryParse(values[0]?.ToString(), out decimal profit); |
|||
decimal.TryParse(values[1]?.ToString(), out decimal totalCost); |
|||
return totalCost == 0 ? "0" : Math.Round(profit / totalCost * 100, 2).ToString(); |
|||
} |
|||
|
|||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,25 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Globalization; |
|||
using System.Text; |
|||
using System.Windows; |
|||
using System.Windows.Data; |
|||
|
|||
namespace BBWY.Client.Converters |
|||
{ |
|||
public class PurchaseOrderDelBtnConverter : IMultiValueConverter |
|||
{ |
|||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) |
|||
{ |
|||
long.TryParse(values[0]?.ToString(), out long id); |
|||
int.TryParse(values[1]?.ToString(), out int purchaseQuantity); |
|||
int.TryParse(values[2]?.ToString(), out int remainingQuantity); |
|||
return id == 0 || (id != 0 && purchaseQuantity != 0 && purchaseQuantity == remainingQuantity) ? Visibility.Visible : Visibility.Collapsed; |
|||
} |
|||
|
|||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,27 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Globalization; |
|||
using System.Text; |
|||
using System.Windows; |
|||
using System.Windows.Data; |
|||
|
|||
namespace BBWY.Client.Converters |
|||
{ |
|||
public class PurchaseOrderEditBtnConverter : IMultiValueConverter |
|||
{ |
|||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) |
|||
{ |
|||
bool.TryParse(values[0]?.ToString(), out bool isEdit); |
|||
int.TryParse(values[1]?.ToString(), out int purchaseQuantity); |
|||
int.TryParse(values[2]?.ToString(), out int remainingQuantity); |
|||
return !isEdit && |
|||
purchaseQuantity != 0 && |
|||
purchaseQuantity == remainingQuantity ? Visibility.Visible : Visibility.Collapsed; |
|||
} |
|||
|
|||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,22 @@ |
|||
using System; |
|||
using System.Globalization; |
|||
using System.Windows.Data; |
|||
|
|||
namespace BBWY.Client.Converters |
|||
{ |
|||
public class WaybillNoConverter : IValueConverter |
|||
{ |
|||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
|||
{ |
|||
if (value == null) |
|||
return string.Empty; |
|||
var waybillNo = value.ToString(); |
|||
return waybillNo.Equals("-10000") ? "厂家自送" : waybillNo; |
|||
} |
|||
|
|||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,27 @@ |
|||
using System; |
|||
using System.Globalization; |
|||
using System.Windows.Data; |
|||
|
|||
namespace BBWY.Client.Converters |
|||
{ |
|||
public class WidthConveter : IValueConverter |
|||
{ |
|||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
|||
{ |
|||
if (value is double) |
|||
{ |
|||
double.TryParse(parameter?.ToString(), out double p); |
|||
var width = (double)value; |
|||
if (width == 0) |
|||
return 0; |
|||
return width - p; |
|||
} |
|||
return 0; |
|||
} |
|||
|
|||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,42 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using BBWY.Client.Models; |
|||
using Jd.Api; |
|||
|
|||
namespace BBWY.Client |
|||
{ |
|||
public class GlobalContext : NotifyObject |
|||
{ |
|||
private User user; |
|||
|
|||
|
|||
public User User { get => user; set { Set(ref user, value); } } |
|||
|
|||
/// <summary>
|
|||
/// 用户名
|
|||
/// </summary>
|
|||
public string UserName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 密码
|
|||
/// </summary>
|
|||
public string Pwd { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// JD客户端
|
|||
/// </summary>
|
|||
public IJdClient JdClient { get; set; } |
|||
|
|||
#region APIHost
|
|||
public string BBYWApiHost { get; set; } |
|||
|
|||
public string MDSApiHost { get; set; } |
|||
|
|||
public string JOSApiHost { get; set; } |
|||
|
|||
public string _1688ApiHost { get; set; } |
|||
#endregion
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,72 @@ |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class ConsigneeResponse |
|||
{ |
|||
/// <summary>
|
|||
/// 联系人名称
|
|||
/// </summary>
|
|||
public string ContactName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 座机
|
|||
/// </summary>
|
|||
public string TelePhone { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 手机
|
|||
/// </summary>
|
|||
public string Mobile { get; set; } |
|||
|
|||
public string Address { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 省
|
|||
/// </summary>
|
|||
public string Province { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 市
|
|||
/// </summary>
|
|||
public string City { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 县
|
|||
/// </summary>
|
|||
public string County { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 镇
|
|||
/// </summary>
|
|||
public string Town { get; set; } |
|||
|
|||
public bool IsDecode { get; set; } |
|||
} |
|||
|
|||
public class ConsigneeSimpleResponse |
|||
{ |
|||
/// <summary>
|
|||
/// 联系人名称
|
|||
/// </summary>
|
|||
public string ContactName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 座机
|
|||
/// </summary>
|
|||
public string TelePhone { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 手机
|
|||
/// </summary>
|
|||
public string Mobile { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 地址
|
|||
/// </summary>
|
|||
public string Address { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 买家账号
|
|||
/// </summary>
|
|||
//public string BuyerAccount { get; set; }
|
|||
} |
|||
} |
@ -0,0 +1,75 @@ |
|||
using System; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class OrderCostDetailResponse |
|||
{ |
|||
|
|||
public long Id { get; set; } |
|||
|
|||
|
|||
public DateTime? CreateTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 扣减数量
|
|||
/// </summary>
|
|||
public int DeductionQuantity { get; set; } = 0; |
|||
|
|||
/// <summary>
|
|||
/// 发货运费
|
|||
/// </summary>
|
|||
public decimal DeliveryExpressFreight { get; set; } = 0.00M; |
|||
|
|||
public string OrderId { get; set; } |
|||
|
|||
|
|||
public string ProductId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 单件成本
|
|||
/// </summary>
|
|||
public decimal UnitCost { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 采购单流水Id
|
|||
/// </summary>
|
|||
public long PurchaseOrderPKId { get; set; } |
|||
|
|||
public string SkuId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Sku成本(商品成本)
|
|||
/// </summary>
|
|||
public decimal SkuAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 采购运费
|
|||
/// </summary>
|
|||
public decimal PurchaseFreight { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 头程运费
|
|||
/// </summary>
|
|||
public decimal FirstFreight { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 操作费
|
|||
/// </summary>
|
|||
public decimal OperationAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 耗材费
|
|||
/// </summary>
|
|||
public decimal ConsumableAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 仓储费
|
|||
/// </summary>
|
|||
public decimal StorageAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 总计(不含发货运费)
|
|||
/// </summary>
|
|||
public decimal TotalCost { get; set; } = 0.00M; |
|||
} |
|||
} |
@ -0,0 +1,72 @@ |
|||
using System; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class OrderCostResponse |
|||
{ |
|||
|
|||
public string OrderId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 平台扣点金额
|
|||
/// </summary>
|
|||
public decimal PlatformCommissionAmount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 平台扣点百分比
|
|||
/// </summary>
|
|||
public decimal PlatformCommissionRatio { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 优惠金额
|
|||
/// </summary>
|
|||
public decimal PreferentialAmount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 利润
|
|||
/// </summary>
|
|||
public decimal Profit { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 利润率
|
|||
/// </summary>
|
|||
public decimal ProfitRatio |
|||
{ |
|||
get |
|||
{ |
|||
return TotalCost == 0 ? 0 : Math.Round(Profit / TotalCost * 100, 2); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 采购金额
|
|||
/// </summary>
|
|||
public decimal PurchaseAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 发货快递费
|
|||
/// </summary>
|
|||
public decimal DeliveryExpressFreight { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 是否手动编辑过成本
|
|||
/// </summary>
|
|||
public bool IsManualEdited { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 刷单佣金
|
|||
/// </summary>
|
|||
public decimal SDCommissionAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 成本总计
|
|||
/// </summary>
|
|||
public decimal TotalCost |
|||
{ |
|||
get |
|||
{ |
|||
return SDCommissionAmount + PlatformCommissionAmount + PurchaseAmount + DeliveryExpressFreight; |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,14 @@ |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class OrderCouponResponse |
|||
{ |
|||
public long Id { get; set; } |
|||
|
|||
public decimal CouponPrice { get; set; } |
|||
|
|||
public string CouponType { get; set; } |
|||
|
|||
public string OrderId { get; set; } |
|||
public string SkuId { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,145 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class OrderResponse |
|||
{ |
|||
public string Id { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商家Id
|
|||
/// </summary>
|
|||
public string VenderId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 下单时间
|
|||
/// </summary>
|
|||
public DateTime OrderStartTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 结单时间
|
|||
/// </summary>
|
|||
public DateTime? OrderEndTime { get; set; } |
|||
|
|||
public DateTime OrderModifyTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 买家账号
|
|||
/// </summary>
|
|||
public string BuyerAccount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单平台
|
|||
/// </summary>
|
|||
public Platform Platform { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单类型
|
|||
/// </summary>
|
|||
public OrderType OrderType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 支付方式
|
|||
/// </summary>
|
|||
public PayType PayType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单状态
|
|||
/// </summary>
|
|||
public OrderState OrderState { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单状态中文说明
|
|||
/// </summary>
|
|||
public string OrderStateText { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单总价
|
|||
/// </summary>
|
|||
public decimal OrderTotalPrice { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单货款金额
|
|||
/// </summary>
|
|||
public decimal OrderSellerPrice { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 用户应付金额
|
|||
/// </summary>
|
|||
public decimal OrderPayment { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商品运费(用户付)
|
|||
/// </summary>
|
|||
public decimal FreightPrice { get; set; } |
|||
|
|||
public decimal PreferentialAmount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 买家备注
|
|||
/// </summary>
|
|||
public string BuyerRemark { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商家备注
|
|||
/// </summary>
|
|||
public string VenderRemark { get; set; } |
|||
|
|||
public StorageType? StorageType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 运单号
|
|||
/// </summary>
|
|||
public string WaybillNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 仓库Id
|
|||
/// </summary>
|
|||
public string StoreId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 仓库名称
|
|||
/// </summary>
|
|||
public string StoreName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单旗帜
|
|||
/// </summary>
|
|||
public string Flag { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 刷单类型
|
|||
/// </summary>
|
|||
public SDType? SDType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 收货人信息
|
|||
/// </summary>
|
|||
public ConsigneeResponse Consignee { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单成本
|
|||
/// </summary>
|
|||
public OrderCostResponse OrderCost { get; set; } |
|||
|
|||
public IList<OrderSkuResponse> ItemList { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 优惠券列表
|
|||
/// </summary>
|
|||
public IList<OrderCouponResponse> OrderCouponList { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单成本明细列表
|
|||
/// </summary>
|
|||
public IList<OrderCostDetailResponse> OrderCostDetailList { get; set; } |
|||
} |
|||
|
|||
public class OrderListResponse |
|||
{ |
|||
public int Count { get; set; } |
|||
|
|||
public IList<OrderResponse> Items { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,25 @@ |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class OrderSkuResponse |
|||
{ |
|||
/// <summary>
|
|||
/// 购买数量
|
|||
/// </summary>
|
|||
public int ItemTotal { get; set; } |
|||
|
|||
public string Id { get; set; } |
|||
|
|||
public string ProductId { get; set; } |
|||
|
|||
public string ProductNo { get; set; } |
|||
|
|||
public double Price { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Sku标题
|
|||
/// </summary>
|
|||
public string Title { get; set; } |
|||
|
|||
public string Logo { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,11 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class ProductListResponse |
|||
{ |
|||
public int Count { get; set; } |
|||
|
|||
public IList<Product> Items { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,68 @@ |
|||
using System; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class PurchaseOrderResponse |
|||
{ |
|||
public long Id { get; set; } |
|||
|
|||
public DateTime? CreateTime { get; set; } |
|||
|
|||
public string ProductId { get; set; } |
|||
|
|||
|
|||
public PurchaseMethod? PurchaseMethod { get; set; } |
|||
|
|||
public string PurchaseOrderId { get; set; } |
|||
|
|||
|
|||
public Platform? PurchasePlatform { get; set; } |
|||
|
|||
|
|||
public int PurchaseQuantity { get; set; } |
|||
|
|||
|
|||
public int RemainingQuantity { get; set; } |
|||
|
|||
public string SkuId { get; set; } |
|||
|
|||
public StorageType? StorageType { get; set; } |
|||
|
|||
public long ShopId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 单件发货运费
|
|||
/// </summary>
|
|||
public decimal SingleDeliveryFreight { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 单件操作费
|
|||
/// </summary>
|
|||
public decimal SingleOperationAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 单件耗材费
|
|||
/// </summary>
|
|||
public decimal SingleConsumableAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 单件仓储费
|
|||
/// </summary>
|
|||
public decimal SingleStorageAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 单件Sku成本
|
|||
/// </summary>
|
|||
public decimal SingleSkuAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 单件采购运费
|
|||
/// </summary>
|
|||
public decimal SingleFreight { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 单件头程运费
|
|||
/// </summary>
|
|||
public decimal SingleFirstFreight { get; set; } = 0.00M; |
|||
} |
|||
} |
@ -0,0 +1,20 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public partial class PurchaseSchemeProductResponse |
|||
{ |
|||
public long Id { get; set; } |
|||
public DateTime? CreateTime { get; set; } |
|||
public string ProductId { get; set; } |
|||
public string PurchaseProductId { get; set; } |
|||
public string PurchaseUrl { get; set; } |
|||
public string SkuId { get; set; } |
|||
public long SkuPurchaseSchemeId { get; set; } |
|||
public long UserId { get; set; } |
|||
public List<PurchaseSchemeProductSkuResponse> PurchaseSchemeProductSkuList { get; set; } |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
using System; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public partial class PurchaseSchemeProductSkuResponse |
|||
{ |
|||
public long Id { get; set; } |
|||
public DateTime? CreateTime { get; set; } |
|||
public string ProductId { get; set; } |
|||
public string PurchaseProductId { get; set; } |
|||
public string PurchaseSkuId { get; set; } |
|||
public string PurchaseSkuSpecId { get; set; } |
|||
public string SkuId { get; set; } |
|||
public long SkuPurchaseSchemeId { get; set; } |
|||
public long UserId { get; set; } |
|||
} |
|||
|
|||
} |
@ -0,0 +1,29 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public partial class PurchaseSchemeResponse |
|||
{ |
|||
public long Id { get; set; } |
|||
public DateTime? CreateTime { get; set; } |
|||
/// <summary>
|
|||
/// 采购默认成本
|
|||
/// </summary>
|
|||
public decimal? DefaultCost { get; set; } |
|||
public string ProductId { get; set; } |
|||
/// <summary>
|
|||
/// 采购商Id
|
|||
/// </summary>
|
|||
public string PurchaserId { get; set; } |
|||
public string PurchaserName { get; set; } |
|||
/// <summary>
|
|||
/// 采购实际成本
|
|||
/// </summary>
|
|||
public decimal? RealCost { get; set; } |
|||
public string SkuId { get; set; } |
|||
public long ShopId { get; set; } |
|||
|
|||
public List<PurchaseSchemeProductResponse> PurchaseSchemeProductList { get; set; } |
|||
} |
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class ShopResponse |
|||
{ |
|||
public string Id { get; set; } |
|||
|
|||
public Platform PlatformId { get; set; } |
|||
|
|||
public long? ShopId { get; set; } |
|||
|
|||
public string ShopName { get; set; } |
|||
|
|||
public string ShopType { get; set; } |
|||
|
|||
public string AppKey { get; set; } |
|||
|
|||
public string AppSecret { get; set; } |
|||
|
|||
public string AppToken { get; set; } |
|||
|
|||
} |
|||
} |
@ -0,0 +1,46 @@ |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class ToDayOrderAchievementResponse |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 销售额(用户实付)
|
|||
/// </summary>
|
|||
public decimal SaleAmount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 利润
|
|||
/// </summary>
|
|||
public decimal Profit { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 利润率
|
|||
/// </summary>
|
|||
public decimal ProfitRaito { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单数量
|
|||
/// </summary>
|
|||
public int OrderCount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购金额
|
|||
/// </summary>
|
|||
public decimal PurchaseAmount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 销售运费
|
|||
/// </summary>
|
|||
public decimal DeliveryExpressFreight { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 平台扣点
|
|||
/// </summary>
|
|||
public decimal PlatformCommissionAmount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 总成本
|
|||
/// </summary>
|
|||
public decimal TotalCost { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,13 @@ |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class MDSUserResponse |
|||
{ |
|||
public long Id { get; set; } |
|||
public string DepartmentName { get; set; } |
|||
public string DepartmentId { get; set; } |
|||
|
|||
public string UserName { get; set; } |
|||
|
|||
public string UserNick { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,82 @@ |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
/// <summary>
|
|||
/// 电商平台
|
|||
/// </summary>
|
|||
public enum Platform |
|||
{ |
|||
淘宝 = 0, |
|||
京东 = 1, |
|||
阿里巴巴 = 2 |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 采购方式
|
|||
/// </summary>
|
|||
public enum PurchaseMethod |
|||
{ |
|||
线上采购 = 0, |
|||
线下采购 = 1 |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 仓储类型
|
|||
/// </summary>
|
|||
public enum StorageType |
|||
{ |
|||
京仓 = 0, |
|||
云仓 = 1, |
|||
本地自发 = 2, |
|||
代发 = 3, |
|||
SD = 4 |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 订单类型
|
|||
/// </summary>
|
|||
public enum OrderType |
|||
{ |
|||
#region JD订单类型
|
|||
SOP = 22, |
|||
LOC = 75, |
|||
FBP = 21 |
|||
#endregion
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 支付方式
|
|||
/// </summary>
|
|||
public enum PayType |
|||
{ |
|||
货到付款 = 1, |
|||
邮局汇款 = 2, |
|||
自提 = 3, |
|||
在线支付 = 4, |
|||
公司转账 = 5, |
|||
银行卡转账 = 6 |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 订单状态
|
|||
/// </summary>
|
|||
public enum OrderState |
|||
{ |
|||
待付款 = 0, |
|||
等待采购 = 1, |
|||
待出库 = 2, |
|||
待收货 = 3, |
|||
已完成 = 4, |
|||
锁定 = 5, |
|||
已取消 = 6 |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 刷单类型
|
|||
/// </summary>
|
|||
public enum SDType |
|||
{ |
|||
自刷 = 0, |
|||
精准打标 = 1, |
|||
京礼金 = 2 |
|||
} |
|||
} |
@ -0,0 +1,29 @@ |
|||
using AutoMapper; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class MappingProfile : Profile |
|||
{ |
|||
public MappingProfile() |
|||
{ |
|||
CreateMap<OrderCostDetailResponse, OrderCostDetail>(); |
|||
CreateMap<OrderCouponResponse, OrderCoupon>(); |
|||
CreateMap<OrderCostResponse, OrderCost>(); |
|||
CreateMap<ConsigneeResponse, Consignee>(); |
|||
CreateMap<OrderResponse, Order>(); |
|||
CreateMap<OrderSkuResponse, OrderSku>().ForMember(t => t.ProductItemNum, opt => opt.MapFrom(f => f.ProductNo)); |
|||
|
|||
CreateMap<MDSUserResponse, User>().ForMember(t => t.TeamId, opt => opt.MapFrom(f => f.DepartmentId)) |
|||
.ForMember(t => t.TeamName, opt => opt.MapFrom(f => f.DepartmentName)) |
|||
.ForMember(t => t.Name, opt => opt.MapFrom(f => f.UserName)); |
|||
|
|||
CreateMap<ShopResponse, Shop>().ForMember(t => t.ShopId, opt => opt.MapFrom(f => f.ShopId)) |
|||
.ForMember(t => t.Name, opt => opt.MapFrom(f => f.ShopName)) |
|||
.ForMember(t => t.VenderType, opt => opt.MapFrom(f => f.ShopType)) |
|||
.ForMember(t => t.Platform, opt => opt.MapFrom(f => f.PlatformId)); |
|||
|
|||
CreateMap<PurchaseOrderResponse, PurchaseOrder>(); |
|||
CreateMap<ToDayOrderAchievementResponse, ToDayOrderAchievement>(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,17 @@ |
|||
using System.Collections.Generic; |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class MenuModel : NotifyObject |
|||
{ |
|||
private bool isSelected; |
|||
|
|||
|
|||
public bool IsSelected { get => isSelected; set { Set(ref isSelected, value); } } |
|||
|
|||
public string Name { get; set; } |
|||
|
|||
public string Url { get; set; } |
|||
|
|||
public IList<MenuModel> ChildList { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,23 @@ |
|||
using System.ComponentModel; |
|||
using System.Runtime.CompilerServices; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class NotifyObject : INotifyPropertyChanged |
|||
{ |
|||
public event PropertyChangedEventHandler PropertyChanged; |
|||
protected void OnPropertyChanged([CallerMemberName]string propertyName = "") |
|||
{ |
|||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
|||
} |
|||
|
|||
protected bool Set<T>(ref T oldValue, T newValue, [CallerMemberName]string propertyName = "") |
|||
{ |
|||
if (Equals(oldValue, newValue)) |
|||
return false; |
|||
oldValue = newValue; |
|||
OnPropertyChanged(propertyName); |
|||
return true; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,37 @@ |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class Consignee : NotifyObject |
|||
{ |
|||
private string contactName; |
|||
private string address; |
|||
private string mobile; |
|||
private string telePhone; |
|||
private bool isDecode; |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 省
|
|||
/// </summary>
|
|||
public string Province { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 市
|
|||
/// </summary>
|
|||
public string City { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 县
|
|||
/// </summary>
|
|||
public string County { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 镇
|
|||
/// </summary>
|
|||
public string Town { get; set; } |
|||
public string ContactName { get => contactName; set { Set(ref contactName, value); } } |
|||
public string Address { get => address; set { Set(ref address, value); } } |
|||
public string Mobile { get => mobile; set { Set(ref mobile, value); } } |
|||
public string TelePhone { get => telePhone; set { Set(ref telePhone, value); } } |
|||
public bool IsDecode { get => isDecode; set { Set(ref isDecode, value); } } |
|||
} |
|||
} |
@ -0,0 +1,182 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class Order : NotifyObject |
|||
{ |
|||
public Order() |
|||
{ |
|||
OrderCostDetailGroupList = new List<OrderCostDetailGroup>(); |
|||
} |
|||
|
|||
private StorageType? storageType; |
|||
|
|||
public string Id { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商家Id
|
|||
/// </summary>
|
|||
public string VenderId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 下单时间
|
|||
/// </summary>
|
|||
public DateTime OrderStartTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 结单时间
|
|||
/// </summary>
|
|||
public DateTime? OrderEndTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 买家账号
|
|||
/// </summary>
|
|||
public string BuyerAccount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单平台
|
|||
/// </summary>
|
|||
public Platform Platform { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单类型
|
|||
/// </summary>
|
|||
public OrderType OrderType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 支付方式
|
|||
/// </summary>
|
|||
public PayType PayType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单状态
|
|||
/// </summary>
|
|||
public OrderState OrderState { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单状态中文说明
|
|||
/// </summary>
|
|||
public string OrderStateText { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单总价
|
|||
/// </summary>
|
|||
public decimal OrderTotalPrice { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单货款金额
|
|||
/// </summary>
|
|||
public decimal OrderSellerPrice { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 用户应付金额
|
|||
/// </summary>
|
|||
public decimal OrderPayment { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商品运费(用户付)
|
|||
/// </summary>
|
|||
public decimal FreightPrice { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商家优惠金额
|
|||
/// </summary>
|
|||
public decimal PreferentialAmount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 买家备注
|
|||
/// </summary>
|
|||
public string BuyerRemark { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商家备注
|
|||
/// </summary>
|
|||
public string VenderRemark { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 运单号
|
|||
/// </summary>
|
|||
public string WaybillNo { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 仓储类型
|
|||
/// </summary>
|
|||
public StorageType? StorageType |
|||
{ |
|||
get => storageType; |
|||
set |
|||
{ |
|||
Set(ref storageType, value); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 仓库名称
|
|||
/// </summary>
|
|||
public string StoreName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单旗帜
|
|||
/// </summary>
|
|||
public string Flag { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 刷单类型
|
|||
/// </summary>
|
|||
public SDType? SDType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 收货人信息
|
|||
/// </summary>
|
|||
public Consignee Consignee { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单成本
|
|||
/// </summary>
|
|||
public OrderCost OrderCost { get; set; } |
|||
|
|||
public IList<OrderSku> ItemList { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 优惠券列表
|
|||
/// </summary>
|
|||
public IList<OrderCoupon> OrderCouponList { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单成本明细列表
|
|||
/// </summary>
|
|||
public IList<OrderCostDetail> OrderCostDetailList { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单成本明细分组列表
|
|||
/// </summary>
|
|||
public IList<OrderCostDetailGroup> OrderCostDetailGroupList { get; set; } |
|||
|
|||
public void ConvertOrderCostDetailToGroup() |
|||
{ |
|||
if (OrderCostDetailList == null || OrderCostDetailList.Count() == 0) |
|||
return; |
|||
foreach (var detail in OrderCostDetailList) |
|||
{ |
|||
var group = OrderCostDetailGroupList.FirstOrDefault(g => g.SkuId == detail.SkuId); |
|||
if (group == null) |
|||
{ |
|||
group = new OrderCostDetailGroup() { SkuId = detail.SkuId }; |
|||
OrderCostDetailGroupList.Add(group); |
|||
} |
|||
group.Items.Add(detail); |
|||
} |
|||
} |
|||
} |
|||
|
|||
public class OrderList |
|||
{ |
|||
public int Count { get; set; } |
|||
|
|||
public IList<Order> Items { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,57 @@ |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class OrderCost |
|||
{ |
|||
public string OrderId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 平台扣点金额
|
|||
/// </summary>
|
|||
public decimal PlatformCommissionAmount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 平台扣点百分比
|
|||
/// </summary>
|
|||
public decimal PlatformCommissionRatio { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 优惠金额
|
|||
/// </summary>
|
|||
public decimal PreferentialAmount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 刷单金额
|
|||
/// </summary>
|
|||
public decimal SDCommissionAmount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 利润
|
|||
/// </summary>
|
|||
public decimal Profit { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 利润率
|
|||
/// </summary>
|
|||
public decimal ProfitRatio { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购金额
|
|||
/// </summary>
|
|||
public decimal PurchaseAmount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 发货快递费
|
|||
/// </summary>
|
|||
public decimal DeliveryExpressFreight { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否手动编辑过成本
|
|||
/// </summary>
|
|||
public bool IsManualEdited { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 成本总计
|
|||
/// </summary>
|
|||
public decimal TotalCost { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,7 @@ |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class OrderCostDetail : OrderCostDetailResponse |
|||
{ |
|||
|
|||
} |
|||
} |
@ -0,0 +1,16 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class OrderCostDetailGroup |
|||
{ |
|||
public OrderCostDetailGroup() |
|||
{ |
|||
Items = new List<OrderCostDetail>(); |
|||
} |
|||
|
|||
public string SkuId { get; set; } |
|||
|
|||
public IList<OrderCostDetail> Items { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,6 @@ |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class OrderCoupon : OrderCouponResponse |
|||
{ |
|||
} |
|||
} |
@ -0,0 +1,22 @@ |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class OrderSku |
|||
{ |
|||
public string Id { get; set; } |
|||
|
|||
public int ItemTotal { get; set; } |
|||
|
|||
public string ProductId { get; set; } |
|||
|
|||
public string ProductItemNum { get; set; } |
|||
|
|||
public double Price { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Sku标题
|
|||
/// </summary>
|
|||
public string Title { get; set; } |
|||
|
|||
public string Logo { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,38 @@ |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class Product : NotifyObject |
|||
{ |
|||
public Product() |
|||
{ |
|||
PurchaserList = new ObservableCollection<Purchaser>(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 商品Id
|
|||
/// </summary>
|
|||
public string Id { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商品货号
|
|||
/// </summary>
|
|||
public string ProductItemNum { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商品标题
|
|||
/// </summary>
|
|||
public string Title { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Sku列表
|
|||
/// </summary>
|
|||
public IList<ProductSku> SkuList { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购商集合
|
|||
/// </summary>
|
|||
public IList<Purchaser> PurchaserList { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,61 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
using System.Text; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class ProductSku : NotifyObject |
|||
{ |
|||
private PurchaseScheme selectedPurchaseScheme; |
|||
private StorageModel selectedStorageModel; |
|||
public string Id { get; set; } |
|||
|
|||
public string ProductId { get; set; } |
|||
|
|||
public double Price { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Sku标题
|
|||
/// </summary>
|
|||
public string Title { get; set; } |
|||
|
|||
public string Logo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购方案
|
|||
/// </summary>
|
|||
public IList<PurchaseScheme> PurchaseSchemeList { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购订单
|
|||
/// </summary>
|
|||
public IList<PurchaseOrder> PurchaseOrderList { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 仓储平台
|
|||
/// </summary>
|
|||
public IList<StorageModel> StorageList { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 选中的采购方案
|
|||
/// </summary>
|
|||
public PurchaseScheme SelectedPurchaseScheme |
|||
{ |
|||
get => selectedPurchaseScheme; |
|||
set { Set(ref selectedPurchaseScheme, value); } |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 选中的仓储平台
|
|||
/// </summary>
|
|||
public StorageModel SelectedStorageModel { get => selectedStorageModel; set { Set(ref selectedStorageModel, value); } } |
|||
|
|||
public ProductSku() |
|||
{ |
|||
PurchaseSchemeList = new ObservableCollection<PurchaseScheme>(); |
|||
PurchaseOrderList = new ObservableCollection<PurchaseOrder>(); |
|||
StorageList = new ObservableCollection<StorageModel>(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,88 @@ |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
/// <summary>
|
|||
/// 采购方案
|
|||
/// </summary>
|
|||
public class PurchaseScheme : NotifyObject |
|||
{ |
|||
private decimal defaultCost; |
|||
private decimal realCost; |
|||
public long Id { get; set; } |
|||
|
|||
public long ShopId { get; set; } |
|||
public string ProductId { get; set; } |
|||
|
|||
public string SkuId { get; set; } |
|||
public decimal DefaultCost { get => defaultCost; set { Set(ref defaultCost, value); } } |
|||
public decimal RealCost { get => realCost; set { Set(ref realCost, value); } } |
|||
|
|||
public string PurchaserId { get; set; } |
|||
public string PurchaserName { get; set; } |
|||
public string PurchaseProductId1 { get; set; } |
|||
public int PurchaseProductSkuCount1 { get; set; } |
|||
public string PurchaseProductId2 { get; set; } |
|||
public int PurchaseProductSkuCount2 { get; set; } |
|||
public string PurchaseProductId3 { get; set; } |
|||
public int PurchaseProductSkuCount3 { get; set; } |
|||
public string PurchaseProductId4 { get; set; } |
|||
public int PurchaseProductSkuCount4 { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 采购方案的商品集合
|
|||
/// </summary>
|
|||
public IList<PurchaseSchemeProduct> PurchaseSchemeProductList { get; set; } |
|||
|
|||
public PurchaseScheme() |
|||
{ |
|||
PurchaseSchemeProductList = new ObservableCollection<PurchaseSchemeProduct>(); |
|||
} |
|||
|
|||
public static PurchaseScheme Convert(PurchaseSchemeResponse apiModel) |
|||
{ |
|||
var model = new PurchaseScheme() |
|||
{ |
|||
Id = apiModel.Id, |
|||
ProductId = apiModel.ProductId, |
|||
SkuId = apiModel.SkuId, |
|||
DefaultCost = apiModel.DefaultCost ?? 0, |
|||
RealCost = apiModel.RealCost ?? 0, |
|||
PurchaserId = apiModel.PurchaserId, |
|||
PurchaserName = apiModel.PurchaserName |
|||
}; |
|||
|
|||
foreach (var apiProduct in apiModel.PurchaseSchemeProductList) |
|||
{ |
|||
model.PurchaseSchemeProductList.Add(PurchaseSchemeProduct.Convert(apiProduct)); |
|||
} |
|||
for (var i = 0; i < model.PurchaseSchemeProductList.Count; i++) |
|||
{ |
|||
var purchaseProductId = model.PurchaseSchemeProductList[i].PurchaseProductId; |
|||
var purchaseProductSkuCount = model.PurchaseSchemeProductList[i].PurchaseSkuCount; |
|||
if (i == 0) |
|||
{ |
|||
model.PurchaseProductId1 = purchaseProductId; |
|||
model.PurchaseProductSkuCount1 = purchaseProductSkuCount; |
|||
} |
|||
else if (i == 1) |
|||
{ |
|||
model.PurchaseProductId2 = purchaseProductId; |
|||
model.PurchaseProductSkuCount2 = purchaseProductSkuCount; |
|||
} |
|||
else if (i == 2) |
|||
{ |
|||
model.PurchaseProductId3 = purchaseProductId; |
|||
model.PurchaseProductSkuCount3 = purchaseProductSkuCount; |
|||
} |
|||
else if (i == 3) |
|||
{ |
|||
model.PurchaseProductId4 = purchaseProductId; |
|||
model.PurchaseProductSkuCount4 = purchaseProductSkuCount; |
|||
} |
|||
} |
|||
return model; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,65 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
using System.Text; |
|||
using System.Linq; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
/// <summary>
|
|||
/// 采购商品
|
|||
/// </summary>
|
|||
public class PurchaseSchemeProduct : NotifyObject |
|||
{ |
|||
|
|||
private string purchaseUrl; |
|||
private string purchaseProductId; |
|||
private bool isEditing; |
|||
|
|||
/// <summary>
|
|||
/// 采购商品和采购方案的关系Id
|
|||
/// </summary>
|
|||
public long Id { get; set; } |
|||
|
|||
public string ProductId { get; set; } |
|||
|
|||
public string SkuId { get; set; } |
|||
|
|||
public string PurchaseUrl { get => purchaseUrl; set { Set(ref purchaseUrl, value); } } |
|||
public string PurchaseProductId { get => purchaseProductId; set => purchaseProductId = value; } |
|||
|
|||
public bool IsEditing { get => isEditing; set { Set(ref isEditing, value); } } |
|||
|
|||
public IList<PurchaseSchemeProductSku> SkuList { get; set; } |
|||
|
|||
public IList<PurchaseSchemeProductSku> PurchaseSchemeProductSkuList { get; set; } |
|||
|
|||
public List<string> SelectedSkuIdList { get; set; } |
|||
|
|||
public int PurchaseSkuCount |
|||
{ |
|||
get { return SelectedSkuIdList.Count(); } |
|||
} |
|||
|
|||
public PurchaseSchemeProduct() |
|||
{ |
|||
SkuList = new ObservableCollection<PurchaseSchemeProductSku>(); |
|||
PurchaseSchemeProductSkuList = new ObservableCollection<PurchaseSchemeProductSku>(); |
|||
SelectedSkuIdList = new List<string>(); |
|||
} |
|||
|
|||
public static PurchaseSchemeProduct Convert(PurchaseSchemeProductResponse apiModel) |
|||
{ |
|||
var model = new PurchaseSchemeProduct() |
|||
{ |
|||
Id = apiModel.Id, |
|||
ProductId = apiModel.ProductId, |
|||
SkuId = apiModel.SkuId, |
|||
PurchaseProductId = apiModel.PurchaseProductId, |
|||
PurchaseUrl = apiModel.PurchaseUrl |
|||
}; |
|||
model.SelectedSkuIdList.AddRange(apiModel.PurchaseSchemeProductSkuList.Select(s => s.PurchaseSkuId)); |
|||
return model; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,36 @@ |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
/// <summary>
|
|||
/// 采购商品的Sku
|
|||
/// </summary>
|
|||
public class PurchaseSchemeProductSku : NotifyObject |
|||
{ |
|||
/// <summary>
|
|||
/// 采购商品的SKU和采购方案的关系Id
|
|||
/// </summary>
|
|||
public long Id { get; set; } |
|||
|
|||
private bool isSelected; |
|||
public bool IsSelected { get => isSelected; set { Set(ref isSelected, value); } } |
|||
|
|||
public double Price { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Sku标题
|
|||
/// </summary>
|
|||
public string Title { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Sku图片
|
|||
/// </summary>
|
|||
public string Logo { get; set; } |
|||
|
|||
public string SkuId { get; set; } |
|||
public string ProductId { get; set; } |
|||
public string PurchaseProductId { get; set; } |
|||
public string PurchaseSkuId { get; set; } |
|||
public string PurchaseSkuSpecId { get; set; } |
|||
public long SkuPurchaseSchemeId { get; set; } |
|||
public long UserId { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,21 @@ |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
/// <summary>
|
|||
/// 采购商
|
|||
/// </summary>
|
|||
public class Purchaser : NotifyObject |
|||
{ |
|||
private int skuUseCount; |
|||
|
|||
public string Id { get; set; } |
|||
|
|||
public string Name { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 使用该采购商的SKU数量
|
|||
/// </summary>
|
|||
public int SkuUseCount { get => skuUseCount; set { Set(ref skuUseCount, value); } } |
|||
|
|||
public string ProductId { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,152 @@ |
|||
using System; |
|||
|
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class PurchaseOrder : NotifyObject |
|||
{ |
|||
public long Id { get; set; } |
|||
public DateTime? CreateTime { get; set; } |
|||
|
|||
public string ProductId { get; set; } |
|||
|
|||
public PurchaseMethod? PurchaseMethod { get; set; } |
|||
|
|||
public string PurchaseOrderId { get; set; } |
|||
|
|||
|
|||
public Platform? PurchasePlatform { get; set; } |
|||
|
|||
|
|||
public string SkuId { get; set; } |
|||
|
|||
public StorageType? StorageType { get; set; } |
|||
|
|||
public long? UserId { get; set; } |
|||
|
|||
public bool IsEdit { get => isEdit; set { Set(ref isEdit, value); } } |
|||
|
|||
/// <summary>
|
|||
/// 单件均摊成本
|
|||
/// </summary>
|
|||
public decimal UnitCost { get => unitCost;private set { Set(ref unitCost, value); } } |
|||
|
|||
public int PurchaseQuantity |
|||
{ |
|||
get => purchaseQuantity; set |
|||
{ |
|||
Set(ref purchaseQuantity, value); |
|||
RefreshUnitCost(); |
|||
if (IsEdit) |
|||
RemainingQuantity = value; |
|||
} |
|||
} |
|||
|
|||
public int RemainingQuantity { get => remainingQuantity; set { Set(ref remainingQuantity, value); } } |
|||
|
|||
|
|||
public long ShopId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 单件发货预估运费(不参与单件均摊成本计算)
|
|||
/// </summary>
|
|||
public decimal SingleDeliveryFreight |
|||
{ |
|||
get => singleDeliveryFreight; set { Set(ref singleDeliveryFreight, value); } |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 单间操作成本
|
|||
/// </summary>
|
|||
public decimal SingleOperationAmount |
|||
{ |
|||
get => singleOperationAmount; |
|||
set |
|||
{ |
|||
if (Set(ref singleOperationAmount, value)) |
|||
RefreshUnitCost(); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 单件耗材成本
|
|||
/// </summary>
|
|||
public decimal SingleConsumableAmount |
|||
{ |
|||
get => singleConsumableAmount; |
|||
set |
|||
{ |
|||
if (Set(ref singleConsumableAmount, value)) |
|||
RefreshUnitCost(); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 单件SKU成本
|
|||
/// </summary>
|
|||
public decimal SingleSkuAmount |
|||
{ |
|||
get => singleSkuAmount; |
|||
set |
|||
{ |
|||
if (Set(ref singleSkuAmount, value)) |
|||
RefreshUnitCost(); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 单件采购运费
|
|||
/// </summary>
|
|||
public decimal SingleFreight |
|||
{ |
|||
get => singleFreight; |
|||
set |
|||
{ |
|||
if (Set(ref singleFreight, value)) |
|||
RefreshUnitCost(); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 单件头程费
|
|||
/// </summary>
|
|||
public decimal SingleFirstFreight |
|||
{ |
|||
get => singleFirstFreight; |
|||
set |
|||
{ |
|||
if (Set(ref singleFirstFreight, value)) |
|||
RefreshUnitCost(); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 单件仓储费
|
|||
/// </summary>
|
|||
public decimal SingleStorageAmount |
|||
{ |
|||
get => singleStorageAmount; |
|||
set |
|||
{ |
|||
if (Set(ref singleStorageAmount, value)) |
|||
RefreshUnitCost(); |
|||
} |
|||
} |
|||
|
|||
public void RefreshUnitCost() |
|||
{ |
|||
UnitCost = SingleSkuAmount + SingleFreight + SingleFirstFreight + SingleOperationAmount + SingleConsumableAmount + SingleStorageAmount; |
|||
} |
|||
|
|||
private bool isEdit; |
|||
private decimal unitCost; |
|||
private int purchaseQuantity; |
|||
private int remainingQuantity; |
|||
private decimal singleSkuAmount; |
|||
private decimal singleFreight; |
|||
private decimal singleFirstFreight; |
|||
private decimal singleDeliveryFreight; |
|||
private decimal singleOperationAmount; |
|||
private decimal singleConsumableAmount; |
|||
private decimal singleStorageAmount; |
|||
} |
|||
} |
@ -0,0 +1,11 @@ |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class StorageModel |
|||
{ |
|||
public string ProductId { get; set; } |
|||
|
|||
public string SkuId { get; set; } |
|||
|
|||
public StorageType StorageType { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,30 @@ |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class Shop : NotifyObject |
|||
{ |
|||
private string name; |
|||
|
|||
/// <summary>
|
|||
/// 店铺Id
|
|||
/// </summary>
|
|||
public long ShopId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商家类型
|
|||
/// </summary>
|
|||
public string VenderType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 店铺平台
|
|||
/// </summary>
|
|||
public Platform Platform { get; set; } |
|||
|
|||
public string AppKey { get; set; } |
|||
|
|||
public string AppSecret { get; set; } |
|||
|
|||
public string AppToken { get; set; } |
|||
|
|||
public string Name { get => name; set { Set(ref name, value); } } |
|||
} |
|||
} |
@ -0,0 +1,50 @@ |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class ToDayOrderAchievement : NotifyObject |
|||
{ |
|||
private decimal saleAmount; |
|||
private decimal profit; |
|||
private decimal profitRaito; |
|||
private int orderCount; |
|||
private decimal purchaseAmount; |
|||
private decimal deliveryExpressFreight; |
|||
private decimal platformCommissionAmount; |
|||
private decimal totalCost; |
|||
|
|||
/// <summary>
|
|||
/// 销售额
|
|||
/// </summary>
|
|||
public decimal SaleAmount { get => saleAmount; set { Set(ref saleAmount, value); } } |
|||
/// <summary>
|
|||
/// 总成本
|
|||
/// </summary>
|
|||
public decimal TotalCost { get => totalCost; set { Set(ref totalCost, value); } } |
|||
/// <summary>
|
|||
/// 利润
|
|||
/// </summary>
|
|||
public decimal Profit { get => profit; set { Set(ref profit, value); } } |
|||
/// <summary>
|
|||
/// 利润比
|
|||
/// </summary>
|
|||
public decimal ProfitRaito { get => profitRaito; set { Set(ref profitRaito, value); } } |
|||
/// <summary>
|
|||
/// 订单数
|
|||
/// </summary>
|
|||
public int OrderCount { get => orderCount; set { Set(ref orderCount, value); } } |
|||
|
|||
/// <summary>
|
|||
/// 采购金额
|
|||
/// </summary>
|
|||
public decimal PurchaseAmount { get => purchaseAmount; set { Set(ref purchaseAmount, value); } } |
|||
|
|||
/// <summary>
|
|||
/// 销售运费
|
|||
/// </summary>
|
|||
public decimal DeliveryExpressFreight { get => deliveryExpressFreight; set { Set(ref deliveryExpressFreight, value); } } |
|||
|
|||
/// <summary>
|
|||
/// 平台扣点
|
|||
/// </summary>
|
|||
public decimal PlatformCommissionAmount { get => platformCommissionAmount; set { Set(ref platformCommissionAmount, value); } } |
|||
} |
|||
} |
@ -0,0 +1,24 @@ |
|||
namespace BBWY.Client.Models |
|||
{ |
|||
public class User : NotifyObject |
|||
{ |
|||
//private string name;
|
|||
|
|||
private Shop shop; |
|||
|
|||
public long Id { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 登录Token
|
|||
/// </summary>
|
|||
public string Token { get; set; } |
|||
|
|||
public string Name { get; set; } |
|||
|
|||
public string TeamId { get; set; } |
|||
|
|||
public string TeamName { get; set; } |
|||
|
|||
public Shop Shop { get => shop; set { Set(ref shop, value); } } |
|||
} |
|||
} |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 6.4 KiB |
@ -0,0 +1,32 @@ |
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
|||
<!--Generic--> |
|||
<SolidColorBrush x:Key="WindowButtonColor" Color="Black"/> |
|||
<SolidColorBrush x:Key="Item.MouseOver" Color="#E6E6E6"/> |
|||
<SolidColorBrush x:Key="Item.Selected" Color="#E6E6E6"/> |
|||
|
|||
<SolidColorBrush x:Key="ScrollBar.Background" Color="#D8D8D8"/> |
|||
<SolidColorBrush x:Key="ScrollBar.Background.MouseOver" Color="#FFC8C7C7"/> |
|||
|
|||
<SolidColorBrush x:Key="Text.Color" Color="#4A4A4A"/> |
|||
<SolidColorBrush x:Key="TextBox.BorderBrush" Color="#D7D7D7"/> |
|||
<SolidColorBrush x:Key="TextBox.Disable.BgColor" Color="#F2F2F2"/> |
|||
|
|||
<SolidColorBrush x:Key="Text.Link.Color" Color="#02A7F0"/> |
|||
|
|||
<SolidColorBrush x:Key="Border.Brush" Color="#D7D7D7"/> |
|||
|
|||
<SolidColorBrush x:Key="PathColor" Color="#02A7F0"/> |
|||
|
|||
<SolidColorBrush x:Key="LoadingColor" Color="#8080FF"/> |
|||
|
|||
<SolidColorBrush x:Key="Border.Background" Color="#F2F2F2"/> |
|||
|
|||
<SolidColorBrush x:Key="Button.Selected.Background" Color="#8080FF"/> |
|||
<SolidColorBrush x:Key="Button.Normal.Background" Color="#F2F2F2"/> |
|||
|
|||
<!--Main--> |
|||
<SolidColorBrush x:Key="MainMenu.BackGround" Color="#F2F2F2"/> |
|||
<SolidColorBrush x:Key="MainMenu.BorderBrush" Color="#D7D7D7"/> |
|||
|
|||
</ResourceDictionary> |
@ -0,0 +1,4 @@ |
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
|||
|
|||
</ResourceDictionary> |
@ -0,0 +1,282 @@ |
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls"> |
|||
<Style x:Key="bwstyle" TargetType="c:BWindow"> |
|||
<Setter Property="MaxButtonColor" Value="{StaticResource WindowButtonColor}"/> |
|||
<Setter Property="MinButtonColor" Value="{StaticResource WindowButtonColor}"/> |
|||
<Setter Property="CloseButtonColor" Value="{StaticResource WindowButtonColor}"/> |
|||
<Setter Property="RightButtonGroupMargin" Value="0,5,5,0"/> |
|||
</Style> |
|||
|
|||
<Style TargetType="{x:Type ListBox}"> |
|||
<Setter Property="Background" Value="Transparent"/> |
|||
<Setter Property="BorderThickness" Value="0"/> |
|||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/> |
|||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="auto"/> |
|||
<Setter Property="ScrollViewer.CanContentScroll" Value="False"/> |
|||
<Setter Property="ScrollViewer.PanningMode" Value="Both"/> |
|||
<Setter Property="VerticalContentAlignment" Value="Center"/> |
|||
<Setter Property="UseLayoutRounding" Value="True"/> |
|||
<Setter Property="SnapsToDevicePixels" Value="True"/> |
|||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> |
|||
<Setter Property="Margin" Value="0,0,0,0"/> |
|||
<Setter Property="Padding" Value="0,0,0,0"/> |
|||
<Setter Property="Template"> |
|||
<Setter.Value> |
|||
<ControlTemplate TargetType="{x:Type ListBox}"> |
|||
<Border x:Name="Bd" |
|||
Background="{TemplateBinding Background}" |
|||
BorderThickness="{TemplateBinding BorderThickness}" |
|||
BorderBrush="{TemplateBinding BorderBrush}" |
|||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" |
|||
UseLayoutRounding="{TemplateBinding UseLayoutRounding}"> |
|||
<ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}"> |
|||
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> |
|||
</ScrollViewer> |
|||
</Border> |
|||
<ControlTemplate.Triggers> |
|||
<MultiTrigger> |
|||
<MultiTrigger.Conditions> |
|||
<Condition Property="IsGrouping" Value="true"/> |
|||
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/> |
|||
</MultiTrigger.Conditions> |
|||
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/> |
|||
</MultiTrigger> |
|||
</ControlTemplate.Triggers> |
|||
</ControlTemplate> |
|||
</Setter.Value> |
|||
</Setter> |
|||
</Style> |
|||
|
|||
<Style x:Key="NoScrollViewListBoxStyle" TargetType="{x:Type ListBox}"> |
|||
<Setter Property="Background" Value="Transparent"/> |
|||
<Setter Property="BorderThickness" Value="0"/> |
|||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/> |
|||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="auto"/> |
|||
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/> |
|||
<Setter Property="ScrollViewer.PanningMode" Value="Both"/> |
|||
<Setter Property="VerticalContentAlignment" Value="Center"/> |
|||
<Setter Property="UseLayoutRounding" Value="True"/> |
|||
<Setter Property="SnapsToDevicePixels" Value="True"/> |
|||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> |
|||
<Setter Property="Margin" Value="0,0,0,0"/> |
|||
<Setter Property="Padding" Value="0,0,0,0"/> |
|||
<Setter Property="Template"> |
|||
<Setter.Value> |
|||
<ControlTemplate TargetType="{x:Type ListBox}"> |
|||
<Border x:Name="Bd" |
|||
Background="{TemplateBinding Background}" |
|||
BorderThickness="{TemplateBinding BorderThickness}" |
|||
BorderBrush="{TemplateBinding BorderBrush}" |
|||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" |
|||
UseLayoutRounding="{TemplateBinding UseLayoutRounding}" |
|||
Padding="{TemplateBinding Padding}"> |
|||
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> |
|||
</Border> |
|||
<ControlTemplate.Triggers> |
|||
<MultiTrigger> |
|||
<MultiTrigger.Conditions> |
|||
<Condition Property="IsGrouping" Value="true"/> |
|||
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/> |
|||
</MultiTrigger.Conditions> |
|||
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/> |
|||
</MultiTrigger> |
|||
</ControlTemplate.Triggers> |
|||
</ControlTemplate> |
|||
</Setter.Value> |
|||
</Setter> |
|||
</Style> |
|||
|
|||
<Style x:Key="NoBgListBoxItemStyle" TargetType="{x:Type ListBoxItem}"> |
|||
<Setter Property="SnapsToDevicePixels" Value="True"/> |
|||
<Setter Property="Padding" Value="0"/> |
|||
<Setter Property="Margin" Value="0"/> |
|||
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"/> |
|||
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"/> |
|||
<Setter Property="Background" Value="Transparent"/> |
|||
<Setter Property="BorderBrush" Value="Transparent"/> |
|||
<Setter Property="BorderThickness" Value="0"/> |
|||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> |
|||
<Setter Property="Template"> |
|||
<Setter.Value> |
|||
<ControlTemplate TargetType="{x:Type ListBoxItem}"> |
|||
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True"> |
|||
<ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" |
|||
Content="{TemplateBinding Content}" Margin="{TemplateBinding Margin}" |
|||
ContentStringFormat="{TemplateBinding ContentStringFormat}" |
|||
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" |
|||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
|||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" |
|||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> |
|||
</Border> |
|||
</ControlTemplate> |
|||
</Setter.Value> |
|||
</Setter> |
|||
</Style> |
|||
|
|||
<Style x:Key="DefaultListBoxItemStyle" TargetType="{x:Type ListBoxItem}"> |
|||
<Setter Property="SnapsToDevicePixels" Value="True"/> |
|||
<Setter Property="Padding" Value="0"/> |
|||
<Setter Property="Margin" Value="0"/> |
|||
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"/> |
|||
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"/> |
|||
<Setter Property="Background" Value="Transparent"/> |
|||
<Setter Property="BorderBrush" Value="Transparent"/> |
|||
<Setter Property="BorderThickness" Value="0"/> |
|||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> |
|||
<Setter Property="Template"> |
|||
<Setter.Value> |
|||
<ControlTemplate TargetType="{x:Type ListBoxItem}"> |
|||
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True"> |
|||
<ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" |
|||
Content="{TemplateBinding Content}" Margin="{TemplateBinding Margin}" |
|||
ContentStringFormat="{TemplateBinding ContentStringFormat}" |
|||
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" |
|||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
|||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" |
|||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> |
|||
</Border> |
|||
<ControlTemplate.Triggers> |
|||
<Trigger Property="IsMouseOver" Value="True"> |
|||
<Setter Property="Background" TargetName="Bd" Value="{StaticResource Item.MouseOver}"/> |
|||
</Trigger> |
|||
<Trigger Property="IsSelected" Value="True"> |
|||
<Setter Property="Background" TargetName="Bd" Value="{StaticResource Item.Selected}"/> |
|||
</Trigger> |
|||
</ControlTemplate.Triggers> |
|||
</ControlTemplate> |
|||
</Setter.Value> |
|||
</Setter> |
|||
</Style> |
|||
|
|||
<Style TargetType="{x:Type c:BButton}"> |
|||
<Setter Property="Height" Value="30"/> |
|||
<Setter Property="BorderThickness" Value="0"/> |
|||
<Setter Property="Background" Value="{StaticResource Button.Selected.Background}"/> |
|||
<Setter Property="Foreground" Value="White"/> |
|||
</Style> |
|||
|
|||
<Style x:Key="LinkButton" TargetType="{x:Type c:BButton}"> |
|||
<Setter Property="BorderThickness" Value="0"/> |
|||
<Setter Property="Background" Value="Transparent"/> |
|||
<Setter Property="Foreground" Value="{StaticResource Text.Link.Color}"/> |
|||
</Style> |
|||
|
|||
<Style TargetType="{x:Type c:BTextBox}"> |
|||
<Setter Property="Height" Value="30"/> |
|||
<Setter Property="Background" Value="White"/> |
|||
<Setter Property="BorderBrush" Value="{StaticResource TextBox.BorderBrush}"/> |
|||
</Style> |
|||
|
|||
<Style TargetType="{x:Type c:RoundWaitProgress}"> |
|||
<Setter Property="Color" Value="{StaticResource LoadingColor}"/> |
|||
<Setter Property="Background" Value="#26000000"/> |
|||
<Setter Property="Foreground" Value="{StaticResource LoadingColor}"/> |
|||
</Style> |
|||
|
|||
<!--滚动条颜色、圆角等设置--> |
|||
<Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}"> |
|||
<Setter Property="OverridesDefaultStyle" Value="true"/> |
|||
<Setter Property="IsTabStop" Value="false"/> |
|||
<Setter Property="Template"> |
|||
<Setter.Value> |
|||
<ControlTemplate TargetType="{x:Type Thumb}"> |
|||
<!--滚动条颜色和圆角设置--> |
|||
<Rectangle Name="thumbRect" Fill="{StaticResource ScrollBar.Background}" RadiusX="3" RadiusY="3"/> |
|||
<!--鼠标拉动滚动条时的颜色--> |
|||
<ControlTemplate.Triggers> |
|||
<Trigger Property="IsMouseOver" Value="True"> |
|||
<Setter Property="Fill" Value="{StaticResource ScrollBar.Background.MouseOver}" TargetName="thumbRect" /> |
|||
</Trigger> |
|||
</ControlTemplate.Triggers> |
|||
</ControlTemplate> |
|||
</Setter.Value> |
|||
</Setter> |
|||
</Style> |
|||
|
|||
<Style x:Key="VerticalScrollBarStyle" TargetType="{x:Type ScrollBar}"> |
|||
<Setter Property="Background" Value="Transparent"/> |
|||
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/> |
|||
<Setter Property="Stylus.IsFlicksEnabled" Value="false"/> |
|||
<!--滚动条宽度--> |
|||
<Setter Property="Width" Value="6"/> |
|||
<Setter Property="MinWidth" Value="6"/> |
|||
<Setter Property="Template"> |
|||
<Setter.Value> |
|||
<ControlTemplate TargetType="{x:Type ScrollBar}"> |
|||
<!--滚动条背景色--> |
|||
<Border x:Name="Bg" Background="{TemplateBinding Background}" SnapsToDevicePixels="true" Width="6" CornerRadius="4"> |
|||
<Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}"> |
|||
<Track.Thumb> |
|||
<Thumb Style="{StaticResource ScrollBarThumb}"/> |
|||
</Track.Thumb> |
|||
</Track> |
|||
</Border> |
|||
</ControlTemplate> |
|||
</Setter.Value> |
|||
</Setter> |
|||
</Style> |
|||
|
|||
<Style x:Key="HorizontalScrollBarStyle" TargetType="{x:Type ScrollBar}"> |
|||
<Setter Property="Background" Value="Transparent"/> |
|||
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/> |
|||
<Setter Property="Stylus.IsFlicksEnabled" Value="false"/> |
|||
<!--滚动条宽度--> |
|||
<Setter Property="Height" Value="6"/> |
|||
<Setter Property="MinHeight" Value="6"/> |
|||
<Setter Property="Template"> |
|||
<Setter.Value> |
|||
<ControlTemplate TargetType="{x:Type ScrollBar}"> |
|||
<!--滚动条背景色--> |
|||
<Border x:Name="Bg" Background="{TemplateBinding Background}" SnapsToDevicePixels="true" Height="6" CornerRadius="4"> |
|||
<Track x:Name="PART_Track" IsDirectionReversed="false" IsEnabled="{TemplateBinding IsMouseOver}"> |
|||
<Track.Thumb> |
|||
<Thumb Style="{StaticResource ScrollBarThumb}"/> |
|||
</Track.Thumb> |
|||
</Track> |
|||
</Border> |
|||
</ControlTemplate> |
|||
</Setter.Value> |
|||
</Setter> |
|||
</Style> |
|||
|
|||
<Style TargetType="ScrollViewer"> |
|||
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True"/> |
|||
<Setter Property="Template"> |
|||
<Setter.Value> |
|||
<ControlTemplate TargetType="{x:Type ScrollViewer}"> |
|||
<Grid x:Name="Grid" Background="{TemplateBinding Background}"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="*"/> |
|||
<ColumnDefinition Width="Auto"/> |
|||
</Grid.ColumnDefinitions> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="*"/> |
|||
<RowDefinition Height="Auto"/> |
|||
</Grid.RowDefinitions> |
|||
<Rectangle x:Name="Corner" Grid.Column="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Row="1"/> |
|||
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/> |
|||
<ScrollBar Margin="-6 0 0 0" x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" Opacity="0.5" Style="{StaticResource VerticalScrollBarStyle}"/> |
|||
<ScrollBar Margin="0 -6 0 0" x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}" Opacity="0.5" Style="{StaticResource HorizontalScrollBarStyle}"/> |
|||
</Grid> |
|||
<ControlTemplate.Triggers> |
|||
<Trigger Property="IsMouseOver" Value="True"> |
|||
<Setter Property="Opacity" TargetName="PART_VerticalScrollBar" Value="1"/> |
|||
<Setter Property="Opacity" TargetName="PART_HorizontalScrollBar" Value="1"/> |
|||
</Trigger> |
|||
</ControlTemplate.Triggers> |
|||
</ControlTemplate> |
|||
</Setter.Value> |
|||
</Setter> |
|||
</Style> |
|||
|
|||
<Style TargetType="CheckBox"> |
|||
<Setter Property="VerticalContentAlignment" Value="Center"/> |
|||
<Setter Property="Foreground" Value="{StaticResource Text.Color}"/> |
|||
</Style> |
|||
|
|||
<Style x:Key="middleTextBlock" TargetType="TextBlock"> |
|||
<Setter Property="HorizontalAlignment" Value="Center"/> |
|||
<Setter Property="VerticalAlignment" Value="Center"/> |
|||
</Style> |
|||
</ResourceDictionary> |
@ -0,0 +1,25 @@ |
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
|||
<Style x:Key="basePath" TargetType="Path"> |
|||
<Setter Property="Stretch" Value="Uniform"/> |
|||
<Setter Property="UseLayoutRounding" Value="True"/> |
|||
<Setter Property="SnapsToDevicePixels" Value="True"/> |
|||
<Setter Property="HorizontalAlignment" Value="Center"/> |
|||
<Setter Property="VerticalAlignment" Value="Center"/> |
|||
<Setter Property="Fill" Value="{StaticResource PathColor}"/> |
|||
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/> |
|||
<Setter Property="Cursor" Value="Hand"/> |
|||
</Style> |
|||
|
|||
<Style x:Key="path_add" TargetType="Path" BasedOn="{StaticResource basePath}"> |
|||
<Setter Property="Data" Value="M12.126984,0L19.872009,0 19.872009,12.128 32,12.128 32,19.872999 19.872009,19.872999 19.872009,31.999 12.126984,31.999 12.126984,19.872999 0,19.872999 0,12.128 12.126984,12.128z"/> |
|||
</Style> |
|||
|
|||
<Style x:Key="path_question" TargetType="Path" BasedOn="{StaticResource basePath}"> |
|||
<Setter Property="Data" Value="M14.580002,23.394012L14.580002,26.235001 17.18399,26.235001 17.18399,23.394012z M16.117996,5.7660065C14.539993,5.7660065 13.278992,6.2390137 12.332993,7.1880035 10.991989,8.5250092 10.320999,10.223007 10.320999,12.27301L13.043991,12.27301C13.043991,10.695007 13.437988,9.5130005 14.22699,8.7230072 14.697998,8.25 15.289001,8.0130005 16,8.0130005 16.867996,8.0130005 17.537003,8.25 18.009995,8.7230072 18.561996,9.2750092 18.838989,10.106003 18.838989,11.207001 18.838989,12.077011 18.522995,12.827011 17.89299,13.455002 16.789001,14.561005 16.039001,15.429001 15.644989,16.061005 15.090988,16.92601 14.817001,18.228012 14.817001,19.964005L16.947998,19.964005C16.947998,18.545013 17.302002,17.478012 18.009995,16.767014 18.955994,15.824005 19.705994,15.074005 20.259995,14.522003 21.205002,13.574005 21.679001,12.432007 21.679001,11.090012 21.679001,9.5130005 21.166,8.2109985 20.14299,7.1880035 19.194992,6.2390137 17.853989,5.7660065 16.117996,5.7660065z M16,0C24.819992,0 32,7.178009 32,16.001007 32,24.822006 24.819992,32 16,32 7.1759949,32 0,24.822006 0,16.001007 0,7.178009 7.1759949,0 16,0z"/> |
|||
</Style> |
|||
|
|||
<Style x:Key="path_flag" TargetType="Path" BasedOn="{StaticResource basePath}"> |
|||
<Setter Property="Data" Value="M1.9000015,1.4000239L7.6999969,31.300008 5.8000031,31.700002 0,1.8000178z M9.5999985,0C17.300003,1.653807E-07,28.699997,2.1000055,28.699997,2.1000057L26,11.100002 32,20.400018C14.800003,15.999994,6.6999969,18.999993,6.6999969,18.999993L3.1999969,1.2000117C4.1999969,0.30001835,6.5999985,1.653807E-07,9.5999985,0z"/> |
|||
</Style> |
|||
</ResourceDictionary> |
@ -0,0 +1,18 @@ |
|||
using BBWY.Client.Models; |
|||
using System.Windows; |
|||
using System.Windows.Controls; |
|||
|
|||
namespace BBWY.Client.TemplateSelectors |
|||
{ |
|||
public class PurchaseOrderDataTemplateSelector : DataTemplateSelector |
|||
{ |
|||
public DataTemplate NormalTemplate { get; set; } |
|||
public DataTemplate EditTemplate { get; set; } |
|||
|
|||
public override DataTemplate SelectTemplate(object item, DependencyObject container) |
|||
{ |
|||
PurchaseOrder purchaseOrder = (PurchaseOrder)item; |
|||
return purchaseOrder.IsEdit ? EditTemplate : NormalTemplate; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,24 @@ |
|||
using GalaSoft.MvvmLight; |
|||
using GalaSoft.MvvmLight.Command; |
|||
using System.Windows.Input; |
|||
using System; |
|||
namespace BBWY.Client.ViewModels |
|||
{ |
|||
public class BaseVM : ViewModelBase |
|||
{ |
|||
public Guid VMId { get; set; } |
|||
|
|||
public ICommand LoadCommand { get; set; } |
|||
|
|||
public BaseVM() |
|||
{ |
|||
VMId = Guid.NewGuid(); |
|||
LoadCommand = new RelayCommand(Load); |
|||
} |
|||
|
|||
protected virtual void Load() |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
@ -0,0 +1,184 @@ |
|||
using BBWY.Client.APIServices; |
|||
using BBWY.Client.Models; |
|||
using BBWY.Common.Extensions; |
|||
using BBWY.Common.Models; |
|||
using GalaSoft.MvvmLight.Command; |
|||
using Jd.Api; |
|||
using Jd.Api.Request; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using System.Windows; |
|||
using System.Windows.Input; |
|||
|
|||
namespace BBWY.Client.ViewModels |
|||
{ |
|||
public class MainViewModel : BaseVM, IDenpendency |
|||
{ |
|||
#region Properties
|
|||
private MdsApiService mdsApiService; |
|||
private MenuModel selectedMenuModel; |
|||
private bool showShopChoosePanel; |
|||
|
|||
public GlobalContext GlobalContext { get; set; } |
|||
public IList<MenuModel> MenuList { get; set; } |
|||
|
|||
public IList<Shop> ShopList { get; set; } |
|||
|
|||
public MenuModel SelectedMenuModel |
|||
{ |
|||
get => selectedMenuModel; |
|||
set |
|||
{ |
|||
if (value == null) |
|||
return; |
|||
Set(ref selectedMenuModel, value); |
|||
foreach (var menu in MenuList) |
|||
{ |
|||
foreach (var cmenu in menu.ChildList) |
|||
{ |
|||
if (!ReferenceEquals(value, cmenu)) |
|||
cmenu.IsSelected = false; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 是否显示店铺选择列表
|
|||
/// </summary>
|
|||
public bool ShowShopChoosePanel { get => showShopChoosePanel; set { Set(ref showShopChoosePanel, value); } } |
|||
#endregion
|
|||
|
|||
#region Commands
|
|||
public ICommand ClosingCommand { get; set; } |
|||
|
|||
public ICommand ChooseShopCommand { get; set; } |
|||
#endregion
|
|||
|
|||
#region Methods
|
|||
public MainViewModel(GlobalContext globalContext, MdsApiService mdsApiService) |
|||
{ |
|||
this.mdsApiService = mdsApiService; |
|||
ClosingCommand = new RelayCommand<System.ComponentModel.CancelEventArgs>(Exit); |
|||
ChooseShopCommand = new RelayCommand<Shop>((s) => ChooseShop(s)); |
|||
this.GlobalContext = globalContext; |
|||
ShopList = new ObservableCollection<Shop>(); |
|||
MenuList = new List<MenuModel>() |
|||
{ |
|||
new MenuModel() |
|||
{ |
|||
Name="订单管理",ChildList=new List<MenuModel>() |
|||
{ |
|||
new MenuModel(){ Name="最近订单",Url="/Views/Order/OrderList.xaml" }, |
|||
//new MenuModel(){ Name="等待采购",Url="/Views/Order/OrderList.xaml" },
|
|||
//new MenuModel(){ Name="待出库",Url="/Views/Order/OrderList.xaml" },
|
|||
new MenuModel(){ Name="售后管理",Url="/Views/Order/OrderList.xaml" } |
|||
} |
|||
}, |
|||
new MenuModel() |
|||
{ |
|||
Name="商品管理",ChildList=new List<MenuModel>() |
|||
{ |
|||
new MenuModel(){ Name="货源管理",Url="/Views/Ware/WareManager.xaml" }, |
|||
new MenuModel(){ Name="产品库存",Url="/Views/Ware/WareStock.xaml" } |
|||
} |
|||
} |
|||
}; |
|||
Task.Factory.StartNew(Login); |
|||
} |
|||
|
|||
private void Exit(System.ComponentModel.CancelEventArgs e) |
|||
{ |
|||
App.Current.Shutdown(); |
|||
//Environment.Exit(Environment.ExitCode);
|
|||
} |
|||
|
|||
private void Login() |
|||
{ |
|||
try |
|||
{ |
|||
Thread.Sleep(1000); |
|||
|
|||
//从磨刀石获取用户Token
|
|||
var userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNDA1MTUxNjE5NTk0NTg4MTYwIiwidGVhbUlkIjoiMTQzOTg5OTEyMzk1NTI3MzcyOCIsImV4cCI6MTY3MTkwMTU1NH0.UaUubqP442qxVc6ppQt7FO0jcFs3w6KR6q1OeBuL1i8"; //齐越小一
|
|||
|
|||
//var userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNDE1OTMxMjU4NjEzMDEwNDMyIiwidGVhbUlkIjoiMTQxNDkzNTcwNDQ2MjQzMDIwOCIsImV4cCI6MTY3MjgzMTE3N30.gOlJav6J1bSrLvIzUCmc3zfTYcW_8hAlUpJxc02kyos"; //齐越文魁
|
|||
|
|||
var mdsUserResponse = mdsApiService.GetUserInfo(userToken); |
|||
if (!mdsUserResponse.Success) |
|||
throw new Exception($"获取磨刀石用户信息失败 {mdsUserResponse.Msg}"); |
|||
|
|||
GlobalContext.User = mdsUserResponse.Data.Map<User>(); |
|||
GlobalContext.User.Token = userToken; |
|||
|
|||
//请求用户信息接口
|
|||
//GlobalContext.User = new User()
|
|||
//{
|
|||
// Id = userId,
|
|||
// Name = "ShanJ",
|
|||
// Store = new Store()
|
|||
// {
|
|||
// Platform = Platform.京东,
|
|||
// AppKey = "120EA9EC65AB017567D78CC1139EEEA5",
|
|||
// AppSecret = "866a9877f5f24b03b537483b4defe75d",
|
|||
// AppToken = "d8433fb2a4994484b5d9e5a5896a6dfdmyjj" //d202f5eaf1c041dbbe2630363c6151eadiwm,8241a17cb2ae4d0db88b47a399dce22edi0m
|
|||
// }
|
|||
//};
|
|||
|
|||
var shopListResponse = mdsApiService.GetShopsByUserId(GlobalContext.User.Id); |
|||
if (!shopListResponse.Success) |
|||
throw new Exception(shopListResponse.Msg); |
|||
if (shopListResponse.Data == null || shopListResponse.Data.Count == 0) |
|||
throw new Exception("未绑定店铺"); |
|||
var shopList = shopListResponse.Data.Map<IList<Shop>>(); |
|||
if (shopList.Count == 1) |
|||
{ |
|||
ChooseShop(shopList[0], true); |
|||
} |
|||
else |
|||
{ |
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
foreach (var s in shopList) |
|||
ShopList.Add(s); |
|||
}); |
|||
ShowShopChoosePanel = true; |
|||
} |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
MessageBox.Show(ex.Message, "登录失败"); |
|||
}); |
|||
Environment.Exit(Environment.ExitCode); |
|||
} |
|||
} |
|||
|
|||
private void ChooseShop(Shop shop, bool _throw = false) |
|||
{ |
|||
if (shop.ShopId == 0 || |
|||
string.IsNullOrEmpty(shop.AppKey) || |
|||
string.IsNullOrEmpty(shop.AppSecret) || |
|||
string.IsNullOrEmpty(shop.AppToken) || |
|||
(shop.Platform == Platform.京东 && string.IsNullOrEmpty(shop.VenderType))) |
|||
{ |
|||
var error = $"{shop.Name} 店铺数据不完整"; |
|||
if (_throw) |
|||
throw new Exception(error); |
|||
else |
|||
{ |
|||
MessageBox.Show(error, "选择店铺"); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
GlobalContext.User.Shop = shop; |
|||
ShowShopChoosePanel = false; |
|||
} |
|||
#endregion
|
|||
} |
|||
} |
@ -0,0 +1,341 @@ |
|||
using BBWY.Client.APIServices; |
|||
using BBWY.Client.Models; |
|||
using BBWY.Client.Views.Order; |
|||
using BBWY.Common.Extensions; |
|||
using BBWY.Common.Models; |
|||
using BBWY.Controls; |
|||
using GalaSoft.MvvmLight.Command; |
|||
using GalaSoft.MvvmLight.Messaging; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
using System.Linq; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using System.Windows; |
|||
using System.Windows.Input; |
|||
|
|||
namespace BBWY.Client.ViewModels |
|||
{ |
|||
public class OrderListViewModel : BaseVM, IDenpendency |
|||
{ |
|||
private OrderService orderService; |
|||
private StatisticsService statisticsService; |
|||
|
|||
private bool isLoading; |
|||
|
|||
private string searchOrderId; |
|||
private DateTime startDate; |
|||
private DateTime endDate; |
|||
private int pageIndex = 1; |
|||
private int pageSize = 10; |
|||
private int orderCount; |
|||
private OrderState? orderState; |
|||
private string searchSku; |
|||
private string searchProductNo; |
|||
private string searchContactName; |
|||
private string searchWaybill; |
|||
private Random random; |
|||
|
|||
private GlobalContext globalContext; |
|||
|
|||
public IList<Order> OrderList { get; set; } |
|||
|
|||
public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } |
|||
|
|||
public string SearchOrderId { get => searchOrderId; set { Set(ref searchOrderId, value); } } |
|||
|
|||
public DateTime StartDate { get => startDate; set { Set(ref startDate, value); } } |
|||
|
|||
public DateTime EndDate { get => endDate; set { Set(ref endDate, 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 OrderState? OrderState { get => orderState; private set { Set(ref orderState, value); } } |
|||
|
|||
public string SearchSku { get => searchSku; set { Set(ref searchSku, value); } } |
|||
public string SearchProductNo { get => searchProductNo; set { Set(ref searchProductNo, value); } } |
|||
public string SearchContactName { get => searchContactName; set { Set(ref searchContactName, value); } } |
|||
public string SearchWaybill { get => searchWaybill; set { Set(ref searchWaybill, value); } } |
|||
|
|||
public ToDayOrderAchievement ToDayOrderAchievement { get; set; } |
|||
|
|||
public ICommand SetOrderStateCommand { get; set; } |
|||
|
|||
public ICommand SearchOrderCommand { get; set; } |
|||
|
|||
public ICommand CopyTextCommand { get; set; } |
|||
|
|||
public ICommand CopyOrderWaybillCommand { get; set; } |
|||
|
|||
public ICommand SetSearchDateCommand { get; set; } |
|||
|
|||
public ICommand OrderPageIndexChangedCommand { get; set; } |
|||
|
|||
public ICommand DecodeConsigneeCommand { get; set; } |
|||
|
|||
public ICommand ChooseStorageTypeCommand { get; set; } |
|||
|
|||
public ICommand EditCostCommand { get; set; } |
|||
|
|||
public OrderListViewModel(OrderService orderService, StatisticsService statisticsService, GlobalContext globalContext) |
|||
{ |
|||
random = new Random(); |
|||
this.globalContext = globalContext; |
|||
this.orderService = orderService; |
|||
this.statisticsService = statisticsService; |
|||
OrderList = new ObservableCollection<Order>(); |
|||
EndDate = DateTime.Now; |
|||
StartDate = DateTime.Now.Date.AddDays(-29); |
|||
ToDayOrderAchievement = new ToDayOrderAchievement(); |
|||
SetOrderStateCommand = new RelayCommand<OrderState?>(SetOrderState); |
|||
SearchOrderCommand = new RelayCommand(() => |
|||
{ |
|||
PageIndex = 1; |
|||
Task.Factory.StartNew(() => LoadOrder(1)); |
|||
Task.Factory.StartNew(LoadTodayAchievement); |
|||
}); |
|||
CopyTextCommand = new RelayCommand<string>(s => Clipboard.SetText(s)); |
|||
CopyOrderWaybillCommand = new RelayCommand<Order>(o => Clipboard.SetText(o.WaybillNo)); |
|||
SetSearchDateCommand = new RelayCommand<int>(d => |
|||
{ |
|||
EndDate = d == 1 ? DateTime.Now.Date.AddDays(-1) : DateTime.Now; |
|||
StartDate = DateTime.Now.Date.AddDays(d * -1); |
|||
PageIndex = 1; |
|||
Task.Factory.StartNew(() => LoadOrder(1)); |
|||
Task.Factory.StartNew(LoadTodayAchievement); |
|||
}); |
|||
OrderPageIndexChangedCommand = new RelayCommand<PageArgs>(p => |
|||
{ |
|||
Task.Factory.StartNew(() => LoadOrder(p.PageIndex)); |
|||
Task.Factory.StartNew(LoadTodayAchievement); |
|||
}); |
|||
DecodeConsigneeCommand = new RelayCommand<Order>(DecodeConsignee); |
|||
ChooseStorageTypeCommand = new RelayCommand<object>(ChooseStorageType); |
|||
EditCostCommand = new RelayCommand<Order>(EditCost); |
|||
SearchOrderCommand.Execute(null); |
|||
} |
|||
|
|||
public void SetOrderState(OrderState? orderState) |
|||
{ |
|||
this.OrderState = orderState; |
|||
SearchOrderId = String.Empty; |
|||
SearchContactName = String.Empty; |
|||
SearchProductNo = String.Empty; |
|||
SearchSku = String.Empty; |
|||
SearchWaybill = String.Empty; |
|||
EndDate = DateTime.Now; |
|||
StartDate = DateTime.Now.Date.AddDays(-29); |
|||
PageIndex = 1; |
|||
Task.Factory.StartNew(() => LoadOrder(1)); |
|||
} |
|||
|
|||
private void LoadOrder(int pageIndex) |
|||
{ |
|||
IsLoading = true; |
|||
Thread.Sleep(random.Next(1000, 2000)); |
|||
var response = orderService.GetOrderList(SearchOrderId, |
|||
StartDate, |
|||
EndDate, |
|||
OrderState, |
|||
SearchSku, |
|||
SearchProductNo, |
|||
SearchWaybill, |
|||
SearchContactName, |
|||
pageIndex, |
|||
pageSize, |
|||
globalContext.User.Shop.ShopId); |
|||
if (!response.Success) |
|||
{ |
|||
IsLoading = false; |
|||
App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "提示")); |
|||
return; |
|||
} |
|||
OrderCount = response.Data.Count; |
|||
var orderList = response.Data.Items.Map<IList<Order>>(); |
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
OrderList.Clear(); |
|||
foreach (var order in orderList) |
|||
{ |
|||
if (order.OrderCostDetailList.Count > 0) |
|||
order.ConvertOrderCostDetailToGroup(); |
|||
OrderList.Add(order); |
|||
} |
|||
|
|||
Messenger.Default.Send(string.Empty, "OrderList_OrderListScrollToTop"); |
|||
}); |
|||
IsLoading = false; |
|||
} |
|||
|
|||
private void LoadTodayAchievement() |
|||
{ |
|||
var response = statisticsService.GetTodayAchievementStatistics(); |
|||
if (!response.Success) |
|||
return; |
|||
_ = response.Data.Map(ToDayOrderAchievement); |
|||
} |
|||
|
|||
private void DecodeConsignee(Order order) |
|||
{ |
|||
IsLoading = true; |
|||
Task.Factory.StartNew(() => orderService.DecodeConsignee(order.Id)).ContinueWith(t => |
|||
{ |
|||
var response = t.Result; |
|||
IsLoading = false; |
|||
if (!response.Success) |
|||
{ |
|||
App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "解密失败")); |
|||
return; |
|||
} |
|||
order.Consignee.ContactName = response.Data.ContactName; |
|||
order.Consignee.Address = response.Data.Address; |
|||
order.Consignee.Mobile = response.Data.Mobile; |
|||
order.Consignee.IsDecode = true; |
|||
}); |
|||
} |
|||
|
|||
private void ChooseStorageType(object param) |
|||
{ |
|||
var paramList = (object[])param; |
|||
var orderId = paramList[0].ToString(); |
|||
var storageType = (StorageType)paramList[1]; |
|||
|
|||
var order = OrderList.FirstOrDefault(o => o.Id == orderId); |
|||
if (order.StorageType == storageType) |
|||
return;//忽略相同的仓储类型
|
|||
|
|||
if (storageType == StorageType.本地自发) |
|||
{ |
|||
var calculationCostType = new ChooseCalculationCostType(orderId, storageType, true); |
|||
calculationCostType.Closed += ChooseCalculationCostType_Closed; |
|||
calculationCostType.ShowDialog(); |
|||
} |
|||
else if (storageType == StorageType.SD) |
|||
{ |
|||
var sd = new SD(orderId, true); |
|||
sd.Closed += Sd_Closed; |
|||
sd.ShowDialog(); |
|||
} |
|||
} |
|||
|
|||
private void Sd_Closed(object sender, EventArgs e) |
|||
{ |
|||
var sd = sender as SD; |
|||
if (sd.DialogResult != true) |
|||
return; |
|||
var orderId = sd.OrderId; |
|||
var isSetStorageType = sd.IsSetStorageType; |
|||
var sdCommissionAmount = sd.SDCommissionAmount; |
|||
var deliveryExpressFreight = sd.DeliveryExpressFreight; |
|||
var sdType = sd.SDType; |
|||
var flag = sd.Flag; |
|||
var venderRemark = sd.VenderRemark; |
|||
|
|||
IsLoading = true; |
|||
Task.Factory.StartNew(() => orderService.SDCalculationCost(orderId, |
|||
isSetStorageType, |
|||
sdCommissionAmount, |
|||
deliveryExpressFreight, |
|||
sdType.Value, |
|||
flag, |
|||
venderRemark)) |
|||
.ContinueWith(r => |
|||
{ |
|||
var response = r.Result; |
|||
if (!response.Success) |
|||
{ |
|||
IsLoading = false; |
|||
App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "设置刷单成本")); |
|||
return; |
|||
} |
|||
LoadOrder(PageIndex); //手动计算成功刷新订单列表
|
|||
}); |
|||
} |
|||
|
|||
private void EditCost(Order order) |
|||
{ |
|||
if (order.StorageType == null) |
|||
return; |
|||
if (order.StorageType != StorageType.SD) |
|||
{ |
|||
var calculationCostType = new ChooseCalculationCostType(order.Id, order.StorageType.Value, false); |
|||
calculationCostType.Closed += ChooseCalculationCostType_Closed; |
|||
calculationCostType.ShowDialog(); |
|||
} |
|||
else |
|||
{ |
|||
var sd = new SD(order.Id, false); |
|||
sd.Closed += Sd_Closed; |
|||
sd.ShowDialog(); |
|||
} |
|||
} |
|||
|
|||
private void ChooseCalculationCostType_Closed(object sender, EventArgs e) |
|||
{ |
|||
var chooseCalculationCostType = sender as ChooseCalculationCostType; |
|||
chooseCalculationCostType.Closed -= ChooseCalculationCostType_Closed; |
|||
if (chooseCalculationCostType.DialogResult != true) |
|||
return; |
|||
|
|||
var orderId = chooseCalculationCostType.OrderId; |
|||
var storageType = chooseCalculationCostType.StorageType; |
|||
var isSetStorageType = chooseCalculationCostType.IsSetStorageType; |
|||
var isAutoCalculation = chooseCalculationCostType.IsAutoCalculation; |
|||
|
|||
if (isAutoCalculation) |
|||
{ |
|||
IsLoading = true; |
|||
Task.Factory.StartNew(() => orderService.AutoCalculationCost(orderId, isSetStorageType, storageType)).ContinueWith(r => |
|||
{ |
|||
var response = r.Result; |
|||
if (!response.Success) |
|||
{ |
|||
IsLoading = false; |
|||
App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "自动计算成本")); |
|||
return; |
|||
} |
|||
|
|||
LoadOrder(PageIndex); //自动计算成功刷新订单列表
|
|||
}); |
|||
} |
|||
else |
|||
{ |
|||
var manualCalculationCost = new ManualCalculationCost(orderId, isSetStorageType, storageType); |
|||
manualCalculationCost.Closed += ManualCalculationCost_Closed; |
|||
manualCalculationCost.ShowDialog(); |
|||
} |
|||
} |
|||
|
|||
private void ManualCalculationCost_Closed(object sender, EventArgs e) |
|||
{ |
|||
var manualCalculationCost = sender as ManualCalculationCost; |
|||
manualCalculationCost.Closed -= ManualCalculationCost_Closed; |
|||
if (manualCalculationCost.DialogResult != true) |
|||
return; |
|||
|
|||
var orderId = manualCalculationCost.OrderId; |
|||
var storageType = manualCalculationCost.StorageType; |
|||
var isSetStorageType = manualCalculationCost.IsSetStorageType; |
|||
var purchaseCost = manualCalculationCost.PurchaseCost; |
|||
var deliveryExpressFreight = manualCalculationCost.DeliveryExpressFreight; |
|||
|
|||
IsLoading = true; |
|||
Task.Factory.StartNew(() => orderService.ManualCalculationCost(orderId, isSetStorageType, storageType, purchaseCost, deliveryExpressFreight)).ContinueWith(r => |
|||
{ |
|||
var response = r.Result; |
|||
if (!response.Success) |
|||
{ |
|||
IsLoading = false; |
|||
App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "手动计算成本")); |
|||
return; |
|||
} |
|||
LoadOrder(PageIndex); //手动计算成功刷新订单列表
|
|||
}); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,70 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using System; |
|||
|
|||
namespace BBWY.Client.ViewModels |
|||
{ |
|||
public class ViewModelLocator |
|||
{ |
|||
private IServiceProvider sp; |
|||
|
|||
public ViewModelLocator() |
|||
{ |
|||
sp = (App.Current as App).ServiceProvider; |
|||
} |
|||
|
|||
public MainViewModel Main |
|||
{ |
|||
get |
|||
{ |
|||
using (var s = sp.CreateScope()) |
|||
{ |
|||
return s.ServiceProvider.GetRequiredService<MainViewModel>(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
public WareManagerViewModel WareManager |
|||
{ |
|||
get |
|||
{ |
|||
using (var s = sp.CreateScope()) |
|||
{ |
|||
return s.ServiceProvider.GetRequiredService<WareManagerViewModel>(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
public WareStockViewModel WareStock |
|||
{ |
|||
get |
|||
{ |
|||
using (var s = sp.CreateScope()) |
|||
{ |
|||
return s.ServiceProvider.GetRequiredService<WareStockViewModel>(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
public BindingPurchaseProductViewModel BindingPurchaseProduct |
|||
{ |
|||
get |
|||
{ |
|||
using (var s = sp.CreateScope()) |
|||
{ |
|||
return s.ServiceProvider.GetRequiredService<BindingPurchaseProductViewModel>(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
public OrderListViewModel OrderList |
|||
{ |
|||
get |
|||
{ |
|||
using (var s = sp.CreateScope()) |
|||
{ |
|||
return s.ServiceProvider.GetRequiredService<OrderListViewModel>(); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,431 @@ |
|||
using BBWY.Client.Models; |
|||
using GalaSoft.MvvmLight.Command; |
|||
using System.Threading.Tasks; |
|||
using System.Windows.Input; |
|||
using BBWY.Client.APIServices; |
|||
using System.Collections.Generic; |
|||
using Newtonsoft.Json.Linq; |
|||
using System.Linq; |
|||
using System; |
|||
using System.Windows; |
|||
using BBWY.Common.Models; |
|||
using System.Text.RegularExpressions; |
|||
using GalaSoft.MvvmLight.Messaging; |
|||
using System.Threading; |
|||
|
|||
namespace BBWY.Client.ViewModels |
|||
{ |
|||
public class BindingPurchaseProductViewModel : BaseVM, IDenpendency |
|||
{ |
|||
#region Properties
|
|||
private GlobalContext globalContext; |
|||
private OneBoundAPIService oneBoundAPIService; |
|||
private PurchaseService purchaseService; |
|||
|
|||
private string purchaserName; |
|||
private bool isLoading; |
|||
|
|||
public Product Product { get; set; } |
|||
public string PurchaserId { get; set; } |
|||
public string PurchaserName { get => purchaserName; set { Set(ref purchaserName, value); } } |
|||
public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } |
|||
|
|||
#endregion
|
|||
|
|||
#region ICommands
|
|||
public ICommand ClosingCommand { get; set; } |
|||
|
|||
public ICommand AddPurchaseProductCommand { get; set; } |
|||
|
|||
public ICommand RemovePurchaseSchemeProductCommand { get; set; } |
|||
|
|||
public ICommand GetPurchaseProductInfoCommand { get; set; } |
|||
|
|||
public ICommand ConfirmPurchaseProductCommand { get; set; } |
|||
|
|||
public ICommand EditPurchaseProductCommand { get; set; } |
|||
|
|||
public ICommand SavePurchaseSchemeCommand { get; set; } |
|||
#endregion
|
|||
|
|||
#region Methods
|
|||
public BindingPurchaseProductViewModel(OneBoundAPIService oneBoundAPIService, PurchaseService purchaseService, GlobalContext globalContext) |
|||
{ |
|||
this.globalContext = globalContext; |
|||
this.oneBoundAPIService = oneBoundAPIService; |
|||
this.purchaseService = purchaseService; |
|||
ClosingCommand = new RelayCommand<System.ComponentModel.CancelEventArgs>(Closing); |
|||
AddPurchaseProductCommand = new RelayCommand<ProductSku>(AddPurchaseProduct); |
|||
RemovePurchaseSchemeProductCommand = new RelayCommand<PurchaseSchemeProduct>(RemovePurchaseSchemeProduct); |
|||
GetPurchaseProductInfoCommand = new RelayCommand<PurchaseSchemeProduct>(GetPurchaseProductInfo); |
|||
ConfirmPurchaseProductCommand = new RelayCommand<PurchaseSchemeProduct>(ConfirmPurchaseProduct); |
|||
EditPurchaseProductCommand = new RelayCommand<PurchaseSchemeProduct>(EditPurchaseProduct); |
|||
SavePurchaseSchemeCommand = new RelayCommand(SavePurchaseScheme); |
|||
} |
|||
|
|||
public void SetData(Product product, string purchaserId, string purchaserName) |
|||
{ |
|||
this.Product = product; |
|||
this.PurchaserId = purchaserId; |
|||
this.PurchaserName = purchaserName; |
|||
} |
|||
|
|||
protected override void Load() |
|||
{ |
|||
if (!string.IsNullOrEmpty(PurchaserId)) |
|||
{ |
|||
IsLoading = true; |
|||
Task.Factory.StartNew(() => purchaseService.GetPurchaseSchemeList(new List<string>() { Product.Id }, PurchaserId, globalContext.User.Shop.ShopId)).ContinueWith(r => |
|||
{ |
|||
var apiResponse = r.Result; |
|||
if (!apiResponse.Success) |
|||
{ |
|||
App.Current.Dispatcher.BeginInvoke((Action)delegate |
|||
{ |
|||
MessageBox.Show(apiResponse.Msg, "查询采购方案"); |
|||
}); |
|||
IsLoading = false; |
|||
return; |
|||
} |
|||
|
|||
var purchaseSchemeList = apiResponse.Data; |
|||
|
|||
var waitList = new List<EventWaitHandle>(); |
|||
foreach (var sku in Product.SkuList) |
|||
{ |
|||
//当前SKU下当前采购商的采购方案
|
|||
var apiScheme = purchaseSchemeList.FirstOrDefault(s => s.SkuId == sku.Id && s.PurchaserId == PurchaserId); |
|||
|
|||
if (apiScheme == null) |
|||
continue; |
|||
|
|||
sku.SelectedPurchaseScheme = PurchaseScheme.Convert(apiScheme); |
|||
var ewh = new ManualResetEvent(false); |
|||
waitList.Add(ewh); |
|||
|
|||
Task.Factory.StartNew(() => |
|||
{ |
|||
foreach (var purchaseSchemeProduct in sku.SelectedPurchaseScheme.PurchaseSchemeProductList) |
|||
{ |
|||
purchaseSchemeProduct.IsEditing = false; |
|||
LoadPurchaseProduct(purchaseSchemeProduct); |
|||
} |
|||
ewh.Set(); |
|||
ewh.Dispose(); |
|||
}); |
|||
WaitHandle.WaitAll(waitList.ToArray()); |
|||
IsLoading = false; |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
|
|||
private void LoadPurchaseProduct(PurchaseSchemeProduct purchaseSchemeProduct, IList<PurchaseSchemeProductSku> skuList = null) |
|||
{ |
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
purchaseSchemeProduct.SkuList.Clear(); |
|||
purchaseSchemeProduct.PurchaseSchemeProductSkuList.Clear(); |
|||
}); |
|||
|
|||
if (skuList == null) |
|||
skuList = LoadPurchaseProductCore(purchaseSchemeProduct.PurchaseProductId, out _, out _, out _, null); |
|||
if (skuList == null) |
|||
return; |
|||
|
|||
App.Current.Dispatcher.BeginInvoke((Action)delegate |
|||
{ |
|||
foreach (var sku in skuList) |
|||
{ |
|||
purchaseSchemeProduct.SkuList.Add(sku); |
|||
if (purchaseSchemeProduct.SelectedSkuIdList.Any(s => s == sku.PurchaseSkuId)) |
|||
{ |
|||
sku.IsSelected = true; |
|||
purchaseSchemeProduct.PurchaseSchemeProductSkuList.Add(sku); |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
|
|||
private IList<PurchaseSchemeProductSku> LoadPurchaseProductCore(string purchseProductId, |
|||
out string errorMsg, |
|||
out string purchaserId, |
|||
out string purchaserName, |
|||
Func<string, string> checkPurchaserFunc) |
|||
{ |
|||
errorMsg = string.Empty; |
|||
purchaserId = string.Empty; |
|||
purchaserName = string.Empty; |
|||
//1688商品详情接口
|
|||
var response = oneBoundAPIService.GetProductInfo("1688", purchseProductId); |
|||
if (!response.Success) |
|||
{ |
|||
//记录日志
|
|||
|
|||
errorMsg = response.Msg; |
|||
return null; |
|||
} |
|||
var jobject = response.Data; |
|||
purchaserId = jobject["item"]["seller_info"].Value<string>("user_num_id"); |
|||
purchaserName = jobject["item"]["seller_info"].Value<string>("title"); |
|||
|
|||
if (checkPurchaserFunc != null) |
|||
{ |
|||
errorMsg = checkPurchaserFunc(purchaserId); |
|||
if (!string.IsNullOrEmpty(errorMsg)) |
|||
return null; |
|||
} |
|||
//else if (PurchaserId != shopId)
|
|||
//{
|
|||
// errorMsg = "同一条采购方案内的商品所属店铺必须相同";
|
|||
// return null;
|
|||
//}
|
|||
|
|||
var skuJArray = (JArray)jobject["item"]["skus"]["sku"]; |
|||
if (skuJArray.Count == 0) |
|||
{ |
|||
errorMsg = $"商品{purchseProductId}缺少sku信息"; |
|||
return null; |
|||
} |
|||
|
|||
return skuJArray.Select(j => new PurchaseSchemeProductSku() |
|||
{ |
|||
//ProductId = Product.Id,
|
|||
//SkuId = purchaseSchemeProduct.SkuId,
|
|||
PurchaseProductId = purchseProductId, |
|||
Price = j.Value<double>("price"), |
|||
PurchaseSkuId = j.Value<string>("sku_id"), |
|||
PurchaseSkuSpecId = j.Value<string>("spec_id"), |
|||
Title = j.Value<string>("properties_name"), |
|||
Logo = GetSkuLogo(j, (JArray)jobject["item"]["prop_imgs"]["prop_img"]) |
|||
}).ToList(); |
|||
} |
|||
|
|||
private string GetSkuLogo(JToken skuJToken, JArray prop_img) |
|||
{ |
|||
if (!prop_img.HasValues) |
|||
return "pack://application:,,,/Resources/Images/defaultItem.png"; |
|||
var properties = skuJToken.Value<string>("properties").Split(';', StringSplitOptions.RemoveEmptyEntries); |
|||
foreach (var p in properties) |
|||
{ |
|||
var imgJToken = prop_img.FirstOrDefault(g => g.Value<string>("properties") == p); |
|||
if (imgJToken != null) |
|||
return imgJToken.Value<string>("url"); |
|||
} |
|||
return "pack://application:,,,/Resources/Images/defaultItem.png"; |
|||
} |
|||
|
|||
private void AddPurchaseProduct(ProductSku productSku) |
|||
{ |
|||
if (productSku.PurchaseSchemeList.Count > 4) |
|||
{ |
|||
MessageBox.Show("该sku的采购方案已达上限(5)"); |
|||
return; |
|||
} |
|||
|
|||
if (productSku.SelectedPurchaseScheme == null) |
|||
{ |
|||
productSku.SelectedPurchaseScheme = new PurchaseScheme() |
|||
{ |
|||
ProductId = Product.Id, |
|||
SkuId = productSku.Id |
|||
}; |
|||
} |
|||
else if (productSku.SelectedPurchaseScheme.PurchaseSchemeProductList.Count >= 4) |
|||
{ |
|||
MessageBox.Show("该采购方案的商品数量已达上限(4)"); |
|||
return; |
|||
} |
|||
|
|||
productSku.SelectedPurchaseScheme.PurchaseSchemeProductList.Add(new PurchaseSchemeProduct() |
|||
{ |
|||
IsEditing = true, |
|||
ProductId = productSku.ProductId, |
|||
SkuId = productSku.Id |
|||
}); |
|||
} |
|||
|
|||
private void RemovePurchaseSchemeProduct(PurchaseSchemeProduct purchaseSchemeProduct) |
|||
{ |
|||
var productSku = Product.SkuList.FirstOrDefault(sku => sku.Id == purchaseSchemeProduct.SkuId); |
|||
productSku.SelectedPurchaseScheme.PurchaseSchemeProductList.Remove(purchaseSchemeProduct); |
|||
if (!Product.SkuList.Any(s => s.SelectedPurchaseScheme != null && s.SelectedPurchaseScheme.PurchaseSchemeProductList.Count > 0)) |
|||
PurchaserId = string.Empty; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 查询
|
|||
/// </summary>
|
|||
/// <param name="purchaseSchemeProduct"></param>
|
|||
private void GetPurchaseProductInfo(PurchaseSchemeProduct purchaseSchemeProduct) |
|||
{ |
|||
//验证路径是否合法
|
|||
if (string.IsNullOrEmpty(purchaseSchemeProduct.PurchaseUrl)) |
|||
{ |
|||
MessageBox.Show("商品url不能为空"); |
|||
return; |
|||
} |
|||
var match = Regex.Match(purchaseSchemeProduct.PurchaseUrl, @"^(https://detail.1688.com/offer/(\d+).html)[^\s]*"); |
|||
if (!match.Success) |
|||
{ |
|||
MessageBox.Show("未能识别的url"); |
|||
return; |
|||
} |
|||
var sku = Product.SkuList.FirstOrDefault(s => s.Id == purchaseSchemeProduct.SkuId); |
|||
var purchaseUrl = match.Groups[1].Value; |
|||
if (sku.SelectedPurchaseScheme.PurchaseSchemeProductList.Any(p => p.PurchaseUrl == purchaseUrl)) |
|||
{ |
|||
MessageBox.Show("商品链接重复"); |
|||
return; |
|||
} |
|||
|
|||
var purchaseProductId = match.Groups[2].Value; |
|||
|
|||
IsLoading = true; |
|||
|
|||
Task.Factory.StartNew(() => |
|||
{ |
|||
var purchaseSchemeProductSkuList = LoadPurchaseProductCore(purchaseProductId, |
|||
out string errorMsg, |
|||
out string purchaserId, |
|||
out string purchaserName, |
|||
(p) => |
|||
{ |
|||
if (sku.PurchaseSchemeList.Any(s => s.PurchaserId == p)) |
|||
return $"sku{sku.Id}的采购方案中已存在相同的采购商"; |
|||
|
|||
if (!string.IsNullOrEmpty(PurchaserId) && p != PurchaserId) |
|||
return "采购商必须相同"; |
|||
|
|||
return string.Empty; |
|||
}); |
|||
IsLoading = false; |
|||
if (!string.IsNullOrEmpty(errorMsg)) |
|||
{ |
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
MessageBox.Show(errorMsg, "绑定采购商"); |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
PurchaserId = purchaserId; |
|||
PurchaserName = purchaserName; |
|||
|
|||
purchaseSchemeProduct.PurchaseUrl = purchaseUrl; |
|||
purchaseSchemeProduct.PurchaseProductId = purchaseProductId; |
|||
|
|||
LoadPurchaseProduct(purchaseSchemeProduct, purchaseSchemeProductSkuList); |
|||
}); |
|||
} |
|||
|
|||
private void ConfirmPurchaseProduct(PurchaseSchemeProduct purchaseSchemeProduct) |
|||
{ |
|||
if (!purchaseSchemeProduct.SkuList.Any(s => s.IsSelected)) |
|||
{ |
|||
MessageBox.Show("至少选中一个采购Sku"); |
|||
return; |
|||
} |
|||
purchaseSchemeProduct.PurchaseSchemeProductSkuList.Clear(); |
|||
purchaseSchemeProduct.SelectedSkuIdList.Clear(); |
|||
foreach (var sku in purchaseSchemeProduct.SkuList) |
|||
{ |
|||
if (sku.IsSelected) |
|||
{ |
|||
purchaseSchemeProduct.PurchaseSchemeProductSkuList.Add(sku); |
|||
purchaseSchemeProduct.SelectedSkuIdList.Add(sku.PurchaseSkuId); |
|||
} |
|||
} |
|||
purchaseSchemeProduct.IsEditing = false; |
|||
|
|||
var productSku = Product.SkuList.FirstOrDefault(sku => sku.Id == purchaseSchemeProduct.SkuId); |
|||
productSku.SelectedPurchaseScheme.PurchaserId = PurchaserId; |
|||
productSku.SelectedPurchaseScheme.PurchaserName = PurchaserName; |
|||
} |
|||
|
|||
private void EditPurchaseProduct(PurchaseSchemeProduct purchaseSchemeProduct) |
|||
{ |
|||
purchaseSchemeProduct.IsEditing = true; |
|||
} |
|||
|
|||
private void SavePurchaseScheme() |
|||
{ |
|||
if (!Product.SkuList.Any(s => s.SelectedPurchaseScheme != null && s.SelectedPurchaseScheme.PurchaseSchemeProductList.Count != 0)) |
|||
{ |
|||
MessageBox.Show("没有需要保存的数据,如需删除该采购商所有数据请返回采购商列表进行删除", "提示"); |
|||
return; |
|||
} |
|||
|
|||
var hasNoReady = Product.SkuList.Any(s => s.SelectedPurchaseScheme != null && s.SelectedPurchaseScheme.PurchaseSchemeProductList.Any(p => p.IsEditing)); |
|||
if (hasNoReady) |
|||
{ |
|||
MessageBox.Show("存在未保存的数据", "提示"); |
|||
return; |
|||
} |
|||
|
|||
var addPurchaseSchemeList = Product.SkuList.Where(s => s.SelectedPurchaseScheme != null && |
|||
s.SelectedPurchaseScheme.PurchaseSchemeProductList.Count > 0 && |
|||
s.SelectedPurchaseScheme.Id == 0) |
|||
.Select(s => s.SelectedPurchaseScheme).ToList(); |
|||
var editPurchaseSchemeList = Product.SkuList.Where(s => s.SelectedPurchaseScheme != null && |
|||
s.SelectedPurchaseScheme.PurchaseSchemeProductList.Count > 0 && |
|||
s.SelectedPurchaseScheme.Id != 0) |
|||
.Select(s => s.SelectedPurchaseScheme).ToList(); |
|||
SuppPurchaseSkuData(addPurchaseSchemeList); |
|||
SuppPurchaseSkuData(editPurchaseSchemeList); |
|||
|
|||
IsLoading = true; |
|||
Task.Factory.StartNew(() => |
|||
{ |
|||
var response = purchaseService.EditPurchaseScheme(addPurchaseSchemeList, editPurchaseSchemeList); |
|||
IsLoading = false; |
|||
if (response.Success) |
|||
{ |
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
MessageBox.Show("绑定成功", "提示"); |
|||
}); |
|||
//关闭窗口
|
|||
Messenger.Default.Send(true, "BindingPurchaseProduct_Close"); |
|||
} |
|||
else |
|||
{ |
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
MessageBox.Show(response.Msg, "绑定失败"); |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
private void Closing(System.ComponentModel.CancelEventArgs e) |
|||
{ |
|||
PurchaserId = PurchaserName = string.Empty; |
|||
//clear data
|
|||
foreach (var sku in Product.SkuList) |
|||
{ |
|||
sku.SelectedPurchaseScheme = null; |
|||
} |
|||
Product = null; |
|||
e.Cancel = false; |
|||
} |
|||
|
|||
private void SuppPurchaseSkuData(IList<PurchaseScheme> purchaseSchemeList) |
|||
{ |
|||
foreach (var scheme in purchaseSchemeList) |
|||
{ |
|||
scheme.ShopId = globalContext.User.Shop.ShopId; |
|||
foreach (var purchaseProduct in scheme.PurchaseSchemeProductList) |
|||
{ |
|||
foreach (var purchaseSku in purchaseProduct.PurchaseSchemeProductSkuList) |
|||
{ |
|||
purchaseSku.ProductId = scheme.ProductId; |
|||
purchaseSku.SkuId = scheme.SkuId; |
|||
purchaseSku.SkuPurchaseSchemeId = scheme.Id; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
#endregion
|
|||
} |
|||
} |
@ -0,0 +1,323 @@ |
|||
using BBWY.Client.Models; |
|||
using BBWY.Common.Models; |
|||
using GalaSoft.MvvmLight.Command; |
|||
using Jd.Api.Request; |
|||
using Newtonsoft.Json.Linq; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
using System.Linq; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using System.Windows; |
|||
using System.Windows.Input; |
|||
using BBWY.Client.APIServices; |
|||
using GalaSoft.MvvmLight.Messaging; |
|||
|
|||
namespace BBWY.Client.ViewModels |
|||
{ |
|||
public class WareManagerViewModel : BaseVM, IDenpendency |
|||
{ |
|||
#region Properties
|
|||
private PurchaseService purchaseService; |
|||
private ProductService productService; |
|||
private BindingPurchaseProductViewModel bindingPurchaseProduct; |
|||
private GlobalContext globalContext; |
|||
private bool isLoading; |
|||
private int pageIndex = 1; |
|||
private int pageSize; |
|||
private int productCount; |
|||
private string searchProductName; |
|||
private string searchProductItem; |
|||
private string searchSpu; |
|||
private string searchSku; |
|||
|
|||
public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } |
|||
|
|||
public IList<Product> ProductList { get; set; } |
|||
public int PageIndex { get => pageIndex; set { Set(ref pageIndex, value); } } |
|||
public int PageSize { get => pageSize; set { Set(ref pageSize, value); } } |
|||
public int ProductCount { get => productCount; set { Set(ref productCount, value); } } |
|||
|
|||
public string SearchProductName { get => searchProductName; set { Set(ref searchProductName, value); } } |
|||
public string SearchProductItem { get => searchProductItem; set { Set(ref searchProductItem, value); } } |
|||
public string SearchSpu { get => searchSpu; set { Set(ref searchSpu, value); } } |
|||
public string SearchSku { get => searchSku; set { Set(ref searchSku, value); } } |
|||
#endregion
|
|||
|
|||
#region Commands
|
|||
public ICommand AddPurchaserCommand { get; set; } |
|||
public ICommand EditPurchaserCommand { get; set; } |
|||
public ICommand DeletePurchaserCommand { get; set; } |
|||
public ICommand SearchCommand { get; set; } |
|||
public ICommand ProductPageIndexChangedCommand { get; set; } |
|||
#endregion
|
|||
|
|||
#region Methods
|
|||
public WareManagerViewModel(GlobalContext globalContext, BindingPurchaseProductViewModel bindingPurchaseProduct, PurchaseService purchaseService, ProductService productService) |
|||
{ |
|||
AddPurchaserCommand = new RelayCommand<Product>(AddPurchaser); |
|||
EditPurchaserCommand = new RelayCommand<Purchaser>(EditPurchaser); |
|||
DeletePurchaserCommand = new RelayCommand<Purchaser>(DeletePurchaser); |
|||
SearchCommand = new RelayCommand(() => |
|||
{ |
|||
PageIndex = 1; |
|||
Task.Factory.StartNew(() => LoadWare(1)); |
|||
}); |
|||
ProductPageIndexChangedCommand = new RelayCommand<Controls.PageArgs>((p) => Task.Factory.StartNew(() => LoadWare(p.PageIndex))); |
|||
this.purchaseService = purchaseService; |
|||
this.productService = productService; |
|||
this.globalContext = globalContext; |
|||
this.bindingPurchaseProduct = bindingPurchaseProduct; |
|||
ProductList = new ObservableCollection<Product>(); |
|||
Task.Factory.StartNew(() => LoadWare(1)); |
|||
} |
|||
|
|||
protected override void Load() |
|||
{ |
|||
Console.WriteLine($"{VMId} {DateTime.Now}"); |
|||
} |
|||
|
|||
private void LoadWare(int pageIndex) |
|||
{ |
|||
if (!string.IsNullOrEmpty(SearchSpu) && !string.IsNullOrEmpty(SearchSku)) |
|||
{ |
|||
App.Current.Dispatcher.Invoke(() => MessageBox.Show("SPU和SKU条件不能共存")); |
|||
return; |
|||
} |
|||
|
|||
App.Current.Dispatcher.Invoke(() => ProductList.Clear()); |
|||
|
|||
IsLoading = true; |
|||
|
|||
#region 加载JD商品列表
|
|||
ApiResponse<ProductListResponse> productApiResponse = null; |
|||
if (!string.IsNullOrEmpty(SearchSku)) |
|||
{ |
|||
var skuResponse = productService.GetProductSkuList(string.Empty, SearchSku); |
|||
if (skuResponse.Success) |
|||
{ |
|||
if (skuResponse.Data.Count == 0) |
|||
{ |
|||
IsLoading = false; |
|||
return; |
|||
} |
|||
productApiResponse = productService.GetProductList(skuResponse.Data[0].ProductId, string.Empty, string.Empty, pageIndex); |
|||
} |
|||
else |
|||
{ |
|||
IsLoading = false; |
|||
App.Current.Dispatcher.Invoke(() => MessageBox.Show(skuResponse.Msg, "加载sku")); |
|||
return; |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
productApiResponse = productService.GetProductList(SearchSpu, SearchProductName, SearchProductItem, pageIndex); |
|||
} |
|||
|
|||
if (!productApiResponse.Success) |
|||
{ |
|||
IsLoading = false; |
|||
App.Current.Dispatcher.Invoke(() => MessageBox.Show(productApiResponse.Msg, "加载产品")); |
|||
return; |
|||
} |
|||
var productList = productApiResponse.Data.Items; |
|||
ProductCount = productApiResponse.Data.Count; |
|||
if (ProductCount == 0) |
|||
{ |
|||
IsLoading = false; |
|||
return; |
|||
} |
|||
#endregion
|
|||
|
|||
#region 加载JDSKU列表
|
|||
var waitList = new List<EventWaitHandle>(); |
|||
foreach (var p in productList) |
|||
{ |
|||
var ewh = new ManualResetEvent(false); |
|||
waitList.Add(ewh); |
|||
Task.Factory.StartNew(() => LoadSku(p, ewh)); |
|||
} |
|||
WaitHandle.WaitAll(waitList.ToArray(), 8000); |
|||
#endregion
|
|||
|
|||
#region 加载采购方案
|
|||
LoadPurchaseScheme(productList); |
|||
#endregion
|
|||
|
|||
App.Current.Dispatcher.BeginInvoke((Action)delegate |
|||
{ |
|||
foreach (var p in productList) |
|||
ProductList.Add(p); |
|||
ExtractPurchaser(); |
|||
//使滚动条保持顶部
|
|||
Messenger.Default.Send(string.Empty, "WareManager_ProductListScrollToTop"); |
|||
}); |
|||
|
|||
IsLoading = false; |
|||
} |
|||
|
|||
private void LoadSku(Product product, EventWaitHandle ewh) |
|||
{ |
|||
try |
|||
{ |
|||
var skuResponse = productService.GetProductSkuList(product.Id, string.Empty); |
|||
if (!skuResponse.Success) |
|||
{ |
|||
IsLoading = false; |
|||
App.Current.Dispatcher.Invoke(() => MessageBox.Show(skuResponse.Msg, "加载sku")); |
|||
return; |
|||
} |
|||
product.SkuList = skuResponse.Data; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
|
|||
} |
|||
finally |
|||
{ |
|||
ewh.Set(); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 加载采购方案
|
|||
/// </summary>
|
|||
/// <param name="productList"></param>
|
|||
private void LoadPurchaseScheme(IList<Product> productList) |
|||
{ |
|||
var response = purchaseService.GetPurchaseSchemeList(productList.Select(p => p.Id).ToList(), string.Empty, globalContext.User.Shop.ShopId); |
|||
if (!response.Success) |
|||
{ |
|||
App.Current.Dispatcher.BeginInvoke((Action)delegate { MessageBox.Show(response.Msg, "获取采购方案"); }); |
|||
return; |
|||
} |
|||
|
|||
var schemeList = response.Data; |
|||
|
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
foreach (var p in productList) |
|||
{ |
|||
foreach (var s in p.SkuList) |
|||
{ |
|||
s.PurchaseSchemeList.Clear(); |
|||
var currentSchemeList = schemeList.Where(scheme => scheme.SkuId == s.Id); |
|||
if (currentSchemeList.Count() > 0) |
|||
foreach (var scheme in currentSchemeList) |
|||
s.PurchaseSchemeList.Add(PurchaseScheme.Convert(scheme)); |
|||
} |
|||
} |
|||
}); |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 提取SKU中的采购商到商品的采购商列表中
|
|||
/// </summary>
|
|||
private void ExtractPurchaser(string productId = "") |
|||
{ |
|||
var productList = string.IsNullOrEmpty(productId) ? ProductList : ProductList.Where(p => p.Id == productId); |
|||
foreach (var product in productList) |
|||
{ |
|||
product.PurchaserList.Clear(); |
|||
foreach (var sku in product.SkuList) |
|||
{ |
|||
if (sku.PurchaseSchemeList.Count() > 0) |
|||
{ |
|||
foreach (var pscheme in sku.PurchaseSchemeList) |
|||
{ |
|||
var purchaser = product.PurchaserList.FirstOrDefault(purchaser => purchaser.Id == pscheme.PurchaserId); |
|||
if (purchaser == null) |
|||
{ |
|||
purchaser = new Purchaser() { Id = pscheme.PurchaserId, Name = pscheme.PurchaserName, ProductId = product.Id }; |
|||
product.PurchaserList.Add(purchaser); |
|||
} |
|||
purchaser.SkuUseCount++; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
private void AddPurchaser(Product product) |
|||
{ |
|||
if (product.PurchaserList.Count >= 5) |
|||
{ |
|||
MessageBox.Show("一个SPU内最多允许5个采购商"); |
|||
return; |
|||
} |
|||
|
|||
OpenBindingView(product, string.Empty, string.Empty); |
|||
} |
|||
|
|||
private void EditPurchaser(Purchaser purchaser) |
|||
{ |
|||
var product = ProductList.FirstOrDefault(p => p.Id == purchaser.ProductId); |
|||
OpenBindingView(product, purchaser.Id, purchaser.Name); |
|||
} |
|||
|
|||
private void DeletePurchaser(Purchaser purchaser) |
|||
{ |
|||
if (MessageBox.Show("确认删除该采购商吗?", "提示", MessageBoxButton.OKCancel) != MessageBoxResult.OK) |
|||
return; |
|||
IsLoading = true; |
|||
Task.Factory.StartNew(() => |
|||
{ |
|||
var response = purchaseService.DeletePurchaser(purchaser.ProductId, purchaser.Id); |
|||
IsLoading = false; |
|||
if (response.Success) |
|||
{ |
|||
App.Current.Dispatcher.BeginInvoke((Action)delegate |
|||
{ |
|||
var product = ProductList.FirstOrDefault(p => p.Id == purchaser.ProductId); |
|||
if (product != null) |
|||
{ |
|||
foreach (var sku in product.SkuList) |
|||
{ |
|||
var deleteScheme = sku.PurchaseSchemeList.FirstOrDefault(s => s.PurchaserId == purchaser.Id); |
|||
if (deleteScheme != null) |
|||
sku.PurchaseSchemeList.Remove(deleteScheme); |
|||
} |
|||
product.PurchaserList.Remove(purchaser); |
|||
} |
|||
MessageBox.Show("采购商删除成功", "提示"); |
|||
}); |
|||
} |
|||
else |
|||
{ |
|||
App.Current.Dispatcher.BeginInvoke((Action)delegate |
|||
{ |
|||
MessageBox.Show(response.Msg, "采购商删除"); |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
private void OpenBindingView(Product product, string purchaserId, string purchaserName) |
|||
{ |
|||
bindingPurchaseProduct.SetData(product, purchaserId, purchaserName); |
|||
var bindingView = new Views.Ware.BindingPurchaseProduct(); |
|||
var r = bindingView.ShowDialog(); |
|||
if (r == true) |
|||
{ |
|||
Console.WriteLine("Refresh PurchaseScheme"); |
|||
Task.Factory.StartNew(() => |
|||
{ |
|||
IsLoading = true; |
|||
LoadPurchaseScheme(new List<Product>() { product }); |
|||
IsLoading = false; |
|||
App.Current.Dispatcher.BeginInvoke((Action)delegate |
|||
{ |
|||
ExtractPurchaser(product.Id); |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
#endregion
|
|||
|
|||
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,333 @@ |
|||
using BBWY.Client.APIServices; |
|||
using BBWY.Client.Models; |
|||
using BBWY.Common.Extensions; |
|||
using BBWY.Common.Models; |
|||
using GalaSoft.MvvmLight.Command; |
|||
using GalaSoft.MvvmLight.Messaging; |
|||
using Jd.Api.Request; |
|||
using Newtonsoft.Json.Linq; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
using System.Linq; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using System.Windows; |
|||
using System.Windows.Input; |
|||
|
|||
namespace BBWY.Client.ViewModels |
|||
{ |
|||
public class WareStockViewModel : BaseVM, IDenpendency |
|||
{ |
|||
#region Property
|
|||
private PurchaseOrderService purchaseOrderService; |
|||
private ProductService productService; |
|||
private GlobalContext globalContext; |
|||
|
|||
private bool isLoading; |
|||
private int pageIndex = 1; |
|||
private int pageSize; |
|||
private int productCount; |
|||
private string searchProductItem; |
|||
private string searchSpu; |
|||
private string searchSku; |
|||
private string searchPurchaseOrder; |
|||
|
|||
public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } |
|||
public int PageIndex { get => pageIndex; set { Set(ref pageIndex, value); } } |
|||
public int PageSize { get => pageSize; set { Set(ref pageSize, value); } } |
|||
public int ProductCount { get => productCount; set { Set(ref productCount, value); } } |
|||
public string SearchProductItem { get => searchProductItem; set { Set(ref searchProductItem, value); } } |
|||
public string SearchSpu { get => searchSpu; set { Set(ref searchSpu, value); } } |
|||
public string SearchSku { get => searchSku; set { Set(ref searchSku, value); } } |
|||
public string SearchPurchaseOrder { get => searchPurchaseOrder; set { Set(ref searchPurchaseOrder, value); } } |
|||
|
|||
public IList<Product> ProductList { get; set; } |
|||
#endregion
|
|||
|
|||
#region ICommand
|
|||
public ICommand SearchCommand { get; set; } |
|||
public ICommand ProductPageIndexChangedCommand { get; set; } |
|||
public ICommand AddPurchaserOrderCommand { get; set; } |
|||
public ICommand EditPurchaseOrderCommand { get; set; } |
|||
public ICommand DeletePurchaseOrderCommand { get; set; } |
|||
public ICommand SavePurchaseOrderCommand { get; set; } |
|||
public ICommand SwitchStorageTypeCommand { get; set; } |
|||
#endregion
|
|||
|
|||
#region Method
|
|||
public WareStockViewModel(GlobalContext globalContext, PurchaseOrderService purchaseOrderService, ProductService productService) |
|||
{ |
|||
this.globalContext = globalContext; |
|||
this.purchaseOrderService = purchaseOrderService; |
|||
this.productService = productService; |
|||
ProductList = new ObservableCollection<Product>(); |
|||
|
|||
SearchCommand = new RelayCommand(() => |
|||
{ |
|||
PageIndex = 1; |
|||
Task.Factory.StartNew(() => LoadWare(1)); |
|||
}); |
|||
ProductPageIndexChangedCommand = new RelayCommand<Controls.PageArgs>((p) => Task.Factory.StartNew(() => LoadWare(p.PageIndex))); |
|||
SwitchStorageTypeCommand = new RelayCommand<StorageModel>(SwitchStorageType); |
|||
AddPurchaserOrderCommand = new RelayCommand<Product>(AddPurchaserOrder); |
|||
EditPurchaseOrderCommand = new RelayCommand<PurchaseOrder>(po => po.IsEdit = true); |
|||
DeletePurchaseOrderCommand = new RelayCommand<PurchaseOrder>(DeletePurchaseOrder); |
|||
SavePurchaseOrderCommand = new RelayCommand<PurchaseOrder>(SavePurchaseOrder); |
|||
Task.Factory.StartNew(() => LoadWare(1)); |
|||
} |
|||
|
|||
private void LoadWare(int pageIndex) |
|||
{ |
|||
if (!string.IsNullOrEmpty(SearchSpu) && !string.IsNullOrEmpty(SearchSku)) |
|||
{ |
|||
App.Current.Dispatcher.Invoke(() => MessageBox.Show("SPU和SKU条件不能共存")); |
|||
return; |
|||
} |
|||
|
|||
App.Current.Dispatcher.Invoke(() => ProductList.Clear()); |
|||
|
|||
IsLoading = true; |
|||
|
|||
#region 加载JD商品列表
|
|||
ApiResponse<ProductListResponse> productApiResponse = null; |
|||
if (!string.IsNullOrEmpty(SearchSku)) |
|||
{ |
|||
var skuResponse = productService.GetProductSkuList(string.Empty, SearchSku); |
|||
if (skuResponse.Success) |
|||
{ |
|||
if (skuResponse.Data.Count == 0) |
|||
{ |
|||
IsLoading = false; |
|||
return; |
|||
} |
|||
productApiResponse = productService.GetProductList(skuResponse.Data[0].ProductId, string.Empty, string.Empty, pageIndex); |
|||
} |
|||
else |
|||
{ |
|||
IsLoading = false; |
|||
App.Current.Dispatcher.Invoke(() => MessageBox.Show(skuResponse.Msg, "加载sku")); |
|||
return; |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
productApiResponse = productService.GetProductList(SearchSpu, string.Empty, SearchProductItem, pageIndex); |
|||
} |
|||
|
|||
if (!productApiResponse.Success) |
|||
{ |
|||
IsLoading = false; |
|||
App.Current.Dispatcher.Invoke(() => MessageBox.Show(productApiResponse.Msg, "加载产品")); |
|||
return; |
|||
} |
|||
var productList = productApiResponse.Data.Items; |
|||
ProductCount = productApiResponse.Data.Count; |
|||
if (ProductCount == 0) |
|||
{ |
|||
IsLoading = false; |
|||
return; |
|||
} |
|||
#endregion
|
|||
|
|||
#region 加载JDSKU列表
|
|||
var waitList = new List<EventWaitHandle>(); |
|||
foreach (var p in productList) |
|||
{ |
|||
var ewh = new ManualResetEvent(false); |
|||
waitList.Add(ewh); |
|||
Task.Factory.StartNew(() => LoadSku(p, ewh)); |
|||
} |
|||
WaitHandle.WaitAll(waitList.ToArray(), 8000); |
|||
#endregion
|
|||
|
|||
#region 加载采购单
|
|||
LoadPurchaseOrder(productList, StorageType.京仓); |
|||
#endregion
|
|||
|
|||
App.Current.Dispatcher.BeginInvoke((Action)delegate |
|||
{ |
|||
foreach (var p in productList) |
|||
ProductList.Add(p); |
|||
//使滚动条保持顶部
|
|||
Messenger.Default.Send(string.Empty, "WareStock_ProductListScrollToTop"); |
|||
}); |
|||
|
|||
IsLoading = false; |
|||
} |
|||
|
|||
private void LoadSku(Product product, EventWaitHandle ewh) |
|||
{ |
|||
try |
|||
{ |
|||
var skuResponse = productService.GetProductSkuList(product.Id, string.Empty); |
|||
if (!skuResponse.Success) |
|||
{ |
|||
IsLoading = false; |
|||
App.Current.Dispatcher.Invoke(() => MessageBox.Show(skuResponse.Msg, "加载sku")); |
|||
return; |
|||
} |
|||
foreach (var sku in skuResponse.Data) |
|||
{ |
|||
sku.StorageList.Add(new StorageModel() |
|||
{ |
|||
ProductId = product.Id, |
|||
SkuId = sku.Id, |
|||
StorageType = StorageType.京仓 |
|||
}); |
|||
sku.StorageList.Add(new StorageModel() |
|||
{ |
|||
ProductId = product.Id, |
|||
SkuId = sku.Id, |
|||
StorageType = StorageType.云仓 |
|||
}); |
|||
sku.StorageList.Add(new StorageModel() |
|||
{ |
|||
ProductId = product.Id, |
|||
SkuId = sku.Id, |
|||
StorageType = StorageType.本地自发 |
|||
}); |
|||
sku.SelectedStorageModel = sku.StorageList[0]; |
|||
} |
|||
product.SkuList = skuResponse.Data; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
|
|||
} |
|||
finally |
|||
{ |
|||
ewh.Set(); |
|||
} |
|||
} |
|||
|
|||
private void LoadPurchaseOrder(IList<Product> productList, StorageType storageType) |
|||
{ |
|||
var skuList = new List<ProductSku>(); |
|||
foreach (var p in productList) |
|||
skuList.AddRange(p.SkuList); |
|||
LoadPurchaseOrder(skuList, storageType); |
|||
} |
|||
|
|||
private void LoadPurchaseOrder(IList<ProductSku> skuList, StorageType storageType) |
|||
{ |
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
foreach (var s in skuList) |
|||
s.PurchaseOrderList.Clear(); |
|||
}); |
|||
var response = purchaseOrderService.GetList(skuList.Select(s => s.Id).ToList(), storageType, globalContext.User.Shop.ShopId); |
|||
if (response.Success) |
|||
{ |
|||
var purchaseOrderList = response.Data; |
|||
App.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
foreach (var s in skuList) |
|||
{ |
|||
var currentSkuPurchaseOrderList = purchaseOrderList.Where(po => po.SkuId == s.Id).Map<IList<PurchaseOrder>>(); |
|||
foreach (var po in currentSkuPurchaseOrderList) |
|||
s.PurchaseOrderList.Add(po); |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
|
|||
private void SwitchStorageType(StorageModel storageModel) |
|||
{ |
|||
var product = ProductList.FirstOrDefault(p => p.Id == storageModel.ProductId); |
|||
var sku = product.SkuList.FirstOrDefault(s => s.Id == storageModel.SkuId); |
|||
if (sku.SelectedStorageModel == storageModel) |
|||
return; |
|||
sku.SelectedStorageModel = storageModel; |
|||
IsLoading = true; |
|||
Task.Factory.StartNew(() => |
|||
{ |
|||
LoadPurchaseOrder(new List<ProductSku>() { sku }, storageModel.StorageType); |
|||
IsLoading = false; |
|||
}); |
|||
} |
|||
|
|||
private void AddPurchaserOrder(Product product) |
|||
{ |
|||
foreach (var sku in product.SkuList) |
|||
sku.PurchaseOrderList.Add(new PurchaseOrder |
|||
{ |
|||
IsEdit = true, |
|||
SkuId = sku.Id, |
|||
ProductId = product.Id, |
|||
UserId = globalContext.User.Id, |
|||
StorageType = sku.SelectedStorageModel.StorageType, |
|||
PurchaseMethod = PurchaseMethod.线下采购, |
|||
CreateTime = DateTime.Now, |
|||
ShopId = globalContext.User.Shop.ShopId, |
|||
PurchasePlatform = Platform.阿里巴巴 |
|||
}); |
|||
} |
|||
|
|||
private void DeletePurchaseOrder(PurchaseOrder purchaseOrder) |
|||
{ |
|||
var product = ProductList.FirstOrDefault(p => p.Id == purchaseOrder.ProductId); |
|||
var sku = product.SkuList.FirstOrDefault(s => s.Id == purchaseOrder.SkuId); |
|||
if (purchaseOrder.Id == 0) |
|||
{ |
|||
sku.PurchaseOrderList.Remove(purchaseOrder); |
|||
} |
|||
else |
|||
{ |
|||
if (MessageBox.Show("确定要删除采购单吗?", "确认", MessageBoxButton.OKCancel) != MessageBoxResult.OK) |
|||
return; |
|||
IsLoading = true; |
|||
Task.Factory.StartNew(() => |
|||
{ |
|||
var response = purchaseOrderService.DeletePurchaseOrder(purchaseOrder.Id); |
|||
IsLoading = false; |
|||
App.Current.Dispatcher.BeginInvoke((Action)delegate |
|||
{ |
|||
if (response.Success) |
|||
sku.PurchaseOrderList.Remove(purchaseOrder); |
|||
else |
|||
MessageBox.Show(response.Msg, "删除采购单"); |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
|
|||
private void SavePurchaseOrder(PurchaseOrder purchaseOrder) |
|||
{ |
|||
if (purchaseOrder.PurchasePlatform == null || |
|||
string.IsNullOrEmpty(purchaseOrder.PurchaseOrderId) || |
|||
purchaseOrder.PurchaseQuantity == 0) |
|||
{ |
|||
MessageBox.Show("缺少必要信息", "保存采购单"); |
|||
return; |
|||
} |
|||
|
|||
if (purchaseOrder.RemainingQuantity > purchaseOrder.PurchaseQuantity) |
|||
{ |
|||
MessageBox.Show("剩余库存不成超过采购数量", "保存采购单"); |
|||
return; |
|||
} |
|||
|
|||
purchaseOrder.IsEdit = false; |
|||
var product = ProductList.FirstOrDefault(p => p.Id == purchaseOrder.ProductId); |
|||
var sku = product.SkuList.FirstOrDefault(s => s.Id == purchaseOrder.SkuId); |
|||
IsLoading = true; |
|||
Task.Factory.StartNew(() => |
|||
{ |
|||
var response = purchaseOrder.Id == 0 ? purchaseOrderService.AddPurchaseOrder(purchaseOrder) : |
|||
purchaseOrderService.EditPurchaseOrder(purchaseOrder); |
|||
IsLoading = false; |
|||
if (response.Success) |
|||
{ |
|||
if (purchaseOrder.Id == 0) |
|||
LoadPurchaseOrder(new List<ProductSku>() { sku }, purchaseOrder.StorageType.Value); |
|||
} |
|||
else |
|||
{ |
|||
App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "保存采购单")); |
|||
} |
|||
}); |
|||
} |
|||
#endregion
|
|||
} |
|||
} |
@ -0,0 +1,104 @@ |
|||
<c:BWindow x:Class="BBWY.Client.Views.MainWindow" |
|||
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:b="http://schemas.microsoft.com/xaml/behaviors" |
|||
xmlns:local="clr-namespace:BBWY.Client.Views" |
|||
DataContext="{Binding Main,Source={StaticResource Locator}}" |
|||
mc:Ignorable="d" |
|||
Style="{StaticResource bwstyle}" |
|||
Title="{Binding GlobalContext.User.Shop.Name,StringFormat=步步为盈 \{0\}}" Height="450" Width="800"> |
|||
<b:Interaction.Triggers> |
|||
<b:EventTrigger EventName="Closing"> |
|||
<b:InvokeCommandAction Command="{Binding ClosingCommand}" PassEventArgsToCommand="True"/> |
|||
</b:EventTrigger> |
|||
</b:Interaction.Triggers> |
|||
<Grid> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition/> |
|||
</Grid.RowDefinitions> |
|||
<Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource MainMenu.BorderBrush}"> |
|||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"> |
|||
<TextBlock Text="{Binding GlobalContext.User.Name}"/> |
|||
<!--<TextBlock Text="{Binding GlobalContext.User.TeamName}" Margin="5,0,0,0"/> |
|||
<TextBlock Text="{Binding GlobalContext.User.Shop.Platform}" Margin="5,0,0,0"/>--> |
|||
<TextBlock Text="{Binding GlobalContext.User.Shop.Name}" Margin="5,0,0,0"/> |
|||
</StackPanel> |
|||
</Border> |
|||
<Grid Grid.Row="1"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="150"/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
<ListBox x:Name="listbox_menu" ItemsSource="{Binding MenuList}" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" |
|||
Background="{StaticResource MainMenu.BackGround}" |
|||
Foreground="{StaticResource Text.Color}" |
|||
BorderThickness="0,0,1,0" |
|||
BorderBrush="{StaticResource MainMenu.BorderBrush}"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Grid Width="{Binding ActualWidth,ElementName=listbox_menu}"> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="auto"/> |
|||
<RowDefinition/> |
|||
</Grid.RowDefinitions> |
|||
<TextBlock Text="{Binding Name}" Margin="10,5,0,5"/> |
|||
<ListBox ItemsSource="{Binding ChildList}" |
|||
SelectedItem="{Binding DataContext.SelectedMenuModel,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}" |
|||
Grid.Row="1" |
|||
Foreground="#4A4A4A"> |
|||
<ListBox.ItemContainerStyle> |
|||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource DefaultListBoxItemStyle}"> |
|||
<Setter Property="IsSelected" Value="{Binding IsSelected,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/> |
|||
</Style> |
|||
</ListBox.ItemContainerStyle> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<TextBlock Text="{Binding Name}" Margin="20,5,0,5" /> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
</Grid> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
|
|||
<Frame x:Name="frame" Navigated="frame_Navigated" NavigationUIVisibility="Hidden" |
|||
Source="{Binding SelectedMenuModel.Url}" |
|||
Grid.Column="1"/> |
|||
|
|||
<Grid Grid.ColumnSpan="2" Background="{StaticResource Border.Background}" |
|||
Visibility="{Binding ShowShopChoosePanel,Converter={StaticResource objConverter},ConverterParameter=true:Visible:Collapsed}"> |
|||
<Grid HorizontalAlignment="Center" VerticalAlignment="Center"> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="40"/> |
|||
<RowDefinition/> |
|||
</Grid.RowDefinitions> |
|||
<TextBlock Text="请选择一个店铺" VerticalAlignment="Center" FontWeight="Bold" FontSize="20"/> |
|||
<ListBox ItemsSource="{Binding ShopList}" Grid.Row="1" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" |
|||
Style="{StaticResource NoScrollViewListBoxStyle}"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<c:BButton Content="{Binding Name}" |
|||
Background="Transparent" |
|||
Foreground="{StaticResource Text.Color}" |
|||
FontSize="14" |
|||
MouseOverBgColor="{StaticResource Button.Selected.Background}" |
|||
MouseOverFontColor="White" |
|||
Padding="5,0" |
|||
Command="{Binding DataContext.ChooseShopCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}" |
|||
CommandParameter="{Binding }"/> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
</Grid> |
|||
|
|||
</Grid> |
|||
</Grid> |
|||
</Grid> |
|||
</c:BWindow> |
@ -0,0 +1,51 @@ |
|||
using BBWY.Controls; |
|||
using Jd.Api; |
|||
using Jd.Api.Request; |
|||
using Jd.Api.Response; |
|||
using System; |
|||
using System.Windows; |
|||
using System.Windows.Controls; |
|||
|
|||
namespace BBWY.Client.Views |
|||
{ |
|||
/// <summary>
|
|||
/// Interaction logic for MainWindow.xaml
|
|||
/// </summary>
|
|||
public partial class MainWindow : BWindow |
|||
{ |
|||
public MainWindow() |
|||
{ |
|||
InitializeComponent(); |
|||
this.Width = SystemParameters.WorkArea.Size.Width * 0.8; |
|||
this.Height = SystemParameters.WorkArea.Size.Height * 0.7; |
|||
this.Loaded += MainWindow_Loaded; |
|||
} |
|||
|
|||
private void MainWindow_Loaded(object sender, RoutedEventArgs e) |
|||
{ |
|||
|
|||
|
|||
//var appkey = "120EA9EC65AB017567D78CC1139EEEA5";
|
|||
//var appsecret = "866a9877f5f24b03b537483b4defe75d";
|
|||
//var token = "00f28ca8917948aea46e9f534090817a5mdb";
|
|||
//
|
|||
//IJdClient client = new DefaultJdClient("https://api.jd.com/routerjson", appkey, appsecret);
|
|||
//
|
|||
//WareReadSearchWare4ValidRequest req = new WareReadSearchWare4ValidRequest();
|
|||
//req.orderField = "modified";
|
|||
//req.orderType = "desc";
|
|||
//req.pageSize = 50;
|
|||
//req.field = "images,logo";
|
|||
//
|
|||
//WareReadSearchWare4ValidResponse response = client.Execute(req, token, DateTime.Now.ToLocalTime());
|
|||
//
|
|||
//Console.WriteLine(response.Body);
|
|||
} |
|||
|
|||
private void frame_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e) |
|||
{ |
|||
if (frame.CanGoBack) |
|||
frame.RemoveBackEntry(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,28 @@ |
|||
<c:BWindow x:Class="BBWY.Client.Views.Order.ChooseCalculationCostType" |
|||
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:local="clr-namespace:BBWY.Client.Views.Order" |
|||
mc:Ignorable="d" |
|||
Title="成本信息计算方式" Height="150" Width="300" |
|||
Style="{StaticResource bwstyle}" |
|||
MinButtonVisibility="Collapsed" |
|||
MaxButtonVisibility="Collapsed"> |
|||
<Grid> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition/> |
|||
</Grid.RowDefinitions> |
|||
|
|||
<Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource MainMenu.BorderBrush}" |
|||
Background="{StaticResource Border.Background}"> |
|||
<TextBlock Text="成本信息计算方式" HorizontalAlignment="Center" VerticalAlignment="Center"/> |
|||
</Border> |
|||
<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center"> |
|||
<c:BButton Content="自动" Width="100" x:Name="btn_autoCalculation" Click="btn_autoCalculation_Click"/> |
|||
<c:BButton Content="手动" Width="100" Margin="10,0,0,0" x:Name="btn_manualCalculation" Click="btn_manualCalculation_Click"/> |
|||
</StackPanel> |
|||
</Grid> |
|||
</c:BWindow> |
@ -0,0 +1,42 @@ |
|||
using BBWY.Client.Models; |
|||
using BBWY.Controls; |
|||
|
|||
namespace BBWY.Client.Views.Order |
|||
{ |
|||
/// <summary>
|
|||
/// CalculationCost.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
public partial class ChooseCalculationCostType : BWindow |
|||
{ |
|||
public string OrderId { get; private set; } |
|||
|
|||
public StorageType StorageType { get; private set; } |
|||
|
|||
public bool IsSetStorageType { get; private set; } |
|||
|
|||
public bool IsAutoCalculation { get; private set; } |
|||
|
|||
public ChooseCalculationCostType(string orderId, StorageType storageType, bool isSetstorageType) |
|||
{ |
|||
InitializeComponent(); |
|||
|
|||
OrderId = orderId; |
|||
StorageType = storageType; |
|||
IsSetStorageType = isSetstorageType; |
|||
} |
|||
|
|||
private void btn_autoCalculation_Click(object sender, System.Windows.RoutedEventArgs e) |
|||
{ |
|||
IsAutoCalculation = true; |
|||
this.DialogResult = true; |
|||
this.Close(); |
|||
} |
|||
|
|||
private void btn_manualCalculation_Click(object sender, System.Windows.RoutedEventArgs e) |
|||
{ |
|||
IsAutoCalculation = false; |
|||
this.DialogResult = true; |
|||
this.Close(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,76 @@ |
|||
<c:BWindow x:Class="BBWY.Client.Views.Order.ManualCalculationCost" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:local="clr-namespace:BBWY.Client.Views.Order" |
|||
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" |
|||
mc:Ignorable="d" |
|||
Title="手动计算成本" Height="450" Width="300" |
|||
Style="{StaticResource bwstyle}" |
|||
MinButtonVisibility="Collapsed" |
|||
MaxButtonVisibility="Collapsed"> |
|||
<Grid> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition/> |
|||
<RowDefinition Height="40"/> |
|||
</Grid.RowDefinitions> |
|||
<Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource MainMenu.BorderBrush}" |
|||
Background="{StaticResource Border.Background}"> |
|||
<TextBlock x:Name="txt_StorageType" HorizontalAlignment="Center" VerticalAlignment="Center"/> |
|||
</Border> |
|||
|
|||
<Grid Grid.Row="1"> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="10"/> |
|||
<RowDefinition Height="40"/> |
|||
<RowDefinition Height="40"/> |
|||
<RowDefinition Height="40"/> |
|||
<RowDefinition Height="Auto"/> |
|||
<RowDefinition Height="Auto"/> |
|||
<RowDefinition Height="Auto"/> |
|||
<RowDefinition Height="Auto"/> |
|||
<RowDefinition Height="1*"/> |
|||
<RowDefinition Height="40"/> |
|||
</Grid.RowDefinitions> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="100"/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
<TextBlock Text="商品成本" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="1"/> |
|||
<c:BTextBox x:Name="txtSkuAmount" Grid.Column="1" Grid.Row="1" Height="30" Width="150" HorizontalAlignment="Left" Margin="5,0,0,0"/> |
|||
|
|||
<TextBlock Text="采购运费" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="2"/> |
|||
<c:BTextBox x:Name="txtFeright" Grid.Column="1" Grid.Row="2" Height="30" Width="150" HorizontalAlignment="Left" Margin="5,0,0,0"/> |
|||
|
|||
<TextBlock Text="销售运费" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="3"/> |
|||
<c:BTextBox x:Name="txtDeliveryExpressFreight" Grid.Column="1" Grid.Row="3" Height="30" Width="150" HorizontalAlignment="Left" Margin="5,0,0,0"/> |
|||
|
|||
<TextBlock Text="头程运费" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="4" |
|||
Visibility="{Binding Visibility,ElementName=txtFirstFreight}"/> |
|||
<c:BTextBox x:Name="txtFirstFreight" Grid.Column="1" Grid.Row="4" Height="30" Width="150" HorizontalAlignment="Left" Margin="5,5,0,5"/> |
|||
|
|||
<TextBlock Text="操作费" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="5" |
|||
Visibility="{Binding Visibility,ElementName=txtFirstFreight}"/> |
|||
<c:BTextBox x:Name="txtOperationAmount" Grid.Column="1" Grid.Row="5" Height="30" Width="150" HorizontalAlignment="Left" Margin="5,5,0,5" |
|||
Visibility="{Binding Visibility,ElementName=txtFirstFreight}"/> |
|||
|
|||
<TextBlock Text="仓储费" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="6" |
|||
Visibility="{Binding Visibility,ElementName=txtFirstFreight}"/> |
|||
<c:BTextBox x:Name="txtStorageAmount" Grid.Column="1" Grid.Row="6" Height="30" Width="150" HorizontalAlignment="Left" Margin="5,5,0,5" |
|||
Visibility="{Binding Visibility,ElementName=txtFirstFreight}"/> |
|||
|
|||
<TextBlock Text="耗材费" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="7" |
|||
Visibility="{Binding Visibility,ElementName=txtFirstFreight}"/> |
|||
<c:BTextBox x:Name="txtConsumableAmount" Grid.Column="1" Grid.Row="7" Height="30" Width="150" HorizontalAlignment="Left" Margin="5,5,0,5" |
|||
Visibility="{Binding Visibility,ElementName=txtFirstFreight}"/> |
|||
|
|||
<c:BButton x:Name="btn_fillFromLately" Content="填入最近一次信息" Grid.Row="9" Grid.ColumnSpan="2" Width="120" |
|||
Click="btn_fillFromLately_Click"/> |
|||
</Grid> |
|||
|
|||
<c:BButton x:Name="btn_Save" Content="保存" Grid.Row="2" Width="60" HorizontalAlignment="Right" Margin="0,0,8,0" |
|||
Click="btn_Save_Click"/> |
|||
</Grid> |
|||
</c:BWindow> |
@ -0,0 +1,69 @@ |
|||
using BBWY.Client.Models; |
|||
using BBWY.Controls; |
|||
using System.Windows; |
|||
|
|||
namespace BBWY.Client.Views.Order |
|||
{ |
|||
/// <summary>
|
|||
/// ManualCalculationCost.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
public partial class ManualCalculationCost : BWindow |
|||
{ |
|||
public string OrderId { get; private set; } |
|||
|
|||
public bool IsSetStorageType { get; private set; } |
|||
|
|||
public StorageType StorageType { get; private set; } |
|||
|
|||
public decimal PurchaseCost { get; private set; } |
|||
|
|||
public decimal DeliveryExpressFreight { get; private set; } |
|||
|
|||
public ManualCalculationCost(string orderId, bool isSetStorageType, StorageType storageType) |
|||
{ |
|||
InitializeComponent(); |
|||
this.OrderId = orderId; |
|||
this.IsSetStorageType = isSetStorageType; |
|||
this.StorageType = storageType; |
|||
this.Loaded += ManualCalculationCost_Loaded; |
|||
} |
|||
|
|||
private void ManualCalculationCost_Loaded(object sender, RoutedEventArgs e) |
|||
{ |
|||
txt_StorageType.Text = $"{this.StorageType}-手动计算成本"; |
|||
|
|||
if (StorageType != StorageType.云仓 && StorageType != StorageType.京仓) |
|||
{ |
|||
txtFirstFreight.Visibility = Visibility.Collapsed; |
|||
this.Height = 290; |
|||
} |
|||
} |
|||
|
|||
private void btn_fillFromLately_Click(object sender, System.Windows.RoutedEventArgs e) |
|||
{ |
|||
|
|||
} |
|||
|
|||
private void btn_Save_Click(object sender, System.Windows.RoutedEventArgs e) |
|||
{ |
|||
if (!decimal.TryParse(txtSkuAmount.Text, out decimal skuAmount) || |
|||
!decimal.TryParse(txtFeright.Text, out decimal feright) || |
|||
!decimal.TryParse(txtDeliveryExpressFreight.Text, out decimal deliveryExpressFreight)) |
|||
{ |
|||
MessageBox.Show("请填写完整信息", "手动编辑成本"); |
|||
return; |
|||
} |
|||
|
|||
decimal.TryParse(txtFirstFreight.Text, out decimal firstFreight); |
|||
decimal.TryParse(txtOperationAmount.Text, out decimal operationAmount); |
|||
decimal.TryParse(txtConsumableAmount.Text, out decimal consumableAmount); |
|||
decimal.TryParse(txtStorageAmount.Text, out decimal storageAmount); |
|||
|
|||
|
|||
this.PurchaseCost = skuAmount + feright + firstFreight + operationAmount + consumableAmount + storageAmount; |
|||
this.DeliveryExpressFreight = deliveryExpressFreight; |
|||
this.DialogResult = true; |
|||
this.Close(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,720 @@ |
|||
<Page x:Class="BBWY.Client.Views.Order.OrderList" |
|||
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:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" |
|||
xmlns:ctr="clr-namespace:BBWY.Client.Converters" |
|||
xmlns:cmodel="clr-namespace:BBWY.Client.Models" |
|||
xmlns:sys="clr-namespace:System;assembly=mscorlib" |
|||
xmlns:local="clr-namespace:BBWY.Client.Views.Order" |
|||
xmlns:b="http://schemas.microsoft.com/xaml/behaviors" |
|||
DataContext="{Binding OrderList,Source={StaticResource Locator}}" |
|||
mc:Ignorable="d" |
|||
d:DesignHeight="450" d:DesignWidth="800" |
|||
Title="OrderList"> |
|||
<Page.Resources> |
|||
<ObjectDataProvider x:Key="storageTypeProvider" MethodName="GetValues" ObjectType="{x:Type sys:Enum}"> |
|||
<ObjectDataProvider.MethodParameters> |
|||
<x:Type TypeName="cmodel:StorageType"/> |
|||
</ObjectDataProvider.MethodParameters> |
|||
</ObjectDataProvider> |
|||
<ctr:OrderStorageTypeOptionConverter x:Key="ostConverter"/> |
|||
<ctr:ProfitRatioConverter x:Key="profitRatioConverter"/> |
|||
<ctr:WaybillNoConverter x:Key="waybillConverter"/> |
|||
<ctr:MultiParameterTransferConverter x:Key="mptConverter"/> |
|||
|
|||
<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> |
|||
|
|||
<Style x:Key="OrderCouponToolipStyle" TargetType="{x:Type ToolTip}"> |
|||
<!--<Setter Property="Foreground" Value="White"/>--> |
|||
<Setter Property="HorizontalOffset" Value="10"/> |
|||
<Setter Property="VerticalOffset" Value="10"/> |
|||
<Setter Property="Background" Value="White"/> |
|||
</Style> |
|||
|
|||
</Page.Resources> |
|||
<Grid> |
|||
<c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999"/> |
|||
<Grid Margin="5,0"> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition Height="5"/> |
|||
<RowDefinition Height="auto"/> |
|||
<RowDefinition Height="5"/> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition Height="5"/> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition/> |
|||
<RowDefinition Height="30"/> |
|||
</Grid.RowDefinitions> |
|||
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal"> |
|||
<c:BButton Content="近一个月订单" Width="100" |
|||
Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=#null:#8080FF:#F2F2F2}" |
|||
Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=#null:White:#4A4A4A}" |
|||
Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Null}"/> |
|||
<c:BButton Content="等待采购" Width="100" |
|||
Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=等待采购:#8080FF:#F2F2F2}" |
|||
Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=等待采购:White:#4A4A4A}" |
|||
Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Static cmodel:OrderState.等待采购}"/> |
|||
<c:BButton Content="待出库" Width="100" |
|||
Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待出库:#8080FF:#F2F2F2}" |
|||
Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待出库:White:#4A4A4A}" |
|||
Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Static cmodel:OrderState.待出库}"/> |
|||
<c:BButton Content="待收货" Width="100" |
|||
Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待收货:#8080FF:#F2F2F2}" |
|||
Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待收货:White:#4A4A4A}" |
|||
Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Static cmodel:OrderState.待收货}"/> |
|||
<c:BButton Content="已完成" Width="100" |
|||
Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=已完成:#8080FF:#F2F2F2}" |
|||
Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=已完成:White:#4A4A4A}" |
|||
Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Static cmodel:OrderState.已完成}"/> |
|||
<c:BButton Content="待付款" Width="100" |
|||
Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待付款:#8080FF:#F2F2F2}" |
|||
Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待付款:White:#4A4A4A}" |
|||
Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Static cmodel:OrderState.待付款}"/> |
|||
<c:BButton Content="锁定" Width="100" |
|||
Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=锁定:#8080FF:#F2F2F2}" |
|||
Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=锁定:White:#4A4A4A}" |
|||
Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Static cmodel:OrderState.锁定}"/> |
|||
<c:BButton Content="已取消" Width="100" |
|||
Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=已取消:#8080FF:#F2F2F2}" |
|||
Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=已取消:White:#4A4A4A}" |
|||
Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Static cmodel:OrderState.已取消}"/> |
|||
</StackPanel> |
|||
|
|||
<Grid Grid.Row="2" Background="{StaticResource Border.Background}"> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="0.5*"/> |
|||
<RowDefinition Height="5"/> |
|||
<RowDefinition Height="0.5*"/> |
|||
</Grid.RowDefinitions> |
|||
<StackPanel Orientation="Horizontal" Margin="0,5,0,0"> |
|||
<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 StartDate}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="5,0,0,0"/> |
|||
<DatePicker SelectedDate="{Binding EndDate}" Width="133.5" Height="30" VerticalContentAlignment="Center" FocusVisualStyle="{x:Null}" Margin="5,0,0,0"/> |
|||
<TextBlock Text="订单号" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchOrderId}" WaterRemark="精确匹配"/> |
|||
<TextBlock Text="SKU" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchSku}" WaterRemark="精确匹配"/> |
|||
<TextBlock Text="快递单号" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchWaybill}" WaterRemark="前缀模糊匹配"/> |
|||
<!--<TextBlock Text="下单账号" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<c:BTextBox Width="150" Margin="5,0,0,0" WaterRemark="暂不支持" IsEnabled="False" |
|||
DisableBgColor="{StaticResource TextBox.Disable.BgColor}"/>--> |
|||
<c:BButton Content="搜索" Width="50" Margin="5,0,0,0" Command="{Binding SearchOrderCommand}"/> |
|||
</StackPanel> |
|||
<StackPanel Orientation="Horizontal" Grid.Row="2" Margin="0,0,0,5"> |
|||
<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="25" 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}"/> |
|||
<TextBlock Text="采购单" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<c:BTextBox Width="150" Margin="5,0,0,0" WaterRemark="暂不支持" IsEnabled="false" DisableBgColor="{StaticResource TextBox.Disable.BgColor}"/> |
|||
<TextBlock Text="货号" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchProductNo}" WaterRemark="精确匹配"/> |
|||
<TextBlock Text="客户姓名" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchContactName}" WaterRemark="精确匹配"/> |
|||
</StackPanel> |
|||
</Grid> |
|||
|
|||
<Grid Grid.Row="2" HorizontalAlignment="Right" Width="370"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="80"/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition Width="auto"/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="0.5*"/> |
|||
<RowDefinition Height="0.5*"/> |
|||
</Grid.RowDefinitions> |
|||
<TextBlock Style="{StaticResource middleTextBlock}" FontSize="25" Foreground="#EC808D" Grid.RowSpan="2"> |
|||
<Run Text="今日"/> |
|||
<LineBreak/> |
|||
<Run Text="业绩"/> |
|||
</TextBlock> |
|||
|
|||
<TextBlock Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left"> |
|||
<Run Text="销售额"/> |
|||
<LineBreak/> |
|||
<Run Text="{Binding ToDayOrderAchievement.SaleAmount}"/> |
|||
</TextBlock> |
|||
|
|||
<TextBlock Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,5,0"> |
|||
<Run Text="利润"/> |
|||
<LineBreak/> |
|||
<Run Text="{Binding ToDayOrderAchievement.Profit}"/> |
|||
<Run Text="{Binding ToDayOrderAchievement.ProfitRaito,StringFormat=({0}%)}"/> |
|||
</TextBlock> |
|||
|
|||
<StackPanel Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Left" |
|||
Orientation="Horizontal"> |
|||
<TextBlock> |
|||
<Run Text="成本总计"/> |
|||
<LineBreak/> |
|||
<Run Text="{Binding ToDayOrderAchievement.TotalCost}"/> |
|||
</TextBlock> |
|||
<Path Style="{StaticResource path_question}" Width="14" Margin="5,0,0,0" Fill="#EC808D" ToolTipService.InitialShowDelay="0"> |
|||
<Path.ToolTip> |
|||
<ToolTip Style="{StaticResource OrderCouponToolipStyle}"> |
|||
<StackPanel> |
|||
<TextBlock> |
|||
<Run Text="采购金额"/> |
|||
<Run Text="{Binding ToDayOrderAchievement.PurchaseAmount}"/> |
|||
</TextBlock> |
|||
<TextBlock> |
|||
<Run Text="销售运费"/> |
|||
<Run Text="{Binding ToDayOrderAchievement.DeliveryExpressFreight}"/> |
|||
</TextBlock> |
|||
<TextBlock> |
|||
<Run Text="平台扣点"/> |
|||
<Run Text="{Binding ToDayOrderAchievement.PlatformCommissionAmount}"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
</ToolTip> |
|||
</Path.ToolTip> |
|||
</Path> |
|||
</StackPanel> |
|||
|
|||
|
|||
<TextBlock Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left"> |
|||
<Run Text="订单数"/> |
|||
<LineBreak/> |
|||
<Run Text="{Binding ToDayOrderAchievement.OrderCount}"/> |
|||
</TextBlock> |
|||
|
|||
<TextBlock Grid.Row="1" Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Left"> |
|||
<Run Text="推广费用"/> |
|||
<LineBreak/> |
|||
<Run Text="--"/> |
|||
</TextBlock> |
|||
|
|||
<TextBlock Grid.Row="1" Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Left"> |
|||
<Run Text="平台扣点"/> |
|||
<LineBreak/> |
|||
<Run Text="{Binding ToDayOrderAchievement.PlatformCommissionAmount}"/> |
|||
</TextBlock> |
|||
</Grid> |
|||
|
|||
<Border Grid.Row="4" Background="{StaticResource Border.Background}"> |
|||
<StackPanel Orientation="Horizontal" > |
|||
<CheckBox Content="仅显示代发订单" Margin="5,0,0,0"/> |
|||
<CheckBox Content="过滤SD订单" Margin="5,0,0,0"/> |
|||
<CheckBox Content="过滤已取消" Margin="5,0,0,0"/> |
|||
</StackPanel> |
|||
</Border> |
|||
|
|||
<Border Grid.Row="6" BorderBrush="{StaticResource Border.Brush}" BorderThickness="1,1,1,0" |
|||
Background="#F2F2F2"> |
|||
<Grid> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="351"/> |
|||
<ColumnDefinition Width="80"/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
<TextBlock Text="商品信息" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="仓储类型" 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}"/> |
|||
<TextBlock Text="订单状态" Grid.Column="6" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="备注信息" Grid.Column="7" Style="{StaticResource middleTextBlock}"/> |
|||
|
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}"/> |
|||
<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"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="6"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="7"/> |
|||
</Grid> |
|||
</Border> |
|||
|
|||
<ListBox x:Name="listbox_order" |
|||
Grid.Row="7" |
|||
ItemsSource="{Binding OrderList}" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" |
|||
BorderBrush="{StaticResource Border.Brush}" |
|||
BorderThickness="1,1,1,0" |
|||
Foreground="{StaticResource Text.Color}"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Grid Width="{Binding ActualWidth,ElementName=listbox_order,Converter={StaticResource widthConverter},ConverterParameter=-0}" |
|||
MinHeight="185"> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition/> |
|||
</Grid.RowDefinitions> |
|||
<Grid Background="#F2F2F2" Grid.ColumnSpan="2"> |
|||
<StackPanel Orientation="Horizontal"> |
|||
<TextBlock Text="{Binding OrderStartTime,StringFormat=yyyy-MM-dd HH:mm:ss}" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<TextBlock VerticalAlignment="Center" Margin="5,0,0,0"> |
|||
<Run Text="订单号:"/> |
|||
<Run Text="{Binding Id}"/> |
|||
</TextBlock> |
|||
<c:BButton Content="复制" Style="{StaticResource LinkButton}" Margin="5,0,0,0" |
|||
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}" |
|||
CommandParameter="{Binding Id}"/> |
|||
<Border Width="1" Margin="5,5,0,5" Background="{StaticResource Border.Brush}"/> |
|||
<!--<TextBlock VerticalAlignment="Center" Margin="5,0,0,0"> |
|||
<Run Text="下单账号:"/> |
|||
<Run Text="{Binding BuyerAccount}"/> |
|||
</TextBlock>--> |
|||
<c:BButton x:Name="btn_decodeCommand" Content="解密收货信息" Style="{StaticResource LinkButton}" Margin="5,0,0,0" |
|||
Command="{Binding DataContext.DecodeConsigneeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}" |
|||
CommandParameter="{Binding }"/> |
|||
<TextBlock x:Name="txt_consignee" VerticalAlignment="Center" Margin="5,0,0,0" Visibility="Collapsed"> |
|||
<Run Text="收货人:"/> |
|||
<Run Text="{Binding Consignee.ContactName}"/> |
|||
<Run Text="联系电话:"/> |
|||
<Run Text="{Binding Consignee.Mobile}"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
<Border VerticalAlignment="Bottom" Height="1" Background="{StaticResource Border.Brush}"/> |
|||
</Grid> |
|||
<Grid Grid.Row="1"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="350"/> |
|||
<ColumnDefinition Width="80"/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
|
|||
<ListBox x:Name="listbox_orerSku" ItemsSource="{Binding ItemList}" |
|||
Style="{StaticResource NoScrollViewListBoxStyle}" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Grid Width="{Binding ActualWidth,ElementName=listbox_orerSku}"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="90"/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
|
|||
<!--{Binding Logo}--> |
|||
<c:BAsyncImage UrlSource="{Binding Logo}" |
|||
Width="80" DecodePixelWidth="80" |
|||
VerticalAlignment="Top" Margin="0,5,0,0"/> |
|||
|
|||
<StackPanel Grid.Column="1" Orientation="Vertical" Margin="0,5,0,5"> |
|||
<TextBlock TextWrapping="Wrap"> |
|||
<Run Text="SKU名称:"/> |
|||
<Run Text="{Binding Title}"/> |
|||
</TextBlock> |
|||
<TextBlock TextWrapping="Wrap"> |
|||
<Run Text="单价:"/> |
|||
<Run Text="{Binding Price}"/> |
|||
</TextBlock> |
|||
<TextBlock TextWrapping="Wrap"> |
|||
<Run Text="数量:"/> |
|||
<Run Text="{Binding ItemTotal}"/> |
|||
</TextBlock> |
|||
<StackPanel Orientation="Horizontal"> |
|||
<TextBlock> |
|||
<Run Text="SPU:" /> |
|||
<Run Text="{Binding ProductId}"/> |
|||
</TextBlock> |
|||
<c:BButton Content="复制" Style="{StaticResource LinkButton}" |
|||
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Page}}}" |
|||
CommandParameter="{Binding ProductId}" |
|||
Margin=" 5,0,0,0"/> |
|||
</StackPanel> |
|||
<StackPanel Orientation="Horizontal"> |
|||
<TextBlock> |
|||
<Run Text="SKU:" /> |
|||
<Run Text="{Binding Id}"/> |
|||
</TextBlock> |
|||
<c:BButton Content="复制" Style="{StaticResource LinkButton}" |
|||
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Page}}}" |
|||
CommandParameter="{Binding Id}" |
|||
Margin=" 5,0,0,0"/> |
|||
</StackPanel> |
|||
<TextBlock> |
|||
<Run Text="货号:" /> |
|||
<Run Text="{Binding ProductItemNum}"/> |
|||
</TextBlock> |
|||
<TextBlock DataContext="{Binding DataContext,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBox}}" |
|||
TextWrapping="Wrap"> |
|||
<Run Text="买家备注:" /> |
|||
<Run Text="{Binding BuyerRemark}"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
|
|||
<Border Grid.ColumnSpan="2" VerticalAlignment="Bottom" Height="1" Background="{StaticResource Border.Brush}" |
|||
DataContext="{Binding DataContext,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}" |
|||
Visibility="{Binding ItemList.Count,Converter={StaticResource objConverter},ConverterParameter=1:Collapsed:Visible}"/> |
|||
</Grid> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
|
|||
<ListBox x:Name="listbox_storageType" Grid.Column="1" |
|||
Style="{StaticResource NoScrollViewListBoxStyle}" |
|||
BorderBrush="{StaticResource Border.Brush}" |
|||
BorderThickness="1,0" |
|||
ItemsSource="{Binding Source={StaticResource storageTypeProvider}}" |
|||
SelectedItem="{Binding StorageType,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> |
|||
<ListBox.ItemContainerStyle> |
|||
<Style BasedOn="{StaticResource NoBgListBoxItemStyle}" TargetType="ListBoxItem"> |
|||
<Setter Property="IsEnabled"> |
|||
<Setter.Value> |
|||
<MultiBinding Converter="{StaticResource ostConverter}"> |
|||
<MultiBinding.Bindings> |
|||
<Binding Path="."/> |
|||
<Binding Path="DataContext.StorageType" RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1}"/> |
|||
</MultiBinding.Bindings> |
|||
</MultiBinding> |
|||
</Setter.Value> |
|||
</Setter> |
|||
</Style> |
|||
</ListBox.ItemContainerStyle> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<!--<Grid x:Name="grid_storageType" |
|||
Width="{Binding ActualWidth,ElementName=listbox_storageType}" |
|||
Margin="5" Height="25" |
|||
Background="{StaticResource Button.Normal.Background}"> |
|||
<TextBlock x:Name="txt_storageType" Text="{Binding }" HorizontalAlignment="Center" VerticalAlignment="Center" |
|||
Margin="0,0,7,0"/> |
|||
</Grid>--> |
|||
<c:BButton x:Name="btn_storageType" Content="{Binding }" |
|||
Width="{Binding ActualWidth,ElementName=listbox_storageType}" |
|||
Margin="5,5,5,0" Height="25" |
|||
Background="{StaticResource Button.Normal.Background}" |
|||
Foreground="{StaticResource Text.Color}" |
|||
DisableText="{Binding Content,RelativeSource={RelativeSource Mode=Self}}" |
|||
Command="{Binding DataContext.ChooseStorageTypeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}"> |
|||
<c:BButton.CommandParameter> |
|||
<MultiBinding Converter="{StaticResource mptConverter}"> |
|||
<Binding Path="DataContext.Id" RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1}"/> |
|||
<Binding Path="."/> |
|||
</MultiBinding> |
|||
</c:BButton.CommandParameter> |
|||
</c:BButton> |
|||
<DataTemplate.Triggers> |
|||
<DataTrigger Binding="{Binding IsSelected,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}}}" |
|||
Value="True"> |
|||
<Setter TargetName="btn_storageType" Property="Background" Value="{StaticResource Button.Selected.Background}"/> |
|||
<Setter TargetName="btn_storageType" Property="Foreground" Value="White"/> |
|||
</DataTrigger> |
|||
</DataTemplate.Triggers> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
|
|||
<Border Width="1" Background="{StaticResource Border.Brush}" Grid.Column="2" HorizontalAlignment="Right"/> |
|||
<Border Width="1" Background="{StaticResource Border.Brush}" Grid.Column="3" HorizontalAlignment="Right"/> |
|||
<Border Width="1" Background="{StaticResource Border.Brush}" Grid.Column="4" HorizontalAlignment="Right"/> |
|||
<Border Width="1" Background="{StaticResource Border.Brush}" Grid.Column="5" HorizontalAlignment="Right"/> |
|||
<Border Width="1" Background="{StaticResource Border.Brush}" Grid.Column="6" HorizontalAlignment="Right"/> |
|||
|
|||
|
|||
<StackPanel Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,10"> |
|||
<TextBlock> |
|||
<Run Text="实收金额"/> |
|||
<Run Text="{Binding OrderPayment}"/> |
|||
</TextBlock> |
|||
|
|||
<StackPanel x:Name="sp_orderCoupon" Orientation="Horizontal"> |
|||
<TextBlock> |
|||
<Run Text="优惠金额"/> |
|||
<Run Text="{Binding PreferentialAmount}"/> |
|||
</TextBlock> |
|||
|
|||
<Path Style="{StaticResource path_question}" Width="14" Margin="5,0,0,0" Fill="#EC808D" ToolTipService.InitialShowDelay="0"> |
|||
<Path.ToolTip> |
|||
<ToolTip Style="{StaticResource OrderCouponToolipStyle}"> |
|||
<ListBox ItemsSource="{Binding OrderCouponList}" |
|||
Style="{StaticResource NoScrollViewListBoxStyle}"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<TextBlock> |
|||
<Run Text="{Binding CouponType}"/> |
|||
<Run Text="{Binding CouponPrice,StringFormat=¥{0}}"/> |
|||
</TextBlock> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
</ToolTip> |
|||
</Path.ToolTip> |
|||
</Path> |
|||
</StackPanel> |
|||
|
|||
<StackPanel x:Name="sp_purchaseAmount" Orientation="Horizontal"> |
|||
<TextBlock> |
|||
<Run Text="采购金额"/> |
|||
<Run Text="{Binding OrderCost.PurchaseAmount}"/> |
|||
</TextBlock> |
|||
|
|||
<Path x:Name="path_purchaseAmount_question" |
|||
Style="{StaticResource path_question}" |
|||
Width="14" Margin="5,0,0,0" Fill="#EC808D" |
|||
ToolTipService.InitialShowDelay="0" |
|||
ToolTipService.ShowDuration="20000"> |
|||
<Path.ToolTip> |
|||
<ToolTip Style="{StaticResource OrderCouponToolipStyle}"> |
|||
<Grid> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="Auto"/> |
|||
<RowDefinition/> |
|||
</Grid.RowDefinitions> |
|||
<TextBlock x:Name="txt_isManualed" Text="该订单成本经过手动编辑" |
|||
Style="{StaticResource middleTextBlock}" |
|||
Foreground="Red" |
|||
Visibility="{Binding OrderCost.IsManualEdited,Converter={StaticResource objConverter},ConverterParameter=true:Visible:Collapsed}"/> |
|||
<ListBox Grid.Row="1" |
|||
ItemsSource="{Binding OrderCostDetailGroupList}" |
|||
Style="{StaticResource NoScrollViewListBoxStyle}" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Grid> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="20"/> |
|||
<RowDefinition Height="20"/> |
|||
<RowDefinition/> |
|||
</Grid.RowDefinitions> |
|||
<TextBlock Text="{Binding SkuId,StringFormat=SKU {0}}" VerticalAlignment="Center"/> |
|||
|
|||
<Grid Grid.Row="1"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="120"/> |
|||
<ColumnDefinition Width="120"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="80"/> |
|||
</Grid.ColumnDefinitions> |
|||
<TextBlock Text="成本明细ID" Style="{StaticResource middleTextBlock}"/> |
|||
<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}"/> |
|||
<TextBlock Text="耗材费" Grid.Column="6" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="仓储费" Grid.Column="7" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="总成本" Grid.Column="8" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="扣减数量" Grid.Column="9" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="扣减时间" Grid.Column="10" Style="{StaticResource middleTextBlock}"/> |
|||
</Grid> |
|||
|
|||
<ListBox Grid.Row="2" ItemsSource="{Binding Items}" |
|||
Style="{StaticResource NoScrollViewListBoxStyle}" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Grid> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="120"/> |
|||
<ColumnDefinition Width="120"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="80"/> |
|||
</Grid.ColumnDefinitions> |
|||
<TextBlock Text="{Binding Id}" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="{Binding PurchaseOrderPKId}" Grid.Column="1" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="{Binding SkuAmount}" Grid.Column="2" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="{Binding PurchaseFreight}" Grid.Column="3" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="{Binding FirstFreight}" Grid.Column="4" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="{Binding OperationAmount}" Grid.Column="5" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="{Binding ConsumableAmount}" Grid.Column="6" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="{Binding StorageAmount}" Grid.Column="7" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="{Binding TotalCost}" Grid.Column="8" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="{Binding DeductionQuantity}" Grid.Column="9" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="{Binding CreateTime,StringFormat=yyyy-MM-dd}" Grid.Column="10" Style="{StaticResource middleTextBlock}"/> |
|||
</Grid> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
</Grid> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
</Grid> |
|||
</ToolTip> |
|||
</Path.ToolTip> |
|||
</Path> |
|||
</StackPanel> |
|||
|
|||
<TextBlock> |
|||
<Run Text="快递费用"/> |
|||
<Run Text="{Binding OrderCost.DeliveryExpressFreight}"/> |
|||
</TextBlock> |
|||
|
|||
<TextBlock> |
|||
<Run Text="平台扣点"/> |
|||
<Run Text="{Binding OrderCost.PlatformCommissionAmount}"/> |
|||
<Run Text="{Binding OrderCost.PlatformCommissionRatio,StringFormat=({0:P})}"/> |
|||
</TextBlock> |
|||
|
|||
<TextBlock x:Name="txt_sdCommissionAmount"> |
|||
<Run Text="SD佣金"/> |
|||
<Run Text="{Binding OrderCost.SDCommissionAmount}"/> |
|||
</TextBlock> |
|||
|
|||
<TextBlock> |
|||
<Run Text="成本总计"/> |
|||
<Run Text="{Binding OrderCost.TotalCost,Mode=OneWay}"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
|
|||
<Border Height="1" Background="{StaticResource Border.Brush}" Grid.Column="3" VerticalAlignment="Bottom" Margin="0,0,0,25" |
|||
Visibility="{Binding Visibility,ElementName=btn_editCost}"/> |
|||
<c:BButton x:Name="btn_editCost" Content="修改" Grid.Column="3" VerticalAlignment="Bottom" |
|||
Foreground="{StaticResource Text.Color}" |
|||
HorizontalAlignment="Stretch" |
|||
Background="White" |
|||
Margin="0,0,1,0" |
|||
Command="{Binding DataContext.EditCostCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}" |
|||
CommandParameter="{Binding }" |
|||
Visibility="{Binding StorageType,Converter={StaticResource objConverter},ConverterParameter=#null:Collapsed:Visible}" |
|||
Height="25"/> |
|||
|
|||
<StackPanel Grid.Column="4" VerticalAlignment="Center" HorizontalAlignment="Center"> |
|||
<TextBlock> |
|||
<Run Text="利润"/> |
|||
<Run Text="{Binding OrderCost.Profit}"/> |
|||
</TextBlock> |
|||
<TextBlock> |
|||
<Run Text="利润率"/> |
|||
<Run Text="{Binding OrderCost.ProfitRatio,StringFormat=\{0\}%}"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
|
|||
<StackPanel Grid.Column="5" |
|||
VerticalAlignment="Center" |
|||
HorizontalAlignment="Center"> |
|||
<TextBlock x:Name="txt_storeName" |
|||
Text="{Binding StoreName}" |
|||
TextWrapping="Wrap" |
|||
HorizontalAlignment="Center" |
|||
Visibility="{Binding StoreName,Converter={StaticResource objConverter},ConverterParameter=#null|0:Collapsed:Visible}"/> |
|||
<StackPanel x:Name="sp_waybill" Orientation="Horizontal"> |
|||
<TextBlock Text="{Binding WaybillNo,Converter={StaticResource waybillConverter}}"/> |
|||
<c:BButton x:Name="btn_waybillCopy" Style="{StaticResource LinkButton}" |
|||
Content="复制" |
|||
Command="{Binding DataContext.CopyOrderWaybillCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}" |
|||
CommandParameter="{Binding }" Margin="5,0,0,0"/> |
|||
</StackPanel> |
|||
</StackPanel> |
|||
|
|||
<TextBlock Text="{Binding OrderState}" Grid.Column="6" |
|||
HorizontalAlignment="Center" |
|||
VerticalAlignment="Center"/> |
|||
|
|||
<StackPanel Orientation="Vertical" Grid.Column="7" Margin="5,5,5,0"> |
|||
<TextBlock x:Name="txtBuyerRemark" TextWrapping="Wrap"> |
|||
<Run Text="买家备注"/> |
|||
<Run Text="{Binding BuyerRemark}"/> |
|||
</TextBlock> |
|||
<TextBlock x:Name="txtVenderRemark" TextWrapping="Wrap"> |
|||
<Path x:Name="path_flag" Style="{StaticResource path_flag}" Width="16" |
|||
Fill="{Binding Flag}"/> |
|||
<Run Text="商家备注"/> |
|||
<Run Text="{Binding VenderRemark}"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
</Grid> |
|||
<Border Grid.Row="1" VerticalAlignment="Bottom" Height="1" Background="{StaticResource Border.Brush}"/> |
|||
</Grid> |
|||
<DataTemplate.Triggers> |
|||
<DataTrigger Binding="{Binding WaybillNo}" Value=""> |
|||
<Setter TargetName="sp_waybill" Property="Visibility" Value="Collapsed"/> |
|||
</DataTrigger> |
|||
<DataTrigger Binding="{Binding WaybillNo}" Value="-10000"> |
|||
<Setter TargetName="btn_waybillCopy" Property="Visibility" Value="Collapsed"/> |
|||
</DataTrigger> |
|||
<!--<DataTrigger Binding="{Binding StoreName}" Value=""> |
|||
<Setter TargetName="txt_storeName" Property="Visibility" Value="Collapsed"/> |
|||
</DataTrigger>--> |
|||
<DataTrigger Binding="{Binding BuyerRemark}" Value=""> |
|||
<Setter TargetName="txtBuyerRemark" Property="Visibility" Value="Collapsed"/> |
|||
</DataTrigger> |
|||
<DataTrigger Binding="{Binding VenderRemark}" Value=""> |
|||
<Setter TargetName="txtVenderRemark" Property="Visibility" Value="Collapsed"/> |
|||
</DataTrigger> |
|||
<DataTrigger Binding="{Binding Consignee.IsDecode}" Value="True"> |
|||
<Setter Property="Visibility" Value="Visible" TargetName="txt_consignee"/> |
|||
<Setter Property="Visibility" Value="Collapsed" TargetName="btn_decodeCommand"/> |
|||
</DataTrigger> |
|||
<DataTrigger Binding="{Binding PreferentialAmount}" Value="0"> |
|||
<Setter TargetName="sp_orderCoupon" Property="Visibility" Value="Collapsed"/> |
|||
</DataTrigger> |
|||
<DataTrigger Binding="{Binding OrderCost.PurchaseAmount}" Value="0"> |
|||
<Setter TargetName="path_purchaseAmount_question" Property="Visibility" Value="Collapsed"/> |
|||
</DataTrigger> |
|||
<DataTrigger Binding="{Binding Flag}" Value="{x:Null}"> |
|||
<Setter TargetName="path_flag" Property="Fill" Value="{x:Null}"/> |
|||
<Setter TargetName="path_flag" Property="Visibility" Value="Collapsed"/> |
|||
</DataTrigger> |
|||
<DataTrigger Binding="{Binding OrderCost.SDCommissionAmount}" Value="0"> |
|||
<Setter TargetName="txt_sdCommissionAmount" Property="Visibility" Value="Collapsed"/> |
|||
</DataTrigger> |
|||
<DataTrigger Binding="{Binding StorageType}" Value="SD"> |
|||
<Setter TargetName="sp_purchaseAmount" Property="Visibility" Value="Collapsed"/> |
|||
</DataTrigger> |
|||
</DataTemplate.Triggers> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
|
|||
<c:PageControl PageIndex="{Binding PageIndex}" |
|||
PageSize="{Binding PageSize}" |
|||
RecordCount="{Binding OrderCount}" |
|||
Grid.Row="8"> |
|||
<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,36 @@ |
|||
using BBGWY.Controls.Extensions; |
|||
using GalaSoft.MvvmLight.Messaging; |
|||
using System.Windows.Controls; |
|||
|
|||
namespace BBWY.Client.Views.Order |
|||
{ |
|||
/// <summary>
|
|||
/// OrderList.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
public partial class OrderList : Page |
|||
{ |
|||
private ScrollViewer scrollviewer_OrderList; |
|||
|
|||
public OrderList() |
|||
{ |
|||
InitializeComponent(); |
|||
this.Loaded += OrderList_Loaded; |
|||
this.Unloaded += OrderList_Unloaded; |
|||
|
|||
Messenger.Default.Register<string>(this, "OrderList_OrderListScrollToTop", (x) => |
|||
{ |
|||
scrollviewer_OrderList.Dispatcher.Invoke(() => scrollviewer_OrderList.ScrollToTop()); |
|||
}); |
|||
} |
|||
|
|||
private void OrderList_Unloaded(object sender, System.Windows.RoutedEventArgs e) |
|||
{ |
|||
Messenger.Default.Unregister(this); |
|||
} |
|||
|
|||
private void OrderList_Loaded(object sender, System.Windows.RoutedEventArgs e) |
|||
{ |
|||
scrollviewer_OrderList = listbox_order.FindFirstVisualChild<ScrollViewer>(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,75 @@ |
|||
<c:BWindow x:Class="BBWY.Client.Views.Order.SD" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" |
|||
xmlns:sys="clr-namespace:System;assembly=mscorlib" |
|||
xmlns:cmodel="clr-namespace:BBWY.Client.Models" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:local="clr-namespace:BBWY.Client.Views.Order" |
|||
mc:Ignorable="d" |
|||
Title="SD订单" Height="300" Width="300" |
|||
Style="{StaticResource bwstyle}" |
|||
MinButtonVisibility="Collapsed" |
|||
MaxButtonVisibility="Collapsed"> |
|||
<c:BWindow.Resources> |
|||
<ObjectDataProvider x:Key="SDTypeProvider" MethodName="GetValues" ObjectType="{x:Type sys:Enum}"> |
|||
<ObjectDataProvider.MethodParameters> |
|||
<x:Type TypeName="cmodel:SDType"/> |
|||
</ObjectDataProvider.MethodParameters> |
|||
</ObjectDataProvider> |
|||
</c:BWindow.Resources> |
|||
<Grid> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition/> |
|||
<RowDefinition Height="40"/> |
|||
</Grid.RowDefinitions> |
|||
<Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource MainMenu.BorderBrush}" |
|||
Background="{StaticResource Border.Background}"> |
|||
<TextBlock Text="SD订单" Style="{StaticResource middleTextBlock}"/> |
|||
</Border> |
|||
|
|||
<Grid Grid.Row="1"> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="40"/> |
|||
<RowDefinition Height="40"/> |
|||
<RowDefinition Height="40"/> |
|||
<RowDefinition Height="40"/> |
|||
<RowDefinition Height="40"/> |
|||
<RowDefinition /> |
|||
</Grid.RowDefinitions> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="100"/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
<TextBlock Text="刷单平台" HorizontalAlignment="Right" VerticalAlignment="Center" /> |
|||
<ComboBox x:Name="cbx_sdType" Grid.Column="1" ItemsSource="{Binding Source={StaticResource SDTypeProvider}}" |
|||
SelectedIndex="0" Height="25" Width="100" |
|||
HorizontalAlignment="Left" VerticalAlignment="Center" VerticalContentAlignment="Center" Margin="5,0,0,0"/> |
|||
|
|||
<TextBlock Text="佣金" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="1"/> |
|||
<c:BTextBox x:Name="txtSDCommissionAmount" Grid.Column="1" Grid.Row="1" Height="30" Width="150" HorizontalAlignment="Left" Margin="5,0,0,0"/> |
|||
|
|||
<TextBlock Text="邮费" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="2"/> |
|||
<c:BTextBox x:Name="txtDeliveryExpressFreight" Grid.Column="1" Grid.Row="2" Height="30" Width="150" HorizontalAlignment="Left" Margin="5,0,0,0"/> |
|||
|
|||
<TextBlock Text="标签" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="3"/> |
|||
<ComboBox x:Name="cbx_flag" Grid.Column="1" Grid.Row="3" Height="25" Width="100" |
|||
HorizontalAlignment="Left" VerticalAlignment="Center" VerticalContentAlignment="Center" Margin="5,0,0,0" |
|||
SelectedIndex="0" FocusVisualStyle="{x:Null}"> |
|||
<ComboBoxItem Content="Gray" Foreground="Gray"/> |
|||
<ComboBoxItem Content="Red" Foreground="Red"/> |
|||
<ComboBoxItem Content="Yellow" Foreground="Yellow"/> |
|||
<ComboBoxItem Content="Green" Foreground="Green"/> |
|||
<ComboBoxItem Content="Blue" Foreground="Blue"/> |
|||
<ComboBoxItem Content="Purple" Foreground="Purple"/> |
|||
</ComboBox> |
|||
<TextBlock Text="商家备注" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="4"/> |
|||
<c:BTextBox x:Name="txtVenderRemark" Grid.Column="1" Grid.Row="4" Height="30" Width="150" HorizontalAlignment="Left" Margin="5,0,0,0"/> |
|||
</Grid> |
|||
|
|||
<c:BButton x:Name="btn_Save" Content="保存" Grid.Row="2" Width="60" HorizontalAlignment="Right" Margin="0,0,8,0" |
|||
Click="btn_Save_Click"/> |
|||
</Grid> |
|||
</c:BWindow> |
@ -0,0 +1,48 @@ |
|||
using BBWY.Client.Models; |
|||
using BBWY.Controls; |
|||
using System.Windows; |
|||
using System.Windows.Controls; |
|||
|
|||
namespace BBWY.Client.Views.Order |
|||
{ |
|||
/// <summary>
|
|||
/// SD.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
public partial class SD : BWindow |
|||
{ |
|||
public string OrderId { get; private set; } |
|||
|
|||
public bool IsSetStorageType { get; private set; } |
|||
|
|||
public decimal SDCommissionAmount { get; private set; } |
|||
|
|||
public decimal DeliveryExpressFreight { get; private set; } |
|||
|
|||
public SDType? SDType { get; private set; } |
|||
|
|||
public string Flag { get; private set; } |
|||
|
|||
public string VenderRemark { get; private set; } |
|||
|
|||
public SD(string orderId, bool isSetStorageType) |
|||
{ |
|||
InitializeComponent(); |
|||
this.OrderId = orderId; |
|||
this.IsSetStorageType = isSetStorageType; |
|||
} |
|||
|
|||
private void btn_Save_Click(object sender, RoutedEventArgs e) |
|||
{ |
|||
decimal.TryParse(txtSDCommissionAmount.Text, out decimal sdCommissionAmountd); |
|||
decimal.TryParse(txtDeliveryExpressFreight.Text, out decimal deliveryExpressFreight); |
|||
SDCommissionAmount = sdCommissionAmountd; |
|||
DeliveryExpressFreight = deliveryExpressFreight; |
|||
Flag = (cbx_flag.SelectedItem as ComboBoxItem).Content.ToString(); |
|||
SDType = (SDType)cbx_sdType.SelectedItem; |
|||
VenderRemark = txtVenderRemark.Text; |
|||
|
|||
this.DialogResult = true; |
|||
this.Close(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,243 @@ |
|||
<c:BWindow x:Class="BBWY.Client.Views.Ware.BindingPurchaseProduct" |
|||
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:b="http://schemas.microsoft.com/xaml/behaviors" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:local="clr-namespace:BBWY.Client.Views.Ware" |
|||
mc:Ignorable="d" |
|||
Style="{StaticResource bwstyle}" |
|||
DataContext="{Binding BindingPurchaseProduct,Source={StaticResource Locator}}" |
|||
Title="绑定采购商品" Height="768" Width="665"> |
|||
<b:Interaction.Triggers> |
|||
<b:EventTrigger EventName="Loaded"> |
|||
<b:InvokeCommandAction Command="{Binding LoadCommand}"/> |
|||
</b:EventTrigger> |
|||
<b:EventTrigger EventName="Closing"> |
|||
<b:InvokeCommandAction Command="{Binding ClosingCommand}" PassEventArgsToCommand="True"/> |
|||
</b:EventTrigger> |
|||
</b:Interaction.Triggers> |
|||
<Grid> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition/> |
|||
<RowDefinition Height="40"/> |
|||
</Grid.RowDefinitions> |
|||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center"> |
|||
<Run Text="{Binding PurchaserName}"/> |
|||
<Run Text="绑定采购商品"/> |
|||
</TextBlock> |
|||
<ListBox x:Name="listbox_skuList" ItemsSource="{Binding Product.SkuList}" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" |
|||
Grid.Row="1" |
|||
Foreground="{StaticResource Text.Color}"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Grid Width="{Binding ActualWidth,ElementName=listbox_skuList}"> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition/> |
|||
<RowDefinition Height="Auto"/> |
|||
</Grid.RowDefinitions> |
|||
<Border Padding="5,0" |
|||
Background="#F2F2F2" |
|||
BorderThickness="0,1,0,1" |
|||
BorderBrush="{StaticResource Border.Brush}"> |
|||
<Grid VerticalAlignment="Center"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="auto"/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
<TextBlock> |
|||
<Run Text="SKU:"/> |
|||
<Run Text="{Binding Id}"/> |
|||
</TextBlock> |
|||
<TextBlock Grid.Column="1" TextTrimming="CharacterEllipsis" Margin="10,0,0,0"> |
|||
<Run Text="SKU名称:"/> |
|||
<Run Text="{Binding Title}"/> |
|||
</TextBlock> |
|||
</Grid> |
|||
</Border> |
|||
<ListBox x:Name="listbox_purchaseSchemeProductList" |
|||
ItemsSource="{Binding SelectedPurchaseScheme.PurchaseSchemeProductList}" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" |
|||
Style="{StaticResource NoScrollViewListBoxStyle}" |
|||
Grid.Row="1"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Border Width="{Binding ActualWidth,ElementName=listbox_purchaseSchemeProductList,Converter={StaticResource widthConverter},ConverterParameter=10}" |
|||
BorderBrush="{StaticResource Border.Brush}" |
|||
BorderThickness="1" |
|||
Margin="5" |
|||
Padding="5,0"> |
|||
<Grid> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="40"/> |
|||
<RowDefinition/> |
|||
<RowDefinition Height="Auto"/> |
|||
</Grid.RowDefinitions> |
|||
<Grid> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition /> |
|||
<ColumnDefinition Width="80"/> |
|||
<ColumnDefinition Width="5"/> |
|||
<ColumnDefinition Width="80"/> |
|||
</Grid.ColumnDefinitions> |
|||
<TextBlock Text="商品链接:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,5,0"/> |
|||
<c:BTextBox Text="{Binding PurchaseUrl}" Grid.Column="1" |
|||
IsEnabled="{Binding IsEditing}" |
|||
DisableBgColor="{StaticResource TextBox.Disable.BgColor}"/> |
|||
<c:BButton Content="查询" Grid.Column="2" Width="80" |
|||
Command="{Binding DataContext.GetPurchaseProductInfoCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type c:BWindow}}}" |
|||
CommandParameter="{Binding }" |
|||
Visibility="{Binding IsEditing,Converter={StaticResource objConverter},ConverterParameter=true:Visible:Collapsed}"/> |
|||
<c:BButton Content="修改" Grid.Column="2" Width="80" |
|||
Command="{Binding DataContext.EditPurchaseProductCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type c:BWindow}}}" |
|||
CommandParameter="{Binding }" |
|||
Visibility="{Binding IsEditing,Converter={StaticResource objConverter},ConverterParameter=false:Visible:Collapsed}"/> |
|||
<c:BButton Content="删除" Grid.Column="4" Width="80" Background="#EC808D" |
|||
Command="{Binding DataContext.RemovePurchaseSchemeProductCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type c:BWindow}}}" |
|||
CommandParameter="{Binding }"/> |
|||
</Grid> |
|||
|
|||
<ListBox x:Name="listbox_purchaseProductSkuList" |
|||
Grid.Row="1" |
|||
ItemsSource="{Binding SkuList}" |
|||
SelectionMode="Multiple" |
|||
Visibility="{Binding IsEditing,Converter={StaticResource objConverter},ConverterParameter=true:Visible:Collapsed}" |
|||
Style="{StaticResource NoScrollViewListBoxStyle}"> |
|||
<ListBox.ItemContainerStyle> |
|||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource NoBgListBoxItemStyle}"> |
|||
<Setter Property="ListBoxItem.IsSelected" Value="{Binding IsSelected}"/> |
|||
</Style> |
|||
</ListBox.ItemContainerStyle> |
|||
<ListBox.ItemsPanel> |
|||
<ItemsPanelTemplate> |
|||
<WrapPanel Orientation="Horizontal" Width="{Binding ActualWidth,ElementName=listbox_purchaseProductSkuList}"/> |
|||
</ItemsPanelTemplate> |
|||
</ListBox.ItemsPanel> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Grid Margin="0,5"> |
|||
<Grid.ToolTip> |
|||
<StackPanel> |
|||
<TextBlock> |
|||
<Run Text="SKU属性"/> |
|||
<Run Text="{Binding Title}"/> |
|||
</TextBlock> |
|||
<TextBlock> |
|||
<Run Text="SKU"/> |
|||
<Run Text="{Binding PurchaseSkuId}"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
</Grid.ToolTip> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="16"/> |
|||
<ColumnDefinition Width="50"/> |
|||
<ColumnDefinition Width="250"/> |
|||
</Grid.ColumnDefinitions> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition/> |
|||
<RowDefinition/> |
|||
</Grid.RowDefinitions> |
|||
<CheckBox IsChecked="{Binding IsSelected}" |
|||
Grid.RowSpan="2" |
|||
VerticalAlignment="Center" VerticalContentAlignment="Center"/> |
|||
<c:BAsyncImage Width="40" DecodePixelWidth="40" |
|||
UrlSource="{Binding Logo}" |
|||
Grid.Column="1" Grid.RowSpan="2" |
|||
BorderThickness="1" |
|||
BorderBrush="{StaticResource Border.Brush}"/> |
|||
<TextBlock Text="{Binding Title}" Grid.Column="2" VerticalAlignment="Center"/> |
|||
<TextBlock Grid.Column="2" Grid.Row="1" VerticalAlignment="Center"> |
|||
<Run Text="单价"/> |
|||
<Run Text="{Binding Price}"/> |
|||
</TextBlock> |
|||
</Grid> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
<ListBox ItemsSource="{Binding PurchaseSchemeProductSkuList}" |
|||
Grid.Row="1" |
|||
Visibility="{Binding IsEditing,Converter={StaticResource objConverter},ConverterParameter=true:Collapsed:Visible}" |
|||
x:Name="listbox_selectedPurchaseProductSkuList" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" |
|||
Style="{StaticResource NoScrollViewListBoxStyle}"> |
|||
<ListBox.ItemsPanel> |
|||
<ItemsPanelTemplate> |
|||
<WrapPanel Orientation="Horizontal" Width="{Binding ActualWidth,ElementName=listbox_selectedPurchaseProductSkuList}"/> |
|||
</ItemsPanelTemplate> |
|||
</ListBox.ItemsPanel> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Grid Margin="0,5"> |
|||
<Grid.ToolTip> |
|||
<StackPanel> |
|||
<TextBlock> |
|||
<Run Text="SKU属性"/> |
|||
<Run Text="{Binding Title}"/> |
|||
</TextBlock> |
|||
<TextBlock> |
|||
<Run Text="SKU"/> |
|||
<Run Text="{Binding PurchaseSkuId}"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
</Grid.ToolTip> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="50"/> |
|||
<ColumnDefinition Width="220"/> |
|||
</Grid.ColumnDefinitions> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition/> |
|||
<RowDefinition/> |
|||
</Grid.RowDefinitions> |
|||
<c:BAsyncImage Width="40" DecodePixelWidth="40" |
|||
UrlSource="{Binding Logo}" Grid.RowSpan="2" |
|||
BorderThickness="1" |
|||
BorderBrush="{StaticResource Border.Brush}"/> |
|||
<TextBlock Text="{Binding Title}" Grid.Column="1" VerticalAlignment="Center"/> |
|||
<TextBlock Grid.Column="1" Grid.Row="1" VerticalAlignment="Center"> |
|||
<Run Text="单价"/> |
|||
<Run Text="{Binding Price}"/> |
|||
</TextBlock> |
|||
</Grid> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
|
|||
<c:BButton Content="确定" Grid.Row="2" Width="80" Margin="0,0,0,5" HorizontalAlignment="Right" |
|||
Visibility="{Binding IsEditing,Converter={StaticResource objConverter},ConverterParameter=true:Visible:Collapsed}" |
|||
Command="{Binding DataContext.ConfirmPurchaseProductCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type c:BWindow}}}" CommandParameter="{Binding }"/> |
|||
</Grid> |
|||
</Border> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
<c:BButton Grid.Row="2" Background="Transparent" Foreground="{StaticResource PathColor}" Margin="0,10" |
|||
Command="{Binding DataContext.AddPurchaseProductCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}" |
|||
CommandParameter="{Binding }"> |
|||
<StackPanel> |
|||
<Path Style="{StaticResource path_add}" Width="16"/> |
|||
<TextBlock Text="添加链接"/> |
|||
</StackPanel> |
|||
</c:BButton> |
|||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" |
|||
VerticalAlignment="Center" |
|||
Grid.Row="2" Margin="0,0,5,0" |
|||
Visibility="{Binding SelectedPurchaseScheme,Converter={StaticResource objConverter},ConverterParameter=#null:Collapsed:Visible}"> |
|||
<TextBlock Text="默认成本" VerticalAlignment="Center"/> |
|||
<c:BTextBox Text="{Binding SelectedPurchaseScheme.DefaultCost}" Width="60"/> |
|||
<TextBlock Text="实际成本" VerticalAlignment="Center"/> |
|||
<c:BTextBox Text="{Binding SelectedPurchaseScheme.RealCost}" Width="60"/> |
|||
</StackPanel> |
|||
</Grid> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
<c:BButton Content="保存" Grid.Row="2" HorizontalAlignment="Right" Width="80" Margin="0,0,5,0" |
|||
Command="{Binding SavePurchaseSchemeCommand}"/> |
|||
<c:RoundWaitProgress Grid.RowSpan="3" Play="{Binding IsLoading}" WaitText="加载中..."/> |
|||
</Grid> |
|||
</c:BWindow> |
@ -0,0 +1,31 @@ |
|||
using BBWY.Controls; |
|||
using System; |
|||
using System.Windows; |
|||
using GalaSoft.MvvmLight.Messaging; |
|||
namespace BBWY.Client.Views.Ware |
|||
{ |
|||
/// <summary>
|
|||
/// BindingPurchaseProduct.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
public partial class BindingPurchaseProduct : BWindow |
|||
{ |
|||
public BindingPurchaseProduct() |
|||
{ |
|||
InitializeComponent(); |
|||
Messenger.Default.Register<bool>(this, "BindingPurchaseProduct_Close", (x) => |
|||
{ |
|||
this.Dispatcher.Invoke(() => { |
|||
this.DialogResult = x; |
|||
this.Close(); |
|||
}); |
|||
}); |
|||
|
|||
this.Unloaded += BindingPurchaseProduct_Unloaded; |
|||
} |
|||
|
|||
private void BindingPurchaseProduct_Unloaded(object sender, RoutedEventArgs e) |
|||
{ |
|||
Messenger.Default.Unregister(this); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,288 @@ |
|||
<Page x:Class="BBWY.Client.Views.Ware.WareManager" |
|||
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:b="http://schemas.microsoft.com/xaml/behaviors" |
|||
xmlns:local="clr-namespace:BBWY.Client.Views.Ware" |
|||
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" |
|||
xmlns:ctr="clr-namespace:BBWY.Client.Converters" |
|||
mc:Ignorable="d" |
|||
d:DesignHeight="450" d:DesignWidth="800" |
|||
Title="WareManager" |
|||
DataContext="{Binding WareManager,Source={StaticResource Locator}}"> |
|||
<b:Interaction.Triggers> |
|||
<b:EventTrigger EventName="Loaded"> |
|||
<b:InvokeCommandAction Command="{Binding LoadCommand}"/> |
|||
</b:EventTrigger> |
|||
</b:Interaction.Triggers> |
|||
<Page.Resources> |
|||
<ctr:ItemHeightConverter x:Key="itemHeightConverter"/> |
|||
</Page.Resources> |
|||
<Grid> |
|||
<c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999"/> |
|||
<Grid Margin="5,0"> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="50"/> |
|||
<RowDefinition Height="5"/> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition/> |
|||
<RowDefinition Height="30"/> |
|||
</Grid.RowDefinitions> |
|||
<StackPanel Orientation="Horizontal" Background="{StaticResource Border.Background}"> |
|||
<TextBlock Text="商品名称" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchProductName}" WaterRemark="模糊搜索"/> |
|||
<TextBlock Text="货号" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchProductItem}" WaterRemark="精确匹配"/> |
|||
<TextBlock Text="SPU" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchSpu}" WaterRemark="精确匹配"/> |
|||
<TextBlock Text="SKU" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchSku}" WaterRemark="精确匹配"/> |
|||
<c:BButton Content="搜索" Padding="10,0" Margin="5,0,0,0" |
|||
Command="{Binding SearchCommand}"/> |
|||
</StackPanel> |
|||
|
|||
<Border Grid.Row="2" BorderBrush="{StaticResource Border.Brush}" BorderThickness="1,1,1,0" |
|||
Background="#F2F2F2"> |
|||
<Grid> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="351"/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition Width="50"/> |
|||
<ColumnDefinition Width="170"/> |
|||
<ColumnDefinition Width="110"/> |
|||
</Grid.ColumnDefinitions> |
|||
<TextBlock Text="商品信息" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="商品1" Grid.Column="1" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="商品2" Grid.Column="2" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="商品3" Grid.Column="3" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="商品4" Grid.Column="4" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="毛利" Grid.Column="5" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="采购商" Grid.Column="6" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="操作" Grid.Column="7" Style="{StaticResource middleTextBlock}"/> |
|||
|
|||
|
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}"/> |
|||
<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"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="6"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="7"/> |
|||
|
|||
</Grid> |
|||
</Border> |
|||
|
|||
<ListBox x:Name="listbox_productList" |
|||
Grid.Row="3" |
|||
ItemsSource="{Binding ProductList}" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" |
|||
Foreground="{StaticResource Text.Color}" |
|||
BorderThickness="1,1,1,0" |
|||
BorderBrush="{StaticResource Border.Brush}"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Grid Width="{Binding ActualWidth,ElementName=listbox_productList}"> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition/> |
|||
</Grid.RowDefinitions> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition Width="280"/> |
|||
</Grid.ColumnDefinitions> |
|||
|
|||
<Grid Background="#F2F2F2" Grid.ColumnSpan="2"> |
|||
<StackPanel Orientation="Horizontal"> |
|||
<TextBlock VerticalAlignment="Center" Margin="5,0,0,0"> |
|||
<Run Text="SPU:"/> |
|||
<Run Text="{Binding Id}"/> |
|||
</TextBlock> |
|||
<TextBlock VerticalAlignment="Center" Margin="5,0,0,0"> |
|||
<Run Text="货号:"/> |
|||
<Run Text="{Binding ProductItemNum}"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
<c:BButton HorizontalAlignment="Right" Content="添加采购商" Width="110" |
|||
Command="{Binding DataContext.AddPurchaserCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}" CommandParameter="{Binding }"/> |
|||
</Grid> |
|||
<!--<Border Grid.ColumnSpan="2" BorderBrush="{StaticResource Border.Brush}" BorderThickness="0,0,0,1"/>--> |
|||
|
|||
<ListBox x:Name="listbox_sku" Grid.Row="1" ItemsSource="{Binding SkuList}" |
|||
Style="{StaticResource NoScrollViewListBoxStyle}" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" |
|||
Foreground="{StaticResource Text.Color}" |
|||
BorderThickness="0,1,0,0" |
|||
BorderBrush="{StaticResource Border.Brush}"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource Border.Brush}" |
|||
Width="{Binding ActualWidth,ElementName=listbox_sku}"> |
|||
<Grid Height="150"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="350"/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
<!--SKU信息--> |
|||
<Grid> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="90"/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
|
|||
<c:BAsyncImage UrlSource="{Binding Logo}" Width="80" DecodePixelWidth="80" |
|||
VerticalAlignment="Top" Margin="0,5,0,0"/> |
|||
|
|||
<StackPanel Grid.Column="1" Orientation="Vertical" Margin="0,5,0,0"> |
|||
<TextBlock> |
|||
<Run Text="售价:" /> |
|||
<Run Text="{Binding Price}"/> |
|||
</TextBlock> |
|||
<TextBlock> |
|||
<Run Text="SKU:" /> |
|||
<Run Text="{Binding Id}"/> |
|||
</TextBlock> |
|||
<TextBlock TextWrapping="Wrap"> |
|||
<Run Text="SKU名称:" /> |
|||
<Run Text="{Binding Title}"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
</Grid> |
|||
|
|||
<!--采购方案--> |
|||
<ListBox x:Name="listbox_purchaseSchemeList" ItemsSource="{Binding PurchaseSchemeList}" |
|||
Grid.Column="1" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" |
|||
BorderThickness="1,0" |
|||
BorderBrush="{StaticResource Border.Brush}" |
|||
Style="{StaticResource NoScrollViewListBoxStyle}"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Grid Width="{Binding ActualWidth,ElementName= listbox_purchaseSchemeList}" |
|||
Height="30"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="0.15*"/> |
|||
<ColumnDefinition Width="0.1*"/> |
|||
<ColumnDefinition Width="0.15*"/> |
|||
<ColumnDefinition Width="0.1*"/> |
|||
<ColumnDefinition Width="0.15*"/> |
|||
<ColumnDefinition Width="0.1*"/> |
|||
<ColumnDefinition Width="0.15*"/> |
|||
<ColumnDefinition Width="0.1*"/> |
|||
<ColumnDefinition Width="50"/> |
|||
</Grid.ColumnDefinitions> |
|||
<TextBlock Text="{Binding PurchaseProductId1}" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Grid.Column="1" Style="{StaticResource middleTextBlock}" |
|||
Foreground="{StaticResource Text.Link.Color}"> |
|||
<Run Text="Sku*"/> |
|||
<Run Text="{Binding PurchaseProductSkuCount1}"/> |
|||
</TextBlock> |
|||
<TextBlock Text="{Binding PurchaseProductId2}" Grid.Column="2" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Grid.Column="3" Style="{StaticResource middleTextBlock}" Foreground="{StaticResource Text.Link.Color}" |
|||
Visibility="{Binding PurchaseProductSkuCount2,Converter={StaticResource objConverter},ConverterParameter=0:Collapsed:Visible}"> |
|||
<Run Text="Sku*"/> |
|||
<Run Text="{Binding PurchaseProductSkuCount2}"/> |
|||
</TextBlock> |
|||
|
|||
<TextBlock Text="{Binding PurchaseProductId3}" Grid.Column="4" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Grid.Column="5" Style="{StaticResource middleTextBlock}" Foreground="{StaticResource Text.Link.Color}" |
|||
Visibility="{Binding PurchaseProductSkuCount3,Converter={StaticResource objConverter},ConverterParameter=0:Collapsed:Visible}"> |
|||
<Run Text="Sku*"/> |
|||
<Run Text="{Binding PurchaseProductSkuCount3}"/> |
|||
</TextBlock> |
|||
|
|||
<TextBlock Text="{Binding PurchaseProductId4}" Grid.Column="6" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Grid.Column="7" Style="{StaticResource middleTextBlock}" Foreground="{StaticResource Text.Link.Color}" |
|||
Visibility="{Binding PurchaseProductSkuCount4,Converter={StaticResource objConverter},ConverterParameter=0:Collapsed:Visible}"> |
|||
<Run Text="Sku*"/> |
|||
<Run Text="{Binding PurchaseProductSkuCount4}"/> |
|||
</TextBlock> |
|||
<Border Grid.Column="8"> |
|||
<!--毛利率--> |
|||
</Border> |
|||
|
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}"/> |
|||
<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"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="6"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="7"/> |
|||
<Border Height="1" Grid.ColumnSpan="9" Background="{StaticResource Border.Brush}" VerticalAlignment="Bottom"/> |
|||
</Grid> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
</Grid> |
|||
</Border> |
|||
|
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
|
|||
<ListBox x:Name="listbox_purchaser" ItemsSource="{Binding PurchaserList}" |
|||
Grid.Row="1" Grid.Column="1" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" |
|||
Style="{StaticResource NoScrollViewListBoxStyle}" |
|||
BorderBrush="{StaticResource Border.Brush}" |
|||
BorderThickness="0,1"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Border Width="{Binding ActualWidth,ElementName=listbox_purchaser}" |
|||
Height="{Binding SkuUseCount,Converter={StaticResource itemHeightConverter},ConverterParameter=30}" |
|||
BorderBrush="{StaticResource Border.Brush}" |
|||
BorderThickness="0,0,0,1"> |
|||
<Grid> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition/> |
|||
<ColumnDefinition Width="110"/> |
|||
</Grid.ColumnDefinitions> |
|||
<Border BorderBrush="{StaticResource Border.Brush}" BorderThickness="0,0,1,0"> |
|||
<TextBlock Text="{Binding Name}" |
|||
VerticalAlignment="Center" |
|||
HorizontalAlignment="Center" |
|||
ToolTip="{Binding Name}"/> |
|||
</Border> |
|||
|
|||
<Grid Grid.Column="1"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="0.65*"/> |
|||
<ColumnDefinition Width="0.35*"/> |
|||
</Grid.ColumnDefinitions> |
|||
<c:BButton Content="编辑采购商" Style="{StaticResource LinkButton}" |
|||
Command="{Binding DataContext.EditPurchaserCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}" |
|||
CommandParameter="{Binding }"/> |
|||
<c:BButton Content="删除" Grid.Column="1" Style="{StaticResource LinkButton}" |
|||
Command="{Binding DataContext.DeletePurchaserCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}" |
|||
CommandParameter="{Binding }"/> |
|||
</Grid> |
|||
</Grid> |
|||
</Border> |
|||
|
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
|
|||
</Grid> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
|
|||
<c:PageControl PageIndex="{Binding PageIndex}" |
|||
PageSize="5" |
|||
RecordCount="{Binding ProductCount}" |
|||
Grid.Row="4"> |
|||
<b:Interaction.Triggers> |
|||
<b:EventTrigger EventName="OnPageIndexChanged"> |
|||
<b:InvokeCommandAction Command="{Binding ProductPageIndexChangedCommand}" PassEventArgsToCommand="True"/> |
|||
</b:EventTrigger> |
|||
</b:Interaction.Triggers> |
|||
</c:PageControl> |
|||
</Grid> |
|||
</Grid> |
|||
</Page> |
@ -0,0 +1,46 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
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; |
|||
using BBGWY.Controls.Extensions; |
|||
using GalaSoft.MvvmLight.Messaging; |
|||
|
|||
namespace BBWY.Client.Views.Ware |
|||
{ |
|||
/// <summary>
|
|||
/// WareManager.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
public partial class WareManager : Page |
|||
{ |
|||
private ScrollViewer scrollviewer_ProductList; |
|||
|
|||
public WareManager() |
|||
{ |
|||
InitializeComponent(); |
|||
this.Loaded += WareManager_Loaded; |
|||
this.Unloaded += WareManager_Unloaded; |
|||
Messenger.Default.Register<string>(this, "WareManager_ProductListScrollToTop", (x) => |
|||
{ |
|||
scrollviewer_ProductList.Dispatcher.Invoke(() => scrollviewer_ProductList.ScrollToTop()); |
|||
}); |
|||
} |
|||
|
|||
private void WareManager_Unloaded(object sender, RoutedEventArgs e) |
|||
{ |
|||
Messenger.Default.Unregister(this); |
|||
} |
|||
|
|||
private void WareManager_Loaded(object sender, RoutedEventArgs e) |
|||
{ |
|||
scrollviewer_ProductList = listbox_productList.FindFirstVisualChild<ScrollViewer>(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,401 @@ |
|||
<Page x:Class="BBWY.Client.Views.Ware.WareStock" |
|||
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.Ware" |
|||
xmlns:b="http://schemas.microsoft.com/xaml/behaviors" |
|||
xmlns:sys="clr-namespace:System;assembly=mscorlib" |
|||
mc:Ignorable="d" |
|||
d:DesignHeight="450" d:DesignWidth="800" |
|||
DataContext="{Binding WareStock,Source={StaticResource Locator}}" |
|||
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" |
|||
xmlns:ts="clr-namespace:BBWY.Client.TemplateSelectors" |
|||
xmlns:clientModel="clr-namespace:BBWY.Client.Models" |
|||
xmlns:ctr="clr-namespace:BBWY.Client.Converters" |
|||
Title="WareStock"> |
|||
<b:Interaction.Triggers> |
|||
<b:EventTrigger EventName="Loaded"> |
|||
<b:InvokeCommandAction Command="{Binding LoadCommand}"/> |
|||
</b:EventTrigger> |
|||
</b:Interaction.Triggers> |
|||
<Page.Resources> |
|||
<ObjectDataProvider x:Key="platformProvider" MethodName="GetValues" ObjectType="{x:Type sys:Enum}"> |
|||
<ObjectDataProvider.MethodParameters> |
|||
<x:Type TypeName="clientModel:Platform"/> |
|||
</ObjectDataProvider.MethodParameters> |
|||
</ObjectDataProvider> |
|||
<ctr:PurchaseOrderDelBtnConverter x:Key="poDelConverter"/> |
|||
<ctr:PurchaseOrderEditBtnConverter x:Key="poEditConverter"/> |
|||
|
|||
<DataTemplate x:Key="purchaseOrderTemplate_normal"> |
|||
<Grid Width="{Binding ActualWidth,ElementName= listbox_purchaseOrderList}" |
|||
Height="30"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="80"/> |
|||
<ColumnDefinition Width="1*"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="80"/> |
|||
<ColumnDefinition Width="90"/> |
|||
</Grid.ColumnDefinitions> |
|||
<TextBlock Text="{Binding PurchasePlatform}" Style="{StaticResource middleTextBlock}"/> |
|||
|
|||
<TextBlock Text="{Binding PurchaseOrderId}" Grid.Column="1" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="{Binding SingleSkuAmount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Grid.Column="2" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="{Binding SingleFreight,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Grid.Column="3" Style="{StaticResource middleTextBlock}"/> |
|||
|
|||
<TextBlock Text="{Binding SingleFirstFreight,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Grid.Column="4" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="{Binding SingleOperationAmount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Grid.Column="5" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="{Binding SingleConsumableAmount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Grid.Column="6" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="{Binding SingleStorageAmount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Grid.Column="7" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="{Binding SingleDeliveryFreight}" Grid.Column="8" Style="{StaticResource middleTextBlock}"/> |
|||
|
|||
<TextBlock Text="{Binding PurchaseQuantity,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Grid.Column="9" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="{Binding RemainingQuantity,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Grid.Column="10" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="{Binding UnitCost,Mode=OneWay}" Grid.Column="11" Style="{StaticResource middleTextBlock}" Foreground="Gray"/> |
|||
<TextBlock Text="{Binding CreateTime,StringFormat=yyyy-MM-dd}" Grid.Column="12" Style="{StaticResource middleTextBlock}"/> |
|||
|
|||
<StackPanel Grid.Column="13" HorizontalAlignment="Center" Orientation="Horizontal"> |
|||
<c:BButton Content="编辑" Style="{StaticResource LinkButton}" |
|||
Command="{Binding DataContext.EditPurchaseOrderCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}" |
|||
CommandParameter="{Binding }"> |
|||
</c:BButton> |
|||
|
|||
<c:BButton Content="删除" Style="{StaticResource LinkButton}" Margin="5,0,0,0" |
|||
Command="{Binding DataContext.DeletePurchaseOrderCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}" CommandParameter="{Binding }"> |
|||
</c:BButton> |
|||
</StackPanel> |
|||
|
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}"/> |
|||
<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"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="6"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="7"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="8"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="9"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="10"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="11"/> |
|||
<Border Height="1" Grid.ColumnSpan="14" Background="{StaticResource Border.Brush}" VerticalAlignment="Bottom"/> |
|||
</Grid> |
|||
</DataTemplate> |
|||
<DataTemplate x:Key="purchaseOrderTemplate_edit"> |
|||
<Grid Width="{Binding ActualWidth,ElementName= listbox_purchaseOrderList}" |
|||
Height="30"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="80"/> |
|||
<ColumnDefinition Width="1*"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="80"/> |
|||
<ColumnDefinition Width="90"/> |
|||
</Grid.ColumnDefinitions> |
|||
<!--<c:BTextBox Text="{Binding PurchasePlatform}"/>--> |
|||
<ComboBox ItemsSource="{Binding Source={StaticResource platformProvider}}" |
|||
SelectedItem="{Binding PurchasePlatform}" |
|||
BorderThickness="0" |
|||
VerticalContentAlignment="Center" |
|||
FocusVisualStyle="{x:Null}"/> |
|||
|
|||
<c:BTextBox Text="{Binding PurchaseOrderId}" Grid.Column="1" BorderThickness="0"/> |
|||
<c:BTextBox Text="{Binding SingleSkuAmount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource inputNumberConverter}}" |
|||
Grid.Column="2" BorderThickness="0"/> |
|||
<c:BTextBox Text="{Binding SingleFreight,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource inputNumberConverter}}" Grid.Column="3" BorderThickness="0"/> |
|||
|
|||
<c:BTextBox Text="{Binding SingleFirstFreight,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource inputNumberConverter}}" Grid.Column="4" BorderThickness="0"/> |
|||
<c:BTextBox Text="{Binding SingleOperationAmount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource inputNumberConverter}}" Grid.Column="5" BorderThickness="0"/> |
|||
<c:BTextBox Text="{Binding SingleConsumableAmount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource inputNumberConverter}}" Grid.Column="6" BorderThickness="0"/> |
|||
<c:BTextBox Text="{Binding SingleStorageAmount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource inputNumberConverter}}" Grid.Column="7" BorderThickness="0"/> |
|||
<c:BTextBox Text="{Binding SingleDeliveryFreight,Converter={StaticResource inputNumberConverter}}" Grid.Column="8" BorderThickness="0"/> |
|||
|
|||
<c:BTextBox Text="{Binding PurchaseQuantity,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Grid.Column="9" BorderThickness="0"/> |
|||
<c:BTextBox Text="{Binding RemainingQuantity,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Grid.Column="10" BorderThickness="0"/> |
|||
<TextBlock Text="{Binding UnitCost,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" Grid.Column="11" Style="{StaticResource middleTextBlock}" Foreground="Gray"/> |
|||
<TextBlock Text="{Binding CreateTime,StringFormat=yyyy-MM-dd}" Grid.Column="12" Style="{StaticResource middleTextBlock}" Foreground="Gray"/> |
|||
|
|||
<StackPanel Grid.Column="13" HorizontalAlignment="Center" Orientation="Horizontal"> |
|||
<c:BButton Content="保存" Style="{StaticResource LinkButton}" |
|||
Command="{Binding DataContext.SavePurchaseOrderCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}" |
|||
CommandParameter="{Binding }" /> |
|||
<c:BButton Content="删除" Style="{StaticResource LinkButton}" Margin="5,0,0,0" |
|||
Command="{Binding DataContext.DeletePurchaseOrderCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}" CommandParameter="{Binding }"> |
|||
|
|||
</c:BButton> |
|||
</StackPanel> |
|||
|
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}"/> |
|||
<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"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="6"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="7"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="8"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="9"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="10"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="11"/> |
|||
<Border Height="1" Grid.ColumnSpan="14" Background="{StaticResource Border.Brush}" VerticalAlignment="Bottom"/> |
|||
</Grid> |
|||
</DataTemplate> |
|||
</Page.Resources> |
|||
<Grid> |
|||
<c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999"/> |
|||
<Grid Margin="5,0"> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="50"/> |
|||
<RowDefinition Height="5"/> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition/> |
|||
<RowDefinition Height="30"/> |
|||
</Grid.RowDefinitions> |
|||
<StackPanel Orientation="Horizontal" Background="{StaticResource Border.Background}"> |
|||
<TextBlock Text="SPU" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchSpu}" WaterRemark="精确匹配"/> |
|||
<TextBlock Text="SKU" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchSku}" WaterRemark="精确匹配"/> |
|||
<TextBlock Text="货号" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchProductItem}" WaterRemark="精确匹配"/> |
|||
<TextBlock Text="采购单号" VerticalAlignment="Center" Margin="5,0,0,0"/> |
|||
<c:BTextBox Width="150" Margin="5,0,0,0" Text="{Binding SearchPurchaseOrder}" WaterRemark="精确匹配"/> |
|||
<c:BButton Content="搜索" Padding="10,0" Margin="5,0,0,0" |
|||
Command="{Binding SearchCommand}"/> |
|||
</StackPanel> |
|||
|
|||
<Border Grid.Row="2" BorderBrush="{StaticResource Border.Brush}" BorderThickness="1,1,1,0" |
|||
Background="#F2F2F2"> |
|||
<Grid> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="351"/> |
|||
<ColumnDefinition Width="80"/> |
|||
<ColumnDefinition Width="80"/> |
|||
<ColumnDefinition Width="1*"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="60"/> |
|||
<ColumnDefinition Width="80"/> |
|||
<ColumnDefinition Width="90"/> |
|||
</Grid.ColumnDefinitions> |
|||
<TextBlock Text="商品信息" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="仓储平台" 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 Grid.Column="5" Style="{StaticResource middleTextBlock}"> |
|||
<Run Text="采购运"/> |
|||
<LineBreak/> |
|||
<Run Text="单价"/> |
|||
</TextBlock> |
|||
<TextBlock Text="头程单价" Grid.Column="6" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="操作单价" Grid.Column="7" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="耗材单价" Grid.Column="8" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="仓储单价" Grid.Column="9" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Grid.Column="10" Style="{StaticResource middleTextBlock}"> |
|||
<Run Text="销售运"/> |
|||
<LineBreak/> |
|||
<Run Text="单价"/> |
|||
</TextBlock> |
|||
<TextBlock Text="库存" Grid.Column="11" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="剩余库存" Grid.Column="12" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="均摊单价" Grid.Column="13" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="采购时间" Grid.Column="14" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="操作" Grid.Column="15" Style="{StaticResource middleTextBlock}"/> |
|||
|
|||
|
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}"/> |
|||
<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"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="6"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="7"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="8"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="9"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="10"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="11"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="12"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="13"/> |
|||
<Border Width="1" HorizontalAlignment="Right" Background="{StaticResource Border.Brush}" Grid.Column="14"/> |
|||
</Grid> |
|||
</Border> |
|||
|
|||
<ListBox x:Name="listbox_productList" |
|||
Grid.Row="3" |
|||
ItemsSource="{Binding ProductList}" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" |
|||
Foreground="{StaticResource Text.Color}" |
|||
BorderThickness="1,1,1,0" |
|||
BorderBrush="{StaticResource Border.Brush}"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Grid Width="{Binding ActualWidth,ElementName=listbox_productList}"> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="30"/> |
|||
<RowDefinition/> |
|||
</Grid.RowDefinitions> |
|||
|
|||
<Grid Background="#F2F2F2" Grid.ColumnSpan="2"> |
|||
<StackPanel Orientation="Horizontal"> |
|||
<TextBlock VerticalAlignment="Center" Margin="5,0,0,0"> |
|||
<Run Text="SPU:"/> |
|||
<Run Text="{Binding Id}"/> |
|||
</TextBlock> |
|||
<TextBlock VerticalAlignment="Center" Margin="5,0,0,0"> |
|||
<Run Text="货号:"/> |
|||
<Run Text="{Binding ProductItemNum}"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
<c:BButton HorizontalAlignment="Right" Content="采购库存" Width="110" |
|||
Command="{Binding DataContext.AddPurchaserOrderCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}" CommandParameter="{Binding }"/> |
|||
</Grid> |
|||
<!--<Border Grid.ColumnSpan="2" BorderBrush="{StaticResource Border.Brush}" BorderThickness="0,0,0,1"/>--> |
|||
|
|||
<ListBox x:Name="listbox_sku" Grid.Row="1" ItemsSource="{Binding SkuList}" |
|||
Style="{StaticResource NoScrollViewListBoxStyle}" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" |
|||
Foreground="{StaticResource Text.Color}" |
|||
BorderThickness="0,1,0,0" |
|||
BorderBrush="{StaticResource Border.Brush}"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource Border.Brush}" |
|||
Width="{Binding ActualWidth,ElementName=listbox_sku}"> |
|||
<Grid Height="150"> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="350"/> |
|||
<!--350--> |
|||
<ColumnDefinition Width="80"/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
<!--SKU信息--> |
|||
<Grid> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="90"/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
|
|||
<c:BAsyncImage UrlSource="{Binding Logo}" Width="80" DecodePixelWidth="80" |
|||
VerticalAlignment="Top" Margin="0,5,0,0"/> |
|||
|
|||
<StackPanel Grid.Column="1" Orientation="Vertical" Margin="0,5,0,0"> |
|||
<TextBlock> |
|||
<Run Text="售价:" /> |
|||
<Run Text="{Binding Price}"/> |
|||
</TextBlock> |
|||
<TextBlock> |
|||
<Run Text="SKU:" /> |
|||
<Run Text="{Binding Id}"/> |
|||
</TextBlock> |
|||
<TextBlock TextWrapping="Wrap"> |
|||
<Run Text="SKU名称:" /> |
|||
<Run Text="{Binding Title}"/> |
|||
</TextBlock> |
|||
</StackPanel> |
|||
</Grid> |
|||
|
|||
<!--仓储平台--> |
|||
<ListBox x:Name="listbox_storageType" Grid.Column="1" |
|||
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" |
|||
Style="{StaticResource NoScrollViewListBoxStyle}" |
|||
BorderBrush="{StaticResource Border.Brush}" |
|||
BorderThickness="1,0,0,0" |
|||
ItemsSource="{Binding StorageList}" |
|||
SelectedItem="{Binding SelectedStorageModel}"> |
|||
<ListBox.ItemTemplate> |
|||
<DataTemplate> |
|||
<Grid x:Name="grid_storageType" Width="{Binding ActualWidth,ElementName=listbox_storageType,Converter={StaticResource widthConverter},ConverterParameter=7}" Margin="5,5,5,0" Height="25" |
|||
Background="{StaticResource Button.Normal.Background}"> |
|||
<TextBlock x:Name="txt_storageType" Text="{Binding StorageType}" HorizontalAlignment="Center" VerticalAlignment="Center" |
|||
Foreground="{StaticResource Text.Color}"/> |
|||
<b:Interaction.Triggers> |
|||
<b:EventTrigger EventName="MouseLeftButtonDown"> |
|||
<b:InvokeCommandAction Command="{Binding DataContext.SwitchStorageTypeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}" |
|||
CommandParameter="{Binding }"/> |
|||
</b:EventTrigger> |
|||
</b:Interaction.Triggers> |
|||
</Grid> |
|||
<DataTemplate.Triggers> |
|||
<DataTrigger Binding="{Binding IsSelected,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}}}" |
|||
Value="True"> |
|||
<Setter TargetName="grid_storageType" Property="Background" Value="{StaticResource Button.Selected.Background}"/> |
|||
<Setter TargetName="txt_storageType" Property="Foreground" Value="White"/> |
|||
</DataTrigger> |
|||
</DataTemplate.Triggers> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
|
|||
|
|||
<!--采购订单--> |
|||
<ListBox x:Name="listbox_purchaseOrderList" ItemsSource="{Binding PurchaseOrderList}" |
|||
Grid.Column="2" |
|||
BorderThickness="1,0" |
|||
BorderBrush="{StaticResource Border.Brush}" |
|||
Style="{StaticResource NoScrollViewListBoxStyle}"> |
|||
<!-- ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"--> |
|||
<!--<ListBox.ItemTemplateSelector> |
|||
<ts:PurchaseOrderDataTemplateSelector NormalTemplate="{StaticResource purchaseOrderTemplate_normal}" |
|||
EditTemplate="{StaticResource purchaseOrderTemplate_edit}"/> |
|||
</ListBox.ItemTemplateSelector>--> |
|||
<ListBox.ItemContainerStyle> |
|||
<Style BasedOn="{StaticResource NoBgListBoxItemStyle}" TargetType="ListBoxItem"> |
|||
<Setter Property="ContentTemplate" Value="{StaticResource purchaseOrderTemplate_normal}"/> |
|||
<Style.Triggers> |
|||
<DataTrigger Binding="{Binding IsEdit}" Value="True"> |
|||
<Setter Property="ContentTemplate" Value="{StaticResource purchaseOrderTemplate_edit}"/> |
|||
</DataTrigger> |
|||
</Style.Triggers> |
|||
</Style> |
|||
</ListBox.ItemContainerStyle> |
|||
</ListBox> |
|||
</Grid> |
|||
</Border> |
|||
|
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
</Grid> |
|||
</DataTemplate> |
|||
</ListBox.ItemTemplate> |
|||
</ListBox> |
|||
|
|||
<c:PageControl PageIndex="{Binding PageIndex}" |
|||
PageSize="5" |
|||
RecordCount="{Binding ProductCount}" |
|||
Grid.Row="4"> |
|||
<b:Interaction.Triggers> |
|||
<b:EventTrigger EventName="OnPageIndexChanged"> |
|||
<b:InvokeCommandAction Command="{Binding ProductPageIndexChangedCommand}" PassEventArgsToCommand="True"/> |
|||
</b:EventTrigger> |
|||
</b:Interaction.Triggers> |
|||
</c:PageControl> |
|||
</Grid> |
|||
</Grid> |
|||
</Page> |
@ -0,0 +1,35 @@ |
|||
using BBGWY.Controls.Extensions; |
|||
using GalaSoft.MvvmLight.Messaging; |
|||
using System.Windows; |
|||
using System.Windows.Controls; |
|||
|
|||
namespace BBWY.Client.Views.Ware |
|||
{ |
|||
/// <summary>
|
|||
/// WareStock.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
public partial class WareStock : Page |
|||
{ |
|||
private ScrollViewer scrollviewer_ProductList; |
|||
public WareStock() |
|||
{ |
|||
InitializeComponent(); |
|||
this.Loaded += WareStock_Loaded; |
|||
this.Unloaded += WareStock_Unloaded; |
|||
Messenger.Default.Register<string>(this, "WareStock_ProductListScrollToTop", (x) => |
|||
{ |
|||
scrollviewer_ProductList.Dispatcher.Invoke(() => scrollviewer_ProductList.ScrollToTop()); |
|||
}); |
|||
} |
|||
|
|||
private void WareStock_Unloaded(object sender, RoutedEventArgs e) |
|||
{ |
|||
Messenger.Default.Unregister(this); |
|||
} |
|||
|
|||
private void WareStock_Loaded(object sender, RoutedEventArgs e) |
|||
{ |
|||
scrollviewer_ProductList = listbox_productList.FindFirstVisualChild<ScrollViewer>(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,17 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<None Include="..\.editorconfig" Link=".editorconfig" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="AutoMapper" Version="10.1.1" /> |
|||
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" /> |
|||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
@ -0,0 +1,102 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Runtime.InteropServices; |
|||
using System.Text; |
|||
|
|||
namespace BBWY.Common.Extensions |
|||
{ |
|||
public static class DateTimeExtension |
|||
{ |
|||
private static readonly DateTime beginTime = new DateTime(1970, 1, 1, 0, 0, 0, 0); |
|||
|
|||
/// <summary>
|
|||
/// 时间戳转时间
|
|||
/// </summary>
|
|||
/// <param name="timeStamp">时间</param>
|
|||
/// <param name="len13">true:13, false:10</param>
|
|||
/// <returns></returns>
|
|||
[Obsolete] |
|||
public static DateTime StampToDateTime(this long timeStamp) |
|||
{ |
|||
DateTime dt = TimeZone.CurrentTimeZone.ToLocalTime(beginTime); |
|||
return timeStamp.ToString().Length == 13 ? dt.AddMilliseconds(timeStamp) : dt.AddSeconds(timeStamp); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 时间转时间戳
|
|||
/// </summary>
|
|||
/// <param name="time">时间</param>
|
|||
/// <param name="len13">true:13, false:10</param>
|
|||
/// <returns></returns>
|
|||
public static long DateTimeToStamp(this DateTime time, bool len13 = true) |
|||
{ |
|||
TimeSpan ts = time.ToUniversalTime() - beginTime; |
|||
if (len13) |
|||
return Convert.ToInt64(ts.TotalMilliseconds); |
|||
else |
|||
return Convert.ToInt64(ts.TotalSeconds); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 将秒数转换为时分秒形式
|
|||
/// </summary>
|
|||
/// <param name="second"></param>
|
|||
/// <returns></returns>
|
|||
public static string FormatToHHmmss(long second) |
|||
{ |
|||
if (second < 60) |
|||
return $"00:00:{(second >= 10 ? $"{second}" : $"0{second}")}"; |
|||
if (second < 3600) |
|||
{ |
|||
var minute = second / 60; |
|||
var s = second % 60; |
|||
return $"00:{(minute >= 10 ? $"{minute}" : $"0{minute}")}:{(s >= 10 ? $"{s}" : $"0{s}")}"; |
|||
} |
|||
else |
|||
{ |
|||
var hour = second / 3600; |
|||
var minute = (second - (hour * 3600)) / 60; |
|||
var s = (second - ((hour * 3600) + minute * 60)) % 60; |
|||
return $"{(hour >= 10 ? $"{hour}" : $"0{hour}")}:{(minute >= 10 ? $"{minute}" : $"0{minute}")}:{(s >= 10 ? $"{s}" : $"0{s}")}"; |
|||
} |
|||
} |
|||
|
|||
#region SetLocalTime
|
|||
[DllImport("Kernel32.dll")] |
|||
private static extern bool SetLocalTime(ref SYSTEMTIME lpSystemTime); |
|||
|
|||
[StructLayout(LayoutKind.Sequential)] |
|||
private struct SYSTEMTIME |
|||
{ |
|||
public ushort wYear; |
|||
public ushort wMonth; |
|||
public ushort wDayOfWeek; |
|||
public ushort wDay; |
|||
public ushort wHour; |
|||
public ushort wMinute; |
|||
public ushort wSecond; |
|||
public ushort wMilliseconds; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 修改系统时间(需要管理员权限)
|
|||
/// </summary>
|
|||
/// <param name="date"></param>
|
|||
public static void SetSystemTime(DateTime date) |
|||
{ |
|||
SYSTEMTIME lpTime = new SYSTEMTIME(); |
|||
lpTime.wYear = Convert.ToUInt16(date.Year); |
|||
lpTime.wMonth = Convert.ToUInt16(date.Month); |
|||
lpTime.wDayOfWeek = Convert.ToUInt16(date.DayOfWeek); |
|||
lpTime.wDay = Convert.ToUInt16(date.Day); |
|||
DateTime time = date; |
|||
lpTime.wHour = Convert.ToUInt16(time.Hour); |
|||
lpTime.wMinute = Convert.ToUInt16(time.Minute); |
|||
lpTime.wSecond = Convert.ToUInt16(time.Second); |
|||
lpTime.wMilliseconds = Convert.ToUInt16(time.Millisecond); |
|||
var r = SetLocalTime(ref lpTime); |
|||
Console.WriteLine($"修改系统时间 {r}"); |
|||
} |
|||
#endregion
|
|||
} |
|||
} |
@ -0,0 +1,59 @@ |
|||
using AutoMapper; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
|
|||
namespace BBWY.Common.Extensions |
|||
{ |
|||
public static class MapperExtension |
|||
{ |
|||
private static IMapper _mapper; |
|||
|
|||
/// <summary>
|
|||
/// 注册对象映射器
|
|||
/// </summary>
|
|||
/// <param name="services"></param>
|
|||
/// <param name="profile"></param>
|
|||
/// <returns></returns>
|
|||
public static IServiceCollection AddMapper(this IServiceCollection services, Profile profile) |
|||
{ |
|||
var config = new MapperConfiguration(cfg => |
|||
{ |
|||
cfg.AddProfile(profile); |
|||
}); |
|||
_mapper = config.CreateMapper(); |
|||
return services; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 设置对象映射执行者
|
|||
/// </summary>
|
|||
/// <param name="mapper">映射执行者</param>
|
|||
public static void SetMapper(IMapper mapper) |
|||
{ |
|||
_mapper = mapper; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 将对象映射为指定类型
|
|||
/// </summary>
|
|||
/// <typeparam name="TTarget">要映射的目标类型</typeparam>
|
|||
/// <param name="source">源对象</param>
|
|||
/// <returns>目标类型的对象</returns>
|
|||
public static TTarget Map<TTarget>(this object source) |
|||
{ |
|||
return _mapper.Map<TTarget>(source); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 使用源类型的对象更新目标类型的对象
|
|||
/// </summary>
|
|||
/// <typeparam name="TSource">源类型</typeparam>
|
|||
/// <typeparam name="TTarget">目标类型</typeparam>
|
|||
/// <param name="source">源对象</param>
|
|||
/// <param name="target">待更新的目标对象</param>
|
|||
/// <returns>更新后的目标类型对象</returns>
|
|||
public static TTarget Map<TSource, TTarget>(this TSource source, TTarget target) |
|||
{ |
|||
return _mapper.Map(source, target); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,37 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Reflection; |
|||
|
|||
namespace BBWY.Common.Extensions |
|||
{ |
|||
public static class StartupExtension |
|||
{ |
|||
public static void BatchRegisterServices(this IServiceCollection serviceCollection, Assembly[] assemblys, Type baseType, ServiceLifetime serviceLifetime = ServiceLifetime.Singleton, bool registerSelf = true) |
|||
{ |
|||
List<Type> typeList = new List<Type>(); //所有符合注册条件的类集合
|
|||
foreach (var assembly in assemblys) |
|||
{ |
|||
var types = assembly.GetTypes().Where(t => t.IsClass && !t.IsSealed && !t.IsAbstract && baseType.IsAssignableFrom(t)); |
|||
typeList.AddRange(types); |
|||
} |
|||
|
|||
if (typeList.Count() == 0) |
|||
return; |
|||
|
|||
foreach (var instanceType in typeList) |
|||
{ |
|||
if (registerSelf) |
|||
{ |
|||
serviceCollection.Add(new ServiceDescriptor(instanceType, instanceType, serviceLifetime)); |
|||
continue; |
|||
} |
|||
var interfaces = instanceType.GetInterfaces(); |
|||
if (interfaces != null && interfaces.Length > 0) |
|||
foreach (var interfaceType in interfaces) |
|||
serviceCollection.Add(new ServiceDescriptor(interfaceType, instanceType, serviceLifetime)); |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,113 @@ |
|||
using BBWY.Common.Extensions; |
|||
using Newtonsoft.Json; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Net; |
|||
using System.Net.Http; |
|||
using System.Net.Http.Headers; |
|||
using System.Text; |
|||
|
|||
namespace BBWY.Common.Http |
|||
{ |
|||
public class RestApiService |
|||
{ |
|||
public const string ContentType_Json = "application/json"; |
|||
public const string ContentType_Form = "application/x-www-form-urlencoded"; |
|||
public TimeSpan TimeOut { get; set; } = new TimeSpan(0, 0, 20); |
|||
|
|||
private IHttpClientFactory httpClientFactory; |
|||
|
|||
public RestApiService(IHttpClientFactory httpClientFactory) |
|||
{ |
|||
this.httpClientFactory = httpClientFactory; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 发送请求
|
|||
/// </summary>
|
|||
/// <param name="apiHost"></param>
|
|||
/// <param name="apiPath"></param>
|
|||
/// <param name="param"></param>
|
|||
/// <param name="requestHeaders"></param>
|
|||
/// <param name="httpMethod"></param>
|
|||
/// <param name="contentType"></param>
|
|||
/// <param name="paramPosition"></param>
|
|||
/// <param name="enableRandomTimeStamp"></param>
|
|||
/// <param name="getResponseHeader"></param>
|
|||
/// <param name="httpCompletionOption"></param>
|
|||
/// <param name="httpClientName"></param>
|
|||
/// <returns></returns>
|
|||
/// <exception cref="Exception"></exception>
|
|||
public RestApiResult SendRequest(string apiHost, |
|||
string apiPath, |
|||
object param, |
|||
IDictionary<string, string> requestHeaders, |
|||
HttpMethod httpMethod, |
|||
string contentType = ContentType_Json, |
|||
ParamPosition paramPosition = ParamPosition.Body, |
|||
bool enableRandomTimeStamp = false, |
|||
bool getResponseHeader = false, |
|||
HttpCompletionOption httpCompletionOption = HttpCompletionOption.ResponseContentRead, |
|||
string httpClientName = "") |
|||
{ |
|||
//Get和Delete强制使用QueryString形式传参
|
|||
if (httpMethod == HttpMethod.Get) |
|||
paramPosition = ParamPosition.Query; |
|||
|
|||
//拼接Url
|
|||
var url = $"{apiHost}{(apiHost.EndsWith("/") ? string.Empty : "/")}{(apiPath.StartsWith("/") ? apiPath.Substring(1) : apiPath)}"; |
|||
var isCombineParam = false; |
|||
if (paramPosition == ParamPosition.Query && param != null) |
|||
{ |
|||
url = $"{url}{(param.ToString().StartsWith("?") ? string.Empty : "?")}{param}"; |
|||
isCombineParam = true; |
|||
} |
|||
|
|||
//使用时间戳绕过CDN
|
|||
if (enableRandomTimeStamp) |
|||
url = $"{url}{(isCombineParam ? "&" : "?")}t={DateTime.Now.DateTimeToStamp()}"; |
|||
|
|||
using (var httpClient = httpClientFactory.CreateClient()) |
|||
{ |
|||
using (var request = new HttpRequestMessage(httpMethod, url)) |
|||
{ |
|||
if (requestHeaders != null && requestHeaders.Count > 0) |
|||
foreach (var key in requestHeaders.Keys) |
|||
request.Headers.Add(key, requestHeaders[key]); |
|||
|
|||
if (paramPosition == ParamPosition.Body && param != null) |
|||
request.Content = new StringContent(contentType == ContentType_Json ? JsonConvert.SerializeObject(param) : param.ToString(), Encoding.UTF8, contentType); |
|||
|
|||
using (var response = httpClient.SendAsync(request, httpCompletionOption).Result) |
|||
{ |
|||
return new RestApiResult() |
|||
{ |
|||
StatusCode = response.StatusCode, |
|||
Content = httpCompletionOption == HttpCompletionOption.ResponseContentRead ? response.Content.ReadAsStringAsync().Result : |
|||
string.Empty, |
|||
Headers = getResponseHeader ? response.Headers : null |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
public class RestApiResult |
|||
{ |
|||
public HttpStatusCode StatusCode { get; set; } |
|||
|
|||
public string Content { get; set; } |
|||
|
|||
public HttpResponseHeaders Headers { get; set; } |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 参数传递位置
|
|||
/// </summary>
|
|||
public enum ParamPosition |
|||
{ |
|||
Query, |
|||
Body |
|||
} |
|||
} |
@ -0,0 +1,34 @@ |
|||
using System; |
|||
|
|||
namespace BBWY.Common.Models |
|||
{ |
|||
public class ApiResponse<T> |
|||
{ |
|||
public bool Success { get { return Code == 200; } } |
|||
|
|||
/// <summary>
|
|||
/// 接口调用状态
|
|||
/// </summary>
|
|||
public int Code { get; set; } = 200; |
|||
|
|||
/// <summary>
|
|||
/// 返回消息
|
|||
/// </summary>
|
|||
public string Msg { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 数据内容
|
|||
/// </summary>
|
|||
public T Data { get; set; } |
|||
|
|||
public static ApiResponse<T> Error(int code, string msg) |
|||
{ |
|||
return new ApiResponse<T>() { Code = code, Msg = msg }; |
|||
} |
|||
} |
|||
|
|||
public class ApiResponse : ApiResponse<object> |
|||
{ |
|||
|
|||
} |
|||
} |
@ -0,0 +1,22 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace BBWY.Common.Models |
|||
{ |
|||
/// <summary>
|
|||
/// 业务异常
|
|||
/// </summary>
|
|||
public class BusinessException : Exception |
|||
{ |
|||
public BusinessException(string message) : base(message) |
|||
{ |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 错误代码
|
|||
/// </summary>
|
|||
public int Code { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,10 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace BBWY.Common.Models |
|||
{ |
|||
public interface IDenpendency |
|||
{ |
|||
} |
|||
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue