Exemple #1
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');
}
Exemple #2
0
        }
    }
    $res[$i]['pay_time'] = local_date($GLOBALS['_CFG']['time_format'], $res['pay_time']);
    //支付时间
    if ($res[$i]['pay_status'] == 0) {
        $res[$i]['pay_status'] = "未付款";
    } else {
        if ($res[$i]['pay_status'] == 1) {
            $res[$i]['pay_status'] = "付款中";
        } else {
            if ($res[$i]['pay_status'] == 2) {
                $res[$i]['pay_status'] = "已付款";
            }
        }
    }
    $res[$i]['inv_complete_address'] = get_inv_complete_address($res[$i]);
    $aa = $res[$i]['order_id'];
    $sql = "SELECT g.goods_thumb,s.* FROM " . $ecs->table('order_goods') . "as s," . $ecs->table('goods') . " as g WHERE s.order_id='{$aa}' AND s.goods_id=g.goods_id";
    $res[$i]['xiang'] = $db->getAll($sql);
    if ($res[$i]['xiang']) {
        $count_money = $res[$i]['xiang'];
        for ($j = 0; $j < count($count_money); $j++) {
            $res[$i]['count_goods_amount'] += $count_money[$j]['goods_number'] * $count_money[$j]['goods_price'];
        }
    }
    $res[$i]['count_amount'] = $res[$i]['count_goods_amount'] + $res[$i]['shipping_fee'] + $res[$i]['insure_fee'] + $res[$i]['pay_fee'] + $res[$i]['pack_fee'] + $res[$i]['card_fee'] + $res[$i]['tax'] - ($res[$i]['discount'] + $res[$i]['bonus'] + $res[$i]['integral_money']);
}
//$result['orderInfo']=$res;
$sql = "SELECT g.goods_thumb,s.* FROM " . $ecs->table('order_goods') . "as s," . $ecs->table('goods') . " as g WHERE s.order_id='{$order_id}' AND s.goods_id=g.goods_id";
$resa = $db->getAll($sql);
$smarty->assign('order_info', $res);
Exemple #3
0
function format_invoice_rows($rows)
{
    if (is_array($rows) && count($rows) > 0) {
        $_LANG['provided'] = '已开票';
        $_LANG['unprovided'] = '未开票';
        $_LANG['normal_invoice'] = '普通发票';
        $_LANG['vat_invoice'] = '增值税发票';
        $temp = array();
        foreach ($rows as $key => $value) {
            $value['add_time'] = local_date('Y-m-d H:i', $value['add_time']);
            $value['inv_status'] = $_LANG[$value['inv_status']];
            $value['inv_consignee_address'] = get_inv_complete_address($value);
            $value['inv_type'] = $_LANG[$value['inv_type']];
            $value['inv_money'] = price_format($value['inv_money']);
            unset($value['order_id']);
            $temp[$key] = $value;
        }
        return $temp;
    } else {
        return array();
    }
}
Exemple #4
0
                }
                $smarty->assign('available_bonus', $user_bonus1);
            }
        }
    } elseif ('invoice' == $step) {
        /*增值税发票_更改_START_www.68ecshop.com*/
        $order['order_time'] = local_date($_CFG['time_format'], $order['add_time']);
        if (!empty($_REQUEST['step_detail'])) {
            $smarty->assign('step_detail', $_REQUEST['step_detail']);
            if ($_REQUEST['step_detail'] == 'edit') {
                $smarty->assign('ur_here', $_LANG['edit_invoice']);
                $order['inv_consignee_regions'] = get_inv_consignee_regions($order);
            } elseif ($_REQUEST['step_detail'] == 'info') {
                $action_link = array('text' => '发票列表', 'href' => 'order.php?act=invoice_list&uselastfilter=1');
                $smarty->assign('action_link', $action_link);
                $order['inv_complete_address'] = get_inv_complete_address($order);
                $order['formatted_inv_money'] = price_format($order['inv_money']);
                $smarty->assign('ur_here', $_LANG['check_invoice']);
            }
            $_CFG['invoice_content'] = explode("\n", str_replace("\r", '', $_CFG['invoice_content']));
        }
        $smarty->assign('cfg', $_CFG);
        $smarty->assign('order', $order);
        /*增值税发票_更改_END_www.68ecshop.com*/
    }
    /* 显示模板 */
    assign_query_info();
    $smarty->display('order_step.htm');
} elseif ($_REQUEST['act'] == 'process') {
    /* 取得参数 func */
    $func = isset($_GET['func']) ? $_GET['func'] : '';