vdetail.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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">
  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. <!-- <map
  41. id="container"
  42. class="map"
  43. :latitude="center.lat"
  44. :longitude="center.lng"
  45. @poitap="onClcikImgMap"
  46. @tap="onClcikImgMap"
  47. :markers="covers"
  48. scale="15"
  49. :style="'width: 750rpx;height:' + mapheight + 'px;'"
  50. ></map> -->
  51. </view>
  52. <view class="adrbox mb16">
  53. <view class="tit mb10">房屋地址</view>
  54. <view class="txt">{{datainfo.detailAddress}}{{datainfo.houseAddress}}</view>
  55. </view>
  56. <view class="adrbox">
  57. <view class="flexc mb6">
  58. <view class="tit flex1">共享位置</view>
  59. <view class="flexc" @click="checkflag=!checkflag">
  60. <view class="flex1"></view>
  61. <image :src="check" v-if="checkflag" class="checkimg"></image>
  62. <image :src="ncheck" v-else class="checkimg"></image>
  63. </view>
  64. </view>
  65. <view class="txts">打开即确认将位置共享于被分享者</view>
  66. </view>
  67. </view>
  68. <!-- #ifdef APP-PLUS -->
  69. <!-- <view class="rhbtn mt30" @click="getShareFn">分享</view> -->
  70. <!-- #endif -->
  71. <!-- #ifdef MP-WEIXIN -->
  72. <button open-type="share" class="rhbtn mt30">分享</button>
  73. <!-- #endif -->
  74. <!-- <button class="rhbtn mt30" @click="getShareFn">分享</button> -->
  75. <!-- <view class="rhbtn mt30" @click="getShareFn">分享</view> -->
  76. <!-- <view class="rhbtn mt30" @click="getPutFn">修改</view> -->
  77. </view>
  78. <loading></loading>
  79. </view>
  80. </template>
  81. <script>
  82. import config from '@/config'
  83. const baseUrl = config.baseUrl
  84. import {geocodeAddress} from '@/utils/common.js'
  85. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  86. import {reservDet} from "@/api/work/people.js"
  87. var key='';
  88. // #ifdef H5
  89. key='8de52b560193f01932ad997dba3e76c0'
  90. // #endif
  91. // #ifdef APP-PLUS
  92. key='8de52b560193f01932ad997dba3e76c0'
  93. // #endif
  94. // #ifdef MP-WEIXIN
  95. key='8de52b560193f01932ad997dba3e76c0'
  96. // #endif
  97. export default{
  98. components:{},
  99. data(){
  100. return{
  101. check: require('@/mine/static/check.png'),
  102. ncheck: require('@/mine/static/ncheck.png'),
  103. mapimg: require("@/work/static/visitor/adr.png"),
  104. nvaHeight:44,
  105. checkflag:false,
  106. backgroundColor: "transparent",
  107. baseUrl:config.baseUrl,
  108. mapContext:'',
  109. center:{
  110. lng:'',
  111. lat:'',
  112. },
  113. covers:[],
  114. // covers: [{
  115. // id:0,
  116. // latitude: '31.839676',
  117. // longitude: '117.211954',
  118. // width:18, //宽
  119. // height:19, //高
  120. // iconPath: require("@/work/static/visitor/adr.png"),
  121. // anchor:{x: 0.5, y: 0.5}
  122. // }],
  123. id:'',
  124. datainfo:{}
  125. }
  126. },
  127. onLoad: function(e) {
  128. uni.getSystemInfo({
  129. success: (e) => {
  130. this.nvaHeight = Number(e.statusBarHeight)+44;
  131. }
  132. })
  133. if(e.id){
  134. this.id=e.id;
  135. this.getDetail()
  136. }
  137. },
  138. onReady() {
  139. this.getcreateMap()
  140. },
  141. onPageScroll(e) {
  142. var scrollTop = Number(e.scrollTop);
  143. if (scrollTop > 0) {
  144. this.backgroundColor = '#0256FD'
  145. } else {
  146. this.backgroundColor = 'transparent'
  147. }
  148. },
  149. onShareAppMessage(res) {
  150. this.comflag=false;
  151. if (res.from === 'button') {// 来自页面内分享按钮
  152. var data=res.target.dataset;
  153. var newobj={
  154. title: "邀请你来我家",
  155. path: 'http://192.168.101.147:9091'
  156. }
  157. // if(data.img){
  158. // newobj.imageUrl=this.baseUrl+data.img
  159. // }
  160. return newobj
  161. }else{
  162. return {
  163. title: '智能校管家',
  164. path: '/pages/trends/index'
  165. }
  166. }
  167. },
  168. methods:{
  169. checkPermi, checkRole,
  170. getcreateMap(){
  171. //mapId 就是你在 map 标签中定义的 id
  172. this.mapContext = uni.createMapContext('container', this);
  173. },
  174. onClcikImgMap(){
  175. },
  176. getShareFn(){
  177. this.$tab.navigateTo(`/work/pages/visitor/vshare?id=${this.id}&cflag=${this.checkflag}`)
  178. // #ifdef APP-PLUS
  179. uni.shareWithSystem({
  180. summary: '邀请你来我家',
  181. href: 'https://zhsq.qs163.cn/work/pages/visitor/vshare/id='+this.id+'&cflag'+this.checkflag,
  182. success(){
  183. // 分享完成,请注意此时不一定是成功分享
  184. },
  185. fail(){
  186. // 分享失败
  187. }
  188. })
  189. // #endif
  190. },
  191. getPutFn(){
  192. this.$tab.navigateTo("/work/pages/visitor/vadd?id="+this.id)
  193. },
  194. getOpenFn(){
  195. },
  196. getBackFn(){
  197. uni.navigateBack({
  198. delta:1
  199. })
  200. },
  201. getPhoneFn(){
  202. uni.makePhoneCall({
  203. phoneNumber: '114' //仅为示例
  204. });
  205. },
  206. async getLocation(address) {
  207. console.log(address,111)
  208. var that=this;
  209. if (!address) {
  210. uni.showToast({ title: '请输入地址', icon: 'none' });
  211. return;
  212. }
  213. try {
  214. const { latitude, longitude } = await geocodeAddress(address, key);
  215. this.center.lat = latitude;
  216. this.center.lng = longitude;
  217. console.log(latitude,longitude)
  218. that.covers = [];
  219. that.covers = [{
  220. id:3,
  221. width:18, //宽
  222. height:19, //高
  223. latitude: latitude,
  224. longitude: longitude,
  225. iconPath: that.mapimg,
  226. anchor:{x: 0.5, y: 0.5}
  227. }]
  228. } catch (error) {
  229. // uni.showToast({ title: '获取经纬度失败', icon: 'none' });
  230. }
  231. },
  232. getDetail(){
  233. reservDet(this.id).then(res=>{
  234. if(res.code==200){
  235. this.datainfo=res.data;
  236. this.chooseValue=res.data.portalId;
  237. if(res.data.detailAddress){
  238. this.getLocation(res.data.detailAddress)
  239. }
  240. }
  241. })
  242. },
  243. }
  244. }
  245. </script>
  246. <style>
  247. page{background: #F3F3F0;}
  248. </style>
  249. <style lang="scss" scoped>
  250. .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;}
  251. .rfbga{background: #2ACA8E !important;}
  252. .navbg{width: 100%;height: 722rpx;z-index: 0;}
  253. .navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4; }
  254. .vdmain{z-index: 2;position: relative;background: #FFFFFF;border-radius: 20rpx;flex: 1;padding: 60rpx 26rpx 98rpx;
  255. .line{width: 168rpx;height: 2rpx;
  256. &.lia{background: linear-gradient(270deg, #0256FD 0%, rgba(2,86,253,0) 100%);}
  257. &.lib{background: linear-gradient(90deg, #0256FD 0%, rgba(2,86,253,0) 100%);}
  258. }
  259. .vdtop{font-weight: bold;font-size: 26rpx;color: #272727;margin: 0 32rpx;}
  260. .vdlist{
  261. .list{font-weight: 500;font-size: 26rpx;color: #272727;margin-bottom: 24rpx;}
  262. }
  263. .adrbox{
  264. .tit{font-weight: bold;font-size: 26rpx;color: #272727;}
  265. .txt{font-weight: 500;font-size: 26rpx;color: #666666;line-height: 36rpx;}
  266. .txts{font-weight: 500;font-size: 22rpx;color: #AAAAAA;}
  267. .checkimg{width: 80rpx;height: 40rpx;margin-left: 8rpx;}
  268. }
  269. }
  270. </style>