{extend name="common/common2" /}
{block name="main"}
<style>
    .custom-table th,td{
        padding: 10px;
    }
    .custom-table th{
        width: 120px;
        text-align: left;
    }

</style>
<div class="row">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <!--<div class="ibox-title">-->
                <!--<h5>{$meta_title}</h5>-->
                <!--<div class="ibox-tools">-->
                    <!--<a class="toback" href="{:url('selfIndex')}?mode={$info['work_type_mode']}">-->
                        <!--返回上一页-->
                    <!--</a>-->
                <!--</div>-->
            <!--</div>-->

            <div class="ibox-content">
                <table class="table custom-table table-bordered">
                    <tbody>
                    <tr>
                        <th>订单编号</th><td>{$info['sn']}</td>
                    </tr>
                    <tr>
                        <th>类型</th><td>{$info['work_type_mode_text']}</td>
                    </tr>
                    {if $info['real_name'] != null || $info['real_name'] != ''}
                    <tr>
                        <th>申请人</th><td>{$info['real_name']}</td>
                    </tr>
                    {/if}
                    <tr>
                        <th>申请时间</th><td>{$info['create_time']}</td>
                    </tr>
                    {if $info['dep'] != null || $info['dep'] != ''}
                    <tr>
                        <th>所在科室/部门</th><td>{$info['dep']}</td>
                    </tr>
                    {/if}
                    {if $info['work_type_mode']==1}
                    <tr>
                        <th>报修类型</th><td>{$info['order_type']}</td>
                    </tr>
                    <tr>
                        <th>报修事项</th><td>{$info['order_type_matter']}</td>
                    </tr>
                    <tr>
                        <th>报修地点</th><td>{$info['address_title']}</td>
                    </tr>
                    <tr>
                        <th>报修紧急程度</th><td>{$info['repair_priority']}</td>
                    </tr>
                    {/if}
                    <tr>
                        <th>任务内容</th><td><div>{$info['content']}</div></td>
                    </tr>
                    {if $info['work_type_mode'] == 3}
                    <tr>
                        <th>开始地点</th><td><div>{$info['oc']['start_name']}</div></td>
                    </tr>
                    <tr>
                        <th>运送类型</th>
                        <td>
                            {$info['oc']['type_name']}
                        </td>
                    </tr>
                    <tr>
                        <th>结束地点</th><td><div>{$info['oc']['end_name']}</div></td>
                    </tr>
                    {if condition="$info['work_type_mode'] == 3&&$info['ends']"}
                    <tr>
                        <th>运送路线</th>
                        <td>
                            <table class="table table-bordered">
                                <tr>
                                    <th>地点</th>
                                    <th>是否已扫码</th>
                                    <th>扫码日期</th>
                                </tr>
                                {volist name="info['ends']" id="v"}
                                <tr>
                                    <th>{$v['title']}</th>
                                    <th>
                                        {eq name="v['scan']" value="1"}是{else /}否{/eq}
                                    </th>
                                    <th>{$v['update_time']}</th>
                                </tr>
                                {/volist}
                            </table>
                        </td>
                    </tr>
                    {/if}
                    <tr>
                        <th>优先级</th>
                        <td>
                            {if $info['oc']['priority'] == 1}可延缓的{/if}
                            {if $info['oc']['priority'] == 2}常规{/if}
                            {if $info['oc']['priority'] == 3}紧急{/if}
                            {if $info['oc']['priority'] == 4}预约{/if}
                        </td>
                    </tr>
                    {if !empty($info['oc']['device_name'])}
                    <tr>
                        <th>运送设备</th><td><div>{$info['oc']['device_name']}</div></td>
                    </tr>
                    {/if}
                    <tr>
                        <th>需求时间</th><td><div>{$info['oc']['xq_time']}</div></td>
                    </tr>
                    <tr>
                        <th>应完成时间</th><td><div>{$info['oc']['ywc_time']}</div></td>
                    </tr>

                    {if !empty($info['ocp'])}
                    <tr>
                        <th>床号</th><td>{$info['ocp']['bed_number']}</td>
                    </tr>
                    <tr>
                        <th>姓名</th><td>{$info['ocp']['name']}</td>
                    </tr>
                    <tr>
                        <th>病案号</th><td>{$info['ocp']['ba_number']}</td>
                    </tr>

                    <tr>
                        <th>性别</th>
                        <td>
                            {if $info['ocp']['gender'] == 0}未知{/if}
                            {if $info['ocp']['gender'] == 1}男{/if}
                            {if $info['ocp']['gender'] == 2}女{/if}
                        </td>
                    </tr>
                    <tr>
                        <th>往返</th>
                        <td>
                            {if $info['ocp']['back'] == 0}否{/if}
                            {if $info['ocp']['back'] == 1}是{/if}
                        </td>
                    </tr>
                    {/if}
                    {/if}
