主理人后台:发票管理

This commit is contained in:
qinzexin 2025-06-17 18:35:17 +08:00
parent 015ce9ca58
commit 9814f3b0ed
35 changed files with 21900 additions and 33 deletions

View File

@ -28,6 +28,10 @@ class Order extends Backend
$this->view->assign("serverStatusList", $this->model->getServerStatusList());
$this->view->assign("authStatusList", $this->model->getAuthStatusList());
$this->view->assign("suspendStatusList", $this->model->getSuspendStatusList());
$this->view->assign("invoiceStatusList", $this->model->getInvoiceStatusList());
$this->view->assign("invoiceStatusListJson", json_encode($this->model->getInvoiceStatusList(), JSON_UNESCAPED_UNICODE));
}
@ -305,6 +309,7 @@ class Order extends Backend
if(isset($param['ids']))$ids = $param['ids'];
$order = \app\common\model\school\activity\order\Order::getHaveOrder($ids);
\app\common\model\school\activity\order\Order::orderRefund($order,$order['sub_refundprice'],'admin',$this->auth->id,true,true);

View File

@ -17,11 +17,14 @@ class Apply extends Backend
* @var \app\admin\model\user\invoice\Apply
*/
protected $model = null;
protected $qSwitch = true;
protected $qFields = ["user_id"];
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\user\invoice\Apply;
parent::_initialize();
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("applyTypeList", $this->model->getApplyTypeList());
$this->view->assign("headTypeList", $this->model->getHeadTypeList());

View File

@ -17,11 +17,14 @@ class Header extends Backend
* @var \app\admin\model\user\invoice\Header
*/
protected $model = null;
protected $qSwitch = true;
protected $qFields = ["user_id"];
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\user\invoice\Header;
parent::_initialize();
$this->view->assign("headTypeList", $this->model->getHeadTypeList());
$this->view->assign("invoiceTypeList", $this->model->getInvoiceTypeList());
$this->view->assign("isDefaultList", $this->model->getIsDefaultList());

View File

