DiverseYouthNightSchool/public/assets/js/backend/manystore/index.js

238 lines
12 KiB
JavaScript
Raw Normal View History

2024-11-04 15:00:20 +08:00
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'manystore/index/index',
add_url: 'manystore/index/add',
edit_url: 'manystore/index/edit',
del_url: 'manystore/index/del',
free_url: 'manystore/index/free',
2024-11-04 15:00:20 +08:00
multi_url: 'manystore/index/multi',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
fixedColumns: true,
fixedRightNumber: 1,
2024-11-04 15:00:20 +08:00
columns: [
[
{checkbox: true},
{field: 'operate', title: __('Operate'),width:700, table: table , buttons: [
{name: 'free',
text: '免登录进入机构后台',
icon: 'fa fa-sign-in',
classname: 'btn btn-xs btn-warning btn-magic btn-ajax',
url: $.fn.bootstrapTable.defaults.extend.free_url,
confirm: '确认免登录进入机构后台?如果已登录其他机构,对方账号将被强制退出。',
success: function (data, ret) {
Layer.alert(ret.msg );
$(".btn-refresh").trigger("click");
//js获取当前域名
window.open("https://"+window.location.host + "/manystore", '_blank');
},
error: function (data, ret) {
Layer.alert(ret.msg);
return false;
},
visible: function (row) {
//显示条件 只能待入住订单
// if((row.status == 2 || row.status == 3) && row.mock_type == "base" && row.add_mock_status == "1" ){
return true;
// }
// return false;
}},
{
name: 'classes_spec',
text: __('机构课程'),
title: __('机构课程'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
url: classes_spec_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'teacher',
text: __('主讲老师信息'),
title: __('主讲老师信息'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
url: teacher_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'verification',
text: __('核销员信息'),
title: __('核销员信息'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
url: verification_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'virtual_user',
text: __('机构虚拟参与者'),
title: __('机构虚拟参与者'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
url: virtual_user_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
//
// {name: 'unsetmockauth',
// text: '取消加圈资格',
// icon: 'fa fa-sign-in',
// classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
// url: $.fn.bootstrapTable.defaults.extend.unsetmockauth_url,
// confirm: '(分车版本)确认取消用户加圈资格!',
// success: function (data, ret) {
// Layer.alert(ret.msg );
// $(".btn-refresh").trigger("click");
// },
// error: function (data, ret) {
// Layer.alert(ret.msg);
// return false;
// },
// visible: function (row) {
// //显示条件 只能待入住订单
// if((row.status == 2 || row.status == 3) && row.mock_type == "base" && row.add_mock_status == "2"){
// return true;
// }
// return false;
// }},
], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
2024-11-04 15:00:20 +08:00
{field: 'id', title: 'ID'},
2024-11-04 15:00:20 +08:00
{field: 'username', title: __('Username')},
{field: 'nickname', title: __('Nickname')},
{field: 'email', title: __('Email')},
{field: 'status', title: __("Status"), formatter: Table.api.formatter.status},
{field: 'shop.status', title: __('Auth_status'), searchList: {"0":__('Auth_status 0'),"1":__('Auth_status 1'),"2":__('Auth_status 2')}, formatter: Table.api.formatter.status},
{field: 'user_id', title: __('User_id'),visible:false},
{field: 'shop.type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
{field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
{field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
{field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'shop.name', title: __('申请姓名|机构名'), operate: 'LIKE'},
{field: 'shop.logo', title: __('Logo'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'shop.image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'shop.address_city', title: __('Address_city'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'shop.province', title: __('Province'),visible:false},
{field: 'shop.city', title: __('City'),visible:false},
{field: 'shop.district', title: __('District'),visible:false},
{field: 'shop.address', title: __('Address'), operate: 'LIKE',visible:false},
{field: 'shop.address_detail', title: __('Address_detail'), operate: 'LIKE',visible:false},
{field: 'shop.yyzz_images', title: __('Yyzz_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
{field: 'shop.front_idcard_image', title: __('身份证正面'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'shop.reverse_idcard_image', title: __('身份证反面'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'shop.tel', title: __('Tel'), operate: 'LIKE'},
2024-11-04 15:00:20 +08:00
{field: 'logintime', title: __('Login time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
2024-11-04 15:00:20 +08:00
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
$("#c-address_city").on("cp:updated", function() {
var citypicker = $(this).data("citypicker");
var province = citypicker.getCode("province");
var city = citypicker.getCode("city");
var district = citypicker.getCode("district");
if(province){
$("#province").val(province);
}
if(city){
$("#city").val(city);
}
if(district){
$("#district").val(district);
}
$(this).blur();
});
Form.api.bindevent($("form[role=form]"));
},
edit: function () {
$("#c-address_city").on("cp:updated", function() {
var citypicker = $(this).data("citypicker");
var province = citypicker.getCode("province");
var city = citypicker.getCode("city");
var district = citypicker.getCode("district");
if(province){
$("#province").val(province);
}
if(city){
$("#city").val(city);
}
if(district){
$("#district").val(district);
}
});
Form.api.bindevent($("form[role=form]"));
}
};
var classes_spec_url = function (row,dom) {
return 'school/classes/classes_lib/index?shop_id='+row.shop_id;
}
var virtual_user_url = function (row,dom) {
return 'school/classes/virtual_user/index?shop_id='+row.shop_id;
}
var teacher_url = function (row,dom) {
return 'school/classes/teacher/index?shop_id='+row.shop_id;
}
var verification_url = function (row,dom) {
return 'school/classes/verification/index?shop_id='+row.shop_id;
}
2024-11-04 15:00:20 +08:00
return Controller;
});