distribution.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. <template>
  2. <view class="container">
  3. <view class="header">
  4. <view class="now-location">
  5. <u-icon name="map" size="36" class="icon"></u-icon>
  6. <text class="text Medium title">{{position.name}}</text>
  7. </view>
  8. <view class="selectType">
  9. <picker @change="bindPickerChange" :value="index" :range="typeList">
  10. <text class="uni-input header-type">{{typeList[index]}}</text>
  11. </picker>
  12. </view>
  13. </view>
  14. <view class="uni-common-mt">
  15. <view class="content">
  16. <map class="map" @markertap="markertap" :latitude="nowLocation.latitude"
  17. :longitude="nowLocation.longitude" :markers="covers" :enable-poi="true">
  18. </map>
  19. </view>
  20. </view>
  21. <view class="content2">
  22. <view class="no-enterprise Regular" v-if="enterpriseList.length!=0">
  23. 附近暂无相关企业
  24. </view>
  25. <view class="warp">
  26. <view class="line-style" @click="lineClick">
  27. <text class="top-line"></text>
  28. </view>
  29. <scroll-view :scroll-top="scrollTop" :scroll-y="isscroll" @scrolltoupper="upper" @scrolltolower="lower"
  30. @scroll="scroll" :class="{'active':isActive}" class="scroll-style">
  31. <view class="bottom-list-item">
  32. <img class="left-img" src="/static/location.png" alt="">
  33. <view class="middle">
  34. <text class="title Medium">中天昊元粮库中天昊元粮库</text>
  35. <text class="localtion Regular">辽宁省营口市鲅鱼圈区xx路108号</text>
  36. </view>
  37. <text class="line"></text>
  38. <view class="right">
  39. <img class="right-img" src="/static/location.png" alt="">
  40. <text class="right-bottom Regular">500m</text>
  41. </view>
  42. </view>
  43. <view class="bottom-list-item">
  44. <img class="left-img" src="/static/location.png" alt="">
  45. <view class="middle">
  46. <text class="title Medium">中天昊元粮库中天昊元粮库</text>
  47. <text class="localtion Regular">辽宁省营口市鲅鱼圈区xx路108号</text>
  48. </view>
  49. <text class="line"></text>
  50. <view class="right">
  51. <img class="right-img" src="/static/location.png" alt="">
  52. <text class="right-bottom Regular">500m</text>
  53. </view>
  54. </view>
  55. <view class="bottom-list-item">
  56. <img class="left-img" src="/static/location.png" alt="">
  57. <view class="middle">
  58. <text class="title Medium">中天昊元粮库中天昊元粮库</text>
  59. <text class="localtion Regular">辽宁省营口市鲅鱼圈区xx路108号</text>
  60. </view>
  61. <text class="line"></text>
  62. <view class="right">
  63. <img class="right-img" src="/static/location.png" alt="">
  64. <text class="right-bottom Regular">500m</text>
  65. </view>
  66. </view>
  67. <view class="bottom-list-item">
  68. <img class="left-img" src="/static/location.png" alt="">
  69. <view class="middle">
  70. <text class="title Medium">中天昊元粮库中天昊元粮库</text>
  71. <text class="localtion Regular">辽宁省营口市鲅鱼圈区xx路108号</text>
  72. </view>
  73. <text class="line"></text>
  74. <view class="right">
  75. <img class="right-img" src="/static/location.png" alt="">
  76. <text class="right-bottom Regular">500m</text>
  77. </view>
  78. </view>
  79. <view class="bottom-list-item">
  80. <img class="left-img" src="/static/location.png" alt="">
  81. <view class="middle">
  82. <text class="title Medium">中天昊元粮库中天昊元粮库</text>
  83. <text class="localtion Regular">辽宁省营口市鲅鱼圈区xx路108号</text>
  84. </view>
  85. <text class="line"></text>
  86. <view class="right">
  87. <img class="right-img" src="/static/location.png" alt="">
  88. <text class="right-bottom Regular">500m</text>
  89. </view>
  90. </view>
  91. <view class="bottom-list-item">
  92. <img class="left-img" src="/static/location.png" alt="">
  93. <view class="middle">
  94. <text class="title Medium">中天昊元粮库中天昊元粮库</text>
  95. <text class="localtion Regular">辽宁省营口市鲅鱼圈区xx路108号</text>
  96. </view>
  97. <text class="line"></text>
  98. <view class="right">
  99. <img class="right-img" src="/static/location.png" alt="">
  100. <text class="right-bottom Regular">500m</text>
  101. </view>
  102. </view>
  103. <view class="bottom-list-item">
  104. <img class="left-img" src="/static/location.png" alt="">
  105. <view class="middle">
  106. <text class="title Medium">中天昊元粮库中天昊元粮库</text>
  107. <text class="localtion Regular">辽宁省营口市鲅鱼圈区xx路108号</text>
  108. </view>
  109. <text class="line"></text>
  110. <view class="right">
  111. <img class="right-img" src="/static/location.png" alt="">
  112. <text class="right-bottom Regular">500m</text>
  113. </view>
  114. </view>
  115. <view class="bottom-list-item">
  116. <img class="left-img" src="/static/location.png" alt="">
  117. <view class="middle">
  118. <text class="title Medium">中天昊元粮库中天昊元粮库</text>
  119. <text class="localtion Regular">辽宁省营口市鲅鱼圈区xx路108号</text>
  120. </view>
  121. <text class="line"></text>
  122. <view class="right">
  123. <img class="right-img" src="/static/location.png" alt="">
  124. <text class="right-bottom Regular">500m</text>
  125. </view>
  126. </view>
  127. <view class="bottom-list-item">
  128. <img class="left-img" src="/static/location.png" alt="">
  129. <view class="middle">
  130. <text class="title Medium">中天昊元粮库中天昊元粮库</text>
  131. <text class="localtion Regular">辽宁省营口市鲅鱼圈区xx路108号</text>
  132. </view>
  133. <text class="line"></text>
  134. <view class="right">
  135. <img class="right-img" src="/static/location.png" alt="">
  136. <text class="right-bottom Regular">500m</text>
  137. </view>
  138. </view>
  139. <view class="bottom-list-item">
  140. <img class="left-img" src="/static/location.png" alt="">
  141. <view class="middle">
  142. <text class="title Medium">中天昊元粮库中天昊元粮库</text>
  143. <text class="localtion Regular">辽宁省营口市鲅鱼圈区xx路108号</text>
  144. </view>
  145. <text class="line"></text>
  146. <view class="right">
  147. <img class="right-img" src="/static/location.png" alt="">
  148. <text class="right-bottom Regular">500m</text>
  149. </view>
  150. </view>
  151. </scroll-view>
  152. </view>
  153. </view>
  154. </view>
  155. </template>
  156. <script>
  157. // import amap from '@/js_sdk/js-amap/amap-wx.130.js'
  158. export default {
  159. data() {
  160. return {
  161. isscroll: true,
  162. scrollTop: 0,
  163. old: {
  164. scrollTop: 0
  165. },
  166. "isActive": false,
  167. position: {},
  168. nowLocation: {
  169. latitude: 39.9085,
  170. longitude: 116.39747,
  171. },
  172. showType: false,
  173. enterpriseList: [],
  174. // typeStr: '全部类型',
  175. index: 0,
  176. typeList: ['全部类型', '粮仓', '加工厂'],
  177. title: 'map',
  178. covers: [{
  179. id: 0,
  180. latitude: 39.9085,
  181. longitude: 116.39747,
  182. iconPath: '../../../static/img/location.png',
  183. }]
  184. }
  185. },
  186. onShow() {
  187. },
  188. onLoad(e) {
  189. if(e.position){
  190. this.position = JSON.parse(e.position)
  191. console.log("地点",this.position)
  192. this.nowLocation.latitude = this.position.location.split(',')[1]
  193. this.nowLocation.longitude = this.position.location.split(',')[0]
  194. }
  195. //获取标记点
  196. this.getMarkers()
  197. },
  198. methods: {
  199. getMarkers(){
  200. //点击列表标记改变颜色,显示气泡提示
  201. // this.$api.doRequest('get', '/settledCompanyInfo/selectSettledCompanyInfo', {
  202. // pageSize: this.pageSize,
  203. // currentPage: this.currentPage,
  204. // }).then(res => {
  205. // if (res.data.code == 200) {
  206. // this.datalist = res.data.data.records
  207. // }
  208. // })
  209. },
  210. lineClick(){
  211. this.isActive= !this.isActive
  212. // this.isscroll = !this.isscroll
  213. },
  214. upper: function(e) {
  215. console.log(e)
  216. },
  217. lower: function(e) {
  218. console.log(e)
  219. },
  220. scroll: function(e) {
  221. console.log(e)
  222. this.old.scrollTop = e.detail.scrollTop
  223. },
  224. bindPickerChange: function(e) {
  225. console.log('picker发送选择改变,携带值为', e.target)
  226. this.index = e.detail.value
  227. },
  228. confirm() {
  229. console.log('确定')
  230. this.showType = false
  231. },
  232. cancel() {
  233. console.log('取消')
  234. this.showType = false
  235. },
  236. selectType() {
  237. this.showType = true
  238. console.log(1)
  239. },
  240. // typeConfirm(e) {
  241. // console.log(e)
  242. // this.typeStr = this.typeList[e[0]].name
  243. // },
  244. getLocation() {
  245. let that = this;
  246. // uni.getLocation({
  247. // type: 'gcj02',
  248. // geocode: true,
  249. // success: function(res) {
  250. // that.nowLocation.longitude = res.longitude
  251. // that.nowLocation.latitude = res.latitude
  252. // that.covers[0].longitude = res.longitude
  253. // that.covers[0].latitude = res.latitude
  254. // let _coverrsData = []
  255. // for (let i = 0; i < 50; i++) {
  256. // let _obj = {
  257. // id: i,
  258. // latitude: res.latitude += 0.00150,
  259. // longitude: res.longitude + 0.00150,
  260. // iconPath: '../../../static/img/location.png',
  261. // width: 30,
  262. // height: 30,
  263. // callout: {
  264. // content: '中天昊元粮库',
  265. // color: '#333333',
  266. // fontSize: 12,
  267. // borderRadius: 20,
  268. // padding: 4,
  269. // bgColor: 'white',
  270. // display: 'ALWAYS',
  271. // },
  272. // }
  273. // _coverrsData.push(_obj)
  274. // }
  275. // that.covers = _coverrsData
  276. // console.log('获取位置数据:', res);
  277. // console.log('当前位置的经度:' + res.longitude);
  278. // console.log('当前位置的纬度:' + res.latitude);
  279. // //拼接当前定位回显地址
  280. // // #ifdef APP-PLUS
  281. // let _address = res.address
  282. // that.address = _address.province + _address.city + _address.district + _address.poiName
  283. // console.log(that.address)
  284. // // #endif
  285. // }
  286. // });
  287. },
  288. markertap(e) {
  289. console.log(e)
  290. uni.showToast({
  291. title: "点击id为" + e.detail.markerId + "的坐标",
  292. icon: 'none',
  293. duration: 2000
  294. })
  295. },
  296. getLst() {
  297. console.log("加载数据")
  298. }
  299. }
  300. }
  301. </script>
  302. <style scoped>
  303. .active {
  304. height: 583rpx!important;
  305. }
  306. .header {
  307. flex-direction: row;
  308. justify-content: space-between;
  309. margin-bottom: 20rpx;
  310. padding: 20rpx;
  311. }
  312. .title {
  313. font-size: 32rpx;
  314. font-weight: 500;
  315. color: #333333;
  316. }
  317. .content {
  318. width: 750px;
  319. flex: 1;
  320. }
  321. .map {
  322. height: 1350rpx;
  323. }
  324. .content2 {
  325. position: fixed;
  326. bottom: 0;
  327. width: 750rpx;
  328. flex: 1;
  329. font-size: 34rpx;
  330. background: white;
  331. border-top-left-radius: 20rpx;
  332. border-top-right-radius: 20rpx;
  333. }
  334. .warp {
  335. /* flex-direction: row;
  336. justify-content: center; */
  337. }
  338. .header-type {
  339. font-size: 26rpx;
  340. font-weight: 400;
  341. color: #333333;
  342. }
  343. .alert {
  344. flex: 1;
  345. }
  346. .select-alert {
  347. background-color: green;
  348. position: fixed;
  349. bottom: 0;
  350. width: 750rpx;
  351. flex: 1;
  352. }
  353. .select-top {
  354. flex-direction: row;
  355. align-items: center;
  356. justify-content: space-around;
  357. background: yellow;
  358. height: 80rpx;
  359. }
  360. .select {
  361. width: 750rpx;
  362. flex: 1;
  363. flex-direction: column;
  364. justify-content: center;
  365. align-items: center;
  366. background: white;
  367. }
  368. .cancel {
  369. font-size: 24rpx;
  370. color: white;
  371. font-weight: bold;
  372. }
  373. .confirm {
  374. font-size: 24rpx;
  375. color: green;
  376. font-weight: bold;
  377. }
  378. .select-item {
  379. font-size: 24rpx;
  380. }
  381. .warp {}
  382. .bottom-list-item {
  383. flex-direction: row;
  384. justify-content: space-between;
  385. margin-bottom: 20rpx;
  386. padding-bottom: 20rpx;
  387. margin-top: 20rpx;
  388. border-bottom: 1px solid #EEEEEE;
  389. }
  390. .left {}
  391. .left-img {
  392. width: 102rpx;
  393. height: 106rpx;
  394. }
  395. .localtion {
  396. font-size: 24rpx;
  397. font-weight: 400;
  398. color: #AFB3BF;
  399. }
  400. .localtion {
  401. flex-direction: column;
  402. }
  403. .right-img {
  404. width: 21rpx;
  405. height: 26rpx;
  406. background: #AFB3BF;
  407. }
  408. .right {
  409. flex-direction: column;
  410. justify-content: center;
  411. align-items: center;
  412. }
  413. .middle {
  414. flex-direction: column;
  415. justify-content: center;
  416. }
  417. .warp {
  418. padding: 20rpx;
  419. }
  420. .right-bottom {
  421. font-size: 24rpx;
  422. font-weight: 400;
  423. color: #AFB3BF;
  424. }
  425. .top-line {
  426. width: 68px;
  427. height: 8px;
  428. background: #B4B7C3;
  429. border-radius: 4px;
  430. flex-direction: row;
  431. margin-bottom: 30rpx;
  432. }
  433. .line-style {
  434. flex-direction: row;
  435. justify-content: center;
  436. }
  437. .scroll-style {
  438. height: 130rpx;
  439. }
  440. </style>