diff --git a/pages/goods_cate/goods_cate.vue b/pages/goods_cate/goods_cate.vue index 62d2595..b83a3ab 100644 --- a/pages/goods_cate/goods_cate.vue +++ b/pages/goods_cate/goods_cate.vue @@ -11,7 +11,6 @@ - @@ -50,28 +49,26 @@ async onLoad(options) { if(this.$Route.query) { let query = this.$Route.query; - this.p_id = query.p_id ? parseInt(query.p_id) : 0; - this.set = query.set ? parseInt(query.set) : 0; + this.p_id = parseInt(query.p_id) || 0 + this.set = parseInt(query.set) || 0 if (query.scene) { let data = strToParams(decodeURIComponent(query.scene)) - this.p_id = data.id ? parseInt(data.id) : 0; - this.set = data.set ? parseInt(data.set) : 0; + this.p_id = parseInt(data.id) || 0 + this.set = parseInt(data.set) || 0 if (data.icde) { const [err,res] = await uni.login() - if (err) { - this.$toast({ title: "登录失败" }) - return - } + if (err) return this.$toast({ title: "登录失败" }) + if (res) { await bindSuperior({code: res.code, invite_code: data.icde}) } } } } - this.$store.commit("setPid", this.p_id); + this.$store.commit("setPid", this.p_id) this.$store.commit("setSetId", this.set) this.$Route.query = '' - this.getLevelOneListFun(); + this.getLevelOneListFun() }, onShow() { this.getCartNum() @@ -83,7 +80,7 @@ const { code, data - } = await getLevelOneList({p_id: this.p_id, set: this.set}); + } = await getLevelOneList({p_id: this.p_id, set: this.set}) if (code == 1) { this.cateList = data }