<?php

/* ========================================================================
 * $Id: orders.php 1372 2020-07-08 13:40:09Z onez $
 * 
 * Email: www@onez.cn
 * QQ: 6200103
 * HomePage: http://www.onez.cn
 * ========================================================================
 * Copyright 2016-2017 佳蓝科技.
 * 
 * ======================================================================== */

!defined('IN_ONEZ') && exit('Access Denied');
# orders
#请求数据
if($MODE=='$post'){
  $action=onez()->gp('action');
  if($action=='data'){
    $action=onez()->gp('ac');


    if($action=='del'){
      $id=(int)onez()->gp('id');
      $G['this']->data()->open('orders')->delete("id='$id'");
      return $this->ok('删除成功','reload');
    }
    $data=array();
    $data['title']='订单管理';

    $datatable=$this->load('datatable');
    


    $datatable->set('del','1');
    $datatable->set('fields','id');

    $datatable->add('订单号','token');
    $datatable->add('名称','subject');
    $datatable->add('IP','ip');
    $datatable->add('支付金额','price');
    $datatable->add('支付时间','addtime',array('type'=>'time',));
    $datatable->add('支付方式','paytype',array('function'=>function($rs){
      global $G;
      $T=$G['this']->data()->open('bs.pay.setting')->one("token='$rs[paytype]'");
      return $T['name'];
    }));
    $datatable->add('状态','status');
    $datatable->output($data,array(
      'table'=>'orders',

      'where'=>"1 order by id desc",
      'pagesize'=>20,
    ));
    $A['pagedata']=$data;
  }
  return;
}
$this->add(array(
  'type'=>'breadcrumb',
  'name'=>'面包屑导航',
  'data'=>'pagedata',
));
$this->add(array(
  'type'=>'datatable',
  'name'=>'数据列表',
  'data'=>'pagedata',
));
?>