siteDetails.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <view class="">
  3. <uni-popup ref="siteDetailsPopupRef" type="bottom">
  4. <view class="details-box">
  5. <view class="details-content" :style="{'height':contentH +'px' }">
  6. <template v-if="info">
  7. <view class="site-info">
  8. <view class="site-name">{{info.locationName}}</view>
  9. <view class="site-location">
  10. {{`${info.provinceName}${info.cityName}${info.areaName}${info.address}`}}
  11. </view>
  12. <view class="site-distance">距离{{getDistance(info.distance)}}</view>
  13. <view class="site-time">
  14. <text class="time-lable">办公时间</text>
  15. <!-- <text class="site-time-val">{{getVal(info.workTimeRemark)}}</text> -->
  16. <view class="site-time-val">
  17. <view class="" v-for="item in getVal(info.workTimeRemark)">
  18. {{ item }}
  19. </view>
  20. </view>
  21. <!-- <text class="site-time-val">{{info.workTimeRemark}}</text> -->
  22. </view>
  23. </view>
  24. <view class="sever-box" :style="{'height':serveH +'px' }">
  25. <template v-if="serveH">
  26. <siteServe v-if="$config.type === 'H5'" :height="serveH"
  27. :mapLocationId="info.mapLocationId" />
  28. <siteServeH6 v-if="$config.type === 'H6'" :height="serveH"
  29. :mapLocationId="info.mapLocationId" />
  30. </template>
  31. </view>
  32. </template>
  33. </view>
  34. <!-- <scroll-view :style="{'height':scrollH +'px' }" scroll-y="true" :show-scrollbar="false">
  35. </scroll-view> -->
  36. <view class="details-btn">
  37. <view class="site-btn" @click.stop="getPhoneCall(info.mapContactList)">
  38. <svg t="1733972888261" class="icon" viewBox="0 0 1024 1024" version="1.1"
  39. xmlns="http://www.w3.org/2000/svg" p-id="4331" xmlns:xlink="http://www.w3.org/1999/xlink">
  40. <path
  41. d="M575.7 647.1l69.4-69.2 13.3 2.3c1.7 0.3 4.9 0.9 9.4 1.7 7.4 1.3 15.7 2.9 24.6 4.5 25.5 4.8 50.9 9.8 74.8 14.9 17.3 3.7 33.1 7.3 47 10.7 27.6 6.8 47.3 12.9 59.1 18.6 43 20.8 60 65.5 53.4 122-9.7 81.3-97 174.3-204.4 175.4-121 1.2-291.4-87.7-411.9-214.7C165.3 560.4 81.8 406.9 98 278.3c8.5-67.1 40.2-115.9 87.8-147.2 32.4-21.3 69.4-32.5 97.9-34.6 38.2-2.8 69.6 9.6 92.5 38 9.7 12 19.7 36.1 32.2 73.3 3.6 10.9 7.4 22.8 11.3 35.4 7 23 14.1 47.6 20.9 72.2 2.4 8.6 4.5 16.6 6.4 23.7 1.1 4.3 2 7.4 2.4 9.1l3.7 14.2-80.4 81.8c44.5 89 122.6 169.8 203 202.9z m13.5 60l-15.3-5.1c-105.4-35.6-205.4-139.4-256.3-252.3l-7.3-16.2 85-86.4c-1.5-5.6-3.1-11.6-4.9-17.9-6.6-24.1-13.5-48.2-20.4-70.7-3.8-12.3-7.4-23.7-10.9-34.2-10.2-30.5-19.1-52-23.3-57.2-11.8-14.6-26.4-20.4-48.2-18.8-20.2 1.5-48.7 10.1-73.1 26.2-35.2 23.2-58.3 58.6-64.8 110.3-13.8 108.7 63.1 250.2 198.4 392.7C459.5 794.9 617 877 721.8 876c79.2-0.8 146.4-72.5 153.2-129.4 4.3-36.6-4.3-59.4-24.4-69.1-7.5-3.6-24.7-8.9-48.9-14.9-13.4-3.3-28.6-6.8-45.4-10.4-23.3-5-48.4-10-73.5-14.7-7.2-1.3-13.9-2.6-20.1-3.7l-73.5 73.3z"
  42. p-id="4332">
  43. </path>
  44. </svg>
  45. <text class="site-text">立即联系</text>
  46. </view>
  47. <view class="site-btn" @click.stop="openLocation(info)">
  48. <svg t="1733972953937" class="icon" viewBox="0 0 1024 1024" version="1.1"
  49. xmlns="http://www.w3.org/2000/svg" p-id="8440" xmlns:xlink="http://www.w3.org/1999/xlink">
  50. <path
  51. d="M894.185422 128.023792 129.814578 445.743994 445.99982 577.744353 571.860343 893.929596Z"
  52. p-id="8441"></path>
  53. </svg>
  54. <text class="site-text">一键导航</text>
  55. </view>
  56. </view>
  57. </view>
  58. </uni-popup>
  59. <telList ref="telListRef" />
  60. </view>
  61. </template>
  62. <script>
  63. // import { EventBus } from "@/utils/vueBus.js"
  64. import { openMap } from "@/utils/openApp.js"
  65. import { distanceCalculate } from "@/utils/tool.js";
  66. import telList from "./telList.vue"
  67. import siteServe from "./siteServe.vue"
  68. import siteServeH6 from "./siteServeH6.vue"
  69. import map from "./../map.js"
  70. export default {
  71. mixins: [map],
  72. data() {
  73. return {
  74. contentH: 0,
  75. serveH: 0,
  76. info: null,
  77. }
  78. },
  79. components: { telList, siteServe, siteServeH6 },
  80. created() {
  81. },
  82. mounted() {
  83. // EventBus.$on('TianDiTuSite', (res) => {
  84. // const { longitude, latitude } = res;
  85. // this.openDetails(res);
  86. // });
  87. // const aaa = {
  88. // "deleteFlag": "NOT_DELETE",
  89. // "createTime": "2024-12-11 16:56:18",
  90. // "createUser": "1543837863788879871",
  91. // "updateTime": "2024-12-18 09:08:07",
  92. // "updateUser": "1543837863788879871",
  93. // "mapLocationId": "1866768964909047810",
  94. // "locationName": "武汉市民之家 出入境办证大厅",
  95. // "mapTypeId": "1867023355423547393",
  96. // "mapTypeName": "市公安政务服务中心",
  97. // "mapTypeIcon": "https://sly-ga-zwserver.obs.cn-north-4.myhuaweicloud.com/2024/12/16/1868630815665283073.png",
  98. // "provinceCode": "420000",
  99. // "provinceName": "湖北省",
  100. // "cityCode": "420100",
  101. // "cityName": "武汉市",
  102. // "areaCode": "420102",
  103. // "areaName": "江岸区",
  104. // "address": "江岸区金桥大道117号",
  105. // "workTimeRemark": "周一至周五:上午9:00-12:00;下午13:30-17:00 周六:上午9:00-12:00;下午13:00-16:00",
  106. // "outerPhone": "12367",
  107. // "mapStatus": "ENABLE",
  108. // "orderIndex": 1,
  109. // "longitude": "114.28986",
  110. // "latitude": "30.66223",
  111. // "centerPoint": false,
  112. // "distance": 0,
  113. // "centerDistance": 50.825090552695464,
  114. // "mapContactList": [{
  115. // "deleteFlag": "NOT_DELETE",
  116. // "createTime": "2024-12-18 09:08:07",
  117. // "createUser": "1543837863788879871",
  118. // "updateTime": null,
  119. // "updateUser": null,
  120. // "mapContactsId": "1869187854787371009",
  121. // "phone": "12367",
  122. // "remark": null,
  123. // "mapLocationId": "1866768964909047810"
  124. // }]
  125. // }
  126. // this.openDetails(aaa)
  127. },
  128. beforeDestroy() {
  129. // EventBus.$off('someEvent'); // 确保在组件销毁前移除事件监听
  130. },
  131. watch: {
  132. contentH: {
  133. handler(newH) {
  134. if (newH) {
  135. const query = uni.createSelectorQuery().in(this);
  136. query
  137. .select(".site-info")
  138. .boundingClientRect((data) => {
  139. const { height } = data || {};
  140. const h = this.contentH - height - 10;
  141. this.serveH = h;
  142. })
  143. .exec();
  144. }
  145. },
  146. }
  147. },
  148. methods: {
  149. getDistance(num) {
  150. return distanceCalculate(num)
  151. },
  152. getPhoneCall(tel) {
  153. this.$refs.telListRef.open({ tel })
  154. },
  155. openLocation(info) {
  156. const { areaCode, cityCode, provinceCode, provinceName, cityName, areaName, address } = info
  157. const name = `${provinceName}${cityName}${areaName}${address}`;
  158. const code = areaCode || cityCode || provinceCode
  159. openMap({ name, code: code, type: "baidu" })
  160. },
  161. openDetails(res) {
  162. console.log('openDetails = ', res)
  163. this.info = res;
  164. this.serveH = 0;
  165. this.contentH = 0;
  166. this.$refs.siteDetailsPopupRef.open()
  167. this.calculateHeight()
  168. },
  169. calculateHeight() {
  170. this.$nextTick(() => {
  171. try {
  172. const query = uni.createSelectorQuery().in(this);
  173. query
  174. .select(".details-box")
  175. .boundingClientRect((data) => {
  176. if (data) {
  177. this.contentH = data.height - uni.upx2px(150);
  178. }
  179. })
  180. .exec();
  181. } catch (error) {
  182. //TODO handle the exception
  183. const windowHeight = uni.getSystemInfoSync().windowHeight;
  184. this.contentH = windowHeight * 0.8 - uni.upx2px(150);
  185. }
  186. if (!this.contentH) {
  187. setTimeout(() => {
  188. this.calculateHeight()
  189. }, 100)
  190. }
  191. })
  192. }
  193. }
  194. }
  195. </script>
  196. <style lang="scss" scoped>
  197. .uni-popup {
  198. z-index: 1002;
  199. .details-box {
  200. height: 80vh;
  201. padding: 0 30rpx;
  202. background-color: #fff;
  203. border-radius: 20rpx 20rpx 0 0;
  204. .site-name {
  205. font-size: 36rpx;
  206. padding-top: 30rpx;
  207. padding-bottom: 15rpx;
  208. }
  209. .site-location,
  210. .site-distance {
  211. padding-top: 10rpx;
  212. // color: #8e8c8c;
  213. font-size: 28rpx;
  214. }
  215. .site-distance {
  216. color: #7D7D7D;
  217. }
  218. .site-time {
  219. margin-top: 15rpx;
  220. background-color: #fff;
  221. border-top: 1rpx solid #F0F0F0;
  222. padding: 15rpx 0;
  223. display: flex;
  224. justify-content: space-between;
  225. font-size: 28rpx;
  226. text {
  227. flex-shrink: 0;
  228. }
  229. .time-lable {
  230. color: #7D7D7D;
  231. }
  232. .site-time-val {
  233. width: 1rpx;
  234. flex: 1;
  235. padding-left: 30rpx;
  236. // text-align: right;
  237. }
  238. }
  239. .details-btn {
  240. width: 100%;
  241. height: 120rpx;
  242. padding-top: 20rpx;
  243. display: flex;
  244. justify-content: center;
  245. align-items: center;
  246. .site-btn {
  247. width: 260rpx;
  248. height: 80rpx;
  249. display: flex;
  250. justify-content: center;
  251. align-items: center;
  252. color: #fff;
  253. border-radius: 10rpx;
  254. background-color: #3291F8;
  255. &+.site-btn {
  256. margin-left: 50rpx;
  257. }
  258. .icon {
  259. width: 50rpx;
  260. height: 50rpx;
  261. path {
  262. fill: #fff;
  263. }
  264. }
  265. .site-text {
  266. font-size: 30rpx;
  267. padding-left: 20rpx;
  268. }
  269. }
  270. }
  271. }
  272. .sever-box {
  273. width: 100%;
  274. // background-color: hotpink;
  275. }
  276. }
  277. </style>