Commit 34074886 by 杨树贤

用户获取红包加入禁用理由

parent 31d35e6a
......@@ -56,8 +56,15 @@ class UserIntegralsApiController extends Controller
public function batchUpdateStatusApi(Request $request)
{
$data = [
'status' => $request->get('status'),
'audit_reason' => $request->get('audit_reason'),
'audit_id' => $request->user->userId,
'audit_email' => $request->user->email,
'ids' => $request->get('ids'),
];
$path = 'user_integrals/batchUpdateStatus';
$result = $this->service->batchUpdateStatus($path, $request->all());
$result = $this->service->batchUpdateStatus($path, $data);
return $result;
}
......
......@@ -11,36 +11,6 @@ function getRequestParams() {
return theRequest;
}
function changeStatus(checkStatus, status, table) {
var data = checkStatus.data;
var ids = [];
for (var key in data) {
ids.push(data[key].id);
}
var operateText = status ? '恢复' : '禁用';
layer.confirm('确定要批量' + operateText + '? 禁用之后你所选择的用户都将无法进行红包兑换!', function (index) {
$.ajax({
url: '/user_integrals/api/batchUpdateStatusApi',
type: 'post',
data: {ids: ids, status: status},
dataType: 'json',
timeout: 10000,
success: function (res) {
if (!res) return layer.msg('网络错误,请重试', {icon: 5});
if (res.errcode === 0) {
var msg = status ? '批量恢复成功' : '批量禁用成功';
layer.msg(msg);
table.reload('UserIntegral');
}
},
error: function () {
return layer.msg('网络错误,请重试', {icon: 5});
}
})
})
}
layui.use(['table', 'form', 'laydate', 'layer'], function () {
var table = layui.table;
var form = layui.form;
......@@ -128,4 +98,51 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
}
});
function changeStatus(checkStatus, status, table) {
var data = checkStatus.data;
var ids = [];
for (var key in data) {
ids.push(data[key].id);
}
if (!ids || ids.length < 1) return layer.msg('没有可以操作的数据', {offset: 200, icon: 6});
//禁用才需要输入理由
if (!status) {
layer.prompt({
formType: 2,
title: '请输入批量操作理由,禁用之后选择的用户无法进行获取红包',
area: ['300px', '200px'] //自定义文本域宽高
}, function (val, index) {
if (!val) return layer.msg('请输入禁用原因', {icon: 6});
layer.msg('处理中', {icon: 16, time: 10000});
batchChangeStatus(ids, status, val);
layer.close(index);
});
} else {
layer.confirm('确定要恢复用户获取红包?', function (index) {
//恢复不需要理由
batchChangeStatus(ids, status, '恢复');
layer.close(index);
});
}
}
function batchChangeStatus(ids, status, val) {
$.ajax({
url: '/user_integrals/api/batchUpdateStatusApi',
type: 'post',
data: {ids: ids, status: status, audit_reason: val},
dataType: 'json',
timeout: 10000,
success: function (res) {
if (!res) return layer.msg('网络错误,请重试', {icon: 5});
layer.msg('批量操作成功');
if (res.errcode === 0) {
table.reload('UserIntegral');
}
},
error: function () {
return layer.msg('网络错误,请重试', {icon: 5});
}
})
}
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment