2025-04-03 17:58:16 +08:00
|
|
|
|
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
|
|
|
|
|
|
var Controller = {
|
|
|
|
|
index: function () {
|
|
|
|
|
// 初始化表格参数配置
|
|
|
|
|
Table.api.init({
|
|
|
|
|
extend: {
|
|
|
|
|
index_url: 'school/activity/activity/index' + location.search,
|
2025-04-07 18:20:31 +08:00
|
|
|
|
add_url: 'school/activity/activity/add'+ location.search,
|
|
|
|
|
edit_url: 'school/activity/activity/edit'+ location.search,
|
2025-04-03 17:58:16 +08:00
|
|
|
|
del_url: 'school/activity/activity/del',
|
2025-04-08 18:44:38 +08:00
|
|
|
|
cancel_url: 'school/activity/activity/cancel',
|
2025-04-03 17:58:16 +08:00
|
|
|
|
multi_url: 'school/activity/activity/multi',
|
|
|
|
|
import_url: 'school/activity/activity/import',
|
|
|
|
|
table: 'school_activity',
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var table = $("#table");
|
|
|
|
|
|
|
|
|
|
// 初始化表格
|
|
|
|
|
table.bootstrapTable({
|
|
|
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
|
|
|
pk: 'id',
|
|
|
|
|
sortName: 'weigh',
|
|
|
|
|
fixedColumns: true,
|
|
|
|
|
fixedRightNumber: 1,
|
|
|
|
|
columns: [
|
|
|
|
|
[
|
|
|
|
|
{checkbox: true},
|
|
|
|
|
{field: 'id', title: __('Id')},
|
|
|
|
|
{field: 'user_id', title: __('User_id')},
|
|
|
|
|
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
|
|
|
{field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
|
2025-04-09 19:07:58 +08:00
|
|
|
|
{field: 'feel', title: __('Feel'), searchList: {"0":__('Feel 0'),"1":__('Feel 1')}, formatter: Table.api.formatter.normal},
|
2025-04-08 18:44:38 +08:00
|
|
|
|
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3'),"4":__('Status 4'),"5":__('Status 5'),"-1":__('Status -1')}, formatter: Table.api.formatter.status},
|
|
|
|
|
{field: 'auth_status', title: __('Auth_status'), searchList: {"0":__('Auth_status 0'),"1":__('Auth_status 1'),"2":__('Auth_status 2')}, formatter: Table.api.formatter.status},
|
|
|
|
|
{field: 'reason', title: __('Reason'), operate: 'LIKE'},
|
2025-04-07 18:20:31 +08:00
|
|
|
|
// {field: 'address_city', title: __('Address_city'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
|
|
|
// {field: 'cate_ids', title: __('Cate_ids'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
|
|
|
|
|
|
|
|
{field: 'cate_ids', title: __('Cate_ids'), searchList: cateListJson, formatter: Table.api.formatter.flag},
|
|
|
|
|
// {field: 'province', title: __('Province')},
|
|
|
|
|
// {field: 'city', title: __('City')},
|
|
|
|
|
// {field: 'district', title: __('District')},
|
2025-04-03 17:58:16 +08:00
|
|
|
|
{field: 'address', title: __('Address'), operate: 'LIKE'},
|
|
|
|
|
{field: 'address_detail', title: __('Address_detail'), operate: 'LIKE'},
|
|
|
|
|
{field: 'longitude', title: __('Longitude'), operate: 'LIKE'},
|
|
|
|
|
{field: 'latitude', title: __('Latitude'), operate: 'LIKE'},
|
|
|
|
|
{field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
|
|
|
{field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
|
|
|
{field: 'sign_start_time', title: __('Sign_start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
|
|
|
{field: 'sign_end_time', title: __('Sign_end_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
|
|
|
{field: 'price', title: __('Price'), operate:'BETWEEN'},
|
|
|
|
|
{field: 'stock', title: __('Stock')},
|
2025-04-08 18:44:38 +08:00
|
|
|
|
|
2025-04-03 17:58:16 +08:00
|
|
|
|
{field: 'cancel_type', title: __('Cancel_type'), searchList: {"1":__('Cancel_type 1'),"2":__('Cancel_type 2')}, formatter: Table.api.formatter.normal},
|
|
|
|
|
{field: 'weigh', title: __('Weigh'), operate: false},
|
|
|
|
|
{field: 'recommend', title: __('Recommend'), searchList: {"0":__('Recommend 0'),"1":__('Recommend 1')}, formatter: Table.api.formatter.normal},
|
|
|
|
|
{field: 'hot', title: __('Hot'), searchList: {"0":__('Hot 0'),"1":__('Hot 1')}, formatter: Table.api.formatter.normal},
|
|
|
|
|
{field: 'new', title: __('New'), searchList: {"0":__('New 0'),"1":__('New 1')}, formatter: Table.api.formatter.normal},
|
|
|
|
|
{field: 'sale', title: __('Sale')},
|
|
|
|
|
{field: 'views', title: __('Views')},
|
|
|
|
|
{field: 'add_type', title: __('Add_type'), searchList: {"1":__('Add_type 1'),"2":__('Add_type 2')}, formatter: Table.api.formatter.normal},
|
|
|
|
|
{field: 'add_id', title: __('Add_id')},
|
2025-04-09 19:07:58 +08:00
|
|
|
|
|
2025-04-03 17:58:16 +08:00
|
|
|
|
{field: 'sign_num', title: __('Sign_num')},
|
|
|
|
|
{field: 'verification_num', title: __('Verification_num')},
|
|
|
|
|
{field: 'collect', title: __('Collect')},
|
|
|
|
|
{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},
|
2025-04-08 18:44:38 +08:00
|
|
|
|
|
2025-04-03 17:58:16 +08:00
|
|
|
|
{field: 'admin_id', title: __('Admin_id')},
|
|
|
|
|
{field: 'auth_time', title: __('Auth_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
|
|
|
{field: 'canceltime', title: __('Canceltime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
|
|
|
{field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
|
|
|
|
|
{field: 'user.realname', title: __('User.realname'), 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: 'admin.nickname', title: __('Admin.nickname'), operate: 'LIKE'},
|
|
|
|
|
{field: 'admin.avatar', title: __('Admin.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
|
2025-04-08 18:44:38 +08:00
|
|
|
|
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
|
|
|
|
|
|
|
|
|
{field: 'operate', title: __('Operate'), table: table , buttons: [
|
|
|
|
|
|
|
|
|
|
{name: 'cancel',
|
|
|
|
|
text: '取消活动',
|
|
|
|
|
icon: 'fa fa-user-times',
|
|
|
|
|
classname: 'btn btn-xs btn-warning btn-magic btn-ajax',
|
|
|
|
|
url: $.fn.bootstrapTable.defaults.extend.cancel_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 == '1' || row.status == '2' || row.status == '3' || row.status == '4' ){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}},
|
|
|
|
|
|
|
|
|
|
], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 17:58:16 +08:00
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 为表格绑定事件
|
|
|
|
|
Table.api.bindevent(table);
|
|
|
|
|
},
|
|
|
|
|
recyclebin: function () {
|
|
|
|
|
// 初始化表格参数配置
|
|
|
|
|
Table.api.init({
|
|
|
|
|
extend: {
|
|
|
|
|
'dragsort_url': ''
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var table = $("#table");
|
|
|
|
|
|
|
|
|
|
// 初始化表格
|
|
|
|
|
table.bootstrapTable({
|
|
|
|
|
url: 'school/activity/activity/recyclebin' + location.search,
|
|
|
|
|
pk: 'id',
|
|
|
|
|
sortName: 'id',
|
|
|
|
|
columns: [
|
|
|
|
|
[
|
|
|
|
|
{checkbox: true},
|
|
|
|
|
{field: 'id', title: __('Id')},
|
|
|
|
|
{field: 'title', title: __('Title'), align: 'left'},
|
|
|
|
|
{
|
|
|
|
|
field: 'deletetime',
|
|
|
|
|
title: __('Deletetime'),
|
|
|
|
|
operate: 'RANGE',
|
|
|
|
|
addclass: 'datetimerange',
|
|
|
|
|
formatter: Table.api.formatter.datetime
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'operate',
|
|
|
|
|
width: '140px',
|
|
|
|
|
title: __('Operate'),
|
|
|
|
|
table: table,
|
|
|
|
|
events: Table.api.events.operate,
|
|
|
|
|
buttons: [
|
|
|
|
|
{
|
|
|
|
|
name: 'Restore',
|
|
|
|
|
text: __('Restore'),
|
|
|
|
|
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
|
|
|
|
|
icon: 'fa fa-rotate-left',
|
|
|
|
|
url: 'school/activity/activity/restore',
|
|
|
|
|
refresh: true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Destroy',
|
|
|
|
|
text: __('Destroy'),
|
|
|
|
|
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
|
|
|
|
|
icon: 'fa fa-times',
|
|
|
|
|
url: 'school/activity/activity/destroy',
|
|
|
|
|
refresh: true
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
formatter: Table.api.formatter.operate
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 为表格绑定事件
|
|
|
|
|
Table.api.bindevent(table);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
add: function () {
|
|
|
|
|
Controller.api.bindevent();
|
|
|
|
|
},
|
|
|
|
|
edit: function () {
|
|
|
|
|
Controller.api.bindevent();
|
|
|
|
|
},
|
|
|
|
|
api: {
|
|
|
|
|
bindevent: function () {
|
2025-04-07 18:20:31 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(document).on("dp.change", "#add-form .datetimerange", function () {
|
|
|
|
|
$(this).parent().prev().find("input").trigger("change");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(document).on("dp.change", "#add-form .datetimepicker", function () {
|
|
|
|
|
$(this).parent().prev().find("input").trigger("change");
|
|
|
|
|
});
|
|
|
|
|
$(document).on("dp.change", "#edit-form .datetimerange", function () {
|
|
|
|
|
$(this).parent().prev().find("input").trigger("change");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(document).on("dp.change", "#edit-form .datetimepicker", function () {
|
|
|
|
|
$(this).parent().prev().find("input").trigger("change");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(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 ids = $(this).attr('data-id');
|
|
|
|
|
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.close(ret);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
Fast.api.open(url,title,options);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
2025-04-03 17:58:16 +08:00
|
|
|
|
Form.api.bindevent($("form[role=form]"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return Controller;
|
|
|
|
|
});
|