diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js
index 81b6bc3..12a095b 100644
--- a/pages/coupon/detail/index.js
+++ b/pages/coupon/detail/index.js
@@ -101,7 +101,6 @@ Page({
isshowposter: false,
})
},
-
/**
* 显示分享海报
*/
@@ -590,46 +589,18 @@ Page({
}
})
},
- checkPhoneStatus: function() {
- let that = this;
- Http.get({
- url: config.api.checkPhoneStatus,
- data: {}
- })
- .then(res => {
- console.log(666, '授权成功!')
- that.receiveCard()
- })
- .catch(err => {
- if (err.code == 11005) {
- /**
- * 手机号没有授权,将值传到用户手机号授权的页面
- *
- */
- wx.redirectTo({
- url: "/pages/getphoneInfo/index?path=index&cuserId=" + that.data.cardData.cuserId + "&couponChannelId=" + that.data.cardData.couponChannelId + "&userName=" + that.data.cardData.userName + "&coverImg=" + that.data.cardData.coverImg + "&avatarUrl=" + that.data.cardData.avatarUrl + "&couponOrderId=" + that.data.cardData.couponOrderId + "&updateDate=" + that.data.cardData.updateDate,
- });
- } else if (err.code == 11006) {
- // 用户手机已加密
- wx.redirectTo({
- url: "/pages/phoneinput/phoneinput?path=index&cuserId=" + that.data.cardData.cuserId + "&couponChannelId=" + that.data.cardData.couponChannelId + "&userName=" + that.data.cardData.userName + "&coverImg=" + that.data.cardData.coverImg + "&avatarUrl=" + that.data.cardData.avatarUrl + "&couponOrderId=" + that.data.cardData.couponOrderId + "&updateDate=" + that.data.cardData.updateDate,
- });
- } else {
- wx.showToast({
- title: err.message,
- icon: 'none',
- duration: 2000,
- mask: false
- });
- }
- })
- },
/**
* 发起支付
*/
orderFunc(discount) {
let that = this;
Http.get({
+ url: config.api.checkUserStatus,
+ data: {
+ token: app.globalData.token
+ }
+ }).then(res => {
+ Http.get({
url: config.api.checkPhoneStatus,
data: {}
})
@@ -854,6 +825,20 @@ Page({
}
}
})
+ }).catch(err => {
+ console.log(err)
+ if(err.code == 11004){
+ wx.redirectTo({
+ url: `/pages/getuserinfo/index?fromflag=coupondetail&couponChannelIdflag=${that.data.couponChannelId}`,
+ })
+ }else{
+ wx.showToast({
+ title: err.message,
+ icon:"none",
+ duration:2500
+ })
+ }
+ })
},
// 获得未支付的订单
getUnPaidOrder(couponId){
diff --git a/pages/getphoneInfo/index.js b/pages/getphoneInfo/index.js
index 1899190..55b49ee 100755
--- a/pages/getphoneInfo/index.js
+++ b/pages/getphoneInfo/index.js
@@ -25,6 +25,7 @@ Page({
couponChannelId: options.couponChannelId
});
}
+
if (options && options.mineFlag) {
that.setData({
mineFlag: options.mineFlag
diff --git a/pages/getuserinfo/index.js b/pages/getuserinfo/index.js
index e1736f2..448d1ab 100755
--- a/pages/getuserinfo/index.js
+++ b/pages/getuserinfo/index.js
@@ -11,10 +11,25 @@ Page({
cuserId:null,
coverImg:null,
couponOrderId:null,
- optionData:null
+ optionData:null,
+ fromflag:'',
+ couponChannelIdflag:''
},
onLoad: function(options) {
var that = this;
+ // options.fromflag == 'coupondetail';
+ // 来自优惠券详情页面
+ if (options && options.fromflag){
+ that.setData({
+ fromflag: options.fromflag
+ })
+ }
+ // 来自优惠券列表券详情页面的 couponChannelId
+ if (options && options.couponChannelIdflag) {
+ that.setData({
+ couponChannelIdflag: options.couponChannelIdflag
+ })
+ }
if (options && options.spellGroup){
that.setData({
spellGroup: options.spellGroup
@@ -256,7 +271,15 @@ Page({
wx.switchTab({
url: '/index/searchbar'
});
- } else {
+ } else if (that.data.fromflag == 'coupondetail' && that.data.couponChannelIdflag){
+ wx.navigateTo({
+ url: `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelIdflag}`
+ });
+ } else if (that.data.fromflag == 'spellcoupondetail' && that.data.couponChannelIdflag) {
+ wx.navigateTo({
+ url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${that.data.couponChannelIdflag}`
+ });
+ }else {
wx.switchTab({
url: "/index/index"
});
diff --git a/pages/getuserinfo/index.wxml b/pages/getuserinfo/index.wxml
index 29bddca..d44cbff 100755
--- a/pages/getuserinfo/index.wxml
+++ b/pages/getuserinfo/index.wxml
@@ -1,4 +1,4 @@
-
+
diff --git a/pages/index/index.js b/pages/index/index.js
index a22c72f..4393695 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -379,12 +379,12 @@ Page({
url: `/pages/getuserinfo/index?id=${options.id}&frommd=md`
});
} else {
- wx.redirectTo({
- url: `/pages/getuserinfo/index`
- });
+ wx.switchTab({
+ url: '/index/index',
+ })
}
}
- });
+ })
},
getGameOne: function(token, id) {
diff --git a/pages/spellGroup/mySpellGroup/index.js b/pages/spellGroup/mySpellGroup/index.js
index f47cfa9..bdc6d67 100644
--- a/pages/spellGroup/mySpellGroup/index.js
+++ b/pages/spellGroup/mySpellGroup/index.js
@@ -3,7 +3,8 @@ const navigationBarHeight = (getApp().statusBarHeight + 50) + 'px'
var config = require("../../../config/config.js");
const Http = require("../../../utils/HttpBasics");
const imgurl = require("../../../utils/imgurl");
-const utils = require("../../../utils/util.js")
+const utils = require("../../../utils/util.js");
+let app = getApp();
Page({
/**
@@ -22,7 +23,6 @@ Page({
quesGouUrl: imgurl.ques_gou.url,
headbgUrl: imgurl.headbg.url,
quesBgUrl: imgurl.ques_bg.url,
-
couponChannelId: '',
couponId: '',
data: null,
@@ -64,8 +64,6 @@ Page({
if (options && options.couponId) {
this.getOneSpell(options.couponId)
}
- console.log(this.data.couponId)
- this.getUserInfo();
},
/**
* 显示分享海报
@@ -92,21 +90,6 @@ Page({
isshowposter: false,
})
},
- getUserInfo: function() {
- let that = this;
- // 获取用户信息
- Http.get({
- url: config.api.getScore,
- data: {}
- })
- .then(res => {
- console.log(res)
- that.setData({
- nickName: res.data.nickName,
- avatarUrl: res.data.avatarUrl
- })
- })
- },
gotoIndex: function() {
wx.switchTab({
url: '/index/index',
@@ -498,6 +481,7 @@ Page({
* 发起支付
*/
orderFunc() {
+ let that = this;
let orderGroupId = this.data.orderGroupId;
let data = {
couponChannelId: this.data.data.id,
@@ -507,7 +491,6 @@ Page({
/**
* 拼团订单
*/
- let that = this;
if (this.data.orderGroupId == 0) {
data.orderGroupId = this.data.orderGroupId,
that.setData({
@@ -518,125 +501,132 @@ Page({
isFromSpell: false
})
}
+
Http.get({
+ url: config.api.checkUserStatus,
+ data: {
+ token: app.globalData.token
+ }
+ }).then(res=>{
+ Http.get({
url: config.api.checkPhoneStatus,
data: {}
})
- .then(res => {
- /**
- * orderSave 下单
- */
- return Http.post({
- url: config.api.orderSave,
- data: data
- });
- })
- .catch(err => {
- console.log(err);
- that.setData({
- showbutton: false,
- showbutton1: false,
- canSpell: true,
- canBuyIf: true
- })
- if (err.code == 2011) {
- wx.showToast({
- title: "商户信息没找到",
- image: './../../../assets/images/fail.png',
- duration: 2000,
- mask: false
- });
- } else if (err.code == 2013) {
- wx.showToast({
- title: "商户信息禁用",
- image: './../../../assets/images/fail.png',
- duration: 2000,
- mask: false
- });
- } else if (err.code == 3000) {
- wx.showToast({
- title: "库存不足",
- image: './../../../assets/images/fail.png',
- duration: 2000,
- mask: false
- });
- } else if (err.code == 3001) {
- wx.showToast({
- title: "您已超过限购",
- image: './../../../assets/images/fail.png',
- duration: 2000,
- mask: false
- });
- } else if (err.code == 3002) {
- wx.showToast({
- title: "订单失败",
- image: './../../../assets/images/fail.png',
- duration: 2000,
- mask: false
- });
- } else if (err.code == 3003) {
- wx.showToast({
- title: "订单不存在",
- image: './../../../assets/images/fail.png',
- duration: 2000,
- mask: false
- });
- } else if (err.code == 3004) {
- wx.showToast({
- title: "订单不存在",
- image: './../../../assets/images/fail.png',
- duration: 2000,
- mask: false
- });
- } else if (err.code == 4003) {
- wx.showToast({
- title: "卡券已作废",
- image: './../../../assets/images/fail.png',
- duration: 2000,
- mask: false
- });
- } else if (err.code == 3012) {
- // wx.showToast({
- // title: err.message,
- // icon: "none"
- // })
- that.getUnPaidOrder(that.data.data.couponId);
- } else if (err.code == 11005) {
+ .then(res => {
/**
- * 将值传到用户手机号授权的页面
- *
+ * orderSave 下单
*/
- wx.redirectTo({
- url: `/pages/getphoneInfo/index?path=spell&couponChannelId=${that.data.couponChannelId}&couponId=${that.data.data.couponId}`
+ return Http.post({
+ url: config.api.orderSave,
+ data: data
});
- } else if (err.code == 11006) {
- // 用户手机已加密
- wx.redirectTo({
- url: `/pages/phoneinput/phoneinput?path=spell&couponChannelId=${that.data.couponChannelId}&couponId=${that.data.data.couponId}`
- });
- } else {
- wx.showToast({
- title: err.message,
- icon: 'none',
- duration: 2000,
- mask: false
- });
- }
- })
- .then(res => {
- console.log(res)
- if (typeof(res) != "undefined") {
- let orderId = "" + res.data.id;
+ })
+ .catch(err => {
+ console.log(err);
that.setData({
- orderId: orderId,
- canSpell: false,
+ showbutton: false,
+ showbutton1: false,
+ canSpell: true,
canBuyIf: true
- });
- // 支付金额不为0
- /**
- * 支付订单创建
- */
- Http.post({
+ })
+ if (err.code == 2011) {
+ wx.showToast({
+ title: "商户信息没找到",
+ image: './../../../assets/images/fail.png',
+ duration: 2000,
+ mask: false
+ });
+ } else if (err.code == 2013) {
+ wx.showToast({
+ title: "商户信息禁用",
+ image: './../../../assets/images/fail.png',
+ duration: 2000,
+ mask: false
+ });
+ } else if (err.code == 3000) {
+ wx.showToast({
+ title: "库存不足",
+ image: './../../../assets/images/fail.png',
+ duration: 2000,
+ mask: false
+ });
+ } else if (err.code == 3001) {
+ wx.showToast({
+ title: "您已超过限购",
+ image: './../../../assets/images/fail.png',
+ duration: 2000,
+ mask: false
+ });
+ } else if (err.code == 3002) {
+ wx.showToast({
+ title: "订单失败",
+ image: './../../../assets/images/fail.png',
+ duration: 2000,
+ mask: false
+ });
+ } else if (err.code == 3003) {
+ wx.showToast({
+ title: "订单不存在",
+ image: './../../../assets/images/fail.png',
+ duration: 2000,
+ mask: false
+ });
+ } else if (err.code == 3004) {
+ wx.showToast({
+ title: "订单不存在",
+ image: './../../../assets/images/fail.png',
+ duration: 2000,
+ mask: false
+ });
+ } else if (err.code == 4003) {
+ wx.showToast({
+ title: "卡券已作废",
+ image: './../../../assets/images/fail.png',
+ duration: 2000,
+ mask: false
+ });
+ } else if (err.code == 3012) {
+ // wx.showToast({
+ // title: err.message,
+ // icon: "none"
+ // })
+ that.getUnPaidOrder(that.data.data.couponId);
+ } else if (err.code == 11005) {
+ /**
+ * 将值传到用户手机号授权的页面
+ *
+ */
+ wx.redirectTo({
+ url: `/pages/getphoneInfo/index?path=spell&couponChannelId=${that.data.couponChannelId}&couponId=${that.data.data.couponId}`
+ });
+ } else if (err.code == 11006) {
+ // 用户手机已加密
+ wx.redirectTo({
+ url: `/pages/phoneinput/phoneinput?path=spell&couponChannelId=${that.data.couponChannelId}&couponId=${that.data.data.couponId}`
+ });
+ } else {
+ wx.showToast({
+ title: err.message,
+ icon: 'none',
+ duration: 2000,
+ mask: false
+ });
+ }
+ })
+ .then(res => {
+ console.log(res)
+ if (typeof (res) != "undefined") {
+ let orderId = "" + res.data.id;
+ that.setData({
+ orderId: orderId,
+ canSpell: false,
+ canBuyIf: true
+ });
+ // 支付金额不为0
+ /**
+ * 支付订单创建
+ */
+ Http.post({
url: config.api.payOrderCreate,
data: {
orderId: orderId
@@ -658,12 +648,12 @@ Page({
wx.showLoading({
title: '订单正在处理中...',
})
- setTimeout(function() {
+ setTimeout(function () {
wx.hideLoading()
}, 5000)
that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', that, orderGroupId);
if (res.errMsg == "requestPayment:ok") {
- setTimeout(function() {
+ setTimeout(function () {
wx.hideLoading();
}, 2000);
}
@@ -680,7 +670,7 @@ Page({
})
return;
},
- complete: res => {}
+ complete: res => { }
});
/// End payment --------
})
@@ -696,9 +686,25 @@ Page({
mask: false
});
})
- }
+ }
- })
+ })
+ })
+ .catch(err => {
+ console.log(err)
+ if(err.code == 11004){
+ wx.redirectTo({
+ url: `/pages/getuserinfo/index?fromflag=spellcoupondetail&couponChannelIdflag=${that.data.couponChannelId}`,
+ })
+ }else{
+ wx.showToast({
+ title: err.message,
+ icon:"none",
+ duration:2500
+ })
+ }
+ })
+
},
/**
* 生命周期函数--监听页面显示
diff --git a/pages/spellGroup/mySpellGroup/index.wxss b/pages/spellGroup/mySpellGroup/index.wxss
index ad4416c..07277c8 100644
--- a/pages/spellGroup/mySpellGroup/index.wxss
+++ b/pages/spellGroup/mySpellGroup/index.wxss
@@ -1,4 +1,7 @@
/* pages/spellGroup/mySpellGroup/index.wxss */
+page{
+ background: #F4F5F9;
+}
.top-img{
width: 100%;
height: 533rpx;
@@ -43,7 +46,7 @@ button::after{ border: none; }
position: relative;
width: 100%;
height: auto;
- background: #F4F5F9;
+ /* background: #F4F5F9; */
overflow: hidden;
padding-bottom: 130rpx;
}
@@ -195,7 +198,7 @@ button::after{ border: none; }
left:0;
right:0;
padding:20rpx 22rpx;
- /* background:#fff; */
+ background:transparent!important;
}
.edit-left{
float: left;
diff --git a/pages/spellGroup/spellGroup.js b/pages/spellGroup/spellGroup.js
index 34343ee..9b28c46 100644
--- a/pages/spellGroup/spellGroup.js
+++ b/pages/spellGroup/spellGroup.js
@@ -74,7 +74,6 @@ Page({
})
}
}
- that.getUserInfo();
},
onShow(){
let that=this;
@@ -172,27 +171,11 @@ Page({
})
},
gotoEdit(e){
- console.log(e.currentTarget.dataset.status)
let status = e.currentTarget.dataset.status
if (status==10){
}
},
- getUserInfo: function () {
- let that = this;
- // 获取用户信息
- Http.get({
- url: config.api.getScore,
- data: {}
- })
- .then(res => {
- console.log(res)
- that.setData({
- nickName: res.data.nickName,
- avatarUrl: res.data.avatarUrl
- })
- })
- },
getList(pageNum, flag) {
var that = this;
console.log(pageNum)