mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2026-03-22 19:17:21 +08:00
【新增】新增【微信发货信息管理】功能对接。实现微信小程序二次发货功能平移到后台业务,减少繁琐的二次发货操作。
This commit is contained in:
@@ -64,6 +64,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
private readonly ICoreCmsUserWeChatInfoServices _userWeChatInfoServices;
|
||||
private readonly IRedisOperationRepository _redisOperationRepository;
|
||||
private readonly CoreCms.Net.WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
||||
private readonly IWeChatShippingDeliveryServices _weChatShippingDeliveryServices;
|
||||
|
||||
|
||||
private readonly ICoreCmsOrderItemServices _orderItemServices;
|
||||
@@ -82,7 +83,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
, ICoreCmsLogisticsServices logisticsServices
|
||||
, ICoreCmsBillPaymentsServices billPaymentsServices
|
||||
, ICoreCmsPaymentsServices paymentsServices
|
||||
, ICoreCmsSettingServices settingServices, ICoreCmsUserWeChatInfoServices userWeChatInfoServices, IRedisOperationRepository redisOperationRepository, ICoreCmsBillDeliveryServices billDeliveryServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, ICoreCmsOrderItemServices orderItemServices)
|
||||
, ICoreCmsSettingServices settingServices, ICoreCmsUserWeChatInfoServices userWeChatInfoServices, IRedisOperationRepository redisOperationRepository, ICoreCmsBillDeliveryServices billDeliveryServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, ICoreCmsOrderItemServices orderItemServices, IWeChatShippingDeliveryServices weChatShippingDeliveryServices)
|
||||
{
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_coreCmsOrderServices = coreCmsOrderServices;
|
||||
@@ -99,6 +100,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
_billDeliveryServices = billDeliveryServices;
|
||||
_weChatApiHttpClientFactory = weChatApiHttpClientFactory;
|
||||
_orderItemServices = orderItemServices;
|
||||
_weChatShippingDeliveryServices = weChatShippingDeliveryServices;
|
||||
}
|
||||
|
||||
#region 获取列表============================================================
|
||||
@@ -493,7 +495,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
var storeList = await _storeServices.QueryAsync();
|
||||
|
||||
var logistics = await _logisticsServices.QueryListByClauseAsync(p => p.isDelete == false);
|
||||
|
||||
var deliveryCompany = await _weChatShippingDeliveryServices.GetCaChe();
|
||||
var result = await _coreCmsOrderServices.GetOrderShipInfo(entity.id);
|
||||
if (!result.status)
|
||||
{
|
||||
@@ -517,6 +519,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
jm.data = new
|
||||
{
|
||||
orderModel = result.data,
|
||||
deliveryCompany,
|
||||
storeList,
|
||||
logistics,
|
||||
};
|
||||
@@ -543,10 +546,32 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
{
|
||||
var ids = entity.orderId.Split(",");
|
||||
result = await _coreCmsOrderServices.BatchShip(ids, entity.logiCode, entity.logiNo, entity.items, entity.shipName, entity.shipMobile, entity.shipAddress, entity.memo, entity.storeId, entity.shipAreaId, entity.deliveryCompanyId);
|
||||
|
||||
if (result.status)
|
||||
{
|
||||
var orderPaymentIds = await _billPaymentsServices.QueryListByClauseAsync(p => ids.Contains(p.sourceId) && p.paymentCode == GlobalEnumVars.PaymentsTypes.wechatpay.ToString() && p.status == (int)GlobalEnumVars.BillPaymentsStatus.Payed);
|
||||
if (orderPaymentIds.Any())
|
||||
{
|
||||
//依次推入队列.
|
||||
foreach (var item in orderPaymentIds)
|
||||
{
|
||||
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.WeChatPayShipping, item.paymentId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await _coreCmsOrderServices.Ship(entity.orderId, entity.logiCode, entity.logiNo, entity.items, entity.shipName, entity.shipMobile, entity.shipAddress, entity.memo, entity.storeId, entity.shipAreaId, entity.deliveryCompanyId);
|
||||
|
||||
//微信发货信息管理API发货
|
||||
if (result.status && await _billPaymentsServices.QueryByClauseAsync(p => p.sourceId == entity.orderId && p.status == (int)GlobalEnumVars.BillPaymentsStatus.Payed) is { } paymentInfo)
|
||||
{
|
||||
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.WeChatPayShipping, paymentInfo.paymentId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
jm.code = result.status ? 0 : 1;
|
||||
@@ -603,6 +628,12 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
result = await _coreCmsOrderServices.Ship(order.orderId, "benditongcheng", "无", items, order.shipName, order.shipMobile, order.shipAddress, order.memo, order.storeId, order.shipAreaId, "OTHERS");
|
||||
}
|
||||
|
||||
//微信发货信息管理API发货
|
||||
if (result.status && await _billPaymentsServices.QueryByClauseAsync(p => p.sourceId == order.orderId && p.status == (int)GlobalEnumVars.BillPaymentsStatus.Payed) is { } paymentInfo)
|
||||
{
|
||||
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.WeChatPayShipping, paymentInfo.paymentId);
|
||||
}
|
||||
|
||||
jm.code = result.status ? 0 : 1;
|
||||
jm.msg = result.msg;
|
||||
jm.data = result.data;
|
||||
@@ -1716,7 +1747,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 预览快递进度============================================================
|
||||
// POST: Api/CoreCmsOrder/GetDetails/10
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2023/9/15 23:09:53
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.Entities.Expression;
|
||||
using CoreCms.Net.Model.FromBody;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Filter;
|
||||
using CoreCms.Net.Loging;
|
||||
using CoreCms.Net.IServices;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.HSSF.UserModel;
|
||||
using SqlSugar;
|
||||
using CoreCms.Net.Services;
|
||||
|
||||
namespace CoreCms.Net.Web.Admin.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 微信发货快递公司信息
|
||||
///</summary>
|
||||
[Description("微信发货快递公司信息")]
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[RequiredErrorForAdmin]
|
||||
[Authorize(Permissions.Name)]
|
||||
public class WeChatShippingDeliveryController : ControllerBase
|
||||
{
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private readonly IWeChatShippingDeliveryServices _weChatShippingDeliveryServices;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
///</summary>
|
||||
public WeChatShippingDeliveryController(IWebHostEnvironment webHostEnvironment
|
||||
,IWeChatShippingDeliveryServices weChatShippingDeliveryServices
|
||||
)
|
||||
{
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_weChatShippingDeliveryServices = weChatShippingDeliveryServices;
|
||||
}
|
||||
|
||||
#region 获取列表============================================================
|
||||
// POST: Api/WeChatShippingDelivery/GetPageList
|
||||
/// <summary>
|
||||
/// 获取列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("获取列表")]
|
||||
public async Task<AdminUiCallBack> GetPageList()
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
var pageCurrent = Request.Form["page"].FirstOrDefault().ObjectToInt(1);
|
||||
var pageSize = Request.Form["limit"].FirstOrDefault().ObjectToInt(30);
|
||||
var where = PredicateBuilder.True<WeChatShippingDelivery>();
|
||||
//获取排序字段
|
||||
var orderField = Request.Form["orderField"].FirstOrDefault();
|
||||
|
||||
Expression<Func<WeChatShippingDelivery, object>> orderEx = orderField switch
|
||||
{
|
||||
"id" => p => p.id,"deliveryId" => p => p.deliveryId,"deliveryName" => p => p.deliveryName,
|
||||
_ => p => p.id
|
||||
};
|
||||
|
||||
//设置排序方式
|
||||
var orderDirection = Request.Form["orderDirection"].FirstOrDefault();
|
||||
var orderBy = orderDirection switch
|
||||
{
|
||||
"asc" => OrderByType.Asc,
|
||||
"desc" => OrderByType.Desc,
|
||||
_ => OrderByType.Desc
|
||||
};
|
||||
//查询筛选
|
||||
|
||||
//序列 int
|
||||
var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0);
|
||||
if (id > 0)
|
||||
{
|
||||
where = where.And(p => p.id == id);
|
||||
}
|
||||
//快递公司编码 nvarchar
|
||||
var deliveryId = Request.Form["deliveryId"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(deliveryId))
|
||||
{
|
||||
where = where.And(p => p.deliveryId.Contains(deliveryId));
|
||||
}
|
||||
//快递公司名称 nvarchar
|
||||
var deliveryName = Request.Form["deliveryName"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(deliveryName))
|
||||
{
|
||||
where = where.And(p => p.deliveryName.Contains(deliveryName));
|
||||
}
|
||||
//获取数据
|
||||
var list = await _weChatShippingDeliveryServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, true);
|
||||
//返回数据
|
||||
jm.data = list;
|
||||
jm.code = 0;
|
||||
jm.count = list.TotalCount;
|
||||
jm.msg = "数据调用成功!";
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 首页数据============================================================
|
||||
// POST: Api/WeChatShippingDelivery/GetIndex
|
||||
/// <summary>
|
||||
/// 首页数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("首页数据")]
|
||||
public AdminUiCallBack GetIndex()
|
||||
{
|
||||
//返回数据
|
||||
var jm = new AdminUiCallBack { code = 0 };
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 拉取数据更新============================================================
|
||||
|
||||
// POST: Api/CoreCmsLogistics/DoDelete/10
|
||||
/// <summary>
|
||||
/// 拉取数据更新
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
[Description("单选删除")]
|
||||
public async Task<AdminUiCallBack> DoUpdateCompany()
|
||||
{
|
||||
var jm = await _weChatShippingDeliveryServices.DoUpdateCompany();
|
||||
return jm;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,661 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.Filter;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.Entities.Expression;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using SqlSugar;
|
||||
using Azure.Core;
|
||||
using CoreCms.Net.Caching.AccressToken;
|
||||
using CoreCms.Net.DTO.WeChatShipping;
|
||||
using CoreCms.Net.IServices;
|
||||
using CoreCms.Net.Model.ViewModels.Api;
|
||||
using Flurl.Http;
|
||||
using CoreCms.Net.WeChat.Service.HttpClients;
|
||||
using CoreCms.Net.WeChat.Service.Enums;
|
||||
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
||||
using SKIT.FlurlHttpClient.Wechat.Api;
|
||||
using CoreCms.Net.Model.FromBody;
|
||||
using CoreCms.Net.Services;
|
||||
using static SKIT.FlurlHttpClient.Wechat.Api.Models.CgibinExpressBusinessDeliveryGetAllResponse.Types;
|
||||
using CoreCms.Net.Loging;
|
||||
|
||||
namespace CoreCms.Net.Web.Admin.Controllers.WeChatShipping
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 微信发货信息订单管理
|
||||
///</summary>
|
||||
[Description("微信发货信息订单管理")]
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[RequiredErrorForAdmin]
|
||||
[Authorize(Permissions.Name)]
|
||||
public class WeChatShippingOrderController : ControllerBase
|
||||
{
|
||||
|
||||
private readonly IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
||||
private readonly ICoreCmsBillPaymentsServices _billPaymentsServices;
|
||||
private readonly ICoreCmsOrderServices _orderServices;
|
||||
private readonly ICoreCmsOrderItemServices _orderItemServices;
|
||||
private readonly ICoreCmsServicesServices _servicesServices;
|
||||
private readonly IWeChatShippingDeliveryServices _weChatShippingDeliveryServices;
|
||||
private readonly ICoreCmsBillDeliveryServices _billDeliveryServices;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public WeChatShippingOrderController(IWeChatApiHttpClientFactory weChatApiHttpClientFactory, ICoreCmsBillPaymentsServices billPaymentsServices, ICoreCmsOrderServices orderServices, ICoreCmsOrderItemServices orderItemServices, ICoreCmsServicesServices servicesServices, IWeChatShippingDeliveryServices weChatShippingDeliveryServices, ICoreCmsBillDeliveryServices billDeliveryServices)
|
||||
{
|
||||
_weChatApiHttpClientFactory = weChatApiHttpClientFactory;
|
||||
_billPaymentsServices = billPaymentsServices;
|
||||
_orderServices = orderServices;
|
||||
_orderItemServices = orderItemServices;
|
||||
_servicesServices = servicesServices;
|
||||
_weChatShippingDeliveryServices = weChatShippingDeliveryServices;
|
||||
_billDeliveryServices = billDeliveryServices;
|
||||
}
|
||||
|
||||
|
||||
#region 获取列表============================================================
|
||||
|
||||
// POST: Api/CoreCmsBillReship/GetPageList
|
||||
/// <summary>
|
||||
/// 获取列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("获取列表")]
|
||||
public async Task<AdminUiCallBack> GetPageList()
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
var pageCurrent = Request.Form["page"].FirstOrDefault().ObjectToInt(1);
|
||||
var pageSize = Request.Form["limit"].FirstOrDefault().ObjectToInt(20);
|
||||
|
||||
var last_index = Request.Form["last_index"].FirstOrDefault();
|
||||
|
||||
//获取排序字段
|
||||
|
||||
//设置排序方式
|
||||
var orderDirection = Request.Form["orderDirection"].FirstOrDefault();
|
||||
var orderBy = orderDirection switch
|
||||
{
|
||||
"asc" => OrderByType.Asc,
|
||||
"desc" => OrderByType.Desc,
|
||||
_ => OrderByType.Desc
|
||||
};
|
||||
//查询筛选
|
||||
|
||||
|
||||
//构建请求
|
||||
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
|
||||
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
|
||||
var request = new WxaSecOrderGetOrderListRequest()
|
||||
{
|
||||
AccessToken = accessToken
|
||||
};
|
||||
|
||||
//构建查询
|
||||
var status = Request.Form["status"].FirstOrDefault().ObjectToInt(0);
|
||||
if (status > 0)
|
||||
{
|
||||
request.OrderState = status;
|
||||
}
|
||||
|
||||
if (pageCurrent > 1)
|
||||
{
|
||||
request.Limit = pageCurrent;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(last_index))
|
||||
{
|
||||
request.Offset = last_index;
|
||||
}
|
||||
|
||||
if (pageSize > 0)
|
||||
{
|
||||
request.Limit = pageSize;
|
||||
}
|
||||
|
||||
var response = await client.ExecuteWxaSecOrderGetOrderListAsync(request, HttpContext.RequestAborted);
|
||||
if (response.ErrorCode == (int)WeChatReturnCode.ReturnCode.请求成功)
|
||||
{
|
||||
|
||||
//返回数据
|
||||
jm.data = response.OrderList;
|
||||
jm.otherData = response;
|
||||
jm.code = 0;
|
||||
jm.count = 10000;
|
||||
jm.msg = "数据调用成功!";
|
||||
}
|
||||
else
|
||||
{
|
||||
jm.code = 1;
|
||||
jm.msg = response.ErrorMessage;
|
||||
}
|
||||
|
||||
//获取数据
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 首页数据============================================================
|
||||
|
||||
// POST: Api/CoreCmsBillReship/GetIndex
|
||||
/// <summary>
|
||||
/// 首页数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("首页数据")]
|
||||
public AdminUiCallBack GetIndex()
|
||||
{
|
||||
//返回数据
|
||||
var jm = new AdminUiCallBack { code = 0 };
|
||||
|
||||
var status = EnumHelper.EnumToList<GlobalEnumVars.WeChatShippingOrderStatus>();
|
||||
var logisticsType = EnumHelper.EnumToList<GlobalEnumVars.WeChatShippingLogisticsType>();
|
||||
|
||||
jm.data = new
|
||||
{
|
||||
status,
|
||||
logisticsType
|
||||
};
|
||||
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 创建发货单============================================================
|
||||
/// <summary>
|
||||
/// 创建发货单
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("创建数据")]
|
||||
public async Task<AdminUiCallBack> GetCreate([FromBody] FMStringId entity)
|
||||
{
|
||||
//返回数据
|
||||
var jm = new AdminUiCallBack { code = 0 };
|
||||
|
||||
var paymentOrder = await _billPaymentsServices.QueryByClauseAsync(p => p.paymentId == entity.id);
|
||||
if (paymentOrder == null)
|
||||
{
|
||||
jm.msg = "支付单获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var billDeliveryList = new List<CoreCmsBillDelivery>();
|
||||
|
||||
var orderTitle = string.Empty;
|
||||
var logisticsTypeValue = 0;
|
||||
if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Recharge)
|
||||
{
|
||||
orderTitle = "用户充值" + paymentOrder.money + "元";
|
||||
logisticsTypeValue = (int)GlobalEnumVars.WeChatShippingLogisticsType.虚拟商品;
|
||||
}
|
||||
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.FormOrder)
|
||||
{
|
||||
orderTitle = "表单订单";
|
||||
logisticsTypeValue = (int)GlobalEnumVars.WeChatShippingLogisticsType.虚拟商品;
|
||||
}
|
||||
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.FormPay)
|
||||
{
|
||||
orderTitle = "表单付款码支付";
|
||||
logisticsTypeValue = (int)GlobalEnumVars.WeChatShippingLogisticsType.虚拟商品;
|
||||
}
|
||||
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.ServiceOrder)
|
||||
{
|
||||
var id = Convert.ToInt32(paymentOrder.sourceId);
|
||||
var serviceModel = await _servicesServices.QueryByClauseAsync(p => p.id == id);
|
||||
if (serviceModel == null)
|
||||
{
|
||||
jm.msg = "服务项目获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
orderTitle = serviceModel.title;
|
||||
logisticsTypeValue = (int)GlobalEnumVars.WeChatShippingLogisticsType.虚拟商品;
|
||||
}
|
||||
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Common
|
||||
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.PinTuan
|
||||
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Group
|
||||
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Seckill
|
||||
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Solitaire
|
||||
)
|
||||
{
|
||||
|
||||
billDeliveryList = await _billDeliveryServices.QueryListByClauseAsync(p => p.orderId == paymentOrder.sourceId);
|
||||
//获取订单
|
||||
var order = await _orderServices.QueryByClauseAsync(p => p.orderId == paymentOrder.sourceId);
|
||||
if (order == null)
|
||||
{
|
||||
jm.msg = "关联订单获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
logisticsTypeValue = order.receiptType switch
|
||||
{
|
||||
//设置物流的发货模式
|
||||
(int)GlobalEnumVars.OrderReceiptType.SelfDelivery => (int)GlobalEnumVars.WeChatShippingLogisticsType.用户自提,
|
||||
(int)GlobalEnumVars.OrderReceiptType.IntraCityService => (int)GlobalEnumVars.WeChatShippingLogisticsType.同城配送,
|
||||
(int)GlobalEnumVars.OrderReceiptType.Logistics => (int)GlobalEnumVars.WeChatShippingLogisticsType.物流配送,
|
||||
_ => logisticsTypeValue
|
||||
};
|
||||
var orderItems = await _orderItemServices.QueryListByClauseAsync(p => p.orderId == paymentOrder.sourceId);
|
||||
if (!orderItems.Any())
|
||||
{
|
||||
jm.msg = "订单详情获取失败";
|
||||
return jm;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (orderItems.Count == 1)
|
||||
{
|
||||
orderTitle = orderItems.FirstOrDefault()?.name;
|
||||
}
|
||||
else
|
||||
{
|
||||
orderItems.ForEach(p => { orderTitle += p.name + ";"; });
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Bargain)
|
||||
{
|
||||
orderTitle = "砍价活动";
|
||||
logisticsTypeValue = (int)GlobalEnumVars.WeChatShippingLogisticsType.物流配送;
|
||||
}
|
||||
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Giveaway)
|
||||
{
|
||||
orderTitle = "购物赠品";
|
||||
logisticsTypeValue = (int)GlobalEnumVars.WeChatShippingLogisticsType.虚拟商品;
|
||||
}
|
||||
else
|
||||
{
|
||||
jm.msg = "订单类型获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var status = EnumHelper.EnumToList<GlobalEnumVars.WeChatShippingOrderStatus>();
|
||||
var logisticsType = EnumHelper.EnumToList<GlobalEnumVars.WeChatShippingLogisticsType>();
|
||||
|
||||
|
||||
//构建请求
|
||||
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
|
||||
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
|
||||
var request = new WxaSecOrderGetOrderRequest
|
||||
{
|
||||
AccessToken = accessToken,
|
||||
TransactionId = entity.data.ToString(),
|
||||
OutTradeNumber = entity.id
|
||||
};
|
||||
|
||||
var deliveryCompany = await _weChatShippingDeliveryServices.GetCaChe();
|
||||
|
||||
|
||||
var response = await client.ExecuteWxaSecOrderGetOrderAsync(request, HttpContext.RequestAborted);
|
||||
if (response.IsSuccessful())
|
||||
{
|
||||
jm.code = 0;
|
||||
jm.data = new
|
||||
{
|
||||
response.Order,
|
||||
status,
|
||||
logisticsType,
|
||||
orderTitle,
|
||||
deliveryCompany,
|
||||
billDeliveryList,
|
||||
paymentOrder,
|
||||
logisticsTypeValue
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
jm.code = 1;
|
||||
jm.msg = response.ErrorMessage;
|
||||
}
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 创建提交============================================================
|
||||
// POST: Api/CoreCmsAgent/DoCreate
|
||||
/// <summary>
|
||||
/// 创建提交
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("创建提交")]
|
||||
public async Task<AdminUiCallBack> DoCreate([FromBody] OrderShippingCreatePost entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var shippingList = new List<WxaSecOrderUploadShippingInfoRequest.Types.Shipping>();
|
||||
|
||||
if (entity.logistics_type == (int)GlobalEnumVars.WeChatShippingLogisticsType.物流配送)
|
||||
{
|
||||
if (entity.shipping_list == null || !entity.shipping_list.Any())
|
||||
{
|
||||
jm.msg = "物流配送请完善快递信息";
|
||||
return jm;
|
||||
}
|
||||
|
||||
foreach (var item in entity.shipping_list)
|
||||
{
|
||||
if (string.IsNullOrEmpty(item.express_company) && string.IsNullOrEmpty(item.tracking_no))
|
||||
{
|
||||
jm.msg = "请填写完整的快递信息";
|
||||
return jm;
|
||||
}
|
||||
var shipping = new WxaSecOrderUploadShippingInfoRequest.Types.Shipping
|
||||
{
|
||||
ItemDescription = entity.item_desc,
|
||||
ExpressCompany = item.express_company,
|
||||
TrackingNumber = item.tracking_no
|
||||
};
|
||||
shippingList.Add(shipping);
|
||||
}
|
||||
}
|
||||
else if (entity.logistics_type == (int)GlobalEnumVars.WeChatShippingLogisticsType.同城配送)
|
||||
{
|
||||
var shipping = new WxaSecOrderUploadShippingInfoRequest.Types.Shipping
|
||||
{
|
||||
ItemDescription = entity.item_desc,
|
||||
ExpressCompany = entity.cityDistributionName,
|
||||
TrackingNumber = entity.cityDistributionNumber
|
||||
};
|
||||
shippingList.Add(shipping);
|
||||
}
|
||||
else if (entity.logistics_type == (int)GlobalEnumVars.WeChatShippingLogisticsType.用户自提 || entity.logistics_type == (int)GlobalEnumVars.WeChatShippingLogisticsType.虚拟商品)
|
||||
{
|
||||
var shipping = new WxaSecOrderUploadShippingInfoRequest.Types.Shipping
|
||||
{
|
||||
ItemDescription = entity.item_desc
|
||||
};
|
||||
shippingList.Add(shipping);
|
||||
}
|
||||
else
|
||||
{
|
||||
jm.msg = "请提交合理的物流模式";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var request = new WxaSecOrderUploadShippingInfoRequest
|
||||
{
|
||||
OrderKey = new WxaSecOrderUploadCombinedShippingInfoRequest.Types.OrderKey()
|
||||
{
|
||||
OrderNumberType = 2,
|
||||
TransactionId = entity.transaction_id,
|
||||
MerchantId = entity.merchant_id,
|
||||
OutTradeNumber = entity.merchant_trade_no
|
||||
},
|
||||
LogisticsType = entity.logistics_type,
|
||||
IsFinishAll = entity.is_all_delivered,
|
||||
ShippingList = shippingList,
|
||||
Payer = new WxaSecOrderUploadCombinedShippingInfoRequest.Types.Payer() { OpenId = entity.openid }
|
||||
};
|
||||
|
||||
if (request.LogisticsType == (int)GlobalEnumVars.WeChatShippingLogisticsType.物流配送 && request.IsFinishAll == true)
|
||||
{
|
||||
if (shippingList.Count == 1)
|
||||
{
|
||||
request.DeliveryMode = (int)GlobalEnumVars.WeChatShippingDeliveryMode.UNIFIED_DELIVERY;
|
||||
}
|
||||
else
|
||||
{
|
||||
request.DeliveryMode = (int)GlobalEnumVars.WeChatShippingDeliveryMode.SPLIT_DELIVERY;
|
||||
}
|
||||
}
|
||||
else if (request.LogisticsType == (int)GlobalEnumVars.WeChatShippingLogisticsType.物流配送 && request.IsFinishAll == false)
|
||||
{
|
||||
request.DeliveryMode = (int)GlobalEnumVars.WeChatShippingDeliveryMode.SPLIT_DELIVERY;
|
||||
}
|
||||
else
|
||||
{
|
||||
request.DeliveryMode = (int)GlobalEnumVars.WeChatShippingDeliveryMode.UNIFIED_DELIVERY;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//构建请求
|
||||
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
|
||||
|
||||
request.AccessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
|
||||
|
||||
var response = await client.ExecuteWxaSecOrderUploadShippingInfoAsync(request, HttpContext.RequestAborted);
|
||||
|
||||
if (response.IsSuccessful())
|
||||
{
|
||||
jm.code = 0;
|
||||
jm.data = new
|
||||
{
|
||||
response
|
||||
};
|
||||
jm.msg = "提交成功";
|
||||
}
|
||||
else
|
||||
{
|
||||
jm.code = 1;
|
||||
jm.msg = response.ErrorMessage;
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 重新发货============================================================
|
||||
/// <summary>
|
||||
/// 重新发货
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("创建数据")]
|
||||
public async Task<AdminUiCallBack> GetUpdate([FromBody] FMStringId entity)
|
||||
{
|
||||
//返回数据
|
||||
var jm = new AdminUiCallBack { code = 0 };
|
||||
|
||||
var paymentOrder = await _billPaymentsServices.QueryByClauseAsync(p => p.paymentId == entity.id);
|
||||
if (paymentOrder == null)
|
||||
{
|
||||
jm.msg = "支付单获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var status = EnumHelper.EnumToList<GlobalEnumVars.WeChatShippingOrderStatus>();
|
||||
var logisticsType = EnumHelper.EnumToList<GlobalEnumVars.WeChatShippingLogisticsType>();
|
||||
|
||||
|
||||
//构建请求
|
||||
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
|
||||
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
|
||||
var request = new WxaSecOrderGetOrderRequest
|
||||
{
|
||||
AccessToken = accessToken,
|
||||
TransactionId = entity.data.ToString(),
|
||||
OutTradeNumber = entity.id
|
||||
};
|
||||
|
||||
var deliveryCompany = await _weChatShippingDeliveryServices.GetCaChe();
|
||||
|
||||
|
||||
var response = await client.ExecuteWxaSecOrderGetOrderAsync(request, HttpContext.RequestAborted);
|
||||
if (response.IsSuccessful())
|
||||
{
|
||||
jm.code = 0;
|
||||
jm.data = new
|
||||
{
|
||||
response.Order,
|
||||
status,
|
||||
logisticsType,
|
||||
deliveryCompany
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
jm.code = 1;
|
||||
jm.msg = response.ErrorMessage;
|
||||
}
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 重新发货提交============================================================
|
||||
/// <summary>
|
||||
/// 重新发货提交
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("创建提交")]
|
||||
public AdminUiCallBack DoUpdate([FromBody] Object entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 预览数据============================================================
|
||||
// POST: Api/CoreCmsAgent/GetDetails/10
|
||||
/// <summary>
|
||||
/// 预览数据
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("预览数据")]
|
||||
public async Task<AdminUiCallBack> GetDetails([FromBody] FMStringId entity)
|
||||
{
|
||||
//返回数据
|
||||
var jm = new AdminUiCallBack { code = 0 };
|
||||
|
||||
var paymentOrder = await _billPaymentsServices.QueryByClauseAsync(p => p.paymentId == entity.id);
|
||||
if (paymentOrder == null)
|
||||
{
|
||||
jm.msg = "支付单获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var orderTitle = string.Empty;
|
||||
|
||||
if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Recharge)
|
||||
{
|
||||
orderTitle = "用户充值" + paymentOrder.money + "元";
|
||||
}
|
||||
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.FormOrder)
|
||||
{
|
||||
orderTitle = "表单订单";
|
||||
}
|
||||
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.FormPay)
|
||||
{
|
||||
orderTitle = "表单付款码支付";
|
||||
}
|
||||
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.ServiceOrder)
|
||||
{
|
||||
var id = Convert.ToInt32(paymentOrder.sourceId);
|
||||
var serviceModel = await _servicesServices.QueryByClauseAsync(p => p.id == id);
|
||||
if (serviceModel == null)
|
||||
{
|
||||
jm.msg = "服务项目获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
orderTitle = serviceModel.title;
|
||||
}
|
||||
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Common
|
||||
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.PinTuan
|
||||
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Group
|
||||
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Seckill
|
||||
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Solitaire
|
||||
)
|
||||
{
|
||||
var orderItems = await _orderItemServices.QueryListByClauseAsync(p => p.orderId == paymentOrder.sourceId);
|
||||
if (!orderItems.Any())
|
||||
{
|
||||
jm.msg = "订单详情获取失败";
|
||||
return jm;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (orderItems.Count == 1)
|
||||
{
|
||||
orderTitle = orderItems.FirstOrDefault()?.name;
|
||||
}
|
||||
else
|
||||
{
|
||||
orderItems.ForEach(p => { orderTitle += p.name + ";"; });
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Bargain)
|
||||
{
|
||||
orderTitle = "砍价活动";
|
||||
}
|
||||
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Giveaway)
|
||||
{
|
||||
orderTitle = "购物赠品";
|
||||
}
|
||||
else
|
||||
{
|
||||
jm.msg = "订单类型获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var status = EnumHelper.EnumToList<GlobalEnumVars.WeChatShippingOrderStatus>();
|
||||
var logisticsType = EnumHelper.EnumToList<GlobalEnumVars.WeChatShippingLogisticsType>();
|
||||
|
||||
|
||||
//构建请求
|
||||
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
|
||||
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
|
||||
var request = new WxaSecOrderGetOrderRequest
|
||||
{
|
||||
AccessToken = accessToken,
|
||||
TransactionId = entity.data.ToString(),
|
||||
OutTradeNumber = entity.id
|
||||
};
|
||||
|
||||
var deliveryCompany = await _weChatShippingDeliveryServices.GetCaChe();
|
||||
|
||||
|
||||
var response = await client.ExecuteWxaSecOrderGetOrderAsync(request, HttpContext.RequestAborted);
|
||||
if (response.IsSuccessful())
|
||||
{
|
||||
jm.code = 0;
|
||||
jm.data = new
|
||||
{
|
||||
response.Order,
|
||||
status,
|
||||
logisticsType,
|
||||
orderTitle,
|
||||
deliveryCompany
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
jm.code = 1;
|
||||
jm.msg = response.ErrorMessage;
|
||||
}
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||
<div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-WeChatShippingDelivery-createForm" id="LAY-app-WeChatShippingDelivery-createForm">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="deliveryId" class="layui-form-label layui-form-required">快递公司编码</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="deliveryId" lay-verType="tips" lay-verify="required|verifydeliveryId" class="layui-input" lay-reqText="请输入快递公司编码" placeholder="请输入快递公司编码" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="deliveryName" class="layui-form-label layui-form-required">快递公司名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="deliveryName" lay-verType="tips" lay-verify="required|verifydeliveryName" 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-WeChatShippingDelivery-createForm-submit" id="LAY-app-WeChatShippingDelivery-createForm-submit" value="确认添加">
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
var debug = layui.setter.debug;
|
||||
layui.data.done = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d.params.data); }
|
||||
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, form = layui.form
|
||||
, admin = layui.admin
|
||||
, laydate = layui.laydate
|
||||
, upload = layui.upload
|
||||
, cropperImg = layui.cropperImg
|
||||
, coreHelper = layui.coreHelper;
|
||||
|
||||
form.verify({
|
||||
|
||||
verifydeliveryId: [/^.{0,50}$/, '快递公司编码最大只允许输入50位字符'],
|
||||
verifydeliveryName: [/^.{0,50}$/, '快递公司名称最大只允许输入50位字符'],
|
||||
});
|
||||
//重载form
|
||||
form.render(null, 'LAY-app-WeChatShippingDelivery-createForm');
|
||||
})
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,54 @@
|
||||
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||
<table class="layui-table layui-form" lay-filter="LAY-app-WeChatShippingDelivery-detailsForm" id="LAY-app-WeChatShippingDelivery-detailsForm">
|
||||
<colgroup>
|
||||
<col width="100">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="id">序列</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.id || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="deliveryId">快递公司编码</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.deliveryId || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="deliveryName">快递公司名称</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.deliveryName || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</script>
|
||||
<script>
|
||||
var debug= layui.setter.debug;
|
||||
layui.data.done = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d.params.data); }
|
||||
|
||||
layui.use(['admin', 'form', 'coreHelper'], function () {
|
||||
var $ = layui.$
|
||||
, setter = layui.setter
|
||||
, admin = layui.admin
|
||||
, coreHelper = layui.coreHelper
|
||||
, form = layui.form;
|
||||
form.render(null, 'LAY-app-WeChatShippingDelivery-detailsForm');
|
||||
});
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,48 @@
|
||||
<script type="text/html" template lay-done="layui.data.sendParams(d);">
|
||||
<div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-WeChatShippingDelivery-editForm" id="LAY-app-WeChatShippingDelivery-editForm">
|
||||
<input type="hidden" name="id" value="{{d.params.data.id || '' }}" />
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="deliveryId" class="layui-form-label layui-form-required">快递公司编码</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="deliveryId" lay-verType="tips" lay-verify="required|verifydeliveryId" class="layui-input" placeholder="请输入快递公司编码" lay-reqText="请输入快递公司编码" value="{{d.params.data.deliveryId || '' }}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="deliveryName" class="layui-form-label layui-form-required">快递公司名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="deliveryName" lay-verType="tips" lay-verify="required|verifydeliveryName" class="layui-input" placeholder="请输入快递公司名称" lay-reqText="请输入快递公司名称" value="{{d.params.data.deliveryName || '' }}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item text-right core-hidden">
|
||||
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-WeChatShippingDelivery-editForm-submit" id="LAY-app-WeChatShippingDelivery-editForm-submit" value="确认编辑">
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
var debug = layui.setter.debug;
|
||||
layui.data.sendParams = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d.params.data); }
|
||||
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, form = layui.form
|
||||
, admin = layui.admin
|
||||
, laydate = layui.laydate
|
||||
, upload = layui.upload
|
||||
, cropperImg = layui.cropperImg
|
||||
, coreHelper = layui.coreHelper;
|
||||
|
||||
form.verify({
|
||||
|
||||
verifydeliveryId: [/^.{0,50}$/, '快递公司编码最大只允许输入50位字符'],
|
||||
verifydeliveryName: [/^.{0,50}$/, '快递公司名称最大只允许输入50位字符'],
|
||||
});
|
||||
//重载form
|
||||
form.render(null, 'LAY-app-WeChatShippingDelivery-editForm');
|
||||
})
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,148 @@
|
||||
<title>微信发货快递公司信息</title>
|
||||
<!--当前位置开始-->
|
||||
<div class="layui-card layadmin-header">
|
||||
<div class="layui-breadcrumb" lay-filter="breadcrumb">
|
||||
<script type="text/html" template lay-done="layui.data.updateMainBreadcrumb();">
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<!--当前位置结束-->
|
||||
<style>
|
||||
/* 重写样式 */
|
||||
</style>
|
||||
<script type="text/html" template lay-type="Post" lay-url="Api/WeChatShippingDelivery/GetIndex" lay-done="layui.data.done(d);">
|
||||
|
||||
</script>
|
||||
<div class="table-body">
|
||||
<table id="LAY-app-WeChatShippingDelivery-tableBox" lay-filter="LAY-app-WeChatShippingDelivery-tableBox"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="LAY-app-WeChatShippingDelivery-toolbar">
|
||||
<div class="layui-form coreshop-toolbar-search-form">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="deliveryId">快递公司编码</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="deliveryId" placeholder="请输入快递公司编码" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="deliveryName">快递公司名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="deliveryName" placeholder="请输入快递公司名称" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-WeChatShippingDelivery-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="LAY-app-WeChatShippingDelivery-pagebar">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="updateCompany"><i class="layui-icon layui-icon-refresh-1"></i>同步获取新数据</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var indexData;
|
||||
var debug = layui.setter.debug;
|
||||
layui.data.done = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d); }
|
||||
|
||||
indexData = d.data;
|
||||
layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, admin = layui.admin
|
||||
, table = layui.table
|
||||
, form = layui.form
|
||||
, laydate = layui.laydate
|
||||
, setter = layui.setter
|
||||
, coreHelper = layui.coreHelper
|
||||
, util = layui.util
|
||||
, view = layui.view;
|
||||
|
||||
var searchwhere;
|
||||
//监听搜索
|
||||
form.on('submit(LAY-app-WeChatShippingDelivery-search)',
|
||||
function (data) {
|
||||
var field = data.field;
|
||||
searchwhere = field;
|
||||
//执行重载
|
||||
table.reloadData('LAY-app-WeChatShippingDelivery-tableBox', { where: field });
|
||||
});
|
||||
//数据绑定
|
||||
table.render({
|
||||
elem: '#LAY-app-WeChatShippingDelivery-tableBox',
|
||||
url: layui.setter.apiUrl + 'Api/WeChatShippingDelivery/GetPageList',
|
||||
method: 'POST',
|
||||
toolbar: '#LAY-app-WeChatShippingDelivery-toolbar',
|
||||
pagebar: '#LAY-app-WeChatShippingDelivery-pagebar',
|
||||
className: 'pagebarbox',
|
||||
defaultToolbar: ['filter', 'print', 'exports'],
|
||||
height: 'full-127',//面包屑142px,搜索框4行172,3行137,2行102,1行67
|
||||
page: true,
|
||||
limit: 30,
|
||||
limits: [10, 15, 20, 25, 30, 50, 100, 200],
|
||||
text: { none: '暂无相关数据' },
|
||||
cols: [
|
||||
[
|
||||
{ type: "checkbox", fixed: "left" },
|
||||
{ field: 'id', title: '序列', width: 60, sort: false },
|
||||
{ field: 'deliveryId', title: '快递公司编码', sort: false, width: 205 },
|
||||
{ field: 'deliveryName', title: '快递公司名称', sort: false, width: 205 },
|
||||
]
|
||||
]
|
||||
});
|
||||
//监听排序事件
|
||||
table.on('sort(LAY-app-WeChatShippingDelivery-tableBox)', function (obj) {
|
||||
table.reloadData('LAY-app-WeChatShippingDelivery-tableBox', {
|
||||
initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
|
||||
where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
||||
orderField: obj.field, //排序字段
|
||||
orderDirection: obj.type //排序方式
|
||||
}
|
||||
});
|
||||
});
|
||||
//头工具栏事件
|
||||
table.on('pagebar(LAY-app-WeChatShippingDelivery-tableBox)', function (obj) {
|
||||
var checkStatus = table.checkStatus(obj.config.id);
|
||||
switch (obj.event) {
|
||||
case 'updateCompany':
|
||||
updateCompany();
|
||||
break;
|
||||
};
|
||||
});
|
||||
//监听工具条
|
||||
table.on('tool(LAY-app-WeChatShippingDelivery-tableBox)',
|
||||
function (obj) {
|
||||
if (obj.event === 'detail') {
|
||||
doDetails(obj);
|
||||
} else if (obj.event === 'del') {
|
||||
doDelete(obj);
|
||||
} else if (obj.event === 'edit') {
|
||||
doEdit(obj)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//刷新数据
|
||||
function updateCompany(obj) {
|
||||
layer.confirm('确定刷新吗?刷新后将删除老数据。', function (index) {
|
||||
coreHelper.Post("Api/WeChatShippingDelivery/DoUpdateCompany", null, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
table.reloadData('LAY-app-WeChatShippingDelivery-tableBox'); //重载表格
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//重载form
|
||||
form.render();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,236 @@
|
||||
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||
<div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-WeChatShippingOrder-createForm" id="LAY-app-WeChatShippingOrder-createForm">
|
||||
<input type="hidden" name="transaction_id" value="{{d.params.data.order.transaction_id }}" />
|
||||
<input type="hidden" name="openid" value="{{d.params.data.order.openid }}" />
|
||||
<input type="hidden" name="merchant_id" value="{{d.params.data.order.merchant_id }}" />
|
||||
<input type="hidden" name="merchant_trade_no" value="{{d.params.data.order.merchant_trade_no }}" />
|
||||
|
||||
<blockquote class="layui-elem-quote">
|
||||
商户单号:{{d.params.data.order.merchant_trade_no }}<br />
|
||||
交易单号:{{d.params.data.order.transaction_id }}<br />
|
||||
支付金额:¥ {{d.params.data.order.paid_amount / 100 }} 元<br />
|
||||
支付时间:{{ layui.util.toDateString(d.params.data.order.pay_time * 1000, 'yyyy-MM-dd HH:mm:ss')}}<br />
|
||||
</blockquote>
|
||||
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">商品信息</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="item_desc" placeholder="商品信息会向用户展示,请保持和订单信息一致。输入多个商品时用“ ; ”隔开。" class="layui-textarea">{{d.params.data.orderTitle}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">发货方式</label>
|
||||
<div class="layui-input-block">
|
||||
{{# layui.each(d.params.data.logisticsType, function(index, item){ }}
|
||||
<input type="radio" name="logistics_type" value="{{item.value}}" title="{{item.title}}" {{item.value==d.params.data.logisticsTypeValue ? 'checked':''}} lay-filter="logistics-type-filter">
|
||||
{{# }); }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="logisticsBox">
|
||||
<div class="layui-form-item">
|
||||
<label for="matchKey" class="layui-form-label ">
|
||||
快递信息
|
||||
</label>
|
||||
<div class="layui-input-block">
|
||||
<table class="layui-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>物流公司</th>
|
||||
<th style="width: 250px;">快递单号</th>
|
||||
<th style="width: 82px;">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="logisticsView">
|
||||
<tr data-id="0">
|
||||
<td>
|
||||
<select lay-search="" id="express_company" name="shipping_list.express_company[0]" class="layui-input">
|
||||
<option value="">请选择,可直接输入搜索</option>
|
||||
{{# layui.each(d.params.data.deliveryCompany, function(index, item){ }}
|
||||
<option value="{{item.deliveryId}}">{{item.deliveryName}}</option>
|
||||
{{# }); }}
|
||||
</select>
|
||||
</td>
|
||||
<td class="field_value">
|
||||
<input type="text" id="tracking_no" name="shipping_list.tracking_no[0]" required value="" placeholder="填写快递单号" autocomplete="off" class="layui-input">
|
||||
</td>
|
||||
<td>
|
||||
<a class="layui-btn layui-btn-xs addfield-class table-button">
|
||||
添加
|
||||
</a>
|
||||
<!--<a class="layui-btn layui-btn-danger layui-btn-xs del-class table-button">
|
||||
删除
|
||||
</a>-->
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">全部发货</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="is_all_delivered" lay-skin="switch" lay-filter="switchTest" checked="checked" title="是|否">
|
||||
</div>
|
||||
</div>
|
||||
{{# if(d.params.data.billDeliveryList){ }}
|
||||
<div class="layui-bg-gray" style="padding: 16px;">
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">订单发货信息</div>
|
||||
<div class="layui-card-body">
|
||||
{{# layui.each(d.params.data.billDeliveryList, function(index, item){ }}
|
||||
发货快递:{{item.logiCode}} 快递编号:{{item.logiNo}}
|
||||
{{# }); }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{# } }}
|
||||
|
||||
</div>
|
||||
|
||||
<div id="cityDistributionBox" style="display:none;">
|
||||
<div class="layui-form-item">
|
||||
<label for="matchKey" class="layui-form-label">
|
||||
快递信息
|
||||
</label>
|
||||
<div class="layui-input-inline layui-inline-4">
|
||||
<input name="cityDistributionName" class="layui-input" placeholder="填写同城配送公司名称" />
|
||||
</div>
|
||||
<div class="layui-input-inline layui-inline-4">
|
||||
<input name="cityDistributionNumber" class="layui-input" placeholder="填写快递单号" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
如商家自配,则该项可选填
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item text-right core-hidden">
|
||||
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-WeChatShippingOrder-createForm-submit" id="LAY-app-WeChatShippingOrder-createForm-submit" value="确认添加">
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
||||
<script id="tr_tpl" type="text/html">
|
||||
<tr data-id="{{ d.id }}">
|
||||
<td>
|
||||
<select lay-search="" id="express_company" name="shipping_list.express_company[{{ d.id }}]" class="layui-input">
|
||||
<option value="">请选择,可直接输入搜索</option>
|
||||
{{# layui.each(d.deliveryCompany, function(index, item){ }}
|
||||
<option value="{{item.deliveryId}}">{{item.deliveryName}}</option>
|
||||
{{# }); }}
|
||||
</select>
|
||||
</td>
|
||||
<td class="field_value">
|
||||
<input type="text" id="tracking_no" name="shipping_list.tracking_no[{{ d.id }}]" required value="" placeholder="填写快递单号" autocomplete="off" class="layui-input">
|
||||
</td>
|
||||
<td>
|
||||
<a class="layui-btn layui-btn-xs addfield-class table-button">
|
||||
添加
|
||||
</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs del-class table-button">
|
||||
删除
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
var data;
|
||||
var debug = layui.setter.debug;
|
||||
layui.data.done = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d.params.data); }
|
||||
data = d.params.data;
|
||||
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg', 'laytpl'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, form = layui.form
|
||||
, admin = layui.admin
|
||||
, laydate = layui.laydate
|
||||
, upload = layui.upload
|
||||
, cropperImg = layui.cropperImg
|
||||
, laytpl = layui.laytpl
|
||||
, coreHelper = layui.coreHelper;
|
||||
|
||||
hideBox(d.params.data.logisticsTypeValue);
|
||||
|
||||
$(".layui-table").on('click', '.addfield-class', function (e) {
|
||||
var getTpl = tr_tpl.innerHTML;
|
||||
var lastId = $(this).parent().parent().parent().find('tr').last().attr('data-id');
|
||||
console.log(lastId);
|
||||
var tmpData = {};
|
||||
tmpData.id = parseInt(lastId) + 1;
|
||||
tmpData.deliveryCompany = d.params.data.deliveryCompany;
|
||||
laytpl(getTpl).render(tmpData, function (html) {
|
||||
$("#logisticsView").append(html);
|
||||
form.render();
|
||||
});
|
||||
});
|
||||
|
||||
$(".layui-table").on('click', '.del-class', function (e) {
|
||||
if ($(".del-class").length > 0) {
|
||||
$(this).parent().parent().remove();
|
||||
resetInputNameID();
|
||||
} else {
|
||||
layer.msg("至少保留1个物流信息录入框");
|
||||
}
|
||||
})
|
||||
|
||||
//重置排序
|
||||
function resetInputNameID() {
|
||||
$.each($("#logisticsView tr"), function (i, tr) {
|
||||
$(this).attr('data-id', i);
|
||||
$(this).find("#express_company").attr("name", "shipping_list.express_company[" + i + "]");
|
||||
$(this).find("#tracking_no").attr("name", "shipping_list.tracking_no[" + i + "]");
|
||||
});
|
||||
}
|
||||
|
||||
// radio 事件
|
||||
form.on('radio(logistics-type-filter)', function (data) {
|
||||
var elem = data.elem; // 获得 radio 原始 DOM 对象
|
||||
var value = elem.value; // 获得 radio 值
|
||||
|
||||
hideBox(value);
|
||||
});
|
||||
|
||||
function hideBox(value) {
|
||||
if (value == 1) {
|
||||
$('#logisticsBox').show();
|
||||
$('#cityDistributionBox').hide();
|
||||
} else if (value == 2) {
|
||||
$('#logisticsBox').hide();
|
||||
$('#cityDistributionBox').show();
|
||||
} else {
|
||||
$('#logisticsBox').hide();
|
||||
$('#cityDistributionBox').hide();
|
||||
}
|
||||
}
|
||||
|
||||
form.verify({
|
||||
|
||||
verifymatchKey: [/^.{0,100}$/, '匹配字符最大只允许输入100位字符'],
|
||||
verifyimgTextUrl: [/^.{0,1000}$/, '图片回复图片地址最大只允许输入1000位字符'],
|
||||
verifyimgTextLink: [/^.{0,1000}$/, '图片回复超链接最大只允许输入1000位字符'],
|
||||
verifymeidaUrl: [/^.{0,1000}$/, '语音回复地址最大只允许输入1000位字符'],
|
||||
verifymeidaLink: [/^.{0,1000}$/, '语音回复超链接最大只允许输入1000位字符'],
|
||||
verifyremark: [/^.{0,1000}$/, '备注最大只允许输入1000位字符'],
|
||||
verifycreateBy: [/^.{0,100}$/, '创建来源最大只允许输入100位字符'],
|
||||
verifymodifyBy: [/^.{0,100}$/, '修改来源最大只允许输入100位字符'],
|
||||
});
|
||||
//重载form
|
||||
form.render(null, 'LAY-app-WeChatShippingOrder-createForm');
|
||||
})
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,104 @@
|
||||
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||
<div class="layui-table layui-form" lay-filter="LAY-app-WeChatMessageResponse-detailsForm" id="LAY-app-WeChatMessageResponse-detailsForm">
|
||||
{{ d.params.data.id || '' }}
|
||||
|
||||
|
||||
<div class="layui-bg-gray" style="padding: 5px;">
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">发货状态</div>
|
||||
<div class="layui-card-body">
|
||||
{{# layui.each(d.params.data.status, function(index, item){ }}
|
||||
|
||||
{{# if(d.params.data.order.order_state==item.value) { }}
|
||||
|
||||
{{- item.description }}
|
||||
|
||||
{{# } }}
|
||||
|
||||
{{# }); }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-bg-gray" style="padding: 5px;">
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">发货状态</div>
|
||||
<div class="layui-card-body">
|
||||
商户号:{{d.params.data.order.merchant_id }}<br />
|
||||
商户单号:{{d.params.data.order.merchant_trade_no }}<br />
|
||||
交易单号:{{d.params.data.order.transaction_id }}<br />
|
||||
支付金额:¥ {{d.params.data.order.paid_amount / 100 }} 元<br />
|
||||
支付时间:{{ layui.util.toDateString(d.params.data.order.pay_time * 1000, 'yyyy-MM-dd HH:mm:ss')}}<br />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-bg-gray" style="padding: 5px;">
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
发货信息
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
商品信息:{{d.params.data.order.description }}<br />
|
||||
发货方式:
|
||||
{{# layui.each(d.params.data.logisticsType, function(index, item){ }}
|
||||
{{d.params.data.order.shipping.logistics_type==item.value ? item.title:''}}
|
||||
{{# }); }}
|
||||
<br />
|
||||
|
||||
|
||||
{{# if(d.params.data.order.shipping.logistics_type==1) { }}
|
||||
{{# layui.each(d.params.data.order.shipping.shipping_list, function(index, itemP){ }}
|
||||
发货时间:{{ layui.util.toDateString(itemP.upload_time * 1000, 'yyyy-MM-dd HH:mm:ss')}}<br />
|
||||
包裹{{index+1}}:
|
||||
|
||||
{{# layui.each(d.params.data.deliveryCompany, function(index, item){ }}
|
||||
|
||||
{{itemP.express_company==item.deliveryId ? item.deliveryName:''}}
|
||||
|
||||
{{# }); }}
|
||||
|
||||
{{itemP.tracking_no}}
|
||||
<br />
|
||||
{{# }); }}
|
||||
|
||||
{{# }; }}
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
var debug = layui.setter.debug;
|
||||
layui.data.done = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d.params.data); }
|
||||
|
||||
layui.use(['admin', 'form', 'coreHelper'], function () {
|
||||
var $ = layui.$
|
||||
, setter = layui.setter
|
||||
, admin = layui.admin
|
||||
, coreHelper = layui.coreHelper
|
||||
, form = layui.form;
|
||||
form.render(null, 'LAY-app-WeChatMessageResponse-detailsForm');
|
||||
});
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,387 @@
|
||||
<title>微信自动回复消息表</title>
|
||||
<!--当前位置开始-->
|
||||
<div class="layui-card layadmin-header">
|
||||
<div class="layui-breadcrumb" lay-filter="breadcrumb">
|
||||
<script type="text/html" template lay-done="layui.data.updateMainBreadcrumb();">
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<!--当前位置结束-->
|
||||
<style>
|
||||
/* 重写样式 */
|
||||
</style>
|
||||
<script type="text/html" template lay-type="Post" lay-url="Api/WeChatShippingOrder/GetIndex" lay-done="layui.data.done(d);">
|
||||
|
||||
</script>
|
||||
<div class="table-body">
|
||||
<table id="LAY-app-WeChatShippingOrder-tableBox" lay-filter="LAY-app-WeChatShippingOrder-tableBox"></table>
|
||||
<div id="demo-laypage-pn-show"></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/html" id="LAY-app-WeChatShippingOrder-toolbar">
|
||||
<div class="layui-form coreshop-toolbar-search-form">
|
||||
<div class="layui-form-item">
|
||||
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<select name="status">
|
||||
<option value="">请选择订单状态</option>
|
||||
{{# layui.each(indexData.status, function(index, item){ }}
|
||||
<option value="{{item.value}}">{{- item.description}}</option>
|
||||
{{# }); }}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-WeChatShippingOrder-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="LAY-app-WeChatShippingOrder-tableBox-bar">
|
||||
|
||||
<!--<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">关联订单</a>-->
|
||||
{{# if(d.order_state>1){ }}
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">发货详情</a>
|
||||
{{# } }}
|
||||
|
||||
{{# if(d.order_state==1){ }}
|
||||
<a class="layui-btn layui-btn-xs" lay-event="addData">立即发货</a>
|
||||
{{# } else if(d.order_state==2){ }}
|
||||
<a class="layui-btn layui-bg-blue layui-btn-xs" lay-event="updateData">重新发货</a>
|
||||
{{# } }}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
var _this = this;
|
||||
var indexData;
|
||||
var debug = layui.setter.debug;
|
||||
var has_more = false;
|
||||
var last_index = "";
|
||||
layui.data.done = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d); }
|
||||
|
||||
indexData = d.data;
|
||||
layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper', 'laypage'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, admin = layui.admin
|
||||
, table = layui.table
|
||||
, form = layui.form
|
||||
, laydate = layui.laydate
|
||||
, setter = layui.setter
|
||||
, coreHelper = layui.coreHelper
|
||||
, util = layui.util
|
||||
, laypage = layui.laypage
|
||||
, view = layui.view;
|
||||
var searchwhere;
|
||||
|
||||
//监听搜索
|
||||
form.on('submit(LAY-app-WeChatShippingOrder-search)',
|
||||
function (data) {
|
||||
var field = data.field;
|
||||
searchwhere = field;
|
||||
//执行重载
|
||||
table.reloadData('LAY-app-WeChatShippingOrder-tableBox', { where: field });
|
||||
});
|
||||
//数据绑定
|
||||
table.render({
|
||||
elem: '#LAY-app-WeChatShippingOrder-tableBox',
|
||||
url: layui.setter.apiUrl + 'Api/WeChatShippingOrder/GetPageList',
|
||||
method: 'POST',
|
||||
where: { last_index: last_index, has_more: has_more },
|
||||
toolbar: '#LAY-app-WeChatShippingOrder-toolbar',
|
||||
//pagebar: '#LAY-app-WeChatShippingOrder-pagebar',
|
||||
className: 'pagebarbox',
|
||||
defaultToolbar: ['filter', 'print', 'exports'],
|
||||
//height: 'full-127',//面包屑142px,搜索框4行172,3行137,2行102,1行67
|
||||
page: false,
|
||||
limit: 10,
|
||||
limits: [10, 15, 20, 25, 30, 50, 100, 200],
|
||||
text: { none: '暂无相关数据' },
|
||||
cols: [
|
||||
[
|
||||
{ type: "checkbox", fixed: "left" },
|
||||
//{ field: 'merchant_id', title: '商户号', align: 'center', width: 100, sort: false },
|
||||
//{ field: 'sub_merchant_id', title: '二级商户号', width: 80, sort: false },
|
||||
{ field: 'transaction_id', title: '微信订单号', sort: false, width: 205 },
|
||||
{ field: 'merchant_trade_no', title: '支付单号', sort: false, width: 125 },
|
||||
{
|
||||
field: 'order_state', title: '发货单状态', sort: false, align: 'center', width: 80, templet: function (data) {
|
||||
for (var i = 0; i < d.data.status.length; i++) {
|
||||
if (d.data.status[i].value == data.order_state) {
|
||||
return d.data.status[i].description;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'logistics_type', title: '发货模式', sort: false, align: 'center', width: 80, templet: function (data) {
|
||||
for (var i = 0; i < d.data.logisticsType.length; i++) {
|
||||
if (d.data.logisticsType[i].value == data.shipping.logistics_type) {
|
||||
return d.data.logisticsType[i].description;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
},
|
||||
{ field: 'description', title: '发货商品描述', sort: false },
|
||||
{
|
||||
field: 'paid_amount', title: '实际支付', sort: false, align: 'center', width: 80, templet: function (data) {
|
||||
return '<div>' + (data.paid_amount / 100) + '元' + '</div>';
|
||||
}
|
||||
},
|
||||
{ field: 'openid', title: 'openid', sort: false, width: 220 },
|
||||
{
|
||||
field: 'trade_create_time', title: '交易创建时间', sort: false, width: 130, templet: function (data) {
|
||||
return util.toDateString(data.trade_create_time * 1000, 'yyyy-MM-dd HH:mm:ss');;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'pay_time', title: '支付时间', sort: false, width: 130, templet: function (data) {
|
||||
return util.toDateString(data.pay_time * 1000, 'yyyy-MM-dd HH:mm:ss');
|
||||
}
|
||||
},
|
||||
{ field: 'in_complaint', title: '交易纠纷中', width: 85, templet: '#switch_in_complaint', align: 'center', sort: false, unresize: true },
|
||||
|
||||
{ width: 220, align: 'center', title: '操作', fixed: 'right', toolbar: '#LAY-app-WeChatShippingOrder-tableBox-bar' }
|
||||
]
|
||||
],
|
||||
done: function (res, curr, count, origin) {
|
||||
console.log(res); // 得到当前渲染的数据
|
||||
console.log(curr); // 得到当前页码
|
||||
console.log(count); // 得到数据总量
|
||||
console.log(res.otherData.has_more);
|
||||
if (res.code == 0) {
|
||||
has_more = res.otherData.has_more;
|
||||
if (res.otherData.has_more) {
|
||||
last_index = res.otherData.last_index;
|
||||
} else {
|
||||
last_index = "";
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
});
|
||||
//监听排序事件
|
||||
table.on('sort(LAY-app-WeChatShippingOrder-tableBox)', function (obj) {
|
||||
table.reloadData('LAY-app-WeChatShippingOrder-tableBox', {
|
||||
initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
|
||||
where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
||||
orderField: obj.field, //排序字段
|
||||
orderDirection: obj.type //排序方式
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//监听工具条
|
||||
table.on('tool(LAY-app-WeChatShippingOrder-tableBox)',
|
||||
function (obj) {
|
||||
if (obj.event === 'detail') {
|
||||
doDetails(obj);
|
||||
} else if (obj.event === 'updateData') {
|
||||
doUpdate(obj)
|
||||
} else if (obj.event === 'addData') {
|
||||
doCreate(obj)
|
||||
}
|
||||
});
|
||||
//执行创建操作
|
||||
function doCreate(obj) {
|
||||
coreHelper.Post("Api/WeChatShippingOrder/GetCreate", { data: obj.data.transaction_id, id: obj.data.merchant_trade_no }, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '创建数据',
|
||||
area: ['800px', '90%'],
|
||||
id: 'LAY-popup-WeChatShippingOrder-create',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('wechatshipping/order/create', { data: e.data }).done(function () {
|
||||
//监听提交
|
||||
form.on('submit(LAY-app-WeChatShippingOrder-createForm-submit)',
|
||||
function (data) {
|
||||
var field = data.field; //获取提交的字段
|
||||
|
||||
field.is_all_delivered = field.is_all_delivered == 'on';
|
||||
|
||||
var keys = Object.keys(field);
|
||||
var keysCount = 0;
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
if (keys[i].indexOf('shipping_list.express_company') != -1) {
|
||||
keysCount++;
|
||||
}
|
||||
}
|
||||
var items = [];
|
||||
if (keysCount > 0) {
|
||||
for (var i = 0; i < keysCount; i++) {
|
||||
var item = {};
|
||||
item.express_company = field['shipping_list.express_company[' + i + ']'];
|
||||
item.tracking_no = field['shipping_list.tracking_no[' + i + ']'];
|
||||
items.push(item);
|
||||
}
|
||||
}
|
||||
field.shipping_list = items;
|
||||
|
||||
if (debug) { console.log(field); } //开启调试返回数据
|
||||
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
||||
coreHelper.Post("Api/WeChatShippingOrder/DoCreate", field, function (e) {
|
||||
console.log(e)
|
||||
if (e.code === 0) {
|
||||
layui.table.reloadData('LAY-app-WeChatShippingOrder-tableBox'); //重载表格
|
||||
layer.close(index); //再执行关闭
|
||||
layer.msg(e.msg);
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
// 禁止弹窗出现滚动条
|
||||
//$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
, btn: ['确定', '取消']
|
||||
, yes: function (index, layero) {
|
||||
layero.contents().find("#LAY-app-WeChatShippingOrder-createForm-submit").click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行编辑操作
|
||||
function doUpdate(obj) {
|
||||
coreHelper.Post("Api/WeChatShippingOrder/GetUpdate", { data: obj.data.transaction_id, id: obj.data.merchant_trade_no }, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '编辑数据',
|
||||
area: ['800px', '90%'],
|
||||
id: 'LAY-popup-WeChatShippingOrder-update',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('wechatshipping/order/update', { data: e.data }).done(function () {
|
||||
//监听提交
|
||||
form.on('submit(LAY-app-WeChatMessageResponse-updateForm-submit)',
|
||||
function (data) {
|
||||
var field = data.field; //获取提交的字段
|
||||
|
||||
field.is_all_delivered = field.is_all_delivered == 'on';
|
||||
|
||||
var keys = Object.keys(field);
|
||||
var keysCount = 0;
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
if (keys[i].indexOf('shipping_list.express_company') != -1) {
|
||||
keysCount++;
|
||||
}
|
||||
}
|
||||
var items = [];
|
||||
if (keysCount > 0) {
|
||||
for (var i = 0; i < keysCount; i++) {
|
||||
var item = {};
|
||||
item.express_company = field['shipping_list.express_company[' + i + ']'];
|
||||
item.tracking_no = field['shipping_list.tracking_no[' + i + ']'];
|
||||
items.push(item);
|
||||
}
|
||||
}
|
||||
field.shipping_list = items;
|
||||
|
||||
if (debug) { console.log(field); } //开启调试返回数据
|
||||
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
||||
coreHelper.Post("Api/WeChatShippingOrder/DoCreate", field, function (e) {
|
||||
console.log(e)
|
||||
if (e.code === 0) {
|
||||
layui.table.reloadData('LAY-app-WeChatShippingOrder-tableBox'); //重载表格
|
||||
layer.close(index); //再执行关闭
|
||||
layer.msg(e.msg);
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
// 禁止弹窗出现滚动条
|
||||
//$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
, btn: ['确定', '取消']
|
||||
, yes: function (index, layero) {
|
||||
layero.contents().find("#LAY-app-WeChatMessageResponse-updateForm-submit").click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行预览操作
|
||||
function doDetails(obj) {
|
||||
coreHelper.Post("Api/WeChatShippingOrder/GetDetails", { data: obj.data.transaction_id, id: obj.data.merchant_trade_no }, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '查看详情',
|
||||
area: ['800px', '600px'],
|
||||
id: 'LAY-popup-WeChatShippingOrder-details',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('wechatshipping/order/details', { data: e.data }).done(function () {
|
||||
form.render();
|
||||
});
|
||||
// 禁止弹窗出现滚动条
|
||||
//$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 只显示上一页、下一页、当前页
|
||||
laypage.render({
|
||||
elem: 'demo-laypage-pn-show',
|
||||
count: 99999,
|
||||
groups: 1,
|
||||
first: '首页',
|
||||
last: false,
|
||||
layout: ['first', 'page', 'next'],
|
||||
jump: function (obj, first) {
|
||||
// 首次不执行
|
||||
if (!first) {
|
||||
layer.msg('第 ' + obj.curr + ' 页');
|
||||
|
||||
if (has_more) {
|
||||
table.reloadData('LAY-app-WeChatShippingOrder-tableBox', {
|
||||
where: { last_index: last_index },
|
||||
scrollPos: true,
|
||||
});
|
||||
} else {
|
||||
layer.msg('没有更多内容了');
|
||||
|
||||
}
|
||||
|
||||
if (obj.curr == 1) {
|
||||
last_index = '';
|
||||
table.reloadData('LAY-app-WeChatShippingOrder-tableBox', {
|
||||
where: { last_index: '' },
|
||||
scrollPos: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//重载form
|
||||
form.render();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<!--设置是否启用-->
|
||||
<script type="text/html" id="switch_in_complaint">
|
||||
<input type="checkbox" name="switch_in_complaint" value="{{d.in_complaint}}" lay-skin="switch" lay-text="是|否" disabled="disabled">
|
||||
</script>
|
||||
@@ -0,0 +1,241 @@
|
||||
<script type="text/html" template lay-done="layui.data.sendParams(d);">
|
||||
<div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-WeChatMessageResponse-updateForm" id="LAY-app-WeChatMessageResponse-updateForm">
|
||||
|
||||
<input type="hidden" name="transaction_id" value="{{d.params.data.order.transaction_id }}" />
|
||||
<input type="hidden" name="openid" value="{{d.params.data.order.openid }}" />
|
||||
<input type="hidden" name="merchant_id" value="{{d.params.data.order.merchant_id }}" />
|
||||
<input type="hidden" name="merchant_trade_no" value="{{d.params.data.order.merchant_trade_no }}" />
|
||||
|
||||
<blockquote class="layui-elem-quote">
|
||||
商户单号:{{d.params.data.order.merchant_trade_no }}<br />
|
||||
交易单号:{{d.params.data.order.transaction_id }}<br />
|
||||
支付金额:¥ {{d.params.data.order.paid_amount / 100 }} 元<br />
|
||||
支付时间:{{ layui.util.toDateString(d.params.data.order.pay_time * 1000, 'yyyy-MM-dd HH:mm:ss')}}<br />
|
||||
</blockquote>
|
||||
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">商品信息</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="item_desc" placeholder="商品信息会向用户展示,请保持和订单信息一致。输入多个商品时用“ ; ”隔开。" class="layui-textarea">{{d.params.data.order.description}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">发货方式</label>
|
||||
<div class="layui-input-block">
|
||||
{{# layui.each(d.params.data.logisticsType, function(index, item){ }}
|
||||
<input type="radio" name="logistics_type" value="{{item.value}}" title="{{item.title}}" {{d.params.data.order.shipping.logistics_type==item.value ? 'checked':''}} lay-filter="logistics-type-filter">
|
||||
{{# }); }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="logisticsBox">
|
||||
<div class="layui-form-item">
|
||||
<label for="matchKey" class="layui-form-label ">
|
||||
快递信息
|
||||
</label>
|
||||
<div class="layui-input-block">
|
||||
<table class="layui-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>物流公司</th>
|
||||
<th style="width: 250px;">快递单号</th>
|
||||
<th style="width: 82px;">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="logisticsView">
|
||||
{{# if(d.params.data.order.shipping.logistics_type==1) { }}
|
||||
{{# layui.each(d.params.data.order.shipping.shipping_list, function(index, itemP){ }}
|
||||
<tr data-id="{{index}}">
|
||||
<td>
|
||||
<select lay-search="" id="express_company" name="shipping_list.express_company[0]" class="layui-input">
|
||||
<option value="">请选择,可直接输入搜索</option>
|
||||
{{# layui.each(d.params.data.deliveryCompany, function(index, item){ }}
|
||||
<option value="{{item.deliveryId}}" {{itemP.express_company==item.deliveryId ? 'selected="selected"':''}}>{{item.deliveryName}}</option>
|
||||
{{# }); }}
|
||||
</select>
|
||||
</td>
|
||||
<td class="field_value">
|
||||
<input type="text" id="tracking_no" name="shipping_list.tracking_no[0]" required value="{{itemP.tracking_no}}" placeholder="填写快递单号" autocomplete="off" class="layui-input">
|
||||
</td>
|
||||
<td>
|
||||
<a class="layui-btn layui-btn-xs addfield-class table-button">
|
||||
添加
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{# }); }}
|
||||
{{# } else { }}
|
||||
<tr data-id="0">
|
||||
<td>
|
||||
<select lay-search="" id="express_company" name="shipping_list.express_company[0]" class="layui-input">
|
||||
<option value="">请选择,可直接输入搜索</option>
|
||||
{{# layui.each(d.params.data.deliveryCompany, function(index, item){ }}
|
||||
<option value="{{item.deliveryId}}">{{item.deliveryName}}</option>
|
||||
{{# }); }}
|
||||
</select>
|
||||
</td>
|
||||
<td class="field_value">
|
||||
<input type="text" id="tracking_no" name="shipping_list.tracking_no[0]" required value="" placeholder="填写快递单号" autocomplete="off" class="layui-input">
|
||||
</td>
|
||||
<td>
|
||||
<a class="layui-btn layui-btn-xs addfield-class table-button">
|
||||
添加
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{# }; }}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">全部发货</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="is_all_delivered" lay-skin="switch" lay-filter="switchTest" checked="checked" title="是|否">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="cityDistributionBox" style="display:none;">
|
||||
<div class="layui-form-item">
|
||||
<label for="matchKey" class="layui-form-label">
|
||||
快递信息
|
||||
</label>
|
||||
<div class="layui-input-inline layui-inline-4">
|
||||
<input name="cityDistributionName" class="layui-input" placeholder="填写同城配送公司名称" value="{{d.params.data.order.shipping.logistics_type==2 ? d.params.data.order.shipping.shipping_list[0].express_company : ''}}" />
|
||||
</div>
|
||||
<div class="layui-input-inline layui-inline-4">
|
||||
<input name="cityDistributionNumber" class="layui-input" placeholder="填写快递单号" value="{{d.params.data.order.shipping.logistics_type==2 ? d.params.data.order.shipping.shipping_list[0].tracking_no : ''}}" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
如商家自配,则该项可选填
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="layui-form-item text-right core-hidden">
|
||||
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-WeChatMessageResponse-updateForm-submit" id="LAY-app-WeChatMessageResponse-updateForm-submit" value="确认编辑">
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
||||
<script id="tr_tpl" type="text/html">
|
||||
<tr data-id="{{ d.id }}">
|
||||
<td>
|
||||
<select lay-search="" id="express_company" name="shipping_list.express_company[{{ d.id }}]" class="layui-input">
|
||||
<option value="">请选择,可直接输入搜索</option>
|
||||
{{# layui.each(d.deliveryCompany, function(index, item){ }}
|
||||
<option value="{{item.deliveryId}}">{{item.deliveryName}}</option>
|
||||
{{# }); }}
|
||||
</select>
|
||||
</td>
|
||||
<td class="field_value">
|
||||
<input type="text" id="tracking_no" name="shipping_list.tracking_no[{{ d.id }}]" required value="" placeholder="填写快递单号" autocomplete="off" class="layui-input">
|
||||
</td>
|
||||
<td>
|
||||
<a class="layui-btn layui-btn-xs addfield-class table-button">
|
||||
添加
|
||||
</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs del-class table-button">
|
||||
删除
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
var debug = layui.setter.debug;
|
||||
layui.data.sendParams = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d.params.data); }
|
||||
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg', 'laytpl'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, form = layui.form
|
||||
, admin = layui.admin
|
||||
, laydate = layui.laydate
|
||||
, upload = layui.upload
|
||||
, cropperImg = layui.cropperImg
|
||||
, laytpl = layui.laytpl
|
||||
, coreHelper = layui.coreHelper;
|
||||
|
||||
hideBox(d.params.data.order.shipping.logistics_type);
|
||||
|
||||
$(".layui-table").on('click', '.addfield-class', function (e) {
|
||||
var getTpl = tr_tpl.innerHTML;
|
||||
var lastId = $(this).parent().parent().parent().find('tr').last().attr('data-id');
|
||||
console.log(lastId);
|
||||
var tmpData = {};
|
||||
tmpData.id = parseInt(lastId) + 1;
|
||||
tmpData.deliveryCompany = d.params.data.deliveryCompany;
|
||||
laytpl(getTpl).render(tmpData, function (html) {
|
||||
$("#logisticsView").append(html);
|
||||
form.render();
|
||||
});
|
||||
});
|
||||
|
||||
$(".layui-table").on('click', '.del-class', function (e) {
|
||||
if ($(".del-class").length > 0) {
|
||||
$(this).parent().parent().remove();
|
||||
resetInputNameID();
|
||||
} else {
|
||||
layer.msg("至少保留1个物流信息录入框");
|
||||
}
|
||||
})
|
||||
|
||||
//重置排序
|
||||
function resetInputNameID() {
|
||||
$.each($("#logisticsView tr"), function (i, tr) {
|
||||
$(this).attr('data-id', i);
|
||||
$(this).find("#express_company").attr("name", "shipping_list.express_company[" + i + "]");
|
||||
$(this).find("#tracking_no").attr("name", "shipping_list.tracking_no[" + i + "]");
|
||||
});
|
||||
}
|
||||
|
||||
// radio 事件
|
||||
form.on('radio(logistics-type-filter)', function (data) {
|
||||
var elem = data.elem; // 获得 radio 原始 DOM 对象
|
||||
var value = elem.value; // 获得 radio 值
|
||||
|
||||
hideBox(value);
|
||||
});
|
||||
|
||||
function hideBox(value) {
|
||||
if (value == 1) {
|
||||
$('#logisticsBox').show();
|
||||
$('#cityDistributionBox').hide();
|
||||
} else if (value == 2) {
|
||||
$('#logisticsBox').hide();
|
||||
$('#cityDistributionBox').show();
|
||||
} else {
|
||||
$('#logisticsBox').hide();
|
||||
$('#cityDistributionBox').hide();
|
||||
}
|
||||
}
|
||||
|
||||
form.verify({
|
||||
|
||||
verifymatchKey: [/^.{0,100}$/, '匹配字符最大只允许输入100位字符'],
|
||||
verifyimgTextUrl: [/^.{0,1000}$/, '图片回复图片地址最大只允许输入1000位字符'],
|
||||
verifyimgTextLink: [/^.{0,1000}$/, '图片回复超链接最大只允许输入1000位字符'],
|
||||
verifymeidaUrl: [/^.{0,1000}$/, '语音回复地址最大只允许输入1000位字符'],
|
||||
verifymeidaLink: [/^.{0,1000}$/, '语音回复超链接最大只允许输入1000位字符'],
|
||||
verifyremark: [/^.{0,1000}$/, '备注最大只允许输入1000位字符'],
|
||||
verifycreateBy: [/^.{0,100}$/, '创建来源最大只允许输入100位字符'],
|
||||
verifymodifyBy: [/^.{0,100}$/, '修改来源最大只允许输入100位字符'],
|
||||
});
|
||||
|
||||
//重载form
|
||||
form.render(null, 'LAY-app-WeChatMessageResponse-updateForm');
|
||||
})
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user