paotuiMap.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <view v-if="XCXIsSelect == '是'">
  3. <map id="map" style="width: 100%; height: 700px" :latitude="latitude" :longitude="longitude" :markers="markers" :show-location="true"></map>
  4. <cover-view class="controls-title">
  5. <cover-view class="tabs_box">
  6. <cover-image class="pay_img" src="../../static/images/order/avatar.png"></cover-image>
  7. <cover-view class="flex flex-sub margin-left-sm flex-direction justify-between">
  8. <cover-view class="pay_name">骑手预计{{ rider.mDateTime[1] }}送达</cover-view>
  9. <cover-view class="text-gray margin-top" style="margin-top: 5rpx">距离您{{ rider.aDouble }}</cover-view>
  10. </cover-view>
  11. <cover-view class="flex">
  12. <cover-image class="pay_img1 margin-right" @click="goNav" src="../../static/images/order/im.png"></cover-image>
  13. <cover-image class="pay_img1" @click="call" src="../../static/images/order/phone.png"></cover-image>
  14. </cover-view>
  15. </cover-view>
  16. </cover-view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. latitude: '',
  24. longitude: '',
  25. markers: [], //标记点
  26. indentNumber: '',
  27. riderUserId: '',
  28. orderDetails: {},
  29. rider: {},
  30. timer: '',
  31. XCXIsSelect: '是'
  32. }
  33. },
  34. onLoad(option) {
  35. this.XCXIsSelect = this.$queue.getData('XCXIsSelect')
  36. if (this.XCXIsSelect == '否') {
  37. this.getGuize()
  38. uni.setNavigationBarTitle({
  39. title: '隐私政策'
  40. })
  41. } else {
  42. uni.setNavigationBarTitle({
  43. title: '地图'
  44. })
  45. }
  46. this.indentNumber = option.indentNumber
  47. this.getData()
  48. },
  49. onShow() {
  50. this.timer = setInterval(() => {
  51. this.getLocation()
  52. }, 10000)
  53. },
  54. onHide() {
  55. console.log(this.timer, '定时器')
  56. clearInterval(this.timer)
  57. },
  58. methods: {
  59. getData() {
  60. this.$Request.postT('/app/tbindent/userIndentMessage?indentNumber=' + this.indentNumber).then((res) => {
  61. console.log(res)
  62. if (res.code == 0) {
  63. this.orderDetails = res.data
  64. console.log(this.orderDetails.avatar)
  65. let marker = {
  66. id: 1,
  67. latitude: res.data.userLat,
  68. longitude: res.data.userLng,
  69. iconPath: '../../static/images/order/01.png',
  70. width: '40',
  71. height: '40'
  72. }
  73. this.markers.push(marker)
  74. this.riderUserId = this.orderDetails.riderUserId
  75. this.getLocation()
  76. console.log(this.markers)
  77. }
  78. })
  79. },
  80. getLocation() {
  81. let data = {
  82. riderUserId: this.riderUserId,
  83. lat: this.orderDetails.userLat,
  84. lng: this.orderDetails.userLng
  85. }
  86. this.$Request.getT('/timedtask/selectRiderLocation', data).then((res) => {
  87. if (res.code === 0) {
  88. this.latitude = res.data.riderLocation.lat
  89. this.longitude = res.data.riderLocation.lng
  90. this.rider = res.data
  91. this.rider.mDateTime = res.data.mDateTime.split(' ')
  92. if (this.rider.aDouble > 1000) {
  93. this.rider.aDouble = Number(this.rider.aDouble / 1000).toFixed(2) + 'km'
  94. } else {
  95. if (this.rider.aDouble == 0) {
  96. this.rider.aDouble = '0m'
  97. } else {
  98. this.rider.aDouble = Number(this.rider.aDouble).toFixed(1) + 'm'
  99. }
  100. }
  101. let marker = {
  102. id: 2,
  103. latitude: res.data.riderLocation.lat,
  104. longitude: res.data.riderLocation.lng,
  105. iconPath: '../../static/images/order/rider.png',
  106. width: '40',
  107. height: '40'
  108. }
  109. this.markers.push(marker)
  110. }
  111. })
  112. },
  113. call() {
  114. uni.makePhoneCall({
  115. phoneNumber: this.orderDetails.phone
  116. })
  117. },
  118. goNav() {
  119. uni.navigateTo({
  120. url: '/pageA/kefu/kefu'
  121. })
  122. }
  123. }
  124. }
  125. </script>
  126. <style>
  127. .controls-title {
  128. width: 90%;
  129. /* height: 220upx; */
  130. /* line-height: 220upx; */
  131. background: #ffffff;
  132. position: fixed;
  133. bottom: 0rpx;
  134. margin: 40upx;
  135. border-radius: 26upx;
  136. box-shadow: 0upx 30upx 40upx 0upx rgba(187, 170, 163, 0.2);
  137. /* margin: 0 40rpx; */
  138. margin-bottom: 50rpx;
  139. }
  140. .tabs_box {
  141. display: flex;
  142. justify-content: space-between;
  143. align-items: center;
  144. padding: 10rpx;
  145. margin: 20rpx;
  146. }
  147. .pay_tit {
  148. flex: 1;
  149. display: flex;
  150. flex-direction: column;
  151. justify-content: space-between;
  152. }
  153. .pay_img {
  154. width: 100rpx;
  155. height: 100rpx;
  156. border-radius: 10rpx;
  157. }
  158. .pay_img1 {
  159. width: 60rpx;
  160. height: 60rpx;
  161. border-radius: 10rpx;
  162. }
  163. .tabs_bottom {
  164. margin: 0 20rpx 20rpx;
  165. display: flex;
  166. }
  167. .pay_btn {
  168. padding: 5rpx 16rpx;
  169. border: solid 2rpx #999999;
  170. margin-right: 20rpx;
  171. display: flex;
  172. align-items: center;
  173. border-radius: 10rpx;
  174. }
  175. .pay_name {
  176. font-size: 32rpx;
  177. font-weight: bold;
  178. }
  179. .pay_line {
  180. height: 2rpx;
  181. background-color: #afafaf;
  182. margin: 10rpx 0;
  183. }
  184. </style>