<?php

$type = array
(
    1 => '零售店',
    // 2 => '已签署',
    // 3 => '已作废',
);
$status = array
(
    1 => '待交付',
    2 => '已交付',
    // 3 => '已作废',
);
$manage_audit = array
(
    1 => '待财务终审',
    2 => '交付确认',
    3 => '已完成',
    4 => '驳回',
);
$audit = array
(
    1 => '审核通过',
    2 => '拒绝',
);
$col = Dever::input('col');

return array
(
    # 表名
    'name' => 'option_account',
    # 显示给用户看的名称
    'lang' => '期权账户管理',
    'order' => 1,
    // 'config_type' => $type,
    'config_status' => $status,
    'end' => array
    (
        'update' => 'agent/lib/option_account.updateAccount',
        'insert' => 'agent/lib/option_account.updateAccount',
    ),
    # 数据结构
    'struct' => array
    (
    
        'id'        => array
        (
            'type'      => 'int-11',
            'name'      => '受益人姓名/电话',
            'default'   => '',
            'desc'      => '',
            'match'     => 'is_numeric',
            'search'    => 'order',
            'search'    => array
            (
                'api' => 'agent/option_account-getSearch',
                'col' => 'col',
                'result' => 'id',
                'search' => 'id',
            ),
            // 'update'    => 'hidden',
            //'list'        => true,
        ),

        'name'      => array
        (
            'type'      => 'varchar-100',
            'name'      => '受益人姓名',
            'default'   => '',
            'desc'      => '姓名',
            'match'     => 'is_string',
            'update'    => 'text',
            'list_name' => '受益人',
            'list'      => 'Dever::load("agent/lib/option_account.show#list",{id})',
        ),

         'mobile'      => array
        (
            'type'      => 'bigint-11',
            'name'      => '受益人电话',
            'default'   => '',
            'desc'      => '请输入受益人电话',
            'match'     => Dever::rule('mobile'),
            'update'    => 'text',
            // 'search'    => 'fulltext',
            // 'list'      => true,
        ),
     	
       'idcard'      => array
        (
            'type'      => 'varchar-32',
            'name'      => '身份证号码',
            'default'   => '',
            'desc'      => '身份证号码',
            'match'     => Dever::rule('idcard'),
            'search'    => 'fulltext',
            'update'    => 'text',
        ),

        'area'       => array
        (
            'type'      => 'varchar-500',
            'name'      => '门店地址',
            'default'   => '',
            'desc'      => '门店地址',
            'match'     => 'option',
            'search'    => 'linkage',
            'update'    => 'linkage',
            'option'    => Dever::url('api.get?level_total=4', 'area'),
        ),

        'address'      => array
        (
            'type'      => 'varchar-200',
            'name'      => '详细地址',
            'default'   => '',
            'desc'      => '地址',
            'match'     => 'is_string',
            'update'    => 'text',
            // 'list'      => true,
        ),

        'title'      => array
        (
            'type'      => 'varchar-100',
            'name'      => '期权记录标题',
            'default'   => '',
            'desc'      => '期权记录标题',
            'match'     => 'is_string',
            'update'    => 'text',
            'list'      => true,
        ),

        'desc'      => array
        (
            'type'      => 'varchar-600',
            'name'      => '说明',
            'default'   => '',
            'desc'      => '记录说明',
            'match'     => 'option',
            'update'    => 'textarea',
            'list'      => true,
        ),
        
        'type'        => array
        (
            'type'      => 'tinyint-1',
            'name'      => '记录类型',
            'default'   => '1',
            'desc'      => '记录类型',
            'match'     => 'is_numeric',
            'update'    => 'radio',
            'option'    => $type,
            // 'search'    => 'select',
            // 'list'      => true,
        ),

        'price'      => array
        (
            'type'      => 'decimal-11,2',
            'name'      => '设备费用-单位:万元',
            'default'   => '0',
            'desc'      => '设备费用',
            'match'     => 'option',
            'update'    => 'text',
            'list_name' => '资金记录明细(万元)',
            'list'      => 'Dever::load("agent/lib/option_account.show#price",{id})',
        ),

        'zh_price'      => array
        (
            'type'      => 'decimal-11,2',
            'name'      => '装修费用-单位:万元',
            'default'   => '0',
            'desc'      => '装修费用',
            'match'     => 'option',
            'update'    => 'text',
            // 'list'      => true,
        ),

        'zj_price'      => array
        (
            'type'      => 'decimal-11,2',
            'name'      => '租金费用-单位:万元',
            'default'   => '0',
            'desc'      => '租金费用',
            'match'     => 'option',
            'update'    => 'text',
            // 'list'      => true,
        ),

        'other_price'      => array
        (
            'type'      => 'decimal-11,2',
            'name'      => '其他费用-单位:万元',
            'default'   => '0',
            'desc'      => '其他费用',
            'match'     => 'option',
            'update'    => 'text',
            // 'list'      => true,
        ),

        'pic'       => array
        (
            'type'      => 'text-255',
            'name'      => '上传凭证-门店租赁合同,支付凭证等',
            'default'   => '',
            'desc'      => '多张图片',
            'match'     => 'is_string',
            'update'    => 'images',
            'key'       => '1',
            // 'place'     => '759*562',
        ),

        'annex'       => array
        (
            'type'      => 'text-800',
            'name'      => '上传附件',
            'default'   => '',
            'desc'      => '上传附件',
            'match'     => 'option',
            'update'    => 'upload',
            'key'       => '10',
            // 'place'     => '759*562',
        ),

        'status'        => array
        (
            'type'      => 'tinyint-1',
            'name'      => '交付状态',
            'default'   => '1',
            'desc'      => '交付状态',
            'match'     => 'is_numeric',
            // 'update'    => 'select',
            'option'    => $status,
            'search'    => 'select',
            'list_name' => '交付状态<br/>交付时间',
            'list'      => 'Dever::load("agent/lib/option_account.show#date",{id})',
        ),

        'jf_date'     => array
        (
            'type'      => 'int-11',
            'name'      => '交付时间',
            'match'     => 'option',
            'default'   => '0',
            'desc'      => '',
            'match'     => 'is_numeric',
            // 'update'    => 'day',
            'search'    => 'date',
            'callback'  => 'maketime',
            // 'list'        => '{buy_date} > 0 ? date("Y-m-d H:i", {buy_date}) : "无"',
        ),

        'audit_type'        => array
        (
            'type'      => 'tinyint-1',
            'name'      => '审核状态',
            'default'   => '1',
            'desc'      => '审核状态',
            'match'     => 'is_numeric',
            // 'update'    => 'select',
            'option'    => $manage_audit,
            'search'    => 'select',
            'list_name' => '审核状态<br/>审核时间',
            'list'      => 'Dever::load("agent/lib/option_account.show#audit",{id})',
        ),

       	'audit_date'     => array
        (
            'type'      => 'int-11',
            'name'      => '审核时间',
            'match'     => 'option',
            'default'   => '0',
            'desc'      => '',
            'match'     => 'is_numeric',
            // 'update'    => 'day',
            'search'    => 'date',
            'callback'  => 'maketime',
            // 'list'        => '{buy_date} > 0 ? date("Y-m-d H:i", {buy_date}) : "无"',
        ),

        'audit'        => array
        (
            'type'      => 'int-11',
            'name'      => '审核状态',
            'default'   => '1',
            'desc'      => '审核状态',
            'match'     => 'is_numeric',
            'update'    => $col ? 'radio' : false,
            'option'    => $audit,
            // 'search'    => 'select',
            'mul'       => true,
            'control'   => 'audit',
        ),
        'remark'      => array
        (
            'type'      => 'varchar-600',
            'name'      => '备注',
            'default'   => '',
            'desc'      => '备注',
            'match'     => 'option',
            'update'    => 'textarea',
            // 'list'      => '"{audit_desc}" ? "{audit_desc}" : "-"',
            // 'list_order'  => 9,
            'show'      => 'audit=2',
        ),

        'audit_desc'      => array
        (
            'type'      => 'varchar-600',
            'name'      => '审核说明',
            'default'   => '',
            'desc'      => '审核说明',
            'match'     => 'is_string',
            'update'    => $col ? 'textarea' : false,
            // 'list'      => '"{audit_desc}" ? "{audit_desc}" : "-"',
            // 'list_order'  => 9,
            'show'      => 'audit=2',
        ),
        'num'      => array
        (
            'type'      => 'int-11',
            'name'      => '确认期权数-行权3年期。自门店注册日期开始计算。满一年30%,满两年35%,满三年35%',
            'default'   => '',
            'desc'      => '姓名',
            'match'     => 'is_numeric',
            'update'    => $col ? 'text' : false, 
            'show'      => 'audit=1', 
        ),
        'audit_admin'     => array
        (
            'type'      => 'int-11',
            'name'      => '添加人',
            'default'   => '',
            'match'     => 'is_numeric',
            'desc'      => '操作人',
            'list'      => '"{audit_admin}" > 0 ? Dever::load("manage/admin-find#username", {audit_admin}) : "-"',
            'list_order'  => 10,
        ),
        '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})',
            'list_order'  => 11,
        ),
    ),

    'manage' => array
    (
    	// 'insert' => $insert,
    	'delete' => false,
    	'edit'   => false,
    	'page_list' => 'option_account',
        // 'button' => $button,
    	'list_button' => array
        (
        	 'list' => array('查看详情', '"option_account&project=agent&id={id}&page_type=1&[refer]"'),
        	 // 'list' => array('查看详情', 'Dever::load("agent/lib/option_account.list",{id})'),
        ),
    ),

    'request' => array
    (
        'getSearch' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'col' => array('yes-mobile,name', 'like'),
            ),
            'type' => 'all',
            'col' => '*|id',
        ),

    ),
);