示例#1
0
    }
} elseif ($action == 'act_add_bonus') {
    include_once ROOT_PATH . 'includes/lib_transaction.php';
    $bouns_sn = isset($_POST['bonus_sn']) ? intval($_POST['bonus_sn']) : '';
    if (add_bonus($user_id, $bouns_sn)) {
        show_message($_LANG['add_bonus_sucess'], $_LANG['back_up_page'], 'user.php?act=bonus', 'info');
    } else {
        $err->show($_LANG['back_up_page'], 'user.php?act=bonus');
    }
} elseif ($action == 'order_list') {
    include_once ROOT_PATH . 'includes/lib_transaction.php';
    $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1;
    $record_count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('order_info') . " WHERE user_id = '{$user_id}'");
    $pager = get_pager('user.php', array('act' => $action), $record_count, $page);
    $orders = get_user_orders($user_id, $pager['size'], $pager['start']);
    $merge = get_user_merge($user_id);
    $smarty->assign('merge', $merge);
    $smarty->assign('pager', $pager);
    $smarty->assign('orders', $orders);
    $smarty->display('user_transaction.dwt');
} elseif ($action == 'order_detail') {
    include_once ROOT_PATH . 'includes/lib_transaction.php';
    include_once ROOT_PATH . 'includes/lib_payment.php';
    include_once ROOT_PATH . 'includes/lib_order.php';
    include_once ROOT_PATH . 'includes/lib_clips.php';
    $order_id = isset($_GET['order_id']) ? intval($_GET['order_id']) : 0;
    /* 订单详情 */
    $order = get_order_detail($order_id, $user_id);
    if ($order === false) {
        $err->show($_LANG['back_home_lnk'], './');
        exit;
示例#2
0
function action_order_list()
{
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $_SESSION['user_id'];
    $action = $GLOBALS['action'];
    include_once ROOT_PATH . 'includes/lib_transaction.php';
    include_once ROOT_PATH . 'includes/lib_transaction_1.php';
    include_once ROOT_PATH . 'includes/lib_payment.php';
    include_once ROOT_PATH . 'includes/lib_order.php';
    include_once ROOT_PATH . 'includes/lib_clips.php';
    $ex_where = " and user_id={$user_id}";
    /* 已完成的订单 */
    $order_count['finished'] = $db->GetOne('SELECT COUNT(*) FROM ' . $ecs->table('order_info') . " WHERE 1 {$ex_where} " . order_query_sql('finished'));
    $status['finished'] = CS_FINISHED;
    /* 待发货的订单: */
    $order_count['await_ship'] = $db->GetOne('SELECT COUNT(*)' . ' FROM ' . $ecs->table('order_info') . " WHERE 1 {$ex_where} " . order_query_sql('await_ship'));
    $status['await_ship'] = CS_AWAIT_SHIP;
    /* 待付款的订单: */
    $order_count['await_pay'] = $db->GetOne('SELECT COUNT(*)' . ' FROM ' . $ecs->table('order_info') . " WHERE 1 {$ex_where} " . order_query_sql('await_pay'));
    $status['await_pay'] = CS_AWAIT_PAY;
    /* “未确认”的订单 */
    $order_count['unconfirmed'] = $db->GetOne('SELECT COUNT(*) FROM ' . $ecs->table('order_info') . " WHERE 1 {$ex_where} " . order_query_sql('unconfirmed'));
    $status['unconfirmed'] = OS_UNCONFIRMED;
    // $today_start = mktime(0,0,0,date('m'),date('d'),date('Y'));
    $order_count['stats'] = $db->getRow('SELECT COUNT(*) AS oCount, IFNULL(SUM(order_amount), 0) AS oAmount' . ' FROM ' . $ecs->table('order_info'));
    $smarty->assign('order_count', $order_count);
    $smarty->assign('status', $status);
    $composite_status = isset($_REQUEST['composite_status']) ? intval($_REQUEST['composite_status']) : -1;
    $where = '';
    switch ($composite_status) {
        case CS_AWAIT_PAY:
            $where .= order_query_sql('await_pay');
            break;
        case CS_AWAIT_SHIP:
            $where .= order_query_sql('await_ship');
            break;
        case CS_FINISHED:
            $where .= order_query_sql('finished');
            break;
        default:
            if ($composite_status != -1) {
                $where .= " AND o.order_status = '{$composite_status}' ";
            }
    }
    $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1;
    $record_count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('order_info') . " WHERE user_id = '{$user_id}'");
    $pager = get_pager('user.php', array('act' => $action, 'composite_status' => $composite_status), $record_count, $page, 5);
    $orders = get_user_orders_1($user_id, $pager['size'], $pager['start'], $where);
    foreach ($orders as $k_kuaidi => $v_kuaidi) {
        // 同城快递
        if ($v_kuaidi['shipping_name_2'] == "同城快递") {
            $kos_order_id = $db->getOne("select order_id from " . $ecs->table('kuaidi_order') . " where order_sn='" . $v_kuaidi['invoice_no'] . "'");
            $sql = "select * from " . $ecs->table('kuaidi_order_status') . " where order_id='" . $kos_order_id . "'  order by status_id desc";
            $res_status = $db->query($sql);
            $have_shipping_info = 0;
            $shipping_info = "";
            while ($row_status = $db->fetchRow($res_status)) {
                if ($row_status['status_display'] == 1) {
                    switch ($row_status['status_id']) {
                        case 1:
                            $shipping_info .= "您提交了订单,请等待确认。 (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")";
                            break;
                        case 2:
                            $shipping_info .= "您的快件已经确认,等待快递员揽收。 (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")";
                            break;
                        case 3:
                            $postman_id = $db->getOne("select postman_id from " . $ecs->table('kuaidi_order') . " where order_sn='" . $orders[$k_kuaidi]['invoice_no'] . "'");
                            $postman_info = $db->getRow("select postman_name, mobile from " . $ecs->table('postman') . " where postman_id=" . $postman_id);
                            $shipping_info .= "您的快件正在派送,快递员:" . $postman_info['postman_name'] . ",电话:" . $postman_info['mobile'] . " (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")";
                            break;
                        case 4:
                            $shipping_info .= "您的快件已经签收。 (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")";
                            break;
                        case 5:
                            $shipping_info .= "您的快件已被拒收。 (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")";
                            break;
                        case 6:
                            $shipping_info .= "您拒收的快件已被退回。 (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")";
                            break;
                        case 7:
                            $shipping_info .= "您的快件已经取消。 (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")";
                            break;
                    }
                    $shipping_info .= "<br>";
                    if ($row_status['status_id'] >= 1) {
                        $have_shipping_info++;
                    }
                }
            }
            if ($have_shipping_info) {
                $orders[$k_kuaidi]['result_content'] = $shipping_info;
            } else {
                $orders[$k_kuaidi]['result_content'] = '抱歉,暂时还没有该运单的物流信息哦!';
            }
        }
    }
    $merge = get_user_merge($user_id);
    $smarty->assign('merge', $merge);
    $smarty->assign('pager', $pager);
    $smarty->assign('orders', $orders);
    $smarty->display('user_transaction.dwt');
}