xcDetail.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. <template>
  2. <view>
  3. <view style="position: relative;">
  4. <view>
  5. <map id="map" style="width: 100%; height: 46vh;" :latitude="latitude" :longitude="longitude"
  6. :markers="covers" :polyline="polyline">
  7. </map>
  8. </view>
  9. <view class="listbb" v-if="orderList.length > 0">
  10. <scroll-view scroll-y="true" style="width: 750rpx;height: 790rpx;">
  11. <view v-for="(item,index) in orderList" v-if="item.status == 3 || item.status == 4">
  12. <view class="boxa">
  13. <view class="flex align-center justify-between" style="padding: 30rpx 0rpx 0rpx 30rpx;">
  14. <view style="font-weight: bold;">
  15. <view>{{item.appointmentStartTime}}-{{item.appointmentEndTime}}</view>
  16. </view>
  17. </view>
  18. <view class="order_city">
  19. <view class="flex align-center add_name justify-between"
  20. style="margin: 0rpx 0rpx 4rpx;">
  21. <view class="flex align-center">
  22. <view class="green"></view>{{item.shipAddress}}
  23. </view>
  24. <view class="item_juli">{{item.startDistance}}km</view>
  25. </view>
  26. <image src="/static/upload/up.png" class="order_up"></image>
  27. <view class="flex align-center add_name justify-between">
  28. <view class="flex align-center">
  29. <view class="orgin"></view>{{item.deliveryAddress}}
  30. </view>
  31. <view class="item_juli">{{item.endDistance}}km</view>
  32. </view>
  33. <view class="flex align-center justify-between" style="margin-top: 24rpx;">
  34. <view class="flex align-center">
  35. <image src="/static/upload/person.png" style="width: 30rpx;height: 31rpx;">
  36. </image>
  37. <view style="margin-left: 16rpx;" class="add_name">
  38. {{item.appointmentNum}}人乘坐·{{item.appointmentType == 1 ? '独享' : '拼车'}}
  39. </view>
  40. </view>
  41. <view class="item_juli">订单里程{{item.kmDistance}}km</view>
  42. </view>
  43. </view>
  44. <view class="margin-tb-sm" style="width: 100%;height:1rpx;background: #F2F2F2;"></view>
  45. <view class="flex align-center justify-between padding-lr ">
  46. <view class="flex align-center" @click="bindPhone()">
  47. <view>
  48. <view class="">{{item.shipUserName}}</view>
  49. <!-- <view class="margin-top-xs">{{item.shipUserPhones}}</view> -->
  50. </view>
  51. <view class="flex margin-left-sm">
  52. <image src="/my/static/phone.png" style="width: 22rpx;height: 30rpx;">
  53. </image>
  54. </view>
  55. </view>
  56. <view style="color: #FF2020;font-size: 32rpx;font-weight: bold;">
  57. <text>¥</text><text style="font-size: 42rpx;">{{item.driveMoney}}</text>
  58. </view>
  59. </view>
  60. </view>
  61. <!-- <view class="boxs" style="margin-top: 28rpx;">
  62. <view class="flex align-center justify-between padding-lr">
  63. <view class="flex align-center">
  64. <image src="/static/image/shifuAvatar.png"
  65. style="width: 90rpx;height: 90rpx;border-radius: 50rpx;">
  66. </image>
  67. <view class="margin-left-sm">
  68. <view class="">{{item.shipUserName}}</view>
  69. <view class="margin-top-xs">{{item.shipUserPhones}}</view>
  70. </view>
  71. </view>
  72. <view class="flex" v-if="item.status == 3">
  73. <image src="/my/static/phone.png" @click="bindPhone()"
  74. style="width: 32rpx;height: 40rpx;">
  75. </image>
  76. </view>
  77. </view>
  78. </view> -->
  79. </view>
  80. </scroll-view>
  81. </view>
  82. </view>
  83. </view>
  84. </template>
  85. <script>
  86. import QQMapWX from '@/components/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.js'
  87. export default {
  88. data() {
  89. return {
  90. orderList: [],
  91. latitude: '',
  92. longitude: '',
  93. qqmapsdk: {}, // 腾讯地图小程序的SDK
  94. covers: [], // 地图上面的标记点
  95. to: { // 目的地坐标
  96. latitude: '',
  97. longitude: '',
  98. },
  99. polyline: [], //路线
  100. polylines: '',
  101. driverRouteId: '',
  102. indentNumber: '',
  103. order: {
  104. appointmentStartTime: ''
  105. },
  106. isVip: false,
  107. waypointsList: [],
  108. waypoints: '', //途径点
  109. }
  110. },
  111. onLoad(option) {
  112. // 实例化API核心类
  113. // DU7BZ-S6GCJ-Y46FR-XIEGB-4EKBZ-ZMFA4
  114. this.$Request.getT('/app/common/type/282').then(res => { //师傅端腾讯地图key
  115. if (res.code === 0) {
  116. this.qqmapsdk = new QQMapWX({
  117. key: res.data.value // 自己申请的key值
  118. })
  119. }
  120. });
  121. if (option.driverRouteId) {
  122. this.driverRouteId = option.driverRouteId;
  123. this.selectDriverRouteByUserId();
  124. }
  125. },
  126. onShow() {},
  127. methods: {
  128. //获取我的行程
  129. selectDriverRouteByUserId() {
  130. let data = {
  131. userId: uni.getStorageSync('userId'),
  132. driverRouteId: this.driverRouteId
  133. }
  134. this.$Request.getT('/app/driverRoute/selectDriverRouteById', data).then(res => {
  135. if (res.code == 0 && res.data) {
  136. let from = {
  137. lat: res.data.shipAddressLatitude,
  138. lng: res.data.shipAddressLongitude,
  139. address: res.data.shipAddress,
  140. }
  141. let to = {
  142. lat: res.data.deliveryAddressLatitude,
  143. lng: res.data.deliveryAddressLongitude,
  144. address: res.data.deliveryAddress,
  145. }
  146. this.waypointsList = [from, to]
  147. console.log(this.waypointsList, '4444444')
  148. this.latitude = res.data.shipAddressLatitude
  149. this.longitude = res.data.shipAddressLongitude
  150. this.to.latitude = res.data.deliveryAddressLatitude
  151. this.to.longitude = res.data.deliveryAddressLongitude
  152. this.getMyOrderListByRounteId();
  153. } else {
  154. this.getMyOrderListByRounteId();
  155. }
  156. })
  157. },
  158. // 一键导航
  159. openMap(latitude, longitude, name) {
  160. uni.openLocation({
  161. latitude: latitude - 0, //要去的纬度-地址
  162. longitude: longitude - 0, //要去的经度-地址
  163. name: name, //地址名称
  164. address: name, //详细地址名称
  165. success: function() {
  166. console.log('导航成功');
  167. },
  168. fail: function(error) {
  169. console.log(error)
  170. }
  171. });
  172. },
  173. bindPhone() {
  174. uni.makePhoneCall({
  175. phoneNumber: this.order.shipUserPhone //仅为示例
  176. });
  177. },
  178. getMyOrderListByRounteId() {
  179. let driverId = this.$queue.getData('driverId');
  180. if (!driverId) {
  181. return;
  182. }
  183. let userId = this.$queue.getData('userId');
  184. let latitude = uni.getStorageSync('latitude');
  185. let longitude = uni.getStorageSync('longitude');
  186. let data = {
  187. page: 1,
  188. limit: 10,
  189. latitude: latitude,
  190. longitude: longitude,
  191. driverUserId: userId,
  192. appointmentType: '',
  193. driverRouteIds: this.driverRouteId,
  194. driverRouteId: this.driverRouteId,
  195. status: '',
  196. driverId: driverId,
  197. sort: 3
  198. }
  199. let that = this;
  200. this.$Request.getT('/app/orders/selectOrdersList', data).then(res => {
  201. uni.hideLoading()
  202. if (res.code == 0) {
  203. this.order = res.data.list[0]
  204. this.orderList = res.data.list
  205. let waypoints = ''
  206. let dData = {
  207. id: 1,
  208. latitude: that.waypointsList[0].lat,
  209. longitude: that.waypointsList[0].lng,
  210. iconPath: '../../static/image/qi.png',
  211. width: 32,
  212. height: 44,
  213. callout: { //自定义标记点上方的气泡窗口 点击有效
  214. content: that.waypointsList[0].address, //文本
  215. color: '#333333', //文字颜色
  216. fontSize: 10, //文本大小
  217. padding: 10, //附近留白
  218. borderRadius: 6, //边框圆角
  219. bgColor: '#FFFFFF', //背景颜色
  220. display: 'ALWAYS', //常显
  221. },
  222. }
  223. that.covers = []
  224. that.covers.push(dData)
  225. res.data.list.forEach((d,index) => {
  226. // waypoints: that.latitude + ',' + that.longitude + ';' + that.to.latitude + ',' + that.to
  227. // .longitude, //客户的位置是途径点
  228. // latitude: this.order.shipAddressLatitude,
  229. // longitude: this.order.shipAddressLongitude,
  230. // latitude: this.order.deliveryAddressLatitude,
  231. // longitude: this.order.deliveryAddressLongitude,
  232. let dDatas = {
  233. id: index + 2,
  234. latitude: d.shipAddressLatitude,
  235. longitude: d.shipAddressLongitude,
  236. iconPath: '../../static/image/qi.png',
  237. width: 32,
  238. height: 44,
  239. callout: { //自定义标记点上方的气泡窗口 点击有效
  240. content: d.shipAddress, //文本
  241. color: '#333333', //文字颜色
  242. fontSize: 10, //文本大小
  243. padding: 10, //附近留白
  244. borderRadius: 6, //边框圆角
  245. bgColor: '#FFFFFF', //背景颜色
  246. display: 'ALWAYS', //常显
  247. },
  248. }
  249. that.covers.push(dDatas)
  250. dDatas = {
  251. id: index + 3,
  252. latitude: d.deliveryAddressLatitude,
  253. longitude: d.deliveryAddressLongitude,
  254. iconPath: '../../static/image/zd.png',
  255. // iconPath: '../../static/logo.png',
  256. width: 32,
  257. height: 44,
  258. callout: { //自定义标记点上方的气泡窗口 点击有效
  259. content: d.deliveryAddress, //文本
  260. color: '#333333', //文字颜色
  261. fontSize: 10, //文本大小
  262. padding: 10, //附近留白
  263. borderRadius: 6, //边框圆角
  264. bgColor: '#FFFFFF', //背景颜色
  265. display: 'ALWAYS', //常显
  266. },
  267. }
  268. that.covers.push(dDatas)
  269. if (waypoints) {
  270. waypoints = waypoints + ';' + d.shipAddressLatitude + ',' + d.shipAddressLongitude + ';' + d.deliveryAddressLatitude + ',' + d.deliveryAddressLongitude
  271. } else {
  272. waypoints = d.shipAddressLatitude + ',' + d.shipAddressLongitude + ';' + d.deliveryAddressLatitude + ',' + d.deliveryAddressLongitude
  273. }
  274. });
  275. // console.log(this.covers)
  276. dData = {
  277. id: this.covers.length + 1,
  278. latitude: that.waypointsList[1].lat,
  279. longitude: that.waypointsList[1].lng,
  280. iconPath: '../../static/image/zd.png',
  281. width: 32,
  282. height: 44,
  283. callout: { //自定义标记点上方的气泡窗口 点击有效
  284. content: that.waypointsList[1].address, //文本
  285. color: '#333333', //文字颜色
  286. fontSize: 10, //文本大小
  287. padding: 10, //附近留白
  288. borderRadius: 6, //边框圆角
  289. bgColor: '#FFFFFF', //背景颜色
  290. display: 'ALWAYS', //常显
  291. },
  292. }
  293. this.covers.push(dData)
  294. this.routePlanning(waypoints)
  295. }
  296. });
  297. },
  298. getorderDet() {
  299. let userId = this.$queue.getData('userId');
  300. let driverRouteId = this.$queue.getData('driverRouteId')
  301. let data = {
  302. ordersId: this.indentNumber,
  303. driverRouteId: driverRouteId,
  304. driverRouteId: this.driverRouteId,
  305. driverUserId: userId
  306. }
  307. this.$Request.getT('/app/orders/selectOrdersDetails', data).then(res => {
  308. if (res.code === 0) {
  309. this.order = res.data
  310. // if (this.order.shipUserPhone) {
  311. // let mobile = this.order.shipUserPhone
  312. // this.order.shipPhone = mobile.substring(0, 3) + "****" + mobile.substring(7)
  313. // }
  314. this.latitude = this.order.shipAddressLatitude
  315. this.longitude = this.order.shipAddressLongitude
  316. this.to.latitude = this.order.deliveryAddressLatitude
  317. this.to.longitude = this.order.deliveryAddressLongitude
  318. this.covers = [{
  319. id: 1,
  320. latitude: this.waypointsList[0].lat,
  321. longitude: this.waypointsList[0].lng,
  322. iconPath: '../../static/image/qi.png',
  323. width: 32,
  324. height: 44,
  325. callout: { //自定义标记点上方的气泡窗口 点击有效
  326. content: this.waypointsList[0].address, //文本
  327. color: '#333333', //文字颜色
  328. fontSize: 10, //文本大小
  329. padding: 10, //附近留白
  330. borderRadius: 6, //边框圆角
  331. bgColor: '#FFFFFF', //背景颜色
  332. display: 'ALWAYS', //常显
  333. },
  334. }, {
  335. id: 2,
  336. latitude: this.order.shipAddressLatitude,
  337. longitude: this.order.shipAddressLongitude,
  338. iconPath: '../../static/image/qi.png',
  339. // iconPath: '../../static/logo.png',
  340. width: 32,
  341. height: 44,
  342. callout: { //自定义标记点上方的气泡窗口 点击有效
  343. content: this.order.shipAddress, //文本
  344. color: '#333333', //文字颜色
  345. fontSize: 10, //文本大小
  346. padding: 10, //附近留白
  347. borderRadius: 6, //边框圆角
  348. bgColor: '#FFFFFF', //背景颜色
  349. display: 'ALWAYS', //常显
  350. },
  351. }, {
  352. id: 3,
  353. latitude: this.order.deliveryAddressLatitude,
  354. longitude: this.order.deliveryAddressLongitude,
  355. iconPath: '../../static/image/zd.png',
  356. // iconPath: '../../static/logo.png',
  357. width: 32,
  358. height: 44,
  359. callout: { //自定义标记点上方的气泡窗口 点击有效
  360. content: this.order.deliveryAddress, //文本
  361. color: '#333333', //文字颜色
  362. fontSize: 10, //文本大小
  363. padding: 10, //附近留白
  364. borderRadius: 6, //边框圆角
  365. bgColor: '#FFFFFF', //背景颜色
  366. display: 'ALWAYS', //常显
  367. },
  368. }, {
  369. id: 4,
  370. latitude: this.waypointsList[1].lat,
  371. longitude: this.waypointsList[1].lng,
  372. iconPath: '../../static/image/zd.png',
  373. width: 32,
  374. height: 44,
  375. callout: { //自定义标记点上方的气泡窗口 点击有效
  376. content: this.waypointsList[1].address, //文本
  377. color: '#333333', //文字颜色
  378. fontSize: 10, //文本大小
  379. padding: 10, //附近留白
  380. borderRadius: 6, //边框圆角
  381. bgColor: '#FFFFFF', //背景颜色
  382. display: 'ALWAYS', //常显
  383. },
  384. }]
  385. // this.polylines = this.order.polyline
  386. this.routePlanning(waypoints)
  387. } else {
  388. uni.showModal({
  389. title: '温馨提示',
  390. content: '当前订单已结束!',
  391. showCancel: false,
  392. confirmText: '确认',
  393. success: res => {
  394. uni.navigateBack();
  395. }
  396. });
  397. }
  398. });
  399. },
  400. // 步行路线规划
  401. routePlanning(waypoints) {
  402. let that = this
  403. // latitude: that.latitude,
  404. // longitude: that.longitude
  405. console.log(that.latitude + ',' + that.longitude + ';' + that.to.latitude + ',' + that.to
  406. .longitude, '2222222')
  407. that.qqmapsdk.direction({
  408. mode: 'driving', // 驾车
  409. from: { // 起始位置(当前位置)坐标
  410. latitude: that.waypointsList[0].lat,
  411. longitude: that.waypointsList[0].lng
  412. },
  413. waypoints: waypoints,
  414. // waypoints: that.latitude + ',' + that.longitude + ';' + that.to.latitude + ',' + that.to
  415. // .longitude, //客户的位置是途径点
  416. to: {
  417. latitude: that.waypointsList[1].lat,
  418. longitude: that.waypointsList[1].lng,
  419. }, // 目的地位置坐标(我的终点)
  420. success(res) {
  421. console.log(res, '=======')
  422. // var coors = JSON.parse(that.polylines)
  423. // console.log(coors,'11111111111111')
  424. var coors = res.result.routes[0].polyline
  425. // console.log(coors2,'11111111111111')
  426. var pl = [] // 点串数组
  427. // 坐标解压(返回的点串坐标,通过前向差分进行压缩)
  428. var kr = 1000000
  429. for (var i = 2; i < coors.length; i++) {
  430. coors[i] = Number(coors[i - 2]) + Number(coors[i]) / kr
  431. }
  432. // 将解压后的坐标放入点串数组pl中
  433. for (var i = 0; i < coors.length; i += 2) {
  434. pl.push({
  435. latitude: coors[i],
  436. longitude: coors[i + 1]
  437. })
  438. }
  439. console.log(pl,'plplplplpl')
  440. // 设置polyline属性,将路线显示出来,将解压坐标第一个数据作为起点
  441. that.polyline = [{
  442. points: pl,
  443. color: '#346EF6',
  444. width: 4
  445. }]
  446. },
  447. fail(e) {
  448. console.log(e)
  449. },
  450. })
  451. }
  452. }
  453. }
  454. </script>
  455. <style lang="less">
  456. page {
  457. background: #F5F5F5;
  458. }
  459. .boxs {
  460. background: #FFFFFF;
  461. border-radius: 24rpx;
  462. margin: 30rpx;
  463. padding: 30rpx 0;
  464. }
  465. .item_shunlu {
  466. width: 210rpx;
  467. height: 80rpx;
  468. background: #EFF4FF;
  469. border-radius: 0px 24rpx 0px 50rpx;
  470. text-align: center;
  471. line-height: 80rpx;
  472. font-family: Source Han Sans CN;
  473. font-weight: bold;
  474. font-size: 32rpx;
  475. color: #346EF6;
  476. }
  477. .order_city {
  478. padding: 10rpx 30rpx 10rpx;
  479. font-weight: bold;
  480. color: #1A1A1A;
  481. }
  482. .order_up {
  483. width: 6rpx;
  484. height: 24rpx;
  485. margin-left: 16rpx;
  486. }
  487. .listbb {
  488. position: absolute;
  489. left: 0;
  490. right: 0;
  491. /* #ifdef H5 */
  492. top: 700rpx;
  493. /* #endif */
  494. /* #ifndef H5 */
  495. top: 670rpx;
  496. /* #endif */
  497. }
  498. .boxa {
  499. background: #FFFFFF;
  500. border-radius: 24rpx;
  501. margin: 30rpx;
  502. padding: 0rpx 0rpx 30rpx;
  503. }
  504. .addbox {
  505. display: flex;
  506. align-items: center;
  507. justify-content: space-between;
  508. padding: 0 30rpx;
  509. height: 110rpx;
  510. border-radius: 16rpx;
  511. }
  512. .add_cont {
  513. display: flex;
  514. align-items: center;
  515. }
  516. .add_tit {
  517. font-size: 30rpx;
  518. font-family: PingFang SC;
  519. font-weight: bold;
  520. color: #333333;
  521. }
  522. .bg {
  523. background: #F5F5F5;
  524. }
  525. .bgs {
  526. background: #F5F8FF;
  527. }
  528. .remkbtn {
  529. width: 100%;
  530. height: 98rpx;
  531. background: #346EF6;
  532. border-radius: 16rpx;
  533. font-size: 28rpx;
  534. font-family: PingFang SC;
  535. font-weight: bold;
  536. color: #FFFFFF;
  537. display: flex;
  538. align-items: center;
  539. justify-content: center;
  540. line-height: 98rpx;
  541. margin-top: 40rpx;
  542. }
  543. .green {
  544. width: 16rpx;
  545. height: 16rpx;
  546. background: #1FC657;
  547. border-radius: 50%;
  548. margin-right: 20rpx;
  549. margin-left: 10rpx;
  550. }
  551. .orgin {
  552. width: 16rpx;
  553. height: 16rpx;
  554. background: #FBAC04;
  555. border-radius: 50%;
  556. margin-right: 20rpx;
  557. margin-left: 10rpx;
  558. }
  559. .user {
  560. background: #FFFFFF;
  561. border-radius: 24rpx;
  562. padding: 30rpx;
  563. margin: 30rpx;
  564. display: flex;
  565. align-items: center;
  566. }
  567. .btn {
  568. width: 690rpx;
  569. height: 100rpx;
  570. background: #346EF6;
  571. border-radius: 24rpx;
  572. font-size: 28rpx;
  573. font-family: PingFang SC;
  574. font-weight: bold;
  575. color: #FFFFFF;
  576. display: flex;
  577. align-items: center;
  578. justify-content: center;
  579. margin: 0 auto;
  580. }
  581. .item_juli {
  582. font-family: PingFang SC;
  583. font-weight: 500;
  584. font-size: 26rpx;
  585. color: #999999;
  586. }
  587. </style>