Ejemplo n.º 1
0
function order()
{
    switch ($_SERVER['REQUEST_METHOD']) {
        case 'GET':
            $order_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
            if ($order_id > 0) {
                $r_data = get_order_detail($order_id, $user_id);
            } else {
                $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1;
                $limit = isset($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 1;
                $r_data = get_user_orders($user_id, $limit, $page);
            }
            // $record_count = $db->getOne("SELECT COUNT(*) FROM " .$ecs->table('order_info'). " WHERE user_id = '$user_id'");
            return $r_data;
            break;
        case 'DELETE':
            $order_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
            $user_id = $_SESSION['user_id'];
            if (cancel_order($order_id, $user_id)) {
                $r_data = 'Cancle Order Success!';
            } else {
                $r_data = 'Cancle Order Failed!';
            }
            return $r_data;
            break;
        default:
            return 'This API can not support ' . $_SERVER['REQUEST_METHOD'] . ' method';
            break;
    }
}
Ejemplo n.º 2
0
function add_order($orderInfo)
{
    $orderInfo = GetDefaultOrderInfo($orderInfo);
    $dbh = new PDOConnection();
    $order_id = AddOrderFromInfo($dbh, $orderInfo);
    if (isset($orderInfo['lines'])) {
        add_order_detail($dbh, $order_id, $orderInfo['lines']);
    }
    //return all order data to display on the order confirmation page
    $orderConf = get_order_detail(array('details' => 1, 'order_id' => $order_id));
    return $orderConf;
}
Ejemplo n.º 3
0
    $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;
    }
    /* 是否显示添加到购物车 */
    if ($order['extension_code'] != 'group_buy' && $order['extension_code'] != 'exchange_goods') {
        $smarty->assign('allow_to_cart', 1);
    }
    /* 订单商品 */
    $goods_list = order_goods($order_id);
    foreach ($goods_list as $key => $value) {
        $goods_list[$key]['market_price'] = price_format($value['market_price'], false);
        $goods_list[$key]['goods_price'] = price_format($value['goods_price'], false);
        $goods_list[$key]['subtotal'] = price_format($value['subtotal'], false);
    }
