修改工单流程页面,订单列表增加工单按钮
This commit is contained in:
1 parent
f9dcae4610
commit
10bb0803d9
44 files changed
+5920
-1291
No files matched your search
@@ -1,3 +1,5 @@
|
||||
using AllBase;
|
||||
using AllBase.Model.DBModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
@@ -32,6 +34,25 @@ public sealed class TicketClientOptions
|
||||
/// </summary>
|
||||
public IList<TicketOrderOption> Orders { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建参数副本,避免宿主与页面共享可变集合。
|
||||
/// </summary>
|
||||
public TicketClientOptions Clone()
|
||||
{
|
||||
return new TicketClientOptions
|
||||
{
|
||||
UserName = UserName,
|
||||
AppIds = (AppIds ?? Enumerable.Empty<string>())
|
||||
.Where(appId => !string.IsNullOrWhiteSpace(appId))
|
||||
.Select(appId => appId.Trim())
|
||||
.Distinct(StringComparer.Ordinal)
|
||||
.ToList(),
|
||||
Orders = (Orders ?? Enumerable.Empty<TicketOrderOption>())
|
||||
.Where(order => order != null)
|
||||
.ToList()
|
||||
};
|
||||
}
|
||||
|
||||
public static TicketClientOptions FromApplicationSettings()
|
||||
{
|
||||
var purchaseAccount =
|
||||
@@ -72,6 +93,11 @@ public sealed class TicketOrderOption
|
||||
/// </summary>
|
||||
public string GoodsName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品缩略图地址,用于新建工单页展示关联商品。
|
||||
/// </summary>
|
||||
public string ImageUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单金额,单位元,使用 decimal 保存原始金额,不在模型中保存格式化文本。
|
||||
/// </summary>
|
||||
@@ -97,23 +123,54 @@ public sealed class TicketOrderOption
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 订单详情展示文本,包含商品名、金额和下单时间。
|
||||
/// 订单详情展示文本。商品名已包含在 <see cref="DisplayText"/> 中,这里只展示金额和下单时间。
|
||||
/// </summary>
|
||||
public string ProductDescription
|
||||
{
|
||||
get
|
||||
{
|
||||
var product = string.IsNullOrWhiteSpace(GoodsName)
|
||||
? "未提供商品名称"
|
||||
: GoodsName;
|
||||
var amount = "¥ " + Amount.ToString("N2", CultureInfo.GetCultureInfo("zh-CN"));
|
||||
var orderedAt = OrderedAt == default
|
||||
? "下单时间未知"
|
||||
: OrderedAt.ToString("yyyy-MM-dd HH:mm", CultureInfo.CurrentCulture);
|
||||
return $"商品:{product}\n金额:{amount} 下单时间:{orderedAt}";
|
||||
return $"金额 {amount} · {orderedAt}";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从本地订单生成工单关联订单信息,统一商品名、缩略图、金额和下单时间的取值规则。
|
||||
/// </summary>
|
||||
public static TicketOrderOption FromWechatOrder(
|
||||
oms_wei_order_info order,
|
||||
string appId)
|
||||
{
|
||||
if (order == null)
|
||||
return null;
|
||||
|
||||
var goodsName = string.Join(
|
||||
"、",
|
||||
(order.orderItems ?? Enumerable.Empty<oms_wei_order_item_info>())
|
||||
.Select(item => item.title)
|
||||
.Where(title => !string.IsNullOrWhiteSpace(title))
|
||||
.Distinct());
|
||||
if (goodsName.Length > 200)
|
||||
goodsName = goodsName.Substring(0, 200) + "…";
|
||||
|
||||
return new TicketOrderOption
|
||||
{
|
||||
AppId = appId?.Trim(),
|
||||
OrderId = order.order_id,
|
||||
GoodsName = goodsName,
|
||||
ImageUrl = (order.orderItems ?? Enumerable.Empty<oms_wei_order_item_info>())
|
||||
.Select(item => item.thumb_img)
|
||||
.FirstOrDefault(url => !string.IsNullOrWhiteSpace(url)),
|
||||
Amount = (order.order_price ?? 0) / 100m,
|
||||
OrderedAt = order.create_time > 0
|
||||
? BaseClass.StampToDateTime(order.create_time)
|
||||
: default
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前工单的唯一订单键,由 APPID 和微信订单号共同组成。
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user