<extend name="Public:pinduoduobase" />

<block name="content">    
<link rel="stylesheet" href="__PUBLIC__/pin/assets/css/react_boot_30305e74e4b4d863454d94cab029e844.css">
<link rel="stylesheet" href="__PUBLIC__/pin/assets/css/react_common_e1852e5ddc660dd79bef5eb49d18af1d.css">
<link rel="stylesheet" href="__PUBLIC__/pin/assets/css/react_commercial_bargain_6db21a60a93d84d59dc0bbd52d770f69.css">

<script src="__PUBLIC__/pin/js/clocktime_coupon.js"></script>

<div id="main">
   <section  class="main-view container red-bg revision" style="overflow: hidden;">
    <div class="cb-detail-container">
     <img class="bargain-bg" src="__PUBLIC__/image/bargain_bg_v3.png" />
     <div>
		<button class="rule-btn">活动规则</button>
     </div>
	 
     <div role="button" class="bargain-base-info">
      <img class="avatar" src="{$member_info.avatar}" alt="avatar" />
      <p class="nickname">{$member_info.uname}</p>
      <p class="info-hint">我发现一件好货，来一起砍价0元拿吧</p>
      <div class="goods-info">
       <img src="{$goods_info.image}" alt="goods" />
       <div class="right">
        <p class="goods-name">{$goods_info.name}</p>
        <p class="price"><i>￥</i>
         {$goods_info.price}
         </p>
       </div>
       <span class="sold-quantity">{$goods_info.seller_count}人已0元拿</span>
      </div>
     </div>
     <div class="bargain-status">
      <div class="status">
       <p class="amount">
        已砍
        <i class="already"><?php echo round($bargain_info['total_money']-$bargain_info['deal_money'],2); ?></i>
        元，还差
        <i class="remain"><?php echo $bargain_info['deal_money']; ?></i>
        元</p>
		
		<?php if($bargain_info['state'] == 1){ ?>
		<button class="button go_kan_list">砍价成功，重砍一个</button>
		<?php }else if($bargain_info['end_time'] > time()){ ?>
		
			<?php if($is_me && $bargain_info['is_share'] == 0){ ?>
		   <button class="button go_share">分享给好友，多砍一刀</button>
		   <?php } ?>
		   
		   <?php if($is_me && $bargain_info['is_share'] == 1){ ?>
		   <button class="button go_share">喊好友砍一刀</button>
		   <?php } ?>
		   
		   <?php if(!$is_me && $has_kan){ ?>
		   <button class="button go_kan_list">我也要砍价</button>
		   <?php } ?>
		   
		   <?php if(!$is_me && !$has_kan){ ?>
		   <button class="button kan_bargain">帮他砍一刀</button>
		   <?php } ?>
		
		<?php }else{ ?>
		<button class="button go_kan_list">砍价失败，重砍一个</button>
		<?php } ?>
		
		
	   
	   <?php if($bargain_info['end_time'] > time() && $bargain_info['state'] == 0){ ?>
       <p class="count-down " > 
        <!-- react-text: 40 -->
        <!-- /react-text -->
		<span class="millisecond-countdown">
			<span class="clock_div" endtime="<?php echo date('m/d/Y H:i:s', $bargain_info['end_time']);?>">
			</span>
		</span>
        <!-- react-text: 50 -->结束，快来砍价吧~
		</p>
		<?php } ?>
      </div>
      <div role="button" class="mask black-mask" style="display:none;">
       <img class="arrow" src="http://mobile.yangkeduo.com/assets/img/arrow-3bc881bf3f.png" alt="arrow" />
       <div class="hint-hew-combo with-arrow">
         <p class="hint-1">
         <!-- react-text: 66 -->你已砍
         <!-- /react-text --><i class="already"><?php echo round($bargain_info['total_money']-$bargain_info['deal_money'],2); ?></i>
         <!-- react-text: 68 -->元啦，赶快分享给好友吧
         </p>
		 
		 <?php if($bargain_info['is_share'] == 1){ ?>
		 <p class="hint-2" id="share_tip">喊好友帮你砍价吧~</p>
		 <?php }else{ ?>
         <p class="hint-2" id="share_tip">分享成功后可以多砍一刀哦</p>
		 <?php } ?>
		 
       </div>
      </div>
     </div>
     <div role="button" class="bargain-group">
      <p class="title">砍价帮</p>
      <ul class="bg-list " id="bg-list">
	  
		<?php  $i =1;foreach($kan_order_list as $val){ ?>
		<li class="user-item" <?php if($i>2){ ?> style="display:none;" <?php } ?> >
			<img src="<?php echo $val['avatar']; ?>" alt="avatar" />
			<div class="text">
			 <p class="nickname"><?php echo $val['nickname']; ?></p>
			 <p class="hint">来一起砍价0元拿</p>
			</div>
			<div class="amount">
			 <div class="knives knives-1">
			  <div class="knife"></div>
			 </div>
			 砍掉
			 <i class="detail "><?php echo $val['kan_money']; ?></i>
			 元
			</div>
		</li>
		<?php $i++; } ?>
      </ul>
	  <?php if( count($kan_order_list) >=14 ){ ?>
      <p class="bottom-note" >&middot; 只显示最近15个好友砍价记录 &middot;</p>
	  <?php }?>
	  
	   <?php if(count($kan_order_list) >=3) { ?>
	   <p role="button" class="draw-label draw-up" >
       查看更多
		<i class="draw-icon down " ></i>
	   </p>
	   <p role="button" class="draw-label draw-down" style="display:none;">
        收起
	    <i class="draw-icon up " style="background:none;"></i>
	   </p>
	   <?php } ?>
	   
     </div>
    </div>
    <div id="bargain-recommend-list" class="react-base-list-wrapper cb-recommend-container bargain-recommend-list" style="display: block;">
     <div role="button" class="recommend-list-title">
      看看其他活动
     </div>
	 <?php foreach($related_goods as $goods){ ?>
     <div  class="goods-item-container" onclick="location.href='{:U('/goods/'.$goods['goods_id'])}'">
      <div class="goods-item gap-right">
       <img class="std-goods-image-square goods-pic" src="<?php echo $goods['image']; ?>" />
       <div class="goods-name">
			<?php echo $goods['name']; ?>
       </div>
       <div class="goods-detail">
        <b class="price-icon">￥</b>
        <b class="price"><?php echo $goods['price']; ?></b>
        <div class="info">
         <span>
          <!-- react-text: 80 -->已拼
          <?php echo $goods['seller_count']; ?>
          <!-- react-text: 82 -->件
          <!-- /react-text --></span>
        </div>
       </div>
      </div>
     </div>
	 <?php } ?>
	 
    </div>
    <div class="bc-fc"></div>
    <div>
     <div class="official-activity">
      <?php echo C('SITE_TITLE'); ?>官方活动
     </div>
    </div>
   </section>
   
  
			
