/**
 * 渠道加V用户列表
 */
$(function(){

    $.form.render();

    var ffrom = $('#ffrom').val();

    $('#btn_export_channel').click(function(e){
        var startDate = $('#startDate').val();
        var endDate = $('#endDate').val();
        window.location.href = Config.ROOT + '/marketing/joinWxcorp/export?ffrom='+ffrom+'&startDate='+startDate+'&endDate='+endDate;
    });

    $('#btn_export').click(function(e){
        var startDate = $('#startDate').val();
        var endDate = $('#endDate').val();
        window.location.href = Config.ROOT + '/marketing/joinWxcorp/export?startDate='+startDate+'&endDate='+endDate;
    });

    $('#btn_search').click(function(e){
        var startDate = $('#startDate').val() || '';
        var endDate = $('#endDate').val() || '';
        var postData = {
            'startDate'	: startDate,
            'endDate'	: endDate
        };
        $table.search(postData);
    });
	
	//初始化表格
    var landingConfigExtendId = $('#landingConfigExtendId').val();
    var $table = new App.Table({
        url: Config.ROOT + '/marketing/joinWxcorp/list?ffrom='+ffrom+'&landingConfigExtendId='+landingConfigExtendId,
        search: false,
        showRefresh: false,
        showToggle: false,
        showColumns: false,
        searchPlaceholder: 'uid',
        columns	:[
            {checkbox: true},
            {field:'join_wxcorp_userid', title:'企微成员userid'},
            {field:'uid', title:'用户uid'},
            {field:'phone', title:'手机号'},
            {field:'pay_time', title:'付款时间', dateFormat: 'yyyy-MM-dd HH:mm:ss'},
            {field:'id', title:'订单号'}
        ],
        getQueryParam: function () {
            var startDate = $('#startDate').val() || '';
            var endDate = $('#endDate').val() || '';
            var postData = {
                'startDate'	: startDate,
                'endDate'	: endDate
            };
            return postData;
        }
    });

});