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

bug处理

parent 37388f4b
......@@ -15,7 +15,7 @@ const request = (url = '', data = {}, type = 'POST') => {
dataType: 'json',
}).then((response) => {
uni.hideLoading()
let [error, res] = response;
let [error,res] = response;
resolve(res.data);
}).catch(error => {
uni.hideLoading()
......
......@@ -111,13 +111,12 @@
let pdCreateUserId=uni.getStorageSync("createUserId")
let pdUserId=uni.getStorageSync("userId")
let data={
openid:uni.getStorageSync("openid")
openid:pdOpenid
}
this.$request("wechatUser/wxUser/getLastRecord",data).then((res) => {
if (res.code == "00"){
this.companyId=res.data.companyId||""
this.outUrl="https://wx.pangdly.com/#/home?pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId+"&companyId="+this.companyId
console.log(this.outUrl)
}else{
this.outUrl="https://wx.pangdly.com/#/home?pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId+"&companyId="+this.companyId
uni.showToast({
......
......@@ -117,54 +117,111 @@
paySign:"",
background:"",//去支付的背景颜色
orderId:"",//订单Id
openid:""//用户Id
}
},
onLoad(option){
this.orderId=option.orderId
let data = {
orderId:this.orderId, //订单Id
userId:uni.getStorageSync("openid"), //用户Id
payType:42, //支付类型
}
this.$request("orderc/order/findOrderInfo", data).then((res) => {
if (res.code == "00") {
this.bodyShow = true
//支付参数开始
this.timeStamp=res.data.timestamp
this.nonceStr=res.data.noncestr
this.package=res.data.package
this.signType=res.data.signType
this.paySign=res.data.sign
//支付参数结束
this.pdOrderMoney = res.data.pdOrderMoney
if(this.pdOrderMoney==0&&res.data.subOrderType == -1){//0元购直接跳电子门票页面
uni.navigateTo({
url:"/pages/my/order/electronicTicket/electronicTicket?orderId="+this.orderId
})
}
this.errorMessage = res.data.errorMessage
this.totalMoney = res.data.totalMoney
this.orderList = res.data.orderList
if (typeof(this.orderList) == "undefined") { //单票
this.orderList = ""
this.merchantName = res.data.merchantName
this.productName = res.data.productName
this.unitPrice = res.data.unitPrice
this.orderNum = res.data.orderNum
this.depositReceived = res.data.depositReceived
this.pdDiscountMoney = res.data.pdDiscountMoney
}
}else{
uni.showToast({
title:res.message,
icon:"none"
})
}
})
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 = {
orderId:this.orderId, //订单Id
userId:this.openid, //用户Id
payType:42, //支付类型
}
this.$request("orderc/order/findOrderInfo", data).then((res) => {
if (res.code == "00") {
this.bodyShow = true
//支付参数开始
this.timeStamp=res.data.timestamp
this.nonceStr=res.data.noncestr
this.package=res.data.package
this.signType=res.data.signType
this.paySign=res.data.sign
//支付参数结束
this.pdOrderMoney = res.data.pdOrderMoney
if(this.pdOrderMoney==0&&res.data.subOrderType == -1){//0元购直接跳电子门票页面
uni.navigateTo({
url:"/pages/my/order/electronicTicket/electronicTicket?orderId="+this.orderId
})
}
this.errorMessage = res.data.errorMessage
this.totalMoney = res.data.totalMoney
this.orderList = res.data.orderList
if (typeof(this.orderList) == "undefined") { //单票
this.orderList = ""
this.merchantName = res.data.merchantName
this.productName = res.data.productName
this.unitPrice = res.data.unitPrice
this.orderNum = res.data.orderNum
this.depositReceived = res.data.depositReceived
this.pdDiscountMoney = res.data.pdDiscountMoney
}
}else{
uni.showToast({
title:res.message,
icon:"none"
})
}
})
},
goPay(){//-------------------------------------------------------去支付
let _this=this
if (this.errorMessage) {
......
......@@ -213,7 +213,7 @@
if(res.code=='00'){
_this.openid=res.data.openid
uni.setStorageSync('openid',_this.openid)
this.getUserBrowse()
_this.getUserBrowse()
if (_this.merchantId) { //大商家的有merchantId
_this.init()
} else { //小商家没有merchantId
......@@ -249,12 +249,18 @@
title:res.message,
icon:"none"
})
setTimeout(()=>{
_this.login()
},2000)
}
}).catch((err)=>{
}).catch((err)=>{
uni.showToast({
title:"登录失败",
icon:"none"
})
setTimeout(()=>{
_this.login()
},2000)
})
}
}
......@@ -323,9 +329,13 @@
this.$request("user/company/detail", data).then((res) => {
uni.hideLoading()
if (res.code=="00"){
this.name = res.data.companyVo.companyName
this.companyAttribute=res.data.companyVo.companyAttribute
this.paydJumpUrl=res.data.paydJumpUrl
if(this.companyAttribute==5){//出租车显示联系人姓名,其他显示公司名称
this.name = res.data.companyVo.contactName
}else{
this.name = res.data.companyVo.companyName
}
} else {
uni.showToast({
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