parking.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view>
  3. <u-navbar
  4. title="车辆入场"
  5. title-color="#fff"
  6. :custom-back="customBack"
  7. :border-bottom="false"
  8. back-icon-color="#CCE8FF"
  9. :background="{background: 'linear-gradient(145deg, #41AFF9 0%, #2D8CFB 100%)' }"></u-navbar>
  10. <u-empty class="u-m-t-80" text="暂无车位" mode="data" v-if="roadspaceList.length == 0"></u-empty>
  11. <view class="roadspace-list wrap">
  12. <view class="roadspace-list-item" @click="roadspaceClick(item)" v-for="(item,index) in roadspaceList" :key="index + item.id">
  13. <view class="block">
  14. </view>
  15. <view class="text">{{item.spaceName}}</view>
  16. </view>
  17. <view class="bottom-btn-wrap">
  18. <view class="bottom-btn" @click="openPage('pages/index/index')">返回主页</view>
  19. </view>
  20. </view>
  21. <u-action-sheet :list="actionList" @click="actionClick" v-model="actionShow"></u-action-sheet>
  22. <u-toast ref="uToast" />
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. roadNo:null,//路段编码 ,示例值(RN000000004)
  30. actionList:[
  31. {text: '停车',},
  32. // {text: '查看'}
  33. ],
  34. actionShow:false,
  35. roadspaceList:[],
  36. spaceId:null,
  37. spaceName:'',
  38. }
  39. },
  40. onLoad() {
  41. this.roadNo = this.$store.state.vuex_user.roadList[0].roadNo || '';
  42. this.handleGetRoadspace(this.roadNo);
  43. },
  44. methods:{
  45. customBack(){
  46. this.$u.route({
  47. // type:'switchTab',
  48. url: 'pages/index/index'
  49. });
  50. },
  51. openPage(path) {
  52. console.log('path',path);
  53. this.$u.route({
  54. url: path
  55. })
  56. },
  57. handleGetRoadspace(roadNo){
  58. this.$u.api.getRoadspace({roadNo:this.roadNo,placeStatus:0})
  59. .then(res=>{
  60. // this.$refs.uToast.show({
  61. // title: res.msg,
  62. // type: 'success',
  63. // });
  64. this.roadspaceList = res.data.rows;
  65. console.log('handleGetRoadspace',res)
  66. }).catch(err=>{
  67. if(err.errMsg){
  68. this.$refs.uToast.show({
  69. title: '请检查网络',
  70. type: 'error',
  71. });
  72. return false;
  73. };
  74. this.$refs.uToast.show({
  75. title: err.msg,
  76. type: 'error',
  77. });
  78. console.log('handleGetRoadspace ',err)
  79. });
  80. },
  81. roadspaceClick(roadspace){
  82. this.actionShow = true;
  83. this.spaceId = roadspace.id;
  84. this.spaceName = roadspace.spaceName;
  85. console.log('roadspace',roadspace);
  86. },
  87. actionClick(e){
  88. console.log('actionClick',e);
  89. switch (e){
  90. case 0:
  91. this.$u.route({
  92. url: 'pages/getin/getin',
  93. params: {
  94. spaceId: this.spaceId,
  95. spaceName:this.spaceName,
  96. roadNo:this.roadNo
  97. }
  98. });
  99. break;
  100. case 1:
  101. break;
  102. default:
  103. break;
  104. }
  105. }
  106. }
  107. }
  108. </script>
  109. <style lang="scss">
  110. @import "./parking.scss";
  111. </style>