home.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. <template>
  2. <view>
  3. <view class="header">
  4. <view class="flex justify-between map">
  5. <view class='Medium flex align-item-center locationwrap'
  6. @click='naviageToPage("/pages/grain_pulse/position/position")'>
  7. <image class='location' src="../../static/img/liangmai/icon_ditu.png" mode=""></image>
  8. {{position.name}}
  9. </view>
  10. <view @click='naviageToPage("/pages/grain_pulse/distribution/distribution?position="+JSON.stringify(position))'
  11. class='Regular flex align-item-center distribution justify-center'>
  12. <image class='cangku' src="../../static/img/liangmai/cangku.png" mode=""></image>
  13. 分布
  14. </view>
  15. </view>
  16. <!-- <view class="cu-bar search">
  17. <view class="search-form round" @click="naviageToPage('/pages/grain_pulse/search')">
  18. <image class='icon-scarch' src="../../static/img/liangmai/sousuo.png" mode=""></image>
  19. <view class='Regular'> 请输入货名或标题</view>
  20. </view>
  21. </view> -->
  22. </view>
  23. <view class="content">
  24. <view @click='friendcircle' class="friendcircle">
  25. <view class='title flex align-item-center Medium'>
  26. <image class='icon-friendcircle' src="../../static/img/liangmai/icon.png" mode=""></image>
  27. 圈友说
  28. </view>
  29. <view class='friendcircle-content flex justify-between'>
  30. <image class='bg' src="../../static/img/liangmai/bg.png" mode=""></image>
  31. <view class='friendcircle-content-right'>
  32. <view v-for='item in releaseInfo' class='friendcircle-content-right-item Regular flex align-item-center'>
  33. <image class='headportrait' v-if='item.avatarUrl' :src="item.avatarUrl" mode=""></image>
  34. <image class='headportrait' v-else src="../../static/img/myimg/YongHu@3x.png" mode=""></image>
  35. {{item.title}}
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <scroll-view scroll-x="true" scroll-with-animation="true" class='list-type'>
  41. <view v-for='item in searchTypes' @click='mainBusinessTypechange(item)'
  42. :class='mainBusinessTypeKey==item.value?"Semibold active":"Regular"' class="typeitem">{{item.name}}
  43. </view>
  44. </scroll-view>
  45. <view v-if='datalist.length>0' v-for='item in datalist' @click='todetails(item)' class="listitem">
  46. <view class="flex">
  47. <image class='listitem-left' :src="item.attachmentAddress" mode=""></image>
  48. <view class="listitem-right">
  49. <view class="companyname Medium">{{item.compName}}</view>
  50. <view class='Regular introduce'>{{item.companyProfile}}</view>
  51. </view>
  52. </view>
  53. <view class="flex align-item-center justify-between">
  54. <view @click.stop='naviageToPage1(item,"/pages/grain_pulse/localtion/localtion")'
  55. class='companylocation flex align-item-center Regular'>
  56. <image class='location' src="../../static/img/liangmai/icon_ditu.png" mode=""></image>
  57. {{item.province}}{{item.city}}{{item.area}}{{item.detailedAddress}}
  58. </view>
  59. <view v-if='position.name!="未设置"' class='distance Regular'>{{item._metre}}</view>
  60. </view>
  61. </view>
  62. <view style='padding:10px;text-align:center;' v-if='datalist.length==0'>
  63. 当前暂无数据
  64. </view>
  65. </view>
  66. <view v-if='datalist.length==0' class="enter" @click="enterUrl">
  67. <image style='width:56.5px;height:28px;' src="../../static/img/liangmai/ruzhu.png" mode=""></image>
  68. <view class='enter-content'>入驻</view>
  69. </view>
  70. </view>
  71. </template>
  72. <script>
  73. export default {
  74. components: {
  75. },
  76. data() {
  77. return {
  78. position:{
  79. name:"未设置"
  80. } ,
  81. status: 0,
  82. mainBusinessType: '',
  83. mainBusinessTypeKey: '0',
  84. pageSize: 10,
  85. releaseInfo:[],
  86. currentPage: 1,
  87. searchTypes: [{
  88. name: '全部',
  89. value: '0'
  90. }, {
  91. name: '粮库',
  92. value: '1'
  93. }, {
  94. name: '加工厂',
  95. value: '2'
  96. },
  97. {
  98. name: '烘干塔',
  99. value: '3'
  100. }, {
  101. name: '饲料厂',
  102. value: '4'
  103. }, {
  104. name: '养殖场',
  105. value: '5'
  106. },
  107. {
  108. name: '粮贸',
  109. value: '6'
  110. }, {
  111. name: '期货',
  112. value: '7'
  113. }
  114. ],
  115. notlist:false,
  116. datalist: []
  117. }
  118. },
  119. onPullDownRefresh() {
  120. this.getList()
  121. setTimeout(function () {
  122. uni.stopPullDownRefresh(); //关闭下拉刷新
  123. }, 1000);
  124. },
  125. onShow(val) {
  126. this.getList()
  127. uni.hideKeyboard()
  128. uni.getStorage({
  129. key: 'setLocaltion',
  130. success: (res) => {
  131. console.log(res.data)
  132. this.position = res.data
  133. // uni.removeStorage({
  134. // key: 'setLocaltion'
  135. // })
  136. },
  137. })
  138. },
  139. onLoad(option) {
  140. if (option.position){
  141. this.position = option.position
  142. }
  143. },
  144. methods: {
  145. getList(){
  146. this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
  147. currentPage: 1,
  148. pageSize: 4,
  149. searchKeyWord: this.keyword
  150. })
  151. .then(res => {
  152. if (res.data.code == 200) {
  153. this.releaseInfo = res.data.data.records
  154. }
  155. })
  156. this.getInfo()
  157. },
  158. getInfo(){
  159. uni.showLoading({
  160. title:"正在加载"
  161. })
  162. this.$api.doRequest('get', '/settledCompanyInfo/selectSettledCompanyInfo', {
  163. mainBusinessType: this.mainBusinessType,
  164. pageSize: this.pageSize,
  165. currentPage: this.currentPage,
  166. pcFlag: 2
  167. }).then(res => {
  168. if (res.data.code == 200) {
  169. this.datalist = res.data.data.records
  170. console.log(this.position)
  171. let lat2 =this.position.location.split(',')[1];
  172. let lng2 = this.position.location.split(',')[0];
  173. for(var i=0;i<this.datalist.length;i++){
  174. this.datalist[i]._metre=this.utils.getDistance(this.datalist[i].latitude,this.datalist[i].longitude,lat2,lng2)
  175. }
  176. if(this.currentPage==1&&this.datalist.length==0){
  177. this.notlist=true
  178. }else{
  179. this.notlist=false
  180. }
  181. console.log(this.datalist)
  182. // let _metre = this.utils.getDistance(lat1,lng1,lat2,lng2) +"千米"
  183. }
  184. uni.hideLoading()
  185. }).catch(res => {
  186. uni.hideLoading()
  187. })
  188. },
  189. mainBusinessTypechange(item) {
  190. if (item.name != '全部') {
  191. this.mainBusinessType = item.name
  192. } else {
  193. this.mainBusinessType = ''
  194. }
  195. this.getInfo()
  196. this.mainBusinessTypeKey = item.value
  197. },
  198. enterUrl() {
  199. //入驻
  200. uni.navigateTo({
  201. url: '/pages/grain_pulse/enter'
  202. })
  203. },
  204. friendcircle() {
  205. uni.navigateTo({
  206. url: '/pages/grain_pulse/dynamic'
  207. })
  208. },
  209. todetails(item) {
  210. uni.navigateTo({
  211. url: '/pages/grain_pulse/details?id=' + item.id
  212. })
  213. },
  214. naviageToPage(item) {
  215. console.log(item)
  216. uni.navigateTo({
  217. url: item
  218. })
  219. },
  220. naviageToPage1(item,url) {
  221. uni.setStorageSync('location', item)
  222. uni.navigateTo({
  223. url: url
  224. })
  225. }
  226. }
  227. }
  228. </script>
  229. <style scoped>
  230. /* 《--头部 */
  231. .header {
  232. padding: 0 12.5px;
  233. background: #fff;
  234. border-radius: 0 0 10px 10px;
  235. }
  236. /* 头部--》 */
  237. /* 《--定位 */
  238. .location {
  239. width: 30rpx;
  240. height: 30rpx;
  241. margin-right: 2.5px;
  242. }
  243. .locationwrap {
  244. font-size: 16px;
  245. }
  246. /* 定位 --》 */
  247. /* 《--分布 */
  248. .map {
  249. padding: 8.5px 0;
  250. }
  251. .cangku {
  252. width: 16.5px;
  253. height: 16.5px;
  254. margin-right: 5px;
  255. }
  256. .distribution {
  257. background: #F5F6FA;
  258. width: 71.5px;
  259. height: 32px;
  260. border-radius: 15px;
  261. font-size: 12px;
  262. }
  263. /* 分布--》 */
  264. /* 《--搜索 */
  265. .cu-bar .search-form {
  266. background: #F5F6F9;
  267. margin: 0;
  268. margin-bottom: 18px;
  269. padding: 10px 18px;
  270. }
  271. .icon-scarch {
  272. width: 15px;
  273. height: 15px;
  274. margin-right: 5px;
  275. }
  276. /* 搜索--》 */
  277. /* 《--内容 */
  278. .content {
  279. margin-top: 13px;
  280. }
  281. /* 内容--》 */
  282. /* 《--圈友说 */
  283. .friendcircle {
  284. background: #fff;
  285. margin: 0 9px;
  286. border-radius: 4px;
  287. }
  288. .friendcircle .title {
  289. font-size: 16px;
  290. padding: 11.5px 14.5px;
  291. }
  292. .icon-friendcircle {
  293. width: 17px;
  294. height: 17px;
  295. margin-right: 5.5px;
  296. }
  297. .bg {
  298. width: 200rpx;
  299. height: 200rpx;
  300. }
  301. .friendcircle-content {
  302. padding: 0 17px 18px;
  303. }
  304. .friendcircle-content-right {
  305. margin-left: 15.5px;
  306. }
  307. .friendcircle-content-right-item {
  308. background: linear-gradient(90deg, #F5F6FA 0%, #FFFFFF 100%);
  309. border-radius: 15rpx;
  310. margin-bottom: 20rpx;
  311. width: 420rpx;
  312. font-size: 12px;
  313. padding: 3px 0;
  314. }
  315. .headportrait {
  316. width: 22.5px;
  317. height: 22.5px;
  318. margin-right: 8.5px;
  319. border-radius:10px;
  320. }
  321. /* 圈友说--》 */
  322. /* 《--类型 */
  323. .list-type {
  324. background: linear-gradient(180deg, #F5F6FA 0%, #FFFFFF 100%);
  325. width: 100vw;
  326. padding-top: 5px;
  327. height: 49px;
  328. overflow-x: scroll;
  329. white-space: nowrap;
  330. }
  331. .typeitem {
  332. margin: 10px;
  333. position: relative;
  334. display: inline-block;
  335. padding-top: 8px;
  336. padding-bottom: 5px;
  337. }
  338. .typeitem.active {
  339. font-size: 16px;
  340. }
  341. .typeitem.active:after {
  342. content: '';
  343. display: block;
  344. position: absolute;
  345. height: 3px;
  346. bottom: 0;
  347. background: #22C572;
  348. width: 50%;
  349. left: 50%;
  350. transform: translateX(-50%);
  351. }
  352. /* 类型--》 */
  353. /* 《--数据 */
  354. .listitem {
  355. background: #fff;
  356. margin: 10px;
  357. padding: 15px 19px;
  358. }
  359. .listitem-left {
  360. width: 400rpx;
  361. height: 200rpx;
  362. margin-right: 8px;
  363. border-radius: 5px;
  364. }
  365. .companyname {
  366. font-size: 14px;
  367. color: #333;
  368. }
  369. .introduce {
  370. font-size: 12px;
  371. color: #676E80;
  372. }
  373. .companylocation {
  374. color: #676E80;
  375. background: #F5F6FA;
  376. margin-top: 8px;
  377. padding: 4px 10px;
  378. border-radius: 15px;
  379. font-size: 12px;
  380. }
  381. .distance {
  382. color: #AFB3BF;
  383. padding: 4px;
  384. margin-top: 8px;
  385. font-size: 12px;
  386. }
  387. /* 数据--》 */
  388. .enter {
  389. position: fixed;
  390. right: 0;
  391. top: 80%;
  392. width: 56.5px;
  393. height: 28px;
  394. }
  395. .enter-content {
  396. position: absolute;
  397. right: 5px;
  398. top: 50%;
  399. transform: translateY(-50%);
  400. color: #fff;
  401. }
  402. </style>