<!--标签零售样式-->
<style>
#asideBox .bq1 { background: url("http://esf.s.house365.com/zsb/images/v1.0/bq_sprites.png") no-repeat 0 -138px ;}
#asideBox .on .bq1{ background: url("http://esf.s.house365.com/zsb/images/v1.0/bq_sprites.png") no-repeat 0 0 ;}
.bqhd{color:#000;margin-top:80px;} 
.bqbuy-tit{display: block;font-size: 14px;font-weight: bold;color:#4c4c4c;margin:10px 20px;}                 
.bqbuybox{margin:0;padding: 20px 0 20px 10px;}
.bqtig1{margin-right: 10px;}
.bqmore{color:#3887f2;display: inline-block;margin-top:10px;float: right;}
.bqmore:hover{color:#3887f2;}
.bqbuybox1{margin:0;padding-bottom: 20px;}
.bqbuybox1 ul {width: 100%;}

.bqbuy-tb1 li{float: left;font-weight: bold;border-right:solid 1px #d9d9d9;text-align: center;color:#000;line-height: 40px;background-color: #eaeaea;}
.bqbuy-tb2 li{display: block;float: left;height: 80px;text-align: center;}
.bq-input{ border: 1px solid #ccc; color: #666;height: 20px;ime-mode: disabled;line-height: 20px;margin: 0;outline: 0 none;padding: 0;text-align: center;width: 30px;
color:#000;}
.bq{background-color: #ededed; border: 1px solid #ccc; display: block; height: 20px;  line-height: 20px; overflow: hidden;
 padding: 0;text-align: center;vertical-align: top;width: 20px;color:#3c3c3c;}
.bq-increase{border-left: 0 none !important; }
.bq-reduce{border-right: 0 none !important; }
.bq:hover{color: #666;text-decoration: none;}
.disable:hover{color: #ccc;cursor: not-allowed; }
.bqbtn{width: 80px;background-color: #fc6f2a;color:#fff;font-size: 14px;font-weight: bold;height: 30px;border: 1px solid #ccc;margin:25px 0 0 40px;}
.bqmid{display: inline-block;margin:30px 0 0 5px;}
.bqorg{color:#f47b38;}
.saletex{text-decoration:line-through;}
.bq-p1{display: block;margin-top:15px;}
.bq-p2{display: block;margin-top:10px;}
.bq-p3{color:#363233;line-height: 80px;}
.bq-zhu{display: block;margin:10px 0 50px 5px;}

</style>
<!--标签零售样式结束-->
<div id="centre" class="layout">
          <div class="centreInner ">
    <div class="mainInner radius5 "> 
              <!---->
              <div class="belongBox radius5">
        <div class="personalPInner fdPayInner clearfix"> 
                  
                  <!---->
                  
                  <div class="nameBox"> <span class="bold mr45 left">&nbsp;姓名：<span class="color1"><?= $info['truename'] ?></span></span> <span class="bold left">账户：</span><em class="color2 mr45 left"><?=$info['username']?></em> <span class="bold left">星级：</span><em class="color2 mr45 left"><?  echo $broker_new_info['0']['starlevel'];?>星</em><span class="bold left">房豆：</span><em class="color3 left"><?= $info['credit'] ?></em>
            <div class="btnFBbox btnLJCZbox left"> <a class="btnB btnSubmit radius5" href="/payment/recharge/">立即充值</a> </div>
            <span class="left m_l_10"><a href="http://zsb.house365.com/help/nj/?p=876" target="_blank" class="help_pay">什么是房豆</a>丨<a href="http://zsb.house365.com/help/nj/?p=518" target="_blank" class="help_pay_link">获取房豆说明</a></span> </div>
                </div>
        
        <!----> 
        
      </div>
              <!---->
              
              <div class="belongBox belongBox_visible radius5">
        <div class="titleTabBox titleTabBoxPay">
                  <div class="titleTab">
            <div class="titleTabB clearfix">
                      <dl class="list">
                <dd class="item itemOn"> <a href="#" class="link">我要购买</a> </dd>
                <dd class="item"> <a href="/tag_index/record" class="link">我的购买记录</a> </dd>
              </dl>
                    </div>
          </div>
                </div>
        <div class="pay_zx_zs_box clearfix">
                  <div class="pay_zx_zs_l">
            <dl class="list">
                      <dd class="item">还在担心每月套餐赠送的标签不够用？</dd>
                      <dd class="item">7天不到急推房就火速成交了，效果这么好还再等什么？</dd>
                      <dd class="item">急推标签也推叠加包了，心动不如行动</dd>
                    </dl>
          </div>
                  <div class="pay_zx_zs_r">
            <div class="hd bqhd"> <span>未使用标签有效期：自购买之日起<font color="#f47b38">30</font>个自然日</span> <a href="http://zsb.house365.com/help/nj/?cat=68" class="more" target="_blank">查看详细规则说明&gt;&gt;</a> </div>
          </div>
                </div>
      </div>
              <!--推广形式start-->
              <p class="bqbuy-tit">推广形式</p>
              <div class="belongBox  radius5 bqbuybox">
        <div class="left bqtig1"> <img src="http://esf.s.house365.com/zsb/images/v1.0/tg_img1.jpg" alt=""/>
                  <p><a href="http://nj.sell.house365.com/district/" class="bqmore" target="_blank"> 查看线上包装示例&gt;&gt;</a></p>
                </div>
        <div class="left"> <img src="http://esf.s.house365.com/zsb/images/v1.0/tg_img2.jpg" alt=""/>
                  <p><a href="http://nj.rent.house365.com/district/" class="bqmore" target="_blank"> 查看线上包装示例&gt;&gt;</a></p>
                </div>
      </div>
              <!--推广形式end--> 
              
              <!--我要购买start-->
		<p class="bqbuy-tit">我要购买</p>
		<?php if($house_tag_num){?>
		   <div class="belongBox  radius5 bqbuybox1">
				<ul class="bqbuy-tb1">
						  <li style="width:30%;">产品</li>
						  <li style="width:17%;">单价</li>
						  <li style="width:17%;">数量</li>
						  <li style="width:17%;">总价</li>
						  <li style="border:0;width:161px;">&nbsp;</li>
				</ul>
				<?php foreach ($house_tag_info as $house_tag_rs){?>
				<ul class="bqbuy-tb2 js_bqbuy">
						<li style="width:30%;">
									  <p class="bq-p3"><?php echo $house_tag_rs['tag_name']?></p>
						  </li>

						  <li style="width:17%;">
									<p class="bqorg bq-p1 js_prize" id="prize"><?php echo $house_tag_rs['tag_discount_price']?>房豆</p>
								  <p class="saletex bq-p2 js_prmprz" id="prmprz">原价<?php echo $house_tag_rs['tag_price']?>房豆</p>
						   </li>

							<li style="width:17%;"> 
							  <span class="bqmid">
								  <a href="javascript:;" class="left bq bq-reduce disable js_reduce_increase">-</a>
								   <input type="text" value="1" maxlength="8" class="left bq-input js_bqcount NumText" />
								   <a href="javascript:;" class="left bq bq-increase js_reduce_increase" >+</a> </span>
						   </li>

						   <li style="width:17%;">
								 <p class="bqorg bq-p1 js_total" ><?php echo $house_tag_rs['tag_discount_price']?>房豆</p>
								 <input type="hidden" class="js_price_total" value="<?php echo $house_tag_rs['tag_discount_price']?>"/>
								 <p class="bq-p2 js_favor" id="favor">已优惠<?php echo $house_tag_rs['tag_price'] - $house_tag_rs['tag_discount_price']?>房豆</p>
						   </li>

						  <li>
								 <button type="submit" class="bqbtn radius5 " onclick="bug_tag_confirm(<?php echo $house_tag_rs['id'];?>,this)">购买</button>
						  </li>
			   </ul>
			   <?php }?>
			   
		   </div>
		<?php }?>
              <!--我要购买end--> 
          <p class="bq-zhu">注：您能购买的标签包取决于您的套餐版本，当月标签购买的上限为套餐的60%，即120+30套餐可再买18个标签（6个标签包）.</p> 
            </div>
    </div>
</div>


<div class="dialog radius5" id="dialogtc" style="display: none;">
	<div class="hd">
		<h3 class="h3">提示</h3>
		<span class="close close-win" title="关闭">Χ</span> </div>
	<div class="mod">
		<div id="dialogSaveDiv" class="text"></div>
		<div style="padding:20px 0 0 65px;">
                    <a onclick="bug_tag();close_confirm_window()" class="btn savePrjoect btnConColor radius5" href="####">确定</a>
                    <a class="btn btnCon radius5 close-win" href="####">取消</a>
                    <input type="hidden"  id="dialogrowid" name="dialogrowid">
                    <input type="hidden"  id="dialogprice" name="dialogprice">
                    <input type="hidden"  id="dialognum"   name="dialognum">
                    
		</div>
	</div>
</div>





<!--操作结果弹出提示框-->
<div id="dialogts" class="dialog radius5">
    <div class="hd">
        <h3 class="h3">提示</h3>
        <span title="关闭" class="close close-win">&Chi;</span> </div>
    <div class="mod">
        <div class="text" id="dialog_tip"></div>
    </div>
</div>



<script>


//关闭确认窗口
function close_confirm_window()
{
    $("#gTipsCoverdialogtc").remove();
    $("#dialogtc").hide();
}


function bug_tag_confirm( rowid , obj )
{  
	var tag_price   = $(obj).parent().prev().find(".js_price_total").val();
	var tag_num     = $(obj).parent().parents().find(".js_bqcount").val();
	if(tag_num==0)
	{
		alert("标签数量非法!");
		return false;
	}
	document.getElementById('dialogrowid').value = rowid;
	document.getElementById('dialogprice').value = tag_price;
	document.getElementById('dialognum').value = tag_num;
	$("#dialogSaveDiv").html("您确定要花费"+tag_price*tag_num+"房豆购买"+"该条标签包吗?");
	openWin("dialogtc");
    
}


//编辑标签
function bug_tag()
{ 
	var rowid     =document.getElementById('dialogrowid').value;

	var tag_price =document.getElementById('dialogprice').value;
    var tag_num   =document.getElementById('dialognum').value;
	
	//window.location.href="/tag_index/addcart?id="+rowid+"&tag_price="+tag_price+"&tag_num="+tag_num;
	//return false;	
	$.ajax({
		type: 'get',
		url: '/tag_index/addcart',
		data: {'id':rowid,'tag_price':tag_price,'tag_num':tag_num},
		dataType: "json",
		success: function(data)
		{   
		   if( data.is_ok == '1' )
		   {  
				$("#dialogts #dialog_tip").html(data.msg);
				openWin('dialogts');
				//window.location.href="/tag_index";
			    setTimeout('window.location.href="/tag_index"',1000*3);
		   }
		   else
		   {    
				$("#dialogts #dialog_tip").html(data.msg);
				openWin('dialogts');
				setTimeout('window.location.href="/tag_index"',1000*3);
				
		
		   }
		}
	});
    
}



</script>	

<script>
$(function(){ //js_bqbuy





    //购买标签js

    //case1 输入数字的情况
     

        $(".js_bqcount").live("blur",function(){ 
           var obj=$(this);
          changePrize1(obj); 
        });
      
     $(".NumText").live("keyup",function(){   
                    $(this).val($(this).val().replace(/\D|^0/g,'')); 
                }).bind("paste",function(){  //CTR+V事件处理   
                    $(this).val($(this).val().replace(/\D|^0/g,''));    
                }).css("ime-mode", "disabled"); //CSS设置输入法不可用   


 
	//case2 点击情况
	$(".js_reduce_increase").click(function(){
            var obj=$(this);
          changePrize2(obj);


	});


      function changePrize1(obj){
                 var _count=obj.val();
                 var p = obj.parents(".js_bqbuy");
                var _prize=parseInt(p.find('.js_prize').text());//现价
                var _prmprz=p.find('.js_prmprz').text().match(/\d+/g);//原价
                var _favor=parseInt(_prmprz) - _prize;//一份优惠价
                var reduce=p.find('.bq-reduce')
                
                
               if(_count=="")
               {
                       
                       _count=1;
                       obj.val("1");
                       var total=_prize*_count+"房豆";
                       var favor="已优惠"+_favor*_count+"房豆";
                      p.find(".js_total").text(total);
                     p.find(".js_favor").text(favor);

                       
               }
               else{

                             var total=_prize*_count+"房豆";
                             var favor="已优惠"+_favor*_count+"房豆";
                              p.find(".js_total").text(total);
                             p.find(".js_favor").text(favor);
                           
                            if(_count>1){
                                  reduce.removeClass("disable");
                                
                                 
                                }

                            if(_count==1){
                                      reduce.addClass("disable");
                                     
                            }
                    }



      }



   function changePrize2(obj){

      var p = obj.parents(".js_bqbuy");
     var _prize=parseInt(p.find('.js_prize').text());//现价
     var _prmprz=p.find('.js_prmprz').text().match(/\d+/g);//原价
     var _favor=parseInt(_prmprz) - _prize;//一份优惠价
     var _count=parseInt(p.find(".js_bqcount").val());
     if(obj.hasClass("bq-increase"))
     {
         _count++;
        p.find(".js_bqcount").val(_count);
        p.find(".bq-reduce").removeClass("disable");
        var total=_prize*_count+"房豆";
        
        var favor="已优惠"+_favor*_count+"房豆";
        p.find(".js_total").text(total);
        p.find(".js_favor").text(favor);
    }
    else
    {
      if(_count!=1){
        _count--;
        p.find(".js_bqcount").val(_count);
        var total=_prize*_count+"房豆";
        var favor="已优惠"+_favor*_count+"房豆";
        p.find(".js_total").text(total);
        p.find(".js_favor").text(favor); 
      }
       if(_count==1){
        obj.addClass("disable");
        return false;
      }
      
         
    }
     


  }
  
  
})

</script> 