- 新增账号安全页面及支付密码验证组件 - 新增用户类型选择流程及商家资质管理 - 新增订单资质校验逻辑,师傅需满足订单证书要求 - 新增企业资质认证相关数据库表及接口 - 优化用户列表展示,区分个人与商家用户类型
138 行
6.8 KiB
JavaScript
138 行
6.8 KiB
JavaScript
define(['jquery', 'bootstrap', 'backend', 'table', 'backend/admin-table-layout', 'form'], function ($, undefined, Backend, Table, TableLayout, Form) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'user/user/index',
|
|
add_url: '',
|
|
edit_url: 'user/user/edit',
|
|
del_url: '',
|
|
detail_url: 'user/user/detail',
|
|
multi_url: 'user/user/multi',
|
|
table: 'user',
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
|
|
table.on('post-body.bs.table', function () {
|
|
$(".btn-detail-usr", this).data("area", ["1020px", "86%"]);
|
|
$(".btn-editone", this).data("area", ["820px", "78%"]);
|
|
$(".btn-recharge-usr", this).data("area", ["650px", "620px"]);
|
|
});
|
|
$(".btn-edit").data("area", ["820px", "78%"]);
|
|
|
|
table.bootstrapTable({
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
pk: 'id',
|
|
sortName: 'user.id',
|
|
sortOrder: 'desc',
|
|
fixedColumns: false,
|
|
fixedRightNumber: 0,
|
|
columns: [
|
|
[
|
|
{checkbox: true},
|
|
{field: 'index', title: '序号', operate: false, formatter: Table.api.formatter.index, width: '55px'},
|
|
{field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false, width: '65px'},
|
|
{field: 'nickname', title: '会员昵称', operate: 'LIKE', align: 'left'},
|
|
{field: 'username', title: __('Username'), operate: 'LIKE'},
|
|
{field: 'id', title: 'ID', operate: false, visible: false},
|
|
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
|
|
{field: 'user_type', title: '用户类型', searchList: {personal: '个人用户', merchant: '商家用户'}, formatter: function (value, row) { return !Number(row.identity_selected) ? '待选择' : (value === 'merchant' ? '商家用户' : '个人用户'); }},
|
|
{
|
|
field: 'role_badges',
|
|
title: '平台身份角色',
|
|
operate: false,
|
|
align: 'left',
|
|
formatter: function (val) {
|
|
if (!Array.isArray(val) || !val.length) {
|
|
return '—';
|
|
}
|
|
return val.map(function (b) {
|
|
var cls = b.type === 'master' ? 'warning' : (b.type === 'merchant' || b.type === 'merchant_user' ? 'primary' : (b.type === 'member' ? 'info' : 'default'));
|
|
return '<span class="label label-' + cls + '" style="margin-right:4px;">' + $('<div>').text(b.label).html() + '</span>';
|
|
}).join('');
|
|
}
|
|
},
|
|
{
|
|
field: 'order_count',
|
|
title: '下单笔数',
|
|
operate: false,
|
|
formatter: function (val) {
|
|
return '<strong>' + (val || 0) + ' 笔</strong>';
|
|
}
|
|
},
|
|
{
|
|
field: 'total_spent',
|
|
title: '累计实付消费',
|
|
operate: false,
|
|
formatter: function (val) {
|
|
return '<strong style="color:#ea580c;">¥' + (val || '0.00') + '</strong>';
|
|
}
|
|
},
|
|
{
|
|
field: 'money',
|
|
title: '账户余额',
|
|
operate: 'BETWEEN',
|
|
sortable: true,
|
|
formatter: function (val) {
|
|
return '¥' + Number(val || 0).toFixed(2);
|
|
}
|
|
},
|
|
{field: 'jointime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
|
{field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
|
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
|
|
{
|
|
field: 'operate',
|
|
title: __('Operate'),
|
|
table: table,
|
|
events: Table.api.events.operate,
|
|
formatter: Table.api.formatter.operate,
|
|
buttons: [
|
|
{
|
|
name: 'recharge',
|
|
text: '充值',
|
|
title: '用户余额充值',
|
|
classname: 'btn btn-xs btn-success btn-dialog btn-recharge-usr',
|
|
url: 'user/user/recharge',
|
|
visible: function () { return !!table.data('operate-recharge'); }
|
|
},
|
|
{
|
|
name: 'detail',
|
|
text: '详情',
|
|
title: function (row) {
|
|
return '会员业务档案 - ' + (row.nickname || row.username);
|
|
},
|
|
icon: 'fa fa-eye',
|
|
classname: 'btn btn-xs btn-info btn-dialog btn-detail-usr',
|
|
url: 'user/user/detail'
|
|
}
|
|
]
|
|
}
|
|
]
|
|
]
|
|
});
|
|
|
|
Table.api.bindevent(table);
|
|
},
|
|
add: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
edit: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
detail: function () {
|
|
},
|
|
recharge: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
api: {
|
|
bindevent: function () {
|
|
Form.api.bindevent($("form[role=form]"));
|
|
}
|
|
}
|
|
};
|
|
return Controller;
|
|
});
|