123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389 |
- <template>
- <view class="container">
- <view class="header">
- <view class="now-location">
- <!-- <u-icon name="map" size="36" class="icon"></u-icon> -->
- <text class="text Medium title">{{position.name}}</text>
- </view>
- <view class="selectType">
- <picker @change="bindPickerChange" :value="index" :range="typeList">
- <text class="uni-input header-type">{{typeList[index]}}</text>
- </picker>
- </view>
- </view>
- <view class="uni-common-mt">
- <view class="content">
- <map class="map" @markertap="markertap" :latitude="nowLocation.latitude"
- :longitude="nowLocation.longitude" :markers="covers" :enable-poi="true">
- </map>
- </view>
- </view>
- <view class="content2">
- <view class="no-enterprise Regular" v-if="enterpriseList.length!=0">
- 附近暂无相关企业
- </view>
- <view class="warp">
- <view class="line-style" @click="lineClick">
- <text class="top-line"></text>
- </view>
- <scroll-view :scroll-top="scrollTop" :scroll-y="isscroll" @scrolltoupper="upper" @scrolltolower="lower"
- @scroll="scroll" :class="{'active':isActive}" class="scroll-style">
- <view class="bottom-list-item" v-for="(item,index) in datalist" :key="index">
- <img class="left-img" :src="item.attachmentAddress" alt="">
- <view class="middle">
- <text class="title Medium">{{item.title}}</text>
- <text
- class="localtion Regular">{{item.province}}{{item.city}}{{item.area}}{{item.detailedAddress}}</text>
- </view>
- <text class="line"></text>
- <view class="right">
- <img class="right-img" src="/static/img/dizhi.png" alt="">
- <text class="right-bottom Regular">{{metreList[index]}}</text>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- </view>
- </template>
- <script>
- // import amap from '@/js_sdk/js-amap/amap-wx.130.js'
- import * as config from '@/config'
- export default {
- data() {
- return {
- isscroll: true,
- scrollTop: 0,
- old: {
- scrollTop: 0
- },
- metreList: [],
- datalist: [],
- "isActive": false,
- position: {},
- nowLocation: {
- latitude: 39.9085,
- longitude: 116.39747,
- },
- showType: false,
- enterpriseList: [],
- // typeStr: '全部类型',
- index: 0,
- typeList: ['全部类型', '粮仓', '加工厂'],
- title: 'map',
- covers: [{
- id: 0,
- latitude: 39.9085,
- longitude: 116.39747,
- iconPath: '../../../static/img/location.png',
- }],
- }
- },
- onShow() {
- },
- onLoad(e) {
- if (Object.keys(e).length) {
- this.position = JSON.parse(e.position)
- this.nowLocation.latitude = this.position.location.split(',')[1]
- this.nowLocation.longitude = this.position.location.split(',')[0]
- //获取列表数据
- }
- this.getList()
- },
- methods: {
- getList(val) {
- this.metreList = []
- let detailedAddress = ""
- if (val) {
- detailedAddress = this.position.name
- }
- console.log("-----------------------")
- getApp().nvueRequst('get', '/settledCompanyInfo/selectSettledCompanyInfo', {
- pageSize: 10000,
- currentPage: 1,
- detailedAddress:detailedAddress
- }).then(res => {
- console.log('res',res)
- if (res.data.code == 200) {
- this.datalist = res.data.data.records
- let lat1 = this.nowLocation.latitude
- let lng1 = this.nowLocation.longitude
- for(let i = 0;i<this.datalist.length;i++){
- let lat2 = this.datalist[i].latitude
- let lng2 = this.datalist[i].longitude
- let _metre = this.utils.getDistance(lat1,lng1,lat2,lng2) +"千米"
- this.metreList.push(_metre)
- }
- }
- })
- },
- lineClick() {
- this.isActive = !this.isActive
- // this.isscroll = !this.isscroll
- },
- upper: function(e) {
- console.log(e)
- },
- lower: function(e) {
- console.log(e)
- },
- scroll: function(e) {
- console.log(e)
- this.old.scrollTop = e.detail.scrollTop
- },
- bindPickerChange: function(e) {
- console.log('picker发送选择改变,携带值为', e.target)
- this.index = e.detail.value
- },
- confirm() {
- console.log('确定')
- this.showType = false
- },
- cancel() {
- console.log('取消')
- this.showType = false
- },
- selectType() {
- this.showType = true
- console.log(1)
- },
- // typeConfirm(e) {
- // console.log(e)
- // this.typeStr = this.typeList[e[0]].name
- // },
- getLocation() {
- let that = this;
- // uni.getLocation({
- // type: 'gcj02',
- // geocode: true,
- // success: function(res) {
- // that.nowLocation.longitude = res.longitude
- // that.nowLocation.latitude = res.latitude
- // that.covers[0].longitude = res.longitude
- // that.covers[0].latitude = res.latitude
- // let _coverrsData = []
- // for (let i = 0; i < 50; i++) {
- // let _obj = {
- // id: i,
- // latitude: res.latitude += 0.00150,
- // longitude: res.longitude + 0.00150,
- // iconPath: '../../../static/img/location.png',
- // width: 30,
- // height: 30,
- // callout: {
- // content: '中天昊元粮库',
- // color: '#333333',
- // fontSize: 12,
- // borderRadius: 20,
- // padding: 4,
- // bgColor: 'white',
- // display: 'ALWAYS',
- // },
- // }
- // _coverrsData.push(_obj)
- // }
- // that.covers = _coverrsData
- // console.log('获取位置数据:', res);
- // console.log('当前位置的经度:' + res.longitude);
- // console.log('当前位置的纬度:' + res.latitude);
- // //拼接当前定位回显地址
- // // #ifdef APP-PLUS
- // let _address = res.address
- // that.address = _address.province + _address.city + _address.district + _address.poiName
- // console.log(that.address)
- // // #endif
- // }
- // });
- },
- markertap(e) {
- console.log(e)
- uni.showToast({
- title: "点击id为" + e.detail.markerId + "的坐标",
- icon: 'none',
- duration: 2000
- })
- },
- getLst() {
- console.log("加载数据")
- }
- }
- }
- </script>
- <style scoped>
- .active {
- height: 583rpx !important;
- }
- .header {
- flex-direction: row;
- justify-content: space-between;
- margin-bottom: 20rpx;
- padding: 20rpx;
- }
- .title {
- font-size: 32rpx;
- font-weight: 500;
- color: #333333;
- }
- .content {
- width: 750px;
- flex: 1;
- }
- .map {
- height: 1350rpx;
- }
- .content2 {
- position: fixed;
- bottom: 0;
- width: 750rpx;
- flex: 1;
- font-size: 34rpx;
- background: white;
- border-top-left-radius: 20rpx;
- border-top-right-radius: 20rpx;
- }
- .warp {
- /* flex-direction: row;
- justify-content: center; */
- }
- .header-type {
- font-size: 26rpx;
- font-weight: 400;
- color: #333333;
- }
- .alert {
- flex: 1;
- }
- .select-alert {
- background-color: green;
- position: fixed;
- bottom: 0;
- width: 750rpx;
- flex: 1;
- }
- .select-top {
- flex-direction: row;
- align-items: center;
- justify-content: space-around;
- background: yellow;
- height: 80rpx;
- }
- .select {
- width: 750rpx;
- flex: 1;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- background: white;
- }
- .cancel {
- font-size: 24rpx;
- color: white;
- font-weight: bold;
- }
- .confirm {
- font-size: 24rpx;
- color: green;
- font-weight: bold;
- }
- .select-item {
- font-size: 24rpx;
- }
- .warp {}
- .bottom-list-item {
- flex-direction: row;
- justify-content: space-between;
- margin-bottom: 20rpx;
- padding-bottom: 20rpx;
- margin-top: 20rpx;
- border-bottom: 1px solid #EEEEEE;
- }
- .left {}
- .left-img {
- width: 102rpx;
- height: 106rpx;
- }
- .localtion {
- font-size: 24rpx;
- font-weight: 400;
- color: #AFB3BF;
- }
- .localtion {
- flex-direction: column;
- }
- .right-img {
- width: 21rpx;
- height: 26rpx;
- }
- .right {
- flex-direction: column;
- justify-content: center;
- align-items: center;
- }
- .middle {
- flex-direction: column;
- justify-content: center;
- }
- .warp {
- padding: 20rpx;
- }
- .right-bottom {
- font-size: 24rpx;
- font-weight: 400;
- color: #AFB3BF;
- }
- .top-line {
- width: 68px;
- height: 8px;
- background: #B4B7C3;
- border-radius: 4px;
- flex-direction: row;
- margin-bottom: 30rpx;
- }
- .line-style {
- flex-direction: row;
- justify-content: center;
- }
- .scroll-style {
- height: 130rpx;
- }
- </style>
|