Merge branch 'release' of 47.111.118.107:wmtx/platform into feature/channel_fee

master
sunke 5 years ago
commit c0e506a89d

@ -0,0 +1,266 @@
<?php
namespace Admin\Controller;
use User\Api\UserApi as UserApi;
use Base\Service\PresidentDepositService;
/**
* 会长押金管理
*/
class PresidentDepositController extends ThinkController
{
public function records()
{
$companyType = I('company_type');
$payType = I('pay_type');
$status = I('status');
$promoteId = I('promote_id');
$query = M('promote', 'tab_')->where(['level' => 1])->where(['company_belong' => ['in', [1, 2]]]);
$idStrWhere = [];
if ($promoteId !== '') {
$idStrWhere[] = 'id = ' . $promoteId;
}
if ($companyType !== '') {
$query->where(['company_belong' => $companyType]);
}
$promoteIds = [];
if ($status !== '') {
$tempPromoteIds = M('president_deposit', 'tab_')->where(['status' => $status])->getField('promote_id', true);
if (count($tempPromoteIds) > 0) {
$idStrWhere[] = 'id in (' . implode(',', $tempPromoteIds) . ')';
} else {
$idStrWhere[] = '1<>1';
}
}
if ($payType !== '') {
$tempPromoteIds = M('president_deposit', 'tab_')->where(['pay_type' => $payType])->getField('promote_id', true);
if (count($tempPromoteIds) > 0) {
$idStrWhere[] = 'id in (' . implode(',', $tempPromoteIds) . ')';
} else {
$idStrWhere[] = '1<>1';
}
}
if (count($idStrWhere) > 0) {
$query->where(['_string' => implode(' and ', $idStrWhere)]);
}
$promotes = $query->select();
$relationQuery = M('promote_company', 'tab_')->field(['id', 'company_name']);
$promotes = $this->mergeOneReletions('company', $promotes, $relationQuery, 'company_id', 'id');
$relationQuery = M('president_deposit', 'tab_');
$promotes = $this->mergeOneReletions('presidentDeposit', $promotes, $relationQuery, 'id', 'promote_id');
$relationQuery = M('promote_belong', 'tab_')->field(['verify_time', 'promote_id']);
$promotes = $this->mergeOneReletions('promoteBelong', $promotes, $relationQuery, 'id', 'promote_id');
/*echo '<pre>';
var_dump($promotes);
echo '</pre>';
die();*/
$companyTypes = [
1 => '外团',
2 => '外团-分发联盟',
];
$this->assign('payWays', PresidentDepositService::$payWays);
$this->assign('payTypes', PresidentDepositService::$payTypes);
$this->assign('companyTypes', $companyTypes);
$this->assign('statusList', PresidentDepositService::$statusList);
$this->assign('promotes', $promotes);
$this->display();
}
private function mergeOneReletions($name, $records, $relationQuery, $selfColumn, $relationColumn = 'id')
{
$values = array_column($records, $selfColumn);
if (count($values) == 0) {
return [];
}
$rows = $relationQuery->where([$relationColumn => ['in', $values]])->select();
foreach ($records as &$record) {
$record[$name] = null;
}
foreach ($records as &$record) {
foreach ($rows as $row) {
if ($record[$selfColumn] == $row[$relationColumn]) {
$record[$name] = $row;
}
}
}
return $records;
}
public function edit()
{
$this->meta_title = '编辑/查看会长押金';
$id = I('id', 0);
$promote = M('promote', 'tab_')->field(['account', 'id'])->where(['id' => $id])->find();
$record = M('president_deposit', 'tab_')->where(['promote_id' => $id])->find();
$this->assign('payWays', PresidentDepositService::$payWays);
$this->assign('payTypes', PresidentDepositService::$payTypes);
$this->assign('promote', $promote);
$this->assign('record', $record);
$this->display('form');
}
public function save()
{
$payWay = I('pay_way', 0);
$payType = I('pay_type', 0);
$promoteId = I('id', 0);
$payAccount = I('pay_account', '');
$amount = floatval(I('amount', 0));
$payer = I('payer', '');
$record = M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->find();
if (!$record) {
if ($payType == 0) {
return $this->error('请选择押金付款方式');
}
if ($payWay == 0) {
return $this->error('请选择付款方式');
}
$data = [];
$data['pay_way'] = $payWay;
$data['pay_type'] = $payType;
$data['promote_id'] = $promoteId;
$data['pay_account'] = $payAccount;
$data['amount'] = $amount;
$data['payer'] = $payer;
$data['create_time'] = time();
$data['update_time'] = time();
M('president_deposit', 'tab_')->add($data);
return $this->success('保存成功', U('PresidentDeposit/records'));
}
if ($record['status'] != 0) {
return $this->error('该状态下不可编辑/修改');
}
if ($amount == 0) {
return $this->error('请输入金额');
}
if ($payer == '') {
return $this->error('请输入付款人');
}
if ($payAccount == '') {
return $this->error('请输入付款账号');
}
$data = [];
$data['pay_account'] = $payAccount;
$data['amount'] = $amount;
$data['payer'] = $payer;
$data['update_time'] = time();
M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->save($data);
return $this->success('保存成功');
}
public function delete()
{
$promoteId = I('id', 0);
M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->delete();
$this->ajaxReturn([
'status' => 1,
'message' => '删除成功'
]);
}
public function noDeposit()
{
$promoteId = I('id', 0);
$record = M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->find();
if (!$record) {
$data = [];
$data['pay_way'] = 0;
$data['pay_type'] = PresidentDepositService::PAY_TYPE_NONE;
$data['promote_id'] = $promoteId;
$data['pay_account'] = '';
$data['amount'] = 0;
$data['payer'] = '';
$data['create_time'] = time();
$data['update_time'] = time();
M('president_deposit', 'tab_')->add($data);
}
$this->ajaxReturn([
'status' => 1,
'message' => '操作成功'
]);
}
public function refund()
{
$promoteIds = I('ids', []);
if (count($promoteIds) == 0) {
$this->ajaxReturn([
'status' => 0,
'message' => '无选中项'
]);
}
$checkStatus = true;
$records = M('president_deposit', 'tab_')->field(['id', 'status'])->where(['promote_id' => ['in', $promoteIds]])->select();
foreach ($records as $record) {
if ($record['status'] != 1) {
$checkStatus = false;
break;
}
}
if (!$checkStatus) {
$this->ajaxReturn([
'status' => 0,
'message' => '含有非已到账状态记录,不可批量操作'
]);
}
M('president_deposit', 'tab_')->where(['promote_id' => ['in', $promoteIds]])->save([
'status' => 2,
'refund_time' => time(),
'update_time' => time()
]);
$this->ajaxReturn([
'status' => 1,
'message' => '操作成功'
]);
}
public function payConfirm()
{
$promoteIds = I('ids', []);
if (count($promoteIds) == 0) {
$this->ajaxReturn([
'status' => 0,
'message' => '无选中项'
]);
}
$checkStatus = true;
$records = M('president_deposit', 'tab_')->field(['id', 'status'])->where(['promote_id' => ['in', $promoteIds]])->select();
foreach ($records as $record) {
if ($record['status'] != 0) {
$checkStatus = false;
break;
}
}
if (!$checkStatus) {
$this->ajaxReturn([
'status' => 0,
'message' => '含有非待确认状态记录,不可批量操作'
]);
}
M('president_deposit', 'tab_')->where(['promote_id' => ['in', $promoteIds]])->save([
'status' => 1,
'pay_confirm_time' => time(),
'update_time' => time()
]);
$this->ajaxReturn([
'status' => 1,
'message' => '操作成功'
]);
}
}

