# 2022-02-09

### 1.3.5 开源社区版(会员专业版同步修改):
无
### 0.1.5 会员专业版:
【升级】nuget升级常用组件到最新版本。
【修复】服务商品列表图片组件从image调整为u--image组件。#I4RUC6
【优化】规范coreshop-goods.vue组件for循环未定义key的问题。
【修复】修复因升级uview版本导致【商品选项卡goodTabBar组件】切换失效的问题。
【新增】微信自定义交易组件增加【商品审核结果回调】,【类目审核结果回调】微信服务器消息推送处理。
【优化】调整自定义交易组件sku价格为decimal(18, 2)类型,方便小数处理。
【优化】微信自定义交易组件增加图片同步至微信侧功能。
【优化】重命名一些方法名称大小写。
【新增】首页设计轮播图增加高度设置功能。#I4SWEA
【修复】优化在苹果6/7/8plus及安卓一些机型出现分享海报弹窗文字被遮挡的问题。#I4SWCA
This commit is contained in:
JianWeie
2022-02-09 02:07:06 +08:00
parent 8e3adda57b
commit 05df55d7ec
43 changed files with 1044 additions and 535 deletions

View File

@@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="11.0.0" />
<PackageReference Include="AutoMapper" Version="11.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
</ItemGroup>

View File

@@ -109,7 +109,6 @@ namespace CoreCms.Net.Configuration
QiNiuKoDo = 3,
}
/// <summary>
/// 本地存储位置
/// </summary>
@@ -121,6 +120,7 @@ namespace CoreCms.Net.Configuration
API = 1
}
#endregion
#region User用户相关===========================================================================
@@ -772,6 +772,24 @@ namespace CoreCms.Net.Configuration
#endregion
#region MyRegion
/// <summary>
/// 购物车数量设置方式(1是直接增加/2是赋值)
/// </summary>
public enum CartSetNumType
{
/// <summary>
/// 增加
/// </summary>
Increase = 1,
/// <summary>
/// 设置
/// </summary>
Set = 2
}
#endregion
#region OrderLog订单日志=====================================================
/// <summary>
@@ -2731,7 +2749,6 @@ namespace CoreCms.Net.Configuration
#endregion
#region
public enum SolitaireStatus
@@ -2751,6 +2768,7 @@ namespace CoreCms.Net.Configuration
#endregion
#region redis缓存类型
public enum AccessTokenEnum
{
@@ -2771,5 +2789,44 @@ namespace CoreCms.Net.Configuration
}
#endregion
#region
/// <summary>
/// 售后订单状态
/// </summary>
public enum ShopAftersaleAddStatus
{
= 0,
= 1,
= 2,
= 3,
退 = 4,
退退 = 5,
退 = 6,
退退 = 7,
= 8,
退 = 11,
退 = 12,
退 = 13,
退退 = 14,
= 15,
= 16,
= 17,
= 18,
= 19
}
/// <summary>
/// 售后类型
/// </summary>
public enum ShopAftersaleAddType
{
退 = 0,
退退 = 1,
= 2
}
#endregion
}
}

View File

@@ -34,10 +34,11 @@ namespace CoreCms.Net.IServices
/// <param name="shipAreaId">省市区id</param>
/// <param name="shipAddress">收货地址</param>
/// <param name="memo">发货描述</param>
/// <param name="deliveryCompanyId">直播物流编码</param>
/// <returns></returns>
Task<WebApiCallBack> BatchShip(string[] orderId, string logiCode, string logiNo, Dictionary<int, int> items,
int storeId = 0, string shipName = "", string shipMobile = "", int shipAreaId = 0, string shipAddress = "",
string memo = "");
string memo = "", string deliveryCompanyId = "");
/// <summary>
@@ -53,12 +54,11 @@ namespace CoreCms.Net.IServices
/// <param name="shipAreaId">省市区id</param>
/// <param name="shipAddress">收货地址</param>
/// <param name="memo">发货描述</param>
/// <param name="deliveryCompanyId">直播物流编码</param>
/// <returns></returns>
Task<WebApiCallBack> Ship(string orderId, string logiCode, string logiNo, Dictionary<int, int> items,
int storeId = 0, string shipName = "", string shipMobile = "", int shipAreaId = 0, string shipAddress = "",
string memo = "");
string memo = "", string deliveryCompanyId = "");
/// <summary>

View File

