home.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  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 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. import {
  74. mapState
  75. } from 'vuex';
  76. export default {
  77. components: {
  78. },
  79. data() {
  80. return {
  81. position:{
  82. name:"未设置"
  83. } ,
  84. status: 0,
  85. mainBusinessType: '',
  86. mainBusinessTypeKey: '0',
  87. pageSize: 10,
  88. releaseInfo:[],
  89. currentPage: 1,
  90. searchTypes: [{
  91. name: '全部',
  92. value: '0'
  93. }, {
  94. name: '粮库',
  95. value: '1'
  96. }, {
  97. name: '加工厂',
  98. value: '2'
  99. },
  100. {
  101. name: '烘干塔',
  102. value: '3'
  103. }, {
  104. name: '饲料厂',
  105. value: '4'
  106. }, {
  107. name: '养殖场',
  108. value: '5'
  109. },
  110. {
  111. name: '粮贸',
  112. value: '6'
  113. }, {
  114. name: '期货',
  115. value: '7'
  116. }
  117. ],
  118. notlist:false,
  119. datalist: []
  120. }
  121. },
  122. computed: {
  123. ...mapState(['hasLogin', 'userInfo'])
  124. },
  125. onPullDownRefresh() {
  126. this.getList()
  127. setTimeout(function () {
  128. uni.stopPullDownRefresh(); //关闭下拉刷新
  129. }, 1000);
  130. },
  131. onShow(val) {
  132. this.getList()
  133. uni.hideKeyboard()
  134. uni.getStorage({
  135. key: 'setLocaltion',
  136. success: (res) => {
  137. console.log("setLocaltion",res.data)
  138. this.position = res.data
  139. // uni.removeStorage({
  140. // key: 'setLocaltion'
  141. // })
  142. },
  143. })
  144. },
  145. onLoad(option) {
  146. if (option.position){
  147. this.position = option.position
  148. }
  149. },
  150. methods: {
  151. getList(){
  152. this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
  153. currentPage: 1,
  154. pageSize: 4,
  155. searchKeyWord: this.keyword
  156. })
  157. .then(res => {
  158. if (res.data.code == 200) {
  159. this.releaseInfo = res.data.data.records
  160. }
  161. })
  162. this.getInfo()
  163. },
  164. getInfo(){
  165. uni.showLoading({
  166. title:"正在加载"
  167. })
  168. this.$api.doRequest('get', '/settledCompanyInfo/selectSettledCompanyInfo', {
  169. mainBusinessType: this.mainBusinessType,
  170. pageSize: this.pageSize,
  171. currentPage: this.currentPage,
  172. pcFlag: 2,
  173. searchType: 2
  174. }).then(res => {
  175. if (res.data.code == 200) {
  176. this.datalist = res.data.data.records
  177. console.log(this.position)
  178. let lat2 =this.position.location.split(',')[1];
  179. let lng2 = this.position.location.split(',')[0];
  180. for(var i=0;i<this.datalist.length;i++){
  181. this.datalist[i]._metre=this.utils.getDistance(this.datalist[i].latitude,this.datalist[i].longitude,lat2,lng2)
  182. }
  183. if(this.currentPage==1&&this.datalist.length==0){
  184. this.notlist=true
  185. }else{
  186. this.notlist=false
  187. }
  188. console.log(this.datalist)
  189. // let _metre = this.utils.getDistance(lat1,lng1,lat2,lng2) +"千米"
  190. }
  191. uni.hideLoading()
  192. }).catch(res => {
  193. uni.hideLoading()
  194. })
  195. },
  196. mainBusinessTypechange(item) {
  197. if (item.name != '全部') {
  198. this.mainBusinessType = item.name
  199. } else {
  200. this.mainBusinessType = ''
  201. }
  202. this.getInfo()
  203. this.mainBusinessTypeKey = item.value
  204. },
  205. enterUrl() {
  206. if (!this.hasLogin) {
  207. uni.showModal({
  208. title: '登录提示',
  209. content: '您尚未登录,是否立即登录?',
  210. showCancel: true,
  211. confirmText: '登录',
  212. success: (e) => {
  213. if (e.confirm) {
  214. uni.navigateTo({
  215. url: '/pages/public/login'
  216. })
  217. }
  218. },
  219. fail: () => {},
  220. complete: () => {}
  221. })
  222. }
  223. else{
  224. //入驻
  225. uni.navigateTo({
  226. url: '/pages/grain_pulse/enter'
  227. })
  228. }
  229. },
  230. friendcircle() {
  231. uni.navigateTo({
  232. url: '/pages/grain_pulse/dynamic'
  233. })
  234. },
  235. todetails(item) {
  236. uni.navigateTo({
  237. url: '/pages/grain_pulse/details?id=' + item.id
  238. })
  239. },
  240. naviageToPage(item) {
  241. console.log(item)
  242. uni.navigateTo({
  243. url: item
  244. })
  245. },
  246. naviageToPage1(item,url) {
  247. uni.setStorageSync('location', item)
  248. uni.navigateTo({
  249. url: url
  250. })
  251. }
  252. }
  253. }
  254. </script>
  255. <style scoped>
  256. /* 《--头部 */
  257. .header {
  258. padding: 0 12.5px;
  259. background: #fff;
  260. border-radius: 0 0 10px 10px;
  261. }
  262. /* 头部--》 */
  263. /* 《--定位 */
  264. .location {
  265. width: 30rpx;
  266. height: 30rpx;
  267. margin-right: 2.5px;
  268. }
  269. .locationwrap {
  270. font-size: 16px;
  271. }
  272. /* 定位 --》 */
  273. /* 《--分布 */
  274. .map {
  275. padding: 8.5px 0;
  276. }
  277. .cangku {
  278. width: 16.5px;
  279. height: 16.5px;
  280. margin-right: 5px;
  281. }
  282. .distribution {
  283. background: #F5F6FA;
  284. width: 71.5px;
  285. height: 32px;
  286. border-radius: 15px;
  287. font-size: 12px;
  288. }
  289. /* 分布--》 */
  290. /* 《--搜索 */
  291. .cu-bar .search-form {
  292. background: #F5F6F9;
  293. margin: 0;
  294. margin-bottom: 18px;
  295. padding: 10px 18px;
  296. }
  297. .icon-scarch {
  298. width: 15px;
  299. height: 15px;
  300. margin-right: 5px;
  301. }
  302. /* 搜索--》 */
  303. /* 《--内容 */
  304. .content {
  305. margin-top: 13px;
  306. }
  307. /* 内容--》 */
  308. /* 《--圈友说 */
  309. .friendcircle {
  310. background: #fff;
  311. margin: 0 9px;
  312. border-radius: 4px;
  313. }
  314. .friendcircle .title {
  315. font-size: 16px;
  316. padding: 11.5px 14.5px;
  317. }
  318. .icon-friendcircle {
  319. width: 17px;
  320. height: 17px;
  321. margin-right: 5.5px;
  322. }
  323. .bg {
  324. width: 200rpx;
  325. height: 200rpx;
  326. }
  327. .friendcircle-content {
  328. padding: 0 17px 18px;
  329. }
  330. .friendcircle-content-right {
  331. margin-left: 15.5px;
  332. }
  333. .friendcircle-content-right-item {
  334. background: linear-gradient(90deg, #F5F6FA 0%, #FFFFFF 100%);
  335. border-radius: 15rpx;
  336. margin-bottom: 20rpx;
  337. width: 420rpx;
  338. font-size: 12px;
  339. padding: 3px 0;
  340. }
  341. .headportrait {
  342. width: 22.5px;
  343. height: 22.5px;
  344. margin-right: 8.5px;
  345. border-radius:10px;
  346. }
  347. /* 圈友说--》 */
  348. /* 《--类型 */
  349. .list-type {
  350. background: linear-gradient(180deg, #F5F6FA 0%, #FFFFFF 100%);
  351. width: 100vw;
  352. padding-top: 5px;
  353. height: 49px;
  354. overflow-x: scroll;
  355. white-space: nowrap;
  356. }
  357. .typeitem {
  358. margin: 10px;
  359. position: relative;
  360. display: inline-block;
  361. padding-top: 8px;
  362. padding-bottom: 5px;
  363. }
  364. .typeitem.active {
  365. font-size: 16px;
  366. }
  367. .typeitem.active:after {
  368. content: '';
  369. display: block;
  370. position: absolute;
  371. height: 3px;
  372. bottom: 0;
  373. background: #22C572;
  374. width: 50%;
  375. left: 50%;
  376. transform: translateX(-50%);
  377. }
  378. /* 类型--》 */
  379. /* 《--数据 */
  380. .listitem {
  381. background: #fff;
  382. margin: 10px;
  383. padding: 15px 19px;
  384. }
  385. .listitem-left {
  386. width: 400rpx;
  387. height: 200rpx;
  388. margin-right: 8px;
  389. border-radius: 5px;
  390. }
  391. .companyname {
  392. font-size: 14px;
  393. color: #333;
  394. }
  395. .introduce {
  396. font-size: 12px;
  397. color: #676E80;
  398. }
  399. .companylocation {
  400. color: #676E80;
  401. background: #F5F6FA;
  402. margin-top: 8px;
  403. padding: 4px 10px;
  404. border-radius: 15px;
  405. font-size: 12px;
  406. }
  407. .distance {
  408. color: #AFB3BF;
  409. padding: 4px;
  410. margin-top: 8px;
  411. font-size: 12px;
  412. }
  413. /* 数据--》 */
  414. .enter {
  415. position: fixed;
  416. right: 0;
  417. top: 80%;
  418. width: 56.5px;
  419. height: 28px;
  420. }
  421. .enter-content {
  422. position: absolute;
  423. right: 5px;
  424. top: 50%;
  425. transform: translateY(-50%);
  426. color: #fff;
  427. }
  428. </style>