123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334 |
- <template>
- <view class="refuel">
- <image class="banner" src="https://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/03uYm9N6msBkfcb964559107edb57a716b835f90fde5.jpg/1.jpg" mode=""></image>
-
- <view class="notice-box">
- <image class="icon" src="../static/notice.png" mode=""></image>
- 进入加油站后,请前往安全区域使用手机
- </view>
- <!-- 内容 -->
- <zs-list class="store-box" mt="0" @load="loadMore" :status="status">
- <view class="item" v-for="(item,index) in list" :key="index" @click="goDetail(item)">
- <image class="tag" src="../static/refuel-tag.png" mode=""></image>
- <!-- <zs-img :src="item.logo" width="200rpx" height="200rpx" radius="full" ></zs-img> -->
- <view class="info">
- <view class="title-box">
- <view class="title">
- {{item.storeName}}
- </view>
- <view class="diatance-box">
- <image class="icon" src="../static/refuel/nav-icon-black.png" mode=""></image>
- {{(item.distance/1000).toFixed(2)}}km
- </view>
- </view>
- <view class="address" >
- 距离你 {{(item.distance/1000).toFixed(2)}} 公里
- </view>
- <view class="activity">
- <view class="discount">
- 满200元减14
- </view>
- <!-- <view class="coupon">
- <image class="icon" src="../static/refuel/card-icon.png" mode=""></image>
- 优惠券省999
- </view> -->
-
- <view class="price-box">
- <view class="label">
- 特惠价
- </view>
- <view class="price">
- ¥{{item |filterVipPrice}}/L
- </view>
- </view>
-
- </view>
-
-
- </view>
- </view>
- </zs-list>
- </view>
- </template>
- <script>
- import { getNearbyStore } from '@/api/refuel.js';
- import {
- search
- } from '@/api/shop.js';
- export default {
- data() {
- return {
- map: null,
- longitude: 0,
- latitude: 0,
- scale:18,
- markers: [],
- destination: '',
- active: 0,
- status: 'more',
- list: [],
- list: [],
- // query:{
- // latitude:39.896751,
- // longitude:116.460653,
- // maxDistanceInKilometers:50,
- // pageCurrent:1,
- // pageSize:10
- // },
- query: {
- district:'',
- menuId: 4,
- queryName: '',
- 'location.lat': 0,
- 'location.lon': 0,
- pageCurrent: 1,
- pageSize: 10,
- userId: uni.getStorageSync('userInfo')?JSON.parse(uni.getStorageSync('userInfo')).userId:''
- },
- }
- },
- filters: {
- filterVipPrice: function(item) {
- let arr = item.itemInfoList.filter(i=>i.itemName == '92#')
- if(!arr.length &&item.itemInfoList.length){
- arr = [item.itemInfoList[0]]
- }
- return arr.length?(arr[0].vipPrice/100).toFixed(2) : 0;
- },
- filterPrice: function(item) {
- let arr = item.itemInfoList.filter(i=>i.itemName == '92#')
- if(!arr.length &&item.itemInfoList.length){
- arr = [item.itemInfoList[0]]
- }
- return arr.length?(arr[0].cityPrice/100).toFixed(2) : 0;
- }
- },
- methods: {
- goDetail(item) {
- if(!uni.getStorageSync('token')){
- return uni.showModal({
- title:'请登录',
- confirmText:'去登录',
- success(res){
- console.log(res);
- if(res.confirm){
- uni.navigateTo({
- url:'/login/login/login?redirect=/refuel/index'
- })
- }
- }
- })
- }
- uni.navigateTo({
- url: `/refuel/refuelDetail?id=${item.storeId}&epId=${item.shopId}`
- })
- },
- loadMore() {
- this.search()
- },
- search() {
- this.status = 'loading'
- let obj = JSON.parse(JSON.stringify(this.query))
- search(obj).then(res => {
- uni.stopPullDownRefresh()
- if (res.state == 'Success') {
- let dataList = []
- res.content.records.map(item=>{
- let obj
- if(item.tripartiteJson){
- obj = JSON.parse(item.tripartiteJson)
- obj.distance = item.shopVo.distance
- obj.shopId = item.shopVo.id
- dataList.push(obj)
- }
- })
- this.list = this.list.concat(dataList)
- if (this.list.length >= res.content.total) {
- this.status = 'noMore'
- } else {
- this.status = 'more'
- this.query.pageCurrent++
- }
- }
- })
- // getNearbyStore(this.query).then(res=>{
- // uni.stopPullDownRefresh()
- // this.status = 'noMore'
- // if(res.state == 'Success'){
- // this.list = res.content
-
- // }
- // })
- },
- },
- onPullDownRefresh() {
- uni.getLocation({
- type: 'gcj02',
- success: (res) => {
- // 解析地址
- this.query['location.lat'] = res.latitude
- this.query['location.lon'] = res.longitude
- // 存储经纬度
- uni.setStorageSync('location',JSON.stringify({latitude:res.latitude,longitude:res.longitude}))
- this.query.pageCurrent = 1
- this.status = 'more'
- this.list = []
- this.search()
- }
- })
- },
- onLoad(option) {
- },
- onReady() {
- // let location = JSON.parse(uni.getStorageSync('location'))
- // this.query['location.lat'] = location.latitude
- // this.query['location.lon']= location.longitude
- // this.search()
- uni.getLocation({
- type: 'gcj02',
- success: (res) => {
- // 解析地址
- this.query['location.lat'] = res.latitude
- this.query['location.lon'] = res.longitude
- console.log(this);
- // 存储经纬度
- uni.setStorageSync('location',JSON.stringify({latitude:res.latitude,longitude:res.longitude}))
- this.search()
- }
- })
- }
- }
- </script>
- <style lang="scss">
- .refuel {
- background: #F9F9F9;
- padding: 20rpx 24rpx;
- .banner{
- width: 100%;
- height: 132rpx;
- border-radius: 16rpx;
- }
- .notice-box{
- display: flex;
- align-items: center;
- font-weight: 300;
- font-size: 22rpx;
- color: #EE4927;
- margin: 20rpx 0;
- .icon{
- width: 26rpx;
- height: 26rpx;
- margin-right: 10rpx;
- }
- }
- .zs-list {
- // padding-top: 20rpx;
- .item {
- display: flex;
- padding: 24rpx;
- background: #fff;
- border-radius: 16rpx;
- margin-bottom: 20rpx;
- position: relative;
- .tag{
- position: absolute;
- top: 0%;
- left: 0%;
- width: 150rpx;
- height: 53rpx;
- }
- .info{
- flex: 1;
- padding: 26rpx 0 0;
- .title-box{
- display: flex;
- align-items: center;
- justify-content: space-between;
- .title{
- font-size: 28rpx;
- font-weight: bold;
- width: 500rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- margin-top: 10rpx;
- }
- .diatance-box{
- display: flex;
- align-items: center;
- font-weight: 400;
- font-size: 24rpx;
- color: #222222;
- .icon{
- width: 20rpx;
- height: 20rpx;
- margin-right: 8rpx;
- }
- }
- }
- .address{
- font-weight: 300;
- font-size: 24rpx;
- color: #AAAAAA;
- margin-top: 12rpx;
- }
-
- .activity{
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-top: 10rpx;
- .price-box{
- display: flex;
- align-items: center;
- .label{
- font-weight: 300;
- font-size: 20rpx;
- color: #FF4D3A;
- }
- .price{
- font-weight: 600;
- font-size: 32rpx;
- color: $uni-color-primary;
- margin-left: 8rpx;
- }
- }
- .coupon{
- font-weight: 300;
- padding: 4rpx 16rpx;
- font-weight: 400;
- font-size: 24rpx;
- color: #FFFFFF;
- border-radius: 8rpx 8rpx 8rpx 8rpx;
- background: linear-gradient( 270deg, #EE4320 0%, #FF9C87 100%);
- display: flex;
- align-items: center;
- .icon{
- width: 30rpx;
- height: 30rpx;
- }
- }
- }
- .discount{
- display: inline-block;
- font-weight: 300;
- font-size: 22rpx;
- color: #AAAAAA;
- padding: 2rpx 12rpx;
- border: 1rpx solid #F0F0F0;
- border-radius: 4rpx 4rpx 4rpx 4rpx;
- margin-top: 10rpx;
- }
- }
- }
- }
- }
- </style>
|