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

长江索道公众号页面改成小程序页面

parent 44040ee8
var baseUrl = '' var baseUrl = ''
if(process.env.NODE_ENV === 'development'){//开发环境 if(process.env.NODE_ENV === 'development'){//开发环境
baseUrl= "http://pay.tuyoyoo.com/" baseUrl= 'http://pay.tuyoyoo.com/'
}else{ }else{
baseUrl= "https://manager.pangdly.com/" baseUrl= 'https://manager.pangdly.com/'
} }
const request = (url = '', data = {}, type = 'POST') => { const request = (url = '', data = {}, type = 'POST') => {
data.reqId = new Date().getTime() //获取时间戳 data.reqId = new Date().getTime() //获取时间戳
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.request({ uni.request({
method: type, method: type,
url: baseUrl + url+'?token='+uni.getStorageSync("token"), url: baseUrl + url+'?token='+uni.getStorageSync('token'),
data:data, data:data,
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()
let [err, res] = error; let [err, res] = error
reject(err) reject(err)
}) })
}); })
} }
export default request export default request
\ No newline at end of file
{ {
"name" : "uni-pdtravel", "name" : "uni-pdtravel",
"appid" : "", "appid" : "__UNI__17F18E2",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : "100", "versionCode" : "100",
......
...@@ -320,6 +320,15 @@ ...@@ -320,6 +320,15 @@
} }
} }
,{
"path" : "pages/common/getTicket/getTicket",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
], ],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "white", "navigationBarTextStyle": "white",
......
...@@ -5,32 +5,32 @@ ...@@ -5,32 +5,32 @@
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
enterUrl:"",//进入页面路由 enterUrl:'',//进入页面路由
outUrl:"",//跳出页面路由 outUrl:'',//跳出页面路由
} }
}, },
onLoad(option){ onLoad(option){
let groupId=option.groupId let groupId=option.groupId||''
let groupChannelId=option.groupChannelId let groupChannelId=option.groupChannelId||''
let companyId=option.companyId let companyId=option.companyId||''
let productIdList=option.productIdList let productIdList=option.productIdList||''
let orderSource=option.orderSource let orderSource=option.orderSource||''
let ifyukuaiCode=option.ifyukuaiCode//是否是渝快码跳入,渝快码跳入需要在H5端另外走流程 let ifyukuaiCode=option.ifyukuaiCode||''//是否是渝快码跳入,渝快码跳入需要在H5端另外走流程
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/#/combiOrder?pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId let baseUrl='https://wx.pangdly.com/#/combiOrder?pdOpenid='+pdOpenid+'&pdToken='+pdToken+'&pdCreateUserId='+pdCreateUserId+'&pdUserId='+pdUserId
let url="&groupId="+groupId+"&groupChannelId="+groupChannelId+"&productIdList="+productIdList+"&orderSource="+orderSource+"&companyId="+companyId+"&ifyukuaiCode="+ifyukuaiCode let url='&groupId='+groupId+'&groupChannelId='+groupChannelId+'&productIdList='+productIdList+'&orderSource='+orderSource+'&companyId='+companyId+'&ifyukuaiCode='+ifyukuaiCode
this.outUrl=baseUrl+url this.outUrl=baseUrl+url
}, },
methods: { methods: {
} }
} }
</script> </script>
<style> <style>
......
<template>
<!-- 1.获取购票凭证页面,索道等景区进入添加企业微信获取电子门票 -->
<!--2.判断是否添加,已经添加直接进入订单列表页面 ,没有添加就添加企业微信-->
<!-- 3.如果企业微信人数达到上线,直接跳转到订单列表页面 -->
<!-- 4.如果企业微信码停用,走公众号流程 -->
<view class="bigBox">
<image src="../../../static/img/common/getTicketBg.jpg" class="bigImg"></image>
<view class="title">获取购票凭证</view>
<!-- 企业微信流程 -->
<view v-if="showCompany">
<view class="imgbox">
<image :src="imgUrl" style="width:360rpx;height:360rpx;"></image>
</view>
<view class="content1">长按二维码,添加“客服”</view>
<view class="content2">获取您的电子门票</view>
</view>
<!-- 公众号流程 -->
<div v-if="showPublic">
<view class="imgbox">
<image :src="imgUrl" style="width:360rpx;height:360rpx;"></image>
</view>
<view class="content1">长按二维码,关注“胖丁旅游”</view>
<view class="content2">获取您的电子门票</view>
</div>
</view>
</template>
<script>
export default {
data() {
return {
showCompany:false,//企业微信流程
showPublic:false,//公众号流程
merchantId:'',//商户Id
companyId:'',//公司Id
imgUrl:'',//图片地址
}
},
onLoad(option) {
this.merchantId=option.merchantId
this.companyId=option.companyId
this.ifAddWxUser()
},
methods: {
//---是否添加企业微信
ifAddWxUser(){
let data = {
openid:uni.getStorageSync('openid'),//openId
}
this.$request('wechatUser/wxUser/findWxUser',data).then(res => {
if (res.code == '00') {
if(res.data.alreadyAddAttendant=='1'){
//已添加
uni.navigateTo({
url: '/pages/my/order/orderList/orderList'
})
}else{
//未添加
this.getCompanyCode()
}
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
},
//---获取企业微信二维码编号
getCompanyCode() {
let data = {
merchantId: this.merchantId,
companyId:this.companyId
}
this.$request('scenic/wechatCodeConfig/load',data).then(res => {
if (res.code == '00') {
//微信码正常
if(res.data.status=='0'){
//达到上线跳转小程序页面
if(res.data.alreadyAddNumber>=res.data.canAddNumber){
uni.navigateTo({
url: '/pages/my/order/orderList/orderList'
})
}else{
this.showCompany=true
this.imgUrl = res.data.codeUrl
}
}else{
//微信码停用获取公众号二维码
this.showPublic=true
this.getCode()
}
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
},
//---获取公众号二维码编号
getCode() {
let data = {
codeType: 1,
select: 1,
companyId: this.companyId
}
this.$request('user/company/generateQrCodeUrl', data).then(res => {
if (res.code == '00') {
this.imgUrl = res.data.codeImgUrl
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
},
}
}
</script>
<style>
.bigBox {
height: 100%;
padding-top: 18vh;
text-align: center;
font-weight: bold;
font-size:28rpx;
box-sizing: border-box;
position: relative;
}
.bigImg{
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: -1;
}
.title {
font-size:66rpx;
font-weight: bold;
color: #ff570e;
}
.imgbox {
margin-top: 6vh;
}
.content1 {
margin-top: 6vh;
}
.content2 {
margin-top: 3vh;
}
@media only screen and (max-height:760px) {
.bigBox {
padding-top: 16vh;
}
.imgbox {
margin-top: 5vh;
}
.content1 {
margin-top: 5vh;
}
.content2 {
margin-top: 2vh;
}
}
</style>
...@@ -63,25 +63,25 @@ ...@@ -63,25 +63,25 @@
} }
}else{ }else{
uni.showToast({ uni.showToast({
title:res.message, title:res.message+'请退出并重新登录',
icon:'none' icon:'none'
}) })
} }
}).catch((err)=>{ }).catch((err)=>{
uni.showToast({ uni.showToast({
title:'登录失败', title:'登录失败,请退出并重新登录',
icon:'none' icon:'none'
}) })
}) })
}else{ }else{
uni.showToast({ uni.showToast({
title:res.message, title:res.message='请退出并重新登录',
icon:'none' icon:'none'
}) })
} }
}).catch((err)=>{ }).catch((err)=>{
uni.showToast({ uni.showToast({
title:'登录失败', title:'登录失败,请退出并重新登录',
icon:'none' icon:'none'
}) })
}) })
......
...@@ -5,44 +5,44 @@ ...@@ -5,44 +5,44 @@
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
outUrl:"",//跳出地址 outUrl:'',//跳出地址
Brightness:"",//屏幕亮度 Brightness:'',//屏幕亮度
} }
}, },
onShow() { onShow() {
let _this=this let _this=this
uni.getScreenBrightness({ uni.getScreenBrightness({
success: function(res){ success: function(res){
// 这里是把获取到的手机屏幕亮度,存储到data里面,方便给到页面生命周期隐藏和卸载方法里面用 // 这里是把获取到的手机屏幕亮度,存储到data里面,方便给到页面生命周期隐藏和卸载方法里面用
_this.Brightness = res.value; _this.Brightness = res.value
if(res.value != 1){ if(res.value != 1){
uni.setScreenBrightness({ uni.setScreenBrightness({
value: 1 value: 1
}); })
} }
} }
}) })
}, },
onHide: function () { onHide: function () {
uni.setScreenBrightness({// 恢复之前屏幕亮度 uni.setScreenBrightness({// 恢复之前屏幕亮度
value: this.Brightness value: this.Brightness
}) })
}, },
onLoad(option) { onLoad(option) {
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 ifyukuaiCode=option.ifyukuaiCode//是否是渝快码跳入,渝快码跳入需要在H5端另外走流程 let ifyukuaiCode=option.ifyukuaiCode||''//是否是渝快码跳入,渝快码跳入需要在H5端另外走流程
this.outUrl="https://wx.pangdly.com/#/unusedDetail?id="+option.orderId+"&pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId+"&ifyukuaiCode="+ifyukuaiCode this.outUrl='https://wx.pangdly.com/#/unusedDetail?id='+option.orderId+'&pdOpenid='+pdOpenid+'&pdToken='+pdToken+'&pdCreateUserId='+pdCreateUserId+'&pdUserId='+pdUserId+'&ifyukuaiCode='+ifyukuaiCode
}, },
methods: { methods: {
} }
} }
</script> </script>
<style> <style>
......
...@@ -5,24 +5,24 @@ ...@@ -5,24 +5,24 @@
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
outUrl:"",//跳出地址 outUrl:'',//跳出地址
} }
}, },
onLoad(option) { onLoad(option) {
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 ifyukuaiCode=option.ifyukuaiCode//是否是渝快码跳入,渝快码跳入需要在H5端另外走流程 let ifyukuaiCode=option.ifyukuaiCode||''//是否是渝快码跳入,渝快码跳入需要在H5端另外走流程
this.outUrl="https://wx.pangdly.com/#/ordersList1?pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId+"&ifyukuaiCode="+ifyukuaiCode this.outUrl='https://wx.pangdly.com/#/ordersList1?pdOpenid='+pdOpenid+'&pdToken='+pdToken+'&pdCreateUserId='+pdCreateUserId+'&pdUserId='+pdUserId+'&ifyukuaiCode='+ifyukuaiCode
}, },
methods: { methods: {
} }
} }
</script> </script>
<style> <style>
This diff is collapsed.
...@@ -5,31 +5,31 @@ ...@@ -5,31 +5,31 @@
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
enterUrl:"",//进入页面路由 enterUrl:'',//进入页面路由
outUrl:"",//跳出页面路由 outUrl:'',//跳出页面路由
} }
}, },
onLoad(option){ onLoad(option){
let merchantId=option.merchantId let merchantId=option.merchantId||''
let productId=option.productId let productId=option.productId||''
let companyId=option.companyId let companyId=option.companyId||''
let orderSource=option.orderSource let orderSource=option.orderSource||''
let ifyukuaiCode=option.ifyukuaiCode//是否是渝快码跳入,渝快码跳入需要在H5端另外走流程 let ifyukuaiCode=option.ifyukuaiCode||''//是否是渝快码跳入,渝快码跳入需要在H5端另外走流程
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/#/scenicJointOrder?pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId let baseUrl='https://wx.pangdly.com/#/scenicJointOrder?pdOpenid='+pdOpenid+'&pdToken='+pdToken+'&pdCreateUserId='+pdCreateUserId+'&pdUserId='+pdUserId
let url="&merchantId="+merchantId+"&productId="+productId+"&orderSource="+orderSource+"&companyId="+companyId+"&ifyukuaiCode="+ifyukuaiCode let url='&merchantId='+merchantId+'&productId='+productId+'&orderSource='+orderSource+'&companyId='+companyId+'&ifyukuaiCode='+ifyukuaiCode
this.outUrl=baseUrl+url this.outUrl=baseUrl+url
}, },
methods: { methods: {
} }
} }
</script> </script>
<style> <style>
......
...@@ -5,56 +5,56 @@ ...@@ -5,56 +5,56 @@
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
enterUrl:"",//进入页面路由 enterUrl:'',//进入页面路由
outUrl:"",//跳出页面路由 outUrl:'',//跳出页面路由
} }
}, },
onLoad(option) { onLoad(option) {
//#ifdef MP-WEIXIN //#ifdef MP-WEIXIN
this.enterUrl=option.q this.enterUrl=option.q
//#endif //#endif
//#ifdef MP-ALIPAY //#ifdef MP-ALIPAY
this.enterUrl=uni.getStorageSync("alipayQrCode") this.enterUrl=uni.getStorageSync('alipayQrCode')
//#endif //#endif
if(this.enterUrl){//普通二维码扫码进入 if(this.enterUrl){//普通二维码扫码进入
let merchantId=this.getUrlKey("merchantId") let merchantId=this.getUrlKey('merchantId')
let productId=this.getUrlKey("productId") let productId=this.getUrlKey('productId')
let orderSource=this.getUrlKey("orderSource") let orderSource=this.getUrlKey('orderSource')
let companyId=this.getUrlKey("companyId") let companyId=this.getUrlKey('companyId')
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/#/scenicSingleOrder?pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId let baseUrl='https://wx.pangdly.com/#/scenicSingleOrder?pdOpenid='+pdOpenid+'&pdToken='+pdToken+'&pdCreateUserId='+pdCreateUserId+'&pdUserId='+pdUserId
let url="&merchantId="+merchantId+"&productId="+productId+"&orderSource="+orderSource+"&companyId="+companyId let url='&merchantId='+merchantId+'&productId='+productId+'&orderSource='+orderSource+'&companyId='+companyId
this.outUrl=baseUrl+url this.outUrl=baseUrl+url
}else{//小程序页面跳转进入 }else{//小程序页面跳转进入
let merchantId=option.merchantId let merchantId=option.merchantId||''
let productId=option.productId let productId=option.productId||''
let orderSource=option.orderSource let orderSource=option.orderSource||''
let companyId=option.companyId let companyId=option.companyId||''
let ifyukuaiCode=option.ifyukuaiCode//是否是渝快码跳入,渝快码跳入需要在H5端另外走流程 let ifyukuaiCode=option.ifyukuaiCode||''//是否是渝快码跳入,渝快码跳入需要在H5端另外走流程
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/#/scenicSingleOrder?pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId let baseUrl='https://wx.pangdly.com/#/scenicSingleOrder?pdOpenid='+pdOpenid+'&pdToken='+pdToken+'&pdCreateUserId='+pdCreateUserId+'&pdUserId='+pdUserId
let url="&merchantId="+merchantId+"&productId="+productId+"&orderSource="+orderSource+"&companyId="+companyId+"&ifyukuaiCode="+ifyukuaiCode let url='&merchantId='+merchantId+'&productId='+productId+'&orderSource='+orderSource+'&companyId='+companyId+'&ifyukuaiCode='+ifyukuaiCode
this.outUrl=baseUrl+url this.outUrl=baseUrl+url
} }
}, },
methods: { methods: {
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') || ''
}, },
} }
} }
</script> </script>
<style> <style>
......
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