book-list.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view>
  3. <view class="header">
  4. <image src="../../static/booklist-header.png" mode=""></image>
  5. </view>
  6. <empty top="180" v-if="list.length==0" text="暂无车主"></empty>
  7. <view style="padding-bottom: 150rpx;">
  8. <view @click="toDetail(item.id)" class="mlr-36 mt-30 plr-30 ptb-20" style="box-shadow: 0px 0px 13px 0px rgba(0,194,142, 0.15);" v-for="(item,i) in list"
  9. :key="i">
  10. <view class="text-center blue bold">
  11. {{item.start_time}}
  12. </view>
  13. <view class="flex mt-10">
  14. <view class="">
  15. <text class="gray-2">【车主】</text>{{item.driver_name}}
  16. </view>
  17. <view class="flex1 flex-middle">
  18. <text class="gray-2">【余座】</text>{{item.more_seats}}
  19. <u-icon name="arrow-right" color="rgba(51,51,51,0.3)" size="35"></u-icon>
  20. </view>
  21. </view>
  22. <view class="mt-10">
  23. <text class="gray-2">【车型】</text>{{item.car_type}}
  24. </view>
  25. <view class="flex1 mt-10">
  26. <text class="gray-2">【路线】</text>
  27. <view class="u-flex-1">
  28. {{item.route}}
  29. </view>
  30. </view>
  31. <view class="flex1 mt-10">
  32. <text class="gray-2">【备注】</text>
  33. <view class="u-flex-1">
  34. {{item.remark}}
  35. </view>
  36. </view>
  37. <view class="mt-10">
  38. <text class="gray-2">【评分】</text>
  39. <text class="red">{{item.score}}分</text>
  40. </view>
  41. <view class="flex flex-end mt-20">
  42. <view class="">
  43. 摊费<text class="red">¥{{item.car_price}}</text>/座
  44. </view>
  45. <view class="bg-green white ptb-10 plr-20 ml-20" @click.stop="book(item.id)">
  46. 预订
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <u-loadmore v-show="list.length>9" :status="status" icon-type="flower" bg-color="transperant" margin-top="30"
  52. margin-bottom="30" />
  53. <bookTip class="fixed-bottom"></bookTip>
  54. </view>
  55. </template>
  56. <script>
  57. import {mapState} from 'vuex'
  58. export default {
  59. data() {
  60. return {
  61. list:[],
  62. page:1,
  63. status: 'loadmore',
  64. };
  65. },
  66. computed:{
  67. //...mapState(['start','end','city1','city2'])
  68. ...mapState(['city1', 'city2'])
  69. },
  70. onShow() {
  71. this.page = 1
  72. this.list = []
  73. this.init()
  74. },
  75. mounted() {
  76. uni.setNavigationBarTitle({
  77. title:this.city1+'——'+this.city2
  78. })
  79. },
  80. onPullDownRefresh() {
  81. this.page = 1
  82. this.list = []
  83. this.init()
  84. },
  85. onReachBottom() {
  86. //避免多次触发
  87. if (this.status == 'loading' || this.status == 'nomore') {
  88. return;
  89. }
  90. this.status = "loading";
  91. this.init()
  92. },
  93. methods:{
  94. init(){
  95. this.$http('/addons/ddrive/sforder/order_index',{
  96. order_type:2,
  97. //start_city: this.start.city,
  98. //end_city: this.end.city,
  99. start_city: this.city1,
  100. end_city: this.city2,
  101. page: this.page
  102. },"POST").then(data=>{
  103. console.log(data);
  104. if (data.length < 10) {
  105. this.status = "nomore"
  106. } else {
  107. this.page = this.page + 1
  108. this.status = "loadmore"
  109. }
  110. this.list = this.list.concat(data)
  111. uni.stopPullDownRefresh();
  112. })
  113. },
  114. book(id){
  115. uni.navigateTo({
  116. url:'/pages/shunfeng/confirm-book?id='+id
  117. })
  118. },
  119. toDetail(id){
  120. uni.navigateTo({
  121. url:'/pages/shunfeng/order-detail?id='+id
  122. })
  123. }
  124. }
  125. }
  126. </script>
  127. <style lang="scss">
  128. .header {
  129. image {
  130. width: 100%;
  131. height: 310rpx;
  132. }
  133. }
  134. </style>