<!DOCTYPE html>
<html lang="en">
<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">
  <style type="text/css">
    #describe img { max-width: 100% }
  </style>
</head>
<body>
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-card-body" pad15>
               <div class="layui-tab layui-tab-card">
                   <ul class="layui-tab-title">
                       <li class="layui-this">活动信息</li>
                       <li>购买记录</li>
                       <li>优惠券</li>
                   </ul>
                   <div class="layui-tab-content">
                       <div class="layui-tab-item layui-show">
                           <table class="layui-table">
                               <tr>
                                   <th style="width: 100px;">标题</th>
                                   <td id="title" class="cell"></td>
                               </tr>
                               <tr>
                                   <th style="width: 100px;">门店名称</th>
                                   <td id="branch_name" class="cell"></td>
                               </tr>
                               <tr>
                                   <th style="width: 100px;">门店电话</th>
                                   <td id="branch_tel" class="cell"></td>
                               </tr>

                              <tr>
                                   <th style="width: 100px;">费用</th>
                                   <td id="amount" class="cell"></td>
                               </tr>
                               <tr>
                                   <th style="width: 100px;">返利</th>
                                   <td id="rebate" class="cell"></td>
                               </tr>
                               <tr>
                                   <th style="width: 100px;">介绍</th>
                                   <td>
                                       <img id="pic" src="" alt="">
                                   </td>
                               </tr>
                                <tr>
                                   <th style="width: 100px;">截止日期</th>
                                   <td id="end_date" class="cell"></td>
                               </tr>
                                <tr>
                                   <th style="width: 100px;">状态</th>
                                   <td id="check_status_text" class="cell"></td>
                               </tr>
                               <tr>
                                   <th style="width: 100px;">门店地址</th>
                                   <td id="branch_address" class="cell"></td>
                               </tr>
                               <tr>
                                   <th style="width: 100px;">添加时间</th>
                                   <td id="create_time" class="cell"></td>
                               </tr>
                           </table>
                       </div>
                       <div class="layui-tab-item">
                           <table class="layui-hide" id="datagrid" style="margin-top: 10px;"></table>
                       </div>
                       <div class="layui-tab-item">
                           <table class="layui-hide" id="coupon_datagrid" style="margin-top: 10px;"></table>
                       </div>
                   </div>
               </div>
            </div>
        </div>
    </div>

    <script src="../../layuiadmin/layui/layui.js?t=1"></script>
    <script>
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'table','laydate', 'utils'], function () {
            var $ = layui.$;
            var table = layui.table;
            var admin = layui.admin;
            var options = null;

            var id = layui.view.getParameterByName('id');
            var editdata = JSON.parse(JSON.stringify(parent.layui.table.editdata));
            if (editdata.pic){
                $('#pic').attr('src', 'https://jpm.zzly.vip' + editdata.pic)
            }
            $('.cell').each(function (index, element) {
                if (editdata[element.id]){
                    element.innerHTML =  (editdata[element.id]);
                }
            });

            table.render({
              elem: '#datagrid'
              ,url: '/activity/order/data/'
              ,cols: [[
                {field:'member_name', title:'会员名称',width: 120}
                ,{field:'member_tel', title:'会员电话',width: 120}
                ,{field:'name', title:'姓名', width:100}
                ,{field:'model', title:'车型', width:200}
                ,{field:'tel', title:'电话', width:120}
                ,{field:'number', title:'车牌号', width:110}
                ,{field:'status_text', title:'状态', width:90}
                ,{field:'create_time', title:'创建时间', width:180}
              ]]
              ,page: true
              ,where: {'activity': id, 'delete': 0}
              ,height: 'full-108'
            });

            table.render({
              elem: '#coupon_datagrid'
              ,url: '/activity/coupon/data/'
              ,cols: [[
                {field:'name', title:'名称', width:200}
                ,{field:'end_date', title:'截止日期',width: 150}
                ,{field:'end_days', title:'截止天数',width: 100}
                ,{field:'create_time', title:'添加时间', width:300}
                ,{field:'enabled_text', title:'在用', width:90}
              ]]
              ,page: true
              ,where: {'activity': id}
              ,height: 'full-108'
            });

        })
    </script>
</body>
</html>