diff --git a/pages/shop/list.vue b/pages/shop/list.vue index 5a2accf..d0af915 100644 --- a/pages/shop/list.vue +++ b/pages/shop/list.vue @@ -75,7 +75,8 @@ @click="$store.commit('setCartShow',!$store.state.cartShow)" /> - + ¥{{total | formatPrice}} 还差¥{{minimumOrderDifference | formatPrice}}起送 @@ -186,13 +187,13 @@ // 如果节点尚未生成,res值为null,循环调用执行 if (!res) { setTimeout(() => { - this.getElRect(elClass); + this.getElRect(elClass) }, 10) return } - this[dataVal] = res.height; + this[dataVal] = res.height resolve() - }).exec(); + }).exec() }) }, // 观测元素相交状态 @@ -262,21 +263,22 @@ // 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可 if (!height2 || scrollHeight >= height1 && scrollHeight < height2) { this.leftMenuStatus(i) - return; + return } } }, 10) }, //"选好了"执行 handleSeled() { - if (!this.$store.state.userInfo.tel) { //没有手机号 跳转到手机获取 - uni.navigateTo({ - url: '/pages/main/getTel' - }) - } else { //跳转到 确认订单页面 - uni.navigateTo({ + const regex = /^(\+?\d{1,4}[\s-]?)?\d{3}\*{4}\d{4}$/ + if (regex.test(this.$store.state.userInfo.tel)) { //手机号合法 + uni.navigateTo({ //跳转到订单页面 url: '/pages/shop/order' }) + } else { //手机号不合法 获取为空 + uni.navigateTo({ //跳转到获取手机号页面 + url: '/pages/main/getTel' + }) } } },