@ -3,6 +3,7 @@
namespace app\admin\model\school\activity\order;
use app\admin\model\school\activity\Activity;
use app\admin\model\user\invoice\Apply;
use think\Model;
use traits\model\SoftDelete;
@ -38,11 +39,28 @@ class Order extends Model
'finishtime_text',
'refundtime_text',
'auth_status_text',
'refundsendtime_text'
'refundsendtime_text',
'invoice_status_text',
];
public function getInvoiceStatusList()
{
return ['0' => __('未申请'), '1' => __('申请中'), '2' => __('已开票')];
}
public function getInvoiceStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['invoice_status']) ? $data['invoice_status'] : '');
$list = $this->getInvoiceStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getPayTypeList()
{
return ['yue' => __('Pay_type yue'), 'wechat' => __('Pay_type wechat')];
@ -225,4 +243,10 @@ class Order extends Model
{
return $this->belongsTo(OrderDetail::class, 'activity_order_detail_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function invoiceapply(){
return $this->belongsTo(Apply::class, 'user_invoice_apply_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

View File

@ -4,7 +4,12 @@
{:build_heading(null,FALSE)}
<ul class="nav nav-tabs nav4-custom-condition">
<li class="active"><a href="#t-all" data-value="" data-toggle="tab">{:__('不筛选开票')}</a></li>
{foreach name="invoiceStatusList" item="vo"}
<li class="{:$Think.get.invoice_status === (string)$key ? 'active' : ''}"><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
{/foreach}
</ul>
<ul class="nav nav-tabs nav-custom-condition">
@ -74,3 +79,6 @@
</div>
</div>
</div>
<script>
var invoiceStatusListJson = {$invoiceStatusListJson};
</script>

View File

@ -3,7 +3,13 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="mobile" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="{$q_user_id}">
<!-- <span style="color: red">-->
<!-- (没找到用户则点击按钮创建用户后重新下拉框选用户)-->
<!-- <a data-url="user/user/changeuser" href="javascript:;" class="btn btn-success btn-changeuser {:$auth->check('user/user/changeuser')?'':'hide'}" title="根据手机号生成用户" ><i class="fa fa-plus"></i> 根据手机号生成用户</a>-->
<!-- </span>-->
</div>
</div>
<div class="form-group">
@ -69,7 +75,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Tax_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-tax_id" data-rule="required" data-source="tax/index" class="form-control selectpage" name="row[tax_id]" type="text" value="">
<input id="c-tax_id" data-rule="required" class="form-control" name="row[tax_id]" type="text" value="">
</div>
</div>
<div class="form-group">

View File

@ -3,8 +3,17 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="mobile" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
<!-- <span style="color: red">-->
<!-- (没找到用户则点击按钮创建用户后重新下拉框选用户)-->
<!-- <a data-url="user/user/changeuser" href="javascript:;" class="btn btn-success btn-changeuser {:$auth->check('user/user/changeuser')?'':'hide'}" title="根据手机号生成用户" ><i class="fa fa-plus"></i> 根据手机号生成用户</a>-->
<!-- </span>-->
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
@ -69,7 +78,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Tax_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-tax_id" data-rule="required" data-source="tax/index" class="form-control selectpage" name="row[tax_id]" type="text" value="{$row.tax_id|htmlentities}">
<input id="c-tax_id" data-rule="required" class="form-control" name="row[tax_id]" type="text" value="{$row.tax_id|htmlentities}">
</div>
</div>
<div class="form-group">

View File

@ -17,25 +17,25 @@
<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('user/invoice/apply/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<!-- <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('user/invoice/apply/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('user/invoice/apply/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('user/invoice/apply/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<!-- <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('user/invoice/apply/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
<div class="dropdown btn-group {:$auth->check('user/invoice/apply/multi')?'':'hide'}">
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
<ul class="dropdown-menu text-left" role="menu">
{foreach name="statusList" item="vo"}
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:" data-params="status={$key}">{:__('Set status to ' . $key)}</a></li>
{/foreach}
</ul>
</div>
<!-- <div class="dropdown btn-group {:$auth->check('user/invoice/apply/multi')?'':'hide'}">-->
<!-- <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
<!-- <ul class="dropdown-menu text-left" role="menu">-->
<!-- {foreach name="statusList" item="vo"}-->
<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:" data-params="status={$key}">{:__('Set status to ' . $key)}</a></li>-->
<!-- {/foreach}-->
<!-- </ul>-->
<!-- </div>-->
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('user/invoice/apply/edit')}"
data-operate-del="{:$auth->check('user/invoice/apply/del')}"
data-operate-del="0"
width="100%">
</table>
</div>

View File

@ -3,7 +3,13 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="mobile" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="{$q_user_id}">
<!-- <span style="color: red">-->
<!-- (没找到用户则点击按钮创建用户后重新下拉框选用户)-->
<!-- <a data-url="user/user/changeuser" href="javascript:;" class="btn btn-success btn-changeuser {:$auth->check('user/user/changeuser')?'':'hide'}" title="根据手机号生成用户" ><i class="fa fa-plus"></i> 根据手机号生成用户</a>-->
<!-- </span>-->
</div>
</div>
<div class="form-group">
@ -39,7 +45,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Tax_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-tax_id" data-rule="required" data-source="tax/index" class="form-control selectpage" name="row[tax_id]" type="text" value="">
<input id="c-tax_id" data-rule="required" class="form-control" name="row[tax_id]" type="text" value="">
</div>
</div>
<div class="form-group">

View File

@ -3,8 +3,17 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="mobile" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
<!-- <span style="color: red">-->
<!-- (没找到用户则点击按钮创建用户后重新下拉框选用户)-->
<!-- <a data-url="user/user/changeuser" href="javascript:;" class="btn btn-success btn-changeuser {:$auth->check('user/user/changeuser')?'':'hide'}" title="根据手机号生成用户" ><i class="fa fa-plus"></i> 根据手机号生成用户</a>-->
<!-- </span>-->
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Head_type')}:</label>
@ -39,7 +48,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Tax_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-tax_id" data-rule="required" data-source="tax/index" class="form-control selectpage" name="row[tax_id]" type="text" value="{$row.tax_id|htmlentities}">
<input id="c-tax_id" data-rule="required" class="form-control" name="row[tax_id]" type="text" value="{$row.tax_id|htmlentities}">
</div>
</div>
<div class="form-group">

View File

@ -10,6 +10,7 @@ use app\common\model\school\activity\Activity;
use app\common\model\school\activity\Cate;
use app\common\model\school\activity\Refund;
use app\common\model\User;
use app\common\model\user\invoice\Apply;
use bw\Common;
use fast\Random;
use think\Cache;
@ -52,8 +53,25 @@ class Order extends BaseModel
'auth_status_text',
'refundsendtime_text',
'cancel_last_seconds',
'invoice_status_text',
];
public function getInvoiceStatusList()
{
return ['0' => __('未申请'), '1' => __('申请中'), '2' => __('已开票')];
}
public function getInvoiceStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['invoice_status']) ? $data['invoice_status'] : '');
$list = $this->getInvoiceStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getCancelLastSecondsAttr($value, $data)
{
@ -259,6 +277,9 @@ class Order extends BaseModel
return $this->hasMany(OrderCode::class,'activity_order_id');
}
public function invoiceapply(){
return $this->belongsTo(Apply::class, 'user_invoice_apply_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
@ -639,13 +660,33 @@ class Order extends BaseModel
throw new \Exception("当前活动您下单的人数已超{$x}人!无法下单!");
}
}
$people_num = count($param["people"]?? []) ;
$peoples = $param["people"] ?? [];
$people_num = count($peoples) ;
//人数与参与数量需对上
if($people_num != $num){
throw new \Exception("报名人信息需要跟报名人数一致!");
}
//$param["people"] = [{name:"小明",idnum:"410303199501220515"}]
$people_idnums = [];
foreach ($peoples as $people){
$people_idnums[] = $people["idnum"];
}
//当前活动已经报名的身份证无法重复报名
$as = (new OrderCode)->getWithAlisaName();
$orderCode = OrderCode::with("activityorder")
->where("{$as}.activity_id",$activity_id)
->where("activityorder.status","in",[ "0","2","3",'4',"7","9"])
->where("{$as}.idnum","in",$people_idnums)
->find();
if($orderCode){
throw new \Exception("{$orderCode['name']}已经报过名了!请勿重复报名!");
}
}
@ -1833,6 +1874,11 @@ class Order extends BaseModel
public static function orderRefund($order,$refund_money,$oper_type='user',$oper_id=0,$trans=false,$admin=false){
if(is_numeric($order))$order = self::getHaveRefundOrder($order);
if(!$order)throw new \Exception("找不到订单");
//若订单的结算记录为已结算,则不能退
$settleLog = SettleLog::where(['activity_order_id'=>$order['id'],'status'=>3])->find();
if($settleLog)throw new \Exception("订单已结算完毕,不能再发起退款!");
//判断逻辑
if($trans){
self::beginTrans();
@ -1852,7 +1898,8 @@ class Order extends BaseModel
if(!$order->total_refundprice)$order->total_refundprice = $refund_money;
$order->save();
//将退款金额存入缓存
cache("activity_order_refund_money_{$order['refund_no']}",$refund_money);
//事务逻辑
switch ($order['pay_type']) {
case "wechat": //微信退款
@ -1928,10 +1975,15 @@ class Order extends BaseModel
$notify_url = request()->domain() . '/api/school.newactivity.pay/notifyr/payment/' . $classesorder->pay_type . '/platform/' . $classesorder->platform;
$config['notify_url'] = $notify_url;
$pay = Pay::wechat($config);
// throw new \Exception($trans."111测试错误".$order["status"]);
$result = $pay->refund($order_data);
\think\Log::write('refund-result' . json_encode($result));
@ -2015,6 +2067,14 @@ class Order extends BaseModel
//得到机构售后提交确认订单
$order = self::getHaveOrder($refund_sn);
//钱退完则直接返回
if($order->sub_refundprice <= 0){
return true;
}
//尝试从缓存中取出退款金额
$price = $price ?: cache("activity_order_refund_money_{$refund_sn}");
//判断逻辑
if($trans){
self::beginTrans();
@ -2027,7 +2087,7 @@ class Order extends BaseModel
$order = self::updateRefundOrder($refund_sn,$price,$refund_json);
//插入订单日志
OrderLog::log($order['id'],"活动订单退款已原路退回", 'admin', 0);
OrderLog::log($order['id'],"活动订单退款已原路退回{$price}", 'admin', 0);
//执行课时数更新
$res1 = self::statisticsAndUpdateClassesNumber($order['id']);
@ -2036,6 +2096,8 @@ class Order extends BaseModel
$data = ['order' => self::where("id",$order['id'])->find(),"user_id"=>$order['user_id'],"oper_type"=>'admin',"oper_id"=>0];
\think\Hook::listen('activity_order_refund_success_after', $data);
//清除缓存
cache("activity_order_refund_money_{$refund_sn}",null);
if($trans){
@ -2603,6 +2665,28 @@ class Order extends BaseModel
}
/**得到能够申请发票的订单
* @param $order_no
* @param $check
* @return array|bool|\PDOStatement|string|Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function getHaveInvoiceApplyOrder($order_no,$check=true){
// $where = [self::STATUS_NOPAY,self::STATUS_PAYED];
$order = self::where('pay_no|order_no|id',$order_no)->where('status',"in",["9"])->where("sub_refundprice",">",0)->find();
if(!$order)throw new \Exception("只有全部核销完成的订单才能申请发票!");
$detail = $order->detail;
if(!$detail)throw new \Exception("找不到订单详情!");
if($check){
}
return $order;
}

View File

@ -0,0 +1,203 @@
<?php
namespace app\common\model\user\invoice;
use app\common\model\BaseModel;
use app\common\model\school\activity\order\Order;
use think\Model;
class Apply extends BaseModel
{
// 表名
protected $name = 'user_invoice_apply';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = false;
// 追加属性
protected $append = [
'status_text',
'apply_type_text',
'head_type_text',
'invoice_type_text',
'invoicingtime_text'
];
public function getStatusList()
{
return ['1' => __('Status 1'), '2' => __('Status 2')];
}
public function getApplyTypeList()
{
return ['1' => __('Apply_type 1'), '2' => __('Apply_type 2')];
}
public function getHeadTypeList()
{
return ['personal' => __('Head_type personal'), 'corporate' => __('Head_type corporate')];
}
public function getInvoiceTypeList()
{
return ['ordinary' => __('Invoice_type ordinary'), 'special' => __('Invoice_type special')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getApplyTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['apply_type']) ? $data['apply_type'] : '');
$list = $this->getApplyTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getHeadTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['head_type']) ? $data['head_type'] : '');
$list = $this->getHeadTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getInvoiceTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['invoice_type']) ? $data['invoice_type'] : '');
$list = $this->getInvoiceTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getInvoicingtimeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['invoicingtime']) ? $data['invoicingtime'] : '');
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
protected function setInvoicingtimeAttr($value)
{
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
public function user()
{
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
/** 申请发票
* @param $order_no 申请发票的订单号
* @param
* @param $trans
* @return true
* @throws \Exception
*/
public function add($order_no,$params,$check=true,$trans=false){
if (empty($params)) {
throw new \Exception(__('Parameter %s can not be empty', ''));
}
$order = Order::getHaveInvoiceApplyOrder($order_no);
$rule = [
'user_id'=>'require',
'head_type'=>'require',
'invoice_type'=>'require',
'invoice_header' => 'require',
'invoice_reservation_phone' => 'require',
'invoice_reservation_email' => 'require',
];
$rule_msg = [
"user_id.require"=>'提交用户必填',
"head_type.require"=>'抬头类型必填',
"invoice_type.require"=>'发票类型必填',
'invoice_header.require' => '发票抬头必填',
'invoice_reservation_phone.require' => '发票预留电话必填',
'invoice_reservation_email.require' => '发票预留邮箱必填',
];
self::check($params,$rule,$rule_msg);
//个人无法开专用发票
if($params['head_type']=='personal' && $params['invoice_type']=='special'){
throw new \Exception('个人用户无法开专用发票');
}
//企业需要填写纳税人识别号等信息
if($params['head_type']=='corporate'){
$rule = [
'tax_id'=>'require',
'bank_deposit'=>'require',
'bank_number'=>'require',
'enterprise_address'=>'require',
'enterprise_phone'=>'require',
];
$rule_msg = [
'tax_id.require' => '纳税人识别号必填',
'bank_deposit.require' => '开户银行必填',
'bank_number.require' => '银行账号必填',
'enterprise_address.require' => '企业地址必填',
'enterprise_phone.require' => '企业电话必填',
];
self::check($params,$rule,$rule_msg);
}
//判断逻辑
if($trans){
self::beginTrans();
}
$res = true;
try{
//是否采用模型验证
// if ($this->modelValidate) {
// $name = str_replace("\\model\\", "\\validate\\", get_class($this));
// $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
// $this->validateFailException()->validate($validate);
// }
$result = $this->allowField(true)->save($params);
if($trans){
self::commitTrans();
}
}catch (\Exception $e){
if($trans){
self::rollbackTrans();
}
throw new \Exception($e->getMessage().$e->getFile().$e->getLine());
}
return $this;
}
}

View File

@ -0,0 +1,82 @@
<?php
namespace app\common\model\user\invoice;
use app\common\model\BaseModel;
use think\Model;
class Header extends BaseModel
{
// 表名
protected $name = 'user_invoice_header';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = false;
// 追加属性
protected $append = [
'head_type_text',
'invoice_type_text',
'is_default_text'
];
public function getHeadTypeList()
{
return ['personal' => __('Head_type personal'), 'corporate' => __('Head_type corporate')];
}
public function getInvoiceTypeList()
{
return ['ordinary' => __('Invoice_type ordinary'), 'special' => __('Invoice_type special')];
}
public function getIsDefaultList()
{
return ['0' => __('Is_default 0'), '1' => __('Is_default 1')];
}
public function getHeadTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['head_type']) ? $data['head_type'] : '');
$list = $this->getHeadTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getInvoiceTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['invoice_type']) ? $data['invoice_type'] : '');
$list = $this->getInvoiceTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getIsDefaultTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['is_default']) ? $data['is_default'] : '');
$list = $this->getIsDefaultList();
return isset($list[$value]) ? $list[$value] : '';
}
public function user()
{
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

View File

@ -28,6 +28,11 @@ class Order extends ManystoreBase
$this->view->assign("serverStatusList", $this->model->getServerStatusList());
$this->view->assign("suspendStatusList", $this->model->getSuspendStatusList());
$this->view->assign("authStatusList", $this->model->getAuthStatusList());
$this->view->assign("invoiceStatusList", $this->model->getInvoiceStatusList());
$this->view->assign("invoiceStatusListJson", json_encode($this->model->getInvoiceStatusList(), JSON_UNESCAPED_UNICODE));
}
public function import()

