<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>熊猫美妆F码</title>
    <meta name="format-detection" content="telephone=no" />
    <script src="<?php echo RESOURCE_SITE_URL; ?>/mobile/comm/flexible.js?<?php echo bonus_version(); ?>"></script>
    <link rel="stylesheet" href="<?php echo RESOURCE_SITE_URL; ?>/mobile/fcode/css/main.css?<?php echo bonus_version(); ?>"/>
</head>
<body>
<div class="container-fluid bit_img bg_red layout_center">
    <div class="title">
        <h3 class="t_center">领取F码</h3>
        <h2 class="t_center">获得以下商品购买权</h2>
    </div>
    <div class="block_goods_item layout_center">
        <div class="block_goods layout_center">
            <img src="<?php echo $output['image']; ?>" alt="<?php echo $output['name']; ?>"/>
        </div>
        <div class="block_goods_msg t_center">
            <p><?php echo $output['name']; ?></p>
            <p>¥<?php echo $output['price']; ?></p>
        </div>
    </div>
    <div class="receive">
        <a href="javascript:void(0)" class="btn btn_receive block layout_center t_center btn_pressed" id="receive">立即领取</a>
    </div>
    <div class="loading"></div>
</div>
<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/mobile/bonus/js/zepto.min.js?<?php echo bonus_version(); ?>"></script>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js?<?php echo bonus_version(); ?>"></script>
<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/mobile/comm/wx_share.js?<?php echo bonus_version(); ?>"></script>
<script type="text/javascript">
    $(function()
    {
        $('#receive').on('touchstart',function(){
            $(this).removeClass('btn_pressed');
        });

        $('#receive').on('touchend',function()
        {
            $(this).addClass('btn_pressed');
            $('.loading').css('display','block');
            $.ajax({
                type:'get',
                dataType:'json',
                url:'/mobile/index.php?act=fcode&op=open&client_type=ajax',
                data: {
                    'common_id':<?php echo $output['common_id']; ?>,
                    'batch_code':'<?php echo $output['batch_code']; ?>'
                },
                success:function(data)
                {
                    if(data.code == 200) {
                        $('.loading').css('display','none');
                        location.replace(data.datas.url);
                    } else {
                        $('.loading').css('display','none');
                        alert('请检查网络');
                    }
                }
            })
        });

        var shareData = (function()
        {
            var url = "<?php echo url_helper::fcode_url($output['common_id'],$output['batch_code']); ?>";
            return  {
                title:"领取熊猫美妆F码",
                desc:'享<?php echo "{$output['price']}元购{$output['name']}"; ?>福利\n点击领取',
                link:url,
                imgUrl:"<?php echo $output['image']; ?>"
            };
        })();
        weiXinShare.init(shareData);
    });
</script>
</body>
</html>