{include file="layout/header" /}
<style type="text/css">
</style>
<!-- banner -->
<div class="product-details-banner">
    <div class="container">
        <div>
            <div class="">
                <ul class="rslides">
                    <li>
                        <div class="slider-info" style="text-align: left !important;">
                            <p style="font-size: 2.8vw;">
                                {$fatherProduct.product_name} ▪ {$product.product_name}
                            </p>
                            <p style="font-size: 1vw;">
                                {$product.product_content}
                            </p>
                            <div style="text-align: right">
                                <button onclick="goShopping()">立即选购</button>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>

<section class="wthree-row" id="pricing">
    <div class="container" style="font-size: 18px; font-weight: 800; margin-top: 50px;">
        产品介绍
    </div>
    {volist name="productInfo" id="value"}
    <div>
        <div class="container" style="margin-top: 5px;">
            <img src="{$Think.HOME_SITE_ROOT}/images/infoData.png">
            {$value.productInfo_title}
        </div>
        <div class="container" style="margin-top: 5px;">
            {$value.productInfo_content}
        </div>
        <div class="container" style="margin-top: 20px; margin-bottom: 50px">
            <img src="{$Think.UPLOADS_ROOT}{$value.productInfo_img}" width="100%">
        </div>
    </div>
    {/volist}
    <div class="container" style="font-size: 18px; font-weight: 800; margin-top: 50px;">
        产品价格
    </div>
</section>

<section class="wthree-row" id="shopping">
    <div class="container" style="margin-top: 10px; margin-bottom: 50px;">
        <table class="gridtable">
            <tr>
                <td style="border-right: 0;">服务名称</td>
                <td style="border-right: 0; border-left: 0;">时长</td>
                <td style="border-right: 0; border-left: 0;">价格</td>
                <td style="border-left: 0;">选购</td>
            </tr>
            {volist name="renewal" id="value"}
            <tr>
                <td>{$fatherProduct.product_name} ▪ {$product.product_name}</td>
                <td>{$value.renewal_name}</td>
                <td>
                    <?php
                        switch($value->renewal_identity){
                            case 1:
                                echo $product->product_TypeOne;
                                break;
                            case 2:
                                echo $product->product_TypeTwo;
                                break;
                            case 3:
                                echo $product->product_TypeThree;
                                break;
                            case 4:
                                echo $product->product_TypeFour;
                                break;
                        }
                    ?>元
                </td>
                <td onclick="shopping('{$product.product_id}','{$value.renewal_identity}')" style="color: #0d93bf; cursor:pointer;">选购</td>
            </tr>
            {/volist}
        </table>
    </div>
</section>
<script>
    const myHost = "http://" + window.location.host;
    function shopping(product_id, renewal_identity) {
        $.ajax({
            url: myHost + "/home/index/isLogin.html",
            type: 'get',
            dataType: 'json',
            success: function(res){
                if (res['success']) {
                    window.location.href = myHost + "/home/product/shopping.html?product_id=" + product_id + "&renewal_identity=" + renewal_identity;
                } else {
                    window.location.href = myHost + "/User/login/index.html?login=0";
                }
            },
            error: function(){
                alert("服务器连接失败");
            }
        });
    }
    function goShopping(product_id, renewal_identity) {
        window.location.href = "#shopping";
    }
</script>
{include file="layout/footer" /}
