123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <template>
- <view class="content">
- <view>
- <scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="reachBottom"
- @scroll="scroll">
- <view class="">
-
- </view>
- </scroll-view>
- </view>
- </view>
- </template>
- <script>
-
- export default {
- components: {},
- data() {
- return {
- storeList: [],
- currentPosition: {
- lat: '0',
- lng: '0'
- },
- pageNo: 1,
- pageSize: 10
- }
- },
- onShow() {
-
- },
- onLoad() {
- // 获取当前经纬度
- let _this = this
- uni.getLocation({
- type: 'wgs84', // 默认wgs84
- success: function(res) {
- _this.currentPosition.lat = res.latitude;
- _this.currentPosition.lng = res.longitude;
- _this.gpsCompletion = true;
- // 查询门店信息
- // _this.getStoresList()
- },
- fail: function(res) {
- console.log(res)
- // 查询门店信息
- // _this.getStoresList()
- },
- });
- },
-
- computed: {
- },
- methods:{
- getStoresList () {
- uni.showLoading({
- title: '正在加载...'
- })
- let lat = this.currentPosition.lat
- let lng = this.currentPosition.lng
- getStoresList({pageNo:this.pageNo,pageSize:this.pageSize,lat:lat,lng:lng}).then(res => {
- console.log(res)
- if(res.status == 200){
- let list = res.data.list
- if(list&&list.length){
- list.map(item => {
- if (item.addrDetail.indexOf("省")>0 && item.addrDetail.indexOf("市")>0 && item.addrDetail.indexOf("区")>0){
- item.addrDetail = item.addrDetail
- } else {
- if (item.addrDetail.indexOf("市")>0 && item.addrDetail.indexOf("区")>0){
- item.addrDetail = item.addrProvinceName + item.addrDetail
- } else if (item.addrDetail.indexOf("区")>0) {
- item.addrDetail = item.addrProvinceName + item.addrCityName + item.addrDetail
- } else {
- item.addrDetail = item.addrProvinceName + item.addrCityName + item.addrDistrictName + item.addrDetail
- }
- }
- item.distance = item.distance ? Math.round(item.distance/1000) : ''
- item.star = getStarNum(item.level)
- })
- this.storeList = this.storeList.concat(list)
- }else{
- if(this.pageNo!=1){
- uni.showToast({
- title: '已经是最后一页'
- })
- this.isLastPage = true
- }
- }
- }
- uni.hideLoading()
- })
- },
- // 到达底部
- reachBottom () {
-
- }
-
- }
- }
- </script>
- <style lang="scss" scoped>
-
- </style>
|