|
|
|
<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;
|
|
|
|
}
|
|
|
|
.data_list table th {
|
|
|
|
line-height: 30px;
|
|
|
|
height: 30px;
|
|
|
|
}
|
|
|
|
.data_list table td {
|
|
|
|
line-height: 30px;
|
|
|
|
height: 30px;
|
|
|
|
}
|
|
|
|
</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>
|
|
|
|
<?php if (!$record):?>
|
|
|
|
<tr>
|
|
|
|
<td class="l"><i class="mustmark">*</i>限制类型:</td>
|
|
|
|
<td class="r table_radio">
|
|
|
|
<span class="form_radio table_btn">
|
|
|
|
<label >
|
|
|
|
<input type="radio" value="1" name="limit_type" checked="checked"> 单账号
|
|
|
|
</label >
|
|
|
|
<label >
|
|
|
|
<input type="radio" value="2" name="limit_type" > 多账号
|
|
|
|
</label>
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?php endif;?>
|
|
|
|
<?php if (!$record):?>
|
|
|
|
<tr id="batch-item" style="display: none;">
|
|
|
|
<td class="l"><i class="mustmark">*</i>推广账号:</td>
|
|
|
|
<td class="r">
|
|
|
|
<div>
|
|
|
|
<input id="account-list" type="hidden" name="accounts" value="">
|
|
|
|
<input type="file" id="fileinput" name="file" style="display: inline-block;">
|
|
|
|
<span>推广账号文件(格式见下方),暂只支持.xls .xlsx 格式文件</span>
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?php endif;?>
|
|
|
|
<tr id="single-item">
|
|
|
|
<td class="l"><i class="mustmark">*</i>推广账号:</td>
|
|
|
|
<td class="r">
|
|
|
|
<input type="text" class="txt" name="account" value="<?=$promote['account']?>" placeholder="输入推广员账号" onKeyUp="value=value.replace(/[^\w\.\/]/ig,'')">
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr id="single-item">
|
|
|
|
<td class="l"><i class="mustmark">*</i>限制游戏:</td>
|
|
|
|
<td class="r">
|
|
|
|
<select id="game_id" name="base_game_id" class="select_gallery" style="width:215px;">
|
|
|
|
<option value="0">所有游戏</option>
|
|
|
|
<?php foreach($baseGames as $baseGame):?>
|
|
|
|
<option value="<?=$baseGame['id']?>" <?php if($baseGame['id'] == $record['base_game_id']):?>selected<?php endif;?>><?=$baseGame['name']?></option>
|
|
|
|
<?php endforeach;?>
|
|
|
|
</select>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="l"><i class="mustmark">*</i>是否包含下级:</td>
|
|
|
|
<td class="r table_radio">
|
|
|
|
<span class="form_radio table_btn">
|
|
|
|
<label >
|
|
|
|
<input type="radio" value="1" name="with_sub" checked="checked"> 是
|
|
|
|
</label >
|
|
|
|
<label >
|
|
|
|
<input type="radio" value="0" name="with_sub" > 否
|
|
|
|
</label>
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="l">开始时间:</td>
|
|
|
|
<td class="r">
|
|
|
|
<input type="text" name="started_at" class="time" value="<?=$record['started_at']?>" placeholder="请选择开始时间" style="width: 200px"/>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="l">结束时间:</td>
|
|
|
|
<td class="r">
|
|
|
|
<input type="text" name="ended_at" class="time" value="<?=$record['ended_at']?>" placeholder="请选择结束时间" style="width: 200px" />
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<?php if (!$record):?>
|
|
|
|
<div id="file-item" style="width: 450px; margin-left: 50px; margin-top: 20px; display: none;">
|
|
|
|
<h5 style="margin-bottom: 5px;">文件格式参考<span style="color: red;">(请严格按此格式,文件的第一行必须是字段名,且字段名不允许修改)</span></h5>
|
|
|
|
<div class="data_list">
|
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>推广账号</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>test1234</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php endif;?>
|
|
|
|
</div>
|
|
|
|
<input type="hidden" name="id" id="id" value="{$record.id}" />
|
|
|
|
<div class="form-item cf">
|
|
|
|
<button class="submit_btn mlspacing" id="submit" type="button" 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__/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">
|
|
|
|
//导航高亮
|
|
|
|
highlight_subnav("{:U('PromoteLimitRule/records')}");
|
|
|
|
$(".select_gallery").select2();
|
|
|
|
|
|
|
|
$(function(){
|
|
|
|
$('.time').datetimepicker({
|
|
|
|
format: 'yyyy-mm-dd',
|
|
|
|
language: "zh-CN",
|
|
|
|
autoclose: true,
|
|
|
|
scrollMonth: false,
|
|
|
|
scrollTime: false,
|
|
|
|
scrollInput: false,
|
|
|
|
startView: 'month',
|
|
|
|
minView:'month',
|
|
|
|
maxView:'month',
|
|
|
|
});
|
|
|
|
showTab();
|
|
|
|
$('#company-select').on({
|
|
|
|
change: function() {
|
|
|
|
var companyId = $(this).val()
|
|
|
|
getPromotesByCompany(companyId, function(promotes) {
|
|
|
|
var html = '<option value="">请选择会长</option>'
|
|
|
|
for (var key in promotes) {
|
|
|
|
html += '<option value="' + promotes[key].id + '">' + promotes[key].account + '</option>'
|
|
|
|
}
|
|
|
|
$('#promote-select').html(html)
|
|
|
|
$('#promote-select').select2()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
function getPromotesByCompany(companyId, callback) {
|
|
|
|
$.ajax({
|
|
|
|
url: '{:U("getPromotesByCompany")}',
|
|
|
|
type: 'get',
|
|
|
|
dataType: 'json',
|
|
|
|
data: {company_id: companyId},
|
|
|
|
success: function(result) {
|
|
|
|
if (result.status == 1) {
|
|
|
|
callback(result.data.promotes)
|
|
|
|
} else {
|
|
|
|
layer.msg(result.message)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
$('input:radio[name="limit_type"]').click(function() {
|
|
|
|
if ($('input:radio[name="limit_type"]:checked').val() == 1) {
|
|
|
|
$('#batch-item').hide()
|
|
|
|
$('#file-item').hide()
|
|
|
|
$('#single-item').show()
|
|
|
|
} else {
|
|
|
|
$('#single-item').hide()
|
|
|
|
$('#batch-item').show()
|
|
|
|
$('#file-item').show()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
var isfile = false
|
|
|
|
var rABS = false; //是否将文件读取为二进制字符串
|
|
|
|
var accounts = []
|
|
|
|
|
|
|
|
$("#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'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
accounts = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]])
|
|
|
|
console.log(JSON.stringify(accounts))
|
|
|
|
$('#account-list').val(JSON.stringify(accounts))
|
|
|
|
callback();
|
|
|
|
} catch (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 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#submit').click(function (e) {
|
|
|
|
if ($('input:radio[name="limit_type"]:checked').val() == 2) {
|
|
|
|
readFileInput(function () {
|
|
|
|
if (accounts.length == 0) {
|
|
|
|
layer.msg('表格中无道具');
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
postForm()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
postForm()
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
function postForm() {
|
|
|
|
var target = $('form').get(0).action;
|
|
|
|
var query = $('form').serialize();
|
|
|
|
var that = $('#submit');
|
|
|
|
$(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);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</block>
|