@@ -14,8 +14,8 @@ using System.Linq.Expressions;
using System.Threading.Tasks;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.ViewModels.Basics;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Model.ViewModels.DTO;
using CoreCms.Net.Model.ViewModels.UI;
using SqlSugar;
namespace CoreCms.Net.IServices
@@ -77,6 +77,14 @@ namespace CoreCms.Net.IServices
/// <returns></returns>
Task<WebApiCallBack> GetOrderInfoByOrderId(string id, int userId = 0, int aftersaleLevel = 0);
/// <summary>
/// 把退款金额和退货商品查出来判断是否能进行售后
/// </summary>
/// <param name="order"></param>
/// <param name="afterSaleLevel">取售后单的时候售后单的等级0待审核的和审核通过的售后单1未审核的2审核通过的</param>
void AfterSalesVal(CoreCmsOrder order, int afterSaleLevel = 0);
/// <summary>
/// 获取订单不同状态的数量
/// </summary>
@@ -112,9 +120,10 @@ namespace CoreCms.Net.IServices
/// 商家获取订单列表
/// </summary>
/// <returns></returns>
Task<WebApiCallBack> GetOrderPageByMerchant(string dateType, string[] date, int status = 0, int storeId = 0,
Task<WebApiCallBack> GetOrderPageByMerchant(string dateType, string[] date, int status = 0, int receiptType = 0, int storeId = 0,
int page = 1, int limit = 5);
/// <summary>
/// 根据搜索条件商家获取订单列表
/// </summary>
@@ -154,17 +163,19 @@ namespace CoreCms.Net.IServices
/// <summary>
/// 构建需要发货的数据,和发货单密切关联
/// 构建多个需要发货的数据,和发货单密切关联
/// </summary>
/// <returns></returns>
Task<WebApiCallBack> GetOrderShipInfo(string[] ids);
/// <summary>
/// 构建单个需要发货的数据,和发货单密切关联
/// </summary>
/// <returns></returns>
Task<WebApiCallBack> GetOrderShipInfo(string orderId);
/// <summary>
/// 发货改状态
/// </summary>
@@ -273,8 +284,6 @@ namespace CoreCms.Net.IServices
/// <returns></returns>
Task<WebApiCallBack> RemindOrderPay();
/// <summary>
/// 重写根据条件列表数据
/// </summary>

View File

@@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="11.0.0" />
<PackageReference Include="AutoMapper" Version="11.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

View File

@@ -4,7 +4,7 @@
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/7/31 15:51:02
* CreateTime: 2022/2/7 1:09:51
* Description: 暂无
***********************************************************************/
@@ -25,152 +25,152 @@ namespace CoreCms.Net.Model.Entities
public WeChatTransactionComponentGoodSKU()
{
}
/// <summary>
/// 序列
/// </summary>
[Display(Name = "序列")]
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
[Required(ErrorMessage = "请输入{0}")]
public System.Int32 id { get; set; }
public System.Int32 id { get; set; }
/// <summary>
/// 交易组件平台自定义skuID
/// </summary>
[Display(Name = "交易组件平台自定义skuID")]
[Required(ErrorMessage = "请输入{0}")]
public System.Int64 skuId { get; set; }
public System.Int64 skuId { get; set; }
/// <summary>
/// 商家自定义商品ID
/// </summary>
[Display(Name = "商家自定义商品ID")]
[Required(ErrorMessage = "请输入{0}")]
[StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")]
public System.String outProductId { get; set; }
[StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")]
public System.String outProductId { get; set; }
/// <summary>
/// 商家自定义skuID
/// </summary>
[Display(Name = "商家自定义skuID")]
[Required(ErrorMessage = "请输入{0}")]
[StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")]
public System.String outSkuId { get; set; }
[StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")]
public System.String outSkuId { get; set; }
/// <summary>
/// sku小图
/// </summary>
[Display(Name = "sku小图")]
[Required(ErrorMessage = "请输入{0}")]
[StringLength(maximumLength:255,ErrorMessage = "{0}不能超过{1}字")]
public System.String thumbImg { get; set; }
[StringLength(maximumLength: 255, ErrorMessage = "{0}不能超过{1}字")]
public System.String thumbImg { get; set; }
/// <summary>
/// 成本价格
/// </summary>
[Display(Name = "成本价格")]
[Required(ErrorMessage = "请输入{0}")]
public System.Int32 costprice { get; set; }
public System.Decimal costprice { get; set; }
/// <summary>
/// 售卖价格
/// </summary>
[Display(Name = "售卖价格")]
[Required(ErrorMessage = "请输入{0}")]
public System.Int32 salePrice { get; set; }
public System.Decimal salePrice { get; set; }
/// <summary>
/// 市场价格
/// </summary>
[Display(Name = "市场价格")]
[Required(ErrorMessage = "请输入{0}")]
public System.Int32 marketPrice { get; set; }
public System.Decimal marketPrice { get; set; }
/// <summary>
/// 库存
/// </summary>
[Display(Name = "库存")]
[Required(ErrorMessage = "请输入{0}")]
public System.Int32 stockNum { get; set; }
public System.Int32 stockNum { get; set; }
/// <summary>
/// 条形码
/// </summary>
[Display(Name = "条形码")]
[StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")]
public System.String barCode { get; set; }
[StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")]
public System.String barCode { get; set; }
/// <summary>
/// 商品编码
/// </summary>
[Display(Name = "商品编码")]
[StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")]
public System.String skuCode { get; set; }
[StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")]
public System.String skuCode { get; set; }
/// <summary>
/// 是否选择
/// </summary>
[Display(Name = "是否选择")]
[Required(ErrorMessage = "请输入{0}")]
public System.Boolean isSelect { get; set; }
public System.Boolean isSelect { get; set; }
}
}

View File

@@ -16,7 +16,7 @@ namespace CoreCms.Net.Model.ViewModels.DTO
/// <summary>
/// OrderToAftersales返回类
/// </summary>
public class OrderToAftersalesDto
public class OrderToAfterSalesDto
{
public decimal refundMoney { get; set; } = 0;

View File

@@ -14,7 +14,7 @@ namespace CoreCms.Net.Model.ViewModels.QueryMuch
/// <summary>
/// 根据订单号查询已经售后的内容.算退货商品明细
/// </summary>
public class QMAftersalesItems
public class QMAfterSalesItems
{
public int orderItemsId { get; set; }
public int nums { get; set; }

View File

@@ -10,14 +10,19 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using CoreCms.Net.Caching.AccressToken;
using CoreCms.Net.Configuration;
using CoreCms.Net.IServices;
using CoreCms.Net.Loging;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.WeChat.Service.HttpClients;
using InitQ.Abstractions;
using InitQ.Attributes;
using Newtonsoft.Json;
using SKIT.FlurlHttpClient.Wechat.Api;
using SKIT.FlurlHttpClient.Wechat.Api.Models;
namespace CoreCms.Net.RedisMQ.Subscribe
{
@@ -29,23 +34,22 @@ namespace CoreCms.Net.RedisMQ.Subscribe
private readonly string _wxOpenAppId = AppSettingsConstVars.WxOpenAppId;
private readonly string _wxOpenAppSecret = AppSettingsConstVars.WxOpenAppSecret;
private readonly ICoreCmsUserWeChatInfoServices _userWeChatInfoServices;
private readonly ICoreCmsBillDeliveryServices _billDeliveryServices;
private readonly ICoreCmsOrderServices _orderServices;
private readonly ICoreCmsOrderItemServices _orderItemServices;
private readonly ICoreCmsUserWeChatInfoServices _weChatInfoServices;
private readonly IWeChatTransactionComponentOrderServices _tcOrderServices;
private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
private readonly ICoreCmsBillAftersalesServices _billAftersalesServices;
private readonly ICoreCmsBillAftersalesItemServices _billAftersalesItemServices;
public TCOrderAfterSaleCreateSyncSubscribe(ICoreCmsUserWeChatInfoServices userWeChatInfoServices, ICoreCmsBillDeliveryServices billDeliveryServices, ICoreCmsOrderServices orderServices, ICoreCmsUserWeChatInfoServices weChatInfoServices, IWeChatTransactionComponentOrderServices tcOrderServices, ICoreCmsOrderItemServices orderItemServices)
public TCOrderAfterSaleCreateSyncSubscribe(ICoreCmsOrderServices orderServices, IWeChatTransactionComponentOrderServices tcOrderServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, ICoreCmsBillAftersalesServices billAftersalesServices, ICoreCmsBillAftersalesItemServices billAftersalesItemServices)
{
_userWeChatInfoServices = userWeChatInfoServices;
_billDeliveryServices = billDeliveryServices;
_orderServices = orderServices;
_weChatInfoServices = weChatInfoServices;
_tcOrderServices = tcOrderServices;
_orderItemServices = orderItemServices;
_weChatApiHttpClientFactory = weChatApiHttpClientFactory;
_billAftersalesServices = billAftersalesServices;
_billAftersalesItemServices = billAftersalesItemServices;
}
/// <summary>
@@ -75,33 +79,59 @@ namespace CoreCms.Net.RedisMQ.Subscribe
return;
}
////获取小程序认证
//var accessToken = await new WeChatHelper().GetWxOpenAccessToken();
////检查场景值是否在支付校验范围内
////接口调用请求地址
//var sceneUrl = WeChat.TransactionComponent.Api.Delivery.recieve(accessToken);
//获取售后单
var aftersale = await _billAftersalesServices.QueryByClauseAsync(p => p.aftersalesId == orderModel.billAftersalesId);
//获取售后单详情
var aftersaleItems = await _billAftersalesItemServices.QueryListByClauseAsync(p => p.aftersalesId == orderModel.billAftersalesId);
////组合请求
//var sceneClient = new RestClient(sceneUrl);
//var request = new RestRequest(RestSharp.Method.POST);
//获取小程序认证
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
//request.AddHeader("Content-Type", "application/json");
//request.AddJsonBody(new
//{
// out_order_id = orderModel.orderId,
// openid = tcOrderModel.openid,
//});
//var response = await sceneClient.ExecuteAsync(request);
//var result = JsonConvert.DeserializeObject<CheckSceneResult>(response.Content);
var request = new ShopAftersaleAddRequest();
request.AccessToken = accessToken;
request.OutOrderId = orderModel.orderId;
request.OutAftersaleOrderId = orderModel.billAftersalesId;
request.PagePath = "pages/member/afterSales/detail/detail?aftersalesId=" + orderModel.billAftersalesId;
request.RefundFee = Convert.ToInt32(aftersale.refundAmount * 100);
request.OpenId = tcOrderModel.openid;
//if (result != null && result.errcode == 0)
//{
// NLogUtil.WriteAll(NLog.LogLevel.Info, LogType.RedisMessageQueue, "自定义交易组件-同步创建售后单", JsonConvert.SerializeObject(result));
//}
//else
//{
// NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "自定义交易组件-同步创建售后单", JsonConvert.SerializeObject(result));
//}
if (aftersale.refundAmount > 0 && aftersale.type == (int)GlobalEnumVars.BillAftersalesIsReceive.Refund)
{
request.Type = (int)GlobalEnumVars.ShopAftersaleAddType.退;
}
else if (aftersale.refundAmount > 0 && aftersale.type == (int)GlobalEnumVars.BillAftersalesIsReceive.Reship)
{
request.Type = (int)GlobalEnumVars.ShopAftersaleAddType.退退;
}
else if (Convert.ToInt32(aftersale.refundAmount) == 0 && aftersale.type == (int)GlobalEnumVars.BillAftersalesIsReceive.Reship)
{
request.Type = (int)GlobalEnumVars.ShopAftersaleAddType.退退;
}
else if (Convert.ToInt32(aftersale.refundAmount) == 0 && aftersale.type == (int)GlobalEnumVars.BillAftersalesIsReceive.Refund)
{
request.Type = (int)GlobalEnumVars.ShopAftersaleAddType.退;
}
request.Status = 0;
request.CreateTime = aftersale.createTime;
request.IsFinishAll = false;
request.ProductList = new List<ShopAftersaleAddRequest.Types.Product>();
aftersaleItems.ForEach(p =>
{
var product = new ShopAftersaleAddRequest.Types.Product();
product.Count = p.nums;
product.OutProductId = p.goodsId.ToString();
product.OutSKUId = p.productId.ToString();
request.ProductList.Add(product);
});
var response = await client.ExecuteShopAftersaleAddAsync(request);
NLogUtil.WriteAll(response.IsSuccessful() ? NLog.LogLevel.Info : NLog.LogLevel.Error,
LogType.RedisMessageQueue, "自定义交易组件-同步创建售后单", JsonConvert.SerializeObject(response));
}
else
{
@@ -115,7 +145,6 @@ namespace CoreCms.Net.RedisMQ.Subscribe
{
wxOpenAppId = _wxOpenAppId,
wxOpenAppSecret = _wxOpenAppSecret,
msg
};
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "自定义交易组件-同步创建售后单", JsonConvert.SerializeObject(obj), ex);
throw;

View File

@@ -1,12 +1,12 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/7/10 22:41:46
* Description: 暂无
***********************************************************************/
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/7/10 22:41:46
* Description: 暂无
***********************************************************************/
using System;
@@ -59,33 +59,26 @@ namespace CoreCms.Net.RedisMQ.Subscribe
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
var sceneRequest = new ShopSceneCheckRequest();
sceneRequest.AccessToken = accessToken;
sceneRequest.Scene = orderModel.scene;
var sceneResponse = await client.ExecuteShopSceneCheckAsync(sceneRequest);
if (sceneResponse.IsSuccessful() && sceneResponse.IsMatched == true)
var userInfo = await _userWeChatInfoServices.QueryByClauseAsync(p => p.userId == orderModel.userId);
if (userInfo != null)
{
var userInfo = await _userWeChatInfoServices.QueryByClauseAsync(p => p.userId == orderModel.userId);
if (userInfo != null)
{
var payment = orderModel.paymentItem[0];
var payment = orderModel.paymentItem[0];
//获取同步地址接口地址
var request = new ShopOrderPayRequest();
request.OutOrderId = orderModel.orderId;
request.OpenId = userInfo.openid;
request.ActionType = 1;
request.TransactionId = payment.tradeNo;
request.PayTime = payment.createTime;
var response = await client.ExecuteShopOrderPayAsync(request);
}
else
{
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "自定义交易组件-同步订单状态", "微信用户数据获取失败");
}
//获取同步地址接口地址
var request = new ShopOrderPayRequest();
request.AccessToken = accessToken;
request.OutOrderId = orderModel.orderId;
request.OpenId = userInfo.openid;
request.ActionType = 1;
request.TransactionId = payment.tradeNo;
request.PayTime = payment.createTime;
var response = await client.ExecuteShopOrderPayAsync(request);
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "自定义交易组件-同步订单状态", JsonConvert.SerializeObject(response));
}
else
{
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "自定义交易组件-同步订单状态", "微信用户数据获取失败");
}
}
else

View File

@@ -53,7 +53,7 @@ namespace CoreCms.Net.Repository
return jm;
}
//事物处理过程开始
oldModel.id = entity.id;
//oldModel.id = entity.id;
oldModel.licenseImage = entity.licenseImage;
oldModel.level1 = entity.level1;
oldModel.level1Name = entity.level1Name;
@@ -62,11 +62,11 @@ namespace CoreCms.Net.Repository
oldModel.level3 = entity.level3;
oldModel.level3Name = entity.level3Name;
oldModel.certificateImage = entity.certificateImage;
oldModel.auditId = entity.auditId;
oldModel.status = entity.status;
oldModel.brandId = entity.brandId;
oldModel.rejectReason = entity.rejectReason;
oldModel.createTime = entity.createTime;
//oldModel.auditId = entity.auditId;
//oldModel.status = entity.status;
//oldModel.brandId = entity.brandId;
//oldModel.rejectReason = entity.rejectReason;
//oldModel.createTime = entity.createTime;
//事物处理过程结束
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();

View File

@@ -119,7 +119,7 @@ namespace CoreCms.Net.Repository
return jm;
}
//事物处理过程开始
oldModel.id = entity.id;
//oldModel.id = entity.id;
oldModel.productId = entity.productId;
oldModel.createTime = entity.createTime;
oldModel.outProductId = entity.outProductId;
@@ -138,9 +138,44 @@ namespace CoreCms.Net.Repository
//事物处理过程结束
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
if (entity.sku == null || entity.sku.Count < 0)
{
jm.msg = "请提交sku列表";
return jm;
}
var isSelectCount = entity.sku.Count(p => p.isSelect == true);
if (isSelectCount <= 0)
{
jm.msg = "请至少勾选一个需要提交的sku";
return jm;
}
var oldSku = await DbClient.Queryable<WeChatTransactionComponentGoodSKU>()
.Where(p => p.outProductId == oldModel.outProductId).ToListAsync();
oldSku.ForEach(p =>
{
var newSku = entity.sku.Find(o => o.outSkuId == p.outSkuId);
if (newSku != null)
{
p.thumbImg = newSku.thumbImg;
p.costprice = newSku.costprice;
p.salePrice = newSku.salePrice;
p.marketPrice = newSku.marketPrice;
p.stockNum = newSku.stockNum;
p.isSelect = newSku.isSelect;
}
});
await DbClient.Updateable(oldSku).ExecuteCommandAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
return jm;
}

View File

@@ -22,13 +22,14 @@ using CoreCms.Net.Loging;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.ViewModels.Basics;
using CoreCms.Net.Model.ViewModels.DTO;
using CoreCms.Net.Model.ViewModels.QueryMuch;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Model.ViewModels.DTO;
using CoreCms.Net.Utility.Extensions;
using CoreCms.Net.Utility.Helper;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SqlSugar;
@@ -46,7 +47,8 @@ namespace CoreCms.Net.Services
private readonly ICoreCmsMessageCenterServices _messageCenterServices;
private readonly ICoreCmsUserPointLogServices _userPointLogServices;
private readonly IRedisOperationRepository _redisOperationRepository;
public CoreCmsBillAftersalesServices(IUnitOfWork unitOfWork, ICoreCmsBillAftersalesRepository dal, IServiceProvider serviceProvider, ICoreCmsMessageCenterServices messageCenterServices, ICoreCmsUserPointLogServices userPointLogServices, IRedisOperationRepository redisOperationRepository)
{
this._dal = dal;
@@ -94,12 +96,12 @@ namespace CoreCms.Net.Services
var refundMoney = base.GetSum(where, p => p.refundAmount);
//算退货商品明细
var list = base.QueryMuch<CoreCmsBillAftersalesItem, CoreCmsBillAftersales, QMAftersalesItems>(
var list = base.QueryMuch<CoreCmsBillAftersalesItem, CoreCmsBillAftersales, QMAfterSalesItems>(
(child, parent) => new object[]
{
JoinType.Inner, child.aftersalesId == parent.aftersalesId
},
(child, parent) => new QMAftersalesItems
(child, parent) => new QMAfterSalesItems
{
orderItemsId = child.orderItemsId,
nums = child.nums,
@@ -127,7 +129,7 @@ namespace CoreCms.Net.Services
}
var billAftersales = base.QueryListByClause(where);
jm.data = new OrderToAftersalesDto
jm.data = new OrderToAfterSalesDto
{
refundMoney = refundMoney,
reshipGoods = reshipGoods,
@@ -181,19 +183,32 @@ namespace CoreCms.Net.Services
using var container = _serviceProvider.CreateScope();
var orderServices = container.ServiceProvider.GetService<ICoreCmsOrderServices>();
var settingServices = container.ServiceProvider.GetService<ICoreCmsSettingServices>();
var orderItemServices = container.ServiceProvider.GetService<ICoreCmsOrderItemServices>();
//var settingServices = container.ServiceProvider.GetService<ICoreCmsSettingServices>();
var imagesServices = container.ServiceProvider.GetService<ICoreCmsBillAftersalesImagesServices>();
var itemServices = container.ServiceProvider.GetService<ICoreCmsBillAftersalesItemServices>();
var result = await orderServices.GetOrderInfoByOrderId(orderId, userId);
if (result.status == false)
var aftersalesServices = container.ServiceProvider.GetService<ICoreCmsBillAftersalesServices>();
//判断是否存在还未处理的售后单据。
var haveAS = await aftersalesServices.ExistsAsync(p => p.orderId == orderId && p.userId == userId && p.status == (int)GlobalEnumVars.BillAftersalesStatus.WaitAudit);
if (haveAS)
{
jm.msg = "存在未处理的售后单";
jm.status = false;
return jm;
}
var orderInfo = await orderServices.QueryByClauseAsync(p => p.orderId == orderId && p.userId == userId);
if (orderInfo == null)
{
jm.msg = GlobalErrorCodeVars.Code13101;
jm.code = 13101;
return jm;
}
orderInfo.items = await orderItemServices.QueryListByClauseAsync(p => p.orderId == orderInfo.orderId);
var orderInfo = new CoreCmsOrder();
orderInfo = result.data as CoreCmsOrder;
orderServices.AfterSalesVal(orderInfo);
if (orderInfo.addAftersalesStatus == false)
{
@@ -202,7 +217,7 @@ namespace CoreCms.Net.Services
return jm;
}
//生成售后单号
var aftersalesId = CommonHelper.GetSerialNumberType((int)GlobalEnumVars.SerialNumberType.);
var afterSalesId = CommonHelper.GetSerialNumberType((int)GlobalEnumVars.SerialNumberType.);
//校验订单是否可以进行此售后,并且校验订单价格是否合理
var verifyResult = Verify(type, orderInfo, refund, items);
@@ -218,7 +233,6 @@ namespace CoreCms.Net.Services
verifyResult
};
//判断图片是否大于系统限定
//var allConfigs = await settingServices.GetConfigDictionaries();
@@ -229,9 +243,29 @@ namespace CoreCms.Net.Services
return jm;
}
var aftersalesItemData = new List<CoreCmsBillAftersalesItem>();
if (items != null && items.Any())
{
//如果是退货,判断退货明细,数量是否超出可退的数量
var aftersalesItems = FormatAfterSalesItems(orderInfo, items, afterSalesId);
if (!aftersalesItems.status)
{
return aftersalesItems;
}
//保存售后明细
if (aftersalesItems.data != null)
{
aftersalesItemData = aftersalesItems.data as List<CoreCmsBillAftersalesItem>;
}
else
{
jm.msg = "售后明细获取失败";
return jm;
}
}
var billAftersales = new CoreCmsBillAftersales();
billAftersales.aftersalesId = aftersalesId;
billAftersales.aftersalesId = afterSalesId;
billAftersales.orderId = orderId;
billAftersales.userId = userId;
billAftersales.type = type;
@@ -241,22 +275,7 @@ namespace CoreCms.Net.Services
billAftersales.createTime = DateTime.Now;
//保存主表数据
await _dal.InsertAsync(billAftersales);
if (items != null && items.Any())
{
//如果是退货,判断退货明细,数量是否超出可退的数量
var aftersalesItems = formatAftersalesItems(orderInfo, items, aftersalesId);
if (!aftersalesItems.status)
{
return aftersalesItems;
}
//保存售后明细
if (aftersalesItems.data != null)
{
var list = aftersalesItems.data as List<CoreCmsBillAftersalesItem>;
await itemServices.InsertAsync(list);
}
}
await itemServices.InsertAsync(aftersalesItemData);
//保存图片
if (images.Length > 0)
@@ -266,7 +285,7 @@ namespace CoreCms.Net.Services
{
imagesList.Add(new CoreCmsBillAftersalesImages()
{
aftersalesId = aftersalesId,
aftersalesId = afterSalesId,
imageUrl = images[i],
sortId = i
});
@@ -277,11 +296,15 @@ namespace CoreCms.Net.Services
//消息模板推送给客户
SmsHelper.SendMessage();
orderInfo.billAftersalesId = afterSalesId;
// 微信自定义交易组件-同步创建售后单
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.TransactionComponentAfterSaleCreateSync, JsonConvert.SerializeObject(orderInfo));
jm.status = true;
jm.data = billAftersales;
jm.msg = "售后申请成功!";
return jm;
}
#endregion
@@ -385,7 +408,7 @@ namespace CoreCms.Net.Services
/// <param name="items">前台选择的退货商品信息</param>
/// <param name="aftersalesId">将要保存的售后单的单号</param>
/// <returns></returns>
private WebApiCallBack formatAftersalesItems(CoreCmsOrder orderInfo, JArray items, string aftersalesId)
private WebApiCallBack FormatAfterSalesItems(CoreCmsOrder orderInfo, JArray items, string aftersalesId)
{
var jm = new WebApiCallBack();
var data = new List<CoreCmsBillAftersalesItem>();
@@ -433,7 +456,6 @@ namespace CoreCms.Net.Services
{
jm.msg = GlobalErrorCodeVars.Code13202;
jm.data = jm.code = 13202;
return jm;
}
jm.status = true;
@@ -533,7 +555,7 @@ namespace CoreCms.Net.Services
var billAftersalesItems = new List<CoreCmsBillAftersalesItem>();
if (items.Count > 0)
{
var aftersalesItems = formatAftersalesItems(orderInfo, items, aftersalesId);
var aftersalesItems = FormatAfterSalesItems(orderInfo, items, aftersalesId);
if (!aftersalesItems.status)
{
return aftersalesItems;
@@ -698,7 +720,6 @@ namespace CoreCms.Net.Services
}
}
}
//更新状态
await orderServices.UpdateAsync(
p => new CoreCmsOrder() { status = orderInfo.status, payStatus = orderInfo.payStatus },

View File

@@ -20,8 +20,8 @@ using CoreCms.Net.IServices;
using CoreCms.Net.Loging;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.ViewModels.Api;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Model.ViewModels.DTO;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using Flurl.Http;
using Google.Protobuf.WellKnownTypes;
@@ -69,6 +69,7 @@ namespace CoreCms.Net.Services
_redisOperationRepository = redisOperationRepository;
}
/// <summary>
/// 批量发货,可以支持多个订单合并发货,单个订单拆分发货等。
/// </summary>
@@ -82,8 +83,9 @@ namespace CoreCms.Net.Services
/// <param name="shipAreaId">省市区id</param>
/// <param name="shipAddress">收货地址</param>
/// <param name="memo">发货描述</param>
/// <param name="deliveryCompanyId">直播物流编码</param>
/// <returns></returns>
public async Task<WebApiCallBack> BatchShip(string[] orderId, string logiCode, string logiNo, Dictionary<int, int> items, int storeId = 0, string shipName = "", string shipMobile = "", int shipAreaId = 0, string shipAddress = "", string memo = "")
public async Task<WebApiCallBack> BatchShip(string[] orderId, string logiCode, string logiNo, Dictionary<int, int> items, int storeId = 0, string shipName = "", string shipMobile = "", int shipAreaId = 0, string shipAddress = "", string memo = "", string deliveryCompanyId = "")
{
using var container = _serviceProvider.CreateScope();
var jm = new WebApiCallBack();
@@ -139,7 +141,7 @@ namespace CoreCms.Net.Services
billDelivery.status = (int)GlobalEnumVars.BillDeliveryStatus.Already;
billDelivery.memo = memo;
billDelivery.createTime = DateTime.Now;
billDelivery.thirdPartylogiCode = deliveryCompanyId;
//设置发货明细
var bdRel = new List<CoreCmsBillDeliveryItem>();
@@ -229,15 +231,14 @@ namespace CoreCms.Net.Services
/// <param name="shipAreaId">省市区id</param>
/// <param name="shipAddress">收货地址</param>
/// <param name="memo">发货描述</param>
/// <param name="deliveryCompanyId">直播物流编码</param>
/// <returns></returns>
public async Task<WebApiCallBack> Ship(string orderId, string logiCode, string logiNo, Dictionary<int, int> items, int storeId = 0, string shipName = "", string shipMobile = "", int shipAreaId = 0, string shipAddress = "", string memo = "")
public async Task<WebApiCallBack> Ship(string orderId, string logiCode, string logiNo, Dictionary<int, int> items, int storeId = 0, string shipName = "", string shipMobile = "", int shipAreaId = 0, string shipAddress = "", string memo = "", string deliveryCompanyId = "")
{
using var container = _serviceProvider.CreateScope();
var jm = new WebApiCallBack();
var orderService = container.ServiceProvider.GetService<ICoreCmsOrderServices>();
var stockServices = container.ServiceProvider.GetService<ICoreCmsStockServices>();
//获取订单详情
var dInfoResult = await orderService.GetOrderShipInfo(orderId);
if (!dInfoResult.status)
@@ -287,7 +288,7 @@ namespace CoreCms.Net.Services
billDelivery.status = (int)GlobalEnumVars.BillDeliveryStatus.Already;
billDelivery.memo = memo;
billDelivery.createTime = DateTime.Now;
billDelivery.thirdPartylogiCode = deliveryCompanyId;
//设置发货明细
var bdRel = new List<CoreCmsBillDeliveryItem>();
@@ -315,6 +316,7 @@ namespace CoreCms.Net.Services
//构建发货单明细
var bdItem = new CoreCmsBillDeliveryItem();
bdItem.deliveryId = billDelivery.deliveryId;
bdItem.orderId = orderItem.orderId;
bdItem.productId = orderItem.productId;
bdItem.goodsId = orderItem.goodsId;
bdItem.bn = orderItem.bn;
@@ -322,7 +324,7 @@ namespace CoreCms.Net.Services
bdItem.weight = orderItem.weight;
bdItem.name = orderItem.name;
bdItem.addon = !string.IsNullOrEmpty(orderItem.addon) ? orderItem.addon : "";
bdItem.nums = item.Value;
bdItem.nums = orderItem.nums;
bdRel.Add(bdItem);
}
if (tNum < 1)
@@ -342,16 +344,8 @@ namespace CoreCms.Net.Services
//订单更新发货状态,发送各种消息
await OrderShip(orderInfo, items, billDelivery, storeId);
var stock = new CoreCmsStock
{
manager = 0,
id = billDelivery.deliveryId,
createTime = DateTime.Now,
type = (int)GlobalEnumVars.StockType.DeliverGoods,
memo = "订单发货操作,发货单号:" + billDelivery.deliveryId
};
await stockServices.InsertAsync(stock);
//发货同步处理
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.TransactionComponentOrderShipSync, billDelivery.deliveryId);
jm.status = true;
jm.msg = "发货成功";

View File

@@ -7,13 +7,13 @@
<ItemGroup>
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.13.0" />
<PackageReference Include="Essensoft.Paylink.WeChatPay" Version="4.0.8" />
<PackageReference Include="Flurl.Http" Version="3.2.1" />
<PackageReference Include="Flurl.Http" Version="3.2.2" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
<PackageReference Include="Qc.YilianyunSdk" Version="1.0.7" />
<PackageReference Include="Qiniu" Version="8.0.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.4" />
<PackageReference Include="SixLabors.ImageSharp" Version="2.0.0" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta13" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="Tencent.QCloud.Cos.Sdk" Version="5.4.26" />

View File

@@ -25,13 +25,11 @@ using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.Basics;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Model.ViewModels.DTO;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Extensions;
using CoreCms.Net.Utility.Helper;
using Microsoft.AspNetCore.Http;
using Microsoft.Net.Http.Headers;
using Microsoft.OpenApi.Validations;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SqlSugar;
@@ -75,6 +73,11 @@ namespace CoreCms.Net.Services
private readonly ISysTaskLogServices _taskLogServices;
private readonly ICoreCmsPromotionRecordServices _promotionRecordServices;
private readonly IRedisOperationRepository _redisOperationRepository;
private readonly ICoreCmsUserWeChatInfoServices _userWeChatInfoServices;
private readonly IWeChatTransactionComponentOrderServices _tcOrderServices;
public CoreCmsOrderServices(ICoreCmsOrderRepository dal
, IHttpContextAccessor httpContextAccessor
@@ -100,7 +103,7 @@ namespace CoreCms.Net.Services
, ICoreCmsPaymentsServices paymentsServices
, ICoreCmsBillRefundServices billRefundServices
, ICoreCmsBillLadingServices billLadingServices
, ICoreCmsBillReshipServices billReshipServices, ICoreCmsMessageCenterServices messageCenterServices, ICoreCmsGoodsCommentServices goodsCommentServices, ISysTaskLogServices taskLogServices, ICoreCmsPromotionRecordServices promotionRecordServices, IRedisOperationRepository redisOperationRepository)
, ICoreCmsBillReshipServices billReshipServices, ICoreCmsMessageCenterServices messageCenterServices, ICoreCmsGoodsCommentServices goodsCommentServices, ISysTaskLogServices taskLogServices, ICoreCmsPromotionRecordServices promotionRecordServices, IRedisOperationRepository redisOperationRepository, ICoreCmsUserWeChatInfoServices userWeChatInfoServices, IWeChatTransactionComponentOrderServices tcOrderServices)
{
this._dal = dal;
base.BaseDal = dal;
@@ -134,6 +137,8 @@ namespace CoreCms.Net.Services
_taskLogServices = taskLogServices;
_promotionRecordServices = promotionRecordServices;
_redisOperationRepository = redisOperationRepository;
_userWeChatInfoServices = userWeChatInfoServices;
_tcOrderServices = tcOrderServices;
}
@@ -246,6 +251,7 @@ namespace CoreCms.Net.Services
order.status = (int)GlobalEnumVars.OrderStatus.Normal;
order.confirmStatus = (int)GlobalEnumVars.OrderConfirmStatus.ReceiptNotConfirmed;
order.createTime = DateTime.Now;
order.scene = scene;
//开始事务处理
await _dal.InsertAsync(order);
@@ -820,7 +826,7 @@ namespace CoreCms.Net.Services
if (item.status == (int)GlobalEnumVars.BillAftersalesStatus.WaitAudit) break;
}
}
//把退款金额和退货商品查出来
//把退款金额和退货商品查出来判断是否能进行售后
AfterSalesVal(order, aftersaleLevel);
//促销信息
if (!string.IsNullOrEmpty(order.promotionList))
@@ -830,7 +836,7 @@ namespace CoreCms.Net.Services
//发票信息
var invoiceModel = await _invoiceServices.GetOrderInvoiceInfo(order.orderId);
if (invoiceModel != null && invoiceModel.status)
if (invoiceModel is { status: true })
{
order.invoice = invoiceModel.data;
}
@@ -844,6 +850,9 @@ namespace CoreCms.Net.Services
};
}
order.tcOrder = await _tcOrderServices.QueryByClauseAsync(p => p.outOrderId == order.orderId);
jm.status = true;
jm.data = order;
jm.msg = GlobalConstVars.GetDataSuccess;
@@ -853,9 +862,9 @@ namespace CoreCms.Net.Services
#endregion
#region 退退
#region 退退
/// <summary>
/// 把退款金额和退货商品数量保存起来
/// 把退款金额和退货商品查出来判断是否能进行售后
/// </summary>
/// <param name="order"></param>
/// <param name="aftersaleLevel">取售后单的时候售后单的等级0待审核的和审核通过的售后单1未审核的2审核通过的</param>
@@ -863,7 +872,7 @@ namespace CoreCms.Net.Services
{
var addAftersalesStatus = false;
var res = _billAftersalesServices.OrderToAftersales(order.orderId, aftersaleLevel);
var resData = res.data as OrderToAftersalesDto;
var resData = res.data as OrderToAfterSalesDto;
//已经退过款的金额
order.refunded = resData.refundMoney;
//算退货商品数量
@@ -1126,7 +1135,7 @@ namespace CoreCms.Net.Services
/// 商家获取订单列表-微信小程序
/// </summary>
/// <returns></returns>
public async Task<WebApiCallBack> GetOrderPageByMerchant(string dateType, string[] date, int status = 0, int storeId = 0, int page = 1, int limit = 5)
public async Task<WebApiCallBack> GetOrderPageByMerchant(string dateType, string[] date, int status = 0, int receiptType = 0, int storeId = 0, int page = 1, int limit = 5)
{
var jm = new WebApiCallBack { status = true };
@@ -1139,6 +1148,12 @@ namespace CoreCms.Net.Services
where = where.And(p => p.storeId == storeId);
}
if (receiptType > 0)
{
where = where.And(p => p.receiptType == receiptType);
}
DateTime dt = DateTime.Now;
if (dateType == "today")
@@ -1171,6 +1186,7 @@ namespace CoreCms.Net.Services
//本月第一天时间
DateTime dtFirst = dt.AddDays(1 - (dt.Day));
dtFirst = new DateTime(dtFirst.Year, dtFirst.Month, dtFirst.Day, 0, 0, 0);
//获得某年某月的天数
int dayCount = DateTime.DaysInMonth(dt.Date.Year, dt.Date.Month);
//本月最后一天时间
@@ -1231,7 +1247,6 @@ namespace CoreCms.Net.Services
#endregion
#region -
/// <summary>
/// 商家获取订单列表通过检索手机号码和订单号-微信小程序
@@ -1296,6 +1311,7 @@ namespace CoreCms.Net.Services
#endregion
#region
/// <summary>
@@ -1329,15 +1345,14 @@ namespace CoreCms.Net.Services
order.paymentCode = paymentCode;
order.payStatus = (int)GlobalEnumVars.OrderPayStatus.Yes;
var isUpdate = await _dal.UpdateAsync(
p => new CoreCmsOrder()
{
paymentCode = paymentCode,
payStatus = (int)GlobalEnumVars.OrderPayStatus.Yes,
paymentTime = order.paymentTime,
payedAmount = order.orderAmount,
updateTime = order.updateTime
}, p => p.orderId == order.orderId);
var isUpdate = await _dal.UpdateAsync(p => new CoreCmsOrder()
{
paymentCode = paymentCode,
payStatus = (int)GlobalEnumVars.OrderPayStatus.Yes,
paymentTime = order.paymentTime,
payedAmount = order.orderAmount,
updateTime = order.updateTime
}, p => p.orderId == order.orderId);
jm.data = isUpdate;
if (isUpdate)
@@ -1723,6 +1738,7 @@ namespace CoreCms.Net.Services
}
#endregion
#region
/// <summary>
/// 构建单个需要发货的数据,和发货单密切关联
@@ -1772,7 +1788,6 @@ namespace CoreCms.Net.Services
}
AfterSalesVal(orderInfo, 0);
if (!jm.status)
{
return jm;
@@ -1885,7 +1900,7 @@ namespace CoreCms.Net.Services
Dictionary<int, int> items, string shipName, string shipMobile, string shipAddress, string memo, int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "")
{
var result = await _billDeliveryServices.BatchShip(ids, logiCode, logiNo, items, storeId, shipName, shipMobile, shipAreaId, shipAddress, memo);
var result = await _billDeliveryServices.BatchShip(ids, logiCode, logiNo, items, storeId, shipName, shipMobile, shipAreaId, shipAddress, memo, deliveryCompanyId);
return result;
}
@@ -1911,14 +1926,12 @@ namespace CoreCms.Net.Services
public async Task<WebApiCallBack> Ship(string orderId, string logiCode, string logiNo,
Dictionary<int, int> items, string shipName, string shipMobile, string shipAddress, string memo, int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "")
{
var result = await _billDeliveryServices.Ship(orderId, logiCode, logiNo, items, storeId, shipName, shipMobile, shipAreaId, shipAddress, memo);
var result = await _billDeliveryServices.Ship(orderId, logiCode, logiNo, items, storeId, shipName, shipMobile, shipAreaId, shipAddress, memo, deliveryCompanyId);
return result;
}
#endregion
#region
/// <summary>
@@ -1991,6 +2004,10 @@ namespace CoreCms.Net.Services
//订单完成结算订单
await _redisOperationRepository.SortedSetAddAsync(RedisMessageQueueKey.OrderFinishCommand, orderInfo.orderId, score);
// 微信自定义交易组件-订单确认收货
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.TransactionComponentOrderDeliveryRecieveSync, JsonConvert.SerializeObject(orderInfo));
jm.status = true;
jm.msg = "订单完成";
@@ -2026,12 +2043,19 @@ namespace CoreCms.Net.Services
where = where.And(p => p.status == (int)GlobalEnumVars.OrderStatus.Normal);
where = where.And(p => p.confirmStatus != (int)GlobalEnumVars.OrderConfirmStatus.ConfirmReceipt);
var orderInfo = await _dal.QueryByClauseAsync(where);
if (orderInfo == null)
{
jm.status = false;
jm.msg = "订单查询失败";
}
var bl = await _dal.UpdateAsync(
p => new CoreCmsOrder()
{
confirmStatus = (int)GlobalEnumVars.OrderConfirmStatus.ConfirmReceipt,
confirmTime = DateTime.Now
}, where);
}, p => p.orderId == orderInfo.orderId);
if (!bl)
{
jm.msg = "确认收货失败";
@@ -2050,6 +2074,10 @@ namespace CoreCms.Net.Services
};
await _orderLogServices.InsertAsync(orderLog);
// 微信自定义交易组件-订单确认收货
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.TransactionComponentOrderDeliveryRecieveSync, JsonConvert.SerializeObject(orderInfo));
jm.status = true;
jm.msg = "确认收货成功";
@@ -2096,6 +2124,7 @@ namespace CoreCms.Net.Services
}
#endregion
#region
/// <summary>
/// 重写根据条件列表数据

