优化:站点支持定位及导航

This commit is contained in:
wuhui_zzw 2024-01-16 16:42:51 +08:00
parent eb5e0983e2
commit 91856622a9
4 changed files with 193 additions and 2 deletions

View File

@ -17,7 +17,7 @@ export function pointUserInfo(data) {
}
// 提货处理 - 获取提货点信息
export function pointList(data) {
return request.get("exchange/pointList",data);
return request.get("exchange/pointList", data, {noAuth: true});
}
// 提货处理 - 提货处理
export function confirmExchange(data) {

View File

@ -551,8 +551,15 @@
"style": {
"navigationBarTitleText": "兑换管理"
}
},
{
"path": "online_payment/site/list",
"style": {
"navigationBarTitleText": "兑换站列表"
}
}
]
},
{

View File

@ -0,0 +1,184 @@
<template>
<view :style="viewColor">
<view class='content-box'>
<view v-if="Object.values(list).length > 0" class="content-list">
<view class="site-box" v-for="(item,index) in list" :key="index">
<view class="left">
<view class="title">
<view class="title-text">{{item.title}}</view>
<view v-if="item.distance > 0" class="distance">{{item.distance_text}}</view>
</view>
<view class="address">{{item.address}}</view>
</view>
<view class="right" @click="navigationAddress(item)">导航</view>
</view>
</view>
<emptyPage v-else title="暂无信息~"></emptyPage>
</view>
</view>
</template>
<script>
import { pointList } from '@/api/exchange.js';
import {mapGetters} from "vuex";
import emptyPage from '@/components/emptyPage.vue';
const app = getApp();
export default {
components: {
emptyPage,
},
data() {
return {
//
lng: null,
lat: null,
//
list: [],
page: 1,
};
},
computed: {
// ...mapGetters(['isLogin', 'userInfo', 'viewColor'])
...mapGetters(['viewColor'])
},
onLoad(options) {
this.getLocation();
},
onReachBottom: function () {
this.getPointList();
},
methods: {
//
getLocation() {
let _this = this;
uni.getLocation({
type: 'gcj02', //
success(res) {
_this.lng = res.longitude || null;
_this.lat = res.latitude || null;
_this.getPointList();
},
fail(err) {
console.error('获取地理位置失败', err)
_this.getPointList();
}
})
},
//
getPointList() {
let _this = this;
let params = {
page: _this.page,
lng: _this.lng,
lat: _this.lat
};
pointList(params).then(res => {
let list = res.data || {};
if (Object.values(list).length > 0) {
_this.list = _this.$util.SplitArray(list, _this.list);
_this.$set(_this, 'list', _this.list);
_this.page++;
}
}).catch(err => {
console.log('错误', err)
this.$util.Tips({
title: err
});
});
},
//
navigationAddress(item){
uni.openLocation({
longitude: Number(item.lng),
latitude: Number(item.lat),
// name: '',
// address: '',
success: function (res) {
console.log('打开系统位置地图成功')
},
fail: function (error) {
console.log(error)
}
});
}
},
}
</script>
<style scoped lang="scss">
.content-box{
min-height: 100vh;
width: 100%;
background: #f6f6f6;
.content-list{
width: 100%;
.site-box{
width: 100%;
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: space-between;
padding: 20rpx;
border-bottom: 2rpx solid #CCCCCC;
.left{
width: calc(100% - 120rpx);
.title{
width: 100%;
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: flex-start;
.title-text{
max-width: calc(100% - 130rpx);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 30rpx;
font-weight: bold;
}
.distance{
font-size: 24rpx;
background-color: #e6a23c;
color: #fff;
font-weight: initial;
height: 35rpx;
line-height: 35rpx;
border-radius: 50rpx;
margin-left: 20rpx;
width: 110rpx;
text-align: center;
}
}
.address{
width: 100%;
text-align: left;
font-size: 26rpx;
color: #a0a1a7;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.right{
color: #fff;
background-color: #409eff;
border-color: #409eff;
height: 40rpx;
line-height: 40rpx;
padding: 0 15rpx;
border-radius: 50rpx;
width: 100rpx;
text-align: center;
}
}
.site-box:last-child{
border-bottom: 0!important;
}
}
}
</style>

View File

@ -47,7 +47,7 @@ function atob(input) {
const sum = (a << 18) | (b << 12) | (c << 6) | d;
output += String.fromCharCode((sum >> 16) & 0xFF, (sum >> 8) & 0xFF, sum & 0xFF);
}
return output;
}
/**