<?php

$config = array
(
    # 表名
    'name' => 'goods',
    # 显示给用户看的名称
    'lang' => '商品价格模板',
    'order' => 200,
    'menu' => false,
    'fill' => array
    (
        # 从哪个表填充
        'goods/info' => array
        (
            # 条件,另外一个表的字段 => 本表的字段
            'where' => array('id' => 'goods_id'),
            # 要填充的数据,另外一个表的字段 => 本表的字段,如果不填写就是所有的
            'update' => array('price_type' => 'price_type', 'status' => 'status'),
            # 不需要填充的字段 与update互斥
            //'no' => array('id', 'seller_id', 'service_id', 'chose', 'state', 'cdate')
        )
    ),

    # 数据结构 不同的字段放这里
    'struct' => array
    (
        'id'        => array
        (
            'type'      => 'int-11',
            'name'      => 'ID',
            'default'   => '',
            'desc'      => '',
            'match'     => 'is_numeric',
            //'list'        => true,
        ),

        'name'      => array
        (
            'type'      => 'varchar-800',
            'name'      => '模板名称',
            'default'   => '',
            'desc'      => '模板名称',
            'match'     => 'is_string',
            'update'    => 'text',
            'search'    => 'fulltext',
            'list'        => true,
            'edit'        => true,
        ),

        'goods_id'       => array
        (
            'type'      => 'int-11',
            'name'      => '商品名称',
            'default'   => '',
            'desc'      => '商品ID',
            'match'     => 'is_numeric',
            'update'    => 'hidden',
            'value'		=> Dever::input('search_option_goods_id'),
            'list'      => 'Dever::load("goods/info-one#name", {goods_id})',
        ),

        'category_id'      => array
        (
            'type'      => 'int-11',
            'name'      => '分类id',
            'default'   => '',
            'desc'      => '分类id',
            'match'     => 'is_numeric',
        ),

        'price_type'        => array
        (
            'type'      => 'int-11',
            'name'      => '价格类型',
            'default'   => '0',
            'desc'      => '价格类型',
            'match'     => 'is_numeric',
            'table'     => 'goods/info',
        ),

        'price_sell'     => array
        (
            'type'      => 'varchar-100',
            'name'      => '销售价',
            'default'   => '',
            'desc'      => '销售价',
            'match'     => 'option',
            'list_name' => '模板价格',
            'list'      => 'Dever::load("goods/lib/sku.table", "{goods_id}", "price", "{id}", false, false)',
        ),

        'price_buy'       => array
        (
            'type'      => 'varchar-100',
            'name'      => '门店采购价',
            'default'   => '',
            'desc'      => '采购价',
            'match'     => 'option',
        ),

        'price_num'       => array
        (
            'type'      => 'int-11',
            'name'      => '起购数',
            'default'   => '1',
            'desc'      => '起购数',
            'match'     => 'is_string',
        ),

        'state'     => array
        (
            'type'      => 'tinyint-1',
            'name'      => '数据状态',
            'default'   => '1',
            'desc'      => '请选择状态',
            'match'     => 'is_numeric',
        ),

        'cdate'     => array
        (
            'type'      => 'int-11',
            'name'      => '发布时间',
            'match'     => array('is_numeric', time()),
            'desc'      => '',
            # 只有insert时才生效
            'insert'    => true,
            //'search'  => 'date',
            //'list'        => 'date("Y-m-d H:i:s", {cdate})',
        ),
    ),

    'manage' => array
    (
        'edit' => false,
        'insert' => false,
        //'delete' => false,
        'button' => array
        (
            '新增' => array('fast', 1, 'goods'),
        ),
        # 列表里的按钮
        'list_button' => array
        (
            'fast_list' => array('编辑', '"info_sku&project=goods&goods_id={goods_id}&other=price&other_id={id}&page_type=1"', '{price_type} <= 3'),
        ),
    ),

    # request 请求接口定义
    'request' => array
    (
        
    ),
);

return $config;