jquery实现 多选框传值 (用到了 选择触发事件,1、遍历所选 2、不刷新改变地址。 传参)



HTML

  <form method="get"  id="myform" action="__URL__/{$from_url}" >
        <input type="hidden" id="action" name="action" value=""/>
        用户名:<input type="text" name="uname" value="{$search.uname}" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        真实名称:<input type="text" name="real_name"  value="{$search.real_name}"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        注册时间:<input οnclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true});" name="s_reg_time_start" id="start_time" class="input Wdate" type="text" value="<notempty name='search.reg_time_start'>{$search.reg_time_start|date='Y-m-d H:i:s',###} </notempty>">
        &nbsp;至&nbsp;
        <input οnclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true});" name="s_reg_time_end" id="start_time" class="input Wdate" type="text" value="<notempty name='search.reg_time_end'>{$search.reg_time_end|date='Y-m-d H:i:s',###} </notempty>">
&nbsp;&nbsp;&nbsp;&nbsp;
<!-- <a class="btn_a" href="__APP__/admin/members/change_service/id/{$vo.id}" οnclick="change_service()"><span>重新分配</span></a> -->
<div id="div2"  class="btn_a" οnclick="change_service();select_status()" ><span>重新分配</span></a></div>
        <br/>
        投资次数:<input type="text" name="sum_invest_times_start" value="{$search.sum_invest_times_start}"  />&nbsp;至&nbsp;<input type="text" name="sum_invest_times_end"  value="{$search.sum_invest_times_end}"  />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        累计投资:<input type="text" name="sum_invest_money_start"  value="{$search.sum_invest_money_start}"/>&nbsp;至&nbsp;<input type="text" name="sum_invest_money_end"   value="{$search.sum_invest_money_end}"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        累计充值:<input type="text" name="charge_money_start"   value="{$search.charge_money_start}"/>&nbsp;至&nbsp;<input type="text" name="charge_money_end"   value="{$search.charge_money_end}"/>
        <br/>
        累计提现:<input type="text" name="sum_out_money_start"  value="{$search.sum_out_money_start}"/>&nbsp;至&nbsp;<input type="text" name="sum_out_money_end"  value="{$search.sum_out_money_end}"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        可用余额:<input type="text" name="account_money_start"  value="{$search.account_money_start}"/>&nbsp;至&nbsp;<input type="text" name="account_money_end"  value="{$search.account_money_end}"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        所属客服:
        <select name="service_id" >
            <option value="0">请选择</option>
            <volist name="kf" id="vo">
                <option value="{$vo.service_id}" <?php if(!empty($search['service_id']) && $search['service_id']==$vo['service_id'] ){ ?> selected <?php }?> >{$vo.true_name}</option>
            </volist>
        </select>&nbsp;&nbsp;&nbsp;&nbsp;
        实名认证:
         <select name="id_status" >
            <option value="-1">请选择</option>
            <option value="1" <eq name='search.id_status' value='1'>selected</eq> >是</option>
            <option value="0" <eq name='search.id_status' value='0'>selected</eq> >否</option>
        </select>&nbsp;&nbsp;&nbsp;&nbsp;
        <a class="btn_a" href="javascript:;" οnclick="$('#myform').submit();$('#action').val('');"><span>查询</span></a>
        <a class="btn_a" href="javascript:;" οnclick="$('#action').val('export');$('#myform').submit();$('#action').val('');"><span>导出</span></a>
    </form>

    
  </div>
<!--/搜索/筛选会员-->
  <div class="list">
  <table id="area_list" width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
      <th style="width:30px;">
        <input type="checkbox" id="checkbox_handle" οnclick="checkAll(this)" value="0">
        <label for="checkbox"></label>
    </th>
    <th class="line_l" rowspan="2">ID</th>
    <th class="line_l" rowspan="2">用户名</th>
    <th class="line_l" rowspan="2">姓名</th>
    <th class="line_l" rowspan="2">性别</th>
    <th class="line_l" rowspan="2">年龄</th>
    <th class="line_l" rowspan="2">手机</th>
    
    <th class="line_l" rowspan="2">投资次数</th>
    <th class="line_l" rowspan="2">累计投资金额</th>
    <th class="line_l" rowspan="2">累计充值金额</th>
    <th class="line_l" rowspan="2">累计提现金额</th>
    <th class="line_l" rowspan="2">可用余额</th>
    

    <th class="line_l" rowspan="2">注册时间</th>
    
    <th class="line_l" rowspan="2">实名认证</th>
    <th class="line_l" rowspan="2">所属客服</th>
    <th class="line_l" rowspan="2">来源</th>
    <th class="line_l" rowspan="2">推广来源</th>
    
    <th class="line_l" rowspan="2">真实地址</th>
    
    <th class="line_l" rowspan="2">操作</th>
  </tr>
  <tr>
<!--    <th class="line_l">提现</th>
    <th class="line_l">利息</th>
    <th class="line_l">奖金</th>-->
  </tr>
  <volist id="vo" name="list">
  <tr overstyle='on' id="list_{$vo.id}">
  <td><input type="checkbox" name="checkbox" id="checkbox2" οnclick="checkon(this);change_service()" value="{$vo.id}"></td>
    <td>{$vo.id}</td>
    <td>{$vo.user_name|default="-"}</td>
    <td>{$vo.real_name|default="-"}</td>
    <td>
        <eq name="vo[id_status]" value='0'>-</eq>
        <eq name="vo[id_status]" value='1'>
        <switch name="vo.sex">
            <case value="1">男</case>
            <case value="2">女</case>
            <case value="0">女</case>
            <default />-
            </switch>
        </eq>
    </td>
    <td>
        <eq name="vo[id_status]" value='0'></eq>
        <eq name="vo[id_status]" value='1'>
        <php>if($vo['age'] != 0){</php>{$vo.age|default='0'}<php>}</php>
        </eq>
    </td>
    <td>{$vo.user_phone}</td>
    <td>{$vo.sum_invest_times|default="0"}</td>
    <td>¥{$vo.sum_invest_money|default="0.00"}</td>
    <td>¥{$vo.charge_money|default="0.00"}</td>
    <td>¥{$vo.sum_withdraw|default="0.00"}</td>
    <td>¥{$vo.kyxjje|default="0.00"}</td>
    <td>{$vo.reg_time|date="Y-m-d H:i",###}</td>
    
    <td><eq name="vo[id_status]" value='0'>否</eq><eq name="vo[id_status]" value='1'>是</eq></td>
    <td>{$vo.s_name}-{$vo.true_name}</td>
    <td>
          <switch name="vo.inviter_type">
            <case value="0">
                <switch name="vo.reg_source">
                    <case value="IOS">IOS注册</case>
                    <case value="Android">Android注册</case>
                    <case value="H5">H5注册</case>
                   <default />网站注册
                </switch>
            </case>
            <case value="1">会员[{$vo.inviter_name}]邀请</case>
            <case value="2">客服[{$vo.inviter_name}]邀请</case>
            <default />-
          </switch>
    </td>
    <td>{$vo.promotion|default="-"}</td>
    <td>{$vo.reg_area|default="-"}</td>
    <td>
    <php>if( ($_SESSION['admintype'] == 4) && (empty($vo['s_name'])) && (!empty($vo['user_phone'])) && ($vo['inviter_type'] != 2) ){</php>
        <a href="__URL__/allot/id/{$vo.id}/p/{$p}">分配客服</a>&nbsp;&nbsp;
    <php>}elseif(!empty($vo['user_phone'])){</php>
        <a href="__URL__/send_note/id/{$vo.id}">发送短信</a>&nbsp;&nbsp;
    <php>}</php>
        <a href="__URL__/edit/id/{$vo.id}">修改资料</a>&nbsp;&nbsp;
        <a href="__APP__/admin/adjust/trim_money/id/{$vo.id}">调整金额</a>&nbsp;&nbsp;
        <a href="__APP__/admin/members/change_service/id/{$vo.id}">重新分配</a>
    </td>
   
  </tr>
</volist>
  </table>

  </div>

  <div class="Toolbar_inbox" style="height: 26px;">
  <div style="float:right;">
      <form action="__URL__/{$from_url}" method='get'>
      跳转到第<input type='text' style='width:30px;' name="p" value="{$p}">页
      <input type="submit" value="跳转">
      </form>
  </div>
      <div class="page right">{$pagebar}</div>
  </div>
</div>
<script type="text/javascript">
function showurl(url,Title){
    ui.box.load(url, {title:Title});
}

function select_status(){
     var idstr="";
     $("input[name='checkbox']:checkbox").each(function(){ 
         if($(this).attr("checked")){
             idstr += $(this).val()+","
         }
     })
      if(idstr == ''){
         alert('请选择会员!');         
      }
     }
function change_service(){
     var idstr="";
     $("input[name='checkbox']:checkbox").each(function(){ 
         if($(this).attr("checked")){
             idstr += $(this).val()+","
         }
     })
     
     //alert(idstr);
     
     if(idstr == ''){
         //alert('请选择会员!');
         var hre = "<div id='div2'   οnclick='change_service()' ><span>重新分配</span></a></div>"
         $("#div2").html(hre);
     }else{
     
        idstr = (idstr.substr(0,idstr.length-1)); 
        
        
        var hre = "<a  href="+"__APP__/admin/members/change_service/"+idstr+">"+"<span>重新分配</span>"+"</a>";
        //alert(hre);
        
        $("#div2").html(hre);
         //$.ajax ({
            //    url: "__APP__/admin/members/change_service",
                //type: "post",
                //dataType: "json",
                //data: {"id":str},
                //success:function(data){

                    //}

                //});
                
        
         }
     
   
}
</script>


HTML2  (中间多一层页面,可省略,只为传值,和再拼凑其他值)

<div class="page_tit">客户重新分配</div>

<div class="form2">
    <form method="post" action="__URL__/do_change_service" οnsubmit="return subcheck();">
<div id="tab_1">
    <dl class="lineD"><dt>新分配客服:</dt>
        <dd>
            <select class="c_select" id="service_id" name="service_id">
                <option value="0">请选择...</option>
                <volist key="k" name="service" id="vo">
                    <option value="{$vo.service_id}"<if condition="$data[service_id] eq $vo[service_id]">selected</if>>{$vo.user_name}-{$vo.true_name}</option>
                </volist>
            </select>
            <input type="hidden" name="id" value="{$id}">   //单选
			<input type="hidden" name="ids" value="{$ids}">   //多选
            <span class="tip" id="tip_team_id">*</span>
        </dd>
    </dl>
</div>
    <div class="page_btm">
      <input type="submit" class="btn_b" value="确定" />
    </div>
    </form>
</div>

PHP

    public function do_change_service(){
    	
    	if(!empty($_POST)){
			
			if(empty($_POST['ids'])){
				$id = $_POST['id'];				
				$service_id = $_POST['service_id'];
				$data['service_id'] = $service_id;
				$data['inviter_type'] = 0;
				$update = M('members')->where("id = $id")->save($data);
			}else{
				$id = $_POST['ids'];  //explode(',',$_POST['ids']);
				
				
				$service_id = $_POST['service_id'];
				$data['service_id'] = $service_id;
				$data['inviter_type'] = 0;
				$update = M('members')->where("id in ($id)")->save($data);  //in的运用
				
				//var_dump( M('members')->getlastsql());  //$id
				//die();
				
				
			}
		    if($update){
				$this->success('修改成功!','/Admin/members/custom_search');
		    }else{
					$this->error('修改失败,请重试!','/Admin/members/custom_search');
				}
    	}else{
    		$this->error('请提交正确数据!','/Admin/finance/adduser');
    	}
    	
    }


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

蜗牛慢慢向上爬

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值