Commit 5c5c61ca authored by 潘永坪's avatar 潘永坪

支付页面参数修改

parent 3ad0f954
<script>
// 1、uni-app的页面生命周期仅在page页面有效,而单独封装的组件中【页面周期无效】,
//但是Vue的生命周期依然有效 【Vue的生命周期在任何地方都是有效的,即你仍然可以在uni-app项目中使用Vue生命周期,但是不建议这么做】
// 2、推荐使用uni-app里面的onLoad 代替 vue 里面的 created
// 3、推荐使用uni-app里面的onReady 代替 vue 里面的 mounted
//4.setStorageSync与setStorage的区别:如果后续的操作需要使用更新storage后保存的data,则使用setStorageSync使用异步性能更好,使用同步数据更安全
export default {
onLaunch: function(options) { //初始化完成时触发(全局只触发一次
let today = this.$commonjs.today()
let oldDate = uni.getStorageSync('oldDate')
//大于7天重新登录
if (oldDate) {
let number = this.$commonjs.dateDifference(today, oldDate)
if (number > 7) {
uni.clearStorageSync()
}
} else {
//用于处理这个功能之前登录过的用户,未保存登录时间
uni.clearStorageSync()
}
let path = options.path
uni.setStorageSync('enterOptions', options)
let token = uni.getStorageSync('token')
if (!token && path.indexOf('pages/payment/ourPayment/ourPayment') == -1) { //扫码支付页面不需要在此登录
setTimeout(() => { //解决关联普通二维码扫码首次进入时一直显示登录中
uni.navigateTo({
url: '/pages/login/login'
})
}, 300)
}
//#ifdef MP-WEIXIN
uni.setStorageSync('appid', 'wxe678d5240e98a7b8')
//#endif
// 1、uni-app的页面生命周期仅在page页面有效,而单独封装的组件中【页面周期无效】,
//但是Vue的生命周期依然有效 【Vue的生命周期在任何地方都是有效的,即你仍然可以在uni-app项目中使用Vue生命周期,但是不建议这么做】
// 2、推荐使用uni-app里面的onLoad 代替 vue 里面的 created
// 3、推荐使用uni-app里面的onReady 代替 vue 里面的 mounted
//4.setStorageSync与setStorage的区别:如果后续的操作需要使用更新storage后保存的data,则使用setStorageSync使用异步性能更好,使用同步数据更安全
export default {
onLaunch: function(options) { //初始化完成时触发(全局只触发一次
let today = this.$commonjs.today()
let oldDate = uni.getStorageSync('oldDate')
//大于7天重新登录
if (oldDate) {
let number = this.$commonjs.dateDifference(today, oldDate)
if (number > 7) {
uni.clearStorageSync()
}
} else {
//用于处理这个功能之前登录过的用户,未保存登录时间
uni.clearStorageSync()
}
let path = options.path
uni.setStorageSync('enterOptions', options)
let token = uni.getStorageSync('token')
if (!token && path.indexOf('pages/payment/ourPayment/ourPayment') == -1) { //扫码支付页面不需要在此登录
setTimeout(() => { //解决关联普通二维码扫码首次进入时一直显示登录中
uni.navigateTo({
url: '/pages/login/login'
})
}, 300)
}
//#ifdef MP-WEIXIN
uni.setStorageSync('appid', 'wxe678d5240e98a7b8')
//#endif
//#ifdef MP-ALIPAY
if (options.query && options.query.qrCode) {
uni.setStorageSync('alipayQrCode', options.query.qrCode)
} else {
uni.removeStorageSync('alipayQrCode')
}
//#endif
/* 版本自动更新代码 */
const updateManager = uni.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
console.log('是否有更新:' + res.hasUpdate) // 请求完新版本信息的回调 true说明有更新
})
updateManager.onUpdateReady(function () {
uni.showModal({
title: '更新检测', // 此处可自定义提示标题
content: '检测到新版本,是否重启小程序?', // 此处可自定义提示消息内容
success: function (res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
})
updateManager.onUpdateFailed(function () {
// 新的版本下载失败
uni.showModal({
title: '更新提示',
content: '新版本下载失败',
showCancel: false
})
})
},
onShow: function() {
//#ifdef MP-ALIPAY
uni.setStorageSync('appid', '2021001194629244')
if (options.query && options.query.qrCode) {
uni.setStorageSync('alipayQrCode', options.query.qrCode)
} else {
uni.removeStorageSync('alipayQrCode')
}
//#endif
/* 版本自动更新代码 */
const updateManager = uni.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
console.log('是否有更新:' + res.hasUpdate) // 请求完新版本信息的回调 true说明有更新
})
updateManager.onUpdateReady(function () {
uni.showModal({
title: '更新检测', // 此处可自定义提示标题
content: '检测到新版本,是否重启小程序?', // 此处可自定义提示消息内容
success: function (res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
})
updateManager.onUpdateFailed(function () {
// 新的版本下载失败
uni.showModal({
title: '更新提示',
content: '新版本下载失败',
showCancel: false
})
})
},
onShow: function() {
},
onHide: function() {
},
onHide: function() {
}
}
}
}
</script>
<style lang="scss">
......
......@@ -6,20 +6,20 @@
export default {
data() {
return {
timer:null,
}
timer:null,
}
},
onLoad() {
this.login()
},
// 一般页面用onUnload
// tabbar页面用onHide
onUnload() {
if(this.timer) {
clearTimeout(this.timer)
this.timer = null
}
},
// 一般页面用onUnload
// tabbar页面用onHide
onUnload() {
if(this.timer) {
clearTimeout(this.timer)
this.timer = null
}
},
methods:{
//---登录
login(){
......@@ -40,8 +40,10 @@ export default {
let data = {
code: res.code,
source, //微信小程序3,支付宝小程序4
companyId:uni.getStorageSync('enterOptions').query.companyId||'',
appid:uni.getStorageSync('appid')||''
appid:uni.getStorageSync('appid')||''
}
if(uni.getStorageSync('enterOptions').query){
data.companyId=uni.getStorageSync('enterOptions').query.companyId||''
}
_this.$request('wechat/wx/getUserInfoByCode', data).then(res => {
if (res.code == '00') {
......@@ -68,9 +70,9 @@ export default {
uni.redirectTo({
url: '/' + enterOptions.path + '?' + queryTotal
})
//保存当前日期
let oldDate=_this.$commonjs.today()
uni.setStorageSync('oldDate', oldDate)
//保存当前日期
let oldDate=_this.$commonjs.today()
uni.setStorageSync('oldDate', oldDate)
// uni.navigateBack({
// delta:1
// })
......
......@@ -140,8 +140,10 @@ export default {
let data = {
code: res.code,
source, //微信小程序3,支付宝小程序4
companyId:uni.getStorageSync('enterOptions').query.companyId||'',
appid:uni.getStorageSync('appid')||''
appid:uni.getStorageSync('appid')||''
}
if(uni.getStorageSync('enterOptions').query){
data.companyId=uni.getStorageSync('enterOptions').query.companyId||''
}
_this.$request('wechat/wx/getUserInfoByCode', data)
.then(res => {
......@@ -177,13 +179,13 @@ export default {
}
this.$request('orderc/order/findOrderInfo', data).then(res => {
if (res.code == '00') {
if(res.data.orderType=='10'){
//组合票和联票跳订单列表
this.afterBuyUrl='/pages/my/order/orderList/orderList'
}else{
//单票跳详情
this.afterBuyUrl='/pages/my/order/electronicTicket/electronicTicket'
}
if(res.data.orderType=='10'){
//组合票和联票跳订单列表
this.afterBuyUrl='/pages/my/order/orderList/orderList'
}else{
//单票跳详情
this.afterBuyUrl='/pages/my/order/electronicTicket/electronicTicket'
}
this.bodyShow = true
//支付参数开始
this.timeStamp = res.data.timestamp
......@@ -196,9 +198,9 @@ export default {
//支付参数结束
this.pdOrderMoney = res.data.pdOrderMoney
if (this.pdOrderMoney == 0 && res.data.subOrderType == -1) {
this.afterBuyUrl='/pages/my/order/electronicTicket/electronicTicket'
this.afterBuyUrl='/pages/my/order/electronicTicket/electronicTicket'
uni.navigateTo({
url: '/pages/payment/paySuccess/paySuccess?orderId=' + _this.orderId+'&afterBuyUrl=' + _this.afterBuyUrl + '&ifyukuaiCode=' + _this.ifyukuaiCode
url: '/pages/payment/paySuccess/paySuccess?orderId=' + _this.orderId+'&afterBuyUrl=' + _this.afterBuyUrl + '&ifyukuaiCode=' + _this.ifyukuaiCode
})
}
this.errorMessage = res.data.errorMessage
......
This diff is collapsed.
......@@ -37,7 +37,7 @@
}
this.ticketStatus()
intFun()
}, 1200)
}, 2000)
}
intFun()
},
......
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