|
@@ -508,7 +508,7 @@
|
|
|
<li class="add-buycar" style="width: 2.2rem">加入购物车</li>
|
|
|
<li style="width: 1rem;" class="go-buycar">
|
|
|
<img src="../../image/goods_buy_car.png" />
|
|
|
- <span class="msg-total mask-hidden" style="position: absolute;transform: translateY(75%) translateX(-37%);animation: bounceOut 2s;">10</span>
|
|
|
+ <span class="msg-total mask-hidden" style="position: absolute;transform: translateY(75%) translateX(-37%);animation: bounceOut 2s;">0</span>
|
|
|
</li>
|
|
|
<li style="width: 1rem;" class="add-favorite"><img id="favorite" src="../../image/goods_buy_favorite.png" /></li>
|
|
|
<li style="width: 1rem;" class="go-home"><img src="../../image/goods_buy_home.png" /></li>
|
|
@@ -546,16 +546,19 @@ var imgUrl="";
|
|
|
apiready = function() {
|
|
|
_keyid = api.pageParam.keyid;
|
|
|
_storeid = api.pageParam.storeid;
|
|
|
- // _spot = api.pageParam.spot;
|
|
|
setIosTopBar();
|
|
|
getRouteData(_keyid, _storeid);
|
|
|
- // chkfavorite();
|
|
|
getfeed();
|
|
|
api.addEventListener({
|
|
|
name: 'longpress'
|
|
|
}, function(ret, err) {
|
|
|
save_img();
|
|
|
});
|
|
|
+ api.addEventListener({
|
|
|
+ name: 'viewappear'
|
|
|
+ }, function(ret, err) {
|
|
|
+ // getRouteData(_keyid, _storeid);
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
function getRouteData(_keyid, _storeid) {
|
|
@@ -589,7 +592,6 @@ function getRouteData(_keyid, _storeid) {
|
|
|
$("#goods-content").html('<p></p>'+datas.data.goods_body);
|
|
|
$("#goods-issue").html(datas.data.issue);
|
|
|
if ( datas.data.cart > 0 ) {//调用赋值给购物车数量方法
|
|
|
- // getCar();
|
|
|
$(".msg-total").html(datas.data.cart);
|
|
|
$(".msg-total").removeClass("mask-hidden");
|
|
|
}
|
|
@@ -717,7 +719,6 @@ $(function() {
|
|
|
}
|
|
|
$("img").click(function() {
|
|
|
var index = $('img').index(this);
|
|
|
- // imagePreview(src[index],src);
|
|
|
});
|
|
|
})
|
|
|
|
|
@@ -809,15 +810,9 @@ function spec_map_check(goods_list, spec_map, line, key, checked_list) {
|
|
|
|
|
|
|
|
|
$(".home-ads").on("tap", "img", function() {
|
|
|
- // console.log($(this).attr("src"));
|
|
|
gallery_qz($(this).attr("src"));
|
|
|
});
|
|
|
-// $(".feed-list").on("tap", "img", function() {
|
|
|
-// // console.log($(this).attr("src"));
|
|
|
-// gallery_qz($(this).attr("src"));
|
|
|
-// });
|
|
|
$(".goods-content").on("tap", "img", function() {
|
|
|
- // console.log($(this).attr("src"));
|
|
|
gallery_qz($(this).attr("src"));
|
|
|
});
|
|
|
|
|
@@ -1033,9 +1028,6 @@ $(".goods-size-item").on("tap", ".goods-tag", function() {
|
|
|
_size_item.push(_item);
|
|
|
}
|
|
|
})
|
|
|
- // console.log(_sku_spec_map_index)
|
|
|
- // console.log(_sku_spec_map[_sku_spec_map_index])
|
|
|
- // console.log(_sku_data[_sku_spec_map[_sku_spec_map_index]].spec_img)
|
|
|
set_checked_list();
|
|
|
if (_size_item.length == $(".size-item").length) {
|
|
|
_single_price = _sku_data[_sku_spec_map[_sku_spec_map_index]].goods_price;//$(this).attr("spec_goods_price");
|
|
@@ -1259,8 +1251,10 @@ $(".add-buycar").on("tap", function() {
|
|
|
type: 'post',
|
|
|
success: function(datas) {
|
|
|
if (datas.result) {
|
|
|
+ $(".msg-total").show();
|
|
|
$(".msg-total").css("animation", "bounceOut 2s");
|
|
|
var num_car = $(".msg-total").html()*1 + $("#buy-num").val()*1;
|
|
|
+ console.log(num_car);
|
|
|
$(".msg-total").removeClass("mask-hidden");
|
|
|
$(".msg-total").html(num_car);
|
|
|
api.toast({ msg: datas.msg });
|
|
@@ -1391,20 +1385,25 @@ function touch() {
|
|
|
function chkfavorite() {
|
|
|
$(".msg-total").addClass("mask-hidden");
|
|
|
$.ajax({
|
|
|
- url: rooturl + '?do=chkfavorite',
|
|
|
+ url: siteurl + 'v2/goods/detail',
|
|
|
data: {
|
|
|
- goods_id: _keyid,
|
|
|
- store_id: _storeid,
|
|
|
- buyer_id: $api.getStorage("memberid")
|
|
|
+ goods_commonid: _keyid,
|
|
|
+ store_id: _storeid
|
|
|
},
|
|
|
+ headers: { "X-TOKEN": $api.getStorage("accesstoken") },
|
|
|
dataType: 'json',
|
|
|
type: 'post',
|
|
|
success: function(datas) {
|
|
|
- if (datas.fav) {
|
|
|
+ if (datas.data) {
|
|
|
_isfavorite = true;
|
|
|
$("#favorite").attr("src", "../../image/favorite2.png");
|
|
|
}
|
|
|
- $(".msg-total").html(datas.cart);
|
|
|
+ if(datas.data.cart==0||!datas.data.cart){
|
|
|
+ $(".msg-total").empty();
|
|
|
+ $(".msg-total").hide();
|
|
|
+ }else{
|
|
|
+ $(".msg-total").html(datas.data.cart);
|
|
|
+ }
|
|
|
$(".msg-total").removeClass("mask-hidden");
|
|
|
}
|
|
|
});
|