View File

@@ -151,6 +151,7 @@ namespace CoreCms.Net.Services
if (payment != null)
{
var is_matched = 0;
var sceneResponse = new ShopSceneCheckResponse();
#region
var orderModel = await orderServices.QueryByClauseAsync(p => p.orderId == payment.sourceId);
var orderInfo = new OrderInfo();
@@ -165,9 +166,10 @@ namespace CoreCms.Net.Services
sceneRequest.AccessToken = accessToken;
sceneRequest.Scene = orderModel.scene;
var sceneResponse = await client.ExecuteShopSceneCheckAsync(sceneRequest);
sceneResponse = await client.ExecuteShopSceneCheckAsync(sceneRequest);
is_matched = sceneResponse.IsMatched ? 1 : 0;
if (sceneResponse.IsSuccessful() && sceneResponse.IsMatched == true)
//if (sceneResponse.IsSuccessful() && sceneResponse.IsMatched == true)
if (sceneResponse.IsSuccessful())
{
//基础
orderInfo.create_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
@@ -246,6 +248,8 @@ namespace CoreCms.Net.Services
});
}
var tcOrder = await weChatTransactionComponentOrderServices.QueryByClauseAsync(p => p.outOrderId == orderModel.orderId);
if (tcOrder == null)
{
@@ -267,7 +271,8 @@ namespace CoreCms.Net.Services
orderInfo,
checkSceneResult = new
{
is_matched
is_matched,
sceneResponse
}
};