<!--                    {if $info['work_type_mode']==1}-->
<!--                    <tr>-->
<!--                        <th>报修事项</th><td>{$info['order_type_matter']}</td>-->
<!--                    </tr>-->
<!--                    <tr>-->
<!--                        <th>报修类型</th><td>{$info['order_type']}</td>-->
<!--                    </tr>-->
<!--                    <tr>-->
<!--                        <th>报修地点</th><td>{$info['address_title']}</td>-->
<!--                    </tr>-->
<!--                    {/if}-->
                    {if !empty($info['voices'])}
                    <tr>
                        <th>语音</th><td><audio src="{$info['voices']}" controls></audio></td>
                    </tr>
                    {/if}
                    {if !empty($info['images'])}
                    <tr>
                        <th>图片</th>
                        <td>
                            <p>
                                {foreach $info['images'] as $key=>$val}
                                <img onclick="open_img(this)" src="{$val}"  width="60" height="60">
                                {/foreach}
                            </p>
                        </td>
                    </tr>
                    {/if}

                    {if !empty($info['videos'])}
                    <tr>
                        <th>视频</th>
                        <td  style="width: 200px!important;height: 200px;!important;">

                            <video style="width: 200px!important;height: 200px;!important;" src="{$info['videos']}" controls="controls">
                            </video>
                        </td>
                    </tr>
                    {/if}
                    <tr>
                        <th>状态</th><td><div>{$info['order_mode_text']}</div></td>
                    </tr>
                    {if isset($info['name']) && !empty($info['name'])}
                    <tr>
                        <th>联系人</th><td>{$info['name']}</td>
                    </tr>
                    {/if}
                    {if isset($info['phone']) && !empty($info['phone'])}
                    <tr>
                        <th>电话</th><td>{$info['phone']}</td>
                    </tr>
                    {/if}
                    {if !empty($info['reason'])}
                    <tr>
                        <th>原因</th>
                        <td>
                            {$info['reason']}
                        </td>
                    </tr>
                    {/if}
                    {if $info['order_mode'] == 6 && !empty($info['comment'])}
                    <tr>
                        <th>评价</th>
                        <td>
                            <link rel="stylesheet" href="/static/bootstrap-star-rating/css/star-rating.css">
                            <script src="/static/bootstrap-star-rating/js/star-rating.js"></script>
                            <div class="atar_show">
                                <input id="input-id" type="hidden" class="rating" value="{$info['comment']['score']}" disabled data-size="xs" >
                            </div>
                            <script>
                                $("#input-id").rating({
                                    showclear:false,
                                    showcaption: false,
                                });
                            </script>
                            <div>
                                {$info['comment']['content']}
                            </div>
                        </td>
                    </tr>
                    {/if}
                    {if $info['order_mode'] == 5}
                    <tr>
                        <th>评价</th>
                        <td>
                            <link rel="stylesheet" href="/static/bootstrap-star-rating/css/star-rating.css">
                            <script src="/static/bootstrap-star-rating/js/star-rating.js"></script>
                            <div class="atar_show">
                                <input id="create-input-id" type="text" class="rating" value="5">
                            </div>
                            <script>
                                $("#create-input-id").rating({
                                    min: 0,
                                    max: 5,
                                    step: 1,
                                    size: 'xs',
                                    showclear:false,
                                    showcaption: false,
                                });
                            </script>
                            <div>
                                <textarea id="content" class="form-control" cols="80" rows="3"></textarea>
                            </div>
                        </td>
                    </tr>
                    {/if}
                    {if $info['order_mode'] == 5}
                    <tr>
                        <th></th>
                        <td>
                            <button type="button" onclick="comment(this)" class="btn btn-sm btn-primary">评价</button>
                        </td>
                    </tr>
                    {/if}
                    {if !empty($info['todo_list'])}
                    <tr>
                        <th>工单信息</th>
                        <td>
                            <table class="table table-bordered">
                                <tr>
                                    <td style="width: 12.5%">执行人</td>
                                    <td style="width: 12.5%">分派时间</td>
                                    <td style="width: 12.5%">接单时间</td>
                                    <td style="width: 12.5%">完成时间</td>
                                    {if $info['work_type_mode']==1}
                                    <td style="width: 12.5%">签名图</td>
                                    {/if}
                                    <td style="width: 12.5%">完成图片</td>
                                    <td style="width: 12.5%">备注</td>
                                    <td style="width: 12.5%">状态</td>
                                </tr>
                                {foreach $info['todo_list'] as $k=>$v}
                                <tr>
                                    <td>{$v['to_real_name']}</td>
                                    <td>{$v['create_time']}</td>
                                    <td>{$v['confirm_time']}</td>
                                    <td>{$v['done_time']}</td>
                                    {if $info['work_type_mode']==1}
                                    <td>{if !empty($info['sign'])}
                                        <img onclick="open_img(this)" src="{$info['sign']}"  width="60" height="60">
                                        {/if}
                                    </td>
                                    {/if}
                                    <td>{if !empty($v['to_ok_images'])}
                                        {foreach $v['to_ok_images'] as $key=>$val}
                                        <img onclick="open_img(this)" src="{$val}"  width="60" height="60">
                                        {/foreach}
                                        {/if}
                                    </td>
                                    <td>{$v['nodo_reason']}</td>

                                    <td>
                                        {if condition="$v['todo_mode'] eq 2 and $v['pause'] == 1"}
                                        已挂起 <br>
                                        <div>挂起原因:{$v['pause_reason']}</div>
                                        <div>挂起时间:{$v['pause_time']}</div>
                                        {else /}
                                        {$v['todo_mode_text']}
                                        {/if}
                                    </td>
                                </tr>
                                {/foreach}
                            </table>
                        </td>
                    </tr>
                    {/if}
                    {if !empty($info['cons'])}
                    <tr>
                        <th>耗材信息</th>
                        <td>
                            <table class="table table-bordered">
                                <tr>
                                    <td style="width: 12.5%">名称</td>
                                    <td style="width: 12.5%">数量</td>
                                    <td style="width: 12.5%">单价</td>
                                    <td style="width: 12.5%">总价</td>
                                    <td style="width: 12.5%">使用人</td>
                                </tr>
                                {foreach $info['cons'] as $k=>$v}
                                <tr>
                                    <td>{$v['title']}</td>
                                    <td>{$v['total']}</td>
                                    <td>{$v['money']}</td>
                                    <td>{$v['total_money']}</td>
                                    <td>{$v['realName']}</td>
                                </tr>
                                {/foreach}
                            </table>
                        </td>
                    </tr>
                    {/if}
                    {if in_array($info['order_mode'],[1])}
                    <tr>
                        <th>操作</th><td>

                        {if $info.order_mode==1}
                        <a href="{:url('cancel',[],'')}/id/{$info['id']}" class="confirm ajax-get"  data-confirm="确定要取消吗?"><span class="btn btn-sm btn-default">取消订单</span></a> &nbsp;
                        {/if}
                    </td>
                    </tr>
                    {/if}
                    </tbody>
                </table>

            </div>
        </div>
    </div>
</div>
{/block}
{block name="script"}

<script>

    function comment() {
        var content = $("#content").val();
        var score = $("#create-input-id").val();

        $.post('{:url("comment")}',{id:"{$info['id']}",score:score,content:content},function (res) {

            if(res.code==1){
                layer.msg('评价成功',{time:2000},function () {
                   window.location.reload();
                });
            }else {
                layer.msg(res.msg);
            }
        })
    }
</script>
{/block}