siteDetails.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <template>
  2. <view class="">
  3. <uni-popup ref="siteDetailsPopupRef" type="bottom">
  4. <view class="details-box">
  5. <siteListModel :info="info" ref="siteListModelRef" @refresh='calculateHeight()'/>
  6. <siteServeH6 :height="serveH" :mapLocationId="info ? info.mapLocationId : undefined " />
  7. </view>
  8. </uni-popup>
  9. <telList ref="telListRef" />
  10. </view>
  11. </template>
  12. <script>
  13. // import { EventBus } from "@/utils/vueBus.js"
  14. import { openMap } from "@/utils/openApp.js"
  15. import { distanceCalculate } from "@/utils/tool.js";
  16. import telList from "./telList.vue"
  17. import siteListModel from "./siteList.vue";
  18. // import siteServe from "./siteServe.vue"
  19. import siteServeH6 from "./siteServeH6.vue"
  20. import map from "./../map.js"
  21. export default {
  22. mixins: [map],
  23. data() {
  24. return {
  25. contentH: 0,
  26. serveH: 0,
  27. info: undefined,
  28. }
  29. },
  30. components: {
  31. telList,
  32. siteListModel,
  33. siteServeH6
  34. // siteServe,
  35. },
  36. created() {
  37. },
  38. mounted() {
  39. // EventBus.$on('TianDiTuSite', (res) => {
  40. // const { longitude, latitude } = res;
  41. // this.openDetails(res);
  42. // });
  43. // const aaa = {
  44. // "deleteFlag": "NOT_DELETE",
  45. // "createTime": "2024-12-11 16:56:18",
  46. // "createUser": "1543837863788879871",
  47. // "updateTime": "2024-12-18 09:08:07",
  48. // "updateUser": "1543837863788879871",
  49. // "mapLocationId": "1866768964909047810",
  50. // "locationName": "武汉市民之家 出入境办证大厅",
  51. // "mapTypeId": "1867023355423547393",
  52. // "mapTypeName": "市公安政务服务中心",
  53. // "mapTypeIcon": "https://sly-ga-zwserver.obs.cn-north-4.myhuaweicloud.com/2024/12/16/1868630815665283073.png",
  54. // "provinceCode": "420000",
  55. // "provinceName": "湖北省",
  56. // "cityCode": "420100",
  57. // "cityName": "武汉市",
  58. // "areaCode": "420102",
  59. // "areaName": "江岸区",
  60. // "address": "江岸区金桥大道117号",
  61. // "workTimeRemark": "周一至周五:上午9:00-12:00;下午13:30-17:00 周六:上午9:00-12:00;下午13:00-16:00",
  62. // "outerPhone": "12367",
  63. // "mapStatus": "ENABLE",
  64. // "orderIndex": 1,
  65. // "longitude": "114.28986",
  66. // "latitude": "30.66223",
  67. // "centerPoint": false,
  68. // "distance": 0,
  69. // "centerDistance": 50.825090552695464,
  70. // "mapContactList": [{
  71. // "deleteFlag": "NOT_DELETE",
  72. // "createTime": "2024-12-18 09:08:07",
  73. // "createUser": "1543837863788879871",
  74. // "updateTime": null,
  75. // "updateUser": null,
  76. // "mapContactsId": "1869187854787371009",
  77. // "phone": "12367",
  78. // "remark": null,
  79. // "mapLocationId": "1866768964909047810"
  80. // }]
  81. // }
  82. // this.openDetails(aaa)
  83. },
  84. beforeDestroy() {
  85. // EventBus.$off('someEvent'); // 确保在组件销毁前移除事件监听
  86. },
  87. watch: {
  88. contentH: {
  89. handler(newH) {
  90. if (newH) {
  91. const query = uni.createSelectorQuery().in(this);
  92. query
  93. .select(".details-box")
  94. .boundingClientRect((data) => {
  95. const { height } = data || {};
  96. console.log('heightheightheight = ' , height , this.contentH )
  97. const h =height - this.contentH - uni.upx2px(50);
  98. this.serveH = h;
  99. })
  100. .exec();
  101. }
  102. },
  103. }
  104. },
  105. methods: {
  106. getDistance(num) {
  107. return distanceCalculate(num)
  108. },
  109. getPhoneCall(tel) {
  110. this.$refs.telListRef.open({ tel })
  111. },
  112. openLocation(info) {
  113. const { areaCode, cityCode, provinceCode, provinceName, cityName, areaName, address } = info
  114. const name = `${provinceName}${cityName}${areaName}${address}`;
  115. const code = areaCode || cityCode || provinceCode
  116. openMap({ name, code: code, type: "baidu" })
  117. },
  118. openDetails(res) {
  119. console.log('openDetails = ', res)
  120. this.info = res;
  121. this.serveH = 0;
  122. this.contentH = 0;
  123. this.$refs.siteDetailsPopupRef.open()
  124. this.calculateHeight()
  125. },
  126. calculateHeight() {
  127. this.$nextTick(() => {
  128. if(this.$refs.siteListModelRef){
  129. this.$refs.siteListModelRef.getHeight().then(res => {
  130. this.contentH = res;
  131. })
  132. }else{
  133. setTimeout(() => {
  134. this.calculateHeight()
  135. },10)
  136. }
  137. console.log('this.$refs.siteListModelRef = ' , this.$refs.siteListModelRef)
  138. // try {
  139. // const query = uni.createSelectorQuery().in(this);
  140. // query
  141. // .select(".details-box")
  142. // .boundingClientRect((data) => {
  143. // if (data) {
  144. // this.contentH = data.height - uni.upx2px(150);
  145. // }
  146. // })
  147. // .exec();
  148. // } catch (error) {
  149. // //TODO handle the exception
  150. // const windowHeight = uni.getSystemInfoSync().windowHeight;
  151. // this.contentH = windowHeight * 0.8 - uni.upx2px(150);
  152. // }
  153. // if (!this.contentH) {
  154. // setTimeout(() => {
  155. // this.calculateHeight()
  156. // }, 100)
  157. // }
  158. })
  159. }
  160. }
  161. }
  162. </script>
  163. <style lang="scss" scoped>
  164. .uni-popup {
  165. z-index: 1002;
  166. .details-box {
  167. height: 80vh;
  168. padding: 50rpx 0 0;
  169. background-color: #fff;
  170. border-radius: 20rpx 20rpx 0 0;
  171. .site-name {
  172. font-size: 36rpx;
  173. padding-top: 30rpx;
  174. padding-bottom: 15rpx;
  175. }
  176. .site-location,
  177. .site-distance {
  178. padding-top: 10rpx;
  179. // color: #8e8c8c;
  180. font-size: 28rpx;
  181. }
  182. .site-distance {
  183. color: #7D7D7D;
  184. }
  185. .site-time {
  186. margin-top: 15rpx;
  187. background-color: #fff;
  188. border-top: 1rpx solid #F0F0F0;
  189. padding: 15rpx 0;
  190. display: flex;
  191. justify-content: space-between;
  192. font-size: 28rpx;
  193. text {
  194. flex-shrink: 0;
  195. }
  196. .time-lable {
  197. color: #7D7D7D;
  198. }
  199. .site-time-val {
  200. width: 1rpx;
  201. flex: 1;
  202. padding-left: 30rpx;
  203. // text-align: right;
  204. }
  205. }
  206. .details-btn {
  207. width: 100%;
  208. height: 120rpx;
  209. padding-top: 20rpx;
  210. display: flex;
  211. justify-content: center;
  212. align-items: center;
  213. .site-btn {
  214. width: 260rpx;
  215. height: 80rpx;
  216. display: flex;
  217. justify-content: center;
  218. align-items: center;
  219. color: #fff;
  220. border-radius: 10rpx;
  221. background-color: #3291F8;
  222. &+.site-btn {
  223. margin-left: 50rpx;
  224. }
  225. .icon {
  226. width: 50rpx;
  227. height: 50rpx;
  228. path {
  229. fill: #fff;
  230. }
  231. }
  232. .site-text {
  233. font-size: 30rpx;
  234. padding-left: 20rpx;
  235. }
  236. }
  237. }
  238. }
  239. .sever-box {
  240. width: 100%;
  241. // background-color: hotpink;
  242. }
  243. }
  244. </style>