distribution.nvue 9.3 KB

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