|
@@ -0,0 +1,303 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html>
|
|
|
+<head>
|
|
|
+ <meta charset="utf-8">
|
|
|
+ <title>公众号管理</title>
|
|
|
+ <script src="../../js/min-loader-next.js"></script>
|
|
|
+</head>
|
|
|
+<body class="content">
|
|
|
+ <!-- <form class="layui-form" action="javascript:void(0)" id = "formRole">
|
|
|
+ <div class="" style="padding: 0.5rem 1rem;">
|
|
|
+ <input class="y-left-input" type="text" name="name" id ="name" value="" placeholder="请输入角色名称" />
|
|
|
+ <button class="y-search" data-type="reset" >重置</button>
|
|
|
+ <button class="y-search" data-type="reload" >搜索</button>
|
|
|
+ <button class="y-search" id = "addBtn">添加</button>
|
|
|
+ </div>
|
|
|
+ <div class="shadow-content" style="margin:1.5rem;">
|
|
|
+ <table id="tableTest" lay-filter="tableFilter"></table>
|
|
|
+ </div>
|
|
|
+ </form> -->
|
|
|
+ <div class="order-body">
|
|
|
+ <div class="order-tiaojian back-gray">
|
|
|
+ <div class="tiaojian-part1" id = "conditions">
|
|
|
+ <div class="fl f12-gray4-op mt4">所选条件:</div>
|
|
|
+ </div>
|
|
|
+ <div class="tiaojian-part2 fr demoTable">
|
|
|
+ <button class="layui-btn order-bnt1" data-type="reload" >搜索</button>
|
|
|
+ <button class="layui-btn order-bnt2" data-type="reset">重置</button>
|
|
|
+ <a href="#" id="toggle" class="top">收起</a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <form class="layui-form" action="javascript:void(0)" id = "formRole">
|
|
|
+ <div class="order-select back-border" id="content">
|
|
|
+ <div class="layui-inline">
|
|
|
+ <label class="f12-gray4">公众号名称:</label>
|
|
|
+ <input onchange = "changeSelectCon(0,this,'inp')" class="search-select" type="tel" name="tencentName" id ="tencentName" value="" placeholder="请输入公众号名称" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="shadow-content" style="margin:1.5rem;">
|
|
|
+ <table id="tableTest" lay-filter="tableFilter"></table>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <script type="text/html" id="barDemo">
|
|
|
+ <!--<a class="layui-btn layui-btn-xs" lay-event="detail">查看</a>-->
|
|
|
+ <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
|
|
+ <a class="layui-btn layui-btn-xs" lay-event="associated">关联客户</a>
|
|
|
+ <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
|
|
+ <!-- 这里同样支持 laytpl 语法,如: -->
|
|
|
+ {{# if(d.certtype == '1'){ }}
|
|
|
+ <a class="layui-btn layui-btn-xs" lay-event="check">审核</a>
|
|
|
+ {{# } }}
|
|
|
+ </script>
|
|
|
+ <script type="text/html" id="barDemo1">
|
|
|
+ <a class="layui-btn layui-btn-xs" lay-event="choose">选择</a>
|
|
|
+ </script>
|
|
|
+ <script>
|
|
|
+ $("#toggle").click(function() {
|
|
|
+ $(this).html($("#content").is(":hidden") ? "收起" + "<i class='iconfont up iconSelect_drop-down'/></i>" : "展开" +
|
|
|
+ "<i class='iconfont up iconSelect_drop-down'/></i>");
|
|
|
+ $("#content").slideToggle();
|
|
|
+ });
|
|
|
+ var table;
|
|
|
+ layui.use('table', function(){
|
|
|
+ table = layui.table;
|
|
|
+
|
|
|
+ // 加载数据
|
|
|
+ table.render({
|
|
|
+ //tbname:'roleTable',
|
|
|
+ id: 'tableTest'
|
|
|
+ ,elem: '#tableTest'
|
|
|
+ ,limit:10
|
|
|
+ ,url: '../../TencentManageAction/tencentManageQuery' //数据接口
|
|
|
+ ,method: 'post'
|
|
|
+ ,where:{MINView:"JSON"}
|
|
|
+ ,page: true //开启分页
|
|
|
+ ,cols: [[ //表头
|
|
|
+ {field: 'operate', title: '选择', width:'10%', toolbar: '#barDemo1'}
|
|
|
+ ,{field:'num', title: '序号',width:'10%', type:'numbers'}
|
|
|
+ ,{field: 'tencentName', title: '公众号名称', width:'10%'}
|
|
|
+ ,{field: 'vxNum', title: '微信号', width:'10%'}
|
|
|
+ ,{field: 'vxId', title: '微信原始ID', width:'10%'}
|
|
|
+ ,{field: 'appId', title: 'APPID(应用ID)', width:'10%'}
|
|
|
+ ,{field: 'appSecret', title: 'AppSecret(应用秘钥)', width:'15%'}
|
|
|
+ ,{field: 'personName', title: '关联客户', width: '20%'}
|
|
|
+ ]]
|
|
|
+ ,done: function(res, curr, count){
|
|
|
+ //如果是异步请求数据方式,res即为你接口返回的信息。
|
|
|
+ //如果是直接赋值的方式,res即为:{data: [], count: 99} data为当前页数据、count为数据总长度
|
|
|
+ console.log(res);
|
|
|
+
|
|
|
+ //得到当前页码
|
|
|
+ console.log(curr);
|
|
|
+
|
|
|
+ //得到数据总量
|
|
|
+ console.log(count);
|
|
|
+ }
|
|
|
+ ,even: true //开启隔行背景
|
|
|
+ });
|
|
|
+
|
|
|
+ // 监听工具条(操作)
|
|
|
+ table.on('tool(tableFilter)', function(obj){ //注:tool是工具条事件名,tableFilter是table原始容器的属性 lay-filter="对应的值"
|
|
|
+ var data = obj.data; //获得当前行数据
|
|
|
+ var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值)
|
|
|
+ var tr = obj.tr; //获得当前行 tr 的DOM对象
|
|
|
+
|
|
|
+ if(layEvent === 'detail'){ //查看
|
|
|
+ showDetail(data);
|
|
|
+ //do somehing
|
|
|
+ } else if(layEvent === 'del'){ //删除
|
|
|
+ layer.confirm('确认删除此数据?', function(index){
|
|
|
+ layer.close(index);
|
|
|
+ //向服务端发送删除指令roleDelete
|
|
|
+ $.request({
|
|
|
+ action : "../../TencentManageAction/deleteTencent",
|
|
|
+ data : {
|
|
|
+ id : data.vtiId
|
|
|
+ },
|
|
|
+ success : function(resData) {
|
|
|
+ if (resData.MINStatus == 0) {
|
|
|
+ layer.alert('操作成功!', {icon: 1});
|
|
|
+ obj.del(); //删除对应行(tr)的DOM结构,并更新缓存
|
|
|
+ } else {
|
|
|
+ layer.alert(resData.MINErrorMessage, {
|
|
|
+ icon: 5,
|
|
|
+ title: "提示"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error : function(data2){
|
|
|
+ layer.alert(data2.MINErrorMessage, {
|
|
|
+ icon: 5,
|
|
|
+ title: "提示"
|
|
|
+ });
|
|
|
+// layer.alert(resData.MINErrorMessage, {icon: 2});
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ } else if(layEvent === 'edit'){ //编辑
|
|
|
+ updateDetail(data);
|
|
|
+ } else if(layEvent === 'associated'){ //关联客户
|
|
|
+ associatedDetail(data);
|
|
|
+ }else if(layEvent == 'choose'){
|
|
|
+ parentPass(data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ var $ = layui.$, active = {
|
|
|
+ getCheckData: function(){ //获取选中数据
|
|
|
+ var checkStatus = table.checkStatus('tableTest')
|
|
|
+ ,data = checkStatus.data;
|
|
|
+ layer.alert(JSON.stringify(data));
|
|
|
+ }
|
|
|
+ ,getCheckLength: function(){ //获取选中数目
|
|
|
+ var checkStatus = table.checkStatus('tableTest')
|
|
|
+ ,data = checkStatus.data;
|
|
|
+ layer.msg('选中了:'+ data.length + ' 个');
|
|
|
+ }
|
|
|
+ ,isAll: function(){ //验证是否全选
|
|
|
+ var checkStatus = table.checkStatus('tableTest');
|
|
|
+ layer.msg(checkStatus.isAll ? '全选': '未全选')
|
|
|
+ }
|
|
|
+ //搜索
|
|
|
+ ,reload: function(){
|
|
|
+ reloadRole();
|
|
|
+ }
|
|
|
+ //重置
|
|
|
+ ,reset : function(){
|
|
|
+ $('#formRole')[0].reset();
|
|
|
+ $("#conditions").html('<div class="fl f12-gray4-op mt4">所选条件:</div>');
|
|
|
+ }
|
|
|
+ };
|
|
|
+// $('.demoTable .layui-btn').on('click', function(){
|
|
|
+// var type = $(this).data('type');
|
|
|
+// active[type] ? active[type].call(this) : '';
|
|
|
+// });
|
|
|
+ $('.layui-btn').on('click', function(){
|
|
|
+ var type = $(this).data('type');
|
|
|
+ active[type] ? active[type].call(this) : '';
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ function reloadRole() {
|
|
|
+ //角色名称
|
|
|
+ var tencentName = $("#tencentName").val();
|
|
|
+ //执行重载
|
|
|
+ table.reload('tableTest', {
|
|
|
+ page: {
|
|
|
+ curr: 1 //重新从第 1 页开始
|
|
|
+ }
|
|
|
+ ,where: {
|
|
|
+ tencentName : tencentName,
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function updateDetail(data) {
|
|
|
+ layui.sessionData("ROW_DATA", {key:"NOW_ROW", value:data});
|
|
|
+ layer.open({
|
|
|
+ type: 2,
|
|
|
+ title: '公众号修改',
|
|
|
+ shadeClose: true,
|
|
|
+ shade:0.8,
|
|
|
+ //maxmin: true, //开启最大化最小化按钮
|
|
|
+ area: ['75%', '85%'],
|
|
|
+ content: '../../admin/tencentManage/tencentUpdate.html'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ function associatedDetail(data) {
|
|
|
+ layui.sessionData("ROW_DATA", {key:"NOW_ROW", value:data});
|
|
|
+ layer.open({
|
|
|
+ type: 2,
|
|
|
+ title: '关联客户',
|
|
|
+ shadeClose: true,
|
|
|
+ shade:0.8,
|
|
|
+ //maxmin: true, //开启最大化最小化按钮
|
|
|
+ area: ['75%', '85%'],
|
|
|
+ content: '../../admin/tencentManage/tencentAssociated.html'
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 新增
|
|
|
+ $("#addBtn").click(function(){
|
|
|
+ // 打开新增页面
|
|
|
+ openMainTabPage('415001-01', ' 新增公众号', 'tencentManage/tencentAdd.html', '', '415001', reloadRole);
|
|
|
+ })
|
|
|
+ function changeSelectCon(index, t, type, dateValue){
|
|
|
+ if (type == "date") {
|
|
|
+ if (isEmpty(dateValue)) {
|
|
|
+ $("#search" + index).remove();
|
|
|
+ } else {
|
|
|
+ $("#search" + index).remove();
|
|
|
+ if (isEmpty($("#search" + index).attr("name"))) {
|
|
|
+ $("#conditions").append(getSelectConHtml(index, t, type,dateValue));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (type == 'inp') {
|
|
|
+ if (isEmpty($(t).val())) {
|
|
|
+ $("#search" + index).remove();
|
|
|
+ } else {
|
|
|
+ $("#search" + index).remove();
|
|
|
+ if (isEmpty($("#search" + index).attr("name"))) {
|
|
|
+ $("#conditions").append(getSelectConHtml(index, t, type));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (isEmpty($(t).val())) {
|
|
|
+ $("#search" + index).remove();
|
|
|
+ } else {
|
|
|
+ $("#search" + index).remove();
|
|
|
+ if (isEmpty($("#search" + index).attr("name"))) {
|
|
|
+ $(t).attr("id","subjects");
|
|
|
+ $("#conditions").append(getSelectConHtml(index, t, type));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var array = new Array('产品名称','订单编号');
|
|
|
+ function getSelectConHtml(index, t, type,dateValue){
|
|
|
+ var name;
|
|
|
+ var value;
|
|
|
+ if(type == "inp"){
|
|
|
+ value = t.value.substr(0,5)+"..";
|
|
|
+ }
|
|
|
+ if (type == "date") {
|
|
|
+ value = dateValue;
|
|
|
+ }
|
|
|
+ if(type == "sel"){
|
|
|
+ value = $("#state").find("option:selected").text();
|
|
|
+ }
|
|
|
+ if (type == "date") {
|
|
|
+ name = $("#"+t).attr("id");
|
|
|
+ } else {
|
|
|
+ name = $(t).attr("id");
|
|
|
+ }
|
|
|
+ var html = '<div class="fl xuanzhong-active" id = "search' + index + '" name = "' + name + '" onclick = "removeSearch(this)">' +
|
|
|
+ '<div class="fl">' + array[index] + '</div>' +
|
|
|
+ ':<i class="iconfont">'+value+'</i>' +
|
|
|
+ '<svg class="icon" aria-hidden="true">' +
|
|
|
+ '<use xlink:href="#iconicon_close1"></use>' +
|
|
|
+ '</svg>' +
|
|
|
+ '</div>';
|
|
|
+ return html;
|
|
|
+ }
|
|
|
+ function removeSearch(t) {
|
|
|
+ if ($(t).attr("name") == 'subjects') {
|
|
|
+ initSelect('state', "ORDER_STT", "state", ' ', true);
|
|
|
+ form.render();
|
|
|
+ $(t).remove();
|
|
|
+ } else {
|
|
|
+ $("#"+$(t).attr("name")).val('');
|
|
|
+ $(t).remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function parentPass(data){
|
|
|
+ window.parent.childRetunDatas(data);
|
|
|
+ parent.layer.close(parent.layer.index);
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+</body>
|
|
|
+</html>
|