作者 anyv
1 个管道 的构建 通过 耗费 0 秒

1

@@ -132,6 +132,41 @@ @@ -132,6 +132,41 @@
132 <script src="__TMPL__/public/assets/js/base.js"></script> 132 <script src="__TMPL__/public/assets/js/base.js"></script>
133 <script src="__TMPL__/public/assets/js/jquery.js"></script> 133 <script src="__TMPL__/public/assets/js/jquery.js"></script>
134 <script> 134 <script>
  135 + // 计算总计
  136 + function calcTotal() {
  137 + var checkBoxes = $(".sh_cartround img");
  138 + var priceSpans = $(".order_newsTxt3 .de_topTxt1_1 span");
  139 + var countInputs = $(".order_newsNum .order_newsnum");
  140 + var totalCount = 0;
  141 + var totalPrice = 0;
  142 + for (var i = 0; i < priceSpans.length; i += 1) {
  143 + // 强调: jQuery对象使用下标运算或get方法会还原成原生的JavaScript对象
  144 + if ($(checkBoxes[i]).attr("src") == "img/39.png") {
  145 + console.log($(checkBoxes[i]).attr("src"));
  146 + var price = parseFloat($(priceSpans[i]).text());
  147 + var count = parseInt($(countInputs[i]).val());
  148 + totalCount += count;
  149 + totalPrice += price * count;
  150 + }
  151 + }
  152 + $(".zoji span").html(totalPrice.toFixed(2));
  153 + }
  154 +
  155 + function calcTotal2() {
  156 + var checkBoxes = $(".sh_cartround img");
  157 + var priceSpans = $(".order_newsTxt3 .de_topTxt1_1 span");
  158 + var countInputs = $(".order_newsNum .order_newsnum");
  159 + var totalCount = 0;
  160 + var totalPrice = 0;
  161 + for (var i = 0; i < priceSpans.length; i += 1) {
  162 + // 强调: jQuery对象使用下标运算或get方法会还原成原生的JavaScript对象
  163 + var price = parseFloat($(priceSpans[i]).text());
  164 + var count = parseInt($(countInputs[i]).val());
  165 + totalCount += count;
  166 + totalPrice += price * count;
  167 + }
  168 + $(".zoji span").html(totalPrice.toFixed(2));
  169 + }
135 $(function() { 170 $(function() {
136 $(".order_newsNum div").on("click", function(evt) { 171 $(".order_newsNum div").on("click", function(evt) {
137 if ($(this).text() == "-") { 172 if ($(this).text() == "-") {
@@ -203,41 +238,6 @@ @@ -203,41 +238,6 @@
203 } 238 }
204 }); 239 });
205 }); 240 });
206 - // 计算总计  
207 - function calcTotal() {  
208 - var checkBoxes = $(".sh_cartround img");  
209 - var priceSpans = $(".order_newsTxt3 .de_topTxt1_1 span");  
210 - var countInputs = $(".order_newsNum .order_newsnum");  
211 - var totalCount = 0;  
212 - var totalPrice = 0;  
213 - for (var i = 0; i < priceSpans.length; i += 1) {  
214 - // 强调: jQuery对象使用下标运算或get方法会还原成原生的JavaScript对象  
215 - if ($(checkBoxes[i]).attr("src") == "img/39.png") {  
216 - console.log($(checkBoxes[i]).attr("src"));  
217 - var price = parseFloat($(priceSpans[i]).text());  
218 - var count = parseInt($(countInputs[i]).val());  
219 - totalCount += count;  
220 - totalPrice += price * count;  
221 - }  
222 - }  
223 - $(".zoji span").html(totalPrice.toFixed(2));  
224 - }  
225 -  
226 - function calcTotal2() {  
227 - var checkBoxes = $(".sh_cartround img");  
228 - var priceSpans = $(".order_newsTxt3 .de_topTxt1_1 span");  
229 - var countInputs = $(".order_newsNum .order_newsnum");  
230 - var totalCount = 0;  
231 - var totalPrice = 0;  
232 - for (var i = 0; i < priceSpans.length; i += 1) {  
233 - // 强调: jQuery对象使用下标运算或get方法会还原成原生的JavaScript对象  
234 - var price = parseFloat($(priceSpans[i]).text());  
235 - var count = parseInt($(countInputs[i]).val());  
236 - totalCount += count;  
237 - totalPrice += price * count;  
238 - }  
239 - $(".zoji span").html(totalPrice.toFixed(2));  
240 - }  
241 }); 241 });
242 </script> 242 </script>
243 </body> 243 </body>