Commit b2fb13f6 authored by 潘永坪's avatar 潘永坪

bug处理

parent 37388f4b
...@@ -15,7 +15,7 @@ const request = (url = '', data = {}, type = 'POST') => { ...@@ -15,7 +15,7 @@ const request = (url = '', data = {}, type = 'POST') => {
dataType: 'json', dataType: 'json',
}).then((response) => { }).then((response) => {
uni.hideLoading() uni.hideLoading()
let [error, res] = response; let [error,res] = response;
resolve(res.data); resolve(res.data);
}).catch(error => { }).catch(error => {
uni.hideLoading() uni.hideLoading()
......
...@@ -111,13 +111,12 @@ ...@@ -111,13 +111,12 @@
let pdCreateUserId=uni.getStorageSync("createUserId") let pdCreateUserId=uni.getStorageSync("createUserId")
let pdUserId=uni.getStorageSync("userId") let pdUserId=uni.getStorageSync("userId")
let data={ let data={
openid:uni.getStorageSync("openid") openid:pdOpenid
} }
this.$request("wechatUser/wxUser/getLastRecord",data).then((res) => { this.$request("wechatUser/wxUser/getLastRecord",data).then((res) => {
if (res.code == "00"){ if (res.code == "00"){
this.companyId=res.data.companyId||"" this.companyId=res.data.companyId||""
this.outUrl="https://wx.pangdly.com/#/home?pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId+"&companyId="+this.companyId this.outUrl="https://wx.pangdly.com/#/home?pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId+"&companyId="+this.companyId
console.log(this.outUrl)
}else{ }else{
this.outUrl="https://wx.pangdly.com/#/home?pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId+"&companyId="+this.companyId this.outUrl="https://wx.pangdly.com/#/home?pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId+"&companyId="+this.companyId
uni.showToast({ uni.showToast({
......
...@@ -117,13 +117,72 @@ ...@@ -117,13 +117,72 @@
paySign:"", paySign:"",
background:"",//去支付的背景颜色 background:"",//去支付的背景颜色
orderId:"",//订单Id orderId:"",//订单Id
openid:""//用户Id
} }
}, },
onLoad(option){ onLoad(option){
this.orderId=option.orderId this.orderId=option.orderId
this.openid=uni.getStorageSync("openid")||""
if(this.openid){
this.initDetail()
}else{
this.login()//极个别手机从公众号跳转回来没有openid,再次获取openid
}
},
methods:{
login(){//---登录
let _this=this
uni.getProvider({
service: 'oauth',
success(proRes){
uni.login({
provider:proRes.provider[0],
success: function (res) {
if(res.code){
let source=""
if(proRes.provider[0]=="weixin"){
source=3
}else if(proRes.provider[0]=="alipay"){
source=4
}
let data={
code:res.code,
source,//微信小程序3,支付宝小程序4
}
_this.$request('wechat/wx/getUserInfoByCode',data).then(res => {
if(res.code=='00'){
_this.openid=res.data.openid
uni.setStorageSync('openid',_this.openid)
_this.initDetail()
}else{
uni.showToast({
title:res.message,
icon:"none"
})
setTimeout(()=>{
_this.login()
},2000)
}
}).catch((err)=>{
uni.showToast({
title:"登录失败",
icon:"none"
})
setTimeout(()=>{
_this.login()
},2000)
})
}
}
})
}
})
},
initDetail(){//---初始化产品信息,以及获取支付需要的参数
let data = { let data = {
orderId:this.orderId, //订单Id orderId:this.orderId, //订单Id
userId:uni.getStorageSync("openid"), //用户Id userId:this.openid, //用户Id
payType:42, //支付类型 payType:42, //支付类型
} }
this.$request("orderc/order/findOrderInfo", data).then((res) => { this.$request("orderc/order/findOrderInfo", data).then((res) => {
...@@ -162,9 +221,7 @@ ...@@ -162,9 +221,7 @@
}) })
} }
}) })
}, },
methods:{
goPay(){//-------------------------------------------------------去支付 goPay(){//-------------------------------------------------------去支付
let _this=this let _this=this
if (this.errorMessage) { if (this.errorMessage) {
......
...@@ -213,7 +213,7 @@ ...@@ -213,7 +213,7 @@
if(res.code=='00'){ if(res.code=='00'){
_this.openid=res.data.openid _this.openid=res.data.openid
uni.setStorageSync('openid',_this.openid) uni.setStorageSync('openid',_this.openid)
this.getUserBrowse() _this.getUserBrowse()
if (_this.merchantId) { //大商家的有merchantId if (_this.merchantId) { //大商家的有merchantId
_this.init() _this.init()
} else { //小商家没有merchantId } else { //小商家没有merchantId
...@@ -249,12 +249,18 @@ ...@@ -249,12 +249,18 @@
title:res.message, title:res.message,
icon:"none" icon:"none"
}) })
setTimeout(()=>{
_this.login()
},2000)
} }
}).catch((err)=>{ }).catch((err)=>{
uni.showToast({ uni.showToast({
title:"登录失败", title:"登录失败",
icon:"none" icon:"none"
}) })
setTimeout(()=>{
_this.login()
},2000)
}) })
} }
} }
...@@ -323,9 +329,13 @@ ...@@ -323,9 +329,13 @@
this.$request("user/company/detail", data).then((res) => { this.$request("user/company/detail", data).then((res) => {
uni.hideLoading() uni.hideLoading()
if (res.code=="00"){ if (res.code=="00"){
this.name = res.data.companyVo.companyName
this.companyAttribute=res.data.companyVo.companyAttribute this.companyAttribute=res.data.companyVo.companyAttribute
this.paydJumpUrl=res.data.paydJumpUrl this.paydJumpUrl=res.data.paydJumpUrl
if(this.companyAttribute==5){//出租车显示联系人姓名,其他显示公司名称
this.name = res.data.companyVo.contactName
}else{
this.name = res.data.companyVo.companyName
}
} else { } else {
uni.showToast({ uni.showToast({
title:res.message, title:res.message,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment