bybusDetails.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import * as API from '@/apis/my.js'
  2. import Carmap from '@/components/Carmap.vue'
  3. export default {
  4. data() {
  5. return {
  6. id:"",
  7. mapopen:false,
  8. obj:{
  9. driverInfo:{},
  10. shiftInfo:{},
  11. routeInfo:{},
  12. vehicleInfo:{},
  13. },
  14. }
  15. },
  16. methods: {
  17. mapopenBtn(){
  18. this.mapopen=!this.mapopen;
  19. if(this.mapopen){
  20. this.$refs.amap.setMyStyle("width: 100%; height: 340px;")
  21. }else{
  22. this.$refs.amap.setMyStyle("width: 100%; height: 140px;")
  23. }
  24. },
  25. mapdown(){
  26. this.$refs.amap.setUp(this.obj.ticketUpDownLonLat[0]);
  27. this.$refs.amap.setDown(this.obj.ticketUpDownLonLat[1]);
  28. this.$refs.amap.setCenter(this.obj.ticketUpDownLonLat[1]);
  29. },
  30. makePhoneCall(tel){
  31. uni.makePhoneCall({
  32. phoneNumber: tel //仅为示例
  33. });
  34. },
  35. showname(name){
  36. if(!name){
  37. return "";
  38. }
  39. return name.substring(0,1)+'师傅';
  40. },
  41. passengerRecordDetail() {
  42. this.$refs.common.showLoading();
  43. API.passengerRecordDetail(this.id).then((res) => {
  44. this.isLoading=true;
  45. this.obj=res.data;
  46. var point=[];
  47. res.data.routeInfo.mapPath.split("|").forEach((item) => {
  48. var sz = item.split(",");
  49. point.push({
  50. longitude: sz[0],
  51. latitude: sz[1],
  52. })
  53. })
  54. this.$refs.amap.initMap(point, [],this.obj.routeStationLonLat);
  55. this.$refs.common.showLoading(false);
  56. }).catch(error => {
  57. this.$refs.common.showLoading(false,error);
  58. })
  59. }
  60. },
  61. components: {
  62. Carmap
  63. },
  64. onLoad(op) {
  65. this.id=op.id;
  66. },
  67. onReady() {
  68. this.passengerRecordDetail();
  69. },
  70. }