< template >
< view @ touchend = 'touchend' @ touchmove = 'touchmove' @ touchstart = 'onChange'
style = "display: flex;flex-direction: column;flex-wrap: wrap;z-index: 9999999999999999999999999 !important;"
: style = "{height:isShow.switchBar?`calc(${styles.height}rpx + ${styles.move}rpx )`: ` calc( ${styles.move}rpx + 150rpx)` }"
: class = "styles.open? 'serviceStation_body' :'seleServiceStation_body' " >
< view @click ="switchBar" class = "switchBar" > < / view >
< view style = "flex: 1; overflow: hidden; width: 100%; " >
< view style = "" class = "information" >
< view class = "information_left" >
< image class = "ser_img" :src ="details.siteImages" mode = "widthFix" > < / image >
< view
style = "width: calc(100% - 80rpx);display: flex; flex-direction: column;justify-content: space-between;"
class = "serviceStation_text black_color" >
< view class = "ovf" > { { details . siteName } } < / view >
< view style = " " class = "ovf samall_text hui_color" > { { details . address } } < / view >
< / view >
< / view >
< view class = "information_right" >
< uni -icons type = "paperplane-filled" size = "20" > < / u n i - i c o n s >
< view class = "samall_text hui_color" >
{ { Number ( details . juli / 1000 ) . toFixed ( 2 ) } } km
< / view >
< / view >
< / view >
< view class = "oli_swiper" >
< view class = "oli_swiper_title" >
< view : style = "{borderBottom: seleIndex==index? '#FF6700 solid 3px':''}" @click ="seletitle(index)"
v - for = "(item,index) in details.oilSiteChannelDetailsVos" class = "oli_swiper_title_item" >
{ { item . channelCode | channelCode } } < / view >
<!-- < view : style = "{transform:`translateX( calc(${seleIndex} * 100%) )`,width:`calc(100% / ${details.oilSiteChannelDetailsVos.length})`}" class = "tiao" > < / view > -- >
< / view >
< swiper class = "swiper" next -margin = ' 480rpx ' :duration ="500" >
< swiper -item
v - for = "(item,index) in (details.oilSiteChannelDetailsVos[seleIndex].oilSitePriceDetailsVos==null?[]:details.oilSiteChannelDetailsVos[seleIndex].oilSitePriceDetailsVos)"
: key = 'index' >
< view class = "swiper-item" >
< view class = "swiper-item_oliType bag_text black_color" > { { item . oilProductCode } } < / view >
< view class = "bag_text hu_color " style = "text-align: start;" >
{ { moneyIntercept ( item . sitePrice ) } } / L
< / view >
< view class = "samall_text hui_color" style = "text-align: end;text-decoration: line-through;" >
{ { moneyIntercept ( item . oilSitePrice ) } } / L
< / view >
< / view >
< / s w i p e r - i t e m >
< / swiper >
< / view >
< view class = "serviceStation_footer" >
< view @click ="Navigation" style = "background-color: #8B583E;" class = "serviceStation_footer_butten" > 导航
< / view >
< view @click ="jump" style = "background-color: #FF6700;" class = "serviceStation_footer_butten" > 详情 < / view >
< / view >
< / view >
< / view >
< / template >
< script >
export default {
data ( ) {
return {
touchData : null ,
styles : {
height : 700 ,
moveY : 0 ,
Y : 0 ,
move : 0 ,
open : false
} ,
seleIndex : 0 ,
isShow : {
switchBar : true
}
}
} ,
created ( ) {
console . log ( this . details , '***' ) ;
this . $emit ( 'dragMap' , this . details , false )
} ,
mounted ( ) { } ,
props : {
details : {
type : Object ,
default : ( ) => {
return null
}
}
} ,
filters : {
channelCode ( e ) {
switch ( e ) {
case 'XOIL' :
return '星油'
case 'WJY' :
return '万金油'
case 'LV' :
return '其他'
case 'TY' :
return '团油'
case 'YDJY' :
return '一点加油(壳牌)'
}
}
} ,
watch : { } ,
methods : {
jump ( ) {
let obj = {
siteId : this . details . id ,
// siteCode: this.details.siteCode,
// siteChannel: this.details.siteChannel,
longitude : this . details . longitude ,
latitude : this . details . latitude ,
}
let itemS = JSON . stringify ( obj )
console . log ( itemS , this . details , '************' ) ;
// return
uni . navigateTo ( {
url : ` ../stationDetail/stationDetail?item= ${ itemS } &&types=map `
} )
} ,
Navigation ( ) {
console . log ( '组件导航' )
this . $emit ( 'openMapApp' )
} ,
touchcancel ( e ) {
console . log ( this . styles . yd , 'touchcancel滑动距离' )
console . log ( e , 'touchcancel' )
} ,
//监听鼠标滑动
touchmove ( e ) {
if ( this . isShow . switchBar && this . styles . Y - e . changedTouches [ 0 ] . clientY > 0 ) return
this . styles . moveY = e . changedTouches [ 0 ] . clientY ;
this . styles . move = this . styles . Y - this . styles . moveY ;
console . log ( this . styles . moveY )
} ,
//开始滑动
onChange ( e ) {
this . $emit ( 'dragMap' , this . details , false )
// 这一行为记录滑动位置代码 this.styles.Y = e.changedTouches[0].clientY + this.styles.move;
console . log ( '禁用' ) ;
this . styles . open = true ;
this . styles . Y = e . changedTouches [ 0 ] . clientY ;
console . log ( 'onChange' )
} ,
// 滑动完成
touchend ( e ) {
this . styles . open = false ;
if ( this . styles . move > 0 ) {
this . isShow . switchBar = true
} else if ( this . styles . move < 0 ) {
this . isShow . switchBar = false
}
this . styles . move = 0 ;
console . log ( 'touchend' )
setTimeout ( ( ) => {
this . $emit ( 'dragMap' , this . details , true )
} , 500 )
} ,
vtouchmove ( e ) {
this . styles . height -= 3 ;
console . log ( e , this . styles . height , 'vtouchmove' )
} ,
seletitle ( e ) {
this . seleIndex = e
} ,
switchBar ( ) {
this . isShow . switchBar = ! this . isShow . switchBar
console . log ( this . isShow . switchBar )
}
}
}
< / script >
< style scoped >
. an {
align - items : flex - end ;
}
. flex {
display : flex ;
}
. ac {
align - items : center ;
}
. ser _img {
width : 80 rpx ;
/* height: 80rpx; */
margin - right : 15 rpx ;
}
. serviceStation _footer _butten {
display : flex ;
align - items : center ;
justify - content : center ;
width : 240 rpx ;
height : 80 rpx ;
color : # FFFFFF ;
border - radius : 50 px ;
}
. serviceStation _footer {
display : flex ;
justify - content : center ;
gap : 26 rpx ;
/ * p o s i t i o n : a b s o l u t e ;
bottom : 40 rpx ; * /
width : 100 % ;
margin - top : 20 rpx ;
}
. bag _text {
font - size : 36 rpx ;
}
. swiper - item _oliType {
position : absolute ;
right : - 10 rpx ;
top : - 10 rpx ;
}
. swiper - item {
width : 200 rpx ! important ;
background : # F0F0F0 ;
border - radius : 10 px ;
height : 140 rpx ;
/* padding: 32rpx; */
position : relative ;
margin - top : 10 rpx ;
display : flex ;
flex - direction : column ;
justify - content : center ;
gap : 10 rpx ;
padding : 0 40 rpx ;
}
. hu _color {
color : # FF6700 ;
}
. swiper {
width : 100 % ;
height : 150 rpx ;
}
. oli _swiper {
margin - top : 40 rpx ;
}
. oli _swiper _title _item {
/* flex: 1; */
text - align : center ;
font - size : 28 rpx ;
/* width: min-intrinsic; */
padding - bottom : 5 px ;
}
. tiao {
background - color : # FF6700 ;
border - radius : 10 px ;
height : 5 rpx ;
position : absolute ;
bottom : 0 ;
left : 0 ;
transition : all .3 s ;
transform : scaleX ( 100 % ) ;
}
. oli _swiper _title {
/ *
border - bottom : # FF6700 solid ;
width : max - content ;
margin : 0 auto ;
* /
padding - bottom : 10 rpx ;
margin - bottom : 40 rpx ;
display : flex ;
justify - content : center ;
gap : 20 rpx ;
flex - wrap : nowrap ;
overflow : hidden ;
position : relative ;
}
. black _color {
color : # 666666 ;
}
. hui _color {
color : # BBBBBB ;
}
. samall _text {
font - size : 24 rpx ;
}
. serviceStation _text {
font - size : 28 rpx ;
}
. ovf {
width : 100 % ;
overflow : hidden ;
white - space : nowrap ;
text - overflow : ellipsis ;
}
. information _right {
width : 94 rpx ;
display : flex ;
flex - direction : column ;
gap : 10 rpx ;
justify - content : space - between ;
align - items : center ;
}
. information _left {
flex : 1 ;
overflow : hidden ;
display : flex ;
/ * f l e x - d i r e c t i o n : c o l u m n ;
justify - content : space - between ; * /
}
. information {
display : flex ;
padding : 0 30 rpx ;
gap : 20 rpx ;
margin - top : 30 rpx ;
overflow : hidden ;
max - height : 90 rpx ;
}
. switchBar {
width : 160 rpx ;
height : 10 rpx ;
background : # F0F0F0 ;
border - radius : 10 px ;
margin : 0 auto ;
}
. seleServiceStation _body {
height : 700 rpx ;
width : 750 rpx ;
background : # FFFFFF ;
border - radius : 20 px 20 px 0 px 0 px ;
padding : 16 rpx ;
transition : all .3 s ;
}
. serviceStation _body {
height : 700 rpx ;
width : 750 rpx ;
background : # FFFFFF ;
border - radius : 20 px 20 px 0 px 0 px ;
padding : 16 rpx ;
transition : all .3 s ;
}
< / style >