文件
fenleixinxi/public/assets/js/backend/fc/userext.js
MiAn ea26329e80 feat: 新增用户真实姓名与实名认证功能,优化后台用户管理
1. 前端个人中心新增真实姓名输入与实名状态展示,支持微信提现核验
2. 后端Auth接口新增真实姓名修改与手机号冲突校验逻辑
3. 后台新增用户详情综合看板,展示佣金、提现、分销等全量数据
4. 优化微信转账逻辑,支持paying状态重试时查询微信单号避免重复创建
5. 新增数据库ALTER脚本同步transfer_status字段结构
6. 新增部署与数据库变更工具脚本,支持线上线下环境同步
2026-10-28 16:21:22 +08:00

154 行
8.8 KiB
JavaScript

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/format'], function ($, undefined, Backend, Table, Form, Format) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'fc/userext/index' + location.search,
add_url: 'fc/userext/add',
edit_url: 'fc/userext/edit',
del_url: 'fc/userext/del',
multi_url: 'fc/userext/multi',
import_url: 'fc/userext/import',
table: 'fc_user_ext',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('SerialNo'), operate: false, sortable: false, align: 'center', width: '60px', class: 'fc-serial', table: table, formatter: Format.serial},
{field: 'nickname', title: '用户昵称', operate: 'LIKE'},
{field: 'mobile', title: '手机号', operate: 'LIKE'},
{
field: 'realname', title: '真实姓名(实名)', operate: 'LIKE',
formatter: function (value, row) {
if (!value) {
return '<span class="text-muted"><i class="fa fa-minus-circle"></i> 未填写</span>';
}
var isAuthed = parseInt(row.realname_status) === 1;
var icon = isAuthed ? '<i class="fa fa-shield text-success" title="微信已核验实名"></i> ' : '<i class="fa fa-question-circle text-muted" title="未核验"></i> ';
return icon + '<span class="text-bold" style="color: #2c3e50;">' + value + '</span>';
}
},
{
field: 'realname_status', title: '实名状态',
searchList: {'0': '未认证', '1': '已认证'},
formatter: Format.statusFormatter({'0': '未认证', '1': '已实名'}, {'0': 'default', '1': 'success'})
},
{
field: 'money', title: __('Money'), operate: false,
formatter: function (value) {
var n = parseFloat(value || 0);
return '<span class="text-bold" style="color: #00A854;">¥' + n.toFixed(2) + '</span>';
}
},
{
field: 'user_type', title: __('User_type'),
searchList: {'1': __('个人'), '2': __('商家')},
formatter: Format.statusFormatter({'1': __('个人'), '2': __('商家')}, {'1': 'info', '2': 'warning'})
},
{
field: 'is_member', title: __('Is_member'),
searchList: {'0': __('否'), '1': __('是')},
formatter: Format.statusFormatter({'0': __('非会员'), '1': __('会员')}, {'0': 'default', '1': 'warning'})
},
{field: 'member_level', title: __('Member_level'), operate: 'LIKE'},
{field: 'member_expiretime', title: __('Member_expiretime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime},
{field: 'invite_code', title: __('Invite_code'), operate: 'LIKE'},
{field: 'openid', title: __('Openid'), operate: 'LIKE', visible: false},
{field: 'inviter_id', title: __('Inviter_id'), visible: false},
{field: 'post_quota_left', title: '剩余发布额度', operate: false, visible: false},
{field: 'createtime', title: __('Createtime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime},
{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: 'detail',
text: '详情',
title: function (row) {
return '用户详情 - ' + (row.nickname || ('UID:' + row.user_id));
},
classname: 'btn btn-xs btn-info btn-dialog',
icon: 'fa fa-user-circle-o',
url: 'fc/userext/detail',
extend: 'data-area=\'["960px", "780px"]\''
},
{
name: 'recharge',
text: '充值',
title: '余额充值',
classname: 'btn btn-xs btn-warning btn-click',
icon: 'fa fa-money',
click: function (options, row) {
var nickname = row.nickname || ('用户#' + row.user_id);
var balance = parseFloat(row.money || 0).toFixed(2);
Layer.prompt({
title: '给「' + nickname + '」充值(当前余额 ¥' + balance + ')',
formType: 0
}, function (value, index) {
var amount = parseFloat(value);
if (!(amount > 0)) {
Layer.msg('请输入大于 0 的金额', {icon: 2});
return;
}
if (amount > 100000) {
Layer.msg('单次充值不能超过 100000 元', {icon: 2});
return;
}
// 注意:本表主键 id 是扩展表记录ID,余额存在 fa_user.money,必须传 user_id
Fast.api.ajax({
url: 'fc/userext/recharge',
data: {ids: row.user_id, amount: amount}
}, function (data, ret) {
Layer.close(index);
Toastr.success(ret.msg || '充值成功');
$('#' + options.tableId).bootstrapTable('refresh');
return false;
}, function (data, ret) {
Layer.close(index);
Toastr.error(ret.msg || '充值失败');
return false;
});
});
}
}
]
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
detail: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});