vshare.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <view class="warrbox flexdc" :style="'padding-top:'+nvaHeight+'px;'">
  3. <view class="navbox">
  4. <uni-nav-bar title="访客信息" left-icon="left" @clickLeft="getBackFn" color="#FFFFFF" :background-color="backgroundColor" :border="false" statusBar='true' fixed="true">
  5. </uni-nav-bar>
  6. </view>
  7. <!-- <image :src="mbg" class="navbg"></image> -->
  8. <view class="vdmain flexdc">
  9. <view class="flex1">
  10. <view class="flexcc mb26">
  11. <view class="line lia"></view>
  12. <view class="vdtop">邀请详情</view>
  13. <view class="line lib"></view>
  14. </view>
  15. <view class="vdlist mb26">
  16. <view class="list"><text>访客姓名:</text>{{datainfo.name}}</view>
  17. <view class="list"><text>来访时间:</text>{{datainfo.visitorTime}}</view>
  18. <view class="flexc">
  19. <view class="list mw50"><text>来访人数:</text>{{datainfo.num}}人</view>
  20. <view class="list mw50"><text>来访事由:</text>{{datainfo.reason}}</view>
  21. </view>
  22. <view class="flexc">
  23. <view class="list mw50"><text>车牌号码:</text>{{datainfo.plateNumber||''}}</view>
  24. <view class="list mw50"><text>手机号码:</text>{{datainfo.mobileNumber}}</view>
  25. </view>
  26. </view>
  27. <!-- 地图 -->
  28. <view class="mb22" v-if="checkflag">
  29. <map
  30. id="container"
  31. class="map"
  32. :latitude="center.lat"
  33. :longitude="center.lng"
  34. @poitap="onClcikImgMap"
  35. @tap="onClcikImgMap"
  36. :markers="covers"
  37. scale="18"
  38. style="width: 638rpx;height:280rpx;"
  39. ></map>
  40. </view>
  41. <!-- <view class="adrbox mb16">
  42. <view class="tit mb10">分享人</view>
  43. <view class="txt">{{datainfo.houseAddress||"分享人"}}</view>
  44. </view> -->
  45. <view class="adrbox mb16" v-if="checkflag">
  46. <view class="tit mb10">房屋地址</view>
  47. <view class="txt">{{datainfo.detailAddress}}{{datainfo.houseAddress}}</view>
  48. </view>
  49. </view>
  50. </view>
  51. <loading></loading>
  52. </view>
  53. </template>
  54. <script>
  55. import config from '@/config'
  56. const baseUrl = config.baseUrl
  57. import {geocodeAddress} from '@/utils/common.js'
  58. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  59. import {reservDet} from "@/api/work/people.js"
  60. var key='';
  61. // #ifdef H5
  62. key='8de52b560193f01932ad997dba3e76c0'
  63. // #endif
  64. // #ifdef APP-PLUS
  65. key='8de52b560193f01932ad997dba3e76c0'
  66. // #endif
  67. // #ifdef MP-WEIXIN
  68. key='8de52b560193f01932ad997dba3e76c0'
  69. // #endif
  70. export default{
  71. components:{},
  72. data(){
  73. return{
  74. check: require('@/mine/static/check.png'),
  75. ncheck: require('@/mine/static/ncheck.png'),
  76. mapimg: require("@/work/static/visitor/adr.png"),
  77. nvaHeight:44,
  78. checkflag:false,
  79. backgroundColor: "transparent",
  80. baseUrl:config.baseUrl,
  81. mapContext:'',
  82. center:{
  83. lng:'',
  84. lat:'',
  85. },
  86. covers:[],
  87. // covers: [{
  88. // id:0,
  89. // latitude: '31.839676',
  90. // longitude: '117.211954',
  91. // width:18, //宽
  92. // height:19, //高
  93. // iconPath: require("@/work/static/visitor/adr.png"),
  94. // anchor:{x: 0.5, y: 0.5}
  95. // }],
  96. id:'',
  97. datainfo:{},
  98. }
  99. },
  100. onLoad: function(e) {
  101. uni.getSystemInfo({
  102. success: (e) => {
  103. this.nvaHeight = Number(e.statusBarHeight)+44;
  104. }
  105. })
  106. if(e.id){
  107. this.id=e.id;
  108. this.getDetail()
  109. }
  110. if(e.cflag=='1'){
  111. this.checkflag=true;
  112. }else{
  113. this.checkflag=false;
  114. }
  115. if(this.checkflag){
  116. this.getcreateMap()
  117. }
  118. },
  119. onReady() {
  120. },
  121. onPageScroll(e) {
  122. var scrollTop = Number(e.scrollTop);
  123. if (scrollTop > 0) {
  124. this.backgroundColor = '#0256FD'
  125. } else {
  126. this.backgroundColor = 'transparent'
  127. }
  128. },
  129. methods:{
  130. checkPermi, checkRole,
  131. getcreateMap(){
  132. //mapId 就是你在 map 标签中定义的 id
  133. this.mapContext = uni.createMapContext('container', this);
  134. },
  135. onClcikImgMap(){
  136. },
  137. getOpenFn(){
  138. },
  139. getBackFn(){
  140. uni.navigateBack({
  141. delta:1
  142. })
  143. },
  144. getPhoneFn(){
  145. uni.makePhoneCall({
  146. phoneNumber: '114' //仅为示例
  147. });
  148. },
  149. async getLocation(address) {
  150. console.log(address,111)
  151. var that=this;
  152. if (!address) {
  153. uni.showToast({ title: '请输入地址', icon: 'none' });
  154. return;
  155. }
  156. try {
  157. const { latitude, longitude } = await geocodeAddress(address, key);
  158. this.center.lat = latitude;
  159. this.center.lng = longitude;
  160. console.log(latitude,longitude)
  161. that.covers = [];
  162. that.covers = [{
  163. id:3,
  164. width:18, //宽
  165. height:19, //高
  166. latitude: latitude,
  167. longitude: longitude,
  168. iconPath: that.mapimg,
  169. anchor:{x: 0.5, y: 0.5}
  170. }]
  171. } catch (error) {
  172. // uni.showToast({ title: '获取经纬度失败', icon: 'none' });
  173. }
  174. },
  175. getDetail(){
  176. reservDet(this.id).then(res=>{
  177. if(res.code==200){
  178. this.datainfo=res.data;
  179. this.chooseValue=res.data.houseId;
  180. if(res.data.detailAddress&&this.checkflag){
  181. this.getLocation(res.data.detailAddress)
  182. }
  183. }
  184. })
  185. },
  186. }
  187. }
  188. </script>
  189. <style>
  190. page{background: #F3F3F0;}
  191. </style>
  192. <style lang="scss" scoped>
  193. .warrbox{min-height: 100vh;background: linear-gradient(180deg, #0256FD 0%,#528AF9 60%, rgba(255,255,255,0) 100%) no-repeat;background-size: 100% 722rpx;padding:0 30rpx 26rpx;}
  194. .rfbga{background: #2ACA8E !important;}
  195. .navbg{width: 100%;height: 722rpx;z-index: 0;}
  196. .navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4; }
  197. .vdmain{z-index: 2;position: relative;background: #FFFFFF;border-radius: 20rpx;flex: 1;padding: 60rpx 26rpx 98rpx;
  198. .line{width: 168rpx;height: 2rpx;
  199. &.lia{background: linear-gradient(270deg, #0256FD 0%, rgba(2,86,253,0) 100%);}
  200. &.lib{background: linear-gradient(90deg, #0256FD 0%, rgba(2,86,253,0) 100%);}
  201. }
  202. .vdtop{font-weight: bold;font-size: 26rpx;color: #272727;margin: 0 32rpx;}
  203. .vdlist{
  204. .list{font-weight: 500;font-size: 26rpx;color: #272727;margin-bottom: 24rpx;}
  205. }
  206. .adrbox{
  207. .tit{font-weight: bold;font-size: 26rpx;color: #272727;}
  208. .txt{font-weight: 500;font-size: 26rpx;color: #666666;line-height: 36rpx;}
  209. .txts{font-weight: 500;font-size: 22rpx;color: #AAAAAA;}
  210. .checkimg{width: 80rpx;height: 40rpx;margin-left: 8rpx;}
  211. }
  212. }
  213. </style>