home.vue 9.1 KB

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