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

获取公共方法处理

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