@ -0,0 +1,415 @@
<extend name="Public/base" />
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<link href="__STATIC__/icons_alibaba/iconfont.css" rel="stylesheet">
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<script type="text/javascript" src="__STATIC__/provincecityarea/AreaData_min.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<style>
.tabcon1711 input.time {
width: 150px;
}
#form .txt_area {
width: 300px;
height: 150px;
}
.tabcon1711 .form_unit {
margin-left: 2px;
}
.tabcon1711 .mustmark {
margin-left:-7px;
}
.list-ratio {
display: table;
}
.list-ratio .li-ratio {
display: flex;
margin-bottom: 20px;
align-items: center;
}
.list-ratio .li-ratio .turnover, .list-ratio .li-ratio .turnover-ratio {
position: relative;
}
.list-ratio .li-ratio .turnover span, .list-ratio .li-ratio .turnover-ratio .error-message {
color: red;
position: absolute;
left: 0;
top: 30px;
white-space: nowrap;
display: none;
}
.iconfont-btn {
cursor: pointer;
}
.iconfont-style {
font-size: 18px;
color: #fff;
border-radius: 4px;
border: 0;
padding: 5px;
margin-left: 10px;
}
.iconfont-selected {
background-color: #0A9AF2;
}
.iconfont-selected:hover {
background-color: #03a9f4;
}
.iconfont-unselected {
background-color: #999;
}
.iconfont-unselected:hover {
background-color: #ababab;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">{$meta_title}</h3>
<!-- <p class="description_text">说明:此功是创建推广员时所需填写信息</p>-->
</div>
<!-- 标签页导航 -->
<div class="tab-wrap">
<div class="tab-content tabcon1711">
<!-- 表单 -->
<form id="form" action="{:U('save')}" method="post" class="form-horizontal">
<!-- 基础文档模型 -->
<div id="tab1" class="tab-pane in tab1">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l"><i class="mustmark">*</i>会长账号:</td>
<td class="r table_radio">
<span class="form_radio table_btn" style="color: red;">{$promote.account}</span>
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>押金付款方式:</td>
<td class="r">
<select name="pay_type" id="pay_type" class="select_gallery" <?php if($record):?>disabled<?php endif;?>>
<option value="">押金付款方式</option>
<?php foreach($payTypes as $key => $name):?>
<option value="<?=$key?>" <?php if($record && $record['pay_type'] == $key):?>selected<?php endif;?>><?=$name?></option>
<?php endforeach;?>
</select>
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>付款方式:</td>
<td class="r">
<select name="pay_way" id="pay_way" class="select_gallery" <?php if($record):?>disabled<?php endif;?>>
<option value="">付款方式</option>
<?php foreach($payWays as $key => $name):?>
<option value="<?=$key?>" <?php if($record && $record['pay_way'] == $key):?>selected<?php endif;?>><?=$name?></option>
<?php endforeach;?>
</select>
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l"><?php if($record):?><i class="mustmark">*</i><?php endif?>金额:</td>
<td class="r table_radio">
<input type="text" class="txt ratio" name="amount" id="amount" value="<?=$record?$record['amount']:''?>" <?php if($record && $record['status']!=0):?>disabled<?php endif;?> placeholder="请输入金额">
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l"><?php if($record):?><i class="mustmark">*</i><?php endif?>付款人:</td>
<td class="r table_radio">
<input type="text" class="txt ratio" name="payer" id="payer" value="<?=$record?$record['payer']:''?>" <?php if($record && $record['status']!=0):?>disabled<?php endif;?> placeholder="请输入付款人">
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l"><?php if($record):?><i class="mustmark">*</i><?php endif?>付款账号:</td>
<td class="r table_radio">
<input type="text" class="txt ratio" name="pay_account" id="pay_account" value="<?=$record?$record['pay_account']:''?>" <?php if($record && $record['status']!=0):?>disabled<?php endif;?> placeholder="请输入付款账号">
<span class="notice-text"></span>
</td>
</tr>
</tbody>
</table>
</div>
<input type="hidden" name="id" id="id" value="{$promote.id}" />
<div class="form-item cf">
<?php if(!$record || $record['status']==0):?>
<button class="submit_btn mlspacing" id="submit" type="submit" target-form="form-horizontal">
确认
</button>
<?php endif;?>
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();" >
返回
</a>
</div>
</form>
</div>
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$m_title}">
<input type="hidden" name="url" value="Promote/lists/type/1">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</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 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">
//导航高亮
highlight_subnav('{:U('PresidentDeposit/records')}');
$(".select_gallery").select2();
$(function(){
$('.time').datetimepicker({
format: 'yyyy-mm',
language: "zh-CN",
autoclose: true,
scrollMonth: false,
scrollTime: false,
scrollInput: false,
startView: 'year',
minView:'year',
maxView:'year',
});
showTab();
var promoteGameRatioData = {};
promoteGameRatioData.ratio = '0.00';
promoteGameRatioData.begin_time = '';
promoteGameRatioData.end_time = '';
promoteGameRatioData.remark = '';
$('#company_id').change(function (e) {
var companyId = parseInt($(this).val());
$.ajax({
type: 'post',
url: "{:U('getPromotes')}",
dataType: 'json',
data: {'company_id': companyId},
success: function (data) {
var html = '<option value="" selected>会长账号</option>';
if (data.length > 0) {
for (let i = 0;i < data.length;i++) {
html += '<option value="' + data[i]['id'] + '">' + data[i]['account'] + '(' + data[i]['real_name'] + ')' + '</option>';
}
}
$('#promote_id').html(html);
$('#promote_id').select2();
getPromoteGameRatio();
},
error: function (result) {
console.log(result);
}
});
});
$('#ratio, #begin_time, #end_time, #remark').change(function () {
var val = $(this).val();
var elementIdName = $(this).attr('id');
promoteGameRatioData[elementIdName] = val;
});
$('#promote_id, #game_id').change(function () {
getPromoteGameRatio();
});
function getPromoteGameRatio()
{
var promoteId = parseInt($('#promote_id').val());
var gameId = parseInt($('#game_id').val());
$.ajax({
type: 'post',
url: "{:U('getPromoteGameRatio')}",
dataType: 'json',
data: {'promote_id': promoteId, 'game_id': gameId},
success: function (data) {
var record = data.record;
if (data.status == 2) {
$('#ratio').val(record.ratio);
$('#last_ratio').text(record.last_ratio);
$('#begin_time').val(record.begin_time);
$('#end_time').val(record.end_time);
$('#remark').val(record.remark);
$('#id').val(record.id);
} else {
// $('#ratio').val(promoteGameRatioData.ratio);
$('#last_ratio').text(record.last_ratio);
// $('#begin_time').val(promoteGameRatioData.begin_time);
// $('#end_time').val(promoteGameRatioData.end_time);
// $('#remark').val(promoteGameRatioData.remark);
$('#id').val('');
}
}
});
}
$('#submit').click(function (e) {
var target = $('form').get(0).action;
var query = $('form').serialize();
var that = this;
$(that).addClass('disabled').attr('autocomplete','off').prop('disabled',true);
$.post(target,query).success(function(data){
if(layer) {layer.closeAll('loading');}
if (data.status==1) {
if (data.url) {
updateAlert(data.info + ' 页面即将自动跳转~');
}else{
updateAlert(data.info);
}
setTimeout(function(){
$(that).removeClass('disabled').prop('disabled',false);
if (data.url) {
location.href=data.url;
}else if( $(that).hasClass('no-refresh')){
$('#tip').find('.tipclose').click();
}else{
location.reload();
}
},1500);
}else{
updateAlert(data.info,'tip_error');
setTimeout(function(){
$(that).removeClass('disabled').prop('disabled',false);
if (data.url) {
location.href=data.url;
}else{
$('#tip').find('.tipclose').click();
}
},3000);
}
});
});
$('.iconfont-btn-add').click(function (e) {
var delBtn = $('.iconfont-btn-del');
var html = '';
html += '<div class="li-ratio">';
html += '<label class="instanceof_text">月流水:</label>';
html += '<select name="instanceof[]" style="width: 50px;margin-right: 10px;">';
html += '<option value="1"></option>';
html += '<option value="2">></option>';
html += '</select>';
html += '<div class="turnover">';
html += '<input type="text" class="txt" name="turnover[]" value="" placeholder="请输入金额" onKeyUp="value=value.replace(/[^\\w\\.\\/]/ig, \'\')" style="width: 100px;margin-right: 10px;">';
html += '<span></span>';
html += '</div>';
html += '<label>分成比例:</label>';
html += '<div class="turnover-ratio">';
html += '<input type="text" class="txt" name="turnover_ratio[]" value="" placeholder="请输入比例" onKeyUp="value=value.replace(/[^\\w\\.\\/]/ig, \'\')" style="width: 60px;">';
html += '<span class="form_unit" style="margin-right: 10px;">%</span>';
html += '<span class="error-message"></span>';
html += '</div>';
html += '</div>';
$('.list-ratio').append(html);
if ($('.list-ratio').children().length > 1 && delBtn.children('i').hasClass('iconfont-unselected')) {
delBtn.children('i').removeClass('iconfont-unselected');
delBtn.children('i').addClass('iconfont-selected');
}
$('.list-ratio').children(':last-child').children('.turnover').children('input').change(function (e) {
turnoverChangeHandle();
});
$('.list-ratio').children(':last-child').children('.turnover-ratio').children('input').change(function (e) {
turnoverRatioChangeHandle();
});
});
$('.list-ratio').children('.li-ratio').children('.turnover').children('input').change(function (e) {
turnoverChangeHandle();
});
$('.list-ratio').children('.li-ratio').children('.turnover-ratio').children('input').change(function (e) {
turnoverRatioChangeHandle();
});
function turnoverChangeHandle()
{
$('.list-ratio').children('.li-ratio').children('.turnover').children('input').each(function () {
var that = $(this);
var thatLiRatio = that.parent().parent();
var thatLiRatioIndex = thatLiRatio.index();
var prevTurnover = 0;
var prev = thatLiRatio.prev().children().children('input');
var thatTurnover = parseFloat(that.val());
if (thatLiRatioIndex > 0) {
prevTurnover = parseFloat(prev.val());
prevTurnoverHandle(thatTurnover, prevTurnover, that);
}
});
}
function turnoverRatioChangeHandle() {
var ratio = parseFloat($('#ratio').val());
$('.list-ratio').children('.li-ratio').children('.turnover-ratio').children('input').each(function () {
var that = $(this);
var thatLiRatio = that.parent().parent();
var thatLiRatioIndex = thatLiRatio.index();
var thatTurnoverRatio = parseFloat(that.val());
if (thatLiRatioIndex === 0) {
console.log(111)
prevTurnoverRatio = ratio;
prevTurnoverRatioHandle(thatTurnoverRatio, prevTurnoverRatio, that, true);
} else {
var prev = thatLiRatio.prev().children('.turnover-ratio').children('input');
var prevTurnoverRatio = parseFloat(prev.val());
prevTurnoverRatioHandle(thatTurnoverRatio, prevTurnoverRatio, that);
}
});
}
function prevTurnoverHandle(thatTurnover, prevTurnover, that)
{
if (thatTurnover <= prevTurnover) {
that.parent().children('span').text('月流水必须大于上一个月流水');
that.parent().children('span').show();
} else {
that.parent().children('span').hide();
}
return true;
}
function prevTurnoverRatioHandle(thatTurnoverRatio, prevTurnoverRatio, that, isDefault = false)
{
if (thatTurnoverRatio <= prevTurnoverRatio) {
var msg = isDefault ? '月流水分成比例必须大于默认分成比例' : '月流水分成比例必须大于上一个月流水分成比例';
that.parent().children('.error-message').text(msg);
that.parent().children('.error-message').show();
} else {
that.parent().children('.error-message').hide();
}
return true;
}
$('.iconfont-btn-del').click(function (e) {
var that = $(this);
if ($('.list-ratio').children().length > 1) {
$('.list-ratio').children(':last-child').remove();
if ($('.list-ratio').children().length === 1) {
that.children('i').removeClass('iconfont-selected');
that.children('i').addClass('iconfont-unselected');
}
}
});
});
</script>
</block>