View File

@@ -156,7 +156,6 @@ namespace CoreCms.Net.Services
item.parameters = item.parameters.Replace("/images/empty-banner.png", "/static/images/common/empty-banner.png");
if (item.widgetCode == "search") //搜索
{
dto.parameters = (JObject)JsonConvert.DeserializeObject(item.parameters);
@@ -280,6 +279,7 @@ namespace CoreCms.Net.Services
{
var list = JArray.Parse(parameters["list"].ToString());
var newList = new JArray();
var count = 0;
foreach (var jToken in list)
{
var child = (JObject)jToken;
@@ -373,6 +373,7 @@ namespace CoreCms.Net.Services
child.Add("list", new JArray());
}
}
count++;
newList.Add(child);
}
@@ -384,7 +385,6 @@ namespace CoreCms.Net.Services
}
dto.parameters = parameters;
}
else if (item.widgetCode == "goods")
{
JObject parameters = (JObject)JsonConvert.DeserializeObject(item.parameters);
@@ -437,7 +437,7 @@ namespace CoreCms.Net.Services
else
{
var orderBy = string.Empty;
var goodidsStr = string.Empty;
string goodidsStr;
if (parameters != null && parameters.ContainsKey("list"))
{
JArray result = JArray.Parse(parameters["list"].ToString());
@@ -533,10 +533,10 @@ namespace CoreCms.Net.Services
var promotionId = ((JObject)ss)["id"].ObjectToInt(0);
if (promotionId > 0)
{
var promotionModel = await _promotionServices.QueryByClauseAsync(p => p.id == promotionId && p.isEnable == true && p.startTime <= dt && p.endTime > dt);
var promotionModel = await _promotionServices.QueryByClauseAsync(p => p.id == promotionId && p.isEnable == true && p.startTime <= dt && p.endTime > dt, true);
if (promotionModel != null)
{
var condition = await _promotionConditionServices.QueryByClauseAsync(p => p.promotionId == promotionId);
var condition = await _promotionConditionServices.QueryByClauseAsync(p => p.promotionId == promotionId, true);
if (condition != null)
{
var obj = (JObject)JsonConvert.DeserializeObject(condition.parameters);

View File

@@ -1,6 +1,6 @@
<template>
<view class="coreshop-margin-left-10 coreshop-margin-right-10 coreshop-margin-bottom-10 coreshop-margin-top-10 coreshop-bg-white">
<u-swiper :list="swiperItems" keyName="image" @click="taped"></u-swiper>
<u-swiper :list="swiperItems" :height="swiperHeight" :interval="swiperDuration" keyName="image" @click="taped"></u-swiper>
</view>
</template>
@@ -16,6 +16,8 @@
data() {
return {
swiperItems: [],
swiperHeight: 130,
swiperDuration: 2500,
};
},
computed: {
@@ -37,6 +39,8 @@
}
this.swiperItems.push(moder);
}
this.swiperHeight = this.coreshopdata.parameters.height;
this.swiperDuration = this.coreshopdata.parameters.duration;
},
watch: {},
methods: {

View File

@@ -128,7 +128,8 @@
case 'wechatpay':
this.$u.api.pay(data).then(res => {
if (res.status) {
if (res.otherData.checkSceneResult && res.otherData.checkSceneResult.is_matched == 1) {
if (res.otherData.checkSceneResult) {
console.log("自定义交易组件");
wx.requestOrderPayment({
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,

View File

@@ -13,7 +13,7 @@
</button>
</view>
</view>
<view class="coreshop-bottomBox">
<view class="coreshop-share-bottomBox">
<button class="coreshop-btn coreshop-btn-w coreshop-btn-square" @click="close()">关闭</button>
</view>
</view>

View File

@@ -27,7 +27,9 @@
</view>
</view>
<view class="item coreshop-solid-bottom coreshop-margin-top-5 coreshop-margin-padding-10 coreshop-padding-bottom-5">
<view class="left"><image :src="item.thumbnail && item.thumbnail!='null' ? item.thumbnail : '/static/images/common/empty-banner.png'" mode="aspectFill"></image></view>
<view class="left">
<u--image :showLoading="true" :src="item.thumbnail && item.thumbnail!='null' ? item.thumbnail : '/static/images/common/empty-banner.png'" width="80px" height="80px"></u--image>
</view>
<view class="content">
<view class="title u-line-2">{{item.title}}</view>
<view class="type u-line-2">{{item.description}}</view>

View File

@@ -65,12 +65,15 @@
/*分享浮层*/
.coreshop-share-Box { width: 100%; height: 120px; background: #FFFFFF; }
.coreshop-share-pop { height: 120px; width: 100%; display: flex; }
.coreshop-share-Box { width: 100%; background: #FFFFFF; }
.coreshop-share-pop { width: 100%; display: flex; }
.coreshop-share-item { flex: 1; text-align: center; font-size: 13px; color: #333; padding: 10px 0;
image { width: 40px; height: 40px; margin: 10px; }
.coreshop-btn { line-height: 1; display: block; font-size: 13px; background-color: #fff; }
}
.coreshop-share-bottomBox { background-color: #fff; height: 45px; width: 100%; display: flex; box-shadow: 0 0 10px #ccc;
.coreshop-btn { flex: 1; }
}
//顶部通用标题
.coreshop-bar-view-box { position: fixed; top: 0; width: 100%; z-index: 10000; background: #FAFAFA; /* #ifndef MP */ height: calc(var(--status-bar-height) + 50px); /* #endif */ /* #ifdef MP */ height: calc(var(--status-bar-height) + 65px); /* #endif */ padding: var(--status-bar-height) 14px 0 14px; align-items: center;
@@ -156,8 +159,7 @@
.orderWrap { display: flex; flex-direction: column; height: calc(100vh - var(--window-top)); width: 100%; }
.orderList { background-color: #ffffff; margin: 10px; border-radius: 10px; box-sizing: border-box; padding: 10px; font-size: 14px;
.item { display: flex; margin: 10px 0 0;
.left { margin-right: 10px;
}
.left { margin-right: 10px; }
.content {
.title { font-size: 14px; line-height: 25px; }
.type { margin: 5px 0; font-size: 12px; color: $core-tips-color; }
@@ -632,4 +634,4 @@
.contact-btn { margin: 0 auto; }
.contact-btn { margin: 0 auto; }

View File

@@ -55,8 +55,15 @@ namespace CoreCms.Net.WeChat.Service.Configuration
#endregion
#region
/// <summary>
/// 商品审核结果回调
/// </summary>
public const string OpenProductSpuAudit = "open_product_spu_audit";
/// <summary>
/// 类目审核结果回调
/// </summary>
public const string OpenProductCategoryAudit = "open_product_category_audit";
#endregion

View File

@@ -26,10 +26,9 @@ using CoreCms.Net.IServices;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.Echarts;
using CoreCms.Net.Model.ViewModels.Options;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Model.ViewModels.DTO;
using CoreCms.Net.Model.ViewModels.Echarts;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Extensions;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.WeChat.Service.HttpClients;
@@ -38,7 +37,6 @@ using COSXML.Auth;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using SKIT.FlurlHttpClient.Wechat.Api;
using SKIT.FlurlHttpClient.Wechat.Api.Models;
@@ -56,7 +54,6 @@ namespace CoreCms.Net.Web.Admin.Controllers
public class ToolsController : ControllerBase
{
private readonly ICoreCmsAreaServices _areaServices;
private readonly ICodeGeneratorServices _codeGeneratorServices;
private readonly ICoreCmsArticleServices _coreCmsArticleServices;
private readonly ICoreCmsArticleTypeServices _coreCmsArticleTypeServices;
private readonly ICoreCmsFormServices _coreCmsFormServices;
@@ -89,9 +86,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
private readonly IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
/// <summary>
/// 构造函数
@@ -112,8 +107,9 @@ namespace CoreCms.Net.Web.Admin.Controllers
, ISysRoleServices sysRoleServices
, ISysMenuServices sysMenuServices
, ISysUserRoleServices sysUserRoleServices
, ISysOrganizationServices sysOrganizationServices, ICodeGeneratorServices codeGeneratorServices,
ICoreCmsLogisticsServices logisticsServices, ISysLoginRecordServices sysLoginRecordServices, ISysNLogRecordsServices sysNLogRecordsServices, ICoreCmsBillPaymentsServices paymentsServices, ICoreCmsBillDeliveryServices billDeliveryServices, ICoreCmsUserServices userServices, ICoreCmsOrderServices orderServices, ICoreCmsBillAftersalesServices aftersalesServices, ICoreCmsSettingServices settingServices, ICoreCmsProductsServices productsServices, ICoreCmsServicesServices servicesServices, IOptions<FilesStorageOptions> filesStorageOptions, ISysRoleMenuServices sysRoleMenuServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, ICoreCmsPagesServices pagesServices, IToolsServices toolsServices)
, ISysOrganizationServices sysOrganizationServices,
ICoreCmsLogisticsServices logisticsServices, ISysLoginRecordServices sysLoginRecordServices, ISysNLogRecordsServices sysNLogRecordsServices, ICoreCmsBillPaymentsServices paymentsServices, ICoreCmsBillDeliveryServices billDeliveryServices, ICoreCmsUserServices userServices, ICoreCmsOrderServices orderServices, ICoreCmsBillAftersalesServices aftersalesServices, ICoreCmsSettingServices settingServices, ICoreCmsProductsServices productsServices, ICoreCmsServicesServices servicesServices, ISysRoleMenuServices sysRoleMenuServices
, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, ICoreCmsPagesServices pagesServices, IToolsServices toolsServices)
{
_user = user;
_webHostEnvironment = webHostEnvironment;
@@ -132,7 +128,6 @@ namespace CoreCms.Net.Web.Admin.Controllers
_sysMenuServices = sysMenuServices;
_sysUserRoleServices = sysUserRoleServices;
_sysOrganizationServices = sysOrganizationServices;
_codeGeneratorServices = codeGeneratorServices;
_logisticsServices = logisticsServices;
_sysLoginRecordServices = sysLoginRecordServices;
_sysNLogRecordsServices = sysNLogRecordsServices;
@@ -145,6 +140,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
_productsServices = productsServices;
_servicesServices = servicesServices;
_sysRoleMenuServices = sysRoleMenuServices;
_weChatApiHttpClientFactory = weChatApiHttpClientFactory;
_pagesServices = pagesServices;
_toolsServices = toolsServices;
@@ -264,6 +260,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
return jm;
}
if (entity.password == entity.oldPassword)
{
jm.msg = "请设置与旧密码不同的新密码";
@@ -619,7 +616,6 @@ namespace CoreCms.Net.Web.Admin.Controllers
if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.LocalStorage.ToString())
{
url = _toolsServices.UpLoadBase64ForLocalStorage(filesStorageOptions, memStream);
}
else if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.AliYunOSS.ToString())
{
@@ -776,7 +772,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
var newObj = list.Select(p => new
{
p.id,
image = !string.IsNullOrEmpty(p.images) ? p.images.Split(",")[0] : "/static/images/common/empty.png",
p.image,
p.images,
p.price,
p.name,
@@ -830,6 +826,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
#endregion
#region ====================================================
// POST: Api/Tools/GetProducts
@@ -891,6 +888,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
#endregion
#region ============================================================
// POST: Api/Tools/GetArticles
@@ -912,8 +910,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
if (!string.IsNullOrEmpty(title)) where = where.And(p => p.title.Contains(title));
//获取数据
var list = await _coreCmsArticleServices.QueryPageAsync(where, p => p.id, OrderByType.Asc, pageCurrent,
pageSize);
var list = await _coreCmsArticleServices.QueryPageAsync(where, p => p.id, OrderByType.Asc, pageCurrent, pageSize);
//返回数据
jm.data = list;
jm.code = 0;
@@ -1221,6 +1218,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
}
}
jm = await _logisticsServices.ExpressPoll(entity.code, entity.no, entity.mobile);
return jm;
@@ -1251,12 +1249,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
var menuIds = sysRoleMenu.Select(p => p.menuId).ToList();
var where = PredicateBuilder.True<SysMenu>();
where = where.And(p => p.deleted == false && p.hide == false && p.menuType == 0);
where = where.And(p => menuIds.Contains(p.id));
var navs = await _sysMenuServices.QueryListByClauseAsync(where, p => p.sortNumber, OrderByType.Asc);
var navs = await _sysMenuServices.QueryListByClauseAsync(p => menuIds.Contains(p.id) && p.deleted == false && p.hide == false && p.menuType == 0, p => p.sortNumber, OrderByType.Asc);
var menus = GetMenus(navs, 0);
jm.data = menus;
@@ -1519,8 +1512,8 @@ namespace CoreCms.Net.Web.Admin.Controllers
var series = new List<SeriesDataIntItem>
{
new SeriesDataIntItem() {name = "新增记录", type = "line", data = regs.Select(p => p.nums).ToList()},
new SeriesDataIntItem() {name = "活跃记录", type = "line", data = orders.Select(p => p.nums).ToList()}
new() {name = "新增记录", type = "line", data = regs.Select(p => p.nums).ToList()},
new() {name = "活跃记录", type = "line", data = orders.Select(p => p.nums).ToList()}
};
@@ -1581,12 +1574,13 @@ namespace CoreCms.Net.Web.Admin.Controllers
goodsStaticsTotalWarn
};
return jm;
}
#endregion
//微信自定义交易组件================================================================
#region ====================================================
@@ -1717,5 +1711,163 @@ namespace CoreCms.Net.Web.Admin.Controllers
#endregion
#region (Url交换)====================================================
/// <summary>
/// 自定义交易组件上传图片(Url交换)
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<AdminUiCallBack> MiNiShopOpenComponent2_UploadImgByUrl([FromBody] FMStringId entity)
{
var jm = new AdminUiCallBack();
var filesStorageOptions = await _coreCmsSettingServices.GetFilesStorageOptions();
if (string.IsNullOrEmpty(entity.id))
{
jm.msg = "请提交合法图片地址";
return jm;
}
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
var request = new ShopImageUploadRequest();
request.AccessToken = accessToken;
request.ImageUrl = entity.id;
request.ResponseType = 1;
var response = await client.ExecuteShopImageUploadAsync(request);
if (response.IsSuccessful())
{
jm.code = 0;
jm.msg = "上传成功!";
jm.data = new
{
fileUrl = response.Image.TempImageUrl,
src = response.Image.TempImageUrl
};
}
else
{
jm.code = 1;
jm.msg = response.ErrorMessage;
}
jm.otherData = response;
return jm;
}
#endregion
#region (Url交换)====================================================
/// <summary>
/// 自定义交易组件上传图片(Url交换)
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<AdminUiCallBack> MiNiShopOpenComponent2_UploadImgByUrlArr([FromBody] FMArrayStringIds entity)
{
var jm = new AdminUiCallBack();
var filesStorageOptions = await _coreCmsSettingServices.GetFilesStorageOptions();
if (entity.id.Length <= 0)
{
jm.msg = "请提交合法图片地址";
return jm;
}
var urlArr = new String[] { "store.mp.video.tencent-cloud.com", "mmbizurl.cn", "mmecimage.cn" };
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
for (var index = 0; index < entity.id.Length; index++)
{
var img = entity.id[index];
if (img.Contains(urlArr[0]) || img.Contains(urlArr[1]) || img.Contains(urlArr[2]))
{
continue;
}
else
{
var request = new ShopImageUploadRequest();
request.AccessToken = accessToken;
request.ImageUrl = img;
request.ResponseType = 1;
var response = await client.ExecuteShopImageUploadAsync(request);
if (response.IsSuccessful())
{
entity.id[index] = response.Image.TempImageUrl;
}
}
}
jm.code = 0;
jm.msg = "同步成功";
jm.data = entity.id;
return jm;
}
#endregion
#region (Url交换单张)====================================================
/// <summary>
/// 自定义交易组件上传图片(Url交换单张)
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<AdminUiCallBack> MiNiShopOpenComponent2_UploadImgByUrlSingle([FromBody] FMStringId entity)
{
var jm = new AdminUiCallBack();
var filesStorageOptions = await _coreCmsSettingServices.GetFilesStorageOptions();
if (string.IsNullOrEmpty(entity.id))
{
jm.msg = "请提交合法图片地址";
return jm;
}
var urlArr = new String[] { "store.mp.video.tencent-cloud.com", "mmbizurl.cn", "mmecimage.cn" };
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
if (entity.id.Contains(urlArr[0]) || entity.id.Contains(urlArr[1]) || entity.id.Contains(urlArr[2]))
{
jm.msg = "合法图片,无需同步";
return jm;
}
else
{
var request = new ShopImageUploadRequest();
request.AccessToken = accessToken;
request.ImageUrl = entity.id;
request.ResponseType = 1;
var response = await client.ExecuteShopImageUploadAsync(request);
if (response.IsSuccessful())
{
jm.code = 0;
jm.msg = "同步成功";
jm.data = response.Image.TempImageUrl;
}
else
{
jm.code = 1;
jm.msg = "同步失败" + response.ErrorMessage;
}
}
return jm;
}
#endregion
}
}

View File

@@ -19,6 +19,7 @@ using CoreCms.Net.Caching.AutoMate.RedisCache;
using CoreCms.Net.Configuration;
using CoreCms.Net.Filter;
using CoreCms.Net.IServices;
using CoreCms.Net.Loging;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
@@ -31,6 +32,7 @@ using CoreCms.Net.WeChat.Service.TransactionComponent.Enum;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using NPOI.HSSF.UserModel;
using NPOI.SS.Util;
using SKIT.FlurlHttpClient.Wechat.Api;
@@ -1221,7 +1223,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
//订单状态 int
var orderUnifiedStatus = Request.Form["orderUnifiedStatus"].FirstOrDefault().ObjectToInt(0);
var orderUnifiedStatus = ObjectExtensions.ObjectToInt(Request.Form["orderUnifiedStatus"].FirstOrDefault(), 0);
if (orderUnifiedStatus > 0)
{
if (orderUnifiedStatus == (int)GlobalEnumVars.OrderCountType.payment)
@@ -1776,6 +1778,29 @@ namespace CoreCms.Net.Web.Admin.Controllers
p => p.id == tcOrder.id && p.outOrderId == tcOrder.outOrderId);
}
if (response.Order is { OrderId: > 0 } && (response.Order.Status == 11 || response.Order.Status == 10) && (orderModel.payStatus == (int)GlobalEnumVars.OrderPayStatus.Yes || orderModel.payStatus == (int)GlobalEnumVars.OrderPayStatus.PartialYes))
{
var payment = await _billPaymentsServices.QueryByClauseAsync(p =>
p.sourceId == orderModel.orderId && p.status == (int)GlobalEnumVars.BillPaymentsStatus.Payed);
if (payment != null)
{
var userInfo = await _userWeChatInfoServices.QueryByClauseAsync(p => p.userId == orderModel.userId);
//获取同步地址接口地址
var refreshRequest = new ShopOrderPayRequest();
refreshRequest.AccessToken = accessToken;
refreshRequest.OutOrderId = orderModel.orderId;
refreshRequest.OpenId = userInfo.openid;
refreshRequest.ActionType = 1;
refreshRequest.TransactionId = payment.tradeNo;
refreshRequest.PayTime = payment.createTime;
var refreshResponse = await client.ExecuteShopOrderPayAsync(refreshRequest);
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "自定义交易组件-手动同步", JsonConvert.SerializeObject(refreshResponse));
}
}
return jm;
}

View File

@@ -429,8 +429,8 @@ namespace CoreCms.Net.Web.Admin.Controllers
item.OutProductId = p.outProductId;
item.OutSKUId = p.outSkuId;
item.ThumbnailUrl = p.thumbImg;
item.SalePrice = p.salePrice * 100;
item.MarketPrice = p.marketPrice * 100;
item.SalePrice = Convert.ToInt32(p.salePrice * 100);
item.MarketPrice = Convert.ToInt32(p.marketPrice * 100);
item.Stock = p.stockNum;
item.BarCode = p.barCode;
item.SKUCode = p.skuCode;
@@ -536,8 +536,8 @@ namespace CoreCms.Net.Web.Admin.Controllers
item.OutProductId = p.outProductId;
item.OutSKUId = p.outSkuId;
item.ThumbnailUrl = p.thumbImg;
item.SalePrice = p.salePrice * 100;
item.MarketPrice = p.marketPrice * 100;
item.SalePrice = Convert.ToInt32(p.salePrice * 100);
item.MarketPrice = Convert.ToInt32(p.marketPrice * 100);
item.Stock = p.stockNum;
item.BarCode = p.barCode;
item.SKUCode = p.skuCode;

View File

@@ -66,7 +66,7 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.0.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.0.1" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.1.0" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.1.0" />

View File

@@ -4,6 +4,7 @@ var allWidget = {
"name": "图片轮播",
"value": {
"duration": 2500,
"height": 130,
"list": [{
"image": "/static/images/common/empty-banner.png",
"linkType": '',

View File

@@ -28,7 +28,7 @@ layui.define(['laytpl', 'layer', 'element', 'util'], function (exports) {
//额外增加
, apiUrl: '/' //api请求地址
, fileUrl: '/' //资源请求地址
, noImagePicUrl: layui.cache.base + 'style/res/noImage.jpg' //api请求地址
, noImagePicUrl: 'https://files.cdn.coreshop.cn/static/images/empty/noImage.jpg' //api请求地址
//自定义响应字段
, response: {

View File

@@ -822,6 +822,13 @@
<p class="layout-tip">轮播图自动切换的间隔时间,单位:毫秒</p>
</div>
</div>
<div class="content-item">
<span class="item-label">高度:</span>
<div class="number-content ml20">
<input type="number" :step="10" v-model.number="selectWg.value.height" :min="0" class="number-input">
<p class="layout-tip">默认高度为130px单位像素</p>
</div>
</div>
<draggable element="ul" :list="selectWg.value.list"
:options="{group:{ name:'slideList'}, ghostClass: 'ghost',animation: 150,handle:'.drag-block'}">
<li v-for="(item, index) in selectWg.value.list" :key="index">

View File

@@ -158,11 +158,14 @@
, url: layui.setter.apiUrl + 'Api/Tools/MiNiShopOpenComponent2_UploadImg'
, before: function (obj) {
obj.preview(function (index, file, result) {
layer.msg('上传中', { icon: 16, shade: 0.4 });
});
}
, done: function (res) {
if (res.code > 0) { return layer.msg('上传失败'); }
layer.closeAll('loading'); //关闭加载层
if (res.code > 0) {
return layer.msg('上传失败');
}
layer.msg('上传成功');
$('#viewImgBoxlicenseImage').attr('src', res.data.fileUrl);
$("#licenseImageInput").val(res.data.fileUrl);
@@ -182,11 +185,14 @@
, url: layui.setter.apiUrl + 'Api/Tools/MiNiShopOpenComponent2_UploadImg'
, before: function (obj) {
obj.preview(function (index, file, result) {
//$('#viewImgBoxlicenseImage').attr('src', result);
layer.msg('上传中', { icon: 16, shade: 0.4 });
});
}
, done: function (res) {
if (res.code > 0) { return layer.msg('上传失败'); }
layer.closeAll('loading'); //关闭加载层
if (res.code > 0) {
return layer.msg('上传失败');
}
layer.msg('上传成功');
imgs.push(res.data.fileUrl);
$('#certificateImage').val(imgs);

View File

@@ -166,11 +166,14 @@
, url: layui.setter.apiUrl + 'Api/Tools/MiNiShopOpenComponent2_UploadImg'
, before: function (obj) {
obj.preview(function (index, file, result) {
layer.msg('上传中', { icon: 16, shade: 0.4 });
});
}
, done: function (res) {
if (res.code > 0) { return layer.msg('上传失败'); }
layer.closeAll('loading'); //关闭加载层
if (res.code > 0) {
return layer.msg('上传失败');
}
layer.msg('上传成功');
$('#viewImgBoxlicenseImage').attr('src', res.data.fileUrl);
$("#licenseImageInput").val(res.data.fileUrl);
@@ -190,11 +193,14 @@
, url: layui.setter.apiUrl + 'Api/Tools/MiNiShopOpenComponent2_UploadImg'
, before: function (obj) {
obj.preview(function (index, file, result) {
//$('#viewImgBoxlicenseImage').attr('src', result);
layer.msg('上传中', { icon: 16, shade: 0.4 });
});
}
, done: function (res) {
if (res.code > 0) { return layer.msg('上传失败'); }
layer.closeAll('loading'); //关闭加载层
if (res.code > 0) {
return layer.msg('上传失败');
}
layer.msg('上传成功');
imgs.push(res.data.fileUrl);
$('#certificateImage').val(imgs);

View File

@@ -133,12 +133,21 @@
//{ field: 'level3', title: '三级类目', sort: false, width: 105 },
{ field: 'level3Name', title: '三级类目名称', sort: false, width: 105 },
{
field: 'certificateImage', title: '资质材料', width: 100, sort: false,
field: 'certificateImage', title: '资质材料', width: 180, sort: false,
templet: function (d) {
if (d.certificateImage) {
return '<a href="javascript:void(0);" onclick=layui.coreHelper.viewImage("' + d.certificateImage + '")><image style="max-width:28px;max-height:28px;" src="' + d.certificateImage + '"/></a>';
var arr = d.certificateImage.split(',');
if (Array.isArray(arr) && arr.length) {
var html = '';
for (var i = 0; i < arr.length; i++) {
html += '<a href="javascript:void(0);" onclick=layui.coreHelper.viewImage("' + arr[i] + '")><image style="max-width:28px;max-height:28px;" src="' + arr[i] + '?x-oss-process=image/resize,m_lfit,h_200,w_200"/></a>&nbsp;'
}
return html;
} else {
return '<a href="javascript:void(0);" onclick=layui.coreHelper.viewImage("' + setter.noImagePicUrl + '")><image style="max-width:30px;max-height:30px;" src="' + setter.noImagePicUrl + '"/></a>';
}
} else {
return '<a href="javascript:void(0);" onclick=layui.coreHelper.viewImage("' + setter.noImagePicUrl + '")><image style="max-width:30px;max-height:30px;" src="' + setter.noImagePicUrl + '"/></a>';
return '';
}
}
},

View File

@@ -26,13 +26,6 @@
</div>
</div>
<!--<div class="layui-form-item">
<label for="headImg" class="layui-form-label layui-form-required">主图列表</label>
<div class="layui-input-block">
<input name="headImg" id="headImg" lay-verify="required|verifyheadImg" class="layui-input" lay-reqText="请输入主图列表" placeholder="请输入主图列表" />
</div>
</div>-->
<div class="layui-form-item">
<label for="brand_id" class="layui-form-label layui-form-required">品牌id</label>
<div class="layui-input-inline layui-inline-4">
@@ -58,53 +51,34 @@
<input type="hidden" name="headImg" id="headImg" class="layui-input" placeholder="请上传缩略图" lay-reqText="请上传缩略图" />
<button type="button" class="layui-btn layui-btn-sm" id="upBtnimageIds"><i class="layui-icon"></i></button>
</div>
<div class="layui-form-mid">
图集[建议数量控制在10张以内]
<div class="layui-input-inline layui-inline-5">
<button type="button" class="layui-btn layui-btn-sm" lay-active="doSycnWeChatProductImages"><i class="layui-icon"></i></button>
</div>
<div class="layui-input-inline layui-inline-12">
请保证图集地址域名为store.mp.video.tencent-cloud.commmbizurl.cnmmecimage.cn/p/中某个
</div>
</div>
<div class="layui-form-item ">
<blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
<div class="layui-upload-list" id="upload-more-list"></div>
</blockquote>
<div class="layui-form-item">
<div class="layui-upload-list" id="upload-more-list"></div>
</div>
<fieldset class="layui-elem-field layui-field-title site-title"><legend><a name="products">货品</a></legend></fieldset>
<div id="products">
</div>
<!--<div class="layui-form-item">
<label for="qualificationPics" class="layui-form-label layui-form-required">商品资质图片列表</label>
<div class="layui-input-block">
<input name="qualificationPics" lay-verify="required|verifyqualificationPics" class="layui-input" lay-reqText="请输入商品资质图片列表" placeholder="请输入商品资质图片列表" />
</div>
</div>-->
<div class="layui-form-item layui-form-text">
<label for="descInfoDesc" class="layui-form-label layui-form-required">商品详情图文</label>
<div class="layui-input-block">
<!--<div id="descInfoDesc"></div>-->
<div class="document-editor">
<div class="toolbar-container" id="toolbar-container"></div>
<div class="content-container">
<div id="editor"></div>
</div>
</div>
</div>
</div>
<!--<div class="layui-form-item">
<label for="descInfoImgs" class="layui-form-label layui-form-required">商品详情图片列表</label>
<div class="layui-input-block">
<input name="descInfoImgs" lay-verify="required|verifydescInfoImgs" class="layui-input" lay-reqText="请输入商品详情图片列表" placeholder="请输入商品详情图片列表" />
</div>
</div>-->
<div class="layui-form-item text-right core-hidden">
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-WeChatTransactionComponentGood-createForm-submit" id="LAY-app-WeChatTransactionComponentGood-createForm-submit" value="确认添加">
</div>
@@ -112,18 +86,38 @@
</script>
<script id="image_tpl" type="text/html">
{{# layui.each(d, function(index, item){ }}
<div class="imgdiv">
<img src="{{ item }}" class="layui-upload-img" onclick='layui.coreHelper.viewImage("{{ item }}")' style="width: 100px;height:100px;">
<div id="operate">
<div><a class="del" onclick="delImg(this,'{{ item }}')">删除</a>|<a class="setmain" onclick="setDefault(this,'{{ item }}')"></a>|<a class="setmain" onclick="upLoadImage(this,'{{ item }}')"></a></div>
</div>
</div>
{{# }); }}
<table class="layui-table" lay-size="sm">
<colgroup>
<col width="110">
<col>
<col width="150">
</colgroup>
<thead>
<tr>
<th>图片</th>
<th>地址</th>
<th>操作</th>
</tr>
</thead>
<tbody id="productsTbody">
{{# layui.each(d, function(index, item){ }}
<tr data-index="{{ index }}">
<td>
<img src="{{ item }}" id="img{{ index }}" class="layui-upload-img" onclick='layui.coreHelper.viewImage("{{ item }}")' style="width: 100px; height: 100px;">
</td>
<td>
<input type="text" value="{{ item }}" class="layui-input" readonly="readonly" />
</td>
<td>
<a class="layui-btn layui-btn-xs" lay-active="delImg">删除</a>
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-active="setDefault">设为主图</a>
</td>
</tr>
{{# }); }}
</tbody>
</table>
</script>
<script id="getSpec_tpl" type="text/html">
<table class="layui-table" lay-size="sm">
<colgroup>
@@ -153,19 +147,14 @@
<tbody id="productsTbody">
{{# layui.each(d, function(index, item){ }}
<tr>
<td>
<td rowspan="2">
<input type="hidden" value="{{item.id}}" name="product[outProductId][]" />
<input type="hidden" value="{{item.id}}" name="product[outSkuId][]" />
<input type="checkbox" name="product[isDefalut][]" {{item.isDefalut? 'checked="true"':''}} value="{{item.isDefalut? '1':'0'}}" lay-skin="switch" lay-text="是|否" disabled>
</td>
<td class="spec-td">
<div class="spec_image">
<div class="spec_image_item">
<img src="{{ item.images && item.images !='null'? item.images : layui.setter.noImagePicUrl }}" id="productImagesSrc" style="width:60px;height:60px">
</div>
<!--<input type="hidden" id="productImagesInput" name="product[thumbImg][]" value="{{ item.images && item.images !='null'? item.images : layui.setter.noImagePicUrl }}">-->
<input type="hidden" id="productImagesInput" name="product[thumbImg][]" value="{{layui.setter.noImagePicUrl}}">
</div>
<td class="spec-td" rowspan="2" style="text-align: center;">
<img src="{{ item.images && item.images !='null'? item.images : layui.setter.noImagePicUrl }}" style="width:80px;height:80px">
<button type="button" class="layui-btn layui-btn-xs" style="margin-top: 10px;" lay-active="doSycnWeChatProductImagesSingle"><i class="layui-icon"></i></button>
</td>
<td>
<input type="text" name="product[barCode][]" value="{{item.sn}}" readonly="readonly" placeholder="货号" class="layui-input layui-inline-3">
@@ -190,13 +179,16 @@
<input type="checkbox" name="product[isSelect][]" checked="checked" lay-skin="primary">
</td>
</tr>
<tr>
<td colspan="6">
<input type="text" name="product[thumbImg][]" value="{{ item.images && item.images !='null'? item.images : layui.setter.noImagePicUrl }}" class="layui-input layui-inline-14" readonly="readonly" />
</td>
</tr>
{{# }); }}
</tbody>
</table>
</script>
<script>
var $;
var imgs = [];
@@ -303,14 +295,14 @@
window.editor.setData(ids.intro);
//if (ids.images) {
// imgs = ids.images.split(',');
// $('#headImg').val(imgs);
// var getTpl = image_tpl.innerHTML, viewBox = document.getElementById('upload-more-list');
// laytpl(getTpl).render(imgs, function (html) {
// viewBox.innerHTML = html;
// });
//}
if (ids.images) {
imgs = ids.images.split(',');
$('#headImg').val(imgs);
var getTpl = image_tpl.innerHTML, viewBox = document.getElementById('upload-more-list');
laytpl(getTpl).render(imgs, function (html) {
viewBox.innerHTML = html;
});
}
$('#skuCount').val(ids.sku.length);
@@ -354,41 +346,110 @@
});
}
});
},
upLoadImage: function (othis) {
var imgDiv = $(othis).parent().parent();
var imageUrl = imgDiv.find('img').attr("src");
},
delImg: function (othis) {
var imgDiv = $(othis).parent().parent();
imgDiv.remove();
var imageUrl = imgDiv.find('img').attr("src");
var index = imgs.indexOf(imageUrl);
if (index > -1) {
imgs.splice(index, 1);
}
$('#headImg').val(imgs);
console.log(imgs);
refreshImages();
},
setDefault: function (othis) {
var imgDiv = $(othis).parent().parent();
$("#upload-more-list").prepend(imgDiv);
var imageUrl = imgDiv.find('img').attr("src");
var index = imgs.indexOf(imageUrl);
if (index > -1) {
imgs.unshift(imgs.splice(index, 1)[0]);
}
$('#headImg').val(imgs);
console.log(imgs);
refreshImages();
},
doSycnWeChatProductImages: function () {
if (imgs.length > 0) {
//执行交换url操作
coreHelper.Post("Api/Tools/MiNiShopOpenComponent2_UploadImgByUrlArr", { id: imgs }, function (res) {
if (debug) { console.log(res); } //开启调试返回数据
if (res.code == 0) {
imgs = res.data;
$('#headImg').val(imgs);
refreshImages();
}
});
} else {
layer.msg('请先上传图片或选择商品获取图集');
}
},
doSycnWeChatProductImagesSingle: function (othis) {
var imgObj = $(othis).prev().attr('src');
console.log(imgObj);
coreHelper.Post("Api/Tools/MiNiShopOpenComponent2_UploadImgByUrlSingle", { id: imgObj }, function (res) {
if (debug) { console.log(res); } //开启调试返回数据
if (res.code == 0) {
$(othis).parent().parent().next().find("input[name='product[thumbImg][]']").val(res.data);
} else {
layer.msg(res.msg);
}
});
},
});
function refreshImages() {
var getTpl = image_tpl.innerHTML, view = document.getElementById('upload-more-list');
laytpl(getTpl).render(imgs, function (html) {
view.innerHTML = html;
});
console.log(imgs);
}
//设为默认图
function setDefault(obj, imageUrl) {
var imgDiv = $(obj).parent().parent();
$("#upload-more-list").prepend(imgDiv);
var index = imgs.indexOf(imageUrl);
if (index > -1) {
imgs.unshift(imgs.splice(index, 1)[0]);
}
$('#headImg').val(imgs);
console.log(imgs);
refreshImages();
}
//图集上传
upload.render({
elem: '#upBtnimageIds'
, url: layui.setter.apiUrl + 'Api/Tools/MiNiShopOpenComponent2_UploadImg'
, before: function (obj) {
obj.preview(function (index, file, result) {
layer.msg('上传中', { icon: 16, shade: 0.4 });
});
}
, done: function (res) {
layer.closeAll('loading'); //关闭加载层
if (res.code > 0) {
return layer.msg('上传失败');
}
layer.msg('上传成功');
imgs.push(res.data.fileUrl);
$('#headImg').val(imgs);
refreshImages();
}
, error: function () {
return layer.msg('上传失败,请重试!');
}
});
//图集上传
$('#upBtnimageIds').click(function () {
cropperImg.cropImg({
aspectRatio: 1 / 1,
onCrop: function (data) {
var loadIndex = layer.load(2);
coreHelper.Post("api/Tools/MiNiShopOpenComponent2_UploadImgByBase64", { base64: data }, function (res) {
if (0 === res.code) {
imgs.push(res.data.fileUrl);
$('#headImg').val(imgs);
var getTpl = image_tpl.innerHTML, view = document.getElementById('upload-more-list');
laytpl(getTpl).render(imgs, function (html) {
view.innerHTML = html;
});
layer.msg(res.msg);
layer.close(loadIndex);
} else {
layer.close(loadIndex);
layer.msg(res.msg, { icon: 2, anim: 6 });
}
});
}
});
});
form.verify({
verifyoutProductId: [/^.{0,50}$/, '商品序列最大只允许输入50位字符'],
verifytitle: [/^.{0,255}$/, '商品标题最大只允许输入255位字符'],
verifypath: [/^.{0,255}$/, '小程序路径最大只允许输入255位字符'],
@@ -399,28 +460,7 @@
});
//重载form
form.render(null, 'LAY-app-WeChatTransactionComponentGood-createForm');
})
};
//删除图片
function delImg(obj, imageUrl) {
var imgDiv = $(obj).parent().parent().parent();
imgDiv.remove();
var index = imgs.indexOf(imageUrl);
if (index > -1) {
imgs.splice(index, 1);
}
$('#headImg').val(imgs);
}
//设为默认图
function setDefault(obj, imageUrl) {
var imgDiv = $(obj).parent().parent().parent();
$("#upload-more-list").prepend(imgDiv);
var index = imgs.indexOf(imageUrl);
if (index > -1) {
imgs.unshift(imgs.splice(index, 1)[0]);
}
$('#headImg').val(imgs);
}
</script>
</script>

View File

@@ -1,8 +1,8 @@
<script type="text/html" template lay-done="layui.data.sendParams(d);">
<div class="layui-form coreshop-form layui-form-pane transactioncomponent" lay-filter="LAY-app-WeChatTransactionComponentGood-editForm" id="LAY-app-WeChatTransactionComponentGood-editForm">
<input type="hidden" name="id" value="{{d.params.data.model.id }}" />
<input type="hidden" name="productId" value="{{d.params.data.model.id }}" />
<input type="hidden" name="outProductId" id="outProductId" value="{{d.params.data.model.id }}" />
<input type="hidden" name="productId" value="{{d.params.data.model.productId }}" />
<input type="hidden" name="outProductId" id="outProductId" value="{{d.params.data.model.outProductId }}" />
<input type="hidden" name="skuCount" id="skuCount" value="0" />
<div class="layui-form-item">
@@ -19,7 +19,6 @@
</div>
</div>
<div class="layui-form-item">
<label for="brand_id" class="layui-form-label layui-form-required">品牌id</label>
<div class="layui-input-inline layui-inline-4">
@@ -45,23 +44,22 @@
<input type="hidden" name="headImg" id="headImg" value="{{d.params.data.model.headImg || '' }}" class="layui-input" placeholder="请上传缩略图" lay-reqText="请上传缩略图" />
<button type="button" class="layui-btn layui-btn-sm" id="upBtnimageIds"><i class="layui-icon"></i></button>
</div>
<div class="layui-form-mid">
图集[建议数量控制在10张以内]
<div class="layui-input-inline layui-inline-5">
<button type="button" class="layui-btn layui-btn-sm" lay-active="doSycnWeChatProductImages"><i class="layui-icon"></i></button>
</div>
<div class="layui-input-inline layui-inline-12">
请保证图集地址域名为store.mp.video.tencent-cloud.commmbizurl.cnmmecimage.cn/p/中某个
</div>
</div>
<div class="layui-form-item ">
<blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
<div class="layui-upload-list" id="upload-more-list"></div>
</blockquote>
<div class="layui-form-item">
<div class="layui-upload-list" id="upload-more-list"></div>
</div>
<fieldset class="layui-elem-field layui-field-title site-title"><legend><a name="products">货品</a></legend></fieldset>
<div id="products">
</div>
<div class="layui-form-item layui-form-text">
<label for="descInfoDesc" class="layui-form-label layui-form-required">商品详情图文</label>
<div class="layui-input-block">
@@ -74,29 +72,45 @@
</div>
</div>
<div class="layui-form-item text-right core-hidden">
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-WeChatTransactionComponentGood-editForm-submit" id="LAY-app-WeChatTransactionComponentGood-editForm-submit" value="确认编辑">
</div>
</div>
</script>
<script id="image_tpl" type="text/html">
{{# layui.each(d, function(index, item){ }}
<div class="imgdiv">
<img src="{{ item }}" class="layui-upload-img" onclick='layui.coreHelper.viewImage("{{ item }}")' style="width: 100px;height:100px;">
<div id="operate">
<div><a class="del" onclick="delImg(this,'{{ item }}')">删除</a>|<a class="setmain" onclick="setDefault(this,'{{ item }}')"></a></div>
</div>
</div>
{{# }); }}
<table class="layui-table" lay-size="sm">
<colgroup>
<col width="110">
<col>
<col width="150">
</colgroup>
<thead>
<tr>
<th>图片</th>
<th>地址</th>
<th>操作</th>
</tr>
</thead>
<tbody id="productsTbody">
{{# layui.each(d, function(index, item){ }}
<tr data-index="{{ index }}">
<td>
<img src="{{ item }}" id="img{{ index }}" class="layui-upload-img" onclick='layui.coreHelper.viewImage("{{ item }}")' style="width: 100px; height: 100px;">
</td>
<td>
<input type="text" value="{{ item }}" class="layui-input" readonly="readonly" />
</td>
<td>
<a class="layui-btn layui-btn-xs" lay-active="delImg">删除</a>
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-active="setDefault">设为主图</a>
</td>
</tr>
{{# }); }}
</tbody>
</table>
</script>
<script id="getSpec_tpl" type="text/html">
<table class="layui-table" lay-size="sm">
<colgroup>
@@ -126,18 +140,14 @@
<tbody id="productsTbody">
{{# layui.each(d.products, function(index, item){ }}
<tr>
<td>
<td rowspan="2">
<input type="hidden" value="{{item.id}}" name="product[outProductId][]" />
<input type="hidden" value="{{item.id}}" name="product[outSkuId][]" />
<input type="hidden" value="{{d.sku[index].outSkuId}}" name="product[outSkuId][]" />
<input type="checkbox" name="product[isDefalut][]" {{item.isDefalut? 'checked="true"':''}} value="{{item.isDefalut? '1':'0'}}" lay-skin="switch" lay-text="是|否" disabled>
</td>
<td class="spec-td">
<div class="spec_image">
<div class="spec_image_item">
<img src="{{ item.images && item.images !='null'? item.images : layui.setter.noImagePicUrl }}" id="productImagesSrc" style="width:60px;height:60px">
</div>
<input type="hidden" id="productImagesInput" name="product[thumbImg][]" value="{{ item.images && item.images !='null'? item.images : layui.setter.noImagePicUrl }}">
</div>
<td class="spec-td" rowspan="2" style="text-align: center;">
<img src="{{ d.sku[index].thumbImg}}" style="width:80px;height:80px">
<button type="button" class="layui-btn layui-btn-xs" style="margin-top: 10px;" lay-active="doSycnWeChatProductImagesSingle"><i class="layui-icon"></i></button>
</td>
<td>
<input type="text" name="product[barCode][]" value="{{item.sn}}" readonly="readonly" placeholder="货号" class="layui-input layui-inline-3">
@@ -147,19 +157,24 @@
{{item.spesDesc}}
</td>
<td class="have-add-td">
<input type="number" name="product[stockNum][]" value="{{item.stock}}" placeholder="库存" class="layui-input layui-inline-1 goods-stock">
<input type="number" name="product[stockNum][]" value="{{d.sku[index].stockNum}}" placeholder="库存" class="layui-input layui-inline-1 goods-stock">
</td>
<td>
<input type="number" name="product[salePrice][]" value="{{item.price}}" placeholder="销售价" class="layui-input layui-inline-1">
<input type="number" name="product[salePrice][]" value="{{d.sku[index].salePrice}}" placeholder="销售价" class="layui-input layui-inline-1">
</td>
<td>
<input type="number" name="product[costprice][]" value="{{item.costprice}}" placeholder="成本价" class="layui-input layui-inline-1">
<input type="number" name="product[costprice][]" value="{{d.sku[index].costprice}}" placeholder="成本价" class="layui-input layui-inline-1">
</td>
<td>
<input type="number" name="product[marketPrice][]" value="{{item.mktprice}}" placeholder="市场价" class="layui-input layui-inline-1">
<input type="number" name="product[marketPrice][]" value="{{d.sku[index].marketPrice}}" placeholder="市场价" class="layui-input layui-inline-1">
</td>
<td>
<input type="checkbox" name="product[isSelect][]" checked="checked" lay-skin="primary">
<td rowspan="2">
<input type="checkbox" name="product[isSelect][]" {{d.sku[index].isSelect? 'checked="true"':''}} lay-skin="primary">
</td>
</tr>
<tr>
<td colspan="6">
<input type="text" name="product[thumbImg][]" value="{{ d.sku[index].thumbImg}}" class="layui-input layui-inline-14" readonly="readonly" />
</td>
</tr>
{{# }); }}
@@ -188,9 +203,6 @@
, laytpl = layui.laytpl
, coreHelper = layui.coreHelper;
//加载编辑器
var Authorization = layui.data(layui.setter.tableName)[layui.setter.request.tokenName];
//加载编辑器
var Authorization = layui.data(layui.setter.tableName)[layui.setter.request.tokenName];
//重点代码 适配器
@@ -251,7 +263,6 @@
console.error(error);
});
if (d.params.data.model.headImg) {
imgs = d.params.data.model.headImg.split(',');
$('#headImg').val(imgs);
@@ -261,7 +272,6 @@
});
}
$('#skuCount').val(d.params.data.products.length);
//初始化商品信息
@@ -271,8 +281,6 @@
viewBox.innerHTML = html;
});
//处理属性 为 lay-active 的所有元素事件
util.event('lay-active', {
goods_show: function () {
@@ -299,7 +307,6 @@
$('#path').val('pages/goods/goodDetails/goodDetails?id=' + ids.id);
window.editor.setData(ids.intro);
if (ids.images) {
imgs = ids.images.split(',');
$('#headImg').val(imgs);
@@ -351,37 +358,108 @@
});
}
});
}
});
//图集上传
$('#upBtnimageIds').click(function () {
cropperImg.cropImg({
aspectRatio: 1 / 1,
onCrop: function (data) {
var loadIndex = layer.load(2);
coreHelper.Post("api/Tools/UploadFilesFByBase64", { base64: data }, function (res) {
if (0 === res.code) {
imgs.push(res.data.fileUrl);
},
upLoadImage: function (othis) {
var imgDiv = $(othis).parent().parent();
var imageUrl = imgDiv.find('img').attr("src");
},
delImg: function (othis) {
var imgDiv = $(othis).parent().parent();
imgDiv.remove();
var imageUrl = imgDiv.find('img').attr("src");
var index = imgs.indexOf(imageUrl);
if (index > -1) {
imgs.splice(index, 1);
}
$('#headImg').val(imgs);
console.log(imgs);
refreshImages();
},
setDefault: function (othis) {
var imgDiv = $(othis).parent().parent();
$("#upload-more-list").prepend(imgDiv);
var imageUrl = imgDiv.find('img').attr("src");
var index = imgs.indexOf(imageUrl);
if (index > -1) {
imgs.unshift(imgs.splice(index, 1)[0]);
}
$('#headImg').val(imgs);
console.log(imgs);
refreshImages();
},
doSycnWeChatProductImages: function () {
if (imgs.length > 0) {
//执行交换url操作
coreHelper.Post("Api/Tools/MiNiShopOpenComponent2_UploadImgByUrlArr", { id: imgs }, function (res) {
if (debug) { console.log(res); } //开启调试返回数据
if (res.code == 0) {
imgs = res.data;
$('#headImg').val(imgs);
var getTpl = image_tpl.innerHTML, view = document.getElementById('upload-more-list');
laytpl(getTpl).render(imgs, function (html) {
view.innerHTML = html;
});
layer.msg(res.msg);
layer.close(loadIndex);
} else {
layer.close(loadIndex);
layer.msg(res.msg, { icon: 2, anim: 6 });
refreshImages();
}
});
} else {
layer.msg('请先上传图片或选择商品获取图集');
}
});
},
doSycnWeChatProductImagesSingle: function (othis) {
var imgObj = $(othis).prev().attr('src');
console.log(imgObj);
coreHelper.Post("Api/Tools/MiNiShopOpenComponent2_UploadImgByUrlSingle", { id: imgObj }, function (res) {
if (debug) { console.log(res); } //开启调试返回数据
if (res.code == 0) {
$(othis).parent().parent().next().find("input[name='product[thumbImg][]']").val(res.data);
} else {
layer.msg(res.msg);
}
});
},
});
function refreshImages() {
var getTpl = image_tpl.innerHTML, view = document.getElementById('upload-more-list');
laytpl(getTpl).render(imgs, function (html) {
view.innerHTML = html;
});
console.log(imgs);
}
//设为默认图
function setDefault(obj, imageUrl) {
var imgDiv = $(obj).parent().parent();
$("#upload-more-list").prepend(imgDiv);
var index = imgs.indexOf(imageUrl);
if (index > -1) {
imgs.unshift(imgs.splice(index, 1)[0]);
}
$('#headImg').val(imgs);
console.log(imgs);
refreshImages();
}
//图集上传
upload.render({
elem: '#upBtnimageIds'
, url: layui.setter.apiUrl + 'Api/Tools/MiNiShopOpenComponent2_UploadImg'
, before: function (obj) {
obj.preview(function (index, file, result) {
layer.msg('上传中', { icon: 16, shade: 0.4 });
});
}
, done: function (res) {
layer.closeAll('loading'); //关闭加载层
if (res.code > 0) {
return layer.msg('上传失败');
}
layer.msg('上传成功');
imgs.push(res.data.fileUrl);
$('#headImg').val(imgs);
refreshImages();
}
, error: function () {
return layer.msg('上传失败,请重试!');
}
});
form.verify({
@@ -398,28 +476,4 @@
})
};
//删除图片
function delImg(obj, imageUrl) {
var imgDiv = $(obj).parent().parent().parent();
imgDiv.remove();
var index = imgs.indexOf(imageUrl);
if (index > -1) {
imgs.splice(index, 1);
}
$('#headImg').val(imgs);
}
//设为默认图
function setDefault(obj, imageUrl) {
var imgDiv = $(obj).parent().parent().parent();
$("#upload-more-list").prepend(imgDiv);
var index = imgs.indexOf(imageUrl);
if (index > -1) {
imgs.unshift(imgs.splice(index, 1)[0]);
}
$('#headImg').val(imgs);
}
</script>

View File

@@ -17,6 +17,7 @@ using CoreCms.Net.Utility.Helper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using CoreCms.Net.Configuration;
namespace CoreCms.Net.Web.WebApi.Controllers
{
@@ -116,7 +117,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers
[Authorize]
public async Task<WebApiCallBack> SetCartNum([FromBody] FMSetCartNum entity)
{
var jm = await _cartServices.SetCartNum(entity.id, entity.nums, _user.ID, 2, 1);
var jm = await _cartServices.SetCartNum(entity.id, entity.nums, _user.ID, (int)GlobalEnumVars.CartSetNumType.Set, (int)GlobalEnumVars.OrderType.Common);
return jm;
}

View File

@@ -47,7 +47,6 @@ namespace CoreCms.Net.Web.WebApi.Controllers.WeChatOAuth
private readonly IMediator _mediator;
/// <summary>
/// 原始的加密请求如果不加密则为null
/// </summary>
@@ -123,7 +122,6 @@ namespace CoreCms.Net.Web.WebApi.Controllers.WeChatOAuth
postModel.EncodingAESKey = _weChatOptions.WxOpenEncodingAESKey;//根据自己后台的设置保持一致
postModel.AppId = _weChatOptions.WxOpenAppId;//根据自己后台的设置保持一致(必须提供)
var body = Request.Body;
//获取流数据转xml流
XDocument postDataDocument = XmlUtility.Convert(Request.GetRequestStream());
@@ -165,7 +163,6 @@ namespace CoreCms.Net.Web.WebApi.Controllers.WeChatOAuth
switch (requestType)
{
case RequestMsgType.Text:
var textMessageEvent = client.DeserializeEventFromXml<SKIT.FlurlHttpClient.Wechat.Api.Events.TextMessageEvent>(msgXml);
callBack = await _mediator.Send(new TextMessageEventCommand() { EventObj = textMessageEvent });
@@ -206,6 +203,20 @@ namespace CoreCms.Net.Web.WebApi.Controllers.WeChatOAuth
break;
case EventType.OpenProductSpuAudit:
var openProductSpuAuditEvent = client.DeserializeEventFromXml<SKIT.FlurlHttpClient.Wechat.Api.Events.OpenProductSPUAuditEvent>(msgXml);
callBack = await _mediator.Send(new OpenProductSPUAuditEventCommand() { EventObj = openProductSpuAuditEvent });
break;
case EventType.OpenProductCategoryAudit:
var openProductCategoryAuditEvent = client.DeserializeEventFromXml<SKIT.FlurlHttpClient.Wechat.Api.Events.OpenProductCategoryAuditEvent>(msgXml);
callBack = await _mediator.Send(new OpenProductCategoryAuditEventCommand() { EventObj = openProductCategoryAuditEvent });
break;
default:
NLogUtil.WriteFileLog(LogLevel.Info, LogType.WxPost, "接收服务器推送处理xml内容/Event无匹配", JsonConvert.SerializeObject(sourceXml));
break;

View File

@@ -58,7 +58,7 @@
<PackageReference Include="Hangfire.Dashboard.BasicAuthorization" Version="1.0.2" />
<PackageReference Include="Hangfire.Redis.StackExchange" Version="1.8.5" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.1" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.0.1" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.1.0" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.1" />
<PackageReference Include="Nito.AsyncEx" Version="5.1.2" />

View File

@@ -0,0 +1,4 @@
ALTER TABLE WeChatTransactionComponentGoodSKU modify column costprice decimal(10, 2) NOT NULL;
ALTER TABLE WeChatTransactionComponentGoodSKU modify column marketPrice decimal(10, 2) NOT NULL;
ALTER TABLE WeChatTransactionComponentGoodSKU modify column salePrice decimal(10, 2) NOT NULL;

View File

@@ -0,0 +1,5 @@
GO
ALTER TABLE [dbo].[WeChatTransactionComponentGoodSKU] ALTER COLUMN [costprice] DECIMAL (18, 2) NOT NULL;
ALTER TABLE [dbo].[WeChatTransactionComponentGoodSKU] ALTER COLUMN [marketPrice] DECIMAL (18, 2) NOT NULL;
ALTER TABLE [dbo].[WeChatTransactionComponentGoodSKU] ALTER COLUMN [salePrice] DECIMAL (18, 2) NOT NULL;