Commit 8693c8c2 authored by 潘永坪's avatar 潘永坪

获取公共方法处理

parent 01d56b68
......@@ -130,18 +130,32 @@ export default{
uni.setStorageSync('companyId',companyId)
return companyId
},
//获取除companyId的其他参数
//获取页面参数
getKey:function(option,query){
let key=''
// 优先取值小程序页面参数,其次取值普通二维码
//#ifdef MP-WEIXIN
key=option[query]||this.getUrlKey(`${query}`,option.q)||''
//#endif
//#ifdef MP-ALIPAY
key=option[query]||this.getUrlKey(`${query}`,uni.getStorageSync('alipayQrCode'))||''
//#endif
return key
if(query=='companyId'){
// 优先取值小程序页面参数,其次取值普通二维码,再次取缓存里面的值
//#ifdef MP-WEIXIN
key=option[query]||this.getUrlKey(`${query}`,option.q)||uni.getStorageSync(query)||''
//#endif
//#ifdef MP-ALIPAY
key=option[query]||this.getUrlKey(`${query}`,uni.getStorageSync('alipayQrCode'))||uni.getStorageSync(query)||''
//#endif
uni.setStorageSync(query,key)
return key
}else{
// 优先取值小程序页面参数,其次取值普通二维码
//#ifdef MP-WEIXIN
key=option[query]||this.getUrlKey(`${query}`,option.q)||''
//#endif
//#ifdef MP-ALIPAY
key=option[query]||this.getUrlKey(`${query}`,uni.getStorageSync('alipayQrCode'))||''
//#endif
return key
}
}
}
//调用方法时--this.$commonjs.today()
\ No newline at end of file
......@@ -353,14 +353,14 @@ export default {
}
},
onLoad(options) {
this.$commonjs.getCompanyId(options)
this.$commonjs.getKey(options,'companyId')
this.openid = uni.getStorageSync('openid')
this.userId = uni.getStorageSync('userId')
this.recordDeviceInfo()
this.options = options
if (this.options.template === 'true') { // 从模板选择页进入
this.show = true
this.couponTip = true
this.couponTip = true
}else if (this.options.channelId) { // 扫码进入本页
this.handleWhetherToVotePage()
} else if (this.options.index == 1) { // 从vlog首页进入
......
......@@ -174,7 +174,7 @@ export default {
}
},
onLoad(option) {
this.companyId = this.$commonjs.getCompanyId(option)||''
this.companyId = this.$commonjs.getKey(option,'companyId')||''
//this.companyId = '6da527f930be4aa1904fe17fcb41874f'
this.openid = uni.getStorageSync('openid') //获取openid
//this.openid = 'oh2UV1lyYABHMZ1rMlgjhVHyyYDQ' //获取openid oroHZ5B455jLw_BqDmVpr7W13NLY
......
......@@ -331,7 +331,7 @@ export default {
},
onLoad(option) {
//获取公司Id,保存到本地,支付等逻辑需要入口companyId
this.companyId=this.$commonjs.getCompanyId(option)||''
this.companyId=this.$commonjs.getKey(option,'companyId')||''
this.merchantId = this.$commonjs.getKey(option,'merchantId')|| ''
this.channelId=this.$commonjs.getKey(option,'channelId')||''
this.groupId=this.$commonjs.getKey(option,'groupId')||''
......
......@@ -15,7 +15,7 @@ export default {
onLoad(option){
let groupId=option.groupId||''
let groupChannelId=option.groupChannelId||''
let companyId=this.$commonjs.getCompanyId(option)|| ''
let companyId=this.$commonjs.getKey(option,'companyId')||''
let productIdList=option.productIdList||''
let orderSource=option.orderSource||''
let ifyukuaiCode=option.ifyukuaiCode||''//是否是渝快码跳入,渝快码跳入需要在H5端另外走流程
......
......@@ -314,7 +314,7 @@ export default {
}, 2500)
}
//获取公司Id,保存到本地,支付等逻辑需要入口companyId
this.companyId=this.$commonjs.getCompanyId(option)||''
this.companyId=this.$commonjs.getKey(option,'companyId')||''
this.merchantId = this.$commonjs.getKey(option,'merchantId')|| ''
this.channelId=this.$commonjs.getKey(option,'channelId')||''
this.groupId=this.$commonjs.getKey(option,'groupId')||''
......
......@@ -314,7 +314,7 @@ export default {
}, 2500)
}
//获取公司Id,保存到本地,支付等逻辑需要入口companyId
this.companyId=this.$commonjs.getCompanyId(option)||''
this.companyId=this.$commonjs.getKey(option,'companyId')||''
this.merchantId = this.$commonjs.getKey(option,'merchantId')|| ''
this.channelId=this.$commonjs.getKey(option,'channelId')||''
this.groupId=this.$commonjs.getKey(option,'groupId')||''
......
......@@ -12,7 +12,7 @@ export default {
}
},
onLoad(option) {
let companyId=this.$commonjs.getCompanyId(option)
let companyId=this.$commonjs.getKey(option,'companyId')||''
let pdOpenid=uni.getStorageSync('openid')||''//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync('token')||''
let pdCreateUserId=uni.getStorageSync('createUserId')||''
......
......@@ -150,7 +150,7 @@ export default {
},
onLoad(option){
// 首次进入时执行
let companyId=this.$commonjs.getCompanyId(option)
let companyId=this.$commonjs.getKey(option,'companyId')||''
if(!companyId){
this.getCompanyId()
}
......
......@@ -174,7 +174,7 @@ export default {
},
onLoad(option) {
//获取公司Id,保存到本地,支付等逻辑需要入口companyId
this.$commonjs.getCompanyId(option)
this.$commonjs.getKey(option,'companyId')
let token = uni.getStorageSync('token')||''
if(token){
uni.getLocation({
......
......@@ -12,7 +12,7 @@ export default {
}
},
onLoad(option) {
let companyId=this.$commonjs.getCompanyId(option)
let companyId=this.$commonjs.getKey(option,'companyId')||''
let pdOpenid=uni.getStorageSync('openid')||''//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync('token')||''
let pdCreateUserId=uni.getStorageSync('createUserId')||''
......
......@@ -12,7 +12,7 @@ export default {
}
},
onLoad(option) {
let companyId=this.$commonjs.getCompanyId(option)
let companyId=this.$commonjs.getKey(option,'companyId')||''
let pdOpenid=uni.getStorageSync('openid')||''//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync('token')||''
let pdCreateUserId=uni.getStorageSync('createUserId')||''
......
......@@ -12,7 +12,7 @@ export default {
}
},
onLoad(option) {
let companyId=this.$commonjs.getCompanyId(option)
let companyId=this.$commonjs.getKey(option,'companyId')||''
let pdOpenid=uni.getStorageSync('openid')||''//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync('token')||''
let pdCreateUserId=uni.getStorageSync('createUserId')||''
......
......@@ -12,7 +12,7 @@ export default {
}
},
onLoad(option) {
let companyId=this.$commonjs.getCompanyId(option)
let companyId=this.$commonjs.getKey(option,'companyId')||''
let pdOpenid=uni.getStorageSync('openid')||''//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync('token')||''
let pdCreateUserId=uni.getStorageSync('createUserId')||''
......
......@@ -12,7 +12,7 @@ export default {
}
},
onLoad(option) {
let companyId=this.$commonjs.getCompanyId(option)
let companyId=this.$commonjs.getKey(option,'companyId')||''
let pdOpenid=uni.getStorageSync('openid')||''//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync('token')||''
let pdCreateUserId=uni.getStorageSync('createUserId')||''
......
......@@ -12,7 +12,7 @@ export default {
}
},
onLoad(option) {
let companyId=this.$commonjs.getCompanyId(option)
let companyId=this.$commonjs.getKey(option,'companyId')||''
let pdOpenid=uni.getStorageSync('openid')||''//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync('token')||''
let pdCreateUserId=uni.getStorageSync('createUserId')||''
......
......@@ -12,7 +12,7 @@ export default {
}
},
onLoad(option) {
let companyId=this.$commonjs.getCompanyId(option)
let companyId=this.$commonjs.getKey(option,'companyId')||''
let pdOpenid=uni.getStorageSync('openid')||''//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync('token')||''
let pdCreateUserId=uni.getStorageSync('createUserId')||''
......
......@@ -12,7 +12,7 @@ export default {
}
},
onLoad(option) {
let companyId=this.$commonjs.getCompanyId(option)
let companyId=this.$commonjs.getKey(option,'companyId')||''
let pdOpenid=uni.getStorageSync('openid')||''//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync('token')||''
let pdCreateUserId=uni.getStorageSync('createUserId')||''
......
......@@ -416,7 +416,7 @@ export default {
}
},
onLoad(option) {
this.companyId=this.$commonjs.getCompanyId(option)|| ''
this.companyId=this.$commonjs.getKey(option,'companyId')|| ''
this.groupId=option.groupId||''
this.groupChannelId=option.groupChannelId||''
this.orderSource=option.orderSource||''
......
......@@ -12,7 +12,7 @@ export default {
}
},
onLoad(option) {
let companyId=this.$commonjs.getCompanyId(option)
let companyId=this.$commonjs.getKey(option,'companyId')|| ''
let pdOpenid=uni.getStorageSync('openid')||''//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
let pdToken=uni.getStorageSync('token')||''
let pdCreateUserId=uni.getStorageSync('createUserId')||''
......
......@@ -15,7 +15,7 @@ export default {
onLoad(option){
let merchantId=option.merchantId||''
let productId=option.productId||''
let companyId=this.$commonjs.getCompanyId(option)|| ''
let companyId=this.$commonjs.getKey(option,'companyId')||''
let orderSource=option.orderSource||''
let ifyukuaiCode=option.ifyukuaiCode||''//是否是渝快码跳入,渝快码跳入需要在H5端另外走流程
let pdOpenid=uni.getStorageSync('openid')//胖丁小程序openid,临时用,当公众号授权做好之后可以删除
......
......@@ -128,7 +128,7 @@ export default {
},
onLoad(option) {
this.nowTime=parseInt(new Date().Format('hhmm'))
this.companyId=this.$commonjs.getCompanyId(option)||''
this.companyId=this.$commonjs.getKey(option,'companyId')||''
this.merchantId = this.$commonjs.getKey(option,'merchantId')|| ''
this.channelType = this.$commonjs.getKey(option,'channelType')|| 0
this.initProduct()
......
......@@ -483,10 +483,10 @@ export default {
onLoad(option) {
let times = new Date().Format('yyyy-MM-dd hh:mm:ss')
this.timeNumber = parseInt(this.$commonjs.changeTime(times)) //将当前时间转化为数字
this.companyId=this.$commonjs.getCompanyId(option)|| ''
this.orderSource = this.$commonjs.getKey(option,'orderSource')|| ''
this.thirdOpenid = this.$commonjs.getKey(option,'thirdOpenid')|| '' //第三方openid
this.productId = this.$commonjs.getKey(option,'productId') || ''
this.companyId=this.$commonjs.getKey(option,'companyId')||''
this.orderSource = this.$commonjs.getKey(option,'orderSource')||''
this.thirdOpenid = this.$commonjs.getKey(option,'thirdOpenid')||'' //第三方openid
this.productId = this.$commonjs.getKey(option,'productId') ||''
//#ifdef MP-WEIXIN
this.initData() //页面初始化数据
//#endif
......
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