mui.init(); mui.ready(function() { getUserInfo(); mobile.getCartNum(); getNum(); getIntegral(); getMoney(); $('.icon-kefu-tianchong').parents('a').attr('href',mobile.getParam('customer')); $("#kefu").on("tap",function(e){ var html=[]; html.push('' + '电话:'+mobile.getParam('customer_tel')+''); mui.alert(html.join(""), '长按二维码联系客服'); }); $('.mui-bar-tab').on('tap', 'a', function(e) { location.href=$(this).attr("href"); }); $('.mui-table-view').on('tap', 'li', function(e) { if($(this).attr("data-url")){ location.href=$(this).attr("data-url"); } }); $('.mui-table').on('tap', '.mui-table-cell', function(e) { if($(this).attr("data-url")){ location.href=$(this).attr("data-url"); } }); }); //获取用户信息 function getUserInfo() { if(user.is_share=="1"){ $("#share-div").removeClass("mui-hidden"); } if(user.username){ $("#userName").html(user.username); }else{ $("#userName").html(user.nickname); } if(user.headimgurl){ $(".user-avatar").css("background-image","url("+user.headimgurl+")"); } } //获取各类型订单数量 function getNum() { mobile.ajaxPost(base + '/userOrder/getNum', {}, function(json) { if (json.data) { $.each(json.data, function(key, value) { if ($('#' + key)) { if (value != 0) { $('#' + key).html(value); $('#' + key).removeClass('mui-hidden'); } } }); } },""); } //获取积分 function getIntegral() { mobile.ajaxPost(base + '/userIntegral/getIntegral', {}, function(json) { $('#integral').html(json.data); },""); } //获取余额 function getMoney() { mobile.ajaxPost(base + '/userMoney/getMoney', {}, function(json) { $('#money').html("¥"+json.data); },""); }