rimDetail.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <template>
  2. <view class="container" :style="'overflow:' + (showPage ? 'hidden' : 'visible')" v-if="info">
  3. <!-- 顶部轮播图区域 -->
  4. <swiper indicator-dots indicator-color="rgba(255, 255, 255, 0.5)" indicator-active-color="#fff" circular autoplay :interval="3000" class="swiper">
  5. <swiper-item v-if="info.show_video">
  6. <video
  7. class="video"
  8. :src="info.show_video"
  9. id="myVideo"
  10. :show-fullscreen-btn="false"
  11. :direction="0"
  12. @fullscreenchange="fullscreenchange"
  13. @click="handleClickVideo('myVideo')"
  14. ></video>
  15. </swiper-item>
  16. <swiper-item v-for="(item, index) in imgList" :key="index">
  17. <img class="img" mode="aspectFill" :src="item" @click="handleLookImgs(imgList, index)" />
  18. </swiper-item>
  19. </swiper>
  20. <!-- 周边信息区域 -->
  21. <view class="info">
  22. <view class="info_name">{{ info.rname }}</view>
  23. <view class="info_score">
  24. <view class="score_msg" @click="goPageInfo">简介</view>
  25. <img class="score_icon" src="../../static/index/right.png" @click="goPageInfo" />
  26. </view>
  27. <view class="info_address">
  28. <img class="address_icon" src="../../static/index/address.png" />
  29. <text @click="handleLookAddress">地址:{{ info.radress }}</text>
  30. </view>
  31. <view class="info_phone">
  32. <img class="phone_icon" src="../../static/index/phone3.png" />
  33. <text @click="handleCallPhone(info.rphone)">联系电话:{{ info.rphone }}</text>
  34. </view>
  35. </view>
  36. <!-- 周边产品区域 -->
  37. <view class="goods" v-if="goodList.length">
  38. <view class="goods_title">周边产品</view>
  39. <!-- 列表区域 -->
  40. <view class="goods_list">
  41. <!-- 每一个产品区域 -->
  42. <view class="item_box" v-for="item in goodList" :key="item.id" @click="handleLookDetail(item)">
  43. <view class="box_left">
  44. <view class="left_name">{{ item.product_name }}</view>
  45. <view class="left_info">产品简介 ></view>
  46. <view class="left_price">¥{{ item.price }}</view>
  47. </view>
  48. <view class="box_right">
  49. <view class="right_btn">查看</view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <!-- 查看更多区域 -->
  55. <view class="more" v-if="showMore" @click="handleShowMore">
  56. 查看更多
  57. <img class="more_icon" src="../../static/index/down.png" />
  58. </view>
  59. <!-- 弹窗区域 -->
  60. <uv-popup ref="popup" bgColor="none" :safeAreaInsetBottom="false">
  61. <view class="body_pop">
  62. <img class="pop_img" mode="aspectFill" :src="info.first_img" />
  63. <!-- 弹窗关闭图标区域 -->
  64. <img class="pop_icon" src="../../static/index/close.png" @click="handleClosePop" />
  65. <view class="pop_name">{{ popInfo.product_name }}</view>
  66. <view class="pop_desc">
  67. <mp-html :content="popInfo.product_desc" />
  68. </view>
  69. </view>
  70. </uv-popup>
  71. </view>
  72. </template>
  73. <script>
  74. export default {
  75. data() {
  76. return {
  77. // 滚动穿透控制
  78. showPage: false,
  79. goodList: [],
  80. page: 1,
  81. rows: 3,
  82. total: null,
  83. info: null,
  84. showMore: true,
  85. popInfo: null,
  86. imgList: [],
  87. // video 上下文 videoContext 对象
  88. videoContext: null,
  89. // 是否是全屏状态
  90. isFullScreen: false
  91. }
  92. },
  93. onLoad(options) {
  94. this.info = JSON.parse(decodeURIComponent(options.info))
  95. if (this.info.detail_img) {
  96. this.imgList = this.info.detail_img.split(',')
  97. }
  98. this.getData()
  99. },
  100. methods: {
  101. async getData() {
  102. const res = await this.$myRequest({
  103. url: '/mhotel/applistAround_pd.action',
  104. data: {
  105. aid: this.info.id,
  106. page: this.page,
  107. rows: this.rows
  108. }
  109. })
  110. // console.log(res)
  111. if (res.code === 200) {
  112. this.goodList = [...this.goodList, ...res.rows]
  113. this.total = res.total
  114. if (this.goodList.length >= this.total) {
  115. this.showMore = false
  116. }
  117. }
  118. },
  119. goPageInfo() {
  120. let desc = encodeURIComponent(JSON.stringify(this.info.detail))
  121. uni.navigateTo({
  122. url: `/pages/rimInfo/rimInfo?desc=${desc}`
  123. })
  124. },
  125. handleLookDetail(item) {
  126. this.popInfo = item
  127. this.showPage = true
  128. this.$refs.popup.open('bottom')
  129. },
  130. // 点击弹窗关闭图标回调
  131. handleClosePop() {
  132. this.showPage = false
  133. this.$refs.popup.close()
  134. },
  135. handleLookImgs(urls, current) {
  136. uni.previewImage({
  137. urls,
  138. current
  139. })
  140. },
  141. handleLookAddress() {
  142. let latitude = this.info.jingwei.split(',')[1] * 1
  143. let longitude = this.info.jingwei.split(',')[0] * 1
  144. uni.openLocation({
  145. latitude,
  146. longitude,
  147. name: this.info.rname,
  148. address: this.info.radress,
  149. success: () => {}
  150. })
  151. },
  152. handleCallPhone(phone) {
  153. uni.makePhoneCall({
  154. phoneNumber: phone
  155. })
  156. },
  157. handleShowMore() {
  158. this.page++
  159. this.getData()
  160. },
  161. // 进入全屏和退出全屏时触发的回调
  162. fullscreenchange(e) {
  163. this.isFullScreen = e.detail.fullScreen
  164. },
  165. // 点击视频控件时触发的回调
  166. handleClickVideo(id) {
  167. this.videoContext = uni.createVideoContext(id)
  168. if (this.isFullScreen) {
  169. this.videoContext.pause()
  170. this.videoContext.exitFullScreen()
  171. } else {
  172. this.videoContext.requestFullScreen()
  173. this.videoContext.play()
  174. }
  175. }
  176. }
  177. }
  178. </script>
  179. <style lang="scss" scoped>
  180. .container {
  181. min-height: 100vh;
  182. background-color: #fff;
  183. .swiper {
  184. width: 100%;
  185. height: 423rpx;
  186. .img,
  187. .video {
  188. width: 100%;
  189. height: 100%;
  190. }
  191. }
  192. .info {
  193. margin-top: 20rpx;
  194. padding: 0 20rpx;
  195. .info_name {
  196. font-size: 34rpx;
  197. font-weight: bold;
  198. color: #000000;
  199. }
  200. .info_score {
  201. display: flex;
  202. align-items: center;
  203. margin-top: 22rpx;
  204. font-size: 24rpx;
  205. .score_left {
  206. padding: 0 10rpx 0 12rpx;
  207. line-height: 36rpx;
  208. color: #fff;
  209. text-align: center;
  210. font-weight: bold;
  211. border-radius: 32rpx 0 0 32rpx;
  212. background-color: #096562;
  213. }
  214. .score_right {
  215. padding: 0 12rpx 0 10rpx;
  216. line-height: 36rpx;
  217. color: #096562;
  218. text-align: center;
  219. font-weight: bold;
  220. border-radius: 0 32rpx 32rpx 0;
  221. background-color: #dff2f2;
  222. }
  223. .score_msg {
  224. // margin-left: 42rpx;
  225. color: #096562;
  226. }
  227. .score_icon {
  228. margin-top: 5rpx;
  229. margin-left: 13rpx;
  230. width: 10rpx;
  231. height: 20rpx;
  232. }
  233. }
  234. .info_address {
  235. display: flex;
  236. align-items: center;
  237. margin-top: 24rpx;
  238. height: 83rpx;
  239. font-size: 28rpx;
  240. border-top: 1rpx solid #e6e6e6;
  241. .address_icon {
  242. margin-right: 8rpx;
  243. width: 30rpx;
  244. height: 30rpx;
  245. }
  246. }
  247. .info_phone {
  248. display: flex;
  249. align-items: center;
  250. height: 83rpx;
  251. font-size: 28rpx;
  252. border-top: 1rpx solid #e6e6e6;
  253. .phone_icon {
  254. margin-right: 8rpx;
  255. width: 40rpx;
  256. height: 40rpx;
  257. }
  258. }
  259. }
  260. .goods {
  261. padding: 0 20rpx;
  262. border-top: 1rpx solid #cccccc;
  263. .goods_title {
  264. margin-top: 30rpx;
  265. font-size: 32rpx;
  266. font-weight: bold;
  267. }
  268. .goods_list {
  269. margin-top: 17rpx;
  270. .item_box {
  271. display: flex;
  272. margin-bottom: 20rpx;
  273. padding: 0 32rpx 0 24rpx;
  274. height: 170rpx;
  275. border-radius: 10rpx;
  276. background-color: #f2f2f2;
  277. .box_left {
  278. flex: 2;
  279. display: flex;
  280. flex-direction: column;
  281. justify-content: space-evenly;
  282. overflow: hidden;
  283. .left_name {
  284. font-size: 28rpx;
  285. overflow: hidden;
  286. text-overflow: ellipsis;
  287. white-space: nowrap;
  288. }
  289. .left_info {
  290. color: #808080;
  291. font-size: 24rpx;
  292. overflow: hidden;
  293. text-overflow: ellipsis;
  294. white-space: nowrap;
  295. }
  296. .left_price {
  297. color: #ff5733;
  298. font-size: 24rpx;
  299. }
  300. }
  301. .box_right {
  302. flex: 1;
  303. display: flex;
  304. justify-content: flex-end;
  305. align-items: center;
  306. .right_btn {
  307. display: flex;
  308. justify-content: center;
  309. align-items: center;
  310. width: 115rpx;
  311. height: 60rpx;
  312. color: #fff;
  313. font-size: 28rpx;
  314. border-radius: 10rpx;
  315. background-color: #ff5733;
  316. }
  317. }
  318. }
  319. }
  320. }
  321. .more {
  322. display: flex;
  323. justify-content: center;
  324. align-items: center;
  325. padding: 20rpx 0 30rpx 0;
  326. color: #096663;
  327. font-size: 24rpx;
  328. .more_icon {
  329. width: 38rpx;
  330. height: 48rpx;
  331. }
  332. }
  333. .body_pop {
  334. position: relative;
  335. width: 750rpx;
  336. height: 85vh;
  337. border-radius: 22rpx 22rpx 0 0;
  338. background-color: #fff;
  339. overflow-y: auto;
  340. .pop_img {
  341. width: 100%;
  342. height: 423rpx;
  343. border-radius: 20rpx 20rpx 0 0;
  344. }
  345. .pop_icon {
  346. position: absolute;
  347. top: 20rpx;
  348. right: 30rpx;
  349. width: 58rpx;
  350. height: 58rpx;
  351. }
  352. .pop_name {
  353. padding: 0 20rpx;
  354. line-height: 90rpx;
  355. font-size: 32rpx;
  356. font-weight: bold;
  357. }
  358. .pop_desc {
  359. padding: 0 20rpx;
  360. }
  361. }
  362. }
  363. </style>