Commit c1b4db3a by cwq0219

上一步,下一步

1 parent 3798154f
...@@ -294,8 +294,8 @@ ...@@ -294,8 +294,8 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label required">登录账户名:</label> <label class="layui-form-label required">登录账户名:</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input class="layui-input" name="merchantLoginAccount" maxlength="15" placeholder="请输入登录账户名" required <input class="layui-input" id="merchantLoginAccountEl" name="merchantLoginAccount" maxlength="15"
lay-verify="required"> placeholder="请输入登录账户名" required lay-verify="required">
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
...@@ -379,6 +379,7 @@ ...@@ -379,6 +379,7 @@
// 是否工厂 // 是否工厂
var isFactory = true var isFactory = true
var parentInfo = {} var parentInfo = {}
var isFreshSecond = true
var merchantForm = { var merchantForm = {
channelId: '', channelId: '',
...@@ -437,6 +438,10 @@ ...@@ -437,6 +438,10 @@
lay('#endDate').html(value) lay('#endDate').html(value)
} }
}) })
editLevel = qs('editLevel')
isFactory = (qs('isFactory') == 'true')
step = qs('step')
init() init()
// helper.store.set('merchantMapObj', { // helper.store.set('merchantMapObj', {
...@@ -530,20 +535,27 @@ ...@@ -530,20 +535,27 @@
if (merchantForm.merchantFiles.length) { if (merchantForm.merchantFiles.length) {
params.merchantFiles = JSON.stringify(merchantForm.merchantFiles) params.merchantFiles = JSON.stringify(merchantForm.merchantFiles)
} }
if (editLevel == 1) { if (merchantId) {
params.method = 'cn.com.glsx.merchants.merchant.saveMerchant' params.id = merchantId
} else if (editLevel == 2) {
if (!isFactory) { if (!isFactory) {
params.parentId = parentInfo.parentId params.parentId = parentInfo.parentId
} }
params.method = 'cn.com.glsx.merchants.merchant.updateMerchant'
} else if (editLevel == 1) {
params.method = 'cn.com.glsx.merchants.merchant.saveMerchant' params.method = 'cn.com.glsx.merchants.merchant.saveMerchant'
} else if (editLevel == 3) { } else if (editLevel == 2) {
params.id = merchantId
if (!isFactory) { if (!isFactory) {
params.parentId = parentInfo.parentId params.parentId = parentInfo.parentId
} }
params.method = 'cn.com.glsx.merchants.merchant.updateMerchant' params.method = 'cn.com.glsx.merchants.merchant.saveMerchant'
} }
// else if (editLevel == 3) {
// params.id = merchantId
// if (!isFactory) {
// params.parentId = parentInfo.parentId
// }
// params.method = 'cn.com.glsx.merchants.merchant.updateMerchant'
// }
// 保存状态 1.草稿 2.发布 3.注销 4.过期 // 保存状态 1.草稿 2.发布 3.注销 4.过期
if (merchantForm.status) { if (merchantForm.status) {
params.status = merchantForm.status params.status = merchantForm.status
...@@ -562,14 +574,26 @@ ...@@ -562,14 +574,26 @@
}) })
go('merchant', 'index') go('merchant', 'index')
} else { } else {
merchantId = res.data if (!merchantId) {
merchantId = res.data
}
merchantForm.merchantAccountLevel = parseInt(merchantForm.merchantAccountLevel) merchantForm.merchantAccountLevel = parseInt(merchantForm.merchantAccountLevel)
getMerchantApi(merchantId, function (respone) { getMerchantApi(merchantId, function (respone) {
form.val('merchantForm', respone.data) form.val('merchantForm', respone.data)
merchantForm = respone.data merchantForm = respone.data
accountTypeVisible = true
var el = $('#accountTypeEl')
el.empty()
// recoveryBusiScopeCus()
// getCarBrandTree()
recoveryFile()
getAccountType()
baseIsShow(false) baseIsShow(false)
treeIsShow(true) treeIsShow(true)
getById() if (isFreshSecond) {
getById()
isFreshSecond = false
}
}) })
} }
} }
...@@ -731,44 +755,61 @@ ...@@ -731,44 +755,61 @@
} }
function init() { function init() {
editLevel = qs('editLevel')
isFactory = (qs('isFactory') == 'true')
step = qs('step')
if (step == 1) { if (step == 1) {
baseIsShow(true)
treeIsShow(false) treeIsShow(false)
} else { } else {
baseIsShow(false) baseIsShow(false)
treeIsShow(true)
} }
// 创建商户 // 创建商户
if (editLevel == 1) { if (editLevel == 1) {
$('#accountLevelEl').attr('disabled', true) if (!merchantId) {
getBusiScope() $('#accountLevelEl').attr('disabled', true)
getCarBrandTree() getBusiScope()
getAccountLevel() getCarBrandTree()
getAccountType() getAccountLevel()
getAccountType()
} else {
$('#validPeriodEl').attr('disabled', true)
$('#merchantLoginAccountEl').attr('disabled', true)
}
} else { } else {
merchantId = qs('id') if (!merchantId) {
$('#preStep').remove() merchantId = qs('id')
}
console.log(merchantId)
if (editLevel == 3) { if (editLevel == 3) {
$('#firstBtn').text('确定') $('#firstBtn').text('确定')
$('#preStep').remove()
$('#validPeriodEl').attr('disabled', true) $('#validPeriodEl').attr('disabled', true)
$('#merchantLoginAccountEl').attr('disabled', true)
accountTypeVisible = true accountTypeVisible = true
$('#accountLevelEl').attr('disabled', true) $('#accountLevelEl').attr('disabled', true)
} else { } else {
getBusiScope() if (!merchantId) {
getCarBrandTree() getBusiScope()
getCarBrandTree()
}
} }
if (isFactory) { if (isFactory) {
getAccountLevel() getAccountLevel()
getMerchantInfo() getMerchantInfo()
} else { } else {
// 创建/编辑子商户 // 创建/编辑子商户
parentMerchantId = qs('parentId') if (!parentMerchantId) {
// $('#validPeriodEl').attr('disabled', true) parentMerchantId = qs('parentId')
}
$('#validPeriodEl').attr('disabled', true)
$('#channelEl').attr('disabled', true) $('#channelEl').attr('disabled', true)
getParentInfo() if (editLevel == 3 || (editLevel == 2 && !merchantId)) {
getParentInfo()
} else {
$('#merchantLoginAccountEl').attr('disabled', true)
$('#accountLevelEl').attr('disabled', true)
}
} }
} }
if (isFactory) { if (isFactory) {
...@@ -1016,7 +1057,7 @@ ...@@ -1016,7 +1057,7 @@
// console.log(res.data, 'account_type') // console.log(res.data, 'account_type')
baseData.accountTypeList = res.data baseData.accountTypeList = res.data
var checkedList = [] var checkedList = []
if (editLevel == 3 && merchantForm.accountType) { if (merchantId && merchantForm.accountType) {
checkedList = merchantForm.accountType.split(',') checkedList = merchantForm.accountType.split(',')
} }
var el = $('#accountTypeEl') var el = $('#accountTypeEl')
...@@ -1034,7 +1075,7 @@ ...@@ -1034,7 +1075,7 @@
optionEl.attr('disabled', true) optionEl.attr('disabled', true)
} }
// 修改-回显 // 修改-回显
if (editLevel == 3) { if (merchantId) {
for (var i = 0; i <= checkedList.length; i++) { for (var i = 0; i <= checkedList.length; i++) {
if (checkedList[i] == item.dictValue) { if (checkedList[i] == item.dictValue) {
optionEl.attr("checked", true) optionEl.attr("checked", true)
...@@ -1055,7 +1096,7 @@ ...@@ -1055,7 +1096,7 @@
optionEl.attr('disabled', true) optionEl.attr('disabled', true)
} }
// 修改-回显 // 修改-回显
if (editLevel == 3) { if (merchantId) {
for (var i = 0; i <= checkedList.length; i++) { for (var i = 0; i <= checkedList.length; i++) {
if (checkedList[i] == item.dictValue) { if (checkedList[i] == item.dictValue) {
optionEl.attr("checked", true) optionEl.attr("checked", true)
......
...@@ -25,7 +25,12 @@ ...@@ -25,7 +25,12 @@
.layui-btn-xs { .layui-btn-xs {
cursor: pointer; cursor: pointer;
} }
.channel,.accountLevel,.accountType,.customerStatus,.searchInputBtn{
.channel,
.accountLevel,
.accountType,
.customerStatus,
.searchInputBtn {
margin-left: 20px; margin-left: 20px;
} }
</style> </style>
...@@ -68,7 +73,7 @@ ...@@ -68,7 +73,7 @@
</div> </div>
<div class="layui-inline loginName" pane> <div class="layui-inline loginName" pane>
<div class="layui-input-inline" style="width: 120px;"> <div class="layui-input-inline" style="width: 120px;">
<select name="name" lay-filter="nameFilter"> <select name="accountOrPhone" lay-filter="nameFilter">
<option value="0">账号登录名</option> <option value="0">账号登录名</option>
<option value="1">手机号</option> <option value="1">手机号</option>
</select> </select>
...@@ -188,7 +193,7 @@ ...@@ -188,7 +193,7 @@
var merchantTable = table.render({ var merchantTable = table.render({
elem: '#merchantTable', elem: '#merchantTable',
page: false, page: false,
skin: 'nob', skin: 'nob',
cols: [ cols: [
[{ [{
field: 'index', field: 'index',
...@@ -319,7 +324,8 @@ ...@@ -319,7 +324,8 @@
fixed: false, //不固定 fixed: false, //不固定
// maxmin: true, // maxmin: true,
btn: ['确定', '取消'], btn: ['确定', '取消'],
content: 'validPeriodForm.html?id=' + row.id + '&effectiveTime=' + row.effectiveTime + '&merchantAccountLevel=' + row.merchantAccountLevel + '&status=' + row.status, content: 'validPeriodForm.html?id=' + row.id + '&effectiveTime=' + row.effectiveTime +
'&merchantAccountLevel=' + row.merchantAccountLevel + '&status=' + row.status,
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)
...@@ -372,11 +378,16 @@ ...@@ -372,11 +378,16 @@
var searchData = $('#searchForm [name]').serializeArray() var searchData = $('#searchForm [name]').serializeArray()
// console.log(searchData) // console.log(searchData)
$.each(searchData, function () { $.each(searchData, function () {
params[this.name] = this.value if (this.name == 'merchantLoginAccount') {
var attrName = params.accountOrPhone == '0' ? 'merchantLoginAccount' : 'merchantLegalPersonPhone'
params[attrName] = this.value
} else {
params[this.name] = this.value
}
}) })
// console.log(params) // console.log(params)
request(params, function (res) { request(params, function (res) {
var data = helper.formateNullFieldData(res.data) var data = helper.formateNullFieldData(res.data)
$.each(data.data, function (index, item) { $.each(data.data, function (index, item) {
item.index = index + 1 + page.pageSize * (page.pageNum - 1) item.index = index + 1 + page.pageSize * (page.pageNum - 1)
item.btn = { item.btn = {
......
...@@ -25,9 +25,12 @@ layui.define(['ztree'], function (exports) { ...@@ -25,9 +25,12 @@ layui.define(['ztree'], function (exports) {
var p = gtree.opt.checkedList var p = gtree.opt.checkedList
if (p.indexOf(treeNode.id) != -1) { if (p.indexOf(treeNode.id) != -1) {
treeNode.checked = true treeNode.checked = true
if (inst) { var i= setInterval(function(){
inst.updateNode(treeNode) if (inst) {
} clearInterval(i)
inst.updateNode(treeNode)
}
},20)
} }
} }
if (gtree.opt && gtree.opt.chkDisabled) { if (gtree.opt && gtree.opt.chkDisabled) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!