|
@@ -16,7 +16,11 @@
|
|
|
<footer class="mui-bar mui-bar-tab">
|
|
|
<ul class="mui-table-view mui-table-view-striped mui-table-view-condensed my-grid-view-no">
|
|
|
<li class="mui-table-view-cell">
|
|
|
- <div class="mui-table"><div class="mui-table-cell mui-col-xs-4 table-middle add-gouwuche ico-gouwuche"><span class="iconfont icon-gouwuche"></span></div><div class="mui-table-cell mui-col-xs-8 table-middle div-btn-buy-know">立即购买</div></div>
|
|
|
+ <div class="mui-table">
|
|
|
+ <div class="mui-table-cell mui-col-xs-4 table-middle go-index"><img style="width: 60%;vertical-align: middle;" src="images/logo.png" /></div>
|
|
|
+ <div class="mui-table-cell mui-col-xs-4 table-middle add-gouwuche" style="background-color: #ccc;color: #fff;font-size: 18px;">加入购物车</div>
|
|
|
+ <div class="mui-table-cell mui-col-xs-4 table-middle div-btn-buy-know">立即购买</div>
|
|
|
+ </div>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</footer>
|
|
@@ -80,6 +84,10 @@
|
|
|
</li>-->
|
|
|
</ul>
|
|
|
</div>
|
|
|
+ <div class="fixed-cart">
|
|
|
+ <span class="iconfont icon-gouwuche"></span>
|
|
|
+ <span class="mui-badge my-badge-danger">0</span>
|
|
|
+ </div>
|
|
|
<!-- 加载ing -->
|
|
|
<div class="loading covers">
|
|
|
<div class="loading-bj"></div>
|
|
@@ -163,6 +171,7 @@
|
|
|
+zen+'</br>'
|
|
|
+'<a><img class="mui-media-object" src="'+ productInfo.productIntroduceImg +'"></a>';
|
|
|
table.appendChild(li);
|
|
|
+ getCartNumber();//获取购物车数量
|
|
|
fenxiang();
|
|
|
$(".loading").hide().css("opacity", "0");
|
|
|
} else {
|
|
@@ -213,6 +222,7 @@
|
|
|
} else {
|
|
|
if(dt.status) {
|
|
|
th.parent().attr("cartid", dt.data);
|
|
|
+ getCartNumber()
|
|
|
console.log("增加数量成功!");
|
|
|
} else {
|
|
|
mui.alert("增加数量失败!");
|
|
@@ -260,6 +270,7 @@
|
|
|
} else {
|
|
|
if(dt.status) {
|
|
|
console.log("减少数量数量成功!");
|
|
|
+ getCartNumber()
|
|
|
} else {
|
|
|
mui.alert("减少数量数量失败!");
|
|
|
}
|
|
@@ -317,7 +328,7 @@
|
|
|
if(count > 0) {
|
|
|
$(".my-btn-buy-know").removeAttr("disabled"); //激活结算按钮
|
|
|
}
|
|
|
- if(th.hasClass("ico-gouwuche")) {
|
|
|
+ if(th.hasClass("add-gouwuche")) {
|
|
|
$(".my-btn-buy-know").attr("cart", "cart");
|
|
|
}
|
|
|
mui(".mui-numbox").numbox(); //激活加减按钮组合
|
|
@@ -370,6 +381,44 @@
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+ $(document).on('tap', '.go-index', function() {
|
|
|
+ location.href='index.html';
|
|
|
+ });
|
|
|
+ $(document).on('tap', '.fixed-cart', function() {
|
|
|
+ location.href='shopping-cart.html';
|
|
|
+ });
|
|
|
+ //获取购物车数量
|
|
|
+ function getCartNumber(){
|
|
|
+ $.ajax(base_path + '/wechat/cart/getCartNumByCartOpenId?dates=' + new Date().getTime(), {
|
|
|
+ data: {},
|
|
|
+ dataType: 'json',
|
|
|
+ xhrFields: {
|
|
|
+ withCredentials: true
|
|
|
+ },
|
|
|
+ crossDomain: true,
|
|
|
+ type: 'get',
|
|
|
+ timeout: 15000,
|
|
|
+ success: function(dt) {
|
|
|
+ if(dt.isRedirect) {
|
|
|
+ location.href = dt.redirectURL;
|
|
|
+ } else {
|
|
|
+ if(dt.status) {
|
|
|
+ if(dt.data>0){
|
|
|
+ $(".fixed-cart .my-badge-danger").text(dt.data).show();
|
|
|
+ }else{
|
|
|
+ $(".fixed-cart .my-badge-danger").text(dt.data).hide();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ mui.alert("获取购物车数量失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function(xhr, type, errorThrown) {
|
|
|
+ console.log(xhr);
|
|
|
+ mui.alert("获取购物车数量失败!网络错误");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
//分享
|
|
|
function fenxiang(){
|
|
|
var src = location.href;
|