环卫车小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

146 lines
3.3 KiB

7 months ago
  1. <template>
  2. <view class="se-m-20 se-p-20 se-br-10">
  3. <u--form labelPosition="left" :model="form" :rules="rules" ref="uForm" labelWidth="80">
  4. <u-form-item label="类型" prop="type">
  5. <u--input v-model="form.type" placeholder="请填写类型"></u--input>
  6. </u-form-item>
  7. <u-form-item label="车辆型号" prop="model">
  8. <u--input v-model="form.model" placeholder="请填写车辆型号"></u--input>
  9. </u-form-item>
  10. <u-form-item label="年限" prop="date">
  11. <u--input v-model="form.date" placeholder="请填写年限"></u--input>
  12. </u-form-item>
  13. <u-form-item label="公里数" prop="distance">
  14. <u--input v-model="form.distance" placeholder="请填写公里数"></u--input>
  15. </u-form-item>
  16. <u-form-item label="联系人" prop="contacts">
  17. <u--input v-model="form.contacts" placeholder="请填写联系人"></u--input>
  18. </u-form-item>
  19. <u-form-item label="联系电话" prop="phone">
  20. <u--input v-model="form.phone" placeholder="请填写联系电话"></u--input>
  21. </u-form-item>
  22. <u-form-item label="备注" labelPosition="top" prop="remark">
  23. <u--textarea class="se-mt-20" v-model="form.remark" count
  24. placeholder="请填写备注"></u--textarea>
  25. </u-form-item>
  26. <u-form-item>
  27. <view class="se-px-20 se-pt-20">
  28. <view class="se-px-20 se-pb-80 se-fs-20 se-flex">
  29. <view @click="onSubmit"
  30. class="se-mx-10 se-flex-1 se-br-40 se-flex-h-c se-h-80 se-lh-80 se-ta-c se-fs-28 se-c-white se-bgc-green">
  31. <text>确认申请</text>
  32. </view>
  33. </view>
  34. </view>
  35. </u-form-item>
  36. </u--form>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. components:{
  42. },
  43. data() {
  44. return {
  45. form: {
  46. type:"",//类型
  47. model:"",//车辆型号
  48. date:"",//时间
  49. distance:"",//距离
  50. price:"",//价格
  51. contacts:"",//联系人
  52. phone:"",//联系人电话
  53. remark:"",//备注
  54. },
  55. rules: {
  56. type:[
  57. {
  58. type: 'string',
  59. required: true,
  60. message: '请填写类型',
  61. trigger: ['blur', 'change']
  62. }
  63. ],
  64. model:[
  65. {
  66. type: 'string',
  67. required: true,
  68. message: '请选择车辆型号',
  69. trigger: ['blur', 'change']
  70. }
  71. ],
  72. date:[
  73. {
  74. type: 'string',
  75. required: true,
  76. message: '请填写时间',
  77. trigger: ['blur', 'change']
  78. }
  79. ],
  80. distance:[
  81. {
  82. type: 'string',
  83. required: true,
  84. message: '请填写公里数',
  85. trigger: ['blur', 'change']
  86. }
  87. ],
  88. price:[
  89. {
  90. type: 'string',
  91. required: true,
  92. message: '请填写价格',
  93. trigger: ['blur', 'change']
  94. }
  95. ],
  96. contacts:[
  97. {
  98. type: 'string',
  99. required: true,
  100. message: '请填写联系人',
  101. trigger: ['blur', 'change']
  102. }
  103. ],
  104. phone:[
  105. {
  106. type: 'string',
  107. required: true,
  108. message: '请填写联系电话',
  109. trigger: ['blur', 'change']
  110. }
  111. ],
  112. }
  113. }
  114. },
  115. onLoad(options) {
  116. },
  117. watch: {
  118. },
  119. methods: {
  120. onSubmit() {
  121. this.$refs.uForm.validate().then(res => {
  122. uni.$u.toast('校验通过')
  123. }).catch(errors => {
  124. // uni.$u.toast('校验失败')
  125. })
  126. }
  127. },
  128. onReady() {
  129. this.$refs.uForm.setRules(this.rules)
  130. }
  131. }
  132. </script>
  133. <style>
  134. page {
  135. background-color: #f5f5f5 !important;
  136. }
  137. </style>