my-book.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="">
  3. <view class="mlr-36 flex mt-10 ptb-20 plr-30" style="box-shadow: 0px 0px 13px 0px rgba(0,194,142, 0.14);">
  4. <view class="u-flex-1 ptb-30">
  5. <view class="flex1 flex-middle">
  6. <view class="bg-green" style="width: 16rpx;height: 16rpx;border-radius: 50%;"></view>
  7. <view :class="[start.city?'':'gray-2','ml-40']" @click="goSearch(1)">
  8. {{start.city?start.city+'--'+start.name:'请选择出发城市'}}
  9. </view>
  10. </view>
  11. <view class="ml-56 mtb-30" style="height: 1rpx;background: #eee;"></view>
  12. <view class="flex1 flex-middle">
  13. <view class="bg-orange" style="width:16rpx;height: 16rpx;border-radius: 50%;"></view>
  14. <view :class="[end.city?'':'gray-2','ml-40']" @click="goSearch(2)">
  15. {{end.city?end.city+'--'+end.name:'请选择终点城市'}}
  16. </view>
  17. </view>
  18. </view>
  19. <view class="img ml-20">
  20. <image src="../../static/switching-icon.png" mode=""></image>
  21. </view>
  22. </view>
  23. <view class="mlr-36 mt-30" style="box-shadow: 0px 0px 13px 0px rgba(0,194,142, 0.14);">
  24. <u-cell-item title="【出发时间】" :class="[time?'active':'']" :value="time?time:'请选择出发时间'" @click="showTime=true"></u-cell-item>
  25. <u-cell-item title="【预定座位】" :class="[seat?'active':'']" :value="seat?seat:'请选择预定座位'" @click="show=true"></u-cell-item>
  26. <u-cell-item title="【手机号码】">
  27. <view slot="right-icon" class="input">
  28. <input type="text" v-model="tel" maxlength="11" placeholder="请输入手机号"/>
  29. </view>
  30. </u-cell-item>
  31. </view>
  32. <view class="mlr-36 mt-50">
  33. <u-button @click="book" :disabled="!start.city||!end.city||!time||!seat||!tel" type="primary">预约</u-button>
  34. </view>
  35. <view class="plr-36 mt-50">
  36. 温馨提示:
  37. </view>
  38. <view class="plr-36 size-26 mt-15">
  39. 1.拼有提交成功后,系统会为您匹配与您出行时间相符的车主,并实时通知给您。
  40. </view>
  41. <view class="plr-36 size-26 mt-15">
  42. 2.<text class="green">匹配成功,不是预约成功</text>。此功能仅仅是通知提醒功能,拼友还是要自己判断车主路线是否适合自己,并进行预订。
  43. </view>
  44. <!-- 选择时间 -->
  45. <u-popup v-model="showTime" mode="bottom" height="400">
  46. <longDate type="day" :openStatus="true" :getDayNum="7" :chooesMaxDay="7" @select="onSelectTime">
  47. </longDate>
  48. </u-popup>
  49. <!-- 选择座位 -->
  50. <u-select v-model="show" :list="list" @confirm="confirm"></u-select>
  51. </view>
  52. </template>
  53. <script>
  54. import {mapState} from 'vuex'
  55. import longDate from '../../components/long-date/long-date.vue'
  56. import {changeTime} from "../../common/common.js"
  57. export default {
  58. data() {
  59. return {
  60. time:'',
  61. seat:'',
  62. tel:'',
  63. list:[{
  64. value:1,
  65. label:'1人'
  66. },
  67. {
  68. value:2,
  69. label:'2人'
  70. },
  71. {
  72. value:3,
  73. label:'3人'
  74. },
  75. {
  76. value:4,
  77. label:'4人'
  78. },
  79. {
  80. value:5,
  81. label:'5人'
  82. },
  83. {
  84. value:6,
  85. label:'6人'
  86. },
  87. {
  88. value:7,
  89. label:'7人'
  90. }],
  91. show:false,
  92. showTime:false
  93. };
  94. },
  95. components: {
  96. longDate
  97. },
  98. computed:{
  99. ...mapState(['start','end','userInfo'])
  100. },
  101. mounted() {
  102. this.tel=this.userInfo.mobile
  103. if(!this.start.address){
  104. this.$store.commit('getStart', {})
  105. this.$store.commit('getEnd', {})
  106. }
  107. },
  108. methods:{
  109. goSearch(i){
  110. uni.navigateTo({
  111. url:'/pages/home/search?type=' + i
  112. })
  113. },
  114. // 确定时间
  115. onSelectTime(res) {
  116. console.log(res);
  117. if (res.tip) {
  118. uni.showToast({
  119. title: res.tip,
  120. icon: 'none'
  121. })
  122. } else {
  123. this.time = res.time
  124. this.showTime = false
  125. }
  126. },
  127. // 选择预定座位
  128. confirm(e){
  129. console.log(e);
  130. this.seat = e[0].label
  131. },
  132. //预约
  133. book(){
  134. this.$http('/addons/ddrive/sforder/ddriver_create',{
  135. start_address:this.start.address,
  136. start_city:this.start.city,
  137. start_name:this.start.name,
  138. start_latitude:this.start.latitude,
  139. start_longitude:this.start.longitude,
  140. end_city:this.end.city,
  141. end_address:this.end.address,
  142. end_name:this.end.name,
  143. end_latitude:this.end.latitude,
  144. end_longitude:this.end.longitude,
  145. order_type:1,
  146. start_time: changeTime(this.time),
  147. people_num:this.seat.substr(0,1)
  148. }).then((data)=>{
  149. uni.showToast({
  150. title:"预约成功"
  151. })
  152. setTimeout(()=>{
  153. uni.redirectTo({
  154. url:"/pages/shunfeng/order-detail?id="+data.order_id
  155. })
  156. },1000)
  157. })
  158. }
  159. }
  160. }
  161. </script>
  162. <style lang="scss" scoped>
  163. /deep/.u-primary-hover {
  164. background: linear-gradient(to right,#00b6b4,#00d496) !important;
  165. }
  166. /deep/.uni-input-placeholder{
  167. color: #909399;
  168. }
  169. .active{
  170. /deep/.u-cell__value{
  171. color: #333;
  172. }
  173. }
  174. .img {
  175. image {
  176. width: 40rpx;
  177. height: 40rpx;
  178. }
  179. }
  180. .input{
  181. input{
  182. font-size: 26rpx;
  183. text-align: right;
  184. }
  185. }
  186. </style>