Commit 88c8c815 by 胡悦

Merge branch 'master' of 192.168.3.233:h5/account

2 parents 6e89b2bf 9fcf2a44
...@@ -353,6 +353,7 @@ ...@@ -353,6 +353,7 @@
helper.store.set('merchantMapObj', merchantForm) helper.store.set('merchantMapObj', merchantForm)
form.on('submit(handleSubmit)', function (data) { form.on('submit(handleSubmit)', function (data) {
console.log(editLevel)
// console.log(data.field) // console.log(data.field)
var formData = data.field var formData = data.field
var params = { var params = {
...@@ -413,13 +414,16 @@ ...@@ -413,13 +414,16 @@
merchantForm.businessScopeCustomize = tempList.join(',') merchantForm.businessScopeCustomize = tempList.join(',')
params.businessScopeCustomize = tempList.join(',') params.businessScopeCustomize = tempList.join(',')
merchantForm.merchantBrand = treeObj.getCheckedNodes(true) merchantForm.merchantBrand = treeObj.getCheckedNodes(true)
params.merchantBrand = findId(merchantForm.merchantBrand, []).join(',') params.merchantBrand = findId(merchantForm.merchantBrand).join(',')
params.merchantFiles = JSON.stringify(merchantForm.merchantFiles) if (merchantForm.merchantFiles.length) {
params.merchantFiles = JSON.stringify(merchantForm.merchantFiles)
}
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) {
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 = id
params.method = 'cn.com.glsx.merchants.merchant.updateMerchant' params.method = 'cn.com.glsx.merchants.merchant.updateMerchant'
} }
// 保存状态 1.草稿 2.发布 3.注销 4.过期 // 保存状态 1.草稿 2.发布 3.注销 4.过期
...@@ -432,19 +436,18 @@ ...@@ -432,19 +436,18 @@
console.log(params) console.log(params)
request(params, function (res) { request(params, function (res) {
console.log(res) console.log(res)
go('merchant', 'index') layer.msg('操作成功', {
icon: 1
})
// go('merchant', 'index')
}) })
return false return false
}) })
function findId(nodeList, idList) { function findId(nodeList) {
// var idList = [] var idList = []
$.each(nodeList, function (index, item) { $.each(nodeList, function (index, item) {
if (item.children) { idList.push(item.id)
findId(item.children, idList)
} else {
idList.push(item.id)
}
}) })
return idList return idList
} }
...@@ -478,7 +481,7 @@ ...@@ -478,7 +481,7 @@
var body = layer.getChildFrame('body', index) var body = layer.getChildFrame('body', index)
body.find('#mapBtn').click() body.find('#mapBtn').click()
var res = helper.store.get('merchantMapObj') var res = helper.store.get('merchantMapObj')
console.log(res) // console.log(res)
merchantForm.lat = res.lat merchantForm.lat = res.lat
merchantForm.lng = res.lng merchantForm.lng = res.lng
merchantForm.merchantAddress = res.merchantAddress merchantForm.merchantAddress = res.merchantAddress
...@@ -584,22 +587,6 @@ ...@@ -584,22 +587,6 @@
getPeriod() getPeriod()
} }
function setCheckbox(checkedStr, attr) {
if (!checkedStr || !checkedStr.length) {
return false
}
var list = []
if (layui._isArray(checkedStr)) {
list = checkedStr
} else {
list = checkedStr.split(',')
}
console.log(list)
$.each(list, function (index, item) {
$('input[class=' + attr + ']').attr("checked", true)
})
}
// 获取商户信息 // 获取商户信息
function getMerchantInfo() { function getMerchantInfo() {
request({ request({
...@@ -612,9 +599,6 @@ ...@@ -612,9 +599,6 @@
getBusiScope() getBusiScope()
getCarBrandTree() getCarBrandTree()
getAccountType() getAccountType()
// if (merchantForm.accountTypes.length) {
// setCheckbox(merchantForm.accountTypes, 'accounttypeId')
// }
}) })
} }
...@@ -631,8 +615,22 @@ ...@@ -631,8 +615,22 @@
request({ request({
method: 'cn.com.glsx.merchants.merchantCommon.getCarbrandTree' method: 'cn.com.glsx.merchants.merchantCommon.getCarbrandTree'
}, function (res) { }, function (res) {
// console.log(res.data)
baseData.carBrandTreeList = res.data baseData.carBrandTreeList = res.data
treeObj = tree.create('carBrandTree', res.data) var checkedList = []
if (editLevel == 3) {
checkedList = merchantForm.merchantBrand.split(',')
}
treeObj = tree.create('carBrandTree', res.data, {
checkedList: checkedList
})
// 修改-回显
// if (editLevel == 3) {
// checkedList = merchantForm.merchantBrand.split(',')
// for (var i = 0; i <= checkedList.length; i++) {
// treeObj.checkNode(treeObj.getNodeByParam("id", checkedList[i]), true)
// }
// }
}) })
} }
...@@ -680,17 +678,26 @@ ...@@ -680,17 +678,26 @@
function getBusiScope() { function getBusiScope() {
getDictData('business_scope', function (res) { getDictData('business_scope', function (res) {
baseData.busiScopeList = res.data baseData.busiScopeList = res.data
var checkedList = []
if (editLevel == 3) {
checkedList = merchantForm.businessScope.split(',')
}
var el = $('#busiScopeEl') var el = $('#busiScopeEl')
$.each(baseData.busiScopeList, function (index, item) { $.each(baseData.busiScopeList, function (index, item) {
var optionEl = $('<input type="checkbox" class="businessScope" name="businessScope[' + item var optionEl = $('<input type="checkbox" class="businessScope" name="businessScope[' + item
.dictValue + ']" title=' + .dictValue + ']" title=' +
item.dictLabel + ' value="' + item.dictValue + '" lay-skin="primary">') item.dictLabel + ' value="' + item.dictValue + '" lay-skin="primary">')
el.append(optionEl)
form.render('checkbox')
// 修改-回显 // 修改-回显
if (editLevel == 3 && merchantForm.businessScope) { if (editLevel == 3) {
setCheckbox(merchantForm.businessScope, 'businessScope') for (var i = 0; i <= checkedList.length; i++) {
if (checkedList[i] == item.dictValue) {
optionEl.attr("checked", true)
break
}
}
} }
el.append(optionEl)
form.render('checkbox')
}) })
}) })
} }
...@@ -700,17 +707,26 @@ ...@@ -700,17 +707,26 @@
getDictData('account_type', function (res) { getDictData('account_type', function (res) {
// console.log(res.data) // console.log(res.data)
baseData.accountTypeList = res.data baseData.accountTypeList = res.data
var checkedList = []
if (editLevel == 3) {
checkedList = merchantForm.accountType.split(',')
}
var el = $('#accountTypeEl') var el = $('#accountTypeEl')
$.each(baseData.accountTypeList, function (index, item) { $.each(baseData.accountTypeList, function (index, item) {
var optionEl = $('<input type="checkbox" class="accounttypeId" name="accountType[' + item var optionEl = $('<input type="checkbox" class="accounttypeId" name="accountType[' + item
.dictValue + ']" title=' + .dictValue + ']" title=' +
item.dictLabel + ' value="' + item.dictValue + '">') item.dictLabel + ' value="' + item.dictValue + '">')
el.append(optionEl)
form.render('checkbox')
// 修改-回显 // 修改-回显
if (editLevel == 3 && merchantForm.accountTypes.length) { if (editLevel == 3) {
setCheckbox(merchantForm.accountTypes, 'accounttypeId') for (var i = 0; i <= checkedList.length; i++) {
if (checkedList[i] == item.dictValue) {
optionEl.attr("checked", true)
break
}
}
} }
el.append(optionEl)
form.render('checkbox')
}) })
}) })
} }
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
</div> </div>
<div style="float: right;"> <div style="float: right;">
<div class="layui-inline"> <div class="layui-inline">
<input class="layui-input" placeholder="请输入客户名称"> <input class="layui-input" name="merchantName" placeholder="请输入客户名称">
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
<button class="layui-btn" lay-submit lay-filter="searchSubmit">查询</button> <button class="layui-btn" lay-submit lay-filter="searchSubmit">查询</button>
...@@ -335,6 +335,7 @@ ...@@ -335,6 +335,7 @@
item.btn.createSubMerchant = true item.btn.createSubMerchant = true
} }
} else { // 下级商户 } else { // 下级商户
console.log(item)
item.btn.edit = true item.btn.edit = true
item.btn.editPeriod = true item.btn.editPeriod = true
// 直属门店 // 直属门店
......
...@@ -58,6 +58,9 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) { ...@@ -58,6 +58,9 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) {
config = config || {} config = config || {}
var common = store.getEx('external') var common = store.getEx('external')
var settings = helper.clone(true, defaultSettings) var settings = helper.clone(true, defaultSettings)
if (isOtherUrl) {
delete settings.beforeSend
}
var data = helper.clone(true, { var data = helper.clone(true, {
timestamp: new Date().getTime() timestamp: new Date().getTime()
}, common.params, params) }, common.params, params)
...@@ -94,6 +97,8 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) { ...@@ -94,6 +97,8 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) {
} }
delete params.sign delete params.sign
var arr = [] var arr = []
var secretArr = []
for (var key in params) { for (var key in params) {
var isPush = false var isPush = false
$.each(noSignAttr, function (index, item) { $.each(noSignAttr, function (index, item) {
...@@ -102,12 +107,17 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) { ...@@ -102,12 +107,17 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) {
} }
}) })
if (!isPush) { if (!isPush) {
arr.push(key + params[key]) arr.push(key)
} }
} }
var str = arr.sort().join('') arr.sort()
for (var key in arr) {
var val = arr[key]
secretArr.push(val + params[val])
}
var str = secretArr.join('')
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() // 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!