</div>


<div id="jsalert-assist_free_coupon_rules1516799938453"  style="display:none;">
    <div class="bg-fill bg-fill2"></div>
    <div id="assist-free-coupon-rules-alert" class="assist-free-coupon-rules-alert">
        <div class="content-wrapper">
            <div class="detail">
                <div class="title"><?php echo C('SITE_NAME'); ?>官方活动</div>
                <ul class="desc"> 
				 <?php foreach($kan_description_str as $val){ ?>
                    <li><?php echo $val; ?></li>
				<?php } ?>
                </ul>
            </div>
        </div>
    </div>
</div>

<div id="jsalert-assist_notice"  style="display:none;">
    <div class="bg-fill bg-fill2"></div>
    <div id="assist-free-coupon-rules-alert" class="assist-free-coupon-rules-alert">
        <div class="content-wrapper">
            <div class="detail">
                <div class="title">关注公众号，我们一起砍价0元拿</div>
                <ul class="desc">
					<li><img src="/Uploads/image/<?php echo C('notice_qrcode'); ?>" width="100%" /></li>
                </ul>
            </div>
        </div>
    </div>
</div>

<div id="jsalert-assist_free_coupon_rules666"  style="display:none;">
    <div class="bg-fill bg-fill2"></div>
    <div id="assist-free-coupon-rules-alert" class="assist-free-coupon-rules-alert">
        <div class="content-wrapper">
            <div class="detail">
                <div class="title">活动规则</div>
                <ul class="desc">
					<?php foreach($kan_rules_str as $val){ ?>
                    <li><?php echo $val; ?></li>
					<?php } ?>
                </ul>
            </div>
        </div>
    </div>
</div>

<div class="">
<style>

.pin-spinner-2 {
    display: none;
    position: fixed;
    width: .66rem;
    height: .66rem;
    top: 35%;
    margin: 0 auto;
    left: 0;
    right: 0;
    z-index: 999999999;
}
.ps-inner-box {
    width: 100%;
    height: 100%;
}
.ps-rotate-img {
    width: .25rem;
    height: .25rem;
    margin: auto;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    animation: rotateImg 2.5s linear infinite;
    -webkit-animation: rotateImg 2.5s linear infinite;
    z-index: 9999999999;
    position: absolute;
}

