<GZHXPAGEBOX><div class="table-body auto-login-content">
  <div class="table-tools domain-table-tools">




  </div>
  <div class="table-responsive">
    <table class="table table-bordered table-hover ">
      <thead class="thead-light">
      <tr>

        <th class="center t1">ID </th>
        <th class="t4">活动</th>

        <th>状态</th>
        <th>优惠码</th>
        <th>奖品来源</th>
        <th class="center t5">时间</th>

      </tr>
      </thead>
      <tbody>
      {foreach $DomainList as $key=>$item}
        <tr>
          <td class="center">{$item.id}</td>


          <td>{$item.title}</td>

          <td>{empty name="$item.error"}<a href="javascript:;" data-record="{$item.id}" class="btn btn-primary">点此领取</a> {else /}{$item.error}{/empty}</td>
          <td>{notempty name="item.code"}{$item.code}[<a href="{php}if(!empty($item['product_id'])){ echo '/cart?action=configureproduct&pid='.$item['product_id']; }else{echo '/cart';}{/php}" target="_blank">使用</a>]{/notempty}</td>
          <td>{$item.msg}</td>
          <td>{$item.add_time} </td>
        </tr>
      {/foreach}
      </tbody>
    </table>
  </div>
  <div class="table-body myPagination"></div>

</div>
<script>

  $(function (){
    $('#PageTitle').html('{$Title}');
    $('.gzhx-navigation>.underline').removeClass("underline");
    $('.gzhx-navigation>[data-name="index"]').addClass("underline");

    $('[data-record]').off("click").on('click',function () {
      let self_this=$(this),id=$(this).data("record");
      ajax({
        data:{
          action:'receive',
          id:id
        },
        success:function (r){
          layer.alert("领取成功",{
            end:function (){
              GzhxDomainTpl( queryToJson(true) );
            }
          });
        }
      })
    })


    let count="{$count}";
    let pageNumber="{$Page}";
    $(".myPagination").Pagination({
      page:parseInt(pageNumber),
      count:parseInt(count),
      groups: 10,
      prev:'上一页',
      next:'下一页',
      first:'首页',
      last:'末页',
      limit:10,
      onPageChange:function (page) {
        if(parseInt(pageNumber)!=parseInt(page)){
          let query=queryToJson(true);
          query.page=page;
          GzhxDomainTpl(query);
         // top.location.href="./addons?"+jsonToQuery(query)
        }

      }
    });
  })
</script></GZHXPAGEBOX>