View File

@ -0,0 +1,87 @@
<?php
namespace app\manystore\controller\user\invoice;
use app\common\controller\ManystoreBase;
use app\manystore\model\school\activity\order\Order;
/**
* 个人发票申请管理
*
* @icon fa fa-circle-o
*/
class Apply extends ManystoreBase
{
/**
* Apply模型对象
* @var \app\manystore\model\user\invoice\Apply
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\user\invoice\Apply;
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("applyTypeList", $this->model->getApplyTypeList());
$this->view->assign("headTypeList", $this->model->getHeadTypeList());
$this->view->assign("invoiceTypeList", $this->model->getInvoiceTypeList());
}
public function import()
{
parent::import();
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*/
public function index()
{
//当前是否为关联查询
$this->relationSearch = true;
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if ($this->request->isAjax()) {
//如果发送的来源是Selectpage则转发到Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$as = (new Order)->getWithAlisaName();
$user_ids = Order::with(['schoolactivityorderdetail'])
->where("schoolactivityorderdetail.user_id", SHOP_USER_ID)
->column("{$as}.user_id");
if(!$user_ids){
$user_ids = [-1];
}
$as = $this->model->getWithAlisaName();
$list = $this->model
->with(['user'])
->where("{$as}.user_id","in",$user_ids)
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('user')->visible(['nickname','mobile','avatar']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
}

View File

@ -0,0 +1,230 @@
<?php
namespace app\manystore\controller\user\invoice;
use app\common\controller\ManystoreBase;
use think\Db;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 个人发票抬头管理
*
* @icon fa fa-circle-o
*/
class Header extends ManystoreBase
{
/**
* Header模型对象
* @var \app\manystore\model\user\invoice\Header
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\user\invoice\Header;
$this->view->assign("headTypeList", $this->model->getHeadTypeList());
$this->view->assign("invoiceTypeList", $this->model->getInvoiceTypeList());
$this->view->assign("isDefaultList", $this->model->getIsDefaultList());
}
public function import()
{
parent::import();
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*/
public function index()
{
//当前是否为关联查询
$this->relationSearch = true;
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if ($this->request->isAjax()) {
//如果发送的来源是Selectpage则转发到Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$as = $this->model->getWithAlisaName();
$list = $this->model
->with(['user'])
->where("{$as}.user_id",SHOP_USER_ID)
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('user')->visible(['nickname','mobile','avatar']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
/**
* 添加
*/
public function add()
{
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
if($this->storeIdFieldAutoFill && STORE_ID ){
$params['store_id'] = STORE_ID;
}
if($this->shopIdAutoCondition && SHOP_ID){
$params['shop_id'] = SHOP_ID;
}
$params['user_id'] = SHOP_USER_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(true)->validate($validate);
}
$result = $this->model->allowField(true)->save($params);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were inserted'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
return $this->view->fetch();
}
/**
* 编辑
*/
public function edit($ids = null)
{
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$this->model->where(array('user_id'=>SHOP_USER_ID));
$row = $this->model->where(array('id'=>$ids))->find();
if (!$row) {
$this->error(__('No Results were found'));
}
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
$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 . '.edit' : $name) : $this->modelValidate;
$row->validateFailException(true)->validate($validate);
}
$params['user_id'] = SHOP_USER_ID;
$result = $row->allowField(true)->save($params);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were updated'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 删除
*/
public function del($ids = "")
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
$pk = $this->model->getPk();
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$this->model->where(array('user_id'=>SHOP_USER_ID));
$list = $this->model->where($pk, 'in', $ids)->select();
$count = 0;
Db::startTrans();
try {
foreach ($list as $k => $v) {
$count += $v->delete();
}
Db::commit();
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
} else {
$this->error(__('No rows were deleted'));
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
}

View File

@ -0,0 +1,32 @@
<?php
return [
'User_id' => '用户id',
'Status' => '申请状态',
'Status 1' => '申请中',
'Status 2' => '已开票',
'Apply_type' => '申请类型',
'Apply_type 1' => '单开',
'Apply_type 2' => '连开',
'Price' => '申请金额',
'Head_type' => '抬头类型',
'Head_type personal' => '个人或事业单位',
'Head_type corporate' => '企业',
'Invoice_type' => '发票类型',
'Invoice_type ordinary' => '普通发票',
'Invoice_type special' => '专用发票',
'Invoice_header' => '发票抬头',
'Tax_id' => '税号',
'Bank_deposit' => '开户银行',
'Bank_number' => '银行账号',
'Enterprise_address' => '企业地址',
'Enterprise_phone' => '企业电话',
'Invoice_reservation_phone' => '发票预留电话',
'Invoice_reservation_email' => '发票预留邮箱',
'Invoicingtime' => '开票时间',
'Createtime' => '创建时间',
'Updatetime' => '修改时间',
'User.nickname' => '昵称',
'User.mobile' => '手机号',
'User.avatar' => '头像'
];

View File

@ -0,0 +1,27 @@
<?php
return [
'User_id' => '用户id',
'Head_type' => '抬头类型',
'Head_type personal' => '个人或事业单位',
'Head_type corporate' => '企业',
'Invoice_type' => '发票类型',
'Invoice_type ordinary' => '普通发票',
'Invoice_type special' => '专用发票',
'Invoice_header' => '发票抬头',
'Tax_id' => '税号',
'Bank_deposit' => '开户银行',
'Bank_number' => '银行账号',
'Enterprise_address' => '企业地址',
'Enterprise_phone' => '企业电话',
'Invoice_reservation_phone' => '发票预留电话',
'Invoice_reservation_email' => '发票预留邮箱',
'Is_default' => '是否默认',
'Is_default 0' => '否',
'Is_default 1' => '是',
'Createtime' => '创建时间',
'Updatetime' => '修改时间',
'User.nickname' => '昵称',
'User.mobile' => '手机号',
'User.avatar' => '头像'
];

View File

@ -4,6 +4,7 @@ namespace app\manystore\model\school\activity\order;
use app\common\model\BaseModel;
use app\manystore\model\school\activity\Activity;
use app\manystore\model\user\invoice\Apply;
use think\Model;
use traits\model\SoftDelete;
@ -41,11 +42,27 @@ class Order extends BaseModel
'auth_status_text',
'refundsendtime_text',
'settle_log_time_text',
'last_time_text'
'last_time_text',
'invoice_status_text',
];
public function getInvoiceStatusList()
{
return ['0' => __('未申请'), '1' => __('申请中'), '2' => __('已开票')];
}
public function getInvoiceStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['invoice_status']) ? $data['invoice_status'] : '');
$list = $this->getInvoiceStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getPayTypeList()
{
return ['yue' => __('Pay_type yue'), 'wechat' => __('Pay_type wechat')];
@ -249,4 +266,12 @@ class Order extends BaseModel
{
return $this->belongsTo('app\manystore\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function invoiceapply(){
return $this->belongsTo(Apply::class, 'user_invoice_apply_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

View File

@ -0,0 +1,107 @@
<?php
namespace app\manystore\model\user\invoice;
use app\common\model\BaseModel;
use think\Model;
class Apply extends BaseModel
{
// 表名
protected $name = 'user_invoice_apply';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = false;
// 追加属性
protected $append = [
'status_text',
'apply_type_text',
'head_type_text',
'invoice_type_text',
'invoicingtime_text'
];
public function getStatusList()
{
return ['1' => __('Status 1'), '2' => __('Status 2')];
}
public function getApplyTypeList()
{
return ['1' => __('Apply_type 1'), '2' => __('Apply_type 2')];
}
public function getHeadTypeList()
{
return ['personal' => __('Head_type personal'), 'corporate' => __('Head_type corporate')];
}
public function getInvoiceTypeList()
{
return ['ordinary' => __('Invoice_type ordinary'), 'special' => __('Invoice_type special')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getApplyTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['apply_type']) ? $data['apply_type'] : '');
$list = $this->getApplyTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getHeadTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['head_type']) ? $data['head_type'] : '');
$list = $this->getHeadTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getInvoiceTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['invoice_type']) ? $data['invoice_type'] : '');
$list = $this->getInvoiceTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getInvoicingtimeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['invoicingtime']) ? $data['invoicingtime'] : '');
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
protected function setInvoicingtimeAttr($value)
{
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
public function user()
{
return $this->belongsTo('app\manystore\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

View File

@ -0,0 +1,82 @@
<?php
namespace app\manystore\model\user\invoice;
use app\common\model\BaseModel;
use think\Model;
class Header extends BaseModel
{
// 表名
protected $name = 'user_invoice_header';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = false;
// 追加属性
protected $append = [
'head_type_text',
'invoice_type_text',
'is_default_text'
];
public function getHeadTypeList()
{
return ['personal' => __('Head_type personal'), 'corporate' => __('Head_type corporate')];
}
public function getInvoiceTypeList()
{
return ['ordinary' => __('Invoice_type ordinary'), 'special' => __('Invoice_type special')];
}
public function getIsDefaultList()
{
return ['0' => __('Is_default 0'), '1' => __('Is_default 1')];
}
public function getHeadTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['head_type']) ? $data['head_type'] : '');
$list = $this->getHeadTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getInvoiceTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['invoice_type']) ? $data['invoice_type'] : '');
$list = $this->getInvoiceTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getIsDefaultTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['is_default']) ? $data['is_default'] : '');
$list = $this->getIsDefaultList();
return isset($list[$value]) ? $list[$value] : '';
}
public function user()
{
return $this->belongsTo('app\manystore\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace app\manystore\validate\user\invoice;
use think\Validate;
class Apply extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}

View File

@ -0,0 +1,27 @@
<?php
namespace app\manystore\validate\user\invoice;
use think\Validate;
class Header extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}

