优化打款

master
chenzhi 3 years ago
parent c3688db1f2
commit 903e98e3cf

@ -0,0 +1,240 @@
<?php
namespace Payment\Controller;
/**
* 后台首页控制器
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
class WxPaymentController extends BaseController
{
public $PayStatus=[
"-2"=>"信息配置不全",
"-1"=>"打款失败",
"0"=>"未打款",
"1"=>"打款成功"
];
public $CompanyType = [
"1"=>"下游公司",
"2"=>"下游个人",
"3"=>"上游CP"
];
public $ALIRSP=[
"out_biz_no"=>"商户订单号",
"order_id"=>"支付订单号",
"pay_fund_order_id"=>"资金流水号",
"status"=>"转账状态",
"trans_date"=>"订单支付时间",
"msg"=>"支付信息",
"sub_msg"=>"失败描述",
"sub_code"=>"失败码",
"remark"=>"打款备注",
"code"=>"打款状态码"
];
public function _initialize()
{
$this->admininfo = session('payment_user');;
// $this->DBModel = M("CompanyStatementPool","tab_");
parent::_initialize();
}
public function customerLists()
{
$params = I('get.');
$page = $params['p'] ? intval($params['p']) : 1;
$row = $params['row'] ? intval($params['row']) : 10;
$where = [];
if(isset($_REQUEST['nickname'])){
$where['nickname'] = ["LIKE","%{$_REQUEST['nickname']}%"];
}
$data = M('mini_program_user', 'tab_')
->field("wx_json",true)
->where($where)
->page($page,$row)
->select();
foreach ($data as $key => $value) {
$data[$key]['create_time'] = date('Y-m-d H:i:s',$value['create_time']);
}
$count = M('mini_program_user', 'tab_')->where($where)->count();
$page = set_pagination_all($count['count'], $row);
if ($page) {
$this->assign('_page', $page);
}
$this->assign('data', $data);
$this->display();
}
public function customerExport()
{
$where["_string"]="1=1";
if($_REQUEST['ids']){
$where = [
"id"=>["in",$_REQUEST['ids']]
];
}
$data = M('mini_program_user', 'tab_')
->field("wx_json",true)
->where($where)
->select();
header("Content-type: text/html; charset=utf-8");
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
Vendor("PHPExcel.PHPExcel");
$objPHPExcel = new \PHPExcel();
$objReader = \PHPExcel_IOFactory::createReader('Excel2007');
$objPHPExcel = $objReader->load("Public/Admin/excel/customer.xlsx");
$line = 2;
//设置模板文件
foreach ($data as $key => $value) {
$objPHPExcel->getActiveSheet()->setCellValue('A'.$line, $line-1)->setCellValue('B'.$line, $value['openid']);
$line++;
}
$fileName = "微信打款模板";
ob_end_clean();//清除缓冲区,避免乱码
header('pragma:public');
header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $fileName .'".xlsx');
header("Content-Disposition:attachment;filename={$fileName}.xlsx");//attachment新窗口打印inline本窗口打印
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');
exit;
}
public function lists()
{
$params = I('get.');
$page = $params['p'] ? intval($params['p']) : 1;
$row = $params['row'] ? intval($params['row']) : 10;
$map=[
"_string"=>"1=1",
];
if (isset($_REQUEST['pay_time_start']) && isset($_REQUEST['pay_time_end'])) {
$map['pay_time'] = ['between', [strtotime($_REQUEST['pay_time_start']), strtotime($_REQUEST['pay_time_end']) + 86399]];
} elseif (isset($_REQUEST['pay_time_start'])) {
$map['pay_time'] = ['EGT', strtotime($_REQUEST['pay_time_start'])];
} elseif (isset($_REQUEST['pay_time_end'])) {
$map['pay_time'] = ['ELT', strtotime($_REQUEST['pay_time_end']) + 86399];
}
if(isset($_REQUEST['realname'])){
$map['realname'] = ['LIKE',"%".$_REQUEST['realname']."%"];
}
if(isset($_REQUEST['pay_status'])){
$map['pay_status'] = $_REQUEST['pay_status'];
}
if(isset($_REQUEST['batch_num'])){
$map['batch_num'] = ["LIKE","%{$_REQUEST['batch_num']}%"];
}
if (isset($_REQUEST['export']) && $_REQUEST['export']==1) {
$data = M("excel_statement_info","tab_")
->alias('i')
->field("i.*")
->where($map)
->order("FIELD(pay_status,0,-1,1)")
->select();
$ids = array_column($data, 'id');
$ids = implode(',', $ids);
$this->viewPool($ids);
return ;
}
$CompanyInfo = M("excel_statement_info","tab_")
->alias('i')
->field("i.*")
->where($map)
->page($page,$row)
->order("FIELD(pay_status,0,-1,1)")
->select();
foreach($CompanyInfo as $k=>&$v){
$v['can_pay'] = 1;
if($v['pay_status'] == 1){ $v['can_pay'] = 0; }
if($v['statement_money'] < 0.1){ $v['can_pay'] = 0; }
$v['company_type'] = $this->CompanyType[$v['company_type']];
$v["pay_status_str"] = $this->PayStatus[$v['pay_status']];
$v['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
// $v['statement_begin_time'] = date('Y-m-d',$v['statement_begin_time']);
// $v['statement_end_time'] = date('Y-m-d',$v['statement_end_time']);
if(empty($v['pay_time'])){
$v['pay_time'] = "--";
}else{
$v['pay_time'] = date('Y-m-d H:i:s',$v['pay_time']);
}
if($v['verify_status'] == 0){
$v['verify'] = "--";
}else {
$member = M("payment_member")
->field("name")
->where(['id'=>$v['verify_member_id']])
->find();
$v['verify'] = (($v['verify_status'] == 1)?'审核通过':'审核拒绝')."({$member['name']})<br>".date('Y-m-d H:i:s', $v['verify_time']);;
}
// $v["valid"] = "{$v['statement_begin_time']} ~ {$v['statement_end_time']}";
}
//统计待打款金额
$field = "IFNULL(SUM(CASE WHEN pay_status = 1 THEN statement_money ELSE 0 END),0) as success_money,
IFNULL(SUM(CASE WHEN pay_status = 0 THEN statement_money ELSE 0 END),0) as statement_money,
IFNULL(SUM(CASE WHEN pay_status = -1 THEN statement_money ELSE 0 END),0) as error_money";
$money = M("excel_statement_info","tab_")->alias('i')->field( $field)->where($map)->find();
$count = M("excel_statement_info","tab_")->alias('i')->field("count(id) count")->where($map)->find();
$page = set_pagination_all($count['count'], $row);
if ($page) {
$this->assign('_page', $page);
}
// echo($page);die();
$this->meta_title = '线下打款';
$this->assign("data",$CompanyInfo);
$this->assign("money",$money);
$this->assign("CompanyType", $this->CompanyType);
$this->assign("PayStatus", $this->PayStatus);
$this->display();
}
public function add()
{
$batch = date('Ymd').date('His').sp_random_num(3);
$this->assign("batch",$batch);
$this->meta_title = 'EXCEL导入';
$this->display();
}
public function loopAdd()
{
$p = $_REQUEST;
$batch = $p['batch'];
$checkarr = $p['checkarr'];
//循环获取添加
if(count($checkarr) < 1){
$this->ajaxReturn(["status"=>1,"msg"=>"ok"]);
}
$wxPayment = M('wx_payment',"tab_");
foreach ($checkarr as $k => &$v) {
if(!isset($v['realname']) || !isset($v['openid']) || !isset($v['statement_money']) || $v['realname'] == '' || $v['openid'] == '' || $v['statement_money'] <= 0){
$wxPayment->where("batch_num = '{$v['batch_num']}'")->delete();
$this->ajaxReturn(["status"=>0,"msg"=>"真实姓名,openid,打款金额均不允许为空"]);
}
$v['batch_num'] = $batch;
$res = $wxPayment->add($v);
if($res === false){
$wxPayment->where("batch_num = '{$v['batch_num']}'")->delete();
$this->ajaxReturn(["status"=>0,"msg"=>"添加失败"]);
}
}
$this->ajaxReturn(["status"=>1,"msg"=>"ok"]);
}
}

@ -223,6 +223,17 @@ $(function(){
<a class="item" href="{:U('ExcelPayment/lists')}">线下付款</a> <a class="item" href="{:U('ExcelPayment/lists')}">线下付款</a>
</li> </li>
</ul> </ul>
<h3 class='no'><i class="icon icon-unfold"></i>微信打款</h3>
<ul class="side-sub-menu" style="display: none;">
<li>
<a class="item" href="{:U('WxPayment/customerLists')}">打款名录</a>
</li>
<li>
<a class="item" href="{:U('WxPayment/lists')}">微信付款</a>
</li>
</ul>
</div> </div>
</div> </div>
<!-- /边栏 --> <!-- /边栏 -->

@ -0,0 +1,316 @@
<extend name="Public/base" />
<block name="body">
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<style>
.tabcon1711 td:first-child {
width: auto;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">新增excel导入</h3>
<p class="description_text">说明:导入预付款数据</p>
</div>
<!-- 标签页导航 -->
<div class="tab-wrap" style="display: flex;">
<div class="tab-content tabcon1711" style="min-width:700px;">
<!-- 基础文档模型 -->
<div id="tab1" class="tab-pane in tab1">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l">本次批次号:</td>
<td class="r">
<div class="input-list" id="batch" style="margin-left: 0;line-height: 30px;font-size: 16px;">
</div>
<!-- <span class="notice-text" style="margin-left: 20px;">用于检索使用</span> -->
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>文件上传:</td>
<td class="r">
<div class="input-list" style="margin-left: 0;">
<input type="file" id="fileinput" name="file">
</div>
<span class="notice-text" style="margin-left: 0;">暂只支持.xls .xlsx 格式文件</span>
</td>
</tr>
</tbody>
</table>
</div>
<div class="form-item cf">
<button class="submit_btn" id="submit_btn">
保存
</button>
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();">
返回
</a>
</div>
</div>
</div>
<div style="margin-top: 60px;" id="firle">
<div style="width: 100%;height: 45px;font-size: 16px;">
文件格式参考:<span style="color: #777;font-size: 12px;margin-left: 20px;">请严格按此格式,文件的第一行必须是字段名,且字段名不允许修改</span>
</div>
<style>
#firle td,#firle th{
padding: 10px 5px;
}
</style>
<table id="cktable" style="width: 100%;margin: 0;padding: 0;text-align: center;border: 1px solid #777;" border="1px">
<thead>
<tr>
<th>序号</th>
<th>openid</th>
<th>真实姓名</th>
<th>打款金额</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>oGkwL49glkGPgU3h0iEBQVIrY036</td>
<td>张小花</td>
<td>56.26</td>
</tr>
</tbody>
</table>
</div>
<div style="width: 100vw;height: 100vh;padding: 0;position: absolute;top: 0;z-index: 9999;display: none;" id="creat_msg">
<div class="layui-layer layui-layer-dialog layui-layer-border layui-layer-msg layui-layer-hui"
type="dialog" times="1" showtime="50000" contype="string" style="z-index: 19891015; top:30%; left:30%;">
<div class="layui-layer-content" style="padding: 15px 0 5px;font-size: 20px;font-weight: 600;">执行进度</div>
<div id="tip_msg" class="layui-layer-content">开始时间与结束时间都不允许为空</div>
<div class="layui-layer-content" style="padding: 5px 10px 15px;font-size: 10px;color: #BBB;">TIP:未执行完成之前请勿刷新或关闭此页面</div>
<span class="layui-layer-setwin"></span>
</div>
</div>
</block>
<block name="script">
<script type="text/javascript" src="__STATIC__/xlsx.core.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('lists')}");
var MSG={
showmsg:function(str){
$("#creat_msg").show();
$("#tip_msg").html(str);
},
hidemsg:function(){
$("#creat_msg").hide();
$("#tip_msg").html('');
}
}
var COMPARE={
publiucAjax:function(url,senddata,callback){
console.log(senddata);
$.ajax({
type: 'post',
url: url,
data:senddata,
success: function(data) {
if(data.status == 1){
callback();
}else{
MSG.hidemsg();
layer.alert(data.msg);
return false;
}
},
error:function(){
MSG.hidemsg();
layer.alert("网络错误或超时");
return false;
}
});
},
//循环比较
loopCheck:function(page,callback){
if(page > sendDefaultData.check_page){
MSG.showmsg("添加成功,执行跳转中");
callback();
return;
}
var senddata = {
batch:sendDefaultData.batch,
checkarr:sendDefaultData.filedata.splice(0,check_size)
}
COMPARE.publiucAjax("{:U('loopAdd')}",senddata,function(data){
var checkok = page*check_size > sendDefaultData.filedata_count ? sendDefaultData.filedata_count : page*check_size;
MSG.showmsg("数据插入 ["+checkok+"/"+sendDefaultData.filedata_count+"] ......");
page++;
COMPARE.loopCheck(page,callback)
});
},
checkData:function(callback){
MSG.showmsg("数据校验中...");
var d = sendDefaultData.filedata;
for (const key in d) {
var c = d[key];
if(!c.hasOwnProperty('realname') || c.realname == '' || !c.hasOwnProperty('statement_money') || c.statement_money == '' || !c.hasOwnProperty('openid') || c.openid == ''){
MSG.hidemsg();
layer.msg( "序号:"+c.sort+'真实姓名打款金额openid均不允许为空');
return false;
}
}
callback();
}
}
</script>
<script type="text/javascript">
var isfile = false;
var rABS = false; //是否将文件读取为二进制字符串
var check_size = 1;//每次验证的数量
var batch = '{$batch}';
var sendDefaultData = {
"filedata_count": 0,
"check_page":0,
"filedata":[],
"pay_way":-1,
"batch":batch
}
$("#batch").html(batch);
$(function () {
$("#submit_btn").on("click", function () {
//获取文件
if (!isfile) {
layer.msg('excel文件不能为空');
return false;
}
//执行
readFileInput(function () {
if(sendDefaultData.filedata_count == 0){
MSG.hidemsg();
layer.msg('excel内容不能为空');
return false;
}
//获取需要循环的次数
sendDefaultData.check_page = Math.ceil(sendDefaultData.filedata_count/check_size);
COMPARE.checkData(function(){
COMPARE.loopCheck(1,function(){
setTimeout(function(){
window.location.href="{:U('lists',['row'=>999999,'page'=>1,'batch_num'=>$batch])}";
},1500);
})
});
})
})
$("#fileinput").change(function () {
var p = $(this).val();
var ext = p.substr(p.lastIndexOf(".")).toLowerCase();
if (ext != ".xls" && ext != ".xlsx") {
layer.msg("文件仅支持excel文件格式");
$(this).val('');
p = '';
}
if (p != '') {
isfile = true;
} else {
isfile = false;
}
})
});
function readFileInput(callback) {
MSG.showmsg("读取excle中。。。");
var wb;//读取完成的数据
var f = $("#fileinput")[0].files[0];
var reader = new FileReader();
if (rABS) {
reader.readAsArrayBuffer(f);
} else {
reader.readAsBinaryString(f);
}
reader.onload = function (e) {
MSG.showmsg("文件读取完成,添加命令初始化。。。");
var data = e.target.result;
if (rABS) {
wb = XLSX.read(btoa(fixdata(data)), {
type: 'base64'
});
} else {
wb = XLSX.read(data, {
type: 'binary'
});
}
// console.log(wb);
try {
var filedata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]);
sendDefaultData.filedata = resetCount(filedata);
sendDefaultData.filedata_count = sendDefaultData.filedata.length;
callback();
} catch (error) {
console.log(error)
MSG.hidemsg();
isfile = false;
layer.msg('excel内容不符或不能为空');
return false;
}
// document.getElementById("demo").innerHTML= JSON.stringify( XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]) );
};
}
function resetCount(fdata){
var titleKey={
"序号": "sort",
"openid":"openid",
"真实姓名": "realname",
"打款金额":"statement_money",
}
var data = [];
for (let index = 0; index < fdata.length; index++) {
let temp = {};
for (const key in titleKey) {
if(fdata[index].hasOwnProperty(key)){
let tkey = titleKey[key];
temp[tkey] = fdata[index][key];
}
}
data.push(temp);
}
return data;
}
function fixdata(data) { //文件流转BinaryString
var o = "",
l = 0,
w = 10240;
for (; l < data.byteLength / w; ++l) o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w, l * w + w)));
o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w)));
return o;
}
</script>
</block>

@ -0,0 +1,268 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" href="__CSS__/pro_promote.css" type="text/css" />
<script src="__STATIC__/jquery.form.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<script src="__STATIC__/juicer-min.js" type="text/javascript"></script>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
.layui-layer-dialog .layui-layer-content{color:red}
.butnbox {padding:10px 0 10px;}
.butnbox .butnlist {overflow:hidden;clear:both;}
.butnbox .butnlist .butn,.butnbox .butnlist .butn:hover {text-decoration:none;border:none;}
.butnbox .butnlist .butn {display:inline-block;width:120px;height:28px;line-height:28px;text-align:center;color:#FFF;background:#3C95C8;border-radius:3px;}
.butnbox .butnlist .butn.last {background:#009900;}
.butnbox .butnlist .butn~.butn {margin-left:20px;}
.data_list table tbody tr a.disabled,.data_list table tbody tr a.disabled:hover {color:#999;cursor:default;}
.layui-layer-title {
text-align: center;
height: 80px;
line-height: 80px;
font-weight: 600;
font-size: 18px;
}
/* .data_list table td{
line-height: 2;
} */
.layui-layer-title {
text-align: center;
height: 42px;
line-height: 42px;
font-weight: 400;
font-size: 14px;
}
.tooltip {
position: relative;
/* display: block; */
/* color: #056dae; */
}
.tooltip .tooltiptext {
display: none;
width: 100%;
background-color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 10px 5px 5px;
position: absolute;
z-index: 1;
bottom: 80%;
left: 0;
border: #000 solid 1px;
line-height: 20px;
}
.tooltip .tooltiptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: black transparent transparent transparent;
}
.tooltip:hover .tooltiptext {
color: #333;
display: block;
}
.page .sch-btn:before{
content: '';
padding: 0;
}
::-webkit-scrollbar {
width: 3px;
height: 3px;
}
::-webkit-scrollbar-track {
border-radius: 3px; /*滚动条的背景区域的圆角*/
}
::-webkit-scrollbar-thumb {
border-radius: 3px; /*滚动条的圆角*/
background-color: #ccc; /*滚动条的背景颜色*/
}
::-webkit-scrollbar-thumb:hover {
background-color: #bbb;
}
::-webkit-scrollbar-thumb:active {
cursor: pointer;
}
.triangle{
width:0;
height:0;
border-top:10px solid blue;
border-left:8px solid transparent;
border-right:8px solid transparent;
border-bottom:0;
/*float: left;*/
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">打款名录</h3>
<p class="description_text">导出后可批量打款</p>
</div>
<div class="cf top_nav_list" style="height: 38px;">
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list" style="margin-bottom: 0">
<div class="input-list">
<input type="text" name="nickname" class="" value="{:I('nickname')}" placeholder="昵称查找" style="width: 180px;"/>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('customerLists','model='.$model['name'] .'&row='.I('row'),false)}">搜索</a>
</div>
</div>
</div>
<div class="butnbox" >
<div class="butnlist jscheckbutn" style="margin-left: 2px">
<a class='butn' id='customerExport'>导出所选记录</a>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th><input class="check-all" type="checkbox"></th>
<th>昵称</th>
<th>openid</th>
<th>头像</th>
<th>添加时间</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<if condition = "empty($data)">
<tr>
<td colspan="16" class="text-center">aOh! 暂时还没有内容!</td>
</tr>
</if>
<notemtpy name = "data">
<volist name="data" id="data">
<tr>
<td ><input class="ids" type="checkbox" value="{$data['ids']}" data-verify_id="{$data['id']}" name="ids[]"></td>
<td>{$data.nickname}</td>
<td>{$data.openid}</td>
<td style="display: flex;justify-content:center"><img src="{$data.avatar}" style="width: 50px;height: auto;"></td>
<td>{$data.create_time}</td>
</tr>
</volist>
</notemtpy>
</tbody>
</table>
</div>
</div>
<div class="page">
{$_page|default=''}
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">
';
</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script src="__STATIC__/laydate/laydate.js" type="text/javascript"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script src="__STATIC__/layer/extend/layer.ext.js"></script>
<script type="text/javascript">
</script>
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('customerLists')}");
$(function(){
$("#customerExport").click(function () {
var flag = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
return $(elem).data("verify_id");
}).get();
if(text.length < 1){
layer.msg("<font style='color:white'>" + '请先选择要导出的打款单' + "</font>");
return;
}
_export();
function _export(){
layer.alert("<font style='color:#333'>"+"指令执行成功,等待浏览器响应中,注意打款金额默认为元,打款模板的表头不允许修改"+ "</font>");
var id = text.join(",");
var url ="{:U('customerExport')}"+"&ids="+id;
var iframeExcel = "<iframe src='"+url+"' width='0px' height='0px' style='z-index:-1;position: absolute;top: -999999px;'></iframe>"
$("body").append(iframeExcel);
}
});
$("#search").click(function(){
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&"+$('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
query = query.replace(/^&/g,'');
if( url.indexOf('?')>0 ){
url += '&' + query;
}else{
url += '?' + query;
}
window.location.href = url;
});
//回车自动提交
$('.jssearch').find('input').keyup(function(event){
if(event.keyCode===13){
$("#search").click();
}
});
})
</script>
</block>

