开票
This commit is contained in:
parent
9489f84992
commit
a916c55786
1
addons/.htaccess
Executable file
1
addons/.htaccess
Executable file
|
|
@ -0,0 +1 @@
|
|||
deny from all
|
||||
|
|
@ -11,6 +11,7 @@ use app\common\controller\Backend;
|
|||
use app\common\Logic\OrderLogic;
|
||||
use fast\Tree;
|
||||
use think\Db;
|
||||
use think\exception\DbException;
|
||||
use think\exception\PDOException;
|
||||
use think\exception\ValidateException;
|
||||
use think\Hook;
|
||||
|
|
@ -572,4 +573,46 @@ class Order extends Backend
|
|||
// 重新索引数组
|
||||
return array_values($filtered_codes);
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param $ids
|
||||
* @return string
|
||||
* @throws DbException
|
||||
* @throws \think\Exception
|
||||
*/
|
||||
public function invoice($ids = null){
|
||||
if (false === $this->request->isPost()) {
|
||||
$order = model('order')->get($ids);
|
||||
return $this->fetch('order/invoice/add',['row' => $order]);
|
||||
}
|
||||
$params = $this->request->post('row/a');
|
||||
if (empty($params)) {
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
$params = $this->preExcludeFields($params);
|
||||
|
||||
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
|
||||
$params[$this->dataLimitField] = $this->auth->id;
|
||||
}
|
||||
$result = false;
|
||||
Db::startTrans();
|
||||
try {
|
||||
//是否采用模型验证
|
||||
if ($this->modelValidate) {
|
||||
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
|
||||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
|
||||
$this->model->validateFailException()->validate($validate);
|
||||
}
|
||||
$result = $this->model->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error(__('No rows were inserted'));
|
||||
}
|
||||
$this->success();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
74
application/admin/controller/order/Invoice.php
Normal file
74
application/admin/controller/order/Invoice.php
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\controller\order;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
use think\exception\PDOException;
|
||||
use think\exception\ValidateException;
|
||||
|
||||
/**
|
||||
* 发票信息管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Invoice extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Invoice模型对象
|
||||
* @var \app\admin\model\order\Invoice
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\order\Invoice;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
public function add()
|
||||
{
|
||||
if (false === $this->request->isPost()) {
|
||||
return $this->view->fetch();
|
||||
}
|
||||
$params = $this->request->post('row/a');
|
||||
if (empty($params)) {
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
$params = $this->preExcludeFields($params);
|
||||
|
||||
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
|
||||
$params[$this->dataLimitField] = $this->auth->id;
|
||||
}
|
||||
$result = false;
|
||||
Db::startTrans();
|
||||
try {
|
||||
//是否采用模型验证
|
||||
if ($this->modelValidate) {
|
||||
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
|
||||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
|
||||
$this->model->validateFailException()->validate($validate);
|
||||
}
|
||||
$result = $this->model->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error(__('No rows were inserted'));
|
||||
}
|
||||
$this->success();
|
||||
}
|
||||
|
||||
}
|
||||
22
application/admin/lang/zh-cn/order/invoice.php
Normal file
22
application/admin/lang/zh-cn/order/invoice.php
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'Id' => '发票ID',
|
||||
'Order_id' => '订单ID',
|
||||
'Invoice_type' => '发票类型',
|
||||
'Title' => '发票抬头',
|
||||
'Tax_number' => '纳税人识别号',
|
||||
'Amount' => '发票金额',
|
||||
'Invoice_method' => '发票方式',
|
||||
'Recipient_email' => '接收邮箱(电子)',
|
||||
'Company_address' => '公司注册地址',
|
||||
'Company_phone' => '公司注册电话',
|
||||
'Bank_name' => '开户行名称',
|
||||
'Bank_account' => '银行账号',
|
||||
'Recipient_address' => '收件地址(纸质)',
|
||||
'Recipient_name' => '收件人姓名',
|
||||
'Recipient_phone' => '收件人电话',
|
||||
'Issued_at' => '开票时间',
|
||||
'Status' => '开票状态',
|
||||
'Remark' => '备注'
|
||||
];
|
||||
40
application/admin/model/order/Invoice.php
Normal file
40
application/admin/model/order/Invoice.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\model\order;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Invoice extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'order_invoice';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
27
application/admin/validate/order/Invoice.php
Normal file
27
application/admin/validate/order/Invoice.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\validate\order;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Invoice extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
101
application/admin/view/order/invoice/add.html
Normal file
101
application/admin/view/order/invoice/add.html
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">订单编号:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-order_id" data-rule="required" disabled data-source="order/index" class="form-control" type="text" value="{$row.order_no}">
|
||||
</div>
|
||||
</div>
|
||||
<input class="form-control" style="display: none" type="text" value="{$row.id}">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">发票类型:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<select id="c-source" data-live-search="true" title="请选择" data-rule="required" name="row[invoice_type]" class="form-control">
|
||||
<option value="1">公司发票</option>
|
||||
<option value="2">个人发票</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">抬头/名字:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">纳税人识别号:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-tax_number" class="form-control" name="row[tax_number]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">金额:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-amount" data-rule="required" class="form-control" step="0.01" name="row[amount]" type="number">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">公司地址:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-company_address" class="form-control" name="row[company_address]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">公司电话:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-company_phone" class="form-control" name="row[company_phone]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">开户行:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-bank_name" class="form-control" name="row[bank_name]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">开户账号:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-bank_account" class="form-control" name="row[bank_account]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">接收邮箱:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-recipient_email" class="form-control" name="row[recipient_email]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">接收地址:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-recipient_address" class="form-control" name="row[recipient_address]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">接收名字:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-recipient_name" class="form-control" name="row[recipient_name]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">接收电话:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-recipient_phone" class="form-control" name="row[recipient_phone]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">备注:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<textarea id="c-remark" class="form-control " rows="5" name="row[remark]" cols="50"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
123
application/admin/view/order/invoice/edit.html
Normal file
123
application/admin/view/order/invoice/edit.html
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Order_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-order_id" data-rule="required" data-source="order/index" class="form-control selectpage" name="row[order_id]" type="text" value="{$row.order_id|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Invoice_type')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-invoice_type" data-rule="required" class="form-control" name="row[invoice_type]" type="number" value="{$row.invoice_type|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="{$row.title|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Tax_number')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-tax_number" class="form-control" name="row[tax_number]" type="text" value="{$row.tax_number|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Amount')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-amount" data-rule="required" class="form-control" step="0.01" name="row[amount]" type="number" value="{$row.amount|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Invoice_method')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-invoice_method" data-rule="required" class="form-control" name="row[invoice_method]" type="number" value="{$row.invoice_method|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Recipient_email')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-recipient_email" class="form-control" name="row[recipient_email]" type="text" value="{$row.recipient_email|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Company_address')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-company_address" class="form-control" name="row[company_address]" type="text" value="{$row.company_address|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Company_phone')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-company_phone" class="form-control" name="row[company_phone]" type="text" value="{$row.company_phone|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Bank_name')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-bank_name" class="form-control" name="row[bank_name]" type="text" value="{$row.bank_name|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Bank_account')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-bank_account" class="form-control" name="row[bank_account]" type="text" value="{$row.bank_account|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Recipient_address')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-recipient_address" class="form-control" name="row[recipient_address]" type="text" value="{$row.recipient_address|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Recipient_name')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-recipient_name" class="form-control" name="row[recipient_name]" type="text" value="{$row.recipient_name|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Recipient_phone')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-recipient_phone" class="form-control" name="row[recipient_phone]" type="text" value="{$row.recipient_phone|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Issued_at')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-issued_at" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[issued_at]" type="text" value="{$row.issued_at}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-status" class="form-control" name="row[status]" type="number" value="{$row.status|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<textarea id="c-remark" class="form-control " rows="5" name="row[remark]" cols="50">{$row.remark|htmlentities}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Created_at')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-created_at" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[created_at]" type="text" value="{$row.created_at}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Updated_at')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-updated_at" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[updated_at]" type="text" value="{$row.updated_at}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
29
application/admin/view/order/invoice/index.html
Normal file
29
application/admin/view/order/invoice/index.html
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<div class="panel panel-default panel-intro">
|
||||
{:build_heading()}
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="tab-pane fade active in" id="one">
|
||||
<div class="widget-body no-padding">
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('order.invoice/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('order.invoice/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('order.invoice/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="{:$auth->check('order.invoice/edit')}"
|
||||
data-operate-del="{:$auth->check('order.invoice/del')}"
|
||||
width="100%">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -267,6 +267,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
|||
return false;
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'invoice',
|
||||
text: '申请开票',
|
||||
title: '申请开票',
|
||||
classname: 'btn btn-xs button-cancel btn-dialog',
|
||||
icon: 'fa fa-send',
|
||||
url: 'order/invoice/',
|
||||
dropdown: "更多",
|
||||
|
||||
visible: function (row) {
|
||||
if (row.status >= 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
|
|
|
|||
70
public/assets/js/backend/order/invoice.js
Normal file
70
public/assets/js/backend/order/invoice.js
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'order.invoice/index' + location.search,
|
||||
add_url: 'order.invoice/add',
|
||||
edit_url: 'order.invoice/edit',
|
||||
del_url: 'order.invoice/del',
|
||||
multi_url: 'order.invoice/multi',
|
||||
import_url: 'order.invoice/import',
|
||||
table: 'order_invoice',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
fixedColumns: true,
|
||||
fixedRightNumber: 1,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'order_id', title: __('Order_id')},
|
||||
{field: 'invoice_type', title: __('Invoice_type')},
|
||||
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'tax_number', title: __('Tax_number'), operate: 'LIKE'},
|
||||
{field: 'amount', title: __('Amount'), operate:'BETWEEN'},
|
||||
{field: 'invoice_method', title: __('Invoice_method')},
|
||||
{field: 'recipient_email', title: __('Recipient_email'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'company_address', title: __('Company_address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'company_phone', title: __('Company_phone'), operate: 'LIKE'},
|
||||
{field: 'bank_name', title: __('Bank_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'bank_account', title: __('Bank_account'), operate: 'LIKE'},
|
||||
{field: 'recipient_address', title: __('Recipient_address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'recipient_name', title: __('Recipient_name'), operate: 'LIKE'},
|
||||
{field: 'recipient_phone', title: __('Recipient_phone'), operate: 'LIKE'},
|
||||
{field: 'issued_at', title: __('Issued_at'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
{field: 'status', title: __('Status')},
|
||||
{field: 'created_at', title: __('Created_at'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
{field: 'updated_at', title: __('Updated_at'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
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;
|
||||
});
|
||||
BIN
vendor.zip
Normal file
BIN
vendor.zip
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user