<?php

/* ========================================================================
 * $Id: categorys.php 1406 2020-07-07 04:44:35Z onez $
 * 
 * Email: www@onez.cn
 * QQ: 6200103
 * HomePage: http://www.onez.cn
 * ========================================================================
 * Copyright 2016-2017 佳蓝科技.
 * 
 * ======================================================================== */

!defined('IN_ONEZ') && exit('Access Denied');
# categorys
#请求数据
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('categorys')->delete("id='$id'");
      return $this->ok('删除成功','reload');
    }
    $data=array();
    $data['title']='分类管理';

    $data['btns'][]=array(
      'name'=>'添加分类',
      'href'=>'./edit.php',
      'args'=>'width=960&height=750&title=添加分类',
    );
    
    $datatable=$this->load('datatable');
    


    
    $datatable->set('edit',array(
      'event'=>array(
        'option'=>array(
          'width'=>960,
          'height'=>750,
        ),
      ),
    ));
    $datatable->set('del','1');
    $datatable->set('fields','id');

    $datatable->add('商品类型','type',array('options'=>onez('bs.app.shipments')->product_types()));
    $datatable->add('名称','name');
    $datatable->add('分类描述','summary');
    $datatable->output($data,array(
      'table'=>'categorys',

      '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',
));
?>