提交 88ca692e authored 作者: chengye's avatar chengye

电费付款修复

上级 86bd4d7b
...@@ -5,6 +5,7 @@ use app\admin\model\StaffRoleModel; ...@@ -5,6 +5,7 @@ use app\admin\model\StaffRoleModel;
use think\Controller; use think\Controller;
use think\facade\Cookie; use think\facade\Cookie;
use think\facade\Request; use think\facade\Request;
use think\facade\Session;
/** /**
* 控制器基类 * 控制器基类
...@@ -16,8 +17,12 @@ use think\facade\Request; ...@@ -16,8 +17,12 @@ use think\facade\Request;
class Base extends Controller class Base extends Controller
{ {
protected $uid ;
protected $user = [];
//登录检测 //登录检测
protected function initialize(){ protected function initialize(){
$this->user = Session::get('user');
$this->uid = $this->user['user_id'];
$this->check(); $this->check();
} }
......
...@@ -70,7 +70,7 @@ class Login extends Controller ...@@ -70,7 +70,7 @@ class Login extends Controller
session(null); session(null);
cookie(null); cookie(null);
(new SingleSign())->clear(); (new SingleSign())->clear();
$this->redirect('/index'); $this->redirect('/login');
} }
private function checkStaff(){ private function checkStaff(){
......
...@@ -11,7 +11,7 @@ class PermissionModel extends BaseModel ...@@ -11,7 +11,7 @@ class PermissionModel extends BaseModel
protected $deleteTime = 'delete_time'; protected $deleteTime = 'delete_time';
protected $table = 'permission'; protected $table = 'permission';
private $fields = 'id,title,pid,model_name,controller_name,method_name,params,is_nav,sort,status,update_time'; private $fields = '*';
private $ids = []; private $ids = [];
private function getPermissionTree($fields = '',$isNav = false) private function getPermissionTree($fields = '',$isNav = false)
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<tr> <tr>
<th>菜单编号</th> <th>菜单编号</th>
<th>名称</th> <th>名称</th>
<th>规则</th> <th>路由</th>
<th>导航</th> <th>导航</th>
<th>排序</th> <th>排序</th>
<th>状态</th> <th>状态</th>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<tr> <tr>
<td>{$item.id}</td> <td>{$item.id}</td>
<td>{$item.name}</td> <td>{$item.name}</td>
<td>{$item.model_name}/{$item.controller_name}/{$item.method_name}/{$item.params}</td> <td>{$item.nav_url ?: '-'}</td>
<td>{if $item.is_nav == 1}是{else /}否{/if}</td> <td>{if $item.is_nav == 1}是{else /}否{/if}</td>
<td>{$item.sort}</td> <td>{$item.sort}</td>
<td class="td-status"> <td class="td-status">
...@@ -97,7 +97,6 @@ ...@@ -97,7 +97,6 @@
var a='<span class="layui-btn layui-btn-normal layui-btn-mini">正常</span>' var a='<span class="layui-btn layui-btn-normal layui-btn-mini">正常</span>'
$('#setstatus'+id).html(a); $('#setstatus'+id).html(a);
return false; return false;
} }
}, },
error : function (XMLHttpRequest, textStatus, errorThrow ) { error : function (XMLHttpRequest, textStatus, errorThrow ) {
......
...@@ -16,4 +16,4 @@ function getTree($array, $pid =0, $level = 0){ ...@@ -16,4 +16,4 @@ function getTree($array, $pid =0, $level = 0){
} }
} }
return $list; return $list;
} }
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: chouchou
* Date: 2020-6-21
* Time: 18:52
*/
namespace app\api\controller\v2\common;
use app\em\model\EmAccount;
use app\em\model\EmInvoice;
use app\em\model\EmPayment;
use app\em\model\EmPaymentFk;
use app\em\model\EmPayment as PaymentModel;
use app\em\model\EmPaymentInvoice;
use app\em\model\EmPaymentInvoiceBalance;
class Payment
{
public function index()
{
$data = request()->get();
$res = $this->checkKey($data['key']);
if ($res !== true) return json([
'code' => 201,
'message' => $res,
'data' => ''
]);
if ($data['action'] == 1) return $this->update($data['numb'],$data['status'],$data['mes']);
else return $this->dropNumb($data['numb']);
}
//更新payment状态
private function update($numb,$status,$mes='')
{
$paymentFk = (new EmPaymentFk())->get(['oafk_numb' => $numb]);
$payment = (new PaymentModel())->get(['payment_id' => $paymentFk->payment_id]);
$res = $this->writeOffFromPayment($payment->account_id, $payment->payment_id);
$payment->status = $status;
if($status == 3) $payment->pay_date = time();
$payment->save();
$account = EmAccount::get(['account_id'=>$payment->account_id]);
$account->amount += $payment->amount ;
$account->save();
return json([
'code' => 200,
'message' => $mes ?: '已成功付款',
'data' => $res
]);
}
//作废单据
private function dropNumb($numb)
{
try {
$paymentFk = (new EmPaymentFk())->get(['oafk_numb' => $numb]);
$payment = (new PaymentModel())->get(['payment_id' => $paymentFk->payment_id]);
} catch (\Exception $e) {
return json([
'code' => 200,
'message' => '单号异常,或已经作废',
'data' => ''
]);
}
$paymentFk->delete();
$payment->status = 9;
$payment->save();
//删除payment_invoice表
$delNum = (new EmPaymentInvoice())->where('payment_id', '=', $payment->payment_id)->delete();
return json([
'code' => 200,
'message' => '缴费单已作废',
'data' => $delNum
]);
}
private function checkKey($key)
{
if (empty($key)) {
return '秘钥不能为空';
}
$baseKey = substr(md5(config('oafk.oa_key') . date('Y-m-d')), 0, 12);
if ($key != $baseKey) {
return '秘钥错误';
}
return true;
}
//从缴费单消账单
public function writeOffFromPayment($account_id, $payment_id)
{
//获取缴费单对象
$payment = EmPayment::where('payment_id', '=', $payment_id)->find();
//获取关联的账单对象
$invs = (new EmInvoice())->alias('ei')->field('ei.invoice_id')
->leftJoin(['em_payment_invoice' => 'epi'], 'epi.invoice_id = ei.invoice_id')
->where('epi.payment_id', '=', $payment_id)
->where('ei.payment_balance', 'neq', 0)
->order('ei.invoice_id asc')
->select();
$invsArr = [];
//更新缴费单状态
if ($invs->isEmpty()) {
$payment->status = 4;
$payment->save();
return '审核成功';
} else {
foreach ($invs as $inv) {
$invsArr[] = $inv->invoice_id;
}
}
//查询可消的额度
$payments_balance = (new EmInvoice)->where('invoice_id', 'in', $invsArr)->sum('payment_balance');
//如果可以完全销账 则继续销账
if ($payment->balance > $payments_balance) {
$invs = (new EmInvoice())->field('invoice_id')
->where('account_id', '=', $account_id)
->where('payment_balance', 'neq', 0)
->order('invoice_id asc')
->select();
if (!$invs->isEmpty()) {
foreach ($invs as $inv) {
$invsArr[] = $inv->invoice_id;
}
}
}
$paymentIds[] = $payment->payment_id;
//处理账户金额
return $this->writeOff($paymentIds, $invsArr);
}
/**
* @param $account_id
* @param $invoiceIds
* @param $paymentIds
* @return mixed
*/
private function writeOff($paymentIds, $invoiceIds)
{
//获取可销账缴费单
$payments = EmPayment::where('payment_id', 'in', $paymentIds)->select();
//获取可销账账单
$invs = EmInvoice::where('invoice_id', 'in', $invoiceIds)->select();
$result = 0;
foreach ($payments as $key => $payment) {
if ($payment->balance == 0)
continue;
foreach ($invs as $index => $inv) {
$balanceMode = new EmPaymentInvoiceBalance();
$balanceMode->payment_id = $payment->payment_id;
if ($inv->payment_balance == 0)
continue;
$balanceMode->invoice_id = $inv->invoice_id;
//如果该缴费单可以完全消除当前账单额度
if ($payment->balance >= $inv->payment_balance) {
//单笔销账多少
$balanceMode->balance = $inv->payment_balance;
//缴费额度变化
if (($payment->balance - $inv->payment_balance) == 0) {
$payment->status = 4;
} else {
$payment->status = 4; //缴费部分销账
}
$payment->balance = $payment->balance - $inv->payment_balance;
//账单额度变化
$inv->payment_balance = 0;
//更新账户status 首字母 = 2
$inv->status = $this->setInvoiceStatus($inv->status, 2);
} else {
//单笔销账多少
$balanceMode->balance = $payment->balance;
//账单额度变化
$inv->status = $this->setInvoiceStatus($inv->status, 1);
$inv->payment_balance = $inv->payment_balance - $payment->balance;
//缴费额度变化
$payment->balance = 0;
$payment->status = 4; //缴费已经完全销账
}
$model = new EmPaymentInvoice();
if (!$model->where(['payment_id' => $payment->payment_id, 'invoice_id' => $inv->invoice_id])->find()) {
$model->payment_id = $payment->payment_id;
$model->invoice_id = $inv->invoice_id;
$model->save();
}
$result++;
//更新账单状态
$inv->save();
//todo::history; 保存历史记录
$invData = $inv->toArray();
$invData['id'] = null;
$invData['create_time'] = strtotime($invData['create_time']);
$invData['update_time'] = strtotime($invData['update_time']);
//EmInvoiceHistory::create($invData);
//unset($invs[$index]); //从结果集中去掉无效的数据
//更新状态
$payment->save();
//todo::history;保存历史记录
$payData = $payment->toArray();
$payData['id'] = null;
$payData['create_time'] = strtotime($payData['create_time']);
$payData['update_time'] = strtotime($payData['update_time']);
$payData['pay_date'] = strtotime($payData['pay_date']);
//EmPaymentHistory::create($payData);
unset($payments[$key]);
$balanceMode->isUpdate(false)->save();
}
}
$msg = $result == 0 ? '已审核,没有可销账的账单.' : '已审核,成功销账 ' . $result . ' 笔账单.';
return $msg;
}
public function setInvoiceStatus($statusCode, $value, $index = 0)
{
return substr_replace($statusCode, $value, $index, 1);
}
}
\ No newline at end of file
...@@ -40,40 +40,28 @@ class Em extends Base ...@@ -40,40 +40,28 @@ class Em extends Base
if($search_text){ if($search_text){
switch ($search_type) { switch ($search_type) {
case '1': case '1':
$this->assign('search_text',$search_text);
$map[]=['s.station_name','like',"%$search_text%"]; $map[]=['s.station_name','like',"%$search_text%"];
$this->assign('search_type',$search_type);
break; break;
case '2': case '2':
$this->assign('search_text',$search_text);
$map[]=['s.station_sp_code','like',"%$search_text%"]; $map[]=['s.station_sp_code','like',"%$search_text%"];
$this->assign('search_type',$search_type);
break; break;
case '3': case '3':
$this->assign('search_text',$search_text);
$map[]=['s.proj_number','like',"%$search_text%"]; $map[]=['s.proj_number','like',"%$search_text%"];
$this->assign('search_type',$search_type);
break; break;
case '4': case '4':
$this->assign('search_text',$search_text);
$map[]=['em.em_numb','like',"%$search_text%"]; $map[]=['em.em_numb','like',"%$search_text%"];
$this->assign('search_type',$search_type);
break; break;
case '5': case '5':
$this->assign('search_text',$search_text);
$map[]=['em.qrcode','like',"%$search_text%"]; $map[]=['em.qrcode','like',"%$search_text%"];
$this->assign('search_type',$search_type);
break; break;
case '6': case '6':
$this->assign('search_text',$search_text);
$map[]=['d.rent','like',"%$search_text%"]; $map[]=['d.rent','like',"%$search_text%"];
$this->assign('search_type',$search_type);
break; break;
} }
}else{
$this->assign('search_type','');
$this->assign('search_text','');
} }
$this->assign('search_type',$search_type ?: '');
$this->assign('search_text',$search_text ?: '');
$operator = Request::param('operator'); $operator = Request::param('operator');
if($operator){ if($operator){
$map[] = ['s.original_sp_id','=',$operator]; $map[] = ['s.original_sp_id','=',$operator];
...@@ -88,8 +76,8 @@ class Em extends Base ...@@ -88,8 +76,8 @@ class Em extends Base
}else{ }else{
$this->assign('area_id',''); $this->assign('area_id','');
} }
$page =Request::param('page')?Request::param('page'):1; $page =Request::param('page')?:1;
$limit = Request::param('limit')?Request::param('limit'):10; $limit = Request::param('limit')?:10;
$emModel = new EmList(); $emModel = new EmList();
$list = $emModel->getEmList($map,$page,$limit); $list = $emModel->getEmList($map,$page,$limit);
...@@ -98,7 +86,6 @@ class Em extends Base ...@@ -98,7 +86,6 @@ class Em extends Base
return ['code'=>0,'msg'=>'','count'=>$emCount,'data'=>$list]; return ['code'=>0,'msg'=>'','count'=>$emCount,'data'=>$list];
} }
$region=new ElectricMeter(); $region=new ElectricMeter();
$operator=new OperatorModel();
$operators = OperatorModel::field('operator_id,operator_name')->where('operator_state','=',1)->select()->toArray(); $operators = OperatorModel::field('operator_id,operator_name')->where('operator_state','=',1)->select()->toArray();
$this->assign('regions',getTree($region->regions())); $this->assign('regions',getTree($region->regions()));
$this->assign('operators',$operators); $this->assign('operators',$operators);
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
namespace app\em\controller; namespace app\em\controller;
use app\admin\controller\Base; use app\admin\controller\Base;
use app\em\model\EmAccount;
use app\em\model\EmInvoice; use app\em\model\EmInvoice;
use app\em\model\EmInvoiceUseage; use app\em\model\EmInvoiceUseage;
use app\em\model\EmPayment; use app\em\model\EmPayment;
...@@ -232,7 +233,6 @@ class Invoice extends Base ...@@ -232,7 +233,6 @@ class Invoice extends Base
$eiu->useage_id = $uData['useage_id']; $eiu->useage_id = $uData['useage_id'];
$eiu->save(); $eiu->save();
} }
return $inv; return $inv;
} }
...@@ -301,17 +301,16 @@ class Invoice extends Base ...@@ -301,17 +301,16 @@ class Invoice extends Base
->where('epib.balance','>',0) ->where('epib.balance','>',0)
->where('epi.invoice_id','=',$invoice_id)->select(); ->where('epi.invoice_id','=',$invoice_id)->select();
//如果没有找到记录 证明并没有形成对应关系 //如果没有找到记录 证明并没有形成对应关系
if($payments->isEmpty()) { if($payments->isEmpty()){
//查询是否有未缴费的缴费单存在 //查询是否有未缴费的缴费单存在
$payments = EmPayment::field('payment_id')->where('account_id','=',$account_id) $payments = EmPayment::field('payment_id')->where('account_id','=',$account_id)
->where('balance','neq',0) ->where('balance','>',0)
->whereIn('status','3,4,5,6,8')
->order('payment_id asc') ->order('payment_id asc')
->select(); ->select();
if($payments->isEmpty()) { if($payments->isEmpty()) {
return '没有销账的缴费单!'; return '没有销账的缴费单!';
} }
} }
$paymentIds = []; $paymentIds = [];
foreach ($payments as $payment){ foreach ($payments as $payment){
...@@ -388,34 +387,24 @@ class Invoice extends Base ...@@ -388,34 +387,24 @@ class Invoice extends Base
$result = 0; $result = 0;
foreach ($payments as $key => $payment){ foreach ($payments as $key => $payment){
if($payment->balance == 0) if($payment->balance == 0) continue;
continue;
foreach ($invs as $index => $inv) { foreach ($invs as $index => $inv) {
$balanceMode = new EmPaymentInvoiceBalance(); $balanceMode = new EmPaymentInvoiceBalance();
$balanceMode->payment_id = $payment->payment_id; $balanceMode->payment_id = $payment->payment_id;
if ($inv->payment_balance == 0) if ($inv->payment_balance == 0) continue;
continue;
$balanceMode->invoice_id = $inv->invoice_id; $balanceMode->invoice_id = $inv->invoice_id;
//如果该缴费单可以完全消除当前账单额度 //如果该缴费单可以完全消除当前账单额度
if ($payment->balance >= $inv->payment_balance) { if ($payment->balance >= $inv->payment_balance) {
//单笔销账多少 //单笔销账多少
$balanceMode->balance = $inv->payment_balance; $balanceMode->balance = $inv->payment_balance;
//缴费额度变化
if(($payment->balance - $inv->payment_balance) == 0){
$payment->status = 4;
} else {
$payment->status = 4; //缴费部分销账
}
$payment->balance = $payment->balance - $inv->payment_balance; $payment->balance = $payment->balance - $inv->payment_balance;
//账单额度变化 //账单额度变化
$inv->payment_balance = 0; $inv->payment_balance = 0;
//更新账户status 首字母 = 2 //更新账户status 首字母 = 2
$inv->status = setInvoiceStatus($inv->status, 2); $inv->status = setInvoiceStatus($inv->status, 2);
} else { } else {
//单笔销账多少 //单笔销账多少
$balanceMode->balance = $payment->balance; $balanceMode->balance = $payment->balance;
...@@ -425,10 +414,11 @@ class Invoice extends Base ...@@ -425,10 +414,11 @@ class Invoice extends Base
$inv->payment_balance = $inv->payment_balance - $payment->balance; $inv->payment_balance = $inv->payment_balance - $payment->balance;
//缴费额度变化 //缴费额度变化
$payment->balance = 0; $payment->balance = 0;
$payment->status = 4; //缴费已经完全销账
} }
$model = new EmPaymentInvoice();
if(!$model->where(['payment_id'=>$payment->payment_id,'invoice_id'=>$inv->invoice_id])->find()){ //查找是否已经存在相关联的账单关系
$model = (new EmPaymentInvoice())->where(['payment_id'=>$payment->payment_id,'invoice_id'=>$inv->invoice_id])->find();
if(!$model){
$model->payment_id = $payment->payment_id; $model->payment_id = $payment->payment_id;
$model->invoice_id = $inv->invoice_id; $model->invoice_id = $inv->invoice_id;
$model->save(); $model->save();
...@@ -437,28 +427,16 @@ class Invoice extends Base ...@@ -437,28 +427,16 @@ class Invoice extends Base
//更新账单状态 //更新账单状态
$inv->save(); $inv->save();
//todo::history; 保存历史记录
$invData = $inv->toArray();
$invData['id'] = null;
$invData['create_time'] = strtotime($invData['create_time']);
$invData['update_time'] = strtotime($invData['update_time']);
//EmInvoiceHistory::create($invData); //更新缴费状态
//unset($invs[$index]); //从结果集中去掉无效的数据
//更新状态
$payment->save(); $payment->save();
//todo::history;保存历史记录
$payData = $payment->toArray();
$payData['id'] = null;
$payData['create_time'] = strtotime($payData['create_time']);
$payData['update_time'] = strtotime($payData['update_time']);
$payData['pay_date'] = strtotime($payData['pay_date']);
//EmPaymentHistory::create($payData);
unset($payments[$key]); unset($payments[$key]);
$balanceMode->isUpdate(false)->save(); $balanceMode->isUpdate(false)->save();
//更新账户余额
$account = EmAccount::get(['account_id'=>$inv->account_id]);
$account->amount -= $balanceMode->balance;
$account->save();
} }
} }
$msg = $result == 0 ? '已审核,没有可销账的账单.' : '已审核,成功销账 '.$result.' 笔账单.'; $msg = $result == 0 ? '已审核,没有可销账的账单.' : '已审核,成功销账 '.$result.' 笔账单.';
......
<?php
namespace app\em\controller;
use app\admin\controller\Base;
use app\em\model\EmInvoice;
use app\em\model\EmPaymentReceipt;
use app\em\model\EmReceiptType;
use app\em\validate\AddReceiptValidate;
use think\facade\Request;
/**
* 缴费发票
* Class Receipt
* @package app\em\controller
*/
class Receipt extends Base
{
//显示缴费凭证表单
public function create(){
$payment_id = Request::param('payment_id');
//将缴费应缴金额传递给模板
$balance = (new EmInvoice())->alias('ei')
->leftJoin(['em_payment_invoice'=>'epi'],'epi.invoice_id=ei.invoice_id')
->where('epi.payment_id','=',$payment_id)
->where('ei.payment_balance','>',0)
->sum('ei.payment_balance');
$this->assign('balance',$balance?:0);
$this->assign('payment_id',$payment_id);
$types = EmReceiptType::select();
$this->assign('types',$types);
return $this->fetch();
}
public function store(){
$data = Request::post();
$validata = new AddReceiptValidate();
if(!$validata->check($data)){
return json(['status'=>0,'message'=>$validata->getError()]);
}
//获取certId
$data['receipt_id'] = $this->createReceiptId();
//保存凭证
$receiptModel = new EmPaymentReceipt();
if($receiptModel->save($data)){
//更新缴费单状态
return json(['status'=>1,'message'=>'上传发票成功']);
} else {
return json(['status'=>0,'message'=>'添加发票失败']);
}
}
//查看列表
public function receipts(){
$payment_id = Request::param('payment_id');
$list = EmPaymentReceipt::with('file,types')->where('payment_id','=',$payment_id)->order('receipt_id asc')->select();
foreach ($list as &$item){
if(!empty($item->file->src)){
$item->file->src = ltrim($item->file->src,'.');
}
}
$this->assign('data',$list);
return $this->fetch('list');
}
//创建凭证id
private function createReceiptId(){
$epr = EmPaymentReceipt::field('id')->order('id desc,create_time desc')->find();
if(!$epr) $id = 1;
else $id = $epr->id + 1;
return "RT".date('Ymd').zero($id);
}
}
\ No newline at end of file
...@@ -9,7 +9,6 @@ use app\em\model\Staff; ...@@ -9,7 +9,6 @@ use app\em\model\Staff;
use app\em\model\Station; use app\em\model\Station;
use app\em\model\UseageDetail; use app\em\model\UseageDetail;
use app\em\validate\UseageGeneralInfoValidate; use app\em\validate\UseageGeneralInfoValidate;
use think\Db;
use think\facade\Request; use think\facade\Request;
use think\facade\Session; use think\facade\Session;
...@@ -310,16 +309,9 @@ class Useage extends Base ...@@ -310,16 +309,9 @@ class Useage extends Base
return true; return true;
} }
//审核 //审核
public function verify($usage_id,$status=2){ public function verify($usage_id,$status=2){
$user = Session::get('user'); $user = Session::get('user');
$cModel = new EmCheckBill(); (new EmCheckBill)->check(Request::param('refuseInfo'),$user['user_id'],Request::controller(),$usage_id,$status);
$cModel->info = Request::param('refuseInfo');
$cModel->uid = $user['user_id'];
$cModel->mode = 'useage';
$cModel->mode_id = $usage_id;
$cModel->status = $status;
$cModel->save();
} }
} }
\ No newline at end of file
<?php <?php
namespace app\em\model; namespace app\em\model;
class EmCheckBill extends Base class EmCheckBill extends Base
{ {
public function check($info,$uid,$mode,$mode_id,$status){
$this->info = $info;
$this->uid = $uid;
$this->mode = $mode;
$this->mode_id = $mode_id;
$this->status = $status;
$this->save();
}
} }
\ No newline at end of file
...@@ -116,7 +116,7 @@ class EmInvoice extends Base ...@@ -116,7 +116,7 @@ class EmInvoice extends Base
$eiu = EmInvoiceUseage::where(['invoice_id'=>$inv->invoice_id])->find(); $eiu = EmInvoiceUseage::where(['invoice_id'=>$inv->invoice_id])->find();
//查询抄表信息 //查询抄表信息
$useage = Useage::get(['useage_id'=>$eiu->useage_id]); $useage = Useage::with('photo')->get(['useage_id'=>$eiu->useage_id]);
if($useage->photo_id) { if($useage->photo_id) {
$receipt = Receipt::get(['id'=>$useage->photo_id]); $receipt = Receipt::get(['id'=>$useage->photo_id]);
......
<?php <?php
namespace app\em\model; namespace app\em\model;
use app\em\controller\Payment;
class EmPayment extends Base class EmPayment extends Base
{ {
protected $table = 'em_payment'; protected $table = 'em_payment';
public function getPayDateAttr($val){ public function getPayDateAttr($val){
if($val =='' || $val == 0){
return '尚未付款';
}
return date('Y-m-d H:i:s',$val); return date('Y-m-d H:i:s',$val);
} }
public function setPayDateAttr($val){ public function setPayDateAttr($val){
...@@ -18,18 +22,12 @@ class EmPayment extends Base ...@@ -18,18 +22,12 @@ class EmPayment extends Base
//先找到账单 //先找到账单
$data = self::alias('pay') $data = self::alias('pay')
->field('pay.*') ->field('pay.*')
->field('case pay.status
when 0 then "未缴费"
when 1 then "已缴费"
when 2 then "已上传发票"
when 3 then "凭证完整"
when 4 then "已审核"
end as status')
->field('epi.invoice_id') ->field('epi.invoice_id')
->field('em.em_numb') ->field('em.em_numb')
->field('r.region_name,station.station_name') ->field('r.region_name,station.station_name')
->leftJoin(['em_account'=>'ea'],'ea.account_id=pay.account_id')
->leftJoin(['em_payment_invoice'=>'epi'],'epi.payment_id = pay.payment_id') ->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(['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')
...@@ -39,10 +37,30 @@ class EmPayment extends Base ...@@ -39,10 +37,30 @@ class EmPayment extends Base
->select() ->select()
->toarray(); ->toarray();
$data2 = self::alias('pay')
->field('pay.*')
->field('em.em_numb,r.region_name,station.station_name')
->leftJoin(['em_account'=>'ea'],'ea.account_id=pay.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')
->page($Nowpage, $limits)
->select()
->toarray();
$data = array_merge($data,$data2);
$sortKey = [];
foreach ($data as $k=>$item){ foreach ($data as $k=>$item){
$data[$k]['amount'] = round($data[$k]['amount'],3); $data[$k]['amount'] = round($data[$k]['amount'],2);
$data[$k]['status'] = Payment::PAYMENT_STATUS[$item['status']];
$data[$k]['payment_type'] = Payment::PAYMENT_TYPE[$item['payment_type']];
$sortKey[$k] = $item['create_time'];
} }
array_multisort($sortKey, SORT_DESC, $data);
return $data; return $data;
} }
public function getPaymentCount($map){ public function getPaymentCount($map){
...@@ -50,16 +68,29 @@ class EmPayment extends Base ...@@ -50,16 +68,29 @@ class EmPayment extends Base
//先找到账单 //先找到账单
$data = self::alias('pay') $data = self::alias('pay')
->field('pay.*') ->field('pay.*')
->field('epi.invoice_id')
->field('em.em_numb') ->field('em.em_numb')
->field('r.region_name') ->field('r.region_name,station.station_name')
->join(['em_account'=>'ea'],'ea.account_id=pay.account_id')
->leftJoin(['em_payment_invoice'=>'epi'],'epi.payment_id = pay.payment_id') ->leftJoin(['em_payment_invoice'=>'epi'],'epi.payment_id = pay.payment_id')
->join(['em'],'em.id=ea.em_id') ->leftJoin(['em_invoice'=>'ei'],'ei.invoice_id=epi.invoice_id')
->join(['station_info'=>'station'],'station.station_id=em.station_id') ->leftJoin(['em_account'=>'ea'],'ea.account_id=ei.account_id')
->join(['region'=>'r'],'station.area_id = r.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) ->where($map)
->count(); ->count();
return $data;
$data2 = self::alias('pay')
->field('pay.*')
->field('em.em_numb,r.region_name,station.station_name')
->leftJoin(['em_account'=>'ea'],'ea.account_id=pay.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();
return intval($data + $data2);
} }
//通过缴费单id返回缴费单关联账单信息 //通过缴费单id返回缴费单关联账单信息
public function getinvsInfo($payment_id){ public function getinvsInfo($payment_id){
...@@ -74,7 +105,7 @@ class EmPayment extends Base ...@@ -74,7 +105,7 @@ class EmPayment extends Base
$invModel = new EmInvoice(); $invModel = new EmInvoice();
$invs = $invModel->alias('inv') $invs = $invModel->alias('inv')
->field('inv.*') ->field('inv.*')
->field('station.station_name') ->field('station.station_name,station.proj_number')
->field('em.em_numb') ->field('em.em_numb')
->leftJoin(['em_invoice_useage'=>'eiu'],'eiu.invoice_id=inv.invoice_id') ->leftJoin(['em_invoice_useage'=>'eiu'],'eiu.invoice_id=inv.invoice_id')
->leftJoin(['em_useage'=>'eu'],'eu.useage_id = eiu.useage_id') ->leftJoin(['em_useage'=>'eu'],'eu.useage_id = eiu.useage_id')
......
<?php
/**
* Created by PhpStorm.
* User: chouchou
* Date: 2020-3-31
* Time: 0:54
*/
namespace app\em\model;
class EmPaymentAccount extends Base
{
}
\ No newline at end of file
<?php
namespace app\em\model;
class EmPaymentMonthly extends Base
{
public function getCurrentMonthly($em_id){
$data = self::field('month')->where('em_id','=',$em_id)->order('id desc')->find();
return isset($data->month) ? $data->month : 0;
}
}
\ No newline at end of file
<?php
namespace app\em\validate;
use think\Validate;
class AddFkInfoDetailsValidate extends Validate
{
protected $rule = [
'cbzxid' => 'require',
'amount' => 'require'
];
protected $message = [
'cbzxid.require' => '成本中心编码不存在',
'amount.require' => '付款金额不能为空'
];
}
\ No newline at end of file
<?php
namespace app\em\validate;
use think\Validate;
class AddFkInfoValidate extends Validate
{
protected $rule = [
'title' => 'require',
'info' => 'require',
'date' => 'require|date'
];
protected $message = [
'title.require' => '标题不能为空',
'info.require' => '付款信息不能为空,请选择收款方之后自动补充付款信息,如果选择收款方之后付款信息依然为空,则需要通过OA补充收款方的付款信息',
'date.require' => '日期不能为空',
'date.date' => '日期格式不正确'
];
}
\ No newline at end of file
...@@ -121,18 +121,14 @@ ...@@ -121,18 +121,14 @@
<span class="x-red">*</span>抄表单照片 <span class="x-red">*</span>抄表单照片
</label> </label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<!-- <button type="button" class="layui-btn" id="up_photo"> {if $inv.useage.photo.src == ''}
<i class="layui-icon"></i>上传 <input type="text"
</button> --> autocomplete="off" class="layui-input layui-no-border" value="未上传抄表照片" disabled="disabled">
<input type="hidden" name="photo_id" value="{$inv.em.photo.id|default=''}">
{if !isset($inv.em.photo.id) || $inv.em.photo.id == ''}
未上传抄表照片
{else /} {else /}
<a href="{$inv.em.photo.src}" class='layui-btn' target="_blank" > <a href="{$inv.useage.photo.src}" class='layui-btn' target="_blank" >
<i class="layui-icon">&#xe64a;</i>预览 <i class="layui-icon">&#xe64a;</i>预览
</a> </a>
{/if} {/if}
</div> </div>
</div> </div>
</div> </div>
...@@ -280,19 +276,6 @@ ...@@ -280,19 +276,6 @@
}); });
} }
laydate.render({
elem:'#last_date',
trigger:'click',
format:'yyyy-MM-dd HH:mm:ss'
})
laydate.render({
elem:'#current_date',
value:new Date(),
trigger:'click',
format:'yyyy-MM-dd HH:mm:ss'
})
//查看缴费详情 //查看缴费详情
form.on('submit(paymentsDetail)', form.on('submit(paymentsDetail)',
function (data) { function (data) {
......
...@@ -17,7 +17,17 @@ ...@@ -17,7 +17,17 @@
</div> </div>
<div class="layui-form-body"> <div class="layui-form-body">
<div class="layui-row"> <div class="layui-row">
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
账户金额:
</label>
<div class="layui-input-inline">
<input type="text" name="tmp" value="{$account.amount}" disabled="disabled" class="layui-input">
</div>
</div>
</div>
<div class="layui-col-md5"> <div class="layui-col-md5">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label layui-text-left"> <label class="layui-form-label layui-text-left">
......
{extend name="public:base" /}
{block name="body"}
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<form class="layui-form">
<!--缴费-->
<div class="layui-form-box">
<div class="layui-form-head">
<div class="layui-form-item">
<label class="layui-form-label">
填写缴费信息
</label>
</div>
</div>
<div class="layui-form-body">
<div class="layui-row">
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
缴费金额:
</label>
<div class="layui-input-inline">
<input type="text" name="amount" id="paid_totle"
class="layui-input no-border" disabled="disabled">
</div>
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
缴费员:
</label>
<div class="layui-input-inline">
<select name="staff_id">
{foreach $staffs as $u}
<option value="{$u['id']}"}>{$u['name']}</option>
{/foreach}
</select>
</div>
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
缴费凭证:
</label>
<div class="layui-input-inline">
<a class="layui-btn layui-btn-normal layui-right" lay-submit lay-filter="showCert" οnclick="return false;">查看</a>
<button class="layui-btn layui-btn-normal layui-right" lay-submit lay-filter="addCert" οnclick="return false;"><i class="layui-icon layui-icon-add-circle-fine"></i></button>
</div>
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
发票凭证:
</label>
<div class="layui-input-inline">
<a class="layui-btn layui-btn-normal layui-right" lay-submit lay-filter="showReceipt" οnclick="return false;">查看</a>
<button class="layui-btn layui-btn-normal layui-right" lay-submit lay-filter="addReceipt" οnclick="return false;"><i class="layui-icon layui-icon-add-circle-fine"></i></button>
</div>
</div>
</div>
</div>
<div class="layui-form-item layui-col-md-offset4">
<button class="layui-btn" lay-filter="save" lay-submit="">保存</button>
</div>
</div>
</div>
<!--缴费结束-->
</form>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
//限制输入长度
function sliceDom(dom,len){
if(dom.value.length>len)
return dom.value = dom.value.slice(0,len)
}
//初始化Layui控件
layui.use(['form', 'layer', 'laydate', 'upload'],
function () {
$ = layui.jquery;
var form = layui.form,
layer = layui.layer,
laydate = layui.laydate,
upload = layui.upload;
//消息提示
function layMsg(msg,type=6,time=1000){
layer.msg(msg,{
icon: type,
time: time,
});
}
form.on('submit(submit)',
function (data) {
$.ajax({
url: '/payment/update',
method: "POST",
data: data.field,
dataType: "json",
success: function (data) {
if (data.status == 1) {
layer.msg(data.message,{icon: 6,time: 1000})
} else {
layer.msg(data.message,{icon: 5,time: 1000 })
}
}
});
return false;
});
//保存信息
form.on('submit(save)',
function (data) {
$.ajax({
url: '/payment/save',
method: "POST",
data: data.field,
dataType: "json",
success: function (data) {
if (data.status == 1) {
layer.msg(data.message,{icon: 6,time: 1000})
} else {
layer.msg(data.message,{icon: 5,time: 1000 })
}
}
});
return false;
});
//上传电表照片
var upPhoto = upload.render({
elem: '#up_photo' ,
url: '/up_photo',
field: 'cp_photo',
done: function (res) {
if(res.status == 1){
layMsg(res.message)
//将电表照片的ID填写
var $photoId = $("input[name='photo_id']")
$photoId.val(res.data.id)
var $a = $photoId.next('a');
$a.removeClass('layui-hide')
$a.attr('href',res.data.src);
}
else {
layMsg(res.message,5)
return;
}
}
});
});
</script>
{/block}
\ No newline at end of file
{extend name="public:base" /}
{block name="body"}
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<form class="layui-form">
<!--缴费-->
<div class="layui-form-box">
<div class="layui-form-head">
<div class="layui-form-item">
<label class="layui-form-label">
缴费详情
</label>
</div>
</div>
<div class="layui-form-body">
<div class="layui-row">
<input type="hidden" name="em_id" value="{$em.id}">
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
电表号:
</label>
<div class="layui-input-inline">
<input type="text" name="em_numb" autocomplete="off"
class="layui-input no-border" value="{$em.em_numb}" disabled="disabled">
</div>
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
缴费单号:
</label>
<div class="layui-input-inline">
<input type="text" name="payment_id" autocomplete="off"
class="layui-input no-border" value="{$payment.payment_id}" disabled="disabled">
</div>
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
缴费金额:
</label>
<div class="layui-input-inline">
<input type="text" name="amount" id="amount"
class="layui-input" >
</div>
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
缴费日期:
</label>
<div class="layui-input-inline">
<input type="text" name="pay_date" id="pay_date"
class="layui-input" >
</div>
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
缴费员:
</label>
<div class="layui-input-inline">
<select name="staff_id">
{foreach $staffs as $u}
<option value="{$u['id']}"}>{$u['name']}</option>
{/foreach}
</select>
</div>
</div>
</div>
</div>
<div class="layui-form-item layui-col-md-offset4">
<button class="layui-btn" lay-filter="save" lay-submit="">
保存
</button>
</div>
</div>
</div>
<!--缴费结束-->
</form>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
//限制输入长度
function sliceDom(dom,len){
if(dom.value.length>len)
return dom.value = dom.value.slice(0,len)
}
//初始化Layui控件
layui.use(['form', 'layer', 'laydate', 'upload'],
function () {
$ = layui.jquery;
var form = layui.form,
layer = layui.layer,
laydate = layui.laydate,
upload = layui.upload;
//消息提示
function layMsg(msg,type=6,time=1000){
layer.msg(msg,{
icon: type,
time: time,
});
}
laydate.render({
elem:'#pay_date',
trigger:'click',
})
//审核通过
form.on('submit(save)',
function (data) {
$.ajax({
url: '/payment/save',
method: "POST",
data: data.field,
dataType: "json",
success: function (data) {
if (data.status == 1) {
layer.msg(data.message,{icon: 6,time: 1000})
} else {
layer.msg(data.message,{icon: 5,time: 1000 })
}
}
});
return false;
});
//上传电表照片
var upPhoto = upload.render({
elem: '#up_photo' ,
url: '/up_photo',
field: 'cp_photo',
done: function (res) {
if(res.status == 1){
layMsg(res.message)
//将电表照片的ID填写
var $photoId = $("input[name='photo_id']")
$photoId.val(res.data.id)
var $a = $photoId.next('a');
$a.removeClass('layui-hide')
$a.attr('href',res.data.src);
}
else {
layMsg(res.message,5)
return;
}
}
});
});
</script>
{/block}
\ No newline at end of file
...@@ -66,18 +66,16 @@ ...@@ -66,18 +66,16 @@
</div> </div>
<div class="layui-card-body "> <div class="layui-card-body ">
<table class="layui-table" lay-data="{ url:'/payment', page:true, id:'idTest',where:{search_type:document.getElementById('search_type').value,search_text:document.getElementById('search_text').value,area_id:document.getElementById('area_id').value,date_start:document.getElementById('date_start').value,date_end:document.getElementById('date_end').value,payment_status:document.getElementById('payment_status').value} }"> <thead> <table class="layui-table" lay-data="{ url:'/payment', page:true, id:'idTest',where:{search_type:document.getElementById('search_type').value,search_text:document.getElementById('search_text').value,area_id:document.getElementById('area_id').value,date_start:document.getElementById('date_start').value,date_end:document.getElementById('date_end').value,payment_status:document.getElementById('payment_status').value} }"> <thead>
<tr> <tr>
<th lay-data="{templet: '#payment_id',sort: true} ">缴费单号</th> <th lay-data="{templet: '#payment_id',sort: true} ">缴费单号</th>
<th lay-data="{templet: '#invoice_id',sort: true}">账单号</th> <th lay-data="{field:'station_name',sort: true} ">站名</th>
<th lay-data="{field:'station_name'} ">所属站名</th> <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:'region_name'}">区域</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="{field: 'status',sort: true}">状态</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>
</thead> </thead>
</table> </table>
...@@ -92,13 +90,12 @@ ...@@ -92,13 +90,12 @@
<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>
<script type="text/html" id="invoice_id">
<a class="layui-link" title="查看账单" href="/invoice/{{d.invoice_id}}">{{d.invoice_id}}</a>
</script>
<script type="text/html" id="barDemo"> <script type="text/html" id="barDemo">
{{# if(d.status== '未缴费'){ }} <a class="layui-btn layui-btn-sm" title="查看详情" href="/payment/{{d.payment_id}}">详情</a>
<a title="作废" class="layui-btn layui-btn-sm layui-btn-danger layui-btn-disabled" href="/payment/del/{{d.payment_id}}">作废</a>
{{# } }} <!-- {{# if(d.status== '未缴费'){ }}-->
<!-- <a title="作废" class="layui-btn layui-btn-sm layui-btn-danger layui-btn-disabled" href="/payment/del/{{d.payment_id}}">作废</a>-->
<!-- {{# } }}-->
</script> </script>
<script> <script>
layui.use(['laydate','form','table'], function(){ layui.use(['laydate','form','table'], function(){
......
...@@ -36,38 +36,39 @@ ...@@ -36,38 +36,39 @@
汇款方式: 汇款方式:
</label> </label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<select name="payType" id="payType"> <select name="payway" id="payway">
{volist name="payType" id="item"} {volist name="payway" id="item"}
<option value="{$item.name}">{$item.name}</option> <option value="{$item.name}">{$item.name}</option>
{/volist} {/volist}
</select> </select>
</div> </div>
</div> </div>
</div> </div>
<div class="layui-col-md5"> <div class="layui-col-md5">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label layui-text-left"> <label class="layui-form-label layui-text-left">
收款方: 付款组织:
</label> </label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<select name="payee" id="payee" lay-filter="change"> <select name="org" id="org">
{volist name="payee" id="item"} {volist name="org" id="item"}
<option value="{$item.name}" data-info='{$item.bankInfo|default=' <option value="{$item.name}">{$item.name}</option>
'}'>{$item.name}</option> {/volist}
{/volist}
</select> </select>
</div> </div>
</div> </div>
</div> </div>
<div class="layui-col-md5"> <div class="layui-col-md5">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label layui-text-left"> <label class="layui-form-label layui-text-left">
付款组织: 收款方:
</label> </label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<select name="payOrg" id="payOrg"> <select name="payee" id="payee" lay-filter="change">
{volist name="payOrg" id="item"} {volist name="payee" id="item"}
<option value="{$item.name}">{$item.name}</option> <option value="{$item.name}" data-info='{$item.bankInfo|default=""}'>{$item.name}</option>
{/volist} {/volist}
</select> </select>
</div> </div>
...@@ -90,22 +91,54 @@ ...@@ -90,22 +91,54 @@
付款信息: 付款信息:
</label> </label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<textarea class="layui-textarea" name="fkinfo" id="fkinfo"></textarea> <textarea class="layui-textarea" name="info" id="info"></textarea>
</div> </div>
</div> </div>
</div> </div>
<div class="layui-col-md5"> <div class="layui-col-md5">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label layui-text-left"> <label class="layui-form-label layui-text-left">
备注: 付款事由:
</label> </label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<textarea class="layui-textarea" name="remark" id="remark"></textarea> <textarea class="layui-textarea" name="cause" id="remark">电费付款</textarea>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="layui-col-md10">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
款项明细:
</label>
</div>
</div>
<div class="layui-col-md10">
<table class="layui-table layui-form">
<thead>
<tr>
<th>账单号</th>
<th>款项类型</th>
<th>金额</th>
<th>成本中心</th>
</thead>
<tbody>
{volist name="invs" id="item"}
<tr>
<td>{$item.invoice_id}</td>
<td>维护电费</td>
<td>{$item.payment_amount}</td>
<td>{$item.proj_number}</td>
</tr>
{/volist}
</tbody>
</table>
</div>
<div class="layui-form-item layui-col-md-offset4"> <div class="layui-form-item layui-col-md-offset4">
<button class="layui-btn" lay-filter="submit" lay-submit=""> <button class="layui-btn" lay-filter="submit" lay-submit="">
创建 创建
...@@ -114,6 +147,7 @@ ...@@ -114,6 +147,7 @@
</div> </div>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
...@@ -134,21 +168,13 @@ ...@@ -134,21 +168,13 @@
form.on('select(change)', function (data) { form.on('select(change)', function (data) {
var that = $(data.elem); var that = $(data.elem);
var info = that.find('option:selected').data('info'); var info = that.find('option:selected').data('info');
$("#fkinfo").text(info); $("#info").text(info);
}); });
laydate.render({ laydate.render({
elem: '#date', elem: '#date',
trigger: 'click', trigger: 'click',
}); });
//消息提示
function layMsg(msg, type = 6, time = 1000) {
layer.msg(msg, {
icon: type,
time: time,
});
}
//生成缴费单 //生成缴费单
form.on('submit(submit)', form.on('submit(submit)',
function (data) { function (data) {
......
...@@ -205,7 +205,7 @@ ...@@ -205,7 +205,7 @@
</div> </div>
{if $detail == false} {if $detail == false}
<div class="layui-form-item layui-col-md-offset4"> <div class="layui-form-item layui-col-md-offset4">
<a href="/useage/" class="layui-btn"> <a href="/useage" class="layui-btn">
返回 返回
</a> </a>
<button class="layui-btn" lay-filter="save" lay-submit=""> <button class="layui-btn" lay-filter="save" lay-submit="">
......
...@@ -187,7 +187,8 @@ ...@@ -187,7 +187,8 @@
</label> </label>
<div class="layui-input-inline"> <div class="layui-input-inline">
{if $useage.photo.src== ''} {if $useage.photo.src== ''}
<div style="line-height: 20px;padding: 9px 15px;">未上传凭证</div> <input type="text" class="layui-input layui-no-border" disabled="disabled" value="未上传凭证">
{else /} {else /}
<a href="{$useage.photo.src}" target="_blank" class="layui-btn" disabled="disabled"> <a href="{$useage.photo.src}" target="_blank" class="layui-btn" disabled="disabled">
<i class="layui-icon">&#xe64a;</i>预览 <i class="layui-icon">&#xe64a;</i>预览
...@@ -238,7 +239,7 @@ ...@@ -238,7 +239,7 @@
function (data) { function (data) {
$(this).addClass('layui-disabled'); $(this).addClass('layui-disabled');
$(this).attr('disabled','disabled'); $(this).attr('disabled','disabled');
data.checkType = 1; data.field.checkType = 1;
$.ajax({ $.ajax({
url: '/useage/check', url: '/useage/check',
method: "POST", method: "POST",
......
<?php
//配置文件
return [
//加密串
'passwd_salt' => 'gonn',
'passwd_init' => 'gonn',
'encrypt_key' => 'INJq4HXEGI',
'login_pattern' => '/^\w{2,}@\w+/', //开放模式
//'login_pattern' => '/^\w{2,}@gonn\.com\.cn$', 严格模式
'upload_dir' => './static/uploads',
'images_dir' => './static/uploads/images',
'files_dir' => './static/uploads/files',
'search_area' => '1', //1按部门搜索,2全局
'order_per' =>'ZD',
'redis_host' => '192.168.1.71',
'redis_port' => 6379,
'base_url' => 'http://chengye-dev.gonn.tech/'
];
<?php <?php
return [ return [
'oa_key' => '5bdfcedb618e1e03abf18e391278c1f4', 'oa_key' => '5bdfcedb618e1e03abf18e391278c1f4',
'base_url' => 'http://oa-test.gonn.tech', 'base_url' => 'http://chengye-dev.gonn.tech/',
'gys' => '/api.php?m=opensupplier&a=list&openkey=', 'gys' => 'api.php?m=opensupplier&a=list&openkey=',
'type' => '/api.php?m=openfkinfo&a=fkinfor&openkey=', 'type' => 'api.php?m=openfkinfo&a=fkinfor&openkey=',
'fk' => '/api.php?m=openfk&a=create&openkey=', 'fk' => 'api.php?m=openemfk&a=create&openkey=',
'link'=>'/task.php?a=p&num=oayfk&mid=' 'link' => 'task.php?a=p&num=emfk&mid='
]; ];
...@@ -80,7 +80,7 @@ ul.station_flow li.active>*{ ...@@ -80,7 +80,7 @@ ul.station_flow li.active>*{
.no-border{ border: 0; width: 100%; line-height: 24px; background: none; } .no-border{ border: 0; width: 100%; line-height: 24px; background: none; }
.layui-no-border{border :0;}
/*二阶段*/ /*二阶段*/
.layui-pay-model{ .layui-pay-model{
...@@ -91,3 +91,32 @@ ul.station_flow li.active>*{ ...@@ -91,3 +91,32 @@ ul.station_flow li.active>*{
} }
.layui-width-auto{width: 65px; display: inline-block;} .layui-width-auto{width: 65px; display: inline-block;}
.layui-color-orange{color:#FFB800;}
.layui-color-red{color:#FF5722;}
.layui-color-green{color:#5FB878;}
.layui-color-cyan{color:#393D49;}
.layui-color-blue{color:#1E9FFF;}
.layui-color-black{color:#2F4056;}
.layui-color-gray{color:#c2c2c2;}
.layui-form-label{
padding:6px 10px;
}
.layui-input-inline>a{
padding:6px 10px;
display: inline-block;
}
.layui-font-bold{
font-weight: 700;
}
.layui-form-item input[tyle=text]{
border:none;
border-bottom: 1px solid #c2c2c2;
padding-left: 0;
padding-right: 0;
}
.layui-form-mid{
padding:7px 0 !important;
}
\ No newline at end of file
...@@ -170,6 +170,7 @@ Route::post('payment/save','em/payment/store'); ...@@ -170,6 +170,7 @@ Route::post('payment/save','em/payment/store');
Route::post('payment/confirm','em/payment/confirm'); Route::post('payment/confirm','em/payment/confirm');
Route::get('payment/payoa/:payment_id','em/payment/payoa'); Route::get('payment/payoa/:payment_id','em/payment/payoa');
Route::post('payment/docnumb','em/payment/docnumb'); Route::post('payment/docnumb','em/payment/docnumb');
Route::post('payment/checkPayment','em/payment/checkPayment');
//结算 //结算
Route::get('settle','em/settle/index'); Route::get('settle','em/settle/index');
......
...@@ -30,4 +30,7 @@ Route::get('/v1/customers','api/v1.supplier.Assign/getCustomers'); //上游客 ...@@ -30,4 +30,7 @@ Route::get('/v1/customers','api/v1.supplier.Assign/getCustomers'); //上游客
//基站状态 //基站状态
Route::get('/v1/basestate','api/v1.supplier.Assign/getBasestate'); //基站状态信息 Route::get('/v1/basestate','api/v1.supplier.Assign/getBasestate'); //基站状态信息
Route::get('/v1/permission','api/v1.supplier.Assign/getDataPermission'); //获取项目数据权限 Route::get('/v1/permission','api/v1.supplier.Assign/getDataPermission'); //获取项目数据权限
\ No newline at end of file
//电费
Route::get('/v2/payment','api/v2.common.Payment/index'); //缴费接口
\ No newline at end of file
deny from all
\ No newline at end of file
如何贡献我的源代码
===
此文档介绍了 ThinkPHP 团队的组成以及运转机制,您提交的代码将给 ThinkPHP 项目带来什么好处,以及如何才能加入我们的行列。
## 通过 Github 贡献代码
ThinkPHP 目前使用 Git 来控制程序版本,如果你想为 ThinkPHP 贡献源代码,请先大致了解 Git 的使用方法。我们目前把项目托管在 GitHub 上,任何 GitHub 用户都可以向我们贡献代码。
参与的方式很简单,`fork`一份 ThinkPHP 的代码到你的仓库中,修改后提交,并向我们发起`pull request`申请,我们会及时对代码进行审查并处理你的申请并。审查通过后,你的代码将被`merge`进我们的仓库中,这样你就会自动出现在贡献者名单里了,非常方便。
我们希望你贡献的代码符合:
* ThinkPHP 的编码规范
* 适当的注释,能让其他人读懂
* 遵循 Apache2 开源协议
**如果想要了解更多细节或有任何疑问,请继续阅读下面的内容**
### 注意事项
* 本项目代码格式化标准选用 [**PSR-2**](http://www.kancloud.cn/thinkphp/php-fig-psr/3141)
* 类名和类文件名遵循 [**PSR-4**](http://www.kancloud.cn/thinkphp/php-fig-psr/3144)
* 对于 Issues 的处理,请使用诸如 `fix #xxx(Issue ID)` 的 commit title 直接关闭 issue。
* 系统会自动在 PHP 5.4 5.5 5.6 7.0 和 HHVM 上测试修改,其中 HHVM 下的测试容许报错,请确保你的修改符合 PHP 5.4 ~ 5.6 和 PHP 7.0 的语法规范;
* 管理员不会合并造成 CI faild 的修改,若出现 CI faild 请检查自己的源代码或修改相应的[单元测试文件](tests)
## GitHub Issue
GitHub 提供了 Issue 功能,该功能可以用于:
* 提出 bug
* 提出功能改进
* 反馈使用体验
该功能不应该用于:
* 提出修改意见(涉及代码署名和修订追溯问题)
* 不友善的言论
## 快速修改
**GitHub 提供了快速编辑文件的功能**
1. 登录 GitHub 帐号;
2. 浏览项目文件,找到要进行修改的文件;
3. 点击右上角铅笔图标进行修改;
4. 填写 `Commit changes` 相关内容(Title 必填);
5. 提交修改,等待 CI 验证和管理员合并。
**若您需要一次提交大量修改,请继续阅读下面的内容**
## 完整流程
1. `fork`本项目;
2. 克隆(`clone`)你 `fork` 的项目到本地;
3. 新建分支(`branch`)并检出(`checkout`)新分支;
4. 添加本项目到你的本地 git 仓库作为上游(`upstream`);
5. 进行修改,若你的修改包含方法或函数的增减,请记得修改[单元测试文件](tests)
6. 变基(衍合 `rebase`)你的分支到上游 master 分支;
7. `push` 你的本地仓库到 GitHub;
8. 提交 `pull request`
9. 等待 CI 验证(若不通过则重复 5~7,GitHub 会自动更新你的 `pull request`);
10. 等待管理员处理,并及时 `rebase` 你的分支到上游 master 分支(若上游 master 分支有修改)。
*若有必要,可以 `git push -f` 强行推送 rebase 后的分支到自己的 `fork`*
*绝对不可以使用 `git push -f` 强行推送修改到上游*
### 注意事项
* 若对上述流程有任何不清楚的地方,请查阅 GIT 教程,如 [这个](http://backlogtool.com/git-guide/cn/)
* 对于代码**不同方面**的修改,请在自己 `fork` 的项目中**创建不同的分支**(原因参见`完整流程`第9条备注部分);
* 变基及交互式变基操作参见 [Git 交互式变基](http://pakchoi.me/2015/03/17/git-interactive-rebase/)
## 推荐资源
### 开发环境
* XAMPP for Windows 5.5.x
* WampServer (for Windows)
* upupw Apache PHP5.4 ( for Windows)
或自行安装
- Apache / Nginx
- PHP 5.4 ~ 5.6
- MySQL / MariaDB
*Windows 用户推荐添加 PHP bin 目录到 PATH,方便使用 composer*
*Linux 用户自行配置环境, Mac 用户推荐使用内置 Apache 配合 Homebrew 安装 PHP 和 MariaDB*
### 编辑器
Sublime Text 3 + phpfmt 插件
phpfmt 插件参数
```json
{
"autocomplete": true,
"enable_auto_align": true,
"format_on_save": true,
"indent_with_space": true,
"psr1_naming": false,
"psr2": true,
"version": 4
}
```
或其他 编辑器 / IDE 配合 PSR2 自动格式化工具
### Git GUI
* SourceTree
* GitHub Desktop
或其他 Git 图形界面客户端
ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
版权所有Copyright © 2006-2018 by ThinkPHP (http://thinkphp.cn)
All rights reserved。
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
Apache Licence是著名的非盈利开源组织Apache采用的协议。
该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,
允许代码修改,再作为开源或商业软件发布。需要满足
的条件:
1. 需要给代码的用户一份Apache Licence ;
2. 如果你修改了代码,需要在被修改的文件中说明;
3. 在延伸的代码中(修改和有源代码衍生的代码中)需要
带有原来代码中的协议,商标,专利声明和其他原来作者规
定需要包含的说明;
4. 如果再发布的产品中包含一个Notice文件,则在Notice文
件中需要带有本协议内容。你可以在Notice中增加自己的
许可,但不可以表现为对Apache Licence构成更改。
具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
![](https://box.kancloud.cn/5a0aaa69a5ff42657b5c4715f3d49221)
ThinkPHP 5.1(LTS) —— 12载初心,你值得信赖的PHP框架
===============
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/top-think/framework/badges/quality-score.png?b=5.1)](https://scrutinizer-ci.com/g/top-think/framework/?branch=5.1)
[![Build Status](https://travis-ci.org/top-think/framework.svg?branch=master)](https://travis-ci.org/top-think/framework)
[![Total Downloads](https://poser.pugx.org/topthink/framework/downloads)](https://packagist.org/packages/topthink/framework)
[![Latest Stable Version](https://poser.pugx.org/topthink/framework/v/stable)](https://packagist.org/packages/topthink/framework)
[![PHP Version](https://img.shields.io/badge/php-%3E%3D5.6-8892BF.svg)](http://www.php.net/)
[![License](https://poser.pugx.org/topthink/framework/license)](https://packagist.org/packages/topthink/framework)
ThinkPHP5.1对底层架构做了进一步的改进,减少依赖,其主要特性包括:
+ 采用容器统一管理对象
+ 支持Facade
+ 更易用的路由
+ 注解路由支持
+ 路由跨域请求支持
+ 验证类增强
+ 配置和路由目录独立
+ 取消系统常量
+ 类库别名机制
+ 模型和数据库增强
+ 依赖注入完善
+ 支持PSR-3日志规范
+ 中间件支持(`V5.1.6+`
+ 支持`Swoole`/`Workerman`运行(`V5.1.18+`
官方已经正式宣布`5.1.27`版本为LTS版本。
### 废除的功能:
+ 聚合模型
+ 内置控制器扩展类
+ 模型自动验证
> ThinkPHP5.1的运行环境要求PHP5.6+。
## 安装
使用composer安装
~~~
composer create-project topthink/think tp
~~~
启动服务
~~~
cd tp
php think run
~~~
然后就可以在浏览器中访问
~~~
http://localhost:8000
~~~
更新框架
~~~
composer update topthink/framework
~~~
## 在线手册
+ [完全开发手册](https://www.kancloud.cn/manual/thinkphp5_1/content)
+ [升级指导](https://www.kancloud.cn/manual/thinkphp5_1/354155)
## 命名规范
`ThinkPHP5.1`遵循PSR-2命名规范和PSR-4自动加载规范。
## 参与开发
请参阅 [ThinkPHP5 核心框架包](https://github.com/top-think/framework)
## 版权信息
ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
本项目包含的第三方源码和二进制文件之版权信息另行标注。
版权所有Copyright © 2006-2018 by ThinkPHP (http://thinkphp.cn)
All rights reserved。
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
更多细节参阅 [LICENSE.txt](LICENSE.txt)
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace think;
// 载入Loader类
require __DIR__ . '/library/think/Loader.php';
// 注册自动加载
Loader::register();
// 注册错误和异常处理机制
Error::register();
// 实现日志接口
if (interface_exists('Psr\Log\LoggerInterface')) {
interface LoggerInterface extends \Psr\Log\LoggerInterface
{}
} else {
interface LoggerInterface
{}
}
// 注册类库别名
Loader::addClassAlias([
'App' => facade\App::class,
'Build' => facade\Build::class,
'Cache' => facade\Cache::class,
'Config' => facade\Config::class,
'Cookie' => facade\Cookie::class,
'Db' => Db::class,
'Debug' => facade\Debug::class,
'Env' => facade\Env::class,
'Facade' => Facade::class,
'Hook' => facade\Hook::class,
'Lang' => facade\Lang::class,
'Log' => facade\Log::class,
'Request' => facade\Request::class,
'Response' => facade\Response::class,
'Route' => facade\Route::class,
'Session' => facade\Session::class,
'Url' => facade\Url::class,
'Validate' => facade\Validate::class,
'View' => facade\View::class,
]);
{
"name": "topthink/framework",
"description": "the new thinkphp framework",
"type": "think-framework",
"keywords": [
"framework",
"thinkphp",
"ORM"
],
"homepage": "http://thinkphp.cn/",
"license": "Apache-2.0",
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
},
{
"name": "yunwuxin",
"email": "448901948@qq.com"
}
],
"require": {
"php": ">=5.6.0",
"topthink/think-installer": "2.*"
},
"require-dev": {
"phpunit/phpunit": "^5.0|^6.0",
"johnkary/phpunit-speedtrap": "^1.0",
"mikey179/vfsStream": "~1.6",
"phploc/phploc": "2.*",
"sebastian/phpcpd": "2.*",
"squizlabs/php_codesniffer": "2.*",
"phpdocumentor/reflection-docblock": "^2.0"
}
}
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论