<?php

$status = array
(
    1 => '待发放',
    2 => '已发放',
);

$cash_status = array
(
    1 => '待审核',
    2 => '已审核',
    3 => '已作废',
);

$manage_status = array
(
    //1 => '待发放',
    2 => '已发放',
);

$mid = Dever::input('search_option_mid');
return array
(
    # 表名
    'name' => 'tixian',
    # 显示给用户看的名称
    'lang' => '提现管理',
    'set' => array
    (
    	'status' => $status,
    ),
    'end' => array
    (
        'update' => 'bill/lib/manage.tixianAuditUpdate',
    ),
    'order' => 80,
    # 数据结构
    'struct' => array
    (
    
        'id'        => array
        (
            'type'      => 'int-11',
            'name'      => 'ID',
            'default'   => '',
            'desc'      => '',
            'match'     => 'is_numeric',
            'search'    => 'order',
            //'list'        => true,
        ),

        'mid'      => array
        (
            'type'      => 'int-11',
            'name'      => '手机号',
            'default'   => '-1',
            'desc'      => '代理商',
            'match'     => 'is_string',
            'update'    => 'text',
            'search'    => $mid ? 'hidden' : array
            (
                'api' => 'agent/member-select',
                'col' => 'mobile',
                'result' => 'id',
            ),
            'list_name' => '手机号',
            'list'      => 'Dever::load("agent/member-find#mobile", {mid})',
            'list_order' => 4,
        ),

        'agent-member-name'=> array
        (
            'name'      => '姓名',
            'default'   => '',
            'desc'      => '姓名',
            'match'     => 'option',
            # 读取另外表的关联方式
            'sync'      => array('mid', 'id'),
            'list'      => true,
            'list_order' => 3,
        ),

        'agent-member-role'=> array
        (
            'name'      => '代理角色',
            'default'   => '',
            'desc'      => '代理角色',
            'match'     => 'option',
            # 读取另外表的关联方式
            'sync'      => array('mid', 'id'),
            'list'      => 'Dever::load("setting/role-find#name", "{agent-member-role}")',
            'list_order' => 5,
        ),

        'order_num'      => array
        (
            'type'      => 'varchar-100',
            'name'      => '流水号',
            'default'   => '',
            'desc'      => '流水号',
            'match'     => 'is_string',
            'update'    => 'text',
            'search'    => 'fulltext',
            'list'      => true,
            'list_order'  => 1,
        ),

        'ycash'      => array
        (
            'type'      => 'float-11,2',
            'name'      => '提现金额',
            'default'   => '0',
            'desc'      => '金额',
            'match'     => 'is_numeric',
            'update'    => 'text',
            'list'      => true,
            'list_order' => 6,
        ),

        'cash'      => array
        (
            'type'      => 'float-11,2',
            'name'      => '实际提现金额',
            'default'   => '0',
            'desc'      => '提现金额',
            'match'     => 'is_numeric',
            'update'    => 'text',
            'list'      => true,
            'list_order' => 7,
        ),

        'yue'      => array
        (
            'type'      => 'float-11,2',
            'name'      => '提现后余额',
            'default'   => '0',
            'desc'      => '提现后余额',
            'match'     => 'is_numeric',
            'update'    => 'text',
            'list'      => true,
            'list_order' => 8,
        ),

        'name'      => array
        (
            'type'      => 'varchar-100',
            'name'      => '姓名',
            'default'   => '',
            'desc'      => '姓名',
            'match'     => 'is_string',
            'update'    => 'text',
        ),

        'bank'      => array
        (
            'type'      => 'int-11',
            'name'      => '银行',
            'default'   => '',
            'desc'      => '银行',
            'match'     => 'is_numeric',
            'update'    => 'text',
        ),

        'bankname'      => array
        (
            'type'      => 'varchar-100',
            'name'      => '开户行',
            'default'   => '',
            'desc'      => '开户行',
            'match'     => 'is_string',
            'update'    => 'text',
        ),

        'card'      => array
        (
            'type'      => 'varchar-200',
            'name'      => '卡号',
            'default'   => '',
            'desc'      => '卡号',
            'match'     => 'is_string',
            'update'    => 'text',
        ),

        'cash_id'      => array
        (
            'type'      => 'int-11',
            'name'      => '资金表id',
            'default'   => '',
            'desc'      => '资金表id',
            'match'     => 'is_string',
            'update'    => 'text',
        ),

        'bill-cash-status'=> array
        (
            'name'      => '交易状态',
            'default'   => '',
            'desc'      => '交易状态',
            'match'     => 'option',
            # 读取另外表的关联方式
            'sync'      => array('cash_id', 'id'),
            'list'      => true,
            'option'	=> $cash_status,
            'list_order' => 9,
        ),

        'status'        => array
        (
            'type'      => 'int-11',
            'name'      => '发放状态',
            'default'   => '1',
            'desc'      => '发放状态',
            'match'     => 'is_numeric',
            'update'  	=> 'hidden',
            'option'    => $status,
            'search'    => 'select',
            'list'      => true,
            'list_order' => 10,
        ),

        'audit'        => array
        (
            'type'      => 'int-11',
            'name'      => '审核状态',
            'default'   => '2',
            'desc'      => '审核状态',
            'match'     => 'is_numeric',
            'update'    => 'radio',
            'option'    => $manage_status,
        ),

        'audit_desc'      => array
        (
            'type'      => 'varchar-600',
            'name'      => '备注',
            'default'   => '',
            'desc'      => '审核说明',
            'match'     => 'is_string',
            'update'    => 'textarea',
            'list'      => '"{audit_desc}" ? "{audit_desc}" : "-"',
            'list_order'  => 12,
        ),

        'pic'		=> array
		(
			'type' 		=> 'text-255',
			'name' 		=> '凭证',
			'default' 	=> '',
			'desc' 		=> '请选择凭证',
			'match' 	=> 'option',
			'update'	=> 'images',
			'key' 		=> '1',
			'place'		=> '150',
		),

        'operdate'     => array
        (
            'type'      => 'int-11',
            'name'      => '发放时间',
            'default'   => '',
            'match'     => 'is_numeric',
            'desc'      => '',
            'list'      => '"{operdate}" > 0 ? date("Y-m-d H:i", {operdate}) : "-"',
            'list_order'  => 11,
        ),

        '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", {cdate})',
            'list_order'  => 2,
        ),
    ),

    'manage' => array
    (
        'insert' => false,
        'delete' => false,
        'edit' => false,
        'list_button' => array
        (
            'list' => array('查看详情', '"push_cash&project=bill&id={cash_id}&page_type=1"'),

            'fast' => array('发放', '"tixian&where_id={id}&col=audit,audit_desc,pic&oper_save_jump=tixian&oper_table=tixian&oper_parent=tixian"', '{status} == 1 && "{bill-cash-status}" == 2'),
        ),
    ),

    'request' => array
    (
        'getData' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'mid' => 'yes',
                'state' => 1,
            ),
            'order' => array('id' => 'desc'),
            'page' => array(10, 'list'),
            'type' => 'all',
            'col' => '*',
        ),

        'getNew' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'mid' => 'yes',
                'state' => 1,
            ),
            'order' => array('id' => 'desc'),
            'type' => 'one',
            'col' => '*',
        ),
    ),
);