.ps-rotate-msg {
    width: 100%;
    font-size: .15rem;
    text-align: center;
    /*height: 11px;*/
    color: #ffffff;
    position: relative;
    bottom: .12rem;
}

.spinner-background {
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999999999;
}

#ps-background {
    display: none;
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0.8;
    background-color: #000;
    border-radius: .06rem;
}

.pin-spinner-wrapper-no-message {
    display: block;
    top: 50%;
    margin-top: -.65rem;
    width: .66rem;
    height: .66rem;
}

.pin-spinner-wrapper-no-message .ps-rotate-msg {
    display: none;
    bottom: 0;
}

.pin-spinner-wrapper-no-message .ps-rotate-img {
    width: .25rem;
    height: .25rem;
    bottom: 0;
    top: 0;
}

.pin-spinner-wrapper-message {
    display: block;
    top: 50%;
    margin-top: -.82rem;
    width: 1rem;
    height: 1rem;
}

.pin-spinner-wrapper-message .ps-rotate-msg {
    display: block;
    bottom: .32rem;
}

.pin-spinner-wrapper-message .ps-rotate-img {
    width: .39rem;
    height: .39rem;
    bottom: .43rem;
    top: .18rem;
}

@media only screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) {
    .pin-spinner-wrapper-no-message {
        margin-top: -.82rem;
    }

    .pin-spinner-wrapper-message {
        margin-top: -.99rem;
    }
}


@keyframes rotateImg {
    0% {
        transform: rotateZ(0deg);
    }
    50% {
        transform: rotateZ(180deg);
    }
    100% {
        transform: rotateZ(360deg);
    }
}
@-webkit-keyframes rotateImg {
    0% {
        -webkit-transform: rotateZ(0deg);
    }
    50% {
        -webkit-transform: rotateZ(180deg);
    }
    100% {
        -webkit-transform: rotateZ(360deg);
    }
}
</style>
<div id="pin-spinner" class="pin-spinner-2">
    <div id="ps-background"></div>
    <div class="ps-inner-box">
        <img id="imgInit" class="ps-rotate-img" src="data:image/png;base64, ">
    </div>
    <div id="msgInit" class="ps-rotate-msg"></div>

</div>
</div>

<include file="Widget:pin_notify" />
<include file="Public:foot_lazy" />
 <include file="Widget:pin_toast" />

<script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
  wx.config({
    debug: false,
    appId: '{$signPackage.appId}',
    timestamp: {$signPackage.timestamp},
    nonceStr: '{$signPackage.nonceStr}',
    signature: '{$signPackage.signature}',
    jsApiList: [
      'onMenuShareTimeline','onMenuShareAppMessage'
    ]
  });

  wx.ready(function () {
		wx.onMenuShareTimeline({
			title: '{$indexsharetitle}', // 分享标题
			link: '{$url}', // 分享链接
			imgUrl: '{$share_logo}', // 分享图标
			success: function () { 
				// 用户确认分享后执行的回调函数
				share_success();
			},
			cancel: function () { 
				// 用户取消分享后执行的回调函数
			}
		});
		
		wx.onMenuShareAppMessage({
			title: '{$indexsharetitle}', // 分享标题
			desc: '{$indexsharesummary}', // 分享描述
			link: '{$url}', // 分享链接
			imgUrl: '{$share_logo}', // 分享图标
			type: '', // 分享类型,music、video或link，不填默认为link
			dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
			success: function () { 
				// 用户确认分享后执行的回调函数
				share_success();
			},
			cancel: function () { 
				// 用户取消分享后执行的回调函数
			}
		});
  });
</script>
<style>
.qrcode-share-title-0{
	line-height:36px;
}
.center {
    width: 170px;
    margin: 0 auto;
    text-align: center;
}
.img_rotate {
    width: 30px;
    height: 30px;
    margin-top: 7px;
    margin-right: 5px;
    -webkit-animation: loading 1s linear 0s infinite;
}

@-webkit-keyframes loading {
    0% {
        -webkit-transform: rotate(0);
    }

    100% {
        -webkit-transform: rotate(360deg);
    }
}
.orders_text {
    line-height: 45px;
    font-weight: 700;
    font-size: 15px;
}
.m-addr-main .m-addr-close:before{
    position: absolute;
    top: 3px;
    left: 10px;
}

