oil-station/gasStation-uni/pagesRefuel/pagesRefuel/index.vue
2023-12-18 11:10:15 +08:00

317 lines
6.3 KiB
Vue

<template>
<view class="content">
<view class="container">
<view class="my-header">
<view class="my-icons" @click="goBack()"> <uni-icons type="left" size="16"></uni-icons> </view>
<view class="my-text">选择站点</view>
<view class="my-icons"></view>
</view>
<!-- 顶部区域 -->
<view class="bacek">
<view class="back-input">
<view class="hui-input">
<uni-icons type="search" size="20"></uni-icons>
<input v-model="storeName" @confirm="queryStore" type="text" placeholder="请输入站点名" />
</view>
</view>
<view class="b-box" v-for="(item,index) in list" :key="index">
<view class="box-top">
<view class="dis">
<view class="touxiang">
<image src="../../static/imgs/bzhd.png" mode=""></image>
</view>
<view class="box-top-size">
<view class="box-title">
{{item.store.name}}{{item.store.description ? "("+item.store.description+")" : ""}}
</view>
<view class="box-hui"> {{item.store.address}} </view>
</view>
</view>
<view class="">
<view class="top-right-icon" v-if="index == 0">
<u-tag text="距离最近" size="mini" type="error" plain plainFill></u-tag>
</view>
<view class="box-hui" style="width: 80px;">{{(Math.ceil(item.distance)).toFixed(1)}}km
</view>
</view>
</view>
<scroll-view scroll-x="true" class="fa-scroll">
<view class="scrollbox" v-for="(item1,index1) in item.store.oilList" :key="index1"
@click="toRefuel(item.store)">
<view style="font-size: 16px;">{{item1.oilNames}}</view>
<view style="font-size: 18px;">¥{{item1.gbPrice}}/{{item1.unit}}</view>
</view>
</scroll-view>
<view class="wrap-box">
<u-tag v-if="item.store.welfareList!=null" v-for="(item1,index1) in item.store.welfareList"
:key="index1" :text="item1" type="warning" shape="circle"></u-tag>
</view>
<view class="box-bottom">
<view class="box-bottom-anniu">
<view class="bottom-icon">
<image src="../../static/icon/daohang.png" mode=""></image>
</view>
<view class="">到这去</view>
</view>
<view style="color: #ececec;">
|
</view>
<view class="box-bottom-anniu">
<view class="bottom-icon">
<image src="../../static/icon/jiayou.png" mode=""></image>
</view>
<view class="" @click="toRefuel(item.store)">去加油</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import request from '../../utils/request'
export default {
data() {
return {
title: '',
// 店铺列表信息
storeList: [],
list: [],
// 站点名
storeName: "",
map: {
lon: "",
lat: "",
storeId: "",
}
}
},
onLoad() {
this.getLonLat()
},
onShow() {
// this.getAddress()
},
components: {
},
methods: {
// 查询店铺信息
queryStore(val) {
this.list = []
this.storeList.forEach(item => {
if (item.store.name.includes(val.detail.value) || item.store.description.includes(val.detail
.value)) {
this.list.push(item)
}
})
},
// 获取当前经纬度信息
getLonLat() {
let _this = this;
wx.getLocation({
type: 'gcj02', // 使用国测局坐标系
success: function(res) {
_this.map.lon = res.longitude;
_this.map.lat = res.latitude
_this.map.storeId = uni.getStorageSync("storeId")
_this.getList(_this.map)
}
})
},
getList(data) {
let _this = this;
request({
url: "business/storeInformation/store/queryStores",
method: 'post',
data: data,
}).then((res) => {
_this.storeList = res.data
_this.list = _this.storeList
})
},
// 携带油号跳转加油页面
toRefuelOil(data) {
console.log(data)
},
// 跳转一键加油页面
toRefuel(data) {
// console.log(data)
uni.setStorageSync("storeId", data.id)
uni.setStorageSync("chainStoreId", data.chainStoreId)
uni.navigateTo({
url: '/pages/refuel/refuel'
})
},
goBack() {
uni.navigateBack()
}
}
}
</script>
<style scoped lang="scss">
.content {
background: #f4f5f6;
}
.container {
width: 100%;
height: 100vh;
box-sizing: border-box;
padding-top: 88px;
}
.my-header {
width: 100%;
height: 88px;
background: #ffffff;
display: flex;
align-items: center;
justify-content: space-between;
color: #000;
box-sizing: border-box;
padding: 0px 15px;
padding-top: 40px;
.my-icons {
width: 20px;
}
position: fixed;
top: 0px;
}
.bacek {
background: #f4f5f6;
box-sizing: border-box;
padding-bottom: 15px;
}
.back-input {
width: 100%;
height: 60px;
background-color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
}
.hui-input {
width: 90%;
height: 30px;
border-radius: 50px;
background-color: #f2f2f2;
display: flex;
align-items: center;
box-sizing: border-box;
padding: 0px 10px;
input {
width: 90%;
}
}
.b-box {
width: 90%;
padding: 10px;
box-sizing: border-box;
background-color: white;
border-radius: 8px;
margin: 10px auto;
}
.box-top {
width: 100%;
display: flex;
justify-content: space-between;
margin-bottom: 10px;
}
.touxiang {
width: 45px;
height: 45px;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
.box-top-size {
width: 80%;
margin-left: 5px;
}
.box-title {
font-size: 18px;
font-weight: bold;
}
.box-hui {
font-size: 14px;
color: #999999;
margin-top: 5px;
}
.fa-scroll {
width: 100%;
box-sizing: border-box;
white-space: nowrap;
}
.scrollbox {
display: inline-block;
width: 85px;
border: 1px solid #f2f2f2;
border-radius: 6px;
height: 65px;
margin: 5px;
box-sizing: border-box;
padding: 10px;
text-align: center;
color: #666666;
}
.box-bottom {
width: 100%;
height: 40px;
display: flex;
align-items: center;
justify-content: space-between;
border-top: 1px solid #ececec;
margin-top: 10px;
}
.box-bottom-anniu {
width: 50%;
display: flex;
align-items: center;
justify-content: center;
color: #1678ff;
}
.bottom-icon {
margin-right: 5px;
image {
width: 25px;
height: 25px;
}
}
.wrap-box {
display: flex;
width: 100%;
flex-wrap: wrap;
}
</style>