sf-index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view>
  3. <!-- <view class="flex">
  4. <view class="img">
  5. <image src="../../static/home-horn.png" mode=""></image>
  6. </view>
  7. <view class="size-26 gray-2">
  8. 617聚合出行日百万补贴优惠券等您来体验!
  9. </view>
  10. </view> -->
  11. <view class="mlr-36 mt-20 ptb-40 plr-30" style="box-shadow: 0px 0px 13px 0px rgba(0,194,142, 0.15);">
  12. <view class="text-center green bold">
  13. 城际顺风车
  14. </view>
  15. <view class="flex mt-20">
  16. <view class="u-flex-1 ptb-30">
  17. <view class="flex1 flex-middle">
  18. <view class="bg-green" style="width: 16rpx;height: 16rpx;border-radius: 50%;"></view>
  19. <view :class="[city1?'':'gray-2','ml-40']" @click="goSearch(1)">
  20. {{city1||'请选择出发城市'}}
  21. </view>
  22. </view>
  23. <view class="ml-56 mtb-30" style="height: 1rpx;background: #eee;"></view>
  24. <view class="flex1 flex-middle">
  25. <view class="bg-orange" style="width: 16rpx;height: 16rpx;border-radius: 50%;"></view>
  26. <view :class="[city2?'':'gray-2','ml-40']" @click="goSearch(2)">
  27. {{city2||'请选择终点城市'}}
  28. </view>
  29. </view>
  30. </view>
  31. <view class="img-switch ml-20" @click="change">
  32. <image src="../../static/switching-icon.png" mode=""></image>
  33. </view>
  34. </view>
  35. <view class="mt-40">
  36. <u-button type="primary" :disabled="!city1 || !city2" @click="search">查询车主</u-button>
  37. </view>
  38. </view>
  39. <swiper :autoplay="true" :interval="5000" :circular="true" v-if="list.length>0">
  40. <swiper-item v-for="(item,i) in list" :key="i" @click="goDetail(item.id)">
  41. <view class="mlr-36 mt-30" style="box-shadow: 0px 0px 13px 0px rgba(0,194,142, 0.15);">
  42. <view class="img-clock plr-36 flex1 flex-middle ptb-20 bb">
  43. <image src="../../static/home-clock.png" mode=""></image>
  44. <text class="ml-15">当前预约</text>
  45. </view>
  46. <view class="plr-36 ptb-30 flex">
  47. <view class="">
  48. <view class="">
  49. {{item.start_city}}
  50. <text class="mlr-10">→</text>
  51. {{item.end_city}}
  52. </view>
  53. <view class="size-26 green mt-10">
  54. {{item.start_time}}
  55. </view>
  56. <view class="size-26 gray-2 mt-10" v-if="item.status*1==1">
  57. 系统持续为您匹配中
  58. </view>
  59. <view class="size-26 gray-2 mt-10" v-if="item.status*1==2">
  60. 待司机确认分摊费用
  61. </view>
  62. <view class="size-26 gray-2 mt-10" v-if="item.status*1==3">
  63. 等待开始行程
  64. </view>
  65. <view class="size-26 gray-2 mt-10" v-if="item.status*1==4">
  66. 正在行程中
  67. </view>
  68. </view>
  69. <view class="green ptb-6 plr-16" style="border: 1rpx solid #00C28E;" v-if="item.status*1==4">
  70. 支付
  71. </view>
  72. <view class="green ptb-6 plr-16" style="border: 1rpx solid #00C28E;" v-if="item.status*1==3">
  73. 待出发
  74. </view>
  75. <view class="green ptb-6 plr-16" style="border: 1rpx solid #00C28E;" v-if="item.status*1==2">
  76. 待确认
  77. </view>
  78. <view class="green ptb-6 plr-16" style="border: 1rpx solid #00C28E;" v-if="item.status*1==1">
  79. {{item.order_type==1?'取消预订':'预订'}}
  80. </view>
  81. </view>
  82. </view>
  83. </swiper-item>
  84. </swiper>
  85. <view class="plr-36 size-34 mt-20 bold">
  86. 推荐路线
  87. </view>
  88. <view class="plr-80 flex flex-wrap pb-50">
  89. <view class="mt-30" style="width: 40%;" v-for="(item,i) in line" :key="i" @click="clickLine(item)">
  90. <view :class="[i%2!=0?'text-right':'']">
  91. {{item}}
  92. <!-- 杭州市
  93. <text class="mlr-10">→</text>
  94. 郑州市 -->
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. </template>
  100. <script>
  101. import {mapState} from 'vuex'
  102. export default {
  103. data() {
  104. return {
  105. list:[],
  106. line:[],
  107. };
  108. },
  109. computed: {
  110. ...mapState(['city1', 'city2'])
  111. },
  112. mounted() {
  113. this.init()
  114. this.getLine()
  115. },
  116. methods: {
  117. init() {
  118. this.$http('/addons/ddrive/sforder/index_order', "POST").then(data => {
  119. // console.log(data);
  120. this.list = data
  121. })
  122. },
  123. getLine(){
  124. this.$http('/addons/ddrive/sforder/recommend_route', "POST").then(data => {
  125. // console.log(data);
  126. this.line = data
  127. })
  128. },
  129. goSearch(i) {
  130. uni.navigateTo({
  131. url: '/pages/home/search?type=' + i
  132. })
  133. },
  134. goDetail(id){
  135. uni.navigateTo({
  136. url:'/pages/shunfeng/order-detail?id=' + id
  137. })
  138. },
  139. change() {
  140. let start = this.city1
  141. let end = this.city2
  142. this.$store.commit('getCity1',end)
  143. this.$store.commit('getCity2',start)
  144. },
  145. search() {
  146. uni.navigateTo({
  147. url: '/pages/shunfeng/book-list'
  148. })
  149. },
  150. clickLine(item){
  151. this.$store.commit('getCity1',item.split('->')[0])
  152. this.$store.commit('getCity2',item.split('->')[1])
  153. }
  154. }
  155. }
  156. </script>
  157. <style lang="scss" scoped>
  158. /deep/.u-primary-hover {
  159. background: linear-gradient(to right,#00b6b4,#00d496) !important;
  160. }
  161. /deep/uni-swiper {
  162. height: 340rpx;
  163. }
  164. .img-switch {
  165. image {
  166. width: 40rpx;
  167. height: 40rpx;
  168. }
  169. }
  170. .img {
  171. image {
  172. width: 36rpx;
  173. height: 36rpx;
  174. }
  175. }
  176. .img-clock {
  177. image {
  178. width: 36rpx;
  179. height: 36rpx;
  180. }
  181. }
  182. </style>