21 changed files with 584 additions and 32 deletions
@ -0,0 +1,31 @@ |
|||||
|
using BBWY.Client.Models; |
||||
|
using BBWY.Common.Http; |
||||
|
using BBWY.Common.Models; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Net.Http; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace BBWY.Client.APIServices |
||||
|
{ |
||||
|
public class ShopService : BaseApiService, IDenpendency |
||||
|
{ |
||||
|
public ShopService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) { } |
||||
|
|
||||
|
public ApiResponse<long> SaveShopSetting(long shopId, string managerPwd, decimal platformCommissionRatio, PurchaseAccount purchaseAccount) |
||||
|
{ |
||||
|
return SendRequest<long>(globalContext.BBYWApiHost, "api/vender/SaveShopSetting", new |
||||
|
{ |
||||
|
shopId, |
||||
|
managerPwd, |
||||
|
platformCommissionRatio, |
||||
|
PurchaseAccountId = purchaseAccount.Id, |
||||
|
purchaseAccount.AccountName, |
||||
|
purchaseAccount.AppKey, |
||||
|
purchaseAccount.AppSecret, |
||||
|
purchaseAccount.AppToken, |
||||
|
purchaseAccount.PurchasePlatformId |
||||
|
}, null, HttpMethod.Post); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,76 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace BBWY.Client.Models |
||||
|
{ |
||||
|
public class ExportOrderResponse |
||||
|
{ |
||||
|
public string OrderId { get; set; } |
||||
|
|
||||
|
public DateTime OrderStartTime { get; set; } |
||||
|
|
||||
|
public string SkuIds { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 代发订单号
|
||||
|
/// </summary>
|
||||
|
public string PurchaseOrderIds { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 订单总额
|
||||
|
/// </summary>
|
||||
|
public decimal OrderTotalPrice { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购金额
|
||||
|
/// </summary>
|
||||
|
public decimal PurchaseSkuAmount { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 头程费用
|
||||
|
/// </summary>
|
||||
|
public decimal FirstFreight { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 仓储费
|
||||
|
/// </summary>
|
||||
|
public decimal StorageAmount { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 发货快递费
|
||||
|
/// </summary>
|
||||
|
public decimal DeliveryExpressFreight { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 平台扣点金额
|
||||
|
/// </summary>
|
||||
|
public decimal PlatformCommissionAmount { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 补差金额(用户支付)
|
||||
|
/// </summary>
|
||||
|
public decimal FreightPrice { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 总成本
|
||||
|
/// </summary>
|
||||
|
public decimal TotalCost { get; set; } |
||||
|
|
||||
|
public decimal Profit { get; set; } |
||||
|
|
||||
|
public decimal ProfitRatio { get; set; } |
||||
|
|
||||
|
public string ConsigneeStr { get; set; } |
||||
|
|
||||
|
public StorageType? StorageType { get; set; } |
||||
|
|
||||
|
public OrderState OrderState { get; set; } |
||||
|
|
||||
|
public override string ToString() |
||||
|
{ |
||||
|
//日期,店铺订单号,SKU编码,代发下单单号,售价,采购金额,头程费用,仓储服务费,快递费,平台扣点,补差金额,利润,利润率,收件人联系方式
|
||||
|
return $"{OrderStartTime:yyyy-MM-dd HH:mm:ss},{OrderId},{SkuIds},{PurchaseOrderIds},{OrderTotalPrice},{PurchaseSkuAmount},{FirstFreight},{StorageAmount},{DeliveryExpressFreight},{PlatformCommissionAmount},{FreightPrice},{Profit},{ProfitRatio},{ConsigneeStr}"; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
namespace BBWY.Client.Models |
||||
|
{ |
||||
|
public class PurchaseAccountResponse |
||||
|
{ |
||||
|
public long Id { get; set; } |
||||
|
|
||||
|
public string AccountName { get; set; } |
||||
|
|
||||
|
public long ShopId { get; set; } |
||||
|
|
||||
|
public Platform PurchasePlatformId { get; set; } |
||||
|
|
||||
|
public string AppKey { get; set; } |
||||
|
|
||||
|
public string AppSecret { get; set; } |
||||
|
|
||||
|
public string AppToken { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
using System; |
||||
|
|
||||
|
namespace BBWY.Client.Models |
||||
|
{ |
||||
|
public class PurchaseAccount : NotifyObject,ICloneable |
||||
|
{ |
||||
|
private string accountName; |
||||
|
private Platform purchasePlatformId; |
||||
|
private string appKey; |
||||
|
private string appSecret; |
||||
|
private string appToken; |
||||
|
|
||||
|
public long Id { get; set; } |
||||
|
|
||||
|
public long ShopId { get; set; } |
||||
|
public string AccountName { get => accountName; set { Set(ref accountName, value); } } |
||||
|
public Platform PurchasePlatformId { get => purchasePlatformId; set { Set(ref purchasePlatformId, value); } } |
||||
|
public string AppKey { get => appKey; set { Set(ref appKey, value); } } |
||||
|
public string AppSecret { get => appSecret; set { Set(ref appSecret, value); } } |
||||
|
public string AppToken { get => appToken; set { Set(ref appToken, value); } } |
||||
|
|
||||
|
public object Clone() |
||||
|
{ |
||||
|
return this.MemberwiseClone(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,64 @@ |
|||||
|
using BBWY.Client.APIServices; |
||||
|
using BBWY.Client.Models; |
||||
|
using BBWY.Common.Models; |
||||
|
using GalaSoft.MvvmLight.Command; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using System.Windows; |
||||
|
using System.Windows.Input; |
||||
|
|
||||
|
namespace BBWY.Client.ViewModels |
||||
|
{ |
||||
|
public class ShopSettingViewModel : BaseVM, IDenpendency |
||||
|
{ |
||||
|
private bool isLoading; |
||||
|
private GlobalContext globalContext; |
||||
|
private ShopService shopService; |
||||
|
private PurchaseAccount purchaseAccount; |
||||
|
public PurchaseAccount PurchaseAccount { get => purchaseAccount; set { Set(ref purchaseAccount, value); } } |
||||
|
|
||||
|
public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } |
||||
|
public ICommand SaveCommand { get; set; } |
||||
|
|
||||
|
public ShopSettingViewModel(GlobalContext globalContext, ShopService shopService) |
||||
|
{ |
||||
|
this.globalContext = globalContext; |
||||
|
this.shopService = shopService; |
||||
|
SaveCommand = new RelayCommand(Save); |
||||
|
} |
||||
|
|
||||
|
protected override void Load() |
||||
|
{ |
||||
|
this.PurchaseAccount = globalContext.User.Shop.PurchaseAccountList == null || globalContext.User.Shop.PurchaseAccountList.Count() == 0 ? |
||||
|
new PurchaseAccount() : |
||||
|
globalContext.User.Shop.PurchaseAccountList[0].Clone() as PurchaseAccount; |
||||
|
} |
||||
|
|
||||
|
protected override void Unload() |
||||
|
{ |
||||
|
this.PurchaseAccount = null; |
||||
|
} |
||||
|
|
||||
|
private void Save() |
||||
|
{ |
||||
|
IsLoading = true; |
||||
|
Task.Factory.StartNew(() => shopService.SaveShopSetting(globalContext.User.Shop.ShopId, "", 0, PurchaseAccount)).ContinueWith(r => |
||||
|
{ |
||||
|
IsLoading = false; |
||||
|
var response = r.Result; |
||||
|
if (!response.Success) |
||||
|
{ |
||||
|
App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "保存店铺设置")); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (globalContext.User.Shop.PurchaseAccountList == null) |
||||
|
globalContext.User.Shop.PurchaseAccountList = new List<PurchaseAccount>(); |
||||
|
globalContext.User.Shop.PurchaseAccountList.Clear(); |
||||
|
PurchaseAccount.Id = response.Data; |
||||
|
globalContext.User.Shop.PurchaseAccountList.Add(PurchaseAccount); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace BBWY.Server.Business |
||||
|
{ |
||||
|
public class FreeSqlMultiDBManager |
||||
|
{ |
||||
|
public IFreeSql BBWYfsql { get; set; } |
||||
|
public IFreeSql MDSfsql { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,60 @@ |
|||||
|
using FreeSql.DataAnnotations; |
||||
|
using System; |
||||
|
|
||||
|
namespace BBWY.Server.Model.Db.Mds |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购账号表
|
||||
|
/// </summary>
|
||||
|
[Table(Name = "purchaseaccount", DisableSyncStructure = true)] |
||||
|
public partial class Purchaseaccount { |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 主键
|
||||
|
/// </summary>
|
||||
|
[Column(StringLength = 50, IsPrimary = true, IsNullable = false)] |
||||
|
public string Id { get; set; } |
||||
|
|
||||
|
|
||||
|
public string AccountName { get; set; } |
||||
|
|
||||
|
|
||||
|
public string AppKey { get; set; } |
||||
|
|
||||
|
|
||||
|
public string AppSecret { get; set; } |
||||
|
|
||||
|
|
||||
|
public string AppToken { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建时间
|
||||
|
/// </summary>
|
||||
|
[Column(DbType = "datetime")] |
||||
|
public DateTime CreateTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建人Id
|
||||
|
/// </summary>
|
||||
|
[Column(StringLength = 50)] |
||||
|
public string CreatorId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 否已删除
|
||||
|
/// </summary>
|
||||
|
[Column(DbType = "tinyint(4)")] |
||||
|
public sbyte Deleted { get; set; } |
||||
|
|
||||
|
[Column(StringLength = 50)] |
||||
|
public string PurchasePlatformId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购账号归属店铺ID
|
||||
|
/// </summary>
|
||||
|
[Column(StringLength = 50)] |
||||
|
public string ShopId { get; set; } |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,2 @@ |
|||||
|
|
||||
|
FreeSql.Generator -Razor 1 -NameOptions 1,0,0,0 -NameSpace BBWY.Server.Model.Db -DB "MySql,data source=rm-bp1508okrh23710yfao.mysql.rds.aliyuncs.com;port=3306;user id=qyroot;password=kaicn1132+-;initial catalog=mds;charset=utf8;sslmode=none;" -FileName "{name}.cs" |
@ -0,0 +1,34 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace BBWY.Server.Model.Dto |
||||
|
{ |
||||
|
public class ShopSettingRequest |
||||
|
{ |
||||
|
public long ShopId { get; set; } |
||||
|
|
||||
|
public string ManagerPwd { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 平台扣点
|
||||
|
/// </summary>
|
||||
|
public decimal PlatformCommissionRatio { get; set; } |
||||
|
|
||||
|
public long PurchaseAccountId { get; set; } |
||||
|
|
||||
|
|
||||
|
public string AccountName { get; set; } |
||||
|
|
||||
|
|
||||
|
public string AppKey { get; set; } |
||||
|
|
||||
|
|
||||
|
public string AppSecret { get; set; } |
||||
|
|
||||
|
|
||||
|
public string AppToken { get; set; } |
||||
|
|
||||
|
public Enums.Platform PurchasePlatformId { get; set; } |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue