<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <link rel="stylesheet" href="${ctxwxsta}/css/public.css">
    <link rel="stylesheet" href="${ctxwxsta}/css/basic.css">
    <%--<link rel="stylesheet" href="${ctxwxsta}/css/wechat_add_new.css">--%>
    <script src="${ctxwxsta}/js/flexible.js"></script>

    <title>选择产品</title>
    <style>
        #wrapper {
            top: 2.3333rem !important;
            overflow: auto !important;
            padding-bottom: 200px;
        }
        .pro-steps button.xia {
            background: #9bc5fd;
        }
    </style>
</head>
<body id="contain">
<div class="contain">
    <div class="bai-head">
        <span>选择产品</span>

        <a href="javascript:;" onclick="fanhui()" class="left">
            <img src="${ctxwxsta}/images/head-left.png"/>
        </a>

        <%--<i class="she">设置</i>--%>
        <%--<div class="she-content">--%>
            <%--<ul>--%>
                <%--<li>--%>
                    <%--<a href="javascript:;" id="priceAscBtn">价格升序</a>--%>
                <%--</li>--%>
                <%--<li>--%>
                    <%--<a href="javascript:;" id="priceDescBtn">价格降序</a>--%>
                <%--</li>--%>
            <%--</ul>--%>
            <%--<div style="display: none" id="order">asc</div>--%>
            <%--<div style="display: none" id="sortcol">fixed_premium</div>--%>
        <%--</div>--%>

    </div>
    <div class="administer-head">
        <input id="searchText"  type="text" placeholder="请输入产品名称">
        <span class="head-remove"></span>
        <a href="javascript:;" id="search" onclick="serach()" class="head-serach">搜索</a>
    </div>
    <div id="wrapper">
    <form style="padding-bottom:400px;">
    <input  type="hidden" name="companyId" value="${companyId}" id="companyId">
    <input  type="hidden" name="productIds" value="${productIds}" id="productIds">
    <input  type="hidden" name="activityId" value="${activityId}" id="activityId">
    <div class="inferiors-cont adminuster-wed">
        <div class="administer wrapper-product" id="scroller">

            <ul class="optional-product" id="product-list">

            </ul>
            <%--<div id="pullUp">--%>
                <%--<span class="pullUpLabel">上拉加载更多...</span>--%>
            <%--</div>--%>
            <%--<p id="ert"></p>--%>

        </div>
    </div>
    </form>
    </div>
</div>


<div class="pro-steps">
    <div class="steps">
        <button class="xia" id="sureBtn">确定</button>
        <%--<button id="">返回</button>--%>
    </div>
</div>

<!--白色蒙版-->
<div class="white-mask"></div>


<script src="${ctxwxsta}/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="${ctxwxsta}/js/iscroll.js"></script>
<script src="/static/weixin/common/layer_mobile/layer.js"></script>
<link rel="stylesheet" href="/static/weixin/common/layer_mobile/need/right.css">
<script src="/static/weixin/common/jquery.formHelper.js"></script>
<script type="text/javascript" src="/static/weixin/js/g.js"></script>
<script src="/static/weixin/common/layer_mobile/layer.js"></script>
<link rel="stylesheet" href="/static/weixin/common/layer_mobile/need/right.css">

<script type="text/javascript" src="${ctxwxsta}/js/shareProducts.js"></script>
<script type="text/javascript" src="${ctxwxsta}/js/basicOne.js"></script>

<script>
    var baseUrl = '${pageContext.request.contextPath }';
    // $(document).ready(function(){
    //     getData(0);
    // });

     $("#sureBtn").click(function () {
          // alert();
         tijiao();
     })

     function tijiao() {

         var parentName="";
         $(".select-wed.on").each(function () {
             parentName=parentName+$(this).attr('name')+",";
         })
         if(parentName!=""){
             parentName= parentName.substring(0,parentName.length-1);
         }
         if(parentName==""){
             // console.log(">>>>>>>>>>>>")
             layer.open({content:"请选择产品！",btn: '我知道了'}); return;
         }
         var companyId =$("#companyId").val();
         var activityId=$("#activityId").val();
         layer.open({type: 2});
         $.ajax({
             type: 'POST',
             url: "/weixin/share/saveActivityShareProductChange",
             data:{productIds:parentName,companyId:companyId,type:1},
             dataType:"json",
             async: false,
             success: function(data){
                 console.log(JSON.stringify(data));
                 if(data.success){
                         window.location.href="/weixin/activity/activityDetatil?id="+activityId;
                 }else{
                     layer.open({content:"操作失败！",btn: '我知道了'});
                     layer.closeAll();
                 }
             }
         });
     }

     function fanhui(){
        var activityId=$("#activityId").val();
        window.location.href="/weixin/activity/activityDetatil?id="+activityId;


    }
    function assighed(obj) {
        $('.proportion-wind').show();
        $('.block-mask-more').show();
    }

    function serach() {
        $("#product-list").html("");
        getData(0);
    }

    $("#priceAscBtn").click(function () {
        $('.bai-head .she-content').removeClass('active');
        $('.white-mask').hide();
        $("#product-list").html("");
        $("#order").html("asc");
        getData(0);
    });

    $("#priceDescBtn").click(function () {
        $('.bai-head .she-content').removeClass('active');
        $('.white-mask').hide();
        $("#product-list").html("");
        $("#order").html("desc");
        getData(0);
    });
    $('.bai-head i.she').click(function () {
        if($('.bai-head .she-content').hasClass('active')){
            $('.bai-head .she-content').removeClass('active');
            $('.white-mask').hide();
        }else{
            $('.bai-head .she-content').addClass('active');
            $('.white-mask').show();
        }
    });
    $('.white-mask').click(function () {
        $('.bai-head .she-content').removeClass('active');
        $('.white-mask').hide();
    });
    $('.assigned-steps .steps button').click(function () {
        $('.bai-head .she-content').removeClass('active');
        $('.white-mask').hide();
    });
    // $('.assigned-steps .steps button.xia').click(function () {
    //     $('.empty_booth').show();
    //     $('.mask_block').show();
    // });

    // $('.empty_booth span.cancel').click(function () {
    //     $('.empty_booth').hide();
    //     $('.mask_block').hide();
    // });
    // $('.empty_booth span.sure').click(function () {
    //     $('.empty_booth').hide();
    //     $('.mask_block').hide();
    // });
</script>
</body>
</html>