<?php
$config = include('place.php');
$config['update']['tab']['展示设置'] = 'vip_name,agent_name,place/resource';
$config['update']['field']['place/resource'] = array
(
    'name' => '资源选项',
    'where'  => array('id' => array('>', 0)),
    'desc' => '设置要展示的资源选项',
    'default' => Dever::load('manage', 'place')->getResourceDefault(array('name' => 'name')),
);

$data = Dever::load('manage', 'place')->getPlaceTree();
$id = $data[0]['children'][0]['id'];
$uid = $data[0]['children'][0]['uid'];
$user = Dever::db('user', 'sector')->find($uid);
if ($user['channel'] == 1) {
    $config['update']['tab']['渠道设置'] = 'channel,place/client_price,place/client';
    $config['update']['field']['channel'] = array
    (
        'type' => 'radio',
        'tips' => '开启后，将拥有源主供货能力',
    );
    $config['update']['field']['place/client_price'] = array
    (
        'name' => '默认基础折扣',
        'where'  => array('id' => array('>', 0)),
        'desc' => '设置源主进货资源的默认基础折扣',
        'default' => Dever::load('manage', 'place')->getResourceDefault(array('per' => '')),
    );
    $config['update']['field']['place/client'] = array
    (
        'name' => '默认销量折扣',
        'where'  => array('id' => array('>', 0)),
        'desc' => '设置后，如果n天内的销量达到预设值，将在默认基础折扣上再计算折扣',
    );
}
$config['update']['column'] = array
(
    'load' => 'place/info',
    //'add' => '新增',
    'key' => 'id',
    'data' => $data,
    'active' => $id,
    'where' => 'id',
    'hidden' => true,
);
$config['update']['field']['pay_account']['option'] = 'Dever::call("place/manage.getAccountList", '.$uid.')';
return array
(
    'source' => 'place/info',
    'list' => array
    (
        'field'      => array
        (
            'name',
        ),
        'data_button' => array
        (
            '编辑' => 'fastedit',
        ),
    ),
    'update' => $config['update'],
);