orderMap.vue 6.1 KB

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