paotuiMap.vue 4.8 KB

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