Commit 286343ce by 胡悦

商户添加搜索条件

1 parent e23acfa0
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh"> <html lang="zh">
<head>
<meta charset="utf-8" />
<meta content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="广联帐户管理中心-员工管理" />
<meta name="author" content="GLSX Web Team" />
<meta name="keywords" itemprop="keywords" content="广联,帐户管理,员工管理" />
<link rel="stylesheet" type="text/css" href="/css/main.css" />
<style>
.h20 {
height: 20px;
}
.mb5 {
margin-bottom: 5px;
}
.merchant .layui-table {
margin: 0;
width: 100%;
}
.merchant #searchForm .layui-inline {
margin-bottom: 5px;
vertical-align: top;
}
.layui-btn-xs {
cursor: pointer;
}
.layui-form-label {
width: 130px;
}
.accountLevel,
.customerState,
.accountType,
.mode {
margin-left: 30px;
}
.input-before-name {
width: 80px;
text-align: right;
display: inline-block;
}
.commonInput { <head>
width: 260px; <meta charset="utf-8" />
} <meta content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
#relevancyBtn { <meta name="description" content="广联帐户管理中心-员工管理" />
display: flex; <meta name="author" content="GLSX Web Team" />
align-items: center; <meta name="keywords" itemprop="keywords" content="广联,帐户管理,员工管理" />
} <link rel="stylesheet" type="text/css" href="/css/main.css" />
<style>
.relevancyImg { .h20 {
width: 20px; height: 20px;
height: 20px; }
margin-right: 5px;
} .mb5 {
margin-bottom: 5px;
.hide { }
display: none;
} .merchant .layui-table {
margin: 0;
.show { width: 100%;
display: inline-block; }
}
.merchant #searchForm .layui-inline {
.merchantTable .layui-table-cell { margin-bottom: 5px;
/* height: auto; */ vertical-align: top;
/* line-height: 88px; */ }
white-space: normal;
overflow: hidden; .layui-btn-xs {
-webkit-line-clamp: 4; cursor: pointer;
-webkit-box-orient: vertical; }
display: -webkit-box;
word-break: break-all; .layui-form-label {
} width: 130px;
.input-before-name { }
width: 120px;
} .accountLevel,
</style> .customerState,
<title>商户管理</title> .accountType,
</head> .mode {
margin-left: 30px;
<body> }
<div class="merchant" id="app">
<main> .input-before-name {
<div class="context-block"> width: 80px;
<div class="search-block"> text-align: right;
<div class="h20"></div> display: inline-block;
<form class="layui-form" lay-filter="searchFilter" id="searchForm"> }
<div class="layui-inline hide" id="operateEl">
<button class="layui-btn mb5 createBtn" id="addBtn"> .commonInput {
<i class="layui-icon layui-icon-addition"></i> width: 260px;
<span>创建商户</span> }
</button>
</div> #relevancyBtn {
<!-- <div class="hide"> --> display: flex;
<div id="relevancyEl" class="layui-inline hide"> align-items: center;
<button class="layui-btn mb5" id="relevancyBtn"> }
<img class="relevancyImg" src="../../css/img/relevancy.png" alt="" />
门店账户关联企微 .relevancyImg {
</button> width: 20px;
</div> height: 20px;
margin-right: 5px;
}
.hide {
display: none;
}
.show {
display: inline-block;
}
.merchantTable .layui-table-cell {
/* height: auto; */
/* line-height: 88px; */
white-space: normal;
overflow: hidden;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
display: -webkit-box;
word-break: break-all;
}
.input-before-name {
width: 120px;
}
input[type=number] {
-moz-appearance: textfield;
}
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
</style>
<title>商户管理</title>
</head>
<body>
<div class="merchant" id="app">
<main>
<div class="context-block">
<div class="search-block">
<div class="h20"></div>
<form class="layui-form" lay-filter="searchFilter" id="searchForm">
<div class="layui-inline hide" id="operateEl">
<button class="layui-btn mb5 createBtn" id="addBtn">
<i class="layui-icon layui-icon-addition"></i>
<span>创建商户</span>
</button>
</div>
<!-- <div class="hide"> -->
<div id="relevancyEl" class="layui-inline hide">
<button class="layui-btn mb5" id="relevancyBtn">
<img class="relevancyImg" src="../../css/img/relevancy.png" alt="" />
门店账户关联企微
</button>
</div>
<!-- </div> --> <!-- </div> -->
<div class="layui-inline singleRow"> <div class="layui-inline singleRow">
<div id="relevancySearch" class="layui-inline"> <div id="relevancySearch" class="layui-inline">
<div class="layui-inline channel"> <div class="layui-inline channel">
<label class="layui-form-label">是否已关联企微:</label> <label class="layui-form-label">是否已关联企微:</label>
<div class="layui-input-inline" style="width: 246px"> <div class="layui-input-inline" style="width: 246px">
<select name="isRelevance"> <select name="isRelevance">
<option value="0">全部</option> <option value="0">全部</option>
<option value="1">已关联</option> <option value="1">已关联</option>
<option value="2">未关联</option> <option value="2">未关联</option>
</select>
</div>
</div>
</div>
<div id="channelBox" class="hide" style="display: inline-block">
<div class="layui-inline">
<label class="layui-form-label">渠道:</label>
<div class="layui-input-inline" style="width: 246px">
<select name="channelId" id="channelIdEl">
<option value="">全部</option>
</select>
</div>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">账户等级:</label>
<div class="layui-input-inline" style="width: 246px;">
<select name="merchantAccountLevel" id="accountLevelEl">
<option value="">全部</option>
</select> </select>
</div> </div>
</div> </div>
</div>
<div id="channelBox" class="hide" style="display: inline-block">
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">账户状态:</label> <label class="layui-form-label">渠道:</label>
<div class="layui-input-inline" style="width: 246px"> <div class="layui-input-inline" style="width: 246px">
<select name="status" id="searchStatusEl"> <select name="channelId" id="channelIdEl">
<option value="">全部</option> <option value="">全部</option>
</select> </select>
</div> </div>
</div> </div>
<div class="layui-inline loginName" style="margin-left: 40px;"> </div>
<div class="layui-input-inline updateSelectAngle" style="width: 120px"> <div class="layui-inline">
<select name="accountOrPhone" lay-filter="nameFilter"> <label class="layui-form-label">账户等级:</label>
<option value="0">登录账号名</option> <div class="layui-input-inline" style="width: 246px;">
<option value="1">手机号</option> <select name="merchantAccountLevel" id="accountLevelEl">
</select> <option value="">全部</option>
</div> </select>
<!-- margin-left: -5px -->
<div class="layui-input-inline" style="width: 246px; margin-left: -4px">
<input
class="layui-input"
type="text"
placeholder="请输入"
name="merchantLoginAccount"
id="updateCircleAngle"
onkeydown="if (event.keyCode == 13) {event.keyCode = 0;event.returnValue = false;}"
/>
</div>
</div> </div>
<div id="accountType" class="layui-inline hide"> </div>
<label class="layui-form-label">账户类型:</label> <div class="layui-inline">
<div class="layui-input-inline" style="width: 246px;"> <label class="layui-form-label">账户状态:</label>
<select name="accounttypeId" id="accountTypeIdEl"> <div class="layui-input-inline" style="width: 246px">
<option value="">全部</option> <select name="status" id="searchStatusEl">
</select> <option value="">全部</option>
</div> </select>
</div> </div>
<div id="model" class="layui-inline hide"> </div>
<label class="layui-form-label">模式:</label> <div class="layui-inline loginName" style="margin-left: 40px;">
<div class="layui-input-inline" style="width: 246px"> <div class="layui-input-inline updateSelectAngle" style="width: 120px">
<select name="merchantModel" id="searchModelEl"> <select name="accountOrPhone" lay-filter="nameFilter">
<option value="">全部</option> <option value="0">登录账号名</option>
</select> <option value="1">手机号</option>
</div> </select>
</div> </div>
<div id="parentMerchant" class="layui-inline hide"> <!-- margin-left: -5px -->
<label class="layui-form-label">上级商户:</label> <div class="layui-input-inline" style="width: 246px; margin-left: -4px">
<div class="layui-input-inline" style="width: 246px"> <input class="layui-input" type="text" placeholder="请输入" name="merchantLoginAccount"
<input class="layui-input" type="text" placeholder="请输入" name="parentMerchant" /> id="updateCircleAngle"
</div> onkeydown="if (event.keyCode == 13) {event.keyCode = 0;event.returnValue = false;}" />
</div> </div>
<div style="display: inline-flex; justify-content: space-between"> </div>
<div class="layui-inline customerStatus"> <div id="accountType" class="layui-inline hide">
<div class="layui-input-inline"> <label class="layui-form-label">账户类型:</label>
<input <div class="layui-input-inline" style="width: 246px;">
class="layui-input" <select name="accounttypeId" id="accountTypeIdEl">
type="text" <option value="">全部</option>
style="width: 367px; margin-left: 40px;" </select>
name="merchantName" </div>
placeholder="请输入商户名称/关联的企业微信名" </div>
onkeydown="if (event.keyCode == 13) {event.keyCode = 0;event.returnValue = false;}" <div id="model" class="layui-inline hide">
/> <label class="layui-form-label">模式:</label>
</div> <div class="layui-input-inline" style="width: 246px">
</div> <select name="merchantModel" id="searchModelEl">
<option value="">全部</option>
</select>
</div>
</div>
<div id="parentMerchant" class="layui-inline hide">
<label class="layui-form-label">上级商户:</label>
<div class="layui-input-inline" style="width: 246px">
<input class="layui-input" type="text" placeholder="请输入" name="parentMerchant" />
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">上级商户号:</label>
<div class="layui-input-inline" style="width: 246px">
<input class="layui-input" maxlength="11" type="number" placeholder="请输入" name="parentMerchantNo" />
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">商户号:</label>
<div class="layui-input-inline" style="width: 246px">
<input class="layui-input" maxlength="11" type="number" placeholder="请输入" name="merchantNo" />
</div> </div>
</div>
<div class="layui-inline searchInputBtn" style="float: right;"> <div style="display: inline-flex; justify-content: space-between">
<button class="layui-btn" lay-submit lay-filter="searchSubmit">查询</button> <div class="layui-inline customerStatus">
<div class="layui-input-inline">
<input class="layui-input" type="text" style="width: 367px; margin-left: 40px;" name="merchantName"
placeholder="请输入商户名称/关联的企业微信名"
onkeydown="if (event.keyCode == 13) {event.keyCode = 0;event.returnValue = false;}" />
</div>
</div> </div>
</div> </div>
</form>
<div class="table-page merchantTable"> <div class="layui-inline searchInputBtn" style="float: right;">
<table class="layui-table" id="merchantTable" lay-filter="merchant-table-filter"></table> <button class="layui-btn" lay-submit lay-filter="searchSubmit">查询</button>
<div id="merchantPage" class="align-left"></div> </div>
</div> </div>
</form>
<div class="table-page merchantTable">
<table class="layui-table" id="merchantTable" lay-filter="merchant-table-filter"></table>
<div id="merchantPage" class="align-left"></div>
</div> </div>
</div> </div>
</main> </div>
</div> </main>
</div>
<script src="https://www.layuicdn.com/layui/layui.js"></script> <script src="https://www.layuicdn.com/layui/layui.js"></script>
<script src="/js/load.js"></script> <script src="/js/load.js"></script>
<script type="text/html" id="accountTypeTpl"> <script type="text/html" id="accountTypeTpl">
<ul> <ul>
{{# var accountTypes=d.accountTypeNames.split(",")}} {{# }} {{# if((d.accountTypeNames)){ }} {{# layui.each(accountTypes,function(index,item){ }} {{# var accountTypes=d.accountTypeNames.split(",")}} {{# }} {{# if((d.accountTypeNames)){ }} {{# layui.each(accountTypes,function(index,item){ }}
<li><span>{{item}}</span></li> <li><span>{{item}}</span></li>
...@@ -232,7 +246,7 @@ ...@@ -232,7 +246,7 @@
{{# } }} {{# } }}
</ul> </ul>
</script> </script>
<script type="text/html" id="merchantBtns"> <script type="text/html" id="merchantBtns">
<div> <div>
<a class="layui-btn-xs" lay-event="handleDetail">查看</a> <a class="layui-btn-xs" lay-event="handleDetail">查看</a>
{{# if((d.btn.edit)){ }} {{# if((d.btn.edit)){ }}
...@@ -250,644 +264,645 @@ ...@@ -250,644 +264,645 @@
{{# } }} {{# } }}
</div> </div>
</script> </script>
<script> <script>
layui.use(['gtree', 'request', 'helper', 'table', 'laypage', 'layer'], function() { layui.use(['gtree', 'request', 'helper', 'table', 'laypage', 'layer'], function () {
var tree = layui.gtree var tree = layui.gtree
var request = layui.request var request = layui.request
var table = layui.table var table = layui.table
var laypage = layui.laypage var laypage = layui.laypage
var form = layui.form var form = layui.form
var $ = layui.$ var $ = layui.$
var helper = layui.helper var helper = layui.helper
var accountInfo = helper.store.get('accountInfo') var accountInfo = helper.store.get('accountInfo')
window.isDxternal = accountInfo ? 1 : 2 // 1 SCRM, default 运营平台 window.isDxternal = accountInfo ? 1 : 2 // 1 SCRM, default 运营平台
var baseData = { var baseData = {
statusList: [], statusList: [],
channelList: [], channelList: [],
accountLevelList: [], accountLevelList: [],
accountTypeList: [], accountTypeList: [],
modelList: [] modelList: []
} }
var page = { var page = {
pageNum: 1, pageNum: 1,
pageSize: 10 pageSize: 10
} }
var pageOptions = { var pageOptions = {
elem: 'merchantPage', elem: 'merchantPage',
groups: 5, groups: 5,
layout: ['count', 'page', 'skip'], layout: ['count', 'page', 'skip'],
jump: function(obj, first) { jump: function (obj, first) {
//obj包含了当前分页的所有参数,比如: //obj包含了当前分页的所有参数,比如:
// console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。 // console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。
// console.log(obj.limit); //得到每页显示的条数 // console.log(obj.limit); //得到每页显示的条数
page.pageNum = obj.curr page.pageNum = obj.curr
page.pageSize = obj.limit page.pageSize = obj.limit
//首次不执行 //首次不执行
if (!first) { if (!first) {
//do something //do something
getTabelList() getTabelList()
}
} }
} }
var cols = [ }
{ var cols = [
field: 'index', {
title: '序号', field: 'index',
align: 'center', title: '序号',
width: 60 align: 'center',
}, width: 60
{ },
field: 'merchantNo', {
title: '商户号', field: 'merchantNo',
align: 'center', title: '商户号',
width: 100 align: 'center',
}, width: 100
{ },
field: 'merchantName', {
title: '商户名称', field: 'merchantName',
align: 'center', title: '商户名称',
width: 130 align: 'center',
}, width: 130
{ },
field: 'merchantModelName', {
title: '模式', field: 'merchantModelName',
align: 'center', title: '模式',
width: 130 align: 'center',
}, width: 130
{ },
field: 'accountTypeNames', {
title: '账户类型', field: 'accountTypeNames',
align: 'left', title: '账户类型',
width: 140, align: 'left',
templet: '#accountTypeTpl' width: 140,
}, templet: '#accountTypeTpl'
{ },
field: 'merchantLoginAccount', {
title: '登录账户', field: 'merchantLoginAccount',
align: 'center', title: '登录账户',
width: 108 align: 'center',
}, width: 108
{ },
field: 'accountLevelName', {
title: '账户等级', field: 'accountLevelName',
align: 'center', title: '账户等级',
width: 100 align: 'center',
}, width: 100
{ },
field: 'parentMerchant', {
title: '上级商户', field: 'parentMerchant',
align: 'center', title: '上级商户',
width: 120 align: 'center',
}, width: 120
{ },
field: 'statusName', {
title: '账户状态', field: 'statusName',
align: 'center', title: '账户状态',
width: 100 align: 'center',
}, width: 100
{ },
field: 'merchantLegalPerson', {
title: '联系人', field: 'merchantLegalPerson',
align: 'center', title: '联系人',
width: 100 align: 'center',
}, width: 100
{ },
field: 'merchantLegalPersonPhone', {
title: '手机号', field: 'merchantLegalPersonPhone',
align: 'center', title: '手机号',
width: 120 align: 'center',
}, width: 120
{ },
field: 'entmicroName', {
title: '关联的企业微信', field: 'entmicroName',
align: 'center', title: '关联的企业微信',
width: 130 align: 'center',
// }, { width: 130
// field: 'merchantAddress', // }, {
// title: '商户地址', // field: 'merchantAddress',
// align: 'center', // title: '商户地址',
// width: 160 // align: 'center',
}, // width: 160
{ },
field: 'updatedTime', {
title: '更新时间', field: 'updatedTime',
align: 'center', title: '更新时间',
width: 90 align: 'center',
}, width: 90
{ },
align: 'left', {
title: '操作', align: 'left',
toolbar: '#merchantBtns', title: '操作',
width: 230, toolbar: '#merchantBtns',
fixed: 'right' width: 230,
// }, fixed: 'right'
// { // },
// align: 'left', // {
// title: '账户开关', // align: 'left',
// toolbar: '#vaildPeriod', // title: '账户开关',
// width: 150, // toolbar: '#vaildPeriod',
// fixed: 'right' // width: 150,
} // fixed: 'right'
] }
var colums = [ ]
{ var colums = [
field: 'index', {
title: '序号', field: 'index',
align: 'center', title: '序号',
width: 60 align: 'center',
}, width: 60
{ },
field: 'merchantName', {
title: '商户名称', field: 'merchantName',
align: 'center', title: '商户名称',
width: 150 align: 'center',
}, width: 150
{ },
field: 'entmicroName', {
title: '关联的企业微信', field: 'entmicroName',
align: 'center', title: '关联的企业微信',
width: 130 align: 'center',
}, width: 130
{ },
field: 'accountTypeNames', {
title: '账户类型', field: 'accountTypeNames',
align: 'center', title: '账户类型',
width: 150, align: 'center',
templet: '#accountTypeTpl' width: 150,
}, templet: '#accountTypeTpl'
{ },
field: 'merchantLoginAccount', {
title: '登录账户', field: 'merchantLoginAccount',
align: 'center', title: '登录账户',
width: 180 align: 'center',
}, width: 180
{ },
field: 'accountLevelName', {
title: '账户等级', field: 'accountLevelName',
align: 'center', title: '账户等级',
width: 100 align: 'center',
}, width: 100
{ },
field: 'parentMerchant', {
title: '上级商户', field: 'parentMerchant',
align: 'center', title: '上级商户',
width: 100 align: 'center',
}, width: 100
{ },
field: 'statusName', {
title: '账户状态', field: 'statusName',
align: 'center', title: '账户状态',
width: 100 align: 'center',
}, width: 100
{ },
field: 'merchantLegalPerson', {
title: '联系人', field: 'merchantLegalPerson',
align: 'center', title: '联系人',
width: 100 align: 'center',
}, width: 100
{ },
field: 'merchantLegalPersonPhone', {
title: '手机号', field: 'merchantLegalPersonPhone',
align: 'center', title: '手机号',
width: 120 align: 'center',
}, width: 120
{ },
field: 'updatedTime', {
title: '更新时间', field: 'updatedTime',
align: 'center', title: '更新时间',
width: 180 align: 'center',
}, width: 180
{ },
align: 'center', {
title: '操作', align: 'center',
toolbar: '#merchantBtns', title: '操作',
width: 150, toolbar: '#merchantBtns',
fixed: 'right' width: 150,
} fixed: 'right'
] }
]
var merchantTable = table.render({
elem: '#merchantTable', var merchantTable = table.render({
page: false, elem: '#merchantTable',
skin: 'nob', page: false,
height: 'full-300', skin: 'nob',
cols: window.isDxternal != 1 ? [cols] : [colums], height: 'full-300',
done: function() { cols: window.isDxternal != 1 ? [cols] : [colums],
$("[data-field='lowerHairPath']").css('display', 'none') done: function () {
$('.layui-table-main tr').each(function(index, val) { $("[data-field='lowerHairPath']").css('display', 'none')
$($('.layui-table-fixed-l .layui-table-body tbody tr')[index]).height($(val).height()) $('.layui-table-main tr').each(function (index, val) {
$($('.layui-table-fixed-r .layui-table-body tbody tr')[index]).height($(val).height()) $($('.layui-table-fixed-l .layui-table-body tbody tr')[index]).height($(val).height())
}) $($('.layui-table-fixed-r .layui-table-body tbody tr')[index]).height($(val).height())
//动态监听表头高度变化,冻结行跟着改变高度 })
$('.layui-table-header tr').resize(function() { //动态监听表头高度变化,冻结行跟着改变高度
$('.layui-table-header tr').each(function(index, val) { $('.layui-table-header tr').resize(function () {
$($('.layui-table-fixed .layui-table-header table tr')[index]).height($(val).height()) $('.layui-table-header tr').each(function (index, val) {
})
})
//初始化高度,使得冻结行表头高度一致
$('.layui-table-header tr').each(function(index, val) {
$($('.layui-table-fixed .layui-table-header table tr')[index]).height($(val).height()) $($('.layui-table-fixed .layui-table-header table tr')[index]).height($(val).height())
}) })
//动态监听表体高度变化,冻结行跟着改变高度 })
$('.layui-table-body tr').resize(function() { //初始化高度,使得冻结行表头高度一致
$('.layui-table-body tr').each(function(index, val) { $('.layui-table-header tr').each(function (index, val) {
$($('.layui-table-fixed .layui-table-body table tr')[index]).height($(val).height()) $($('.layui-table-fixed .layui-table-header table tr')[index]).height($(val).height())
}) })
}) //动态监听表体高度变化,冻结行跟着改变高度
//初始化高度,使得冻结行表体高度一致 $('.layui-table-body tr').resize(function () {
$('.layui-table-body tr').each(function(index, val) { $('.layui-table-body tr').each(function (index, val) {
$($('.layui-table-fixed .layui-table-body table tr')[index]).height($(val).height()) $($('.layui-table-fixed .layui-table-body table tr')[index]).height($(val).height())
}) })
} })
}) //初始化高度,使得冻结行表体高度一致
$('.layui-table-body tr').each(function (index, val) {
$($('.layui-table-fixed .layui-table-body table tr')[index]).height($(val).height())
})
}
})
table.on('tool(merchant-table-filter)', function(obj) { table.on('tool(merchant-table-filter)', function (obj) {
var eventName = obj.event var eventName = obj.event
var row = obj.data var row = obj.data
switch (eventName) { switch (eventName) {
// 查看 // 查看
case 'handleDetail': case 'handleDetail':
go('merchant', 'detail', { go('merchant', 'detail', {
merchantId: row.id merchantId: row.id
}) })
break break
// 修改 // 修改
case 'handleEdit': case 'handleEdit':
// editLevel - 1-创建新商户;2-创建子商户;3-修改 // editLevel - 1-创建新商户;2-创建子商户;3-修改
// step - 1-基本信息;2-权限树 // step - 1-基本信息;2-权限树
// merchantAccountLevel 账户等级(1-工厂;2-省代;3-市代;4-门店) // merchantAccountLevel 账户等级(1-工厂;2-省代;3-市代;4-门店)
go('merchant', 'edit', { go('merchant', 'edit', {
editLevel: 3, editLevel: 3,
id: row.id, id: row.id,
parentId: row.parentId, parentId: row.parentId,
isFactory: row.merchantAccountLevel == 1, isFactory: row.merchantAccountLevel == 1,
step: 1, step: 1,
model: row.merchantModel, model: row.merchantModel,
status: row.status, status: row.status,
merchantAccountLevel: row.merchantAccountLevel merchantAccountLevel: row.merchantAccountLevel
}) })
break break
case 'handleAuthority': case 'handleAuthority':
// editLevel - 1-创建新商户;2-创建子商户;3-修改 // editLevel - 1-创建新商户;2-创建子商户;3-修改
// step - 1-基本信息;2-权限树 // step - 1-基本信息;2-权限树
// merchantAccountLevel 账户等级 // merchantAccountLevel 账户等级
go('merchant', 'edit', { go('merchant', 'edit', {
editLevel: 3, editLevel: 3,
id: row.id, id: row.id,
parentId: row.parentId, parentId: row.parentId,
isFactory: row.merchantAccountLevel == 1, isFactory: row.merchantAccountLevel == 1,
id: row.id, id: row.id,
step: 2 step: 2
}) })
break break
// 创建子商户/门店 // 创建子商户/门店
case 'handleAddMerchant': case 'handleAddMerchant':
// 1-创建新商户;2-创建子商户;3-修改 // 1-创建新商户;2-创建子商户;3-修改
go('merchant', 'addSubMerchant', { go('merchant', 'addSubMerchant', {
editLevel: 2, editLevel: 2,
parentId: row.id, parentId: row.id,
isFactory: 'false', isFactory: 'false',
step: 1, step: 1,
merchantAccountLevel: row.merchantAccountLevel merchantAccountLevel: row.merchantAccountLevel
}) })
break break
// 创建员工 // 创建员工
case 'handleAddStaff': case 'handleAddStaff':
go('employee', 'add', { go('employee', 'add', {
merchantId: row.id, merchantId: row.id,
merchantName: row.merchantName, merchantName: row.merchantName,
channel: 'merchant' channel: 'merchant'
}) })
break break
// 修改账户有效期 // 修改账户有效期
case 'handleVaildPeriod': case 'handleVaildPeriod':
var area = ['580px', '230px'] var area = ['580px', '230px']
if (row.merchantAccountLevel == 4) { if (row.merchantAccountLevel == 4) {
// area = ['750px', '480px'] // area = ['750px', '480px']
area = ['700px', '480px'] area = ['700px', '480px']
} }
layer.open({ layer.open({
type: 2, type: 2,
title: '', title: '',
closeBtn: 0, closeBtn: 0,
area: area, area: area,
fixed: false, //不固定 fixed: false, //不固定
// maxmin: true, // maxmin: true,
btn: ['确定', '取消'], btn: ['确定', '取消'],
content: content:
'validPeriodForm.html?id=' + 'validPeriodForm.html?id=' +
row.id + row.id +
'&effectiveStarttime=' + '&effectiveStarttime=' +
row.effectiveStarttime + row.effectiveStarttime +
'&expireDate=' + '&expireDate=' +
row.expireDate + row.expireDate +
'&status=' + '&status=' +
row.status + row.status +
'&merchantAccountLevel=' + '&merchantAccountLevel=' +
row.merchantAccountLevel, row.merchantAccountLevel,
yes: function(index, layero) { yes: function (index, layero) {
var body = layer.getChildFrame('body', index) var body = layer.getChildFrame('body', index)
helper.store.set('isRefresh', false) helper.store.set('isRefresh', false)
body.find('#periodVerifyBtn').click() body.find('#periodVerifyBtn').click()
}, },
end: function() { end: function () {
var isRefresh = helper.store.get('isRefresh') var isRefresh = helper.store.get('isRefresh')
if (isRefresh) { if (isRefresh) {
getTabelList() getTabelList()
layer.msg('修改成功', { layer.msg('修改成功', {
icon: 1 icon: 1
}) })
}
helper.store.remove('isRefresh')
} }
}) helper.store.remove('isRefresh')
break }
} })
}) break
}
})
init() init()
$('#addBtn').on('click', function(e) { $('#addBtn').on('click', function (e) {
// 1-创建新商户;2-创建子商户;3-修改 // 1-创建新商户;2-创建子商户;3-修改
// e.target.blur() // e.target.blur()
go('merchant', 'add', { go('merchant', 'add', {
editLevel: 1, editLevel: 1,
step: 1, step: 1,
isFactory: 'true' isFactory: 'true'
})
return false
}) })
return false
})
$('#relevancyBtn').on('click', function() { $('#relevancyBtn').on('click', function () {
$messenger.emit('route-to', { path: '/settings/baseInfo/relevance' }) $messenger.emit('route-to', { path: '/settings/baseInfo/relevance' })
}) })
// 搜索绑定事件 // 搜索绑定事件
form.on('submit(searchSubmit)', function() { form.on('submit(searchSubmit)', function () {
getTabelList(true) getTabelList(true)
return false return false
}) })
// 查询 // 查询
function handleSearch() { function handleSearch() {
getTabelList(true) getTabelList(true)
} }
// 获取表格数据 // 获取表格数据
function getTabelList(isResetPageNum) { function getTabelList(isResetPageNum) {
var params = { var params = {
pageNum: page.pageNum, pageNum: page.pageNum,
pageSize: page.pageSize, pageSize: page.pageSize,
method: 'merchants.api.menu.findMerchantByPage' method: 'merchants.api.menu.findMerchantByPage'
}
var searchData = $('#searchForm [name]').serializeArray()
$.each(searchData, function () {
if (this.name == 'merchantLoginAccount') {
var attrName = params.accountOrPhone == '0' ? 'merchantLoginAccount' : 'merchantLegalPersonPhone'
params[attrName] = this.value
} else {
params[this.name] = this.value
} }
var searchData = $('#searchForm [name]').serializeArray() })
$.each(searchData, function() { request(params, function (res) {
if (this.name == 'merchantLoginAccount') { var data = helper.formateNullFieldData(res.data)
var attrName = params.accountOrPhone == '0' ? 'merchantLoginAccount' : 'merchantLegalPersonPhone' $.each(data.data, function (index, item) {
params[attrName] = this.value item.index = index + 1 + page.pageSize * (page.pageNum - 1)
} else { item.btn = {
params[this.name] = this.value edit: false,
createSubMerchant: false,
createStaff: false,
editPeriod: false
} }
}) /** btn
request(params, function(res) { * check - 查看(无需判断,均有)
var data = helper.formateNullFieldData(res.data) * edit - 修改
$.each(data.data, function(index, item) { * createSubMerchant - 创建子商户/门店
item.index = index + 1 + page.pageSize * (page.pageNum - 1) * createStaff - 创建员工
item.btn = { * editPeriod - 修改账户有效期
edit: false, * **/
createSubMerchant: false, // status(账户状态 - 列表):1-草稿;2-正常;3-注销;4-过期
createStaff: false, // merchantAccountLevel(账户等级 - 列表):1-工厂;2-省代;3-市代;4-门店
editPeriod: false // 外部系统
} switch (window.isDxternal) {
/** btn case 1:
* check - 查看(无需判断,均有) if (item.status == 2) {
* edit - 修改 // 本身
* createSubMerchant - 创建子商户/门店 if (item.merchantNo == accountInfo.merchantId) {
* createStaff - 创建员工
* editPeriod - 修改账户有效期
* **/
// status(账户状态 - 列表):1-草稿;2-正常;3-注销;4-过期
// merchantAccountLevel(账户等级 - 列表):1-工厂;2-省代;3-市代;4-门店
// 外部系统
switch (window.isDxternal) {
case 1:
if (item.status == 2) {
// 本身
if (item.merchantNo == accountInfo.merchantId) {
item.btn.createStaff = true
if (item.merchantAccountLevel != 4) {
item.btn.createSubMerchant = true
}
} else {
// 下级商户
item.btn.edit = true
item.btn.editPeriod = true
// 直属门店
if (item.merchantAccountLevel == 4) {
if (item.parentId == accountInfo.merchantId) {
item.btn.createStaff = true
}
} else {
item.btn.createSubMerchant = true
}
}
} else if (item.status != 3) {
item.btn.edit = true
if (item.status == 4) {
item.btn.editPeriod = true
}
}
break
default:
// 超管登录
if (item.status != 3) {
item.btn.edit = true
}
if (item.status == 2) {
item.btn.createStaff = true item.btn.createStaff = true
if (item.merchantAccountLevel != 4) { if (item.merchantAccountLevel != 4) {
item.btn.createSubMerchant = true item.btn.createSubMerchant = true
} }
} else {
// 下级商户
item.btn.edit = true
item.btn.editPeriod = true
// 直属门店
if (item.merchantAccountLevel == 4) {
if (item.parentId == accountInfo.merchantId) {
item.btn.createStaff = true
}
} else {
item.btn.createSubMerchant = true
}
} }
if (item.status != 1) { } else if (item.status != 3) {
item.btn.edit = true
if (item.status == 4) {
item.btn.editPeriod = true item.btn.editPeriod = true
} }
} }
// if (isDxternal) { break
// // 状态 - 正常 default:
// if (item.status == 2) { // 超管登录
// // 本身 if (item.status != 3) {
// if (item.id == user.merchantId) { item.btn.edit = true
// item.btn.createStaff = true }
// if (item.merchantAccountLevel != 4) { if (item.status == 2) {
// item.btn.createSubMerchant = true item.btn.createStaff = true
// } if (item.merchantAccountLevel != 4) {
// } else { item.btn.createSubMerchant = true
// // 下级商户 }
// // console.log(item) }
// item.btn.edit = true if (item.status != 1) {
// item.btn.editPeriod = true item.btn.editPeriod = true
// // 直属门店 }
// if (item.merchantAccountLevel == 4) {
// if (item.parentId == user.merchantId) {
// item.btn.createStaff = true
// }
// } else {
// item.btn.createSubMerchant = true
// }
// }
// } else if (item.status != 3) {
// item.btn.edit = true
// if (item.status == 4) {
// item.btn.editPeriod = true
// }
// }
// } else {
// // 超管登录
// if (item.status != 3) {
// item.btn.edit = true
// }
// if (item.status == 2) {
// item.btn.createStaff = true
// if (item.merchantAccountLevel != 4) {
// item.btn.createSubMerchant = true
// }
// }
// if (item.status != 1) {
// item.btn.editPeriod = true
// }
// }
})
var options = {
data: data.data
}
pageOptions.count = data.count
if (isResetPageNum) {
pageOptions.curr = 1
} }
laypage.render(pageOptions) // if (isDxternal) {
merchantTable.reload(options) // // 状态 - 正常
// if (item.status == 2) {
// // 本身
// if (item.id == user.merchantId) {
// item.btn.createStaff = true
// if (item.merchantAccountLevel != 4) {
// item.btn.createSubMerchant = true
// }
// } else {
// // 下级商户
// // console.log(item)
// item.btn.edit = true
// item.btn.editPeriod = true
// // 直属门店
// if (item.merchantAccountLevel == 4) {
// if (item.parentId == user.merchantId) {
// item.btn.createStaff = true
// }
// } else {
// item.btn.createSubMerchant = true
// }
// }
// } else if (item.status != 3) {
// item.btn.edit = true
// if (item.status == 4) {
// item.btn.editPeriod = true
// }
// }
// } else {
// // 超管登录
// if (item.status != 3) {
// item.btn.edit = true
// }
// if (item.status == 2) {
// item.btn.createStaff = true
// if (item.merchantAccountLevel != 4) {
// item.btn.createSubMerchant = true
// }
// }
// if (item.status != 1) {
// item.btn.editPeriod = true
// }
// }
}) })
} var options = {
data: data.data
}
pageOptions.count = data.count
if (isResetPageNum) {
pageOptions.curr = 1
}
laypage.render(pageOptions)
merchantTable.reload(options)
})
}
// 获取字典数据 // 获取字典数据
function getDictData(dictType, fn) { function getDictData(dictType, fn) {
request( request(
{ {
method: 'merchants.api.menu.findAllDictData', method: 'merchants.api.menu.findAllDictData',
dictType: dictType dictType: dictType
}, },
function(res) { function (res) {
fn && fn(res) fn && fn(res)
} }
) )
} }
// 设置option // 设置option
function setSelectOption(elName, listName, optionId, optionLabel) { function setSelectOption(elName, listName, optionId, optionLabel) {
var el = $(elName) var el = $(elName)
$.each(baseData[listName], function(index, item) { $.each(baseData[listName], function (index, item) {
el.append(new Option(item[optionLabel], item[optionId])) el.append(new Option(item[optionLabel], item[optionId]))
}) })
form.render('select') form.render('select')
} }
// 获取有效期 // 获取有效期
function getVaildPeriod() { function getVaildPeriod() {
getDictData('merchant_status', function(res) { getDictData('merchant_status', function (res) {
baseData.statusList = res.data baseData.statusList = res.data
setSelectOption('#searchStatusEl', 'statusList', 'dictValue', 'dictLabel') setSelectOption('#searchStatusEl', 'statusList', 'dictValue', 'dictLabel')
}) })
} }
// 获取渠道 // 获取渠道
function getChannel() { function getChannel() {
getDictData('channel', function(res) { getDictData('channel', function (res) {
baseData.channelList = res.data baseData.channelList = res.data
setSelectOption('#channelIdEl', 'channelList', 'dictValue', 'dictLabel') setSelectOption('#channelIdEl', 'channelList', 'dictValue', 'dictLabel')
}) })
} }
// 获取账户等级 // 获取账户等级
function getAccountLevel() { function getAccountLevel() {
getDictData('account_level', function(res) { getDictData('account_level', function (res) {
baseData.accountLevelList = res.data baseData.accountLevelList = res.data
setSelectOption('#accountLevelEl', 'accountLevelList', 'dictValue', 'dictLabel') setSelectOption('#accountLevelEl', 'accountLevelList', 'dictValue', 'dictLabel')
}) })
} }
// 获取账户类型 // 获取账户类型
function getAccountType() { function getAccountType() {
getDictData('account_type', function(res) { getDictData('account_type', function (res) {
baseData.accountTypeList = res.data baseData.accountTypeList = res.data
setSelectOption('#accountTypeIdEl', 'accountTypeList', 'dictValue', 'dictLabel') setSelectOption('#accountTypeIdEl', 'accountTypeList', 'dictValue', 'dictLabel')
}) })
} }
// 获取模式 // 获取模式
function getModel() { function getModel() {
getDictData('merchant_model', function(res) { getDictData('merchant_model', function (res) {
baseData.modelList = res.data baseData.modelList = res.data
setSelectOption('#searchModelEl', 'modelList', 'dictValue', 'dictLabel') setSelectOption('#searchModelEl', 'modelList', 'dictValue', 'dictLabel')
}) })
} }
// SCRM系统 搜索加按钮 // SCRM系统 搜索加按钮
function glBtn() { function glBtn() {
$('#operateEl').remove() $('#operateEl').remove()
$('#channelBox').remove() $('#channelBox').remove()
if (accountInfo.model == 1 && accountInfo.merchantAccountLevel == 1) { if (accountInfo.model == 1 && accountInfo.merchantAccountLevel == 1) {
$('#relevancyEl').removeClass('hide') $('#relevancyEl').removeClass('hide')
$('#relevancyEl').addClass('show') $('#relevancyEl').addClass('show')
}
if (accountInfo.merchantAccountLevel == 4) {
$('#relevancySearch').addClass('hide')
}
// $('#relevancySearch').addClass('show')
$('#model').remove()
$('#accountType').remove()
} }
if (accountInfo.merchantAccountLevel == 4) {
// gl功能点 $('#relevancySearch').addClass('hide')
function scrmBtn() {
// $('#channelBox').remove()
$('#operateEl').addClass('show')
$('#channelBox').addClass('show')
// $('#relevancyEl').remove()
// $('#relevancySearch').remove()
$('#model').addClass('show')
$('#accountType').addClass('show')
$('#parentMerchant').addClass('show')
$('#parentMerchant').removeClass('hide')
} }
// $('#relevancySearch').addClass('show')
$('#model').remove()
$('#accountType').remove()
}
// 运营平台 // gl功能点
function init() { function scrmBtn() {
switch (window.isDxternal) { // $('#channelBox').remove()
// scrm 系统 $('#operateEl').addClass('show')
case 1: $('#channelBox').addClass('show')
glBtn() // $('#relevancyEl').remove()
break // $('#relevancySearch').remove()
// 广联运营系统 $('#model').addClass('show')
default: $('#accountType').addClass('show')
getChannel() $('#parentMerchant').addClass('show')
getModel() $('#parentMerchant').removeClass('hide')
scrmBtn() }
}
// if (!isDxternal) { // 运营平台
// getChannel() function init() {
// getAccountLevel() switch (window.isDxternal) {
// getAccountType() // scrm 系统
// getModel() case 1:
// } else { glBtn()
// elRemove() break
// } // 广联运营系统
getAccountLevel() default:
getAccountType() getChannel()
getVaildPeriod() getModel()
getTabelList() scrmBtn()
} }
}) // if (!isDxternal) {
</script> // getChannel()
</body> // getAccountLevel()
</html> // getAccountType()
// getModel()
// } else {
// elRemove()
// }
getAccountLevel()
getAccountType()
getVaildPeriod()
getTabelList()
}
})
</script>
</body>
</html>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!