echo "<span style='color:#e97816'>参与促销优惠活动:-¥" . $act_res['DecrAmount'] . "<br>(单笔订单满 ¥" . $act_res['MinAmount'] . " 减¥" . $act_res['DecrAmount'] . ")</span>"; } } $order_decr = $act_res['DecrAmount']; break; case 2: //每满减 $act_res = BuyGoodsService::pperdecre($params); $order_decr = $act_res['DecrTotal']; if (!empty($order_decr)) { echo "<span style='color:#e97816'>参与促销优惠活动:-" . $act_res['DecrTotal'] . "<br>(单笔订单每满 ¥" . $act_res['MinAmount'] . " 减¥" . $act_res['DecrAmount'] . ")</span>"; } break; case 3: //优惠券; $act_res = BuyGoodsService::coupondecre($params); if ($counts >= $act_res['MinAmount'] && $num == 1) { echo "<div class='info'><input type='hidden' class='mina' name='minamount' value=" . $act_res['MinAmount'] . ">"; // echo "<span style='color:red'>单笔订单满".$act_res['MinAmount']."元,系统将赠送您价值".$act_res['DecrAmount']."元优惠券".$act_res['Num']."张</span><br>"; echo "<span style='color:#e97816'>您将有机会参与抽奖活动</span>"; echo "<input type='hidden' name='lott' value='1'>"; echo "<input type='hidden' name='PromoID' value=" . $act_res['PromoID'] . "></div>"; } break; } } } } if (!empty($coupon) && is_array($coupon)) { echo "<span class='cup' style='color:#e97816'><input type='checkbox' class='clpayper'><span class='payper' >使用我的优惠券</span><br>(您可以使用优惠券,减免订单金额,每次只限一张)</span>"; }
public function actionGetaction() { $html = ''; $order_decr = 0; $cop_amout = Yii::app()->request->getParam(cop_amout); $organID = Yii::app()->user->getOrganID(); $data = BuyGoodsService::activeorgan(); // var_dump($data);die; $params = array(); if (in_array($organID, $data)) { $act = BuyGoodsService::active(); if (!empty($act) && is_array($act)) { $payment = $act['Payment']; $params['PromoID'] = intval($act['ID']); $params['TotalAmount'] = Yii::app()->request->getParam('amount'); switch ($act['Type']) { case 1: //满多少减多少 $act_res = BuyGoodsService::decre($params); if (!empty($act_res) && is_array($act_res)) { if (!empty($act_res['DecrAmount'])) { $html = "<span style='color:red'>优惠:-¥" . $act_res['DecrAmount'] . "(单笔订单满 ¥" . $act_res['MinAmount'] . " 减¥" . $act_res['DecrAmount'] . ")</span>"; } else { $html = ''; } } $order_decr = $act_res['DecrAmount']; break; case 2: //每满减 $act_res = BuyGoodsService::pperdecre($params); $order_decr = $act_res['DecrTotal']; if (!empty($act_res['DecrAmount'])) { $html = "<span style='color:red'>优惠:-" . $act_res['DecrTotal'] . "(单笔订单每满 ¥" . $act_res['MinAmount'] . " 减¥" . $act_res['DecrAmount'] . ")</span>"; } break; case 3: //优惠券 $params['search'] = 'search'; $res = BuyGoodsService::mycoupon(); $act_res = BuyGoodsService::coupondecre($params); $coupon = $res->getData(); $html = ""; // "<span style='color:red'>单笔订单满" . $act_res['MinAmount'] . "元,系统将赠送您价值" . $act_res['DecrAmount'] . "元优惠券" . $act_res['Num'] . "张</span><br>"; if ($cop_amout) { $html .= '<span style="color:red">使用优惠券:-¥' . floatval($cop_amout); } elseif (!empty($coupon) && is_array($coupon)) { $html .= "<span class='cup' style='color:red'><span class='payper' style='color:blue'>使用我的优惠券</span>(您可以使用优惠券,减免订单金额,每次只限一张)</span>"; } break; } } } echo json_encode(array('html' => $html, 'order_decr' => $order_decr, 'payment' => isset($payment) ? $payment - 1 : '1')); }