@ -24,93 +24,49 @@
< div class = " cart_list " >
<!-- 商品列表 - s -->
< div class = " sc_list " id = " cart_list_13 " >
< ? php if ( $list ){ foreach ( $list as $k => $v ){ ?>
< div class = " sc_list " id = " cart_list_<?php echo $v['id'] ; ?> " >
< div class = " radio-img " >
< div class = " radio fl " >
<!-- 商品勾选按钮 -->
< span onclick = " checkGoods(this) " class = " che " >
< i >
< input name = " checkItem " type = " checkbox " style = " display:none; " value = " 13 " >
< input name = " checkItem " type = " checkbox " style = " display:none; " data - goods - id = " <?php echo $v['goods_id'] ; ?> " >
</ i >
</ span >
</ div >
< div class = " shopimg fl " >
< a href = " /index.php/Mobile/Goods/goodsInfo/id/135.html " >
<!-- 商品图片 -->
< img src = " <?php echo env('APP_URL'); ?>/images/weixin/goods_thumb_135_200_200.jpeg " >
< a href = " <?php echo $v['goods_detail_url'] ; ?> " >
< img src = " <?php echo $v['litpic'] ; ?> " >
</ a >
</ div >
</ div >
< div class = " deleshow " >
< div class = " deletes " >
<!-- 商品名 -->
< p class = " tit " > 重庆电信手机卡电话卡语音卡选靓号3G4G卡内部5折卡低资费(飞) </ p >
< p class = " tit " >< ? php echo $v [ 'title' ]; ?> </p>
<!-- 删除按钮 -->
< a href = " javascript:void(0); " class = " delescj deleteGoods " data - cart - id = " 13 " >< img src = " <?php echo env('APP_URL'); ?>/images/weixin/dele.png " ></ a >
< a href = " javascript:void(0); " class = " delescj deleteGoods " data - cart - id = " <?php echo $v['id'] ; ?> " >< img src = " <?php echo env('APP_URL'); ?>/images/weixin/dele.png " ></ a >
</ div >
<!-- 商品属性,规格 -->
< p class = " weight " > 合约套餐 : 乐享4G套餐59元 </ p >
< p class = " weight " ></ p >
< div class = " prices " >
< p class = " sc_pri fl " >
<!-- 商品单价 -->
< span > ¥ </ span >< span > 54.28 </ span >
< span > ¥ </ span >< span id = " goods_price<?php echo $v['goods_id'] ; ?> " >< ? php echo $v [ 'final_price' ]; ?> </span>
</ p >
<!-- 加减数量 -->
< div class = " plus fr get_mp " >
< span class = " mp_minous disable " >-</ span >
< span class = " mp_mp " >
< input name = " changeQuantity_13 " type = " text " id = " changeQuantity_13 " value = " 1 " onkeyup = " this.value=this.value.replace(/[^ \ d]/g,'') " class = " input-num " >
</ span >
< span class = " mp_plus " >+</ span >
</ div >
</ div >
</ div >
</ div >
<!-- 商品列表 - e -->
<!-- 商品列表 - s -->
< div class = " sc_list " id = " cart_list_13 " >
< div class = " radio-img " >
< div class = " radio fl " >
<!-- 商品勾选按钮 -->
< span onclick = " checkGoods(this) " class = " che " >
< i >
< input name = " checkItem " type = " checkbox " style = " display:none; " value = " 13 " >
</ i >
</ span >
</ div >
< div class = " shopimg fl " >
< a href = " /index.php/Mobile/Goods/goodsInfo/id/135.html " >
<!-- 商品图片 -->
< img src = " <?php echo env('APP_URL'); ?>/images/weixin/goods_thumb_135_200_200.jpeg " >
</ a >
</ div >
</ div >
< div class = " deleshow " >
< div class = " deletes " >
<!-- 商品名 -->
< p class = " tit " > 重庆电信手机卡电话卡语音卡选靓号3G4G卡内部5折卡低资费(飞) </ p >
<!-- 删除按钮 -->
< a href = " javascript:void(0); " class = " delescj deleteGoods " data - cart - id = " 13 " >< img src = " <?php echo env('APP_URL'); ?>/images/weixin/dele.png " ></ a >
</ div >
<!-- 商品属性,规格 -->
< p class = " weight " > 合约套餐 : 乐享4G套餐59元 </ p >
< div class = " prices " >
< p class = " sc_pri fl " >
<!-- 商品单价 -->
< span > ¥ </ span >< span > 54.28 </ span >
</ p >
<!-- 加减数量 -->
< div class = " plus fr get_mp " >
< span class = " mp_minous disable " >-</ span >
< span class = " mp_mp " >
< input name = " changeQuantity_13 " type = " text " id = " changeQuantity_13 " value = " 1 " onkeyup = " this.value=this.value.replace(/[^ \ d]/g,'') " class = " input-num " >
</ span >
< span class = " mp_plus " >+</ span >
< span class = " mp_minous " onClick = " change_goods_number(1,<?php echo $v['goods_id'] ; ?>) " >-</ span >
< span class = " mp_mp " >< input name = " goods_number<?php echo $v['goods_id'] ; ?> " type = " text " id = " goods_number<?php echo $v['goods_id'] ; ?> " value = " <?php echo $v['goods_number'] ; ?> " onkeyup = " this.value=this.value.replace(/[^ \ d]/g,'') " autocomplete = " off " value = " 1 " onblur = " change_goods_number(2,<?php echo $v['goods_id'] ; ?>) " class = " input-num " ></ span >
< span class = " mp_plus " onClick = " change_goods_number(3,<?php echo $v['goods_id'] ; ?>) " >+</ span >
</ div >
</ div >
</ div >
</ div >
< ? php }} ?>
<!-- 商品列表 - e -->
<!-- 提交栏 - s -->
< div class = " foohi foohiext " >
< div class = " payit ma-to-20 payallb " >
@ -124,25 +80,20 @@
< a href = " javascript:void(0); " onclick = " cart_submit(); " > 去结算 </ a >
</ div >
< div class = " youbia " >
< p >< span class = " pmo " > 总计: </ span >< span > ¥ </ span >< span id = " total_fee " > 919.08 </ span ></ p >
< p >< span class = " pmo " > 总计: </ span >< span > ¥ </ span >< span id = " total_fee " > 0 </ span ></ p >
</ div >
</ div >
</ div >
<!-- 提交栏 - e -->
< script type = " text/javascript " >
$ ( document ) . ready ( function (){
initDecrement ();
initCheckBox ();
});
</ script >
</ div >
< ? php if ( ! $list ){ ?>
<!-- 购物车没有商品 - start -->
< div class = " cart_list " >
< div class = " nonenothing " >
< img src = " <?php echo env('APP_URL'); ?>/images/weixin/nothing.png " >
< p > 购物车暂无商品 </ p >
< a href = " /index.php/Mobile/Index/index.html " > 去逛逛 </ a >
< a href = " <?php echo route('weixin'); ?> " > 去逛逛 </ a >
</ div >
</ div >
< br >< br >
@ -155,15 +106,139 @@
</ div >
< div class = " likeshop " >
< ul class = " goods_list " >
< li >< a href = " detail.html " >< img alt = " 1 " src = " images/weixin/goods_thumb_400_400.jpeg " >< div class = " goods_info " >< p class = " goods_tit " > 美女真空凸点诱惑 </ p >< div class = " goods_price " > ¥ < b > 100.00 </ b ></ div ></ div ></ a ></ li >
< li >< a href = " detail.html " >< img alt = " 2 " src = " images/weixin/goods_thumb_400_400.jpeg " >< div class = " goods_info " >< p class = " goods_tit " > 性感小骚货在床上 </ p >< div class = " goods_price " > ¥ < b > 100.00 </ b ></ div ></ div ></ a ></ li >
< li >< a href = " detail.html " >< img alt = " 3 " src = " images/weixin/goods_thumb_400_400.jpeg " >< div class = " goods_info " >< p class = " goods_tit " > 小野猫嫩模大尺度写真 </ p >< div class = " goods_price " > ¥ < b > 100.00 </ b ></ div ></ div ></ a ></ li >
< li >< a href = " detail.html " >< img alt = " 4 " src = " images/weixin/goods_thumb_400_400.jpeg " >< div class = " goods_info " >< p class = " goods_tit " > 韩国嫩模的逆天身材 </ p >< div class = " goods_price " > ¥ < b > 100.00 </ b ></ div ></ div ></ a ></ li >
< li >< a href = " detail.html " >< img alt = " 5 " src = " images/weixin/goods_thumb_400_400.jpeg " >< div class = " goods_info " >< p class = " goods_tit " > 推女郎林夕图片 </ p >< div class = " goods_price " > ¥ < b > 100.00 </ b ></ div ></ div ></ a ></ li >
< li >< a href = " detail.html " >< img alt = " 6 " src = " images/weixin/goods_thumb_400_400.jpeg " >< div class = " goods_info " >< p class = " goods_tit " > 性感闺蜜艺术照 </ p >< div class = " goods_price " > ¥ < b > 100.00 </ b ></ div ></ div ></ a ></ li >
< ? php if ( $like_goods_list ){ foreach ( $like_goods_list as $k => $v ){ ?>
< li >< a href = " <?php echo $v['goods_detail_url'] ; ?> " >< img alt = " <?php echo $v['title'] ; ?> " src = " <?php echo $v['litpic'] ; ?> " >< div class = " goods_info " >< p class = " goods_tit " >< ? php echo $v [ 'title' ]; ?> </p><div class="goods_price">¥<b><?php echo $v['price']; ?></b></div></div></a></li>
< ? php }} ?>
</ ul >
</ div >
</ div >
<!-- 购物车没有商品 - end -->
< ? php } ?>
< br >< br >
< script type = " text/javascript " src = " <?php echo env('APP_URL'); ?>/js/layer/mobile/layer.js " ></ script >
< script >
function change_goods_number ( type , id )
{
var goods_number = document . getElementById ( 'goods_number' + id ) . value ;
if ( type != 2 )
{
var goods_number = document . getElementById ( 'goods_number' + id ) . value ;
document . getElementById ( 'goods_number' + id ) . value = goods_number ;
}
if ( type == 1 ){ goods_number -- ;}
if ( type == 3 ){ goods_number ++ ;}
if ( goods_number <= 0 ){ goods_number = 1 ;}
if ( !/^ [ 0 - 9 ] * $ /. test ( goods_number )){ goods_number = document . getElementById ( 'goods_number' + id ) . value ;}
document . getElementById ( 'goods_number' + id ) . value = goods_number ;
var access_token = '<?php echo $_SESSION[' weixin_user_info '][' access_token ']; ?>' ;
var url = '<?php echo env(' APP_API_URL ').' / cart_add '; ?>' ;
$ . post ( url ,{ access_token : access_token , goods_id : id , goods_number : goods_number }, function ( res )
{
if ( res . code == 0 )
{
changeCartTotalPrice ();
}
else if ( res . msg != '' )
{
//提示
layer . open ({
content : '姓名不能为空'
, skin : 'msg'
, time : 2 //2秒后自动关闭
});
var goods_number = document . getElementById ( 'goods_number' + id ) . value ;
document . getElementById ( 'goods_number' + id ) . value = goods_number ;
}
}, 'json' );
}
//删除购物车商品
$ ( function () {
//删除购物车商品事件
$ ( document ) . on ( " click " , '.deleteGoods' , function ( e ) {
var access_token = '<?php echo $_SESSION[' weixin_user_info '][' access_token ']; ?>' ;
var cart_ids = new Array ();
cart_ids . push ( $ ( this ) . attr ( 'data-cart-id' ));
layer . open ({
content : '确定要删除此商品吗'
, btn : [ '确定' , '取消' ]
, yes : function ( index ){
layer . close ( index );
$ . ajax ({
type : " POST " ,
url : " <?php echo env('APP_API_URL').'/cart_delete'; ?> " ,
dataType : 'json' ,
data : { access_token : access_token , id : cart_ids },
success : function ( res ){
layer . open ({
content : res . msg
, skin : 'msg'
, time : 2 //2秒后自动关闭
});
window . location . reload ();
}
});
}
});
})
});
//勾选商品
function checkGoods ( obj )
{
if ( $ ( obj ) . hasClass ( 'check_t' ))
{
//改变颜色
$ ( obj ) . removeClass ( 'check_t' );
//取消选中
$ ( obj ) . find ( 'input' ) . attr ( 'checked' , false );
}
else
{
//改变颜色
$ ( obj ) . addClass ( 'check_t' );
//勾选选中
$ ( obj ) . find ( 'input' ) . attr ( 'checked' , true );
}
//选中全选多选框
if ( $ ( obj ) . hasClass ( 'checkFull' ))
{
if ( $ ( obj ) . hasClass ( 'check_t' ))
{
$ ( " .che " ) . each ( function ( i , o ){
$ ( this ) . addClass ( 'check_t' );
$ ( this ) . find ( 'input' ) . attr ( 'checked' , true );
});
}
else
{
$ ( " .che " ) . each ( function ( i , o ){
$ ( this ) . removeClass ( 'check_t' );
$ ( this ) . find ( 'input' ) . attr ( 'checked' , false );
});
}
}
changeCartTotalPrice ();
}
//修改选中商品总价
function changeCartTotalPrice ()
{
var total_price = 0 ;
$ ( '[name="checkItem"][checked]' ) . each ( function (){
var goods_id = $ ( this ) . attr ( 'data-goods-id' );
total_price = total_price + $ ( '#goods_number' + goods_id ) . val () * $ ( '#goods_price' + goods_id ) . text ();
});
$ ( '#total_fee' ) . text ( total_price );
}
</ script >
</ body ></ html >