</style>
<script>
var offset = 0;
var _pa = 2;
var is_can_next = 1;
var cur_url = "{:U('Subject/assist_bargain_coupon')}";
var req_step = 1;
var goods_id = 0;
var sku_arr_str = '';
var address_id = 0;
var need_optionc = [];

var is_bang_kan = 0;

var bargain_id = "{$bargain_info.id}";

var  mult_sku_option = new Array();
//$('.sku-specs').length
var ajaxarea_url='{:U("/c_getarea")}';

$(function(){
	//sku-spec-value-selected kan_bargain
	//kan_bargain showTip('请填写手机');
	
	lxfEndtime();
	
	$('.draw-up').click(function(){
		$('.draw-up').hide();
		$('.draw-down').show();
		$('.user-item').show();
		//user-item 展示全部
	})
	
	$('.draw-down').click(function(){
		$('.draw-down').hide();
		$('.draw-up').show();
		$('.user-item').each(function(){
			if( $(this).index() > 1)
			{
				$(this).hide();
			}
		})
	})
	
	$('.kan_bargain').click(function(){
		if(is_bang_kan == 1){
			location.href = "{:U('Subject/assist_bargain_coupon')}";
			return false;
		}
		$.ajax({
			url:"{:U('Subject/kan_others_bargain')}",
			type:'get',
			data:{id:bargain_id},
			dataType:'json',
			success:function(ret){
				if(ret.code ==0)
				{
					is_bang_kan = 1;
					var order_detail = ret.order_detail;
					var bargain_order = ret.bargain_order;
					
					$('.already').html(bargain_order.kan_money);
					$('.remain').html(bargain_order.deal_money);
					
					$('#bg-list').prepend(ret.li_html);
					
					
					showTip('您帮砍了'+order_detail.kan_money+'元');
					$('.button').html('我也要砍价 ');
				}
				else if(ret.code ==5)
				{
					$('#jsalert-assist_notice').show();
					return false;
				}
				else {
					showTip(ret.msg);
				}
			}
		})
	})
	
	$('.go_share').click(function(){
		$('.black-mask').show();
	})
	$('.black-mask').click(function(){
		$('.black-mask').hide();
	})
	
	$('.go_kan_list').click(function(){
		location.href ="{:U('Subject/assist_bargain_coupon')}";
		return false;
	})
	
	$('.rule-btn').click(function(){
		$('#jsalert-assist_free_coupon_rules666').show();
	})
	
	
	
	$('.official-activity').click(function(){
		$('#jsalert-assist_free_coupon_rules1516799938453').show();
	})
	
	$('.assist-free-coupon-rules-alert').click(function(){
		$('#jsalert-assist_free_coupon_rules1516799938453').hide();
		$('#jsalert-assist_free_coupon_rules666').hide();
		//$('#jsalert-assist_notice').hide();
	})
	
	
	$('.sku-spec-value').on('click',function(){
		console.log(32);
	});
	$('.address-popup-title-close').click(function(){
		$('#address-popup').hide();
	})
	
	$('.add-btn').click(function(){
	
	})
	
	$('.m-addr-close').click(function(){
		$('#m-addr-mask').hide();
	})
	
	$('.afc-rules-button').click(function(){
		$('#jsalert-assist_free_coupon_rules1516799938453').show();
	})
	
	$('#qrcode-share').click(function(){
		$('#qrcode-share').hide();
	});

	$("#qrcode_share_img").click(function(event){
		event.stopPropagation();
	});

})

function share_success()
{
	
	$.ajax({
		url:"{:U('Subject/share_success_kan')}",
		type:'get',
		data:{id:bargain_id},
		dataType:'json',
		success:function(ret){
			if(ret.code ==0)
			{
				is_bang_kan = 1;
				var order_detail = ret.order_detail;
				var bargain_order = ret.bargain_order;
				
				$('.already').html(bargain_order.kan_money);
				$('.remain').html(bargain_order.deal_money);
				
				$('#bg-list').prepend(ret.li_html);
				//button 分享成功，多砍了一刀x元 
				$('.go_share').html('喊好友砍一刀 ');
				$('.black-mask').hide();
				showTip('分享成功，多砍了一刀'+order_detail.kan_money+'元');
			}
			else {
				
			}
		}
	})
}


function close_sku()
{
	$('#sku_selector').hide();
}


$(function(){
	$(window).scroll( function() { 
		//loaddata();
	});
})

</script>
</block>
