rimDetail.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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. uni.navigateTo({
  121. url: `/pages/rimInfo/rimInfo?desc=${this.info.detail}`
  122. })
  123. },
  124. handleLookDetail(item) {
  125. this.popInfo = item
  126. this.showPage = true
  127. this.$refs.popup.open('bottom')
  128. },
  129. // 点击弹窗关闭图标回调
  130. handleClosePop() {
  131. this.showPage = false
  132. this.$refs.popup.close()
  133. },
  134. handleLookImgs(urls, current) {
  135. uni.previewImage({
  136. urls,
  137. current
  138. })
  139. },
  140. handleLookAddress() {
  141. let latitude = this.info.jingwei.split(',')[1] * 1
  142. let longitude = this.info.jingwei.split(',')[0] * 1
  143. uni.openLocation({
  144. latitude,
  145. longitude,
  146. name: this.info.rname,
  147. address: this.info.radress,
  148. success: () => {}
  149. })
  150. },
  151. handleCallPhone(phone) {
  152. uni.makePhoneCall({
  153. phoneNumber: phone
  154. })
  155. },
  156. handleShowMore() {
  157. this.page++
  158. this.getData()
  159. },
  160. // 进入全屏和退出全屏时触发的回调
  161. fullscreenchange(e) {
  162. this.isFullScreen = e.detail.fullScreen
  163. },
  164. // 点击视频控件时触发的回调
  165. handleClickVideo(id) {
  166. this.videoContext = uni.createVideoContext(id)
  167. if (this.isFullScreen) {
  168. this.videoContext.pause()
  169. this.videoContext.exitFullScreen()
  170. } else {
  171. this.videoContext.requestFullScreen()
  172. this.videoContext.play()
  173. }
  174. }
  175. }
  176. }
  177. </script>
  178. <style lang="scss" scoped>
  179. .container {
  180. min-height: 100vh;
  181. background-color: #fff;
  182. .swiper {
  183. width: 100%;
  184. height: 423rpx;
  185. .img,
  186. .video {
  187. width: 100%;
  188. height: 100%;
  189. }
  190. }
  191. .info {
  192. margin-top: 20rpx;
  193. padding: 0 20rpx;
  194. .info_name {
  195. font-size: 34rpx;
  196. font-weight: bold;
  197. color: #000000;
  198. }
  199. .info_score {
  200. display: flex;
  201. align-items: center;
  202. margin-top: 22rpx;
  203. font-size: 24rpx;
  204. .score_left {
  205. padding: 0 10rpx 0 12rpx;
  206. line-height: 36rpx;
  207. color: #fff;
  208. text-align: center;
  209. font-weight: bold;
  210. border-radius: 32rpx 0 0 32rpx;
  211. background-color: #096562;
  212. }
  213. .score_right {
  214. padding: 0 12rpx 0 10rpx;
  215. line-height: 36rpx;
  216. color: #096562;
  217. text-align: center;
  218. font-weight: bold;
  219. border-radius: 0 32rpx 32rpx 0;
  220. background-color: #dff2f2;
  221. }
  222. .score_msg {
  223. // margin-left: 42rpx;
  224. color: #096562;
  225. }
  226. .score_icon {
  227. margin-top: 5rpx;
  228. margin-left: 13rpx;
  229. width: 10rpx;
  230. height: 20rpx;
  231. }
  232. }
  233. .info_address {
  234. display: flex;
  235. align-items: center;
  236. margin-top: 24rpx;
  237. height: 83rpx;
  238. font-size: 28rpx;
  239. border-top: 1rpx solid #e6e6e6;
  240. .address_icon {
  241. margin-right: 8rpx;
  242. width: 30rpx;
  243. height: 30rpx;
  244. }
  245. }
  246. .info_phone {
  247. display: flex;
  248. align-items: center;
  249. height: 83rpx;
  250. font-size: 28rpx;
  251. border-top: 1rpx solid #e6e6e6;
  252. .phone_icon {
  253. margin-right: 8rpx;
  254. width: 40rpx;
  255. height: 40rpx;
  256. }
  257. }
  258. }
  259. .goods {
  260. padding: 0 20rpx;
  261. border-top: 1rpx solid #cccccc;
  262. .goods_title {
  263. margin-top: 30rpx;
  264. font-size: 32rpx;
  265. font-weight: bold;
  266. }
  267. .goods_list {
  268. margin-top: 17rpx;
  269. .item_box {
  270. display: flex;
  271. margin-bottom: 20rpx;
  272. padding: 0 32rpx 0 24rpx;
  273. height: 170rpx;
  274. border-radius: 10rpx;
  275. background-color: #f2f2f2;
  276. .box_left {
  277. flex: 2;
  278. display: flex;
  279. flex-direction: column;
  280. justify-content: space-evenly;
  281. overflow: hidden;
  282. .left_name {
  283. font-size: 28rpx;
  284. overflow: hidden;
  285. text-overflow: ellipsis;
  286. white-space: nowrap;
  287. }
  288. .left_info {
  289. color: #808080;
  290. font-size: 24rpx;
  291. overflow: hidden;
  292. text-overflow: ellipsis;
  293. white-space: nowrap;
  294. }
  295. .left_price {
  296. color: #ff5733;
  297. font-size: 24rpx;
  298. }
  299. }
  300. .box_right {
  301. flex: 1;
  302. display: flex;
  303. justify-content: flex-end;
  304. align-items: center;
  305. .right_btn {
  306. display: flex;
  307. justify-content: center;
  308. align-items: center;
  309. width: 115rpx;
  310. height: 60rpx;
  311. color: #fff;
  312. font-size: 28rpx;
  313. border-radius: 10rpx;
  314. background-color: #ff5733;
  315. }
  316. }
  317. }
  318. }
  319. }
  320. .more {
  321. display: flex;
  322. justify-content: center;
  323. align-items: center;
  324. padding: 20rpx 0 30rpx 0;
  325. color: #096663;
  326. font-size: 24rpx;
  327. .more_icon {
  328. width: 38rpx;
  329. height: 48rpx;
  330. }
  331. }
  332. .body_pop {
  333. position: relative;
  334. width: 750rpx;
  335. height: 85vh;
  336. border-radius: 22rpx 22rpx 0 0;
  337. background-color: #fff;
  338. overflow-y: auto;
  339. .pop_img {
  340. width: 100%;
  341. height: 423rpx;
  342. border-radius: 20rpx 20rpx 0 0;
  343. }
  344. .pop_icon {
  345. position: absolute;
  346. top: 20rpx;
  347. right: 30rpx;
  348. width: 58rpx;
  349. height: 58rpx;
  350. }
  351. .pop_name {
  352. padding: 0 20rpx;
  353. line-height: 90rpx;
  354. font-size: 32rpx;
  355. font-weight: bold;
  356. }
  357. .pop_desc {
  358. padding: 0 20rpx;
  359. }
  360. }
  361. }
  362. </style>