(item.order * item.price);
}
}
$('#fix-cart-num').html(cart_num);
$('#cart-price').html(cart_price);
if(cart_num>0){
$('#fix-cart-num').css('display','flex');
}else{
$('#fix-cart-num').hide();
}
if(cart_all_length==cart_selected_length){
var select_all = 1;
}else{
var select_all = 0;
}
cart_price = cart_price.toFixed(2);
app.setStorage('cart_data', cart_data, 86400);
$('[name=cart_data]').val(JSON.stringify(cart_data));
}
function cleanBuyedCard() {
for (var i in cart_data) {
var item = cart_data[i];
if (item && item.selected) {
delete cart_data[item.id];
}
}
countCartPrice();
}
countCartPrice();
$(document).ready(function() {
//首先将#btn隐藏
//当滚动条的位置处于距顶部50像素以下时,跳转链接出现,否则消失
$(function() {
$(window).scroll(function() {
if ($(window).scrollTop() > 100) {
$(".fix-content-box").css("height", "240px");
$(".fix-tool-box").css("height", "240px");
} else {
$(".fix-content-box").css("height", "180px");
$(".fix-tool-box").css("height", "180px");
}
});
//当点击跳转链接后,回到页面顶部位置
$("#to-top").click(function() {
$('body,html').animate({
scrollTop: 0
},
500);
return false;
});
});
});
$('.show-service').hover(function () {
layer.tips('
![](/images/kefu4.png?v=2)
', this, {
tips: 4, // 自定义样式,这里的示例是白色背景
time: 0 // 设置为0,不自动关闭
});
},
function () {
// 当鼠标移出元素时关闭 layer.tip
layer.closeAll('tips');
})
$('.qrcode-container .item').hover(function () {
var img = $(this).find('img').attr('src');
layer.tips('
![]('+img+')
', this, {
tips: [3,'#f2f3f5'], // 自定义样式,这里的示例是白色背景
time: 0 // 设置为0,不自动关闭
});
},
function () {
// 当鼠标移出元素时关闭 layer.tip
layer.closeAll('tips');
})
$('.live-icon').hover(function () {
var img = '/images/live_qrcode.png';
layer.tips('
![]('+img+')
', this, {
tips: [2,'#f2f3f5'], // 自定义样式,这里的示例是白色背景
time: 0 // 设置为0,不自动关闭
});
},
function () {
// 当鼠标移出元素时关闭 layer.tip
layer.closeAll('tips');
})
$('.ajax-get').click(function(){
var target;
var that = this;
if ( $(this).hasClass('confirm') ) {
if(!confirm('确认要执行该操作吗?')){
return false;
}
}
if ( (target = $(this).attr('href')) || (target = $(this).attr('url')) ) {
$.get(target).success(function(data){
if (data.status==1) {
notify.success(data.info,function (){
if (data.url) {
location.href=data.url;
}
});
}else{
notify.error(data.info,function (){
if (data.url) {
location.href=data.url;
}
});
}
});
}
return false;
})
var listPicZoom = $('
![]()
');
$('body').append(listPicZoom);
$('.list_img111').hover(function(){
var left = $(this).offset().left+50;
var top = $(this).offset().top-225;
$('img',listPicZoom).attr('src',$(this).attr('src'));
listPicZoom.css({left:left,top:top}).show();
},
function(){
listPicZoom.hide();
$('img',listPicZoom).attr('src','');
})
$('.action-confirm').click(function(){
var that = $(this);
var alert_tip = that.data('alert_tip');
if(!alert_tip){
alert_tip = "确认要执行"+that.text()+"操作吗?";
}
if(window.confirm(alert_tip)){
$.get($(this).attr('href'),function(data){
if(data.status==1){
if(that.hasClass('show-result')){
notify.success(data.info,function (){
location.reload(true);
});
}else{
location.reload(true);
}
}else{
notify.error(data.info || '该数据无法删除');
}
},'json');
return false;
}else{
return false;
}
})
$('.need-login').click(function (){
var that = $(this);
var href = $(this).attr('href');
if(!member_uid){
layer.confirm('您还没有登录,是否登录?', {
}, function(){
app.setStorage('back_page',href,300);
location.href = 'https://qdpm123.com/index.php?s=/Home/Index/login.html';
});
}else{
location.href = href;
}
return false;
})
var clipboard = new ClipboardJS('.list_copy_link');
clipboard.on('success', function(e) {
notify.success('复制成功!,请粘贴使用');
e.clearSelection();
});
$('.image-box').viewer();
function collect(that,goods_id,goods_type){
if(!member_uid){
layer.confirm('您还没有登录,是否登录?', {
}, function(){
app.setStorage('back_page',location.href,300);
location.href = 'https://qdpm123.com/index.php?s=/Home/Index/login.html';
});
return false;
}
$.post('https://qdpm123.com/index.php?s=/Home/Index/collect.html', {goods_id,goods_type}, function (data) {
if (data.status == 1) {
if(data.info.collected==1){
$(that).html('
已关注
')
}else{
$(that).html('
关注
')
}
} else {
notify.error(data.info);
}
})
return false;
}