Commit ae7abb001c226803fd98baba75550d6a900750e8
1 parent
fef0c4c0
对象判断空时候,要优化计算, 门店不足的bug优化
Showing
1 changed file
with
2 additions
and
2 deletions
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -2035,7 +2035,7 @@ Page({ |
2035 | 2035 | if (e.data.code == 0) { |
2036 | 2036 | |
2037 | 2037 | //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店 |
2038 | - if(dd.lat && !th.data.def_pick_store && th.data.bconfig.is_sort_storage){ | |
2038 | + if(dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store)=='{}') && th.data.bconfig.is_sort_storage){ | |
2039 | 2039 | th.setData({ |
2040 | 2040 | def_pick_store:e.data.data.pageData[0], |
2041 | 2041 | sto_sele_name: e.data.data.pageData[0].pickup_name, |
... | ... | @@ -2046,7 +2046,7 @@ Page({ |
2046 | 2046 | } |
2047 | 2047 | |
2048 | 2048 | //-- 如果有默认选择门店的时候,要把默认门店放在第一位 -- |
2049 | - if (th.data.def_pick_store && (g_distr_type==0 || th.data.def_pick_store.distr_type==0 || th.data.def_pick_store.distr_type==g_distr_type )){ | |
2049 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store)!='{}' && (g_distr_type==0 || th.data.def_pick_store.distr_type==0 || th.data.def_pick_store.distr_type==g_distr_type )){ | |
2050 | 2050 | for (var k = 0; k < e.data.data.pageData.length; k++) { |
2051 | 2051 | if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) { |
2052 | 2052 | e.data.data.pageData.splice(k, 1); //删除 | ... | ... |