home.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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.$api.doRequest('get', '/settledCompanyInfo/selectSettledCompanyInfo', {
  157. mainBusinessType: this.mainBusinessType,
  158. pageSize: this.pageSize,
  159. currentPage: this.currentPage,
  160. pcFlag: 2
  161. }).then(res => {
  162. if (res.data.code == 200) {
  163. this.datalist = res.data.data.records
  164. console.log(this.position)
  165. let lat2 =this.position.location.split(',')[1];
  166. let lng2 = this.position.location.split(',')[0];
  167. for(var i=0;i<this.datalist.length;i++){
  168. this.datalist[i]._metre=this.utils.getDistance(this.datalist[i].latitude,this.datalist[i].longitude,lat2,lng2)
  169. }
  170. if(this.currentPage==1&&this.datalist.length==0){
  171. this.notlist=true
  172. }else{
  173. this.notlist=false
  174. }
  175. console.log(this.datalist)
  176. // let _metre = this.utils.getDistance(lat1,lng1,lat2,lng2) +"千米"
  177. }
  178. })
  179. },
  180. mainBusinessTypechange(item) {
  181. if (item.name != '全部') {
  182. this.mainBusinessType = item.name
  183. } else {
  184. this.mainBusinessType = ''
  185. }
  186. this.getList()
  187. this.mainBusinessTypeKey = item.value
  188. },
  189. enterUrl() {
  190. //入驻
  191. uni.navigateTo({
  192. url: '/pages/grain_pulse/enter'
  193. })
  194. },
  195. friendcircle() {
  196. uni.navigateTo({
  197. url: '/pages/grain_pulse/dynamic'
  198. })
  199. },
  200. todetails(item) {
  201. uni.navigateTo({
  202. url: '/pages/grain_pulse/details?id=' + item.id
  203. })
  204. },
  205. naviageToPage(item) {
  206. console.log(item)
  207. uni.navigateTo({
  208. url: item
  209. })
  210. },
  211. naviageToPage1(item,url) {
  212. uni.setStorageSync('location', item)
  213. uni.navigateTo({
  214. url: url
  215. })
  216. }
  217. }
  218. }
  219. </script>
  220. <style scoped>
  221. /* 《--头部 */
  222. .header {
  223. padding: 0 12.5px;
  224. background: #fff;
  225. border-radius: 0 0 10px 10px;
  226. }
  227. /* 头部--》 */
  228. /* 《--定位 */
  229. .location {
  230. width: 30rpx;
  231. height: 30rpx;
  232. margin-right: 2.5px;
  233. }
  234. .locationwrap {
  235. font-size: 16px;
  236. }
  237. /* 定位 --》 */
  238. /* 《--分布 */
  239. .map {
  240. padding: 8.5px 0;
  241. }
  242. .cangku {
  243. width: 16.5px;
  244. height: 16.5px;
  245. margin-right: 5px;
  246. }
  247. .distribution {
  248. background: #F5F6FA;
  249. width: 71.5px;
  250. height: 32px;
  251. border-radius: 15px;
  252. font-size: 12px;
  253. }
  254. /* 分布--》 */
  255. /* 《--搜索 */
  256. .cu-bar .search-form {
  257. background: #F5F6F9;
  258. margin: 0;
  259. margin-bottom: 18px;
  260. padding: 10px 18px;
  261. }
  262. .icon-scarch {
  263. width: 15px;
  264. height: 15px;
  265. margin-right: 5px;
  266. }
  267. /* 搜索--》 */
  268. /* 《--内容 */
  269. .content {
  270. margin-top: 13px;
  271. }
  272. /* 内容--》 */
  273. /* 《--圈友说 */
  274. .friendcircle {
  275. background: #fff;
  276. margin: 0 9px;
  277. border-radius: 4px;
  278. }
  279. .friendcircle .title {
  280. font-size: 16px;
  281. padding: 11.5px 14.5px;
  282. }
  283. .icon-friendcircle {
  284. width: 17px;
  285. height: 17px;
  286. margin-right: 5.5px;
  287. }
  288. .bg {
  289. width: 200rpx;
  290. height: 200rpx;
  291. }
  292. .friendcircle-content {
  293. padding: 0 17px 18px;
  294. }
  295. .friendcircle-content-right {
  296. margin-left: 15.5px;
  297. }
  298. .friendcircle-content-right-item {
  299. background: linear-gradient(90deg, #F5F6FA 0%, #FFFFFF 100%);
  300. border-radius: 15rpx;
  301. margin-bottom: 20rpx;
  302. width: 420rpx;
  303. font-size: 12px;
  304. padding: 3px 0;
  305. }
  306. .headportrait {
  307. width: 22.5px;
  308. height: 22.5px;
  309. margin-right: 8.5px;
  310. border-radius:10px;
  311. }
  312. /* 圈友说--》 */
  313. /* 《--类型 */
  314. .list-type {
  315. background: linear-gradient(180deg, #F5F6FA 0%, #FFFFFF 100%);
  316. width: 100vw;
  317. padding-top: 5px;
  318. height: 49px;
  319. overflow-x: scroll;
  320. white-space: nowrap;
  321. }
  322. .typeitem {
  323. margin: 10px;
  324. position: relative;
  325. display: inline-block;
  326. padding-top: 8px;
  327. padding-bottom: 5px;
  328. }
  329. .typeitem.active {
  330. font-size: 16px;
  331. }
  332. .typeitem.active:after {
  333. content: '';
  334. display: block;
  335. position: absolute;
  336. height: 3px;
  337. bottom: 0;
  338. background: #22C572;
  339. width: 50%;
  340. left: 50%;
  341. transform: translateX(-50%);
  342. }
  343. /* 类型--》 */
  344. /* 《--数据 */
  345. .listitem {
  346. background: #fff;
  347. margin: 10px;
  348. padding: 15px 19px;
  349. }
  350. .listitem-left {
  351. width: 400rpx;
  352. height: 200rpx;
  353. margin-right: 8px;
  354. border-radius: 5px;
  355. }
  356. .companyname {
  357. font-size: 14px;
  358. color: #333;
  359. }
  360. .introduce {
  361. font-size: 12px;
  362. color: #676E80;
  363. }
  364. .companylocation {
  365. color: #676E80;
  366. background: #F5F6FA;
  367. margin-top: 8px;
  368. padding: 4px 10px;
  369. border-radius: 15px;
  370. font-size: 12px;
  371. }
  372. .distance {
  373. color: #AFB3BF;
  374. padding: 4px;
  375. margin-top: 8px;
  376. font-size: 12px;
  377. }
  378. /* 数据--》 */
  379. .enter {
  380. position: fixed;
  381. right: 0;
  382. top: 80%;
  383. width: 56.5px;
  384. height: 28px;
  385. }
  386. .enter-content {
  387. position: absolute;
  388. right: 5px;
  389. top: 50%;
  390. transform: translateY(-50%);
  391. color: #fff;
  392. }
  393. </style>