210 lines
7.1 KiB
HTML
210 lines
7.1 KiB
HTML
{extend name="app/shop/view/base.html"/}
|
|
{block name="resources"}
|
|
<style>
|
|
.fenxiao-header {
|
|
padding: 50px 0 100px 50px;
|
|
font-size: 20px;
|
|
font-weight: 600;
|
|
}
|
|
.layui-form {
|
|
position: relative;
|
|
}
|
|
.layui-form-label {
|
|
text-align: right;
|
|
margin-left: 60px;
|
|
}
|
|
.layui-form-item {
|
|
margin-bottom: 22px;
|
|
}
|
|
.fenxiao-select {
|
|
position: absolute;
|
|
left: 400px;
|
|
top: 135px;
|
|
}
|
|
.member-select {
|
|
position: absolute;
|
|
left: 400px;
|
|
top: 195px;
|
|
}
|
|
.layui-unselect.layui-form-radio.layui-form-radioed i:after {
|
|
background-color: #fff;
|
|
}
|
|
.layui-table-body {
|
|
max-height: 530px;
|
|
}
|
|
</style>
|
|
{/block}
|
|
{block name="main"}
|
|
<div class="layui-form ns-form">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label"><span class="required">*</span>关联店铺:</label>
|
|
<div class="layui-input-inline">
|
|
<input type="text" id="store_name" name="search_text" disabled class="layui-input">
|
|
<input type="hidden" id="site_id" name="site_id" class="layui-input">
|
|
</div>
|
|
<button class="layui-btn layui-btn2 ns-bg-color" onclick="addMember()">选择店铺</button>
|
|
</div>
|
|
<div class="form-row">
|
|
<button class="layui-btn bg-color" lay-submit lay-filter="save">保存</button>
|
|
<button class="layui-btn layui-btn-primary" onclick="back()">返回</button>
|
|
</div>
|
|
</div>
|
|
{/block}
|
|
|
|
{block name="script"}
|
|
<script type="text/html" id="addMember">
|
|
<div class="layui-form">
|
|
<div class="layui-input-inline" style="width: 205px;">
|
|
<input type="text" style="width: 205px;" name="member_search" placeholder="请输入商家名称账号手机号" autocomplete="off" class="layui-input ">
|
|
<button type="button" class="layui-btn layui-btn-primary member-search" style="height: 32px; line-height: 32px; position: absolute; right: 1px; top: 1px; border-width: 0; border-left-width: 1px;" lay-filter="search" lay-submit>
|
|
<i class="layui-icon"></i>
|
|
</button>
|
|
</div>
|
|
<table id="member_list" lay-filter="member_list"></table>
|
|
</div>
|
|
</script>
|
|
<script type="text/javascript">
|
|
var new_member_id = 0;
|
|
layui.use(['form', 'laytpl','table','laypage'], function() {
|
|
laytpl = layui.laytpl;
|
|
form = layui.form;
|
|
laypage = layui.laypage;
|
|
table = layui.table;
|
|
repeat_flag = false;
|
|
form.render();
|
|
var cert_upload = new Upload({
|
|
elem: '#cert_upload',
|
|
url: ns.url("wechatpay://shop/pay/uploadwechatcert"), //改成您自己的上传接口
|
|
accept: 'file',
|
|
callback:function (res) {
|
|
if (res.code >= 0) {
|
|
$("input[name='apiclient_cert']").val(res.data.path);
|
|
$("input[name='apiclient_cert']").siblings(".file-upload").text("已上传");
|
|
}
|
|
}
|
|
});
|
|
var key_upload = new Upload({
|
|
elem: '#key_upload',
|
|
url: ns.url("wechatpay://shop/pay/uploadwechatcert"), //改成您自己的上传接口
|
|
accept: 'file',
|
|
callback:function (res) {
|
|
if (res.code >= 0) {
|
|
$("input[name='apiclient_key']").val(res.data.path);
|
|
$("input[name='apiclient_key']").siblings(".file-upload").text("已上传");
|
|
}
|
|
}
|
|
});
|
|
/**
|
|
* 监听提交
|
|
*/
|
|
form.on('submit(save)', function(data) {
|
|
console.log(data);
|
|
// repeat_flag = true;
|
|
if(repeat_flag) return;
|
|
$.ajax({
|
|
url: location.href,
|
|
data: data.field,
|
|
dataType: 'JSON', //服务器返回json格式数据
|
|
type: 'POST', //HTTP请求类型
|
|
success: function(res) {
|
|
repeat_flag = false;
|
|
if (res.code == 0) {
|
|
layer.msg(res.message);
|
|
location.href = ns.url("saasagent://shop/pay/list")
|
|
} else {
|
|
layer.msg(res.message);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
})
|
|
function back() {
|
|
location.href = ns.url("saasagent://shop/pay/list");
|
|
}
|
|
function addMember() {
|
|
var add_attr2 = $("#addMember").html();
|
|
form.on('radio(laymemberid)', function(obj){
|
|
new_member_id = obj.value
|
|
var title3 = ($(this).data('index'))
|
|
console.log(title3);
|
|
$('#store_name').val(title3)
|
|
$('#site_id').val(obj.value)
|
|
})
|
|
laytpl(add_attr2).render({}, function(html) {
|
|
add_attr_index2 = layer.open({
|
|
title: '选择商家',
|
|
skin: 'layer-tips-class',
|
|
type: 1,
|
|
area: ['1000px', '800px'],
|
|
content: html,
|
|
btn:["保存","返回"],
|
|
yes: function(){
|
|
layer.close(add_attr_index2);
|
|
}
|
|
});
|
|
});
|
|
//展示已知数据
|
|
table = new Table({
|
|
elem: '#member_list',
|
|
url: ns.url("saasagent://shop/saas/list"),
|
|
cols: [
|
|
[{
|
|
width: "12%",
|
|
title: '商家选择',
|
|
unresize: 'false',
|
|
templet: function(data) {
|
|
var html = '';
|
|
html += `
|
|
<div>
|
|
<input type="radio" name="layTableRadioc" value="${data.site_id}" data-index="${data.contacts_name}" lay-type="layTableRadio" lay-filter="laymemberid">
|
|
</div>
|
|
`;
|
|
return html;
|
|
}
|
|
},{
|
|
title: '商家名称',
|
|
width: '50%',
|
|
unresize: 'false',
|
|
templet: function(data) {
|
|
var html = '';
|
|
html += `
|
|
<div>
|
|
<img style="width:40px; height:40px; margin-right:20px;" layer-src src="SHOP_IMG/default_headimg.png"><span>${data.contacts_name}</span>
|
|
</div>
|
|
`;
|
|
return html;
|
|
}
|
|
}, {
|
|
title: '账号',
|
|
width: '50%',
|
|
unresize: 'false',
|
|
field: 'username',
|
|
},
|
|
{
|
|
title: '店铺名称',
|
|
width: '50%',
|
|
unresize: 'false',
|
|
field: 'site_name',
|
|
}
|
|
]
|
|
],
|
|
});
|
|
/**
|
|
* 搜索功能
|
|
*/
|
|
form.on('submit(search)', function (data) {
|
|
table.reload({
|
|
page: {
|
|
curr: 1
|
|
},
|
|
where: data.field
|
|
});
|
|
});
|
|
$(document).keydown(function (event) {
|
|
if (event.keyCode == 13) {
|
|
$(".member-search").trigger("click");
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
{/block} |