home.vue 9.9 KB

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