@ -0,0 +1,344 @@
<extend name="Public/base"/>
<block name="css">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" href="__CSS__/promote.css" type="text/css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/webuploader/webuploader.css" media="all">
<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;}
.textarea-style {
width: 200px;
height: 80px;
border-radius: 5px;
padding: 5px;
}
.mustmark {
color: #FF0000;
font-style: normal;
margin: 0 3px;
}
</style>
</block>
<block name="body">
<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="__JS__/jquery.form.js"></script>
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<script src="__STATIC__/md5.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="__STATIC__/webuploader/webuploader.js"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js"></script>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">会长押金记录</h3>
</div>
<div class="cf top_nav_list">
<empty name="model.extend">
<div class="fl button_list">
<div class="tools">
<a id="pay-confirm-btn"><span class="button_icon button_icon12"></span>确认押金已到账</a>
<a id="refund-btn"><span class="button_icon button_icon13"></span>押金已退款</a>
</div>
</div>
</empty>
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list">
<div class="input-list search-title-box">
<label>搜索:</label>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select id="promote_id" name="promote_id" class="select_gallery" style="width:120px;">
<option value="">会长账号</option>
<volist name=":get_promote_list_by_id()" id="vo">
<option value="{$vo.id}">{$vo.account}</option>
</volist>
</select>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select id="pay_type" name="pay_type" class="select_gallery" style="width:120px;">
<option value="">押金类型</option>
<?php foreach($payTypes as $key => $name):?>
<option value="<?=$key?>"><?=$name?></option>
<?php endforeach;?>
</select>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select id="status" name="status" class="select_gallery" style="width:120px;">
<option value="">押金状态</option>
<?php foreach($statusList as $key => $name):?>
<option value="<?=$key?>"><?=$name?></option>
<?php endforeach;?>
</select>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select id="company_type" name="company_type" class="select_gallery" style="width:120px;">
<option value="">工会类型</option>
<?php foreach($companyTypes as $key => $name):?>
<option value="<?=$key?>"><?=$name?></option>
<?php endforeach;?>
</select>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('PresidentDeposit/records')}">搜索</a>
</div>
<!-- <div class="input-list">
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>12,),I('get.')))}">导出</a>
</div> -->
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th>
<input class="check-all" type="checkbox">
</th>
<th>所属推广公司</th>
<th>会长账号</th>
<th>工会类型</th>
<th>付款人</th>
<th>付款方式</th>
<th>账号</th>
<th>押金类型</th>
<th>审批时间</th>
<th>押金金额</th>
<th>会长申请时间</th>
<th>押金状态</th>
<th>押金确认时间</th>
<th>操作</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<empty name ="promotes">
<td colspan="14" class="text-center">aOh! 暂时还没有内容!</td>
<else />
<volist name="promotes" id="data">
<tr data-id="<?=$data['id']?>">
<td>
<?php if($data['presidentDeposit'] && in_array($data['presidentDeposit']['payer'], [0, 1])):?>
<input class="ids" type="checkbox" value="{$data['id']}" name="ids[]">
<?php else:?>
<input class="ids disabled" disabled="disabled" type="checkbox" value="{$data['id']}" name="ids[]">
<?php endif;?>
</td>
<td>{$data.company.company_name}</td>
<td>{$data.account}</td>
<td><?=$companyTypes[$data['company_belong']]?></td>
<?php if($data['presidentDeposit']):?>
<td><?=$data['presidentDeposit']['payer']?></td>
<td><?=$payWays[$data['presidentDeposit']['pay_way']] ?? '--'?></td>
<td><?=$data['presidentDeposit']['pay_account']?></td>
<td><?=$payTypes[$data['presidentDeposit']['pay_type']] ?? '--'?></td>
<td><?=date('Y-m-d H:i:s', $data['presidentDeposit']['create_time'])?></td>
<td><?=$data['presidentDeposit']['amount']?></td>
<td><?=date('Y-m-d H:i:s', $data['promoteBelong']['verify_time'])?></td>
<td><?=$statusList[$data['presidentDeposit']['status']]?></td>
<td><?=date('Y-m-d H:i:s', $data['presidentDeposit']['pay_confirm_time'])?></td>
<td>
<div class="partakebtn">
<?php if($data['presidentDeposit']['status'] == 0):?>
<a href="<?=U('edit', ['id' => $data['id']])?>">编辑</a>
<a class="delete-btn">删除</a>
<?php else:?>
<a href="<?=U('edit', ['id' => $data['id']])?>">查看</a>
<?php endif;?>
</div>
</td>
<?php else:?>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>
<div class="partakebtn">
<a href="<?=U('edit', ['id' => $data['id']])?>">收取押金</a>
<a class="no-deposit" href="javascript:;">无需押金</a>
</div>
</td>
<?php endif;?>
</tr>
</volist>
</empty>
</tbody>
</table>
</div>
</div>
<div class="page">
<if condition="$is_admin eq true ">
<a class="sch-btn export-btn"
href="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}" target="_blank">导出</a>
</if>
{$_page|default=''}
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$m_title}">
<input type="hidden" name="url" value="Query/withdraw">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
</block>
<block name="script">
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js" ></script>
<script src="__STATIC__/jquery.cookie.js" charset="utf-8"></script>
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('PresidentDeposit/records')}');
$(function(){
//搜索功能
$("#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();
}
});
$('.no-deposit').on({
click: function() {
var id = $(this).parents('tr').eq(0).attr('data-id');
$.ajax({
url: '{:U("noDeposit")}',
type: 'post',
dataType: 'json',
data: {id: id},
success: function(result) {
if (result.status == 1) {
layer.msg(result.message)
setTimeout(function() {
window.location.href = window.location.href
}, 200)
} else {
layer.msg(result.message)
}
}
})
}
})
$('#refund-btn').on({
click: function() {
var ids = getIds();
$.ajax({
url: '{:U("refund")}',
type: 'post',
dataType: 'json',
data: {ids: ids},
success: function(result) {
if (result.status == 1) {
layer.msg(result.message)
setTimeout(function() {
window.location.href = window.location.href
}, 200)
} else {
layer.msg(result.message)
}
}
})
}
})
$('#pay-confirm-btn').on({
click: function() {
var ids = getIds();
$.ajax({
url: '{:U("payConfirm")}',
type: 'post',
dataType: 'json',
data: {ids: ids},
success: function(result) {
if (result.status == 1) {
layer.msg(result.message)
setTimeout(function() {
window.location.href = window.location.href
}, 200)
} else {
layer.msg(result.message)
}
}
})
}
})
function getIds() {
var ids = [];
$('.ids:checked').each(function() {
ids.push($(this).val());
})
return ids;
}
$('.delete-btn').on({
click: function() {
var id = $(this).parents('tr').eq(0).attr('data-id');
$.ajax({
url: '{:U("delete")}',
type: 'post',
dataType: 'json',
data: {id: id},
success: function(result) {
if (result.status == 1) {
layer.msg(result.message)
setTimeout(function() {
window.location.href = window.location.href
}, 200)
} else {
layer.msg(result.message)
}
}
})
}
})
});
$(".export-btn").on("click",function(e){
e.preventDefault();
window.location.href=$(this).attr("href")
})
</script>
</block>

