2025-08-05 18:31:58 +08:00

411 lines
19 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'user/user/index',
add_url: 'user/user/add',
edit_url: 'user/user/edit',
del_url: 'user/user/del',
multi_url: 'user/user/multi',
table: 'user',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'user.id',
fixedColumns: true,
fixedRightNumber: 1,
asyndownload: true,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id'), sortable: true},
{field: 'group.name', title: __('Group')},
{field: 'username', title: __('Username'), operate: 'LIKE'},
{field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
{field: 'realname', title: __('真实姓名'), operate: 'LIKE'},
{field: 'settle_info.settled_amount', title: __('可提现金额'), operate: false},
{field: 'settle_info.expected_incoming_amount', title: __('预期收益'), operate: false},
{field: 'settle_info.accumulated_incoming_amount', title: __('累计收入'), operate: false},
{field: 'business_type', title: __('商户进件完善'), searchList: {"1":__('已完善'),"2":__('未完善')}, formatter: Table.api.formatter.status},
{field: 'work', title: __('职业'), operate: 'LIKE'},
{field: 'email', title: __('Email'), operate: 'LIKE'},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
{field: 'level', title: __('Level'), operate: 'BETWEEN', sortable: true},
{field: 'gender', title: __('Gender'), visible: false, searchList: genderListJson, formatter: Table.api.formatter.normal},
{field: 'score', title: __('Score'), operate: 'BETWEEN', sortable: true},
{field: 'successions', title: __('Successions'), visible: false, operate: 'BETWEEN', sortable: true},
{field: 'maxsuccessions', title: __('Maxsuccessions'), visible: false, operate: 'BETWEEN', sortable: true},
{field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
{field: 'loginip', title: __('Loginip'), formatter: Table.api.formatter.search},
{field: 'jointime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
{field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search},
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
{field: 'operate', title: __('Operate'), table: table , buttons: [
// {
// name: 'user_auth',
// text: __('设置成机构认证'),
// title: __('设置成机构认证'),
// classname: 'btn btn-dialog',
// icon: 'fa fa-bank',
// dropdown : '更多',
// url: manystore_url,
// callback: function (data) {
//
// },
// // visible: function (row) {
// // return row.status == '2'||row.status == '3';
// // }
// },
// {
// name: 'user_auth',
// text: __('设置成机构授权'),
// title: __('设置成机构授权'),
// classname: 'btn btn-dialog',
// icon: 'fa fa-bitbucket',
// dropdown : '更多',
// url: user_auth_url,
// callback: function (data) {
//
// },
// // visible: function (row) {
// // return row.status == '2'||row.status == '3';
// // }
// },
//
//
//
// {
// name: 'teacher',
// text: __('设置成老师'),
// title: __('设置成老师'),
// classname: 'btn btn-dialog',
// icon: 'fa fa-user',
// dropdown : '更多',
// url: teacher_url,
// callback: function (data) {
//
// },
// // visible: function (row) {
// // return row.status == '2'||row.status == '3';
// // }
// },
//
//
//
// {
// name: 'verification',
// text: __('设置成核销员'),
// title: __('设置成核销员'),
// classname: 'btn btn-dialog',
// icon: 'fa fa-user',
// dropdown : '更多',
// url: verification_url,
// callback: function (data) {
//
// },
// // visible: function (row) {
// // return row.status == '2'||row.status == '3';
// // }
// },
//
{
name: 'third',
text: __('三方账号信息'),
title: __('三方账号信息'),
classname: 'btn btn-dialog',
icon: 'fa fa-user',
dropdown : '更多',
url: third_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'activity',
text: __('发布的活动'),
title: __('发布的活动'),
classname: 'btn btn-dialog',
icon: 'fa fa-calendar',
dropdown : '更多',
url: activity_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
// {
// name: 'classes_order',
// text: __('课程购买单'),
// title: __('课程购买单'),
// classname: 'btn btn-dialog',
// icon: 'fa fa-cart-arrow-down',
// dropdown : '更多',
// url: classes_order_url,
// callback: function (data) {
//
// },
// // visible: function (row) {
// // return row.status == '2'||row.status == '3';
// // }
// },
//
{
name: 'userwithdrawal',
text: __('用户提现银行卡'),
title: __('用户提现银行卡'),
classname: 'btn btn-dialog',
icon: 'fa fa-calendar',
dropdown : '更多',
url: userwithdrawal_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'userwithdrawal_log',
text: __('用户提现记录'),
title: __('用户提现记录'),
classname: 'btn btn-dialog',
icon: 'fa fa-calendar',
dropdown : '更多',
url: userwithdrawal_log_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'pay_user',
text: __('贡献资金结算'),
title: __('贡献资金结算'),
classname: 'btn btn-dialog',
icon: 'fa fa-calendar',
dropdown : '更多',
url: settle_log_pay_user_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'to_user',
text: __('获取的资金结算'),
title: __('获取的资金结算'),
classname: 'btn btn-dialog',
icon: 'fa fa-calendar',
dropdown : '更多',
url: settle_log_to_user_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'activity_order',
text: __('参与的活动订单'),
title: __('参与的活动订单'),
classname: 'btn btn-dialog',
icon: 'fa fa-cart-arrow-down',
dropdown : '更多',
url: activity_order_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
// {
// name: 'evaluate',
// text: __('查看用户评价'),
// title: __('查看用户评价'),
// classname: 'btn btn-dialog',
// icon: 'fa fa-handshake-o',
// dropdown : '更多',
// url: evaluate_url,
// callback: function (data) {
//
// },
// // visible: function (row) {
// // return row.classes_evaluate_id;
// // }
// },
{
name: 'attachment',
text: __('查看用户上传图片'),
title: __('查看用户上传图片'),
classname: 'btn btn-dialog',
icon: 'fa fa-file-picture-o',
dropdown : '更多',
url: attachment_url,
callback: function (data) {
},
// visible: function (row) {
// return row.classes_evaluate_id;
// }
},
], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
/**
* 发放y预约订单
* cc
* 2020年8月5日
*/
$(document).on('click', '.btn-changeuser', function (event) {
var url = $(this).attr('data-url');
if(!url) return false;
var title = $(this).attr('title');
var width = $(this).attr('data-width');
var height = $(this).attr('data-height');
var area = [$(window).width() > 800 ? (width?width:'800px') : '95%', $(window).height() > 600 ? (height?height:'600px') : '95%'];
var options = {
shadeClose: false,
shade: [0.3, '#393D49'],
area: area,
callback:function(ret){//回调方法需要在本页面Controller中增加方法监听且调用Fast.api.close(ret)传递结果;
}
};
Fast.api.open(url,title,options);
});
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
changeuser: function(){
$("#changeuser").on('click', function() {
$("#changeuser-form").attr("action",'user/user/changeuser').submit();
});
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
var third_url = function (row,dom) {
return 'third/index?user_id='+row.id;
}
//classes_order_url
var classes_order_url = function (row,dom) {
return 'school/classes/order/order/index?user_id='+row.id;
}
//classes_hourorder_url
var classes_hourorder_url = function (row,dom) {
return 'school/classes/hourorder/order/index?user_id='+row.id;
}
var user_auth_url = function (row,dom) {
return 'manystore/user_auth/index?user_id='+row.id;
}
var teacher_url = function (row,dom) {
return 'school/classes/teacher/index?user_id='+row.id;
}
var verification_url = function (row,dom) {
return 'school/classes/verification/index?user_id='+row.id;
}
var manystore_url = function (row,dom) {
return 'manystore/index/index?user_id='+row.id;
}
var evaluate_url= function (row,dom) {
return 'school/classes/evaluate/index?user_id='+row.id;
}
var attachment_url = function (row,dom) {
return 'general/attachment/index?user_id='+row.id;
}
var activity_order_url = function (row,dom) {
return 'school/activity/order/order/index?user_id='+row.id;
}
var userwithdrawal_url = function (row,dom) {
return 'user/withdrawal/userwithdrawal/index?user_id='+row.id;
}
var userwithdrawal_log_url = function (row,dom) {
return 'user/withdrawal/userwithdrawal_log/index?user_id='+row.id;
}
var settle_log_to_user_url = function (row,dom) {
return 'school/activity/order/settle_log/index?to_user_id='+row.id;
}
var settle_log_pay_user_url = function (row,dom) {
return 'school/activity/order/settle_log/index?pay_user_id='+row.id;
}
var activity_url = function (row,dom) {
return 'school/activity/activity/index?user_id='+row.id;
}
return Controller;
});