This commit is contained in:
caolc
2023-09-08 10:01:06 +08:00
parent 5adc52996c
commit 4d5aa4ac8d
12 changed files with 957 additions and 107 deletions

View File

@@ -128,7 +128,7 @@
</view> -->
<view class=" ">
<view class="" v-if="siteList.length>0">
<site-item v-for="(item,index) in siteList" :key="item.id" :site-item="item" :first="index==0"
<site-item :location='location' v-for="(item,index) in siteList" :key="item.id" :site-item="item" :first="index==0"
:listHeight="listHeight" class="cu-list menu-avatar cu-item" @tap="toDetail(item)">
</site-item>
</view>
@@ -159,6 +159,7 @@
},
data() {
return {
location:null,
swiperArray: [
{
src:this.global.starUrl+'banner.png',
@@ -296,8 +297,6 @@
},
onLoad() {
this.reverseGeocoder(this.location)
this.refreshLocation()
// if (!uni.getStorageSync('filterData')) {
// this.getFilterData()
// }
@@ -310,6 +309,7 @@
}, 800);
},
onShow() {
this.location = uni.getStorageSync('location')
const token = uni.getStorageSync('Authorization')
const openid = uni.getStorageSync('openid')
if (token && openid) {
@@ -320,9 +320,11 @@
icon: "none"
})
}
uni.navigateTo({
// url: `/BagStation/orderDetail/orderDetail?id=XOILAWMP202107070000025117`
})
this.refreshLocation();
// uni.navigateTo({
// url: `/BagStation/orderDetail/orderDetail?id=XOILAWMP202107070000025117`
// })
// uni.redirectTo({
// url:'/BagStation/pages/makeOrder/makeOrder'
// // url:'/BagStation/pages/makeOrder/payResult?status=success'
@@ -395,11 +397,27 @@
success: (res) => {
uni.setStorageSync('location', res)
},
fail: () => {
uni.getSetting({
success: (res) => {
if (!res.authSetting['scope.userLocation']) {
uni.showModal({
title: '请您打开定位权限',
content: '用于获取您当前位置附近的油站',
confirmText: '去设置',
success: (resSec) => {
if (resSec.confirm) {
uni.openSetting({})
}
}
})
}
}
})
},
complete: () => {
this.getSiteList()
// // console.log('made')
},
});
},
hideModel(name) {
@@ -416,7 +434,7 @@
oilSiteApi.getUserAuthInfo().then(res => {
if (res.code === 20000) {
this.getAmount()
this.getSiteList()
// this.getSiteList()
// realStatus: 0 vehicleStatus: 0
if (this.showAuthFrzen <= new Date().getTime()) {
this.showAuthFrror = res.data.realStatus && res.data.vehicleStatus ? false :
@@ -507,8 +525,8 @@
currentPage: 1,
pageSize: 10,
params: { //类型Object 必有字段 备注:// 筛选对象
// longitude: 117.157817, // 必有字段 备注:// 当前位置经度
// latitude: 31.802472, // 必有字段 备注:// 当前位置维度
longitude: 117.157817, // 必有字段 备注:// 当前位置经度
latitude: 31.802472, // 必有字段 备注:// 当前位置维度
// siteBrand: "", // 备注:// 石油品牌 ( 1-中国石油 2-中国石化 3-壳牌 4-民营 5-中海油 6-京博 7-中化石油 8-其他 )
// channelCode: "", // 备注:// 渠道编码 ( OIL星油 WJY万金油 LV老吕找油网 TY团油 YDJY一点加油壳牌)
// oilProductCode: "0#" // 备注:// 油号选择 ( 0# 92# 92#)
@@ -518,9 +536,36 @@
sort: "juli", //类型String 必有字段 备注:// 智能排序 ( price价格最低 juli距离最近 ) 默认距离排序
...uni.getStorageSync('location'),
...this.filterData,
}
}
};
if (!uni.getStorageSync('user')) {
oilSiteApi.readOnlySites(params).then(res => {
this.getCount++
if (res.code == 20000) {
this.siteList = res.data.list
} else {
if (this.getCount == 1) {
setTimeout(() => {
this.getSiteList()
}, 1000)
}
}
})
} else {
oilSiteApi.getSiteLists(params).then(res => {
if (res.code == 20000) {
this.siteList = res.data.list
}
})
}
oilSiteApi[uni.getStorageSync('user')?'getSiteLists':'getSiteLists'](params).then(res=>{
if (res.code == 20000) {
this.siteList = res.data.list
}
})
/* caolc 禁用
别人写的有毛病
if (!uni.getStorageSync('user')) {
oilSiteApi.readOnlySites(params).then(res => {
this.getCount++
@@ -532,8 +577,8 @@
setTimeout(() => {
this.getSiteList()
}, 1000)
} else {
uni.getSetting({
success: (resSet) => {
@@ -545,7 +590,7 @@
success: (res) => {
if (res.confirm) {
uni.openSetting({
})
}
}
@@ -563,11 +608,19 @@
}
})
}
*/
},
toDetail(item) {
let itemS = encodeURIComponent(JSON.stringify(item))
let itemS = encodeURIComponent(JSON.stringify(item));
uni.navigateTo({
url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`,
fail: (err) => {},
success: () => {}
})
// console.log(uni.getStorageSync('user'))
// return
/*
if (uni.getStorageSync('user')) {
uni.navigateTo({
url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`,
@@ -592,6 +645,8 @@
}
})
}
*/
},
getFilterData() {
oilSiteApi.getCheckInfo().then(res => {

View File

@@ -256,8 +256,13 @@
}
},
},
onLoad() {
this.refreshLocation()
onShow() {
this.tools.userLocationChenk().then(res => {
this.refreshLocation();
}).catch(err => {});
},
onLoad() {
// this.refreshLocation()
if (!uni.getStorageSync('filterData')) {
this.getFilterData()
} else {
@@ -373,13 +378,14 @@
});
},
getSiteList() {
this.refreshLocation()
getSiteList() {
let data1 = {
currentPage: this.currentPage,
pageSize: 10,
params: { //类型Object 必有字段 备注:// 筛选对象
clientBelong:'ZHONGPIN',
longitude: 117.157817, // 必有字段 备注:// 当前位置经度
latitude: 31.802472, // 必有字段 备注:// 当前位置维度
sort: "juli", //类型String 必有字段 备注:// 智能排序 ( price价格最低 juli距离最近 ) 默认距离排序
siteName: this.siteName,
...uni.getStorageSync('location'),
@@ -410,7 +416,7 @@
})
} else {
oilSiteApi.getSiteLists(data1).then(res => {
if (res.code == 20000) {
if (res.code == 20000) {
this.siteList = this.siteList.concat(res.data.list)
if (res.data.list.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
this.loadStatus = 'nomore'