@ -0,0 +1,33 @@
<?php
namespace Base\Service;
use Base\Model\PromoteModel;
use Base\Model\UserPlayInfoModel;
use Base\Model\UserPlayModel;
use Base\Model\UserModel;
use Think\Model;
class PresidentDepositService
{
const PAY_TYPE_CASH = 1;
const PAY_TYPE_DIVIDE = 2;
const PAY_TYPE_NONE = 3;
public static $payWays = [
1 => '银行转账',
2 => '支付宝转账',
3 => '微信转账',
];
public static $payTypes = [
self::PAY_TYPE_CASH => '线下转账',
self::PAY_TYPE_DIVIDE => '分成款扣除',
self::PAY_TYPE_NONE => '无需押金',
];
public static $statusList = [
0 => '待确认',
1 => '已收到',
2 => '已退款',
];
}

@ -1004,4 +1004,19 @@ class PromoteService {
}
return null;
}
public function canPresidentApplyGame($promote)
{
$topPromote = $this->getTopPromote($promote);
if (in_array($topPromote['company_belong'], [1, 2])) {
$record = M('president_deposit', 'tab_')->where(['promote_id' => $topPromote['id']])->find();
if (!$record) {
return false;
}
if ($record['status'] != 1) {
return false;
}
}
return true;
}
}

