<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>订单详情</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" type="text/css" href="../../layuiadmin/style/formSelects-v4.css"/>
    <style>
        .input {
            border-radius: 2px;
            height: 38px;
            border-width: 1px;
            border-color: lightgray;
            border-style: solid;
            background-color: white;
            padding-left: 3px;
        }
    </style>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-card">
            <div class="layui-card-body" pad15>
                <div id="tableDom"></div>
                <h3 style="margin: 40px 0 10px 0">进度明细</h3>
                <table class="layui-hide" id="customer_datagrid" lay-filter="customer-operate"></table>
            </div>
        </div>
    </div>
</div>

<script type="text/html" id="customer-operate-bar">
    <div class="layui-btn-group">
        <a class="layui-btn layui-btn-xs" lay-event="order_detail"
        >查看资料</a>
    </div>
</script>


<script id="demo" type="text/html">
    <table class="layui-table">
          <tbody>
            <tr>
              <td style="background: #f8f8f8; width: 70px">单号：</td>
              <td>{{ d.no }}</td>
              <td style="background: #f8f8f8; width: 70px">下单时间：</td>
              <td>{{ d.order_time }}</td>
            </tr>
            <tr>
              <td style="background: #f8f8f8; width: 70px">客户名称：</td>
              <td>{{ d.name }}</td>
              <td style="background: #f8f8f8; width: 70px">客户电话：</td>
              <td>{{ d.tel }}</td>
            </tr>
            <tr>
              <td style="background: #f8f8f8; width: 70px">客户地址：</td>
              <td>{{ d.address }}</td>
              <td style="background: #f8f8f8; width: 70px">当前进度：</td>
              <td>{{ d.current_process }}</td>
            </tr>
            <tr>
              <td style="background: #f8f8f8; width: 70px">服务人员：</td>
              <td>{{ d.current_user }}</td>
              <td style="background: #f8f8f8; width: 70px">备注：</td>
              <td>{{ d.notes }}</td>
            </tr>
          </tbody>
        </table>
</script>
<script src="../../layuiadmin/layui/layui.js"></script>
<script>
    layui.link('../../../layuiadmin/style/autocomplete.css');
    layui.config({
        base: '../../../layuiadmin/' //静态资源所在路径
        , autocomplete: 'autocomplete'
    }).extend({
        index: 'lib/index',
        formSelects: 'formSelects-v4'
    }).use(['index', 'table', 'form', 'autocomplete', 'formSelects', 'laytpl' ], function () {
        var $ = layui.$
            , table = layui.table
            , admin = layui.admin
            , laytpl = layui.laytpl
            , formSelects = layui.formSelects
            , form = layui.form;

        editdata = JSON.parse(JSON.stringify(parent.layui.table.editdata)); // 框架有Bug所以这么转换
        var data = editdata;
        var getTpl = demo.innerHTML
        ,tableDom = document.getElementById('tableDom');
        laytpl(getTpl).render(data, function(html){
          tableDom.innerHTML = html;
        });
        table.render({
            elem: '#customer_datagrid'
            , url: '/api/process.json'
            , cols: [[
                {field: 'time', title: '时间', width: 150}
                , {field: 'process', title: "进度", width: 120}
                , {field: 'notes', title: '备注', width: 200}
                , {field: 'option_user', title: '操作人', width: 120}
                , {width: 100, align: 'center', fixed: 'right', toolbar: '#customer-operate-bar'}
            ]]
            , page: true
        });

         //监听工具条
        table.on('tool(customer-operate)', function (obj) {
            var data = obj.data;
            if (obj.event === 'order_detail') {
                // 显示资料图片
                layer.open({
                    type: 2,
                    title: '资料图片',
                    area: ['100%', '70%'],
                    btn: ['取消'],
                    btn1: function (index, layero) {
                        layer.close(index);//关闭当前按钮
                    },
                    content: 'imgsInfo.html'
                });
            }
        });
    });
</script>
</body>
</html>
