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

@@ -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>