diff --git a/htmls/logshoppingcar/shopcar.html b/htmls/logshoppingcar/shopcar.html
index abc8b13..2f4a615 100644
--- a/htmls/logshoppingcar/shopcar.html
+++ b/htmls/logshoppingcar/shopcar.html
@@ -73,10 +73,13 @@
全部商品(20)
+
@@ -226,101 +229,6 @@
// }
}
sixSwiper()
- //获取元素
- var ckAll = document.getElementById('ckAll');
- var cks = document.getElementsByName('ck');
- var trs = document.getElementsByClassName('inline');
- var allCount = document.getElementById('allCount');
- var allPrice = document.getElementById('allPrice');
- var countInput = document.getElementsByClassName('count-input');
- var accounts = document.getElementById("accounts");
- // 结算
- function accounts() {
- var sum = 0;
- }
- function accounts() {
- accounts.style.display = "block";
- alert("")
- accounts.innerHTML = str;
- }
- //计算总价
- function sumPrice() {
- var sum = 0;
- for (var i = 0; i < cks.length; i++) {
- if (cks[i].checked == true) {
- var p = Number(trs[i].children[4].innerHTML);
- sum += p;
- }
- }
- allPrice.innerHTML = sum.toFixed(2);
- }
- //计算每一行的总价
- function inlinePrice() {
- for (var i = 0; i < trs.length; i++) {
- //获取每一行单价
- var price = Number(trs[i].children[2].innerHTML);
- //获取数量
- var num = Number(trs[i].children[3].children[1].value);
- //小计
- trs[i].children[4].innerHTML = (price * num).toFixed(2);
-
- }
- }
- //数量增加
- function addCount(e) {
- var num = parseInt(e.previousElementSibling.value);
- // 最大数量
- if (num > 98) {
- alert("不能再多了");
- return;
- }
- //数量加1
- e.previousElementSibling.value = num + 1;
- inlinePrice();
- sumPrice();
- // sumCount();
- }
- //数量递减
- function reduceCount(e) {
- var num = parseInt(e.nextElementSibling.value);
- if (num <= 0) {
- alert("不能再减了");
- return;
- }
-
- e.nextElementSibling.value = num - 1;
- inlinePrice();
- sumPrice();
- // sumCount();
- }
- //全选和反选
- function checkAll() {
- for (var i = 0; i < cks.length; i++) {
- cks[i].checked = ckAll.checked;
- }
- sumPrice();
- // sumCount();
- }
- //复选框
- function check() {
- for (var i = 0; i < cks.length; i++) {
- if (cks[i].checked == false) {
- ckAll.checked = false;
- sumPrice();
- // sumCount();
- return;
- }
- }
- ckAll.checked = true;
- sumPrice();
- sumCount();
- }
- //单行删除
- function del(e) {
- e.parentElement.parentElement.remove();
- sumPrice();
- // sumCount();
- }