$order_list = getBackHuanOrder();
        }
        $smarty->assign('order_list', $order_list['orders']);
        $smarty->assign('filter', $order_list['filter']);
        $smarty->assign('record_count', $order_list['record_count']);
        $smarty->assign('page_count', $order_list['page_count']);
    }
    $smarty->assign('rebate', $rebate);
    $smarty->assign('full_page', 1);
    $smarty->assign('ur_here', '佣金相关订单信息');
    $is_pay_ok = $rebate['is_pay_ok'];
    $lang_rebate_list = $rebate['is_pay_ok'] ? $_LANG['03_rebate_pay'] : $_LANG['03_rebate_nopay'];
    $href_rebate_list = "supplier_store_rebate.php?act=list&is_pay_ok={$is_pay_ok}";
    $smarty->assign('action_link', array('href' => $href_rebate_list, 'text' => $lang_rebate_list));
    //判断是不是仓库的主管
    $is_store_admin = haveDoQueRen($rebate['store_id'], $_SESSION['admin_id']);
    $smarty->assign('is_store_admin', $is_store_admin);
    assign_query_info();
    $smarty->display('store_rebate_info.htm');
} elseif ($_REQUEST['act'] == 'query') {
    /* 检查权限 */
    admin_priv('store_rebate');
    $id = intval($_REQUEST['rid']);
    $order_type = isset($_REQUEST['otype']) && intval($_REQUEST['otype']) > 0 ? intval($_REQUEST['otype']) : 0;
    $rebate = rebateHave($id);
    $nowtime = gmtime();
    $rebate['rebate_paytime_start'] = local_date('Y.m.d', $rebate['rebate_paytime_start']);
    $paytime_end = $rebate['rebate_paytime_end'];
    $rebate['rebate_paytime_end'] = local_date('Y.m.d', $paytime_end);
    $rebate['isdo'] = $paytime_end + $GLOBALS['_CFG']['okgoods_time'] * 3600 * 24 >= $nowtime ? 0 : 1;
    $rebate['chadata'] = datecha($paytime_end + $GLOBALS['_CFG']['okgoods_time'] * 3600 * 24);
    $rebate_list = array('rebateid' => $rebate_id, 'username' => '平台方:' . $_SESSION['user_name'], 'type' => REBATE_LOG_LIST, 'typedec' => '取消发起分销商(仓库)结算', 'contents' => '佣金状态由等待审核变可结算', 'addtime' => gmtime());
    $db->autoExecute($ecs->table('store_rebate_log'), $rebate_list, 'INSERT');
    /* 清除缓存 */
    clear_cache_files();
    /* 提示信息 */
    $links[] = array('href' => 'supplier_store_rebate.php?act=list', 'text' => '返回本期佣金列表');
    sys_msg('恭喜,处理成功!', 0, $links);
} elseif ($act == 'queren') {
    /* 检查权限 */
    admin_priv('store_rebate');
    /* 提交值 */
    $rebate_id = intval($_POST['id']);
    if (($rebate = rebateHave($rebate_id)) === false) {
        sys_msg('该返佣记录不存在!');
    }
    if (haveDoQueRen($rebate['store_id'], $_SESSION['admin_id']) == false) {
        sys_msg('你没有权限!');
    }
    $rebate = array('status' => 3);
    /* 保存返佣信息 */
    $db->autoExecute($ecs->table('store_rebate'), $rebate, 'UPDATE', "rebate_id = '" . $rebate_id . "'");
    //修改佣金信息状态记录
    $rebate_list = array('rebateid' => $rebate_id, 'username' => '平台方:' . $_SESSION['user_name'], 'type' => REBATE_LOG_LIST, 'typedec' => '确认通过', 'contents' => '佣金状态由等待审核变等待平台方付款', 'addtime' => gmtime());
    $db->autoExecute($ecs->table('store_rebate_log'), $rebate_list, 'INSERT');
    /* 清除缓存 */
    clear_cache_files();
    /* 提示信息 */
    $links[] = array('href' => 'supplier_store_rebate.php?act=list', 'text' => '返回本期佣金列表');
    sys_msg('恭喜,处理成功!', 0, $links);
} elseif ($act == 'finish') {
    /* 检查权限 */
    $rebate_list = array('rebateid' => $rebate_id, 'username' => '入驻方:' . $_SESSION['supplier_name'], 'type' => REBATE_LOG_LIST, 'typedec' => '取消发起分销商(仓库)结算', 'contents' => '佣金状态由等待审核变可结算', 'addtime' => gmtime());
    $db->autoExecute($ecs->table('store_rebate_log'), $rebate_list, 'INSERT');
    /* 清除缓存 */
    clear_cache_files();
    /* 提示信息 */
    $links[] = array('href' => 'supplier_store_rebate.php?act=list', 'text' => '返回本期佣金列表');
    sys_msg('恭喜,处理成功!', 0, $links);
} elseif ($act == 'queren') {
    /* 检查权限 */
    admin_priv('store_rebate');
    /* 提交值 */
    $rebate_id = intval($_POST['id']);
    if (($rebate = rebateHave($rebate_id)) === false) {
        sys_msg('该返佣记录不存在!');
    }
    if (haveDoQueRen($rebate['store_id'], $_SESSION['supplier_user_id'], $_REQUEST[storetypeid]) == false) {
        sys_msg('你没有权限!');
    }
    $rebate = array('status' => 3);
    /* 保存返佣信息 */
    $db->autoExecute($ecs->table('store_rebate'), $rebate, 'UPDATE', "rebate_id = '" . $rebate_id . "'");
    //修改佣金信息状态记录
    $rebate_list = array('rebateid' => $rebate_id, 'username' => '入驻方:' . $_SESSION['supplier_name'], 'type' => REBATE_LOG_LIST, 'typedec' => '确认通过', 'contents' => '佣金状态由等待审核变等待入驻商方付款', 'addtime' => gmtime());
    $db->autoExecute($ecs->table('store_rebate_log'), $rebate_list, 'INSERT');
    /* 清除缓存 */
    clear_cache_files();
    /* 提示信息 */
    $links[] = array('href' => 'supplier_store_rebate.php?act=list', 'text' => '返回本期佣金列表');
    sys_msg('恭喜,处理成功!', 0, $links);
} elseif ($act == 'finish') {
    /* 检查权限 */
            $order_list = getBackHuanOrder();
        }
        $smarty->assign('order_list', $order_list['orders']);
        $smarty->assign('filter', $order_list['filter']);
        $smarty->assign('record_count', $order_list['record_count']);
        $smarty->assign('page_count', $order_list['page_count']);
    }
    $smarty->assign('rebate', $rebate);
    $smarty->assign('full_page', 1);
    $smarty->assign('ur_here', '佣金相关订单信息');
    $is_pay_ok = $rebate['is_pay_ok'];
    $lang_rebate_list = $rebate['is_pay_ok'] ? $_LANG['03_rebate_pay'] : $_LANG['03_rebate_nopay'];
    $href_rebate_list = "supplier_store_rebate.php?act=list&is_pay_ok={$is_pay_ok}";
    $smarty->assign('action_link', array('href' => $href_rebate_list, 'text' => $lang_rebate_list));
    //判断是不是仓库的主管
    $is_store_admin = haveDoQueRen($rebate['store_id'], $_SESSION['supplier_user_id'], $_REQUEST['storetypeid']);
    $smarty->assign('is_store_admin', $is_store_admin);
    assign_query_info();
    $smarty->display('store_rebate_info.htm');
} elseif ($_REQUEST['act'] == 'query') {
    /* 检查权限 */
    admin_priv('store_rebate');
    $id = intval($_REQUEST['rid']);
    $order_type = isset($_REQUEST['otype']) && intval($_REQUEST['otype']) > 0 ? intval($_REQUEST['otype']) : 0;
    $rebate = rebateHave($id);
    $nowtime = gmtime();
    $rebate['rebate_paytime_start'] = local_date('Y.m.d', $rebate['rebate_paytime_start']);
    $paytime_end = $rebate['rebate_paytime_end'];
    $rebate['rebate_paytime_end'] = local_date('Y.m.d', $paytime_end);
    $rebate['isdo'] = $paytime_end + $GLOBALS['_CFG']['okgoods_time'] * 3600 * 24 >= $nowtime ? 0 : 1;
    $rebate['chadata'] = datecha($paytime_end + $GLOBALS['_CFG']['okgoods_time'] * 3600 * 24);