<?php
$acct_type = array
(
    //-1 => '个人账户',
    1 => '公司账户',
);
$mer_type = array
(
    2 => '个人工商户',
    1 => '企业商户',
    //3 => '小微商户',
);
$desc = '';
$col = Dever::input('col');
if (!$col) {
    $tab = array('基本信息', '法人信息', '企业信息', '银行信息');
} else {
    $tab = '';
}

$step = array
(
    -1 => '待签约提审',
    1 => '入网：资料提交',//3.2
    2 => '入网：对公账户打款',//3.7
    3 => '入网：对公账户验证',//3.6

    4 => '入网：前台签约中',//3.3
    5 => '入网：签约审核中',//3.4
    6 => '入网：签约成功',//3.4

    11 => '变更：资料提交',//3.9
    14 => '变更：前台签约中',//3.10
    15 => '变更：签约审核中',//3.11
    16 => '变更：签约成功',//3.11
);

return array
(
    # 表名
    'name' => 'yspay_sign',
    # 显示给用户看的名称
    'lang' => '银联签约',
    # 后台菜单排序
    'order' => -100,
    'menu' => false,
    'step' => $step,
    'end' => array
    (
        'update' => 'pay/yspay/sign.update',
    ),
    # 数据结构
    'struct' => array
    (
        'id'        => array
        (
            'type'      => 'int-11',
            'name'      => 'ID',
            'default'   => '',
            'desc'      => '',
            'match'     => 'is_numeric',
            'search'    => 'order',
            //'list'      => true,
            'order'     => 'desc',
        ),

        'account_id'      => array
        (
            'type'      => 'int-11',
            'name'      => '账户id',
            'default'   => '',
            'desc'      => '账户id',
            'match'     => 'option',
            'search'    => 'hidden',
            'update'    => 'hidden',
            'value'     => Dever::input('search_option_account_id'),
        ),

        'merchant_id'      => array
        (
            'type'      => 'int-11',
            'name'      => '商户id',
            'default'   => '',
            'desc'      => '商户id',
            'match'     => 'option',
            'update'    => 'hidden',
            'value'     => Dever::input('search_option_merchant_id'),
            'list_name' => '商户名称',
            'list'      => 'Dever::load("pay/yspay_merchant-one#name", "{merchant_id}")',
        ),

        'ums_reg_id'      => array
        (
            'type'      => 'varchar-50',
            'name'      => '自助签约平台唯一标识',
            'default'   => '',
            'desc'      => '自助签约平台唯一标识',
            'match'     => 'option',
            // 'update'    => 'text',
        ),

        'url'      => array
        (
            'type'      => 'varchar-800',
            'name'      => '签约前台页面地址',
            'default'   => '',
            'desc'      => '签约前台页面地址',
            'match'     => 'option',
            // 'update'    => 'text',
        ),

        'cash'      => array
        (
            'type'      => 'varchar-30',
            'name'      => '打款金额',
            'default'   => '',
            'desc'      => '打款金额',
            'match'     => 'option',
            'update'    => $col ? 'text' : false,
        ),

        'area'       => array
        (
            'type'      => 'varchar-500',
            'name'      => '城市区域',
            'default'   => '',
            'desc'      => '城市区域',
            'match'     => 'option',
            //'search'    => 'linkage',
            'update'    => 'linkage',
            'option'    => Dever::url('api.get?level_total=3', 'area'),
            //'list'      => 'Dever::load("area/api.string", "{area}")',
        ),

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

        'mccCode'      => array
        (
            'type'      => 'varchar-200',
            'name'      => '行业类别编码',
            'default'   => '5499',
            'desc'      => '行业类别编码',
            'match'     => 'option',
            //'update'    => 'text',
            'tab'       => 0,
        ),

        'tax'     => array
        (
            'type'      => 'varchar-150',
            'name'      => '税务登记证',
            'default'   => '',
            'desc'      => '税务登记证',
            'match'     => 'option',
            'update'    => 'image',
            'key'       => '8',
            //'place'     => '660*660',
            'tab'       => 0,
        ),

        'door'     => array
        (
            'type'      => 'varchar-150',
            'name'      => '门头照片',
            'default'   => '',
            'desc'      => '门头照片',
            'match'     => 'option',
            'update'    => 'image',
            'key'       => '8',
            //'place'     => '660*660',
            'tab'       => 0,
        ),

        'house_pic'     => array
        (
            'type'      => 'varchar-150',
            'name'      => '室内照片',
            'default'   => '',
            'desc'      => '室内照片',
            'match'     => 'option',
            'update'    => 'image',
            'key'       => '8',
            //'place'     => '660*660',
            'tab'       => 0,
        ),

        'screen_pic'     => array
        (
            'type'      => 'varchar-150',
            'name'      => '商户网站/APP截图',
            'default'   => '',
            'desc'      => '商户网站/APP截图',
            'match'     => 'option',
            'update'    => 'image',
            'key'       => '8',
            //'place'     => '660*660',
            'tab'       => 0,
        ),

        'name'      => array
        (
            'type'      => 'varchar-32',
            'name'      => '法人姓名',
            'default'   => '',
            'desc'      => '请输入法人姓名',
            'match'     => 'is_string',
            'update'    => 'text',
            'search'    => 'fulltext',
            'list'      => true,
            'list_order' => -9,
            'tab'       => 1,
        ),

        'mobile'      => array
        (
            'type'      => 'bigint-11',
            'name'      => '法人电话',
            'default'   => '',
            'desc'      => '请输入法人电话',
            'match'     => 'is_numeric',
            'update'    => 'text',
            'search'    => 'fulltext',
            'list'      => true,
            'list_order' => -8,
            'tab'       => 1,
        ),

        'legalmanHomeAddr'      => array
        (
            'type'      => 'varchar-50',
            'name'      => '法人家庭地址',
            'default'   => '',
            'desc'      => '法人家庭地址',
            'match'     => 'option',
            'update'    => 'text',
            'tab'       => 1,
        ),

        'idcard'      => array
        (
            'type'      => 'varchar-32',
            'name'      => '法人身份证号码',
            'default'   => '',
            'desc'      => '身份证号码',
            'match'     => Dever::rule('idcard'),
            'update'    => 'text',
            'tab'       => 1,
        ),

        'card_deadline'      => array
        (
            'type'      => 'varchar-32',
            'name'      => '法人身份证截止日期',
            'default'   => '',
            'desc'      => '身份证截止日期',
            'match'     => 'option',
            'default'   => '0',
            'desc'      => '',
            'match'     => 'is_numeric',
            'update'    => 'day',
            //'search'    => 'date',
            'callback'  => 'maketime',
            'tab'       => 1,
        ),

        'idcard_front'     => array
        (
            'type'      => 'varchar-150',
            'name'      => '法人身份证正面',
            'default'   => '',
            'desc'      => '身份证正面',
            'match'     => 'option',
            'update'    => 'image',
            'key'       => '8',
            //'place'     => '660*660',
            'tab'       => 1,
        ),

        'idcard_back'     => array
        (
            'type'      => 'varchar-150',
            'name'      => '法人身份证背面',
            'default'   => '',
            'desc'      => '法人身份证背面',
            'match'     => 'option',
            'update'    => 'image',
            'key'       => '8',
            //'place'     => '660*660',
            'tab'       => 1,
        ),

        'hand_idcard'     => array
        (
            'type'      => 'varchar-150',
            'name'      => '法人手持身份证自拍照',
            'default'   => '',
            'desc'      => '法人手持身份证自拍照',
            'match'     => 'option',
            'update'    => 'image',
            'key'       => '8',
            //'place'     => '660*660',
            'tab'       => 1,
        ),

        'reg_mer_type'      => array
        (
            'type'      => 'int-11',
            'name'      => '企业类型',
            'default'   => '2',
            'desc'      => '企业类型',
            'match'     => 'option',
            'update'    => 'radio',
            'option'    => $mer_type,
            'search'    => 'select',
            'list'      => true,
            'tab'       => 2,
        ),

        'company_name'      => array
        (
            'type'      => 'varchar-200',
            'name'      => '企业名称',
            'default'   => '',
            'desc'      => '企业名称',
            'match'     => 'option',
            'update'    => 'text',
            'tab'       => 2,
        ),

        'license'     => array
        (
            'type'      => 'varchar-150',
            'name'      => '企业营业执照',
            'default'   => '',
            'desc'      => '营业执照',
            'match'     => 'option',
            'update'    => 'image',
            'key'       => '8',
            //'place'     => '660*660',
            'tab'       => 2,
        ),

        'license_number'      => array
        (
            'type'      => 'varchar-200',
            'name'      => '企业营业执照号码',
            'default'   => '',
            'desc'      => '营业执照号码',
            'match'     => 'option',
            'update'    => 'text',
            'tab'       => 2,
        ),

        'bank_acct_type'      => array
        (
            'type'      => 'int-11',
            'name'      => '开户行账户类型',
            'default'   => '1',
            'desc'      => '账户类型',
            'match'     => 'option',
            //'update'    => 'radio',
            'option'    => $acct_type,
            'tab'       => 3,
        ),

        'back_no'      => array
        (
            'type'      => 'varchar-50',
            'name'      => '开户行行号',
            'default'   => '',
            'desc'      => '开户行行号',
            'match'     => 'option',
            // 'update'    => 'text',
            'tab'       => 3,
        ),

        'shop_addr_ext'      => array
        (
            'type'      => 'varchar-50',
            'name'      => '开户行地址',
            'default'   => '',
            'desc'      => '开户行地址',
            'match'     => 'option',
            // 'update'    => 'text',
            'tab'       => 3,
        ),

        'bank_acct_no'      => array
        (
            'type'      => 'varchar-50',
            'name'      => '开户行账号',
            'default'   => '',
            'desc'      => '开户行账号',
            'match'     => 'option',
            'update'    => 'text',
            'tab'       => 3,
        ),

        'bank_area'       => array
        (
            'type'      => 'varchar-500',
            'name'      => '开户所在地',
            'default'   => '',
            'desc'      => '开户所在地',
            'match'     => 'option',
            //'search'    => 'linkage',
            'update'    => 'linkage',
            'option'    => Dever::url('api.get?level_total=2', 'area'),
            //'list'      => 'Dever::load("area/api.string", "{area}")',
            'tab'       => 3,
        ),

        'bank_acct_noname'      => array
        (
            'type'      => 'varchar-50',
            'name'      => '开户行名称-银行名称和支行名称用/隔开，如：招商/天通苑',
            'default'   => '',
            'desc'      => '开户行名称',
            'match'     => 'option',
            'update'    => 'text',
            'tab'       => 3,
        ),

        'bank_fount'     => array
        (
            'type'      => 'varchar-150',
            'name'      => '银行卡正面照',
            'default'   => '',
            'desc'      => '银行卡正面照',
            'match'     => 'option',
            'update'    => 'image',
            'key'       => '8',
            //'place'     => '660*660',
            'tab'       => 3,
        ),

        'bank_back'     => array
        (
            'type'      => 'varchar-150',
            'name'      => '银行卡反面照',
            'default'   => '',
            'desc'      => '银行卡反面照',
            'match'     => 'option',
            'update'    => 'image',
            'key'       => '8',
            //'place'     => '660*660',
            'tab'       => 3,
        ),

        'open'     => array
        (
            'type'      => 'varchar-150',
            'name'      => '开户许可证',
            'default'   => '',
            'desc'      => '开户许可证',
            'match'     => 'option',
            'update'    => 'image',
            'key'       => '8',
            //'place'     => '660*660',
            'tab'       => 3,
        ),

        'step'      => array
        (
            'type'      => 'int-11',
            'name'      => '状态',
            'default'   => '-1',
            'desc'      => '当前步骤',
            'match'     => 'option',
            'option'    => $step,
            // 'update'    => 'text',
            'search'    => 'select',
            'list'      => true,
        ),

        'state'     => array
        (
            'type'      => 'tinyint-1',
            'name'      => '状态',
            'default'   => '1',
            'desc'      => '请选择状态',
            'match'     => 'is_numeric',
            'list_name' => '最新进度',
            'list'      => 'Dever::load("shop/lib/sign.getLog", {id})',
        ),
        
        'cdate'     => array
        (
            'type'      => 'int-11',
            'name'      => '录入时间',
            'match'     => array('is_numeric', time()),
            'desc'      => '',
            # 只有insert时才生效
            'insert'    => true,
            //'list'      => 'date("Y-m-d H:i:s", {cdate})',
        ),
    ),
	'manage' => array
    (
        'edit' => false,
        'delete' => false,
        # 图片上传后调用的接口
        'upload' => 'pay/yspay/sign.upload?sign=1',
        # 更新页面顶部描述
        'desc' => $desc,
        # 更新页面tab切换
        'tab' => $tab,
        //'list' => 'update',
        'list_button' => array
        (
            'update' => array('编辑', '', '{step} == -1'),
            'delete' => array('删除', '', '{step} == -1'),
            'oper' => array('提交资料', 'pay/yspay/sign.handle?sign_id={id}', '{step} == -1'),
            'fast' => array('打款确认', '"yspay_sign&where_id={id}&col=cash"', '{step} == 2'),
            'copy' => array('复制链接', 'pay/yspay/sign.getAgreement?sign_id={id}', '{step} == 4'),
            //'oper' => array('重新生成合同', 'pay/yspay/sign.getAgreement?sign_id={id}', '{step} == 4'),
            'list' => array('查看日志', '"yspay_sign_log&search_option_sign_id={id}&oper_table=yspay_sign"'),
            //'fast1' => array('绑定门店', '"sign&where_id={id}&col=create_shop,shop_id"', '({step} == 6)'),
        )
    ),

    'request' => array
    (
        'getData' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'step' => array('yes', 'in'),
                'state' => 1,
            ),
            'type' => 'all',
            'order' => array('id' => 'asc'),
            'col' => '*',
        ),
    )
);