define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'service/shop/applyshop/index' + location.search,
add_url: 'service/shop/applyshop/add',
// edit_url: 'service/shop/applyshop/edit',
// del_url: 'service/shop/applyshop/del',
multi_url: 'service/shop/applyshop/multi',
import_url: 'service/shop/applyshop/import',
table: 'service_apply_shop',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'updatetime',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{field: 'id', title: __('商户信息'),operate: false,formatter:function (value,row){
return `
简称:${row.abbr}
法人:${row.username} ${row.mobile}
身份证:${row.idcard}
类型:${row.type_text}
统一社会信用代码:${row.credit_code}
`
}},
{field: 'id', title: __('证件'),operate: false,formatter:function (value,row){
return `
身份证正面
身份证反面
营业执照
`
}},
{field: 'id', title: __('经营分类'),operate: false,cellStyle: function () {return {css: {"min-width": "200px","max-width": "400px"}}},formatter:function (value,row){
let word = row.categoryname.split(',')
let result = '';
for(let i=0; i < word.length; i++){
result += `
${word[i]}
`
}
result+='
'
return result
}},
{field: 'id', title: __('项目'),operate: false,cellStyle: function () {return {css: {"min-width": "300px","max-width": "500px"}}},formatter:function (value,row){
let word = row.goodsname.split(',')
let result = '';
for(let i=0; i < word.length; i++){
result += `
${word[i]}
`
}
result+='
'
return result
}},
{field: 'id', title: __('店铺信息'),operate: false, cellStyle: function () {return {css: {"min-width": "400px"}}},formatter:function (value,row){
return `
地 址
${row.province}${row.city}${row.district}${row.address}
`
}},
{field: 'id', title: __('店铺简介'),operate: false, cellStyle: function () {return {css: {"min-width": "400px"}}},formatter:function (value,row){
return `
`
}},
{field: 'id', title: __('状态'),operate: false, cellStyle: function () {return {css: {"min-width": "250px"}}},formatter:function (value,row){
let result = `
状态
${row.state_text}
`
if(row.state == -1){
result+=`
`
}
return result
}},
{field: 'id', title: __('时间'),operate: false, cellStyle: function () {return {css: {"min-width": "180px"}}},formatter:function (value,row){
return `
`
}},
// {checkbox: true},
{field: 'id', title: __('Id'),visible: false},
{field: 'user_id', title: __('User_id'),visible: false},
{field: 'name', title: __('Name'), operate: 'LIKE',visible: false},
{field: 'type', title: __('Type'), searchList: {"0":__('Type 0'),"1":__('Type 1')}, formatter: Table.api.formatter.normal,visible: false},
{field: 'credit_code', title: __('Credit_code'), operate: 'LIKE',visible: false},
// {field: 'license_image', title: __('License_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'username', title: __('Username'),visible: false},
{field: 'mobile', title: __('Mobile'),visible: false},
{field: 'idcard', title: __('Idcard'),visible: false},
// {field: 'front_image', title: __('Front_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
// {field: 'opposite_image', title: __('Opposite_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'intro', title: __('Intro'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content,visible: false},
// {field: 'logo_image', title: __('Logo_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'categoryname', title: __('Category_list'), operate: false,visible: false},
{field: 'goodsname', title: __('Goods_list'), operate: false,visible: false},
{field: 'leader_name', title: __('Leader_name'),visible: false},
{field: 'leader_mobile', title: __('Leader_mobile'),visible: false},
{field: 'province', title: __('Province'), operate: 'LIKE',visible: false},
{field: 'city', title: __('City'), operate: 'LIKE',visible: false},
{field: 'district', title: __('District'), operate: 'LIKE',visible: false},
{field: 'address', title: __('Address'), operate: 'LIKE',visible: false},
// {field: 'lng', title: __('Lng')},
// {field: 'lat', title: __('Lat')},
{field: 'state', title: __('State'), searchList: {"0":__('State 0'),"1":__('State 1'),"-1":__('State -1')}, formatter: Table.api.formatter.normal,visible: false},
{field: 'note', title: __('Note'), operate: 'LIKE',visible: false},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible: false},
{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,
buttons: [
{
name:'audit',
text:'通过',
title:'通过',
classname: 'btn btn-xs btn-success btn-dialog',
url: 'service/shop/applyshop/agree',
success: function (data, ret) {
$(".btn-refresh").trigger('click');
},
hidden:function(row){
if(row.state != 0){
return true;
}
}
},
{
name: 'refuse',
text: __('拒绝'),
title: __('拒绝'),
classname: 'btn btn-xs btn-danger btn-dialog',
url: function(row){
return 'service/shop/applyshop/refuse?ids='+row.id;
},
success: function (data, ret) {
$(".btn-refresh").trigger('click');
},
hidden:function(row){
if(row.state != 0){
return true;
}
}
},
],
formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
agree: function () {
$(document).on('click', '.btn-embossed', function () {
parent.$(".btn-refresh").trigger('click');
});
Controller.api.bindevent();
},
refuse: function () {
$(document).on('click', '.btn-embossed', function () {
parent.$(".btn-refresh").trigger('click');
});
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});