{extend name="layout:home" /}
{block name="container"}
<div class="layui-tab layui-tab-card">
    <input type="text" style="display: none" name="id" id="id" value="{$id}">
    <ul class="layui-tab-title">
        {volist name="fartherProduct" id="value"}
        <li id="li-{$value.product_id}" onclick="showCurrent({$value.product_id})">
            <a>{$value.product_name}</a>
        </li>
        {/volist}
    </ul>
    <div class="layui-tab-content page-tab-content">
        <table class="layui-table lay-even">
            <colgroup>
                <col width="150">
                <col width="200">
                <col>
            </colgroup>
            <thead>
            <tr>
                <th>服务名称</th>
                <th>服务简介</th>
                <th>服务报价</th>
                <th>状态</th>
                <th>图片</th>
            </tr>
            </thead>
            <tbody>
            {if count($sonProduct)}
            {volist name="sonProduct" id="value"}
            <tr>
                <td>{$value.product_name}</td>
                <td><?php echo mb_substr($value->product_content,0,30, 'utf-8');?>...</td>
                <td>{$value.product_money}</td>
                <td>{$value.product_status == 1 ? '启用' : '下线'}</td>
                <td>
                    {if $value.product_img}
                    <img src="{$Think.HOME_SITE_ROOT}{$value.product_img}" style="width: 100px;height: 100px">
                    {/if}
                </td>
            </tr>
            {/volist}
            {else}
            <td colspan="99" style="text-align: center">无数据</td>
            {/if}
            </tbody>
        </table>
        {$show_page}
    </div>
</div>
<script>
    const myHost = "http://" + window.location.host;
    let current = $("#id").val();
    $("#li-" + current).attr("class","layui-this")
    function showCurrent(id) {
        if (id) {
            $("#status").val(id)
        }
        let timeRang = $("#timeRang").val();
        let status = $("#status").val();
        window.location.href = myHost + "/User/cost/orderManagement.html?timeRang=" + timeRang + "&status=" + status;
    }
    function getQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var url=decodeURI(decodeURI(window.location.search))
        var r = url.substr(1).match(reg);
        if (r != null) return unescape(r[2]); return null;
    }
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#creatTime' //指定元素
        });
        laydate.render({
            elem:'#timeRang',
            range:true,
            format: 'yyyy/MM/dd',
            done: function(value, date){
                /* 时间选择完成后的回调 */
            }
        })
    });
</script>
{/block}

