home3.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212
  1. <template>
  2. <view class="container">
  3. <view class="header2" :style="{ height: customBarH * 2 + 'rpx', paddingTop: statusBarH * 2 + 'rpx' }" v-if="headerType">
  4. <view class="title">靖安乡村民宿</view>
  5. </view>
  6. <!-- 顶部图片区域 -->
  7. <view class="header">
  8. <img mode="aspectFill" src="https://chtech.ncjti.edu.cn/hotelReservation/image/14.png" />
  9. <img class="img" src="https://chtech.ncjti.edu.cn/hotelReservation/image/16.png" />
  10. <img class="img2" src="https://chtech.ncjti.edu.cn/hotelReservation/image/17.png" />
  11. <view class="header_msg">有一种生活叫靖安</view>
  12. </view>
  13. <view class="content">
  14. <!-- 条件筛选区域 -->
  15. <view class="search">
  16. <!-- 选择乡镇区域 -->
  17. <view class="search_town" :class="{ active: town }" @click="handleOpen">
  18. {{ town ? town : '请选择乡镇' }}
  19. <img src="../../static/index/right2.png" />
  20. </view>
  21. <!-- 关键词搜索和民宿级别区域 -->
  22. <view class="search_center">
  23. <view class="center_input">
  24. <input type="text" v-model="keywords" placeholder="民宿/地名/关键词" placeholder-style="color:#A6A6A6;font-weight:400;" />
  25. </view>
  26. <img class="img" src="../../static/index/right2.png" />
  27. |
  28. <view class="center_level" :class="{ active: level }" @click="handleChooseLv">{{ level ? level : '请选择民宿级别' }}</view>
  29. <img class="img2" src="../../static/index/right2.png" @click="handleChooseLv" />
  30. </view>
  31. <!-- 查找按钮区域 -->
  32. <view class="search_btn" @click="handleSearch">查找</view>
  33. </view>
  34. <!-- 图标列表区域 -->
  35. <!-- <view class="icons">
  36. <view class="icon_item" @click="handleTest">
  37. <view class="item_top color">
  38. <img src="../../static/index/icon.png" />
  39. </view>
  40. <view class="item_bottom">推文</view>
  41. </view>
  42. <view class="icon_item" @click="handleTest">
  43. <view class="item_top color2">
  44. <img class="img2" src="../../static/index/icon2.png" />
  45. </view>
  46. <view class="item_bottom">周边</view>
  47. </view>
  48. <view class="icon_item" @click="handleGoSetMeal">
  49. <view class="item_top color3">
  50. <img class="img3" src="../../static/index/icon3.png" />
  51. </view>
  52. <view class="item_bottom">套餐</view>
  53. </view>
  54. <view class="icon_item" @click="handleTest">
  55. <view class="item_top color4">
  56. <img src="../../static/index/icon4.png" />
  57. </view>
  58. <view class="item_bottom">招商</view>
  59. </view>
  60. <view class="icon_item" @click="handleTest">
  61. <view class="item_top color5">
  62. <img src="../../static/index/icon5.png" />
  63. </view>
  64. <view class="item_bottom">其他</view>
  65. </view>
  66. </view> -->
  67. <!-- 轮播图区域 -->
  68. <swiper class="swiper" indicator-dots circular indicator-color="#BBD8FE" indicator-active-color="#1E7DFB" autoplay interval="3000" v-if="townList.length">
  69. <swiper-item v-for="(ele, index) in townList" :key="index">
  70. <view class="swiper_item">
  71. <view class="item_box" v-for="(swi, index2) in ele" :key="index2" @click="handleChooseTown2(swi.name)">
  72. <img v-if="index === 0 && index2 === 0" src="https://chtech.ncjti.edu.cn/hotelReservation/image/1.png" mode="aspectFill" />
  73. <img v-if="index === 0 && index2 === 1" src="https://chtech.ncjti.edu.cn/hotelReservation/image/2.png" mode="aspectFill" />
  74. <img v-if="index === 0 && index2 === 2" src="https://chtech.ncjti.edu.cn/hotelReservation/image/3.png" mode="aspectFill" />
  75. <img v-if="index === 1 && index2 === 0" src="https://chtech.ncjti.edu.cn/hotelReservation/image/4.png" mode="aspectFill" />
  76. <img v-if="index === 1 && index2 === 1" src="https://chtech.ncjti.edu.cn/hotelReservation/image/5.png" mode="aspectFill" />
  77. <img v-if="index === 1 && index2 === 2" src="https://chtech.ncjti.edu.cn/hotelReservation/image/6.png" mode="aspectFill" />
  78. <img v-if="index === 2 && index2 === 0" src="https://chtech.ncjti.edu.cn/hotelReservation/image/7.png" mode="aspectFill" />
  79. <img v-if="index === 2 && index2 === 1" src="https://chtech.ncjti.edu.cn/hotelReservation/image/8.png" mode="aspectFill" />
  80. <img v-if="index === 2 && index2 === 2" src="https://chtech.ncjti.edu.cn/hotelReservation/image/9.png" mode="aspectFill" />
  81. <img v-if="index === 3 && index2 === 0" src="https://chtech.ncjti.edu.cn/hotelReservation/image/10.png" mode="aspectFill" />
  82. <img v-if="index === 3 && index2 === 1" src="https://chtech.ncjti.edu.cn/hotelReservation/image/11.png" mode="aspectFill" />
  83. <img v-if="index === 3 && index2 === 2" src="https://chtech.ncjti.edu.cn/hotelReservation/image/12.png" mode="aspectFill" />
  84. <view class="box_town">{{ swi.name }}</view>
  85. <view class="box_count">剩{{ swi.residueNumber }}间</view>
  86. </view>
  87. </view>
  88. </swiper-item>
  89. </swiper>
  90. <view class="body">
  91. <!-- 精选攻略区域 -->
  92. <view class="body_top" v-if="bestNewsInfo">
  93. <view class="circle"></view>
  94. <view class="circle color"></view>
  95. <view class="top_title">精选攻略 .</view>
  96. <view class="top_msg">宝藏分享社区</view>
  97. <view class="top_more" @click="handleGoPage">
  98. 更多
  99. <img src="https://chtech.ncjti.edu.cn/hotelReservation/image/13.png" />
  100. </view>
  101. </view>
  102. <view v-if="bestNewsInfo" class="body_strategy" @click="handleGoDetail(bestNewsInfo)">
  103. <img v-if="bestNewsInfo.image" class="strategy_cover" mode="aspectfill" :src="bestNewsInfo.image" />
  104. <video
  105. v-if="bestNewsInfo.video"
  106. class="strategy_cover"
  107. :src="bestNewsInfo.video"
  108. :show-center-play-btn="false"
  109. :show-fullscreen-btn="false"
  110. :show-play-btn="false"
  111. ></video>
  112. <view class="strategy_info">
  113. <view class="info_title">{{ bestNewsInfo.title }}</view>
  114. <view class="info_tags">
  115. <view class="tag">{{ bestNewsInfo.townName }}</view>
  116. </view>
  117. <view class="info_desc">
  118. {{ bestNewsInfo.content }}
  119. </view>
  120. </view>
  121. </view>
  122. <!-- 招商资讯区域 -->
  123. <view class="body_top">
  124. <view class="circle"></view>
  125. <view class="circle color"></view>
  126. <view class="top_title">招商资讯 .</view>
  127. <view class="top_msg">以招商引资,推动镇域经济</view>
  128. <view class="top_more" @click="handleGoNewsList">
  129. 更多
  130. <img src="https://chtech.ncjti.edu.cn/hotelReservation/image/13.png" />
  131. </view>
  132. </view>
  133. <view v-for="item in newsList" :key="item.id" class="body_strategy" @click="handleGoNews(item)">
  134. <uv-image width="253rpx" height="190rpx" radius="8rpx" mode="aspectFill" :src="item.url" />
  135. <view class="strategy_info">
  136. <view class="info_title2">{{ item.title ? item.title : '无标题' }}</view>
  137. <view class="info_desc">
  138. {{ item.desc }}
  139. </view>
  140. <mp-html v-if="item.showHtml" @load="htmlLoad(item)" :ref="item.id + 'html'" :content="item.content" />
  141. </view>
  142. </view>
  143. <!-- 精选推荐区域 -->
  144. <view class="body_top">
  145. <view class="circle"></view>
  146. <view class="circle color"></view>
  147. <view class="top_title">精选推荐 .</view>
  148. <view class="top_msg">线上订民宿,住着玩个遍</view>
  149. <view class="top_more" @click="handleGoHome">
  150. 更多
  151. <img src="https://chtech.ncjti.edu.cn/hotelReservation/image/13.png" />
  152. </view>
  153. </view>
  154. <view class="body_list">
  155. <!-- 每一个民宿区域 -->
  156. <view class="list_item" v-for="item in hotelList" :key="item.id" @click="goPageDetail(item)">
  157. <image class="item-img" :src="item.coverImg" mode="scaleToFill"></image>
  158. <view class="descrition">
  159. <text class="title">{{ item.hotel_name }}</text>
  160. <text class="type">{{ item.hTypeName }}</text>
  161. <text class="distance" v-if="showdDistance">距您直线{{ item.distance }}公里</text>
  162. <view class="detail">
  163. <img class="img" src="../../static/index/hotel.png" />
  164. <view class="price">
  165. <text class="txt1">¥{{ item.min_price }}</text>
  166. <text class="txt2">起</text>
  167. </view>
  168. </view>
  169. </view>
  170. </view>
  171. </view>
  172. <!-- 没有数据时展示的页面 -->
  173. <view class="noData" v-if="!hotelList.length">
  174. <img src="../../static/images/noData.png" />
  175. 暂无推荐数据
  176. </view>
  177. </view>
  178. </view>
  179. <!-- 选择乡镇弹窗区域 -->
  180. <uni-popup ref="popup" type="center">
  181. <view class="popup_body">
  182. <view class="body_header">
  183. <img src="../../static/my/popup_title.png" />
  184. <view class="header_title">请选择乡镇</view>
  185. <img src="../../static/my/popup_title.png" />
  186. </view>
  187. <view class="body_content">
  188. <view class="content_box" v-for="(item, index) in popList" :key="index" @click="handleChooseTown(item.name)">
  189. <img v-if="index === 0" src="https://chtech.ncjti.edu.cn/hotelReservation/image/1.png" mode="aspectFill" />
  190. <img v-if="index === 1" src="https://chtech.ncjti.edu.cn/hotelReservation/image/2.png" mode="aspectFill" />
  191. <img v-if="index === 2" src="https://chtech.ncjti.edu.cn/hotelReservation/image/3.png" mode="aspectFill" />
  192. <img v-if="index === 3" src="https://chtech.ncjti.edu.cn/hotelReservation/image/4.png" mode="aspectFill" />
  193. <img v-if="index === 4" src="https://chtech.ncjti.edu.cn/hotelReservation/image/5.png" mode="aspectFill" />
  194. <img v-if="index === 5" src="https://chtech.ncjti.edu.cn/hotelReservation/image/6.png" mode="aspectFill" />
  195. <img v-if="index === 6" src="https://chtech.ncjti.edu.cn/hotelReservation/image/7.png" mode="aspectFill" />
  196. <img v-if="index === 7" src="https://chtech.ncjti.edu.cn/hotelReservation/image/8.png" mode="aspectFill" />
  197. <img v-if="index === 8" src="https://chtech.ncjti.edu.cn/hotelReservation/image/9.png" mode="aspectFill" />
  198. <img v-if="index === 9" src="https://chtech.ncjti.edu.cn/hotelReservation/image/10.png" mode="aspectFill" />
  199. <img v-if="index === 10" src="https://chtech.ncjti.edu.cn/hotelReservation/image/11.png" mode="aspectFill" />
  200. <img v-if="index === 11" src="https://chtech.ncjti.edu.cn/hotelReservation/image/12.png" mode="aspectFill" />
  201. <view class="box_town">{{ item.name }}</view>
  202. <view class="box_count">剩{{ item.residueNumber }}间</view>
  203. </view>
  204. </view>
  205. </view>
  206. </uni-popup>
  207. <!-- 公告弹窗区域 -->
  208. <uv-popup ref="popup_sale" mode="center" :closeOnClickOverlay="false" bgColor="none">
  209. <view class="popupClass">
  210. <img src="../../static/index/popup_bg.png" />
  211. <!-- 立即前往区域 -->
  212. <!-- <view class="btn_go" @click="handleGo"></view> -->
  213. <view class="btn_text">系统处于迭代试用状态,请勿下单预订酒店,如需预订请电联店家老板确认预订渠道。</view>
  214. <!-- 关闭按钮区域 -->
  215. <view class="btn_close" @click="handleClose"></view>
  216. </view>
  217. </uv-popup>
  218. </view>
  219. </template>
  220. <script>
  221. export default {
  222. data() {
  223. return {
  224. // 用户定位经度
  225. myLng: 0,
  226. // 用户定位纬度
  227. myLat: 0,
  228. // 是否显示距离差
  229. showdDistance: false,
  230. // 搜索框绑定数据
  231. keywords: '',
  232. // 当前页
  233. page: 1,
  234. // 每页多少条
  235. rows: 6,
  236. // 总条数
  237. total: null,
  238. // 地区数组
  239. placeList: [
  240. {
  241. name: '靖安县'
  242. }
  243. ],
  244. // 当前选择地区索引
  245. placeIndex: 0,
  246. // 选择乡镇弹窗数据
  247. popList: [],
  248. // 民宿列表数组
  249. hotelList: [],
  250. // 当前乡镇
  251. town: '',
  252. // 民宿级别
  253. level: '',
  254. // 乡镇列表
  255. townList: [],
  256. // 顶部导航栏显示隐藏控制
  257. headerType: false,
  258. // 状态栏高度
  259. statusBarH: 0,
  260. // 胶囊按钮栏高度
  261. customBarH: 0,
  262. // 招商资讯列表
  263. newsList: [],
  264. // 精选攻略数据
  265. bestNewsInfo: null
  266. }
  267. },
  268. created() {
  269. // 获取系统信息
  270. uni.getSystemInfo({
  271. success: (e) => {
  272. // 获取状态栏高度
  273. this.statusBarH = e.statusBarHeight + 10
  274. // // 获取菜单按钮栏高度
  275. let custom = uni.getMenuButtonBoundingClientRect()
  276. this.customBarH = custom.height + 10
  277. }
  278. })
  279. },
  280. mounted() {
  281. // 开启转发功能
  282. uni.showShareMenu({
  283. withShareTicket: true,
  284. menus: ['shareAppMessage', 'shareTimeline']
  285. })
  286. },
  287. onReachBottom() {
  288. if (this.hotelList.length < this.total) {
  289. this.page++
  290. this.getHotelList()
  291. } else {
  292. uni.showToast({
  293. title: '没有更多数据了',
  294. icon: 'none'
  295. })
  296. }
  297. },
  298. onPageScroll(e) {
  299. if (e.scrollTop > 100) {
  300. this.headerType = true
  301. } else {
  302. this.headerType = false
  303. }
  304. },
  305. onPullDownRefresh() {
  306. this.hotelList = []
  307. this.page = 1
  308. this.getLocation()
  309. this.getResidueCount()
  310. setTimeout(() => {
  311. uni.stopPullDownRefresh()
  312. }, 1000)
  313. },
  314. onLoad() {
  315. // 获取乡镇列表
  316. this.getResidueCount()
  317. // 获取精选攻略
  318. this.getBestNews()
  319. // 获取招商资讯列表
  320. this.getNews()
  321. // 获取定位
  322. this.getLocation()
  323. },
  324. methods: {
  325. async getBestNews() {
  326. const res = await this.$myRequest({
  327. url: '/mhotel/articlequeryMaxArticleLike.action'
  328. })
  329. // console.log(res)
  330. if (res.code == 200) {
  331. this.bestNewsInfo = res.data
  332. }
  333. },
  334. async getNews() {
  335. const res = await this.$myRequest({
  336. url: '/mhotel/appnewlist.action',
  337. data: {
  338. page: 1,
  339. rows: 2
  340. }
  341. })
  342. // console.log(res)
  343. if (res.code === 200) {
  344. this.newsList = res.rows
  345. this.newsList.forEach((ele) => {
  346. this.$set(ele, 'showHtml', true)
  347. })
  348. }
  349. },
  350. // 获取用户当前位置
  351. getLocation() {
  352. uni.getSetting({
  353. success: (res) => {
  354. if (!res.authSetting['scope.userLocation']) {
  355. uni.authorize({
  356. scope: 'scope.userLocation',
  357. success: (res) => {
  358. // 授权成功
  359. uni.getLocation({
  360. type: 'gcj02',
  361. success: (res) => {
  362. this.myLat = res.latitude
  363. this.myLng = res.longitude
  364. this.showdDistance = true
  365. this.getHotelList()
  366. }
  367. })
  368. },
  369. fail: () => {
  370. uni.showModal({
  371. content: '获取定位权限失败将会影响使用部分功能,是否去设置打开?',
  372. confirmText: '确认',
  373. cancelText: '取消',
  374. success: (res) => {
  375. if (res.confirm) {
  376. uni.openSetting({
  377. success: (res) => {
  378. console.log(res)
  379. this.getLocation()
  380. }
  381. })
  382. } else {
  383. this.showdDistance = false
  384. this.getHotelList()
  385. uni.showToast({
  386. title: '获取定位权限失败',
  387. icon: 'none'
  388. })
  389. }
  390. }
  391. })
  392. }
  393. })
  394. } else {
  395. uni.getLocation({
  396. type: 'gcj02',
  397. success: (res) => {
  398. this.myLat = res.latitude
  399. this.myLng = res.longitude
  400. this.showdDistance = true
  401. this.getHotelList()
  402. }
  403. })
  404. }
  405. },
  406. fail: () => {
  407. uni.showToast({
  408. title: '获取用户设置权限失败',
  409. icon: 'none',
  410. mask: true
  411. })
  412. }
  413. })
  414. },
  415. handleGoDetail(info) {
  416. let openid = uni.getStorageSync('openid')
  417. if (openid) {
  418. uni.navigateTo({
  419. url: `/pages/tweetDetail/tweetDetail?id=${info.id}&townId=${info.townId}`
  420. })
  421. } else {
  422. uni.showToast({
  423. title: '请先登录',
  424. icon: 'none',
  425. mask: true
  426. })
  427. setTimeout(() => {
  428. uni.navigateTo({
  429. url: '/pages/login/login'
  430. })
  431. }, 1500)
  432. }
  433. },
  434. // 获取民宿列表
  435. async getHotelList() {
  436. const res = await this.$myRequest({
  437. url: '/mhotel/ahphomePage.action',
  438. data: {
  439. // queryValue: this.keywords,
  440. page: this.page,
  441. rows: this.rows,
  442. type: 3,
  443. // hotel_township: this.placeList[this.placeIndex].id || '',
  444. userId: uni.getStorageSync('userInfo') ? uni.getStorageSync('userInfo').id : ''
  445. }
  446. })
  447. // console.log(res)
  448. if (res.code === 200) {
  449. this.hotelList = [...this.hotelList, ...res.data.pageList]
  450. this.total = res.data.total
  451. // 如果定位成功则获取和民宿之间的距离
  452. if (this.showdDistance && this.hotelList.length) {
  453. this.hotelList.forEach((ele) => {
  454. let lat = ele.hpositionWens.split(',')[0]
  455. let lng = ele.hpositionWens.split(',')[1]
  456. ele.distance = this.calculateDistance(lat, lng)
  457. })
  458. }
  459. this.$refs.popup_sale.open()
  460. }
  461. },
  462. handleOpen() {
  463. this.$refs.popup.open()
  464. },
  465. // 获取乡镇
  466. async getResidueCount() {
  467. const res = await this.$myRequest({
  468. url: '/mhotel/ahpgetResidueCount.action'
  469. })
  470. // console.log(res)
  471. if (res.code === 200) {
  472. let temNum = 0
  473. res.data.forEach((ele) => {
  474. temNum += ele.residueNumber
  475. })
  476. res.data.unshift({
  477. name: '靖安县',
  478. residueNumber: temNum
  479. })
  480. this.popList = res.data
  481. this.townList = this.changeList(this.popList, 3)
  482. }
  483. },
  484. // 变成二维数组
  485. changeList(arr, num) {
  486. let newArr = []
  487. const total = Math.ceil(arr.length / num)
  488. for (let i = 0; i < total; i++) {
  489. let a = arr.slice(i * num, (i + 1) * num)
  490. newArr.push(a)
  491. }
  492. return newArr
  493. },
  494. // 弹窗点击选择乡镇地址回调
  495. handleChooseTown(name) {
  496. this.town = name
  497. this.$refs.popup.close()
  498. },
  499. handleChooseTown2(name) {
  500. // this.town = name
  501. uni.navigateTo({
  502. url: `/pages/home/home?town=${name}&keywords=${this.keywords}&level=${this.level}`
  503. })
  504. },
  505. handleChooseLv() {
  506. uni.showActionSheet({
  507. itemList: ['白金', '金宿', '银宿'],
  508. success: (res) => {
  509. if (res.tapIndex === 0) {
  510. this.level = '白金'
  511. } else if (res.tapIndex === 1) {
  512. this.level = '金宿'
  513. } else if (res.tapIndex === 2) {
  514. this.level = '银宿'
  515. }
  516. }
  517. })
  518. },
  519. handleSearch() {
  520. uni.navigateTo({
  521. url: `/pages/home/home?town=${this.town}&keywords=${this.keywords}&level=${this.level}`
  522. })
  523. },
  524. handleGoSetMeal() {
  525. uni.navigateTo({
  526. url: '/pages/setMeal/setMeal'
  527. })
  528. },
  529. goPageDetail(item) {
  530. uni.navigateTo({
  531. url: `/pages/detail/detail?id=${item.id}&distance=${item.distance}`
  532. })
  533. },
  534. // 弹窗关闭按钮回调
  535. handleClose() {
  536. this.$refs.popup_sale.close()
  537. },
  538. // 立即前往按钮回调
  539. handleGo() {
  540. console.log(111)
  541. },
  542. // 计算两个点之间的距离
  543. calculateDistance(lat, lng) {
  544. let centerLat = lat
  545. let centerLng = lng
  546. let red1 = (this.myLat * Math.PI) / 180.0
  547. let red2 = (centerLat * Math.PI) / 180.0
  548. let a = red1 - red2
  549. let b = (this.myLng * Math.PI) / 180.0 - (centerLng * Math.PI) / 180.0
  550. let R = 6378137
  551. let distance = R * 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(red1) * Math.cos(red2) * Math.pow(Math.sin(b / 2), 2)))
  552. let res = (distance / 1000).toFixed(2) * 1
  553. return res
  554. },
  555. handleGoPage() {
  556. uni.switchTab({
  557. url: '/pages/community/community'
  558. })
  559. },
  560. handleGoNews(item) {
  561. let info = encodeURIComponent(JSON.stringify(item))
  562. uni.navigateTo({
  563. url: `/pages/newsDetail/newsDetail?info=${info}`
  564. })
  565. },
  566. handleGoNewsList() {
  567. uni.navigateTo({
  568. url: '/pages/newsList/newsList'
  569. })
  570. },
  571. htmlLoad(item) {
  572. let id = item.id + 'html'
  573. let ctx = this.$refs[id][0]
  574. let text = ctx.getText()
  575. let imgs = ctx.imgList[0]
  576. item.showHtml = false
  577. item.desc = text
  578. item.url = imgs
  579. },
  580. handleGoHome() {
  581. uni.navigateTo({
  582. url: '/pages/home/home'
  583. })
  584. },
  585. handleTest() {
  586. uni.showToast({
  587. title: '功能开发中',
  588. icon: 'none',
  589. mask: true
  590. })
  591. }
  592. }
  593. }
  594. </script>
  595. <style lang="scss" scoped>
  596. .container {
  597. display: flex;
  598. flex-direction: column;
  599. min-height: 100vh;
  600. overflow-y: auto;
  601. background-color: #f2f2f2;
  602. .header {
  603. position: relative;
  604. height: 505rpx;
  605. img {
  606. width: 100%;
  607. height: 100%;
  608. border-radius: 0 0 20rpx 20rpx;
  609. }
  610. .img {
  611. position: absolute;
  612. top: 135rpx;
  613. left: 61rpx;
  614. width: 160rpx;
  615. height: 40rpx;
  616. }
  617. .img2 {
  618. position: absolute;
  619. top: 193rpx;
  620. left: 38rpx;
  621. width: 268rpx;
  622. height: 88rpx;
  623. }
  624. .header_msg {
  625. position: absolute;
  626. top: 283rpx;
  627. left: 38rpx;
  628. display: flex;
  629. justify-content: center;
  630. align-items: center;
  631. width: 291rpx;
  632. height: 65rpx;
  633. font-size: 31rpx;
  634. color: #fff;
  635. border-radius: 16rpx;
  636. background: rgba(255, 255, 255, 0.2);
  637. }
  638. }
  639. .header2 {
  640. z-index: 999;
  641. position: fixed;
  642. top: 0;
  643. left: 0;
  644. right: 0;
  645. text-align: center;
  646. background-color: #fff;
  647. .title {
  648. font-size: 34rpx;
  649. }
  650. }
  651. .content {
  652. z-index: 1;
  653. margin: -102rpx auto 0;
  654. width: 690rpx;
  655. border-radius: 12rpx 12rpx 0 0;
  656. background-color: #f2f2f2;
  657. .search {
  658. box-sizing: border-box;
  659. padding: 0 28rpx;
  660. width: 690rpx;
  661. height: 353rpx;
  662. border-radius: 12rpx;
  663. background-color: #fff;
  664. .search_town {
  665. display: flex;
  666. justify-content: space-between;
  667. align-items: center;
  668. height: 89rpx;
  669. color: #a6a6a6;
  670. font-size: 32rpx;
  671. border-bottom: 1rpx solid #e6e6e6;
  672. img {
  673. width: 40rpx;
  674. height: 40rpx;
  675. }
  676. }
  677. .active {
  678. font-weight: bold;
  679. color: #000;
  680. }
  681. .search_center {
  682. display: flex;
  683. align-items: center;
  684. height: 89rpx;
  685. color: #a6a6a6;
  686. font-size: 28rpx;
  687. img {
  688. width: 40rpx;
  689. height: 40rpx;
  690. }
  691. .center_input {
  692. margin-right: 12rpx;
  693. width: 250rpx;
  694. color: #000;
  695. font-weight: bold;
  696. }
  697. .img {
  698. margin-right: 12rpx;
  699. }
  700. .center_level {
  701. flex: 1;
  702. margin-left: 24rpx;
  703. font-weight: 400;
  704. }
  705. .active {
  706. font-weight: bold;
  707. color: #000;
  708. }
  709. .img2 {
  710. margin-left: auto;
  711. }
  712. }
  713. .search_btn {
  714. display: flex;
  715. justify-content: center;
  716. align-items: center;
  717. margin-top: 23rpx;
  718. width: 623rpx;
  719. height: 100rpx;
  720. border-radius: 57rpx;
  721. color: #fff;
  722. font-size: 32rpx;
  723. background: linear-gradient(90deg, #2697ef 0%, #5e35eb 100%);
  724. }
  725. }
  726. .icons {
  727. display: flex;
  728. justify-content: space-around;
  729. align-items: center;
  730. margin: 20rpx auto;
  731. width: 690rpx;
  732. height: 180rpx;
  733. border-radius: 12rpx;
  734. background-color: #fff;
  735. .icon_item {
  736. display: flex;
  737. flex-direction: column;
  738. align-items: center;
  739. width: 20%;
  740. .item_top {
  741. display: flex;
  742. align-items: center;
  743. justify-content: center;
  744. width: 60rpx;
  745. height: 60rpx;
  746. border-radius: 50%;
  747. img {
  748. width: 28rpx;
  749. height: 27rpx;
  750. }
  751. .img2 {
  752. width: 40rpx;
  753. height: 25.5rpx;
  754. }
  755. .img3 {
  756. width: 31rpx;
  757. height: 21rpx;
  758. }
  759. }
  760. .color {
  761. background-color: #d8e8e8;
  762. }
  763. .color2 {
  764. background-color: #c2f2d5;
  765. }
  766. .color3 {
  767. background-color: #f7d4ba;
  768. }
  769. .color4 {
  770. background-color: #fae1e2;
  771. }
  772. .color5 {
  773. background-color: #d0e0f2;
  774. }
  775. .item_bottom {
  776. margin-top: 6rpx;
  777. font-size: 28rpx;
  778. }
  779. }
  780. }
  781. .swiper {
  782. margin: 20rpx auto 0;
  783. width: 690rpx;
  784. height: 214rpx;
  785. border-radius: 12rpx;
  786. background-color: #fff;
  787. .swiper_item {
  788. display: flex;
  789. justify-content: space-around;
  790. align-items: center;
  791. width: 100%;
  792. height: 100%;
  793. .item_box {
  794. position: relative;
  795. width: 195rpx;
  796. height: 128rpx;
  797. border-radius: 12rpx;
  798. color: #fff;
  799. img {
  800. width: 195rpx;
  801. height: 128rpx;
  802. border-radius: 12rpx;
  803. }
  804. .box_town {
  805. position: absolute;
  806. top: 30rpx;
  807. left: 0;
  808. right: 0;
  809. text-align: center;
  810. font-size: 28rpx;
  811. font-weight: bold;
  812. }
  813. .box_count {
  814. position: absolute;
  815. top: 75rpx;
  816. left: 0;
  817. right: 0;
  818. text-align: center;
  819. font-size: 18rpx;
  820. }
  821. }
  822. }
  823. }
  824. .body {
  825. margin: 0 auto;
  826. width: 690rpx;
  827. .body_top {
  828. display: flex;
  829. align-items: center;
  830. height: 89rpx;
  831. .circle {
  832. width: 30rpx;
  833. height: 30rpx;
  834. border-radius: 50%;
  835. background-color: #485bed;
  836. }
  837. .color {
  838. margin-left: -15rpx;
  839. opacity: 0.5;
  840. background-color: #fff;
  841. }
  842. .top_title {
  843. margin-left: 15rpx;
  844. font-size: 32rpx;
  845. font-weight: bold;
  846. }
  847. .top_msg {
  848. margin-top: 5rpx;
  849. margin-left: 12rpx;
  850. color: #666666;
  851. font-size: 24rpx;
  852. }
  853. .top_more {
  854. display: flex;
  855. align-items: center;
  856. margin-left: auto;
  857. color: #a6a6a6;
  858. font-size: 24rpx;
  859. img {
  860. width: 32rpx;
  861. height: 32rpx;
  862. }
  863. }
  864. }
  865. .body_strategy {
  866. display: flex;
  867. box-sizing: border-box;
  868. padding: 20rpx;
  869. margin-bottom: 10rpx;
  870. width: 690rpx;
  871. height: 235rpx;
  872. border-radius: 12rpx;
  873. background-color: #fff;
  874. .strategy_cover {
  875. width: 253rpx;
  876. height: 190rpx;
  877. border-radius: 7rpx;
  878. }
  879. .strategy_info {
  880. flex: 1;
  881. display: flex;
  882. flex-direction: column;
  883. justify-content: space-between;
  884. margin-left: 20rpx;
  885. width: 500rpx;
  886. height: 170rpx;
  887. font-size: 24rpx;
  888. color: #666666;
  889. overflow: hidden;
  890. .info_title {
  891. font-size: 32rpx;
  892. font-weight: bold;
  893. color: #000;
  894. overflow: hidden;
  895. text-overflow: ellipsis;
  896. white-space: nowrap;
  897. }
  898. .info_title2 {
  899. font-size: 32rpx;
  900. font-weight: bold;
  901. color: #000;
  902. display: -webkit-box;
  903. -webkit-box-orient: vertical;
  904. -webkit-line-clamp: 2;
  905. overflow: hidden;
  906. }
  907. .info_tags {
  908. display: flex;
  909. .tag {
  910. margin-right: 10rpx;
  911. box-sizing: border-box;
  912. padding: 0 5rpx;
  913. height: 35rpx;
  914. color: #1e7dfb;
  915. font-size: 20rpx;
  916. border-radius: 30rpx;
  917. border: 1rpx solid #1e7dfb;
  918. }
  919. }
  920. .info_desc {
  921. display: -webkit-box;
  922. -webkit-box-orient: vertical;
  923. -webkit-line-clamp: 2;
  924. overflow: hidden;
  925. }
  926. }
  927. }
  928. .body_list {
  929. display: flex;
  930. flex-wrap: wrap;
  931. justify-content: space-between;
  932. .list_item {
  933. width: 335rpx;
  934. box-sizing: border-box;
  935. margin-bottom: 20rpx;
  936. .item-img {
  937. width: 100%;
  938. height: 223rpx;
  939. border-radius: 18rpx 18rpx 0 0;
  940. box-sizing: border-box;
  941. }
  942. .descrition {
  943. display: flex;
  944. flex-direction: column;
  945. width: 100%;
  946. border-radius: 0 0 18rpx 18rpx;
  947. box-sizing: border-box;
  948. background: rgba(255, 255, 255, 1);
  949. margin-top: -10rpx;
  950. .title {
  951. font-size: 28rpx;
  952. font-weight: 600;
  953. padding: 20rpx 20rpx 10rpx;
  954. color: rgba(0, 0, 0, 1);
  955. overflow: hidden;
  956. white-space: nowrap;
  957. text-overflow: ellipsis;
  958. }
  959. .type {
  960. padding: 5rpx 20rpx;
  961. height: 40rpx;
  962. font-size: 24rpx;
  963. color: #a6a6a6;
  964. }
  965. .distance {
  966. padding: 10rpx 20rpx;
  967. font-size: 24rpx;
  968. color: #a6a6a6;
  969. }
  970. .detail {
  971. display: flex;
  972. flex-direction: row;
  973. justify-content: space-between;
  974. align-items: center;
  975. padding: 0 20rpx 20rpx 20rpx;
  976. color: rgba(0, 0, 0, 1);
  977. .img {
  978. width: 40rpx;
  979. height: 40rpx;
  980. }
  981. .price {
  982. .txt1 {
  983. font-size: 36rpx;
  984. font-weight: 600;
  985. color: rgba(255, 87, 51, 1);
  986. }
  987. .txt2 {
  988. font-size: 24rpx;
  989. font-weight: 400;
  990. color: #a6a6a6;
  991. }
  992. }
  993. .score {
  994. font-size: 24rpx;
  995. font-weight: 400;
  996. padding-top: 10rpx;
  997. color: rgba(166, 166, 166, 1);
  998. }
  999. }
  1000. }
  1001. }
  1002. }
  1003. .noData {
  1004. display: flex;
  1005. flex-direction: column;
  1006. justify-content: center;
  1007. align-items: center;
  1008. padding-bottom: 65rpx;
  1009. img {
  1010. margin-top: 80rpx;
  1011. width: 600rpx;
  1012. height: 600rpx;
  1013. }
  1014. }
  1015. }
  1016. }
  1017. .popup_body {
  1018. width: 618rpx;
  1019. height: 687rpx;
  1020. border-radius: 21rpx;
  1021. background-color: #fff;
  1022. .body_header {
  1023. display: flex;
  1024. justify-content: center;
  1025. align-items: center;
  1026. position: relative;
  1027. height: 113rpx;
  1028. border-bottom: 1rpx solid #e6e6e6;
  1029. img {
  1030. width: 16rpx;
  1031. height: 16rpx;
  1032. }
  1033. .header_title {
  1034. margin: 0 10rpx;
  1035. font-size: 34rpx;
  1036. font-weight: bold;
  1037. color: #0f194d;
  1038. }
  1039. }
  1040. .body_content {
  1041. display: grid;
  1042. grid-template-columns: repeat(auto-fill, 160rpx);
  1043. gap: 28rpx;
  1044. box-sizing: border-box;
  1045. padding: 26rpx 40rpx 50rpx;
  1046. .content_box {
  1047. position: relative;
  1048. width: 160rpx;
  1049. height: 105rpx;
  1050. color: #fff;
  1051. border-radius: 10rpx;
  1052. img {
  1053. width: 160rpx;
  1054. height: 105rpx;
  1055. border-radius: 10rpx;
  1056. }
  1057. .box_town {
  1058. position: absolute;
  1059. top: 20rpx;
  1060. left: 0;
  1061. right: 0;
  1062. text-align: center;
  1063. font-size: 28rpx;
  1064. font-weight: bold;
  1065. }
  1066. .box_count {
  1067. position: absolute;
  1068. top: 62rpx;
  1069. left: 0;
  1070. right: 0;
  1071. text-align: center;
  1072. font-size: 18rpx;
  1073. }
  1074. }
  1075. }
  1076. }
  1077. .popupClass {
  1078. position: relative;
  1079. width: 481rpx;
  1080. height: 764rpx;
  1081. img {
  1082. width: 100%;
  1083. height: 665rpx;
  1084. }
  1085. .btn_go {
  1086. position: absolute;
  1087. top: 415rpx;
  1088. left: 40rpx;
  1089. width: 396rpx;
  1090. height: 76rpx;
  1091. border-radius: 43rpx;
  1092. }
  1093. .btn_text {
  1094. position: absolute;
  1095. top: 265rpx;
  1096. left: 40rpx;
  1097. display: flex;
  1098. justify-content: center;
  1099. align-items: center;
  1100. width: 400rpx;
  1101. height: 260rpx;
  1102. color: #0f194d;
  1103. font-size: 28rpx;
  1104. border-radius: 43rpx;
  1105. background-color: #fff;
  1106. }
  1107. .btn_close {
  1108. position: absolute;
  1109. top: 586rpx;
  1110. left: 212rpx;
  1111. width: 58rpx;
  1112. height: 58rpx;
  1113. border-radius: 50%;
  1114. }
  1115. }
  1116. }
  1117. </style>