871 lines
36 KiB
C#
871 lines
36 KiB
C#
using AllBase.Helper;
|
||
using AllBase.Model.MvvmBaseClasses;
|
||
using NaiBa.Util.Extension;
|
||
using Newtonsoft.Json.Linq;
|
||
using NPOI.SS.Formula.Functions;
|
||
using Org.BouncyCastle.Asn1.Mozilla;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Runtime.CompilerServices;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using System.Windows;
|
||
using System.Windows.Media;
|
||
|
||
namespace AllBase.Model.DBModel
|
||
{
|
||
public class oms_wei_order_item_info : PropertyNotifyObject
|
||
{
|
||
public ShopLoginInfo Shop
|
||
{
|
||
get { return this.GetValue(x => x.Shop); }
|
||
set { this.SetValue(x => x.Shop, value); }
|
||
}
|
||
public oms_wei_order_info ItemOrder
|
||
{
|
||
get { return this.GetValue(x => x.ItemOrder); }
|
||
set { this.SetValue(x => x.ItemOrder, value); }
|
||
}
|
||
public oms_wei_refund_info ItemRefund
|
||
{
|
||
get { return this.GetValue(x => x.ItemRefund); }
|
||
set { this.SetValue(x => x.ItemRefund, value); }
|
||
}
|
||
public void SetItemRefund(List<oms_wei_refund_info> itemRefunds)
|
||
{
|
||
if (itemRefunds?.Count == 1)
|
||
ItemRefund = ItemOrder?.refundItems?.FirstOrDefault();
|
||
else
|
||
ItemRefund = ItemOrder?.refundItems?.FirstOrDefault(r => r.sku_id == this.sku_id);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 采购关联
|
||
/// </summary>
|
||
public WXBuyMapInfo BuyMap
|
||
{
|
||
get { return this.GetValue(x => x.BuyMap); }
|
||
set { this.SetValue(x => x.BuyMap, value); }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 采购按钮文字
|
||
/// </summary>
|
||
public string BuyGoodsBtnTxt
|
||
{
|
||
get { return this.GetValue(x => x.BuyGoodsBtnTxt); }
|
||
set { this.SetValue(x => x.BuyGoodsBtnTxt, value); }
|
||
}
|
||
/// <summary>
|
||
/// 采购按钮颜色
|
||
/// </summary>
|
||
public SolidColorBrush BuyGoodsBtnColor
|
||
{
|
||
get { return this.GetValue(x => x.BuyGoodsBtnColor); }
|
||
set { this.SetValue(x => x.BuyGoodsBtnColor, value); }
|
||
}
|
||
/// <summary>
|
||
/// 采购按钮背景颜色
|
||
/// </summary>
|
||
public SolidColorBrush BuyGoodsBtnBackColor
|
||
{
|
||
get { return this.GetValue(x => x.BuyGoodsBtnBackColor); }
|
||
set { this.SetValue(x => x.BuyGoodsBtnBackColor, value); }
|
||
}
|
||
public bool IsBuyGoodsBtnEnabled
|
||
{
|
||
get { return this.GetValue(x => x.IsBuyGoodsBtnEnabled); }
|
||
set { this.SetValue(x => x.IsBuyGoodsBtnEnabled, value); }
|
||
}
|
||
|
||
public List<oms_wei_external_procurement_log_info> ItemTransitOrders { get; set; } = new List<oms_wei_external_procurement_log_info>();
|
||
/// <summary>
|
||
/// 当前仓库订单(不可以是作废单)
|
||
/// </summary>
|
||
public oms_wei_external_procurement_log_info ItemTransitOrder
|
||
{
|
||
get { return ItemTransitOrders.FirstOrDefault(t => t.order_void_status != 1); }
|
||
set { }
|
||
}
|
||
/// <summary>
|
||
/// 当前仓库订单(可以是作废单)
|
||
/// </summary>
|
||
public oms_wei_external_procurement_log_info ItemTransitOrderWithVoid
|
||
{
|
||
get { return ItemTransitOrders.FirstOrDefault(); }
|
||
set { }
|
||
}
|
||
|
||
public List<order_pdd_buyer_order> PddBuyerOrders { get; set; } = new List<order_pdd_buyer_order>();
|
||
public order_pdd_buyer_order PddBuyerOrder
|
||
{
|
||
get { return PddBuyerOrders.FirstOrDefault(); }
|
||
set { }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 拍单物流
|
||
/// </summary>
|
||
public string TransitOrderWaybillToWareHouseStr
|
||
{
|
||
get
|
||
{
|
||
// 直接取号和更正取号
|
||
if (ItemTransitOrder?.pre_allocated_order_no != 1 && ItemTransitOrder?.pre_allocated_order_no != 3)
|
||
return null;
|
||
return "买手物流:" + ItemTransitOrder.express_1_company + "-" + ItemTransitOrder.express_1_waybill;
|
||
}
|
||
set { }
|
||
}
|
||
/// <summary>
|
||
/// 提前取号物流
|
||
/// </summary>
|
||
public string TransitOrderWaybillFakeStr
|
||
{
|
||
get
|
||
{
|
||
// 提前取号
|
||
if (ItemTransitOrder?.pre_allocated_order_no != 2)
|
||
return null;
|
||
return "取号物流:" + ItemTransitOrder.express_1_company + "-" + ItemTransitOrder.express_1_waybill;
|
||
}
|
||
set { }
|
||
}
|
||
/// <summary>
|
||
/// 仓库物流
|
||
/// </summary>
|
||
public string TransitOrderWaybillFromWareHouseStr
|
||
{
|
||
get
|
||
{
|
||
// 仓库下游物流
|
||
if (ItemTransitOrder == null || ItemTransitOrder.express_2_company.IsNullOrEmpty() || ItemTransitOrder.express_2_waybill.IsNullOrEmpty())
|
||
return null;
|
||
return "仓库物流:" + ItemTransitOrder.express_2_company + "-" + ItemTransitOrder.express_2_waybill;
|
||
}
|
||
set { }
|
||
}
|
||
public string BuyerTransitWaybillStatusStr
|
||
{
|
||
get
|
||
{
|
||
if (PddBuyerOrder?.wx_order_id == "3737683253753151488")
|
||
{
|
||
}
|
||
|
||
string refund_status = (ItemTransitOrderWithVoid?.refund_status).ParseToString();
|
||
|
||
//if ((PddBuyerOrder?.order_status_prompt).ParseToString().Contains("退款成功"))
|
||
//{
|
||
// return "买手已退款";
|
||
//}
|
||
//else if (refund_status.Contains("退款成功"))
|
||
//{
|
||
// return "买手已退款";
|
||
//}
|
||
|
||
// 已到中转仓的或者中转仓已正式发出的,买手(仓上游)状态显示为已到中转仓
|
||
if (ItemTransitOrderWithVoid?.warehouse_status == 1 || ItemTransitOrderWithVoid?.warehouse_status == 2)
|
||
{
|
||
return "已到中转仓";
|
||
}
|
||
// 拼多多买手状态为已签收的,为已到中转仓
|
||
else if ((PddBuyerOrder?.order_status_prompt).ParseToString().Contains("已签收"))
|
||
{
|
||
return "已到中转仓";
|
||
}
|
||
// 售后待用户退回商品的,至少为买手已发货
|
||
else if ((PddBuyerOrder?.order_status_prompt).ParseToString().Contains("待用户退回商品"))
|
||
{
|
||
return "买手已发货";
|
||
}
|
||
else if ((PddBuyerOrder?.order_status_prompt).ParseToString().Contains("待收货"))
|
||
{
|
||
return "买手已发货";
|
||
}
|
||
// 有退款还没完成的,至少为买手已发货
|
||
if (!refund_status.Contains("退款成功") && refund_status.Length > 0)
|
||
{
|
||
return "买手已发货";
|
||
}
|
||
// 正式取号或者取号更正的,可认定买手已发货
|
||
if (ItemTransitOrderWithVoid?.pre_allocated_order_no == 1 || ItemTransitOrderWithVoid?.pre_allocated_order_no == 3)
|
||
return "买手已发货";
|
||
if (ItemTransitOrderWithVoid != null)
|
||
return "买手未发货";
|
||
return "";
|
||
}
|
||
set { }
|
||
}
|
||
public SolidColorBrush BuyerTransitWaybillStatusStrColor
|
||
{
|
||
get
|
||
{
|
||
if (BuyerTransitWaybillStatusStr.StartsWith("买手已退款"))
|
||
return new SolidColorBrush(Color.FromRgb(152, 96, 143));
|
||
if (BuyerTransitWaybillStatusStr.StartsWith("已到中转仓"))
|
||
return new SolidColorBrush(Color.FromRgb(19, 206, 102));
|
||
if (BuyerTransitWaybillStatusStr.StartsWith("买手已发货"))
|
||
return new SolidColorBrush(Color.FromRgb(255, 186, 0));
|
||
if (BuyerTransitWaybillStatusStr.StartsWith("买手未发货"))
|
||
return new SolidColorBrush(Color.FromRgb(255, 73, 73));
|
||
return new SolidColorBrush(Color.FromRgb(255, 73, 73));
|
||
}
|
||
set { }
|
||
}
|
||
public SolidColorBrush BuyerTransitWaybillStatusBorderColor
|
||
{
|
||
get
|
||
{
|
||
if (BuyerTransitWaybillStatusStr.StartsWith("买手已退款"))
|
||
return new SolidColorBrush(Color.FromArgb(75, 152, 96, 143));
|
||
if (BuyerTransitWaybillStatusStr.StartsWith("已到中转仓"))
|
||
return new SolidColorBrush(Color.FromRgb(208, 245, 224));
|
||
if (BuyerTransitWaybillStatusStr.StartsWith("买手已发货"))
|
||
return new SolidColorBrush(Color.FromRgb(255, 241, 204));
|
||
if (BuyerTransitWaybillStatusStr.StartsWith("买手未发货"))
|
||
return new SolidColorBrush(Color.FromRgb(255, 219, 219));
|
||
return new SolidColorBrush(Color.FromRgb(255, 219, 219));
|
||
}
|
||
set { }
|
||
}
|
||
public SolidColorBrush BuyerTransitWaybillStatusBackColor
|
||
{
|
||
get
|
||
{
|
||
if (BuyerTransitWaybillStatusStr.StartsWith("买手已退款"))
|
||
return new SolidColorBrush(Color.FromArgb(35, 152, 96, 143));
|
||
if (BuyerTransitWaybillStatusStr.StartsWith("已到中转仓"))
|
||
return new SolidColorBrush(Color.FromRgb(231, 250, 240));
|
||
if (BuyerTransitWaybillStatusStr.StartsWith("买手已发货"))
|
||
return new SolidColorBrush(Color.FromRgb(255, 248, 230));
|
||
if (BuyerTransitWaybillStatusStr.StartsWith("买手未发货"))
|
||
return new SolidColorBrush(Color.FromRgb(255, 237, 237));
|
||
return new SolidColorBrush(Color.FromRgb(255, 237, 237));
|
||
}
|
||
set { }
|
||
}
|
||
|
||
public string WarehouseWaybillStatusStr
|
||
{
|
||
get
|
||
{
|
||
if (ItemTransitOrderWithVoid == null)
|
||
return "";
|
||
|
||
if (ItemTransitOrderWithVoid.raw_message.ParseToString().Contains("取号异常"))
|
||
{
|
||
if (ItemTransitOrderWithVoid.raw_message.Contains("超出派送范围"))
|
||
return "取号异常-超出派送范围";
|
||
else
|
||
return "取号异常";
|
||
}
|
||
|
||
if (ItemTransitOrderWithVoid?.warehouse_status == 2)
|
||
return "中转已出库";
|
||
// 老订单还用之前的逻辑判断
|
||
if (ItemTransitOrderWithVoid?.created_time < new DateTime(2026, 7, 14) && (ItemTransitOrderWithVoid?.pre_allocated_order_no == 1 || ItemTransitOrderWithVoid?.pre_allocated_order_no == 3) && !ItemTransitOrderWithVoid.express_2_company.IsNullOrEmpty() && !ItemTransitOrderWithVoid.express_2_waybill.IsNullOrEmpty())
|
||
//return "中转已出库*";
|
||
return "中转已出库";
|
||
if (ItemTransitOrderWithVoid?.warehouse_status == 1)
|
||
return "中转已入库";
|
||
//if ((ItemTransitOrderWithVoid?.pre_allocated_order_no == 1 || ItemTransitOrderWithVoid?.pre_allocated_order_no == 3) && !ItemTransitOrderWithVoid.express_2_company.IsNullOrEmpty() && !ItemTransitOrderWithVoid.express_2_waybill.IsNullOrEmpty())
|
||
// return "中转已发货";
|
||
//if (ItemTransitOrderWithVoid?.pre_allocated_order_no == 1 || ItemTransitOrderWithVoid?.pre_allocated_order_no == 3)
|
||
// return "中转待发货";
|
||
if (ItemTransitOrderWithVoid?.pre_allocated_order_no == 1 || ItemTransitOrderWithVoid?.pre_allocated_order_no == 3)
|
||
return "中转已取号";
|
||
if (ItemTransitOrderWithVoid?.pre_allocated_order_no == 2)
|
||
return "中转提前取号";
|
||
|
||
//if (ItemTransitOrderWithVoid?.order_void_status == 2)
|
||
// return "中转作废失败";
|
||
//if (ItemTransitOrderWithVoid?.order_void_status == 1)
|
||
// return "中转已作废";
|
||
|
||
if (ItemTransitOrderWithVoid?.pre_allocated_order_no == 0)
|
||
return "中转待取号";
|
||
return "";
|
||
}
|
||
set { }
|
||
}
|
||
public SolidColorBrush WarehouseWaybillStatusStrColor
|
||
{
|
||
get
|
||
{
|
||
//if (WarehouseWaybillStatusStr.StartsWith("中转已作废"))
|
||
// return new SolidColorBrush(Color.FromRgb(152, 96, 143));
|
||
if (WarehouseWaybillStatusStr.StartsWith("中转已出库"))
|
||
return new SolidColorBrush(Color.FromRgb(19, 206, 102));
|
||
if (WarehouseWaybillStatusStr.StartsWith("中转已入库") || WarehouseWaybillStatusStr.StartsWith("中转已取号") || WarehouseWaybillStatusStr.StartsWith("中转提前取号"))
|
||
return new SolidColorBrush(Color.FromRgb(255, 186, 0));
|
||
if (WarehouseWaybillStatusStr.StartsWith("中转待取号"))
|
||
return new SolidColorBrush(Color.FromRgb(255, 73, 73));
|
||
return new SolidColorBrush(Color.FromRgb(255, 73, 73));
|
||
}
|
||
set { }
|
||
}
|
||
public SolidColorBrush WarehouseWaybillStatusBorderColor
|
||
{
|
||
get
|
||
{
|
||
//if (WarehouseWaybillStatusStr.StartsWith("中转已作废"))
|
||
// return new SolidColorBrush(Color.FromArgb(75, 152, 96, 143));
|
||
if (WarehouseWaybillStatusStr.StartsWith("中转已出库"))
|
||
return new SolidColorBrush(Color.FromRgb(208, 245, 224));
|
||
if (WarehouseWaybillStatusStr.StartsWith("中转已入库") || WarehouseWaybillStatusStr.StartsWith("中转已取号") || WarehouseWaybillStatusStr.StartsWith("中转提前取号"))
|
||
return new SolidColorBrush(Color.FromRgb(255, 241, 204));
|
||
if (WarehouseWaybillStatusStr.StartsWith("中转待取号"))
|
||
return new SolidColorBrush(Color.FromRgb(255, 219, 219));
|
||
return new SolidColorBrush(Color.FromRgb(255, 219, 219));
|
||
}
|
||
set { }
|
||
}
|
||
public SolidColorBrush WarehouseWaybillStatusBackColor
|
||
{
|
||
get
|
||
{
|
||
//if (WarehouseWaybillStatusStr.StartsWith("中转已作废"))
|
||
// return new SolidColorBrush(Color.FromArgb(35, 152, 96, 143));
|
||
if (WarehouseWaybillStatusStr.StartsWith("中转已出库"))
|
||
return new SolidColorBrush(Color.FromRgb(231, 250, 240));
|
||
if (WarehouseWaybillStatusStr.StartsWith("中转已入库") || WarehouseWaybillStatusStr.StartsWith("中转已取号") || WarehouseWaybillStatusStr.StartsWith("中转提前取号"))
|
||
return new SolidColorBrush(Color.FromRgb(255, 248, 230));
|
||
if (WarehouseWaybillStatusStr.StartsWith("中转待取号"))
|
||
return new SolidColorBrush(Color.FromRgb(255, 237, 237));
|
||
return new SolidColorBrush(Color.FromRgb(255, 237, 237));
|
||
}
|
||
set { }
|
||
}
|
||
/// <summary>
|
||
/// 中转仓表买手售后字段文字显示
|
||
/// </summary>
|
||
public string TransitRefundStatusStr
|
||
{
|
||
get
|
||
{
|
||
if (!string.IsNullOrEmpty(ItemTransitOrderWithVoid?.refund_status))
|
||
{
|
||
if (!ItemTransitOrderWithVoid.refund_status.Contains("需手动申请售后"))
|
||
return "已申请售后 " + ItemTransitOrderWithVoid.refund_status.Replace("申请收到,", "");
|
||
return ItemTransitOrderWithVoid.refund_status;
|
||
}
|
||
return "";
|
||
}
|
||
set { }
|
||
}
|
||
/// <summary>
|
||
/// 中转仓表买手售后字段文字显示背景颜色
|
||
/// </summary>
|
||
public SolidColorBrush TransitRefundStatusBackColor
|
||
{
|
||
get
|
||
{
|
||
if (TransitRefundStatusStr.Contains("退款成功"))
|
||
return new SolidColorBrush(Color.FromRgb(19, 206, 102));
|
||
if (TransitRefundStatusStr.Contains("需手动申请售后"))
|
||
return new SolidColorBrush(Color.FromRgb(255, 73, 73));
|
||
//return new SolidColorBrush(Color.FromRgb(255, 186, 0));
|
||
return new SolidColorBrush(Color.FromRgb(255, 155, 0));
|
||
}
|
||
set { }
|
||
}
|
||
public string TransitRefundVoidStatusStr
|
||
{
|
||
get
|
||
{
|
||
//if (ItemTransitOrderWithVoid?.order_void_status == 2)
|
||
// return "中转作废失败";
|
||
if (ItemTransitOrderWithVoid?.order_void_status == 1)
|
||
return "中转已作废";
|
||
return "";
|
||
}
|
||
set { }
|
||
}
|
||
|
||
|
||
// 仓库采购时间是否达标字段
|
||
public string OutOrderTimeQualifiedStr
|
||
{
|
||
get
|
||
{
|
||
if (ItemTransitOrderWithVoid == null)
|
||
return "";
|
||
|
||
if (ItemOrder.createDateTime == null)
|
||
ItemOrder.createDateTime = BaseClass.StampToDateTime(ItemOrder.create_time);
|
||
|
||
string timeStr = "采购时间:" + ItemTransitOrderWithVoid.created_time.ToString("yyyy-MM-dd HH:mm:ss");
|
||
if (ItemOrder.createDateTime.Value.Date != ItemTransitOrderWithVoid.created_time.Date && ItemTransitOrderWithVoid.created_time > ItemTransitOrderWithVoid.created_time.Date.AddHours(1.5))
|
||
return timeStr + " ×";
|
||
return timeStr + " √";
|
||
}
|
||
set { }
|
||
}
|
||
/// <summary>
|
||
/// 仓库采购时间是否达标字段
|
||
/// </summary>
|
||
public SolidColorBrush OutOrderTimeQualifiedBrush
|
||
{
|
||
get
|
||
{
|
||
return OutOrderTimeQualifiedStr.EndsWith("√") ? new SolidColorBrush(Color.FromRgb(103, 194, 58)) : new SolidColorBrush(Color.FromRgb(250, 71, 51));
|
||
}
|
||
}
|
||
|
||
|
||
public string OrderItemStatusStr
|
||
{
|
||
get
|
||
{
|
||
if (ItemOrder?.status == 10)
|
||
return "待付款";
|
||
if (ItemOrder?.status == 20)
|
||
return "待店铺发货";
|
||
if (ItemOrder?.status == 21)
|
||
return "店铺部分发货";
|
||
if (ItemOrder?.status == 30)
|
||
return "待买家收货";
|
||
if (ItemOrder?.status == 100)
|
||
return "订单完成";
|
||
if (ItemOrder?.status == 200)
|
||
return "售后完成订单取消";
|
||
if (ItemOrder?.status == 250)
|
||
return "未付款已取消";
|
||
return "未知状态";
|
||
}
|
||
set { }
|
||
}
|
||
public SolidColorBrush OrderItemStatusStrColor
|
||
{
|
||
get
|
||
{
|
||
if ("未知状态,未付款已取消,售后完成订单取消".Contains(OrderItemStatusStr))
|
||
return new SolidColorBrush(Color.FromRgb(255, 73, 73));
|
||
if ("订单完成".Contains(OrderItemStatusStr))
|
||
return new SolidColorBrush(Color.FromRgb(19, 206, 102));
|
||
if ("待买家收货,店铺部分发货,待店铺发货,待付款".Contains(OrderItemStatusStr))
|
||
return new SolidColorBrush(Color.FromRgb(255, 186, 0));
|
||
return new SolidColorBrush(Color.FromRgb(255, 186, 0));
|
||
}
|
||
set { }
|
||
}
|
||
public SolidColorBrush OrderItemStatusBorderColor
|
||
{
|
||
get
|
||
{
|
||
if ("未知状态,未付款已取消,售后完成订单取消".Contains(OrderItemStatusStr))
|
||
return new SolidColorBrush(Color.FromRgb(255, 219, 219));
|
||
if ("订单完成".Contains(OrderItemStatusStr))
|
||
return new SolidColorBrush(Color.FromRgb(208, 245, 224));
|
||
if ("待买家收货,店铺部分发货,待店铺发货,待付款".Contains(OrderItemStatusStr))
|
||
return new SolidColorBrush(Color.FromRgb(255, 241, 204));
|
||
return new SolidColorBrush(Color.FromRgb(255, 241, 204));
|
||
}
|
||
set { }
|
||
}
|
||
public SolidColorBrush OrderItemStatusBackColor
|
||
{
|
||
get
|
||
{
|
||
if ("未知状态,未付款已取消,售后完成订单取消".Contains(OrderItemStatusStr))
|
||
return new SolidColorBrush(Color.FromRgb(255, 237, 237));
|
||
if ("订单完成".Contains(OrderItemStatusStr))
|
||
return new SolidColorBrush(Color.FromRgb(231, 250, 240));
|
||
if ("待买家收货,店铺部分发货,待店铺发货,待付款".Contains(OrderItemStatusStr))
|
||
return new SolidColorBrush(Color.FromRgb(255, 248, 230));
|
||
return new SolidColorBrush(Color.FromRgb(255, 248, 230));
|
||
}
|
||
set { }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 退款状态文本
|
||
/// </summary>
|
||
public string refundResultStr
|
||
{
|
||
get
|
||
{
|
||
if (ItemRefund == null)
|
||
return "";
|
||
if (ItemRefund.status != "MERCHANT_REFUND_SUCCESS" && ItemRefund.status != "MERCHANT_RETURN_SUCCESS")
|
||
return "";
|
||
|
||
return "商品退款数量:" + ItemRefund.count + ",订单状态:" + ItemOrder.orderStatusStr;
|
||
}
|
||
set { }
|
||
}
|
||
|
||
public string ReturnWaybillId
|
||
{
|
||
get { return ItemRefund?.return_waybill_id; }
|
||
set { }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 订单退款时间
|
||
/// </summary>
|
||
public string refund_time_str
|
||
{
|
||
get { return BaseClass.StampToDateTime((ItemRefund?.create_time).ParseToInt()).ToString("yyyy-MM-dd HH:mm:ss"); }
|
||
set { }
|
||
}
|
||
/// <summary>
|
||
/// 订单退款时间可见
|
||
/// </summary>
|
||
public Visibility refund_time_visibility
|
||
{
|
||
get
|
||
{
|
||
return (this.ItemRefund?.create_time) > 0 ? Visibility.Visible : Visibility.Collapsed;
|
||
}
|
||
set { }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 订单中所有商品加起来的总售价文本
|
||
/// </summary>
|
||
public string realPriceStr
|
||
{
|
||
//get { return "¥" + (order_items.Sum(oi => oi.real_price) * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||
get { return "¥" + (real_price * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||
set { }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 订单内商品维度平台券优惠金额(利润需要计算这个金额在内)文本
|
||
/// </summary>
|
||
public string cash_coupon_discounted_price_str
|
||
{
|
||
//get { return "¥" + (order_items.Sum(oi => oi.cash_coupon_discounted_price.ParseToInt()) * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||
get { return "¥" + (cash_coupon_discounted_price.ParseToInt() * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||
set { }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 采购价文本
|
||
/// </summary>
|
||
public string purchase_price_str
|
||
{
|
||
//get { return "¥" + (order_items.Sum(oi => oi.purchase_price.ParseToInt()) * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||
get { return "¥" + (purchase_price * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||
set { }
|
||
}
|
||
/// <summary>
|
||
/// 采购价文本是否可见
|
||
/// </summary>
|
||
public Visibility purchase_price_visibility
|
||
{
|
||
get { if (ItemOrder.out_amount > 0 || ItemTransitOrder?.out_amount > 0) return Visibility.Collapsed; return Visibility.Visible; }
|
||
set { }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 运费文本
|
||
/// </summary>
|
||
public string freight_str
|
||
{
|
||
//get { return "¥" + (order_items.Sum(oi => oi.freight.ParseToInt()) * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||
get { return "¥" + (freight * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||
set { }
|
||
}
|
||
/// <summary>
|
||
/// 运费文本是否可见
|
||
/// </summary>
|
||
public Visibility freight_visibility
|
||
{
|
||
get { if (ItemOrder.out_amount > 0 || ItemTransitOrder?.out_amount > 0) return Visibility.Collapsed; return Visibility.Visible; }
|
||
set { }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 平台服务费
|
||
/// </summary>
|
||
public string predict_commission_fee_str
|
||
{
|
||
//get { return "¥" + (order_items.Sum(oi => oi.predict_commission_fee.ParseToInt()) * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||
get { return "¥" + (predict_commission_fee * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||
set { }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 达人佣金
|
||
/// </summary>
|
||
public string commission_amount_str
|
||
{
|
||
//get { return "¥" + (order_items.Sum(oi => oi.commission_amount.ParseToInt()) * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||
get { return "¥" + (commission_amount.ParseToInt() * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||
set { }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 外采金额文本
|
||
/// </summary>
|
||
public string out_amount_str
|
||
{
|
||
//get { return "¥" + (ItemOrder.out_amount * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||
get
|
||
{
|
||
if (ItemTransitOrder?.out_amount > 0)
|
||
return "¥" + (ItemTransitOrder.out_amount * 0.01m).ParseToDecimal().ToString("0.00");
|
||
else
|
||
return "¥" + (commission_amount.ParseToInt() * 0.01m).ParseToDecimal().ToString("0.00");
|
||
}
|
||
set { }
|
||
}
|
||
|
||
decimal profitCount = decimal.MinValue;
|
||
/// <summary>
|
||
/// 通过计算的利润
|
||
/// </summary>
|
||
public decimal ProfitCount
|
||
{
|
||
get
|
||
{
|
||
if (profitCount == decimal.MinValue)
|
||
{
|
||
//ItemOrder.out_amount ItemTransitOrder.out_amount 只有一个有值
|
||
var out_amount = ItemTransitOrder?.out_amount ?? ItemOrder.out_amount / ItemOrder.orderItems.Count;
|
||
profitCount = ((real_price.ParseToInt() + cash_coupon_discounted_price.ParseToInt() - purchase_price.ParseToInt() - freight.ParseToInt() - predict_commission_fee.ParseToInt() -
|
||
commission_amount.ParseToInt() - out_amount.ParseToInt()) * 0.01m).ParseToDecimal();
|
||
}
|
||
return profitCount;
|
||
}
|
||
set
|
||
{
|
||
profitCount = decimal.MinValue;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 通过计算的利润文本
|
||
/// </summary>
|
||
public string ProfitCountStr
|
||
{
|
||
//get { return "¥" + (profit * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||
//get { return "¥" + ((ItemOrder.profit - ItemOrder.out_amount) * 0.01m).ParseToDecimal().ToString("0.00"); }
|
||
get
|
||
{
|
||
if (refund_status == 2 || refund_status == 3 || refund_status == 4 || refund_status == 11)
|
||
return "--";
|
||
return "¥" + ProfitCount.ToString("0.00");
|
||
}
|
||
set { }
|
||
}
|
||
public SolidColorBrush ProfitStrColor
|
||
{
|
||
get
|
||
{
|
||
if (refund_status == 2 || refund_status == 3 || refund_status == 4 || refund_status == 11)
|
||
return new SolidColorBrush(Color.FromRgb(127, 127, 127));
|
||
return ProfitCount > 0 ? new SolidColorBrush(Color.FromRgb(103, 194, 58)) : new SolidColorBrush(Color.FromRgb(250, 71, 51));
|
||
}
|
||
set { }
|
||
}
|
||
|
||
/// <summary>
|
||
/// sku规格名称文本
|
||
/// </summary>
|
||
public string sku_attr_str
|
||
{
|
||
get
|
||
{
|
||
try
|
||
{
|
||
var jObj = JArray.Parse(sku_attrs);
|
||
var str = string.Join(",", jObj.Select(j => j["attr_value"].ParseToString()));
|
||
return str;
|
||
}
|
||
catch { return "获取失败"; }
|
||
}
|
||
set { }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 订单商品表数据库id
|
||
/// </summary>
|
||
public long id { get; set; }
|
||
public long shop_id { get; set; }
|
||
/// <summary>
|
||
/// 商户ID
|
||
/// </summary>
|
||
public long merchant_id { get; set; }
|
||
/// <summary>
|
||
/// 订单id(平台订单id)
|
||
/// </summary>
|
||
public string order_id { get; set; }
|
||
/// <summary>
|
||
/// 商品spuid
|
||
/// </summary>
|
||
public string product_id { get; set; }
|
||
public string sku_id { get; set; }
|
||
/// <summary>
|
||
/// sku小图
|
||
/// </summary>
|
||
public string thumb_img { get; set; }
|
||
/// <summary>
|
||
/// sku数量
|
||
/// </summary>
|
||
public int? sku_cnt { get; set; }
|
||
/// <summary>
|
||
/// 售卖单价(单位:分)
|
||
/// </summary>
|
||
public int? sale_price { get; set; }
|
||
/// <summary>
|
||
/// 商品名称
|
||
/// </summary>
|
||
public string title { get; set; }
|
||
/// <summary>
|
||
/// 正在售后/退款流程中的 sku 数量
|
||
/// </summary>
|
||
public int? on_aftersale_sku_cnt { get; set; }
|
||
/// <summary>
|
||
/// 完成售后/退款的 sku 数量
|
||
/// </summary>
|
||
public int? finish_aftersale_sku_cnt { get; set; }
|
||
/// <summary>
|
||
/// 商品编码
|
||
/// </summary>
|
||
public string sku_code { get; set; }
|
||
/// <summary>
|
||
/// 市场单价(单位:分)
|
||
/// </summary>
|
||
public int? market_price { get; set; }
|
||
/// <summary>
|
||
/// sku属性JSON
|
||
/// </summary>
|
||
public string sku_attrs { get; set; }
|
||
/// <summary>
|
||
/// sku实付总价,取estimate_price和change_price中较小值
|
||
/// </summary>
|
||
public int? real_price { get; set; }
|
||
/// <summary>
|
||
/// 商品外部spuid
|
||
/// </summary>
|
||
public string out_product_id { get; set; }
|
||
/// <summary>
|
||
/// 采购价
|
||
/// </summary>
|
||
public int? purchase_price { get; set; }
|
||
/// <summary>
|
||
/// 运费
|
||
/// </summary>
|
||
public int? freight { get; set; }
|
||
/// <summary>
|
||
/// 商品外部skuid
|
||
/// </summary>
|
||
public string out_sku_id { get; set; }
|
||
/// <summary>
|
||
/// 是否有优惠金额,非必填,默认为false
|
||
/// </summary>
|
||
public string is_discounted { get; set; }
|
||
/// <summary>
|
||
/// 优惠后sku总价,非必填,is_discounted为true时有值
|
||
/// </summary>
|
||
public int? estimate_price { get; set; }
|
||
/// <summary>
|
||
/// 是否修改过价格,非必填,默认为false
|
||
/// </summary>
|
||
public string is_change_price { get; set; }
|
||
/// <summary>
|
||
/// 改价后sku总价,非必填,is_change_price为true时有值
|
||
/// </summary>
|
||
public int? change_price { get; set; }
|
||
/// <summary>
|
||
/// 订单内商品维度平台券优惠金额(利润需要计算这个金额在内)
|
||
/// </summary>
|
||
public int? cash_coupon_discounted_price { get; set; }
|
||
/// <summary>
|
||
/// 区域库存id
|
||
/// </summary>
|
||
public string out_warehouse_id { get; set; }
|
||
/// <summary>
|
||
/// 退货地址
|
||
/// </summary>
|
||
public string return_address { get; set; }
|
||
/// <summary>
|
||
/// 商品发货信息JSON
|
||
/// </summary>
|
||
public string sku_deliver_info { get; set; }
|
||
/// <summary>
|
||
/// 商品额外服务信息JSON
|
||
/// </summary>
|
||
public string extra_service { get; set; }
|
||
/// <summary>
|
||
/// 是否使用了会员积分抵扣
|
||
/// </summary>
|
||
public string use_deduction { get; set; }
|
||
/// <summary>
|
||
/// 会员积分抵扣金额,单位为分
|
||
/// </summary>
|
||
public int? deduction_price { get; set; }
|
||
/// <summary>
|
||
/// 平台服务费(微信小店:预计技术服务费),单位为分
|
||
/// </summary>
|
||
public int? predict_commission_fee { get; set; }
|
||
/// <summary>
|
||
/// 达人佣金(微信小店:分账金额),单位为分
|
||
/// </summary>
|
||
public int? commission_amount { get; set; }
|
||
/// <summary>
|
||
/// 商品优惠券信息,逐步替换 order.order_detail.coupon_info
|
||
/// </summary>
|
||
public string order_product_coupon_info_list { get; set; }
|
||
/// <summary>
|
||
/// 商品id(o_goods外键)
|
||
/// </summary>
|
||
public long? erp_goods_id { get; set; }
|
||
/// <summary>
|
||
/// 商品skuid(o_goods_sku外键)
|
||
/// </summary>
|
||
public long? erp_goods_sku_id { get; set; }
|
||
/// <summary>
|
||
/// 售后状态 1:无售后或售后关闭,2:售后处理中,3:退款中,4:退款成功,11:已取消(售后完成订单取消)
|
||
/// </summary>
|
||
public int? refund_status { get; set; }
|
||
|
||
public void UpdateOrderItemBuyButton()
|
||
{
|
||
var order_item = this;
|
||
order_item.Shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ErpShopId == order_item.shop_id.ParseToString());
|
||
if (GlobalConfig.lstDangerItemWord.Any(d => order_item.title.Contains(d)))
|
||
{
|
||
order_item.IsBuyGoodsBtnEnabled = false;
|
||
order_item.BuyGoodsBtnBackColor = new SolidColorBrush(Color.FromArgb(50, 250, 70, 51));
|
||
order_item.BuyGoodsBtnColor = new SolidColorBrush(Color.FromArgb(255, 250, 70, 51));
|
||
order_item.BuyGoodsBtnTxt = "危险品不支持中转拍单";
|
||
}
|
||
else if (Shop == null || (Shop?.LoginStatus != "登录成功" /*&& Shop?.Is29Supplier == null*/))
|
||
{
|
||
order_item.IsBuyGoodsBtnEnabled = false;
|
||
//order_item.IsBuyGoodsBtnEnabled = true;
|
||
order_item.BuyGoodsBtnBackColor = new SolidColorBrush(Color.FromArgb(50, 250, 70, 51));
|
||
order_item.BuyGoodsBtnColor = new SolidColorBrush(Color.FromArgb(255, 250, 70, 51));
|
||
order_item.BuyGoodsBtnTxt = "请登录店铺";
|
||
}
|
||
else if (Shop?.LoginStatus == "登录成功" && Shop?.Is29Supplier == null)
|
||
{
|
||
order_item.IsBuyGoodsBtnEnabled = false;
|
||
order_item.BuyGoodsBtnBackColor = new SolidColorBrush(Color.FromArgb(50, 250, 127, 51));
|
||
order_item.BuyGoodsBtnColor = new SolidColorBrush(Color.FromArgb(255, 250, 127, 51));
|
||
order_item.BuyGoodsBtnTxt = "代发状态读取中请稍候";
|
||
}
|
||
else if (Shop?.Is29Supplier == false)
|
||
{
|
||
//order_item.IsBuyGoodsBtnEnabled = false;
|
||
order_item.IsBuyGoodsBtnEnabled = true;
|
||
order_item.BuyGoodsBtnBackColor = new SolidColorBrush(Color.FromArgb(50, 250, 70, 51));
|
||
order_item.BuyGoodsBtnColor = new SolidColorBrush(Color.FromArgb(255, 250, 70, 51));
|
||
order_item.BuyGoodsBtnTxt = "去店铺后台绑定代发";
|
||
}
|
||
else
|
||
{
|
||
order_item.IsBuyGoodsBtnEnabled = true;
|
||
order_item.BuyGoodsBtnTxt = order_item.BuyMap == null ? "关联拍单" : "拍单";
|
||
order_item.BuyGoodsBtnBackColor = new SolidColorBrush(Color.FromArgb(50, 152, 99, 143));
|
||
order_item.BuyGoodsBtnColor = new SolidColorBrush(Color.FromArgb(255, 152, 99, 143));
|
||
}
|
||
}
|
||
}
|
||
}
|