You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

413 lines
16 KiB
HTML

<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">
<option value="">押金付款方式</option>
<?php foreach($payTypes as $key => $name):?>
<option value="<?=$key?>"><?=$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">
<option value="">付款方式</option>
<?php foreach($payWays as $key => $name):?>
<option value="<?=$key?>"><?=$name?></option>
<?php endforeach;?>
</select>
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>金额:</td>
<td class="r table_radio">
<input type="text" class="txt ratio" name="amount" id="amount" value="" placeholder="请输入金额" onKeyUp="value=value.replace(/[^\w\.\/]/ig,'')">
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>付款人:</td>
<td class="r table_radio">
<input type="text" class="txt ratio" name="payer" id="payer" value="" placeholder="请输入付款人" onKeyUp="value=value.replace(/[^\w\.\/]/ig,'')">
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>付款账号:</td>
<td class="r table_radio">
<input type="text" class="txt ratio" name="pay_account" id="pay_account" value="" placeholder="请输入付款账号" onKeyUp="value=value.replace(/[^\w\.\/]/ig,'')">
<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">
<button class="submit_btn mlspacing" id="submit" type="submit" target-form="form-horizontal">
确认
</button>
<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/edit')}');
$(".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>