@ -2,6 +2,7 @@
< 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;
@ -23,28 +24,40 @@
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 >
< p class = "description_text" > 说明:推广员后台申请提现的记录,后台审批操作 < span style = "color: red;" > 注意:批量通过不支持自动打款< / span > < / p >
< p class = "description_text" > 说明:推广员后台申请提现的记录,后台审批操作< / p >
< / div >
< div class = "cf top_nav_list" >
< empty name = "model.extend" >
< div class = "fl button_list" >
< div class = "tools" >
< a class = " ajax-post " target-form = "ids" url = "{:U('set_withdraw_ status?model='.$model['id'],array(' status'=>1,'msg_type'=>5,'field'=>'status') )}"> < span class = "button_icon button_icon12" > < / span > 通 过< / a >
< a class = " ajax-post " target-form = "ids" url = "{:U('set_withdraw_status?model='.$model['id'],array('status'=>2,'msg_type'=>6,'field'=>'status'))} "> < span class = "button_icon button_icon13" > < / span > 驳 回< / a >
< a class = " ajax-post" target-form = "ids" url = "{:U('set_withdraw_ status')}"> < span class = "button_icon button_icon12" > < / span > 通 过< / a >
< a class = " agree" data-id = "ids "> < span class = "button_icon button_icon13" > < / span > 驳 回< / a >
< / div >
< / div >
< / empty >
@ -62,14 +75,14 @@
< / select >
< / div >
< div class = "input-list" >
< input type = "text" name = " settlement_number" class = "" value = "{:I('settlement _number')}" placeholder = "提现单号" >
< input type = "text" name = " widthdraw_number" class = "" value = "{:I('widthdraw _number')}" placeholder = "提现单号" >
< / div >
< div class = "input-list" >
< select name = "ti_status" >
< option value = "" > 提现状态< / option >
< option value = "0" > 待审核< / option >
< option value = " 1"> 已通过 < / option >
< option value = "2" > 已驳回< / option >
<?php foreach (promoteWithdrawStatus() as $key => $value) :? >
< option value = " <?=$key?>"> <?=$value?> < / option >
<?php endforeach;? >
< / select >
< / div >
< input type = "hidden" name = "" value = "" class = "sortBy" >
@ -82,7 +95,6 @@
< / div >
< / div >
<!-- 数据列表 -->
< div class = "data_list" >
< div class = "" >
@ -94,16 +106,12 @@
< input class = "check-all" type = "checkbox" >
< / th >
< th > 提现单号< / th >
<!-- <th>提现金额</th> -->
< th > < a class = "paixu" data-order = 'sum_money' > 提现金额< / a > < / th >
< th > 推广员账号< / th >
<!-- <th>申请时间</th> -->
< th > < a class = "paixu" data-order = 'create_time' > 申请时间< / a > < / th >
< th > 提现状态< / th >
< th > 说明< / th >
< th > 审核时间< / th >
< th > 打款方式< / th >
<!-- <th>打款途径</th> -->
<!-- <th>自动打款状态</th> -->
< th > 操作< / th >
< / tr >
< / thead >
@ -125,44 +133,20 @@
< input class = "ids disabled" disabled = "disabled" type = "checkbox" value = "{$data['id']}" name = "ids[]" >
< / eq >
< / td >
< td > {$data.settlement _number}< / td >
< td onclick = "details('{$data[ 'settlement_number']}') "> < span class = "money_color" > {$data.sum_money}< / span > < / td >
< td > {$data.widthdraw _number}< / td >
< td onclick = "details('{$data[ "id " ] } ' ) "> < span class = "money_color" > {$data.sum_money}< / span > < / td >
< td > {:get_promote_name($data['promote_id'])}< / td >
< td > < notempty name = "data.create_time" > {$data.create_time|date='Y-m-d H:i:s',###}< else / > ---< / notempty > < / td >
< td >
< eq name = "data.status" value = "0" > < span class = "check_wait_color" > 待审核< / span > < / eq >
< eq name = "data.status" value = "1" > < span class = "check_pass_color" > 已通过< / span > < / eq >
< eq name = "data.status" value = "2" > < span class = "check_notpass_color" > 已驳回< / span > < / eq >
< / td >
< td > < notempty name = "data.end_time" > {$data.end_time|date='Y-m-d H:i:s',###}< else / > ---< / notempty > < / td >
<!-- <php>
$type_arr = [0=>'---',1=>'手动打款',2=>'自动打款'];
$way_arr = [0=>'---',1=>'支付宝',2=>'微信'];
$status_arr = [0=>'---',1=>'成功',2=>'失败'];
< / php > -->
< td > {:$data['widthdraw_number']==''& & $data['status']==1?'手动':($data['widthdraw_number']!=''& & $data['status']==1?'自动':'--')}< / td >
<!-- <td>{$way_arr[$data['withdraw_way']]}</td>
< td > {$status_arr[$data['withdraw_status']]}< / td > -->
< td > {:promoteWithdrawStatus($data['status'])}< / td >
< td > {$data.respond}< / td >
< td > < notempty name = "data.audit_time" > {$data.audit_time|date='Y-m-d H:i:s',###}< else / > ---< / notempty > < / td >
< td >
< div class = "partakebtn" >
< if condition = "$data.status eq 0" >
< a class = "agree" data-id = "{$data['id']}" data-promote_id = "{$data['promote_id']}"
promote-name="{:get_promote_account($data['promote_id'])}" promote-money="{$data['sum_money']}" target-form="ids"
alipay_account="{:get_promote_alipay_account($data['promote_id'])}"
weixin_account="{:get_promote_weixin_account($data['promote_id'])}"
url="{:U('set_withdraw_status',array('ids'=>$data['id'],'status'=>1,'msg_type'=>5,'field'=>'status'))}">通过< / a >
< a class = "ajax-get" target-form = "ids"
url="{:U('set_withdraw_status',array('ids'=>$data['id'],'status'=>2,'msg_type'=>6,'field'=>'status'))}">驳回< / a >
< elseif condition = "$data.status eq 2" / >
< a class = "agree" data-id = "{$data['id']}" data-promote_id = "{$data['promote_id']}"
promote-name="{:get_promote_account($data['promote_id'])}" promote-money="{$data['sum_money']}" target-form="ids"
alipay_account="{:get_promote_alipay_account($data['promote_id'])}"
weixin_account="{:get_promote_weixin_account($data['promote_id'])}"
url="{:U('set_withdraw_status',array('ids'=>$data['id'],'status'=>1,'msg_type'=>5,'field'=>'status'))}">通过< / a >
<!-- <a class="ajax - get disabled" disabled="disabled">驳回</a><a class="ajax - get disabled" disabled="disabled">驳回</a> -->
< else / >
<!-- <a class="ajax - get disabled" disabled="disabled">通过</a>
< a class = "ajax-get disabled" disabled = "disabled" > 驳回< / a > -->
< a class = "ajax-get" url = "{:U('set_withdraw_status',array('ids'=>$data['id']))}" > 通过< / a >
< a class = "agree" data-id = "{$data['id']}" > 驳回< / a >
< elseif condition = "$data.status eq 1" / >
< a class = "upload-transfer-proof" data-id = "{$data['id']}" > 上传汇款证明< / a >
< / if >
< / div >
< / td >
@ -192,60 +176,40 @@
< / div >
<!-- 打款弹出层 -->
< div class = "promote-layer mb20" >
< form id = "ajaxForm" action = "{:U('set_withdraw _agree ')}" method = "post" >
< form id = "ajaxForm" action = "{:U('set_withdraw ')}" method = "post" >
< input type = "hidden" name = "ids" id = "hd_ids" value = "" / >
< input type = "hidden" name = "promote_id" id = "hd_promote_id" value = "" / >
< input type = "hidden" name = "status" value = "1" / >
< input type = "hidden" name = "msg_type" value = "5" / >
< input type = "hidden" name = "field" value = "status" / >
< span class = "promote-name" > 打款方式:< / span >
< input type = "radio" name = "withdraw_type" value = "1" id = "auto" checked / >
< label for = "auto" class = "promote-way pr60" > 手动< / label >
< input type = "radio" name = "withdraw_type" value = "2" id = "manual" / >
< label for = "manual" class = "promote-way" > 自动< / label >
< input type = "hidden" name = "case" id = "case" value = "deny" / >
< ol class = "promote-con" >
< li class = "promote-con-con promote-show" >
< div class = "mb20" > < span class = "promote-name" > 推广员账号:< / span > < b > < font class = "promote-name_s" > < / font > < / b > < / div >
< div class = "mb20" > < span class = "promote-name" > 结算金额:< / span > < b > ¥< font class = "promote-money_s" > < / font > < / b > < / div >
< a href = "javascript:;" id = "agree_btn" > < div class = "promote-btn" > 通过< / div > < / a >
< / li >
< li class = "promote-con-con " >
< li class = "promote-con-con " id = "deny" >
< div class = "mb20" >
< span class = "promote-name" > 打款途径:< / span >
< input type = "radio" name = "withdraw_way" id = "alipay" value = "1" checked / >
< label for = "alipay" class = "pr43" > 支付宝< / label >
<!--
< input type = "radio" name = "withdraw_way" id = "wechatpay" value = "2" / >
< label for = "wechatpay" > 微信< / label > < / div > -->
< span class = "promote-name" > < i class = "mustmark" > *< / i > 说明:< / span >
< textarea class = "textarea-style" name = "respond" > < / textarea >
< / div >
< div class = "mb20" >
< span class = "promote-name path-name" > 支付宝账号:< / span >
< b class = "alipay_account_s" > < / b >
< b class = "weixin_account_s" style = "display:none" > < / b >
< / div >
< div class = "mb20" > < span class = "promote-name" > 推广员账号:< / span > < b class = "promote-name_s" > < / b > < / div >
< div class = "mb20" > < span class = "promote-name" > 结算金额:< / span > < b > ¥< font class = "promote-money_s" > < / font > < / b > < / div >
< div class = "mb20" >
< span class = "promote-name path-name" > 超管手机号:< / span >
< b class = "puser" > {$adminmobile}< / b >
< a href = "javascript:;" class = "pop-code smcode sendvcode" > 获取验证码< / a >
< / div >
< div class = "mb20" >
< span class = "promote-name path-name" > 手机验证码:< / span >
< input type = "txt" name = "code" >
< a href = "javascript:;" id = "agree_btn" > < div class = "promote-btn" > 驳回< / div > < / a >
< / li >
< li class = "promote-con-con" id = "upload" >
< div class = "mb20" style = "display: flex;" >
< span class = "promote-name" > < i class = "mustmark" > *< / i > 汇款证明:< / span >
< div id = "uploader" class = "wu-example" >
<!-- 用来存放文件信息 -->
< div class = "btns" >
< div id = "picker" > 选择文件< / div >
< / div >
< div style = "display: flex;" >
< div id = "thelist" class = "uploader-list" > < / div >
< div class = "uploader-list" style = "margin-left: 20px;" >
< img id = "imgList" >
< / div >
< / div >
< input type = "hidden" name = "transfer_proof" id = "transfer_proof" >
< / div >
< / div >
< a href = "javascript:;" id = "promote_btn" > < div class = "promote-btn" > 确定打款< / div > < / a >
< a href = "javascript:;" id = " save "> < div class = "promote-btn" > 保存< / div > < / a >
< / li >
< / ol >
< / form >
< / div >
< / block >
< block name = "script" >
@ -267,51 +231,11 @@ $(".select_gallery").select2();
//导航高亮
highlight_subnav('{:U('Query/withdraw')}');
$(function(){
$(".paixu").click(function(){
$ddd=$(this).attr('date-url');
$sum_money="{:I('sum_money')}";
$create_time = "{:I('create_time')}";
if($ddd=='sum_money'){
if($sum_money==1){
$(".sortBy").attr('name','sum_money');
$(".sortBy").attr('value',2);
$("#search").click();
}else{
$(".sortBy").attr('name','sum_money');
$(".sortBy").attr('value',1);
$("#search").click();
}
}
if($ddd=='create_time' ){
if($create_time==1){
$(".sortBy").attr('name','create_time');
$(".sortBy").attr('value',2);
$("#search").click();
}else{
$(".sortBy").attr('name','create_time');
$(".sortBy").attr('value',1);
$("#search").click();
}
}
})
//搜索功能
$("#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;
});
$(".paixu").click(function(){
var that=$(this);
$data_order=that.attr('data-order');
$order_type='{$userarpu_order}';
console.log($order_type);
if($order_type==''||$order_type=='4'){
$(".sortBy").attr('name','data_order');
val='3,'+$data_order;
@ -324,86 +248,66 @@ $(function(){
$("#search").click();
}
});
//搜索功能
$("#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();
}
});
$('#time-start').datetimepicker({
format: 'yyyy-mm-dd',
language:"zh-CN",
minView:2,
autoclose:true
});
$('#datetimepicker').datetimepicker({
format: 'yyyy-mm-dd',
language:"zh-CN",
minView:2,
autoclose:true,
pickerPosition:'bottom-left'
})
$('#promote').on('click',function(event) {
var navlist = $(this).find('.nav-list');
if (navlist.hasClass('hidden')) {
navlist.removeClass('hidden');
$(this).find('.sort-txt').focus().val('');
} else {
navlist.addClass('hidden');
}
$(document).one('click', function(){
navlist.addClass('hidden');
});
event.stopPropagation();
});
$('#promote .sort-txt').on('keyup',function(event) {
var val = $.trim($(this).val()).toLowerCase();
$('#promote').siblings('input').val(val);
});
$('#promote .nav-list').find("a").each(function(){
var that = $('#promote');
$(this).click(function(){
var text = $.trim($(this).text()).toLowerCase();
that.find('.sort-txt').val(text);
that.siblings('input').val(text);
})
});
})
});
function details(settlement_number ){
function details(id){
layer.open({
type: 2,
title: '结算详情',
shadeClose: true,
shade: 0.8,
area: ['80%', '70%'],
content: '/admin.php?s=/Query/withdrawDetails/settlement_number/'+settlement_number +'' //iframe的url
content: '/admin.php?s=/Query/withdrawDetails/id/'+id+'' //iframe的url
});
}
< / script >
<!-- 打款弹出层 -->
< script type = "text/javascript" >
var ids = [];
var uploaderFile = false;
$(function(){
//点击同意按钮
$('.agree').click(function(){
var that = $(this);
var id = that.attr("data-id");
ids = [];
$("#hd_ids").val($(this).attr("data-id"));
$("#hd_promote_id").val($(this).attr("data-id"));
$(".promote-name_s").text($(this).attr('promote-name')); //推广员账号
$(".promote-money_s").text($(this).attr('promote-money')); //结算金额
if (id === 'ids') {
$('input[class=ids]:checked').each(function (e) {
ids.push(parseInt($(this).val()));
});
if (ids.length === 0) {
updateAlert('请选择需要操作的数据','tip_error');
setTimeout(function(){
$('#tip').find('.tipclose').click();
},1500);
return false;
}
$("#hd_ids").val(ids);
} else {
$("#hd_ids").val($(this).attr("data-id"));
}
$(".alipay_account_s").text(that.attr('alipay_account')); //支付宝账号
$(".weixin_account_s").text(that.attr('weixin_account')); //微信账号
var lh = '320px';
var val = parseInt($.trim($('input:radio[name="withdraw_type"]:checked').val()));
if(val==2) {lh='610px';}
@ -415,189 +319,144 @@ function details(settlement_number){
area: ['387px', lh],
content: $('.promote-layer')
});
$('#case').val('deny');
$('#deny').addClass('promote-show');
$('#upload').removeClass('promote-show');
});
//打款方式选择
$('input:radio[name="withdraw_type"]').change(function(){
var index=$(this).val();
// console.log(index);
if(index==1){
$(".promote-con-con").eq(0).addClass("promote-show").siblings().removeClass("promote-show");
$(".layui-layer").css("height","320px");
$(".layui-layer-content").css("height","280px");
}
else{
$(".promote-con-con").eq(1).addClass("promote-show").siblings().removeClass("promote-show");
$(".layui-layer").css("height","610px");
$(".layui-layer").css("top","250px");
$(".layui-layer-content").css("height","540px");
}
});
$('.upload-transfer-proof').click(function(){
var that = $(this);
var id = that.attr("data-id");
$("#hd_ids").val($(this).attr("data-id"));
uploadFile();
// 打款途径选择
$('input:radio[name="withdraw_way"]').change(function(){
var index=$(this).val();
if(index==1){
$(".alipay_account_s").show();
$(".weixin_account_s").hide();
$(".path-name").html("支付宝账号");
}else{
$(".alipay_account_s").hide();
$(".weixin_account_s").show();
$(".path-name").html("微信账号");
}
var lh = '320px';
var val = parseInt($.trim($('input:radio[name="withdraw_type"]:checked').val()));
if(val==2) {lh='610px';}
layer.open({
type: 1,
title: '& nbsp',
shadeClose: true,
shade: 0.8,
area: ['387px', lh],
content: $('.promote-layer')
});
$('#case').val('upload_transfer_proof');
$('#upload').addClass('promote-show');
$('#deny').removeClass('promote-show');
});
$("#agree_btn").click(function () {
$("#agree_btn,#save").click(function () {
$("#ajaxForm").ajaxSubmit(function (res) {
layer.msg(res.msg);
if(res.status==1){
layer.msg('操作成功');
setTimeout('location.href=location.href',1000);
}else{
layer.msg('操作失败');
}
});
return false;
});
$("#promote_btn").click(function () {
$promote_btn_val = $('input:radio[name="withdraw_way"]:checked').val();
if($promote_btn_val==1& & $('.alipay_account_s').text()=='未知'){
layer.msg('未填写支付宝账号,请填写或选择其他打款方式');
return false;
}else if($promote_btn_val==2& & $('.weixin_account_s').text()=='未知'){
layer.msg('未绑定微信账号,请绑定或选择其他打款方式');
return false;
}
that = $(this);
if( that.hasClass('disabled')){
return false;
}
that.addClass('disabled');
$("#ajaxForm").ajaxSubmit(function (res) {
var index = layer.load(1, {
shade: [0.1,'#fff'] //0.1透明度的白色背景
});
function uploadFile() {
if (uploaderFile === false) {
uploaderFile = true;
var uploader = WebUploader.create({
// 选完文件后,是否自动上传。
auto: true,
// swf文件路径
swf: '__STATIC__/webuploader/Uploader.swf',
// 文件接收服务端。
server: "{:U('File/uploadNew',array('session_id'=>session_id()))}",
// 选择文件的按钮。可选。
// 内部根据当前运行是创建, 可能是input元素, 也可能是flash.
pick: {
id:'#picker',
multiple:true
},
// dnd: false,
paste: document.body,
// 不压缩image, 默认如果是jpeg, 文件上传前会压缩一把再上传!
resize: false,
disableGlobalDnd: true,
fileNumLimit:1,
threads:5,
thumb:true,
compress:false,
prepareNextFile: true,
chunked:false,
duplicate: true
});
// 当有文件添加进来的时候
uploader.on( 'fileQueued', function( file ) {
var thelist = $('#thelist');
// $list为容器jQuery实例
thelist.append( '< div id = "' + file.id + '" class = "item" > ' +
'< h4 class = "info" > ' + file.name + '< / h4 > ' +
'< p class = "state" > 等待上传...< / p > ' +
'< p class = "del" style = "color: #145ccd;cursor: pointer;" > 删除< / p > ' +
'< / div > ' );
//删除按钮
$('.del').on('click', function () {
uploader.removeFile(file);
thelist.empty();
$('#imgList').attr('src', '');
});
if(res.status==1){
layer.close(index);
layer.msg(res.info);
setTimeout('location.href=location.href',1000);
}else{
layer.close(index);
that.removeClass('disabled');
layer.msg(res.info);
// 创建缩略图
// 如果为非图片文件,可以不用调用此方法。
// thumbnailWidth x thumbnailHeight 为 100 x 100
console.log(file)
if (file.type.indexOf("image") !== -1) {
uploader.makeThumb( file, function( error, src ) {
if ( error ) {
$('#imgList').replaceWith('< span > 不能预览< / span > ');
return;
}
$('#imgList').attr( 'src', src );
}, 80, 80 );
}
});
});
});
// 文件上传过程中创建进度条实时显示。
uploader.on( 'uploadProgress', function( file, percentage ) {
var $li = $( '#'+file.id ),
$percent = $li.find('.progress .progress-bar');
// 避免重复创建
if ( !$percent.length ) {
$percent = $('< div class = "progress progress-striped active" > ' +
'< div class = "progress-bar" role = "progressbar" style = "width: 0%" > ' +
'< / div > ' +
'< / div > ').appendTo( $li ).find('.progress-bar');
}
< / script >
< script type = "text/javascript" >
var f=function(msg,obj) {
layer.msg(msg);
};
//发送验证码
$(".sendvcode").on('click',function() {
account=$.trim($('.puser').text());
if (!(/^1[3456789]\d{9}$/.test(account))) {
f('手机号码格式不正确');return;
}else{
$(".sendvcode").addClass('phoneok');
}
$li.find('p.state').text('上传中');
// 发送安全码
if (!$(this).hasClass('disabled')& & $(this).hasClass('phoneok')) {
var e = this,p = account;
$percent.css( 'width', percentage * 100 + '%' );
});
$.ajax({
type:'post',
url: '{:U("Phone/not_account_telsvode")}',
data: 'phone='+p,
dataType: 'json',
success: function(d) {
if (parseInt(d.status) >0) {
$(e).addClass('disabled');
addCookie("secondsremainede",60,60);//添加cookie记录,有效时间60s
$.cookie('phone',p);
settime();
uploader.on( 'uploadSuccess', function( file, response ) {
var text = '已上传';
if (response.status == 1) {
$('#transfer_proof').val(response.id);
} else {
$(e).siblings('.regyzm').addClass('msg-fail');
layer.msg(d.msg);
text = '存储失败';
}
}
});
var r = function(i, t) {
if (i>0) {
var r = 60;
$(e).addClass('disabled');
var a = setInterval(function() {
r--;
$(e).text('成功'+r + '秒'),
0 == r & & ($(e).removeClass('disabled'), $(e).text('获取验证码'), clearInterval(a))
},1e3)
}
};
}
return false;
});
function addCookie(name,value,expiresHours){
//判断是否设置过期时间,0代表关闭浏览器时失效
if(expiresHours>0){
var date=new Date();
date.setTime(date.getTime()+expiresHours*1000);
$.cookie(name, escape(value), {expires: date});
}else{
$.cookie(name, escape(value));
}
}
//修改cookie的值
function editCookie(name,value,expiresHours){
if(expiresHours>1){
var date=new Date();
date.setTime(date.getTime()+expiresHours*1000); //单位是毫秒
$.cookie(name, escape(value), {expires: date});
} else{
$.cookie(name, escape(value));
}
}
$( '#'+file.id ).find('p.state').text(text);
});
//根据名字获取cookie的值
function getCookieValue(name){
return $.cookie(name);
}
$(function(){
s = $.cookie('secondsremainede');
if(s>0){
settime();//开始倒计时
$('#sendphone').val($.cookie('phone'));
}else{
$.cookie('phone','');
}
})
uploader.on( 'uploadError', function( file ) {
$( '#'+file.id ).find('p.state').text('上传出错');
});
//发送验证码
//开始倒计时
var countdown;
function settime(obj){
var obj = $('.sendvcode');
countdown=getCookieValue("secondsremainede");
if (countdown == 0 || isNaN(countdown)) {
obj.removeClass('disabled').removeClass('phoneok').text('获取验证码')
return;
} else {
obj.addClass('phoneok');
obj.addClass("disabled");
obj.text('成功'+countdown + '秒');
countdown--;
editCookie("secondsremainede",countdown,countdown+1);
uploader.on( 'uploadComplete', function( file ) {
$( '#'+file.id ).find('.progress').fadeOut();
});
}
}
setTimeout(function() { settime() },1000) //每1000毫秒执行一次
}
< / script >
< / block >