View File

@ -4,7 +4,12 @@
{:build_heading(null,FALSE)}
<ul class="nav nav-tabs nav4-custom-condition">
<li class="active"><a href="#t-all" data-value="" data-toggle="tab">{:__('不筛选开票')}</a></li>
{foreach name="invoiceStatusList" item="vo"}
<li class="{:$Think.get.invoice_status === (string)$key ? 'active' : ''}"><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
{/foreach}
</ul>
@ -73,3 +78,6 @@
</div>
</div>
</div>
<script>
var invoiceStatusListJson = {$invoiceStatusListJson};
</script>

View File

@ -0,0 +1,124 @@
<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">{:__('User_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">-->
<!-- </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">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Apply_type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-apply_type" data-rule="required" class="form-control selectpicker" name="row[apply_type]">
{foreach name="applyTypeList" item="vo"}
<option value="{$key}" {in name="key" value="1"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-price" data-rule="required" class="form-control" step="0.01" name="row[price]" type="number" value="0.00">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Head_type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-head_type" data-rule="required" class="form-control selectpicker" name="row[head_type]">
{foreach name="headTypeList" item="vo"}
<option value="{$key}" {in name="key" value="personal"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</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">
<select id="c-invoice_type" data-rule="required" class="form-control selectpicker" name="row[invoice_type]">
{foreach name="invoiceTypeList" item="vo"}
<option value="{$key}" {in name="key" value="ordinary"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Invoice_header')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-invoice_header" data-rule="required" class="form-control" name="row[invoice_header]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Tax_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-tax_id" data-rule="required" class="form-control" name="row[tax_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Bank_deposit')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-bank_deposit" class="form-control" name="row[bank_deposit]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Bank_number')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-bank_number" class="form-control" name="row[bank_number]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Enterprise_address')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-enterprise_address" class="form-control" name="row[enterprise_address]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Enterprise_phone')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-enterprise_phone" class="form-control" name="row[enterprise_phone]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Invoice_reservation_phone')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-invoice_reservation_phone" data-rule="required" class="form-control" name="row[invoice_reservation_phone]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Invoice_reservation_email')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-invoice_reservation_email" data-rule="required" class="form-control" name="row[invoice_reservation_email]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Invoicingtime')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-invoicingtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[invoicingtime]" type="text" value="{:date('Y-m-d H:i:s')}">
</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-success btn-embossed disabled">{:__('OK')}</button>-->
<!-- <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>-->
<!-- </div>-->
<!-- </div>-->
</form>

