index.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <view>
  3. <view class="box">
  4. <view class="text-bold" style="font-size: 34rpx;">乘车人</view>
  5. <view class="margin-top-xs">
  6. <u-input v-model="phone" type="number" placeholder="手机号" maxlength="11"/>
  7. </view>
  8. <view style="width: 100%;height: 1rpx;background: #E6E6E6;"></view>
  9. <view class="margin-top-sm">
  10. <u-input v-model="name" type="text" placeholder="姓名" />
  11. </view>
  12. </view>
  13. <view class="btn" @click="submit()">确认</view>
  14. <view class="box">
  15. <view class="text-lg text-bold">代叫服务说明</view>
  16. <view class="margin-top-sm" v-html="content"></view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. data() {
  23. return {
  24. phone: '',
  25. name: '',
  26. content: ''
  27. }
  28. },
  29. onLoad() {
  30. this.$Request.getT('/app/common/type/352').then(res => { //代叫服务说明
  31. if (res.code == 0) {
  32. if (res.data && res.data.value) {
  33. this.content = res.data.value
  34. }
  35. }
  36. });
  37. },
  38. onShow() {
  39. if (uni.getStorageSync('daijiao')) {
  40. let data = uni.getStorageSync('daijiao')
  41. this.phone = data.phone
  42. this.name = data.name
  43. }
  44. },
  45. methods: {
  46. submit() {
  47. if (!this.phone) {
  48. uni.showToast({
  49. title: '请输入乘车人手机号',
  50. icon: 'none'
  51. })
  52. return
  53. }
  54. if (!this.name) {
  55. uni.showToast({
  56. title: '请输入乘车人姓名',
  57. icon: 'none'
  58. })
  59. return
  60. }
  61. let data = {
  62. phone: this.phone,
  63. name: this.name
  64. }
  65. uni.setStorageSync('daijiao', data)
  66. uni.navigateBack()
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="less">
  72. page {
  73. background: #F5F5F5;
  74. }
  75. .box {
  76. background: #FFFFFF;
  77. border-radius: 24rpx;
  78. margin: 30rpx;
  79. padding: 30rpx;
  80. }
  81. .btn {
  82. // width: 100%;
  83. height: 98rpx;
  84. background: #346EF6;
  85. border-radius: 16rpx;
  86. display: flex;
  87. align-items: center;
  88. justify-content: center;
  89. margin: 30rpx;
  90. font-size: 32rpx;
  91. font-family: PingFang SC;
  92. font-weight: bold;
  93. color: #FFFFFF;
  94. }
  95. </style>