Authored by Rock Zhang

修复商品结算页商品价格错误的bug(更改价格计算方式)

Code Review By Rock Zhang
@@ -74,7 +74,7 @@ @@ -74,7 +74,7 @@
74 {{> me/order/good}} 74 {{> me/order/good}}
75 {{/each}} 75 {{/each}}
76 </section> 76 </section>
77 - <div class="goods-num">共{{num}}件商品 合计<span>{{goodsPrice}}</span></div> 77 + <div class="goods-num">共{{num}}件商品 合计<span>¥{{goodsPrice}}</span></div>
78 78
79 <section class="block"> 79 <section class="block">
80 <ul class="sale-invoice"> 80 <ul class="sale-invoice">
@@ -453,6 +453,8 @@ class CartModel @@ -453,6 +453,8 @@ class CartModel
453 // 订单商品 453 // 订单商品
454 if (isset($payReturn['goods_list'])) { 454 if (isset($payReturn['goods_list'])) {
455 $oneGoods = array(); 455 $oneGoods = array();
  456 + $goodsPrice = 0;
  457 +
456 foreach ($payReturn['goods_list'] as $single) { 458 foreach ($payReturn['goods_list'] as $single) {
457 $oneGoods = array(); 459 $oneGoods = array();
458 $oneGoods['id'] = $single['product_sku']; // TODO 未确定用哪个 460 $oneGoods['id'] = $single['product_sku']; // TODO 未确定用哪个
@@ -460,8 +462,8 @@ class CartModel @@ -460,8 +462,8 @@ class CartModel
460 $oneGoods['name'] = $single['product_name']; 462 $oneGoods['name'] = $single['product_name'];
461 $oneGoods['color'] = $single['color_name']; 463 $oneGoods['color'] = $single['color_name'];
462 $oneGoods['size'] = $single['size_name']; 464 $oneGoods['size'] = $single['size_name'];
463 - $oneGoods['price'] = Helpers::transPrice($single['last_price']);  
464 $oneGoods['count'] = $single['buy_number']; 465 $oneGoods['count'] = $single['buy_number'];
  466 + $oneGoods['price'] = Helpers::transPrice($single['last_price']);
465 467
466 //gift=>是否赠品,advanceBuy=>是否加价购; 468 //gift=>是否赠品,advanceBuy=>是否加价购;
467 if ($single['goods_type'] == 'gift' && !isset($single['isAdvanceBuy'])) { 469 if ($single['goods_type'] == 'gift' && !isset($single['isAdvanceBuy'])) {
@@ -472,8 +474,14 @@ class CartModel @@ -472,8 +474,14 @@ class CartModel
472 $oneGoods['price'] = Helpers::transPrice($single['sale_price']); 474 $oneGoods['price'] = Helpers::transPrice($single['sale_price']);
473 } 475 }
474 476
  477 + // 累加商品金额
  478 + $goodsPrice += $single['subtotal'];
  479 +
475 $result['goods'][] = $oneGoods; 480 $result['goods'][] = $oneGoods;
476 } 481 }
  482 +
  483 + // 商品金额
  484 + $result['goodsPrice'] = Helpers::transPrice($goodsPrice);
477 } 485 }
478 486
479 // 支付方式 487 // 支付方式
@@ -514,7 +522,7 @@ class CartModel @@ -514,7 +522,7 @@ class CartModel
514 // 订单商品数 522 // 订单商品数
515 $result['num'] = $payReturn['shopping_cart_data']['selected_goods_count']; 523 $result['num'] = $payReturn['shopping_cart_data']['selected_goods_count'];
516 // 商品金额 524 // 商品金额
517 - $result['goodsPrice'] = $payReturn['shopping_cart_data']['str_order_amount']; 525 +// $result['goodsPrice'] = $payReturn['shopping_cart_data']['str_order_amount'];
518 } 526 }
519 527
520 // 发票有关数据 528 // 发票有关数据