home.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  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 class='friendcircle-content-right-item Regular flex align-item-center'>
  33. <image class='headportrait' src="../../static/img/add@3x.png" mode=""></image>中天昊元粮库中天昊元…
  34. </view>
  35. <view class='friendcircle-content-right-item Regular flex align-item-center'>
  36. <image class='headportrait' src="../../static/img/add@3x.png" mode=""></image>中天昊元粮库中天昊元…
  37. </view>
  38. <view class='friendcircle-content-right-item Regular flex align-item-center'>
  39. <image class='headportrait' src="../../static/img/add@3x.png" mode=""></image>中天昊元粮库中天昊元…
  40. </view>
  41. <view class='friendcircle-content-right-item Regular flex align-item-center'>
  42. <image class='headportrait' src="../../static/img/add@3x.png" mode=""></image>中天昊元粮库中天昊元…
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <scroll-view scroll-x="true" scroll-with-animation="true" class='list-type'>
  48. <view v-for='item in searchTypes' @click='mainBusinessTypecahnge(item)'
  49. :class='mainBusinessTypeKey==item.value?"Semibold active":"Regular"' class="typeitem">{{item.name}}
  50. </view>
  51. </scroll-view>
  52. <view v-for='item in datalist' @click='todetails(item)' class="listitem">
  53. <view class="flex">
  54. <image class='listitem-left' :src="item.attachmentAddress" mode=""></image>
  55. <view class="listitem-right">
  56. <view class="companyname Medium">{{item.compName}}</view>
  57. <view class='Regular introduce'>{{item.companyProfile}}</view>
  58. </view>
  59. </view>
  60. <view class="flex align-item-center justify-between">
  61. <view @click.stop='naviageToPage("/pages/grain_pulse/localtion/localtion")'
  62. class='companylocation flex align-item-center Regular'>
  63. <image class='location' src="../../static/img/liangmai/icon_ditu.png" mode=""></image>
  64. {{item.province}}{{item.city}}{{item.area}}{{item.detailedAddress}}
  65. </view>
  66. <view v-if='position.name!="未设置"' class='distance Regular'>{{item._metre}}</view>
  67. </view>
  68. </view>
  69. </view>
  70. <view v-if='datalist.length==0' class="enter" @click="enter">
  71. <image style='width:56.5px;height:28px;' src="../../static/img/liangmai/ruzhu.png" mode=""></image>
  72. <view class='enter-content'>入驻</view>
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. export default {
  78. components: {
  79. },
  80. data() {
  81. return {
  82. position:{
  83. name:"未设置"
  84. } ,
  85. status: 0,
  86. mainBusinessType: '',
  87. mainBusinessTypeKey: '0',
  88. pageSize: 10,
  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. datalist: []
  119. }
  120. },
  121. onShow(val) {
  122. this.$api.doRequest('get', '/settledCompanyInfo/selectSettledCompanyInfo', {
  123. mainBusinessType: this.mainBusinessType,
  124. pageSize: this.pageSize,
  125. currentPage: this.currentPage,
  126. pcFlag: 2
  127. }).then(res => {
  128. if (res.data.code == 200) {
  129. this.datalist = res.data.data.records
  130. console.log(this.position)
  131. let lat2 =this.position.location.split(',')[1];
  132. let lng2 = this.position.location.split(',')[0];
  133. for(var i=0;i<this.datalist.length;i++){
  134. this.datalist[i]._metre=this.utils.getDistance(this.datalist[i].latitude,this.datalist[i].longitude,lat2,lng2)
  135. }
  136. console.log(this.datalist)
  137. // let _metre = this.utils.getDistance(lat1,lng1,lat2,lng2) +"千米"
  138. }
  139. })
  140. uni.getStorage({
  141. key: 'setLocaltion',
  142. success: (res) => {
  143. console.log(res.data)
  144. this.position = res.data
  145. // uni.removeStorage({
  146. // key: 'setLocaltion'
  147. // })
  148. },
  149. })
  150. },
  151. onLoad(option) {
  152. if (option.position){
  153. this.position = option.position
  154. }
  155. },
  156. methods: {
  157. mainBusinessTypecahnge(item) {
  158. if (item.name != '全部') {
  159. this.mainBusinessType = item.name
  160. } else {
  161. this.mainBusinessType = ''
  162. }
  163. this.mainBusinessTypeKey = item.value
  164. },
  165. enter() {
  166. //入驻
  167. uni.navigateTo({
  168. url: '/pages/grain_pulse/enter'
  169. })
  170. },
  171. friendcircle() {
  172. uni.navigateTo({
  173. url: '/pages/grain_pulse/dynamic'
  174. })
  175. },
  176. todetails(item) {
  177. uni.navigateTo({
  178. url: '/pages/grain_pulse/details?id=' + item.id
  179. })
  180. },
  181. naviageToPage(item) {
  182. console.log(item)
  183. uni.navigateTo({
  184. url: item
  185. })
  186. }
  187. }
  188. }
  189. </script>
  190. <style scoped>
  191. /* 《--头部 */
  192. .header {
  193. padding: 0 12.5px;
  194. background: #fff;
  195. border-radius: 0 0 10px 10px;
  196. }
  197. /* 头部--》 */
  198. /* 《--定位 */
  199. .location {
  200. width: 15.5px;
  201. height: 17.5px;
  202. margin-right: 2.5px;
  203. }
  204. .locationwrap {
  205. font-size: 16px;
  206. }
  207. /* 定位 --》 */
  208. /* 《--分布 */
  209. .map {
  210. padding: 8.5px 0;
  211. }
  212. .cangku {
  213. width: 16.5px;
  214. height: 16.5px;
  215. margin-right: 5px;
  216. }
  217. .distribution {
  218. background: #F5F6FA;
  219. width: 71.5px;
  220. height: 32px;
  221. border-radius: 15px;
  222. font-size: 12px;
  223. }
  224. /* 分布--》 */
  225. /* 《--搜索 */
  226. .cu-bar .search-form {
  227. background: #F5F6F9;
  228. margin: 0;
  229. margin-bottom: 18px;
  230. padding: 10px 18px;
  231. }
  232. .icon-scarch {
  233. width: 15px;
  234. height: 15px;
  235. margin-right: 5px;
  236. }
  237. /* 搜索--》 */
  238. /* 《--内容 */
  239. .content {
  240. margin-top: 13px;
  241. }
  242. /* 内容--》 */
  243. /* 《--圈友说 */
  244. .friendcircle {
  245. background: #fff;
  246. margin: 0 9px;
  247. border-radius: 4px;
  248. }
  249. .friendcircle .title {
  250. font-size: 16px;
  251. padding: 11.5px 14.5px;
  252. }
  253. .icon-friendcircle {
  254. width: 17px;
  255. height: 17px;
  256. margin-right: 5.5px;
  257. }
  258. .bg {
  259. width: 110px;
  260. height: 124px;
  261. }
  262. .friendcircle-content {
  263. padding: 0 17px 18px;
  264. }
  265. .friendcircle-content-right {
  266. margin-left: 15.5px;
  267. }
  268. .friendcircle-content-right-item {
  269. background: linear-gradient(90deg, #F5F6FA 0%, #FFFFFF 100%);
  270. border-radius: 12.5px;
  271. margin-bottom: 10px;
  272. width: 205.5px;
  273. font-size: 12px;
  274. padding: 3px 0;
  275. }
  276. .headportrait {
  277. width: 22.5px;
  278. height: 22.5px;
  279. margin-right: 8.5px;
  280. }
  281. /* 圈友说--》 */
  282. /* 《--类型 */
  283. .list-type {
  284. background: linear-gradient(180deg, #F5F6FA 0%, #FFFFFF 100%);
  285. width: 100vw;
  286. padding-top: 5px;
  287. height: 49px;
  288. overflow-x: scroll;
  289. white-space: nowrap;
  290. }
  291. .typeitem {
  292. margin: 10px;
  293. position: relative;
  294. display: inline-block;
  295. padding-top: 8px;
  296. padding-bottom: 5px;
  297. }
  298. .typeitem.active {
  299. font-size: 16px;
  300. }
  301. .typeitem.active:after {
  302. content: '';
  303. display: block;
  304. position: absolute;
  305. height: 3px;
  306. bottom: 0;
  307. background: #22C572;
  308. width: 50%;
  309. left: 50%;
  310. transform: translateX(-50%);
  311. }
  312. /* 类型--》 */
  313. /* 《--数据 */
  314. .listitem {
  315. background: #fff;
  316. margin: 10px;
  317. padding: 15px 19px;
  318. }
  319. .listitem-left {
  320. width: 98.5px;
  321. height: 96.5px;
  322. margin-right: 8px;
  323. border-radius: 5px;
  324. }
  325. .companyname {
  326. font-size: 14px;
  327. color: #333;
  328. }
  329. .introduce {
  330. font-size: 12px;
  331. color: #676E80;
  332. }
  333. .companylocation {
  334. color: #676E80;
  335. background: #F5F6FA;
  336. margin-top: 8px;
  337. padding: 4px 10px;
  338. border-radius: 15px;
  339. }
  340. .distance {
  341. color: #AFB3BF;
  342. padding: 4px;
  343. margin-top: 8px;
  344. }
  345. /* 数据--》 */
  346. .enter {
  347. position: fixed;
  348. right: 0;
  349. top: 80%;
  350. width: 56.5px;
  351. height: 28px;
  352. }
  353. .enter-content {
  354. position: absolute;
  355. right: 5px;
  356. top: 50%;
  357. transform: translateY(-50%);
  358. color: #fff;
  359. }
  360. </style>