From 3e329afc3552de8dd34278a14b788bcd5fb0266f Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Wed, 19 Sep 2018 20:42:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E9=94=99=E8=AF=AF=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/coupon/detail/index.js | 47 +++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 12 deletions(-) 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); }); } }