diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index f70f319..6d28b1e 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -203,8 +203,24 @@ Page({ console.log(err); console.log(that.data.couponChannelId); console.log(that.data.couponId); - console.log("我即将要跳转到用户手机号授权的页面"); - if (err.code == "3000") { + //console.log("我即将要跳转到用户手机号授权的页面"); + if (err.code == "2011") { + wx.showToast({ + title: "商户信息没找到", + image: "./../../../assets/img/fail.png", + duration: 2000, + mask: false + }); + } + else if (err.code == "2013") { + wx.showToast({ + title: "商户信息禁用", + image: "./../../../assets/img/fail.png", + duration: 2000, + mask: false + }); + } + else if (err.code == "3000") { wx.showToast({ title: "库存不足", image: "./../../../assets/img/fail.png", @@ -212,7 +228,7 @@ Page({ mask: false }); } - if (err.code == "3001") { + else if (err.code == "3001") { wx.showToast({ title: "领取达到上限", image: "./../../../assets/img/fail.png", @@ -220,7 +236,7 @@ Page({ mask: false }); } - if (err.code == "3002") { + else if (err.code == "3002") { wx.showToast({ title: "订单失败", image: "./../../../assets/img/fail.png", @@ -228,7 +244,7 @@ Page({ mask: false }); } - if (err.code == "3003") { + else if (err.code == "3003") { wx.showToast({ title: "订单不存在", image: "./../../../assets/img/fail.png", @@ -236,7 +252,7 @@ Page({ mask: false }); } - if (err.code == "3004") { + else if (err.code == "3004") { wx.showToast({ title: "订单不存在", image: "./../../../assets/img/fail.png", @@ -245,7 +261,7 @@ Page({ }); } - if (err.code == "4003") { + else if (err.code == "4003") { wx.showToast({ title: "卡券已作废", image: "./../../../assets/img/fail.png", @@ -254,7 +270,7 @@ Page({ }); } - if (err.code == 11005) { + else if (err.code == 11005) { // 用户手机未授权 /** * 将值传到用户手机号授权的页面 @@ -267,7 +283,7 @@ Page({ that.data.couponId }); } - if (err.code == 11006) { + else if (err.code == 11006) { // 用户手机已加密 wx.redirectTo({ url: "/pages/phoneinput/phoneinput?couponChannelId=" + @@ -275,13 +291,20 @@ Page({ "&couponId=" + that.data.couponId }); + } else { + wx.showToast({ + title: err.message, + image: "./../../../assets/img/fail.png", + duration: 2000, + mask: false + }); } }) .then(res => { console.log(res); console.log("点击领取卡券一直在loading"); - if (res != "undefined") { - console.log(res); + if (typeof (res) != "undefined") { + console.log("", res); let orderId = "" + res.data.id; that.setData({ orderId: orderId @@ -424,7 +447,7 @@ Page({ } }) .catch(err => { - console.log(err); + console.log("ERR", err); }); } }