master
xiaozhiyong 5 months ago
parent da0f4e6589
commit 0c0aac6fac
  1. 130
      pages/tabbar/home/home.vue
  2. 168
      pages/tabbar/station/stationList.vue

@ -237,7 +237,7 @@
},
onPullDownRefresh() {
this.refreshLocation()
// this.refreshLocation()
setTimeout(function() {
uni.stopPullDownRefresh()
}, 800);
@ -249,17 +249,11 @@
const openid = uni.getStorageSync('openid')
if (token && openid) {
this.getAuthInfo()
} else {
uni.showToast({
title: '您还没有登录哦',
icon: "none"
})
}
this.refreshLocation();
},
methods: {
toManagement() {
const user = uni.getStorageSync('user');
if (user) {
@ -328,7 +322,7 @@
if (resThird
.authSetting[
'scope.userLocation'
]) {
]) {
this.refreshLocation()
}
}
@ -379,25 +373,39 @@
showQr() {
const user = uni.getStorageSync('user');
let user = uni.getStorageSync("user");
if (!user) {
uni.showToast({
title: '请先登录!',
icon: 'none'
})
return
uni.showModal({
content: "登录后才能出示付款码哦",
confirmText: "去登录",
success: function(res) {
if (res.confirm) {
uni.navigateTo({
url: "/BagAuth/pages/login/login",
});
}
},
});
return;
}
this.showThreeSites = true
},
toCards() {
const user = uni.getStorageSync('user');
let user = uni.getStorageSync("user");
if (!user) {
uni.showToast({
title: '请先登录!',
icon: 'none'
})
return
uni.showModal({
content: "登录后才能查看哦",
confirmText: "去登录",
success: function(res) {
if (res.confirm) {
uni.navigateTo({
url: "/BagAuth/pages/login/login",
});
}
},
});
return;
}
uni.navigateTo({
url: '/BagMoney/pages/oilCards/oilCards'
@ -405,6 +413,21 @@
},
toOrders() {
let user = uni.getStorageSync("user");
if (!user) {
uni.showModal({
content: "登录后才能查看哦",
confirmText: "去登录",
success: function(res) {
if (res.confirm) {
uni.navigateTo({
url: "/BagAuth/pages/login/login",
});
}
},
});
return;
}
uni.switchTab({
url: '/pages/tabbar/order/orderList/orderList'
})
@ -419,42 +442,19 @@
let params = {
currentPage: 1,
pageSize: 10,
params: { //Object //
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#)
params: {
longitude: 117.157817,
latitude: 31.802472,
clientBelong: 'ZHONGPIN',
comprehensiveSort: 1,
zpDisable: 'ENABLE',
sort: "juli", //String // ( price juli )
sort: "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 => {
oilSiteApi.getSiteLists(params).then(res => {
if (res.code == 20000) {
this.siteList = res.data.list
}
@ -462,6 +462,21 @@
},
toDetail(item) {
let user = uni.getStorageSync("user");
if (!user) {
uni.showModal({
content: "登录后才能查看哦",
confirmText: "去登录",
success: function(res) {
if (res.confirm) {
uni.navigateTo({
url: "/BagAuth/pages/login/login",
});
}
},
});
return;
}
let itemS = encodeURIComponent(JSON.stringify(item));
uni.navigateTo({
url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`
@ -513,13 +528,20 @@
},
openScan() {
const user = uni.getStorageSync('user');
let user = uni.getStorageSync("user");
if (!user) {
uni.showToast({
title: '请先登录!',
icon: 'none'
})
return
uni.showModal({
content: "登录后才能使用扫一扫哦",
confirmText: "去登录",
success: function(res) {
if (res.confirm) {
uni.navigateTo({
url: "/BagAuth/pages/login/login",
});
}
},
});
return;
}
uni.scanCode({
scanType: 'qrCode',

@ -33,13 +33,13 @@
<!-- 筛选开始 -->
<scroll-view class="screentop bg-white" style="flex: 1;">
<view class="">
<sl-filter v-if="isFilterData" reflexTitle ref="slFilter" :productCodeList="productCodeList" :areaCodeList="areaCodeList"
@result="filterRes" :menuList="menuList"></sl-filter>
<sl-filter v-if="isFilterData" reflexTitle ref="slFilter" :productCodeList="productCodeList"
:areaCodeList="areaCodeList" @result="filterRes" :menuList="menuList"></sl-filter>
<!-- <sl-filter reflexTitle ref="slFilter" @result="filterRes" :menuList="menuList"></sl-filter> -->
</view>
<view class="bg-white min-height-50 padding-top" v-if="siteList.length>0">
<site-item 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)">
:listHeight="listHeight" class="cu-list menu-avatar cu-item" @tap="toDetail(item)">
</site-item>
<view class="placeholder-hidden">
@ -69,11 +69,11 @@
data() {
return {
getSiteListTimer:null,
getSiteListTimer: null,
filterData: {
// oilProductCode: '0#'
},
isFilterData:false,
isFilterData: false,
contentTitle: '您当前位置附近没有油站,可以点击左上角-距离-选择其他省市进行查看。',
loadStatus: 'load',
listHeight: 160,
@ -256,18 +256,18 @@
}
},
},
onShow() {
this.tools.userLocationChenk().then(res => {
onShow() {
this.tools.userLocationChenk().then(res => {
this.refreshLocation();
}).catch(err => {});
this.getSiteList()
},
onLoad() {
onLoad() {
// this.refreshLocation()
if (!uni.getStorageSync('filterData')) {
this.getFilterData()
} else {
this.isFilterData=true
this.isFilterData = true
}
},
@ -331,31 +331,31 @@
uni.setStorageSync('productCodeList', res.data.productCodeList)
uni.setStorageSync('areaCodeList', res.data.areaCodeList)
this.areaCodeList = uni.getStorageSync('areaCodeList')
let channelCodes = []
res.data.channelCodes.map(item => {
channelCodes.push({
title: item.name,
value: item.id
})
let channelCodes = []
res.data.channelCodes.map(item => {
channelCodes.push({
title: item.name,
value: item.id
})
let productCodes = []
res.data.productCodes.map(item => {
productCodes.push({
title: item.name,
value: item.id
})
})
let productCodes = []
res.data.productCodes.map(item => {
productCodes.push({
title: item.name,
value: item.id
})
let siteBrands = []
res.data.siteBrands.map(item => {
siteBrands.push({
title: item.name,
value: item.id
})
})
let siteBrands = []
res.data.siteBrands.map(item => {
siteBrands.push({
title: item.name,
value: item.id
})
menuList[0].detailList = menuList[0].detailList.concat(channelCodes)
menuList[1].detailList = menuList[1].detailList.concat(productCodes)
menuList[2].detailList = menuList[2].detailList.concat(siteBrands)
uni.setStorageSync('filterData', this.menuList);
})
menuList[0].detailList = menuList[0].detailList.concat(channelCodes)
menuList[1].detailList = menuList[1].detailList.concat(productCodes)
menuList[2].detailList = menuList[2].detailList.concat(siteBrands)
uni.setStorageSync('filterData', this.menuList);
if (uni.getStorageSync('areaCodeList')) {
this.areaCodeList = uni.getStorageSync('areaCodeList')
} else {
@ -378,88 +378,68 @@
});
},
getSiteList() {
let data1 = {
getSiteList() {
let parameter = {
currentPage: this.currentPage,
pageSize: 10,
params: { //Object //
clientBelong:'ZHONGPIN',
longitude: 117.157817, // //
latitude: 31.802472, // //
clientBelong: 'ZHONGPIN',
longitude: 117.157817, // //
latitude: 31.802472, // //
sort: "juli", //String // ( price juli )
siteName: this.siteName,
...uni.getStorageSync('location'),
// ...this.filterData
siteBrand: this.siteName ? '' : this.filterData.siteBrand, // // ( 1- 2- 3- 4- 5- 6- 7- 8- )
channelCode: this.siteName ? '' : this.filterData.channelCode, // // ( OIL WJY LV TY YDJY)
oilProductCode: this.siteName ? '' : this.filterData.oilProductCode, // // ( 0# 92# 92#)
siteBrand: this.siteName ? '' : this.filterData
.siteBrand, // // ( 1- 2- 3- 4- 5- 6- 7- 8- )
channelCode: this.siteName ? '' : this.filterData
.channelCode, // // ( OIL WJY LV TY YDJY)
oilProductCode: this.siteName ? '' : this.filterData
.oilProductCode, // // ( 0# 92# 92#)
provinceCode: this.filterData.provinceCode,
cityCode: this.filterData.cityCode,
areaCode: this.filterData.areaCode,
distance: this.filterData.distance,
zpDisable:'ENABLE',
zpDisable: 'ENABLE',
comprehensiveSort: this.filterData.comprehensiveSort ? this.filterData.comprehensiveSort : 1
}
}
if (!uni.getStorageSync('Authorization')) {
oilSiteApi.readOnlySites(data1).then(res => {
if (res.code == 20000) {
this.siteList = this.siteList.concat(res.data.list)
if (res.data.list.length < 10) { //
this.loadStatus = 'nomore'
} else {
this.currentPage++
this.loadStatus = 'load'
}
}
})
} else {
oilSiteApi.getSiteLists(data1).then(res => {
if (res.code == 20000) {
this.siteList = this.siteList.concat(res.data.list)
if (res.data.list.length < 10) { //
this.loadStatus = 'nomore'
} else {
this.currentPage++
this.loadStatus = 'load'
}
oilSiteApi.getSiteLists(parameter).then(res => {
if (res.code == 20000) {
this.siteList = this.siteList.concat(res.data.list)
if (res.data.list.length < 10) { //
this.loadStatus = 'nomore'
} else {
this.currentPage++
this.loadStatus = 'load'
}
})
}
}
})
},
toDetail(item) {
let user = uni.getStorageSync("user");
if (!user) {
uni.showModal({
content: "登录后才能查看哦",
confirmText: "去登录",
success: function(res) {
if (res.confirm) {
uni.navigateTo({
url: "/BagAuth/pages/login/login",
});
}
},
});
return;
}
let itemS = encodeURIComponent(JSON.stringify(item));
uni.navigateTo({
url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`,
fail: (err) => {},
success: () => {}
})
// if (uni.getStorageSync('user')) {
// uni.navigateTo({
// url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`,
// fail: (err) => {
// // console.log(err)
// },
// success: () => {
// // console.log('err')
// }
// })
// } else {
// uni.showModal({
// title: '',
// content: " |˛˙˙)",
// confirmText: '',
// success: (res) => {
// if (res.confirm) {
// uni.reLaunch({
// url: '../../../BagAuth/pages/login/login'
// })
// }
// }
// })
// }
},
nameSelect(value, item) {
this.title2 = item.text
@ -497,22 +477,22 @@
// this.getSiteList()
// }, 100)
clearTimeout(this.getSiteListTimer);
this.getSiteListTimer = setTimeout(()=>{
this.getSiteListTimer = setTimeout(() => {
this.currentPage = 1
this.siteList = []
this.getSiteList()
},500);
}, 500);
},
onSearch() {
// this.currentPage = 1
// this.siteList = []
// this.getSiteList()
clearTimeout(this.getSiteListTimer);
this.getSiteListTimer = setTimeout(()=>{
this.getSiteListTimer = setTimeout(() => {
this.currentPage = 1
this.siteList = []
this.getSiteList()
},500);
}, 500);
}
}
}
@ -539,4 +519,4 @@
.min-height-50 {
min-height: 50vh;
}
</style>
</style>
Loading…
Cancel
Save