<#assign title="预定记录"/>
<#include "/cust/frag.head.ftl" />

<header class="demos-header">
    <h1 class="demos-title">${title}</h1>
</header>

<#if (orderList?size<=0)>
<div class="weui-loadmore weui-loadmore_line">
    <span class="weui-loadmore__tips">暂无数据</span>
</div>
</#if>

<div class="weui-cells weui-cells_form" id="orderList" style="background-color: #f5f5f5">
    <#list orderList as v>
        <div class="weui-form-preview">
            <div class="weui-form-preview__bd">
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">场地</label>
                    <span class="weui-form-preview__value">${v.placeName} - ${v.roomName}</span>
                </div>
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">客户</label>
                    <span class="weui-form-preview__value">${v.customerName} (${v.customerNumber}人)</span>
                </div>
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">客户电话</label>
                    <span class="weui-form-preview__value">${v.customerTel}</span>
                </div>
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">时间</label>
                    <span class="weui-form-preview__value">${v.arrivalAt.toString('YYYY-MM-DD HH:mm')}</span>
                </div>
                <#if v.beUse != 'U'>
                    <div class="weui-form-preview__ft" style="align-items: flex-end">
                        <a id="update" class="weui-btn weui-btn_primary" href="javascript:updateByid('${v.orderId}');">修
                            改</a>
                        <a id="delete" class="weui-btn weui-btn_warn" href="javascript:deleteByid('${v.orderId}');">删 除</a>
                    </div>
                </#if>
            </div>

            <div class="weui-cells__tips"></div>
        </div>
        <br/>
    </#list>
</div>
<#include "/cust/frag.foot.ftl" />
<script>
    function updateByid(id) {
        window.location.href = '/cust/market.html?orderId=' + id + '&userId=${userId}&openId=${openId}';
    }

    function deleteByid(id) {
        $.ajax({
            url: '/cust/delete_order.json?orderId=' + id + '&userId=' + '${userId}',
            contentType: "application/json; charset=utf-8",
            type: 'get',
            success: function (data) {
                if (data.success) {
                    $.alert("取消成功");
                    window.location.reload();
                } else {
                    $.alert(data.msg);
                }
            },
            error: function () {
                $.alert("网络异常");
            }
        });
    }

</script>