mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 19:03:27 +08:00
【新增】自定义交易组件增加【获取商家信息】【更新商家信息】两个接口处理。
This commit is contained in:
@@ -0,0 +1,69 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CoreCms.Net.WeChat.Service.TransactionComponent.FromBody
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 更新商家信息提交
|
||||||
|
/// </summary>
|
||||||
|
public class FMUpdateInfo
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 小程序path
|
||||||
|
/// </summary>
|
||||||
|
public string service_agent_path { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string service_agent_phone { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public List<int> service_agent_type { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public Default_receiving_address default_receiving_address { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 默认退货地址,退货售后超时时,会让用户将货物寄往此地址。
|
||||||
|
/// </summary>
|
||||||
|
public class Default_receiving_address
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 张三
|
||||||
|
/// </summary>
|
||||||
|
public string receiver_name { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 详细收货地址信息
|
||||||
|
/// </summary>
|
||||||
|
public string detailed_address { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 收货人电话
|
||||||
|
/// </summary>
|
||||||
|
public string tel_number { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 国家
|
||||||
|
/// </summary>
|
||||||
|
public string country { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 省份
|
||||||
|
/// </summary>
|
||||||
|
public string province { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 城市
|
||||||
|
/// </summary>
|
||||||
|
public string city { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 区县
|
||||||
|
/// </summary>
|
||||||
|
public string town { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -66,7 +66,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
|||||||
private readonly ICoreCmsUserWeChatInfoServices _userWeChatInfoServices;
|
private readonly ICoreCmsUserWeChatInfoServices _userWeChatInfoServices;
|
||||||
private readonly IWeChatTransactionComponentDeliveryCompanyServices _tcDeliveryCompanyServices;
|
private readonly IWeChatTransactionComponentDeliveryCompanyServices _tcDeliveryCompanyServices;
|
||||||
private readonly IRedisOperationRepository _redisOperationRepository;
|
private readonly IRedisOperationRepository _redisOperationRepository;
|
||||||
private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
private readonly Net.WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
||||||
|
|
||||||
|
|
||||||
private readonly ICoreCmsOrderItemServices _orderItemServices;
|
private readonly ICoreCmsOrderItemServices _orderItemServices;
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using CoreCms.Net.Caching.AccressToken;
|
||||||
|
using CoreCms.Net.Model.Entities;
|
||||||
|
using CoreCms.Net.Model.ViewModels.UI;
|
||||||
|
using CoreCms.Net.WeChat.Service.HttpClients;
|
||||||
|
using SKIT.FlurlHttpClient.Wechat.Api;
|
||||||
|
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
||||||
|
using CoreCms.Net.WeChat.Service.TransactionComponent.FromBody;
|
||||||
|
|
||||||
|
namespace CoreCms.Net.Web.Admin.Controllers.WeChat
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 自定义交易组件上传类目资质
|
||||||
|
///</summary>
|
||||||
|
[Description("自定义交易组件上传类目资质")]
|
||||||
|
[Route("api/[controller]/[action]")]
|
||||||
|
[ApiController]
|
||||||
|
public class WeChatTransactionComponentAccountController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly Net.WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 构造函数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="weChatApiHttpClientFactory"></param>
|
||||||
|
public WeChatTransactionComponentAccountController(IWeChatApiHttpClientFactory weChatApiHttpClientFactory)
|
||||||
|
{
|
||||||
|
_weChatApiHttpClientFactory = weChatApiHttpClientFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region 获取商家信息============================================================
|
||||||
|
// POST: Api/WeChatTransactionComponentAccount/GetInfo
|
||||||
|
/// <summary>
|
||||||
|
/// 获取商家信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Description("获取商家信息")]
|
||||||
|
public async Task<AdminUiCallBack> GetInfo()
|
||||||
|
{
|
||||||
|
var jm = new AdminUiCallBack();
|
||||||
|
|
||||||
|
|
||||||
|
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
|
||||||
|
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
|
||||||
|
var request = new ShopAccountGetInfoRequest();
|
||||||
|
request.AccessToken = accessToken;
|
||||||
|
|
||||||
|
var response = await client.ExecuteShopAccountGetInfoAsync(request);
|
||||||
|
|
||||||
|
jm.code = response.IsSuccessful() ? 0 : 1;
|
||||||
|
jm.msg = response.IsSuccessful() ? "获取成功" : response.ErrorMessage;
|
||||||
|
jm.data = response.Data;
|
||||||
|
|
||||||
|
jm.otherData = new
|
||||||
|
{
|
||||||
|
service_agent_type_service = response.Data.ServiceAgentTypeList?.Contains(0) == true ? 0 : -1,
|
||||||
|
service_agent_type_phone = response.Data.ServiceAgentTypeList?.Contains(2) == true ? 0 : -1,
|
||||||
|
service_agent_type_path = response.Data.ServiceAgentTypeList?.Contains(1) == true ? 0 : -1,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 更新商家信息============================================================
|
||||||
|
// POST: Api/WeChatTransactionComponentAccount/DoUpdateInfo
|
||||||
|
/// <summary>
|
||||||
|
/// 更新商家信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Description("更新商家信息")]
|
||||||
|
public async Task<AdminUiCallBack> DoUpdateInfo([FromBody] FMUpdateInfo entity)
|
||||||
|
{
|
||||||
|
var jm = new AdminUiCallBack { code = 0 };
|
||||||
|
|
||||||
|
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
|
||||||
|
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
|
||||||
|
var request = new ShopAccountUpdateInfoRequest();
|
||||||
|
request.AccessToken = accessToken;
|
||||||
|
|
||||||
|
request.ServiceAgentTypeList = entity.service_agent_type;
|
||||||
|
request.ServiceAgentPagePath = entity.service_agent_path;
|
||||||
|
request.ServiceAgentPhoneNumber = entity.service_agent_phone;
|
||||||
|
|
||||||
|
request.DefaultReceivingAddress = new ShopAccountUpdateInfoRequest.Types.Address();
|
||||||
|
request.DefaultReceivingAddress.ReceiverName = entity.default_receiving_address.receiver_name;
|
||||||
|
request.DefaultReceivingAddress.Detail = entity.default_receiving_address.detailed_address;
|
||||||
|
request.DefaultReceivingAddress.TeleNumber = entity.default_receiving_address.tel_number;
|
||||||
|
request.DefaultReceivingAddress.Country = entity.default_receiving_address.country;
|
||||||
|
request.DefaultReceivingAddress.Province = entity.default_receiving_address.province;
|
||||||
|
request.DefaultReceivingAddress.City = entity.default_receiving_address.city;
|
||||||
|
request.DefaultReceivingAddress.District = entity.default_receiving_address.town;
|
||||||
|
|
||||||
|
var response = await client.ExecuteShopAccountUpdateInfoAsync(request);
|
||||||
|
|
||||||
|
jm.code = response.IsSuccessful() ? 0 : 1;
|
||||||
|
jm.msg = response.IsSuccessful() ? "更新成功" : response.ErrorMessage;
|
||||||
|
|
||||||
|
jm.data = entity;
|
||||||
|
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -51,7 +51,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
|||||||
{
|
{
|
||||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||||
private readonly IWeChatTransactionComponentBrandAuditServices _weChatTransactionComponentBrandAuditServices;
|
private readonly IWeChatTransactionComponentBrandAuditServices _weChatTransactionComponentBrandAuditServices;
|
||||||
private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
private readonly CoreCms.Net.WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构造函数
|
/// 构造函数
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
|||||||
{
|
{
|
||||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||||
private readonly IWeChatTransactionComponentDeliveryCompanyServices _weChatTransactionComponentDeliveryCompanyServices;
|
private readonly IWeChatTransactionComponentDeliveryCompanyServices _weChatTransactionComponentDeliveryCompanyServices;
|
||||||
private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
private readonly CoreCms.Net.WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
|||||||
private readonly IWeChatTransactionComponentAuditCategoryServices
|
private readonly IWeChatTransactionComponentAuditCategoryServices
|
||||||
_weChatTransactionComponentAuditCategoryServices;
|
_weChatTransactionComponentAuditCategoryServices;
|
||||||
private readonly ICoreCmsProductsServices _productsServices;
|
private readonly ICoreCmsProductsServices _productsServices;
|
||||||
private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
private readonly CoreCms.Net.WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
||||||
|
|
||||||
private readonly IWeChatTransactionComponentBrandAuditServices _weChatTransactionComponentBrandAuditServices;
|
private readonly IWeChatTransactionComponentBrandAuditServices _weChatTransactionComponentBrandAuditServices;
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
|||||||
{
|
{
|
||||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||||
private readonly IWeChatTransactionComponentThirdCategoryServices _weChatTcThirdCatListServices;
|
private readonly IWeChatTransactionComponentThirdCategoryServices _weChatTcThirdCatListServices;
|
||||||
private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
private readonly CoreCms.Net.WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Controllers\WeChat\CoreCmsUserWeChatInfoController.cs" />
|
<Compile Include="Controllers\WeChat\CoreCmsUserWeChatInfoController.cs" />
|
||||||
<Compile Include="Controllers\WeChat\CoreCmsUserWeChatMsgTemplateController.cs" />
|
<Compile Include="Controllers\WeChat\CoreCmsUserWeChatMsgTemplateController.cs" />
|
||||||
|
<Compile Include="Controllers\WeChat\WeChatTransactionComponentAccountController.cs" />
|
||||||
<Compile Include="Controllers\WeChat\WeChatTransactionComponentAuditCategoryController.cs" />
|
<Compile Include="Controllers\WeChat\WeChatTransactionComponentAuditCategoryController.cs" />
|
||||||
<Compile Include="Controllers\WeChat\WeChatTransactionComponentBrandAuditController.cs" />
|
<Compile Include="Controllers\WeChat\WeChatTransactionComponentBrandAuditController.cs" />
|
||||||
<Compile Include="Controllers\WeChat\WeChatTransactionComponentDeliveryCompanyController.cs" />
|
<Compile Include="Controllers\WeChat\WeChatTransactionComponentDeliveryCompanyController.cs" />
|
||||||
|
|||||||
@@ -0,0 +1,223 @@
|
|||||||
|
<script type="text/html" template lay-type="Post" lay-url="{{ layui.setter.apiUrl }}Api/WeChatTransactionComponentAccount/GetInfo" lay-done="layui.data.done(d);">
|
||||||
|
|
||||||
|
<div class="layui-fluid">
|
||||||
|
<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">
|
||||||
|
|
||||||
|
<div class="layui-tab layui-tab-card" lay-filter="setting">
|
||||||
|
<ul class="layui-tab-title">
|
||||||
|
<li lay-id="distributionSet" class="layui-this">商家信息</li>
|
||||||
|
</ul>
|
||||||
|
<div class="layui-tab-content">
|
||||||
|
<div class="layui-tab-item layui-show">
|
||||||
|
<div class="layui-form coreshop-form transactioncomponent" lay-filter="LAY-app-WeChatTransactionComponentAuditCategory-createForm" id="LAY-app-WeChatTransactionComponentAuditCategory-createForm">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="licenseImage" class="layui-form-label">客服地址</label>
|
||||||
|
<div class="layui-input-inline layui-inline-12">
|
||||||
|
<input name="service_agent_path" class="layui-input" placeholder="请输入客服地址" lay-reqText="请输入客服地址" value="{{d.data.service_agent_path ? d.data.service_agent_path:''}}" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
输入小程序的客服自定义地址,如:/pages/member/customerService/index
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="licenseImage" class="layui-form-label">联系方式</label>
|
||||||
|
<div class="layui-input-inline layui-inline-12">
|
||||||
|
<input name="service_agent_phone" class="layui-input" placeholder="请输入客服地址" lay-reqText="请输入客服地址" value="{{d.data.service_agent_phone ? d.data.service_agent_phone:''}}" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
如:020-888888
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="licenseImage" class="layui-form-label layui-form-required">客服类型</label>
|
||||||
|
<div class="layui-input-inline layui-inline-12">
|
||||||
|
<input type="checkbox" name="service_agent_type_service" title="小程序官方客服" {{d.otherData.service_agent_type_service===0?'checked':''}}>
|
||||||
|
<input type="checkbox" name="service_agent_type_phone" title="联系电话" {{d.otherData.service_agent_type_phone===0?'checked':''}}>
|
||||||
|
<input type="checkbox" name="service_agent_type_path" title="自定义客服path" {{d.otherData.service_agent_type_path===0?'checked':''}}>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<fieldset class="layui-elem-field layui-field-title site-title"><legend><a name="compress">默认退货地址</a></legend></fieldset>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="licenseImage" class="layui-form-label layui-form-required">收货人姓名</label>
|
||||||
|
<div class="layui-input-inline layui-inline-8">
|
||||||
|
<input name="receiver_name" lay-verify="required" class="layui-input" placeholder="请输入收货人姓名" lay-reqText="请输入收货人姓名" value="{{d.data.default_receiving_address ? d.data.default_receiving_address.receiver_name:''}}" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
如:张三
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="licenseImage" class="layui-form-label layui-form-required">收货地址</label>
|
||||||
|
<div class="layui-input-inline layui-inline-8">
|
||||||
|
<input name="detailed_address" lay-verify="required" class="layui-input" placeholder="请输入详细收货地址信息" lay-reqText="请输入详细收货地址信息" value="{{d.data.default_receiving_address ? d.data.default_receiving_address.detailed_address:''}}" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
如:详细收货地址信息
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="licenseImage" class="layui-form-label layui-form-required">手机号码</label>
|
||||||
|
<div class="layui-input-inline layui-inline-8">
|
||||||
|
<input name="tel_number" lay-verify="required|phone" class="layui-input" placeholder="请输入手机号码" lay-reqText="请输入手机号码" value="{{d.data.default_receiving_address ? d.data.default_receiving_address.tel_number:''}}" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
如:19145919666
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="licenseImage" class="layui-form-label">国家</label>
|
||||||
|
<div class="layui-input-inline layui-inline-8">
|
||||||
|
<input name="country" class="layui-input" placeholder="请输入手机号码" lay-reqText="请输入手机号码" value="{{d.data.default_receiving_address ? d.data.default_receiving_address.country:''}}" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
选填,如:中国
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="licenseImage" class="layui-form-label layui-form-required">省份</label>
|
||||||
|
<div class="layui-input-inline layui-inline-8">
|
||||||
|
<input name="province" class="layui-input" lay-verify="required" placeholder="请输入手机号码" lay-reqText="请输入手机号码" value="{{d.data.default_receiving_address ? d.data.default_receiving_address.province:''}}" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
选填,如:湖南省
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="licenseImage" class="layui-form-label layui-form-required">市</label>
|
||||||
|
<div class="layui-input-inline layui-inline-8">
|
||||||
|
<input name="city" class="layui-input" lay-verify="required" placeholder="请输入城市" lay-reqText="请输入城市" value="{{d.data.default_receiving_address ? d.data.default_receiving_address.city:''}}" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
选填,如:怀化市
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="licenseImage" class="layui-form-label layui-form-required">区</label>
|
||||||
|
<div class="layui-input-inline layui-inline-8">
|
||||||
|
<input name="town" class="layui-input" lay-verify="required" placeholder="请输入乡镇" lay-reqText="请输入乡镇" value="{{d.data.default_receiving_address ? d.data.default_receiving_address.town:''}}" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
选填,如:鹤城区
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="licenseImage" class="layui-form-label"></label>
|
||||||
|
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-WeChatTransactionComponentAuditCategory-updateInfo-submit" id="LAY-app-WeChatTransactionComponentAuditCategory-updateInfo-submit" value="确认修改">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var $;
|
||||||
|
var imgs = [];
|
||||||
|
var debug = layui.setter.debug;
|
||||||
|
layui.data.done = function (d) {
|
||||||
|
//开启调试情况下获取接口赋值数据
|
||||||
|
if (debug) { console.log(d); }
|
||||||
|
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg', 'util', 'view', 'laytpl'],
|
||||||
|
function () {
|
||||||
|
$ = layui.$;
|
||||||
|
var form = layui.form
|
||||||
|
, admin = layui.admin
|
||||||
|
, laydate = layui.laydate
|
||||||
|
, upload = layui.upload
|
||||||
|
, cropperImg = layui.cropperImg
|
||||||
|
, util = layui.util
|
||||||
|
, view = layui.view
|
||||||
|
, laytpl = layui.laytpl
|
||||||
|
, coreHelper = layui.coreHelper;
|
||||||
|
|
||||||
|
form.verify({
|
||||||
|
verifylicenseImage: [/^.{0,255}$/, '最大只允许输入255位字符'],
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//保存数据
|
||||||
|
form.on('submit(LAY-app-WeChatTransactionComponentAuditCategory-updateInfo-submit)', function (data) {
|
||||||
|
formData = data.field;
|
||||||
|
if (!formData) {
|
||||||
|
layer.msg('请先完善数据', {
|
||||||
|
time: 1300
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var field = data.field;
|
||||||
|
|
||||||
|
var postData = {};
|
||||||
|
postData.service_agent_path = field.service_agent_path;
|
||||||
|
postData.service_agent_phone = field.service_agent_phone;
|
||||||
|
postData.service_agent_type = [];
|
||||||
|
|
||||||
|
if (field.service_agent_type_service == 'on') {
|
||||||
|
postData.service_agent_type.push(0);
|
||||||
|
}
|
||||||
|
if (field.service_agent_type_phone == 'on') {
|
||||||
|
postData.service_agent_type.push(2);
|
||||||
|
}
|
||||||
|
if (field.service_agent_type_path == 'on') {
|
||||||
|
postData.service_agent_type.push(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (postData.service_agent_type.length == 0) {
|
||||||
|
layer.msg('请选择客服类型', {
|
||||||
|
time: 1300
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let default_receiving_address = {};
|
||||||
|
default_receiving_address.receiver_name = field.receiver_name;
|
||||||
|
default_receiving_address.detailed_address = field.detailed_address;
|
||||||
|
default_receiving_address.tel_number = field.tel_number;
|
||||||
|
default_receiving_address.country = field.country;
|
||||||
|
default_receiving_address.province = field.province;
|
||||||
|
default_receiving_address.city = field.city;
|
||||||
|
default_receiving_address.town = field.town;
|
||||||
|
|
||||||
|
postData.default_receiving_address = default_receiving_address;
|
||||||
|
|
||||||
|
console.log(postData);
|
||||||
|
|
||||||
|
coreHelper.Post("Api/WeChatTransactionComponentAccount/DoUpdateInfo", postData, function (e) {
|
||||||
|
if (debug) { console.log(e); } //开启调试返回数据
|
||||||
|
layer.msg(e.msg);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//重载form
|
||||||
|
form.render(null, 'LAY-app-WeChatTransactionComponentAuditCategory-createForm');
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user