123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'order/index' + location.search,
- add_url: 'order/submitordernew',
- // edit_url: 'order/edit',
- // del_url: 'order/del',
- multi_url: 'order/multi',
- import_url: 'order/import',
- table: 'order',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- fixedColumns: true,
- fixedRightNumber: 1,
- search:false,
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'orderno', title: __('Orderno'), operate: 'LIKE'},
- {field: 'ordertype', title: __('Ordertype'), searchList: {"1":__('Ordertype 1'),"2":__('Ordertype 2'),"3":__('Ordertype 3')}, formatter: Table.api.formatter.normal},
- {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3'),"4":__('Status 4')}, formatter: Table.api.formatter.status},
- {field: 'company_id', title: __('Company_id')},
- {field: 'company.name', title: __('Company.name'), operate: 'LIKE'},
- // {field: 'staff_id', title: __('Staff_id'), operate:false, visible:false},
- {field: 'staff.truename', title: __('Staff.truename'), operate: 'LIKE'},
- {field: 'staff.mobile', title: __('Staff.mobile'), operate: 'LIKE'},
- // {field: 'user_id', title: __('User_id'), operate:false, visible:false},
- {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
- {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
- {field: 'user_name', title: __('User_name'), operate: 'LIKE'},
- // {field: 'user_car_id', title: __('User_car_id'), operate: false, visible: false},
- {field: 'user_car_number', title: __('User_car_number'), operate: 'LIKE'},
- {field: 'user_mobile', title: __('User_mobile'), operate: 'LIKE'},
- {field: 'user_address', title: __('User_address'), operate: 'LIKE'},
- // {field: 'pre_order_id', title: __('Pre_order_id'), operate:false, visible:false},
- {field: 'pre_order.pre_order_no', title: __('Order.pre_order_no'), operate: 'LIKE'},
- // {field: 'servicetype_id', title: __('Servicetype_id'), operate:false, visible:false},
- {field: 'servicetype.title', title: __('Servicetype.title'), operate: 'LIKE'},
- {field: 'server_time', title: __('Server_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'server_info', title: __('Server_info'), operate: 'LIKE'},
- {field: 'server_images', title: __('Server_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
- // {field: 'package_id', title: __('Package_id'), operate:false, visible:false},
- {field: 'pay_time', title: __('Pay_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'paytype', title: __('Paytype'), searchList: {"1":__('Paytype 1'),"2":__('Paytype 2'),"3":__('Paytype 3')}, formatter: Table.api.formatter.normal},
- {field: 'pay_fee', title: __('Pay_fee'), operate:'BETWEEN'},
- {field: 'appen_fee', title: __('Appen_fee'), operate:'BETWEEN'},
- {field: 'total_fee', title: __('Total_fee'), operate:'BETWEEN'},
- {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'hexiao_time', title: __('Hexiao_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'cancel_time', title: __('Cancel_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'cancel_reason', title: __('Cancel_reason'), operate: 'LIKE'},
- {field: 'finish_time', title: __('Finish_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'next_date', title: __('Next_date'), operate: 'LIKE'},
- {field: 'next_carlicheng', title: __('Next_carlicheng'), operate: 'LIKE'},
- // {field: 'pay_order_id', title: __('Pay_order_id'), operate: false, visible: false},
- {field: 'operate', title: __('Operate'), table: table,
- buttons:[
- {
- name:'appenlist',
- text:'追加服务项',
- title:'追加服务项',
- icon:'fa fa-exclamation-circle',
- classname:'btn btn-xs btn-info btn-dialog',
- url:'orderappen/index/order_id/{ids}?dialog=1',
- target:'_self',
- extend: 'data-area=["90%","90%"]',
- hidden:function($row){
- if($row['status'] == 1){
- return true;
- }
- return false;
- }
- },
- {
- name:'cancel',
- text:'取消',
- title:'取消',
- icon:'fa fa-exclamation-circle',
- classname:'btn btn-xs btn-info btn-dialog',
- url:'order/cancel/id/{ids}?dialog=1',
- target:'_self',
- extend: 'data-area=["90%","90%"]',
- hidden:function($row){
- if($row['ordertype'] != 3 && $row['status'] == 2){
- return false;
- }
- return true;
- }
- },
- {
- name:'finish',
- text:'完成',
- title:'完成',
- icon:'fa fa-exclamation-circle',
- classname:'btn btn-xs btn-info btn-dialog',
- url:'order/finish/id/{ids}?dialog=1',
- target:'_self',
- extend: 'data-area=["90%","90%"]',
- hidden:function($row){
- if($row['status'] == 2){
- return false;
- }
- return true;
- }
- },
- ],
- events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- submitordernew: function () {
- Controller.api.bindevent();
- },
- cancel: function () {
- Controller.api.bindevent();
- },
- finish: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|