- 新增师傅资质审核模块及权限 - 未审核通过的师傅默认禁用接单状态 - 新增售后退款申诉功能与相关界面 - 新增用户钱包管理及充值功能 - 更新服务定价矩阵相关数据库结构 - 修复微信支付证书验证问题
120 行
6.7 KiB
JavaScript
120 行
6.7 KiB
JavaScript
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'invoice/index' + location.search,
|
|
detail_url: 'invoice/detail',
|
|
edit_url: 'invoice/edit',
|
|
table: 'invoice',
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
|
|
table.bootstrapTable({
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
pk: 'id',
|
|
sortName: 'id',
|
|
sortOrder: 'desc',
|
|
fixedColumns: false,
|
|
fixedRightNumber: 0,
|
|
columns: [
|
|
[
|
|
{field: 'index', title: '序号', operate: false, formatter: Table.api.formatter.index, width: '55px'},
|
|
{field: 'invoice_sn', title: '申请单号', operate: 'LIKE'},
|
|
{
|
|
field: 'title',
|
|
title: '发票抬头 / 税号',
|
|
operate: 'LIKE',
|
|
align: 'left',
|
|
formatter: function (v, row) {
|
|
var html = '<div><strong>' + Fast.api.escape(v || '-') + '</strong></div>';
|
|
if (row.tax_no) {
|
|
html += '<div class="text-muted" style="font-size:11.5px;font-family:monospace;">' + Fast.api.escape(row.tax_no) + '</div>';
|
|
}
|
|
return html;
|
|
}
|
|
},
|
|
{field: 'tax_no', title: '税号', operate: 'LIKE', visible: false},
|
|
{field: 'title_type', title: '抬头类型', searchList: {"personal":__('Personal'),"enterprise":__('Enterprise')}, visible: false},
|
|
{field: 'type', title: '发票类型', searchList: {"normal":__('Ordinary'),"special":__('Special')}, formatter: Table.api.formatter.label, custom: {normal: 'info', special: 'warning'}},
|
|
{field: 'amount', title: '开票金额', operate: 'BETWEEN', formatter: function (v, row) {
|
|
var ordTxt = Number(row.order_count) > 0 ? (row.order_count + ' 笔工单') : '按额度';
|
|
return '<strong class="text-danger">¥' + Number(v || 0).toFixed(2) + '</strong><div class="text-muted" style="font-size:11px;">' + ordTxt + '</div>';
|
|
}},
|
|
{
|
|
field: 'merchant.name',
|
|
title: '申请主体 / 邮箱',
|
|
operate: 'LIKE',
|
|
align: 'left',
|
|
formatter: function (value, row) {
|
|
var nick = (row.user && row.user.nickname) ? Fast.api.escape(row.user.nickname) : '';
|
|
var main = value ? ('<strong>' + Fast.api.escape(value) + '</strong>') : (nick || '<span class="text-muted">个人用户</span>');
|
|
var sub = row.email ? Fast.api.escape(row.email) : (nick && value ? nick : '-');
|
|
return '<div>' + main + '</div><div class="text-muted" style="font-size:11.5px;">' + sub + '</div>';
|
|
}
|
|
},
|
|
{field: 'user.nickname', title: '申请用户', operate: 'LIKE', visible: false},
|
|
{field: 'email', title: '接收邮箱', operate: 'LIKE', visible: false},
|
|
{field: 'status', title: '处理状态', searchList: {"wait":__('Wait'),"issued":__('Issued'),"reject":__('Reject'),"cancel":__('Cancel')}, formatter: Table.api.formatter.status, custom: {wait: 'warning', issued: 'success', reject: 'danger', cancel: 'gray'}},
|
|
{field: 'invoice_no', title: '发票号码 / 附件', operate: 'LIKE', formatter: function (v, row) {
|
|
var html = v ? ('<code>' + Fast.api.escape(v) + '</code>') : '<span class="text-muted">-</span>';
|
|
if (row.invoice_file) {
|
|
html += ' <a href="' + Fast.api.cdnurl(row.invoice_file) + '" target="_blank" class="btn btn-xs btn-info"><i class="fa fa-file-pdf-o"></i> 电子票</a>';
|
|
}
|
|
return html;
|
|
}},
|
|
{field: 'audit_msg', title: '处理说明', operate: 'LIKE', visible: false},
|
|
{field: 'createtime', title: '申请时间', operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime, width: '145px'},
|
|
{field: 'operate', title: '操作', table: table, events: Table.api.events.operate,
|
|
buttons: [
|
|
{
|
|
name: 'detail',
|
|
text: '详情',
|
|
title: '开票申请详情',
|
|
classname: 'btn btn-xs btn-info btn-detailone',
|
|
extend: 'data-area=\'["920px","86%"]\''
|
|
},
|
|
{
|
|
name: 'edit',
|
|
text: '开票处理',
|
|
title: '财务开票处理',
|
|
classname: 'btn btn-xs btn-success btn-editone',
|
|
extend: 'data-area=\'["920px","86%"]\'',
|
|
visible: function (row) {
|
|
return row.status === 'wait';
|
|
}
|
|
}
|
|
],
|
|
formatter: Table.api.formatter.operate}
|
|
]
|
|
]
|
|
});
|
|
|
|
Table.api.bindevent(table);
|
|
},
|
|
edit: function () {
|
|
$(document).on('change', 'input[name="row[status]"]', function () {
|
|
var val = $(this).val();
|
|
if (val === 'reject') {
|
|
$('#box-issued-fields').slideUp(150);
|
|
} else {
|
|
$('#box-issued-fields').slideDown(150);
|
|
}
|
|
});
|
|
Controller.api.bindevent();
|
|
},
|
|
detail: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
api: {
|
|
bindevent: function () {
|
|
Form.api.bindevent($("form[role=form]"));
|
|
}
|
|
}
|
|
};
|
|
return Controller;
|
|
});
|