Browse Source

提示开启存储权限

git-svn-id: svn://svn7.apicloud.com/A6007457911931/%E5%9C%88%E5%A4%9A%E5%A4%9A@637 0e1a2743-8d03-4e5a-a60c-7e26af42b145
1149931599@qq.com 4 years ago
parent
commit
db9bcac25e
2 changed files with 31 additions and 33 deletions
  1. 30 32
      html/home/showgoods.html
  2. 1 1
      index.html

+ 30 - 32
html/home/showgoods.html

@@ -578,7 +578,6 @@ function getRouteData(_keyid, _storeid) {
                 }
                 $("#goods_name").html(datas.data.goods_name);
                 _title = datas.data.goods_name;
-                // _spot = datas.data.is_platform_store;
                 _description = datas.data.goods_name;
                 _shareurl = siteurl + 'v1/view/market.html'; //'home/goods/index/goods_id/' + datas.data.goods_commonid + '.html';
                 $("#goods_price").html(datas.data.goods_price);
@@ -588,9 +587,9 @@ function getRouteData(_keyid, _storeid) {
                 $(".line-through").html(datas.data.goods_marketprice);
                 $("#goods-content").html('<p></p>'+datas.data.goods_body);
                 $("#goods-issue").html(datas.data.issue);
-                $(".msg-total").html(datas.data.cart);
-                if ( datas.data.cart > 0 ) {
-                    $(".msg-total").html(datas.data.cart);
+                if ( datas.data.cart > 0 ) {//调用赋值给购物车数量方法
+					// getCar();
+					$(".msg-total").html(datas.data.cart);
                     $(".msg-total").removeClass("mask-hidden");
                 }
                 if ( datas.data.has_collected == 1 ) {
@@ -630,23 +629,10 @@ function getRouteData(_keyid, _storeid) {
                         _html += '<div class="goods-tag-item" ptag="item' + index + '">' + item + '</div><div class="h2"></div><div class="tag_item">';
                         $.each(datas.data.spec_value, function(index2, item2) {
                             if (index == index2) {
-                                // var x = 0;
                                 $.each(item2, function(index3, item3) {
-                                    // console.log(i)
-                                    // console.log(index3)
-                                    // if ( item2.length == 1 ) {
                                       _html += '<span class="goods-tag" id="sku_'+i+'_'+index3+'" ptag="item' + index + '" index="' + index2 + '" tag="' + index3 + '" spec_goods_image="" spec_goods_price="" spec_id="">' + item3 + '</span>';
-                                    // } else {
-                                    // if ( datas.data.goods_list[x].goods_storage > 0 ) {
-                                        // _html += '<span class="goods-tag" ptag="item' + index + '" index="' + index2 + '" tag="' + index3 + '" spec_goods_image="'+datas.data.goods_list[x].goods_image+'" spec_goods_price="'+datas.data.goods_list[x].goods_price+'" spec_id="'+datas.data.goods_list[x].goods_id+'">' + item3 + '</span>';
-                                    // } else {
-                                        // _html += '<span class="goods-tag no_active" ptag="item' + index + '" index="' + index2 + '" tag="' + index3 + '" spec_goods_image="'+datas.data.goods_list[x].goods_image+'" spec_goods_price="'+datas.data.goods_list[x].goods_price+'" spec_id="'+datas.data.goods_list[x].goods_id+'">' + item3 + '</span>';
-                                    // }
-                                    // console.log(x)
-                                    // x++;
-                                  // }
+ 
                                 })
-                                // console.log(index, index2)
                             }
                         })
                         _html += '</div><div class="h10"></div>';
@@ -1078,7 +1064,32 @@ function set_checked_list() {
       })
     })
 }
-
+function getCar() {
+    $.ajax({
+        url: siteurl + 'v2/order/cart',//'?do=getbuycar',
+        data: {
+            buyer_id: $api.getStorage("memberid"),
+            store_id: _storeid,
+            page: 1
+        },
+        headers: { "X-TOKEN": $api.getStorage("accesstoken") },
+        dataType: 'json',
+        type: 'post',
+        success: function(datas) {
+            if (datas.result) {
+				var sum;
+                $.each(datas.data.cart_list, function(index, item2) {
+					var item=JSON.stringify(item2);
+						sum = sum + item.goods_num;
+                });
+				 $(".msg-total").html(sum);
+            } else {
+                errcode(datas, datas.code);
+            }
+       
+		}
+    });
+}
 
 
 
@@ -1135,10 +1146,6 @@ $(".buy-btn-item").on("tap", function() {
         api.toast({ msg: '商品已下架' });
         return false;
     }
-  //   if ($(".buy-btn-item").data("state") == 0) {
-  //       api.toast({ msg: '商品已下架!' });
-  //       return false;
-  //   }
     if (_goods_id == "") {
         //api.toast({ msg:'请选择商品参数!'});
         showGoodsSize();
@@ -1212,10 +1219,6 @@ $(".go-home").on("tap", function() {
 })
 
 $(".go-buycar").on("tap", function() {
-    // if ( _spot == 2 ) {
-    //     api.toast({ msg: '商品已下架' });
-    //     return false;
-    // }
     api.openWin({
         name: 'buycar',
         url: 'buycar.html',
@@ -1232,10 +1235,6 @@ $(".add-buycar").on("tap", function() {
         api.toast({ msg: '商品已下架' });
         return false;
     }
-    // if ($(".add-buycar").data("state") == 0) {
-    //     api.toast({ msg: '商品已下架' });
-    //     return false;
-    // }
     if (_goods_id == "") {
         showGoodsSize();
         return false;
@@ -1264,7 +1263,6 @@ $(".add-buycar").on("tap", function() {
                 $(".msg-total").removeClass("mask-hidden");
                 $(".msg-total").html(num_car);
                 api.toast({ msg: datas.msg });
-                // chkfavorite();
             } else {
                 errcode(datas, datas.code);
             }

+ 1 - 1
index.html

@@ -82,7 +82,7 @@ var _adv_article_id = '0';
 var _webinkeyid = '0';
 var _webinstoreid = '0';
 apiready = function() {
-    // $api.fixStatusBar($api.dom('header'));
+	console.log("123");
     _webinkeyid = api.pageParam.keyid;
     _webinstoreid = api.pageParam.storeid;
     _adv_type = api.pageParam.advtype;