Authored by Rock Zhang

修改订单结算页底部的价格有关信息为直接读取接口返回的数据

Code Review By Rock Zhang
@@ -90,7 +90,7 @@ function orderCompute() { @@ -90,7 +90,7 @@ function orderCompute() {
90 if (!res) { 90 if (!res) {
91 tip.show('网络出错'); 91 tip.show('网络出错');
92 } else { 92 } else {
93 - if (res.order_amount) { 93 + /*if (res.order_amount) {
94 res.order_amount = (+res.order_amount).toFixed(2); 94 res.order_amount = (+res.order_amount).toFixed(2);
95 } 95 }
96 if (res.discount_amount) { 96 if (res.discount_amount) {
@@ -98,14 +98,9 @@ function orderCompute() { @@ -98,14 +98,9 @@ function orderCompute() {
98 } 98 }
99 if (res.last_order_amount) { 99 if (res.last_order_amount) {
100 res.last_order_amount = (+res.last_order_amount).toFixed(2); 100 res.last_order_amount = (+res.last_order_amount).toFixed(2);
101 - } 101 + }*/
102 priceHtml = priceTmpl({ 102 priceHtml = priceTmpl({
103 - sumPrice: res.order_amount,  
104 - salePrice: res.discount_amount,  
105 - freight: res.promotion_formula_list[1].promotion_amount,  
106 - couponPrice: res.coupon_amount,  
107 - yohoCoin: res.use_yoho_coin,  
108 - price: res.last_order_amount 103 + cartPayData: res.promotion_formula_list
109 }); 104 });
110 105
111 $price.html(priceHtml); 106 $price.html(priceHtml);
@@ -98,31 +98,12 @@ @@ -98,31 +98,12 @@
98 98
99 <section class="price-cal block"> 99 <section class="price-cal block">
100 <ul class="total"> 100 <ul class="total">
  101 + {{#cartPayData}}
101 <li> 102 <li>
102 - <span>总价</span>  
103 - &nbsp;&nbsp;¥{{sumPrice}}  
104 - </li>  
105 - <li>  
106 - <span>活动价</span>  
107 - - ¥{{salePrice}}  
108 - </li>  
109 - <li>  
110 - <span>运费</span>  
111 - + {{freight}}  
112 - </li>  
113 - {{#couponPrice}}  
114 - <li>  
115 - <span>优惠券</span>  
116 - - ¥{{.}}  
117 - </li>  
118 - {{/couponPrice}}  
119 - <li>  
120 - <span>YOHO币</span>  
121 - - ¥{{yohoCoin}}  
122 - </li>  
123 - <li class="cost">  
124 - 应付金额: <em>¥{{price}}</em> 103 + <span>{{promotion}}</span>
  104 + &nbsp;&nbsp;{{promotion_amount}}
125 </li> 105 </li>
  106 + {{/cartPayData}}
126 </ul> 107 </ul>
127 </section> 108 </section>
128 109
@@ -144,31 +125,12 @@ @@ -144,31 +125,12 @@
144 </div> 125 </div>
145 <script id="tmpl-price" type="text/tmpl"> 126 <script id="tmpl-price" type="text/tmpl">
146 <ul class="total"> 127 <ul class="total">
  128 + \{{#cartPayData}}
147 <li> 129 <li>
148 - <span>总价</span>  
149 - &nbsp;&nbsp;¥\{{sumPrice}}  
150 - </li>  
151 - <li>  
152 - <span>活动价</span>  
153 - - ¥\{{salePrice}}  
154 - </li>  
155 - <li>  
156 - <span>运费</span>  
157 - + \{{freight}}  
158 - </li>  
159 - \{{#couponPrice}}  
160 - <li>  
161 - <span>优惠券</span>  
162 - - ¥\{{.}}  
163 - </li>  
164 - \{{/couponPrice}}  
165 - <li>  
166 - <span>YOHO币</span>  
167 - - ¥\{{yohoCoin}}  
168 - </li>  
169 - <li class="cost">  
170 - 应付金额: <em>¥\{{price}}</em> 130 + <span>\{{promotion}}</span>
  131 + &nbsp;&nbsp;\{{promotion_amount}}
171 </li> 132 </li>
  133 + \{{/cartPayData}}
172 </ul> 134 </ul>
173 </script> 135 </script>
174 {{> layout/footer}} 136 {{> layout/footer}}
@@ -450,7 +450,9 @@ class CartModel @@ -450,7 +450,9 @@ class CartModel
450 450
451 // 订单数据 451 // 订单数据
452 if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) { 452 if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) {
453 - $sumPrice = isset($orderCompute['order_amount']) ? $orderCompute['order_amount'] : $payReturn['shopping_cart_data']['order_amount']; 453 + $result['cartPayData'] = isset($orderCompute['promotion_formula_list']) ? $orderCompute['promotion_formula_list'] : $payReturn['shopping_cart_data']['promotion_formula_list'];
  454 +
  455 + /*$sumPrice = isset($orderCompute['order_amount']) ? $orderCompute['order_amount'] : $payReturn['shopping_cart_data']['order_amount'];
454 456
455 $freight = '¥0'; 457 $freight = '¥0';
456 if (isset($orderCompute['promotion_formula_list'][1]['promotion_amount'])) { 458 if (isset($orderCompute['promotion_formula_list'][1]['promotion_amount'])) {
@@ -466,7 +468,7 @@ class CartModel @@ -466,7 +468,7 @@ class CartModel
466 $result['salePrice'] = Helpers::transPrice($salePrice); 468 $result['salePrice'] = Helpers::transPrice($salePrice);
467 $result['price'] = Helpers::transPrice($price); 469 $result['price'] = Helpers::transPrice($price);
468 $result['freight'] = $freight; 470 $result['freight'] = $freight;
469 - $result['couponPrice'] = $couponPrice; 471 + $result['couponPrice'] = $couponPrice;*/
470 } 472 }
471 473
472 // 发票有关数据 474 // 发票有关数据