allocatr/public/assets/js/backend/orders/auditorder.js
2025-06-22 18:25:14 +08:00

160 lines
8.5 KiB
JavaScript
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'orders/auditorder/index' + location.search,
add_url: 'orders/auditorder/add',
edit_url: 'orders/auditorder/edit',
// del_url: 'orders/auditorder/del',
//multi_url: 'orders/auditorder/multi',
import_url: 'orders/auditorder/import',
table: 'order',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
queryParams: function (params) {
var filter = params.filter ? JSON.parse(params.filter) : {};
var op = params.op ? JSON.parse(params.op) : {};
// 如果没有 status 参数,则默认使用 50
if (!('status' in filter)) {
filter.status = '50';
op.status = '=';
}
params.filter = JSON.stringify(filter);
params.op = JSON.stringify(op);
return params;
},
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
// {checkbox: true},
{field: 'id', title: __('Id'),operate: false},
{
field: 'status',
title: __('Status'),
searchList: {"50":__('Status 50'),"60":__('Status 60')},
formatter: Table.api.formatter.label,
custom: {
'50': 'warning', // 待跟进:灰蓝色(默认 Bootstrap info
'60': 'success', // 已跟进:绿色
}
},
{field: 'order_no', title: __('Order_no'), operate: '='},
{field: 'customer', title: __('Customer'), operate: false},
{field: 'tel', title: __('Tel'), operate: '='},
//{field: 'area_id', title: __('Area_id')},
//{field: 'address', title: __('Address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
// {field: 'lng', title: __('Lng'), operate:'BETWEEN'},
// {field: 'lat', title: __('Lat'), operate:'BETWEEN'},
//{field: 'work_tel_id', title: __('Work_tel_id')},
{field: 'source_shop', title: __('Source_shop'), operate: '='},
{field: 'source', title: __('Source'), operate: 'like'},
// {field: 'source_uid', title: __('Source_uid'), operate: '='},
// {field: 'item_id', title: __('Item_id')},
{field: 'item_title', title: __('Item_title'), operate: false},
{field: 'detail', title: __('Detail'), operate: false, table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'remark', title: __('Remark'), operate: false, table: table, class: 'autocontent', formatter: Table.api.formatter.content},
// {field: 'plan_time', title: __('Plan_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'admin_id', title: __('Admin_id'), 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: 'amount_images', title: __('收款凭据'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
{field: 'total', title: __('Total'), operate:'BETWEEN'},
{field: 'discount_amount', title: __('Discount_amount'), operate:false},
{field: 'real_amount', title: __('Real_amount'), operate:false},
{field: 'refund_amount', title: __('Refund_amount'), operate:false},
{field: 'cost', title: __('Cost'), operate:false},
{field: 'material_cost', title: __('材料成本'), operate:false},
{field: 'performance', title: __('Performance'), operate:false},
{field: 'workerman.images', title: __('师傅收款码'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
{field: 'trans_images', title: __('转账凭证'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
// {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_admin_id', title: __('Audit_admin_id')},
{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: 'auditadmin.username', title: __('Admin.username'), operate: 'LIKE'},
{field: 'auditadmin.nickname', title: __('Admin.nickname'), operate: '='},
{field: 'audit_remark', title: __('Audit_remark'), operate: false, table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{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();
// 图片点击预览逻辑
$(function () {
var $overlay = $('#image-preview-overlay');
var $previewImg = $('#image-preview-img');
// 委托点击预览
$('body').on('click', 'img[data-preview="true"]', function () {
var src = $(this).attr('src');
$previewImg.attr('src', src);
$overlay.fadeIn(100).css('display', 'flex');
});
// 点击遮罩关闭
$overlay.on('click', function () {
$previewImg.attr('src', '');
$overlay.fadeOut(100);
});
});
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});