739 lines
32 KiB
PHP
739 lines
32 KiB
PHP
<?php
|
||
|
||
/**
|
||
* @author Any
|
||
* @description KISS
|
||
* @date 2020-11-5
|
||
* @version 1.0.0
|
||
*
|
||
* _____LOG_____
|
||
*
|
||
*/
|
||
use yii\widgets\LinkPager;
|
||
use app\models\User;
|
||
|
||
$this->title = '用户列表';
|
||
$this->params['breadcrumbs'][] = $this->title;
|
||
$status_labels = User::statusLabels();
|
||
$status = \Yii::$app->request->get('status');
|
||
?>
|
||
<div class="layui-fluid">
|
||
<div class="layui-card">
|
||
<div class="layui-card-header">
|
||
<?= $this->title ?>
|
||
</div>
|
||
<div class="layui-card-header layuiadmin-card-header-auto">
|
||
<div class="layui-form-item">
|
||
<div class="layui-inline">
|
||
<!--<a class=" layui-btn layui-btn-sm" href="<?=\Yii::$app->urlManager->createUrl(["admin/user/edit"])?>">添加用户</a>-->
|
||
</div>
|
||
<div class="layui-inline layui-float-right layui-form">
|
||
<div class="layui-inline layui-form-item layui-hide">
|
||
<div class="layui-inline">
|
||
<div class="layui-input-inline">
|
||
<select class="layui-select" lay-filter="batch-action">
|
||
<option value="0">批量操作</option>
|
||
<option value="forbidden">批量封禁</option>
|
||
<option value="cancel_forbidden">批量取消封禁</option>
|
||
<!--<option value="hangup">批量挂起</option>-->
|
||
<!--<option value="cancel_hangup">批量取消挂起</option>-->
|
||
<option value="account_logout">批量账号注销</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="layui-inline layui-form-item">
|
||
<div class="layui-input-inline">
|
||
<select class="layui-select" name="status">
|
||
<option value="" <?=$status === null ? 'selected' : ''?>>全部状态</option>
|
||
<?php foreach ($status_labels as $key => $val):?>
|
||
<option value="<?=$key?>" <?=$status == $key && $status != null ? 'selected' : ''?>><?=$val?></option>
|
||
<?php endforeach;?>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="layui-inline layui-form-item">
|
||
<label class="layui-form-label">关键词</label>
|
||
<div class="layui-input-block">
|
||
<input type="text" name="keywords" placeholder="搜索姓名" autocomplete="off" class="layui-input" value="<?=\Yii::$app->request->get("keywords")?>">
|
||
|
||
</div>
|
||
</div>
|
||
<div class="layui-inline">
|
||
<button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="dtable-search">
|
||
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>搜索
|
||
</button>
|
||
<button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="dtable-export">
|
||
<i class="layui-icon layui-icon-export layuiadmin-button-btn"></i>导出excel
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="layui-card-body">
|
||
<table id="dtable" lay-filter="dtable"></table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!--工具栏模板-->
|
||
<script type="text/html" id="toolBarTpl">
|
||
<div class="layui-btn-container">
|
||
<!-- <button class="layui-btn layui-btn-sm" lay-event="add">添加</button>-->
|
||
<button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="forbidden">批量封禁</button>
|
||
<button class="layui-btn layui-btn-sm" lay-event="cancel_forbidden">批量取消封禁</button>
|
||
<!--<button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="hangup">批量挂起</button>-->
|
||
<!--<button class="layui-btn layui-btn-sm" lay-event="cancel_hangup">批量取消挂起</button>-->
|
||
<!-- <button class="layui-btn layui-btn-sm layui-btn-danger layui-hide" lay-event="account_logout">批量账号注销</button>-->
|
||
</div>
|
||
</script>
|
||
<!--行操作列模板-->
|
||
<script type="text/html" id="rowBarTpl">
|
||
<!-- <a href="javascript:;" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="forbidden" >用户报告</a>-->
|
||
|
||
{{# if(d.status == <?=User::STATUS_NORMAL?>){ }}
|
||
<!--<a href="javascript:;" class="layui-btn layui-btn-warm layui-btn-xs" lay-event="hangup" >挂起</a>-->
|
||
<a href="javascript:;" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="forbidden" >封禁</a>
|
||
{{# } else if(d.status == <?=User::STATUS_FORBIDDEN?>){ }}
|
||
<a href="javascript:;" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="cancel_forbidden" >取消封禁</a>
|
||
<!-- <a href="javascript:;" class="layui-btn layui-btn-danger layui-btn-xs layui-hide" lay-event="account_logout" >注销</a>-->
|
||
{{# } else if(d.status == <?=User::STATUS_HANGUP?>){ }}
|
||
<!--<a href="javascript:;" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="cancel_hangup" >取消挂起</a>-->
|
||
<!-- <a href="javascript:;" class="layui-btn layui-btn-danger layui-btn-xs layui-hide" lay-event="account_logout" >注销</a>-->
|
||
{{# } }}
|
||
{{# if(d.is_view == 1){ }}
|
||
<!--<a href="javascript:;" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit_is_view" >变更未观看视频</a>-->
|
||
{{# } }}
|
||
|
||
</script>
|
||
|
||
<script type="text/html" id="nicknameTpl">
|
||
<img src="{{d.avatar_url}}" style="width:24px;height:24px;border-radius: 24px;margin-right: 4px;">{{d.nickname}}
|
||
</script>
|
||
|
||
<script type="text/html" id="statusTpl">
|
||
{{# if(d.status == <?=User::STATUS_NORMAL?>){ }}
|
||
<span class="layui-badge layui-bg-blue">{{d.status_cn}}</span>
|
||
{{# } else if(d.status == <?=User::STATUS_FORBIDDEN?>){ }}
|
||
<span class="layui-badge layui-bg-orange">{{d.status_cn}}</span>
|
||
{{# } else if(d.status == <?=User::STATUS_HANGUP?>){ }}
|
||
<span class="layui-badge layui-bg-red">{{d.status_cn}}</span>
|
||
{{# } }}
|
||
</script>
|
||
|
||
<script id="recharge_html" type="text/html">
|
||
<div class="layui-form recharge-panel">
|
||
<div class="layui-card">
|
||
<div class="layui-card-header layui-hide"></div>
|
||
<div class="layui-card-body">
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label ">类型</label>
|
||
<div class="layui-input-block">
|
||
<input type="radio" name="type" value="1" title="充值" lay-verify="required">
|
||
<input type="radio" name="type" value="2" title="扣除" lay-verify="required">
|
||
</div>
|
||
<div class="layui-form-mid layui-word-aux"></div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">金额</label>
|
||
<div class="layui-input-block">
|
||
<input class="layui-input" name="money" lay-verify="required">
|
||
</div>
|
||
<div class="layui-form-mid layui-word-aux"></div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">备注</label>
|
||
<div class="layui-input-block">
|
||
<textarea class="layui-textarea" name="remark" lay-verify="required" rows="2"></textarea>
|
||
</div>
|
||
<div class="layui-form-mid layui-word-aux"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="layui-card-footer layui-text-center layui-mt-15 layui-mb-15">
|
||
<a class="layui-btn layui-btn-sm confirm-btn" lay-submit="" lay-filter="layui-recharge-submit" href="javascript:;">确定</a>
|
||
<a class="layui-btn layui-btn-sm layui-btn-primary cancel-btn" href="javascript:;">取消</a>
|
||
</div>
|
||
</div>
|
||
</script>
|
||
|
||
<script id="rechargeintegral_html" type="text/html">
|
||
<div class="layui-form rechargeintegral-panel">
|
||
<div class="layui-card">
|
||
<div class="layui-card-header layui-hide"></div>
|
||
<div class="layui-card-body">
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label ">类型</label>
|
||
<div class="layui-input-block">
|
||
<input type="radio" name="type" value="1" title="充值" lay-verify="required">
|
||
<input type="radio" name="type" value="2" title="扣除" lay-verify="required">
|
||
</div>
|
||
<div class="layui-form-mid layui-word-aux"></div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">积分</label>
|
||
<div class="layui-input-block">
|
||
<input class="layui-input" name="integral" type="number" lay-verify="required">
|
||
</div>
|
||
<div class="layui-form-mid layui-word-aux"></div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">备注</label>
|
||
<div class="layui-input-block">
|
||
<textarea class="layui-textarea" name="remark" lay-verify="required" rows="2"></textarea>
|
||
</div>
|
||
<div class="layui-form-mid layui-word-aux"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="layui-card-footer layui-text-center layui-mt-15 layui-mb-15">
|
||
<a class="layui-btn layui-btn-sm confirm-btn" lay-submit="" lay-filter="layui-rechargeintegral-submit" href="javascript:;">确定</a>
|
||
<a class="layui-btn layui-btn-sm layui-btn-primary cancel-btn" href="javascript:;">取消</a>
|
||
</div>
|
||
</div>
|
||
</script>
|
||
|
||
<script>
|
||
<?php $this->beginBlock('js_script_wrap') ?>
|
||
|
||
|
||
function toExcel(FileName, ShowLabel, JSONData) {
|
||
//先转化json
|
||
var arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) : JSONData;
|
||
var excel = '<table>';
|
||
//设置表头
|
||
var row = "<tr align='left'>";//设置Excel的左居中
|
||
for (var i = 0, l = ShowLabel.length; i < l; i++) {
|
||
for (var key in ShowLabel[i]) {
|
||
row += "<td>" + ShowLabel[i][key] + '</td>';
|
||
}
|
||
}
|
||
//换行
|
||
excel += row + "</tr>";
|
||
//设置数据
|
||
for (var i = 0; i < arrData.length; i++) {
|
||
var rowData = "<tr align='left'>";
|
||
|
||
for (var y = 0; y < ShowLabel.length; y++) {
|
||
for(var k in ShowLabel[y]){
|
||
if (ShowLabel[y].hasOwnProperty(k)) {
|
||
rowData += "<td style='vnd.ms-excel.numberformat:@'>" + (arrData[i][k]===null? "" : arrData[i][k]) + "</td>";
|
||
//vnd.ms-excel.numberformat:@ 输出为文本
|
||
}
|
||
}
|
||
}
|
||
excel += rowData + "</tr>";
|
||
}
|
||
excel += "</table>";
|
||
var excelFile = "<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:x='urn:schemas-microsoft-com:office:excel' xmlns='http://www.w3.org/TR/REC-html40'>";
|
||
excelFile += '<meta http-equiv="content-type" content="application/vnd.ms-excel; charset=UTF-8">';
|
||
excelFile += '<meta http-equiv="content-type" content="application/vnd.ms-excel';
|
||
excelFile += '; charset=UTF-8">';
|
||
excelFile += "<head>";
|
||
excelFile += "<!--[if gte mso 9]>";
|
||
excelFile += "<xml>";
|
||
excelFile += "<x:ExcelWorkbook>";
|
||
excelFile += "<x:ExcelWorksheets>";
|
||
excelFile += "<x:ExcelWorksheet>";
|
||
excelFile += "<x:Name>";
|
||
excelFile += "{worksheet}";
|
||
excelFile += "</x:Name>";
|
||
excelFile += "<x:WorksheetOptions>";
|
||
excelFile += "<x:DisplayGridlines/>";
|
||
excelFile += "</x:WorksheetOptions>";
|
||
excelFile += "</x:ExcelWorksheet>";
|
||
excelFile += "</x:ExcelWorksheets>";
|
||
excelFile += "</x:ExcelWorkbook>";
|
||
excelFile += "</xml>";
|
||
excelFile += "<![endif]-->";
|
||
excelFile += "</head>";
|
||
excelFile += "<body>";
|
||
excelFile += excel;
|
||
excelFile += "</body>";
|
||
excelFile += "</html>";
|
||
var uri = 'data:application/vnd.ms-excel;charset=utf-8,' + encodeURIComponent(excelFile);
|
||
var link = document.createElement("a");
|
||
link.href = uri;
|
||
link.style = "visibility:hidden";
|
||
link.download = FileName + ".xls";
|
||
document.body.appendChild(link);
|
||
link.click();
|
||
document.body.removeChild(link);
|
||
}
|
||
|
||
layui.config({
|
||
base: '/statics/layuiadmin/' //静态资源所在路径
|
||
}).extend({
|
||
index: 'lib/index' //主入口模块
|
||
}).use(['index', 'user', 'table'], function () {
|
||
var $ = layui.$
|
||
, form = layui.form
|
||
, table = layui.table
|
||
, admin = layui.admin;
|
||
form.render();
|
||
|
||
//search
|
||
form.on('submit(dtable-search)', function (obj) {
|
||
var field = obj.field;
|
||
reload_table_data(field);
|
||
});
|
||
|
||
//search
|
||
form.on('submit(dtable-export)', function (obj) {
|
||
var field = obj.field;
|
||
console.log(field)
|
||
|
||
/*if(order_type == 1){
|
||
var FileName = "进货单导入模板";
|
||
var ShowLabel= [{ inspect_item_name: '供货商名称' }, { type: '仓库名称' }, { sn: '商品货号' }, { number: '进货单价' }, { number: '入库数量' }];
|
||
}else{
|
||
var FileName = "退货单导入模板";
|
||
var ShowLabel= [{ inspect_item_name: '供货商名称' }, { type: '仓库名称' }, { sn: '商品货号' }, { number: '退货数量' }];
|
||
}
|
||
|
||
var JSONData= [];
|
||
//导出
|
||
toExcel(FileName,ShowLabel,JSONData);*/
|
||
field.page = 1;
|
||
field.limit = 999999;
|
||
layer.msg('数据获取中...', {
|
||
icon: 16
|
||
,shade: 0.01
|
||
,time:0,
|
||
});
|
||
$.ajax('<?=\Yii::$app->urlManager->createUrl(['admin/user/index'])?>',{
|
||
type:"GET",
|
||
dataType:"json",
|
||
data:field,
|
||
success:function(res){
|
||
layer.closeAll();
|
||
if(res.code == 0){
|
||
layer.msg('生成excel...', {
|
||
icon: 16
|
||
,shade: 0.01
|
||
,time:0,
|
||
});
|
||
var date_obj = new Date();
|
||
var FileName = "用户数据列表"+(date_obj.getFullYear()+"-"+(date_obj.getMonth()+1)+"-"+date_obj.getDate()+"_"+date_obj.getHours()+"_"+date_obj.getMinutes());
|
||
var ShowLabel= [{ id: 'id' }, { nickname: '用户' }, { username: '用户名' }, { real_name: '姓名' }
|
||
, { mobile_prefix: '手机号前缀' }
|
||
, { mobile_phone: '手机号' }
|
||
, { gender_cn: '性别' }
|
||
, { created_at_cn: '注册时间' }
|
||
];
|
||
toExcel(FileName,ShowLabel,res.data);
|
||
layer.closeAll();
|
||
} else {
|
||
layer.msg(res.msg, {
|
||
offset: '15px'
|
||
,icon: 2
|
||
,time: 1000
|
||
}, function(){
|
||
});
|
||
}
|
||
},
|
||
error:function(xhr,type,err){
|
||
layer.closeAll();
|
||
layer.msg(xhr.responseText, {
|
||
offset: '15px'
|
||
,icon: 2
|
||
,time: 1000
|
||
}, function(){
|
||
});
|
||
}
|
||
})
|
||
// reload_table_data(field);
|
||
});
|
||
|
||
|
||
|
||
form.on('select(batch-action)', function (obj) {
|
||
var lay_event = obj.value;
|
||
var check_status = table.checkStatus('dtable');
|
||
var id = [];
|
||
$(check_status.data).each(function(index){
|
||
id.push(check_status.data[index]['id']);
|
||
});
|
||
|
||
var confirm_url = null;
|
||
var confirm_tip = null;
|
||
if(lay_event == 'hangup'){
|
||
confirm_tip = '你确定将此项挂起吗?';
|
||
confirm_url = '<?=\Yii::$app->urlManager->createUrl(["/admin/user/hangup"])?>';
|
||
}
|
||
if(lay_event == 'cancel_hangup'){
|
||
confirm_tip = '你确定将此项取消挂起吗?';
|
||
confirm_url = '<?=\Yii::$app->urlManager->createUrl(["/admin/user/cancel-hangup"])?>';
|
||
}
|
||
if(lay_event == 'forbidden'){
|
||
confirm_tip = '你确定将此项封禁吗?';
|
||
confirm_url = '<?=\Yii::$app->urlManager->createUrl(["/admin/user/forbidden"])?>';
|
||
}
|
||
if(lay_event == 'cancel_forbidden'){
|
||
confirm_tip = '你确定将此项取消封禁吗?';
|
||
confirm_url = '<?=\Yii::$app->urlManager->createUrl(["/admin/user/cancel-forbidden"])?>';
|
||
}
|
||
if(lay_event == 'account_logout'){
|
||
confirm_tip = '你确定将此项注销吗?';
|
||
confirm_url = '<?=\Yii::$app->urlManager->createUrl(["/admin/user/account-logout"])?>';
|
||
}
|
||
if(confirm_url != null){
|
||
layer.confirm(confirm_tip, {
|
||
btn: ['确定','取消']
|
||
}, function(){
|
||
$.ajax(confirm_url,{
|
||
type:"POST",
|
||
dataType:"json",
|
||
data:{
|
||
user_id:id,
|
||
_csrf:_csrf
|
||
},
|
||
success:function(res){
|
||
if(res.code == 0){
|
||
layer.msg(res.msg, {
|
||
offset: '15px'
|
||
,icon: 1
|
||
,time: 1000
|
||
}, function(){
|
||
location.reload();
|
||
});
|
||
} else {
|
||
layer.msg(res.msg, {
|
||
offset: '15px'
|
||
,icon: 2
|
||
,time: 1000
|
||
}, function(){
|
||
});
|
||
}
|
||
},
|
||
error:function(xhr,type,err){
|
||
layer.msg(xhr.responseText, {
|
||
offset: '15px'
|
||
,icon: 2
|
||
,time: 1000
|
||
}, function(){
|
||
});
|
||
}
|
||
})
|
||
}, function(){
|
||
});
|
||
}
|
||
});
|
||
|
||
//重新加载表格数据
|
||
function reload_table_data(conf){
|
||
table.reload('dtable', {
|
||
url:'<?=\Yii::$app->urlManager->createUrl(['admin/user/index'])?>'
|
||
,page: true
|
||
,where: conf
|
||
});
|
||
};
|
||
|
||
//执行渲染
|
||
table.render({
|
||
//指定原始表格元素选择器(推荐id选择器)
|
||
elem: '#dtable'
|
||
//容器高度
|
||
//,height: 315
|
||
//容器宽度
|
||
//,width: 720
|
||
//设置表头
|
||
,cols: [[
|
||
{checkbox: true}
|
||
, {field: 'id', title: 'ID', width: 80}
|
||
// , {field: 'nickname', title: '用户',templet:'#nicknameTpl'}
|
||
// , {field: 'username', title: '用户名', width: 120}
|
||
, {field: 'real_name', title: '姓名'}
|
||
, {field: 'mobile', title: '手机号',templet:'<div>+{{d.mobile_prefix}} {{d.mobile_phone}}</div>'}
|
||
, {field: 'gender_cn', title: '性别'}
|
||
, {field: 'gender_cn', title: '鞋码'}
|
||
, {field: 'created_at_cn', title: '注册时间'}
|
||
, {field: 'status_cn', title: '状态', templet:'#statusTpl'}
|
||
, {title: '操作',fixed: 'right', toolbar: '#rowBarTpl', width: 240}
|
||
]
|
||
]
|
||
, url:'<?=\Yii::$app->urlManager->createUrl(['admin/user/index'])?>'
|
||
, page:true
|
||
//指向自定义工具栏模板选择器
|
||
, toolbar:'#toolBarTpl'
|
||
//头部工具栏右侧的图标按钮
|
||
, defaultToolbar:['filter', 'print', 'exports']
|
||
, limit: 20
|
||
, limits:[10,20,30,40,50,60,70,80,90,100]
|
||
, title:'<?=$this->title?>'
|
||
, data:[]
|
||
});
|
||
//监听工具栏
|
||
table.on('toolbar(dtable)', function(obj){
|
||
var lay_event = obj.event;
|
||
var check_status = table.checkStatus('dtable');
|
||
var id = [];
|
||
$(check_status.data).each(function(index){
|
||
id.push(check_status.data[index]['id']);
|
||
});
|
||
if(id.length == 0){
|
||
return layer.msg("请选择需要操作项");
|
||
}
|
||
|
||
var confirm_url = null;
|
||
var confirm_tip = null;
|
||
if(lay_event == 'hangup'){
|
||
confirm_tip = '你确定将此项挂起吗?';
|
||
confirm_url = '<?=\Yii::$app->urlManager->createUrl(["/admin/user/hangup"])?>';
|
||
}
|
||
if(lay_event == 'cancel_hangup'){
|
||
confirm_tip = '你确定将此项取消挂起吗?';
|
||
confirm_url = '<?=\Yii::$app->urlManager->createUrl(["/admin/user/cancel-hangup"])?>';
|
||
}
|
||
if(lay_event == 'forbidden'){
|
||
confirm_tip = '你确定将此项封禁吗?';
|
||
confirm_url = '<?=\Yii::$app->urlManager->createUrl(["/admin/user/forbidden"])?>';
|
||
}
|
||
if(lay_event == 'cancel_forbidden'){
|
||
confirm_tip = '你确定将此项取消封禁吗?';
|
||
confirm_url = '<?=\Yii::$app->urlManager->createUrl(["/admin/user/cancel-forbidden"])?>';
|
||
}
|
||
if(lay_event == 'account_logout'){
|
||
confirm_tip = '你确定将此项注销吗?';
|
||
confirm_url = '<?=\Yii::$app->urlManager->createUrl(["/admin/user/account-logout"])?>';
|
||
}
|
||
|
||
if(confirm_url != null){
|
||
layer.confirm(confirm_tip, {
|
||
btn: ['确定','取消']
|
||
}, function(){
|
||
$.ajax(confirm_url,{
|
||
type:"POST",
|
||
dataType:"json",
|
||
data:{
|
||
user_id:id,
|
||
_csrf:_csrf
|
||
},
|
||
success:function(res){
|
||
if(res.code == 0){
|
||
layer.msg(res.msg, {
|
||
offset: '15px'
|
||
,icon: 1
|
||
,time: 1000
|
||
}, function(){
|
||
location.reload();
|
||
});
|
||
} else {
|
||
layer.msg(res.msg, {
|
||
offset: '15px'
|
||
,icon: 2
|
||
,time: 1000
|
||
}, function(){
|
||
});
|
||
}
|
||
},
|
||
error:function(xhr,type,err){
|
||
layer.msg(xhr.responseText, {
|
||
offset: '15px'
|
||
,icon: 2
|
||
,time: 1000
|
||
}, function(){
|
||
});
|
||
}
|
||
})
|
||
}, function(){
|
||
});
|
||
}
|
||
});
|
||
|
||
//监听工具条
|
||
table.on('tool(dtable)', function(obj){
|
||
var row_data = obj.data;
|
||
var lay_event = obj.event;
|
||
var id = row_data.id;
|
||
|
||
var confirm_url = null;
|
||
var confirm_tip = null;
|
||
if(lay_event == 'hangup'){
|
||
confirm_tip = '你确定将此项挂起吗?';
|
||
confirm_url = '<?=\Yii::$app->urlManager->createUrl(["/admin/user/hangup"])?>';
|
||
}
|
||
if(lay_event == 'cancel_hangup'){
|
||
confirm_tip = '你确定将此项取消挂起吗?';
|
||
confirm_url = '<?=\Yii::$app->urlManager->createUrl(["/admin/user/cancel-hangup"])?>';
|
||
}
|
||
if(lay_event == 'forbidden'){
|
||
confirm_tip = '你确定将此项封禁吗?';
|
||
confirm_url = '<?=\Yii::$app->urlManager->createUrl(["/admin/user/forbidden"])?>';
|
||
}
|
||
if(lay_event == 'cancel_forbidden'){
|
||
confirm_tip = '你确定将此项取消封禁吗?';
|
||
confirm_url = '<?=\Yii::$app->urlManager->createUrl(["/admin/user/cancel-forbidden"])?>';
|
||
}
|
||
if(lay_event == 'account_logout'){
|
||
confirm_tip = '你确定将此项注销吗?';
|
||
confirm_url = '<?=\Yii::$app->urlManager->createUrl(["/admin/user/account-logout"])?>';
|
||
}
|
||
if(lay_event == 'edit_is_view'){
|
||
confirm_tip = '你确定将此用户变更为未观看视频吗?';
|
||
confirm_url = '<?=\Yii::$app->urlManager->createUrl(["/admin/user/edit-is-view"])?>';
|
||
}
|
||
if(lay_event == 'recharge'){
|
||
var content = $("#recharge_html").html();
|
||
return layer.open({
|
||
type: 1,
|
||
title:'余额充值面板',
|
||
offset:'50px',
|
||
area: ['560px', '430px'], //宽高
|
||
content: content,
|
||
success:function(layero, index){
|
||
//console.log(layero, index);
|
||
form.render();
|
||
form.on('submit(layui-recharge-submit)', function (obj) {
|
||
//console.log(obj.field)
|
||
var data = obj.field;
|
||
data.user_id = id;
|
||
data._csrf = _csrf;
|
||
//console.log(data)
|
||
var url = '<?=\Yii::$app->urlManager->createUrl(["/admin/balance/recharge/recharge"])?>';
|
||
$.ajax(url,{
|
||
type:"POST",
|
||
dataType:"json",
|
||
data:data,
|
||
success:function(res){
|
||
if(res.code == 0){
|
||
layer.close(index);
|
||
layer.msg(res.msg, {
|
||
offset: '15px'
|
||
,icon: 1
|
||
,time: 1000
|
||
}, function(){
|
||
location.reload();
|
||
});
|
||
} else {
|
||
layer.msg(res.msg, {
|
||
offset: '15px'
|
||
,icon: 2
|
||
,time: 1000
|
||
}, function(){
|
||
});
|
||
}
|
||
},
|
||
error:function(xhr,type,err){
|
||
layer.msg(xhr.responseText, {
|
||
offset: '15px'
|
||
,icon: 2
|
||
,time: 1000
|
||
}, function(){
|
||
});
|
||
}
|
||
})
|
||
});
|
||
$('.recharge-panel').on('click','.confirm-btn',function(){
|
||
})
|
||
$('.recharge-panel').on('click','.cancel-btn',function(){
|
||
layer.close(index);
|
||
});
|
||
}
|
||
});
|
||
}
|
||
if(lay_event == 'rechargeintegral'){
|
||
var content = $("#rechargeintegral_html").html();
|
||
return layer.open({
|
||
type: 1,
|
||
title:'积分充值面板',
|
||
offset:'50px',
|
||
area: ['560px', '430px'], //宽高
|
||
content: content,
|
||
success:function(layero, index){
|
||
//console.log(layero, index);
|
||
form.render();
|
||
form.on('submit(layui-rechargeintegral-submit)', function (obj) {
|
||
//console.log(obj.field)
|
||
var data = obj.field;
|
||
data.user_id = id;
|
||
data._csrf = _csrf;
|
||
//console.log(data)
|
||
var url = '<?=\Yii::$app->urlManager->createUrl(["/admin/integral/integral/recharge"])?>';
|
||
$.ajax(url,{
|
||
type:"POST",
|
||
dataType:"json",
|
||
data:data,
|
||
success:function(res){
|
||
if(res.code == 0){
|
||
layer.close(index);
|
||
layer.msg(res.msg, {
|
||
offset: '15px'
|
||
,icon: 1
|
||
,time: 1000
|
||
}, function(){
|
||
location.reload();
|
||
});
|
||
} else {
|
||
layer.msg(res.msg, {
|
||
offset: '15px'
|
||
,icon: 2
|
||
,time: 1000
|
||
}, function(){
|
||
});
|
||
}
|
||
},
|
||
error:function(xhr,type,err){
|
||
layer.msg(xhr.responseText, {
|
||
offset: '15px'
|
||
,icon: 2
|
||
,time: 1000
|
||
}, function(){
|
||
});
|
||
}
|
||
})
|
||
});
|
||
$('.rechargeintegral-panel').on('click','.confirm-btn',function(){
|
||
})
|
||
$('.rechargeintegral-panel').on('click','.cancel-btn',function(){
|
||
layer.close(index);
|
||
});
|
||
}
|
||
});
|
||
}
|
||
if(confirm_url != null){
|
||
layer.confirm(confirm_tip, {
|
||
btn: ['确定','取消']
|
||
}, function(){
|
||
$.ajax(confirm_url,{
|
||
type:"POST",
|
||
dataType:"json",
|
||
data:{
|
||
user_id:id,
|
||
_csrf:_csrf
|
||
},
|
||
success:function(res){
|
||
if(res.code == 0){
|
||
layer.msg(res.msg, {
|
||
offset: '15px'
|
||
,icon: 1
|
||
,time: 1000
|
||
}, function(){
|
||
location.reload();
|
||
});
|
||
} else {
|
||
layer.msg(res.msg, {
|
||
offset: '15px'
|
||
,icon: 2
|
||
,time: 1000
|
||
}, function(){
|
||
});
|
||
}
|
||
},
|
||
error:function(xhr,type,err){
|
||
layer.msg(xhr.responseText, {
|
||
offset: '15px'
|
||
,icon: 2
|
||
,time: 1000
|
||
}, function(){
|
||
});
|
||
}
|
||
})
|
||
}, function(){
|
||
});
|
||
}
|
||
});
|
||
});
|
||
<?php $this->endBlock(); ?>
|
||
</script>
|
||
<?php $this->registerJs($this->blocks['js_script_wrap'], \yii\web\View::POS_END); ?>
|