Merge pull request 'lixuan' (#2) from lixuan into master

Reviewed-on: #2
pull/3/head
李轩 2 years ago
commit f04e3fb063
  1. 7
      api/oil-site.js
  2. 7
      components/Empty.vue
  3. 45
      components/site-item/site-item.vue
  4. 191
      components/sl-filter/filter-view.vue
  5. 5
      components/sl-filter/sl-filter.vue
  6. 68
      pages/index/startPage/startPage.vue
  7. 4
      pages/tabbar/home/home.vue
  8. 256
      pages/tabbar/station/stationList.vue

@ -31,6 +31,13 @@ export default {
data: data
})
},
getSiteLists(data) {
return request({
url: `/${service_name}/${group_name}/findBCSiteInfoByPage`,
method: 'post',
data: data
})
},
getSiteDetails(data) {
return request({
url: `/${service_name}/${group_name}/getSiteDetails`,

@ -4,7 +4,7 @@
<div class="img" :class="marginTopExtra?'margin-extra':''">
<image :src="baseUrl+'empty.png'" mode="widthFix"></image>
</div>
<p>这里没有相关记录哦~</p>
<p :style="{padding: contentTitle?'0 50px':''}">{{contentTitle?contentTitle:'这里没有相关记录哦~'}}</p>
</div>
</template>
<script>
@ -14,11 +14,16 @@
marginTopExtra:{
type:Boolean,
default: true
},
contentTitle:{
type:String,
default:''
}
},
data() {
return {
baseUrl: this.global.imgURL
}
}

@ -1,5 +1,5 @@
<template>
<view class="cu-item cur padding no-mr-border site-item">
<view class="cu-item cur padding no-mr-border site-item" :style="{height:siteItem.oilProductCodeAndPrices.length>3?'220rpx !important':listHeight?listHeight + 'rpx !important':''}">
<view class="cu-avatar radius lg "
:style="'background-image:url('+(siteItem.siteImages?siteItem.siteImages:defaultLogo)+');'">
</view>
@ -18,26 +18,34 @@
{{siteItem.address}}
</view>
</view>
<view class="text-gray flex">
<view class="text-bold yellow-oil text-xl padding-right-xs">
<view class="text-gray flex" style="width: calc(100% + 30%);display: flex;flex-wrap: wrap;">
<view v-if="listHeight" class="youpin" style="" v-for="(item,index) in siteItem.oilProductCodeAndPrices">
<view class="text-bold yellow-oil text-xl padding-right-xs">
{{item.oilProductCode}}
</view>
<view class="oil-main-color text-xl text-bold padding-right-xs" style="padding-right: 0;">
{{item.personalPrice|moneyFormat}}
</view>
</view>
<view v-if="!listHeight" class="text-bold yellow-oil text-xl padding-right-xs">
{{siteItem.oilProductCode}}
</view>
<view class="oil-main-color text-xl text-bold padding-right-xs">
<view v-if="!listHeight" class="oil-main-color text-xl text-bold padding-right-xs">
{{siteItem.sitePrice|moneyFormat}}
</view>
<view class="">
</view>
<view v-if="!listHeight" class="">
<text class="cu-tag oil-tag radius text-xs"
v-if="siteItem.oilSitePrice - siteItem.sitePrice>0">{{(siteItem.oilSitePrice - siteItem.sitePrice)|moneyFormat}}</text>
</view>
<view class="text-cut padding-left-sm text-lg">
<view v-if="!listHeight" class="text-cut padding-left-sm text-lg">
<text class="text-delete color-333 text-sm padding-right-xs">
{{siteItem.oilSitePrice|moneyFormat}}/L
</text>
</text>
<!-- <my-icon iconName="¥.png" class="padding-right-xs icon-rectangle"></my-icon>
<my-icon iconName="f.png" class="padding-right-xs "></my-icon> -->
</view>
</view>
</view>
</view>
@ -61,6 +69,10 @@
first: {
type: Boolean,
default: false
},
listHeight:{
type:Number,
default:0
}
},
data() {
@ -76,7 +88,7 @@
filters: {
channelCodeFamt(value) {
console.log(value)
if (value == null) {
if (!value) {
return '未知'
// ( XOIL WJY LV TY YDJY)
// switch (value) {
@ -115,7 +127,7 @@
.site-item {
margin-bottom: 1.8rem;
align-items: flex-start !important;
height: 147rpx!important;
height: 150rpx!important;
}
.yellow-oil{
@ -124,4 +136,15 @@
.cu-avatar{
background-color: transparent !important;
}
.youpin{
border: 1px solid #e4e4e4;
display: flex;
border-radius: 5px;
padding: 0 5px;
margin-right: 5px;
margin-bottom: 5px;
}
.text-xl{
font-size: 30rpx;
}
</style>

@ -17,15 +17,49 @@
</view>
<view class="filter-content-detail">
<text v-for="(detailItem,idx) in selectDetailList" :key="idx" class='filter-content-detail-item-default' :style="{'background-color':detailItem.isSelected?themeColor:'#FFFFFF','color':detailItem.isSelected?'#FFFFFF':'#666666'}"
@tap="itemTap(idx,selectDetailList,item.isMutiple,item.key)">
@tap="itemTap(idx,selectDetailList,item.isMutiple,item.key,detailItem,index)">
{{detailItem.title}}
</text>
</view>
<!-- <view class="" v-if="index==1" v-for="(detailItem,idx) in selectDetailList" :key="idx">
<view class="filter-content-title">
<text>{{detailItem}}</text>
</view>
<view class="filter-content-detail">
<text v-for="(itemss,idxx) in selectDetailList[detailItem]" class='filter-content-detail-item-default' :style="{'background-color':detailItem.isSelected?themeColor:'#FFFFFF','color':detailItem.isSelected?'#FFFFFF':'#666666'}"
@tap="itemTap(idx,selectDetailList,item.isMutiple,item.key,detailItem)">
{{itemss.title}}
</text>
</view>
</view> -->
<view class="filter-content-detail" v-show="pickerShow">
<!-- 省市区选择 -->
<view class="region-box" v-if="index==0">
<picker-view disabled :value="region" @change="bindChange" ref="showHide">
<picker-view-column>
<view class="center" v-for="(item, index) in areaCodeList" :key="index">
{{ item.areaName }}
</view>
</picker-view-column>
<picker-view-column>
<view class="center" v-for="(item, index) in areaCodeList[areaIndex[0]].childList" :key="index">
{{ item.areaName }}
</view>
</picker-view-column>
<!-- <picker-view-column v-if="areaCodeList[areaIndex[0]]">
<view class="center"
v-for="(item, index) in areaCodeList[areaIndex[0]].childList[areaIndex[1]].childList" :key="index">
{{ item.areaName }}
</view>
</picker-view-column> -->
</picker-view>
</view>
</view>
<view class="filter-content-footer">
<view class="filter-content-footer-item" style="color: #777777; background-color: #FFFFFF;" @tap="resetClick(selectDetailList,item.key)">
<view class="filter-content-footer-item" style="color: #777777; background-color: #FFFFFF;" @tap="resetClick(selectDetailList,item.key,index)">
<text>重置</text>
</view>
<view class="filter-content-footer-item" :style="{'color': '#FFFFFF', 'background-color': themeColor}" @tap="sureClick">
<view class="filter-content-footer-item" :style="{'color': '#FFFFFF', 'background-color': themeColor}" @tap="sureClick(selectDetailList,item.key,index)">
<text>确定</text>
</view>
</view>
@ -40,11 +74,21 @@
export default {
data() {
return {
region:[],
selectArr: [],
result: {},
pickerShow:false,
menuIndex: 0,
areaIndex:[0, 0],
paixu:1,
provinceCode:'',
oilCode:'',
showHide:true,
cityCode:'',
areaCode:'',
selectDetailList: [],
independenceObj: {},
areaCodeList:[],
selectedKey: '',
cacheSelectedObj: {},
defaultSelectedTitleObj: {}
@ -57,6 +101,12 @@
return '#D1372C'
}
},
areaCodeList1: {
type: Array,
default () {
return []
}
},
menuList: {
type: Array,
default () {
@ -68,6 +118,17 @@
default: false
}
},
created() {
setTimeout(()=>{
if(this.areaCodeList1.length == 0){
this.areaCodeList = uni.getStorageSync('areaCodeList')
}else{
this.areaCodeList = this.areaCodeList1
}
this.areaCodeList.unshift({areaName:'全部'})
},1000)
console.log('%c 子组件参数↓','font-size:30px;color:red')
},
computed: {
selectedTitleObj() {
let obj = {}
@ -91,6 +152,37 @@
}
},
methods: {
//
bindChange(e,ccc) {
//
const val = e.detail.value
this.areaIndex = val
this.region = val
if(this.areaIndex[0] !== val[0]) {
// 0
this.areaIndex = [val[0], 0, 0]
} else if(this.areaIndex[1] !== val[1]) {
this.areaIndex[1] = val[1]
//
this.areaIndex = [val[0], val[1], 0]
} else {
this.areaIndex = e.detail.value;
}
if(!ccc){
// push
if(this.areaCodeList[val[0]].childList[0]&&this.areaCodeList[val[0]].childList[0].areaName != '全部'){
this.areaCodeList[val[0]].childList.unshift({areaName:'全部'})
}
this.provinceCode = this.areaCodeList[this.areaIndex[0]].id
this.cityCode = this.areaCodeList[this.areaIndex[0]].childList[this.areaIndex[1]].id
}
// if(this.areaCodeList[val[0]].childList[val[1]].childList[0].areaName != ''){
// this.areaCodeList[val[0]].childList[val[1]].childList.unshift({areaName:''})
// }
// this.areaCode = this.areaCodeList[this.areaIndex[0]].childList[this.areaIndex[1]].childList[this.areaIndex[2]].id
this.$emit('changeArea',e)
},
getSelectedObj() {
let obj = {}
for (let i = 0; i < this.menuList.length; i++) {
@ -264,7 +356,7 @@
this.independenceObj[this.selectedKey] = '';
}
},
itemTap(index, list, isMutiple, key) {
itemTap(index, list, isMutiple, key,detailItem,indexs) {
if (isMutiple == true) {
list[index].isSelected = !list[index].isSelected;
if (index == 0) {
@ -323,6 +415,27 @@
}
}
}
if(indexs==0){
if(detailItem.value==10){
this.detailItems = ''
this.pickerShow = true
}else{
this.detailItems = detailItem.value*1000
this.provinceCode = ''
this.cityCode = ''
this.areaCode = ''
this.pickerShow = false
this.region = []
}
}else{
this.pickerShow = false
}
if(indexs==1){
this.oilCode = detailItem.value
}
if(indexs==2){
this.paixu = detailItem.value
}
}
// #ifdef H5
this.$forceUpdate();
@ -371,22 +484,84 @@
}
this.$emit("confirm", obj);
},
sureClick() {
sureClick(selectDetailList,item,index) {
if(index == 1&&!this.oilCode){
this.menuList[2].detailList[0].isSelected = true
this.menuList[2].detailList[1].isSelected = false
this.paixu = 1
this.selectedTitleObj['comprehensiveSort'] = '距离优先'
}
if(index == 2&&!this.oilCode&&this.paixu==2){
uni.showToast({
title: '请先选择油品再价格排序',
icon: 'none'
})
this.itemTap(0, selectDetailList, false, item,selectDetailList[1],index)
this.paixu = 1
return
}
if(this.areaIndex[0] == 0){
this.provinceCode = ''
this.cityCode = ''
this.areaCode = ''
}
if(this.areaIndex[1] == 0){
this.cityCode = ''
this.areaCode = ''
}
if(this.areaIndex[2] == 0){
this.areaCode = ''
}
let obj = {
'result': this.result,
'titles': this.selectedTitleObj,
'isReset': false
}
obj.result.provinceCode = this.provinceCode
obj.result.cityCode = this.cityCode
obj.result.areaCode = this.areaCode
obj.result.distance = this.provinceCode?'':this.cityCode?'':this.areaCode?'':this.detailItems
obj.result.comprehensiveSort = this.paixu
this.$emit("confirm", obj);
},
resetClick(list, key) {
resetClick(list, key,index) {
this.resetSelected(list, key)
if(index == 1){
this.oilCode = ''
this.paixu = 1
}
if(index == 0){
this.provinceCode = ''
this.cityCode = ''
this.areaCode = ''
this.detailItems = ''
this.region = []
this.pickerShow = false
let aaa = {
detail:{
value:[0,0]
}
}
let ccc = 1
this.bindChange(aaa,ccc)
}
if(index == 2){
this.paixu = 1
}
}
}
}
</script>
<style>
.region-box {
background-color: #FFFFFF;
}
.region-box .center {
display: flex;
justify-content: center;
align-items: center;
}
.filter-content {
background-color: #F6F7F8;
}
@ -472,4 +647,8 @@
.filter-content-list-item-active:after {
content: '✓';
}
picker-view {
width: 100%;
height: 424upx;
}
</style>

@ -226,6 +226,10 @@
}
}
} else {
// if(this.titleList[this.selectedIndex].key.indexOf('oilProductCode') !=-1 && this.titleList[this.selectedIndex].title.indexOf('') != -1){
// this.titleList[this.selectedIndex+1].title = ''
// console.log(this.titleList[this.selectedIndex].key,this.titleList[this.selectedIndex].title,'spppppppppppp')
// }
for (let key in titlesObj) {
if (!Array.isArray(titlesObj[key])) {
this.tempTitleObj[key] = titlesObj[key];
@ -240,7 +244,6 @@
}
}
}
this.$refs.popupRef.close()
if (obj.isReset) {

@ -59,21 +59,59 @@
this.getFilterData()
}
}
setTimeout(() => {
if (key == '在线') {
uni.switchTab({
url: '/pages/tabbar/home/home',
fail: (err) => {
console.log(err)
}
// url:'/BagStation/orderDetail/orderDetail'
})
} else {
uni.redirectTo({
url: '/BagAuth/pages/login/login'
})
}
}, 2000)
// 广
let interstitialAd = null
// onLoad广
if (wx.createInterstitialAd) {
interstitialAd = wx.createInterstitialAd({
adUnitId: 'adunit-a7faf57adeed211f'
})
}
interstitialAd.onLoad((err) => {
console.log('onLoad event emit', err)
})
interstitialAd.onError((err) => {
setTimeout(() => {
if (key == '在线') {
uni.switchTab({
url: '/pages/tabbar/home/home',
fail: (err) => {
console.log(err)
}
// url:'/BagStation/orderDetail/orderDetail'
})
} else {
uni.redirectTo({
url: '/BagAuth/pages/login/login'
})
}
}, 2000)
console.log('onError event emit', err)
})
// 广
if (interstitialAd) {
interstitialAd.show().catch((err) => {
console.error(err)
})
}
interstitialAd.onClose(res => {
setTimeout(() => {
if (key == '在线') {
uni.switchTab({
url: '/pages/tabbar/home/home',
fail: (err) => {
console.log(err)
}
// url:'/BagStation/orderDetail/orderDetail'
})
} else {
uni.redirectTo({
url: '/BagAuth/pages/login/login'
})
}
}, 2000)
})
},
onReady(option) {
const updateManager = uni.getUpdateManager();

@ -137,6 +137,9 @@
<swiper-item @click="swiperClick(item,index)" v-for="(item,index) in swiperArray">
<image :src="item.src" style="width: 100%;" mode="widthFix"></image>
</swiper-item>
<swiper-item>
<ad unit-id="adunit-fae65289bc72095d" ad-intervals="30"></ad>
</swiper-item>
</swiper>
<!-- <image :src="starUrl+'banner.png'" style="width: 100%;" mode="widthFix"></image> -->
</view>
@ -310,6 +313,7 @@
onLoad() {
this.reverseGeocoder(this.location)
this.refreshLocation()
// if (!uni.getStorageSync('filterData')) {
// this.getFilterData()
// }

@ -1,5 +1,5 @@
<template>
<view class="my-bg">
<view class="my-bg" style="display: flex;flex-direction: column;height: 100vh;">
<cu-custom class="main-totextbar bg-main-oil" bgColor="bg-main-oil">
<block slot="content">附近油站</block>
</cu-custom>
@ -17,7 +17,7 @@
</view>
</view>
</view>
<view class="placeholder-hidden">
<!-- <view class="placeholder-hidden">
<view class="cu-bar search bg-white">
<view class="search-form round">
<text class="cuIcon-search"></text>
@ -29,14 +29,15 @@
src="https://www.51xingka.net/LSMOIL/static/img/gas-station.png" mode=""></image>
</view>
</view>
</view>
</view> -->
<!-- 筛选开始 -->
<scroll-view class="screentop bg-white">
<scroll-view class="screentop bg-white" style="flex: 1;">
<view class="">
<sl-filter reflexTitle ref="slFilter" @result="filterRes" :menuList="menuList"></sl-filter>
<sl-filter 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"
<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)">
</site-item>
<view class="placeholder-hidden">
@ -45,7 +46,7 @@
</view>
<view class="" v-else>
<my-empty></my-empty>
<my-empty :contentTitle="contentTitle"></my-empty>
</view>
</scroll-view>
@ -68,39 +69,166 @@
data() {
return {
filterData: {
oilProductCode: '0#'
// oilProductCode: '0#'
},
contentTitle:'您当前位置附近没有油站,可以点击左上角-距离-选择其他省市进行查看。',
loadStatus: 'load',
listHeight:160,
areaCodeList:[],
siteName: '',
menuList: uni.getStorageSync('filterData') ? uni.getStorageSync('filterData') : [{
title: '渠道',
isMutiple: false,
key: 'channelCode',
detailList: [{
title: "全部",
value: ""
}]
},
{
title: '0#轻柴油',
key: 'oilProductCode',
isMutiple: false,
detailList: [{
title: "全部",
value: ""
}]
},
menuList:[
{
title: '品牌',
key: 'siteBrand',
isSort: true,
isMutiple: false,
detailList: [{
title: "全部",
value: ""
}]
}
title: '距离',
isMutiple: false,
key: 'distance',
detailList: [
{
title: "全部",
value: ''
},
{
title: "20Km",
value: 20
},
{
title: "30Km",
value: 30
},
{
title: "50Km",
value: 50
},
{
title: "省市",
value: 10
}
]
},
{
title: '油品',
key: 'oilProductCode',
isMutiple: false,
detailList: [{
title: "全部",
value: ""
},
{
title: "0#",
value: "0#"
},
{
title: "-10#",
value: "-10#"
},
{
title: "-20#",
value: "-20#"
},
{
title: "-35#",
value: "-35#"
},
{
title: "LNG",
value: "LNG"
}]
},
// {
// title: '',
// key: 'oilProductCode',
// isMutiple: false,
// detailList: {:[{
// title: "",
// value: ""
// }],
// :[{
// title: "0#",
// value: "0#"
// },
// {
// title: "-10#",
// value: "-10#"
// },
// {
// title: "-20#",
// value: "-20#"
// },
// {
// title: "-35#",
// value: "-35#"
// }],
// :[{
// title: "LNG",
// value: "LNG"
// }]}
// },
{
title: '距离优先',
isMutiple: false,
key: 'comprehensiveSort',
detailList: [{
title: "距离优先",
value: 1
},
{
title: "价格优先",
value: 2
}
]
},
],
// menuList: uni.getStorageSync('filterData') ? uni.getStorageSync('filterData') : [
// {
// title: '',
// isMutiple: false,
// key: 'channelCode',
// detailList: [{
// title: "",
// value: ""
// }]
// },
// {
// title: '',
// isMutiple: false,
// key: 'distance',
// detailList: [{
// title: "",
// value: 20
// },
// {
// title: "20Km",
// value: 20
// },
// {
// title: "30Km",
// value: 30
// },
// {
// title: "50Km",
// value: 50
// }
// ]
// },
// {
// title: '0#',
// key: 'oilProductCode',
// isMutiple: false,
// detailList: [{
// title: "",
// value: ""
// }]
// },
// {
// title: '',
// key: 'siteBrand',
// isSort: true,
// isMutiple: false,
// detailList: [{
// title: "",
// value: ""
// }]
// }
// ],
siteList: [],
InputBottom: 0,
show: false,
@ -155,7 +283,6 @@
methods: {
filterRes(val) {
this.filterData = val
console.log(val)
this.currentPage = 1
this.siteList = []
this.getSiteList()
@ -163,24 +290,33 @@
getFilterData() {
oilSiteApi.getCheckInfo().then(res => {
if (res.code == 20000) {
res.data.channelCodes.map(item => {
this.menuList[0].detailList.push({
title: item.name,
value: item.id
})
})
res.data.productCodes.map(item => {
this.menuList[1].detailList.push({
title: item.name,
value: item.id
})
})
res.data.siteBrands.map(item => {
this.menuList[2].detailList.push({
title: item.name,
value: item.id
})
})
uni.setStorageSync('productCodeList', res.data.productCodeList)
uni.setStorageSync('areaCodeList', res.data.areaCodeList)
this.areaCodeList = uni.getStorageSync('areaCodeList')
if(uni.getStorageSync('areaCodeList')){
this.areaCodeList = uni.getStorageSync('areaCodeList')
}else{
this.areaCodeList = res.data.areaCodeList
}
// this.productCodeList = uni.getStorageSync('productCodeList')
// res.data.channelCodes.map(item => {
// this.menuList[0].detailList.push({
// title: item.name,
// value: item.id
// })
// })
// res.data.productCodes.map(item => {
// this.menuList[1].detailList.push({
// title: item.name,
// value: item.id
// })
// })
// res.data.siteBrands.map(item => {
// this.menuList[2].detailList.push({
// title: item.name,
// value: item.id
// })
// })
// // console.log(channelCodes, productCodes, siteBrands)
// this.$refs.slFilter.resetMenuList(this.menuList)
@ -215,7 +351,12 @@
channelCode: this.siteName ? '' : this.filterData
.channelCode, // // ( OIL WJY LV TY YDJY)
oilProductCode: this.siteName ? '' : this.filterData
.oilProductCode // 备注:// 油号选择 ( 0# 92# 92#)
.oilProductCode, // // ( 0# 92# 92#)
provinceCode:this.filterData.provinceCode,
cityCode:this.filterData.cityCode,
areaCode:this.filterData.areaCode,
distance:this.filterData.distance,
comprehensiveSort:this.filterData.comprehensiveSort?this.filterData.comprehensiveSort:1
}
}
@ -232,7 +373,7 @@
}
})
} else {
oilSiteApi.getSiteList(data1).then(res => {
oilSiteApi.getSiteLists(data1).then(res => {
if (res.code == 20000) {
this.siteList = this.siteList.concat(res.data.list)
if (res.data.list.length < 10) { //
@ -326,12 +467,13 @@
.placeholder-hidden {
/* min-height: 95upx; */
opacity: 0;
}
.fixed-top-site {
/* top: 120rpx; */
z-index: 4;
position: fixed;
/* position: fixed; */
width: 750upx;
}

Loading…
Cancel
Save