抬头管理增删改查 列表
发票申请 订单详情发票信息 可开发票的订单列表
This commit is contained in:
parent
32e079b44f
commit
3a92a48b3a
@ -191,8 +191,9 @@ class Apply extends Backend
|
||||
$result = false;
|
||||
try{
|
||||
$desc = $params["desc"];
|
||||
$images= $params["images"];
|
||||
$model = (new \app\common\model\user\invoice\Apply());
|
||||
$model->examine($ids,$desc,$this->auth->id,'admin',false,true);
|
||||
$model->examine($ids,$images,$desc,$this->auth->id,'admin',false,true);
|
||||
$row->allowField(true)->save($params);
|
||||
}catch (\Exception $e){
|
||||
$this->error($e->getMessage());
|
||||
|
@ -7,10 +7,13 @@ return [
|
||||
'Set status to 1' => '设为申请中',
|
||||
'Status 2' => '已开票',
|
||||
'Set status to 2' => '设为已开票',
|
||||
'Status -3' => '已作废',
|
||||
'Set status to -3' => '设为已作废',
|
||||
'Apply_type' => '申请类型',
|
||||
'Apply_type 1' => '单开',
|
||||
'Apply_type 2' => '连开',
|
||||
'Price' => '申请实付金额',
|
||||
'Images' => '发票图片展示',
|
||||
'Fee_price' => '平台手续费',
|
||||
'Desc' => '开票备注',
|
||||
'Head_type' => '抬头类型',
|
||||
|
@ -36,7 +36,7 @@ class Apply extends Model
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['1' => __('Status 1'), '2' => __('Status 2')];
|
||||
return ['1' => __('Status 1'), '2' => __('Status 2'), '-3' => __('Status -3')];
|
||||
}
|
||||
|
||||
public function getApplyTypeList()
|
||||
|
@ -143,6 +143,23 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text" value="{$row.images|htmlentities}">
|
||||
<div class="input-group-addon no-border no-padding">
|
||||
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-maxcount="5" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
|
||||
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-maxcount="5" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
|
||||
</div>
|
||||
<span class="msg-box n-right" for="c-images"></span>
|
||||
</div>
|
||||
<ul class="row list-inline faupload-preview" id="p-images"></ul>
|
||||
<!-- <span style="color: red">( 推荐图片比例为 690*580 )</span>-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Desc')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
295
application/api/controller/school/Header.php
Normal file
295
application/api/controller/school/Header.php
Normal file
@ -0,0 +1,295 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller\school;
|
||||
|
||||
use app\common\model\user\invoice\Apply;
|
||||
use app\common\model\user\invoice\Header as HeaderModel;
|
||||
|
||||
/**
|
||||
* 个人发票抬头库管理
|
||||
*/
|
||||
class Header extends Base
|
||||
{
|
||||
protected $noNeedLogin = [];
|
||||
protected $noNeedRight = '*';
|
||||
|
||||
protected $model = null;
|
||||
|
||||
|
||||
/**
|
||||
* 初始化操作
|
||||
* @access protected
|
||||
*/
|
||||
protected function _initialize()
|
||||
{
|
||||
// $this->transactionCheck();
|
||||
|
||||
$this->model = new HeaderModel;
|
||||
parent::_initialize();
|
||||
//敏感词过滤
|
||||
// $this->checkSensitivewords([]);
|
||||
|
||||
// $this->setUrlLock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ApiTitle( 抬头列表接口)
|
||||
* @ApiSummary(抬头列表接口)
|
||||
* @ApiMethod(GET)
|
||||
* @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
|
||||
* @ApiParams(name = "page", type = "string",required=true,description = "页数")
|
||||
* @ApiParams(name = "limit", type = "string",required=true,description = "条数")
|
||||
*
|
||||
* @ApiReturn({
|
||||
*
|
||||
*})
|
||||
*/
|
||||
public function header_list()
|
||||
{
|
||||
$user_id = 0;
|
||||
$user = $this->auth->getUser();//登录用户
|
||||
if($user)$user_id = $user['id'];
|
||||
|
||||
$params = [];
|
||||
$params['user_id'] = $user_id;
|
||||
$page = $this->request->get('page/d', 0); //页数
|
||||
$limit = $this->request->get('limit/d', 0); //条数
|
||||
$params["keywords"] = $this->request->get('keywords/s', ''); //搜索关键字
|
||||
|
||||
|
||||
// $params["time"] = $this->request->get('time/s', ''); //时间
|
||||
|
||||
try{
|
||||
//当前申请状态
|
||||
$res = $this->model::headerList($page, $limit,$params);
|
||||
// if($user_id =='670153'){
|
||||
// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
|
||||
// }
|
||||
}catch (\Exception $e){
|
||||
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success('查询成功', $res);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @ApiTitle( 抬头详情)
|
||||
* @ApiSummary(抬头详情)
|
||||
* @ApiMethod(GET)
|
||||
* @ApiParams(name = "id", type = "int",required=true,description = "抬头id")
|
||||
* @ApiReturn({
|
||||
*
|
||||
*})
|
||||
*/
|
||||
public function detail(){
|
||||
$id = $this->request->get('id/d','');
|
||||
|
||||
if(empty($id)){
|
||||
$this->error(__('缺少必要参数'));
|
||||
}
|
||||
|
||||
try {
|
||||
$res = $this->model->detail($id);
|
||||
} catch (\Exception $e){
|
||||
// Log::log($e->getMessage());
|
||||
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
|
||||
}
|
||||
$this->success('获取成功', ['detail' => $res]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除抬头
|
||||
*
|
||||
* @ApiMethod (POST)
|
||||
* @ApiParams (name="ids", type="string", required=true, description="要删除的ids")
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
// $admin_id = $this->auth->id;
|
||||
$ids = $this->request->post('ids/s');
|
||||
|
||||
try{
|
||||
$menulist = $this->model->del($ids,true);
|
||||
} catch (\Exception $e) {
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
|
||||
$this->success('删除成功', $menulist);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ApiTitle(添加抬头)
|
||||
* @ApiSummary(添加抬头)
|
||||
* @ApiMethod(POST)
|
||||
* @ApiParams(name = "head_type", type = "string",required=true,description = "抬头类型:personal=个人或事业单位,corporate=企业")
|
||||
* @ApiParams(name = "invoice_type", type = "string",required=true,description = "发票类型:ordinary=普通发票,special=专用发票")
|
||||
* @ApiParams(name = "invoice_header", type = "string",required=true,description = "发票抬头")
|
||||
* @ApiParams(name = "tax_id", type = "string",required=true,description = "税号")
|
||||
* @ApiParams(name = "bank_deposit", type = "string",required=true,description = "开户银行")
|
||||
* @ApiParams(name = "bank_number", type = "string",required=true,description = "银行账号")
|
||||
* @ApiParams(name = "enterprise_address", type = "string",required=true,description = "企业地址")
|
||||
* @ApiParams(name = "enterprise_phone", type = "string",required=true,description = "企业电话")
|
||||
* @ApiParams(name = "invoice_reservation_phone", type = "string",required=true,description = "发票预留电话")
|
||||
* @ApiParams(name = "invoice_reservation_email", type = "string",required=true,description = "发票预留邮箱")
|
||||
* @ApiParams(name = "is_default", type = "string",required=true,description = "是否默认:0=否,1=是")
|
||||
* @ApiReturn({
|
||||
*
|
||||
*})
|
||||
*/
|
||||
public function add(){
|
||||
|
||||
//敏感词过滤
|
||||
$this->checkSensitivewords(["invoice_header"]);
|
||||
|
||||
$user_id = 0;
|
||||
$user = $this->auth->getUser();//登录用户
|
||||
if($user)$user_id = $user['id'];
|
||||
$params = [];
|
||||
$params["user_id"] = $user_id; //老师id
|
||||
$params["head_type"] = $this->request->post('head_type/s', ''); //课程标签
|
||||
$params["invoice_type"] = $this->request->post('invoice_type/s', ''); //课程标签
|
||||
$params["invoice_header"] = $this->request->post('invoice_header/s', ''); //课程标签
|
||||
$params["tax_id"] = $this->request->post('tax_id/s', ''); //课程标签
|
||||
$params["bank_deposit"] = $this->request->post('bank_deposit/s', ''); //课程标签
|
||||
$params["bank_number"] = $this->request->post('bank_number/s', ''); //课程标签
|
||||
$params["enterprise_address"] = $this->request->post('enterprise_address/s', ''); //课程标签
|
||||
$params["enterprise_phone"] = $this->request->post('enterprise_phone/s', ''); //课程标签
|
||||
$params["invoice_reservation_phone"] = $this->request->post('invoice_reservation_phone/s', ''); //课程标签
|
||||
$params["invoice_reservation_email"] = $this->request->post('invoice_reservation_email/s', ''); //课程标签
|
||||
$params["is_default"] = $this->request->post('is_default/d', ''); //课程标签
|
||||
|
||||
try{
|
||||
$res = $this->model->add($params,true);
|
||||
}catch (\Throwable $e){
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success('添加成功', $res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ApiTitle(编辑成员)
|
||||
* @ApiSummary(编辑成员)
|
||||
* @ApiMethod(POST)
|
||||
* @ApiRoute (/api/school.header/edit/ids/{ids})
|
||||
* @ApiParams (name="ids", type="string", required=true, description="需要编辑的id")
|
||||
* @ApiParams(name = "head_type", type = "string",required=true,description = "抬头类型:personal=个人或事业单位,corporate=企业")
|
||||
* @ApiParams(name = "invoice_type", type = "string",required=true,description = "发票类型:ordinary=普通发票,special=专用发票")
|
||||
* @ApiParams(name = "invoice_header", type = "string",required=true,description = "发票抬头")
|
||||
* @ApiParams(name = "tax_id", type = "string",required=true,description = "税号")
|
||||
* @ApiParams(name = "bank_deposit", type = "string",required=true,description = "开户银行")
|
||||
* @ApiParams(name = "bank_number", type = "string",required=true,description = "银行账号")
|
||||
* @ApiParams(name = "enterprise_address", type = "string",required=true,description = "企业地址")
|
||||
* @ApiParams(name = "enterprise_phone", type = "string",required=true,description = "企业电话")
|
||||
* @ApiParams(name = "invoice_reservation_phone", type = "string",required=true,description = "发票预留电话")
|
||||
* @ApiParams(name = "invoice_reservation_email", type = "string",required=true,description = "发票预留邮箱")
|
||||
* @ApiParams(name = "is_default", type = "string",required=true,description = "是否默认:0=否,1=是")
|
||||
* @ApiReturn({
|
||||
*
|
||||
*})
|
||||
*/
|
||||
public function edit($ids = null){
|
||||
//敏感词过滤
|
||||
$this->checkSensitivewords(["name","idnum"]);
|
||||
|
||||
$user_id = 0;
|
||||
$user = $this->auth->getUser();//登录用户
|
||||
if($user)$user_id = $user['id'];
|
||||
$params = [];
|
||||
$params["user_id"] = $user_id; //老师id
|
||||
$params["head_type"] = $this->request->post('head_type/s', ''); //课程标签
|
||||
$params["invoice_type"] = $this->request->post('invoice_type/s', ''); //课程标签
|
||||
$params["invoice_header"] = $this->request->post('invoice_header/s', ''); //课程标签
|
||||
$params["tax_id"] = $this->request->post('tax_id/s', ''); //课程标签
|
||||
$params["bank_deposit"] = $this->request->post('bank_deposit/s', ''); //课程标签
|
||||
$params["bank_number"] = $this->request->post('bank_number/s', ''); //课程标签
|
||||
$params["enterprise_address"] = $this->request->post('enterprise_address/s', ''); //课程标签
|
||||
$params["enterprise_phone"] = $this->request->post('enterprise_phone/s', ''); //课程标签
|
||||
$params["invoice_reservation_phone"] = $this->request->post('invoice_reservation_phone/s', ''); //课程标签
|
||||
$params["invoice_reservation_email"] = $this->request->post('invoice_reservation_email/s', ''); //课程标签
|
||||
$params["is_default"] = $this->request->post('is_default/d', ''); //课程标签
|
||||
|
||||
try{
|
||||
$res = $this->model->edit($ids,$params,true);
|
||||
}catch (\Throwable $e){
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success('编辑成功', $res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ApiTitle(订单申请开票(单开|合开))
|
||||
* @ApiSummary(订单申请开票)
|
||||
* @ApiMethod(POST)
|
||||
* @ApiParams(name = "order_nos", type = "string",required=true,description = "需要开票的订单号:多开传多个逗号隔开字符串")
|
||||
* @ApiParams(name = "head_type", type = "string",required=true,description = "抬头类型:personal=个人或事业单位,corporate=企业")
|
||||
* @ApiParams(name = "invoice_type", type = "string",required=true,description = "发票类型:ordinary=普通发票,special=专用发票")
|
||||
* @ApiParams(name = "invoice_header", type = "string",required=true,description = "发票抬头")
|
||||
* @ApiParams(name = "tax_id", type = "string",required=true,description = "税号")
|
||||
* @ApiParams(name = "bank_deposit", type = "string",required=true,description = "开户银行")
|
||||
* @ApiParams(name = "bank_number", type = "string",required=true,description = "银行账号")
|
||||
* @ApiParams(name = "enterprise_address", type = "string",required=true,description = "企业地址")
|
||||
* @ApiParams(name = "enterprise_phone", type = "string",required=true,description = "企业电话")
|
||||
* @ApiParams(name = "invoice_reservation_phone", type = "string",required=true,description = "发票预留电话")
|
||||
* @ApiParams(name = "invoice_reservation_email", type = "string",required=true,description = "发票预留邮箱")
|
||||
* @ApiReturn({
|
||||
*
|
||||
*})
|
||||
*/
|
||||
public function apply(){
|
||||
$this->model = new Apply();
|
||||
//敏感词过滤
|
||||
$this->checkSensitivewords(["invoice_header"]);
|
||||
|
||||
$user_id = 0;
|
||||
$user = $this->auth->getUser();//登录用户
|
||||
if($user)$user_id = $user['id'];
|
||||
$params = [];
|
||||
$params["user_id"] = $user_id; //老师id
|
||||
$order_no = $this->request->post('order_nos/s', ''); //课程标签
|
||||
|
||||
$params["head_type"] = $this->request->post('head_type/s', ''); //课程标签
|
||||
$params["invoice_type"] = $this->request->post('invoice_type/s', ''); //课程标签
|
||||
$params["invoice_header"] = $this->request->post('invoice_header/s', ''); //课程标签
|
||||
$params["tax_id"] = $this->request->post('tax_id/s', ''); //课程标签
|
||||
$params["bank_deposit"] = $this->request->post('bank_deposit/s', ''); //课程标签
|
||||
$params["bank_number"] = $this->request->post('bank_number/s', ''); //课程标签
|
||||
$params["enterprise_address"] = $this->request->post('enterprise_address/s', ''); //课程标签
|
||||
$params["enterprise_phone"] = $this->request->post('enterprise_phone/s', ''); //课程标签
|
||||
$params["invoice_reservation_phone"] = $this->request->post('invoice_reservation_phone/s', ''); //课程标签
|
||||
$params["invoice_reservation_email"] = $this->request->post('invoice_reservation_email/s', ''); //课程标签
|
||||
// $params["is_default"] = $this->request->post('is_default/d', ''); //课程标签
|
||||
|
||||
try{
|
||||
|
||||
$res = $this->model->add($order_no,$params,$user_id,'user',true,true);
|
||||
}catch (\Throwable $e){
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success('添加成功', $res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -79,6 +79,8 @@ class Order extends Base
|
||||
* @ApiParams(name = "status", type = "string",required=false,description = "订单状态:-3=已取消,0=待支付,2=已报名,3=核销中,4=售后中,5=退款结算中,6=已退款,9=已完成")
|
||||
* @ApiParams(name = "server_status", type = "string",required=false,description = "售后订单状态:0=正常,3=售后中,6=售后完成")
|
||||
* @ApiParams(name = "auth_status", type = "string",required=false,description = "售后结果状态:0=待审核,1=同意退款,2=拒绝退款")
|
||||
* @ApiParams(name = "invoice_status", type = "string",required=false,description = "发票申请状态:0=未申请,1=申请中,2=已开票")
|
||||
* @ApiParams(name = "have_invoice", type = "int",required=false,description = "是否查可开票:1是")
|
||||
* @ApiParams(name = "activity_id", type = "int",required=false,description = "活动id")
|
||||
* @ApiReturn({
|
||||
*
|
||||
@ -97,6 +99,10 @@ class Order extends Base
|
||||
$params = [];
|
||||
$params["auth_status"] = $this->request->get('auth_status/s', ''); //搜索关键字
|
||||
|
||||
|
||||
$params["invoice_status"] = $this->request->get('invoice_status/s', ''); //搜索关键字
|
||||
$params["have_invoice"] = $this->request->get('have_invoice/d', 0); //搜索关键字
|
||||
|
||||
$activity_id = $this->request->get('activity_id/s', ''); //搜索关键字
|
||||
|
||||
$has_evaluate = $this->request->get('has_evaluate/d', 0); //搜索关键字
|
||||
|
@ -74,6 +74,8 @@ class Order extends Base
|
||||
* @ApiParams(name = "status", type = "string",required=false,description = "订单状态:-3=已取消,0=待支付,2=已报名,3=核销中,4=售后中,5=退款结算中,6=已退款,9=已完成")
|
||||
* @ApiParams(name = "server_status", type = "string",required=false,description = "售后订单状态:0=正常,3=售后中,6=售后完成")
|
||||
* @ApiParams(name = "auth_status", type = "string",required=false,description = "售后结果状态:0=待审核,1=同意退款,2=拒绝退款")
|
||||
* @ApiParams(name = "invoice_status", type = "string",required=false,description = "发票申请状态:0=未申请,1=申请中,2=已开票")
|
||||
* @ApiParams(name = "have_invoice", type = "int",required=false,description = "是否查可开票:1是")
|
||||
* @ApiParams(name = "activity_id", type = "int",required=false,description = "活动id")
|
||||
* @ApiReturn({
|
||||
*
|
||||
@ -90,6 +92,10 @@ class Order extends Base
|
||||
$status = $this->request->get('status/s', ''); //搜索关键字
|
||||
$params =[];
|
||||
$params["auth_status"] = $this->request->get('auth_status/s', ''); //搜索关键字
|
||||
|
||||
$params["invoice_status"] = $this->request->get('invoice_status/s', ''); //搜索关键字
|
||||
$params["have_invoice"] = $this->request->get('have_invoice/d', 0); //搜索关键字
|
||||
|
||||
$server_status = $this->request->get('server_status/s', ''); //搜索关键字
|
||||
$activity_id = $this->request->get('activity_id/s', ''); //搜索关键字
|
||||
|
||||
|
@ -75,7 +75,7 @@ class Api
|
||||
/** 检测敏感词
|
||||
* @return void
|
||||
*/
|
||||
public function checkSensitivewords($sensitivewords_field = []){
|
||||
protected function checkSensitivewords($sensitivewords_field = []){
|
||||
$sensitivewords = new \bw\sensitivewords\Sensitivewords();
|
||||
try {
|
||||
$get = $this->request->param();
|
||||
|
@ -76,13 +76,6 @@ class Activity extends BaseModel
|
||||
return $imagesArray;
|
||||
}
|
||||
|
||||
public function getImageAttr($value, $data)
|
||||
{
|
||||
if (!empty($value)) return cdnurl($value,true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function setImagesAttr($value, $data)
|
||||
@ -95,6 +88,16 @@ class Activity extends BaseModel
|
||||
return $imagesArray;
|
||||
}
|
||||
|
||||
public function getImageAttr($value, $data)
|
||||
{
|
||||
if (!empty($value)) return cdnurl($value,true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function getDistanceTextAttr($value, $data) {
|
||||
|
@ -329,6 +329,18 @@ class Order extends BaseModel
|
||||
|
||||
|
||||
|
||||
if (isset($whereData['invoice_status']) && $whereData['invoice_status']!=="" && $whereData['invoice_status']!==null) $model = $model->where("{$alisa}invoice_status", 'in', $whereData['invoice_status']);
|
||||
if (isset($whereData['not_invoice_status'])&& $whereData['not_invoice_status']!=="" && $whereData['not_invoice_status']!==null) $model = $model->where("{$alisa}invoice_status", 'not in', $whereData['not_invoice_status']);
|
||||
|
||||
|
||||
if(isset($whereData['have_invoice']) && $whereData["have_invoice"]){
|
||||
//查可开票的单
|
||||
$model = $model->where("{$alisa}status","in",["9"])->where("{$alisa}sub_refundprice",">",0)->where("{$alisa}user_invoice_apply_id",0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (isset($whereData['keywords'])&&$whereData['keywords']){
|
||||
$model = $model->where("{$alisa}order_no|{$alisa}pay_no|user.nickname|user.realname|user.mobile|detail.title|detail.address|detail.address_detail", 'LIKE', "%{$whereData['keywords']}%" );
|
||||
}
|
||||
|
@ -36,10 +36,10 @@ class Apply extends BaseModel
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['1' => __('Status 1'), '2' => __('Status 2')];
|
||||
return ['1' => __('Status 1'), '2' => __('Status 2'), '-3' => __('Status -3')];
|
||||
}
|
||||
|
||||
public function getApplyTypeList()
|
||||
@ -102,6 +102,33 @@ class Apply extends BaseModel
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getImagesAttr($value, $data)
|
||||
{
|
||||
$imagesArray = [];
|
||||
if (!empty($value)) {
|
||||
$imagesArray = explode(',', $value);
|
||||
foreach ($imagesArray as &$v) {
|
||||
$v = cdnurl($v, true);
|
||||
}
|
||||
return $imagesArray;
|
||||
}
|
||||
return $imagesArray;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function setImagesAttr($value, $data)
|
||||
{
|
||||
$imagesArray = $value;
|
||||
if (!empty($value) && is_array($value)) {
|
||||
//转成逗号拼接字符串
|
||||
$imagesArray = implode(',', $value);
|
||||
}
|
||||
return $imagesArray;
|
||||
}
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
@ -129,7 +156,7 @@ class Apply extends BaseModel
|
||||
throw new \Exception(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
|
||||
|
||||
$params['type'] = $params['type'] ?? '1'; //默认新开
|
||||
|
||||
$rule = [
|
||||
// 'user_id'=>'require',
|
||||
@ -160,6 +187,7 @@ class Apply extends BaseModel
|
||||
if($params['head_type']=='corporate'){
|
||||
$rule = [
|
||||
'tax_id'=>'require',
|
||||
'type'=>'require',
|
||||
'bank_deposit'=>'require',
|
||||
'bank_number'=>'require',
|
||||
'enterprise_address'=>'require',
|
||||
@ -167,6 +195,7 @@ class Apply extends BaseModel
|
||||
];
|
||||
$rule_msg = [
|
||||
'tax_id.require' => '纳税人识别号必填',
|
||||
'type.require' => '开票类型必填',
|
||||
'bank_deposit.require' => '开户银行必填',
|
||||
'bank_number.require' => '银行账号必填',
|
||||
'enterprise_address.require' => '企业地址必填',
|
||||
@ -206,8 +235,7 @@ class Apply extends BaseModel
|
||||
|
||||
|
||||
|
||||
//是否已提交发票申请
|
||||
if($order->invoiceaplpy) throw new \Exception('订单已提交发票申请,请勿重复提交!');
|
||||
|
||||
|
||||
|
||||
//计算合开金额
|
||||
@ -216,8 +244,19 @@ class Apply extends BaseModel
|
||||
//平台手续费
|
||||
$params['fee_price'] = Order::where( "id","in",$order_ids)->sum("fee_price");
|
||||
if(!$params['price']) throw new \Exception('订单金额异常,该订单无可申请发票金额');
|
||||
//$order_ids 按字典序排序后重新合并成字符串再保存
|
||||
//int数组字典序排序
|
||||
sort($order_ids,SORT_NUMERIC);
|
||||
|
||||
$order_ids = implode(',',$order_ids);
|
||||
|
||||
//如果是换开,orderIds不能变
|
||||
if($params['type']=='2'){
|
||||
$invoiceaplpy = self::where( "order_ids",$order_ids)->find();
|
||||
if(!$invoiceaplpy){
|
||||
throw new \Exception('换开失败,请选择已经开票的记录操作换开');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//判断逻辑
|
||||
@ -233,9 +272,14 @@ class Apply extends BaseModel
|
||||
// $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
|
||||
// $this->validateFailException()->validate($validate);
|
||||
// }
|
||||
|
||||
|
||||
$params["order_ids"] = $order_ids;
|
||||
//添加发票申请
|
||||
$self = new self;
|
||||
$result = $self->allowField(true)->save($params);
|
||||
|
||||
|
||||
//更新订单发票申请状态
|
||||
Order::where( "id","in",$order_ids)->update([
|
||||
'invoice_status'=>'1',
|
||||
@ -243,7 +287,18 @@ class Apply extends BaseModel
|
||||
]);
|
||||
//逐个发订单日志
|
||||
foreach ($orders as $order){
|
||||
OrderLog::log($order['id'],"活动订单发起了发票申请{$typeinfo},等待系统开票",$oper_id ,$oper_type);
|
||||
$invoiceaplpy = $order->invoiceaplpy;
|
||||
if($invoiceaplpy){
|
||||
$invoiceaplpy["status"] = '-3';
|
||||
$invoiceaplpy->save();
|
||||
//换开
|
||||
OrderLog::log($order['id'],"活动订单重新发起了发票申请{$typeinfo},等待发票换开",$oper_id ,$oper_type);
|
||||
}else{
|
||||
//新开
|
||||
OrderLog::log($order['id'],"活动订单发起了发票申请{$typeinfo},等待系统开票",$oper_id ,$oper_type);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//合并调用开发票事件
|
||||
$data = [
|
||||
@ -270,11 +325,12 @@ class Apply extends BaseModel
|
||||
|
||||
/** 发票开票(线下)
|
||||
* @param $id 申请的发票id
|
||||
* @param $images 发票展示
|
||||
* @param $desc 开票备注
|
||||
* @param $trans
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function examine($id,$desc,$oper_id = 0,$oper_type='user',$check=true,$trans=false)
|
||||
public function examine($id,$images,$desc,$oper_id = 0,$oper_type='user',$check=true,$trans=false)
|
||||
{
|
||||
$self = self::get($id);
|
||||
if(!$self) throw new \Exception('发票申请不存在');
|
||||
@ -283,10 +339,12 @@ class Apply extends BaseModel
|
||||
return $self;
|
||||
}
|
||||
if(! $desc) throw new \Exception('请填写开票备注');
|
||||
if(! $images) throw new \Exception( '请上传发票图片');
|
||||
//
|
||||
$params = [
|
||||
'status' => '2',
|
||||
'desc' => $desc,
|
||||
'images' => $images,
|
||||
'invoicingtime' => time(),
|
||||
];
|
||||
|
||||
|
@ -79,4 +79,339 @@ class Header extends BaseModel
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** 通用新增(后台api版本)
|
||||
* @param $params
|
||||
* @param $trans
|
||||
* @return $this
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function add($params,$trans=false){
|
||||
|
||||
if (empty($params)) {
|
||||
throw new \Exception(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$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{
|
||||
|
||||
//是否采用模型验证
|
||||
$params["is_default"] = $params["is_default"] ?? '0';
|
||||
if($params["is_default"] == '1'){
|
||||
self::where('user_id',$params['user_id'])->update(['is_default'=>'0']);
|
||||
}
|
||||
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
/** 通用编辑(后台api版本)
|
||||
* @param $params
|
||||
* @param $trans
|
||||
* @return $this
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function edit($id,$params,$trans=false){
|
||||
|
||||
$row = $this->get($id);
|
||||
if (!$row) {
|
||||
throw new \Exception(__('No Results were found'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (empty($params)) {
|
||||
throw new \Exception(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$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{
|
||||
$params["is_default"] = $params["is_default"] ?? '0';
|
||||
if($params["is_default"] == '1'){
|
||||
self::where('user_id',$params['user_id'])->update(['is_default'=>'0']);
|
||||
}
|
||||
|
||||
$result = $row->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 $row;
|
||||
}
|
||||
|
||||
|
||||
/** 通用详情(后台api版本)
|
||||
* @param $params
|
||||
* @param $trans
|
||||
* @return $this
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function detail($id,$show_field=[],$except_field=[]){
|
||||
$row = $this->get($id);
|
||||
if (!$row) {
|
||||
throw new \Exception(__('No Results were found'));
|
||||
}
|
||||
if($show_field){
|
||||
$row->visible($show_field);
|
||||
}
|
||||
if($except_field){
|
||||
$row->hidden($except_field);
|
||||
}
|
||||
return $row;
|
||||
}
|
||||
|
||||
// public function index($page,$limit,$where=[])
|
||||
// {
|
||||
// $adminIds = $this->getDataLimitAdminIds();
|
||||
// $aliasName = "" ;
|
||||
// if (is_array($adminIds)) {
|
||||
// $where[] = [$aliasName . $this->dataLimitField, 'in', $adminIds];
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
/** 通用删除(后台api版本)
|
||||
* @param $params
|
||||
* @param $trans
|
||||
* @return $this
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function del($ids = null,$trans=false){
|
||||
if (empty($ids)) {
|
||||
throw new \Exception(__('Parameter %s can not be empty', 'ids'));
|
||||
}
|
||||
//判断逻辑
|
||||
|
||||
$pk = $this->getPk();
|
||||
|
||||
$list = $this->where($pk, 'in', $ids)->select();
|
||||
$count = 0;
|
||||
if($trans){
|
||||
self::beginTrans();
|
||||
}
|
||||
$res = true;
|
||||
try{
|
||||
|
||||
foreach ($list as $item) {
|
||||
$count += $item->delete();
|
||||
}
|
||||
|
||||
if($trans){
|
||||
self::commitTrans();
|
||||
}
|
||||
}catch (\Exception $e){
|
||||
if($trans){
|
||||
self::rollbackTrans();
|
||||
}
|
||||
throw new \Exception($e->getMessage().$e->getFile().$e->getLine());
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**得到基础条件
|
||||
* @param $status
|
||||
* @param null $model
|
||||
* @param string $alisa
|
||||
*/
|
||||
public static function getBaseWhere($whereData = [], $model = null, $alisa = '',$with = false)
|
||||
{
|
||||
|
||||
if (!$model) {
|
||||
$model = new static;
|
||||
if ($alisa&&!$with) $model = $model->alias($alisa);
|
||||
}
|
||||
if ($alisa) $alisa = $alisa . '.';
|
||||
$tableFields = (new static)->getTableFields();
|
||||
foreach ($tableFields as $fields)
|
||||
{
|
||||
if(in_array($fields, ["user_id"]))continue;
|
||||
// if (isset($whereData[$fields]) && $whereData[$fields]) $model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]);
|
||||
|
||||
if (isset($whereData[$fields]) && $whereData[$fields]){
|
||||
if(is_array($whereData[$fields])){
|
||||
$model = $model->where("{$alisa}{$fields}", $whereData[$fields][0], $whereData[$fields][1]);
|
||||
}else{
|
||||
$model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (isset($whereData['user_id']) && $whereData['user_id']) $model = $model->where("{$alisa}user_id", 'in', $whereData['user_id']);
|
||||
|
||||
if (isset($whereData['keywords'])&&$whereData['keywords']) $model = $model->where("{$alisa}invoice_header|{$alisa}tax_id|{$alisa}bank_number|{$alisa}invoice_reservation_phone|{$alisa}invoice_reservation_email", 'like', "%". $whereData['keywords']."%");
|
||||
|
||||
if (isset($whereData['time'])&&$whereData['time']){
|
||||
$model = $model->time(["{$alisa}createtime",$whereData['time']]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static function headerList($page, $limit,$params=[]){
|
||||
$with_field = [
|
||||
'base'=>['*'],
|
||||
];
|
||||
// $alisa = (new self)->getWithAlisaName();
|
||||
// $sort = "{$alisa}.id desc";
|
||||
|
||||
$sort = "id desc";
|
||||
|
||||
$serch_where = [];
|
||||
$serch_where = array_merge($serch_where,$params);
|
||||
return (new self)->getBaseList($serch_where, $page, $limit,$sort,$with_field);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ return [
|
||||
/**
|
||||
* CDN地址
|
||||
*/
|
||||
'cdnurl' => 'https://qingchunta.hschool.com.cn',
|
||||
//'cdnurl' => '',
|
||||
// 'cdnurl' => 'https://qingchunta.hschool.com.cn',
|
||||
'cdnurl' => '',
|
||||
/**
|
||||
* 文件保存格式
|
||||
*/
|
||||
|
@ -5,6 +5,8 @@ return [
|
||||
'Status' => '申请状态',
|
||||
'Status 1' => '申请中',
|
||||
'Status 2' => '已开票',
|
||||
'Status -3' => '已作废',
|
||||
|
||||
'Apply_type' => '申请类型',
|
||||
'Apply_type 1' => '单开',
|
||||
'Apply_type 2' => '连开',
|
||||
@ -24,9 +26,11 @@ return [
|
||||
'Enterprise_address' => '企业地址',
|
||||
'Enterprise_phone' => '企业电话',
|
||||
'Invoice_reservation_phone' => '发票预留电话',
|
||||
|
||||
'Invoice_reservation_email' => '发票预留邮箱',
|
||||
'Invoicingtime' => '开票时间',
|
||||
'Createtime' => '创建时间',
|
||||
'Images' => '发票图片展示',
|
||||
'Updatetime' => '修改时间',
|
||||
'User.nickname' => '昵称',
|
||||
'User.mobile' => '手机号',
|
||||
|
@ -37,7 +37,7 @@ class Apply extends BaseModel
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['1' => __('Status 1'), '2' => __('Status 2')];
|
||||
return ['1' => __('Status 1'), '2' => __('Status 2'), '-3' => __('Status -3')];
|
||||
}
|
||||
|
||||
public function getApplyTypeList()
|
||||
|
@ -126,6 +126,24 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text" value="{$row.images|htmlentities}">
|
||||
<div class="input-group-addon no-border no-padding">
|
||||
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-maxcount="5" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
|
||||
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-maxcount="5" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
|
||||
</div>
|
||||
<span class="msg-box n-right" for="c-images"></span>
|
||||
</div>
|
||||
<ul class="row list-inline faupload-preview" id="p-images"></ul>
|
||||
<!-- <span style="color: red">( 推荐图片比例为 690*580 )</span>-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Desc')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
@ -29,10 +29,18 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
{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: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"-3":__('Status -3')}, formatter: Table.api.formatter.status},
|
||||
|
||||
{field: 'type', title: __('开票类型'), searchList: {"1":__('新开'),"2":__('换开')}, formatter: Table.api.formatter.normal},
|
||||
|
||||
|
||||
{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: 'fee_price', title: __('Fee_price'), operate:'BETWEEN'},
|
||||
|
||||
{field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
|
||||
|
||||
|
||||
{field: 'desc', title: __('Desc'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
|
||||
|
||||
|
@ -22,15 +22,26 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
fixedColumns: true,
|
||||
fixedRightNumber: 1,
|
||||
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: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"-3":__('Status -3')}, formatter: Table.api.formatter.status},
|
||||
|
||||
|
||||
{field: 'type', title: __('开票类型'), searchList: {"1":__('新开'),"2":__('换开')}, formatter: Table.api.formatter.normal},
|
||||
|
||||
|
||||
|
||||
|
||||
{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: 'fee_price', title: __('Fee_price'), operate:'BETWEEN'},
|
||||
{field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
|
||||
|
||||
{field: 'desc', title: __('Desc'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user