123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- var delFiles = []; //用于删除图片
- var filesContainer= {}; //存储最终要上传的图片
- var files ; //存储选择图片的数量
- var fContainer= {}; //用于传父级传变量,格式 parent.fContainer
- var depositImg =[];//用于存放弹窗图片
- layui.use(['form','layer','laydate','table','laytpl','layedit','upload'],function(){
- var form = layui.form,
- layer = layui.layer,
- $ = layui.jquery,
- laydate = layui.laydate,
- table = layui.table,
- layedit = layui.layedit
- var tableIds = 'jclist';
- //楼盘列表
- var tableIns = table.render({
- elem: '#'+tableIds,
- url : '/wx/jchomeform',
- method:'post',
- page : true,
- limit : 20,
- id:'tablerReload',
- cols : [[
- {type: "checkbox", width:50},
- {type:'numbers'},
- {field: 'name', title: '奖次', align:"center",sort: true},
- {field: 'state', title: '状态', align:"center",sort: true,templet:function(d){
- if(d.state == '未抽'){
- return '<span>'+d.state+' </span>';
- }else {
- return '<span style="color:red">'+d.state+' </span>';
- }
- }},
- {field: 'total', title: '中奖人数', align:"center",sort: true,templet:function (d) {
- if(d.total == 0){
- return '<span>'+d.total+' </span>';
- }else{
- return '<span style="color:red">'+d.total+' </span>';
- }
- }},
- {field: 'create_at', title: '添加时间',width:150, event:'sortData', align:'center',sort: true},
- {title: '操作', width:300, templet:'#housesListBar',fixed:"right",align:"center"}
- ]]
- });
- // table.reload('tablerReload'); //重新加载
- //表格头部操作菜单
- var $ = layui.$, active = {
- addData: function(){ //获取选中数据
- var index = layui.layer.open({
- title : "添加微信用户",
- type : 2,
- area:['80%','100%'],
- maxmin: true,
- content : "/wx/jccreate",
- end:function () {
- table.reload('tablerReload');
- }
- })
- // layui.layer.full(index);
- // //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
- // $(window).on("resize",function(){
- // layui.layer.full(index);
- // })
- },
- DataClear:function () {
- $.ajax({
- type:"post", //请求方式
- async:true, //是否异步
- url:"http://wx.pinfangge.top/home/yaoclear",
- dataType:"jsonp", //跨域json请求一定是jsonp
- jsonp: "callbackparam", //跨域请求的参数名,默认是callback
- //jsonpCallback:"successCallback", //自定义跨域参数值,回调函数名也是一样,默认为jQuery自动生成的字符串
- success: function(data) {
- //请求成功处理,和本地回调完全一样
- },
- error: function() {
- //请求出错处理
- }
- });
- // $.post('http://wx.pinfangge.top/home/yaoclear',{},function (data) {
- // // layer.msg(data.msg);
- // })
- }
- };
- $('.demoTable .layui-btn').on('click', function(){
- var type = $(this).data('type');
- active[type] ? active[type].call(this) : '';
- });
- //添加
- form.on('submit(addjc)',function (data) {
- $.post('/wx/jccreateform',{name:data.field.name,sort:data.field.sort},function (data) {
- layer.msg(data.msg);
- })
- return false;
- })
- //修改
- form.on('submit(editjc)',function (data) {
- $.post('/wx/jceditform',{name:data.field.name,id:data.field.id,sort:data.field.sort},function (data) {
- layer.msg(data.msg);
- })
- return false;
- })
- //监听指定开关
- // form.on('switch(switchTest)', function(data){
- // layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
- // $.post('/house/housesortedit',{id:data.value,examineid:1},function (data) {
- // if(data.code == 200)
- // {
- // layer.msg(data.msg);
- // table.reload('tablerReload');
- // } else if(data.code == 300 ) {
- // layer.msg(data.msg);
- // }
- // })
- // },function (aa) {
- // table.reload('tablerReload'); //重新加载
- // })
- // });
- //表格右边操作栏目
- table.on('tool('+tableIds+')', function(obj){
- var data = obj.data;
- if(obj.event === 'del'){ //删除操作
- layer.confirm('确定要删除吗?',{btn: ['确定', '取消']},function () {
- $.post('/wx/jcdel',{id:data.id},function (data) {
- layer.msg(data.msg);
- table.reload('tablerReload');
- })
- })
- } else if(obj.event === 'edit'){ //编辑操作
- var index = layui.layer.open({
- title : "编辑",
- type : 2,
- area:['80%','100%'],
- maxmin: true,
- content : "/wx/jcedit?id="+data.id,
- end:function () {
- table.reload('tablerReload'); //重新加载
- }
- })
- } else if(obj.event === 'jc_clear'){
- layer.confirm('确定要清除记录吗?',{btn: ['确定', '取消']},function () {
- $.post('/wx/jcclear',{id:data.id},function (data) {
- layer.msg(data.msg);
- table.reload('tablerReload');
- })
- })
- } else if(obj.event === 'award'){
- var index = layui.layer.open({
- title : '获奖名单',
- type : 2,
- maxmin: true,
- area: ['', '100%'],
- content : "/wx/awardnamelist?id="+data.id,
- end:function () {
- layui.table.reload('tablerReload');
- }
- })
- layui.layer.full(index);
- //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
- $(window).on("resize",function(){
- layui.layer.full(index);
- })
- }
- });
- });
- function clearjc(a,b) {
- // console.log(a);
- // console.log(b);
- $.post('/wx/jcclear',{frequency:a},function (data) {
- layer.msg(data.msg);
- })
- }
|