提交 815757a8 authored 作者: chengye's avatar chengye

Merge branch 'release' of ssh://39.155.253.71:33222/PHP/Jz-Php into release

...@@ -14,16 +14,13 @@ ...@@ -14,16 +14,13 @@
/config/database.php /config/database.php
/config/cache.php /config/cache.php
/config/session.php /config/session.php
<<<<<<< HEAD
/config/admin.php /config/admin.php
=======
/config/cookie.php /config/cookie.php
/config/jz.php /config/app.php
>>>>>>> test
/public/dist /public/dist
/public/dist2 /public/dist2
/public/static/uploads /public/static/uploads
/public/static/xadmin /public/static/xadmin
/public/page
/application/admin/view/staff/role.html /application/admin/view/staff/role.html
/config/jz.php /config/jz.php
/config/cookie.php \ No newline at end of file
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace app\api\controller\v2\common; namespace app\api\controller\v2\common;
use app\em\controller\Account; use app\em\controller\Account;
use app\em\controller\Invoice;
use app\em\controller\WriteOff; use app\em\controller\WriteOff;
use app\em\model\EmInvoice; use app\em\model\EmInvoice;
use app\em\model\EmPayment; use app\em\model\EmPayment;
...@@ -32,6 +33,7 @@ class Payment ...@@ -32,6 +33,7 @@ class Payment
Log::record(date('Y-m-d H:i:s').' OA单号:'.$data['numb'].' 接口操作:单据状态更新'); Log::record(date('Y-m-d H:i:s').' OA单号:'.$data['numb'].' 接口操作:单据状态更新');
return $this->update($data['numb'],$data['status'],$data['mes']); return $this->update($data['numb'],$data['status'],$data['mes']);
} else { } else {
Log::record(date('Y-m-d H:i:s').' OA单号:'.$data['numb'].' 接口操作:单据作废');
return $this->dropNumb($data['numb'],$data['status']); return $this->dropNumb($data['numb'],$data['status']);
} }
} }
...@@ -69,19 +71,20 @@ class Payment ...@@ -69,19 +71,20 @@ class Payment
$payment = (new EmPayment())->get(['payment_id' => $paymentFk->payment_id]); $payment = (new EmPayment())->get(['payment_id' => $paymentFk->payment_id]);
$paymentFk->status = 0; $paymentFk->status = 0;
$paymentFk->save(); $paymentFk->save();
$payment->status = 9; $payment->status = $status;
$payment->save(); $payment->save();
//删除payment_invoice表 //删除payment_invoice表
$delNum = (new EmPaymentInvoice())->where('payment_id', '=', $payment->payment_id)->delete(); $invoices = (new EmPaymentInvoice())->where('payment_id', '=', $paymentFk->payment_id)->delete();
Log::record(date('Y-m-d H:i:s').' OA单号:'.$numb. '缴费单已作废');
$message = ' 缴费单: '.$paymentFk->payment_id. '缴费单已作废';
Log::record(date('Y-m-d H:i:s').$message);
return json( return json(
[ [
'code' => 201, 'code' => 201,
'message' => json_encode($payment->toArray()), 'message' => $message,
'data' => '' 'data' => ''
]); ]);
} }
......
...@@ -201,6 +201,10 @@ class Em extends Base ...@@ -201,6 +201,10 @@ class Em extends Base
//保存缴费结算数据 //保存缴费结算数据
$emRuleModel = EmRule::order('id desc,create_time desc')->get(['em_id'=>$data['em_id']]); $emRuleModel = EmRule::order('id desc,create_time desc')->get(['em_id'=>$data['em_id']]);
//如果之前没有子表记录则插入
if(!$emRuleModel) $emRuleModel = new EmRule();
$emRuleModel->save($data); $emRuleModel->save($data);
(new Account())->createAccount($data['em_id']); (new Account())->createAccount($data['em_id']);
...@@ -248,10 +252,19 @@ class Em extends Base ...@@ -248,10 +252,19 @@ class Em extends Base
if(!$em || !isset($em->rule)){ if(!$em || !isset($em->rule)){
return false; return false;
} }
if(!isset($em->rule->settle_price) || empty($em->rule->settle_price) || !isset($em->rule->pay_price) || empty($em->rule->pay_price)){
return false; if($em->rule->charge_type == 1)
} else { if(!isset($em->rule->settle_price) || empty($em->rule->settle_price) || !isset($em->rule->pay_price) || empty($em->rule->pay_price)){
return true; return false;
} else {
return true;
}
else {
if(!isset($em->rule->settle_price) || empty($em->rule->settle_price)){
return false;
} else {
return true;
}
} }
} }
......
...@@ -413,4 +413,9 @@ class Invoice extends Base ...@@ -413,4 +413,9 @@ class Invoice extends Base
return $msg; return $msg;
} }
public function statusBack($invoice_id,$payment_id){
$eModel = EmPaymentInvoice::get(['invoice_id'=>'$invoice_id','payment_id'=>$payment_id]);
$eModel->delete();
}
} }
\ No newline at end of file
...@@ -97,7 +97,7 @@ class Payment extends Base ...@@ -97,7 +97,7 @@ class Payment extends Base
$this->assign('search_text',$search_text ?: ''); $this->assign('search_text',$search_text ?: '');
//缴费状态 //缴费状态
if($payment_status !== '') $map[]=['pay.status','=',"$payment_status"]; if($payment_status != '') $map[]=['pay.status','=',"$payment_status"];
$this->assign('payment_status',$payment_status ?: ''); $this->assign('payment_status',$payment_status ?: '');
//区域 //区域
...@@ -172,7 +172,9 @@ class Payment extends Base ...@@ -172,7 +172,9 @@ class Payment extends Base
//过滤不可以生成缴费单的账单ID //过滤不可以生成缴费单的账单ID
$idsArr = []; $idsArr = [];
$amount = 0; $amount = 0;
$inv0 = null;
foreach ($invs as $inv){ foreach ($invs as $inv){
if($inv0 === null) $inv0 = $inv;
//未生成缴费或已挂起 //未生成缴费或已挂起
$amount += $inv->payment_balance; $amount += $inv->payment_balance;
//是否已挂起 //是否已挂起
...@@ -219,10 +221,11 @@ class Payment extends Base ...@@ -219,10 +221,11 @@ class Payment extends Base
$pData = []; $pData = [];
$pData['payment_id'] = $paymentId; $pData['payment_id'] = $paymentId;
$pData['status'] = 1; $pData['status'] = 1;
$pData['account_id'] = '\\'; //占位符,表示空的无效的 $pData['account_id'] = $inv0->account_id; //占位符,表示空的无效的
$pData['em_id'] = '\\'; //占位符,表示空的无效的 $pData['em_id'] = $inv0->em_id; //占位符,表示空的无效的
$pData['payment_type'] = 1; $pData['payment_type'] = 1;
$pData['balance'] = $pData['amount'] = round($amount,2); $pData['balance'] = $pData['amount'] = round($amount,2);
$pData['uid'] = $this->uid;
if((new EmPayment())->save($pData)){ if((new EmPayment())->save($pData)){
return json(['status'=>1,'message'=>'已创建缴费单']); return json(['status'=>1,'message'=>'已创建缴费单']);
...@@ -260,6 +263,12 @@ class Payment extends Base ...@@ -260,6 +263,12 @@ class Payment extends Base
if($payment->status > 1 && $payment->status != 7){ if($payment->status > 1 && $payment->status != 7){
$fkModel = EmPaymentFk::get(['payment_id'=>$payment->payment_id]); $fkModel = EmPaymentFk::get(['payment_id'=>$payment->payment_id]);
if(!$fkModel) {
$fkModel = new EmPaymentFk();
$fkModel->oafk_numb = '';
$fkModel->link = '';
$fkModel->oafk_id = '';
}
$fkModel->link = config('oafk.base_url').config('oafk.link') . $fkModel->oafk_id; $fkModel->link = config('oafk.base_url').config('oafk.link') . $fkModel->oafk_id;
} else if ($payment->status == 7) { } else if ($payment->status == 7) {
$fkModel = EmCheckBill::get(['mode_id'=>$payment->payment_id]); $fkModel = EmCheckBill::get(['mode_id'=>$payment->payment_id]);
...@@ -370,7 +379,7 @@ class Payment extends Base ...@@ -370,7 +379,7 @@ class Payment extends Base
$paymentModel->account_id = $accountId; $paymentModel->account_id = $accountId;
$paymentModel->balance = $data['amount']; $paymentModel->balance = $data['amount'];
$paymentModel->staff_id = $data['staff_id']; $paymentModel->staff_id = $data['staff_id'];
$paymentModel->cid = $this->uid; $paymentModel->uid = $this->uid;
$paymentModel->payment_type = $em->em_type_id; $paymentModel->payment_type = $em->em_type_id;
// $paymentModel->is_check = $em->em_type_id == 2 || $em->em_type_id == 4 ? 0 : 1; // $paymentModel->is_check = $em->em_type_id == 2 || $em->em_type_id == 4 ? 0 : 1;
$paymentModel->status = 0; $paymentModel->status = 0;
...@@ -573,8 +582,8 @@ class Payment extends Base ...@@ -573,8 +582,8 @@ class Payment extends Base
public function getGys($email) public function getGys($email)
{ {
$url = config('oafk.base_url').config('oafk.gys') . $this->apiKey(); $url = config('oafk.base_url').config('oafk.gys') . $this->apiKey();
$url .= '&email='.$email; $data = ['email'=>$email,'count'=>'all'];
$res = curlGet($url); $res = httpPOST($url,$data);
$res = json_decode($res,true); $res = json_decode($res,true);
foreach ($res['data'] as $k => $v){ foreach ($res['data'] as $k => $v){
if(!empty($v['bank_info'])){ if(!empty($v['bank_info'])){
...@@ -599,9 +608,7 @@ class Payment extends Base ...@@ -599,9 +608,7 @@ class Payment extends Base
//创建付款编号 //创建付款编号
public function createFkNumb($data){ public function createFkNumb($data){
$url = config('oafk.base_url').config('oafk.fk') . $this->apiKey(); $url = config('oafk.base_url').config('oafk.fk') . $this->apiKey();
var_dump($url);
$res = httpPOST($url, ['data'=>json_encode($data)]); $res = httpPOST($url, ['data'=>json_encode($data)]);
var_dump($res);
// $end = strpos($res,'}'); // $end = strpos($res,'}');
// $str = substr($res,$start,$end); // $str = substr($res,$start,$end);
$res = json_decode($res,true); $res = json_decode($res,true);
......
...@@ -117,12 +117,15 @@ class EmInvoice extends Base ...@@ -117,12 +117,15 @@ class EmInvoice extends Base
$eiu = EmInvoiceUseage::where(['invoice_id'=>$inv->invoice_id])->find(); $eiu = EmInvoiceUseage::where(['invoice_id'=>$inv->invoice_id])->find();
//查询抄表信息 //查询抄表信息
$useage = Useage::with('photo')->get(['useage_id'=>$eiu->useage_id]); $uModel = Useage::get(['useage_id'=>$eiu->useage_id]);
if(isset($uModel->cert_id) && $uModel->cert_id != ''){
if($useage->photo_id) { $useage = Useage::with('photo')->get(['useage_id'=>$eiu->useage_id]);
$receipt = Receipt::get(['id'=>$useage->photo_id]); if($useage->photo_id) {
if($receipt) $useage['photo'] = $receipt; $receipt = Receipt::get(['id'=>$useage->photo_id]);
if($receipt) $useage['photo'] = $receipt;
}
} else { } else {
$useage = $uModel;
$useage['photo'] = []; $useage['photo'] = [];
} }
......
...@@ -23,50 +23,25 @@ class EmPayment extends Base ...@@ -23,50 +23,25 @@ class EmPayment extends Base
//缴费单+search //缴费单+search
public function getPaymentList($map,$Nowpage,$limits){ public function getPaymentList($map,$Nowpage,$limits){
//先找到账单
$data = self::alias('pay')
->field('pay.*')
->field('epi.invoice_id')
->field('em.em_numb')
->field('r.region_name,station.station_name')
->leftJoin(['em_payment_invoice'=>'epi'],'epi.payment_id = pay.payment_id')
->leftJoin(['em_invoice'=>'ei'],'ei.invoice_id=epi.invoice_id')
->leftJoin(['em_account'=>'ea'],'ea.account_id=ei.account_id')
->leftJoin(['em'],'em.id=ea.em_id')
->leftJoin(['station_info'=>'station'],'station.station_id=em.station_id')
->leftJoin(['region'=>'r'],'station.area_id = r.id')
->where($map)
->order('pay.id desc')
->group('pay.payment_id')
->page($Nowpage, $limits)
->select()
->toarray();
$arr = [];
foreach ($data as $v){
$arr[] = $v['payment_id'];
}
$data2 = self::alias('pay') $data = self::alias('pay')
->field('pay.*') ->field('pay.*')
->field('em.em_numb,r.region_name,station.station_name') ->field('em.em_numb,r.region_name,station.station_name')
->leftJoin(['em_account'=>'ea'],'ea.account_id=pay.account_id') ->leftJoin(['em'],'em.id=pay.em_id')
->leftJoin(['em'],'em.id=ea.em_id')
->leftJoin(['station_info'=>'station'],'station.station_id=em.station_id') ->leftJoin(['station_info'=>'station'],'station.station_id=em.station_id')
->leftJoin(['region'=>'r'],'station.area_id = r.id') ->leftJoin(['region'=>'r'],'station.area_id = r.id')
->where($map) ->where($map)
->whereNotIn('pay.payment_id',$arr)
->order('pay.id desc') ->order('pay.id desc')
->group('pay.payment_id')
->page($Nowpage, $limits) ->page($Nowpage, $limits)
->select() ->select()
->toarray(); ->toarray();
$data = array_merge($data,$data2);
$sortKey = []; $sortKey = [];
foreach ($data as $k=>$item){ foreach ($data as $k=>$item){
$data[$k]['state'] = Payment::PAYMENT_STATUS[$item['status']]; $data[$k]['state'] = Payment::PAYMENT_STATUS[$item['status']];
$data[$k]['style'] = Payment::PAYMENT_STAUS_STYLE[$item['status']];
$data[$k]['payment_type'] = Payment::PAYMENT_TYPE[$item['payment_type']]; $data[$k]['payment_type'] = Payment::PAYMENT_TYPE[$item['payment_type']];
$sortKey[$k] = $item['create_time']; $sortKey[$k] = $item['create_time'];
} }
...@@ -78,30 +53,14 @@ class EmPayment extends Base ...@@ -78,30 +53,14 @@ class EmPayment extends Base
//先找到账单 //先找到账单
$data = self::alias('pay') $data = self::alias('pay')
->field('pay.*')
->field('epi.invoice_id')
->field('em.em_numb')
->field('r.region_name,station.station_name')
->leftJoin(['em_payment_invoice'=>'epi'],'epi.payment_id = pay.payment_id')
->leftJoin(['em_invoice'=>'ei'],'ei.invoice_id=epi.invoice_id')
->leftJoin(['em_account'=>'ea'],'ea.account_id=ei.account_id')
->leftJoin(['em'],'em.id=ea.em_id')
->leftJoin(['station_info'=>'station'],'station.station_id=em.station_id')
->leftJoin(['region'=>'r'],'station.area_id = r.id')
->where($map)
->count();
$data2 = self::alias('pay')
->field('pay.*') ->field('pay.*')
->field('em.em_numb,r.region_name,station.station_name') ->field('em.em_numb,r.region_name,station.station_name')
->leftJoin(['em_account'=>'ea'],'ea.account_id=pay.account_id') ->leftJoin(['em'],'em.id=pay.em_id')
->leftJoin(['em'],'em.id=ea.em_id')
->leftJoin(['station_info'=>'station'],'station.station_id=em.station_id') ->leftJoin(['station_info'=>'station'],'station.station_id=em.station_id')
->leftJoin(['region'=>'r'],'station.area_id = r.id') ->leftJoin(['region'=>'r'],'station.area_id = r.id')
->where($map) ->where($map)
->count(); ->count();
return $data;
return intval($data + $data2);
} }
//通过缴费单id返回缴费单关联账单信息 //通过缴费单id返回缴费单关联账单信息
public function getinvsInfo($payment_id){ public function getinvsInfo($payment_id){
......
...@@ -330,7 +330,7 @@ ...@@ -330,7 +330,7 @@
<span class="x-red">*</span>缴费周期 <span class="x-red">*</span>缴费周期
</label> </label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="text" id="pay_cycle" name="pay_cycle" autocomplete="off" class="layui-input" lay-verType="tips"> <input type="number" id="pay_cycle" name="pay_cycle" autocomplete="off" class="layui-input" lay-verType="tips">
</div> </div>
</div> </div>
</div> </div>
......
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
<span class="x-red">*</span>抄表单照片 <span class="x-red">*</span>抄表单照片
</label> </label>
<div class="layui-input-inline"> <div class="layui-input-inline">
{if $inv.useage.photo.src == ''} {if !isset($inv.useage.photo.src) }
<input type="text" <input type="text"
autocomplete="off" class="layui-input layui-no-border" value="未上传抄表照片" disabled="disabled"> autocomplete="off" class="layui-input layui-no-border" value="未上传抄表照片" disabled="disabled">
{else /} {else /}
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
<th lay-data="{field:'em_numb',sort: true} ">表号</th> <th lay-data="{field:'em_numb',sort: true} ">表号</th>
<th lay-data="{field:'payment_type',sort: true}">缴费类型</th> <th lay-data="{field:'payment_type',sort: true}">缴费类型</th>
<th lay-data="{field:'amount',sort: true}">应付金额</th> <th lay-data="{field:'amount',sort: true}">应付金额</th>
<th lay-data="{field: 'status',sort: true}">状态</th> <th lay-data="{templet: '#state'}">状态</th>
<th lay-data="{field: 'create_time',sort: true}">创建日期</th> <th lay-data="{field: 'create_time',sort: true}">创建日期</th>
<th lay-data="{fixed: 'right', align:'center', toolbar: '#barDemo'}">操作</th> <th lay-data="{fixed: 'right', align:'center', toolbar: '#barDemo'}">操作</th>
</tr> </tr>
...@@ -87,6 +87,9 @@ ...@@ -87,6 +87,9 @@
</div> </div>
</div> </div>
</body> </body>
<script type="text/html" id="state">
<span class="{{ d.style }}">{{d.state}}</span>
</script>
<script type="text/html" id="payment_id"> <script type="text/html" id="payment_id">
<a class="layui-link" title="查看详情" href="/payment/{{d.payment_id}}">{{d.payment_id}}</a> <a class="layui-link" title="查看详情" href="/payment/{{d.payment_id}}">{{d.payment_id}}</a>
</script> </script>
......
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
</label> </label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="text" id="current_date" name="current_date" <input type="text" id="current_date" name="current_date"
autocomplete="off" class="layui-input" value="{$em.useage.current_date|date='Y:m:d'}"> autocomplete="off" class="layui-input" value="{$em.useage.current_date}">
</div> </div>
</div> </div>
</div> </div>
...@@ -261,8 +261,7 @@ ...@@ -261,8 +261,7 @@
laydate.render({ laydate.render({
elem:'#current_date', elem:'#current_date'
trigger:'click',
}) })
//保存抄表单,并且返回列表 //保存抄表单,并且返回列表
...@@ -311,7 +310,7 @@ ...@@ -311,7 +310,7 @@
} }
}); });
$('#current_numb').change(function(){ $('#current_numb').change(function(){
var $level = 100000; var $level = 1;
var $rate = $('#rate').val(); var $rate = $('#rate').val();
var $baseNum = $level*$rate; var $baseNum = $level*$rate;
var $rNum = $(this).val()*$baseNum - $('#last_numb').val()*$baseNum; var $rNum = $(this).val()*$baseNum - $('#last_numb').val()*$baseNum;
...@@ -322,7 +321,7 @@ ...@@ -322,7 +321,7 @@
return; return;
} }
var $num = $rNum/$level; var $num = round2($rNum);
$('#repo_numb').val($num); $('#repo_numb').val($num);
if($('#pricing_type').val() == 2){ if($('#pricing_type').val() == 2){
...@@ -348,6 +347,10 @@ ...@@ -348,6 +347,10 @@
$('#price').val($price.toFixed(4)) $('#price').val($price.toFixed(4))
} }
}) })
function round2(num){
return Math.round((num + Number.EPSILON) * 100) / 100;
}
}); });
</script> </script>
{/block} {/block}
\ No newline at end of file
...@@ -307,7 +307,7 @@ ...@@ -307,7 +307,7 @@
} }
}); });
$('#current_numb').change(function(){ $('#current_numb').change(function(){
var $level = 100000; var $level = 1;
var $rate = $('#rate').val(); var $rate = $('#rate').val();
var $baseNum = $level*$rate; var $baseNum = $level*$rate;
var $rNum = $(this).val()*$baseNum - $('#last_numb').val()*$baseNum; var $rNum = $(this).val()*$baseNum - $('#last_numb').val()*$baseNum;
...@@ -317,7 +317,8 @@ ...@@ -317,7 +317,8 @@
layMsg('本次抄表必须大于上次抄表读数',5); layMsg('本次抄表必须大于上次抄表读数',5);
$('#current_numb').focus(); $('#current_numb').focus();
} else{ } else{
var $num = $rNum/$level;
var $num = round2($rNum);
$('#repo_numb').val( $num ) $('#repo_numb').val( $num )
if($amount != '' || $amount != 0){ if($amount != '' || $amount != 0){
...@@ -336,6 +337,10 @@ ...@@ -336,6 +337,10 @@
var $price = $('#amount').val() / $('#repo_numb').val(); var $price = $('#amount').val() / $('#repo_numb').val();
$('#price').val($price.toFixed(4)) $('#price').val($price.toFixed(4))
}) })
function round2(num){
return Math.round((num + Number.EPSILON) * 100) / 100;
}
}); });
</script> </script>
{/block} {/block}
\ No newline at end of file
...@@ -12,7 +12,7 @@ return [ ...@@ -12,7 +12,7 @@ return [
'files_dir' => './static/uploads/files', 'files_dir' => './static/uploads/files',
'search_area' => '1', //1按部门搜索,2全局 'search_area' => '1', //1按部门搜索,2全局
'order_per' =>'ZD', 'order_per' =>'ZD',
'redis_host' => '192.168.1.71', 'redis_host' => '192.168.1.70',
'redis_port' => 6379, 'redis_port' => 6379,
'base_url' => 'http://oa-test.gonn.tech/' 'base_url' => 'http://oa-release.gonn.tech'
]; ];
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论