• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP bonus_info函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中bonus_info函数的典型用法代码示例。如果您正苦于以下问题:PHP bonus_info函数的具体用法?PHP bonus_info怎么用?PHP bonus_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了bonus_info函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: elseif

     }
 } elseif ('money' == $step) {
     /* 查询是否存在实体商品 */
     $exist_real_goods = exist_real_goods($order_id);
     $smarty->assign('exist_real_goods', $exist_real_goods);
     /* 取得用户信息 */
     if ($order['user_id'] > 0) {
         $user = user_info($order['user_id']);
         /* 计算可用余额 */
         $smarty->assign('available_user_money', $order['surplus'] + $user['user_money']);
         /* 计算可用积分 */
         $smarty->assign('available_pay_points', $order['integral'] + $user['pay_points']);
         /* 取得用户可用红包 */
         $user_bonus = user_bonus($order['user_id'], $order['goods_amount']);
         if ($order['bonus_id'] > 0) {
             $bonus = bonus_info($order['bonus_id']);
             $user_bonus[] = $bonus;
         }
         $smarty->assign('available_bonus', $user_bonus);
     }
 } elseif ('invoice' == $step) {
     /* 如果不存在实体商品 */
     if (!exist_real_goods($order_id)) {
         die('Hacking Attemp');
     }
     /* 取得可用的配送方式列表 */
     $region_id_list = array($order['country'], $order['province'], $order['city'], $order['district']);
     $shipping_list = available_shipping_list($region_id_list);
     //        /* 取得配送费用 */
     //        $total = order_weight_price($order_id);
     //        foreach ($shipping_list AS $key => $shipping)
开发者ID:norain2050,项目名称:benhu,代码行数:31,代码来源:order.php


示例2: order_fee

/**
 * 获得订单中的费用信息
 *
 * @access  public
 * @param   array   $order
 * @param   array   $goods
 * @param   array   $consignee
 * @param   bool    $is_gb_deposit  是否团购保证金(如果是,应付款金额只计算商品总额和支付费用,可以获得的积分取 $gift_integral)
 * @return  array
 */
function order_fee($order, $goods, $consignee)
{
    /* 初始化订单的扩展code */
    if (!isset($order['extension_code'])) {
        $order['extension_code'] = '';
    }
    if ($order['extension_code'] == 'group_buy') {
        $group_buy = group_buy_info($order['extension_id']);
    }
    $total = array('real_goods_count' => 0, 'gift_amount' => 0, 'goods_price' => 0, 'market_price' => 0, 'discount' => 0, 'pack_fee' => 0, 'card_fee' => 0, 'shipping_fee' => 0, 'shipping_insure' => 0, 'integral_money' => 0, 'bonus' => 0, 'surplus' => 0, 'cod_fee' => 0, 'pay_fee' => 0, 'tax' => 0);
    $weight = 0;
    /* 商品总价 */
    foreach ($goods as $val) {
        /* 统计实体商品的个数 */
        if ($val['is_real']) {
            $total['real_goods_count']++;
        }
        $total['goods_price'] += $val['goods_price'] * $val['goods_number'];
        $total['market_price'] += $val['market_price'] * $val['goods_number'];
    }
    $total['saving'] = $total['market_price'] - $total['goods_price'];
    $total['save_rate'] = $total['market_price'] ? round($total['saving'] * 100 / $total['market_price']) . '%' : 0;
    $total['goods_price_formated'] = price_format($total['goods_price'], false);
    $total['market_price_formated'] = price_format($total['market_price'], false);
    $total['saving_formated'] = price_format($total['saving'], false);
    /* 折扣 */
    if ($order['extension_code'] != 'group_buy') {
        $discount = compute_discount();
        $total['discount'] = $discount['discount'];
        if ($total['discount'] > $total['goods_price']) {
            $total['discount'] = $total['goods_price'];
        }
    }
    $total['discount_formated'] = price_format($total['discount'], false);
    /* 税额 */
    if (!empty($order['need_inv']) && $order['inv_type'] != '') {
        /* 查税率 */
        $rate = 0;
        foreach ($GLOBALS['_CFG']['invoice_type']['type'] as $key => $type) {
            if ($type == $order['inv_type']) {
                $rate = floatval($GLOBALS['_CFG']['invoice_type']['rate'][$key]) / 100;
                break;
            }
        }
        if ($rate > 0) {
            $total['tax'] = $rate * $total['goods_price'];
        }
    }
    $total['tax_formated'] = price_format($total['tax'], false);
    /* 包装费用 */
    if (!empty($order['pack_id'])) {
        $total['pack_fee'] = pack_fee($order['pack_id'], $total['goods_price']);
    }
    $total['pack_fee_formated'] = price_format($total['pack_fee'], false);
    /* 贺卡费用 */
    if (!empty($order['card_id'])) {
        $total['card_fee'] = card_fee($order['card_id'], $total['goods_price']);
    }
    $total['card_fee_formated'] = price_format($total['card_fee'], false);
    /* 红包 */
    if (!empty($order['bonus_id'])) {
        $bonus = bonus_info($order['bonus_id']);
        $total['bonus'] = $bonus['type_money'];
    }
    $total['bonus_formated'] = price_format($total['bonus'], false);
    /* 线下红包 */
    if (!empty($order['bonus_kill'])) {
        $bonus = bonus_info(0, $order['bonus_kill']);
        $total['bonus_kill'] = $order['bonus_kill'];
        $total['bonus_kill_formated'] = price_format($total['bonus_kill'], false);
    }
    /* 配送费用 */
    $shipping_cod_fee = NULL;
    if ($order['shipping_id'] > 0 && $total['real_goods_count'] > 0) {
        $region['country'] = $consignee['country'];
        $region['province'] = $consignee['province'];
        //$region['city']     = $consignee['city'];
        //$region['district'] = $consignee['district'];
        $shipping_info = shipping_area_info($order['shipping_id'], $region);
        if (!empty($shipping_info)) {
            if ($order['extension_code'] == 'group_buy') {
                $weight_price = cart_weight_price(CART_GROUP_BUY_GOODS);
            } else {
                $weight_price = cart_weight_price();
            }
            // 查看购物车中是否有免运费商品,若是则把运费赋为零 add by 2014-09-15 20:30*/
            //原来的是要全部商品都是免运费的才免运费:$sql = 'SELECT count(*) FROM ' . $ecs->table('cart') . " WHERE `session_id` = '" . SESS_ID. "' AND `extension_code` != 'package_buy' AND `is_shipping` = 0";
            $sql = 'SELECT count(*) FROM ' . $GLOBALS['ecs']->table('cart') . " WHERE `session_id` = '" . SESS_ID . "' AND `extension_code` != 'package_buy' AND `is_shipping` = 1";
            $shipping_count = $GLOBALS['db']->getOne($sql);
            //获取运费
//.........这里部分代码省略.........
开发者ID:dlpc,项目名称:ecshop,代码行数:101,代码来源:lib_order.php


示例3: intval

 $order['money_paid'] = $old_order['money_paid'];
 $order['surplus'] = 0;
 //$order['integral']      = 0;
 $order['integral'] = intval($_POST['integral']) >= 0 ? intval($_POST['integral']) : 0;
 $order['integral_money'] = 0;
 $order['bonus_id'] = 0;
 $order['bonus'] = 0;
 /* 计算待付款金额 */
 $order['order_amount'] = $order['goods_amount'] - $order['discount'] + $order['tax'] + $order['shipping_fee'] + $order['insure_fee'] + $order['pay_fee'] + $order['pack_fee'] + $order['card_fee'] - $order['money_paid'];
 if ($order['order_amount'] > 0) {
     if ($old_order['user_id'] > 0) {
         /* 如果选择了红包,先使用红包支付 */
         if ($_POST['bonus_id'] > 0) {
             /* todo 检查红包是否可用 */
             $order['bonus_id'] = $_POST['bonus_id'];
             $bonus = bonus_info($_POST['bonus_id']);
             $order['bonus'] = $bonus['type_money'];
             $order['order_amount'] -= $order['bonus'];
         }
         /* 使用红包之后待付款金额仍大于0 */
         if ($order['order_amount'] > 0) {
             if ($old_order['extension_code'] != 'exchange_goods') {
                 /* 如果设置了积分,再使用积分支付 */
                 if (isset($_POST['integral']) && intval($_POST['integral']) > 0) {
                     /* 检查积分是否足够 */
                     $order['integral'] = intval($_POST['integral']);
                     $order['integral_money'] = value_of_integral(intval($_POST['integral']));
                     if ($old_order['integral'] + $user['pay_points'] < $order['integral']) {
                         sys_msg($_LANG['pay_points_not_enough']);
                     }
                     $order['order_amount'] -= $order['integral_money'];
开发者ID:seanguo166,项目名称:yinoos,代码行数:31,代码来源:order.php


示例4: bonus_info

         $order['integral'] = 0;
     }
 } else {
     $order['surplus'] = 0;
     $order['integral'] = 0;
 }
 /* 检查抵扣券是否存在 */
 if ($order['bonus_id'] > 0) {
     $bonus = bonus_info($order['bonus_id']);
     if (empty($bonus) || $bonus['user_id'] != $user_id || $bonus['order_id'] > 0 || $bonus['min_goods_amount'] > cart_amount(true, $flow_type)) {
         $order['bonus_id'] = 0;
     }
 } elseif (isset($_POST['bonus_sn'])) {
     $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS;
     $bonus_sn = trim($_POST['bonus_sn']);
     $bonus = bonus_info(0, $bonus_sn);
     $now = gmtime();
     if (empty($bonus) || $bonus['user_id'] > 0 || $bonus['order_id'] > 0 || $bonus['min_goods_amount'] > cart_amount(true, $flow_type) || $now > $bonus['use_end_date']) {
     } else {
         if ($user_id > 0) {
             $sql = "UPDATE " . $ecs->table('user_bonus') . " SET user_id = '{$user_id}' WHERE bonus_id = '{$bonus['bonus_id']}' LIMIT 1";
             $db->query($sql);
         }
         $order['bonus_id'] = $bonus['bonus_id'];
         $order['bonus_sn'] = $bonus_sn;
     }
 }
 /* 订单中的商品 */
 $cart_goods = cart_goods($flow_type);
 if (empty($cart_goods)) {
     $tips = '您的购物车中没有商品';
开发者ID:nanhuacrab,项目名称:ecshop,代码行数:31,代码来源:order.php


示例5: order_fee

/**
 * 获得订单中的费用信息
 *
 * @access  public
 * @param   array   $order
 * @param   array   $goods
 * @param   array   $consignee
 * @param   bool    $is_gb_deposit  是否团购保证金(如果是,应付款金额只计算商品总额和支付费用,可以获得的积分取 $gift_integral)
 * @return  array
 */
function order_fee($order, $goods, $consignee)
{
    /* 初始化订单的扩展code */
    if (!isset($order['extension_code'])) {
        $order['extension_code'] = '';
    }
    if ($order['extension_code'] == 'group_buy') {
        $group_buy = group_buy_info($order['extension_id']);
    }
    $total = array('real_goods_count' => 0, 'gift_amount' => 0, 'goods_price' => 0, 'market_price' => 0, 'discount' => 0, 'pack_fee' => 0, 'card_fee' => 0, 'shipping_fee' => 0, 'shipping_insure' => 0, 'integral_money' => 0, 'bonus' => 0, 'surplus' => 0, 'cod_fee' => 0, 'pay_fee' => 0, 'tax' => 0);
    $weight = 0;
    /* 商品总价 */
    foreach ($goods as $val) {
        /* 统计实体商品的个数 */
        if ($val['is_real']) {
            $total['real_goods_count']++;
        }
        $total['goods_price'] += $val['goods_price'] * $val['goods_number'];
        $total['market_price'] += $val['market_price'] * $val['goods_number'];
    }
    $total['saving'] = $total['market_price'] - $total['goods_price'];
    $total['save_rate'] = $total['market_price'] ? round($total['saving'] * 100 / $total['market_price']) . '%' : 0;
    $total['goods_price_formated'] = price_format($total['goods_price'], false);
    $total['market_price_formated'] = price_format($total['market_price'], false);
    $total['saving_formated'] = price_format($total['saving'], false);
    /* 折扣 */
    if ($order['extension_code'] != 'group_buy') {
        $discount = compute_discount(isset($order['supplier_id']) ? $order['supplier_id'] : -1);
        $total['discount'] = $discount['discount'];
        if ($total['discount'] > $total['goods_price']) {
            $total['discount'] = $total['goods_price'];
        }
    }
    $total['discount_formated'] = price_format($total['discount'], false);
    /* 税额 */
    if (!empty($order['need_inv']) && $order['inv_type'] != '') {
        /* 查税率 */
        $rate = 0;
        foreach ($GLOBALS['_CFG']['invoice_type']['type'] as $key => $type) {
            if ($type == $order['inv_type']) {
                $rate = floatval($GLOBALS['_CFG']['invoice_type']['rate'][$key]) / 100;
                break;
            }
        }
        if ($rate > 0) {
            $total['tax'] = $rate * $total['goods_price'];
        }
    }
    $total['tax_formated'] = price_format($total['tax'], false);
    /* 包装费用 */
    if (!empty($order['pack_id'])) {
        $total['pack_fee'] = pack_fee($order['pack_id'], $total['goods_price']);
    }
    $total['pack_fee_formated'] = price_format($total['pack_fee'], false);
    /* 贺卡费用 */
    if (!empty($order['card_id'])) {
        $total['card_fee'] = card_fee($order['card_id'], $total['goods_price']);
    }
    $total['card_fee_formated'] = price_format($total['card_fee'], false);
    /* 红包 */
    $total['bonus'] = 0;
    if (!empty($order['bonus_id'])) {
        $bonus = bonus_info($order['bonus_id']);
        $total['bonus'] = $bonus['type_money'];
    }
    /* 线下红包 */
    if (!empty($order['bonus_sn'])) {
        $bonus = bonus_info(0, $order['bonus_sn']);
        $total['bonus'] += $bonus['type_money'];
        //$total['bonus_kill'] = $order['bonus_kill'];
        //$total['bonus_kill_formated'] = price_format($total['bonus_kill'], false);
    }
    $total['bonus_formated'] = price_format($total['bonus'], false);
    /* 配送费用 */
    $shipping_cod_fee = NULL;
    $sql_where = $_SESSION['user_id'] > 0 ? "user_id='" . $_SESSION['user_id'] . "' " : "session_id = '" . SESS_ID . "' AND user_id=0 ";
    if ($order['shipping_id'] > 0 && $total['real_goods_count'] > 0) {
        $region['country'] = $consignee['country'];
        $region['province'] = $consignee['province'];
        $region['city'] = $consignee['city'];
        $region['district'] = $consignee['district'];
        $shipping_info = shipping_area_info($order['shipping_id'], $region);
        if (!empty($shipping_info)) {
            if ($order['extension_code'] == 'group_buy') {
                $weight_price = cart_weight_price(CART_GROUP_BUY_GOODS);
            } else {
                $weight_price = cart_weight_price();
            }
            // 查看购物车中是否全为免运费商品,若是则把运费赋为零
            $sql = 'SELECT count(*) FROM ' . $GLOBALS['ecs']->table('cart') . " WHERE  {$sql_where} AND `extension_code` != 'package_buy' AND `is_shipping` = 0 AND rec_id in (" . $_SESSION['sel_cartgoods'] . ")";
//.........这里部分代码省略.........
开发者ID:seanguo166,项目名称:yinoos,代码行数:101,代码来源:lib_order.php


示例6: array

    }
    $link[] = array('text' => $_LANG['back_list'], 'href' => 'bonus.php?act=list');
    sys_msg(sprintf($_LANG['sendbonus_count'], $count), 0, $link);
}
/*------------------------------------------------------ */
//-- 发送邮件
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'send_mail') {
    /* 取得参数:红包id */
    $bonus_id = intval($_REQUEST['bonus_id']);
    if ($bonus_id <= 0) {
        die('invalid params');
    }
    /* 取得红包信息 */
    include_once ROOT_PATH . 'includes/lib_order.php';
    $bonus = bonus_info($bonus_id);
    if (empty($bonus)) {
        sys_msg($_LANG['bonus_not_exist']);
    }
    /* 发邮件 */
    $count = send_bonus_mail($bonus['bonus_type_id'], array($bonus_id));
    $link[0]['text'] = $_LANG['back_bonus_list'];
    $link[0]['href'] = 'bonus.php?act=bonus_list&bonus_type=' . $bonus['bonus_type_id'];
    sys_msg(sprintf($_LANG['success_send_mail'], $count), 0, $link);
}
/*------------------------------------------------------ */
//-- 按印刷品发放红包
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'send_by_print') {
    @set_time_limit(0);
    /* 红下红包的类型ID和生成的数量的处理 */
开发者ID:norain2050,项目名称:mhFault,代码行数:31,代码来源:bonus.php


示例7: gmtime

        if (empty($count)) {
            $time = gmtime();
            $sql = "INSERT INTO " . $GLOBALS['ecs']->table('collect_goods') . " (user_id, goods_id, add_time)" . "VALUES ('{$_SESSION['user_id']}', '{$goods_id}', '{$time}')";
            $db->query($sql);
        }
        flow_drop_cart_goods($rec_id);
    }
    ecs_header("Location: flow.php\n");
    exit;
} elseif ($_REQUEST['step'] == 'validate_bonus') {
    include_once 'includes/cls_json.php';
    $result = array('error' => '', 'content' => '');
    $result['suppid'] = $suppid = intval($_GET['suppid']);
    $bonus_sn = intval($_REQUEST['bonus_sn']);
    if (is_numeric($bonus_sn) && $bonus_sn > 0) {
        $bonus = bonus_info(0, $bonus_sn, $suppid);
    } else {
        $bonus = array();
    }
    /* 取得购物类型 */
    $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS;
    /* 获得收货人信息 */
    $consignee = get_consignee($_SESSION['user_id']);
    /* 对商品信息赋值 */
    $cart_goods = cart_goods($flow_type);
    // 取得商品列表,计算合计
    if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type)) {
        $result['error'] = $_LANG['no_goods_in_cart'];
    } else {
        /* 取得购物流程设置 */
        $smarty->assign('config', $_CFG);
开发者ID:moonlight-wang,项目名称:feilun,代码行数:31,代码来源:flow.php


示例8: user_bonus

         /* 计算可用余额 */
         $smarty->assign('available_user_money', $order['surplus'] + $user['user_money']);
         /* 计算可用积分 */
         $smarty->assign('available_pay_points', $order['integral'] + $user['pay_points']);
         /* 取得用户可用红包 */
         $user_bonus = user_bonus($order['user_id'], array($order['supplier_id'] => $order['goods_amount']));
         /*
                     if ($order['bonus_id'] > 0)
                     {
                         $bonus = bonus_info($order['bonus_id']);
                         $user_bonus[] = $bonus;
                     }*/
         if (!empty($user_bonus)) {
             $user_bonus1 = $user_bonus[$order['supplier_id']];
             foreach ($user_bonus1 as $key => $val) {
                 $user_bonus1[$key] = bonus_info($val['bonus_id']);
             }
             $smarty->assign('available_bonus', $user_bonus1);
         }
     }
 } elseif ('invoice' == $step) {
     /* 如果不存在实体商品 */
     if (!exist_real_goods($order_id)) {
         die('Hacking Attemp');
     }
     //morestock_morecity start
     $sql = "select ssf.*,s.shipping_name from ecs_store_shipping_region as ssr,\n\t\t\t\tecs_store_shipping_fee as ssf,\n\t\t\t\tecs_shipping as s \n\t\t\t\twhere ssr.rec_id = ssf.shipping_region_id \n\t\t\t\tand ssr.store_id=" . $order['store_id'] . "  \n\t\t\t\tand ssr.province=" . $order['province'] . " and ssr.city = " . $order['city'] . " and ssr.district= " . $order['district'] . " and ssr.xiangcun=" . $order['xiangcun'] . " \n\t\t\t\tand ssf.shipping_id=s.shipping_id";
     $ret = $db->getAll($sql);
     $shipping_list = array();
     if (count($ret) > 0) {
         foreach ($ret as $key => $val) {
开发者ID:moonlight-wang,项目名称:feilun,代码行数:31,代码来源:order.php


示例9: done


//.........这里部分代码省略.........
	    $user_id = $_SESSION['user_id'];
		/*
	    #检查积分余额是否合法
	    $user_id = $_SESSION['user_id'];
	    if ($user_id > 0)
	    {
	        $user_info = user_info($user_id);
	
	        $order['surplus'] = min($order['surplus'], $user_info['user_money'] + $user_info['credit_line']);
	        if ($order['surplus'] < 0)
	        {
	            $order['surplus'] = 0;
	        }
	
	        // 查询用户有多少积分
	        $flow_points = flow_available_points();  // 该订单允许使用的积分
	        $user_points = $user_info['pay_points']; // 用户的积分总数
	
	        $order['integral'] = min($order['integral'], $user_points, $flow_points);
	        if ($order['integral'] < 0)
	        {
	            $order['integral'] = 0;
	        }
	    }
	    else
	    {
	        $order['surplus']  = 0;
	        $order['integral'] = 0;
	    }*/
	
	    #检查红包是否存在
	    if ($order['bonus_id'] > 0)
	    {
	        $bonus = bonus_info($order['bonus_id']);
	
	        if (empty($bonus) || $bonus['user_id'] != $user_id || $bonus['order_id'] > 0 || $bonus['min_goods_amount'] > cart_amount(true, $flow_type))
	        {
	            $order['bonus_id'] = 0;
	        }
	        
	    }
	    elseif (isset($_POST['bonus_sn']))
	    {
	        $bonus_sn = trim($_POST['bonus_sn']);
	        $bonus = bonus_info(0, $bonus_sn);
	        $now = gmtime();
	        if (empty($bonus) || $bonus['user_id'] > 0 || $bonus['order_id'] > 0 || $bonus['min_goods_amount'] > cart_amount(true, $flow_type) || $now > $bonus['use_end_date'])
	        {
	        }
	        else
	        {
	            if ($user_id > 0)
	            {
	                $sql = "UPDATE " . $ecs->table('user_bonus') . " SET user_id = '$user_id' WHERE bonus_id = '$bonus[bonus_id]' LIMIT 1";
	                $db->query($sql);
	            }
	            $order['bonus_id'] = $bonus['bonus_id'];
	            $order['bonus_sn'] = $bonus_sn;
	        }
	    }
		
	
	    /* 订单中的商品 */
	    $cart_goods = cart_goods($flow_type);
	
	    if (empty($cart_goods))
开发者ID:noikiy,项目名称:mdwp,代码行数:67,代码来源:flow.action.php


示例10: order_fee

/**
 * 获得订单中的费用信息
 *
 * @access  public
 * @param   array   $order
 * @param   array   $goods
 * @param   array   $consignee
 * @param   bool    $is_gb_deposit  是否团购保证金(如果是,应付款金额只计算商品总额和支付费用,可以获得的积分取 $gift_integral)
 * @return  array
 */
function order_fee($order, $goods, $consignee)
{
    //echo "<pre>";print_r($consignee);echo "</pre>";exit;
    $total = array('real_goods_count' => 0, 'gift_amount' => 0, 'goods_price' => 0, 'market_price' => 0, 'discount' => 0, 'pack_fee' => 0, 'card_fee' => 0, 'shipping_fee' => 0, 'shipping_insure' => 0, 'integral_money' => 0, 'bonus' => 0, 'surplus' => 0, 'cod_fee' => 0, 'pay_fee' => 0, 'tax' => 0);
    $weight = 0;
    /* 商品总价 */
    foreach ($goods as $val) {
        /* 统计实体商品的个数 */
        if ($val['is_real']) {
            $total['real_goods_count']++;
        }
        /*K金的兑礼不计入总费用 bisc*/
        if ($val['is_integral'] == 1) {
            if ($val['cat_id'] != 4) {
                $total['gifts_integral'] += $val['integral'] * $val['goods_number'];
            } else {
                $total['goods_integral'] += $val['goods_price'] * $val['goods_number'];
            }
        } else {
            $total['goods_price'] += $val['goods_price'] * $val['goods_number'];
            $total['market_price'] += $val['market_price'] * $val['goods_number'];
        }
    }
    $total['saving'] = $total['market_price'] - $total['goods_price'];
    $total['save_rate'] = $total['market_price'] ? round($total['saving'] * 100 / $total['market_price']) . '%' : 0;
    $total['goods_price_formated'] = price_format($total['goods_price'], false);
    $total['market_price_formated'] = price_format($total['market_price'], false);
    $total['saving_formated'] = price_format($total['saving'], false);
    /* 折扣$NowDiscount */
    $discount = compute_discount();
    $total['discount'] = $discount['discount'];
    $total['discount_formated'] = price_format($total['discount'], false);
    /* 红包 */
    if (!empty($order['bonus_id'])) {
        $bonus = bonus_info($order['bonus_id']);
        $total['bonus'] = $bonus['type_money'];
    }
    $total['bonus_formated'] = price_format($total['bonus'], false);
    /* 配送费用 */
    $shipping_cod_fee = NULL;
    if ($order['shipping_id'] > 0 && $total['real_goods_count'] > 0) {
        $region['country'] = $consignee['country'];
        $region['province'] = $consignee['province'];
        $region['city'] = $consignee['city'];
        $region['district'] = $consignee['district'];
        $shipping_info = shipping_area_info($order['shipping_id'], $region);
        if (!empty($shipping_info)) {
            $weight_price = cart_weight_price();
            if ($consignee['province'] == '502') {
                $sql = "select shipping_fee from ecs_shipping_fee where locate(address,'" . $consignee['address'] . "') >0 ";
                $fee = $GLOBALS['db']->getOne($sql);
                $total['shipping_fee'] = $fee ? $fee : shipping_fee($shipping_info['shipping_code'], $shipping_info['configure'], $weight_price['weight'], $total['goods_price']);
            } else {
                $total['shipping_fee'] = shipping_fee($shipping_info['shipping_code'], $shipping_info['configure'], $weight_price['weight'], $total['goods_price']);
            }
        }
    }
    $total['shipping_fee_formated'] = price_format($total['shipping_fee'], false);
    $total['shipping_insure_formated'] = price_format($total['shipping_insure'], false);
    // 红包和积分最多能支付的金额为商品总额
    $max_amount = $total['goods_price'];
    /*储值卡金额*/
    if (!empty($order['surplus'])) {
        $total['surplus'] = $order['surplus'];
    }
    $total['surplus_formated'] = price_format($total['surplus'], false);
    /* 计算订单总额 */
    if ($order['extension_code'] == 'group_buy' && $group_buy['deposit'] > 0) {
        $total['amount'] = $total['goods_price'];
    } else {
        $total['amount'] = $total['goods_price'] - $total['discount'] + $total['tax'] + $total['pack_fee'] + $total['card_fee'] + $total['shipping_fee'] + $total['shipping_insure'] + $total['cod_fee'];
        // 减去红包金额
        $use_bonus = min($total['bonus'], $max_amount);
        // 实际减去的红包金额
        $total['bonus'] = $use_bonus;
        $total['bonus_formated'] = price_format($total['bonus'], false);
        $total['amount'] -= $use_bonus;
        // 还需要支付的订单金额
        $max_amount -= $use_bonus;
        // 积分最多还能支付的金额
        //减去储值卡金额
        $total['amount'] -= $order['surplus'];
    }
    /* 积分 */
    $order['integral'] = $order['integral'] > 0 ? $order['integral'] : 0;
    if ($total['amount'] > 0 && $max_amount > 0 && $order['integral'] > 0) {
        $integral_money = value_of_integral($order['integral']);
        $use_integral = min($total['amount'], $max_amount, $integral_money);
        // 实际使用积分支付的金额
        $total['integral_money'] = $use_integral;
//.........这里部分代码省略.........
开发者ID:songtaiwu,项目名称:m-cmsold,代码行数:101,代码来源:lib_order.php


示例11: tender

function tender($order_id, $user_id, $opay_id, $note, $amount, $bonus = 0, $bonus_id = 0, $surplus = 0, $integral = 0)
{
    //$order_pay[]=array('pay_id'=>0,'pay_name'=>'');
    if ($amount > 0) {
        if ($opay_id == 1 || $opay_id == 4) {
            if (strpos($note, 'S')) {
                $order_pay['pay_id'] = $opay_id == 4 ? 2 : 4;
                $n = $order_pay['pay_name'] = 'POS机';
            } else {
                $order_pay['pay_id'] = $opay_id == 4 ? 1 : 3;
                $n = $order_pay['pay_name'] = '现金';
            }
            if ($opay_id == 1) {
                $order_pay['pay_name'] = '异地' . $n;
            }
            $order_pay['amount'] = $amount;
        }
    }
    if ($opay_id == 2 || $opay_id == 3 || $opay_id == 21 || $opay_id == 6) {
        $order_pay['pay_id'] = $opay_id == 2 ? 5 : ($opay_id == 3 ? 6 : $opay_id == 21 ? 7 : 8);
        if ($opay_id == 2) {
            $order_pay['pay_name'] = '支付宝';
        }
        if ($opay_id == 3) {
            $order_pay['pay_name'] = '快钱';
        }
        if ($opay_id == 6) {
            $order_pay['pay_name'] = '免费支付';
        }
        //$order_pay['pay_name']=$note;
        $order_pay['amount'] = $amount;
    }
    if ($opay_id == 5) {
        //大客户
        if ($note == '月结') {
            $order_pay['pay_id'] = 11;
            $order_pay['pay_name'] = '大客户月结';
            $order_pay['amount'] = $surplus;
        } else {
            $order_pay['pay_id'] = 12;
            $order_pay['pay_name'] = '大客户预付款';
            $order_pay['amount'] = $surplus;
        }
    }
    if (isset($order_pay)) {
        $order_pay['order_id'] = $order_id;
        $order_pay['user_id'] = $user_id;
        $order_pay['type'] = get_type($order_pay['pay_id']);
        //echo "<pre>";print_r($order_pay);
        $GLOBALS['db']->autoExecute('tender_info', $order_pay);
    }
    if ($opay_id != 5 && $surplus > 0) {
        $order_pay['order_id'] = $order_id;
        $order_pay['user_id'] = $user_id;
        $order_pay['pay_id'] = 10;
        $order_pay['pay_name'] = '礼金卡';
        $order_pay['amount'] = $surplus;
        $order_pay['type'] = get_type($order_pay['pay_id']);
        //print_r($order_pay);
        $GLOBALS['db']->autoExecute('tender_info', $order_pay);
    }
    if ($bonus > 0) {
        $order_pay['pay_id'] = 9;
        $order_pay['order_id'] = $order_id;
        $order_pay['user_id'] = $user_id;
        //网站
        $bonus = bonus_info($bonus_id);
        $order_pay['pay_name'] = $bonus['type_name'];
        $order_pay['amount'] = 1;
        $order_pay['remark'] = $bonus['bonus_sn'];
        $order_pay['type'] = get_type($order_pay['pay_id']);
        //print_r($order_pay);
        $GLOBALS['db']->autoExecute('tender_info', $order_pay);
    }
}
开发者ID:fromzyy2ann,项目名称:mescake,代码行数:75,代码来源:tender.php



注:本文中的bonus_info函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP book_get_chapter_title函数代码示例发布时间:2022-05-24
下一篇:
PHP bones_theme_support函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap