本项目是关于 百雀羚 手机商城的 App 产品研发模块界面。 如果有需要的小伙伴可以 下载使用阅读 使用框架是 FaceStrap工作室 自主研发的FaceUI 前端框架 FaceCSS
以下是购物车模块代码的JS 实现方式GE1C
var q = “\u60a8\u786e\u5b9a\u8981\u628a\u6b64\u5e97\u6240\u6709\u7684\u5546\u54c1\u4ece\u8d2d\u7269\u8f66\u5220\u9664\u5417?”,
w = “\u786e\u8ba4\u5220\u9664?”,
e = “\u5220\u9664\u6210\u529f!”,
r = “\u53d6\u6d88\u64cd\u4f5c!”,
t = “\u60a8\u786e\u5b9a\u8981\u628a\u6b64\u5e97\u8be5\u5546\u54c1\u4ece\u8d2d\u7269\u8f66\u5220\u9664\u5417?”,
y = “\u8bf7\u9009\u4e2d\u5546\u54c1!”;
(function() {
function b() {
var a = 0;
(function() { function b() { var a = 0;
(“.shop-group-item”).each(function() {
var b = 0,
c = 0;
(this).find(“.goodsCheck”).each(function() {
if($(this).is(“:checked”)) {
var a = parseInt($(this).parents(“.shop-info”).find(“.num”).text());
console.log(a);
var d = parseFloat($(this).parents(“.shop-info”).find(“.price”).text());
b += d * a;
c += a;
$(“#cartnumberall”).text(c);
$(“#cartnumberalls”).text(c)
}
$(this).closest(“.shop-group-item”).find(“.ShopTotal”).text(b.toFixed(2))
});
var f = parseFloat(
(this).find(“.goodsCheck”).each(function() { if($(this).is(“:checked”)) { var a = parseInt($(this).parents(“.shop-info”).find(“.num”).text()); console.log(a); var d = parseFloat($(this).parents(“.shop-info”).find(“.price”).text()); b += d * a; c += a; $(“#cartnumberall”).text(c); $(“#cartnumberalls”).text(c) } $(this).closest(“.shop-group-item”).find(“.ShopTotal”).text(b.toFixed(2)) }); var f = parseFloat(
(this).find(“.ShopTotal”).text());
a += f
});
(“#AllTotal”).text(a.toFixed(2))
}
(“#AllTotal”).text(a.toFixed(2)) }
(“#s-h-admin”).click(function() {
(this).hide();
(
t
h
i
s
)
.
h
i
d
e
(
)
;
(“#s-h-complete”).show();
(“.shop-group-item-delete”).show()
});
(“.shop-group-item-delete”).show() });
(“#s-h-complete”).click(function() {
(this).hide();
(
t
h
i
s
)
.
h
i
d
e
(
)
;
(“#s-h-admin”).show();
(“.shop-group-item-delete”).hide()
});
(“.shop-group-item-delete”).hide() });
(document).on(“click”, “#s-h-delete”, function() {
1 ==
(".shopCheck").prop("checked")?(
(
"
.
s
h
o
p
C
h
e
c
k
"
)
.
p
r
o
p
(
"
c
h
e
c
k
e
d
"
)
?
(
(this).parents(“.shop-group-item”).find(“.goods-check”).prop(“checked”, !0),
(this).length==
(
t
h
i
s
)
.
l
e
n
g
t
h
==
(“.shopCheck:checked”).length ?
.confirm(q,w,function()$.toast(e),function()):(
.
c
o
n
f
i
r
m
(
q
,
w
,
f
u
n
c
t
i
o
n
(
)
$
.
t
o
a
s
t
(
e
)
,
f
u
n
c
t
i
o
n
(
)
)
:
(
("#AllCheck").prop("checked", !1),
.toast(r))):1==
.
t
o
a
s
t
(
r
)
)
)
:
1
==
(".goodsCheck").prop("checked") ?
.confirm(t,w,function()$.toast(e),function()):(
.
c
o
n
f
i
r
m
(
t
,
w
,
f
u
n
c
t
i
o
n
(
)
$
.
t
o
a
s
t
(
e
)
,
f
u
n
c
t
i
o
n
(
)
)
:
(
("#AllCheck").prop("checked", !1), .toast(y))
});
.toast(y)) });
(“.minus”).click(function() {
var a = (this).parent().find(“.num”);
a.text(parseInt(a.text()) - 1);
1 >= a.text() && a.text(1);
b()
});
(this).parent().find(“.num”); a.text(parseInt(a.text()) - 1); 1 >= a.text() && a.text(1); b() });
(“.plus”).click(function() {
var a = (this).parent().find(“.num”);
a.text(parseInt(a.text()) + 1);
1 >= a.text() && a.text(1);
b()
});
(this).parent().find(“.num”); a.text(parseInt(a.text()) + 1); 1 >= a.text() && a.text(1); b() });
(“.goodsCheck”).click(function() {
var a =
(this).closest(“.shop−group−item”).find(“.goodsCheck”),d=
(
t
h
i
s
)
.
c
l
o
s
e
s
t
(
“
.
s
h
o
p
−
g
r
o
u
p
−
i
t
e
m
”
)
.
f
i
n
d
(
“
.
g
o
o
d
s
C
h
e
c
k
”
)
,
d
=
(this).closest(“.shop-group-item”).find(“.goodsCheck:checked”),
c =
(this).closest(“.shop−group−item”).find(“.shopCheck”);a.length==d.length?(c.prop(“checked”,!0),
(
t
h
i
s
)
.
c
l
o
s
e
s
t
(
“
.
s
h
o
p
−
g
r
o
u
p
−
i
t
e
m
”
)
.
f
i
n
d
(
“
.
s
h
o
p
C
h
e
c
k
”
)
;
a
.
l
e
n
g
t
h
==
d
.
l
e
n
g
t
h
?
(
c
.
p
r
o
p
(
“
c
h
e
c
k
e
d
”
,
!
0
)
,
(".shopCheck").length ==
(“.shopCheck:checked”).length?
(
“
.
s
h
o
p
C
h
e
c
k
:
c
h
e
c
k
e
d
”
)
.
l
e
n
g
t
h
?
("#AllCheck").prop("checked", !0) : (“#AllCheck”).prop(“checked”, !1)) : (c.prop(“checked”, !1),
(“#AllCheck”).prop(“checked”, !1)) : (c.prop(“checked”, !1),
(“#AllCheck”).prop(“checked”, !1));
b()
});
(“.shopCheck”).click(function() {
1 == $(this).prop("checked") ? ($(this).parents(“.shop-group-item”).find(“.goods-check”).prop(“checked”, !0), $(“.shopCheck”).length ==
$(".shopCheck:checked").length ? $(“#AllCheck”).prop(“checked”, !0) : $("#AllCheck").prop("checked", !1)) : ($(this).parents(“.shop-group-item”).find(“.goods-check”).prop(“checked”, !1), $(“#AllCheck”).prop(“checked”, !1));
b()
});
(“.shopCheck”).click(function() { 1 == $(this).prop("checked") ? ($(this).parents(“.shop-group-item”).find(“.goods-check”).prop(“checked”, !0), $(“.shopCheck”).length == $(".shopCheck:checked").length ? $(“#AllCheck”).prop(“checked”, !0) : $("#AllCheck").prop("checked", !1)) : ($(this).parents(“.shop-group-item”).find(“.goods-check”).prop(“checked”, !1), $(“#AllCheck”).prop(“checked”, !1)); b() });
(“#AllCheck”).click(function() {
1 ==
(this).prop("checked")?
(
t
h
i
s
)
.
p
r
o
p
(
"
c
h
e
c
k
e
d
"
)
?
(“.goods-check”).prop(“checked”, !0) :
(“.goods−check”).prop(“checked”,!1);b();
(
“
.
g
o
o
d
s
−
c
h
e
c
k
”
)
.
p
r
o
p
(
“
c
h
e
c
k
e
d
”
,
!
1
)
;
b
(
)
;
(“.shopCheck”).change()
})
});
百度云的下载链接链接:链接:https://pan.baidu.com/s/1JR7npoHlDOxROzSDoMtCEQ 密码: 可以在CSDN博客查看我添加方式 或者底部下方留言、发送给你们。 借鉴参考学习