Commit 0e2b3e18 by cwq0219

商户/子商户-新建/编辑基本信息

1 parent 7c03bf2d
...@@ -247,6 +247,20 @@ ...@@ -247,6 +247,20 @@
</div> </div>
</div> </div>
<p class="edit-title">账户基本信息</p> <p class="edit-title">账户基本信息</p>
<div id="subMerchantEl">
<div class="layui-form-item">
<label class="layui-form-label required">上级商户:</label>
<div class="layui-input-inline">
<input class="layui-input layui-btn-disabled" name="parentName" placeholder="请输入上级商户" disabled>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required">账户类型:</label>
<div class="layui-input-inline">
<input class="layui-input layui-btn-disabled" name="parentAccountTypeName" placeholder="请输入账户类型">
</div>
</div>
</div>
<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">
...@@ -325,6 +339,10 @@ ...@@ -325,6 +339,10 @@
// 1-基本信息;2-权限树 // 1-基本信息;2-权限树
var step = 1 var step = 1
var merchantId = null var merchantId = null
var parentMerchantId = null
// 是否工厂
var isFactory = true
var parentInfo = {}
var merchantForm = { var merchantForm = {
channelId: '', channelId: '',
...@@ -393,12 +411,12 @@ ...@@ -393,12 +411,12 @@
form.on('submit(handleSubmit)', function (data) { form.on('submit(handleSubmit)', function (data) {
//--------------- //---------------
baseIsShow(false) // baseIsShow(false)
treeIsShow(true) // treeIsShow(true)
// getMenuList() // getMenuList()
findMenuFunTreeByMerId() // findMenuFunTreeByMerId()
//------------------- //-------------------
console.log(editLevel) // console.log(editLevel)
// console.log(data.field) // console.log(data.field)
var formData = data.field var formData = data.field
var params = { var params = {
...@@ -466,9 +484,15 @@ ...@@ -466,9 +484,15 @@
if (editLevel == 1) { if (editLevel == 1) {
params.method = 'cn.com.glsx.merchants.merchant.saveMerchant' params.method = 'cn.com.glsx.merchants.merchant.saveMerchant'
} else if (editLevel == 2) { } else if (editLevel == 2) {
if (!isFactory) {
params.parentId = parentInfo.parentId
}
params.method = 'cn.com.glsx.merchants.merchant.saveMerchant' params.method = 'cn.com.glsx.merchants.merchant.saveMerchant'
} else if (editLevel == 3) { } else if (editLevel == 3) {
params.id = merchantId params.id = merchantId
if (!isFactory) {
params.parentId = parentInfo.parentId
}
params.method = 'cn.com.glsx.merchants.merchant.updateMerchant' params.method = 'cn.com.glsx.merchants.merchant.updateMerchant'
} }
// 保存状态 1.草稿 2.发布 3.注销 4.过期 // 保存状态 1.草稿 2.发布 3.注销 4.过期
...@@ -577,7 +601,6 @@ ...@@ -577,7 +601,6 @@
subParent.append(child1) subParent.append(child1)
subParent.append(child2) subParent.append(child2)
parent.append(subParent) parent.append(subParent)
// console.log(parent)
}, },
handleCancel() { handleCancel() {
go('merchant', 'index') go('merchant', 'index')
...@@ -642,26 +665,42 @@ ...@@ -642,26 +665,42 @@
function init() { function init() {
editLevel = qs('editLevel') editLevel = qs('editLevel')
isFactory = (qs('isFactory') == 'true')
console.log(isFactory)
if (isFactory) {
merchantId = qs('id')
$('#subMerchantEl').hide()
getAccountLevel()
} else {
// 创建/编辑子商户
parentMerchantId = qs('parentId')
if (editLevel == 3) {
merchantId = qs('id') merchantId = qs('id')
}
$('#validPeriodEl').attr('disabled', true)
$('#channelEl').attr('disabled', true)
getParentInfo()
}
step = qs('step') step = qs('step')
if (step == 1) { if (step == 1) {
treeIsShow(false) treeIsShow(false)
} else { } else {
baseIsShow(false) baseIsShow(false)
// getMenuList() // getMenuList()
// findMenuFunTreeByMerId() findMenuFunTreeByMerId()
} }
if (editLevel == 3) { if (editLevel == 3) {
// merchantName = qs('merchantName') // merchantName = qs('merchantName')
getMerchantInfo() getMerchantInfo()
$('#accountLevelEl').attr('disabled', true)
} else { } else {
getBusiScope() getBusiScope()
getCarBrandTree() getCarBrandTree()
getAccountType() getAccountType()
findMenuFunTreeByMerId()
} }
getChannel() getChannel()
getAccountLevel()
getPeriod() getPeriod()
bindEvent() bindEvent()
} }
...@@ -695,15 +734,44 @@ ...@@ -695,15 +734,44 @@
}) })
} }
// 获取商户信息 function getMerchantApi(id, fn) {
function getMerchantInfo() {
request({ request({
method: 'cn.com.glsx.merchants.merchant.findMerchantDetail', method: 'cn.com.glsx.merchants.merchant.findMerchantDetail',
id: merchantId id: id
}, function (res) { }, function (res) {
console.log(res.data) fn && fn(res)
})
}
// 子商户 - 获取父商户信息
function getParentInfo() {
// console.log(parentMerchantId)
getMerchantApi(parentMerchantId, function (res) {
// console.log(res.data)
var data = res.data
parentInfo = {
parentId: data.id,
parentName: data.merchantName,
parentAccountTypeName: data.accountTypeNames,
parentAccountType: data.merchantType,
channelId: data.channelId,
effectiveTime: data.effectiveTime
}
form.val('merchantForm', parentInfo)
if (editLevel == 3) {
getMerchantInfo()
$('#accountLevelEl').attr('disabled', true)
}
getAccountLevel()
})
}
// 获取商户信息
function getMerchantInfo() {
getMerchantApi(merchantId, function (res) {
form.val('merchantForm', res.data) form.val('merchantForm', res.data)
merchantForm = res.data merchantForm = res.data
// console.log(merchantForm)
getBusiScope() getBusiScope()
getCarBrandTree() getCarBrandTree()
getAccountType() getAccountType()
...@@ -768,6 +836,15 @@ ...@@ -768,6 +836,15 @@
function getAccountLevel() { function getAccountLevel() {
getDictData('account_level', function (res) { getDictData('account_level', function (res) {
baseData.accountLevelList = res.data baseData.accountLevelList = res.data
if (!isFactory) {
var tempList = []
$.each(baseData.accountLevelList, function (index, item) {
if (item.dictValue > parentInfo.parentAccountType) {
tempList.push(baseData.accountLevelList[index])
}
})
baseData.accountLevelList = tempList
}
setSelectOption('#accountLevelEl', 'accountLevelList', 'dictValue', 'dictLabel') setSelectOption('#accountLevelEl', 'accountLevelList', 'dictValue', 'dictLabel')
}) })
} }
...@@ -1072,22 +1149,25 @@ ...@@ -1072,22 +1149,25 @@
// end // end
function toInt(str) { function toInt(str) {
var arr = str.split(',') var arr = str.split(',')
$.each(arr, function(index, item) { $.each(arr, function (index, item) {
arr[index] = parseInt(item) arr[index] = parseInt(item)
}) })
return arr return arr
} }
// findMenuFunTreeByMerId()
// 查询商户的菜单权限树 // 查询商户的菜单权限树
function findMenuFunTreeByMerId() { function findMenuFunTreeByMerId() {
console.log(merchantForm.merchantAccountLevel) // console.log(merchantForm.merchantAccountLevel)
var accountType = toInt(merchantForm.accountType) // var accountType = toInt(merchantForm.accountType)
var params = { var params = {
// method: 'cn.com.glsx.merchants.merchant.findMenuFunTreeByMerId', // method: 'cn.com.glsx.merchants.merchant.findMenuFunTreeByMerId',
method: 'org.ore.api.accountType.getProductTreeList', method: 'org.ore.api.accountType.getProductTreeList',
idList: accountType, // ids: merchantForm.accountType,
ids: '1,26',
merchantId: merchantId, merchantId: merchantId,
accountLevel: merchantForm.merchantAccountLevel // accountLevel: merchantForm.merchantAccountLevel
accountLevel: 1
} }
request(params, function (res) { request(params, function (res) {
if (res.code == '0') { if (res.code == '0') {
......
...@@ -224,18 +224,25 @@ ...@@ -224,18 +224,25 @@
case 'handleEdit': case 'handleEdit':
// editLevel - 1-创建新商户;2-创建子商户;3-修改 // editLevel - 1-创建新商户;2-创建子商户;3-修改
// step - 1-基本信息;2-权限树 // step - 1-基本信息;2-权限树
// merchantAccountLevel 账户等级(1-工厂;2-省代;3-市代;4-门店)
go('merchant', 'edit', { go('merchant', 'edit', {
editLevel: 3, editLevel: 3,
id: row.id, id: row.id,
parentId: row.parentId,
isFactory: (row.merchantAccountLevel == 1),
step: 1 step: 1
}) })
break break
case 'handleAuthority': case 'handleAuthority':
// editLevel - 1-创建新商户;2-创建子商户;3-修改 // editLevel - 1-创建新商户;2-创建子商户;3-修改
// step - 1-基本信息;2-权限树 // step - 1-基本信息;2-权限树
// merchantAccountLevel 账户等级
go('merchant', 'edit', { go('merchant', 'edit', {
editLevel: 3, editLevel: 3,
id: row.id, id: row.id,
parentId: row.parentId,
isFactory: (row.merchantAccountLevel == 1),
id: row.id,
step: 2 step: 2
}) })
break break
...@@ -244,7 +251,9 @@ ...@@ -244,7 +251,9 @@
// 1-创建新商户;2-创建子商户;3-修改 // 1-创建新商户;2-创建子商户;3-修改
go('merchant', 'edit', { go('merchant', 'edit', {
editLevel: 2, editLevel: 2,
id: row.id parentId: row.id,
isFactory: 'false',
step: 1
}) })
break break
// 创建员工 // 创建员工
...@@ -293,7 +302,9 @@ ...@@ -293,7 +302,9 @@
$('#addBtn').on('click', function () { $('#addBtn').on('click', function () {
// 1-创建新商户;2-创建子商户;3-修改 // 1-创建新商户;2-创建子商户;3-修改
go('merchant', 'edit', { go('merchant', 'edit', {
editLevel: 1 editLevel: 1,
step: 1,
isFactory: 'true'
}) })
return false return false
}) })
......
...@@ -116,8 +116,8 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) { ...@@ -116,8 +116,8 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) {
secretArr.push(val + params[val]) secretArr.push(val + params[val])
} }
var str = secretArr.join('') var str = secretArr.join('')
// console.log(str)
return isMd5 ? md5(secret + str + secret).toUpperCase() : SHA1(secret + str + secret).toUpperCase() return isMd5 ? md5(secret + str + secret).toUpperCase() : SHA1(secret + str + secret).toUpperCase()
// return SHA1(secret + str + secret).toUpperCase()
} }
function msg(msg) { function msg(msg) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!