Commit 789635c5 by 胡悦

Merge branch 'master' of 192.168.3.233:h5/account

2 parents bb05336d 6782024e
......@@ -81,9 +81,14 @@
<div id="app">
<main>
<div class="edit-box">
<p class="edit-title">企业基本信息</p>
<div>
<form class="layui-form">
<form class="layui-form" lay-filter="merchantForm">
<div class="layui-form-item edit-title" style="position: relative;">
<div class="layui-input-inline">企业基本信息</div>
<div class="layui-input-inline" style="position: absolute; right: 0; top: 5px; font-size: normal;">
<select id="channelEl" name="channelId"></select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required">商户名称:</label>
<div class="layui-input-inline">
......@@ -111,8 +116,8 @@
<div class="layui-form-item">
<label class="layui-form-label">商户地址:</label>
<div class="layui-input-inline">
<input disabled class="layui-input layui-btn-disabled" name="merchantAbbreviation"
placeholder="请选择商户地址">
<input style="color: #333333 !important;" name="merchantAddress" disabled
class="layui-input layui-btn-disabled" id="addrEl" placeholder="请选择商户地址">
</div>
</div>
<div class="layui-form-item">
......@@ -130,7 +135,7 @@
<div class="layui-form-item">
<label class="layui-form-label required">联系电话:</label>
<div class="layui-input-inline">
<input class="layui-input" name="merchantLegalPersonPhone" required lay-verify="required"
<input class="layui-input" name="merchantLegalPersonPhone" required lay-verify="required|phone"
placeholder="请输入联系电话">
</div>
</div>
......@@ -149,28 +154,24 @@
<div class="layui-form-item">
<label class="layui-form-label">驻店电话:</label>
<div class="layui-input-inline">
<input class="layui-input" name="residentPhone" placeholder="请输入驻点电话">
<input class="layui-input" name="residentPhone" placeholder="请输入驻点电话" lay-verify="phone">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">营业时间:</label>
<div class="layui-inline">
<div class="layui-input-inline">
<input type="text" id="startTime" class="layui-input" name="bussinessBegintime" placeholder="开始时间">
<input type="text" id="startDate" class="layui-input" name="bussinessBegintime" placeholder="开始时间">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" id="endTime" class="layui-input" name="bussinessEndtime" placeholder="结束时间">
<input type="text" id="endDate" class="layui-input" name="bussinessEndtime" placeholder="结束时间">
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">营业范围:</label>
<div class="layui-input-inline">
<input type="checkbox" name="businessScope[write]" title="保养" lay-skin="primary">
<input type="checkbox" name="businessScope[read]" title="维修" lay-skin="primary">
<input type="checkbox" name="businessScope[read]" title="清洗" lay-skin="primary">
<input type="checkbox" name="businessScope[read]" title="钣喷" lay-skin="primary">
<div class="layui-input-inline" id="busiScopeEl">
</div>
</div>
<div class="layui-form-item" id="custom-scope">
......@@ -178,7 +179,7 @@
<label class="layui-form-label"></label>
<div>
<div class="layui-input-inline">
<input class="layui-input business-scope" name="businessScopeCustomize1"
<input class="layui-input business-scope-cust" name="businessScopeCustomize"
placeholder="请自定义营业范围,建议不超过10个">
</div>
<div class="layui-input-inline">
......@@ -244,11 +245,25 @@
<div class="layui-form-item">
<label class="layui-form-label required">账户等级:</label>
<div class="layui-input-inline">
<select id="accountLevelEl" name="merchantAccountLevel" required lay-vertify="required" lay-search>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required">账户有效期:</label>
<div class="layui-input-inline">
<select id="validPeriodEl" name="effectiveTime" required lay-vertify="required" lay-search>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required">账户类型:</label>
<div class="layui-input-inline" id="accountTypeEl">
</div>
</div>
<div class="layui-form-item" style="text-align: center;">
<button class="layui-btn" lay-submit lay-filter="handleSubmit">下一步</button>
<button class="layui-btn" lay-submit lay-filter="handleCancel">取消</button>
<button class="layui-btn" data-type="handleCancel">取消</button>
</div>
</form>
</div>
......@@ -267,42 +282,64 @@
var helper = layui.helper
var editData = {}
var scopeIdx = 1
var treeObj = null
// 1-创建新商户;2-创建子商户;3-修改
var editLevel = 1
var id = null
var merchantForm = {
channelId: '',
merchantName: '',
merchantAbbreviation: '',
merchantType: '',
merchantOrgcode: '',
merchantLegalPerson: '',
merchantLegalPersonPhone: '',
isloginName: 0,
residentContact: '',
residentPhone: '',
bussinessBegintime: '',
bussinessEndtime: '',
lat: '',
lng: '',
merchantAddress: '',
businessScope: '',
merchantFiles: []
}
var baseData = {
carBrandTreeList: []
channelList: [],
carBrandTreeList: [],
accountLevelList: [],
validPeriodList: [],
busiScopeList: [],
accountTypeList: []
}
var startTime = laydate.render({
elem: '#startTime', //指定元素
type: 'time',
var startDate = laydate.render({
elem: '#startDate', //指定元素
type: 'date',
done: function (value, date) { //监听日期被切换
if (value != "") {
date.month = date.month - 1
endTime.config.min = date
endDate.config.min = date
} else {
endTime.config.min = startTime.config.min
endDate.config.min = startDate.config.min
}
lay('#startTime').html(value)
lay('#startDate').html(value)
}
})
var endTime = laydate.render({
elem: '#endTime', //指定元素
type: 'time',
var endDate = laydate.render({
elem: '#endDate', //指定元素
type: 'date',
done: function (value, date) { //监听日期被切换
if (value != "") {
date.month = date.month - 1
startTime.config.max = date
startDate.config.max = date
} else {
startTime.config.max = endTime.config.max
startDate.config.max = endDate.config.max
}
lay('#endTime').html(value)
lay('#endDate').html(value)
}
})
......@@ -316,18 +353,107 @@
helper.store.set('merchantMapObj', merchantForm)
form.on('submit(handleSubmit)', function (data) {
console.log(data.field)
var elList = $('.business-scope')
// console.log(data.field)
var formData = data.field
var params = {
isloginName: 0
}
var fieldToFormNameList = ['channelId', 'merchantName', 'merchantAbbreviation', 'merchantType',
'merchantOrgcode',
'merchantLegalPerson', 'merchantLegalPersonPhone', 'residentContact', 'residentPhone',
'merchantLoginAccount', 'merchantLoginPassword',
'merchantAccountLevel', 'effectiveTime'
]
if (formData.isloginName == 'on') {
params.isloginName = 1
}
if (formData.bussinessBegintime) {
merchantForm.bussinessBegintime = new Date(formData.bussinessBegintime)
params.bussinessBegintime = new Date(formData.bussinessBegintime)
}
if (formData.bussinessEndtime) {
merchantForm.bussinessEndtime = new Date(formData.bussinessEndtime)
params.bussinessEndtime = new Date(formData.bussinessEndtime)
}
if (merchantForm.lat) {
params.lat = merchantForm.lat
params.lng = merchantForm.lng
params.merchantAddress = merchantForm.merchantAddress
}
$.each(fieldToFormNameList, function (index, item) {
if (formData[item]) {
merchantForm[item] = formData[item]
params[item] = formData[item]
}
})
var checkClassNameList = [{
attr: 'businessScope',
toString: ','
}, {
attr: 'accounttypeId',
toString: ','
}]
$.each(checkClassNameList, function (index, item) {
var checkedArr = []
$('input[class=' + item.attr + ']:checked').each(function () {
checkedArr.push($(this).val())
})
if (checkedArr.length) {
if (item.toString) {
merchantForm[item.attr] = checkedArr.join(item.toString)
params[item.attr] = checkedArr.join(item.toString)
}
}
})
var elList = $('.business-scope-cust')
var tempList = []
$.each(elList, function (index, item) {
console.log(item.innerText)
tempList.push(item.value)
})
merchantForm.businessScopeCustomize = tempList.join(',')
params.businessScopeCustomize = tempList.join(',')
merchantForm.merchantBrand = treeObj.getCheckedNodes(true)
params.merchantBrand = findId(merchantForm.merchantBrand, []).join(',')
params.merchantFiles = JSON.stringify(merchantForm.merchantFiles)
if (editLevel == 1) {
params.method = 'cn.com.glsx.merchants.merchant.saveMerchant'
} else if (editLevel == 2) {
params.method = 'cn.com.glsx.merchants.merchant.saveMerchant'
} else if (editLevel == 3) {
params.method = 'cn.com.glsx.merchants.merchant.updateMerchant'
}
// 保存状态 1.草稿 2.发布 3.注销 4.过期
if (merchantForm.status) {
params.status = merchantForm.status
} else {
params.status = 1
}
// console.log(merchantForm)
console.log(params)
request(params, function (res) {
console.log(res)
go('merchant', 'index')
})
return false
})
function findId(nodeList, idList) {
// var idList = []
$.each(nodeList, function (index, item) {
if (item.children) {
findId(item.children, idList)
} else {
idList.push(item.id)
}
})
return idList
}
// 按钮事件绑定
var btnHandle = {
// 选择地址
handleSelectAddr: function () {
helper.store.set('merchantMapObj', merchantForm)
layer.open({
type: 2,
title: '选择地址',
......@@ -336,7 +462,7 @@
content: 'map.html',
success: function (layero, index) {
//向layer页面传值,传值主要代码
var body = layer.getChildFrame('body', index)
// var body = layer.getChildFrame('body', index)
// console.log(body)
//得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
// var iframeWin = window[layero.find('iframe')[0]['name']]
......@@ -352,7 +478,14 @@
var body = layer.getChildFrame('body', index)
body.find('#mapBtn').click()
var res = helper.store.get('merchantMapObj')
console.log(res)
merchantForm.lat = res.lat
merchantForm.lng = res.lng
merchantForm.merchantAddress = res.merchantAddress
setInput('#addrEl', merchantForm.merchantAddress)
layer.close(index)
},
end: function () {
helper.store.remove('merchantMapObj')
}
})
......@@ -363,7 +496,7 @@
var parent = $('#custom-scope')
var subParent = $('<div class="layui-form-item"><label class="layui-form-label"></label></div>')
var child1 = $(
'<div class="layui-input-inline"><input class="layui-input business-scope" name="businessScopeCustomize' +
'<div class="layui-input-inline"><input class="layui-input business-scope-cust" name="businessScopeCustomize' +
scopeIdx + '" placeholder="请自定义营业范围,建议不超过10个"></div>'
)
var child2 = $(
......@@ -389,6 +522,9 @@
subParent.append(child2)
parent.append(subParent)
// console.log(parent)
},
handleCancel() {
go('merchant', 'index')
}
}
......@@ -407,7 +543,7 @@
var addEl = $('.img-add' + idx)
var reader = new FileReader()
var fileInfo = el[0].files[0]
console.log(el)
// console.log(el)
reader.readAsDataURL(fileInfo)
reader.onload = function (e) {
if (e) {
......@@ -417,7 +553,10 @@
method: 'glsx.accounts.biz.common.pictureUpload',
file: base64
}, function (result) {
merchantForm.merchantFiles[idx] = result.data
merchantForm.merchantFiles[idx] = {
fileUrl: result.data,
fileName: ''
}
imgEl.attr('src', result.data)
imgEl.removeClass('hide')
imgEl.addClass('show')
......@@ -430,21 +569,153 @@
})
function init() {
getCarBrandTree()
editLevel = qs('editLevel')
id = qs('id')
if (editLevel == 3) {
// merchantName = qs('merchantName')
getMerchantInfo()
} else {
getBusiScope()
getCarBrandTree()
getAccountType()
}
getChannel()
getAccountLevel()
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() {
request({
method: 'cn.com.glsx.merchants.merchant.findMerchantDetail',
id: id
}, function (res) {
console.log(res.data)
form.val('merchantForm', res.data)
merchantForm = res.data
getBusiScope()
getCarBrandTree()
getAccountType()
// if (merchantForm.accountTypes.length) {
// setCheckbox(merchantForm.accountTypes, 'accounttypeId')
// }
})
}
// 渠道
function getChannel() {
getDictData('channel', function (res) {
baseData.channelList = res.data
setSelectOption('#channelEl', 'channelList', 'dictValue', 'dictLabel')
})
}
// 品牌
function getCarBrandTree() {
request({
method: 'cn.com.glsx.merchants.merchantCommon.getCarbrandTree'
}, function (res) {
console.log(res)
baseData.carBrandTreeList = res.data
tree.create('carBrandTree', res.data)
treeObj = tree.create('carBrandTree', res.data)
})
}
// 获取字典数据
function getDictData(dictType, fn) {
request({
method: 'cn.com.glsx.merchants.menu.findAllDictData',
dictType: dictType
}, function (res) {
fn && fn(res)
})
}
// 设置option
function setSelectOption(elName, listName, optionId, optionLabel) {
var el = $(elName)
$.each(baseData[listName], function (index, item) {
el.append(new Option(item[optionLabel], item[optionId]))
})
form.render('select')
}
// 设置input值
function setInput(elName, value) {
$(elName).val(value)
}
// 账户等级
function getAccountLevel() {
getDictData('account_level', function (res) {
baseData.accountLevelList = res.data
setSelectOption('#accountLevelEl', 'accountLevelList', 'dictValue', 'dictLabel')
})
}
// 有效期
function getPeriod() {
getDictData('account_validity_period', function (res) {
baseData.validPeriodList = res.data
setSelectOption('#validPeriodEl', 'validPeriodList', 'dictValue', 'dictLabel')
})
}
// 营业范围
function getBusiScope() {
getDictData('business_scope', function (res) {
baseData.busiScopeList = res.data
var el = $('#busiScopeEl')
$.each(baseData.busiScopeList, function (index, item) {
var optionEl = $('<input type="checkbox" class="businessScope" name="businessScope[' + item
.dictValue + ']" title=' +
item.dictLabel + ' value="' + item.dictValue + '" lay-skin="primary">')
el.append(optionEl)
form.render('checkbox')
// 修改-回显
if (editLevel == 3 && merchantForm.businessScope) {
setCheckbox(merchantForm.businessScope, 'businessScope')
}
})
})
}
// 账户类型
function getAccountType() {
getDictData('account_type', function (res) {
// console.log(res.data)
baseData.accountTypeList = res.data
var el = $('#accountTypeEl')
$.each(baseData.accountTypeList, function (index, item) {
var optionEl = $('<input type="checkbox" class="accounttypeId" name="accountType[' + item
.dictValue + ']" title=' +
item.dictLabel + ' value="' + item.dictValue + '">')
el.append(optionEl)
form.render('checkbox')
// 修改-回显
if (editLevel == 3 && merchantForm.accountTypes.length) {
setCheckbox(merchantForm.accountTypes, 'accounttypeId')
}
})
})
// 品牌
}
})
</script>
</body>
</html>
</html>
\ No newline at end of file
......@@ -26,6 +26,10 @@
white-space: normal;
}
.merchant #searchForm .layui-inline {
margin-bottom: 5px;
}
.layui-btn-xs {
cursor: pointer;
}
......@@ -39,11 +43,34 @@
<!-- <div id="tree"></div> -->
<div class="context-block">
<div class="search-block">
<button class="layui-btn" id="addBtn" lay-filter="handleAdd">创建商户</button>
<form class="layui-form" lay-filter="searchFilter" id="searchForm">
<!-- <div>
<button class="layui-btn" lay-filter="handleAdd">创建商户</button>
</div> -->
<div class="layui-inline" id="operateEl">
<button class="layui-btn" id="addBtn">创建商户</button>
<div class="layui-inline">
<label class="layui-form-label">渠道:</label>
<div class="layui-input-inline">
<select name="channelId" id="channelIdEl">
<option value="">请选择渠道</option>
</select>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">账户等级:</label>
<div class="layui-input-inline">
<select name="merchantAccountLevel" id="accountLevelEl">
<option value="">请选择账户等级</option>
</select>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">账户类型:</label>
<div class="layui-input-inline">
<select name="accounttypeId" id="accountTypeIdEl">
<option value="">请选择账户类型</option>
</select>
</div>
</div>
</div>
<div class="layui-inline">
<div class="layui-input-inline" style="width: 120px;">
<select name="name" lay-filter="nameFilter">
......@@ -58,7 +85,7 @@
<div class="layui-inline">
<label class="layui-form-label">客户状态:</label>
<div class="layui-input-inline">
<select name="status" id="searchStatus">
<select name="status" id="searchStatusEl">
<option value="">请选择客户状态</option>
</select>
</div>
......@@ -82,106 +109,37 @@
<script src="/js/load.js"></script>
<script type="text/html" id="merchantBtns">
<a class="layui-btn-xs" lay-event="handleDetail">查看</a>
{{# if((d.btn.edit)){ }}
<a class="layui-btn-xs" lay-event="handleEdit">修改</a>
{{# } }}
{{# if((d.btn.createSubMerchant)){ }}
<a class="layui-btn-xs" lay-event="handleAddMerchant">创建子商户/门店</a>
{{# } }}
{{# if((d.btn.createStaff)){ }}
<a class="layui-btn-xs" lay-event="handleAddStaff">创建员工</a>
{{# } }}
{{# if((d.btn.editPeriod)){ }}
<a class="layui-btn-xs" lay-event="handleVaildPeriod">修改账户有效期</a>
{{# } }}
</script>
<script>
layui.use(['gtree', 'request', 'store', 'table', 'layer'], function () {
layui.use(['gtree', 'request', 'helper', 'table', 'layer'], function () {
var tree = layui.gtree
var request = layui.request
var table = layui.table
var form = layui.form
var $ = layui.$
var helper = layui.helper
var user = helper.store.get('user')
var isDxternal = helper.store.get('isDxternal')
var baseData = {
statusList: []
statusList: [],
channelList: [],
accountLevelList: [],
accountTypeList: []
}
// var list = [{
// confId: '1',
// confLabel: '账号登陆名'
// }, {
// confId: '2',
// confLabel: '手机号'
// }]
// var select = $("#searchName")
// $.each(list, function (index, item) {
// select.append(new Option(item.confLabel, item.confId))
// })
// form.render('select')
// request({
// a: 1
// })
var inst = tree.create('tree', [{
id: 1,
label: '一级菜单',
children: [{
id: 4,
label: '二级菜单',
children: [{
id: 9,
label: '三级功能',
children: [
// value: '1,2,3|人保,平安,寿险'
{
id: 111,
label: '人保',
logo: 'PR'
},
{
id: 112,
label: '平安',
logo: 'PR'
},
{
id: 113,
label: '寿险',
logo: 'PR'
}
]
},
{
id: 10,
label: '三级功能-1',
value: null
}
]
}]
},
{
id: 2,
label: '一级菜单2',
children: [{
id: 5,
label: '二级菜单2',
children: [
// value: '1,2,3|人保,平安,寿险'
{
id: 114,
label: '人保',
logo: 'PR'
},
{
id: 115,
label: '平安',
logo: 'PR'
},
{
id: 116,
label: '寿险',
logo: 'PR'
}
]
},
{
id: 6,
label: '二级菜单2.0'
}
]
}
])
var merchantTable = table.render({
elem: '#merchantTable',
page: true,
......@@ -249,9 +207,10 @@
})
table.on('tool(merchant-table-filter)', function (obj) {
console.log(obj)
// console.log(obj)
var eventName = obj.event
var row = obj.data
console.log(row)
switch (eventName) {
// 查看
case 'handleDetail':
......@@ -259,60 +218,65 @@
break
// 修改
case 'handleEdit':
// 1-创建新商户;2-创建子商户;3-修改
go('merchant', 'edit', {
editLevel: 3,
id: row.id
// merchantName: row.merchantName
})
break
// 创建子商户/门店
case 'handleAddMerchant':
go('merchant', 'edit')
// 1-创建新商户;2-创建子商户;3-修改
go('merchant', 'edit', {
editLevel: 2,
id: row.id
})
break
// 创建员工
case 'handleAddStaff':
go('merchant', 'edit')
go('employee', 'add')
break
// 修改账户有效期
case 'handleVaildPeriod':
// console.log(row)
var layerIdx = layer.open({
layer.open({
type: 2,
title: '修改账户的有效期',
area: ['700px', '420px'],
fixed: false, //不固定
// maxmin: true,
btn: ['确定', '取消'],
content: 'validPeriodForm.html?id=' + row.id + '&validPeriod=' + '365',
content: 'validPeriodForm.html?id=' + row.id + '&effectiveTime=' + row.effectiveTime,
yes: function (index, layero) {
// console.log(layero)
// var res = window["layui-layer-iframe" + index].callbackdata()
// console.log(res)
// 获取iframe层的body
var body = layer.getChildFrame('body', index)
body.contents().find('#isValid').attr('value', 'no')
helper.store.set('isRefresh', false)
body.find('#periodVerifyBtn').click()
if (body.contents().find('#isValid').val() === 'yes') {
// console.log('+++++++++++')
layer.msg('操作成功', {
icon: 1
})
layer.close(index)
}
},
cancel: function (index, layero) {
// layer.close(index)
end: function () {
var isRefresh = helper.store.get('isRefresh')
if (isRefresh) {
getTabelList()
}
helper.store.remove('isRefresh')
}
})
console.log(layerIdx)
break
}
})
getVaildPeriod()
getTabelList()
init()
// form.on('handleAdd', function () {
// console.log('00000')
// return false
// })
$('#addBtn').on('click', function() {
go('merchant', 'edit')
$('#addBtn').on('click', function () {
// 1-创建新商户;2-创建子商户;3-修改
go('merchant', 'edit', {
editLevel: 1
})
return false
})
// 搜索绑定事件
form.on('submit(searchSubmit)', function () {
......@@ -345,6 +309,61 @@
var data = res.data
$.each(data.data, function (index, item) {
item.index = index + 1 + pageSize * (pageNum - 1)
item.btn = {
edit: false,
createSubMerchant: false,
createStaff: false,
editPeriod: false
}
/** btn
* check - 查看(无需判断,均有)
* edit - 修改
* createSubMerchant - 创建子商户/门店
* createStaff - 创建员工
* editPeriod - 修改账户有效期
* **/
// status(账户状态 - 列表):1-草稿;2-正常;3-注销;4-过期
// merchantAccountLevel(账户等级 - 列表):1-工厂;2-省代;3-市代;4-门店
// 外部系统
if (isDxternal) {
// 状态 - 正常
if (item.status == 2) {
// 本身
if (item.id == user.merchantId) {
item.btn.createStaff = true
if (merchantAccountLevel != 4) {
item.btn.createSubMerchant = true
}
} else { // 下级商户
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
}
} 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
......@@ -358,22 +377,75 @@
})
}
// 获取有效期
function getVaildPeriod() {
// 获取字典数据
function getDictData(dictType, fn) {
request({
method: 'cn.com.glsx.merchants.menu.findAllDictData',
dictType: 'merchant_status'
dictType: dictType
}, function (res) {
if (res.code === '0') {
baseData.statusList = res.data
var searchStatus = $("#searchStatus")
$.each(baseData.statusList, function (index, item) {
searchStatus.append(new Option(item.dictLabel, item.dictValue))
})
form.render('select')
}
fn && fn(res)
})
}
// 设置option
function setSelectOption(elName, listName, optionId, optionLabel) {
var el = $(elName)
$.each(baseData[listName], function (index, item) {
el.append(new Option(item[optionLabel], item[optionId]))
})
form.render('select')
}
// 获取有效期
function getVaildPeriod() {
getDictData('merchant_status', function (res) {
baseData.statusList = res.data
setSelectOption('#searchStatusEl', 'statusList', 'dictValue', 'dictLabel')
})
}
// 获取渠道
function getChannel() {
getDictData('channel', function (res) {
baseData.channelList = res.data
setSelectOption('#channelIdEl', 'channelList', 'dictValue', 'dictLabel')
})
}
// 获取账户等级
function getAccountLevel() {
getDictData('account_level', function (res) {
baseData.accountLevelList = res.data
setSelectOption('#accountLevelEl', 'accountLevelList', 'dictValue', 'dictLabel')
})
}
// 获取账户类型
function getAccountType() {
getDictData('account_type', function (res) {
baseData.accountTypeList = res.data
setSelectOption('#accountTypeIdEl', 'accountTypeList', 'dictValue', 'dictLabel')
})
}
// 功能点按需出现
function elRemove() {
$('#operateEl').remove()
}
function init() {
// 运营系统
// if (!isDxternal) {
if (isDxternal) {
getChannel()
getAccountLevel()
getAccountType()
} else {
elRemove()
}
getVaildPeriod()
getTabelList()
}
})
</script>
</body>
......
......@@ -67,7 +67,7 @@
</button>
</div>
<div class="layui-form-item">
<div align="center" class="layui-input-inline" style="width: 400px; height: 300px;">
<div class="layui-input-inline" style="width: 400px; height: 300px;">
<div id="container"></div>
</div>
<div class="poi-list layui-input-inline poi-list" id="pois"></div>
......@@ -128,9 +128,9 @@
function init() {
var __pos = null
mapData = helper.store.get('merchantMapObj')
// console.log(mapData)
if (mapData.lat && mapData.lng) {
__pos = [mapData.lat, mapData.lng]
__pos = [mapData.lng, mapData.lat]
modelVal('merchantAddress', mapData.merchantAddress)
}
marker = new AMap.Marker({
......
......@@ -26,63 +26,49 @@
<div class="layui-form-item">
<div class="layui-form-label required" style="width: 120px;">账户有效期:</div>
<div class="layui-input-inline" style="width: auto;">
<select name="validPeriod" id="periodSelect" required lay-verify="required">
<select name="effectiveTime" id="periodSelect" required lay-verify="required">
<option value="">请选择</option>
</select>
<p>(注:永久有效不超过所属工厂商户的有效期)</p>
</div>
<button id="periodVerifyBtn" lay-submit lay-filter="periodSubmit" style="display: none;"></button>
<!-- <div class="layui-form-item" style="padding: 40px 20px;">
<div class="layui-input-inline">
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="validSubmit">立即提交</button>
<button type="reset" class="layui-btn layui-btn-sm layui-btn-primary">重置</button>
</div>
</div> -->
</div>
</form>
<input type="text" id="isValid" name="isValid" value="no" style="display: none;" class="layui-input">
</main>
</div>
<script src="https://www.layuicdn.com/layui/layui.js"></script>
<script src="/js/load.js"></script>
<script>
layui.use(['form', 'request'], function () {
layui.use(['form', 'helper', 'request'], function () {
var form = layui.form
var request = layui.request
var $ = layui.$
var helper = layui.helper
var currLayerIdx = parent.layer.getFrameIndex(window.name)
var baseData = {}
var vaildData = {
id: getQueryString('id'),
validPeriod: getQueryString('validPeriod')
effectiveTime: getQueryString('effectiveTime')
}
getVaildPeriod()
// form.on('submit(validSubmit)', function (data) {
// var params = {
// id: vaildData.id,
// validPeriod: data.field.validPeriod
// }
// console.log(params)
// // layer.msg('操作成功', { time: 2000 })
// parent.layer.close(currLayerIdx)
// return false
// })
form.on('submit(periodSubmit)', function (data) {
// console.log(data)
// console.log('点击啦---')
// 调接口
$('#isValid').attr('value', 'yes')
var params = {
method: 'cn.com.glsx.merchants.merchant.updateValPerByMerId',
id: vaildData.id,
effectiveTime: data.field.effectiveTime
}
request(params, function (res) {
if (res.code == '0') {
helper.store.set('isRefresh', true)
parent.layer.close(currLayerIdx)
}
})
return false
})
// function callbackdata() {
// return vaildData
// }
// 获取参数
function getQueryString(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')
......@@ -100,13 +86,13 @@
dictType: 'account_validity_period'
}, function (res) {
if (res.code === '0') {
baseData.validPeriodList = res.data
baseData.effectiveTimeList = res.data
var periodSelect = $('#periodSelect')
$.each(baseData.validPeriodList, function (index, item) {
$.each(baseData.effectiveTimeList, function (index, item) {
periodSelect.append(new Option(item.dictLabel, item.dictValue))
})
form.val('periodFilter', {
validPeriod: vaildData.validPeriod
effectiveTime: vaildData.effectiveTime
})
form.render('select')
}
......
......@@ -45,6 +45,11 @@ function append() {
function isAppend() {
var _href = location.href.split('/')
var _path = _href.slice(_href.length - 1, _href.length).toString()
layui.use(['store'], function () {
var store = layui.store
// isDxternal: true - 外部独立系统;false - 运营平台
store.set('isDxternal', _path.split('?')[0] !== 'login.html' && self == top)
})
return _path.split('?')[0] !== 'login.html' && self == top
}
......
......@@ -59,6 +59,7 @@
if (result.code == '0') {
var sessionId = result.data.sessionId
helper.store.set('token', sessionId)
helper.store.set('user', result.data)
go('merchant', 'index')
}
})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!