Commit 98010574 by 胡悦

员工特殊商户的修改

1 parent ba3db8c8
...@@ -173,8 +173,8 @@ ...@@ -173,8 +173,8 @@
</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 style="line-height: 32px;">全部商户</div> --> <div class="hide" id="allMerchant" style="line-height: 32px;">全部商户</div>
<div class="layui-input-block"> <div class="layui-input-block" id="otherMerchant">
<input class="layui-input" placeholder="可见商户" id="searchMerchant" /> <input class="layui-input" placeholder="可见商户" id="searchMerchant" />
<div style="position: absolute; top: 0; left: 380px"> <div style="position: absolute; top: 0; left: 380px">
<button type="button" class="layui-btn" id="checkAll">全选</button> <button type="button" class="layui-btn" id="checkAll">全选</button>
...@@ -254,7 +254,8 @@ ...@@ -254,7 +254,8 @@
var visibleMerchant = {} var visibleMerchant = {}
pwd.attr('readonly', false) pwd.attr('readonly', false)
var accountInfo = helper.store.get('accountInfo') var accountInfo = helper.store.get('accountInfo')
// 是否是特殊商户
var specialVisible = ''
// 禁用所有input框的回车事件 // 禁用所有input框的回车事件
var inputs = document.getElementsByTagName('input') var inputs = document.getElementsByTagName('input')
for (let i = 0; i < inputs.length; i++) { for (let i = 0; i < inputs.length; i++) {
...@@ -413,18 +414,24 @@ ...@@ -413,18 +414,24 @@
// 提交表单 // 提交表单
form.on('submit(employeeSubmit)', function (data) { form.on('submit(employeeSubmit)', function (data) {
if (visibleMerchant.getCheckedNodes(true).length == 0) { if (specialVisible != '-1' && visibleMerchant.getCheckedNodes(true).length == 0) {
layer.msg('可见商户必选', { layer.msg('可见商户必选', {
icon: 2 icon: 2
}) })
return false return false
} }
var visibleInferiorMer = visibleMerchant var visibleInferiorMer = ''
if (specialVisible == '-1') {
visibleInferiorMer = '-1'
} else {
visibleInferiorMer = visibleMerchant
.getCheckedNodes(true) .getCheckedNodes(true)
.map(function (i) { .map(function (i) {
return i.id return i.id
}) })
.join(',') .join(',')
}
var otherParams = { var otherParams = {
visibleInferiorMer: visibleInferiorMer, visibleInferiorMer: visibleInferiorMer,
merchantId: merchantId merchantId: merchantId
...@@ -440,6 +447,7 @@ ...@@ -440,6 +447,7 @@
} }
var params = helper.clone(true, data.field, otherParams) var params = helper.clone(true, data.field, otherParams)
delete params.merhcnatImg delete params.merhcnatImg
console.log(params)
request(params, function (result) { request(params, function (result) {
if (result.code == '0') { if (result.code == '0') {
layer.msg('操作成功', { layer.msg('操作成功', {
...@@ -482,25 +490,46 @@ ...@@ -482,25 +490,46 @@
function getVisibleMerchant(merchantId) { function getVisibleMerchant(merchantId) {
var visibleMerchantParams = { id: merchantId, method: 'merchants.api.merchant.findMerchantTree' } var visibleMerchantParams = { id: merchantId, method: 'merchants.api.merchant.findMerchantTree' }
request(visibleMerchantParams, function (res) { request(visibleMerchantParams, function (res) {
console.log(res)
if (res.code == '0') { if (res.code == '0') {
const data = res.data
if (id) { if (id) {
findAllMerchant(function (result) { findAllMerchant(function (result) {
if (result) { if (result) {
getById(function (checkedList) { getById(function (checkedList) {
if (data.length == 1 && data[0].id == -1) {
$('#allMerchant').removeClass('hide')
specialVisible = data[0].id
// createMerchant(data[0].id, data)
$('#otherMerchant').addClass('hide')
} else {
createMerchant(checkedList, res.data) createMerchant(checkedList, res.data)
}
}) })
} }
}) })
} else { } else {
if (data.length == 1 && data[0].id == -1) {
$('#allMerchant').removeClass('hide')
specialVisible = data[0].id
// createMerchant(data[0].id, data)
$('#otherMerchant').addClass('hide')
} else {
const arr = [] const arr = []
arr.push(+merchantId) arr.push(+merchantId)
createMerchant(arr, res.data) createMerchant(arr, res.data)
specialVisible = ''
$('#otherMerchant').removeClass('hide')
$('#allMerchant').addClass('hide')
}
} }
} }
}) })
} }
function createMerchant(arr, data) { function createMerchant(arr, data) {
console.log(arr, data)
visibleMerchant = tree.create('visibleInferiorMerTree', data, null, { visibleMerchant = tree.create('visibleInferiorMerTree', data, null, {
check: { check: {
enable: true, enable: true,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!