<hi:Common_WapHeader runat="server" />
<div class="pbox">
    <a id="productImage">
        <div class="well goods-box">
            <img runat="server" id="imgProductImage">
            <div class="info">
                <div class="name font-xl">
                    <asp:literal runat="server" id="litProductTitle" /></div>
                <div class="intro font-m text-muted">
                    <asp:literal runat="server" id="litShortDescription" /></div>
                <div class="price text-danger">
                    ¥<asp:literal runat="server" id="litSalePrice" /><span class="sales font-s text-muted">已售<asp:literal runat="server" id="litSoldCount" />件</span>
                </div>
            </div>
        </div>
    </a>
    <textarea id="consultation" class="form-control" rows="5" placeholder="请填写您对该商品的咨询"></textarea>
    <button type="button" onclick="Submit()" class="btn btn-warning btn-block">
        提交咨询</button>
    <div id="historyConsultation">
        <hr />
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">
                    全部咨询</h3>
            </div>
            <div class="panel-body" id="historyConsultationlist">
                <hi:WapTemplatedRepeater id="rptProducts" templatefile="/Tags/skin-Common_ProductConsultations.ascx"
                    runat="server" />
            </div>
        </div>
        <div id="pager"></div>
    </div>
</div>
< clientidmode="Static" value="" runat="server" id="txtTotal" />
<script src="/Utility/common.js" type="text/javascript"></script>
<script src="/Utility/pager.js" type="text/javascript"></script>
<script type="text/javascript">
    function Submit() {
        if ($("#consultation").val() == "") {
            alert_h("必须填写咨询内容");
            return;
        }

        var id = window.location.search.substr(window.location.search.indexOf("=") + 1);
        var data = {};
        data.ProductId = id;
        data.ConsultationText = $("#consultation").val();

        $.post("/api/VshopProcess.ashx?action=AddProductConsultations", data, function (json) {
            if (json.success === true) {
                alert_h("提交成功", function () { 
                 location.reload();
                });
               
            }
            else {
                alert_h(json.msg);
            }
        });
    }


    $(function () {
        $('#productImage').attr('href', '/WapShop/productDetails.aspx?productId=' + getParam('ProductId'));

    });
    if (!$.trim($('#historyConsultationlist').html()))
        $('#historyConsultation').hide();
    vshopPager('pager', $('#txtTotal').val(), 1, 20);


    var answerDetails = $('.answerDetail');
    $.each(answerDetails, function (i, answerDetail) {
        if (!$.trim($(answerDetail).html()))
            $(answerDetail).parent().hide();
    });


</script>

<hi:Common_WapFooter runat="server" />