218 lines
7.2 KiB
HTML

{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray{
width: 110px;
}
.addrhelper-ok-btn{
display: none;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<input type="hidden" name="id" value="{$detail.id}">
<h3 class="pb-3">编辑</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">选择商户</td>
<td colspan="4">
<div class="layui-col-md4">
<select lay-filter="merchant" lay-search>
<option value="" >请选择商户</option>
{volist name='merchant' id='vo'}
<option id="merchant{$vo.mer_id}" value="{$vo.mer_id}" >{$vo.real_name}</option>
{/volist}
</select>
</div>
</td>
</tr>
<tr>
<td colspan="4">
<div class="layui-col-md12">
<label class="layui-form-label">已选商户<font>*</font></label>
<div class="layui-input-block" id="merchantList" >
{volist name='detail.merchant' id='vo'}
<input type="checkbox" name="mer_id[]" value="{$vo.mer_id}" title="{$vo.mer_name}" checked>
{/volist}
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="layui-col-md4" id="address"></div>
</td>
</tr>
<tr>
<td colspan="4">
<div class="layui-col-md4">
<label class="layui-form-label">团队名称<font>*</font></label>
<div class="layui-input-block">
<input type="text" name="title" required lay-verify="required" value="{$detail.name}" placeholder="请输入团队名称" autocomplete="off" class="layui-input">
</div>
</div>
</td>
</tr>
<tr>
<td colspan="4">
<div class="layui-col-md4">
<label class="layui-form-label">团队电话<font>*</font></label>
<div class="layui-input-block">
<input type="text" name="phone" required lay-verify="required" value="{$detail.tel}" placeholder="请输入团队电话" autocomplete="off" class="layui-input">
</div>
</div>
</td>
</tr>
<tr>
<td colspan="4">
<div class="layui-col-md4">
<label class="layui-form-label">分润比例<font>*</font></label>
<div class="layui-input-block">
<input type="text" name="shareRate" required lay-verify="required" value="{$detail.shareRate}" autocomplete="off" class="layui-input">
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">请选择所在地址<font>*</font></td>
<td>
<div class="layui-col-md4">
<select name="" lay-filter="merchantAddress" lay-search>
<option value="">选择区域</option>
{volist name='arealist' id='vo'}
{if $detail.area.area_code == $vo.area_code}
<option value="{$vo.area_code}" selected >{$vo.area_name}</option>
{else /}
<option value="{$vo.area_code}" >{$vo.area_name}</option>
{/if}
{/volist}
</select>
</div>
<div class="layui-col-md4">
<label class="layui-form-label">街道/镇</label>
<div class="layui-input-block">
<div id="demo1"></div>
</div>
</div>
</td>
</tr>
</table>
<div class="pt-3">
<input type="hidden" name="id" value="{$detail.id}"/>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="/static/assets/js/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script src="/static/assets/js/xm-select.js"></script>
<script>
var moduleInit = ['tool','tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
// 下拉选中事件
form.on('select(merchant)', function(data){
if(data.value == null || data.value == '')
{
return false;
}
const title = $('#merchant' + data.value).text();
const html = `<input type="checkbox" id="mer_id` + data.value + `" name="mer_id[]" title="` + title + `" value="` + data.value + `" checked/>`
+ `<div id="mer_id_style` + data.value + `" class="layui-unselect layui-form-checkbox layui-form-checked" onclick="merchantxz(` + data.value + `)"><span>` + title + `</span><i class="layui-icon layui-icon-ok"></i></div>`;
$('#merchantList').append(html);
$("#merchant"+ data.value).remove();
$(".layui-this").remove();
});
form.on('select(merchantAddress)', function (data) {
street(data.value);
});
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
console.log(e);
layer.msg(e.msg);
if (e.code == 0) {
tool.tabRefresh(71);
tool.sideClose(1000);
}
}
tool.post('{$url[2]}', data.field, callback);
return false;
});
// 删除选中商户
function merchantxz(env)
{
if($('#mer_id'+env).attr("checked") == 'checked')
{
$('#mer_id'+env).removeAttr('checked');
$('#mer_id_style'+env).removeClass('layui-form-checked');
}else{
$('#mer_id'+env).attr('checked', 'checked');
$('#mer_id_style'+env).addClass('layui-form-checked');
}
}
var group_access = "{:session('gougu_admin')['group_access']}";
street("{$detail.area.area_code}");
function street (id) {
if(id == null || id == '')
{
return false;
}
var demo1 = xmSelect.render({
name: 'street_id',
el: '#demo1',
prop: {
name: 'name',
value: 'id',
},
data: [],
radio: true,
initValue: ['{$detail.street_id}'],
disabled: group_access == 2 || group_access==4 ? true : false
});
$.get('/api/geo/street?pcode=' + id, function (result) {
demo1.update({
data: result.data
});
});
}
}
</script>
{/block}
<!-- /脚本 -->