This commit is contained in:
xiaozhiyong
2024-09-23 08:48:47 +08:00
parent bd75b1f7ac
commit 5803d8a222
12 changed files with 337 additions and 356 deletions

View File

@@ -22,7 +22,7 @@
}
},
mounted() {
console.log('广告组件挂载完成');
// console.log('广告组件挂载完成');
this.showAdvertisement()
},
methods: {

View File

@@ -17,6 +17,7 @@
return {
showAdvertisement: false,
key: '',
isOnline:false,
option: null,
imgURL: this.global.imgURL + 'start/',
yellowURL: this.global.yellowURL + 'xq-ad/',
@@ -96,10 +97,10 @@
const token = uni.getStorageSync('Authorization')
const openid = uni.getStorageSync('openid')
// this.key = '';
let isOnline = false;
// this.isOnline = false;
if (token) {
await oilSiteApi.isLoginSuccess().then(res => {
if (res.code == 20000) isOnline = true
if (res.code == 20000) this.isOnline = true
}).catch(err => {})
}
// console.log(isOnline,'isOnline')
@@ -108,7 +109,7 @@
// } else {
// this.key = '离线'
// }
if (isOnline) {
if (this.isOnline) {
if (!uni.getStorageSync('filterData')) {
this.getFilterData()
} else if (uni.getStorageSync('filterData')[0].detailList.length < 2) {
@@ -124,21 +125,21 @@
}
},
goHome(type) {
if (type) {
uni.setStorageSync('isJump', {
page: 'Financial/pages/estimate/index',
disposable: true
if (this.isOnline) {
if (type) {
uni.setStorageSync('isJump', {
page: 'Financial/pages/estimate/index',
disposable: true
})
}
uni.switchTab({
url: `/pages/tabbar/home/home`
})
} else {
uni.redirectTo({
url: '/BagAuth/pages/login/login'
})
}
uni.switchTab({
url: `/pages/tabbar/home/home`
})
// if (this.key == '在线') {
// } else {
// uni.redirectTo({
// url: '/BagAuth/pages/login/login'
// })
// }
},
Interceptor(id) {
// let taht = this
@@ -167,9 +168,9 @@
...res.data,
qrCode: id
}),
fail(e) {
console.log(e, '跳转失败')
}
// fail(e) {
// console.log(e, '跳转失败')
// }
})
}
})

View File

