优化比例

master
chenzhi 5 years ago
parent 22aa5d3dd4
commit 4e4da92420

@ -160,7 +160,7 @@ class CompanyStatementController extends ThinkController
$v["confirm"] = '--';
}
if(isset($v['verify_log']['pool_user'])){
if($v['status'] == -2){
if($v['verify_status'] == -2){
$ts = "撤销汇总";
$v["pool"]= "{$ts}({$v['verify_log']['pool_user']}){$symbol} {$v['verify_log']['pool_time']}";
}else{
@ -492,9 +492,20 @@ class CompanyStatementController extends ThinkController
$company_info = $va['company_info'];
if($k == "up" || $k=="ups"){
$company_type = 1;
foreach ($va['statement_info'] as $key => &$value) {
if($company_info['pay_type'] == 2){
$value["ratio"] = $value["second_ratio"];
}else{
$value["ratio"] = $value["first_ratio"];
}
unset($value["first_ratio"]);
unset($value["second_ratio"]);
}
}else{
//下游
$company_type = 2;
}
$adddata=[
"pool_id"=>$pool_id,
"company_id"=>$company_info['id'],
@ -550,13 +561,15 @@ class CompanyStatementController extends ThinkController
}else{
if($v['pay_type'] == 2){
//乙方收款
$v['company_info'] = $v['second_party_info'];
$v['company_info'] =json_decode($v['second_party_info'],ture);
$v['company_info']['pay_type'] = 2;
}else{
$v['company_info'] = $v['first_party_info'];
$v['company_info'] = json_decode($v['first_party_info'],ture);
$v['company_info']['pay_type'] = 1;
}
//先分配好订单号,防止重复提交
$tdata = [
"company_info"=>json_decode($v['company_info'],ture),
"company_info"=>$v['company_info'],
"company_name"=>$v['company_name'],
"platform_amount"=>$v['platform_amount'],
"pay_amount"=>$v['pay_amount'],

@ -23,8 +23,8 @@ class CompanyStatementPoolController extends ThinkController
"0"=>"未审批",
"1"=>"审批通过",
"2"=>"待打款",
"3"=>"打款成功"
// "4"=>"打款成功"
"3"=>"打款中",
"4"=>"打款成功"
];
public $admininfo;
public $DBModel;
@ -130,6 +130,9 @@ class CompanyStatementPoolController extends ThinkController
$ts = "待打款";
$v["payment"]= "{$ts}({$v['verify_log']['payment_user']}){$symbol} {$v['verify_log']['payment_time']}";
}elseif($v['verify_status'] == 3){
$ts = "打款中";
$v["payment"]= "{$ts}({$v['verify_log']['payment_user']}){$symbol} {$v['verify_log']['payment_time']}";
}elseif($v['verify_status'] == 4){
if($v['is_payment']==1){
$ts="线上打款成功";
}else{
@ -161,14 +164,15 @@ class CompanyStatementPoolController extends ThinkController
}
//查看
public function viewStatement()
public function viewPool()
{
if(!isset($_REQUEST['id'])){
$this->error('参数错误');
}
$id = $_REQUEST['id'];
//获取基本信息
$dbres = M("CompanyStatement","tab_")->where("id='{$id}'")->find();
$dbres = $this->DBModel->where("id='{$id}'")->find();
$first_party_info = json_decode($dbres['first_party_info'],true);
$second_party_info = json_decode($dbres['second_party_info'],true);
$statement_info = json_decode($dbres['statement_info'],true);
@ -204,41 +208,7 @@ class CompanyStatementPoolController extends ThinkController
$this->display("viewPcStatement");
}
}
//编辑
public function editStatement()
{
if ($_POST) {
$params = I('post.');
if(!isset($params['id'])){
$this->error('参数错误');
}
$params['first_party_info'] = json_encode($params['first_party_info'],JSON_UNESCAPED_UNICODE);
$params['second_party_info'] = json_encode($params['second_party_info'],JSON_UNESCAPED_UNICODE);
$params['statement_info'] = json_encode($params['statement_info'],JSON_UNESCAPED_UNICODE);
$params['verify_status'] = 0;
$params['verify_log'] = json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s")]);
$params['op_time'] = time();
M("CompanyStatement","tab_")->save($params);
$this->ajaxReturn(["code"=>0,"msg"=>"ok"]);
}else{
if (!isset($_REQUEST['id'])) {
$this->error('参数错误');
}
$id = $_REQUEST['id'];
//获取基本信息
$dbres = M("CompanyStatement", "tab_")->where("id='{$id}'")->find();
$dbres['first_party_info'] = json_decode($dbres['first_party_info'], true);
$dbres['second_party_info']= json_decode($dbres['second_party_info'], true);
$dbres['statement_info'] = json_decode($dbres['statement_info'], true);
$this->assign("data", $dbres);
if ($dbres["company_belong"] == 9) {
//上游
$this->display("editCpStatement");
} else {
$this->display("editPcStatement");
}
}
}
//审批通过
public function verifyAgree(){
$this->setVerifyStatus(0,1,"verify");
@ -246,9 +216,7 @@ class CompanyStatementPoolController extends ThinkController
public function verifyRefuse(){
$this->setVerifyStatus(0,-1,"verify");
}
public function launch(){
$this->setVerifyStatus(1,2,"launch");
}
protected function setVerifyStatus($old_status,$change_status,$op_pre)
{
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
@ -281,28 +249,131 @@ class CompanyStatementPoolController extends ThinkController
'info' => "操作成功"
));
}
//重算
public function updateStatement()
//上传凭证
public function uploadVoucher()
{
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$this->assign("id",$id);
$this->display();
}
//修改凭证
public function editVoucher()
{
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$info = $this->DBModel->field("id,ext_file")->where("id = '{$id}'")->find();
$this->assign("id",$id);
$this->assign("ext_file",$info['ext_file']);
$this->display();
}
//保存凭证
public function saveVoucher()
{
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$path = '/Uploads/';
$upload = new \Think\Upload();// 实例化上传类
$upload->maxSize = 0 ;// 设置附件上传大小
$upload->exts = array('jpg', 'gif', 'png', 'jpeg');;// 设置附件上传类型
$upload->rootPath = '.'.$path; // 设置附件上传根目录
$upload->savePath = ''; // 设置附件上传(子)目录
// 上传文件
$info = $upload->upload();
if(!$info) {// 上传错误提示错误信息
$msg = $upload->getError();
$array= array('status' => 0, 'info' => $msg);
}else{// 上传成功
//
$pf = $path.$info['file']['savepath'].$info['file']['savename'];
$save = [
"ext_file"=>$pf,
];
//获取旧值,存在删除
$info = $this->DBModel->field("id,ext_file")->where("id = '{$id}'")->find();
if(!empty($info['ext_file'])){
unlink("./".$info['ext_file']);
}
$this->DBModel->where("id = '{$id}'")->save($save);
$array=array(
'status' => 1,
"info"=>"上传成功",
"file_path"=>$pf,
);
}
$this->ajaxReturn($array);
}
//删除凭证
public function delVoucher(){
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$info = $this->DBModel->field("id,ext_file")->where("id = '{$id}'")->find();
if(!empty($info['ext_file'])){
unlink("./".$info['ext_file']);
}
$save = [
"ext_file"=>'',
];
$this->DBModel->where("id = '{$id}'")->save($save);
// $this->doAddOperationLog($id,"删除凭证");
$this->ajaxReturn(array(
'status' => 1,
'info' => "删除成功"
));
}
//撤销汇总
public function cancelPool()
{
//开启事务
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$dbres = $this->DBModel->field("id,verify_status,verify_log")->where("id in ({$ids})")->select();
foreach($dbres as $k=>&$v){
if(in_array($v['verify_status'],[3,4])) continue; //合作方确认后不进行重算
//重算
$res = A("CompanyStatementSet")->updateCompanyStatementData($v['id'],$this->admininfo["username"]);
if($res === false){
$this->ajaxReturn(array(
'status' => 0,
"info"=>"重算金额错误"
));
$dbres = $this->DBModel->field("id,statement_ids,verify_status")->where("id in ({$ids})")->select();
$sids = [];
foreach($dbres as $k=>$v){
if(in_array($v['verify_status'],[3,4])) continue; //有打款就不允许回退
$statement_ids = explode(",",$v['statement_ids']);
$sids = array_merge($sids,$statement_ids);
}
$sids = implode(",",$sids);
M()->startTrans();//事务
//删除info
$infores = M("company_statement_info","tab_")->where("pool_id in ($ids)")->delete();
if($infores === false){
M()->rollback();
$this->ajaxReturn(array('status' => 0,"info"=>"撤销汇总失败"));
}
//删除自己
$poolres = $this->DBModel->where("id in ({$ids})")->delete();
if($poolres === false){
M()->rollback();
$this->ajaxReturn(array('status' => 0,"info"=>"撤销汇总失败"));
}
//修改结算单信息
$st_res = M("company_statement","tab_")->field("id,verify_status,verify_log")->where("id in ({$sids})")->select();
foreach($st_res as $k=>&$v){
$v['verify_log'] = json_decode($v['verify_log'],true);
$v['verify_log'][$op_pre.'_user']=$this->admininfo["username"];
$v['verify_log'][$op_pre.'_time']=date("Y-m-d H:i:s");
$v['verify_log'] = json_encode($v['verify_log']);
$v['verify_status']=-2;
$stres = M("company_statement","tab_")->save($v);
if($stres === false){
M()->rollback();
$this->ajaxReturn(array('status' => 0,"info"=>"撤销汇总失败"));
}
}
M()->commit();
$this->ajaxReturn(array(
'status' => 1,
"info"=>"重算金额成功"
));
}
}
//导出
public function export()
{
@ -337,191 +408,28 @@ class CompanyStatementPoolController extends ThinkController
excelDownStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_sum_money);
}
}
//汇总
public function pool()
{
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$dbres = $this->DBModel->field("*")->where("id in ({$ids})")->select();
//分单
$basedata = [
"pay_amount"=>0,
"statement_money"=>0,
"platform_amount"=>0,
"statement_ids"=>[],
"statement_begin_time"=>0,
"statement_end_time"=>0,
"fine"=>0,
"reward"=>0,
"verify_status"=>0,
"verify_log"=>json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s")]),
"op_time"=>time(),
"company_list"=>[]
];
$datas = ["ups","up","downs","down","users","user"];
//初始化数据
foreach($datas as $k=>$v){
if($v =="ups"){
$basedata['company_type']=3;
$basedata['is_payment']=1;
}
if($v =="up"){
$basedata['company_type']=3;
$basedata['is_payment']=2;
}
if($v =="downs"){
$basedata['company_type']=1;
$basedata['is_payment']=1;
}
if($v =="down"){
$basedata['company_type']=1;
$basedata['is_payment']=2;
}
if($v =="users"){
$basedata['company_type']=2;
$basedata['is_payment']=1;
}
if($v =="user"){
$basedata['company_type']=2;
$basedata['is_payment']=2;
}
$datas[$v]=$basedata;
unset($datas[$k]);
}
foreach ($dbres as $k=>$v) {
if($v['verify_status'] != 3) continue;
if($v['company_belong'] == 9){
//上游
if($v['is_payment'] == 1){
$this->setDf($datas['ups'],$v);
}else{
$this->setDf($datas['up'],$v);
}
}else{
//下游
if($v['company_type'] == 2){
//个人
if($v['is_payment'] == 1){
$this->setDf($datas['users'],$v);
}else{
$this->setDf($datas['user'],$v);
}
}else{
if($v['is_payment'] == 1){
$this->setDf($datas['downs'],$v);
}else{
$this->setDf($datas['down'],$v);
}
}
}
}
$Pool = M("company_statement_pool","tab_");
$Statemen = M("company_statement","tab_");
foreach ($datas as $k => $v) {
if($v['platform_amount'] <= 0){continue;}
//执行
$v['statement_ids'] = implode(",",$v['statement_ids']);
$v['statement_num'] = "JS_".date('Ymd').date('His').sp_random_num(5);
$v['company_list'] = json_encode(array_values($v['company_list']),JSON_UNESCAPED_UNICODE);
$Pool->add($v);
//修改结算单规则
$this->updatePoolVerifyStatus($v['statement_ids'],3,4,"pool",$v['statement_num']);
}
$this->ajaxReturn(array(
'status' => 1,
"info"=>"汇总成功"
));
//
}
protected function updatePoolVerifyStatus($ids,$old_status,$change_status,$op_pre,$num){
$dbres = $this->DBModel->field("id,verify_status,verify_log")->where("id in ({$ids})")->select();
foreach($dbres as $k=>&$v){
if($v['verify_status'] != $old_status) continue;
$v['verify_log'] = json_decode($v['verify_log'],true);
$v['verify_log'][$op_pre.'_user']=$this->admininfo["username"];
$v['verify_log'][$op_pre.'_time']=date("Y-m-d H:i:s");
$v['verify_log'][$op_pre.'_num']=$num;
$v['verify_log'] = json_encode($v['verify_log']);
$v['verify_status']=$change_status;
$this->DBModel->save($v);
}
}
//设定组合的子操作
protected function setDf(&$savedata,$v)
{
$savedata['statement_ids'][] = $v['id'];
unset($v['id']);
$v['statement_info'] = json_decode( $v['statement_info'],true);
foreach($v['statement_info'] as $ka=>$va){
if($va['statement_type'] == 2){
//奖励
$savedata['reward'] += $va['sum_money'];
unset($v['statement_info'][$ka]);
}else if($va['statement_type'] == 1){
$savedata['fine'] += $va['sum_money'];
unset($v['statement_info'][$ka]);
}
}
if(isset($savedata['company_list'][$v['company_id']])){
//存在游戏合并
$a = &$savedata['company_list'][$v['company_id']];
$a['statement_info'] = array_merge($a['statement_info'],$v['statement_info']);
// dump($a['statement_info']);
$a['platform_amount'] += $v['platform_amount'];
$a['pay_amount'] += $v['pay_amount'];
$a['statement_money'] += $v['statement_money'];
}else{
if($v['pay_type'] == 2){
//乙方收款
$v['company_info'] = $v['second_party_info'];
}else{
$v['company_info'] = $v['first_party_info'];
}
$tdata = [
"company_info"=>json_decode($v['company_info']),
"company_name"=>$v['company_name'],
"platform_amount"=>$v['platform_amount'],
"pay_amount"=>$v['pay_amount'],
"statement_money"=>$v['statement_money'],
"statement_info"=>$v['statement_info'],
];
$savedata['company_list'][$v['company_id']] = $tdata;
}
$savedata['pay_amount'] += $v['pay_amount'];
$savedata['statement_money'] += $v['statement_money'];
$savedata['platform_amount'] += $v['platform_amount'];
if($savedata['statement_begin_time'] == 0){
$savedata['statement_begin_time'] = $v['statement_begin_time'];
}elseif($v['statement_begin_time'] < $savedata['statement_begin_time']){
$savedata['statement_begin_time'] = $v['statement_begin_time'];
}
if($savedata['statement_end_time'] == 0){
$savedata['statement_end_time'] = $v['statement_end_time'];
}elseif($v['statement_end_time'] > $savedata['statement_end_time']){
$savedata['statement_end_time'] = $v['statement_end_time'];
}
}
//设定并保存数据
public function OpAuth($info)
{
$id = $info['id'];
$img = $info['ext_field'];
$img = $info['ext_file'];
$remark = $info['remark'];
//原始列表
$opBtn = [
"viewStatement"=>"<a class='confirm viewStatement' data-id='{$id}'>查看</a>",
"editStatement"=>"<a class='confirm editStatement' data-id='{$id}'>编辑</a>",
"viewPool"=>"<a class='confirm viewStatement' data-id='{$id}'>查看</a>",
"addRemark"=>"<a class='confirm addRemark' data-id='{$id}'>新增备注</a>",
"editRemark"=>"<a class='confirm editRemark' data-remark='{$remark}' data-id='{$id}'>修改备注</a>",
"viewRemark"=>"<a class='confirm viewRemark' data-remark='{$remark}' data-id='{$id}'>查看备注</a>",
"uploadVoucher"=>"<a class='confirm uploadVoucher' data-id='{$id}'>上传凭证</a>",
"viewVoucher"=>"<a class='confirm viewVoucher' data-img='{$img}' data-id='{$id}'>查看凭证</a>",
"editVoucher"=>" <a class='confirm editVoucher' data-id='{$id}'>编辑凭证</a>",
"setPayment"=>"<a class='confirm setPayment' data-id='{$id}'>打款信息提交</a>",
"editPayment"=>"<a class='confirm setPayment' data-id='{$id}'>打款信息编辑</a>",
"viePayment"=>"<a class='confirm setPayment' data-id='{$id}'>打款详情</a>",
];
//操作对应菜单
$optist = [];
@ -529,25 +437,34 @@ class CompanyStatementPoolController extends ThinkController
case '-2':
case '-1':
case '0':
$optist = ["viewPool"];
break;
case '1':
$optist = ["viewPool","addRemark","viewRemark","editRemark","viewVoucher","editVoucher","uploadVoucher","setPayment"];
break;
case '2':
$optist = ["viewStatement","editStatement","addRemark","viewRemark","editRemark"];
$optist = ["viewPool","addRemark","viewRemark","editRemark","viewVoucher","editVoucher","uploadVoucher","editPayment"];
break;
case '3':
$optist = ["viewStatement","addRemark","viewRemark","editRemark"];
break;
case '4':
$optist = ["viewStatement","addRemark","viewRemark","editRemark"];
$optist = ["viewPool","addRemark","viewRemark","editRemark","viewVoucher","editVoucher","uploadVoucher","viePayment"];
break;
default:
break;
}
if(empty($info['ext_file'])){
//未上传凭证
$optist = array_diff($optist, ["viewVoucher", "editVoucher"]);
}else{
$optist = array_diff($optist, ["uploadVoucher"]);
}
if(empty($info['remark'])){
//未上传备注
$optist = array_diff($optist, ["editRemark", "viewRemark"]);
}else{
$optist = array_diff($optist, ["addRemark"]);
}
//
$resarr = [];
foreach ($optist as $k => $v) {
@ -566,10 +483,7 @@ class CompanyStatementPoolController extends ThinkController
$mentBtn = [
"verifyAgree"=>"<a class='butn' id='verifyAgree'>审批通过</a>",
"verifyRefuse"=>"<a class='butn' id='verifyRefuse' style='background-color: red;'>审核拒绝</a>",
"launch"=>"<a class='butn' id='launch'>对外发起</a>",
"pool"=>"<a class='butn' id='pool'>发起汇总</a>",
"monthPool"=>"<a class='butn' id='monthPool'>月结汇总</a>",
"updateStatement"=>"<a class='butn' id='updateStatement' style='background-color: green;'>重算金额</a>",
"cancelPool"=>"<a class='butn' id='cancelPool' style='background-color: green;'>撤销汇总</a>",
"export"=>"<a class='butn' id='export'>批量导出</a>"
];
$resarr = [];

@ -204,7 +204,17 @@
</td>
<td>{$data.launch}</td>
<td>{$data.confirm}</td>
<td>{$data.pool}</td>
<td>
<if condition="$data.verify_status eq -2 ">
<div style="line-height: 2;color: red;">
{$data.pool}
</div>
<else />
<div style="line-height: 2;">
{$data.pool}
</div>
</if>
</td>
<td>
<foreach name="data.oplist" item="vo" >
{$vo}

@ -0,0 +1,120 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title></title>
<link href="http://admin.vlcms.com/Public/icon.ico" type="image/x-icon" rel="shortcut icon">
<link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/module.css">
<link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
</head>
<style>
html {
min-width:100%;
}
body {
padding: 0px;
}
.hide{
display: none !important;
}
</style>
<body>
<div id="main" class="main" style="min-height: 342px;margin-top: 20px;padding-left: 50px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr style="padding: 10px;height: 50px;">
<td class="l">文件选择: </td>
<td >
<input type="file" id="fileinput" name="file" accept="image/*">
</td>
<td style="color: #777;font-size: 12px;">仅能添加一张凭证,重复添加将覆盖</td>
</tr>
</table>
<div class="jssearch search_list fl cf">
<div class="input-list">
<div class="sch-btn uploadfile" style="width: 100px;padding: 5px;">确认修改</div>
<div id="delVoucher" class="sch-btn " style="width: 100px;padding: 5px;background-color: red;">删除凭证</div>
</div>
</div>
<div style="display: block;clear: both;">
<img id="voucher" src="{$ext_file}" class="" style="width: auto;height: 350px;margin: auto;">
</div>
</div>
<script>
var id = {$id};
$(function(){
$(".uploadfile").on("click",function(){
var acceptedTypes = ['image/png','image/jpeg','image/jpg','image/gif'];
var type = document.getElementById('fileinput').files[0].type;
if (acceptedTypes.indexOf(type) === -1) {
layer.msg("只允许图片格式文件");
return false;
}
var formData = new FormData();
formData.append("id",id);
formData.append("file", document.getElementById("fileinput").files[0]);
var index = layer.load();
$.ajax({
url:"{:U('saveVoucher')}",
type:"post",
data:formData,
processData:false,
contentType:false,
success:function(data){
layer.close(index);
if(data.status == 1){
//file_path\
layer.msg("上传成功");
$('#voucher').attr("src",data.file_path).removeClass("hide");
$('#delVoucher').removeClass("hide");
$("#fileinput").val('');
}else{
layer.alert(data.info);
}
},
error:function(e){
layer.alert("网络错误");
}
});
})
$("#delVoucher").on("click",function(){
var index = layer.load();
var formData = new FormData();
formData.append("id",id);
$.ajax({
url:"{:U('delVoucher')}",
type:"post",
data:formData,
processData:false,
contentType:false,
success:function(data){
layer.close(index);
if(data.status == 1){
//file_path\
layer.msg("删除成功");
$('#voucher').attr("src",'').addClass("hide");
$('#delVoucher').addClass("hide");
$("#fileinput").val('');
}else{
layer.alert(data.info);
}
},
error:function(e){
layer.alert("网络错误");
}
});
})
});
</script>
</body>
</html>

@ -243,7 +243,7 @@
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('CompanyStatement/lists')}");
highlight_subnav("{:U('lists')}");
function reload() {
window.location.reload();
}
@ -296,7 +296,7 @@
});
});
$("#verifyAgree,#verifyRefuse,#launch,#pool,#updateStatement").on("click",function(){
$("#verifyAgree,#verifyRefuse,#cancelPool").on("click",function(){
var id = $(this).attr("id");
if(id == "verifyAgree"){
var opname = "审批通过";
@ -308,23 +308,14 @@
var opurl = "{:U('verifyRefuse')}";
var opst ="[未进行审批]";
var status = [0];
}else if(id=="launch"){
var opname = "对外发起";
var opurl = "{:U('launch')}";
}else if(id=="cancelPool"){
var opname = "撤销汇总";
var opurl = "{:U('cancelPool')}";
var opst ="[审批通过]";
var status = [1];
}else if(id=="pool"){
var opname = "发起汇总";
var opurl = "{:U('pool')}";
var opst ="[合作方确认]";
var status = [3];
}else if(id=="updateStatement"){
var opname = "重算金额";
var opurl = "{:U('updateStatement')}";
var opst ="[汇总撤销,审批拒绝,未进行审批,审批通过,对外发起]";
var status = [-2,-1,0,1,2];
var confirm = true;
}
var confirm = confirm ? confirm :false;
var flag = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
@ -478,6 +469,45 @@
});
});
//上传凭证
$(".uploadVoucher").click(function () {
var id = $(this).data("id");
layer.open({
type: 2,
title: "上传凭证",
shadeClose: true,
shade: 0.8,
area: ['60%', '60%'],
content:'/admin.php?s=/CompanyStatementPool/uploadVoucher/id/'+id,
end:function(){
reload();
}
});
});
//查看凭证
$(".viewVoucher").click(function () {
var img = $(this).data("img");
layer.open({
type: 1,
title:false,
content:"<img src='"+img+"' style='width: auto;height: 450px;margin: auto;'>"
});
});
//编辑凭证
$(".editVoucher").click(function () {
var id = $(this).data("id");
layer.open({
type: 2,
title: "编辑凭证",
shadeClose: true,
shade: 0.8,
area: ['60%', '60%'],
content:'/admin.php?s=/CompanyStatementPool/editVoucher/id/'+id,
end:function(){
reload();
}
});
});
$("#search").click(function(){

@ -0,0 +1,120 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title></title>
<link href="http://admin.vlcms.com/Public/icon.ico" type="image/x-icon" rel="shortcut icon">
<link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/module.css">
<link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
</head>
<style>
html {
min-width:100%;
}
body {
padding: 0px;
}
.hide{
display: none !important;
}
</style>
<body>
<div id="main" class="main" style="min-height: 342px;margin-top: 20px;padding-left: 50px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr style="padding: 10px;height: 50px;">
<td class="l">文件选择: </td>
<td >
<input type="file" id="fileinput" name="file" accept="image/*">
</td>
<td style="color: #777;font-size: 12px;">仅能添加一张凭证,重复添加将覆盖</td>
</tr>
</table>
<div class="jssearch search_list fl cf">
<div class="input-list">
<div class="sch-btn uploadfile" style="width: 100px;padding: 5px;">确认添加</div>
<div id="delVoucher" class="sch-btn hide" style="width: 100px;padding: 5px;background-color: red;">删除凭证</div>
</div>
</div>
<div style="display: block;clear: both;">
<img id="voucher" src="" class="hide" style="width: auto;height: 350px;margin: auto;">
</div>
</div>
<script>
var id = {$id};
$(function(){
$(".uploadfile").on("click",function(){
var acceptedTypes = ['image/png','image/jpeg','image/jpg','image/gif'];
var type = document.getElementById('fileinput').files[0].type;
if (acceptedTypes.indexOf(type) === -1) {
layer.msg("只允许图片格式文件");
return false;
}
var formData = new FormData();
formData.append("id",id);
formData.append("file", document.getElementById("fileinput").files[0]);
var index = layer.load();
$.ajax({
url:"{:U('saveVoucher')}",
type:"post",
data:formData,
processData:false,
contentType:false,
success:function(data){
layer.close(index);
if(data.status == 1){
//file_path\
layer.msg("上传成功");
$('#voucher').attr("src",data.file_path).removeClass("hide");
$('#delVoucher').removeClass("hide");
$("#fileinput").val('');
}else{
layer.alert(data.info);
}
},
error:function(e){
layer.alert("网络错误");
}
});
})
$("#delVoucher").on("click",function(){
var index = layer.load();
var formData = new FormData();
formData.append("id",id);
$.ajax({
url:"{:U('delVoucher')}",
type:"post",
data:formData,
processData:false,
contentType:false,
success:function(data){
layer.close(index);
if(data.status == 1){
//file_path\
layer.msg("删除成功");
$('#voucher').attr("src",'').addClass("hide");
$('#delVoucher').addClass("hide");
$("#fileinput").val('');
}else{
layer.alert(data.info);
}
},
error:function(e){
layer.alert("网络错误");
}
});
})
});
</script>
</body>
</html>
Loading…
Cancel
Save