|
|
|
using BBWYB.Client.APIServices;
|
|
|
|
using BBWYB.Client.Helpers;
|
|
|
|
using BBWYB.Client.Models;
|
|
|
|
using BBWYB.Client.Views.PackPurchaseTaska;
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
using CommunityToolkit.Mvvm.Messaging;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
|
namespace BBWYB.Client
|
|
|
|
{
|
|
|
|
|
|
|
|
[ClassInterface(ClassInterfaceType.AutoDual)]
|
|
|
|
[ComVisible(true)]
|
|
|
|
public class GlobalContext : ObservableObject
|
|
|
|
{
|
|
|
|
public GlobalContext()
|
|
|
|
{
|
|
|
|
BBWYBApiVersion = "10038";
|
|
|
|
}
|
|
|
|
|
|
|
|
private User user;
|
|
|
|
|
|
|
|
public User User { get => user; set { SetProperty(ref user, value); } }
|
|
|
|
|
|
|
|
public string UserToken { get; set; }
|
|
|
|
|
|
|
|
public IList<LogisticsResponse> LogisticsResponseList { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// JD客户端
|
|
|
|
/// </summary>
|
|
|
|
//public IJdClient JdClient { get; set; }
|
|
|
|
|
|
|
|
#region APIHost
|
|
|
|
public string BBWYApiHost { get; set; }
|
|
|
|
|
|
|
|
public string MDSApiHost { get; set; }
|
|
|
|
public string BBWYCApiHost { get; set; }
|
|
|
|
public string QKApiHost { get; set; }
|
|
|
|
|
|
|
|
public string BBWYBApiVersion { get; set; }
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region Web
|
|
|
|
public string GetUserString()
|
|
|
|
{
|
|
|
|
return JsonConvert.SerializeObject(User);
|
|
|
|
}
|
|
|
|
|
|
|
|
public string GetClientApiVersion()
|
|
|
|
{
|
|
|
|
return BBWYBApiVersion;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void CallALiWangWang(string sellerLoginId)
|
|
|
|
{
|
|
|
|
var url = $"aliim:sendmsg?siteid=cnalichn&portalId=&gid=&itemsId=&touid=cnalichn{sellerLoginId}&status=1";
|
|
|
|
try
|
|
|
|
{
|
|
|
|
//Process.Start("explorer.exe", url);
|
|
|
|
ShellExecuteHelper.ShellExecute(IntPtr.Zero, "open", url, string.Empty, string.Empty, ShellExecuteHelper.ShowCommands.SW_SHOWNORMAL);
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Clipboard.SetText(url);
|
|
|
|
}
|
|
|
|
catch { }
|
|
|
|
MessageBox.Show($"{ex.Message}\r\n唤醒旺旺失败,唤醒链接已复制到剪切板,请手动打开浏览器唤醒", "提示");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 对web版提供的修改打包任务方法
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="belongSkuId">订单sku归属的来源sku(JD)</param>
|
|
|
|
/// <param name="orderId">订单Id</param>
|
|
|
|
/// <param name="skuLogo">sku图片</param>
|
|
|
|
/// <param name="skuTitle">sku标题</param>
|
|
|
|
/// <param name="originShopName">订单来源店铺名称</param>
|
|
|
|
public void OpenUpdatePurchaseTask(string belongSkuId, string orderId, string skuLogo, string skuTitle, string originShopName)
|
|
|
|
{
|
|
|
|
var app = App.Current as App;
|
|
|
|
var sp = app.ServiceProvider;
|
|
|
|
|
|
|
|
PackPurchaseTaskService packPurchaseTaskService = null;
|
|
|
|
using (var s = sp.CreateScope())
|
|
|
|
{
|
|
|
|
packPurchaseTaskService = s.ServiceProvider.GetRequiredService<PackPurchaseTaskService>();
|
|
|
|
}
|
|
|
|
|
|
|
|
var orderSku = new OrderSku()
|
|
|
|
{
|
|
|
|
OrderId = orderId,
|
|
|
|
BelongSkuId = belongSkuId,
|
|
|
|
Title = skuTitle,
|
|
|
|
Logo = skuLogo,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
var res = packPurchaseTaskService.GetOrderTask(orderSku.BelongSkuId, orderSku.OrderId);
|
|
|
|
if (res == null || !res.Success)
|
|
|
|
{
|
|
|
|
MessageBox.Show("网络异常!查不到任务");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (res.Data == null)
|
|
|
|
{
|
|
|
|
MessageBox.Show("打包任务,不存在或已被删除,请重新发起任务!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
UpdatePurchaseTaskWindow packTask = new(res.Data, originShopName, orderSku);
|
|
|
|
if (!packTask.IsClosed)
|
|
|
|
packTask.Show();
|
|
|
|
//
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|