mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2026-03-27 00:37:22 +08:00
2022-01-11
## 1.2.9 开源社区版: 【修复】修复全局定义微信配置引用的配置文件命名错误问题。 【修复】修复自动生成sku模式价格出现货号重复情况,#I4Q4WU ## 0.0.6 会员先行版: 【新增】新增微信自定义交易组件,实现微信视频号直播带货功能。
This commit is contained in:
@@ -1174,7 +1174,7 @@
|
||||
if (e.data.products) {
|
||||
for (var i = 0; i < e.data.products.length; i++) {
|
||||
e.data.products[i].isDefalut = false;
|
||||
e.data.products[i].sn = layui.coreHelper.getSN('SN');
|
||||
//e.data.products[i].sn = layui.coreHelper.getSN('SN');
|
||||
tmpData.push(e.data.products[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1284,7 +1284,7 @@
|
||||
if (e.data.products) {
|
||||
for (var i = 0; i < e.data.products.length; i++) {
|
||||
e.data.products[i].isDefalut = false;
|
||||
e.data.products[i].sn = layui.coreHelper.getSN('SN');
|
||||
//e.data.products[i].sn = layui.coreHelper.getSN('SN');
|
||||
tmpData.push(e.data.products[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,6 +298,7 @@
|
||||
<th>收货人名</th>
|
||||
<th>收货电话</th>
|
||||
<th>收货地址</th>
|
||||
<th style="width: 60px">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -310,6 +311,9 @@
|
||||
<td>{{item.shipName}}</td>
|
||||
<td>{{item.shipMobile}}</td>
|
||||
<td>{{item.shipAreaIdName}}-{{item.shipAddress}}</td>
|
||||
<td>
|
||||
<button type="button" class="layui-btn layui-btn-warm layui-btn-xs" data-deliveryId="{{item.deliveryId}}" lay-active="refreshDelivery" style="margin-left: 0px">同步直播订单</button>
|
||||
</td>
|
||||
</tr>
|
||||
{{# }); }}
|
||||
</tbody>
|
||||
|
||||
@@ -570,7 +570,7 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//还原订单
|
||||
function restoreOrder(id) {
|
||||
layer.confirm('确认还原:' + id + ' 的订单吗?', {
|
||||
@@ -601,7 +601,6 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//取消订单
|
||||
function doCancelOrder(id) {
|
||||
layer.confirm('确认取消订单号:' + id + ' 的订单吗?', {
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||
<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 layui-form-required">营业执照</label>
|
||||
<div class="layui-input-inline layui-inline-12">
|
||||
<input name="licenseImage" id="licenseImageInput" lay-verify="required" class="layui-input" placeholder="请上传营业执照或组织机构代码证" lay-reqText="请上传营业执照或组织机构代码证" />
|
||||
</div>
|
||||
<div class="layui-input-block">
|
||||
<img class="coreshop-upload-img" id="viewImgBoxlicenseImage" src="{{ layui.setter.noImagePicUrl }}">
|
||||
<button type="button" class="layui-btn" id="upBtnlicenseImage">点击上传营业执照或组织机构代码证</button>
|
||||
</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="level1" class="layui-form-label layui-form-required">一级类目</label>
|
||||
<div class="layui-input-inline layui-inline-3">
|
||||
<input type="number" min="0" max="999999" name="level1" id="level1" readonly="readonly" lay-verify="required|number" class="layui-input" placeholder="请输入一级类目" lay-reqText="请输入一级类目并为数字" />
|
||||
</div>
|
||||
<label for="level1Name" class="layui-form-label layui-form-required">类目名称</label>
|
||||
<div class="layui-input-inline layui-inline-3">
|
||||
<input name="level1Name" id="level1Name" lay-verify="required|verifylevel1Name" readonly="readonly" class="layui-input" lay-reqText="请输入一级类目名称" placeholder="请输入一级类目名称" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="level2" class="layui-form-label layui-form-required">二级类目</label>
|
||||
<div class="layui-input-inline layui-inline-3">
|
||||
<input type="number" min="0" max="999999" name="level2" id="level2" readonly="readonly" lay-verify="required|number" class="layui-input" placeholder="请输入二级类目" lay-reqText="请输入二级类目并为数字" />
|
||||
</div>
|
||||
<label for="level2Name" class="layui-form-label layui-form-required">类目名称</label>
|
||||
<div class="layui-input-inline layui-inline-3">
|
||||
<input name="level2Name" id="level2Name" lay-verify="required|verifylevel2Name" readonly="readonly" class="layui-input" lay-reqText="请输入二级类目名称" placeholder="请输入二级类目名称" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="level3" class="layui-form-label layui-form-required">三级类目</label>
|
||||
<div class="layui-input-inline layui-inline-3">
|
||||
<input type="number" min="0" max="999999" name="level3" id="level3" readonly="readonly" lay-verify="required|number" class="layui-input" placeholder="请输入三级类目" lay-reqText="请输入三级类目并为数字" />
|
||||
</div>
|
||||
<label for="level3Name" class="layui-form-label layui-form-required">类目名称</label>
|
||||
<div class="layui-input-inline layui-inline-3">
|
||||
<input name="level3Name" id="level3Name" lay-verify="required|verifylevel3Name" readonly="readonly" class="layui-input" lay-reqText="请输入三级类目名称" placeholder="请输入三级类目名称" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="level3Name" class="layui-form-label"> </label>
|
||||
|
||||
<div class="layui-input-inline">
|
||||
<button class="layui-btn layui-btn-normal" lay-active="getThirdCategories"><i class="layui-icon layui-icon-ok"></i>选择三级分类</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset class="layui-elem-field layui-field-title site-title"><legend><a name="compress">资质材料</a></legend></fieldset>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-inline layui-inline-2">
|
||||
<input type="hidden" name="certificateImage" id="certificateImage" 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">
|
||||
资质材料:[建议按照三级分类需求上传]:
|
||||
</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>
|
||||
|
||||
|
||||
<div class="layui-form-item text-right core-hidden">
|
||||
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-WeChatTransactionComponentAuditCategory-createForm-submit" id="LAY-app-WeChatTransactionComponentAuditCategory-createForm-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>
|
||||
{{# }); }}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
var $;
|
||||
var imgs = [];
|
||||
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', '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;
|
||||
|
||||
|
||||
//处理属性 为 lay-active 的所有元素事件
|
||||
util.event('lay-active', {
|
||||
getThirdCategories: function () {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '选择三级分类',
|
||||
area: ['1000px', '600px'],
|
||||
id: 'LAY-app-GetThirdCategories',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('wechat/transactioncomponent/goods/getThirdCategories', null).done(function () {
|
||||
form.render();
|
||||
//监听商品列表页工具条
|
||||
var obj_goodsIds = {};
|
||||
form.on('submit(LAY-app-GetThirdCategories-getData)',
|
||||
function (data) {
|
||||
console.log(ids);
|
||||
if (!!!ids) {
|
||||
layer.msg("请先选择三级分类");
|
||||
return;
|
||||
}
|
||||
|
||||
$('#level1').val(ids.first_cat_id);
|
||||
$('#level1Name').val(ids.first_cat_name);
|
||||
$('#level2').val(ids.second_cat_id);
|
||||
$('#level2Name').val(ids.second_cat_name);
|
||||
$('#level3').val(ids.third_cat_id);
|
||||
$('#level3Name').val(ids.third_cat_name);
|
||||
|
||||
form.render();
|
||||
layer.close(index);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//普通图片上传
|
||||
var uploadInst = upload.render({
|
||||
elem: '#upBtnlicenseImage'
|
||||
, url: layui.setter.apiUrl + 'Api/Tools/UploadFiles'
|
||||
, before: function (obj) {
|
||||
obj.preview(function (index, file, result) {
|
||||
|
||||
});
|
||||
}
|
||||
, done: function (res) {
|
||||
if (res.code > 0) { return layer.msg('上传失败'); }
|
||||
layer.msg('上传成功');
|
||||
$('#viewImgBoxlicenseImage').attr('src', res.data.fileUrl);
|
||||
$("#licenseImageInput").val(res.data.fileUrl);
|
||||
}
|
||||
, error: function () {
|
||||
var viewTextBox = $('#viewTextBox');
|
||||
viewTextBox.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
||||
viewTextBox.find('.demo-reload').on('click', function () {
|
||||
uploadInst.upload();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
upload.render({
|
||||
elem: '#upBtnimageIds'
|
||||
, url: layui.setter.apiUrl + 'Api/Tools/UploadFiles'
|
||||
, before: function (obj) {
|
||||
obj.preview(function (index, file, result) {
|
||||
//$('#viewImgBoxlicenseImage').attr('src', result);
|
||||
});
|
||||
}
|
||||
, done: function (res) {
|
||||
if (res.code > 0) { return layer.msg('上传失败'); }
|
||||
layer.msg('上传成功');
|
||||
imgs.push(res.data.fileUrl);
|
||||
$('#certificateImage').val(imgs);
|
||||
var getTpl = image_tpl.innerHTML, view = document.getElementById('upload-more-list');
|
||||
laytpl(getTpl).render(imgs, function (html) {
|
||||
view.innerHTML = html;
|
||||
});
|
||||
}
|
||||
, error: function () {
|
||||
var viewTextBox = $('#viewTextBox');
|
||||
viewTextBox.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
||||
viewTextBox.find('.demo-reload').on('click', function () {
|
||||
uploadInst.upload();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
form.verify({
|
||||
|
||||
verifylicenseImage: [/^.{0,255}$/, '营业执照或组织机构代码证最大只允许输入255位字符'],
|
||||
verifylevel1Name: [/^.{0,50}$/, '一级类目名称最大只允许输入50位字符'],
|
||||
verifylevel2Name: [/^.{0,50}$/, '二级类目名称最大只允许输入50位字符'],
|
||||
verifylevel3Name: [/^.{0,50}$/, '三级类目名称最大只允许输入50位字符'],
|
||||
verifyauditId: [/^.{0,50}$/, '审核单最大只允许输入50位字符'],
|
||||
verifyrejectReason: [/^.{0,255}$/, '拒绝原因最大只允许输入255位字符'],
|
||||
});
|
||||
//重载form
|
||||
form.render(null, 'LAY-app-WeChatTransactionComponentAuditCategory-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);
|
||||
}
|
||||
$('#certificateImage').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]);
|
||||
}
|
||||
$('#certificateImage').val(imgs);
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,129 @@
|
||||
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||
<table class="layui-table layui-form" lay-filter="LAY-app-WeChatTransactionComponentAuditCategory-detailsForm" id="LAY-app-WeChatTransactionComponentAuditCategory-detailsForm">
|
||||
<colgroup>
|
||||
<col width="200">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="licenseImage">营业执照或组织机构代码证</label>
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:void(0);" onclick="layui.coreHelper.viewImage('{{ d.params.data.model.licenseImage || setter.noImagePicUrl }}')"><image style="max-width: 128px; max-height: 128px;" src="{{d.params.data.model.licenseImage }}" /></a>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="level1Name">一级类目</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.model.level1Name || '' }}【{{ d.params.data.model.level1 || '' }}】
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="level2Name">二级类目</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.model.level2Name || '' }}【{{ d.params.data.model.level2 || '' }}】
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="level3Name">三级类目名称</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.model.level3Name || '' }}【{{ d.params.data.model.level3 || '' }}】
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="certificateImage">资质材料</label>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
{{# layui.each(d.params.data.imagesArr, function(index, item){ }}
|
||||
<a href="javascript:void(0);" onclick="layui.coreHelper.viewImage('{{ item || '' }}')"><image style="max-width:128px;max-height:128px;" src="{{item || '' }}" /></a>
|
||||
{{# }); }}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="auditId">审核单</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.model.auditId || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="status">审核状态</label>
|
||||
</td>
|
||||
<td>
|
||||
{{# layui.each(d.params.data.auditCategoryStatus, function(index, item){ }}
|
||||
{{# if(d.params.data.model.status == item.value){ }}
|
||||
{{item.description}}
|
||||
{{# } }}
|
||||
{{# }); }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="brandId">品牌id</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.model.brandId || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="rejectReason">拒绝原因</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.model.rejectReason || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="createTime">创建时间</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.model.createTime || '' }}
|
||||
</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-WeChatTransactionComponentAuditCategory-detailsForm');
|
||||
});
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,254 @@
|
||||
<script type="text/html" template lay-done="layui.data.sendParams(d);">
|
||||
<div class="layui-form coreshop-form transactioncomponent" lay-filter="LAY-app-WeChatTransactionComponentAuditCategory-editForm" id="LAY-app-WeChatTransactionComponentAuditCategory-editForm">
|
||||
<input type="hidden" name="id" value="{{d.params.data.id || '' }}" />
|
||||
|
||||
<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 name="licenseImage" id="licenseImageInput" lay-verify="required" class="layui-input" placeholder="请上传营业执照或组织机构代码证" lay-reqText="请上传营业执照或组织机构代码证" value="{{d.params.data.licenseImage || '' }}" />
|
||||
</div>
|
||||
<div class="layui-input-block">
|
||||
<img class="coreshop-upload-img" id="viewImgBoxlicenseImage" src="{{d.params.data.licenseImage || layui.setter.noImagePicUrl }}">
|
||||
<button type="button" class="layui-btn" id="upBtnlicenseImage">点击上传营业执照或组织机构代码证</button>
|
||||
</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="level1" class="layui-form-label layui-form-required">一级类目</label>
|
||||
<div class="layui-input-inline layui-inline-3">
|
||||
<input type="number" min="0" max="999999" name="level1" id="level1" readonly="readonly" value="{{d.params.data.level1 || '' }}" lay-verify="required|number" class="layui-input" placeholder="请输入一级类目" lay-reqText="请输入一级类目并为数字" />
|
||||
</div>
|
||||
<label for="level1Name" class="layui-form-label layui-form-required">类目名称</label>
|
||||
<div class="layui-input-inline layui-inline-3">
|
||||
<input name="level1Name" id="level1Name" lay-verify="required|verifylevel1Name" readonly="readonly" value="{{d.params.data.level1Name || '' }}" class="layui-input" lay-reqText="请输入一级类目名称" placeholder="请输入一级类目名称" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="level2" class="layui-form-label layui-form-required">二级类目</label>
|
||||
<div class="layui-input-inline layui-inline-3">
|
||||
<input type="number" min="0" max="999999" name="level2" id="level2" readonly="readonly" lay-verify="required|number" value="{{d.params.data.level2 || '' }}" class="layui-input" placeholder="请输入二级类目" lay-reqText="请输入二级类目并为数字" />
|
||||
</div>
|
||||
<label for="level2Name" class="layui-form-label layui-form-required">类目名称</label>
|
||||
<div class="layui-input-inline layui-inline-3">
|
||||
<input name="level2Name" id="level2Name" lay-verify="required|verifylevel2Name" readonly="readonly" value="{{d.params.data.level2Name || '' }}" class="layui-input" lay-reqText="请输入二级类目名称" placeholder="请输入二级类目名称" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="level3" class="layui-form-label layui-form-required">三级类目</label>
|
||||
<div class="layui-input-inline layui-inline-3">
|
||||
<input type="number" min="0" max="999999" name="level3" id="level3" readonly="readonly" value="{{d.params.data.level3 || '' }}" lay-verify="required|number" class="layui-input" placeholder="请输入三级类目" lay-reqText="请输入三级类目并为数字" />
|
||||
</div>
|
||||
<label for="level3Name" class="layui-form-label layui-form-required">类目名称</label>
|
||||
<div class="layui-input-inline layui-inline-3">
|
||||
<input name="level3Name" id="level3Name" lay-verify="required|verifylevel3Name" readonly="readonly" value="{{d.params.data.level3Name || '' }}" class="layui-input" lay-reqText="请输入三级类目名称" placeholder="请输入三级类目名称" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="level3Name" class="layui-form-label">选择 </label>
|
||||
<div class="layui-input-inline">
|
||||
<button class="layui-btn layui-btn-normal" lay-active="getThirdCategories"><i class="layui-icon layui-icon-ok"></i>选择三级分类</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<fieldset class="layui-elem-field layui-field-title site-title"><legend><a name="compress">资质材料</a></legend></fieldset>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-inline layui-inline-2">
|
||||
<input type="hidden" name="certificateImage" id="certificateImage" value="{{d.params.data.certificateImage || '' }}" 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">
|
||||
资质材料:[建议按照三级分类需求上传]:
|
||||
</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>
|
||||
|
||||
<div class="layui-form-item text-right core-hidden">
|
||||
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-WeChatTransactionComponentAuditCategory-editForm-submit" id="LAY-app-WeChatTransactionComponentAuditCategory-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>
|
||||
{{# }); }}
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
var $;
|
||||
var imgs = [];
|
||||
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', '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;
|
||||
|
||||
|
||||
imgs = d.params.data.certificateImage.split(',');
|
||||
|
||||
if (imgs.length > 0) {
|
||||
var getTpl = image_tpl.innerHTML, view = document.getElementById('upload-more-list');
|
||||
laytpl(getTpl).render(imgs, function (html) {
|
||||
view.innerHTML = html;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//处理属性 为 lay-active 的所有元素事件
|
||||
util.event('lay-active', {
|
||||
getThirdCategories: function () {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '选择三级分类',
|
||||
area: ['1000px', '600px'],
|
||||
id: 'LAY-app-GetThirdCategories',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('wechat/transactioncomponent/goods/getThirdCategories', null).done(function () {
|
||||
form.render();
|
||||
//监听商品列表页工具条
|
||||
var obj_goodsIds = {};
|
||||
form.on('submit(LAY-app-GetThirdCategories-getData)',
|
||||
function (data) {
|
||||
console.log(ids);
|
||||
if (!!!ids) {
|
||||
layer.msg("请先选择三级分类");
|
||||
return;
|
||||
}
|
||||
|
||||
$('#level1').val(ids.first_cat_id);
|
||||
$('#level1Name').val(ids.first_cat_name);
|
||||
$('#level2').val(ids.second_cat_id);
|
||||
$('#level2Name').val(ids.second_cat_name);
|
||||
$('#level3').val(ids.third_cat_id);
|
||||
$('#level3Name').val(ids.third_cat_name);
|
||||
|
||||
form.render();
|
||||
layer.close(index);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//普通图片上传
|
||||
var uploadInst = upload.render({
|
||||
elem: '#upBtnlicenseImage'
|
||||
, url: layui.setter.apiUrl + 'Api/Tools/UploadFiles'
|
||||
, before: function (obj) {
|
||||
obj.preview(function (index, file, result) {
|
||||
|
||||
});
|
||||
}
|
||||
, done: function (res) {
|
||||
if (res.code > 0) { return layer.msg('上传失败'); }
|
||||
layer.msg('上传成功');
|
||||
$('#viewImgBoxlicenseImage').attr('src', res.data.fileUrl);
|
||||
$("#licenseImageInput").val(res.data.fileUrl);
|
||||
}
|
||||
, error: function () {
|
||||
var viewTextBox = $('#viewTextBox');
|
||||
viewTextBox.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
||||
viewTextBox.find('.demo-reload').on('click', function () {
|
||||
uploadInst.upload();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
upload.render({
|
||||
elem: '#upBtnimageIds'
|
||||
, url: layui.setter.apiUrl + 'Api/Tools/UploadFiles'
|
||||
, before: function (obj) {
|
||||
obj.preview(function (index, file, result) {
|
||||
//$('#viewImgBoxlicenseImage').attr('src', result);
|
||||
});
|
||||
}
|
||||
, done: function (res) {
|
||||
if (res.code > 0) { return layer.msg('上传失败'); }
|
||||
layer.msg('上传成功');
|
||||
imgs.push(res.data.fileUrl);
|
||||
$('#certificateImage').val(imgs);
|
||||
var getTpl = image_tpl.innerHTML, view = document.getElementById('upload-more-list');
|
||||
laytpl(getTpl).render(imgs, function (html) {
|
||||
view.innerHTML = html;
|
||||
});
|
||||
}
|
||||
, error: function () {
|
||||
var viewTextBox = $('#viewTextBox');
|
||||
viewTextBox.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
||||
viewTextBox.find('.demo-reload').on('click', function () {
|
||||
uploadInst.upload();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
form.verify({
|
||||
|
||||
verifylicenseImage: [/^.{0,255}$/, '营业执照或组织机构代码证最大只允许输入255位字符'],
|
||||
verifylevel1Name: [/^.{0,50}$/, '一级类目名称最大只允许输入50位字符'],
|
||||
verifylevel2Name: [/^.{0,50}$/, '二级类目名称最大只允许输入50位字符'],
|
||||
verifylevel3Name: [/^.{0,50}$/, '三级类目名称最大只允许输入50位字符'],
|
||||
verifyauditId: [/^.{0,50}$/, '审核单最大只允许输入50位字符'],
|
||||
verifyrejectReason: [/^.{0,255}$/, '拒绝原因最大只允许输入255位字符'],
|
||||
});
|
||||
//重载form
|
||||
form.render(null, 'LAY-app-WeChatTransactionComponentAuditCategory-editForm');
|
||||
})
|
||||
};
|
||||
|
||||
//删除图片
|
||||
function delImg(obj, imageUrl) {
|
||||
var imgDiv = $(obj).parent().parent().parent();
|
||||
imgDiv.remove();
|
||||
var index = imgs.indexOf(imageUrl);
|
||||
if (index > -1) {
|
||||
imgs.splice(index, 1);
|
||||
}
|
||||
$('#certificateImage').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]);
|
||||
}
|
||||
$('#certificateImage').val(imgs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,338 @@
|
||||
<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="{{ layui.setter.apiUrl }}Api/WeChatTransactionComponentAuditCategory/GetIndex" lay-done="layui.data.done(d);">
|
||||
|
||||
</script>
|
||||
<div class="table-body">
|
||||
<table id="LAY-app-WeChatTransactionComponentAuditCategory-tableBox" lay-filter="LAY-app-WeChatTransactionComponentAuditCategory-tableBox"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="LAY-app-WeChatTransactionComponentAuditCategory-toolbar">
|
||||
<div class="layui-form coreshop-toolbar-search-form">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="level1Name" placeholder="请输入一级类目名称" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="level2Name" placeholder="请输入二级类目名称" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="level3Name" placeholder="请输入三级类目名称" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-WeChatTransactionComponentAuditCategory-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="LAY-app-WeChatTransactionComponentAuditCategory-pagebar">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="addData"><i class="layui-icon layui-icon-add-1"></i>添加数据</button>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="LAY-app-WeChatTransactionComponentAuditCategory-tableBox-bar">
|
||||
<a class="layui-btn layui-btn-xs" lay-event="refresh">同步</a>
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
|
||||
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" data-dropdown="#WeChatTransactionComponentAuditCategoryTbDelDrop{{d.LAY_INDEX}}" no-shade="true">删除</a>
|
||||
<div class="dropdown-menu-nav dropdown-popconfirm dropdown-top-right layui-hide" id="WeChatTransactionComponentAuditCategoryTbDelDrop{{d.LAY_INDEX}}"
|
||||
style="max-width: 200px;white-space: normal;min-width: auto;margin-left: 10px;">
|
||||
<div class="dropdown-anchor"></div>
|
||||
<div class="dropdown-popconfirm-title">
|
||||
<i class="layui-icon layui-icon-help"></i>
|
||||
确定要删除吗?
|
||||
</div>
|
||||
<div class="dropdown-popconfirm-btn">
|
||||
<a class="layui-btn layui-btn-primary cursor" btn-cancel>取消</a>
|
||||
<a class="layui-btn layui-btn-normal cursor" lay-event="del">确定</a>
|
||||
</div>
|
||||
</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-WeChatTransactionComponentAuditCategory-search)',
|
||||
function (data) {
|
||||
var field = data.field;
|
||||
searchwhere = field;
|
||||
//执行重载
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentAuditCategory-tableBox', { where: field });
|
||||
});
|
||||
//数据绑定
|
||||
table.render({
|
||||
elem: '#LAY-app-WeChatTransactionComponentAuditCategory-tableBox',
|
||||
url: layui.setter.apiUrl + 'Api/WeChatTransactionComponentAuditCategory/GetPageList',
|
||||
method: 'POST',
|
||||
toolbar: '#LAY-app-WeChatTransactionComponentAuditCategory-toolbar',
|
||||
pagebar: '#LAY-app-WeChatTransactionComponentAuditCategory-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: 'licenseImage', title: '营业执照', width: 80, sort: false,
|
||||
templet: function (d) {
|
||||
if (d.licenseImage) {
|
||||
return '<a href="javascript:void(0);" onclick=layui.coreHelper.viewImage("' + d.licenseImage + '")><image style="max-width:28px;max-height:28px;" src="' + d.licenseImage + '"/></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>';
|
||||
}
|
||||
}
|
||||
},
|
||||
//{ field: 'level1', title: '一级类目', sort: false, width: 105 },
|
||||
{ field: 'level1Name', title: '一级类目名称', sort: false, width: 105 },
|
||||
//{ field: 'level2', title: '二级类目', sort: false, width: 105 },
|
||||
{ field: 'level2Name', title: '二级类目名称', sort: false, width: 105 },
|
||||
//{ field: 'level3', title: '三级类目', sort: false, width: 105 },
|
||||
{ field: 'level3Name', title: '三级类目名称', sort: false, width: 105 },
|
||||
{
|
||||
field: 'certificateImage', title: '资质材料', width: 100, 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>';
|
||||
} 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>';
|
||||
}
|
||||
}
|
||||
},
|
||||
//{ field: 'auditId', title: '审核单', sort: false, width: 180 },
|
||||
{
|
||||
field: 'status', title: '审核状态', sort: false, width: 105, templet: function (data) {
|
||||
for (var i = 0; i < d.data.auditCategoryStatus.length; i++) {
|
||||
if (data.status == d.data.auditCategoryStatus[i].value) {
|
||||
return d.data.auditCategoryStatus[i].description;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
},
|
||||
//{ field: 'brandId', title: '品牌id', sort: false, width: 105 },
|
||||
{ field: 'rejectReason', title: '拒绝原因', sort: false },
|
||||
{ field: 'createTime', title: '创建时间', width: 130, sort: false },
|
||||
{ width: 200, align: 'center', title: '操作', fixed: 'right', toolbar: '#LAY-app-WeChatTransactionComponentAuditCategory-tableBox-bar' }
|
||||
]
|
||||
]
|
||||
});
|
||||
//监听排序事件
|
||||
table.on('sort(LAY-app-WeChatTransactionComponentAuditCategory-tableBox)', function (obj) {
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentAuditCategory-tableBox', {
|
||||
initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
|
||||
where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
||||
orderField: obj.field, //排序字段
|
||||
orderDirection: obj.type //排序方式
|
||||
}
|
||||
});
|
||||
});
|
||||
//监听行双击事件
|
||||
table.on('rowDouble(LAY-app-WeChatTransactionComponentAuditCategory-tableBox)', function (obj) {
|
||||
//查看详情
|
||||
doDetails(obj);
|
||||
});
|
||||
//头工具栏事件
|
||||
table.on('pagebar(LAY-app-WeChatTransactionComponentAuditCategory-tableBox)', function (obj) {
|
||||
var checkStatus = table.checkStatus(obj.config.id);
|
||||
switch (obj.event) {
|
||||
case 'addData':
|
||||
doCreate();
|
||||
break;
|
||||
};
|
||||
});
|
||||
//监听工具条
|
||||
table.on('tool(LAY-app-WeChatTransactionComponentAuditCategory-tableBox)',
|
||||
function (obj) {
|
||||
if (obj.event === 'detail') {
|
||||
doDetails(obj);
|
||||
} else if (obj.event === 'del') {
|
||||
doDelete(obj);
|
||||
} else if (obj.event === 'edit') {
|
||||
doEdit(obj)
|
||||
} else if (obj.event === 'refresh') {
|
||||
doRefresh(obj)
|
||||
}
|
||||
});
|
||||
//执行创建操作
|
||||
function doCreate() {
|
||||
coreHelper.Post("Api/WeChatTransactionComponentAuditCategory/GetCreate", null, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '创建数据',
|
||||
area: ['1200px', '90%'],
|
||||
id: 'LAY-popup-WeChatTransactionComponentAuditCategory-create',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('wechat/transactioncomponent/auditcategory/create', { data: e.data }).done(function () {
|
||||
//监听提交
|
||||
form.on('submit(LAY-app-WeChatTransactionComponentAuditCategory-createForm-submit)',
|
||||
function (data) {
|
||||
var field = data.field; //获取提交的字段
|
||||
|
||||
|
||||
if (debug) { console.log(field); } //开启调试返回数据
|
||||
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
||||
coreHelper.Post("Api/WeChatTransactionComponentAuditCategory/DoCreate", field, function (e) {
|
||||
console.log(e)
|
||||
if (e.code === 0) {
|
||||
layui.table.reloadData('LAY-app-WeChatTransactionComponentAuditCategory-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-WeChatTransactionComponentAuditCategory-createForm-submit").click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行编辑操作
|
||||
function doEdit(obj) {
|
||||
coreHelper.Post("Api/WeChatTransactionComponentAuditCategory/GetEdit", { id: obj.data.id }, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '编辑数据',
|
||||
area: ['1200px', '90%'],
|
||||
id: 'LAY-popup-WeChatTransactionComponentAuditCategory-edit',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('wechat/transactioncomponent/auditcategory/edit', { data: e.data }).done(function () {
|
||||
//监听提交
|
||||
form.on('submit(LAY-app-WeChatTransactionComponentAuditCategory-editForm-submit)',
|
||||
function (data) {
|
||||
var field = data.field; //获取提交的字段
|
||||
|
||||
|
||||
if (debug) { console.log(field); } //开启调试返回数据
|
||||
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
||||
coreHelper.Post("Api/WeChatTransactionComponentAuditCategory/DoEdit", field, function (e) {
|
||||
console.log(e)
|
||||
if (e.code === 0) {
|
||||
layui.table.reloadData('LAY-app-WeChatTransactionComponentAuditCategory-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-WeChatTransactionComponentAuditCategory-editForm-submit").click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行预览操作
|
||||
function doDetails(obj) {
|
||||
coreHelper.Post("Api/WeChatTransactionComponentAuditCategory/GetDetails", { id: obj.data.id }, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '查看详情',
|
||||
area: ['1200px', '90%'],
|
||||
id: 'LAY-popup-WeChatTransactionComponentAuditCategory-details',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('wechat/transactioncomponent/auditcategory/details', { data: e.data }).done(function () {
|
||||
form.render();
|
||||
});
|
||||
// 禁止弹窗出现滚动条
|
||||
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行单个删除
|
||||
function doDelete(obj) {
|
||||
coreHelper.Post("Api/WeChatTransactionComponentAuditCategory/DoDelete", { id: obj.data.id }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentAuditCategory-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
}
|
||||
//执行同步状态
|
||||
function doRefresh(obj) {
|
||||
coreHelper.Post("Api/WeChatTransactionComponentAuditCategory/DoRefresh", { id: obj.data.id }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentAuditCategory-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
}
|
||||
|
||||
//监听 表格复选框操作
|
||||
laydate.render({
|
||||
elem: '#searchTime-WeChatTransactionComponentAuditCategory-createTime',
|
||||
type: 'datetime',
|
||||
range: '到',
|
||||
});
|
||||
//重载form
|
||||
form.render();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
<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="{{ layui.setter.apiUrl }}Api/WeChatTransactionComponentDeliveryCompany/GetIndex" lay-done="layui.data.done(d);">
|
||||
|
||||
</script>
|
||||
<div class="table-body">
|
||||
<table id="LAY-app-WeChatTransactionComponentDeliveryCompany-tableBox" lay-filter="LAY-app-WeChatTransactionComponentDeliveryCompany-tableBox"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="LAY-app-WeChatTransactionComponentDeliveryCompany-toolbar">
|
||||
<div class="layui-form coreshop-toolbar-search-form">
|
||||
<div class="layui-form-item">
|
||||
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="deliveryId" placeholder="请输入快递公司编码" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<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-WeChatTransactionComponentDeliveryCompany-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="LAY-app-WeChatTransactionComponentDeliveryCompany-pagebar">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="addData"><i class="layui-icon layui-icon-add-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;
|
||||
|
||||
//重载form
|
||||
form.render();
|
||||
var searchwhere;
|
||||
//监听搜索
|
||||
form.on('submit(LAY-app-WeChatTransactionComponentDeliveryCompany-search)',
|
||||
function (data) {
|
||||
var field = data.field;
|
||||
searchwhere = field;
|
||||
//执行重载
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentDeliveryCompany-tableBox', { where: field });
|
||||
});
|
||||
//数据绑定
|
||||
table.render({
|
||||
elem: '#LAY-app-WeChatTransactionComponentDeliveryCompany-tableBox',
|
||||
url: layui.setter.apiUrl + 'Api/WeChatTransactionComponentDeliveryCompany/GetPageList',
|
||||
method: 'POST',
|
||||
toolbar: '#LAY-app-WeChatTransactionComponentDeliveryCompany-toolbar',
|
||||
pagebar: '#LAY-app-WeChatTransactionComponentDeliveryCompany-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: 'deliveryId', title: '快递公司编码', sort: false, width: 205 },
|
||||
{ field: 'deliveryName', title: '快递公司名称', sort: false, width: 205 },
|
||||
]
|
||||
]
|
||||
});
|
||||
//监听排序事件
|
||||
table.on('sort(LAY-app-WeChatTransactionComponentDeliveryCompany-tableBox)', function (obj) {
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentDeliveryCompany-tableBox', {
|
||||
initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
|
||||
where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
||||
orderField: obj.field, //排序字段
|
||||
orderDirection: obj.type //排序方式
|
||||
}
|
||||
});
|
||||
});
|
||||
//监听行双击事件
|
||||
table.on('rowDouble(LAY-app-WeChatTransactionComponentDeliveryCompany-tableBox)', function (obj) {
|
||||
//查看详情
|
||||
doDetails(obj);
|
||||
});
|
||||
//头工具栏事件
|
||||
table.on('pagebar(LAY-app-WeChatTransactionComponentDeliveryCompany-tableBox)', function (obj) {
|
||||
var checkStatus = table.checkStatus(obj.config.id);
|
||||
switch (obj.event) {
|
||||
case 'addData':
|
||||
doCreate();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
//执行单个删除
|
||||
function doCreate() {
|
||||
coreHelper.Post("Api/WeChatTransactionComponentDeliveryCompany/DoGetCompanyList", null, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentDeliveryCompany-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,424 @@
|
||||
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||
<div class="layui-form coreshop-form layui-form-pane transactioncomponent" lay-filter="LAY-app-WeChatTransactionComponentGood-createForm" id="LAY-app-WeChatTransactionComponentGood-createForm">
|
||||
|
||||
<input type="hidden" name="productId" value="0" />
|
||||
<input type="hidden" name="outProductId" id="outProductId" value="0" />
|
||||
<input type="hidden" name="skuCount" id="skuCount" value="0" />
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="title" class="layui-form-label layui-form-required">选择商品</label>
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" style="margin-left: 10px;" lay-active="goods_show"><i class="layui-icon layui-icon-ok"></i>选择商品</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="title" class="layui-form-label layui-form-required">商品标题</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="title" id="title" lay-verify="required|verifytitle" class="layui-input" lay-reqText="请输入商品标题" placeholder="请输入商品标题" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="path" class="layui-form-label layui-form-required">小程序路径</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="path" id="path" lay-verify="required|verifypath" class="layui-input" lay-reqText="请输入小程序路径" placeholder="请输入小程序路径" />
|
||||
</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">
|
||||
<select name="brandId">
|
||||
<option value="2100000000" selected="selected">无品牌</option>
|
||||
</select>
|
||||
</div>
|
||||
<label for="thirdCatId" class="layui-form-label layui-form-required">所属类目</label>
|
||||
<div class="layui-input-inline layui-inline-1">
|
||||
<input type="number" min="0" max="999999" name="thirdCatId" id="thirdCatId" lay-verify="required|number" class="layui-input" value="0" placeholder="请选择类目名称ID" lay-reqText="请选择类目名称" readonly="readonly" />
|
||||
</div>
|
||||
<div class="layui-input-inline layui-inline-3">
|
||||
<input type="text" name="thirdCatName" id="thirdCatName" lay-verify="required" class="layui-input" placeholder="请选择类目名称" lay-reqText="请选择类目名称" readonly="readonly" />
|
||||
</div>
|
||||
<div class="layui-input-inline">
|
||||
<button class="layui-btn layui-btn-normal" lay-active="getThirdCategories"><i class="layui-icon layui-icon-ok"></i>选择三级分类</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset class="layui-elem-field layui-field-title site-title"><legend><a name="compress">图集</a></legend></fieldset>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-inline layui-inline-2">
|
||||
<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>
|
||||
</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>
|
||||
|
||||
|
||||
<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>
|
||||
</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>
|
||||
{{# }); }}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script id="getSpec_tpl" type="text/html">
|
||||
<table class="layui-table" lay-size="sm">
|
||||
<colgroup>
|
||||
<col width="80">
|
||||
<col width="80">
|
||||
<col width="150">
|
||||
<col>
|
||||
<col width="80">
|
||||
<col width="80">
|
||||
<col width="80">
|
||||
<col width="80">
|
||||
<col width="80">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>默认货品</th>
|
||||
<th>图片</th>
|
||||
<th>货号</th>
|
||||
<th>规格</th>
|
||||
<th>库存</th>
|
||||
<th>销售价</th>
|
||||
<th>成本价</th>
|
||||
<th>市场价</th>
|
||||
<th>是否选择</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="productsTbody">
|
||||
{{# layui.each(d, function(index, item){ }}
|
||||
<tr>
|
||||
<td>
|
||||
<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 }}">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="product[barCode][]" value="{{item.sn}}" readonly="readonly" placeholder="货号" class="layui-input layui-inline-3">
|
||||
</td>
|
||||
<td>
|
||||
<input type="hidden" name="product[spesDesc][]" value="{{item.spesDesc}}" placeholder="规格" class="layui-input">
|
||||
{{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">
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="product[salePrice][]" value="{{item.price}}" 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">
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="product[marketPrice][]" value="{{item.mktprice}}" placeholder="市场价" class="layui-input layui-inline-1">
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" name="product[isSelect][]" checked="checked" lay-skin="primary">
|
||||
</td>
|
||||
</tr>
|
||||
{{# }); }}
|
||||
</tbody>
|
||||
</table>
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
var $;
|
||||
var imgs = [];
|
||||
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', 'util', 'laytpl', 'view'],
|
||||
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;
|
||||
|
||||
//加载编辑器
|
||||
var Authorization = layui.data(layui.setter.tableName)[layui.setter.request.tokenName];
|
||||
|
||||
var Authorization = layui.data(layui.setter.tableName)[layui.setter.request.tokenName];
|
||||
//重点代码 适配器
|
||||
class UploadAdapter {
|
||||
constructor(loader) {
|
||||
this.loader = loader;
|
||||
}
|
||||
upload() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const data = new FormData();
|
||||
let file = [];
|
||||
this.loader.file.then(res => {
|
||||
file = res; //文件流
|
||||
data.append('upload', file);
|
||||
$.ajax({
|
||||
url: "/Api/Tools/CkEditorUploadFiles",
|
||||
type: 'POST',
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
headers: {
|
||||
'Authorization': Authorization
|
||||
},
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function (data) {
|
||||
if (data) {
|
||||
console.log(data)
|
||||
resolve({
|
||||
default: data.url //后端返回的参数 【注】返回参数格式是{uploaded:1,default:'http://xxx.com'}
|
||||
});
|
||||
} else {
|
||||
reject(data.msg);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
}
|
||||
abort() {
|
||||
}
|
||||
}
|
||||
DecoupledEditor
|
||||
.create(document.querySelector('#editor'),
|
||||
{
|
||||
language: 'zh-cn',
|
||||
})
|
||||
.then(editor => {
|
||||
editor.plugins.get('FileRepository').createUploadAdapter = (loader) => {
|
||||
return new UploadAdapter(loader);
|
||||
};
|
||||
const toolbarContainer = document.querySelector('#toolbar-container');
|
||||
toolbarContainer.appendChild(editor.ui.view.toolbar.element);
|
||||
window.editor = editor;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
//处理属性 为 lay-active 的所有元素事件
|
||||
util.event('lay-active', {
|
||||
goods_show: function () {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '选择商品',
|
||||
area: ['750px', '600px'],
|
||||
id: 'LAY-app-CoreCmsPinTuanRule-createForm-GetGoodsList',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('common/getGoodAndSku', null).done(function () {
|
||||
form.render();
|
||||
//监听商品列表页工具条
|
||||
var obj_goodsIds = {};
|
||||
form.on('submit(LAY-app-CoreCmsGoods-getData)',
|
||||
function (data) {
|
||||
console.log(ids);
|
||||
if (!!!ids) {
|
||||
layer.msg("请先选择商品");
|
||||
return;
|
||||
}
|
||||
|
||||
$('#outProductId').val(ids.id);
|
||||
$('#title').val(ids.name);
|
||||
$('#path').val('pages/goods/goodDetails/goodDetails?id=' + ids.id);
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
||||
$('#skuCount').val(ids.sku.length);
|
||||
|
||||
//初始化商品信息
|
||||
var getTpl = getSpec_tpl.innerHTML, viewBox = document.getElementById('products');
|
||||
var tmpData = ids.sku;
|
||||
laytpl(getTpl).render(tmpData, function (html) {
|
||||
viewBox.innerHTML = html;
|
||||
});
|
||||
form.render();
|
||||
layer.close(index);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}, getThirdCategories: function () {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '选择三级分类',
|
||||
area: ['1000px', '600px'],
|
||||
id: 'LAY-app-GetThirdCategories',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('wechat/transactioncomponent/goods/getThirdCategories', null).done(function () {
|
||||
form.render();
|
||||
//监听商品列表页工具条
|
||||
var obj_goodsIds = {};
|
||||
form.on('submit(LAY-app-GetThirdCategories-getData)',
|
||||
function (data) {
|
||||
console.log(ids);
|
||||
if (!!!ids) {
|
||||
layer.msg("请先选择三级分类");
|
||||
return;
|
||||
}
|
||||
|
||||
$('#thirdCatId').val(ids.third_cat_id);
|
||||
$('#thirdCatName').val(ids.third_cat_name);
|
||||
|
||||
form.render();
|
||||
layer.close(index);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//图集上传
|
||||
$('#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);
|
||||
$('#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位字符'],
|
||||
verifyheadImg: [/^.{0,500}$/, '主图列表最大只允许输入500位字符'],
|
||||
verifyqualificationPics: [/^.{0,500}$/, '商品资质图片列表最大只允许输入500位字符'],
|
||||
verifydescInfoImgs: [/^.{0,500}$/, '商品详情图片列表最大只允许输入500位字符'],
|
||||
verifyinfoVersion: [/^.{0,50}$/, '预留字段最大只允许输入50位字符'],
|
||||
});
|
||||
//重载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>
|
||||
@@ -0,0 +1,162 @@
|
||||
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||
<table class="layui-table layui-form" lay-filter="LAY-app-WeChatTransactionComponentGood-detailsForm" id="LAY-app-WeChatTransactionComponentGood-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="productId">交易组件平台内部商品ID</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.productId || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="createTime">交易组件创建时间</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.createTime || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="outProductId">商品序列</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.outProductId || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="title">商品标题</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.title || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="path">小程序路径</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.path || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="headImg">主图列表</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.headImg || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="qualificationPics">商品资质图片列表</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.qualificationPics || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="descInfoDesc">商品详情图文</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.descInfoDesc || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="descInfoImgs">商品详情图片列表</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.descInfoImgs || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="thirdCatId">第三级类目ID</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.thirdCatId || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="brandId">品牌id</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.brandId || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="infoVersion">预留字段</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.infoVersion || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="lastPostTime">最后提交时间</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.lastPostTime || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="updateTime">最后更新时间</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.updateTime || '' }}
|
||||
</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-WeChatTransactionComponentGood-detailsForm');
|
||||
});
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,425 @@
|
||||
<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="skuCount" id="skuCount" value="0" />
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="title" class="layui-form-label layui-form-required">商品标题</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="title" lay-verType="tips" lay-verify="required|verifytitle" class="layui-input" placeholder="请输入商品标题" lay-reqText="请输入商品标题" value="{{d.params.data.model.title || '' }}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="path" class="layui-form-label layui-form-required">小程序路径</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="path" lay-verType="tips" lay-verify="required|verifypath" class="layui-input" placeholder="请输入小程序路径" lay-reqText="请输入小程序路径" value="{{d.params.data.model.path || '' }}" />
|
||||
</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">
|
||||
<select name="brandId">
|
||||
<option value="2100000000" selected="selected">无品牌</option>
|
||||
</select>
|
||||
</div>
|
||||
<label for="thirdCatId" class="layui-form-label layui-form-required">所属类目</label>
|
||||
<div class="layui-input-inline layui-inline-1">
|
||||
<input type="number" min="0" max="999999" value="{{d.params.data.model.thirdCatId }}" name="thirdCatId" id="thirdCatId" lay-verify="required|number" class="layui-input" value="0" placeholder="请选择类目名称ID" lay-reqText="请选择类目名称" readonly="readonly" />
|
||||
</div>
|
||||
<div class="layui-input-inline layui-inline-3">
|
||||
<input type="text" name="thirdCatName" id="thirdCatName" value="{{d.params.data.model.thirdCatName || '' }}" lay-verify="required" class="layui-input" placeholder="请选择类目名称" lay-reqText="请选择类目名称" readonly="readonly" />
|
||||
</div>
|
||||
<div class="layui-input-inline">
|
||||
<button class="layui-btn layui-btn-normal" lay-active="getThirdCategories"><i class="layui-icon layui-icon-ok"></i>选择三级分类</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset class="layui-elem-field layui-field-title site-title"><legend><a name="compress">图集</a></legend></fieldset>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-inline layui-inline-2">
|
||||
<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>
|
||||
</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>
|
||||
|
||||
|
||||
<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">
|
||||
<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 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>
|
||||
{{# }); }}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script id="getSpec_tpl" type="text/html">
|
||||
<table class="layui-table" lay-size="sm">
|
||||
<colgroup>
|
||||
<col width="80">
|
||||
<col width="80">
|
||||
<col width="150">
|
||||
<col>
|
||||
<col width="80">
|
||||
<col width="80">
|
||||
<col width="80">
|
||||
<col width="80">
|
||||
<col width="80">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>默认货品</th>
|
||||
<th>图片</th>
|
||||
<th>货号</th>
|
||||
<th>规格</th>
|
||||
<th>库存</th>
|
||||
<th>销售价</th>
|
||||
<th>成本价</th>
|
||||
<th>市场价</th>
|
||||
<th>是否选择</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="productsTbody">
|
||||
{{# layui.each(d.products, function(index, item){ }}
|
||||
<tr>
|
||||
<td>
|
||||
<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 }}">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="product[barCode][]" value="{{item.sn}}" readonly="readonly" placeholder="货号" class="layui-input layui-inline-3">
|
||||
</td>
|
||||
<td>
|
||||
<input type="hidden" name="product[spesDesc][]" value="{{item.spesDesc}}" placeholder="规格" class="layui-input">
|
||||
{{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">
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="product[salePrice][]" value="{{item.price}}" 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">
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="product[marketPrice][]" value="{{item.mktprice}}" placeholder="市场价" class="layui-input layui-inline-1">
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" name="product[isSelect][]" checked="checked" lay-skin="primary">
|
||||
</td>
|
||||
</tr>
|
||||
{{# }); }}
|
||||
</tbody>
|
||||
</table>
|
||||
</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', 'util', 'laytpl', 'view'],
|
||||
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;
|
||||
|
||||
//加载编辑器
|
||||
var Authorization = layui.data(layui.setter.tableName)[layui.setter.request.tokenName];
|
||||
|
||||
//加载编辑器
|
||||
var Authorization = layui.data(layui.setter.tableName)[layui.setter.request.tokenName];
|
||||
//重点代码 适配器
|
||||
class UploadAdapter {
|
||||
constructor(loader) {
|
||||
this.loader = loader;
|
||||
}
|
||||
upload() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const data = new FormData();
|
||||
let file = [];
|
||||
this.loader.file.then(res => {
|
||||
file = res; //文件流
|
||||
data.append('upload', file);
|
||||
$.ajax({
|
||||
url: "/Api/Tools/CkEditorUploadFiles",
|
||||
type: 'POST',
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
headers: {
|
||||
'Authorization': Authorization
|
||||
},
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function (data) {
|
||||
if (data) {
|
||||
console.log(data)
|
||||
resolve({
|
||||
default: data.url //后端返回的参数 【注】返回参数格式是{uploaded:1,default:'http://xxx.com'}
|
||||
});
|
||||
} else {
|
||||
reject(data.msg);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
}
|
||||
abort() {
|
||||
}
|
||||
}
|
||||
DecoupledEditor
|
||||
.create(document.querySelector('#editor'),
|
||||
{
|
||||
language: 'zh-cn',
|
||||
})
|
||||
.then(editor => {
|
||||
editor.plugins.get('FileRepository').createUploadAdapter = (loader) => {
|
||||
return new UploadAdapter(loader);
|
||||
};
|
||||
const toolbarContainer = document.querySelector('#toolbar-container');
|
||||
toolbarContainer.appendChild(editor.ui.view.toolbar.element);
|
||||
editor.setData(d.params.data.model.descInfoDesc);
|
||||
window.editor = editor;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
|
||||
if (d.params.data.model.headImg) {
|
||||
imgs = d.params.data.model.headImg.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(d.params.data.products.length);
|
||||
|
||||
//初始化商品信息
|
||||
var getTpl = getSpec_tpl.innerHTML, viewBox = document.getElementById('products');
|
||||
var tmpData = d.params.data;
|
||||
laytpl(getTpl).render(tmpData, function (html) {
|
||||
viewBox.innerHTML = html;
|
||||
});
|
||||
|
||||
|
||||
|
||||
//处理属性 为 lay-active 的所有元素事件
|
||||
util.event('lay-active', {
|
||||
goods_show: function () {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '选择商品',
|
||||
area: ['750px', '600px'],
|
||||
id: 'LAY-app-CoreCmsPinTuanRule-createForm-GetGoodsList',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('common/getGoodAndSku', null).done(function () {
|
||||
form.render();
|
||||
//监听商品列表页工具条
|
||||
var obj_goodsIds = {};
|
||||
form.on('submit(LAY-app-CoreCmsGoods-getData)',
|
||||
function (data) {
|
||||
console.log(ids);
|
||||
if (!!!ids) {
|
||||
layer.msg("请先选择商品");
|
||||
return;
|
||||
}
|
||||
|
||||
$('#outProductId').val(ids.id);
|
||||
$('#title').val(ids.name);
|
||||
$('#path').val('pages/goods/goodDetails/goodDetails?id=' + ids.id);
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
||||
$('#skuCount').val(ids.sku.length);
|
||||
|
||||
//初始化商品信息
|
||||
var getTpl = getSpec_tpl.innerHTML, viewBox = document.getElementById('products');
|
||||
var tmpData = ids.sku;
|
||||
laytpl(getTpl).render(tmpData, function (html) {
|
||||
viewBox.innerHTML = html;
|
||||
});
|
||||
form.render();
|
||||
layer.close(index);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}, getThirdCategories: function () {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '选择三级分类',
|
||||
area: ['1000px', '600px'],
|
||||
id: 'LAY-app-GetThirdCategories',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('wechat/transactioncomponent/goods/getThirdCategories', null).done(function () {
|
||||
form.render();
|
||||
//监听商品列表页工具条
|
||||
var obj_goodsIds = {};
|
||||
form.on('submit(LAY-app-GetThirdCategories-getData)',
|
||||
function (data) {
|
||||
console.log(ids);
|
||||
if (!!!ids) {
|
||||
layer.msg("请先选择三级分类");
|
||||
return;
|
||||
}
|
||||
|
||||
$('#thirdCatId').val(ids.third_cat_id);
|
||||
$('#thirdCatName').val(ids.third_cat_name);
|
||||
|
||||
form.render();
|
||||
layer.close(index);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//图集上传
|
||||
$('#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);
|
||||
$('#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位字符'],
|
||||
verifyheadImg: [/^.{0,500}$/, '主图列表最大只允许输入500位字符'],
|
||||
verifyqualificationPics: [/^.{0,500}$/, '商品资质图片列表最大只允许输入500位字符'],
|
||||
verifydescInfoImgs: [/^.{0,500}$/, '商品详情图片列表最大只允许输入500位字符'],
|
||||
verifyinfoVersion: [/^.{0,50}$/, '预留字段最大只允许输入50位字符'],
|
||||
});
|
||||
//重载form
|
||||
form.render(null, 'LAY-app-WeChatTransactionComponentGood-editForm');
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
//删除图片
|
||||
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>
|
||||
@@ -0,0 +1,88 @@
|
||||
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||
<table class="layui-table layui-form" lay-filter="LAY-app-WeChatTransactionComponentGood-detailsForm" id="LAY-app-WeChatTransactionComponentGood-detailsForm">
|
||||
<colgroup>
|
||||
<col width="130">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="brandId">商品草稿状态</label>
|
||||
</td>
|
||||
<td>
|
||||
{{# layui.each(d.params.data.editStatus, function(index, item){ }}
|
||||
{{# if(d.params.data.result.spu.edit_status == item.value){ }}
|
||||
{{item.description}}
|
||||
{{# } }}
|
||||
{{# }); }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="brandId">商品线上状态</label>
|
||||
</td>
|
||||
<td>
|
||||
{{# layui.each(d.params.data.spuStatus, function(index, item){ }}
|
||||
{{# if(d.params.data.result.spu.status == item.value){ }}
|
||||
{{item.description}}
|
||||
{{# } }}
|
||||
{{# }); }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="brandId">审核单id</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.result.spu.audit_info.audit_id || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="infoVersion">拒绝理由</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.result.spu.audit_info.reject_reason || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="lastPostTime">上一次提交时间</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.result.spu.audit_info.submit_time || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="updateTime">上一次审核时间</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.result.spu.audit_info.audit_time || '' }}
|
||||
</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-WeChatTransactionComponentGood-detailsForm');
|
||||
});
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,141 @@
|
||||
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||
<div class="layui-form coreshop-toolbar-search-form">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="name">商品名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="name" id="name" placeholder="请输入商品名称" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-GetThirdCategories-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
||||
</div>
|
||||
|
||||
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-GetThirdCategories-getData" style="float: right"><i class="layui-icon layui-icon-add-1"></i>提交选项</button>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<div class="table-body">
|
||||
<table id="LAY-app-GetThirdCategories-tableBox" lay-filter="LAY-app-GetThirdCategories-tableBox"></table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var ids = {};
|
||||
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', 'coreHelper', 'table'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, admin = layui.admin
|
||||
, table = layui.table
|
||||
, form = layui.form
|
||||
, laydate = layui.laydate
|
||||
, setter = layui.setter
|
||||
, coreHelper = layui.coreHelper
|
||||
, util = layui.util
|
||||
, table = layui.table
|
||||
, view = layui.view;
|
||||
if (d.params.data) {
|
||||
ids = d.params.data;
|
||||
console.log(ids);
|
||||
}
|
||||
//重载form
|
||||
form.render();
|
||||
var searchwhere;
|
||||
//监听搜索
|
||||
form.on('submit(LAY-app-GetThirdCategories-search)',
|
||||
function (data) {
|
||||
var field = data.field;
|
||||
searchwhere = field;
|
||||
//执行重载
|
||||
table.reloadData('LAY-app-GetThirdCategories-tableBox', { where: field });
|
||||
});
|
||||
//数据绑定
|
||||
table.render({
|
||||
elem: '#LAY-app-GetThirdCategories-tableBox',
|
||||
url: layui.setter.apiUrl + 'Api/WeChatTransactionComponentThirdCategory/GetThirdCategories',
|
||||
method: 'POST',
|
||||
defaultToolbar: ['filter', 'print', 'exports'],
|
||||
height: '430',//无面包屑127,搜索框189,1行62
|
||||
page: true,
|
||||
limit: 30,
|
||||
limits: [10, 15, 20, 25, 30, 50, 100, 200],
|
||||
text: { none: '暂无相关数据' },
|
||||
cols: [
|
||||
[
|
||||
{ type: "radio", fixed: "left" },
|
||||
//{ field: 'third_cat_id', title: '类目ID', sort: false, width: 105 },
|
||||
{ field: 'third_cat_name', title: '类目名称', sort: false, width: 105 },
|
||||
{ field: 'qualification', title: '类目资质', sort: false },
|
||||
{
|
||||
field: 'qualification_type', title: '资质类型', sort: false, width: 60, templet: function (data) {
|
||||
if (data.qualification_type == 0) {
|
||||
return "不需要";
|
||||
} else if (data.qualification_type == 1) {
|
||||
return "必填";
|
||||
} else if (data.qualification_type == 2) {
|
||||
return "选填";
|
||||
}
|
||||
}
|
||||
},
|
||||
{ field: 'product_qualification', title: '商品资质', sort: false },
|
||||
{
|
||||
field: 'product_qualification_type', title: '资质类型', sort: false, width: 60, templet: function (data) {
|
||||
if (data.qualification_type == 0) {
|
||||
return "不需要";
|
||||
} else if (data.qualification_type == 1) {
|
||||
return "必填";
|
||||
} else if (data.qualification_type == 2) {
|
||||
return "选填";
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'first_cat_id',
|
||||
title: '上级类目',
|
||||
sort: false,
|
||||
width: 150,
|
||||
templet: function (data) {
|
||||
return data.first_cat_name + "【" + data.second_cat_name + "】";
|
||||
},
|
||||
},
|
||||
]
|
||||
],
|
||||
done: function (res, curr, count) {
|
||||
//数据表格加载完成时调用此函数
|
||||
//如果是异步请求数据方式,res即为你接口返回的信息。
|
||||
//如果是直接赋值的方式,res即为:{data: [], count: 99} data为当前页数据、count为数据总长度
|
||||
|
||||
//在缓存中找到id ,然后设置data表格中的选中状态
|
||||
//循环所有数据,找出对应关系,设置checkbox选中状态
|
||||
for (var i = 0; i < res.data.length; i++) {
|
||||
if (ids.id == res.data[i].id) {
|
||||
//这里才是真正的有效勾选
|
||||
res.data[i]["LAY_CHECKED"] = 'true';
|
||||
//找到对应数据改变勾选样式,呈现出选中效果
|
||||
var index = res.data[i]['LAY_TABLE_INDEX'];
|
||||
console.log(index);
|
||||
$('#LAY-app-GetThirdCategories-tableBox + div .layui-table-body tr[data-index=' + index + '] input[type="radio"]').prop('checked', true);
|
||||
$('#LAY-app-GetThirdCategories-tableBox + div .layui-table-body tr[data-index=' + index + '] ').addClass('layui-table-click');
|
||||
$('#LAY-app-GetThirdCategories-tableBox + div .layui-table-body tr[data-index=' + index + '] input[type="radio"]').next().addClass('layui-form-radioed');
|
||||
$('#LAY-app-GetThirdCategories-tableBox + div .layui-table-body tr[data-index=' + index + '] .layui-anim').addClass('layui-anim-scaleSpring');
|
||||
}
|
||||
}
|
||||
form.render();
|
||||
}
|
||||
});
|
||||
|
||||
//监听表格复选框选择
|
||||
layui.table.on('radio(LAY-app-GetThirdCategories-tableBox)', function (obj) {
|
||||
ids = obj.data;
|
||||
console.log(ids);
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,599 @@
|
||||
<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="{{ layui.setter.apiUrl }}Api/WeChatTransactionComponentGood/GetIndex" lay-done="layui.data.done(d);">
|
||||
|
||||
</script>
|
||||
<div class="table-body">
|
||||
<table id="LAY-app-WeChatTransactionComponentGood-tableBox" lay-filter="LAY-app-WeChatTransactionComponentGood-tableBox"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="LAY-app-WeChatTransactionComponentGood-toolbar">
|
||||
<div class="layui-form coreshop-toolbar-search-form">
|
||||
<div class="layui-form-item">
|
||||
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="title">商品标题</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="title" placeholder="请输入商品标题" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-WeChatTransactionComponentGood-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="addData"><i class="layui-icon layui-icon-add-1"></i>添加数据</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="LAY-app-WeChatTransactionComponentGood-pagebar">
|
||||
<div class="layui-btn-container">
|
||||
<a class="layui-btn layui-btn-sm" data-id="{{d.id}}" lay-event="audit">提交审核</a>
|
||||
<a class="layui-btn layui-btn-sm" data-id="{{d.id}}" lay-event="updateSpu">更新商品</a>
|
||||
<a class="layui-btn layui-btn-sm" data-id="{{d.id}}" lay-event="deleteSpuAudit">撤回审核</a>
|
||||
<a class="layui-btn layui-btn-sm" data-id="{{d.id}}" lay-event="getDraftSKU">获取草稿状态</a>
|
||||
<a class="layui-btn layui-btn-sm" data-id="{{d.id}}" lay-event="getLineSKU">获取线上状态</a>
|
||||
<a class="layui-btn layui-btn-sm" data-id="{{d.id}}" lay-event="listingSKU">上架商品</a>
|
||||
<a class="layui-btn layui-btn-sm" data-id="{{d.id}}" lay-event="delistingSKU">下架商品</a>
|
||||
<a class="layui-btn layui-btn-sm layui-btn-danger" data-id="{{d.id}}" lay-event="deleteSpu">清空数据</a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/html" id="LAY-app-WeChatTransactionComponentGood-tableBox-bar">
|
||||
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" data-dropdown="#WeChatTransactionComponentGoodTbDelDrop{{d.LAY_INDEX}}" no-shade="true">删除</a>
|
||||
<div class="dropdown-menu-nav dropdown-popconfirm dropdown-top-right layui-hide" id="WeChatTransactionComponentGoodTbDelDrop{{d.LAY_INDEX}}"
|
||||
style="max-width: 200px;white-space: normal;min-width: auto;margin-left: 10px;">
|
||||
<div class="dropdown-anchor"></div>
|
||||
<div class="dropdown-popconfirm-title">
|
||||
<i class="layui-icon layui-icon-help"></i>
|
||||
确定要删除吗?
|
||||
</div>
|
||||
<div class="dropdown-popconfirm-btn">
|
||||
<a class="layui-btn layui-btn-primary cursor" btn-cancel>取消</a>
|
||||
<a class="layui-btn layui-btn-normal cursor" lay-event="del">确定</a>
|
||||
</div>
|
||||
</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-WeChatTransactionComponentGood-search)',
|
||||
function (data) {
|
||||
var field = data.field;
|
||||
searchwhere = field;
|
||||
//执行重载
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentGood-tableBox', { where: field });
|
||||
});
|
||||
//数据绑定
|
||||
table.render({
|
||||
elem: '#LAY-app-WeChatTransactionComponentGood-tableBox',
|
||||
url: layui.setter.apiUrl + 'Api/WeChatTransactionComponentGood/GetPageList',
|
||||
method: 'POST',
|
||||
toolbar: '#LAY-app-WeChatTransactionComponentGood-toolbar',
|
||||
pagebar: '#LAY-app-WeChatTransactionComponentGood-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: "radio", fixed: "left" },
|
||||
{ field: 'id', title: '序列', width: 60, sort: false },
|
||||
{ field: 'outProductId', title: '商品序列', sort: false, width: 70 },
|
||||
{ field: 'title', title: '商品标题', sort: false },
|
||||
{
|
||||
field: 'headImg', title: '图集', width: 180, sort: false,
|
||||
templet: function (d) {
|
||||
if (d.headImg && d.headImg.length > 0) {
|
||||
var imagesArr = d.headImg.split(',');
|
||||
var html = '';
|
||||
for (var i = 0; i < imagesArr.length; i++) {
|
||||
html += '<a href="javascript:void(0);" onclick=layui.coreHelper.viewImage("' + imagesArr[i] + '")><image style="max-width:28px;max-height:28px;" src="' + imagesArr[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>';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'thirdCatId', title: '三级类目', sort: false, width: 150, templet: function (data) {
|
||||
return data.thirdCatName + '【' + data.thirdCatId + '】';
|
||||
}
|
||||
},
|
||||
{ field: 'brandId', title: '品牌', sort: false, width: 105 },
|
||||
//{ field: 'infoVersion', title: '预留字段', sort: false, width: 105 },
|
||||
{ field: 'lastPostTime', title: '最后提交时间', width: 130, sort: false },
|
||||
{ field: 'updateTime', title: '最后更新时间', width: 130, sort: false },
|
||||
{ width: 102, align: 'center', title: '数据操作', fixed: 'right', toolbar: '#LAY-app-WeChatTransactionComponentGood-tableBox-bar' }
|
||||
]
|
||||
]
|
||||
});
|
||||
//监听排序事件
|
||||
table.on('sort(LAY-app-WeChatTransactionComponentGood-tableBox)', function (obj) {
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentGood-tableBox', {
|
||||
initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
|
||||
where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
||||
orderField: obj.field, //排序字段
|
||||
orderDirection: obj.type //排序方式
|
||||
}
|
||||
});
|
||||
});
|
||||
//监听行双击事件
|
||||
table.on('rowDouble(LAY-app-WeChatTransactionComponentGood-tableBox)', function (obj) {
|
||||
//查看详情
|
||||
doDetails(obj);
|
||||
});
|
||||
//头工具栏事件
|
||||
table.on('toolbar(LAY-app-WeChatTransactionComponentGood-tableBox)', function (obj) {
|
||||
var checkStatus = table.checkStatus(obj.config.id);
|
||||
console.log(checkStatus);
|
||||
switch (obj.event) {
|
||||
case 'addData':
|
||||
doCreate();
|
||||
break;
|
||||
};
|
||||
});
|
||||
//头工具栏事件
|
||||
table.on('pagebar(LAY-app-WeChatTransactionComponentGood-tableBox)', function (obj) {
|
||||
var checkStatus = table.checkStatus(obj.config.id);
|
||||
console.log(checkStatus);
|
||||
switch (obj.event) {
|
||||
case 'addData':
|
||||
doCreate();
|
||||
break;
|
||||
case 'selectExportExcel':
|
||||
doSelectExportExcel(checkStatus);
|
||||
break;
|
||||
case 'audit':
|
||||
doAudit(checkStatus)
|
||||
break;
|
||||
case 'getDraftSKU':
|
||||
doGetDraftSKU(checkStatus)
|
||||
break;
|
||||
case 'getLineSKU':
|
||||
doGetLineSKU(checkStatus)
|
||||
break;
|
||||
case 'deleteSpuAudit':
|
||||
doDeleteSpuAudit(checkStatus)
|
||||
break;
|
||||
case 'updateSpu':
|
||||
doUpdateSpu(checkStatus)
|
||||
break;
|
||||
case 'deleteSpu':
|
||||
doDeleteSpu(checkStatus)
|
||||
break;
|
||||
case 'listingSKU':
|
||||
doListing(checkStatus)
|
||||
break;
|
||||
case 'delistingSKU':
|
||||
doDelistingSpu(checkStatus)
|
||||
break;
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
//监听工具条
|
||||
table.on('tool(LAY-app-WeChatTransactionComponentGood-tableBox)',
|
||||
function (obj) {
|
||||
if (obj.event === 'detail') {
|
||||
doDetails(obj);
|
||||
} else if (obj.event === 'del') {
|
||||
doDelete(obj);
|
||||
} else if (obj.event === 'edit') {
|
||||
doEdit(obj)
|
||||
}
|
||||
});
|
||||
|
||||
//执行创建操作
|
||||
function doCreate() {
|
||||
coreHelper.Post("Api/WeChatTransactionComponentGood/GetCreate", null, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '创建数据',
|
||||
area: ['1200px', '90%'],
|
||||
id: 'LAY-popup-WeChatTransactionComponentGood-create',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('wechat/transactioncomponent/goods/create', { data: e.data }).done(function () {
|
||||
//监听提交
|
||||
form.on('submit(LAY-app-WeChatTransactionComponentGood-createForm-submit)',
|
||||
function (data) {
|
||||
var field = data.field; //获取提交的字段
|
||||
var postData = {};
|
||||
|
||||
field.descInfoDesc = window.editor.getData();
|
||||
if (!!!field.descInfoDesc) {
|
||||
layer.msg('商品详情图文内容不能为空', { icon: 5 });
|
||||
return false;
|
||||
}
|
||||
postData.productId = field.productId;
|
||||
postData.outProductId = field.outProductId;
|
||||
postData.title = field.title;
|
||||
postData.path = field.path;
|
||||
postData.headImg = field.headImg;
|
||||
postData.qualificationPics = field.qualificationPics;
|
||||
postData.descInfoDesc = field.descInfoDesc;
|
||||
postData.descInfoImgs = field.descInfoImgs;
|
||||
postData.thirdCatId = field.thirdCatId;
|
||||
postData.thirdCatName = field.thirdCatName;
|
||||
postData.brandId = field.brandId;
|
||||
postData.infoVersion = field.infoVersion;
|
||||
|
||||
|
||||
//多参数产品库生成列表集合
|
||||
var products = [];
|
||||
var productsCount = parseInt(field.skuCount);
|
||||
var isSelectCount = 0;
|
||||
for (var i = 0; i < productsCount; i++) {
|
||||
var productModel = {};
|
||||
productModel.outProductId = field['product[outProductId][' + i + ']'];
|
||||
productModel.outSkuId = field['product[outSkuId][' + i + ']'];
|
||||
productModel.thumbImg = field['product[thumbImg][' + i + ']'];
|
||||
if (field['product[isSelect][' + i + ']'] == 'on') {
|
||||
productModel.isSelect = true;
|
||||
isSelectCount++;
|
||||
} else {
|
||||
productModel.isSelect = false;
|
||||
}
|
||||
productModel.costprice = field['product[costprice][' + i + ']'];
|
||||
productModel.salePrice = field['product[salePrice][' + i + ']'];
|
||||
productModel.marketPrice = field['product[marketPrice][' + i + ']'];
|
||||
productModel.barCode = field['product[barCode][' + i + ']'];
|
||||
productModel.stockNum = field['product[stockNum][' + i + ']'];
|
||||
products.push(productModel);
|
||||
}
|
||||
postData.sku = products;
|
||||
|
||||
if (isSelectCount <= 0) {
|
||||
layer.msg('至少要选择一个sku货品', { icon: 5 });
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (debug) { console.log(field); } //开启调试返回数据
|
||||
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
||||
coreHelper.Post("Api/WeChatTransactionComponentGood/DoCreate", postData, function (e) {
|
||||
console.log(e)
|
||||
if (e.code === 0) {
|
||||
layui.table.reloadData('LAY-app-WeChatTransactionComponentGood-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-WeChatTransactionComponentGood-createForm-submit").click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行编辑操作
|
||||
function doEdit(obj) {
|
||||
coreHelper.Post("Api/WeChatTransactionComponentGood/GetEdit", { id: obj.data.id }, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '编辑数据',
|
||||
area: ['1200px', '90%'],
|
||||
id: 'LAY-popup-WeChatTransactionComponentGood-edit',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('wechat/transactioncomponent/goods/edit', { data: e.data }).done(function () {
|
||||
//监听提交
|
||||
form.on('submit(LAY-app-WeChatTransactionComponentGood-editForm-submit)',
|
||||
function (data) {
|
||||
var field = data.field; //获取提交的字段
|
||||
var postData = {};
|
||||
|
||||
field.descInfoDesc = window.editor.getData();
|
||||
if (!!!field.descInfoDesc) {
|
||||
layer.msg('商品详情图文内容不能为空', { icon: 5 });
|
||||
return false;
|
||||
}
|
||||
postData.productId = field.productId;
|
||||
postData.outProductId = field.outProductId;
|
||||
postData.title = field.title;
|
||||
postData.path = field.path;
|
||||
postData.headImg = field.headImg;
|
||||
postData.qualificationPics = field.qualificationPics;
|
||||
postData.descInfoDesc = field.descInfoDesc;
|
||||
postData.descInfoImgs = field.descInfoImgs;
|
||||
postData.thirdCatId = field.thirdCatId;
|
||||
postData.thirdCatName = field.thirdCatName;
|
||||
postData.brandId = field.brandId;
|
||||
postData.infoVersion = field.infoVersion;
|
||||
postData.id = field.id;
|
||||
|
||||
|
||||
|
||||
//多参数产品库生成列表集合
|
||||
var products = [];
|
||||
var productsCount = parseInt(field.skuCount);
|
||||
var isSelectCount = 0;
|
||||
for (var i = 0; i < productsCount; i++) {
|
||||
var productModel = {};
|
||||
productModel.outProductId = field['product[outProductId][' + i + ']'];
|
||||
productModel.outSkuId = field['product[outSkuId][' + i + ']'];
|
||||
productModel.thumbImg = field['product[thumbImg][' + i + ']'];
|
||||
if (field['product[isSelect][' + i + ']'] == 'on') {
|
||||
productModel.isSelect = true;
|
||||
isSelectCount++;
|
||||
} else {
|
||||
productModel.isSelect = false;
|
||||
}
|
||||
productModel.costprice = field['product[costprice][' + i + ']'];
|
||||
productModel.salePrice = field['product[salePrice][' + i + ']'];
|
||||
productModel.marketPrice = field['product[marketPrice][' + i + ']'];
|
||||
productModel.barCode = field['product[barCode][' + i + ']'];
|
||||
productModel.stockNum = field['product[stockNum][' + i + ']'];
|
||||
products.push(productModel);
|
||||
}
|
||||
postData.sku = products;
|
||||
|
||||
if (isSelectCount <= 0) {
|
||||
layer.msg('至少要选择一个sku货品', { icon: 5 });
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (debug) { console.log(field); } //开启调试返回数据
|
||||
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
||||
coreHelper.Post("Api/WeChatTransactionComponentGood/DoEdit", postData, function (e) {
|
||||
console.log(e)
|
||||
if (e.code === 0) {
|
||||
layui.table.reloadData('LAY-app-WeChatTransactionComponentGood-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-WeChatTransactionComponentGood-editForm-submit").click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行预览操作
|
||||
function doDetails(obj) {
|
||||
coreHelper.Post("Api/WeChatTransactionComponentGood/GetDetails", { id: obj.data.id }, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '查看详情',
|
||||
area: ['1200px', '90%'],
|
||||
id: 'LAY-popup-WeChatTransactionComponentGood-details',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('wechat/transactioncomponent/goods/details', { data: e.data }).done(function () {
|
||||
form.render();
|
||||
});
|
||||
// 禁止弹窗出现滚动条
|
||||
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行单个删除
|
||||
function doDelete(obj) {
|
||||
coreHelper.Post("Api/WeChatTransactionComponentGood/DoDelete", { id: obj.data.id }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentGood-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
}
|
||||
//执行提交审核操作
|
||||
function doAudit(checkStatus) {
|
||||
var checkData = checkStatus.data;
|
||||
if (checkData.length === 0) {
|
||||
return layer.msg('请选择您要处理的数据');
|
||||
}
|
||||
coreHelper.Post("Api/WeChatTransactionComponentGood/DoAudit", { id: checkData[0].id }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentGood-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
}
|
||||
//执行提交更新操作
|
||||
function doUpdateSpu(checkStatus) {
|
||||
var checkData = checkStatus.data;
|
||||
if (checkData.length === 0) {
|
||||
return layer.msg('请选择您要处理的数据');
|
||||
}
|
||||
coreHelper.Post("Api/WeChatTransactionComponentGood/DoUpdateSpu", { id: checkData[0].id }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
layer.msg(e.msg);
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentGood-tableBox');
|
||||
});
|
||||
}
|
||||
//执行撤回审核操作
|
||||
function doDeleteSpuAudit(checkStatus) {
|
||||
var checkData = checkStatus.data;
|
||||
if (checkData.length === 0) {
|
||||
return layer.msg('请选择您要处理的数据');
|
||||
}
|
||||
coreHelper.Post("Api/WeChatTransactionComponentGood/DeleteSpuAudit", { id: checkData[0].id }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
layer.msg(e.msg);
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentGood-tableBox');
|
||||
});
|
||||
}
|
||||
//执行删除spu数据操作
|
||||
function doDeleteSpu(checkStatus) {
|
||||
var checkData = checkStatus.data;
|
||||
if (checkData.length === 0) {
|
||||
return layer.msg('请选择您要处理的数据');
|
||||
}
|
||||
coreHelper.Post("Api/WeChatTransactionComponentGood/DeleteSpu", { id: checkData[0].id }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
layer.msg(e.msg);
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentGood-tableBox');
|
||||
});
|
||||
}
|
||||
//执行上架商品
|
||||
function doListing(checkStatus) {
|
||||
var checkData = checkStatus.data;
|
||||
if (checkData.length === 0) {
|
||||
return layer.msg('请选择您要处理的数据');
|
||||
}
|
||||
coreHelper.Post("Api/WeChatTransactionComponentGood/DoListing", { id: checkData[0].id }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
layer.msg(e.msg);
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentGood-tableBox');
|
||||
});
|
||||
}
|
||||
//执行下架商品
|
||||
function doDelistingSpu(checkStatus) {
|
||||
var checkData = checkStatus.data;
|
||||
if (checkData.length === 0) {
|
||||
return layer.msg('请选择您要处理的数据');
|
||||
}
|
||||
coreHelper.Post("Api/WeChatTransactionComponentGood/DoDelistingSpu", { id: checkData[0].id }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
layer.msg(e.msg);
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentGood-tableBox');
|
||||
});
|
||||
}
|
||||
//获取草稿状态
|
||||
function doGetDraftSKU(checkStatus) {
|
||||
var checkData = checkStatus.data;
|
||||
if (checkData.length === 0) {
|
||||
return layer.msg('请选择您要处理的数据');
|
||||
}
|
||||
coreHelper.Post("Api/WeChatTransactionComponentGood/GetSKU", { id: checkData[0].id, data: 1 }, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '查看审核信息',
|
||||
area: ['500px', '330px'],
|
||||
id: 'LAY-popup-WeChatTransactionComponentGood-details',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('wechat/transactioncomponent/goods/getSku', { data: e.data }).done(function () {
|
||||
form.render();
|
||||
});
|
||||
// 禁止弹窗出现滚动条
|
||||
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//获取草稿状态
|
||||
function doGetLineSKU(checkStatus) {
|
||||
var checkData = checkStatus.data;
|
||||
if (checkData.length === 0) {
|
||||
return layer.msg('请选择您要处理的数据');
|
||||
}
|
||||
coreHelper.Post("Api/WeChatTransactionComponentGood/GetSKU", { id: checkData[0].id, data: 0 }, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '查看审核信息',
|
||||
area: ['500px', '330px'],
|
||||
id: 'LAY-popup-WeChatTransactionComponentGood-details',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('wechat/transactioncomponent/goods/getSku', { data: e.data }).done(function () {
|
||||
form.render();
|
||||
});
|
||||
// 禁止弹窗出现滚动条
|
||||
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//执行选择目录导出数据
|
||||
function doSelectExportExcel(checkStatus) {
|
||||
var checkData = checkStatus.data;
|
||||
if (checkData.length === 0) {
|
||||
return layer.msg('请选择您要导出的数据');
|
||||
}
|
||||
layer.confirm('确定导出选择的内容吗?',
|
||||
function (index) {
|
||||
var delidsStr = [];
|
||||
layui.each(checkData,
|
||||
function (index, item) {
|
||||
delidsStr.push(item.id);
|
||||
});
|
||||
layer.close(index);
|
||||
coreHelper.Post("Api/WeChatTransactionComponentGood/SelectExportExcel", { id: delidsStr }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
if (e.code === 0) {
|
||||
window.open(e.data);
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
//监听 表格复选框操作
|
||||
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||
<table class="layui-table layui-form" lay-filter="LAY-app-WeChatTransactionComponentThirdCategory-detailsForm" id="LAY-app-WeChatTransactionComponentThirdCategory-detailsForm">
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="id">序列</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.id || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="third_cat_id">类目ID</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.third_cat_id || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="third_cat_name">类目名称</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.third_cat_name || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="qualification">类目资质</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.qualification || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="qualification_type">类目资质类型【0:不需要,1:必填,2:选填】</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.qualification_type }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="product_qualification">商品资质</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.product_qualification }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="product_qualification_type">商品资质类型【0:不需要,1:必填,2:选填】</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.product_qualification_type }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="second_cat_id">二级类目ID</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.second_cat_id || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="second_cat_name">二级类目名称</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.second_cat_name || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="first_cat_id">一级类目ID</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.first_cat_id || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="first_cat_name">一级类目名称</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.first_cat_name || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="createTime">创建时间</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.createTime || '' }}
|
||||
</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-WeChatTransactionComponentThirdCategory-detailsForm');
|
||||
});
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,319 @@
|
||||
<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="{{ layui.setter.apiUrl }}Api/WeChatTransactionComponentThirdCategory/GetIndex" lay-done="layui.data.done(d);">
|
||||
|
||||
</script>
|
||||
<div class="table-body">
|
||||
<table id="LAY-app-WeChatTransactionComponentThirdCategory-tableBox" lay-filter="LAY-app-WeChatTransactionComponentThirdCategory-tableBox"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="LAY-app-WeChatTransactionComponentThirdCategory-toolbar">
|
||||
<div class="layui-form coreshop-toolbar-search-form">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="third_cat_name" placeholder="请输入类目名称" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="qualification" placeholder="请输入类目资质" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<select name="qualification_type" id="qualification_type">
|
||||
<option value="">请输入类目资质类型</option>
|
||||
<option value="0">不需要</option>
|
||||
<option value="1">必填</option>
|
||||
<option value="2">选填</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="product_qualification" placeholder="请输入商品资质" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<select name="product_qualification_type" id="product_qualification_type">
|
||||
<option value="">请输入商品资质类型</option>
|
||||
<option value="0">不需要</option>
|
||||
<option value="1">必填</option>
|
||||
<option value="2">选填</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="second_cat_name" placeholder="请输入二级类目名称" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="first_cat_name" placeholder="请输入一级类目名称" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-WeChatTransactionComponentThirdCategory-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="LAY-app-WeChatTransactionComponentThirdCategory-pagebar">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="doRefresh"><i class="layui-icon layui-icon-refresh"></i>刷新数据</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="selectExportExcel"><i class="layui-icon layui-icon-add-circle"></i>选择导出</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="queryExportExcel"><i class="layui-icon layui-icon-download-circle"></i>查询导出</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="LAY-app-WeChatTransactionComponentThirdCategory-tableBox-bar">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
|
||||
</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-WeChatTransactionComponentThirdCategory-search)',
|
||||
function (data) {
|
||||
var field = data.field;
|
||||
searchwhere = field;
|
||||
//执行重载
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentThirdCategory-tableBox', { where: field });
|
||||
});
|
||||
//数据绑定
|
||||
table.render({
|
||||
elem: '#LAY-app-WeChatTransactionComponentThirdCategory-tableBox',
|
||||
url: layui.setter.apiUrl + 'Api/WeChatTransactionComponentThirdCategory/GetPageList',
|
||||
method: 'POST',
|
||||
toolbar: '#LAY-app-WeChatTransactionComponentThirdCategory-toolbar',
|
||||
pagebar: '#LAY-app-WeChatTransactionComponentThirdCategory-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: 'third_cat_id', title: '类目ID', sort: false, width: 105 },
|
||||
{ field: 'third_cat_name', title: '类目名称', sort: false, width: 105 },
|
||||
{ field: 'qualification', title: '类目资质', sort: false },
|
||||
{
|
||||
field: 'qualification_type', title: '类目资质类型', sort: false, width: 105, templet: function (data) {
|
||||
if (data.qualification_type == 0) {
|
||||
return "不需要";
|
||||
} else if (data.qualification_type == 1) {
|
||||
return "必填";
|
||||
} else if (data.qualification_type == 2) {
|
||||
return "选填";
|
||||
}
|
||||
}
|
||||
},
|
||||
{ field: 'product_qualification', title: '商品资质', sort: false },
|
||||
{
|
||||
field: 'product_qualification_type', title: '商品资质类型', sort: false, width: 105, templet: function (data) {
|
||||
if (data.qualification_type == 0) {
|
||||
return "不需要";
|
||||
} else if (data.qualification_type == 1) {
|
||||
return "必填";
|
||||
} else if (data.qualification_type == 2) {
|
||||
return "选填";
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'second_cat_id',
|
||||
title: '二级类目',
|
||||
sort: false,
|
||||
width: 150,
|
||||
templet: function (data) {
|
||||
return data.second_cat_name + "【" + data.second_cat_id + "】";
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'first_cat_id',
|
||||
title: '一级类目',
|
||||
sort: false,
|
||||
width: 150,
|
||||
templet: function (data) {
|
||||
return data.first_cat_name + "【" + data.first_cat_id + "】";
|
||||
},
|
||||
},
|
||||
//{ field: 'second_cat_name', title: '二级类目名称', sort: false, width: 105 },
|
||||
//{ field: 'first_cat_id', title: '一级类目', sort: false, width: 65 },
|
||||
//{ field: 'first_cat_name', title: '一级类目名称', sort: false, width: 105 },
|
||||
{ field: 'createTime', title: '创建时间', width: 130, sort: false },
|
||||
{ width: 62, align: 'center', title: '操作', fixed: 'right', toolbar: '#LAY-app-WeChatTransactionComponentThirdCategory-tableBox-bar' }
|
||||
]
|
||||
]
|
||||
});
|
||||
//监听排序事件
|
||||
table.on('sort(LAY-app-WeChatTransactionComponentThirdCategory-tableBox)', function (obj) {
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentThirdCategory-tableBox', {
|
||||
initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
|
||||
where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
||||
orderField: obj.field, //排序字段
|
||||
orderDirection: obj.type //排序方式
|
||||
}
|
||||
});
|
||||
});
|
||||
//监听行双击事件
|
||||
table.on('rowDouble(LAY-app-WeChatTransactionComponentThirdCategory-tableBox)', function (obj) {
|
||||
//查看详情
|
||||
doDetails(obj);
|
||||
});
|
||||
//头工具栏事件
|
||||
table.on('pagebar(LAY-app-WeChatTransactionComponentThirdCategory-tableBox)', function (obj) {
|
||||
var checkStatus = table.checkStatus(obj.config.id);
|
||||
switch (obj.event) {
|
||||
case 'doRefresh':
|
||||
doRefresh(checkStatus);
|
||||
break;
|
||||
case 'selectExportExcel':
|
||||
doSelectExportExcel(checkStatus);
|
||||
break;
|
||||
case 'queryExportExcel':
|
||||
doQueryExportexcel();
|
||||
break;
|
||||
};
|
||||
});
|
||||
//监听工具条
|
||||
table.on('tool(LAY-app-WeChatTransactionComponentThirdCategory-tableBox)',
|
||||
function (obj) {
|
||||
if (obj.event === 'detail') {
|
||||
doDetails(obj);
|
||||
} else if (obj.event === 'del') {
|
||||
doDelete(obj);
|
||||
} else if (obj.event === 'edit') {
|
||||
doEdit(obj)
|
||||
}
|
||||
});
|
||||
//执行预览操作
|
||||
function doDetails(obj) {
|
||||
coreHelper.Post("Api/WeChatTransactionComponentThirdCategory/GetDetails", { id: obj.data.id }, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '查看详情',
|
||||
area: ['1000px', '500px'],
|
||||
id: 'LAY-popup-WeChatTransactionComponentThirdCategory-details',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('wechat/transactioncomponent/thirdcategory/details', { data: e.data }).done(function () {
|
||||
form.render();
|
||||
});
|
||||
// 禁止弹窗出现滚动条
|
||||
//$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行单个删除
|
||||
function doDelete(obj) {
|
||||
coreHelper.Post("Api/WeChatTransactionComponentThirdCategory/DoDelete", { id: obj.data.id }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentThirdCategory-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
}
|
||||
//执行批量删除
|
||||
function doRefresh(checkStatus) {
|
||||
layer.confirm('确定更新吗?更新数据后将无法恢复。',
|
||||
function (index) {
|
||||
coreHelper.Post("Api/WeChatTransactionComponentThirdCategory/DoRefresh", {}, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
table.reloadData('LAY-app-WeChatTransactionComponentThirdCategory-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
});
|
||||
}
|
||||
//执行查询条件导出excel
|
||||
function doQueryExportexcel() {
|
||||
layer.confirm('确定根据当前的查询条件导出数据吗?',
|
||||
function (index) {
|
||||
var field = searchwhere;
|
||||
coreHelper.PostForm("Api/WeChatTransactionComponentThirdCategory/QueryExportExcel", field, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
if (e.code === 0) {
|
||||
window.open(e.data);
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
//执行选择目录导出数据
|
||||
function doSelectExportExcel(checkStatus) {
|
||||
var checkData = checkStatus.data;
|
||||
if (checkData.length === 0) {
|
||||
return layer.msg('请选择您要导出的数据');
|
||||
}
|
||||
layer.confirm('确定导出选择的内容吗?',
|
||||
function (index) {
|
||||
var delidsStr = [];
|
||||
layui.each(checkData,
|
||||
function (index, item) {
|
||||
delidsStr.push(item.id);
|
||||
});
|
||||
layer.close(index);
|
||||
coreHelper.Post("Api/WeChatTransactionComponentThirdCategory/SelectExportExcel", { id: delidsStr }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
if (e.code === 0) {
|
||||
window.open(e.data);
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
laydate.render({
|
||||
elem: '#searchTime-WeChatTransactionComponentThirdCategory-createTime',
|
||||
type: 'datetime',
|
||||
range: '到',
|
||||
});
|
||||
//重载form
|
||||
form.render();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user