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

公司Id新增

parent 890cf235
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
{ {
"launchtype" : "local" "launchtype" : "local"
}, },
"mp-alipay" :
{
"launchtype" : "local"
},
"mp-weixin" : "mp-weixin" :
{ {
"launchtype" : "local" "launchtype" : "local"
......
export default{ export default{
//调用方法时--this.$commonjs.aaa() getCurrentPageUrl(){//---获取当前页面url
let pages = getCurrentPages() //获取加载的页面
} let currentPage = pages[pages.length-1] //获取当前页面的对象
\ No newline at end of file let url = currentPage.route //当前页面url
let options = currentPage.options //如果要获取url中所带的参数可
let queryTotal=""
for (let key in options){
queryTotal+="&"+key+"="+options[key]
}
queryTotal=queryTotal.substr(1)
let pageUrl=url+"?"+queryTotal//请求的全路径
return pageUrl
}
}
//调用方法时--this.$commonjs.aaa()
\ No newline at end of file
...@@ -48,12 +48,13 @@ ...@@ -48,12 +48,13 @@
let groupChannelId=option.groupChannelId let groupChannelId=option.groupChannelId
let thirdOpenid=option.thirdOpenid//第三方openid let thirdOpenid=option.thirdOpenid//第三方openid
let touristType=option.touristType//游客类型 let touristType=option.touristType//游客类型
let pageCode=option.pageCode//赠送优惠券接口参数
let pdOpenid=uni.getStorageSync("openid")//胖丁小程序openid,临时用,当公众号授权做好之后可以删除 let pdOpenid=uni.getStorageSync("openid")//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync("token") let pdToken=uni.getStorageSync("token")
let pdCreateUserId=uni.getStorageSync("createUserId") let pdCreateUserId=uni.getStorageSync("createUserId")
let pdUserId=uni.getStorageSync("userId") let pdUserId=uni.getStorageSync("userId")
let baseUrl="https://wx.pangdly.com/#/distributionCombiChoose?thirdOpenid="+thirdOpenid+"&touristType="+touristType let baseUrl="https://wx.pangdly.com/#/distributionCombiChoose?thirdOpenid="+thirdOpenid+"&touristType="+touristType
this.outUrl=baseUrl+"&channelId="+channelId+"&merchantId="+merchantId+"&groupId="+groupId+"&groupChannelId="+groupChannelId+"&companyId="+companyId+"&pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId this.outUrl=baseUrl+"&channelId="+channelId+"&merchantId="+merchantId+"&groupId="+groupId+"&groupChannelId="+groupChannelId+"&companyId="+companyId+"&pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId+"&pageCode"+pageCode
} }
}, },
......
...@@ -77,14 +77,20 @@ ...@@ -77,14 +77,20 @@
data() { data() {
return { return {
outUrl:"",//跳出地址 outUrl:"",//跳出地址
companyId:"",//公司Id
} }
}, },
onLoad(){ onLoad(option){
let pdOpenid=uni.getStorageSync("openid")//胖丁小程序openid,临时用,当公众号授权做好之后可以删除 this.companyId=option.companyId||""
let pdToken=uni.getStorageSync("token") if(!this.companyId){
let pdCreateUserId=uni.getStorageSync("createUserId") this.getCompanyId()
let pdUserId=uni.getStorageSync("userId") }else{
this.outUrl="https://wx.pangdly.com/#/home?pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId let pdOpenid=uni.getStorageSync("openid")//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync("token")
let pdCreateUserId=uni.getStorageSync("createUserId")
let pdUserId=uni.getStorageSync("userId")
this.outUrl="https://wx.pangdly.com/#/home?pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId+"&companyId="+this.companyId
}
}, },
methods: { methods: {
getUserInfo() { // 获取用户信息 getUserInfo() { // 获取用户信息
...@@ -98,6 +104,30 @@ ...@@ -98,6 +104,30 @@
} }
}) })
},
getCompanyId(){//获取公司Id
let pdOpenid=uni.getStorageSync("openid")//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync("token")
let pdCreateUserId=uni.getStorageSync("createUserId")
let pdUserId=uni.getStorageSync("userId")
let data={
openid:uni.getStorageSync("openid")
}
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({
title:res.message,
icon:"none"
})
}
}).catch(()=>{
this.outUrl="https://wx.pangdly.com/#/home?pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId+"&companyId="+this.companyId
})
} }
} }
......
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
this.pdOrderMoney = res.data.pdOrderMoney this.pdOrderMoney = res.data.pdOrderMoney
if(this.pdOrderMoney==0&&res.data.subOrderType == -1){//0元购直接跳电子门票页面 if(this.pdOrderMoney==0&&res.data.subOrderType == -1){//0元购直接跳电子门票页面
uni.navigateTo({ uni.navigateTo({
url:"../my/order/electronicTicket/electronicTicket?orderId="+this.orderId url:"/pages/my/order/electronicTicket/electronicTicket?orderId="+this.orderId
}) })
} }
this.errorMessage = res.data.errorMessage this.errorMessage = res.data.errorMessage
...@@ -187,7 +187,7 @@ ...@@ -187,7 +187,7 @@
paySign:this.paySign, paySign:this.paySign,
success: function (res) { success: function (res) {
uni.navigateTo({ uni.navigateTo({
url:"../my/order/electronicTicket/electronicTicket?orderId="+_this.orderId url:"/pages/my/order/electronicTicket/electronicTicket?orderId="+_this.orderId
}) })
}, },
fail: function (err) { fail: function (err) {
......
...@@ -77,6 +77,7 @@ ...@@ -77,6 +77,7 @@
</view> </view>
<!-------------------------------------------券弹窗------------------------------> <!-------------------------------------------券弹窗------------------------------>
<orderCoupon :couponData="couponData" ref="orderCoupon" @couponChoose="couponChoose" :chooseCouponObj="chooseCouponObj"></orderCoupon> <orderCoupon :couponData="couponData" ref="orderCoupon" @couponChoose="couponChoose" :chooseCouponObj="chooseCouponObj"></orderCoupon>
</view> </view>
</template> </template>
...@@ -140,6 +141,7 @@ ...@@ -140,6 +141,7 @@
} }
], ],
orderId:"",//订单Id orderId:"",//订单Id
paydJumpUrl:"",//页面跳转路径
companyAttribute:"",//等于5时为出租车 companyAttribute:"",//等于5时为出租车
} }
}, },
...@@ -162,6 +164,7 @@ ...@@ -162,6 +164,7 @@
} }
if(uni.getStorageSync("openid")){ if(uni.getStorageSync("openid")){
this.openid=uni.getStorageSync("openid") this.openid=uni.getStorageSync("openid")
this.getUserBrowse()
if (this.merchantId) { //大商家的有merchantId if (this.merchantId) { //大商家的有merchantId
this.init() this.init()
} else { //小商家没有merchantId } else { //小商家没有merchantId
...@@ -171,10 +174,22 @@ ...@@ -171,10 +174,22 @@
}else{ }else{
this.login() this.login()
} }
}, },
methods: { methods: {
login(){//---------------------------------------------------------------------登录 getUserBrowse(){//---获取浏览记录
let queryUrl=this.$commonjs.getCurrentPageUrl()
let data={
openid:uni.getStorageSync("openid") ,//用户Id
userName:"",//用户昵称
pageType:4,//页面类型(0首页,1商户页,2产品页,3售票页,4付款页,5付款完成页,6行记页,7评论页,8咨询页,9劵中心页,11订单页,12订单详情页,13IC卡出行页,14电子门票页,15常用信息页,16其他页)
queryUrl,//页面全地址
merchantType:""//商户类型1景区,2酒店,3餐饮,4特产
}
this.$request("wechatUser/wxUser/saveUserBrowse",data).then((res)=>{
})
},
login(){//---登录
let _this=this let _this=this
uni.getProvider({ uni.getProvider({
service: 'oauth', service: 'oauth',
...@@ -197,6 +212,7 @@ ...@@ -197,6 +212,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()
if (_this.merchantId) { //大商家的有merchantId if (_this.merchantId) { //大商家的有merchantId
_this.init() _this.init()
} else { //小商家没有merchantId } else { //小商家没有merchantId
...@@ -245,10 +261,10 @@ ...@@ -245,10 +261,10 @@
} }
}) })
}, },
getUrlKey(name){//---------------------------------------------------------------获取url getUrlKey(name){//---获取url
return(new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(this.enterUrl)) || [, ""])[1].replace(/\+/g, '%20') || ""; return(new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(decodeURIComponent(this.enterUrl)) || [, ""])[1].replace(/\+/g, '%20') || "";
}, },
clickNum(i,index,a) {//---------------------------------------------------------------------输入数字 clickNum(i,index,a) {//---输入数字
this.buyMoney += i this.buyMoney += i
this.leftList[index].child[a].background="#dddddd" this.leftList[index].child[a].background="#dddddd"
setTimeout(()=>{ setTimeout(()=>{
...@@ -259,7 +275,7 @@ ...@@ -259,7 +275,7 @@
this.initCoupon() this.initCoupon()
}, 1500) }, 1500)
}, },
clickEnter(){//---------------------------------------------------------------------退格 clickEnter(){//---退格
this.buyMoney = this.buyMoney.substr(0, this.buyMoney.length - 1) this.buyMoney = this.buyMoney.substr(0, this.buyMoney.length - 1)
this.spaceBackground="#dddddd" this.spaceBackground="#dddddd"
setTimeout(()=>{ setTimeout(()=>{
...@@ -270,15 +286,15 @@ ...@@ -270,15 +286,15 @@
this.initCoupon() this.initCoupon()
}, 1500) }, 1500)
}, },
couponChoose(data) { //---------------------------------------------------------------子组件券选择之后触发的事件 couponChoose(data) { //---子组件券选择之后触发的事件
this.chooseCouponObj = data this.chooseCouponObj = data
this.savedMoney=this.chooseCouponObj.savedMoney||0 this.savedMoney=this.chooseCouponObj.savedMoney||0
}, },
showCoupon() { //---------------------------------------------------------------------展示券列表 showCoupon() { //---展示券列表
this.$refs.orderCoupon.showCoupon() this.$refs.orderCoupon.showCoupon()
}, },
init() { //---------------------------------------------------------------------------初始化获取商家名称,大商家 init() { //---初始化获取商家名称,大商家
let data = { let data = {
"merchantId": this.merchantId, "merchantId": this.merchantId,
"companyId": this.companyId, "companyId": this.companyId,
...@@ -298,7 +314,7 @@ ...@@ -298,7 +314,7 @@
uni.hideLoading() uni.hideLoading()
}) })
}, },
initTwo() { //--------------------------------------------------------------------------初始化获取商家名称,没有merchantId的小商家 initTwo() { //---初始化获取商家名称,没有merchantId的小商家
let data = { let data = {
"id": this.companyId, "id": this.companyId,
} }
...@@ -308,6 +324,7 @@ ...@@ -308,6 +324,7 @@
if (res.code=="00"){ if (res.code=="00"){
this.name = res.data.companyVo.companyName this.name = res.data.companyVo.companyName
this.companyAttribute=res.data.companyVo.companyAttribute this.companyAttribute=res.data.companyVo.companyAttribute
this.paydJumpUrl=res.data.paydJumpUrl
} else { } else {
uni.showToast({ uni.showToast({
title:res.message, title:res.message,
...@@ -318,7 +335,7 @@ ...@@ -318,7 +335,7 @@
uni.hideLoading() uni.hideLoading()
}) })
}, },
initCoupon() { //-------------------------------------------------------------------------加载优惠券 initCoupon() { //---加载优惠券
let savedMoneyList = [] let savedMoneyList = []
this.chooseCouponObj = "" this.chooseCouponObj = ""
this.ableConpon = "" this.ableConpon = ""
...@@ -366,7 +383,7 @@ ...@@ -366,7 +383,7 @@
} }
}) })
}, },
clickPay(){//---------------------------------------------------------------点击立即支付,获取支付需要的参数 clickPay(){//---点击立即支付,获取支付需要的参数
if (!parseFloat(this.buyMoney)) { if (!parseFloat(this.buyMoney)) {
uni.showToast({ uni.showToast({
title:"请输入正确金额", title:"请输入正确金额",
...@@ -382,16 +399,16 @@ ...@@ -382,16 +399,16 @@
couponId:this.chooseCouponObj.slaveCouponId,//券id couponId:this.chooseCouponObj.slaveCouponId,//券id
isMerchant:this.chooseCouponObj.slaveCreateSource,//是否是商户的券 isMerchant:this.chooseCouponObj.slaveCreateSource,//是否是商户的券
myCouponId:this.chooseCouponObj.slaveId,//领取人编号 myCouponId:this.chooseCouponObj.slaveId,//领取人编号
couponType:this.chooseCouponObj.couponType,//券类型 couponType:this.chooseCouponObj.couponType,//券类型
couponPrice:this.chooseCouponObj.savedMoney,//券价格 couponPrice:this.chooseCouponObj.savedMoney,//券价格
} }
] ]
}else{ }else{
couponList=[ couponList=[
{ {
couponId:this.chooseCouponObj.couponId,//券id couponId:this.chooseCouponObj.couponId,//券id
isMerchant:this.chooseCouponObj.createSource,//是否是商户的券 isMerchant:this.chooseCouponObj.createSource,//是否是商户的券
myCouponId:this.chooseCouponObj.id,//领取人编号 myCouponId:this.chooseCouponObj.id,//领取人编号
couponType:this.chooseCouponObj.couponType,//券类型 couponType:this.chooseCouponObj.couponType,//券类型
couponPrice:this.chooseCouponObj.savedMoney,//券价格 couponPrice:this.chooseCouponObj.savedMoney,//券价格
} }
...@@ -440,7 +457,7 @@ ...@@ -440,7 +457,7 @@
this.payBackground="#1dce2e" this.payBackground="#1dce2e"
}) })
}, },
goPay(){//------------------------------------------------------------------------------去支付 goPay(){//---去支付
let _this=this let _this=this
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
uni.requestPayment({ uni.requestPayment({
...@@ -451,18 +468,15 @@ ...@@ -451,18 +468,15 @@
signType:this.signType, signType:this.signType,
paySign:this.paySign, paySign:this.paySign,
success: function (res) { success: function (res) {
if(this.companyAttribute==5){//出租车跳转分销组合票页面 if(_this.companyAttribute==5){//出租车跳转分销组合票页面
uni.navigateTo({ uni.navigateTo({
url:"/pages/combination/distributionCombiChoose/distributionCombiChoose" url:_this.paydJumpUrl
}) })
}else{ }else{
uni.navigateTo({ uni.navigateTo({
url:"/pages/paySuccess/paySuccess?orderId="+_this.orderId url:"/pages/payment/paySuccess/paySuccess?orderId="+_this.orderId
}) })
} }
// uni.redirectTo({
// url:"../paySuccess/paySuccess?orderId="+_this.orderId
// })
}, },
fail: function (err) { fail: function (err) {
uni.showToast({ uni.showToast({
...@@ -478,18 +492,15 @@ ...@@ -478,18 +492,15 @@
provider: 'alipay', // 服务提供商 支付宝支付: alipay 微信支付: wxpay provider: 'alipay', // 服务提供商 支付宝支付: alipay 微信支付: wxpay
orderInfo: this.orderInfo, // 支付宝订单号 orderInfo: this.orderInfo, // 支付宝订单号
success: function (res) { success: function (res) {
if(this.companyAttribute==5){//出租车跳转分销组合票页面 if(_this.companyAttribute==5){//出租车跳转分销组合票页面
uni.navigateTo({ uni.navigateTo({
url:"/pages/combination/distributionCombiChoose/distributionCombiChoose" url:_this.paydJumpUrl
}) })
}else{ }else{
uni.navigateTo({ uni.navigateTo({
url:"/pages/paySuccess/paySuccess?orderId="+_this.orderId url:"/pages/payment/paySuccess/paySuccess?orderId="+_this.orderId
}) })
} }
// uni.redirectTo({
// url:"../paySuccess/paySuccess?orderId="+_this.orderId
// })
}, },
fail: function (err) { fail: function (err) {
uni.showToast({ uni.showToast({
......
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