confirm-book.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <view>
  3. <u-cell-item title="手机号码" class="active">
  4. <view slot="right-icon" class="input">
  5. <input type="text" v-model="tel" maxlength="11" placeholder="请填写手机号"/>
  6. </view>
  7. </u-cell-item>
  8. <u-cell-item title="预订座位" :class="[seat?'active':'']" :value="seat?seat:'请选择预订座位'" @click="show=true"></u-cell-item>
  9. <u-cell-item title="上车点(留言)">
  10. <view slot="right-icon" class="input">
  11. <input type="text" v-model="message" placeholder="如:人民路与建设路交叉口"/>
  12. </view>
  13. </u-cell-item>
  14. <view style="margin-top: 580rpx;">
  15. <view class="mlr-36 mb-20 flex_l size-26">
  16. <u-radio-group active-color="#00C28E" @change="radioGroupChange">
  17. <u-radio name="1" :label-disabled="false"></u-radio>
  18. </u-radio-group>
  19. <view class="">
  20. <text class="gray-2">我已阅读并同意</text>
  21. <text class="blue" @click="goDetails(16,'合乘协议')">《合乘协议》</text>
  22. </view>
  23. </view>
  24. <view class="mlr-36">
  25. <u-button type="primary" :disabled="!tel || !seat " @click="submit">确认预订</u-button>
  26. </view>
  27. <bookTip class="fixed-bottom bg-white"></bookTip>
  28. </view>
  29. <!-- 选择座位 -->
  30. <u-select v-model="show" :list="list" @confirm="confirm"></u-select>
  31. </view>
  32. </template>
  33. <script>
  34. import {mapState} from 'vuex'
  35. export default {
  36. data() {
  37. return {
  38. id:'',
  39. tel:'',
  40. seat:'',
  41. message:'',
  42. radio:'',
  43. show:false,
  44. list:[{
  45. value:1,
  46. label:'1人'
  47. },
  48. {
  49. value:2,
  50. label:'2人'
  51. },
  52. {
  53. value:3,
  54. label:'3人'
  55. },
  56. {
  57. value:4,
  58. label:'4人'
  59. },
  60. {
  61. value:5,
  62. label:'5人'
  63. },
  64. {
  65. value:6,
  66. label:'6人'
  67. },
  68. {
  69. value:7,
  70. label:'7人'
  71. }],
  72. };
  73. },
  74. computed:{
  75. ...mapState(['userInfo'])
  76. },
  77. onLoad(option) {
  78. this.id = option.id
  79. this.seat = option.seat
  80. this.tel = this.userInfo.mobile
  81. },
  82. methods:{
  83. radioGroupChange(e){
  84. this.radio = e
  85. },
  86. confirm(e){
  87. this.seat = e[0].label
  88. },
  89. goDetails(id,title){
  90. uni.navigateTo({
  91. url:'/pages/my/details?id='+id+'&title=' + title
  92. })
  93. },
  94. submit(){
  95. if(this.radio){
  96. this.$http('/addons/ddrive/sforder/reserve_order',{
  97. order_id: this.id,
  98. tel: this.tel,
  99. people_num: this.seat.substr(0,1),
  100. remark: this.message
  101. },"POST").then(data=>{
  102. console.log(data);
  103. uni.redirectTo({
  104. url:'/pages/shunfeng/order-detail?id='+data.order_id
  105. })
  106. })
  107. }else{
  108. uni.showToast({
  109. title:'请先同意合乘协议',
  110. icon:'none'
  111. })
  112. }
  113. }
  114. }
  115. }
  116. </script>
  117. <style lang="scss" scoped>
  118. /deep/.u-radio__label{
  119. margin-right: 0;
  120. }
  121. .active{
  122. /deep/.u-cell__value{
  123. color: #333;
  124. }
  125. }
  126. .input{
  127. input{
  128. font-size: 26rpx;
  129. text-align: right;
  130. }
  131. }
  132. </style>