This commit is contained in:
xiaozhiyong
2023-03-20 13:08:21 +08:00
parent da9ffdb20d
commit 604e9b3bb6
4 changed files with 51 additions and 40 deletions

View File

@@ -59,6 +59,7 @@
Vue.prototype.Custom = custom; Vue.prototype.Custom = custom;
Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight; Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
// #endif // #endif
// #ifdef MP-ALIPAY // #ifdef MP-ALIPAY
Vue.prototype.StatusBar = e.statusBarHeight; Vue.prototype.StatusBar = e.statusBarHeight;
Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight; Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;

View File

@@ -152,22 +152,24 @@
loginRes: {}, loginRes: {},
sessionKey: '', sessionKey: '',
nickName: '', nickName: '',
loginOut: uni.getStorageSync('loginOut') ? true : false loginOut: uni.getStorageSync('loginOut') ? true : false,
scanningParams:null
} }
}, },
onLoad() { onLoad(options) {
uni.clearStorageSync() uni.clearStorageSync()
this.refreshLocation() this.refreshLocation()
uni.login({ uni.login({
provider: 'weixin', provider: 'weixin',
success: (loginRes) => { success: (loginRes) => {
console.log(loginRes,'loginRes')
const code = loginRes.code const code = loginRes.code
this.onceCode = code this.onceCode = code
console.log(this.onceCode,'----------')
oilIdentityApi.sendCode(this.onceCode).then(res => { oilIdentityApi.sendCode(this.onceCode).then(res => {
console.log(res,'sendCode')
if (res.code === 20000) { if (res.code === 20000) {
if(options.scanningParams) {
// 用于扫码进入油站详情页面
this.scanningParams = options.scanningParams
}
this.sessionKey = res.data.sessionKey this.sessionKey = res.data.sessionKey
uni.setStorageSync('openid', res.data.openId) uni.setStorageSync('openid', res.data.openId)
uni.setStorageSync('unionid', res.data.unionId) uni.setStorageSync('unionid', res.data.unionId)
@@ -184,7 +186,6 @@
} }
}).catch(err => { }).catch(err => {
console.log(err)
uni.reLaunch({ uni.reLaunch({
url: '/BagAuth/pages/login/boforeLogin/boforeLogin', url: '/BagAuth/pages/login/boforeLogin/boforeLogin',
fail: (err) => { fail: (err) => {
@@ -231,7 +232,6 @@
decryptPhoneNumber(e) { decryptPhoneNumber(e) {
// console.log(e.detail)
if (e.detail.errMsg === 'getPhoneNumber:ok') { if (e.detail.errMsg === 'getPhoneNumber:ok') {
const data1 = { const data1 = {
...e.detail, ...e.detail,
@@ -251,7 +251,6 @@
bindLoginByPhone(data, url) { bindLoginByPhone(data, url) {
if (this.count < 1) { if (this.count < 1) {
oilIdentityApi.bindLoginByPhone(data, url).then(res => { oilIdentityApi.bindLoginByPhone(data, url).then(res => {
console.log(res)
if (res.code == 20000) { if (res.code == 20000) {
this.loginSuccess(res) this.loginSuccess(res)
@@ -278,11 +277,16 @@
title: res.msg, title: res.msg,
icon: 'none', icon: 'none',
complete: (err) => { complete: (err) => {
// console.log(err)
} }
}) })
}, 1000); }, 1000);
// 这里有问题 // 这里有问题
if(this.scanningParams) {
uni.redirectTo({
url: `/BagStation/pages/stationDetail/stationDetail?q=${this.scanningParams}`
})
return
}
uni.switchTab({ uni.switchTab({
url: '/pages/tabbar/home/home' url: '/pages/tabbar/home/home'
}) })

View File

@@ -180,21 +180,29 @@
} }
}, },
onHide() { onHide() {
console.log('这里是hiden') this.audioUrl && this.innerAudioContext.stop()
this.innerAudioContext.stop()
}, },
onUnload() { onUnload() {
console.log('这里是卸载页面') this.audioUrl && this.innerAudioContext.stop()
this.innerAudioContext.stop()
}, },
onLoad(option) { onLoad(option) {
console.log(22222) let userInfo = uni.getStorageSync('user')
if(!userInfo && option.q) {
uni.redirectTo({
url: `/BagAuth/pages/login/login?scanningParams=${option.q}`
})
return
}
if(option.q) { if(option.q) {
let originLink = decodeURIComponent(option.q) let originLink = decodeURIComponent(option.q)
let target = this.obtainUrlPathParameterTarget(originLink) let target = this.obtainUrlPathParameterTarget(originLink)
console.log('target',target) if(target.siteId) {
this.siteId = target.siteId
this.getSiteInfo(target.siteId)
}
return return
} }
@@ -204,6 +212,7 @@
}else{ }else{
var oilItem = JSON.parse(decodeURIComponent(option.item)) var oilItem = JSON.parse(decodeURIComponent(option.item))
} }
uni.setStorageSync('oilItem',oilItem) uni.setStorageSync('oilItem',oilItem)
this.getSiteInfo(oilItem.siteId) this.getSiteInfo(oilItem.siteId)
this.siteId = oilItem.siteId this.siteId = oilItem.siteId
@@ -239,12 +248,11 @@
console.log('开始播放'); console.log('开始播放');
}); });
this.innerAudioContext.onError((res) => { this.innerAudioContext.onError((res) => {
console.log(res.errMsg); console.log(res);
console.log(res.errCode);
}); });
}, },
backTohome(){ backTohome(){
this.innerAudioContext.stop() this.audioUrl && this.innerAudioContext.stop()
uni.switchTab({ uni.switchTab({
url:'../../../pages/tabbar/home/home' url:'../../../pages/tabbar/home/home'
}) })
@@ -253,7 +261,7 @@
this.showtitle =false this.showtitle =false
}, },
gotoPay(){ gotoPay(){
this.innerAudioContext.stop() this.audioUrl && this.innerAudioContext.stop()
uni.navigateTo({ uni.navigateTo({
url: `/BagStation/pages/makeOrder/makeOrder?siteId=${this.siteId}&activeCur=${this.activeCur}` url: `/BagStation/pages/makeOrder/makeOrder?siteId=${this.siteId}&activeCur=${this.activeCur}`
}) })
@@ -263,32 +271,28 @@
this.secondChannelCode = sec this.secondChannelCode = sec
}, },
siteQrPay() { siteQrPay() {
this.innerAudioContext.stop() this.audioUrl && this.innerAudioContext.stop()
// let siteId =
uni.navigateTo({ uni.navigateTo({
url: `/BagStation/pages/stationDetail/stieQr?siteId=${this.siteId}&activeChannelCode=${this.activeChannelCode}&secondChannelCode=${this.secondChannelCode}` url: `/BagStation/pages/stationDetail/stieQr?siteId=${this.siteId}&activeChannelCode=${this.activeChannelCode}&secondChannelCode=${this.secondChannelCode}`
}) })
}, },
getSiteInfo(id) { getSiteInfo(id) {
console.log('进入获取油站信息')
let data2 = { let data2 = {
...uni.getStorageSync('location'), ...uni.getStorageSync('location'),
siteId: id, siteId: id,
clientBelong: "ZHONGPIN" clientBelong: "ZHONGPIN"
} }
oilSiteApi.getSiteDetails(data2).then(res => { oilSiteApi.getSiteDetails(data2).then(res => {
console.log('进入获取油站信息getSiteDetails',res)
if (res.code == 20000) { if (res.code == 20000) {
this.siteInfo = res.data this.siteInfo = res.data
} }
}) })
}, },
makePay() { makePay() {
console.log(this.siteInfo.juli)
if(this.siteInfo.juli > 1000 ){ if(this.siteInfo.juli > 1000 ){
this.showtitle = true this.showtitle = true
}else{ }else{
this.innerAudioContext.stop() this.audioUrl && this.innerAudioContext.stop()
uni.navigateTo({ uni.navigateTo({
url: `/BagStation/pages/makeOrder/makeOrder?siteId=${this.siteId}&activeCur=${this.activeCur}` url: `/BagStation/pages/makeOrder/makeOrder?siteId=${this.siteId}&activeCur=${this.activeCur}`
}) })
@@ -316,10 +320,11 @@
}, },
goBack() { goBack() {
this.innerAudioContext.stop() // this.innerAudioContext.stop()
uni.navigateBack({
}) uni.switchTab({
url: '/pages/tabbar/home/home'
});
}, },
selectRadio() { selectRadio() {
this.radio === 'A' ? this.radio = '' : this.radio = 'A' this.radio === 'A' ? this.radio = '' : this.radio = 'A'

View File

@@ -489,25 +489,26 @@
}, },
getSiteList() { getSiteList() {
let data1 = { let params = {
currentPage: 1, currentPage: 1,
pageSize: 10, pageSize: 10,
params: { //类型Object 必有字段 备注:// 筛选对象 params: { //类型Object 必有字段 备注:// 筛选对象
clientBelong:'ZHONGPIN',
sort: "juli", //类型String 必有字段 备注:// 智能排序 ( price价格最低 juli距离最近 ) 默认距离排序
// longitude: 117.157817, // 必有字段 备注:// 当前位置经度 // longitude: 117.157817, // 必有字段 备注:// 当前位置经度
// latitude: 31.802472, // 必有字段 备注:// 当前位置维度 // latitude: 31.802472, // 必有字段 备注:// 当前位置维度
...uni.getStorageSync('location'),
...this.filterData,
// siteBrand: "", // 备注:// 石油品牌 ( 1-中国石油 2-中国石化 3-壳牌 4-民营 5-中海油 6-京博 7-中化石油 8-其他 ) // siteBrand: "", // 备注:// 石油品牌 ( 1-中国石油 2-中国石化 3-壳牌 4-民营 5-中海油 6-京博 7-中化石油 8-其他 )
// channelCode: "", // 备注:// 渠道编码 ( OIL星油 WJY万金油 LV老吕找油网 TY团油 YDJY一点加油壳牌) // channelCode: "", // 备注:// 渠道编码 ( OIL星油 WJY万金油 LV老吕找油网 TY团油 YDJY一点加油壳牌)
// oilProductCode: "0#" // 备注:// 油号选择 ( 0# 92# 92#) // oilProductCode: "0#" // 备注:// 油号选择 ( 0# 92# 92#)
comprehensiveSort:1 clientBelong:'ZHONGPIN',
comprehensiveSort:1,
zpDisable:'ENABLE',
sort: "juli", //类型String 必有字段 备注:// 智能排序 ( price价格最低 juli距离最近 ) 默认距离排序
...uni.getStorageSync('location'),
...this.filterData,
} }
} }
if (!uni.getStorageSync('user')) { if (!uni.getStorageSync('user')) {
oilSiteApi.readOnlySites(data1).then(res => { oilSiteApi.readOnlySites(params).then(res => {
this.getCount++ this.getCount++
if (res.code == 20000) { if (res.code == 20000) {
// console.log(res.data.list) // console.log(res.data.list)
@@ -542,10 +543,8 @@
} }
}) })
} else { } else {
console.log(data1,'dayindata111111111111') oilSiteApi.getSiteLists(params).then(res => {
oilSiteApi.getSiteLists(data1).then(res => {
if (res.code == 20000) { if (res.code == 20000) {
// console.log(res.data.list)
this.siteList = res.data.list this.siteList = res.data.list
} }
}) })
@@ -553,6 +552,8 @@
}, },
toDetail(item) { toDetail(item) {
let itemS = encodeURIComponent(JSON.stringify(item)) let itemS = encodeURIComponent(JSON.stringify(item))
// console.log(uni.getStorageSync('user'))
// return
if (uni.getStorageSync('user')) { if (uni.getStorageSync('user')) {
uni.navigateTo({ uni.navigateTo({
url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`, url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`,