mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 19:53:27 +08:00
# 2022-02-09
### 1.3.5 开源社区版(会员专业版同步修改): 无 ### 0.1.5 会员专业版: 【升级】nuget升级常用组件到最新版本。 【修复】服务商品列表图片组件从image调整为u--image组件。#I4RUC6 【优化】规范coreshop-goods.vue组件for循环未定义key的问题。 【修复】修复因升级uview版本导致【商品选项卡goodTabBar组件】切换失效的问题。 【新增】微信自定义交易组件增加【商品审核结果回调】,【类目审核结果回调】微信服务器消息推送处理。 【优化】调整自定义交易组件sku价格为decimal(18, 2)类型,方便小数处理。 【优化】微信自定义交易组件增加图片同步至微信侧功能。 【优化】重命名一些方法名称大小写。 【新增】首页设计轮播图增加高度设置功能。#I4SWEA 【修复】优化在苹果6/7/8plus及安卓一些机型出现分享海报弹窗文字被遮挡的问题。#I4SWCA
This commit is contained in:
@@ -26,10 +26,9 @@ using CoreCms.Net.IServices;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.Entities.Expression;
|
||||
using CoreCms.Net.Model.FromBody;
|
||||
using CoreCms.Net.Model.ViewModels.Echarts;
|
||||
using CoreCms.Net.Model.ViewModels.Options;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Model.ViewModels.DTO;
|
||||
using CoreCms.Net.Model.ViewModels.Echarts;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using CoreCms.Net.WeChat.Service.HttpClients;
|
||||
@@ -38,7 +37,6 @@ using COSXML.Auth;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
using SKIT.FlurlHttpClient.Wechat.Api;
|
||||
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
||||
@@ -56,7 +54,6 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
public class ToolsController : ControllerBase
|
||||
{
|
||||
private readonly ICoreCmsAreaServices _areaServices;
|
||||
private readonly ICodeGeneratorServices _codeGeneratorServices;
|
||||
private readonly ICoreCmsArticleServices _coreCmsArticleServices;
|
||||
private readonly ICoreCmsArticleTypeServices _coreCmsArticleTypeServices;
|
||||
private readonly ICoreCmsFormServices _coreCmsFormServices;
|
||||
@@ -89,9 +86,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
|
||||
|
||||
|
||||
private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
||||
|
||||
|
||||
private readonly IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
@@ -112,8 +107,9 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
, ISysRoleServices sysRoleServices
|
||||
, ISysMenuServices sysMenuServices
|
||||
, ISysUserRoleServices sysUserRoleServices
|
||||
, ISysOrganizationServices sysOrganizationServices, ICodeGeneratorServices codeGeneratorServices,
|
||||
ICoreCmsLogisticsServices logisticsServices, ISysLoginRecordServices sysLoginRecordServices, ISysNLogRecordsServices sysNLogRecordsServices, ICoreCmsBillPaymentsServices paymentsServices, ICoreCmsBillDeliveryServices billDeliveryServices, ICoreCmsUserServices userServices, ICoreCmsOrderServices orderServices, ICoreCmsBillAftersalesServices aftersalesServices, ICoreCmsSettingServices settingServices, ICoreCmsProductsServices productsServices, ICoreCmsServicesServices servicesServices, IOptions<FilesStorageOptions> filesStorageOptions, ISysRoleMenuServices sysRoleMenuServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, ICoreCmsPagesServices pagesServices, IToolsServices toolsServices)
|
||||
, ISysOrganizationServices sysOrganizationServices,
|
||||
ICoreCmsLogisticsServices logisticsServices, ISysLoginRecordServices sysLoginRecordServices, ISysNLogRecordsServices sysNLogRecordsServices, ICoreCmsBillPaymentsServices paymentsServices, ICoreCmsBillDeliveryServices billDeliveryServices, ICoreCmsUserServices userServices, ICoreCmsOrderServices orderServices, ICoreCmsBillAftersalesServices aftersalesServices, ICoreCmsSettingServices settingServices, ICoreCmsProductsServices productsServices, ICoreCmsServicesServices servicesServices, ISysRoleMenuServices sysRoleMenuServices
|
||||
, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, ICoreCmsPagesServices pagesServices, IToolsServices toolsServices)
|
||||
{
|
||||
_user = user;
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
@@ -132,7 +128,6 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
_sysMenuServices = sysMenuServices;
|
||||
_sysUserRoleServices = sysUserRoleServices;
|
||||
_sysOrganizationServices = sysOrganizationServices;
|
||||
_codeGeneratorServices = codeGeneratorServices;
|
||||
_logisticsServices = logisticsServices;
|
||||
_sysLoginRecordServices = sysLoginRecordServices;
|
||||
_sysNLogRecordsServices = sysNLogRecordsServices;
|
||||
@@ -145,6 +140,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
_productsServices = productsServices;
|
||||
_servicesServices = servicesServices;
|
||||
_sysRoleMenuServices = sysRoleMenuServices;
|
||||
|
||||
_weChatApiHttpClientFactory = weChatApiHttpClientFactory;
|
||||
_pagesServices = pagesServices;
|
||||
_toolsServices = toolsServices;
|
||||
@@ -264,6 +260,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
return jm;
|
||||
}
|
||||
|
||||
|
||||
if (entity.password == entity.oldPassword)
|
||||
{
|
||||
jm.msg = "请设置与旧密码不同的新密码";
|
||||
@@ -619,7 +616,6 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.LocalStorage.ToString())
|
||||
{
|
||||
url = _toolsServices.UpLoadBase64ForLocalStorage(filesStorageOptions, memStream);
|
||||
|
||||
}
|
||||
else if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.AliYunOSS.ToString())
|
||||
{
|
||||
@@ -776,7 +772,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
var newObj = list.Select(p => new
|
||||
{
|
||||
p.id,
|
||||
image = !string.IsNullOrEmpty(p.images) ? p.images.Split(",")[0] : "/static/images/common/empty.png",
|
||||
p.image,
|
||||
p.images,
|
||||
p.price,
|
||||
p.name,
|
||||
@@ -830,6 +826,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 根据商品序列获取货品数据====================================================
|
||||
|
||||
// POST: Api/Tools/GetProducts
|
||||
@@ -891,6 +888,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 获取文章列表============================================================
|
||||
|
||||
// POST: Api/Tools/GetArticles
|
||||
@@ -912,8 +910,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
if (!string.IsNullOrEmpty(title)) where = where.And(p => p.title.Contains(title));
|
||||
|
||||
//获取数据
|
||||
var list = await _coreCmsArticleServices.QueryPageAsync(where, p => p.id, OrderByType.Asc, pageCurrent,
|
||||
pageSize);
|
||||
var list = await _coreCmsArticleServices.QueryPageAsync(where, p => p.id, OrderByType.Asc, pageCurrent, pageSize);
|
||||
//返回数据
|
||||
jm.data = list;
|
||||
jm.code = 0;
|
||||
@@ -1221,6 +1218,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
jm = await _logisticsServices.ExpressPoll(entity.code, entity.no, entity.mobile);
|
||||
return jm;
|
||||
|
||||
@@ -1251,12 +1249,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
|
||||
var menuIds = sysRoleMenu.Select(p => p.menuId).ToList();
|
||||
|
||||
|
||||
var where = PredicateBuilder.True<SysMenu>();
|
||||
where = where.And(p => p.deleted == false && p.hide == false && p.menuType == 0);
|
||||
where = where.And(p => menuIds.Contains(p.id));
|
||||
|
||||
var navs = await _sysMenuServices.QueryListByClauseAsync(where, p => p.sortNumber, OrderByType.Asc);
|
||||
var navs = await _sysMenuServices.QueryListByClauseAsync(p => menuIds.Contains(p.id) && p.deleted == false && p.hide == false && p.menuType == 0, p => p.sortNumber, OrderByType.Asc);
|
||||
var menus = GetMenus(navs, 0);
|
||||
|
||||
jm.data = menus;
|
||||
@@ -1519,8 +1512,8 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
|
||||
var series = new List<SeriesDataIntItem>
|
||||
{
|
||||
new SeriesDataIntItem() {name = "新增记录", type = "line", data = regs.Select(p => p.nums).ToList()},
|
||||
new SeriesDataIntItem() {name = "活跃记录", type = "line", data = orders.Select(p => p.nums).ToList()}
|
||||
new() {name = "新增记录", type = "line", data = regs.Select(p => p.nums).ToList()},
|
||||
new() {name = "活跃记录", type = "line", data = orders.Select(p => p.nums).ToList()}
|
||||
};
|
||||
|
||||
|
||||
@@ -1581,12 +1574,13 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
goodsStaticsTotalWarn
|
||||
};
|
||||
|
||||
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
//微信自定义交易组件================================================================
|
||||
|
||||
#region 自定义交易组件上传图片====================================================
|
||||
@@ -1717,5 +1711,163 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
|
||||
#endregion
|
||||
|
||||
#region 自定义交易组件上传图片(Url交换)====================================================
|
||||
|
||||
/// <summary>
|
||||
/// 自定义交易组件上传图片(Url交换)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<AdminUiCallBack> MiNiShopOpenComponent2_UploadImgByUrl([FromBody] FMStringId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var filesStorageOptions = await _coreCmsSettingServices.GetFilesStorageOptions();
|
||||
|
||||
if (string.IsNullOrEmpty(entity.id))
|
||||
{
|
||||
jm.msg = "请提交合法图片地址";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
|
||||
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
|
||||
var request = new ShopImageUploadRequest();
|
||||
request.AccessToken = accessToken;
|
||||
request.ImageUrl = entity.id;
|
||||
request.ResponseType = 1;
|
||||
|
||||
var response = await client.ExecuteShopImageUploadAsync(request);
|
||||
if (response.IsSuccessful())
|
||||
{
|
||||
jm.code = 0;
|
||||
jm.msg = "上传成功!";
|
||||
jm.data = new
|
||||
{
|
||||
fileUrl = response.Image.TempImageUrl,
|
||||
src = response.Image.TempImageUrl
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
jm.code = 1;
|
||||
jm.msg = response.ErrorMessage;
|
||||
}
|
||||
jm.otherData = response;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 自定义交易组件上传图片(Url交换)====================================================
|
||||
|
||||
/// <summary>
|
||||
/// 自定义交易组件上传图片(Url交换)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<AdminUiCallBack> MiNiShopOpenComponent2_UploadImgByUrlArr([FromBody] FMArrayStringIds entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var filesStorageOptions = await _coreCmsSettingServices.GetFilesStorageOptions();
|
||||
|
||||
if (entity.id.Length <= 0)
|
||||
{
|
||||
jm.msg = "请提交合法图片地址";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var urlArr = new String[] { "store.mp.video.tencent-cloud.com", "mmbizurl.cn", "mmecimage.cn" };
|
||||
|
||||
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
|
||||
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
|
||||
|
||||
for (var index = 0; index < entity.id.Length; index++)
|
||||
{
|
||||
var img = entity.id[index];
|
||||
if (img.Contains(urlArr[0]) || img.Contains(urlArr[1]) || img.Contains(urlArr[2]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
var request = new ShopImageUploadRequest();
|
||||
request.AccessToken = accessToken;
|
||||
request.ImageUrl = img;
|
||||
request.ResponseType = 1;
|
||||
|
||||
var response = await client.ExecuteShopImageUploadAsync(request);
|
||||
if (response.IsSuccessful())
|
||||
{
|
||||
entity.id[index] = response.Image.TempImageUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jm.code = 0;
|
||||
jm.msg = "同步成功";
|
||||
jm.data = entity.id;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 自定义交易组件上传图片(Url交换单张)====================================================
|
||||
|
||||
/// <summary>
|
||||
/// 自定义交易组件上传图片(Url交换单张)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<AdminUiCallBack> MiNiShopOpenComponent2_UploadImgByUrlSingle([FromBody] FMStringId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var filesStorageOptions = await _coreCmsSettingServices.GetFilesStorageOptions();
|
||||
|
||||
if (string.IsNullOrEmpty(entity.id))
|
||||
{
|
||||
jm.msg = "请提交合法图片地址";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var urlArr = new String[] { "store.mp.video.tencent-cloud.com", "mmbizurl.cn", "mmecimage.cn" };
|
||||
|
||||
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
|
||||
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
|
||||
|
||||
if (entity.id.Contains(urlArr[0]) || entity.id.Contains(urlArr[1]) || entity.id.Contains(urlArr[2]))
|
||||
{
|
||||
jm.msg = "合法图片,无需同步";
|
||||
return jm;
|
||||
}
|
||||
else
|
||||
{
|
||||
var request = new ShopImageUploadRequest();
|
||||
request.AccessToken = accessToken;
|
||||
request.ImageUrl = entity.id;
|
||||
request.ResponseType = 1;
|
||||
|
||||
var response = await client.ExecuteShopImageUploadAsync(request);
|
||||
if (response.IsSuccessful())
|
||||
{
|
||||
jm.code = 0;
|
||||
jm.msg = "同步成功";
|
||||
jm.data = response.Image.TempImageUrl;
|
||||
}
|
||||
else
|
||||
{
|
||||
jm.code = 1;
|
||||
jm.msg = "同步失败" + response.ErrorMessage;
|
||||
}
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ using CoreCms.Net.Caching.AutoMate.RedisCache;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.Filter;
|
||||
using CoreCms.Net.IServices;
|
||||
using CoreCms.Net.Loging;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.Entities.Expression;
|
||||
using CoreCms.Net.Model.FromBody;
|
||||
@@ -31,6 +32,7 @@ using CoreCms.Net.WeChat.Service.TransactionComponent.Enum;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.HSSF.UserModel;
|
||||
using NPOI.SS.Util;
|
||||
using SKIT.FlurlHttpClient.Wechat.Api;
|
||||
@@ -1221,7 +1223,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
|
||||
|
||||
//订单状态 int
|
||||
var orderUnifiedStatus = Request.Form["orderUnifiedStatus"].FirstOrDefault().ObjectToInt(0);
|
||||
var orderUnifiedStatus = ObjectExtensions.ObjectToInt(Request.Form["orderUnifiedStatus"].FirstOrDefault(), 0);
|
||||
if (orderUnifiedStatus > 0)
|
||||
{
|
||||
if (orderUnifiedStatus == (int)GlobalEnumVars.OrderCountType.payment)
|
||||
@@ -1776,6 +1778,29 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
p => p.id == tcOrder.id && p.outOrderId == tcOrder.outOrderId);
|
||||
}
|
||||
|
||||
if (response.Order is { OrderId: > 0 } && (response.Order.Status == 11 || response.Order.Status == 10) && (orderModel.payStatus == (int)GlobalEnumVars.OrderPayStatus.Yes || orderModel.payStatus == (int)GlobalEnumVars.OrderPayStatus.PartialYes))
|
||||
{
|
||||
var payment = await _billPaymentsServices.QueryByClauseAsync(p =>
|
||||
p.sourceId == orderModel.orderId && p.status == (int)GlobalEnumVars.BillPaymentsStatus.Payed);
|
||||
if (payment != null)
|
||||
{
|
||||
var userInfo = await _userWeChatInfoServices.QueryByClauseAsync(p => p.userId == orderModel.userId);
|
||||
//获取同步地址接口地址
|
||||
var refreshRequest = new ShopOrderPayRequest();
|
||||
refreshRequest.AccessToken = accessToken;
|
||||
refreshRequest.OutOrderId = orderModel.orderId;
|
||||
refreshRequest.OpenId = userInfo.openid;
|
||||
refreshRequest.ActionType = 1;
|
||||
refreshRequest.TransactionId = payment.tradeNo;
|
||||
refreshRequest.PayTime = payment.createTime;
|
||||
|
||||
var refreshResponse = await client.ExecuteShopOrderPayAsync(refreshRequest);
|
||||
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "自定义交易组件-手动同步", JsonConvert.SerializeObject(refreshResponse));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
|
||||
@@ -429,8 +429,8 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
item.OutProductId = p.outProductId;
|
||||
item.OutSKUId = p.outSkuId;
|
||||
item.ThumbnailUrl = p.thumbImg;
|
||||
item.SalePrice = p.salePrice * 100;
|
||||
item.MarketPrice = p.marketPrice * 100;
|
||||
item.SalePrice = Convert.ToInt32(p.salePrice * 100);
|
||||
item.MarketPrice = Convert.ToInt32(p.marketPrice * 100);
|
||||
item.Stock = p.stockNum;
|
||||
item.BarCode = p.barCode;
|
||||
item.SKUCode = p.skuCode;
|
||||
@@ -536,8 +536,8 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
item.OutProductId = p.outProductId;
|
||||
item.OutSKUId = p.outSkuId;
|
||||
item.ThumbnailUrl = p.thumbImg;
|
||||
item.SalePrice = p.salePrice * 100;
|
||||
item.MarketPrice = p.marketPrice * 100;
|
||||
item.SalePrice = Convert.ToInt32(p.salePrice * 100);
|
||||
item.MarketPrice = Convert.ToInt32(p.marketPrice * 100);
|
||||
item.Stock = p.stockNum;
|
||||
item.BarCode = p.barCode;
|
||||
item.SKUCode = p.skuCode;
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.0.1" />
|
||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.1.0" />
|
||||
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.1.0" />
|
||||
|
||||
@@ -4,6 +4,7 @@ var allWidget = {
|
||||
"name": "图片轮播",
|
||||
"value": {
|
||||
"duration": 2500,
|
||||
"height": 130,
|
||||
"list": [{
|
||||
"image": "/static/images/common/empty-banner.png",
|
||||
"linkType": '',
|
||||
|
||||
@@ -28,7 +28,7 @@ layui.define(['laytpl', 'layer', 'element', 'util'], function (exports) {
|
||||
//额外增加
|
||||
, apiUrl: '/' //api请求地址
|
||||
, fileUrl: '/' //资源请求地址
|
||||
, noImagePicUrl: layui.cache.base + 'style/res/noImage.jpg' //api请求地址
|
||||
, noImagePicUrl: 'https://files.cdn.coreshop.cn/static/images/empty/noImage.jpg' //api请求地址
|
||||
|
||||
//自定义响应字段
|
||||
, response: {
|
||||
|
||||
@@ -822,6 +822,13 @@
|
||||
<p class="layout-tip">轮播图自动切换的间隔时间,单位:毫秒</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content-item">
|
||||
<span class="item-label">高度:</span>
|
||||
<div class="number-content ml20">
|
||||
<input type="number" :step="10" v-model.number="selectWg.value.height" :min="0" class="number-input">
|
||||
<p class="layout-tip">默认高度为130px,单位:像素</p>
|
||||
</div>
|
||||
</div>
|
||||
<draggable element="ul" :list="selectWg.value.list"
|
||||
:options="{group:{ name:'slideList'}, ghostClass: 'ghost',animation: 150,handle:'.drag-block'}">
|
||||
<li v-for="(item, index) in selectWg.value.list" :key="index">
|
||||
|
||||
@@ -158,11 +158,14 @@
|
||||
, url: layui.setter.apiUrl + 'Api/Tools/MiNiShopOpenComponent2_UploadImg'
|
||||
, before: function (obj) {
|
||||
obj.preview(function (index, file, result) {
|
||||
|
||||
layer.msg('上传中', { icon: 16, shade: 0.4 });
|
||||
});
|
||||
}
|
||||
, done: function (res) {
|
||||
if (res.code > 0) { return layer.msg('上传失败'); }
|
||||
layer.closeAll('loading'); //关闭加载层
|
||||
if (res.code > 0) {
|
||||
return layer.msg('上传失败');
|
||||
}
|
||||
layer.msg('上传成功');
|
||||
$('#viewImgBoxlicenseImage').attr('src', res.data.fileUrl);
|
||||
$("#licenseImageInput").val(res.data.fileUrl);
|
||||
@@ -182,11 +185,14 @@
|
||||
, url: layui.setter.apiUrl + 'Api/Tools/MiNiShopOpenComponent2_UploadImg'
|
||||
, before: function (obj) {
|
||||
obj.preview(function (index, file, result) {
|
||||
//$('#viewImgBoxlicenseImage').attr('src', result);
|
||||
layer.msg('上传中', { icon: 16, shade: 0.4 });
|
||||
});
|
||||
}
|
||||
, done: function (res) {
|
||||
if (res.code > 0) { return layer.msg('上传失败'); }
|
||||
layer.closeAll('loading'); //关闭加载层
|
||||
if (res.code > 0) {
|
||||
return layer.msg('上传失败');
|
||||
}
|
||||
layer.msg('上传成功');
|
||||
imgs.push(res.data.fileUrl);
|
||||
$('#certificateImage').val(imgs);
|
||||
|
||||
@@ -166,11 +166,14 @@
|
||||
, url: layui.setter.apiUrl + 'Api/Tools/MiNiShopOpenComponent2_UploadImg'
|
||||
, before: function (obj) {
|
||||
obj.preview(function (index, file, result) {
|
||||
|
||||
layer.msg('上传中', { icon: 16, shade: 0.4 });
|
||||
});
|
||||
}
|
||||
, done: function (res) {
|
||||
if (res.code > 0) { return layer.msg('上传失败'); }
|
||||
layer.closeAll('loading'); //关闭加载层
|
||||
if (res.code > 0) {
|
||||
return layer.msg('上传失败');
|
||||
}
|
||||
layer.msg('上传成功');
|
||||
$('#viewImgBoxlicenseImage').attr('src', res.data.fileUrl);
|
||||
$("#licenseImageInput").val(res.data.fileUrl);
|
||||
@@ -190,11 +193,14 @@
|
||||
, url: layui.setter.apiUrl + 'Api/Tools/MiNiShopOpenComponent2_UploadImg'
|
||||
, before: function (obj) {
|
||||
obj.preview(function (index, file, result) {
|
||||
//$('#viewImgBoxlicenseImage').attr('src', result);
|
||||
layer.msg('上传中', { icon: 16, shade: 0.4 });
|
||||
});
|
||||
}
|
||||
, done: function (res) {
|
||||
if (res.code > 0) { return layer.msg('上传失败'); }
|
||||
layer.closeAll('loading'); //关闭加载层
|
||||
if (res.code > 0) {
|
||||
return layer.msg('上传失败');
|
||||
}
|
||||
layer.msg('上传成功');
|
||||
imgs.push(res.data.fileUrl);
|
||||
$('#certificateImage').val(imgs);
|
||||
|
||||
@@ -133,12 +133,21 @@
|
||||
//{ field: 'level3', title: '三级类目', sort: false, width: 105 },
|
||||
{ field: 'level3Name', title: '三级类目名称', sort: false, width: 105 },
|
||||
{
|
||||
field: 'certificateImage', title: '资质材料', width: 100, sort: false,
|
||||
field: 'certificateImage', title: '资质材料', width: 180, sort: false,
|
||||
templet: function (d) {
|
||||
if (d.certificateImage) {
|
||||
return '<a href="javascript:void(0);" onclick=layui.coreHelper.viewImage("' + d.certificateImage + '")><image style="max-width:28px;max-height:28px;" src="' + d.certificateImage + '"/></a>';
|
||||
var arr = d.certificateImage.split(',');
|
||||
if (Array.isArray(arr) && arr.length) {
|
||||
var html = '';
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
html += '<a href="javascript:void(0);" onclick=layui.coreHelper.viewImage("' + arr[i] + '")><image style="max-width:28px;max-height:28px;" src="' + arr[i] + '?x-oss-process=image/resize,m_lfit,h_200,w_200"/></a> '
|
||||
}
|
||||
return html;
|
||||
} else {
|
||||
return '<a href="javascript:void(0);" onclick=layui.coreHelper.viewImage("' + setter.noImagePicUrl + '")><image style="max-width:30px;max-height:30px;" src="' + setter.noImagePicUrl + '"/></a>';
|
||||
}
|
||||
} else {
|
||||
return '<a href="javascript:void(0);" onclick=layui.coreHelper.viewImage("' + setter.noImagePicUrl + '")><image style="max-width:30px;max-height:30px;" src="' + setter.noImagePicUrl + '"/></a>';
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -26,13 +26,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--<div class="layui-form-item">
|
||||
<label for="headImg" class="layui-form-label layui-form-required">主图列表</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="headImg" id="headImg" lay-verify="required|verifyheadImg" class="layui-input" lay-reqText="请输入主图列表" placeholder="请输入主图列表" />
|
||||
</div>
|
||||
</div>-->
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="brand_id" class="layui-form-label layui-form-required">品牌id</label>
|
||||
<div class="layui-input-inline layui-inline-4">
|
||||
@@ -58,53 +51,34 @@
|
||||
<input type="hidden" name="headImg" id="headImg" class="layui-input" placeholder="请上传缩略图" lay-reqText="请上传缩略图" />
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="upBtnimageIds"><i class="layui-icon"></i>上传图片</button>
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
图集:[建议数量控制在10张以内]:
|
||||
<div class="layui-input-inline layui-inline-5">
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-active="doSycnWeChatProductImages"><i class="layui-icon"></i>同步商城图片到微信云服务器</button>
|
||||
</div>
|
||||
<div class="layui-input-inline layui-inline-12">
|
||||
请保证图集地址域名为:【store.mp.video.tencent-cloud.com】【mmbizurl.cn】【mmecimage.cn/p/】中某个
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item ">
|
||||
<blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
|
||||
<div class="layui-upload-list" id="upload-more-list"></div>
|
||||
</blockquote>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-upload-list" id="upload-more-list"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<fieldset class="layui-elem-field layui-field-title site-title"><legend><a name="products">货品</a></legend></fieldset>
|
||||
|
||||
<div id="products">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!--<div class="layui-form-item">
|
||||
<label for="qualificationPics" class="layui-form-label layui-form-required">商品资质图片列表</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="qualificationPics" lay-verify="required|verifyqualificationPics" class="layui-input" lay-reqText="请输入商品资质图片列表" placeholder="请输入商品资质图片列表" />
|
||||
</div>
|
||||
</div>-->
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label for="descInfoDesc" class="layui-form-label layui-form-required">商品详情图文</label>
|
||||
<div class="layui-input-block">
|
||||
<!--<div id="descInfoDesc"></div>-->
|
||||
|
||||
<div class="document-editor">
|
||||
<div class="toolbar-container" id="toolbar-container"></div>
|
||||
<div class="content-container">
|
||||
<div id="editor"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--<div class="layui-form-item">
|
||||
<label for="descInfoImgs" class="layui-form-label layui-form-required">商品详情图片列表</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="descInfoImgs" lay-verify="required|verifydescInfoImgs" class="layui-input" lay-reqText="请输入商品详情图片列表" placeholder="请输入商品详情图片列表" />
|
||||
</div>
|
||||
</div>-->
|
||||
|
||||
<div class="layui-form-item text-right core-hidden">
|
||||
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-WeChatTransactionComponentGood-createForm-submit" id="LAY-app-WeChatTransactionComponentGood-createForm-submit" value="确认添加">
|
||||
</div>
|
||||
@@ -112,18 +86,38 @@
|
||||
</script>
|
||||
|
||||
<script id="image_tpl" type="text/html">
|
||||
{{# layui.each(d, function(index, item){ }}
|
||||
<div class="imgdiv">
|
||||
<img src="{{ item }}" class="layui-upload-img" onclick='layui.coreHelper.viewImage("{{ item }}")' style="width: 100px;height:100px;">
|
||||
<div id="operate">
|
||||
<div><a class="del" onclick="delImg(this,'{{ item }}')">删除</a>|<a class="setmain" onclick="setDefault(this,'{{ item }}')">设为主图</a>|<a class="setmain" onclick="upLoadImage(this,'{{ item }}')">图片上传</a></div>
|
||||
</div>
|
||||
</div>
|
||||
{{# }); }}
|
||||
<table class="layui-table" lay-size="sm">
|
||||
<colgroup>
|
||||
<col width="110">
|
||||
<col>
|
||||
<col width="150">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>图片</th>
|
||||
<th>地址</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="productsTbody">
|
||||
{{# layui.each(d, function(index, item){ }}
|
||||
<tr data-index="{{ index }}">
|
||||
<td>
|
||||
<img src="{{ item }}" id="img{{ index }}" class="layui-upload-img" onclick='layui.coreHelper.viewImage("{{ item }}")' style="width: 100px; height: 100px;">
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" value="{{ item }}" class="layui-input" readonly="readonly" />
|
||||
</td>
|
||||
<td>
|
||||
<a class="layui-btn layui-btn-xs" lay-active="delImg">删除</a>
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-active="setDefault">设为主图</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{# }); }}
|
||||
</tbody>
|
||||
</table>
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script id="getSpec_tpl" type="text/html">
|
||||
<table class="layui-table" lay-size="sm">
|
||||
<colgroup>
|
||||
@@ -153,19 +147,14 @@
|
||||
<tbody id="productsTbody">
|
||||
{{# layui.each(d, function(index, item){ }}
|
||||
<tr>
|
||||
<td>
|
||||
<td rowspan="2">
|
||||
<input type="hidden" value="{{item.id}}" name="product[outProductId][]" />
|
||||
<input type="hidden" value="{{item.id}}" name="product[outSkuId][]" />
|
||||
<input type="checkbox" name="product[isDefalut][]" {{item.isDefalut? 'checked="true"':''}} value="{{item.isDefalut? '1':'0'}}" lay-skin="switch" lay-text="是|否" disabled>
|
||||
</td>
|
||||
<td class="spec-td">
|
||||
<div class="spec_image">
|
||||
<div class="spec_image_item">
|
||||
<img src="{{ item.images && item.images !='null'? item.images : layui.setter.noImagePicUrl }}" id="productImagesSrc" style="width:60px;height:60px">
|
||||
</div>
|
||||
<!--<input type="hidden" id="productImagesInput" name="product[thumbImg][]" value="{{ item.images && item.images !='null'? item.images : layui.setter.noImagePicUrl }}">-->
|
||||
<input type="hidden" id="productImagesInput" name="product[thumbImg][]" value="{{layui.setter.noImagePicUrl}}">
|
||||
</div>
|
||||
<td class="spec-td" rowspan="2" style="text-align: center;">
|
||||
<img src="{{ item.images && item.images !='null'? item.images : layui.setter.noImagePicUrl }}" style="width:80px;height:80px">
|
||||
<button type="button" class="layui-btn layui-btn-xs" style="margin-top: 10px;" lay-active="doSycnWeChatProductImagesSingle"><i class="layui-icon"></i>同步图片</button>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="product[barCode][]" value="{{item.sn}}" readonly="readonly" placeholder="货号" class="layui-input layui-inline-3">
|
||||
@@ -190,13 +179,16 @@
|
||||
<input type="checkbox" name="product[isSelect][]" checked="checked" lay-skin="primary">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<input type="text" name="product[thumbImg][]" value="{{ item.images && item.images !='null'? item.images : layui.setter.noImagePicUrl }}" class="layui-input layui-inline-14" readonly="readonly" />
|
||||
</td>
|
||||
</tr>
|
||||
{{# }); }}
|
||||
</tbody>
|
||||
</table>
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
var $;
|
||||
var imgs = [];
|
||||
@@ -303,14 +295,14 @@
|
||||
window.editor.setData(ids.intro);
|
||||
|
||||
|
||||
//if (ids.images) {
|
||||
// imgs = ids.images.split(',');
|
||||
// $('#headImg').val(imgs);
|
||||
// var getTpl = image_tpl.innerHTML, viewBox = document.getElementById('upload-more-list');
|
||||
// laytpl(getTpl).render(imgs, function (html) {
|
||||
// viewBox.innerHTML = html;
|
||||
// });
|
||||
//}
|
||||
if (ids.images) {
|
||||
imgs = ids.images.split(',');
|
||||
$('#headImg').val(imgs);
|
||||
var getTpl = image_tpl.innerHTML, viewBox = document.getElementById('upload-more-list');
|
||||
laytpl(getTpl).render(imgs, function (html) {
|
||||
viewBox.innerHTML = html;
|
||||
});
|
||||
}
|
||||
|
||||
$('#skuCount').val(ids.sku.length);
|
||||
|
||||
@@ -354,41 +346,110 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
upLoadImage: function (othis) {
|
||||
var imgDiv = $(othis).parent().parent();
|
||||
var imageUrl = imgDiv.find('img').attr("src");
|
||||
},
|
||||
delImg: function (othis) {
|
||||
var imgDiv = $(othis).parent().parent();
|
||||
imgDiv.remove();
|
||||
var imageUrl = imgDiv.find('img').attr("src");
|
||||
var index = imgs.indexOf(imageUrl);
|
||||
if (index > -1) {
|
||||
imgs.splice(index, 1);
|
||||
}
|
||||
$('#headImg').val(imgs);
|
||||
console.log(imgs);
|
||||
refreshImages();
|
||||
},
|
||||
setDefault: function (othis) {
|
||||
var imgDiv = $(othis).parent().parent();
|
||||
$("#upload-more-list").prepend(imgDiv);
|
||||
var imageUrl = imgDiv.find('img').attr("src");
|
||||
var index = imgs.indexOf(imageUrl);
|
||||
if (index > -1) {
|
||||
imgs.unshift(imgs.splice(index, 1)[0]);
|
||||
}
|
||||
$('#headImg').val(imgs);
|
||||
console.log(imgs);
|
||||
refreshImages();
|
||||
},
|
||||
doSycnWeChatProductImages: function () {
|
||||
if (imgs.length > 0) {
|
||||
//执行交换url操作
|
||||
coreHelper.Post("Api/Tools/MiNiShopOpenComponent2_UploadImgByUrlArr", { id: imgs }, function (res) {
|
||||
if (debug) { console.log(res); } //开启调试返回数据
|
||||
if (res.code == 0) {
|
||||
imgs = res.data;
|
||||
$('#headImg').val(imgs);
|
||||
refreshImages();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg('请先上传图片或选择商品获取图集');
|
||||
}
|
||||
},
|
||||
doSycnWeChatProductImagesSingle: function (othis) {
|
||||
var imgObj = $(othis).prev().attr('src');
|
||||
console.log(imgObj);
|
||||
coreHelper.Post("Api/Tools/MiNiShopOpenComponent2_UploadImgByUrlSingle", { id: imgObj }, function (res) {
|
||||
if (debug) { console.log(res); } //开启调试返回数据
|
||||
if (res.code == 0) {
|
||||
$(othis).parent().parent().next().find("input[name='product[thumbImg][]']").val(res.data);
|
||||
} else {
|
||||
layer.msg(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
function refreshImages() {
|
||||
var getTpl = image_tpl.innerHTML, view = document.getElementById('upload-more-list');
|
||||
laytpl(getTpl).render(imgs, function (html) {
|
||||
view.innerHTML = html;
|
||||
});
|
||||
console.log(imgs);
|
||||
}
|
||||
|
||||
//设为默认图
|
||||
function setDefault(obj, imageUrl) {
|
||||
var imgDiv = $(obj).parent().parent();
|
||||
$("#upload-more-list").prepend(imgDiv);
|
||||
var index = imgs.indexOf(imageUrl);
|
||||
if (index > -1) {
|
||||
imgs.unshift(imgs.splice(index, 1)[0]);
|
||||
}
|
||||
$('#headImg').val(imgs);
|
||||
console.log(imgs);
|
||||
refreshImages();
|
||||
}
|
||||
|
||||
//图集上传
|
||||
upload.render({
|
||||
elem: '#upBtnimageIds'
|
||||
, url: layui.setter.apiUrl + 'Api/Tools/MiNiShopOpenComponent2_UploadImg'
|
||||
, before: function (obj) {
|
||||
obj.preview(function (index, file, result) {
|
||||
layer.msg('上传中', { icon: 16, shade: 0.4 });
|
||||
});
|
||||
}
|
||||
, done: function (res) {
|
||||
layer.closeAll('loading'); //关闭加载层
|
||||
if (res.code > 0) {
|
||||
return layer.msg('上传失败');
|
||||
}
|
||||
layer.msg('上传成功');
|
||||
imgs.push(res.data.fileUrl);
|
||||
$('#headImg').val(imgs);
|
||||
refreshImages();
|
||||
}
|
||||
, error: function () {
|
||||
return layer.msg('上传失败,请重试!');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//图集上传
|
||||
$('#upBtnimageIds').click(function () {
|
||||
cropperImg.cropImg({
|
||||
aspectRatio: 1 / 1,
|
||||
onCrop: function (data) {
|
||||
var loadIndex = layer.load(2);
|
||||
coreHelper.Post("api/Tools/MiNiShopOpenComponent2_UploadImgByBase64", { base64: data }, function (res) {
|
||||
if (0 === res.code) {
|
||||
imgs.push(res.data.fileUrl);
|
||||
$('#headImg').val(imgs);
|
||||
var getTpl = image_tpl.innerHTML, view = document.getElementById('upload-more-list');
|
||||
laytpl(getTpl).render(imgs, function (html) {
|
||||
view.innerHTML = html;
|
||||
});
|
||||
layer.msg(res.msg);
|
||||
layer.close(loadIndex);
|
||||
} else {
|
||||
layer.close(loadIndex);
|
||||
layer.msg(res.msg, { icon: 2, anim: 6 });
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
form.verify({
|
||||
|
||||
verifyoutProductId: [/^.{0,50}$/, '商品序列最大只允许输入50位字符'],
|
||||
verifytitle: [/^.{0,255}$/, '商品标题最大只允许输入255位字符'],
|
||||
verifypath: [/^.{0,255}$/, '小程序路径最大只允许输入255位字符'],
|
||||
@@ -399,28 +460,7 @@
|
||||
});
|
||||
//重载form
|
||||
form.render(null, 'LAY-app-WeChatTransactionComponentGood-createForm');
|
||||
|
||||
})
|
||||
};
|
||||
|
||||
//删除图片
|
||||
function delImg(obj, imageUrl) {
|
||||
var imgDiv = $(obj).parent().parent().parent();
|
||||
imgDiv.remove();
|
||||
var index = imgs.indexOf(imageUrl);
|
||||
if (index > -1) {
|
||||
imgs.splice(index, 1);
|
||||
}
|
||||
$('#headImg').val(imgs);
|
||||
}
|
||||
//设为默认图
|
||||
function setDefault(obj, imageUrl) {
|
||||
var imgDiv = $(obj).parent().parent().parent();
|
||||
$("#upload-more-list").prepend(imgDiv);
|
||||
var index = imgs.indexOf(imageUrl);
|
||||
if (index > -1) {
|
||||
imgs.unshift(imgs.splice(index, 1)[0]);
|
||||
}
|
||||
$('#headImg').val(imgs);
|
||||
}
|
||||
|
||||
</script>
|
||||
</script>
|
||||
@@ -1,8 +1,8 @@
|
||||
<script type="text/html" template lay-done="layui.data.sendParams(d);">
|
||||
<div class="layui-form coreshop-form layui-form-pane transactioncomponent" lay-filter="LAY-app-WeChatTransactionComponentGood-editForm" id="LAY-app-WeChatTransactionComponentGood-editForm">
|
||||
<input type="hidden" name="id" value="{{d.params.data.model.id }}" />
|
||||
<input type="hidden" name="productId" value="{{d.params.data.model.id }}" />
|
||||
<input type="hidden" name="outProductId" id="outProductId" value="{{d.params.data.model.id }}" />
|
||||
<input type="hidden" name="productId" value="{{d.params.data.model.productId }}" />
|
||||
<input type="hidden" name="outProductId" id="outProductId" value="{{d.params.data.model.outProductId }}" />
|
||||
<input type="hidden" name="skuCount" id="skuCount" value="0" />
|
||||
|
||||
<div class="layui-form-item">
|
||||
@@ -19,7 +19,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="brand_id" class="layui-form-label layui-form-required">品牌id</label>
|
||||
<div class="layui-input-inline layui-inline-4">
|
||||
@@ -45,23 +44,22 @@
|
||||
<input type="hidden" name="headImg" id="headImg" value="{{d.params.data.model.headImg || '' }}" class="layui-input" placeholder="请上传缩略图" lay-reqText="请上传缩略图" />
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="upBtnimageIds"><i class="layui-icon"></i>上传图片</button>
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
图集:[建议数量控制在10张以内]:
|
||||
<div class="layui-input-inline layui-inline-5">
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-active="doSycnWeChatProductImages"><i class="layui-icon"></i>同步商城图片到微信云服务器</button>
|
||||
</div>
|
||||
<div class="layui-input-inline layui-inline-12">
|
||||
请保证图集地址域名为:【store.mp.video.tencent-cloud.com】【mmbizurl.cn】【mmecimage.cn/p/】中某个
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item ">
|
||||
<blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
|
||||
<div class="layui-upload-list" id="upload-more-list"></div>
|
||||
</blockquote>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-upload-list" id="upload-more-list"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<fieldset class="layui-elem-field layui-field-title site-title"><legend><a name="products">货品</a></legend></fieldset>
|
||||
|
||||
<div id="products">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label for="descInfoDesc" class="layui-form-label layui-form-required">商品详情图文</label>
|
||||
<div class="layui-input-block">
|
||||
@@ -74,29 +72,45 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="layui-form-item text-right core-hidden">
|
||||
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-WeChatTransactionComponentGood-editForm-submit" id="LAY-app-WeChatTransactionComponentGood-editForm-submit" value="确认编辑">
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script id="image_tpl" type="text/html">
|
||||
{{# layui.each(d, function(index, item){ }}
|
||||
<div class="imgdiv">
|
||||
<img src="{{ item }}" class="layui-upload-img" onclick='layui.coreHelper.viewImage("{{ item }}")' style="width: 100px;height:100px;">
|
||||
<div id="operate">
|
||||
<div><a class="del" onclick="delImg(this,'{{ item }}')">删除</a>|<a class="setmain" onclick="setDefault(this,'{{ item }}')">设为主图</a></div>
|
||||
</div>
|
||||
</div>
|
||||
{{# }); }}
|
||||
<table class="layui-table" lay-size="sm">
|
||||
<colgroup>
|
||||
<col width="110">
|
||||
<col>
|
||||
<col width="150">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>图片</th>
|
||||
<th>地址</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="productsTbody">
|
||||
{{# layui.each(d, function(index, item){ }}
|
||||
<tr data-index="{{ index }}">
|
||||
<td>
|
||||
<img src="{{ item }}" id="img{{ index }}" class="layui-upload-img" onclick='layui.coreHelper.viewImage("{{ item }}")' style="width: 100px; height: 100px;">
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" value="{{ item }}" class="layui-input" readonly="readonly" />
|
||||
</td>
|
||||
<td>
|
||||
<a class="layui-btn layui-btn-xs" lay-active="delImg">删除</a>
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-active="setDefault">设为主图</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{# }); }}
|
||||
</tbody>
|
||||
</table>
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script id="getSpec_tpl" type="text/html">
|
||||
<table class="layui-table" lay-size="sm">
|
||||
<colgroup>
|
||||
@@ -126,18 +140,14 @@
|
||||
<tbody id="productsTbody">
|
||||
{{# layui.each(d.products, function(index, item){ }}
|
||||
<tr>
|
||||
<td>
|
||||
<td rowspan="2">
|
||||
<input type="hidden" value="{{item.id}}" name="product[outProductId][]" />
|
||||
<input type="hidden" value="{{item.id}}" name="product[outSkuId][]" />
|
||||
<input type="hidden" value="{{d.sku[index].outSkuId}}" name="product[outSkuId][]" />
|
||||
<input type="checkbox" name="product[isDefalut][]" {{item.isDefalut? 'checked="true"':''}} value="{{item.isDefalut? '1':'0'}}" lay-skin="switch" lay-text="是|否" disabled>
|
||||
</td>
|
||||
<td class="spec-td">
|
||||
<div class="spec_image">
|
||||
<div class="spec_image_item">
|
||||
<img src="{{ item.images && item.images !='null'? item.images : layui.setter.noImagePicUrl }}" id="productImagesSrc" style="width:60px;height:60px">
|
||||
</div>
|
||||
<input type="hidden" id="productImagesInput" name="product[thumbImg][]" value="{{ item.images && item.images !='null'? item.images : layui.setter.noImagePicUrl }}">
|
||||
</div>
|
||||
<td class="spec-td" rowspan="2" style="text-align: center;">
|
||||
<img src="{{ d.sku[index].thumbImg}}" style="width:80px;height:80px">
|
||||
<button type="button" class="layui-btn layui-btn-xs" style="margin-top: 10px;" lay-active="doSycnWeChatProductImagesSingle"><i class="layui-icon"></i>同步图片</button>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="product[barCode][]" value="{{item.sn}}" readonly="readonly" placeholder="货号" class="layui-input layui-inline-3">
|
||||
@@ -147,19 +157,24 @@
|
||||
{{item.spesDesc}}
|
||||
</td>
|
||||
<td class="have-add-td">
|
||||
<input type="number" name="product[stockNum][]" value="{{item.stock}}" placeholder="库存" class="layui-input layui-inline-1 goods-stock">
|
||||
<input type="number" name="product[stockNum][]" value="{{d.sku[index].stockNum}}" placeholder="库存" class="layui-input layui-inline-1 goods-stock">
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="product[salePrice][]" value="{{item.price}}" placeholder="销售价" class="layui-input layui-inline-1">
|
||||
<input type="number" name="product[salePrice][]" value="{{d.sku[index].salePrice}}" placeholder="销售价" class="layui-input layui-inline-1">
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="product[costprice][]" value="{{item.costprice}}" placeholder="成本价" class="layui-input layui-inline-1">
|
||||
<input type="number" name="product[costprice][]" value="{{d.sku[index].costprice}}" placeholder="成本价" class="layui-input layui-inline-1">
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="product[marketPrice][]" value="{{item.mktprice}}" placeholder="市场价" class="layui-input layui-inline-1">
|
||||
<input type="number" name="product[marketPrice][]" value="{{d.sku[index].marketPrice}}" placeholder="市场价" class="layui-input layui-inline-1">
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" name="product[isSelect][]" checked="checked" lay-skin="primary">
|
||||
<td rowspan="2">
|
||||
<input type="checkbox" name="product[isSelect][]" {{d.sku[index].isSelect? 'checked="true"':''}} lay-skin="primary">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<input type="text" name="product[thumbImg][]" value="{{ d.sku[index].thumbImg}}" class="layui-input layui-inline-14" readonly="readonly" />
|
||||
</td>
|
||||
</tr>
|
||||
{{# }); }}
|
||||
@@ -188,9 +203,6 @@
|
||||
, laytpl = layui.laytpl
|
||||
, coreHelper = layui.coreHelper;
|
||||
|
||||
//加载编辑器
|
||||
var Authorization = layui.data(layui.setter.tableName)[layui.setter.request.tokenName];
|
||||
|
||||
//加载编辑器
|
||||
var Authorization = layui.data(layui.setter.tableName)[layui.setter.request.tokenName];
|
||||
//重点代码 适配器
|
||||
@@ -251,7 +263,6 @@
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
|
||||
if (d.params.data.model.headImg) {
|
||||
imgs = d.params.data.model.headImg.split(',');
|
||||
$('#headImg').val(imgs);
|
||||
@@ -261,7 +272,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$('#skuCount').val(d.params.data.products.length);
|
||||
|
||||
//初始化商品信息
|
||||
@@ -271,8 +281,6 @@
|
||||
viewBox.innerHTML = html;
|
||||
});
|
||||
|
||||
|
||||
|
||||
//处理属性 为 lay-active 的所有元素事件
|
||||
util.event('lay-active', {
|
||||
goods_show: function () {
|
||||
@@ -299,7 +307,6 @@
|
||||
$('#path').val('pages/goods/goodDetails/goodDetails?id=' + ids.id);
|
||||
window.editor.setData(ids.intro);
|
||||
|
||||
|
||||
if (ids.images) {
|
||||
imgs = ids.images.split(',');
|
||||
$('#headImg').val(imgs);
|
||||
@@ -351,37 +358,108 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//图集上传
|
||||
$('#upBtnimageIds').click(function () {
|
||||
cropperImg.cropImg({
|
||||
aspectRatio: 1 / 1,
|
||||
onCrop: function (data) {
|
||||
var loadIndex = layer.load(2);
|
||||
coreHelper.Post("api/Tools/UploadFilesFByBase64", { base64: data }, function (res) {
|
||||
if (0 === res.code) {
|
||||
imgs.push(res.data.fileUrl);
|
||||
},
|
||||
upLoadImage: function (othis) {
|
||||
var imgDiv = $(othis).parent().parent();
|
||||
var imageUrl = imgDiv.find('img').attr("src");
|
||||
},
|
||||
delImg: function (othis) {
|
||||
var imgDiv = $(othis).parent().parent();
|
||||
imgDiv.remove();
|
||||
var imageUrl = imgDiv.find('img').attr("src");
|
||||
var index = imgs.indexOf(imageUrl);
|
||||
if (index > -1) {
|
||||
imgs.splice(index, 1);
|
||||
}
|
||||
$('#headImg').val(imgs);
|
||||
console.log(imgs);
|
||||
refreshImages();
|
||||
},
|
||||
setDefault: function (othis) {
|
||||
var imgDiv = $(othis).parent().parent();
|
||||
$("#upload-more-list").prepend(imgDiv);
|
||||
var imageUrl = imgDiv.find('img').attr("src");
|
||||
var index = imgs.indexOf(imageUrl);
|
||||
if (index > -1) {
|
||||
imgs.unshift(imgs.splice(index, 1)[0]);
|
||||
}
|
||||
$('#headImg').val(imgs);
|
||||
console.log(imgs);
|
||||
refreshImages();
|
||||
},
|
||||
doSycnWeChatProductImages: function () {
|
||||
if (imgs.length > 0) {
|
||||
//执行交换url操作
|
||||
coreHelper.Post("Api/Tools/MiNiShopOpenComponent2_UploadImgByUrlArr", { id: imgs }, function (res) {
|
||||
if (debug) { console.log(res); } //开启调试返回数据
|
||||
if (res.code == 0) {
|
||||
imgs = res.data;
|
||||
$('#headImg').val(imgs);
|
||||
var getTpl = image_tpl.innerHTML, view = document.getElementById('upload-more-list');
|
||||
laytpl(getTpl).render(imgs, function (html) {
|
||||
view.innerHTML = html;
|
||||
});
|
||||
layer.msg(res.msg);
|
||||
layer.close(loadIndex);
|
||||
} else {
|
||||
layer.close(loadIndex);
|
||||
layer.msg(res.msg, { icon: 2, anim: 6 });
|
||||
refreshImages();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg('请先上传图片或选择商品获取图集');
|
||||
}
|
||||
});
|
||||
},
|
||||
doSycnWeChatProductImagesSingle: function (othis) {
|
||||
var imgObj = $(othis).prev().attr('src');
|
||||
console.log(imgObj);
|
||||
coreHelper.Post("Api/Tools/MiNiShopOpenComponent2_UploadImgByUrlSingle", { id: imgObj }, function (res) {
|
||||
if (debug) { console.log(res); } //开启调试返回数据
|
||||
if (res.code == 0) {
|
||||
$(othis).parent().parent().next().find("input[name='product[thumbImg][]']").val(res.data);
|
||||
} else {
|
||||
layer.msg(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
function refreshImages() {
|
||||
var getTpl = image_tpl.innerHTML, view = document.getElementById('upload-more-list');
|
||||
laytpl(getTpl).render(imgs, function (html) {
|
||||
view.innerHTML = html;
|
||||
});
|
||||
console.log(imgs);
|
||||
}
|
||||
|
||||
//设为默认图
|
||||
function setDefault(obj, imageUrl) {
|
||||
var imgDiv = $(obj).parent().parent();
|
||||
$("#upload-more-list").prepend(imgDiv);
|
||||
var index = imgs.indexOf(imageUrl);
|
||||
if (index > -1) {
|
||||
imgs.unshift(imgs.splice(index, 1)[0]);
|
||||
}
|
||||
$('#headImg').val(imgs);
|
||||
console.log(imgs);
|
||||
refreshImages();
|
||||
}
|
||||
|
||||
//图集上传
|
||||
upload.render({
|
||||
elem: '#upBtnimageIds'
|
||||
, url: layui.setter.apiUrl + 'Api/Tools/MiNiShopOpenComponent2_UploadImg'
|
||||
, before: function (obj) {
|
||||
obj.preview(function (index, file, result) {
|
||||
layer.msg('上传中', { icon: 16, shade: 0.4 });
|
||||
});
|
||||
}
|
||||
, done: function (res) {
|
||||
layer.closeAll('loading'); //关闭加载层
|
||||
if (res.code > 0) {
|
||||
return layer.msg('上传失败');
|
||||
}
|
||||
layer.msg('上传成功');
|
||||
imgs.push(res.data.fileUrl);
|
||||
$('#headImg').val(imgs);
|
||||
refreshImages();
|
||||
}
|
||||
, error: function () {
|
||||
return layer.msg('上传失败,请重试!');
|
||||
}
|
||||
});
|
||||
|
||||
form.verify({
|
||||
|
||||
@@ -398,28 +476,4 @@
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
//删除图片
|
||||
function delImg(obj, imageUrl) {
|
||||
var imgDiv = $(obj).parent().parent().parent();
|
||||
imgDiv.remove();
|
||||
var index = imgs.indexOf(imageUrl);
|
||||
if (index > -1) {
|
||||
imgs.splice(index, 1);
|
||||
}
|
||||
$('#headImg').val(imgs);
|
||||
}
|
||||
//设为默认图
|
||||
function setDefault(obj, imageUrl) {
|
||||
var imgDiv = $(obj).parent().parent().parent();
|
||||
$("#upload-more-list").prepend(imgDiv);
|
||||
var index = imgs.indexOf(imageUrl);
|
||||
if (index > -1) {
|
||||
imgs.unshift(imgs.splice(index, 1)[0]);
|
||||
}
|
||||
$('#headImg').val(imgs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user