allocatr/public/assets/js/backend/orders/configorder.js
2025-05-20 21:50:50 +08:00

115 lines
5.5 KiB
JavaScript

define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'orders/configorder/index' + location.search,
//add_url: 'orders/configorder/add',
edit_url: 'orders/configorder/edit',
// del_url: 'orders/configorder/del',
multi_url: 'orders/configorder/multi',
import_url: 'orders/configorder/import',
table: 'order',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{field: 'id', title: __('Id')},
{field: 'order_no', title: __('Order_no'), operate: '='},
// {field: 'customer', title: __('Customer'), operate: 'LIKE'},
//{field: 'tel', title: __('Tel'), operate: 'LIKE'},
//{field: 'dispatch.worker_name', title: __('Dispatch.worker_name'), operate: 'LIKE'},
//{field: 'dispatch.worker_tel', title: __('Dispatch.worker_tel'), operate: 'LIKE'},
{field: 'dispatchadmin.nickname', title: __('Dispatch.admin_user'), operate: false},
{field: 'dispatch_admin_id', title: __('派单员'), searchList:$.getJSON("orders/configorder/getadminuser"),operate: 'IN',visible:false},
{field: 'status', title: __('Status'), searchList: {"40":__('Status 40'),"41":__('Status 41')}, formatter: Table.api.formatter.status},
{field: 'audit_remark', title: __('审核备注'), operate:false},
// {field: 'address', title: __('Address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'source_shop', title: __('Source_shop'), operate: '='},
// {field: 'source', title: __('Source')},
// {field: 'source_uid', title: __('Source_uid'), operate: 'LIKE'},
{field: 'item_title', title: __('Item_title'), operate: false},
{field: 'total', title: __('Total'), operate:false},
{field: 'online_amount', title: __('Online_amount'), operate:false},
{field: 'online_amount_last', title: __('Online_amount_last'), operate:false},
{field: 'offline_amount', title: __('Offline_amount'), operate:false},
{field: 'offline_amount_type_text', title: __('Offline_amount_type'), operate:false},
{field: 'refund_amount', title: __('Refund_amount'), operate:false},
{field: 'real_amount', title: __('Real_amount'), operate:false},
{field: 'cost', title: __('Cost'), operate:false},
{field: 'material_cost', title: __('材料成本'), operate:false},
{field: 'performance', title: __('Performance'), operate:false},
// {field: 'dispatch_type', title: __('Dispatch_type')},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'update_time', title: __('Update_time'), operate:false, addclass:'datetimerange', autocomplete:false},
// {field: 'dispatch.finish_time', title: __('Dispatch.finish_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
formatter: Table.api.formatter.operate,
buttons: [
{
name: 'edit',
text:"配置",
title:"配置订单",
icon: 'fa fa-pencil',
//title: __('Edit'),
extend: 'data-toggle="tooltip" data-container="body"',
classname: 'btn btn-xs btn-success btn-editone',
/*visible:function(row){
if(row.status == 50){
return true;
}
return false;
}*/
}
],
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});