feat: 重构后台管理界面样式并新增商户/帖子审核功能

- 重构后台所有管理页面工具栏,移除图标改用纯文字按钮
- 新增商户管理的批量审核功能与商家详情/审核页面
- 新增帖子管理的批量审核/上下架功能与帖子详情/审核页面
- 新增多媒体相册字段的前后台处理逻辑
- 新增微信订阅消息兼容导出层
- 更新站点版本号并优化品牌色变量
- 新增商户/帖子控制器的详情与审核方法
- 新增 .sql 文件忽略规则
这个提交包含在:
2026-10-23 09:26:22 +08:00
父节点 cb12bf5fc8
当前提交 3a2fcf7142
共有 44 个文件被更改,包括 3080 次插入 和 917 次删除

查看文件

@@ -10,131 +10,269 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/format'], fu
edit_url: 'fc/merchant/edit',
del_url: 'fc/merchant/del',
multi_url: 'fc/merchant/multi',
import_url: 'fc/merchant/import',
table: 'fc_merchant',
}
});
var table = $("#table");
var batchBar = $("#batch-bar");
var selectedCount = $("#selected-count");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
sortOrder: 'desc',
escape: false,
clickToSelect: false, // 禁用点击行任意位置自动勾选复选框,杜绝误触发多选
columns: [
[
{checkbox: true},
{field: 'id', title: __('SerialNo'), operate: false, sortable: false, align: 'center', width: '70px', class: 'fc-serial', table: table, formatter: Format.serial},
{field: 'user_id', title: '用户', addClass: 'selectpage', extend: "data-source='user/user/index' data-field='nickname'", formatter: function (value, row) {
return row.user_name || '-';
}},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'id', title: '序号', operate: false, formatter: function (value, row, index) {
return '<span class="fc-serial">' + (index + 1) + '</span>';
}},
{field: 'logo', title: '门头Logo', operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{
field: 'name', title: __('Name'), operate: 'LIKE',
events: {
'click .btn-view-merchant': function (e, value, row, index) {
e.stopPropagation();
e.preventDefault();
Fast.api.open('fc/merchant/detail?ids=' + row.id + '&mode=view', '详情', {area: ['820px', '85%']});
}
},
formatter: function (value, row) {
return '<a href="javascript:;" class="btn-view-merchant" style="color:#0F172A;font-weight:600;" title="详情">' + value + '</a>';
}
},
{field: 'user_id', title: '入驻用户', addClass: 'selectpage', extend: "data-source='user/user/index' data-field='nickname'"},
{field: 'category', title: '所属行业', operate: 'LIKE'},
{field: 'contact', title: __('Contact'), operate: 'LIKE'},
{field: 'category', title: __('Category'), operate: 'LIKE'},
{field: 'license', title: '营业执照', operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{
field: 'audit_status', title: __('Audit_status'),
searchList: {0: __('待审核'), 1: __('已通过'), 2: __('已驳回')},
formatter: Format.statusFormatter({0: __('待审核'), 1: __('已通过'), 2: __('已驳回')}, {0: 'warning', 1: 'success', 2: 'danger'})
},
{
field: 'shop_status', title: __('Shop_status'),
searchList: {normal: __('正常'), pending: __('待审核'), banned: __('已封禁')},
formatter: Format.statusFormatter({normal: __('正常'), pending: __('待审核'), banned: __('已封禁')}, {normal: 'success', pending: 'warning', banned: 'danger'})
field: 'shop_status', title: '营业状态',
searchList: {normal: __('正常营业'), closed: __('暂停歇业')},
formatter: function (value) {
return value === 'normal' ? '<span class="text-success">正常营业</span>' : '<span class="text-muted">暂停歇业</span>';
}
},
{field: 'license', title: __('License'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'violations', title: __('Violations')},
{field: 'post_count', title: __('Post_count')},
{field: 'audit_reason', title: __('Audit_reason'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'logo', title: __('Logo'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content, visible: false},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime, visible: false},
{
field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
formatter: Table.api.formatter.operate,
buttons: [
{
name: 'auditpass',
text: __('AuditPass'),
title: __('AuditPass'),
classname: 'btn btn-xs btn-success btn-click',
visible: function (row) {
return Number(row.audit_status) !== 1;
},
confirm: __('确认审核通过该商家?'),
click: function (options, row) {
field: 'recommend', title: '推荐位',
searchList: {0: __('否'), 1: __('是')},
formatter: Format.statusFormatter({0: __('否'), 1: __('已推荐')}, {0: 'default', 1: 'warning'})
},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{
field: 'operate', title: '操作', align: 'center', width: '130px',
events: {
'click .btn-audit-one': function (e, value, row, index) {
e.stopPropagation();
e.preventDefault();
Fast.api.open('fc/merchant/detail?ids=' + row.id + '&mode=audit', '审核', {area: ['820px', '85%']});
},
'click .btn-detail-one': function (e, value, row, index) {
e.stopPropagation();
e.preventDefault();
Fast.api.open('fc/merchant/detail?ids=' + row.id + '&mode=view', '详情', {area: ['820px', '85%']});
},
'click .btn-edit-one': function (e, value, row, index) {
e.stopPropagation();
e.preventDefault();
Fast.api.open('fc/merchant/edit?ids=' + row.id, '编辑', {area: ['820px', '85%']});
},
'click .btn-del-one': function (e, value, row, index) {
e.stopPropagation();
e.preventDefault();
Layer.confirm(__('Are you sure you want to delete this item?'), {title: __('Warning'), btn: ['确定', '取消']}, function (confirmIndex) {
Fast.api.ajax({
url: 'fc/merchant/audit',
data: {ids: row.id, auditStatus: 1}
url: 'fc/merchant/del',
data: {ids: row.id}
}, function () {
$('#' + options.tableId).bootstrapTable('refresh');
table.bootstrapTable('refresh');
return false;
});
}
},
{
name: 'auditreject',
text: __('AuditReject'),
title: __('AuditReject'),
classname: 'btn btn-xs btn-danger btn-click',
visible: function (row) {
return Number(row.audit_status) !== 2;
},
click: function (options, row) {
Layer.prompt({title: __('请输入驳回原因'), formType: 2}, function (value, index) {
Fast.api.ajax({
url: 'fc/merchant/audit',
data: {ids: row.id, auditStatus: 2, reason: value}
}, function () {
$('#' + options.tableId).bootstrapTable('refresh');
return false;
});
Layer.close(index);
});
}
Layer.close(confirmIndex);
});
}
]
},
formatter: function (value, row) {
var isPending = Number(row.audit_status) === 0;
var actionBtn = isPending
? '<a href="javascript:;" class="btn btn-xs btn-success btn-audit-one" title="审核">审核</a> '
: '<a href="javascript:;" class="btn btn-xs btn-default btn-detail-one" title="详情">详情</a> ';
var editBtn = '<a href="javascript:;" class="btn btn-xs btn-default btn-edit-one" title="编辑">编辑</a> ';
var delBtn = '<a href="javascript:;" class="btn btn-xs btn-danger btn-del-one" title="删除">删除</a>';
return actionBtn + editBtn + delBtn;
}
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
// 审核通过
/**
* 联动动态批量操作栏
*/
function updateBatchBar() {
var selectedIds = Table.api.selectedids(table);
if (selectedIds.length > 0) {
selectedCount.text(selectedIds.length);
batchBar.removeClass('hide').show();
} else {
batchBar.addClass('hide').hide();
}
}
table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table load-success.bs.table', function () {
updateBatchBar();
});
// 双击行直接打开资质核验或详情
table.on('dbl-click-row.bs.table', function (e, row) {
var isPending = Number(row.audit_status) === 0;
var mode = isPending ? 'audit' : 'view';
var title = isPending ? '审核' : '详情';
Fast.api.open('fc/merchant/detail?ids=' + row.id + '&mode=' + mode, title, {area: ['820px', '85%']});
});
$(document).on('click', '.btn-clear-selection', function () {
table.bootstrapTable('uncheckAll');
updateBatchBar();
});
// 批量审核通过
$(document).on('click', '.btn-audit-pass', function () {
var ids = Table.api.selectedids(table);
Layer.confirm(__('确认审核通过选中的商家?'), {icon: 3, title: __('提示')}, function (index) {
if (ids.length === 0) {
Toastr.warning('请先勾选需要批量操作的商家');
return;
}
Layer.confirm('确认批量审核通过选中的 ' + ids.length + ' 个商家入驻?', {title: '批量审核确认', btn: ['通过', '取消']}, function (index) {
Fast.api.ajax({
url: 'fc/merchant/audit',
data: {ids: ids.join(','), auditStatus: 1}
}, function (data) {
}, function () {
table.bootstrapTable('refresh');
updateBatchBar();
return false;
});
Layer.close(index);
});
});
// 审核驳回
// 批量审核驳回
$(document).on('click', '.btn-audit-reject', function () {
var ids = Table.api.selectedids(table);
Layer.prompt({title: __('请输入驳回原因'), formType: 2}, function (value, index) {
if (ids.length === 0) {
Toastr.warning('请先勾选需要批量操作的商家');
return;
}
Layer.prompt({title: '请输入批量驳回的原因(将通知给申请商户)', formType: 2}, function (value, index) {
if (!$.trim(value)) {
Toastr.error('驳回原因不可为空');
return;
}
Fast.api.ajax({
url: 'fc/merchant/audit',
data: {ids: ids.join(','), auditStatus: 2, reason: value}
}, function (data) {
}, function () {
table.bootstrapTable('refresh');
updateBatchBar();
return false;
});
Layer.close(index);
});
});
// 批量设为推荐
$(document).on('click', '.btn-merchant-batch-recommend', function () {
var ids = Table.api.selectedids(table);
if (ids.length === 0) {
Toastr.warning('请先勾选需要推荐的商家');
return;
}
Layer.confirm('确认批量将选中的 ' + ids.length + ' 个商家设为首页推荐?', {title: '推荐确认', btn: ['推荐', '取消']}, function (index) {
Fast.api.ajax({
url: 'fc/merchant/recommend',
data: {ids: ids.join(','), recommend: 1}
}, function () {
table.bootstrapTable('refresh');
updateBatchBar();
return false;
});
Layer.close(index);
});
});
},
detail: function () {
var merchantId = Fast.api.query('ids') || Fast.api.query('id');
function submitAudit(status, reason) {
Fast.api.ajax({
url: 'fc/merchant/audit',
type: 'POST',
data: {
ids: merchantId,
auditStatus: status,
reason: reason || ''
}
}, function (data, ret) {
Toastr.success(ret.msg || '操作成功');
setTimeout(function () {
Fast.api.close();
if (parent.$ && parent.$('#table').length) {
parent.$('#table').bootstrapTable('refresh');
}
}, 400);
return false;
}, function (data, ret) {
Toastr.error(ret.msg || '操作失败');
return false;
});
}
// 点击通过:弹窗确认通过
$('#btn-pass').off('click').on('click', function () {
Layer.confirm('确认审核通过此商家的入驻申请吗?', {
title: '通过确认',
btn: ['通过', '取消']
}, function (index) {
Layer.close(index);
submitAudit(1, '');
});
});
// 点击驳回:弹窗确认输入驳回原因
$('#btn-reject').off('click').on('click', function () {
Layer.prompt({
title: '请输入驳回原因(将通知给申请商户)',
formType: 2,
value: ''
}, function (value, promptIndex) {
var reason = $.trim(value);
if (!reason) {
Toastr.warning('驳回原因不可为空');
return;
}
Layer.close(promptIndex);
submitAudit(2, reason);
});
});
// 点击关闭
$('#btn-close').off('click').on('click', function () {
Fast.api.close();
});
},
add: function () {
Controller.api.bindevent();
},
@@ -147,5 +285,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/format'], fu
}
}
};
return Controller;
});

查看文件

@@ -10,182 +10,126 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/format'], fu
edit_url: 'fc/post/edit',
del_url: 'fc/post/del',
multi_url: 'fc/post/multi',
import_url: 'fc/post/import',
table: 'fc_post',
}
});
var table = $("#table");
var batchBar = $("#batch-bar");
var selectedCount = $("#selected-count");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
sortOrder: 'desc',
escape: false,
clickToSelect: false, // 禁用点击行任意位置自动勾选复选框,杜绝点击操作按钮误触发多选
columns: [
[
{checkbox: true},
{field: 'id', title: __('SerialNo'), operate: false, sortable: false, align: 'center', width: '70px', class: 'fc-serial', table: table, formatter: Format.serial},
{field: 'title', title: __('Title'), operate: 'LIKE'},
{field: 'category_id', title: '分类', addClass: 'selectpage', extend: "data-source='fc/category/index' data-field='name'", formatter: function (value, row) {
return row.category_name || '-';
}},
{field: 'price', title: __('Price'), operate: 'BETWEEN',
formatter: function (value) {
return (value === null || value === '' || value === undefined) ? '-' : '¥' + value;
{field: 'id', title: '序号', operate: false, formatter: function (value, row, index) {
return '<span class="fc-serial">' + (index + 1) + '</span>';
}},
{
field: 'cover', title: '封面', operate: false, align: 'center', width: '65px',
events: Table.api.events.image,
formatter: function (value, row) {
var img = value || (row.media && row.media.length > 0 ? (typeof row.media === 'string' && row.media.indexOf('[') === 0 ? JSON.parse(row.media)[0] : row.media.split(',')[0]) : '');
return img ? Table.api.formatter.image.call(this, img, row) : '<span class="text-muted" style="font-size:11px;">无图</span>';
}
},
{field: 'price_unit', title: __('Price_unit'), operate: 'LIKE'},
{field: 'area', title: __('Area'), operate: 'LIKE'},
{field: 'audit_status', title: __('Audit_status'),
{
field: 'title', title: __('Title'), operate: 'LIKE', align: 'left',
events: {
'click .btn-view-detail': function (e, value, row, index) {
e.stopPropagation();
e.preventDefault();
Fast.api.open('fc/post/detail?ids=' + row.id + '&mode=view', '详情', {area: ['850px', '85%']});
}
},
formatter: function (value, row) {
var topBadge = Number(row.is_top) === 1 ? '<span class="label label-warning" style="margin-right:4px;">置顶</span>' : '';
return topBadge + '<a href="javascript:;" class="btn-view-detail" style="color:#0F172A;font-weight:600;" title="详情">' + value + '</a>';
}
},
{
field: 'category_id', title: '分类', addClass: 'selectpage', extend: "data-source='fc/category/index' data-field='name'",
formatter: function (value, row) {
return row.category_name ? '<span class="label label-default" style="font-weight:normal;">' + row.category_name + '</span>' : '-';
}
},
{
field: 'price', title: __('Price'), operate: 'BETWEEN', align: 'right',
formatter: function (value, row) {
if (value === null || value === '' || value === undefined || Number(value) === 0) {
return '<span class="text-muted">面议/免费</span>';
}
return '<strong style="color:#EA580C;">¥' + value + '</strong>' + (row.price_unit ? ' <small class="text-muted">' + row.price_unit + '</small>' : '');
}
},
{field: 'area', title: __('Area'), operate: 'LIKE', formatter: function (value) { return value || '-'; }},
{
field: 'user_id', title: '发布用户', addClass: 'selectpage', extend: "data-source='user/user/index' data-field='nickname'",
formatter: function (value, row) {
return row.user_name ? '<i class="fa fa-user-circle text-muted"></i> ' + row.user_name : '-';
}
},
{
field: 'audit_status', title: __('Audit_status'),
searchList: {0: __('待审核'), 1: __('已通过'), 2: __('已驳回')},
formatter: Format.statusFormatter({0: __('待审核'), 1: __('已通过'), 2: __('已驳回')}, {0: 'warning', 1: 'success', 2: 'danger'})
},
{field: 'views', title: __('Views')},
{field: 'is_paid', title: __('Is_paid'),
searchList: {0: __('否'), 1: __('是')},
formatter: Format.statusFormatter({0: __('未付费'), 1: __('已付费')}, {0: 'default', 1: 'success'})
},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'content', title: __('Content'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'cover', title: __('Cover'), operate: 'LIKE'},
{field: 'media', title: __('Media'), visible: false},
{field: 'user_id', title: '发布用户', addClass: 'selectpage', extend: "data-source='user/user/index' data-field='nickname'", formatter: function (value, row) {
return row.user_name || '-';
}},
{field: 'address', title: __('Address'), operate: 'LIKE'},
{field: 'contact', title: __('Contact'), operate: 'LIKE'},
{field: 'phone', title: __('Phone'), operate: 'LIKE'},
{field: 'wechat', title: __('Wechat'), operate: 'LIKE'},
{field: 'tags', title: __('Tags'), operate: 'LIKE', formatter: Table.api.formatter.flag},
{field: 'amount', title: __('Amount'), operate: 'BETWEEN',
formatter: function (value) {
return (value === null || value === '' || value === undefined) ? '-' : '¥' + value;
}
},
{field: 'pay_type', title: __('Pay_type'),
searchList: {wxpay: __('微信支付'), balance: __('余额支付')},
formatter: function (value) {
var m = {wxpay: __('微信支付'), balance: __('余额支付')};
return m[value] !== undefined ? m[value] : '-';
}
},
{field: 'audit_reason', title: __('Audit_reason'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'likes', title: __('Likes')},
{field: 'comment_count', title: __('Comment_count')},
{field: 'status', title: __('Status'),
{
field: 'status', title: '上架状态',
searchList: {1: __('正常'), 0: __('已下架')},
formatter: Format.statusFormatter({1: __('正常'), 0: __('已下架')}, {1: 'success', 0: 'default'})
},
{field: 'is_top', title: __('Is_top'),
searchList: {0: __('否'), 1: __('是')},
formatter: Format.statusFormatter({0: __('未置顶'), 1: __('已置顶')}, {0: 'default', 1: 'warning'})
},
{field: 'distance', title: __('Distance')},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime, visible: false},
{field: 'deletetime', title: __('Deletetime'), visible: false},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
buttons: [
{
name: 'auditpass',
text: __('AuditPass'),
title: __('AuditPass'),
classname: 'btn btn-xs btn-success btn-click',
visible: function (row) {
return Number(row.audit_status) !== 1;
},
confirm: __('确认审核通过该信息?'),
click: function (options, row) {
Fast.api.ajax({
url: 'fc/post/audit',
data: {ids: row.id, auditStatus: 1}
}, function () {
$('#' + options.tableId).bootstrapTable('refresh');
return false;
});
}
{field: 'views', title: __('Views'), sortable: true, operate: false},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{
field: 'operate', title: '操作', align: 'center', width: '130px',
events: {
'click .btn-audit-one': function (e, value, row, index) {
e.stopPropagation();
e.preventDefault();
Fast.api.open('fc/post/detail?ids=' + row.id + '&mode=audit', '审核', {area: ['850px', '85%']});
},
{
name: 'auditreject',
text: __('AuditReject'),
title: __('AuditReject'),
classname: 'btn btn-xs btn-danger btn-click',
visible: function (row) {
return Number(row.audit_status) !== 2;
},
click: function (options, row) {
Layer.prompt({title: __('请输入驳回原因'), formType: 2}, function (value, index) {
Fast.api.ajax({
url: 'fc/post/audit',
data: {ids: row.id, auditStatus: 2, reason: value}
}, function () {
$('#' + options.tableId).bootstrapTable('refresh');
return false;
});
Layer.close(index);
});
}
'click .btn-detail-one': function (e, value, row, index) {
e.stopPropagation();
e.preventDefault();
Fast.api.open('fc/post/detail?ids=' + row.id + '&mode=view', '详情', {area: ['850px', '85%']});
},
{
name: 'offline',
text: __('OfflinePost'),
title: __('OfflinePost'),
classname: 'btn btn-xs btn-warning btn-click',
visible: function (row) {
return Number(row.status) === 1;
},
confirm: __('确认下架该信息?'),
click: function (options, row) {
'click .btn-edit-one': function (e, value, row, index) {
e.stopPropagation();
e.preventDefault();
Fast.api.open('fc/post/edit?ids=' + row.id, '编辑', {area: ['850px', '85%']});
},
'click .btn-del-one': function (e, value, row, index) {
e.stopPropagation();
e.preventDefault();
Layer.confirm(__('Are you sure you want to delete this item?'), {title: __('Warning'), btn: ['确定', '取消']}, function (confirmIndex) {
Fast.api.ajax({
url: 'fc/post/offline',
url: 'fc/post/del',
data: {ids: row.id}
}, function () {
$('#' + options.tableId).bootstrapTable('refresh');
table.bootstrapTable('refresh');
return false;
});
}
},
{
name: 'top',
text: __('TopPost'),
title: __('TopPost'),
classname: 'btn btn-xs btn-info btn-click',
visible: function (row) {
return Number(row.is_top) !== 1;
},
confirm: __('确认置顶该信息?'),
click: function (options, row) {
Fast.api.ajax({
url: 'fc/post/top',
data: {ids: row.id, isTop: 1}
}, function () {
$('#' + options.tableId).bootstrapTable('refresh');
return false;
});
}
},
{
name: 'untop',
text: __('CancelTopPost'),
title: __('CancelTopPost'),
classname: 'btn btn-xs btn-default btn-click',
visible: function (row) {
return Number(row.is_top) === 1;
},
confirm: __('确认取消置顶该信息?'),
click: function (options, row) {
Fast.api.ajax({
url: 'fc/post/top',
data: {ids: row.id, isTop: 0}
}, function () {
$('#' + options.tableId).bootstrapTable('refresh');
return false;
});
}
Layer.close(confirmIndex);
});
}
]
},
formatter: function (value, row) {
var isPending = Number(row.audit_status) === 0;
var actionBtn = isPending
? '<a href="javascript:;" class="btn btn-xs btn-success btn-audit-one" title="审核">审核</a> '
: '<a href="javascript:;" class="btn btn-xs btn-default btn-detail-one" title="详情">详情</a> ';
var editBtn = '<a href="javascript:;" class="btn btn-xs btn-default btn-edit-one" title="编辑">编辑</a> ';
var delBtn = '<a href="javascript:;" class="btn btn-xs btn-danger btn-del-one" title="删除">删除</a>';
return actionBtn + editBtn + delBtn;
}
}
]
]
@@ -194,84 +138,192 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/format'], fu
// 为表格绑定事件
Table.api.bindevent(table);
// 审核通过
/**
* 联动动态批量操作工具栏(仅勾选多项时显示,杜绝界面臃肿)
*/
function updateBatchBar() {
var selectedIds = Table.api.selectedids(table);
if (selectedIds.length > 0) {
selectedCount.text(selectedIds.length);
batchBar.removeClass('hide').show();
} else {
batchBar.addClass('hide').hide();
}
}
table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table load-success.bs.table', function () {
updateBatchBar();
});
// 双击行打开详情弹窗
table.on('dbl-click-row.bs.table', function (e, row) {
var isPending = Number(row.audit_status) === 0;
var mode = isPending ? 'audit' : 'view';
var title = isPending ? '审核' : '详情';
Fast.api.open('fc/post/detail?ids=' + row.id + '&mode=' + mode, title, {area: ['850px', '85%']});
});
// 清除多选选中状态
$(document).on('click', '.btn-clear-selection', function () {
table.bootstrapTable('uncheckAll');
updateBatchBar();
});
// 批量审核通过
$(document).on('click', '.btn-audit-pass', function () {
var ids = Table.api.selectedids(table);
Layer.confirm(__('确认审核通过选中的信息?'), {icon: 3, title: __('提示')}, function (index) {
if (ids.length === 0) {
Toastr.warning('请先勾选需要批量操作的信息');
return;
}
Layer.confirm('确认批量审核通过选中的 ' + ids.length + ' 条信息?', {title: '批量审核确认', btn: ['通过', '取消']}, function (index) {
Fast.api.ajax({
url: 'fc/post/audit',
data: {ids: ids.join(','), auditStatus: 1}
}, function (data) {
}, function () {
table.bootstrapTable('refresh');
updateBatchBar();
return false;
});
Layer.close(index);
});
});
// 审核驳回
// 批量审核驳回
$(document).on('click', '.btn-audit-reject', function () {
var ids = Table.api.selectedids(table);
Layer.prompt({title: __('请输入驳回原因'), formType: 2}, function (value, index) {
if (ids.length === 0) {
Toastr.warning('请先勾选需要批量操作的信息');
return;
}
Layer.prompt({title: '请输入批量驳回的原因(将通知给发布用户)', formType: 2}, function (value, index) {
if (!$.trim(value)) {
Toastr.error('驳回原因不可为空');
return;
}
Fast.api.ajax({
url: 'fc/post/audit',
data: {ids: ids.join(','), auditStatus: 2, reason: value}
}, function (data) {
}, function () {
table.bootstrapTable('refresh');
updateBatchBar();
return false;
});
Layer.close(index);
});
});
// 下架
// 批量下架
$(document).on('click', '.btn-offline', function () {
var ids = Table.api.selectedids(table);
Layer.confirm(__('确认下架选中的信息?'), {icon: 3, title: __('提示')}, function (index) {
if (ids.length === 0) {
Toastr.warning('请先勾选需要下架的信息');
return;
}
Layer.confirm('确认批量下架选中的 ' + ids.length + ' 条信息?', {title: '下架确认', btn: ['下架', '取消']}, function (index) {
Fast.api.ajax({
url: 'fc/post/offline',
data: {ids: ids.join(',')}
}, function (data) {
}, function () {
table.bootstrapTable('refresh');
updateBatchBar();
return false;
});
Layer.close(index);
});
});
// 置顶(选中项在用户端首页优先展示)
// 批量置顶
$(document).on('click', '.btn-top', function () {
var ids = Table.api.selectedids(table);
Layer.confirm(__('确认置顶选中的信息?'), {icon: 3, title: __('提示')}, function (index) {
if (ids.length === 0) {
Toastr.warning('请先勾选需要置顶的信息');
return;
}
Layer.confirm('确认批量置顶选中的 ' + ids.length + ' 条信息?', {title: '置顶确认', btn: ['置顶', '取消']}, function (index) {
Fast.api.ajax({
url: 'fc/post/top',
data: {ids: ids.join(','), isTop: 1}
}, function (data) {
}, function () {
table.bootstrapTable('refresh');
updateBatchBar();
return false;
});
Layer.close(index);
});
});
// 取消置顶
$(document).on('click', '.btn-untop', function () {
var ids = Table.api.selectedids(table);
Layer.confirm(__('确认取消置顶选中的信息?'), {icon: 3, title: __('提示')}, function (index) {
Fast.api.ajax({
url: 'fc/post/top',
data: {ids: ids.join(','), isTop: 0}
}, function (data) {
table.bootstrapTable('refresh');
return false;
});
Layer.close(index);
});
});
},
/**
* 详情与审核窗口逻辑
*/
detail: function () {
var postId = Fast.api.query('ids') || Fast.api.query('id');
/**
* 提交审核结果
* @param {number} status 1=通过, 2=驳回
* @param {string} reason 驳回原因
*/
function submitAudit(status, reason) {
Fast.api.ajax({
url: 'fc/post/audit',
type: 'POST',
data: {
ids: postId,
auditStatus: status,
reason: reason || ''
}
}, function (data, ret) {
Toastr.success(ret.msg || '操作成功');
setTimeout(function () {
Fast.api.close();
if (parent.$ && parent.$('#table').length) {
parent.$('#table').bootstrapTable('refresh');
}
}, 400);
return false;
}, function (data, ret) {
Toastr.error(ret.msg || '操作失败');
return false;
});
}
// 点击通过:弹窗确认通过
$('#btn-pass').off('click').on('click', function () {
Layer.confirm('确认审核通过此信息吗?', {
title: '通过确认',
btn: ['通过', '取消']
}, function (index) {
Layer.close(index);
submitAudit(1, '');
});
});
// 点击驳回:弹窗确认输入驳回原因
$('#btn-reject').off('click').on('click', function () {
Layer.prompt({
title: '请输入驳回原因(将通知给发布用户)',
formType: 2,
value: ''
}, function (value, promptIndex) {
var reason = $.trim(value);
if (!reason) {
Toastr.warning('驳回原因不可为空');
return;
}
Layer.close(promptIndex);
submitAudit(2, reason);
});
});
// 点击关闭
$('#btn-close').off('click').on('click', function () {
Fast.api.close();
});
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
@@ -280,15 +332,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/format'], fu
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'fc/post/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
clickToSelect: false,
columns: [
[
{checkbox: true},
{field: 'id', title: __('SerialNo'), operate: false, sortable: false, align: 'center', width: '70px', class: 'fc-serial', table: table, formatter: Format.serial},
{field: 'id', title: '序号', operate: false, formatter: function (value, row, index) {
return '<span class="fc-serial">' + (index + 1) + '</span>';
}},
{field: 'title', title: __('Title'), align: 'left'},
{
field: 'deletetime',
@@ -299,24 +353,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/format'], fu
},
{
field: 'operate',
width: '140px',
title: __('Operate'),
width: '120px',
title: '操作',
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'Restore',
text: __('Restore'),
text: '还原',
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
icon: 'fa fa-rotate-left',
url: 'fc/post/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
text: '销毁',
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'fc/post/destroy',
refresh: true
}
@@ -327,7 +379,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/format'], fu
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
@@ -343,5 +394,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/format'], fu
}
}
};
return Controller;
});

查看文件

@@ -53,8 +53,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/format'], fu
buttons: [
{
name: 'handle',
text: __('HandleReport'),
title: __('HandleReport'),
text: '处理',
title: '处理',
classname: 'btn btn-xs btn-success btn-click',
visible: function (row) {
return row.status !== 'handled';

查看文件

@@ -77,7 +77,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/format'], fu
buttons: [
{
name: 'pay',
text: __('PayWithdraw'),
text: '打款',
title: __('PayWithdraw'),
classname: 'btn btn-xs btn-success btn-click',
visible: function (row) {
@@ -96,7 +96,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/format'], fu
},
{
name: 'reject',
text: __('RejectWithdraw'),
text: '驳回',
title: __('RejectWithdraw'),
classname: 'btn btn-xs btn-danger btn-click',
visible: function (row) {