@ -7,6 +7,7 @@ use Admin\Model\ApplyModel;
use Think\Model;
use Base\Facade\Request;
use Base\Service\ApplyService;
use Base\Service\PromoteService;
/**
@ -1781,6 +1782,16 @@ class ApplyController extends BaseController
]);
}
$promoteService = new PromoteService();
if (!$promoteService->canPresidentApplyGame($promote)) {
$this->ajaxReturn([
'status' => 0,
'message' => '请联系市场专员开启',
'data' => [
]
]);
}
$icon = Request::getHost() . '/' . get_cover($game['icon'], 'path');
$applyService = new ApplyService();
@ -1811,6 +1822,7 @@ class ApplyController extends BaseController
if ($promoteId == 0) {
$promoteId = $promote['id'];
}
$apply = M('apply', 'tab_')->where(['promote_id' => $promoteId, 'game_id' => $gameId])->find();
$game = M('game', 'tab_')->field(['icon'])->where(['id' => $gameId])->find();
if ($apply == null) {
@ -1822,6 +1834,16 @@ class ApplyController extends BaseController
]);
}
$promoteService = new PromoteService();
if (!$promoteService->canPresidentApplyGame($promote)) {
$this->ajaxReturn([
'status' => 0,
'message' => '请联系市场专员开启',
'data' => [
]
]);
}
$icon = Request::getHost() . '/' . get_cover($game['icon'], 'path');
$applyService = new ApplyService();

@ -1164,6 +1164,24 @@ CREATE TABLE `tab_company_info` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COMMENT='内部公司信息';
-- 2020-02-10 liaojinling 会长押金
CREATE TABLE `tab_president_deposit` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`promote_id` varchar(60) NOT NULL COMMENT '会长ID',
`payer` varchar(50) NOT NULL DEFAULT '' COMMENT '付款人',
`amount` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '金额',
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
`pay_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '押金付款方式',
`pay_way` tinyint(1) NOT NULL DEFAULT '0' COMMENT '付款方式',
`pay_account` varchar(60) NOT NULL DEFAULT '' COMMENT '付款账号',
`pay_confirm_time` int(10) NOT NULL DEFAULT '0' COMMENT '押金确认时间',
`refund_time` int(10) NOT NULL DEFAULT '0' COMMENT '退款时间',
`create_time` int(10) NOT NULL DEFAULT '0' COMMENT '添加时间',
`update_time` int(10) NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='会长押金';
-- 2020-02-10 yulingwei 推广工会管理 新增属性类型
ALTER TABLE `tab_promote_belong`
MODIFY COLUMN `company_belong` tinyint(1) UNSIGNED NOT NULL DEFAULT 3 COMMENT '工会归属0-内团1-外团 2-分发联盟 3 无' AFTER `verify_status`,
@ -1172,4 +1190,4 @@ ADD COLUMN `company_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '工
-- 2020-02-10 cxj 推广提现--新增审核模式
ALTER TABLE `tab_withdraw`
ADD COLUMN `review_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '审核模式1-人工审核 2-自动审核';
ADD COLUMN `review_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '审核模式1-人工审核 2-自动审核';

Loading…
Cancel
Save