Ejemplo n.º 4
0
function action_order_detail()
{
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $_SESSION['user_id'];
    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);
    /* 退换货插件 www.68ecshop.com增加 */
    $shipping_time = $db->getOne("SELECT shipping_time FROM " . $ecs->table('order_info') . " WHERE order_id = '{$order_id}'");
    $now_time = gmtime();
    $not_back = 0;
    if ($GLOBALS['_CFG']['tuihuan_days_fahuo'] > 0) {
        if (($now_time - $shipping_time) / 86400 < $GLOBALS['_CFG']['tuihuan_days_fahuo']) {
            $not_back = 1;
        }
    }
    if ($GLOBALS['_CFG']['tuihuan_days_qianshou'] > 0) {
        if (($now_time - $shipping_time) / 86400 > $GLOBALS['_CFG']['tuihuan_days_qianshou']) {
            $not_back = 1;
        }
    }
    $smarty->assign('not_back', $not_back);
    /* 退换货插件 www.68ecshop.com增加 */
    if ($order === false) {
        $err->show($_LANG['back_home_lnk'], './');
        exit;
    }
    if ($db->getOne("select shipping_code from " . $ecs->table('shipping') . " where shipping_id=" . $order['shipping_id']) == "tc_express") {
        $order['tc_express'] = 1;
        $ko_order_sn = $db->getOne("select invoice_no from " . $ecs->table('delivery_order') . " where order_id=" . $order_id);
        if ($ko_order_sn) {
            $kos_order_id = $db->getOne("select order_id from " . $ecs->table('kuaidi_order') . " where order_sn='" . $ko_order_sn . "'");
        }
        $sql = "select * from " . $ecs->table('kuaidi_order_status') . " where order_id='{$kos_order_id}'  order by status_id";
        $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='" . $order['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) {
            $result_content = $shipping_info;
        } else {
            $result_content = '抱歉,暂时还没有该运单的物流信息哦!';
        }
    }
    $smarty->assign('result_content', $result_content);
    /* 是否显示添加到购物车 */
    if ($order['extension_code'] != 'group_buy' && $order['extension_code'] != 'exchange_goods') {
        $smarty->assign('allow_to_cart', 1);
    }
    /* 订单商品 */
    $goods_list = order_goods($order_id);
    foreach ($goods_list as $key => $value) {
        $goods_list[$key]['market_price'] = price_format($value['market_price'], false);
        $goods_list[$key]['goods_price'] = price_format($value['goods_price'], false);
        $goods_list[$key]['subtotal'] = price_format($value['subtotal'], false);
        $sql_back = "SELECT bg.*, bo.back_type FROM " . $ecs->table('back_goods') . " AS bg " . " LEFT JOIN " . $ecs->table('back_order') . " AS bo " . " ON bg.back_id = bo.back_id " . " WHERE bo.order_id = " . $order_id . " AND bg.goods_id = " . $value['goods_id'] . " AND bg.product_id = " . $value['product_id'] . " AND bg.status_back < 6";
        $back_info = $db->getRow($sql_back);
        if (count($back_info['back_id']) > 0) {
            switch ($back_info['status_back']) {
                case '3':
                    $sb = "已完成";
                    break;
                case '5':
                    $sb = "已申请";
                    break;
                    // case '6' : $sb = ""; break;
                    // case '7' : $sb = ""; break;
                // case '6' : $sb = ""; break;
                // case '7' : $sb = ""; break;
                default:
                    $sb = "正在";
                    break;
            }
            switch ($back_info['back_type']) {
                case '1':
                    $bt = "退货";
                    break;
                case '3':
                    $bt = "申请维修";
                    break;
                case '4':
                    $bt = "退款";
                    break;
                default:
                    break;
            }
            $shouhou = $sb . " " . $bt;
        } else {
            $shouhou = "正常";
        }
        $goods_list[$key]['shouhou'] = $shouhou;
    }
    /* 设置能否修改使用余额数 */
    if ($order['order_amount'] > 0) {
        if ($order['order_status'] == OS_UNCONFIRMED || $order['order_status'] == OS_CONFIRMED) {
            $user = user_info($order['user_id']);
            if ($user['user_money'] + $user['credit_line'] > 0) {
                $smarty->assign('allow_edit_surplus', 1);
                $smarty->assign('max_surplus', sprintf($_LANG['max_surplus'], $user['user_money']));
            }
        }
    }
    /* 未发货,未付款时允许更换支付方式 */
    if ($order['order_amount'] > 0 && $order['pay_status'] == PS_UNPAYED && $order['shipping_status'] == SS_UNSHIPPED) {
        $payment_list = available_payment_list(false, 0, true);
        /* 过滤掉当前支付方式和余额支付方式 */
        if (is_array($payment_list)) {
            foreach ($payment_list as $key => $payment) {
                if ($payment['pay_id'] == $order['pay_id'] || $payment['pay_code'] == 'balance') {
                    unset($payment_list[$key]);
                }
            }
        }
        $smarty->assign('payment_list', $payment_list);
    }
    /* 订单 支付 配送 状态语言项 */
    $order['order_status'] = $_LANG['os'][$order['order_status']];
    $order['pay_status'] = $_LANG['ps'][$order['pay_status']];
    $order['shipping_status_id'] = $order['shipping_status'];
    // 代码增加 By
    // www.68ecshop.com
    $order['shipping_status'] = $_LANG['ss'][$order['shipping_status']];
    /* 增值税发票_添加_START_www.68ecshop.com */
    /* 增值税发票收票地址 */
    if ($order['inv_type'] == 'vat_invoice') {
        $order['inv_complete_address'] = get_inv_complete_address($order);
    }
    /* 发票金额 */
    $order['formatted_inv_money'] = price_format($order['inv_money']);
    /* 增值税发票_添加_END_www.68ecshop.com */
    $smarty->assign('order', $order);
    /* 代码增加_start By www.68ecshop.com */
    $smarty->assign('mobile_phone', $GLOBALS['db']->getOne("select mobile_phone from " . $GLOBALS['ecs']->table('users') . " where user_id='{$_SESSION['user_id']}'"));
    foreach ($goods_list as $goods_key => $goods_val) {
        $sql_goods = "select count(*) from " . $ecs->table('back_order') . " where order_id='{$order['order_id']}' and goods_id='{$goods_val['goods_id']}'";
        $back_order_count = $db->getOne($sql_goods);
        $goods_list[$goods_key]['back_can'] = $back_order_count ? '0' : '1';
        /* 代码增加_start By www.68ecshop.com _20150804 */
        if ($goods_val['extension_code'] == 'virtual_good') {
            $virtual_goods_card = $db->getAll("select gc.card_sn,gc.end_date,buy_date from " . $ecs->table('virtual_goods_card') . " as gc join (select order_id,order_sn from " . $ecs->table('order_info') . " where order_id='{$goods_val['order_id']}') as oi on gc.order_sn = oi.order_sn");
            foreach ($virtual_goods_card as $k => $v) {
                $virtual_goods_card[$k]['end_date'] = empty($v['end_date']) ? '' : local_date('Y-m-d', $v['end_date']);
                $virtual_goods_card[$k]['buy_date'] = empty($v['buy_date']) ? '' : local_date('Y-m-d', $v['buy_date']);
                $virtual_goods_card[$k]['end_date_time'] = empty($v['end_date']) ? '' : $v['end_date'];
                $virtual_goods_card[$k]['buy_date_time'] = empty($v['buy_date']) ? '' : $v['buy_date'];
            }
            $goods_list[$goods_key]['virtual_goods_card'] = $virtual_goods_card;
        }
        /* 代码增加_end By www.68ecshop.com _20150804 */
        $goods_list[$key]['shouhou'] = $shouhou;
    }
    /* 设置能否修改使用余额数 */
    if ($order['order_amount'] > 0) {
        if ($order['order_status'] == OS_UNCONFIRMED || $order['order_status'] == OS_CONFIRMED) {
            $user = user_info($order['user_id']);
            if ($user['user_money'] + $user['credit_line'] > 0) {
                $smarty->assign('allow_edit_surplus', 1);
                $smarty->assign('max_surplus', sprintf($_LANG['max_surplus'], $user['user_money']));
            }
        }
    }
    /* 未发货,未付款时允许更换支付方式 */
    if ($order['order_amount'] > 0 && $order['pay_status'] == PS_UNPAYED && $order['shipping_status'] == SS_UNSHIPPED) {
        $payment_list = available_payment_list(false, 0, true);
        /* 过滤掉当前支付方式和余额支付方式 */
        if (is_array($payment_list)) {
            foreach ($payment_list as $key => $payment) {
                if ($payment['pay_id'] == $order['pay_id'] || $payment['pay_code'] == 'balance') {
                    unset($payment_list[$key]);
                }
            }
        }
        $smarty->assign('payment_list', $payment_list);
    }
    /* 订单 支付 配送 状态语言项 */
    $order['order_status'] = $_LANG['os'][$order['order_status']];
    $order['pay_status'] = $_LANG['ps'][$order['pay_status']];
    $order['shipping_status_id'] = $order['shipping_status'];
    // 代码增加 By
    // www.68ecshop.com
    $order['shipping_status'] = $_LANG['ss'][$order['shipping_status']];
    /* 增值税发票_添加_START_www.68ecshop.com */
    /* 增值税发票收票地址 */
    if ($order['inv_type'] == 'vat_invoice') {
        $order['inv_complete_address'] = get_inv_complete_address($order);
    }
    /* 发票金额 */
    $order['formatted_inv_money'] = price_format($order['inv_money']);
    /* 增值税发票_添加_END_www.68ecshop.com */
    $smarty->assign('order', $order);
    /* 代码增加_start By www.68ecshop.com */
    foreach ($goods_list as $goods_key => $goods_val) {
        $sql_goods = "select count(*) from " . $ecs->table('back_order') . " where order_id='{$order['order_id']}' and goods_id='{$goods_val['goods_id']}'";
        $back_order_count = $db->getOne($sql_goods);
        $goods_list[$goods_key]['back_can'] = $back_order_count ? '0' : '1';
    }
    /* 代码增加_end By www.68ecshop.com */
    $smarty->assign('goods_list', $goods_list);
    $smarty->display('user_transaction.dwt');
}
Ejemplo n.º 5
0
/*
# ----------------------------------------------------------------------
# ORDER - EDIT: CONTROL
# ----------------------------------------------------------------------
*/
if(isset($_POST['btn-edit-order'])){
	
   /*
   # ----------------------------------------------------------------------
   # DEFINED VARIABLE
   # ----------------------------------------------------------------------
   */
   
   $set_fulfilment_date  = date("Y-m-d H:i:s");
   $get_order_id         = get_order_detail_by_number($order_number);
   $order_detail         = get_order_detail($get_order_id['order_id']);
   $order_item           = order_item($order_detail['order_id']);
   
   $data_header_method   = $_POST['order_payment_method'];
   $data_header_name     = escape_quote($_POST['order_confirm_name']);
   $data_header_amount   = clean_price($_POST['order_confirm_amount']);
   $data_purchase_amount = $_POST['hidden_total_purchase'];
   $data_shipping        = $_POST['hidden_order_shipping_amount'];
   $data_order_id        = $_POST['hidden_order_id'];
   $ship_address         = ltrim(escape_quote($_POST['order_shipping_address']));
   $ship_country         = $_POST['order_shipping_country'];
   $ship_province        = $_POST['order_shipping_province'];
   $ship_city            = $_POST['order_shipping_city'];
	
   /*
   # ----------------------------------------------------------------------
Ejemplo n.º 6
0
//  print_r($sql);exit;
$pager = get_pager('user.php', array('act' => $action), $record_count, $page, $page_parm['count']);
$orders = GZ_get_user_orders($user_id, $pager['size'], $pager['start'], $type);
// print_r($orders);exit;
foreach ($orders as $key => $value) {
    unset($orders[$key]['order_status']);
    $orders[$key]['order_time'] = formatTime($value['order_time']);
    $goods_list = GZ_order_goods($value['order_id']);
    //$orders[$key]['ss'] = $goods_list;
    $goods_list_t = array();
    // $goods_list = API_DATA("SIMPLEGOODS", $goods_list);
    foreach ($goods_list as $v) {
        $goods_list_t[] = array("goods_id" => $v['goods_id'], "name" => $v['goods_name'], "goods_number" => $v['goods_number'], "subtotal" => price_format($v['subtotal'], false), "formated_shop_price" => price_format($v['goods_price'], false), "img" => array('small' => API_DATA('PHOTO', $v['goods_thumb']), 'thumb' => API_DATA('PHOTO', $v['goods_img']), 'url' => API_DATA('PHOTO', $v['original_img'])));
    }
    $orders[$key]['goods_list'] = $goods_list_t;
    $order_detail = get_order_detail($value['order_id'], $user_id);
    $orders[$key]['formated_integral_money'] = $order_detail['formated_integral_money'];
    //积分 钱
    $orders[$key]['formated_bonus'] = $order_detail['formated_bonus'];
    //红包 钱
    $orders[$key]['formated_shipping_fee'] = $order_detail['formated_shipping_fee'];
    //运送费
    if ($order_detail['pay_id'] > 0) {
        $payment = payment_info($order_detail['pay_id']);
    }
    $subject = $orders[$key]['goods_list'][0]['name'] . '等' . count($orders[$key]['goods_list']) . '种商品';
    $orders[$key]['order_info'] = array('pay_code' => $payment['pay_code'], 'order_amount' => $order_detail['order_amount'], 'order_id' => $order_detail['order_id'], 'subject' => $subject, 'desc' => $subject, 'order_sn' => $order_detail['order_sn']);
}
// print_r($orders);exit;
$pagero = array("total" => $pager['record_count'], "count" => count($orders), "more" => empty($pager['page_next']) ? 0 : 1);
GZ_Api::outPut($orders, $pagero);
Ejemplo n.º 7
0
     $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('order_return'), $arr, 'UPDATE', "rec_id = '{$rec_id}'");
     return_action($ret_id, RF_COMPLETE, $back_order['refund_status'], RC_APPLY_SUCCESS, $action_note);
 } elseif ('canceled' == $operation) {
     /* 标记订单为“取消”,记录取消原因 */
     $cancel_note = isset($_REQUEST['cancel_note']) ? trim($_REQUEST['cancel_note']) : '';
     $arr = array('return_status' => RF_CANCELED, 'refund_status' => FF_NOREFUND, 'is_check' => RC_APPLY_FALSE, 'to_buyer' => $cancel_note, 'actual_return' => 0);
     $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('order_return'), $arr, 'UPDATE', "rec_id = '{$rec_id}'");
     /*更新log*/
     return_action($ret_id, RF_CANCELED, FF_NOREFUND, RC_APPLY_FALSE, $action_note);
 } elseif ('invalid' == $operation) {
     //TODO
 } elseif ('refund' == $operation) {
     include_once ROOT_PATH . 'includes/lib_transaction.php';
     /* 定义当前时间 */
     define('GMTIME_UTC', gmtime());
     // 获取 UTC 时间戳
     $order_goods = get_order_goods($order);
     //订单商品
     foreach ($order_goods['goods_list'] as $key => $value) {
         $array_rec_id[] = $value['rec_id'];
     }
     $aftermarket_list = return_order_info_byId($order_id);
     //退换货订单
     foreach ($aftermarket_list as $key => $value) {
         $array_rec_id1[] = $value['rec_id'];
     }
     $order_info = get_order_detail($order_id);
     if (!array_diff($array_rec_id, $array_rec_id1)) {
         //整单退换货
         $return_count = return_order_info_byId($order_id, 0);
     }
Ejemplo n.º 8
0
    $smarty->assign('shares', $shares);
    $smarty->assign('yhcwebsite', $yhcwebsite);
    $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';
    include_once ROOT_PATH . 'includes/upacp/common.php';
    include_once ROOT_PATH . 'includes/upacp/SDKConfig.php';
    include_once ROOT_PATH . 'includes/upacp/secureUtil.php';
    include_once ROOT_PATH . 'includes/upacp/log.class.php';
    include_once ROOT_PATH . 'includes/upacp/httpClient.php';
    $order_id = isset($_GET['order_id']) ? intval($_GET['order_id']) : 0;
    /* 订单详情 */
    $order = get_order_detail($order_id, $user_id, '07');
    if ($order === false) {
        $err->show($_LANG['back_home_lnk'], './');
        exit;
    }
    /* 是否显示添加到购物车 */
    if ($order['extension_code'] != 'group_buy' && $order['extension_code'] != 'exchange_goods') {
        $smarty->assign('allow_to_cart', 1);
    }
    /* 订单商品 */
    $goods_list = order_goods($order_id);
    foreach ($goods_list as $key => $value) {
        $goods_list[$key]['market_price'] = price_format($value['market_price'], false);
        $goods_list[$key]['goods_price'] = price_format($value['goods_price'], false);
        $goods_list[$key]['subtotal'] = price_format($value['subtotal'], false);
    }
Ejemplo n.º 9
0
Archivo: user.php Proyecto: qgz/ecshop
        $smarty->assign('orders', $orders);
    }
    $smarty->display('order_list.dwt');
    exit;
} elseif ($act == 'order_detail') {
    if (!$_SESSION['user_id']) {
        $smarty->display('login.dwt');
        exit;
    }
    $id = isset($_GET['order_id']) ? intval($_GET['order_id']) : 0;
    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 = get_order_detail($id, $_SESSION['user_id']);
    if ($order === false) {
        exit("对不起,该订单不存在");
    }
    require_once ROOT_PATH . 'languages/' . $_CFG['lang'] . '/user.php';
    /* 订单商品 */
    $goods_list = order_goods2($id);
    if (empty($goods_list)) {
        $tips = '<br><br>无效错误订单<br><br><a href=user.php?act=order_list class=red>返回我的订单</a>';
        $smarty->assign('tips', $tips);
        $smarty->display('order_done.dwt');
        exit;
    }
    foreach ($goods_list as $key => $value) {
        $goods_list[$key]['market_price'] = price_format($value['market_price'], false);
        $goods_list[$key]['goods_price'] = price_format($value['goods_price'], false);
Ejemplo n.º 10
0
function action_order_detail()
{
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $GLOBALS['user_id'];
    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';
    include_once ROOT_PATH . 'kuaidi/kuaidi.php';
    $order_id = isset($_GET['order_id']) ? intval($_GET['order_id']) : 0;
    /* 订单详情 */
    $order = get_order_detail($order_id, $user_id);
    if ($order === false) {
        $GLOBALS['err']->show($_LANG['back_home_lnk'], './');
        exit;
    }
    /* 是否显示添加到购物车 */
    if ($order['extension_code'] != 'group_buy' && $order['extension_code'] != 'exchange_goods') {
        $smarty->assign('allow_to_cart', 1);
    }
    /* 订单商品 */
    $goods_list = order_goods($order_id);
    foreach ($goods_list as $key => $value) {
        $goods_list[$key]['market_price'] = price_format($value['market_price'], false);
        $goods_list[$key]['goods_price'] = price_format($value['goods_price'], false);
        $goods_list[$key]['subtotal'] = price_format($value['subtotal'], false);
    }
    /* 设置能否修改使用余额数 */
    if ($order['order_amount'] > 0) {
        if ($order['order_status'] == OS_UNCONFIRMED || $order['order_status'] == OS_CONFIRMED) {
            $user = user_info($order['user_id']);
            if ($user['user_money'] + $user['credit_line'] > 0) {
                $smarty->assign('allow_edit_surplus', 1);
                $smarty->assign('max_surplus', sprintf($_LANG['max_surplus'], $user['user_money']));
            }
        }
    }
    /* 未发货,未付款时允许更换支付方式 */
    if ($order['order_amount'] > 0 && $order['pay_status'] == PS_UNPAYED && $order['shipping_status'] == SS_UNSHIPPED) {
        $payment_list = available_payment_list(false, 0, true);
        /* 过滤掉当前支付方式和余额支付方式 */
        if (is_array($payment_list)) {
            foreach ($payment_list as $key => $payment) {
                if ($payment['pay_id'] == $order['pay_id'] || $payment['pay_code'] == 'balance') {
                    unset($payment_list[$key]);
                }
            }
        }
        $smarty->assign('payment_list', $payment_list);
    }
    /* 订单 支付 配送 状态语言项 */
    $order['order_status'] = $_LANG['os'][$order['order_status']];
    $order['pay_status'] = $_LANG['ps'][$order['pay_status']];
    $order['shipping_status'] = $_LANG['ss'][$order['shipping_status']];
    //快递跟踪
    $kuaidi = new Express();
    $result = $kuaidi->getorder($order['shipping_name'], $order['invoice']);
    $smarty->assign('kuaidi', $result['data'][0]);
    $smarty->assign('order', $order);
    $smarty->assign('goods_list', $goods_list);
    $smarty->display('user_transaction.dwt');
}
Ejemplo n.º 11
0
            $user = array();
            $user['user_money'] = $user_info['user_money'] - $order['order_amount'];
            update_user($_SESSION['user_id'], $user);
            //修改白条消费记录支付状态
            $bt_log_sql = "update " . $ecs->table('baitiao_log') . " set is_repay=1,repayed_date=" . gmtime() . " where order_id='{$order['order_id']}'";
            $is_pay_bt = $db->query($bt_log_sql);
            if ($is_pay_bt) {
                show_message("支付成功");
            } else {
                show_message("支付失败");
            }
        }
    }
    $sql = "UPDATE " . $ecs->table('order_info') . " SET pay_id='{$pay_id}', pay_name='{$payment_info['pay_name']}', pay_fee='{$pay_fee}', order_amount='{$order_amount}'" . " WHERE order_id = '{$order_id}'";
    $db->query($sql);
    $order = get_order_detail($order_id, $user_id, true);
    $payment_list = available_payment_list(false, 0, true);
    $smarty->assign('order', $order);
    $smarty->assign('action', 'repay_bt');
    $smarty->assign('payment_list', $payment_list);
    $smarty->display('user_transaction.dwt');
} elseif ($action == 'bonus') {
    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('user_bonus') . " WHERE user_id = '{$user_id}'");
    $pager = get_pager('user.php', array('act' => $action), $record_count, $page);
    $bonus = get_user_bouns_list($user_id, $pager['size'], $pager['start']);
    $smarty->assign('pager', $pager);
    $smarty->assign('bonus', $bonus);
    $smarty->display('user_transaction.dwt');
} elseif ($action == 'group_buy') {
Ejemplo n.º 12
0
        echo $json->encode($msg);
        return;
    }
    $sql_replace = 'REPLACE INTO ' . $GLOBALS['ecs']->table('brush_order') . '(source_order_id,brush_order_sn,brusher_id,brush_platform)VALUES(' . "{$source_order_id},'{$brush_order_sn}',{$_SESSION['admin_id']},{$brush_platform})";
    if ($GLOBALS['db']->query($sql_replace)) {
        $msg['message'] = '刷单信息保存成功!系统将自动标记发货并过滤!';
        $msg['id'] = $source_order_id;
    } else {
        $msg['message'] = '刷单信息保存失败!请联系技术人员!';
    }
    echo $json->encode($msg);
    return;
} elseif ($_REQUEST['act'] == 'show_single_info') {
    $order_id = intval($_REQUEST['order_id']);
    $table = mysql_real_escape_string($_REQUEST['table']);
    $order_info = get_order_detail($order_id, $table);
    $sql_insert = 'INSERT INTO ' . $GLOBALS['ecs']->table('view_user_info') . '(order_id,admin_id)VALUES(' . "{$order_id},{$_SESSION['admin_id']})";
    $GLOBALS['db']->query($sql_insert);
    $msg = array('req_msg' => true, 'message' => "{$order_info['mobile']}<br>{$order_info['tel']}<br>{$order_info['province']}{$order_info['city']}{$order_info['district']}<br>{$order_info['address']}");
    echo $json->encode($msg);
    return;
} elseif ($_REQUEST['act'] == 'order_receipt') {
    if (!admin_priv('order_receipt', '', false)) {
        echo '对不起,您没有权限打印收据!';
        return;
    }
    $order_id = intval($_REQUEST['order_id']);
    $sql_select = 'SELECT g.goods_name,g.goods_price,g.goods_number,FROM_UNIXTIME(i.shipping_time, "%Y-%m-%d") shipping_date,' . 'i.final_amount,i.consignee FROM ' . $GLOBALS['ecs']->table('order_goods') . ' g, ' . $GLOBALS['ecs']->table('order_info') . " i WHERE i.order_id=g.order_id AND g.goods_price>0 AND g.is_gift<>1 AND i.shipping_status=1 AND i.order_id={$order_id}";
    $goods_list = $GLOBALS['db']->getAll($sql_select);
    if (empty($goods_list)) {
        echo '订单尚未发货,或商品列表为空,请查证后再打印收据!';
Ejemplo n.º 13
0
 public static function get_user_order_list()
 {
     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';
     global $db;
     global $ecs;
     $user_id = $_SESSION['user_id'];
     if (!$user_id) {
         return json_encode(array('code' => RES_FAIL, 'msg' => 'user_id not exsit'));
     }
     $orders = $db->getAll("SELECT * FROM " . $ecs->table('order_info') . " WHERE user_id = '{$user_id}' order by order_id DESC");
     $res = array();
     foreach ($orders as $v) {
         $order_id = $v['order_id'];
         $order_detail = $db->getAll("SELECT * FROM " . $ecs->table('order_goods') . " WHERE order_id = '{$order_id}'");
         $v['detail'] = $order_detail;
         $pay_online = get_order_detail($order_id, $user_id, true);
         $v['pay_online'] = $pay_online;
         array_push($res, $v);
     }
     return json_encode(array('code' => RES_SUCCSEE, 'orders' => $res));
 }
Ejemplo n.º 14
0
        break;
    case 'add_order':
        include_once __DIR__ . '/orders/add_order.php';
        $responseArray['response'] = add_order($values);
        $responseArray['status'] = 'success';
        $responseArray['message'] = 'Added order';
        break;
    case 'get_orders':
        include_once __DIR__ . '/orders/get_orders.php';
        $responseArray['response'] = get_orders($values);
        $responseArray['status'] = 'success';
        $responseArray['message'] = 'Orders successfully read';
        break;
    case 'get_order_detail':
        include_once __DIR__ . '/orders/get_orders.php';
        $responseArray['response'] = get_order_detail($values);
        $responseArray['status'] = 'success';
        $responseArray['message'] = 'Order details successfully read';
        break;
    case 'get_delivery_options':
        include_once __DIR__ . '/orders/get_delivery_options.php';
        $responseArray['status'] = 'success';
        $responseArray['message'] = 'This feature is not implemented, but always will return \'pickup\' for now';
        $responseArray['response'] = get_delivery_options($values);
        break;
    default:
        $responseArray['status'] = 'failure';
        $responseArray['message'] = "Unknown function: {$function}";
}
echo json_encode($responseArray);
exit;
Ejemplo n.º 15
0
Archivo: user.php Proyecto: qgz/ecshop
function get_user_articles($where, $page = 1, $size = 20)
{
    $sql = 'SELECT article_id,order_id,is_open, title, author, click, add_time, file_url, open_type, keywords, description' . ' FROM ' . $GLOBALS['ecs']->table('article') . ' WHERE 1 = 1 AND ' . $where . ' ORDER BY article_type DESC, article_id DESC';
    $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size);
    $arr = array();
    if ($res) {
        while ($row = $GLOBALS['db']->fetchRow($res)) {
            $article_id = $row['article_id'];
            $arr[$article_id]['id'] = $article_id;
            $arr[$article_id]['title'] = $row['title'];
            $arr[$article_id]['is_open'] = $row['is_open'];
            $arr[$article_id]['keywords'] = $row['keywords'];
            $arr[$article_id]['description'] = $row['description'];
            $arr[$article_id]['short_title'] = $GLOBALS['_CFG']['article_title_length'] > 0 ? sub_str($row['title'], $GLOBALS['_CFG']['article_title_length']) : $row['title'];
            $arr[$article_id]['author'] = empty($row['author']) || $row['author'] == '_SHOPHELP' ? $GLOBALS['_CFG']['shop_name'] : $row['author'];
            $arr[$article_id]['url'] = build_uri('article', array('aid' => $article_id), $row['title']);
            $arr[$article_id]['file_url'] = trim($row['file_url']);
            $arr[$article_id]['add_time'] = date($GLOBALS['_CFG']['date_format'], $row['add_time']);
            $arr[$article_id]['click'] = $row['click'];
            $arr[$article_id]['order_id'] = $row['order_id'];
            include_once ROOT_PATH . 'includes/lib_transaction.php';
            /* 订单详情 */
            $order_id = empty($row['order_id']) ? '0' : $row['order_id'];
            $order = get_order_detail($order_id, $user_id);
            $arr[$article_id]['order_sn'] = $order['order_sn'];
        }
    }
    return $arr;
}