distribution.nvue 9.3 KB

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