182 lines
10 KiB
JavaScript
182 lines
10 KiB
JavaScript
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'orders/revisitorder/index' + location.search,
|
|
// add_url: 'orders/revisitorder/add',
|
|
//edit_url: 'orders/revisitorder/edit',
|
|
// del_url: 'orders/revisitorder/del',
|
|
multi_url: 'orders/revisitorder/multi',
|
|
import_url: 'orders/revisitorder/import',
|
|
table: 'order',
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
$("#select_city").on("cp:updated", function () {
|
|
var citypicker = $(this).data("citypicker");
|
|
var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province");
|
|
$("#select_area_id").val(code);
|
|
});
|
|
// 初始化表格
|
|
table.bootstrapTable({
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
pk: 'id',
|
|
sortName: 'revisit_id',
|
|
sortOrder:'asc',
|
|
fixedColumns: true,
|
|
fixedRightNumber: 1,
|
|
commonSearch:true,
|
|
search:false,
|
|
columns: [
|
|
[
|
|
// {checkbox: true},
|
|
{field: 'id', title: __('Id')},
|
|
{field: 'order_no', title: __('Order_no'), operate: '='},
|
|
{field: 'dispatch_admin_user', title: '派单员', operate: '='},
|
|
|
|
{field: 'review.create_time', title: __('回访状态'), operate:false, formatter: function (val, row) {
|
|
|
|
if(row.revisit_id > 0){
|
|
return '<span class="label label-success">已回访</span>';
|
|
}else{
|
|
return '<span class="label label-default">未回访</span>';
|
|
}
|
|
},
|
|
},
|
|
|
|
{field: 'revisit_id', title: __('回访状态'),searchList: {"-1":__('未回访'),"1":__('已回访')},visible:false},
|
|
|
|
{field: 'status', title: __('Status'), searchList: {"60":__('Status 60'),"-10":__('Status -10')}, formatter: Table.api.formatter.status},
|
|
{field: 'is_refund', title: __('是否退款'),operate:false,formatter: function (val) {
|
|
if(val >0){
|
|
return '是';
|
|
}else{
|
|
return '否';
|
|
}
|
|
//return val >0 ? '是' : '否';
|
|
}},
|
|
|
|
{field: 'is_refund', title: __('是否退款'),searchList: {"-1":__('否'),"1":__('是')},visible:false},
|
|
|
|
{field: 'revisit_truth', title: __('是否属实'),formatter(value){
|
|
if(value == -1){
|
|
return '<span class="label label-default">不属实</span>';
|
|
}else if(value == 1){
|
|
return '<span class="label label-success">属实</span>';
|
|
}
|
|
return '-';
|
|
}},
|
|
|
|
// {field: 'area_id', title: __('Area_id'), operate: 'LIKE'},
|
|
{field: 'address', title: __('Address'), operate: false, table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
|
|
// {field: 'source_shop', title: __('Source_shop'), operate: 'LIKE'},
|
|
// {field: 'source', title: __('Source')},
|
|
|
|
{field: 'item_title', title: __('Item_title'), operate: false},
|
|
{field: 'detail', title: __('Detail'), operate: false, table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'customer', title: __('Customer'), operate: false},
|
|
{field: 'tel', title: __('Tel'), operate: '='},
|
|
// {field: 'remark', title: __('Remark'), 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},
|
|
// {field: 'plan_time', title: __('Plan_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
|
// {field: 'admin_id', title: __('Admin_id')},
|
|
// {field: 'coupon_id', title: __('Coupon_id')},
|
|
// {field: 'total', title: __('Total'), operate:'BETWEEN'},
|
|
// {field: 'online_amount', title: __('Online_amount'), operate:'BETWEEN'},
|
|
// {field: 'offline_amount', title: __('Offline_amount'), operate:'BETWEEN'},
|
|
// {field: 'online_amount_last', title: __('Online_amount_last'), operate:'BETWEEN'},
|
|
// {field: 'offline_amount_type', title: __('Offline_amount_type'), searchList: {"1":__('Offline_amount_type 1'),"2":__('Offline_amount_type 2')}, formatter: Table.api.formatter.normal},
|
|
// {field: 'discount_amount', title: __('Discount_amount'), operate:'BETWEEN'},
|
|
// {field: 'refund_amount', title: __('Refund_amount'), operate:'BETWEEN'},
|
|
// {field: 'real_amount', title: __('Real_amount'), operate:'BETWEEN'},
|
|
// {field: 'cost', title: __('Cost'), operate:'BETWEEN'},
|
|
// {field: 'performance', title: __('Performance'), operate:'BETWEEN'},
|
|
// {field: 'cancel_reason_id', title: __('Cancel_reason_id')},
|
|
// {field: 'cancel_detail', title: __('Cancel_detail'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
// {field: 'audit_remark', title: __('Audit_remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
// {field: 'audit_admin_id', title: __('Audit_admin_id')},
|
|
|
|
{field: 'review.pt_star', title: __('Review.pt_star'),operate: false},
|
|
{field: 'review.worker_star', title: __('Review.worker_star'),operate: false},
|
|
{field: 'review.remark', title: __('回访备注'), operate: false, table: table, class: 'autocontent', formatter: function (value){
|
|
|
|
if(value == null || value == undefined){
|
|
return '-';
|
|
}
|
|
return value;
|
|
}},
|
|
{field: 'review.admin_user', title: __('Review.admin_user'), operate: false},
|
|
|
|
{field: 'revisit_time', title: __('回访时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
|
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
|
// {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
|
// {field: 'delete_time', title: __('Delete_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
|
// {field: 'dispatch_type', title: __('Dispatch_type')},
|
|
// {field: 'receive_type', title: __('Receive_type')},
|
|
// {field: 'revisit_id', title: __('Revisit_id')},
|
|
// {field: 'dispatch_admin_id', title: __('Dispatch_admin_id')},
|
|
// {field: 'dispatch_admin_user', title: __('Dispatch_admin_user'), operate: 'LIKE'},
|
|
// {field: 'review.id', title: __('Review.id')},
|
|
//{field: 'review.order_id', title: __('Review.order_id')},
|
|
// {field: 'review.worker_id', title: __('Review.worker_id')},
|
|
|
|
//{field: 'review.admin_id', title: __('Review.admin_id')},
|
|
|
|
{field: 'area', title: __('地区'), searchList: function (column) {
|
|
return Template('categorytpl', {});
|
|
}, formatter: function (value, row, index) {
|
|
return '无';
|
|
}, visible: false
|
|
},
|
|
|
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
|
|
formatter: Table.api.formatter.operate,
|
|
buttons:[
|
|
{
|
|
name: 'addreview',
|
|
text:"回访",
|
|
title:"填写回访信息",
|
|
icon: 'fa fa-pencil',
|
|
url: 'orders/review/edit',
|
|
extend: 'data-toggle="tooltip" data-container="body"',
|
|
classname: 'btn btn-xs btn-info btn-dialog',
|
|
visible:function(row){
|
|
if(row.revisit_id > 0){
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
},
|
|
]
|
|
|
|
}
|
|
]
|
|
]
|
|
});
|
|
|
|
// 为表格绑定事件
|
|
Table.api.bindevent(table);
|
|
},
|
|
add: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
edit: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
addreview: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
api: {
|
|
bindevent: function () {
|
|
Form.api.bindevent($("form[role=form]"));
|
|
}
|
|
}
|
|
};
|
|
return Controller;
|
|
});
|