}
 /* 取得用户信息 */
 $user = user_info($_SESSION['user_id']);
 /* 用户帐户余额是否足够 */
 if ($surplus > $user['user_money'] + $user['credit_line']) {
     $err->add($_LANG['error_surplus_not_enough']);
     $err->show($_LANG['order_detail'], 'user.php?act=order_detail&order_id=' . $order_id);
 }
 /* 修改订单,重新计算支付费用 */
 $order['surplus'] += $surplus;
 $order['order_amount'] -= $surplus;
 if ($order['order_amount'] > 0) {
     $cod_fee = 0;
     if ($order['shipping_id'] > 0) {
         $regions = array($order['country'], $order['province'], $order['city'], $order['district']);
         $shipping = shipping_area_info($order['shipping_id'], $regions);
         if ($shipping['support_cod'] == '1') {
             $cod_fee = $shipping['pay_fee'];
         }
     }
     $pay_fee = 0;
     if ($order['pay_id'] > 0) {
         $pay_fee = pay_fee($order['pay_id'], $order['order_amount'], $cod_fee);
     }
     $order['pay_fee'] = $pay_fee;
     $order['order_amount'] += $pay_fee;
 }
 /* 如果全部支付,设为已确认、已付款 */
 if ($order['order_amount'] == 0) {
     if ($order['order_status'] == OS_UNCONFIRMED) {
         $order['order_status'] = OS_CONFIRMED;
Exemple #2
0
function action_act_edit_surplus()
{
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $_SESSION['user_id'];
    /* 检查是否登录 */
    if ($_SESSION['user_id'] <= 0) {
        ecs_header("Location: ./\n");
        exit;
    }
    /* 检查订单号 */
    $order_id = intval($_POST['order_id']);
    if ($order_id <= 0) {
        ecs_header("Location: ./\n");
        exit;
    }
    /* 检查余额 */
    $surplus = floatval($_POST['surplus']);
    if ($surplus <= 0) {
        $err->add($_LANG['error_surplus_invalid']);
        $err->show($_LANG['order_detail'], 'user.php?act=order_detail&order_id=' . $order_id);
    }
    include_once ROOT_PATH . 'includes/lib_order.php';
    /* 取得订单 */
    $order = order_info($order_id);
    if (empty($order)) {
        ecs_header("Location: ./\n");
        exit;
    }
    /* 检查订单用户跟当前用户是否一致 */
    if ($_SESSION['user_id'] != $order['user_id']) {
        ecs_header("Location: ./\n");
        exit;
    }
    /* 检查订单是否未付款,检查应付款金额是否大于0 */
    if ($order['pay_status'] != PS_UNPAYED || $order['order_amount'] <= 0) {
        $err->add($_LANG['error_order_is_paid']);
        $err->show($_LANG['order_detail'], 'user.php?act=order_detail&order_id=' . $order_id);
    }
    /* 计算应付款金额(减去支付费用) */
    $order['order_amount'] -= $order['pay_fee'];
    /* 余额是否超过了应付款金额,改为应付款金额 */
    if ($surplus > $order['order_amount']) {
        $surplus = $order['order_amount'];
    }
    /* 取得用户信息 */
    $user = user_info($_SESSION['user_id']);
    /* 用户帐户余额是否足够 */
    if ($surplus > $user['user_money'] + $user['credit_line']) {
        $err->add($_LANG['error_surplus_not_enough']);
        $err->show($_LANG['order_detail'], 'user.php?act=order_detail&order_id=' . $order_id);
    }
    /* 修改订单,重新计算支付费用 */
    $order['surplus'] += $surplus;
    $order['order_amount'] -= $surplus;
    if ($order['order_amount'] > 0) {
        $cod_fee = 0;
        if ($order['shipping_id'] > 0) {
            $regions = array($order['country'], $order['province'], $order['city'], $order['district']);
            $shipping = shipping_area_info($order['shipping_id'], $regions);
            if ($shipping['support_cod'] == '1') {
                $cod_fee = $shipping['pay_fee'];
            }
        }
        $pay_fee = 0;
        if ($order['pay_id'] > 0) {
            $pay_fee = pay_fee($order['pay_id'], $order['order_amount'], $cod_fee);
        }
        $order['pay_fee'] = $pay_fee;
        $order['order_amount'] += $pay_fee;
    }
    /* 如果全部支付,设为已确认、已付款 */
    if ($order['order_amount'] == 0) {
        if ($order['order_status'] == OS_UNCONFIRMED) {
            $order['order_status'] = OS_CONFIRMED;
            $order['confirm_time'] = gmtime();
        }
        $order['pay_status'] = PS_PAYED;
        $order['pay_time'] = gmtime();
    }
    $order = addslashes_deep($order);
    update_order($order_id, $order);
    /* 更新用户余额 */
    $change_desc = sprintf($_LANG['pay_order_by_surplus'], $order['order_sn']);
    log_account_change($user['user_id'], -1 * $surplus, 0, 0, 0, $change_desc);
    /* 跳转 */
    ecs_header('Location: user.php?act=order_detail&order_id=' . $order_id . "\n");
    exit;
}
Exemple #3
0
/**
 * 合并订单
 * @param   string  $from_order_sn  从订单号
 * @param   string  $to_order_sn    主订单号
 * @return  成功返回true,失败返回错误信息
 */
function merge_order($from_order_sn, $to_order_sn)
{
    /* 订单号不能为空 */
    if (trim($from_order_sn) == '' || trim($to_order_sn) == '') {
        return $GLOBALS['_LANG']['order_sn_not_null'];
    }
    /* 订单号不能相同 */
    if ($from_order_sn == $to_order_sn) {
        return $GLOBALS['_LANG']['two_order_sn_same'];
    }
    /* 取得订单信息 */
    $from_order = order_info(0, $from_order_sn);
    $to_order = order_info(0, $to_order_sn);
    /* 检查订单是否存在 */
    if (!$from_order) {
        return sprintf($GLOBALS['_LANG']['order_not_exist'], $from_order_sn);
    } elseif (!$to_order) {
        return sprintf($GLOBALS['_LANG']['order_not_exist'], $to_order_sn);
    }
    /* 检查合并的订单是否为普通订单,非普通订单不允许合并 */
    if ($from_order['extension_code'] != '' || $to_order['extension_code'] != 0) {
        return $GLOBALS['_LANG']['merge_invalid_order'];
    }
    /* 检查订单状态是否是已确认或未确认、未付款、未发货 */
    if ($from_order['order_status'] != OS_UNCONFIRMED && $from_order['order_status'] != OS_CONFIRMED) {
        return sprintf($GLOBALS['_LANG']['os_not_unconfirmed_or_confirmed'], $from_order_sn);
    } elseif ($from_order['pay_status'] != PS_UNPAYED) {
        return sprintf($GLOBALS['_LANG']['ps_not_unpayed'], $from_order_sn);
    } elseif ($from_order['shipping_status'] != SS_UNSHIPPED) {
        return sprintf($GLOBALS['_LANG']['ss_not_unshipped'], $from_order_sn);
    }
    if ($to_order['order_status'] != OS_UNCONFIRMED && $to_order['order_status'] != OS_CONFIRMED) {
        return sprintf($GLOBALS['_LANG']['os_not_unconfirmed_or_confirmed'], $to_order_sn);
    } elseif ($to_order['pay_status'] != PS_UNPAYED) {
        return sprintf($GLOBALS['_LANG']['ps_not_unpayed'], $to_order_sn);
    } elseif ($to_order['shipping_status'] != SS_UNSHIPPED) {
        return sprintf($GLOBALS['_LANG']['ss_not_unshipped'], $to_order_sn);
    }
    /* 检查订单用户是否相同 */
    if ($from_order['user_id'] != $to_order['user_id']) {
        return $GLOBALS['_LANG']['order_user_not_same'];
    }
    /* 合并订单 */
    $order = $to_order;
    $order['order_id'] = '';
    $order['add_time'] = gmtime();
    // 合并商品总额
    $order['goods_amount'] += $from_order['goods_amount'];
    // 合并折扣
    $order['discount'] += $from_order['discount'];
    if ($order['shipping_id'] > 0) {
        // 重新计算配送费用
        $weight_price = order_weight_price($to_order['order_id']);
        $from_weight_price = order_weight_price($from_order['order_id']);
        $weight_price['weight'] += $from_weight_price['weight'];
        $weight_price['amount'] += $from_weight_price['amount'];
        $weight_price['number'] += $from_weight_price['number'];
        $region_id_list = array($order['country'], $order['province'], $order['city'], $order['district']);
        $shipping_area = shipping_area_info($order['shipping_id'], $region_id_list);
        $order['shipping_fee'] = shipping_fee($shipping_area['shipping_code'], unserialize($shipping_area['configure']), $weight_price['weight'], $weight_price['amount'], $weight_price['number']);
        // 如果保价了,重新计算保价费
        if ($order['insure_fee'] > 0) {
            $order['insure_fee'] = shipping_insure_fee($shipping_area['shipping_code'], $order['goods_amount'], $shipping_area['insure']);
        }
    }
    // 重新计算包装费、贺卡费
    if ($order['pack_id'] > 0) {
        $pack = pack_info($order['pack_id']);
        $order['pack_fee'] = $pack['free_money'] > $order['goods_amount'] ? $pack['pack_fee'] : 0;
    }
    if ($order['card_id'] > 0) {
        $card = card_info($order['card_id']);
        $order['card_fee'] = $card['free_money'] > $order['goods_amount'] ? $card['card_fee'] : 0;
    }
    // 红包不变,合并积分、余额、已付款金额
    $order['integral'] += $from_order['integral'];
    $order['integral_money'] = value_of_integral($order['integral']);
    $order['surplus'] += $from_order['surplus'];
    $order['money_paid'] += $from_order['money_paid'];
    // 计算应付款金额(不包括支付费用)
    $order['order_amount'] = $order['goods_amount'] - $order['discount'] + $order['shipping_fee'] + $order['insure_fee'] + $order['pack_fee'] + $order['card_fee'] - $order['bonus'] - $order['integral_money'] - $order['surplus'] - $order['money_paid'];
    // 重新计算支付费
    if ($order['pay_id'] > 0) {
        // 货到付款手续费
        $cod_fee = $shipping_area ? $shipping_area['pay_fee'] : 0;
        $order['pay_fee'] = pay_fee($order['pay_id'], $order['order_amount'], $cod_fee);
        // 应付款金额加上支付费
        $order['order_amount'] += $order['pay_fee'];
    }
    /* 插入订单表 */
    do {
        $order['order_sn'] = get_order_sn();
        if ($GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('order_info'), addslashes_deep($order), 'INSERT')) {
            break;
        } else {
            if ($GLOBALS['db']->errno() != 1062) {
                die($GLOBALS['db']->errorMsg());
            }
        }
    } while (true);
    // 防止订单号重复
    /* 订单号 */
    $order_id = $GLOBALS['db']->insert_id();
    /* 更新订单商品 */
    $sql = 'UPDATE ' . $GLOBALS['ecs']->table('order_goods') . " SET order_id = '{$order_id}' " . "WHERE order_id " . db_create_in(array($from_order['order_id'], $to_order['order_id']));
    $GLOBALS['db']->query($sql);
    include_once ROOT_PATH . 'includes/lib_clips.php';
    /* 插入支付日志 */
    insert_pay_log($order_id, $order['order_amount'], PAY_ORDER);
    /* 删除原订单 */
    $sql = 'DELETE FROM ' . $GLOBALS['ecs']->table('order_info') . " WHERE order_id " . db_create_in(array($from_order['order_id'], $to_order['order_id']));
    $GLOBALS['db']->query($sql);
    /* 删除原订单支付日志 */
    $sql = 'DELETE FROM ' . $GLOBALS['ecs']->table('pay_log') . " WHERE order_id " . db_create_in(array($from_order['order_id'], $to_order['order_id']));
    $GLOBALS['db']->query($sql);
    /* 返还 from_order 的红包,因为只使用 to_order 的红包 */
    if ($from_order['bonus_id'] > 0) {
        unuse_bonus($from_order['bonus_id']);
    }
    /* 返回成功 */
    return true;
}
Exemple #4
0
     $shipping_list = available_shipping_list($region_id_list);
     /* 取得配送费用 */
     $total = order_weight_price($order_id);
     foreach ($shipping_list as $key => $shipping) {
         $shipping_fee = shipping_fee($shipping['shipping_code'], unserialize($shipping['configure']), $total['weight'], $total['amount'], $total['number']);
         $shipping_list[$key]['shipping_fee'] = $shipping_fee;
         $shipping_list[$key]['format_shipping_fee'] = price_format($shipping_fee);
         $shipping_list[$key]['free_money'] = price_format($shipping['configure']['free_money']);
     }
     $smarty->assign('shipping_list', $shipping_list);
 } elseif ('payment' == $step) {
     /* 取得可用的支付方式列表 */
     if (exist_real_goods($order_id)) {
         /* 存在实体商品 */
         $region_id_list = array($order['country'], $order['province'], $order['city'], $order['district']);
         $shipping_area = shipping_area_info($order['shipping_id'], $region_id_list);
         $pay_fee = $shipping_area['support_cod'] == 1 ? $shipping_area['pay_fee'] : 0;
         $payment_list = available_payment_list($shipping_area['support_cod'], $pay_fee);
     } else {
         /* 不存在实体商品 */
         $payment_list = available_payment_list(false);
     }
     /* 过滤掉使用余额支付 */
     foreach ($payment_list as $key => $payment) {
         if ($payment['pay_code'] == 'balance') {
             unset($payment_list[$key]);
         }
     }
     $smarty->assign('payment_list', $payment_list);
 } elseif ('other' == $step) {
     /* 查询是否存在实体商品 */
Exemple #5
0
	public function checkout () {
		global $ecs,$db,$_CFG;
		/*------------------------------------------------------ */
	    //-- 订单确认
	    /*------------------------------------------------------ */
	
	    #取得购物类型
	    $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS;
		
		/*
	    #团购标志
	    if ($flow_type == CART_GROUP_BUY_GOODS)
	    {
	        $smarty->assign('is_group_buy', 1);
	    }
	    #积分兑换商品
	    elseif ($flow_type == CART_EXCHANGE_GOODS)
	    {
	        $smarty->assign('is_exchange_goods', 1);
	    }
	    else
	    {
		*/
		#正常购物流程  清空其他购物流程情况
		$_SESSION['flow_order']['extension_code'] = '';
		/*}*/
	
	    /* 检查购物车中是否有商品 */
	    $sql = "SELECT COUNT(*) FROM " . $ecs->table('cart') ." WHERE session_id = '" . SESS_ID . "' " .
	           "AND parent_id = 0 AND is_gift = 0 AND rec_type = '$flow_type'";
	
	    if ($db->getOne($sql) == 0)
	    {
			$msg = rpcLang('flow.php', 'no_goods_in_cart');
			jsonExit("{\"status\":\"$msg\"}");
	    }
	
	    /*
	     * 检查用户是否已经登录
	     * 如果用户已经登录了则检查是否有默认的收货地址
	     * 如果没有登录则跳转到登录和注册页面
	     */
	    if (empty($_SESSION['direct_shopping']) && $_SESSION['user_id'] == 0)
	    {
			$msg = rpcLang('user.php', 'nologin');
			jsonExit("{\"status\":\"$msg\"}");
	    }
	
	    $consignee = get_consignee($_SESSION['user_id']);
	
	    #检查收货人信息是否完整
	    if (!check_consignee_info($consignee, $flow_type))
	    {
			$msg = rpcLang('flow.php', 'user_address_not_full');
			jsonExit("{\"status\":\"$msg\"}");
	    }
	
	    //$_SESSION['flow_consignee'] = $consignee;
	    
	    #对商品信息赋值
	    $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计
	
		/*
	    $smarty->assign('goods_list', $cart_goods);
	    #对是否允许修改购物车赋值
	    if ($flow_type != CART_GENERAL_GOODS || $_CFG['one_step_buy'] == '1')
	    {
	        $smarty->assign('allow_edit_cart', 0);
	    }
	    else
	    {
	        $smarty->assign('allow_edit_cart', 1);
	    }
	    
	    #取得购物流程设置
	    $smarty->assign('config', $_CFG);
		*/
	
	    /*
	     * 取得订单信息
	     */
	    $order = flow_order_info();
	
	    /* 计算折扣 */
	    if ($flow_type != CART_EXCHANGE_GOODS && $flow_type != CART_GROUP_BUY_GOODS)
	    {
	        $discount = compute_discount();
			
	    }
	
	    /*
	     * 计算订单的费用
	     */
	    $total = order_fee($order, $cart_goods, $consignee);
		
	    #取得配送列表
	    $region            = array($consignee['country'], $consignee['province'], $consignee['city'], $consignee['district']);
		#快递方式集合
		$shipping_list     = available_shipping_list($region);
		#购物车重量
	    $cart_weight_price = cart_weight_price($flow_type);
	    $insure_disabled   = true;
	    $cod_disabled      = true;
	
	    #查看购物车中是否全为免运费商品,若是则把运费赋为零s
	    $sql = 'SELECT count(*) FROM ' . $ecs->table('cart') . " WHERE `session_id` = '" . SESS_ID. "' AND `extension_code` != 'package_buy' AND `is_shipping` = 0";
	    $shipping_count = $db->getOne($sql);
	    foreach ($shipping_list AS $key => $val)
	    {
	        $shipping_cfg = unserialize_config($val['configure']);
	        $shipping_fee = ($shipping_count == 0 AND $cart_weight_price['free_shipping'] == 1) ? 0 : shipping_fee($val['shipping_code'], unserialize($val['configure']),
	        $cart_weight_price['weight'], $cart_weight_price['amount'], $cart_weight_price['number']);
	
	        $shipping_list[$key]['format_shipping_fee'] = price_format($shipping_fee, false);
	        $shipping_list[$key]['shipping_fee']        = $shipping_fee;
	        $shipping_list[$key]['free_money']          = price_format($shipping_cfg['free_money'], false);
	        $shipping_list[$key]['insure_formated']     = strpos($val['insure'], '%') === false ?
	        price_format($val['insure'], false) : $val['insure'];
	
	        #当前的配送方式是否支持保价
	        if ($val['shipping_id'] == $order['shipping_id'])
	        {
	            $insure_disabled = ($val['insure'] == 0);
	            $cod_disabled    = ($val['support_cod'] == 0);
	        }
	    }
		#取得支付列表
	    if ($order['shipping_id'] == 0)
	    {
	        $cod        = true;
	        $cod_fee    = 0;
	    }
	    else
	    {
	        $shipping = shipping_info($order['shipping_id']);
	        $cod = $shipping['support_cod'];
	
	        if ($cod)
	        {
	            #如果是团购,且保证金大于0,不能使用货到付款
	            if ($flow_type == CART_GROUP_BUY_GOODS)
	            {
	                $group_buy_id = $_SESSION['extension_id'];
	                if ($group_buy_id <= 0)
	                {
	                    show_message('error group_buy_id');
	                }
	                $group_buy = group_buy_info($group_buy_id);
	                if (empty($group_buy))
	                {
	                    show_message('group buy not exists: ' . $group_buy_id);
	                }
	
	                if ($group_buy['deposit'] > 0)
	                {
	                    $cod = false;
	                    $cod_fee = 0;
	
	                    #赋值保证金
	                    $smarty->assign('gb_deposit', $group_buy['deposit']);
	                }
	            }
	
	            if ($cod)
	            {
	                $shipping_area_info = shipping_area_info($order['shipping_id'], $region);
	                $cod_fee            = $shipping_area_info['pay_fee'];
	            }
	        }
	        else
	        {
	            $cod_fee = 0;
	        }
	    }
	    
	
	    # 给货到付款的手续费加<span id>,以便改变配送的时候动态显示
	    $payment_list = available_payment_list(1, $cod_fee);
	    if(isset($payment_list))
	    {
	        foreach ($payment_list as $key => $payment)
	        {
	            if ($payment['is_cod'] == '1')
	            {
	                $payment_list[$key]['format_pay_fee'] = '<span id="ECS_CODFEE">' . $payment['format_pay_fee'] . '</span>';
	            }
	            #如果有易宝神州行支付 如果订单金额大于300 则不显示
	            if ($payment['pay_code'] == 'yeepayszx' && $total['amount'] > 300)
	            {
	                unset($payment_list[$key]);
	            }
	            #如果有余额支付
	            if ($payment['pay_code'] == 'balance')
	            {
	                #如果未登录,不显示
	                if ($_SESSION['user_id'] == 0)
	                {
	                    unset($payment_list[$key]);
	                }
	                else
	                {
	                    if ($_SESSION['flow_order']['pay_id'] == $payment['pay_id'])
	                    {
	                        $smarty->assign('disable_surplus', 1);
	                    }
	                }
	            }
	        }
	    }
	
		$pack_list = array();
		$card_list = array();
	    /* 取得包装与贺卡 */
	    if ($total['real_goods_count'] > 0)
	    {
	        #只有有实体商品,才要判断包装和贺卡
	        if (!isset($_CFG['use_package']) || $_CFG['use_package'] == '1')
	        {
				#如果使用包装,取得包装列表及用户选择的包装
				$pack_list = pack_list();
	        }
	
	        #如果使用贺卡,取得贺卡列表及用户选择的贺卡
	        if (!isset($_CFG['use_card']) || $_CFG['use_card'] == '1')
	        {
				$card_list = card_list();
			}
	    }
	
	    /* 
		$user_info = user_info($_SESSION['user_id']);
		#如果使用余额,取得用户余额
	    if ((!isset($_CFG['use_surplus']) || $_CFG['use_surplus'] == '1') && $_SESSION['user_id'] > 0  && $user_info['user_money'] > 0)
	    {
	        // 能使用余额
	        $smarty->assign('allow_use_surplus', 1);
	        $smarty->assign('your_surplus', $user_info['user_money']);
	    }
		
		#如果使用积分,取得用户可用积分及本订单最多可以使用的积分
	    if ((!isset($_CFG['use_integral']) || $_CFG['use_integral'] == '1')
	        && $_SESSION['user_id'] > 0
	        && $user_info['pay_points'] > 0
	        && ($flow_type != CART_GROUP_BUY_GOODS && $flow_type != CART_EXCHANGE_GOODS))
	    {
	        // 能使用积分
	        $smarty->assign('allow_use_integral', 1);
	        $smarty->assign('order_max_integral', flow_available_points());  // 可用积分
	        $smarty->assign('your_integral',      $user_info['pay_points']); // 用户积分
	    }*/
		
	    #如果使用红包,取得用户可以使用的红包及用户选择的红包
	    if ((!isset($_CFG['use_bonus']) || $_CFG['use_bonus'] == '1') && ($flow_type != CART_GROUP_BUY_GOODS && $flow_type != CART_EXCHANGE_GOODS))
	    {
	        #取得用户可用红包
	        $user_bonus = zy_user_bonus($_SESSION['user_id'], $total['goods_price']);
	        if (!empty($user_bonus))
	        {
	            foreach ($user_bonus AS $key => $val)
	            {
	                $user_bonus[$key]['bonus_money_formated'] = price_format($val['type_money'], false);
	            }
	        }
	        #能使用红包
	        //$smarty->assign('allow_use_bonus', 1);
	    }
		/*
	    # 如果使用缺货处理,取得缺货处理列表
	    if (!isset($_CFG['use_how_oos']) || $_CFG['use_how_oos'] == '1')
	    {
	        if (is_array($GLOBALS['_LANG']['oos']) && !empty($GLOBALS['_LANG']['oos']))
	        {
	            $smarty->assign('how_oos_list', $GLOBALS['_LANG']['oos']);
	        }
	    }*/
		
	    #如果能开发票,取得发票内容列表
	    if ((!isset($_CFG['can_invoice']) || $_CFG['can_invoice'] == '1')	&& isset($_CFG['invoice_content']) 
			&& trim($_CFG['invoice_content']) != '' && $flow_type != CART_EXCHANGE_GOODS)
	    {
	        $inv_content_list = explode("\n", str_replace("\r", '', $_CFG['invoice_content']));
	       
	        $inv_type_list = array();
	        foreach ($_CFG['invoice_type']['type'] as $key => $type)
	        {
	            if (!empty($type))
	            {
	                $inv_type_list[$type] = $type . ' [' . floatval($_CFG['invoice_type']['rate'][$key]) . '%]';
	            }
	        }
	        $inv_content_list = implode(",", $inv_content_list);
	        $inv_list = array ('inv_content_list'=>$inv_content_list,'inv_type_list'=>$inv_type_list);
	       
	    }
		
	
	    #保存session
	    $_SESSION['flow_order'] = $order;
	   /* $pay_code = rpcLang('flow.php', 'pay_code_name');
		foreach ($payment_list as $value) {
			
			foreach ($value as $k=>$v){
				
			    if (strpos($v, $pay_code) !== false) {
			        $payment_list = $value;
			        $payment_list = preg_replace('/<.*?>|\[.*?\]/', '', $payment_list);
	    			$payment_list = array($payment_list);
			    }
			}
		}*/
	   
		$checkout_order = array('cart_goods'=>$cart_goods,
								'total'=>$total,
								'pack_list'=>$pack_list,
								'card_list'=>$card_list,
								'shipping_list'=>$shipping_list,
								'payment_list'=>$payment_list,
								'inv_list'=>$inv_list,
								'consignee'=>$consignee,);
		if (!empty($user_bonus)) {
	    	$checkout_order ['user_bonus'] = $user_bonus;
	    }
	  // print_r($checkout_order);die;
		jsonExit($checkout_order);
	}
Exemple #6
0
$shipping_id = $db->getOne($sql);
/* ajax获取运费 */
if ($action == 'get_shipping_fee') {
    require ROOT_PATH . 'includes/cls_json.php';
    $region = array();
    $json = new JSON();
    $result = array('error' => 0, 'message' => '', 'content' => '');
    $_POST['goods'] = strip_tags(urldecode($_POST['goods']));
    $_POST['goods'] = json_str_iconv($_POST['goods']);
    $goods = $json->decode($_POST['goods']);
    $region['country'] = $goods->country;
    $region['province'] = $goods->province;
    $region['city'] = $goods->city;
    $region['district'] = $goods->district;
    $goods_weight = $goods->goods_weight;
    $shipping_info = shipping_area_info($shipping_id, $region);
    $shipping_fee = shipping_fee($shipping_info['shipping_code'], $shipping_info['configure'], $goods_weight, '0', '0');
    $result['content'] = $shipping_fee;
    die($json->encode($result));
}
/* ajax获取运单状态 */
if ($action == 'get_OrderStatus') {
    require ROOT_PATH . 'includes/cls_json.php';
    require ROOT_PATH . 'includes/cls_captcha.php';
    $json = new JSON();
    $result = array('error' => 0, 'message' => '', 'content' => '');
    $_POST['order'] = strip_tags(urldecode($_POST['order']));
    $_POST['order'] = json_str_iconv($_POST['order']);
    $order = $json->decode($_POST['order']);
    $validator = new captcha();
    if (!$validator->check_word($order->captcha)) {