@@ -158,7 +158,8 @@
</view>
</view>
<msg-models :showAuthFrror="showAuthFrror" @hideOneModal="hideModel"></msg-models>
<three-sites v-if="showThreeSites" @hideOneModal="showThreeSites=false" :showThreeSites="showThreeSites"></three-sites>
<three-sites v-if="showThreeSites" @hideOneModal="showThreeSites=false"
:showThreeSites="showThreeSites"></three-sites>
<transBlcok ref="transBlcok" />
<!-- <tabbar :current-page="0"/> -->
</view>
@@ -241,7 +242,7 @@
}]
}
],
getCount: 0,
// getCount: 0,
siteList: [],
height: 0,
starUrl: this.global.starUrl,
@@ -329,7 +330,7 @@
},
watch: {
showAuthFrror(n, o) {
console.log(n, o, '=================')
// console.log(n, o, '=================')
}
},
@@ -403,18 +404,11 @@
},
onShow() {
const token = uni.getStorageSync('Authorization')
const openid = uni.getStorageSync('openid')
if (token && openid) {
if (token) {
this.getAuthInfo()
this.refreshLocation()
} else {
uni.showToast({
title: '您还没有登录哦',
icon: "none"
})
}
this.getSiteList();
this.refreshLocation()
// this.getSiteList();
},
mounted() {},
beforeCreate() {},
@@ -427,7 +421,7 @@
if (res.code == '20000') {
uni.showToast({
title: '该油卡已被禁用',
icon:'none'
icon: 'none'
})
uni.clearStorageSync()
uni.setStorageSync('loginOut', true)
@@ -449,7 +443,7 @@
customerId: cardInfo.customerId
}).then(res => {
if (res.code === 20000) {
if(res.data.accountState == 0) {
if (res.data.accountState == 0) {
this.logOut()
}
}
@@ -507,22 +501,28 @@
success: function(res) {
uni.setStorageSync('location', res)
},
fail: err => {
if (err.errMsg === "getLocation:fail auth deny") {
uni.showModal({
title: "提示",
content: "您已拒绝获取位置信息,请重新授权",
confirmText: "开启定位",
success: (res) => {
if (res.confirm) {
uni.openSetting({
success: (res) => {
if (res.authSetting["scope.userLocation"]) {
this.refreshLocation()
}
},
});
}
},
});
}
},
complete: (res) => {
this.getSiteList()
var msgTip = ''
if (res.errMsg == 'getLocation:fail auth deny') {
msgTip = '请允许小程序获取您的位置'
} else if (res.errMsg == 'getLocation:fail:ERROR_NOCELL&WIFI_LOCATIONSWITCHOFF') {
msgTip = '请您打开手机定位'
}
if (msgTip) {
setTimeout(() => {
uni.showToast({
title: msgTip,
icon: 'none'
})
}, 300)
}
}
});
},
@@ -585,22 +585,20 @@
url: '/pages/tabbar/station/stationList'
})
} else if (index == 1) {
if (!uni.getStorageSync('user')) {
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳​˙)♡",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {
uni.reLaunch({
url: '../../../BagAuth/pages/login/login'
})
}
}
})
return
}
// if (!uni.getStorageSync('user')) {
// uni.showModal({
// content: "登录后才能查看哦",
// confirmText: '去登陆',
// success: (res) => {
// if (res.confirm) {
// uni.reLaunch({
// url: '../../../BagAuth/pages/login/login'
// })
// }
// }
// })
// return
// }
uni.removeStorageSync("origins")
uni.removeStorageSync("destination")
wx.navigateTo({
@@ -611,26 +609,29 @@
} else if (index == 9) {
this.goToPage('/BagAuth/pages/agreeMent/OperationGuide')
} else if (index == 2) {
if (!uni.getStorageSync('user')) {
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳​˙)♡",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {
uni.reLaunch({
url: '../../../BagAuth/pages/login/login'
})
}
}
})
return
}
// if (!uni.getStorageSync('user')) {
// uni.showModal({
// content: "登录后才能查看哦",
// confirmText: '去登陆',
// success: (res) => {
// if (res.confirm) {
// uni.reLaunch({
// url: '../../../BagAuth/pages/login/login'
// })
// }
// }
// })
// return
// }
wx.navigateTo({
url: '../../../BagStation/pages/overviewMap/overviewMap',
})
} else if (index == 6) {
uni.showToast({
title: '功能即将开放,敬请期待',
icon: 'none'
})
return
const user = uni.getStorageSync('user');
if (user) {
Financial.findHomePageReport({
@@ -657,7 +658,7 @@
this.swiperClick(this.swiperArray[0], 1)
} else {
uni.showToast({
title: '功能暂无',
title: '功能即将开放,敬请期待',
icon: 'none'
})
}
@@ -670,8 +671,7 @@
// })
if (!uni.getStorageSync('user')) {
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳​˙)♡",
content: "登录后才能查看哦",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {
@@ -731,38 +731,20 @@
})
return
}
this.getCount++
// this.getCount++
if (res.code == 20000) {
// console.log(res.data.list)
this.siteList = res.data.list
} else {
if (this.getCount == 1) {
setTimeout(() => {
this.getSiteList()
}, 1000)
}
// else {
// if (this.getCount == 1) {
// setTimeout(() => {
// this.getSiteList()
// }, 1000)
} else {
uni.getSetting({
success: (resSet) => {
if (resSet.authSetting['scope.address'] == false) {
uni.showMode({
title: '请您打开定位权限',
content: '用于获取您当前位置附近的油站',
confirmText: '去设置',
success: (res) => {
if (res.confirm) {
uni.openSetting({
})
}
}
})
}
}
})
}
}
// }
// }
})
} else {
oilSiteApi.getSiteList(data1).then(res => {
@@ -775,33 +757,31 @@
},
toDetail(item) {
let itemS = JSON.stringify(item)
if (uni.getStorageSync('user')) {
if (item.channelCode === 'TY') {
uni.setStorageSync('OtherSiteInfo', item)
uni.navigateTo({
url: `/BagStation/pages/stationDetail/stationDetail?channerCode=${item.channelCode}`,
})
return
}
if (item.channelCode === 'TY') {
uni.setStorageSync('OtherSiteInfo', item)
uni.navigateTo({
url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`,
})
} else {
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳​˙)♡",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {
uni.reLaunch({
url: '../../../BagAuth/pages/login/login'
})
}
}
url: `/BagStation/pages/stationDetail/stationDetail?channerCode=${item.channelCode}`,
})
return
}
uni.navigateTo({
url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`,
})
// if (uni.getStorageSync('user')) {
// } else {
// uni.showModal({
// content: "登录后才能查看哦",
// confirmText: '去登陆',
// success: (res) => {
// if (res.confirm) {
// uni.reLaunch({
// url: '../../../BagAuth/pages/login/login'
// })
// }
// }
// })
// }
},
getFilterData() {
oilSiteApi.getCheckInfo().then(res => {
@@ -901,16 +881,12 @@
}
})
},
scan1() {
// 测试用
this.getScanRes('fixed_1371293944539422720')
},
openScan() {
let user = uni.getStorageSync('user')
if (!user) {
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳​˙)♡",
content: "登录后才能查看哦",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {

View File

@@ -68,8 +68,8 @@
qrFn(){
if(!uni.getStorageSync('user')){
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳​˙)♡",
content: "登录后才能查看哦",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {
@@ -136,15 +136,12 @@
}
})
},
scan1() {
// 测试用
this.getScanRes('fixed_1371293944539422720')
},
scan() {
if(!uni.getStorageSync('user')){
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳​˙)♡",
content: "登录后才能查看哦",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {

View File

@@ -132,7 +132,7 @@
}
]
},
{
title: '0#轻柴油',
key: 'oilProductCode',
@@ -239,12 +239,12 @@
onLoad() {
if (!uni.getStorageSync('filterDatas')) {
this.getFilterData()
} else {}
}
this.findPriceDetails()
if (uni.getStorageSync('productCodeList')) {
this.productCodeList = uni.getStorageSync('productCodeList')
}
this.getSiteList()
// this.getSiteList()
},
onPullDownRefresh() {
this.updateFn()
@@ -282,7 +282,7 @@
pageSize: 10,
params: { //类型Object 必有字段 备注:// 筛选对象
// siteNameOrId: this.siteName, //产品类型(加注方式)
address:this.siteAddress,
address: this.siteAddress,
productType: this.productType ? this.productType : '', //1-加注机; 2-桶装
brandName: this.brandName ? this.brandName : '', // 桶装品牌名称
currentLongitude: location.longitude + '', // 当前经度
@@ -328,11 +328,28 @@
},
changeHaed(code) {
this.TabHead = code
this.siteList = []
// this.siteList = []
this.siteAddress = ''
this.currentPage = 1
if (code == 1) {
this.getUreaList()
if (uni.getStorageSync('user')) {
this.getUreaList()
} else {
uni.showModal({
content: "登录后才能查看哦",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {
uni.reLaunch({
url: '/BagAuth/pages/login/login'
})
} else {
this.changeHaed(0)
}
}
})
}
} else if (code == 0) {
this.getSiteList()
}
@@ -340,31 +357,31 @@
ureaToDetail(list) {
let itemS = JSON.stringify(list)
if (uni.getStorageSync('user')) {
uni.navigateTo({
url: `/BagStation/pages/ureaDetail/ureaDetail?item=${itemS}`
})
} else {
uni.showModal({
title: '请您登录',
content: "登录小星加油才可以加油 |˛˙꒳​˙)♡",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {
uni.reLaunch({
url: '../../../BagAuth/pages/login/login'
})
}
}
})
}
uni.navigateTo({
url: `/BagStation/pages/ureaDetail/ureaDetail?item=${itemS}`
})
// if (uni.getStorageSync('user')) {
// } else {
// uni.showModal({
// content: "登录后才能查看哦",
// confirmText: '去登陆',
// success: (res) => {
// if (res.confirm) {
// uni.reLaunch({
// url: '/BagAuth/pages/login/login'
// })
// }
// }
// })
// }
},
filterRes(val) {
console.log(val, '重置')
if (this.TabHead == 0) {
this.filterDatas = val
this.currentPage = 1
this.siteList = []
// this.siteList = []
this.getSiteList()
} else {
if (val.formats == 2) {
@@ -376,7 +393,7 @@
this.productType = val.formats
this.brandName = val.productType
this.currentPage = 1
this.siteList = []
// this.siteList = []
this.getUreaList()
}
},
@@ -393,7 +410,6 @@
this.productCodeList = uni.getStorageSync('productCodeList')
res.data.channelCodes.map(item => {
// this.menuList[3].detailLists.push({
// title: item.name,
// value: item.id
@@ -433,7 +449,7 @@
},
]
}
console.log(this.menuList, uni.getStorageSync('areaCodeList'), '----')
// console.log(this.menuList, uni.getStorageSync('areaCodeList'), '----')
})
},
onSelected(e) {
@@ -448,8 +464,6 @@
}
this.ureaMenuList[1].detailList.push(obj)
})
console.log(this.ureaMenuList)
console.log(this.productTypes)
})
},
refreshLocation() {
@@ -458,34 +472,44 @@
success: function(res) {
uni.setStorageSync('location', res)
},
complete(res) {
console.log('定位', res)
var msgTip = ''
if (res.errMsg == 'getLocation:fail auth deny') {
msgTip = '请允许小程序获取您的位置'
} else if (res.errMsg == 'getLocation:fail:ERROR_NOCELL&WIFI_LOCATIONSWITCHOFF') {
msgTip = '请您打开手机定位'
fail: err => {
if (err.errMsg === "getLocation:fail auth deny") {
uni.showModal({
title: "提示",
content: "您已拒绝获取位置信息,请重新授权",
confirmText: "开启定位",
success: (res) => {
if (res.confirm) {
uni.openSetting({
success: (res) => {
if (res.authSetting[
"scope.userLocation"]) {
this.currentPage = 1
// this.siteList = []
this.refreshLocation()
}
},
});
}
},
});
}
if (msgTip) {
setTimeout(() => {
uni.showToast({
title: msgTip,
icon: 'none'
})
}, 300)
}
},
complete: () => {
this.getSiteList()
}
})
},
getSiteList() {
this.refreshLocation()
let location = uni.getStorageSync('location')
// this.refreshLocation()
// let location = uni.getStorageSync('location')
let data1 = {
currentPage: this.currentPage,
pageSize: 10,
params: {
siteAddress: this.siteAddress,
longitude: 116.397451,
latitude: 39.909187,
...uni.getStorageSync('location'),
siteBrand: this.filterDatas
.siteBrand, // 备注:// 石油品牌 ( 1-中国石油 2-中国石化 3-壳牌 4-民营 5-中海油 6-京博 7-中化石油 8-其他 )
@@ -506,8 +530,11 @@
data1.params.role = 1
oilSiteApi.readOnlySites(data1).then(res => {
if (res.code == 20000) {
if (this.currentPage == 1) {
this.siteList = []
}
this.siteList = this.siteList.concat(res.data.list)
if (res.data.list.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
if (res.data.list.length < 10) {
this.loadStatus = 'nomore'
} else {
this.currentPage++
@@ -518,9 +545,11 @@
} else {
oilSiteApi.getSiteList(data1).then(res => {
if (res.code == 20000) {
console.log(res, '+++')
if (this.currentPage == 1) {
this.siteList = []
}
this.siteList = this.siteList.concat(res.data.list)
if (res.data.list.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
if (res.data.list.length < 10) {
this.loadStatus = 'nomore'
} else {
this.currentPage++
@@ -534,32 +563,31 @@
toDetail(item) {
let itemS = JSON.stringify(item)
if (uni.getStorageSync('user')) {
if (item.channelCode === 'TY') {
uni.setStorageSync('OtherSiteInfo', item)
uni.navigateTo({
url: `/BagStation/pages/stationDetail/stationDetail?channerCode=${item.channelCode}`
})
return
}
if (item.channelCode === 'TY') {
uni.setStorageSync('OtherSiteInfo', item)
uni.navigateTo({
url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`
})
} else {
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳​˙)♡",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {
uni.reLaunch({
url: '../../../BagAuth/pages/login/login'
})
}
}
url: `/BagStation/pages/stationDetail/stationDetail?channerCode=${item.channelCode}`
})
return
}
uni.navigateTo({
url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`
})
// if (uni.getStorageSync('user')) {
// } else {
// uni.showModal({
// content: "登录后才能查看哦",
// confirmText: '去登陆',
// success: (res) => {
// if (res.confirm) {
// uni.reLaunch({
// url: '../../../BagAuth/pages/login/login'
// })
// }
// }
// })
// }
},
nameSelect(value, item) {
this.title2 = item.text
@@ -587,7 +615,7 @@
clearTimeout(this.getSiteListTimer);
this.getSiteListTimer = setTimeout(() => {
this.currentPage = 1
this.siteList = []
// this.siteList = []
this.getSiteList()
}, 500);
},
@@ -595,7 +623,7 @@
clearTimeout(this.getSiteListTimer);
this.getSiteListTimer = setTimeout(() => {
this.currentPage = 1
this.siteList = []
// this.siteList = []
if (this.TabHead == 0) {
this.getSiteList()
} else if (this.TabHead == 1) {
@@ -656,4 +684,4 @@
.min-height-50 {
min-height: 50vh;
}
</style>
</style>