Commit 97b612b0f61af30adfd0721d1c08fa2a9d8f987a

Authored by yvan.ni
1 parent 892de59c

脚本错误的修复

components/diy_pingd_buy/diy_pingd_buy.js
@@ -69,7 +69,7 @@ Component({ @@ -69,7 +69,7 @@ Component({
69 69
70 //如果拼单的数组为空的时候 70 //如果拼单的数组为空的时候
71 var goodslist=res.data.data; 71 var goodslist=res.data.data;
72 - if(goodslist.length==0) return false; 72 + if(!goodslist || goodslist.length==0) return false;
73 73
74 /*--商品队列按照添加的顺序排列--*/ 74 /*--商品队列按照添加的顺序排列--*/
75 g_id.forEach(function(val, ind) { 75 g_id.forEach(function(val, ind) {
components/diy_seckill/diy_seckill.js
@@ -65,7 +65,7 @@ Component({ @@ -65,7 +65,7 @@ Component({
65 //如果秒杀的数组为空的时候 65 //如果秒杀的数组为空的时候
66 66
67 var goodslist=res.data.data; 67 var goodslist=res.data.data;
68 - if(goodslist.length==0) return false; 68 + if(!goodslist || goodslist.length==0) return false;
69 69
70 // 判断火热,预热 70 // 判断火热,预热
71 var newTime = ut.gettimestamp(); 71 var newTime = ut.gettimestamp();
components/diy_shopname/diy_shopname.js
@@ -27,15 +27,21 @@ Component({ @@ -27,15 +27,21 @@ Component({
27 //--所有商品-- 27 //--所有商品--
28 getApp().request.promiseGet("/api/weshop/goods/page/", 28 getApp().request.promiseGet("/api/weshop/goods/page/",
29 {data:{ isonsale: 1, store_id: o.stoid,page:1,pageSize:1}}).then(res => { 29 {data:{ isonsale: 1, store_id: o.stoid,page:1,pageSize:1}}).then(res => {
30 - var total=res.data.data.total;  
31 - th.setData({total:total}) 30 +
  31 + if(res.data.code==0 && res.data.data){
  32 + var total=res.data.data.total;
  33 + th.setData({total:total})
  34 + }
32 }) 35 })
33 36
34 //--所有新品-- 37 //--所有新品--
35 getApp().request.promiseGet("/api/weshop/goods/page/", 38 getApp().request.promiseGet("/api/weshop/goods/page/",
36 {data:{is_new:1,isonsale: 1, store_id: o.stoid,page:1,pageSize:1}}).then(res => { 39 {data:{is_new:1,isonsale: 1, store_id: o.stoid,page:1,pageSize:1}}).then(res => {
37 - var total=res.data.data.total;  
38 - th.setData({new_total:total}) 40 + if(res.data.code==0 && res.data.data)
  41 + {
  42 + var total = res.data.data.total;
  43 + th.setData({new_total: total})
  44 + }
39 }) 45 })
40 46
41 }, 47 },