define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { dragsort_url: '', index_url: 'service/skill/skill/index' + location.search, add_url: 'service/skill/skill/add', edit_url: 'service/skill/skill/edit', multi_url: 'service/skill/skill/multi', import_url: 'service/skill/skill/import', table: 'service_skill' } }); 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: __('服务者信息'),operate: false,formatter:function (value,row){ let result = `
${row.name}
ID:${row.id}
工号:${row.code}
${row.skill_cate_name}
` if(row.is_rest == 0){ result += `
${row.is_rest_text}
` }else{ result += `
${row.is_rest_text}
` } result += `
${row.sex_text}${row.mobile}身份证:${row.idcard}
学历:${row.edu_text}
年龄:${row.age}
民族:${row.nation}
经验:${row.exper_text}
所在位置:${row.province}${row.city}${row.district}${row.address}
所属商户:${row.shop_name}
` return result }}, {field: 'id', title: __('钱包'),operate: false, cellStyle: function () {return {css: {"min-width": "250px"}}},formatter:function (value,row){ return `
保证金 ${row.ensure_price}
平台钱包 ${row.skillmoney.money}
商户钱包 ${row.skillmoney.shop_money}
` }}, {field: 'id', title: __('接单信息'),operate: false,formatter:function (value,row){ return `
每日可接单数量 ${row.accept_nums}
已接单数量 ${row.already_accept_nums}
订单收益分成% ${row.percent}
` }}, {field: 'id', title: __('证件'),operate: false,formatter:function (value,row){ return `
身份证正面
身份证反面
从业资格证
健康证
` }}, {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,formatter:function (value,row){ let images = row.images.split(',') let result = `
实拍照
` if(row.images.length>0){ result+=`
相册
`; for(let i=0; i < images.length; i++){ result += `` } result+='
' } return result }}, {field: 'id', title: __('权重、状态'),operate: false, cellStyle: function () {return {css: {"min-width": "250px"}}},formatter:function (value,row){ return `
权重 ${row.weigh}
状态 ${row.state_text}
` }}, {field: 'id', title: __('时间'),operate: false, cellStyle: function () {return {css: {"min-width": "180px"}}},formatter:function (value,row){ return `
创建时间
${row.create_time}
更新时间
${row.update_time}
` }}, {field: 'id', title: __('Id'),visible: false}, {field: 'user_id', title: __('User_id'),visible: false}, {field: 'shop_id', title: __('Shop_id'),visible: false}, {field: 'shop_name', title: __('Shop_name'),operate:false,visible: false}, {field: 'ensure_price', title: __('Ensure_price'), operate:'BETWEEN',visible: false}, {field: 'code', title: __('Code'),visible: false}, {field: 'skillmoney.money', title: __('Money'),operate: false,visible: false}, {field: 'skillmoney.shop_money', title: __('Shop_money'),operate: false,visible: false}, {field: 'mobile', title: __('Mobile'),visible: false}, {field: 'accept_nums', title: __('Accept_nums'),visible: false}, {field: 'already_accept_nums', title: __('Already_accept_nums'),visible: false}, {field: 'percent', title: __('Percent'),visible: false}, {field: 'name', title: __('Name'),visible: false}, {field: 'sex', title: __('Sex'), searchList: {"1":__('Sex 1'),"0":__('Sex 0')}, formatter: Table.api.formatter.normal,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,visible: false}, {field: 'opposite_image', title: __('Opposite_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image,visible: false}, {field: 'user_image', title: __('User_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image,visible: false}, {field: 'certificate_image', title: __('Certificate_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image,visible: false}, {field: 'health_image', title: __('Health_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image,visible: false}, {field: 'category_id', title: __('Category_id'),visible: false}, {field: 'category_name', title: __('Category_name'),operate:false,visible: false}, {field: 'skill_cate_id', title: __('Skill_cate_id'),visible: false}, {field: 'skill_cate_name', title: __('Skill_cate_name'),operate:false,visible: false}, {field: 'goods_ids', title: __('Goods_ids'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content,visible: false}, {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image,visible: false}, {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images,visible: false}, {field: 'edu', title: __('Edu'), searchList: {"0":__('Edu 0'),"1":__('Edu 1'),"2":__('Edu 2'),"3":__('Edu 3'),"4":__('Edu 4'),"5":__('Edu 5'),"6":__('Edu 6')}, formatter: Table.api.formatter.normal,visible: false}, {field: 'age', title: __('Age'),visible: false}, {field: 'nation', title: __('Nation'),visible: false}, {field: 'exper', title: __('Exper'), searchList: {"0":__('Exper 0'),"1":__('Exper 1'),"2":__('Exper 2'),"3":__('Exper 3')}, formatter: Table.api.formatter.normal,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: 'is_rest', title: __('Is_rest'), searchList: {"0":__('Is_rest 0'),"1":__('Is_rest 1')}, formatter: Table.api.formatter.normal,visible: false}, {field: 'rebate_price', title: __('Rebate_price'), operate:'BETWEEN',visible: false}, {field: 'state', title: __('State'), searchList: {"0":__('State 0'),"1":__('State 1')}, formatter: Table.api.formatter.normal,visible: false}, {field: 'weigh', title: __('Weigh'), operate: false,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: 'list', text: __('平台余额明细'), title: __('平台余额明细'), classname: 'btn btn-xs btn-detail btn-dialog', icon: 'fa fa-list-o', url: function(row){ return 'service/money/serviceusermoneylog/index?user_id='+row.user_id; }, }, { name: 'list', text: __('商户余额明细'), title: __('商户余额明细'), classname: 'btn btn-xs btn-change btn-dialog', icon: 'fa fa-list-o', url: function(row){ return 'service/money/shopmoneylog/index?user_id='+row.user_id; }, }, { name: 'list', text: __('保证金明细'), title: __('保证金明细'), classname: 'btn btn-xs btn-list btn-dialog', icon: 'fa fa-list-o', url: function(row){ return 'service/money/ensurelog/index?user_id='+row.user_id+'&type=0'; }, }, { name: 'list', text: __('订单列表'), title: __('订单列表'), classname: 'btn btn-xs btn-list btn-success btn-dialog', icon: 'fa fa-list-o', url: function(row){ return 'service/order/order/index?skill_id='+row.id; }, }, { name: 'info', text: __('扣除保证金'), title: __('扣除保证金'), classname: 'btn btn-xs btn-list btn-danger btn-dialog', icon: 'fa fa-list-o', url: 'service/skill/skill/deduct', }, { name: 'edit', text: __('编辑'), title: __('编辑'), classname: 'btn btn-xs btn-status btn-dialog', icon: 'fa fa-list-o', url: 'service/skill/skill/edit', } ], formatter: Table.api.formatter.operate} ] ] }); // 为表格绑定事件 Table.api.bindevent(table); }, recyclebin: function () { // 初始化表格参数配置 Table.api.init({ extend: { 'dragsort_url': '' } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: 'service/skill/skill/recyclebin' + location.search, pk: 'id', sortName: 'id', columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'name', title: __('Name'), 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: 'service/skill/skill/restore', refresh: true }, { name: 'Destroy', text: __('Destroy'), classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit', icon: 'fa fa-times', url: 'service/skill/skill/destroy', refresh: true } ], formatter: Table.api.formatter.operate } ] ] }); // 为表格绑定事件 Table.api.bindevent(table); }, add: function () { $("[data-toggle='addresspicker']").data("callback", function(res){ //其中res则是包含了address/lat/lng/zoom等信息的JSON对象 console.log(res) }); Controller.api.bindevent(); }, edit: function () { Controller.api.bindevent(); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); } } }; return Controller; });