<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/CoreCmsDistribution/GetIndex" lay-done="layui.data.done(d);">
|
|
</script>
|
<div class="table-body">
|
<table id="LAY-app-CoreCmsDistribution-tableBox" lay-filter="LAY-app-CoreCmsDistribution-tableBox"></table>
|
</div>
|
|
<script type="text/html" id="LAY-app-CoreCmsDistribution-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="number" name="id" placeholder="经销商序列" class="layui-input">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<div class="layui-input-inline">
|
<input type="text" name="name" placeholder="请输入经销商名称" class="layui-input">
|
</div>
|
</div>
|
|
<div class="layui-inline">
|
<div class="layui-input-inline">
|
<input type="text" name="mobile" placeholder="请输入手机号" class="layui-input">
|
</div>
|
</div>
|
<!-- <div class="layui-inline">
|
<div class="layui-input-inline">
|
<input type="text" name="weixin" placeholder="请输入微信号" class="layui-input">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<div class="layui-input-inline">
|
<input type="text" name="qq" placeholder="请输入qq号" class="layui-input">
|
</div>
|
</div> -->
|
<div class="layui-inline">
|
<div class="layui-input-inline">
|
<input type="text" name="storeName" placeholder="请输入店铺名称" class="layui-input">
|
</div>
|
</div>
|
|
<div class="layui-inline">
|
<div class="layui-input-inline">
|
<select name="verifyStatus">
|
<option value="">请选择审核状态</option>
|
{{# layui.each(indexData.distributionVerifyStatus, function(index, item){ }}
|
<option value="{{ item.value }}">{{ item.description }}</option>
|
{{# }); }}
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<div class="layui-input-inline">
|
<select name="gradeId">
|
<option value="">请选择经销等级</option>
|
{{# layui.each(indexData.grades, function(index, item){ }}
|
<option value="{{ item.id }}">{{ item.name }}</option>
|
{{# }); }}
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<div class="layui-input-inline">
|
<select name="userGradeId">
|
<option value="">请选择用户等级</option>
|
{{# layui.each(indexData.userGrades, function(index, item){ }}
|
<option value="{{ item.id }}">{{ item.title }}</option>
|
{{# }); }}
|
</select>
|
</div>
|
</div>
|
<!-- <div class="layui-inline">
|
<div class="layui-input-inline">
|
<input type="number" name="userId" placeholder="用户序列" class="layui-input">
|
</div>
|
</div> -->
|
<div class="layui-inline">
|
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-CoreCmsDistribution-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
</div>
|
</div>
|
</div>
|
</script>
|
|
<script type="text/html" id="LAY-app-CoreCmsDistribution-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-CoreCmsDistribution-tableBox-bar">
|
<!-- <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="qrcode">小程序码</a> -->
|
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="achievement">推广费</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="#CoreCmsDistributionTbDelDrop{{d.LAY_NUM}}" no-shade="true">删除</a>
|
<div class="dropdown-menu-nav dropdown-popconfirm dropdown-top-right layui-hide" id="CoreCmsDistributionTbDelDrop{{d.LAY_NUM}}"
|
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>
|
确定要删除【{{d.name}}】吗?
|
</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;
|
|
//重载form
|
form.render();
|
var searchwhere;
|
//监听搜索
|
form.on('submit(LAY-app-CoreCmsDistribution-search)',
|
function (data) {
|
var field = data.field;
|
searchwhere = field;
|
//执行重载
|
table.reloadData('LAY-app-CoreCmsDistribution-tableBox', { where: field });
|
});
|
//数据绑定
|
table.render({
|
elem: '#LAY-app-CoreCmsDistribution-tableBox',
|
url: layui.setter.apiUrl + 'Api/CoreCmsDistribution/GetPageList',
|
method: 'POST',
|
toolbar: '#LAY-app-CoreCmsDistribution-toolbar',
|
pagebar: '#LAY-app-CoreCmsDistribution-pagebar',
|
className: 'pagebarbox',
|
defaultToolbar: ['filter', 'print', 'exports'],
|
height: 'full-127',//无面包屑127,搜索框189,1行62
|
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: 'userId', title: '用户序列', sort: false, width: 65 },
|
{
|
field: 'userGradeId', title: '用户等级', sort: false, width: 90, templet: function (data) {
|
for (var i = 0; i < d.data.userGrades.length; i++) {
|
if (d.data.userGrades[i].id == data.userGradeId) {
|
return d.data.userGrades[i].title;
|
}
|
}
|
}
|
},
|
{ field: 'name', title: '经销商名称', sort: false, width: 105 },
|
{
|
field: 'gradeId', title: '经销等级', sort: false, width: 90, templet: function (data) {
|
for (var i = 0; i < d.data.grades.length; i++) {
|
if (d.data.grades[i].id == data.gradeId) {
|
return d.data.grades[i].name;
|
}
|
}
|
}
|
},
|
//{ field: 'gradeId', title: '经销等级', sort: false, width: 105 },
|
{ field: 'mobile', title: '手机号', sort: false, width: 100 },
|
// { field: 'weixin', title: '微信号', sort: false, width: 100 },
|
{ field: 'profession', title: '行业', sort: false, width: 100 },
|
// { field: 'qq', title: 'qq号', sort: false, width: 90 },
|
{ field: 'sales', title: '年营业额(元)', sort: false, width: 100 },
|
{ field: 'storeName', title: '店铺名称', sort: false },
|
|
{ field: 'storeCoordinate', title: '店铺坐标', sort: false },
|
// {
|
// field: 'storeLogo', title: 'Logo', sort: false, width: 60, templet: function (d) {
|
// if (d.storeLogo) {
|
// return '<a href="javascript:void(0);" onclick=layui.coreHelper.viewImage("' + d.storeLogo + '")><image style="max-width:28px;max-height:28px;" src="' + d.storeLogo + '" /></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: 'storeBanner', title: '门头图片', sort: false, width: 100, templet: function (d) {
|
if (d.storeBanner) {
|
return '<a href="javascript:void(0);" onclick=layui.coreHelper.viewImage("' + d.storeBanner + '")><image style="max-width:28px;max-height:28px;" src="' + d.storeBanner + '" /></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: 'distributionAchievementTotals', title: '历史推广费总和(元)', sort: false, width: 100 },
|
//{ field: 'storeDesc', title: '店铺简介', sort: false, width: 105 },
|
{
|
field: 'verifyStatus', title: '审核状态', sort: false, width: 80, templet: function (data) {
|
for (var i = 0; i < d.data.distributionVerifyStatus.length; i++) {
|
if (d.data.distributionVerifyStatus[i].value == data.verifyStatus) {
|
return d.data.distributionVerifyStatus[i].description;
|
}
|
}
|
}
|
},
|
{ field: 'createTime', title: '创建时间', width: 130, sort: false },
|
{ field: 'updateTime', title: '更新时间', width: 130, sort: false },
|
{ field: 'verifyTime', title: '审核时间', width: 130, sort: false },
|
//{ field: 'isDelete', title: '是否删除', width: 95, templet: '#switch_isDelete', sort: false, unresize: true },
|
{ width: 222, align: 'center', title: '操作', fixed: 'right', toolbar: '#LAY-app-CoreCmsDistribution-tableBox-bar' }
|
]
|
]
|
});
|
//监听排序事件
|
table.on('sort(LAY-app-CoreCmsDistribution-tableBox)', function (obj) {
|
table.reloadData('LAY-app-CoreCmsDistribution-tableBox', {
|
initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
|
where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
orderField: obj.field, //排序字段
|
orderDirection: obj.type //排序方式
|
}
|
});
|
});
|
//监听行双击事件
|
table.on('rowDouble(LAY-app-CoreCmsDistribution-tableBox)', function (obj) {
|
//查看详情
|
doDetails(obj);
|
});
|
//头工具栏事件
|
table.on('pagebar(LAY-app-CoreCmsDistribution-tableBox)', function (obj) {
|
var checkStatus = table.checkStatus(obj.config.id);
|
switch (obj.event) {
|
case 'addData':
|
doCreate();
|
break;
|
};
|
});
|
//监听工具条
|
table.on('tool(LAY-app-CoreCmsDistribution-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 === 'qrcode') {
|
doQrCode(obj)
|
} else if (obj.event === 'achievement') {
|
achievement(obj)
|
}
|
});
|
//执行创建操作
|
function doCreate() {
|
coreHelper.Post("Api/CoreCmsDistribution/GetCreate", null, function (e) {
|
if (e.code === 0) {
|
admin.popup({
|
shadeClose: false,
|
title: '创建数据',
|
area: ['640px', '300px'],
|
id: 'LAY-popup-CoreCmsDistribution-create',
|
success: function (layero, index) {
|
view(this.id).render('distribution/distributor/create', { data: e.data }).done(function () {
|
//监听提交
|
form.on('submit(LAY-app-CoreCmsDistribution-createForm-submit)',
|
function (data) {
|
var field = data.field; //获取提交的字段
|
|
if (debug) { console.log(field); } //开启调试返回数据
|
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
coreHelper.Post("Api/CoreCmsDistribution/DoCreate", field, function (e) {
|
console.log(e)
|
if (e.code === 0) {
|
layui.table.reloadData('LAY-app-CoreCmsDistribution-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-CoreCmsDistribution-createForm-submit").click();
|
}
|
});
|
} else {
|
layer.msg(e.msg);
|
}
|
});
|
}
|
//执行编辑操作
|
function doEdit(obj) {
|
coreHelper.Post("Api/CoreCmsDistribution/GetEdit", { id: obj.data.id }, function (e) {
|
if (e.code === 0) {
|
admin.popup({
|
shadeClose: false,
|
title: '编辑数据',
|
area: ['640px', '300px'],
|
id: 'LAY-popup-CoreCmsDistribution-edit',
|
success: function (layero, index) {
|
view(this.id).render('distribution/distributor/edit', { data: e.data }).done(function () {
|
//监听提交
|
form.on('submit(LAY-app-CoreCmsDistribution-editForm-submit)',
|
function (data) {
|
var field = data.field; //获取提交的字段
|
|
field.isDelete = field.isDelete == 'on';
|
|
if (!field.gradeId) {
|
return layer.msg('请选择你要设置的等级');
|
}
|
|
if (debug) { console.log(field); } //开启调试返回数据
|
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
coreHelper.Post("Api/CoreCmsDistribution/DoEdit", field, function (e) {
|
console.log(e)
|
if (e.code === 0) {
|
layui.table.reloadData('LAY-app-CoreCmsDistribution-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-CoreCmsDistribution-editForm-submit").click();
|
}
|
});
|
} else {
|
layer.msg(e.msg);
|
}
|
});
|
}
|
//执行预览操作
|
function doDetails(obj) {
|
coreHelper.Post("Api/CoreCmsDistribution/GetDetails", { id: obj.data.id }, function (e) {
|
if (e.code === 0) {
|
admin.popup({
|
shadeClose: false,
|
title: '查看详情',
|
area: ['700px', '550px'],
|
id: 'LAY-popup-CoreCmsDistribution-details',
|
success: function (layero, index) {
|
view(this.id).render('distribution/distributor/details', { data: e.data }).done(function () {
|
form.render();
|
});
|
// 禁止弹窗出现滚动条
|
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
}
|
});
|
} else {
|
layer.msg(e.msg);
|
}
|
});
|
}
|
//执行预览操作
|
function achievement(obj) {
|
coreHelper.Post("Api/CoreCmsDistribution/GetDetailsAchievement", { id: obj.data.id }, function (e) {
|
if (e.code === 0) {
|
admin.popup({
|
shadeClose: false,
|
title: '查看详情',
|
area: ['700px', '550px'],
|
id: 'LAY-popup-CoreCmsDistribution-detailsAchievement',
|
success: function (layero, index) {
|
view(this.id).render('distribution/distributor/achievementdetails', { data: e.data }).done(function () {
|
form.render();
|
});
|
// 禁止弹窗出现滚动条
|
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
}
|
});
|
} else {
|
layer.msg(e.msg);
|
}
|
});
|
}
|
|
//获取小程序码
|
function doQrCode(obj) {
|
coreHelper.Post("Api/Tools/GetDistributionWxCode", { id: obj.data.userId }, function (e) {
|
if (e.code === 0) {
|
admin.popup({
|
shadeClose: false,
|
title: '查看小程序码',
|
area: ['380px', '480px'],
|
id: 'LAY-popup-CoreCmsDistributor-QrCode',
|
success: function (layero, index) {
|
view(this.id).render('distribution/distributor/qrCode', { data: e.data }).done(function () {
|
form.render();
|
});
|
}
|
});
|
} else {
|
layer.msg(e.msg);
|
}
|
});
|
}
|
|
//执行单个删除
|
function doDelete(obj) {
|
//console.log(obj.data.id);
|
coreHelper.Post("Api/CoreCmsDistribution/DoDelete", { id: obj.data.id }, function (e) {
|
if (debug) { console.log(e); } //开启调试返回数据
|
table.reloadData('LAY-app-CoreCmsDistribution-tableBox');
|
layer.msg(e.msg);
|
});
|
}
|
|
//监听 表格复选框操作
|
|
layui.form.on('switch(switch_isDelete)', function (obj) {
|
coreHelper.Post("Api/CoreCmsDistribution/DoSetisDelete", { id: this.value, data: obj.elem.checked }, function (e) {
|
if (debug) { console.log(e); } //开启调试返回数据
|
//table.reloadData('LAY-app-CoreCmsDistribution-tableBox');
|
layer.msg(e.msg);
|
});
|
});
|
|
});
|
};
|
</script>
|
|
<!--设置是否删除-->
|
<script type="text/html" id="switch_isDelete">
|
<input type="checkbox" name="switch_isDelete" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="switch_isDelete" {{ d.isDelete ? 'checked' : '' }}>
|
</script>
|