|
|
<!DOCTYPE html>
|
|
|
<html lang="en">
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<link rel="stylesheet" href="https://at.alicdn.com/t/font_834805_0ml90wdq5hzm.css">
|
|
|
<link rel="stylesheet" href="__INDEX__/css/base.css">
|
|
|
<link rel="stylesheet" href="__INDEX__/css/cart.css">
|
|
|
<link rel="stylesheet" href="__INDEX__/css/swiper.min.css">
|
|
|
<script type="text/javascript" src="__INDEX__/js/base.js" charset="utf-8"></script>
|
|
|
<title>购物车</title>
|
|
|
<style>
|
|
|
.one{
|
|
|
font-size: 0.39rem;
|
|
|
height:1.79rem;
|
|
|
line-height: 1.79rem;
|
|
|
}
|
|
|
.all{
|
|
|
font-size: 0.39rem;
|
|
|
height:0.5rem;
|
|
|
line-height: 0.5rem;
|
|
|
}
|
|
|
.icon-xuanzhong{
|
|
|
font-size: 0.39rem;
|
|
|
color: #FF0000;
|
|
|
}
|
|
|
.carlist{
|
|
|
padding-bottom: 2.6rem;
|
|
|
}
|
|
|
</style>
|
|
|
</head>
|
|
|
<body>
|
|
|
<!--弹出提醒-->
|
|
|
<div class="remindpop" style="display:none">
|
|
|
|
|
|
<p>您好,不同专区的商品</p>
|
|
|
<p>不可混合支付请重新选择</p>
|
|
|
|
|
|
</div>
|
|
|
<!--确认删除-->
|
|
|
<div class="deletewrap" style="display:none">
|
|
|
<div class="deletepop">
|
|
|
<p class="suredelete">确认删除</p>
|
|
|
<p class="certainornot">确定删除该商品吗?</p>
|
|
|
<div class="certain">
|
|
|
<p class="cancel">取消</p>
|
|
|
<p class="sure">确认</p>
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="container">
|
|
|
<!--购物车为空-->
|
|
|
<div class="nogood" style="display:none">
|
|
|
<p class="shopcar">您的购物车还没有商品</p>
|
|
|
<p class="see">
|
|
|
去逛逛
|
|
|
</p>
|
|
|
</div>
|
|
|
<div class="havegood" >
|
|
|
<!--<p class="status edit">编辑</p>-->
|
|
|
<p class="status delect">删除</p>
|
|
|
<!--<p class="status finish" style="display:none">完成</p>-->
|
|
|
<div class="carlist">
|
|
|
<foreach name="all" item="vo">
|
|
|
<div class="cart_text">
|
|
|
<p class="iconfont icon-not_Selected-copy one" data-id="{$vo.cartid}" data-price="{$vo.price}" data-num="{$vo.num}" style="font-size: 0.39rem"></p>
|
|
|
<p class="good_img"><img src="{:cmf_get_image_url($vo.thumb)}"></p>
|
|
|
<div class="good_content">
|
|
|
<p class="cart_name">
|
|
|
<if condition="mb_strlen($vo.name) gt 13">
|
|
|
{:mb_substr($vo.name,0,13)}...
|
|
|
<else>
|
|
|
{$vo.name}
|
|
|
</if>
|
|
|
</p>
|
|
|
<p class="cart_tast">
|
|
|
<if condition="$vo.caid eq 1">
|
|
|
<if condition="mb_strlen($vo.intro) gt 12">
|
|
|
{:mb_substr($vo.intro,0,12)}...
|
|
|
<else>
|
|
|
{$vo.intro}
|
|
|
</if>
|
|
|
<else>
|
|
|
<if condition="mb_strlen($vo.intro) gt 25">
|
|
|
{:mb_substr($vo.intro,0,25)}...
|
|
|
<else>
|
|
|
{$vo.intro}
|
|
|
</if>
|
|
|
</if>
|
|
|
|
|
|
</p>
|
|
|
<if condition="$vo.caid eq 1">
|
|
|
<p class="inter">购买可获得{$vo.price*2}积分</p>
|
|
|
</if>
|
|
|
<div class="addcart">
|
|
|
<p class="price">
|
|
|
¥{$vo.price}
|
|
|
<if condition="$vo.caid eq 3">
|
|
|
(积分)
|
|
|
</if>
|
|
|
</p>
|
|
|
<div class="add_cart_num">
|
|
|
<p class="reduce_num" data-id="{$vo.cartid}">
|
|
|
<img src="__INDEX__/img/minus.png">
|
|
|
</p>
|
|
|
<p class="num_num">{$vo.num}</p>
|
|
|
<p class="add_num" data-id="{$vo.cartid}">
|
|
|
<img src="__INDEX__/img/add.png">
|
|
|
</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</foreach>
|
|
|
|
|
|
</div>
|
|
|
<div class="balance">
|
|
|
<div class="select_all">
|
|
|
<p class="iconfont icon-not_Selected-copy all" ></p>
|
|
|
<p class="both">全选</p>
|
|
|
</div>
|
|
|
<div class="total_select">
|
|
|
<p class="total_balance">合计:</p>
|
|
|
<p class="total_calute"> ¥0</p>
|
|
|
</div>
|
|
|
<div class="settle">结算</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="foot">
|
|
|
<div class="home">
|
|
|
<p class="home_img">
|
|
|
<img src="__INDEX__/img/homegray.png" alt="">
|
|
|
</p>
|
|
|
<p class="home_page">首页</p>
|
|
|
</div>
|
|
|
<div class="shopcart">
|
|
|
<p class="shopcart_img">
|
|
|
<img src="__INDEX__/img/cartred.png" alt="">
|
|
|
</p>
|
|
|
<p class="shop_cart">
|
|
|
购物车
|
|
|
</p>
|
|
|
</div>
|
|
|
<div class="membercenter">
|
|
|
<p class="member_img">
|
|
|
<img src="__INDEX__/img/peoplegray.png" alt="">
|
|
|
</p>
|
|
|
<p class="member_center">
|
|
|
会员中心
|
|
|
</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</body>
|
|
|
<script src="__INDEX__/js/jquery.min.js"></script>
|
|
|
<script>
|
|
|
if ({$you}==1){
|
|
|
$('.nogood').css('display','block')
|
|
|
}
|
|
|
//购物车的数量
|
|
|
$(".add_num").click(function(){
|
|
|
var cartid=$(this).data('id')
|
|
|
var num=$(this).siblings(".num_num").text();
|
|
|
$.ajax({
|
|
|
url:"{:url('num')}",
|
|
|
type:"POST",
|
|
|
data:{id:cartid,state:2}
|
|
|
})
|
|
|
num++;
|
|
|
$(this).siblings(".num_num").html(num);
|
|
|
$(this).parent().parent().parent().siblings(".one").attr('data-num',num);
|
|
|
if ($(this).parent().parent().parent().siblings(".one").hasClass('icon-xuanzhong')){
|
|
|
sum();
|
|
|
}
|
|
|
})
|
|
|
$(".reduce_num").click(function(){
|
|
|
var cartid=$(this).data('id')
|
|
|
var num=$(this).siblings(".num_num").text();
|
|
|
if (num>1){
|
|
|
$.ajax({
|
|
|
url:"{:url('num')}",
|
|
|
type:"POST",
|
|
|
data:{id:cartid,state:1}
|
|
|
})
|
|
|
num--;
|
|
|
$(this).siblings(".num_num").html(num);
|
|
|
$(this).parent().parent().parent().siblings(".one").attr('data-num',num);
|
|
|
if ($(this).parent().parent().parent().siblings(".one").hasClass('icon-xuanzhong')){
|
|
|
sum();
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
//全选按钮
|
|
|
$(".all").click(function(){
|
|
|
var _this=$(this)
|
|
|
if (_this.hasClass('icon-not_Selected-copy')){
|
|
|
_this.removeClass('icon-not_Selected-copy')
|
|
|
_this.addClass('icon-xuanzhong')
|
|
|
$('.one').removeClass('icon-not_Selected-copy')
|
|
|
$('.one').addClass('icon-xuanzhong')
|
|
|
}else {
|
|
|
_this.removeClass('icon-xuanzhong')
|
|
|
_this.addClass('icon-not_Selected-copy')
|
|
|
$('.one').removeClass('icon-xuanzhong')
|
|
|
$('.one').addClass('icon-not_Selected-copy')
|
|
|
}
|
|
|
sum()
|
|
|
})
|
|
|
//单选按钮
|
|
|
$(".one").click(function(){
|
|
|
var _this=$(this)
|
|
|
if (_this.hasClass('icon-not_Selected-copy')){
|
|
|
_this.removeClass('icon-not_Selected-copy')
|
|
|
_this.addClass('icon-xuanzhong')
|
|
|
}else {
|
|
|
_this.removeClass('icon-xuanzhong')
|
|
|
_this.addClass('icon-not_Selected-copy')
|
|
|
}
|
|
|
var one=$('.one')
|
|
|
var len1=one.length
|
|
|
var len2=one.filter('.icon-xuanzhong').length
|
|
|
if (len1==len2){
|
|
|
$('.all').addClass('icon-xuanzhong')
|
|
|
$('.all').removeClass('icon-not_Selected-copy')
|
|
|
}else {
|
|
|
$('.all').addClass('icon-not_Selected-copy')
|
|
|
$('.all').removeClass('icon-xuanzhong')
|
|
|
}
|
|
|
sum()
|
|
|
})
|
|
|
|
|
|
//计算总价
|
|
|
function sum() {
|
|
|
var one=$('.one').filter('.icon-xuanzhong');
|
|
|
var sum=0;
|
|
|
for (i=0;i<one.length;i++){
|
|
|
sum+=one.eq(i).attr('data-num')*one.eq(i).data('price')
|
|
|
}
|
|
|
$('.total_calute').html('¥'+sum);
|
|
|
}
|
|
|
//删除
|
|
|
$(".delect").click(function(){
|
|
|
if ($('.one').filter('.icon-xuanzhong').length>0){
|
|
|
$(".deletewrap").show();
|
|
|
}
|
|
|
})
|
|
|
//确认删除
|
|
|
$(".sure").click(function(){
|
|
|
var one=$('.one').filter('.icon-xuanzhong');
|
|
|
id=[];
|
|
|
for (i=0;i<one.length;i++){
|
|
|
var ii=one.eq(i).data('id')
|
|
|
one.eq(i).parent().remove()
|
|
|
id.push(ii)
|
|
|
}
|
|
|
$.ajax({
|
|
|
url:"{:url('del')}",
|
|
|
type:"POST",
|
|
|
data:{id:id}
|
|
|
})
|
|
|
|
|
|
$(".deletewrap").hide();
|
|
|
});
|
|
|
//取消删除
|
|
|
$(".cancel").click(function(){
|
|
|
$(".deletewrap").hide();
|
|
|
})
|
|
|
//结算
|
|
|
$(".settle").click(function(){
|
|
|
var one=$('.one').filter('.icon-xuanzhong');
|
|
|
if (one.length>0){
|
|
|
data=[];
|
|
|
for (i=0;i<one.length;i++){
|
|
|
var ii=one.eq(i).attr('data-id')
|
|
|
var nm=one.eq(i).attr('data-num')
|
|
|
data.push([ii,nm])
|
|
|
}
|
|
|
$.ajax({
|
|
|
url:"{:url('')}",
|
|
|
type:'POST',
|
|
|
data:{data}
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
$(".home").click(function(){
|
|
|
window.location.href="{:url('index/index/index')}"
|
|
|
})
|
|
|
$(".membercenter").click(function(){
|
|
|
window.location.href="{:url('index/index/index')}"
|
|
|
})
|
|
|
</script>
|
|
|
</html> |
...
|
...
|
|