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

公司Id新增

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