<!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">
</head>
<body>

  <div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body" pad15>
        <div class="layui-row layui-col-space15">
          <div class="layui-col-md12">

            <table class="layui-hide" id="datagrid-log" lay-filter="datagrid-operate"></table>

            <script type="text/html" id="datagrid-operate-bar">
                <div class="layui-btn-group">
                    {{# if(d.transfer_status >= 1){ }}
                    <a class="layui-btn layui-btn-danger layui-btn-xs"  lay-event="detail">明细</a>
                    {{# } }}
                </div>
            </script>
          </div>
        </div>
        </div>
    </div>
  </div>

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

    table.render({
      elem: '#datagrid-log'
      ,url: '/rebate/transfer/?order=' + id
      ,where: {}
      ,cols: [[
        {title: '序号', type: 'numbers'},
        {field: 'no', title: '商家批次号', width: '200',},
        //{field: 'batch_id', title: '微信批次号', width: '10%',},
        {field: 'transfer_amount', title: '转账金额', width: '100',},
        {field: 'transfer_num', title: '转账笔数', width: '100',},
        {field: 'success_amount', title: '成功金额', width: '100',},
        {field: 'success_num', title: '成功笔数', width: '100',},
        {field: 'fail_amount', title: '失败金额', width: '100',},
        {field: 'fail_num', title: '失败笔数', width: '100',},
        {field: 'transfer_status_text', title: '状态', width: '80',},
        {field: 'close_reason', title: '关闭原因', width: '150',},
        {field: 'transfer_time', title: '创建时间', width: '150',},
        {field: 'update_time', title: '更新时间', width: '150',},
        {width:100, align:'center', fixed: 'right', toolbar: '#datagrid-operate-bar'}
      ]]
      ,page: true
      ,height: 'full-104'
      ,done: function () {
        layui.index.removeNoPermButtons();
      }
    });

    //监听工具条
    table.on('tool(datagrid-operate)', function(obj){
        var data = obj.data;
        if(obj.event === 'detail'){
            layer.open({
              type: 2,
              title: '转账记录明细',
              area: ['95%', '90%'],
              btn: ['关闭'],
              yes: function (index, dom) {
                  layer.close(index);
              },
              content: 'transfer_log_detail.html?id=' + data.id
          })
          }
    });

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

