制作自定义交易组件用户前端售后,微信内取消售后操作

This commit is contained in:
大灰灰
2022-06-30 23:43:16 +08:00
parent dc408b8596
commit 9bf0a42289
7 changed files with 182 additions and 20 deletions
@@ -75,6 +75,10 @@ namespace CoreCms.Net.WeChat.Service.Configuration
/// 自定义交易组件用户确认收货
/// </summary>
public const string OpenProductOrderConfirm = "open_product_order_confirm";
/// <summary>
/// 用户取消售后申请
/// </summary>
public const string AfterSaleUserCancel = "aftersale_user_cancel";
#endregion
@@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CoreCms.Net.WeChat.Service.Enums
{
public class AfterSalesEnum
{
/// <summary>
/// 售后类型
/// </summary>
public enum AfterSaleType
{
仅退款 = 1,
退货退款 = 2,
}
/// <summary>
/// 售后描述说明
/// </summary>
public enum AfterSalesReasonType
{
商品无货 = 1,
发货时间问题 = 2,
不想要了 = 3,
地址信息填写错误 = 5,
买多买错不想要了 = 6,
商品损坏包装脏污 = 7,
少错商品与页面描述不符 = 8,
无效的物流单号 = 9,
物流超72小时停滞 = 10,
快递无法送到指定地点 = 11,
显示签收但未收到商品 = 12,
质量问题 = 14,
其他 = 15
}
/// <summary>
/// 售后状态
/// </summary>
public enum AfterSalesState
{
用户取消售后申请 = 1,
商家处理退款申请中 = 2,
商家拒绝退款 = 4,
商家拒绝退货 = 5,
待用户退货 = 6,
售后单关闭 = 7,
待商家收货 = 8,
平台退款中 = 11,
退款成功 = 13,
平台处理退款申请中 = 21,
废弃 = 22,
商家处理退货申请中 = 23,
平台处理退货申请中 = 24,
平台退款失败 = 25
}
}
}
@@ -0,0 +1,74 @@
/***********************************************************************
* Project: CoreCms.Net *
* Web: https://CoreCms.Net *
* ProjectName: 核心内容管理系统 *
* Author: 大灰灰 *
* Email: JianWeie@163.com *
* CreateTime: 2020-08-13 23:57:23
* Description: 暂无
***********************************************************************/
using System;
using System.Threading;
using System.Threading.Tasks;
using CoreCms.Net.Configuration;
using CoreCms.Net.IServices;
using CoreCms.Net.Loging;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.WeChat.Service.HttpClients;
using CoreCms.Net.WeChat.Service.Models;
using MediatR;
using Newtonsoft.Json;
using SKIT.FlurlHttpClient.Wechat.Api;
using SKIT.FlurlHttpClient.Wechat.Api.Events;
namespace CoreCms.Net.WeChat.Service.Mediator
{
/// <summary>
/// 表示 TEXT 事件的数据
/// </summary>
public class AftersaleUserCancelEventCommand : IRequest<WeChatApiCallBack>
{
public AftersaleUserCancelEvent EventObj { get; set; }
}
/// <summary>
/// 用户取消售后申请
/// </summary>
public class AftersaleUserCancelEventCommandHandler : IRequestHandler<AftersaleUserCancelEventCommand, WeChatApiCallBack>
{
private readonly ICoreCmsBillAftersalesServices _aftersalesServices;
public AftersaleUserCancelEventCommandHandler(ICoreCmsBillAftersalesServices aftersalesServices)
{
_aftersalesServices = aftersalesServices;
}
public async Task<WeChatApiCallBack> Handle(AftersaleUserCancelEventCommand request, CancellationToken cancellationToken)
{
var jm = new WeChatApiCallBack() { Status = true };
if (request.EventObj != null)
{
try
{
await _aftersalesServices.UpdateAsync(p => new CoreCmsBillAftersales()
{
status = (int)GlobalEnumVars.BillAftersalesStatus.Cancel
},
p => p.aftersalesId == request.EventObj.AftersaleOrder.OutAftersaleOrderId);
}
catch (Exception e)
{
NLogUtil.WriteFileLog(NLog.LogLevel.Info, LogType.WxPost, "接收服务器推送", "用户取消售后申请", e);
}
}
return await Task.FromResult(jm);
}
}
}