@ -0,0 +1,788 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" href="__CSS__/pro_promote.css" type="text/css" />
<script src="__STATIC__/jquery.form.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
.layui-layer-dialog .layui-layer-content{color:red}
.butnbox {padding:10px 0 10px;}
.butnbox .butnlist {overflow:hidden;clear:both;}
.butnbox .butnlist .butn,.butnbox .butnlist .butn:hover {text-decoration:none;border:none;}
.butnbox .butnlist .butn {display:inline-block;width:120px;height:28px;line-height:28px;text-align:center;color:#FFF;background:#3C95C8;border-radius:3px;}
.butnbox .butnlist .butn.last {background:#009900;}
.butnbox .butnlist .butn~.butn {margin-left:20px;}
.data_list table tbody tr a.disabled,.data_list table tbody tr a.disabled:hover {color:#999;cursor:default;}
.layui-layer-title {
text-align: center;
height: 80px;
line-height: 80px;
font-weight: 600;
font-size: 18px;
}
/* .data_list table td{
line-height: 2;
} */
.layui-layer-title {
text-align: center;
height: 42px;
line-height: 42px;
font-weight: 400;
font-size: 14px;
}
.tooltip {
position: relative;
/* display: block; */
/* color: #056dae; */
}
.tooltip .tooltiptext {
display: none;
width: 100%;
background-color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 10px 5px 5px;
position: absolute;
z-index: 1;
bottom: 80%;
left: 0;
border: #000 solid 1px;
line-height: 20px;
}
.tooltip .tooltiptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: black transparent transparent transparent;
}
.tooltip:hover .tooltiptext {
color: #333;
display: block;
}
.page .sch-btn:before{
content: '';
padding: 0;
}
::-webkit-scrollbar {
width: 3px;
height: 3px;
}
::-webkit-scrollbar-track {
border-radius: 3px; /*滚动条的背景区域的圆角*/
}
::-webkit-scrollbar-thumb {
border-radius: 3px; /*滚动条的圆角*/
background-color: #ccc; /*滚动条的背景颜色*/
}
::-webkit-scrollbar-thumb:hover {
background-color: #bbb;
}
::-webkit-scrollbar-thumb:active {
cursor: pointer;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">微信打款</h3>
<p class="description_text">批次号指同一表格上传的打款单</p>
</div>
<div class="cf top_nav_list" style="height: 38px;">
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list" style="margin-bottom: 0">
<div class="input-list">
<input type="text" name="realname" placeholder="请输入真实姓名模糊搜索" value="{:I('realname')}" style="width: 180px;">
</div>
<div class="input-list input-list-promote search_label_rehab">
<select id="pay_status" name="pay_status" class="select_gallery" >
<option value="">打款状态</option>
<volist name="PayStatus" id="vo">
<option value="{$key}" <if condition="isset($_GET['pay_status']) && $key eq I('pay_status')">selected</if> >{$vo}</option>
</volist>
</select>
</div>
<div class="input-list">
<input type="text" name="batch_num" placeholder="批次号" value="{:I('batch_num')}" style="width: 180px;">
</div>
<div class="input-list">
<input type="text" readonly id="time_start2" name="pay_time_start" class="" value="{:I('pay_time_start')}" placeholder="支付开始时间" />
&nbsp;-&nbsp;
<div class="input-append date" style="display:inline-block">
<input type="text" readonly id="datetimepicker2" name="pay_time_end" class="" value="{:I('pay_time_end')}" placeholder="支付结束时间" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('lists','model='.$model['name'] .'&row='.I('row'),false)}">搜索</a>
</div>
</div>
</div>
<div class="butnbox" >
<div class="butnlist jscheckbutn" style="margin-left: 2px">
<if condition="session('payment_user.is_payment') eq 1">
<a class='butn' id='doPayment'>打款</a>
</if>
<a class='butn' id='leadExcel'>Excel导入</a>
<a class='butn' id='export'>导出所选记录</a>
<a class='butn' id='delItem' style="background-color: red;">批量删除</a>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th><input class="check-all" type="checkbox"></th>
<th>真实姓名</th>
<th>openid</th>
<th>结算金额</th>
<th>批次号</th>
<th>打款状态</th>
<th>创建时间</th>
<th>支付时间</th>
<th>操作</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<if condition = "empty($data)">
<tr>
<td colspan="16" class="text-center">aOh! 暂时还没有内容!</td>
</tr>
</if>
<notemtpy name = "data">
<volist name="data" id="data">
<tr>
<td ><input class="ids" type="checkbox" value="{$data['id']}" data-paystatus="{$data.pay_status}" name="ids[]"></td>
<td>{$data.realname}</td>
<td>{$data.openid}</td>
<td>{$data.statement_money}</td>
<td>{$data.batch_num}</td>
<if condition="($data['pay_status'] eq -1) ">
<td style="color: red;">{$data.pay_status_str}</td>
<else />
<td>{$data.pay_status_str}</td>
</if>
<td>{$data.create_time}</td>
<td>{$data.pay_time}</td>
<td>
<a class='confirm viewPool' data-id='{$data.id}'>查看</a>
<a class='confirm exportPool' data-id='{$data.id}'>导出</a>
<if condition="$data['pay_status'] neq 0">
<a class='confirm paymentInfo' data-id='{$data.id}'>打款详情</a>
</if>
</td>
</tr>
</volist>
<tr><td style="line-height: 42px;">合计</td><td colspan="13" style="line-height: 42px;">
待打款金额:&nbsp;{$money.statement_money}&nbsp;&nbsp;&nbsp;&nbsp;打款成功金额:&nbsp;{$money.success_money}&nbsp;&nbsp;&nbsp;&nbsp;打款失败金额:&nbsp;{$money.error_money}
</td></tr>
</notemtpy>
</tbody>
</table>
</div>
</div>
<div class="page">
{$_page|default=''}
</div>
<div style="width: 800vw;height:600vh;padding: 0;position: absolute;top: 0;z-index: 9999;background-color:rgba(0,0,0,.6);right: 1px;display: none" id="window">
<div class="layui-layer layui-layer-hui" style="width:800px;height:440px;z-index: 19891015; top:28%; left:35%;border-radius: 2%;background-color:white;color: #0a001f;">
<div style="padding: 15px 30px 15px 20px;font-size: 28px;">打款提示</div>
<div class="layui-layer-content" style="font-size: 22px;padding: 0 25px;">您所选打款单与以下打款单可能存在重复,请谨慎操作</div>
<!-- <div style="padding: 0 25px">-->
<!-- <span style="width: 135px;display: block;float: left;height: 30px;text-align: center;border:#c7c7c7 1px solid;border-right:none;"><span style="display: block;padding: 6px 10px">公司</span></span>-->
<!-- <span style="width: 135px;display: block;float: left;height: 30px;text-align: center;border:#c7c7c7 1px solid;border-right:none;"><span style="display: block;padding: 6px 10px">结算时间</span></span>-->
<!-- <span style="width: 135px;display: block;float: left;height: 30px;text-align: center;border:#c7c7c7 1px solid;border-right:none;"><span style="display: block;padding: 6px 10px">结算金额</span></span>-->
<!-- <span style="width: 136px;display: block;float: left;height: 30px;text-align: center;border:#c7c7c7 1px solid;"><span style="display: block;padding: 6px 10px">支付时间</span></span>-->
<!-- </div>-->
<div class="layui-layer-content" style="font-size: 22px;padding: 5px 25px;height: 200px;overflow-x:hidden;overflow-y:scroll">
<div class="data_list">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th>公司</th>
<th>结算时间</th>
<th>结算金额</th>
<th>支付时间</th>
</tr>
</thead>
<!-- 列表 -->
<tbody id="tbody">
<tr>
<td >13214</td>
<td>13214</td>
<td>13214</td>
<td>13214</td>
</tr>
<tr>
<td >13214</td>
<td>13214</td>
<td>13214</td>
<td>13214</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div style="text-align: right;margin-top: 20px">
<div style="font-size: 28px;display: inline-block;">
<div class="search_list" style="justify-content:flex-end;width:100%;">
<div class="input-list" style="float: right;">
<a class="sch-btn" href="javascript:;" style="width: 150px;background: white;border: 1px solid black;color: black" id="back">返回</a>
</div>
</div>
</div>
<div style="padding: 0 20px 0 0;font-size: 28px;display: inline-block;">
<div class="search_list" style="justify-content:flex-end;width:100%;">
<div class="input-list" style="float: right;">
<a class="sch-btn" href="javascript:;" style="width: 150px;" id="commit">继续打款</a>
</div>
</div>
</div>
</div>
</div>
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">
';
</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script src="__STATIC__/laydate/laydate.js" type="text/javascript"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script src="__STATIC__/layer/extend/layer.ext.js"></script>
<script type="text/javascript">
</script>
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('lists')}");
function reload() {
window.location.reload();
}
function closeLayer(pay_status) {
layer.closeAll();
if (pay_status == 1) {
layer.msg("<font style='color: white'>打款成功</font>");
} else {
layer.msg("<font style='color: white'>打款失败</font>");
}
setTimeout(function () {
window.location.reload();
},2000);
}
$(function(){
$("#back,#window").click(function() {
$('#window').hide();
});
$(".viewPool").click(function () {
var id = $(this).data("id");
var url = "{:U('viewPool')}"+"&id="+id
layer.open({
type: 2,
title: "海南万盟天下科技有限公司",
shadeClose: true,
shade: 0.8,
area: ['70%', '80%'],
content: url
});
});
$(".return_verify").click(function () {
var status = $(this).data('value');
var verifytip = 0;
var paytip = 0;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
var verifystatus = $(elem).data('verifystatus');
var pay_status = $(elem).data('paystatus');
if (verifystatus == 0) {
verifytip = 1;
return ;
}
if (pay_status != 0) {
paytip = 1;
return ;
}
return $(elem).val();
}).get();
if (verifytip == 1) {
layer.msg("<font style='color:white'>" + '请选择已审核的打款单' + "</font>");
return;
}
if (paytip == 1) {
layer.msg("<font style='color:white'>" + '请选择未打款的打款单' + "</font>");
return;
}
if(text.length < 1){
layer.msg("<font style='color:white'>" + '请先选择要操作的打款单' + "</font>");
return;
}
layer.confirm('【提示】是否确认取消审核'+((status==1)?'通过':'拒绝'), {
btn: ['确认','取消'],
title:false
}, function(){
$.ajax({
type:'post',
dataType:'json',
data: {'id':text,'status':status},
url:"{:U('verify')}",
success:function(data) {
if (data.status ==1) {
//弹框
layer.msg("<font style='color:white'>审批撤回成功</font>");
setTimeout(function(){
window.location.reload();
},1500);
} else {
layer.msg("<font style='color:white'>审批撤回失败</font>");
}
},
error:function() {
alert('服务器开小差了,请稍后再试。');
// checkcode(mobile);
}
});
});
});
$(".verify").click(function () {
var status = $(this).data('value');
var verifytip = 0;
var paytip = 0;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
var verifystatus = $(elem).data('verifystatus');
var pay_status = $(elem).data('paystatus');
if (verifystatus > 0) {
verifytip = 1;
return ;
}
if (pay_status != 0) {
paytip = 1;
return ;
}
return $(elem).val();
}).get();
if (verifytip == 1) {
layer.msg("<font style='color:white'>" + '请选择未审核的打款单' + "</font>");
return;
}
if (paytip == 1) {
layer.msg("<font style='color:white'>" + '请选择未打款的打款单' + "</font>");
return;
}
if(text.length < 1){
layer.msg("<font style='color:white'>" + '请先选择要操作的打款单' + "</font>");
return;
}
layer.confirm('【提示】是否确认审核'+((status==1)?'通过':'拒绝'), {
btn: ['确认','取消'],
title:false
}, function(){
$.ajax({
type:'post',
dataType:'json',
data: {'id':text,'status':status},
url:"{:U('verify')}",
success:function(data) {
layer.msg("<font style='color:white'>" + data.msg + "</font>");
if (data.status ==1) {
//弹框
setTimeout(function(){
window.location.reload();
},1500);
}
},
error:function() {
alert('服务器开小差了,请稍后再试。');
// checkcode(mobile);
}
});
});
});
$("#export").click(function () {
var flag = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
return $(elem).val();
}).get();
if(text.length < 1){
layer.msg("<font style='color:white'>" + '请先选择要导出的打款单' + "</font>");
return;
}
_export();
function _export(){
layer.alert("<font style='color:#333'>"+"指令执行成功,等待浏览器响应中..在未确认下载完成前请勿关闭此页面.."+ "</font>");
var id = text.join(",");
var url ="{:U('viewPool')}"+"&id="+id+"&export=1&exporttype=all";
var iframeExcel = "<iframe src='"+url+"' width='0px' height='0px' style='z-index:-1;position: absolute;top: -999999px;'></iframe>"//添加下载的地址到iframe这里是公司信息我用**表示了。
$("body").append(iframeExcel);
}
})
$("#export_all").click(function() {
var start = $("#time_start").val();
var end = $("#time_end").val();
if(start !='' && end != ''){
if (Date.parse(start) > Date.parse(end)){
layer.msg('开始时间必须小于等于结束时间');
return false;
}
}
var url = $('#search').attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&"+$('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
query = query.replace(/^&/g,'');
if( url.indexOf('?')>0 ){
url += '&' + query;
}else{
url += '?' + query;
}
url += "&export=1&exporttype=all";
layer.alert("<font style='color:#333'>"+"指令执行成功,等待浏览器响应中..在未确认下载完成前请勿关闭此页面.."+ "</font>");
var iframeExcel = "<iframe src='"+url+"' width='0px' height='0px' style='z-index:-1;position: absolute;top: -999999px;'></iframe>";
$("body").append(iframeExcel);
});
$("#delItem").on("click",function(){
var flag = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($(elem).data("paystatus") == 1){
flag = true;
}else{
return $(elem).val();
}
}).get();
if(text.length < 1){
layer.msg("<font style='color:white'>无可删除数据,支付成功的数据无法删除</font>");
return;
}
text = text.join(",");
layer.confirm('【警告】删除操作将不可回退,如需继续请点击确认', {
btn: ['确认','取消'],
title:false
}, function(){
$.ajax({
type: "POST",
url: "{:U('delItem')}",
dataType: 'json',
async: false,
data: {ids:text},
success:function(data){
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}else{
layer.msg("<font style='color:white'>" + data.info + "</font>");
return false;
}
}
});
});
})
$(".exportPool").click(function(){
layer.alert("<font style='color:#333'>"+"指令执行成功,等待浏览器响应中..在未确认下载完成前请勿关闭此页面.."+ "</font>");
var id = $(this).data("id");
var url ="{:U('viewPool')}"+"&id="+id+"&export=1&exporttype=one";
var iframeExcel = "<iframe src='"+url+"' width='0px' height='0px' style='z-index:-1;position: absolute;top: -999999px;'></iframe>"//添加下载的地址到iframe这里是公司信息我用**表示了。
$("body").append(iframeExcel);
})
$(".paymentInfo").on("click",function(){
var id = $(this).data("id");
var url = "{:U('paymentInfo')}"+"&id="+id
layer.open({
type: 2,
title: "打款详情",
shadeClose: true,
shade: 0.8,
area: ['40%', '60%'],
content: url
});
});
function checkPaymentOrder() {
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
var verifystatus = $(elem).data('verifystatus');
if($(elem).data("pay") == 1 && verifystatus == 1){
return $(elem).val();
}
}).get();
console.log(text)
// text = "47,99,100";
$("#tbody").empty();
$.ajax({
type:'post',
dataType:'json',
data: {'ids':text},
url:"{:U('checkOrder')}",
success:function(data) {
if (data.data.length >0) {
var datas = data.data;
var str = "";
$('#window').show();
for (var key in datas) {
str += "<tr><td>" + datas[key]['company_name'] + "</td>"
+ "<td>"+ datas[key]['time'] + "</td>"
+ "<td>"+ datas[key]['statement_money'] + "</td>"
+ "<td>"+ datas[key]['pay_time'] + "</td></tr>";
}
$("#tbody").append(str);
return true;
} else {
doPayment();
return false;
}
},
error:function() {
alert('服务器开小差了,请稍后再试。');
}
})
}
function doPayment() {
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
// var verifystatus = $(elem).data('verifystatus');
if($(elem).data("pay") == 1){
return $(elem).val();
}
}).get();
text = text.join(",");
layer.open({
type: 2,
title: "打款详情",
shadeClose: true,
shade: 0.8,
area: ['100%', '100%'],
content: "{:U('showPayment')}"+"&ids="+text
});
// window.location.href = "{:U('showPayment')}"+"&ids="+text;
}
$("#commit").on("click",function () {
doPayment();
});
$("#doPayment").on("click",function(){
var verifytip = 0;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
var verifystatus = $(elem).data('verifystatus');
if($(elem).data("pay") == 1){
return $(elem).val();
}
// if (verifystatus != 1) {
// verifytip = 1;
// }
}).get();
// if (verifytip == 1) {
// layer.msg("<font style='color:white'>审核通过方能打款</font>");
// return;
// }
if(text.length < 1){
layer.msg("<font style='color:white'>请先选择需要打款的结算单仅大于0.1元的打款单才能进行打款</font>");
return;
}
checkPaymentOrder();
return;
text = text.join(",");
window.location.href = "{:U('showPayment')}"+"&ids="+text;
})
$("#leadExcel").on("click",function(){
window.location.href = "{:U(add)}";
})
$("#search").click(function(){
var start = $("#time_start").val();
var end = $("#datetimepicker").val();
if(start !='' && end != ''){
if (Date.parse(start) > Date.parse(end)){
layer.msg('开始时间必须小于等于结束时间');
return false;
}
}
var start2 = $("#time_start2").val();
var end2 = $("#datetimepicker2").val();
if(start2 !='' && end2 != ''){
if (Date.parse(start2) > Date.parse(end2)){
layer.msg("<font style='color:white'>支付时间开始时间必须小于等于结束时间</font>");
return false;
}
}
var verifystart = $("#verifytime_start").val();
var verifyend = $("#verifytime_end").val();
if(verifystart !='' && verifyend != ''){
if (Date.parse(verifystart) > Date.parse(verifyend)){
layer.msg("<font style='color:white'>审核时间开始时间必须小于等于结束时间</font>");
return false;
}
}
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&"+$('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
query = query.replace(/^&/g,'');
if( url.indexOf('?')>0 ){
url += '&' + query;
}else{
url += '?' + query;
}
window.location.href = url;
});
laydate.render({
elem: '#time_start'
// ,position: 'static'
});
laydate.render({
elem: '#datetimepicker'
});
laydate.render({
elem: '#time_start2'
});
laydate.render({
elem: '#datetimepicker2'
});
laydate.render({
elem: '#verifytime_start'
});
laydate.render({
elem: '#verifytime_end'
});
//回车自动提交
$('.jssearch').find('input').keyup(function(event){
if(event.keyCode===13){
$("#search").click();
}
});
})
</script>
</block>

Binary file not shown.
Loading…
Cancel
Save