registration.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <!-- 登记 -->
  3. <view class="content main">
  4. <app-header @back="back">扫码登记</app-header>
  5. <view>
  6. <u-cell title="选择粮库" :value="form.orgName" :is-link="true" @click="storehouseSelectShow = true"></u-cell>
  7. <user-info ref="userInfo"></user-info>
  8. <u-button @click="submit" type="primary">提交</u-button>
  9. <u-action-sheet2 :actions="orgList" :closeOnClickOverlay="true" :closeOnClickAction="true" title="选择粮库"
  10. :show="storehouseSelectShow" @select="onOrgSelect" @close="storehouseSelectShow = false">
  11. </u-action-sheet2>
  12. <tabbar></tabbar>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. import { HOME_INDEX, CAR_INDEX, MONITOR_INDEX, LIVE_INDEX } from '@/config/constants'
  18. import userInfo from '@/pages/components/userInfo.vue'
  19. import {
  20. showErr
  21. } from '@/utils/common'
  22. import {
  23. getOrgTypes,
  24. gsqReservationRegisterAdd
  25. } from '@/api/basic'
  26. import appHeader from '@/pages/components/header/header.vue'
  27. import tabbar from '@/pages/components/tabbar.vue'
  28. import uActionSheet2 from '@/components/u-action-sheet/my-action-sheet.vue'
  29. export default {
  30. components: {
  31. userInfo,
  32. appHeader,
  33. tabbar,
  34. uActionSheet2
  35. },
  36. data() {
  37. return {
  38. storehouseSelectShow: false,
  39. orgList: [],
  40. form: {
  41. orgName: null,
  42. orgId: null,
  43. }
  44. }
  45. },
  46. mounted() {
  47. getOrgTypes().then(resp => {
  48. const list = resp.data || list
  49. list.forEach(d => {
  50. d.name = d.orgName
  51. })
  52. this.orgList = resp.data || []
  53. })
  54. },
  55. methods: {
  56. back() {
  57. getApp().globalData.tabIndex = CAR_INDEX
  58. uni.redirectTo({
  59. url: '/pages/carManager/carManager'
  60. })
  61. },
  62. onOrgSelect(data) {
  63. console.log('choose', data);
  64. this.form.orgName = data.orgName
  65. this.form.orgId = data.orgId
  66. },
  67. submit() {
  68. this.$refs.userInfo.getUserInfo().then(info => {
  69. gsqReservationRegisterAdd({
  70. type: 2,
  71. orgId: this.form.orgId,
  72. driverName: info.driverName,
  73. identificationNumber: info.identificationNumber,
  74. mobileNumber: info.mobileNumber,
  75. vehicleType: info.vehicleType,
  76. licensePlateNumber: info.licensePlateNumber,
  77. driverAddress: info.driverAddress,
  78. }).then(resp => {
  79. if (resp.code === 200) {
  80. uni.redirectTo({
  81. url: '/pages/registration/success'
  82. })
  83. }
  84. })
  85. }).catch(err => {
  86. if (err) {
  87. showErr(err)
  88. }
  89. })
  90. }
  91. }
  92. }
  93. </script>
  94. <style>
  95. .main {
  96. background-color: #f0f1f2;
  97. height: 100vh;
  98. }
  99. </style>