View File

@ -0,0 +1,124 @@
<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">{:__('User_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">-->
<!-- </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">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Apply_type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-apply_type" data-rule="required" class="form-control selectpicker" name="row[apply_type]">
{foreach name="applyTypeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.apply_type"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-price" data-rule="required" class="form-control" step="0.01" name="row[price]" type="number" value="{$row.price|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Head_type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-head_type" data-rule="required" class="form-control selectpicker" name="row[head_type]">
{foreach name="headTypeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.head_type"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</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">
<select id="c-invoice_type" data-rule="required" class="form-control selectpicker" name="row[invoice_type]">
{foreach name="invoiceTypeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.invoice_type"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Invoice_header')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-invoice_header" data-rule="required" class="form-control" name="row[invoice_header]" type="text" value="{$row.invoice_header|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Tax_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-tax_id" data-rule="required" class="form-control" name="row[tax_id]" type="text" value="{$row.tax_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Bank_deposit')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-bank_deposit" class="form-control" name="row[bank_deposit]" type="text" value="{$row.bank_deposit|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Bank_number')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-bank_number" class="form-control" name="row[bank_number]" type="text" value="{$row.bank_number|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Enterprise_address')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-enterprise_address" class="form-control" name="row[enterprise_address]" type="text" value="{$row.enterprise_address|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Enterprise_phone')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-enterprise_phone" class="form-control" name="row[enterprise_phone]" type="text" value="{$row.enterprise_phone|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Invoice_reservation_phone')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-invoice_reservation_phone" data-rule="required" class="form-control" name="row[invoice_reservation_phone]" type="text" value="{$row.invoice_reservation_phone|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Invoice_reservation_email')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-invoice_reservation_email" data-rule="required" class="form-control" name="row[invoice_reservation_email]" type="text" value="{$row.invoice_reservation_email|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Invoicingtime')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-invoicingtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[invoicingtime]" type="text" value="{:$row.invoicingtime?datetime($row.invoicingtime):''}">
</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-success btn-embossed disabled">{:__('OK')}</button>-->
<!-- <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>-->
<!-- </div>-->
<!-- </div>-->
</form>

View File

@ -0,0 +1,44 @@
<div class="panel panel-default panel-intro">
<div class="panel-heading">
{:build_heading(null,FALSE)}
<ul class="nav nav-tabs" data-field="status">
<li class="{:$Think.get.status === null ? 'active' : ''}"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
{foreach name="statusList" item="vo"}
<li class="{:$Think.get.status === (string)$key ? 'active' : ''}"><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
{/foreach}
</ul>
</div>
<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('user/invoice/apply/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('user/invoice/apply/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('user/invoice/apply/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
<!-- <div class="dropdown btn-group {:$auth->check('user/invoice/apply/multi')?'':'hide'}">-->
<!-- <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
<!-- <ul class="dropdown-menu text-left" role="menu">-->
<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>-->
<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>-->
<!-- </ul>-->
<!-- </div>-->
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="0"
data-operate-del="0"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,100 @@
<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">{:__('User_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Head_type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-head_type" data-rule="required" class="form-control selectpicker" name="row[head_type]">
{foreach name="headTypeList" item="vo"}
<option value="{$key}" {in name="key" value="personal"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</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">
<select id="c-invoice_type" data-rule="required" class="form-control selectpicker" name="row[invoice_type]">
{foreach name="invoiceTypeList" item="vo"}
<option value="{$key}" {in name="key" value="ordinary"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Invoice_header')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-invoice_header" data-rule="required" class="form-control" name="row[invoice_header]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Tax_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-tax_id" data-rule="required" class="form-control" name="row[tax_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Bank_deposit')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-bank_deposit" class="form-control" name="row[bank_deposit]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Bank_number')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-bank_number" class="form-control" name="row[bank_number]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Enterprise_address')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-enterprise_address" class="form-control" name="row[enterprise_address]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Enterprise_phone')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-enterprise_phone" class="form-control" name="row[enterprise_phone]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Invoice_reservation_phone')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-invoice_reservation_phone" data-rule="required" class="form-control" name="row[invoice_reservation_phone]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Invoice_reservation_email')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-invoice_reservation_email" data-rule="required" class="form-control" name="row[invoice_reservation_email]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Is_default')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-is_default" data-rule="required" class="form-control selectpicker" name="row[is_default]">
{foreach name="isDefaultList" item="vo"}
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</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-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>

View File

@ -0,0 +1,100 @@
<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">{:__('User_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Head_type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-head_type" data-rule="required" class="form-control selectpicker" name="row[head_type]">
{foreach name="headTypeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.head_type"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</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">
<select id="c-invoice_type" data-rule="required" class="form-control selectpicker" name="row[invoice_type]">
{foreach name="invoiceTypeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.invoice_type"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Invoice_header')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-invoice_header" data-rule="required" class="form-control" name="row[invoice_header]" type="text" value="{$row.invoice_header|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Tax_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-tax_id" data-rule="required" class="form-control" name="row[tax_id]" type="text" value="{$row.tax_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Bank_deposit')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-bank_deposit" class="form-control" name="row[bank_deposit]" type="text" value="{$row.bank_deposit|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Bank_number')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-bank_number" class="form-control" name="row[bank_number]" type="text" value="{$row.bank_number|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Enterprise_address')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-enterprise_address" class="form-control" name="row[enterprise_address]" type="text" value="{$row.enterprise_address|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Enterprise_phone')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-enterprise_phone" class="form-control" name="row[enterprise_phone]" type="text" value="{$row.enterprise_phone|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Invoice_reservation_phone')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-invoice_reservation_phone" data-rule="required" class="form-control" name="row[invoice_reservation_phone]" type="text" value="{$row.invoice_reservation_phone|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Invoice_reservation_email')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-invoice_reservation_email" data-rule="required" class="form-control" name="row[invoice_reservation_email]" type="text" value="{$row.invoice_reservation_email|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Is_default')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-is_default" data-rule="required" class="form-control selectpicker" name="row[is_default]">
{foreach name="isDefaultList" item="vo"}
<option value="{$key}" {in name="key" value="$row.is_default"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</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-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>

View File

@ -0,0 +1,34 @@
<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('user/invoice/header/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('user/invoice/header/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('user/invoice/header/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<div class="dropdown btn-group {:$auth->check('user/invoice/header/multi')?'':'hide'}">
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
<ul class="dropdown-menu text-left" role="menu">
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
</ul>
</div>
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('user/invoice/header/edit')}"
data-operate-del="{:$auth->check('user/invoice/header/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -72,6 +72,10 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
{field: 'suspend_status', title: __('Suspend_status'), searchList: {"0":__('Suspend_status 0'),"1":__('Suspend_status 1'),"2":__('Suspend_status 2')}, formatter: Table.api.formatter.status},
{field: 'invoice_status', title: __('发票申请状态'), searchList: invoiceStatusListJson, formatter: Table.api.formatter.status},
{field: 'canceltime',visible:false, title: __('Canceltime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'paytime',visible:false, title: __('Paytime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'auth_time',visible:false, title: __('Auth_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
@ -363,6 +367,46 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
Table.api.bindevent(table);
//自定义Tab筛选条件
$('.panel-heading .nav4-custom-condition a[data-toggle="tab"]', table.closest(".panel-intro")).on('shown.bs.tab', function (e) {
var value = $(this).data("value");
var options = table.bootstrapTable('getOptions');
var queryParams = options.queryParams;
options.pageNumber = 1;
options.queryParams = function (params) {
//这一行必须要存在,否则在点击下一页时会丢失搜索栏数据
params = queryParams(params);
//如果希望追加搜索条件,可使用
var filter = params.filter ? JSON.parse(params.filter) : {};
var op = params.op ? JSON.parse(params.op) : {};
if (value!=="") {
//这里可以自定义多个筛选条件
filter.invoice_status = value;
op.invoice_status = '=';
}else{
//console.log("111111111111111111");
//选全部时要移除相应的条件
delete filter.invoice_status;
delete op.invoice_status;
}
params.filter = JSON.stringify(filter);
params.op = JSON.stringify(op);
//如果希望忽略搜索栏搜索条件,可使用
//params.filter = JSON.stringify(value?{admin_id: value}:{});
//params.op = JSON.stringify(value?{admin_id: '='}:{});
return params;
};
table.trigger("uncheckbox");
table.bootstrapTable('refresh', {pageNumber: 1});
return false;
});
//自定义Tab筛选条件
$('.panel-heading .nav-custom-condition a[data-toggle="tab"]', table.closest(".panel-intro")).on('shown.bs.tab', function (e) {

View File

@ -72,6 +72,9 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
{field: 'suspend_status', title: __('Suspend_status'), searchList: {"0":__('Suspend_status 0'),"1":__('Suspend_status 1'),"2":__('Suspend_status 2')}, formatter: Table.api.formatter.status},
{field: 'invoice_status', title: __('发票申请状态'), searchList: invoiceStatusListJson, formatter: Table.api.formatter.status},
{field: 'canceltime',visible:false, title: __('Canceltime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'paytime',visible:false, title: __('Paytime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'auth_time',visible:false, title: __('Auth_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
@ -275,6 +278,22 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
}
},
{
name: 'invoice_apply',
text: __('查看发票申请'),
title: __('查看发票申请'),
icon: 'fa fa-calendar',
classname: 'btn btn-xs btn-warning btn-magic btn-dialog',
// dropdown : '更多',
url: invoice_apply_url,
callback: function (data) {
},
visible: function (row) {
return row.user_invoice_apply_id;
}
},
{
name: 'order_log',
@ -339,6 +358,49 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
//自定义Tab筛选条件
$('.panel-heading .nav4-custom-condition a[data-toggle="tab"]', table.closest(".panel-intro")).on('shown.bs.tab', function (e) {
var value = $(this).data("value");
var options = table.bootstrapTable('getOptions');
var queryParams = options.queryParams;
options.pageNumber = 1;
options.queryParams = function (params) {
//这一行必须要存在,否则在点击下一页时会丢失搜索栏数据
params = queryParams(params);
//如果希望追加搜索条件,可使用
var filter = params.filter ? JSON.parse(params.filter) : {};
var op = params.op ? JSON.parse(params.op) : {};
if (value!=="") {
//这里可以自定义多个筛选条件
filter.invoice_status = value;
op.invoice_status = '=';
}else{
//console.log("111111111111111111");
//选全部时要移除相应的条件
delete filter.invoice_status;
delete op.invoice_status;
}
params.filter = JSON.stringify(filter);
params.op = JSON.stringify(op);
//如果希望忽略搜索栏搜索条件,可使用
//params.filter = JSON.stringify(value?{admin_id: value}:{});
//params.op = JSON.stringify(value?{admin_id: '='}:{});
return params;
};
table.trigger("uncheckbox");
table.bootstrapTable('refresh', {pageNumber: 1});
return false;
});
//自定义Tab筛选条件
$('.panel-heading .nav-custom-condition a[data-toggle="tab"]', table.closest(".panel-intro")).on('shown.bs.tab', function (e) {
var value = $(this).data("value");
@ -699,6 +761,10 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
return 'school/activity/order/settle_log/index?activity_order_id='+row.id;
}
var invoice_apply_url = function (row,dom) {
return 'user/invoice/apply/edit/ids/'+row.user_invoice_apply_id;
}

View 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: 'user/invoice/apply/index' + location.search,
add_url: 'user/invoice/apply/add',
edit_url: 'user/invoice/apply/edit',
del_url: 'user/invoice/apply/del',
multi_url: 'user/invoice/apply/multi',
import_url: 'user/invoice/apply/import',
table: 'user_invoice_apply',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'user_id', title: __('User_id')},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
{field: 'apply_type', title: __('Apply_type'), searchList: {"1":__('Apply_type 1'),"2":__('Apply_type 2')}, formatter: Table.api.formatter.normal},
{field: 'price', title: __('Price'), operate:'BETWEEN'},
{field: 'head_type', title: __('Head_type'), searchList: {"personal":__('Head_type personal'),"corporate":__('Head_type corporate')}, formatter: Table.api.formatter.normal},
{field: 'invoice_type', title: __('Invoice_type'), searchList: {"ordinary":__('Invoice_type ordinary'),"special":__('Invoice_type special')}, formatter: Table.api.formatter.normal},
{field: 'invoice_header', title: __('Invoice_header'), operate: 'LIKE'},
{field: 'tax_id', title: __('Tax_id'), operate: 'LIKE'},
{field: 'bank_deposit', title: __('Bank_deposit'), operate: 'LIKE'},
{field: 'bank_number', title: __('Bank_number'), operate: 'LIKE'},
{field: 'enterprise_address', title: __('Enterprise_address'), operate: 'LIKE'},
{field: 'enterprise_phone', title: __('Enterprise_phone'), operate: 'LIKE'},
{field: 'invoice_reservation_phone', title: __('Invoice_reservation_phone'), operate: 'LIKE'},
{field: 'invoice_reservation_email', title: __('Invoice_reservation_email'), operate: 'LIKE'},
{field: 'invoicingtime', title: __('Invoicingtime')},
{field: 'createtime', title: __('Createtime')},
{field: 'updatetime', title: __('Updatetime')},
{field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
{field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
{field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
{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;
});

View File

@ -0,0 +1,67 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'user/invoice/header/index' + location.search,
add_url: 'user/invoice/header/add',
edit_url: 'user/invoice/header/edit',
del_url: 'user/invoice/header/del',
multi_url: 'user/invoice/header/multi',
import_url: 'user/invoice/header/import',
table: 'user_invoice_header',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'user_id', title: __('User_id')},
{field: 'head_type', title: __('Head_type'), searchList: {"personal":__('Head_type personal'),"corporate":__('Head_type corporate')}, formatter: Table.api.formatter.normal},
{field: 'invoice_type', title: __('Invoice_type'), searchList: {"ordinary":__('Invoice_type ordinary'),"special":__('Invoice_type special')}, formatter: Table.api.formatter.normal},
{field: 'invoice_header', title: __('Invoice_header'), operate: 'LIKE'},
{field: 'tax_id', title: __('Tax_id'), operate: 'LIKE'},
{field: 'bank_deposit', title: __('Bank_deposit'), operate: 'LIKE'},
{field: 'bank_number', title: __('Bank_number'), operate: 'LIKE'},
{field: 'enterprise_address', title: __('Enterprise_address'), operate: 'LIKE'},
{field: 'enterprise_phone', title: __('Enterprise_phone'), operate: 'LIKE'},
{field: 'invoice_reservation_phone', title: __('Invoice_reservation_phone'), operate: 'LIKE'},
{field: 'invoice_reservation_email', title: __('Invoice_reservation_email'), operate: 'LIKE'},
{field: 'is_default', title: __('Is_default'), searchList: {"0":__('Is_default 0'),"1":__('Is_default 1')}, formatter: Table.api.formatter.normal},
{field: 'createtime', title: __('Createtime')},
{field: 'updatetime', title: __('Updatetime')},
{field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
{field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
{field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
{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;
});