添加购物车结算页面修改属性时重新运算的路由接口
Code Review By Rock Zhang
Showing
2 changed files
with
26 additions
and
2 deletions
@@ -161,6 +161,30 @@ class ShoppingCartController extends AbstractAction | @@ -161,6 +161,30 @@ class ShoppingCartController extends AbstractAction | ||
161 | } | 161 | } |
162 | 162 | ||
163 | /** | 163 | /** |
164 | + * 购物车选择改变字段,重新运算订单数据 | ||
165 | + */ | ||
166 | + public function orderComputeAction() | ||
167 | + { | ||
168 | + $result = array(); | ||
169 | + | ||
170 | + if ($this->isAjax()) { | ||
171 | + $cartType = $this->post('cartType', 'ordinary'); | ||
172 | + $deliveryWay = $this->post('deliveryWay', 1); | ||
173 | + $paymentType = $this->post('paymentType', 1); | ||
174 | + $couponCode = $this->post('paymentType', null); | ||
175 | + $yohoCoin = $this->post('paymentType', null); | ||
176 | + $uid = $this->getUid(true); | ||
177 | + $result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin); | ||
178 | + } | ||
179 | + | ||
180 | + if (empty($result)) { | ||
181 | + echo ' '; | ||
182 | + } else { | ||
183 | + $this->echoJson($result); | ||
184 | + } | ||
185 | + } | ||
186 | + | ||
187 | + /** | ||
164 | * 购物车输入优惠券码使用优惠券 | 188 | * 购物车输入优惠券码使用优惠券 |
165 | */ | 189 | */ |
166 | public function couponSearchAction() | 190 | public function couponSearchAction() |
@@ -390,11 +390,11 @@ class CartModel | @@ -390,11 +390,11 @@ class CartModel | ||
390 | $sumPrice = isset($orderCompute['order_amount']) ? $orderCompute['order_amount'] : $payReturn['shopping_cart_data']['order_amount']; | 390 | $sumPrice = isset($orderCompute['order_amount']) ? $orderCompute['order_amount'] : $payReturn['shopping_cart_data']['order_amount']; |
391 | $salePrice = isset($orderCompute['discount_amount']) ? $orderCompute['discount_amount'] : $payReturn['shopping_cart_data']['discount_amount']; | 391 | $salePrice = isset($orderCompute['discount_amount']) ? $orderCompute['discount_amount'] : $payReturn['shopping_cart_data']['discount_amount']; |
392 | $price = isset($orderCompute['last_order_amount']) ? $orderCompute['last_order_amount'] : $payReturn['shopping_cart_data']['last_order_amount']; | 392 | $price = isset($orderCompute['last_order_amount']) ? $orderCompute['last_order_amount'] : $payReturn['shopping_cart_data']['last_order_amount']; |
393 | - $freight = isset($orderCompute['promotion_formula_list']['promotion_amount']) ? $orderCompute['promotion_formula_list']['promotion_amount'] : $payReturn['shopping_cart_data']['promotion_formula_list']['promotion_amount']; | 393 | + $freight = isset($orderCompute['promotion_formula_list']['promotion_amount']) ? $orderCompute['promotion_formula_list']['promotion_amount'] : $payReturn['shopping_cart_data']['promotion_formula_list'][1]['promotion_amount']; |
394 | $result['sumPrice'] = Helpers::transPrice($sumPrice); | 394 | $result['sumPrice'] = Helpers::transPrice($sumPrice); |
395 | $result['salePrice'] = Helpers::transPrice($salePrice); | 395 | $result['salePrice'] = Helpers::transPrice($salePrice); |
396 | $result['price'] = Helpers::transPrice($price); | 396 | $result['price'] = Helpers::transPrice($price); |
397 | - $result['freight'] = strtr($freight, '¥', '') . '.00'; | 397 | + $result['freight'] = strtr($freight, array('¥'=>'','¥'=>'')) . '.00'; |
398 | } | 398 | } |
399 | 399 | ||
400 | // 发票有关数据 | 400 | // 发票有关数据 |
-
Please register or login to post a comment