<?php

$status = array
(
    1 => array('name' => '待业务初审', 'style' => 'font-weight:bold;color:#436EEE'),
    2 => array('name' => '待财务终审', 'style' => 'font-weight:bold;color:#436EEE'),
    3 => array('name' => '已完成', 'style' => 'font-weight:bold;color:green'),
    4 => array('name' => '驳回', 'style' => 'font-weight:bold;color:#CD3700'),
);

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

$button = array();
$col = Dever::input('col');
if (Dever::load('manage/auth')->checkFunc('agent.soft_cash', 'editnew', '新增')) {
	$button['新增'] = array('新增', Dever::url('project/database/update&project=agent&&table=soft_cash&menu=agent&search_option_state=1'));
}
return array
(
    # 表名
    'name' => 'soft_cash',
    # 显示给用户看的名称
    'lang' => '软件服务费',
    'menu' => true,
    'config_status' => $status,
    'end' => array
    (
    	'insert' => 'agent/lib/soft_cash.updateSoft',
        'update' => 'agent/lib/soft_cash.updateSoft',
    ),
    # 数据结构
    'struct' => array
    (
    
        'id'        => array
        (
            'type'      => 'int-11',
            'name'      => 'ID',
            'default'   => '',
            'desc'      => '',
            'match'     => 'is_numeric',
            'search'    => 'order',
            'update'    => 'hidden',
            //'list'        => true,
        ),

        'mid'      => array
        (
            'type'      => 'int-11',
            'name'      => '代理商姓名/手机号',
            'default'   => '-1',
            'desc'      => '代理商',
            'match'     => 'is_string',
            // 'update'    => 'text',
             'search'    => array
            (
                'api' => 'agent/member-getSearch',
                'col' => 'col',
                'result' => 'id',
                'search' => 'mid',
            ),
            'list'      => 'Dever::load("agent/lib/member.getOne", {mid}, "agent/member", true)',
            'list_order' => 2,
        ),
         'mobile'      => array
        (
            'type'      => 'bigint-11',
            'name'      => '代理商手机号',
            'default'   => '',
            'desc'      => '请输入手机号',
            'match'     => Dever::rule('mobile'),
            'update'    => 'text',
            # 绑定js脚本,更新时使用,第一个参数是执行的方式,第二个参数执行的方法,第三个参数是传值。
            'bind'        => array('onblur', 'loading', array('url' => Dever::url("lib/soft_cash.search", 'agent'))),
            //'search'    => 'fulltext',
            //'list'      => true,
        ),
     
       'order_num'      => array
        (
            'type'      => 'varchar-100',
            'name'      => '订单号',
            'default'   => '',
            'desc'      => '订单号',
            'match'     => 'is_string',
            // 'update'    => 'text',
            //'search'    => 'fulltext',
            'list_name' => '订单号<br />购买时间',
            'list'      => 'Dever::load("agent/lib/soft_cash.soft_show#num",{id})',
            'list_order' => 1,
        ),

        'agreement_id'      => array
        (
            'type'      => 'int-11',
            'name'      => '合同',
            'default'   => '-1',
            'desc'      => '合同',
            'match'     => 'is_string',
            // 'update'    => 'text',
        ),

        'cash'      => array
        (
            'type'      => 'float-11,2',
            'name'      => '软件服务费用',
            'default'   => '0',
            'desc'      => '费用',
            'match'     => 'option',
            'update'    => 'text',
            'list'      => true,
        ),

        'price'      => array
        (
            'type'      => 'float-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',
        ),

        'status'        => array
        (
            'type'      => 'tinyint-1',
            'name'      => '订单状态',
            'default'   => '1',
            'desc'      => '订单状态',
            'match'     => 'is_numeric',
            // 'update'    => 'radio',
            'option'    => $status,
            'list'      => true,
        ),
        'audit'        => array
        (
            'type'      => 'int-11',
            'name'      => '审核状态',
            'default'   => '2',
            'desc'      => '审核状态',
            'match'     => 'is_numeric',
            'update'    => $col ? 'radio' : false,
            'option'    => $manage_audit,
            'mul'       => true,
            'control'   => 'audit',
        ),

        '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=3',
        ),

        'admin_desc'      => array
        (
            'type'      => 'varchar-600',
            'name'      => '管理员备注',
            'default'   => '',
            'desc'      => '管理员备注',
            'match'     => 'option',
            'update'    => 'textarea',
        ),

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

        '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
    (
    	'insert' => false,
    	'delete' => false,
    	'edit'   => false,
    	'button' => $button,
    	'list_button' => array
        (
        	 'list' => array('查看详情', '"member_prize&project=agent&id={id}&page_type=1&[refer]"'),
        ),
    ),

    'request' => array
    (
        'getList' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                // 'main' => 'yes',
                'mobile' => 'yes',
                'state' => 1,
            ),
            'order' => array('id' => 'desc'),
            'type' => 'all',
            'col' => '*',
        ),

    ),
);