daiJiaoDanWeiHuiFei.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view class="container">
  3. <view class="form-box">
  4. <u-form :model="formData.form" ref="formRef" label-width="160" :label-style="{fontWeight: 'bold', fontSize: '26rpx'}">
  5. <u-form-item label="机构名称" prop="name"><u-input v-model="formData.form.name" :border="true" type="text" placeholder="请输入缴交机构名称"/></u-form-item>
  6. <u-form-item label="机构备案证号" prop="number"><u-input v-model="formData.form.number" :border="true" type="text" placeholder="请输入缴交对象机构备案证号"/></u-form-item>
  7. <u-form-item label="缴费年限" prop="year"><u-input v-model="formData.form.year" :border="true" type="select" @click="showYear = true" placeholder="请选择缴费时间"/></u-form-item>
  8. </u-form>
  9. </view>
  10. <u-select v-model="showYear" :list="yearList" @confirm="onYearConfirm"></u-select>
  11. <view class="bottom-box">
  12. <u-button type="error" shape="circle" @click="onSubmit">点击缴费</u-button>
  13. </view>
  14. </view>
  15. </template>
  16. <script setup>
  17. import { ref, reactive } from 'vue'
  18. import { onLoad, onReady } from '@dcloudio/uni-app'
  19. const formRef = ref()
  20. const formData = reactive({
  21. form: {
  22. name: null, // 机构名称
  23. number: null, // 机构备案证号
  24. year: null // 缴费年限
  25. },
  26. rules: {
  27. name: [
  28. {
  29. required: true,
  30. message: '请输入缴交对象机构名称',
  31. // 可以单个或者同时写两个触发验证方式
  32. trigger: 'blur',
  33. }
  34. ],
  35. number: [
  36. {
  37. required: true,
  38. message: '请输入缴交对象机构备案证号',
  39. // 可以单个或者同时写两个触发验证方式
  40. trigger: 'blur',
  41. }
  42. ],
  43. year: [
  44. {
  45. required: true,
  46. message: '请输入缴费年限',
  47. // 可以单个或者同时写两个触发验证方式
  48. trigger: 'change',
  49. }
  50. ],
  51. }
  52. })
  53. const showYear = ref(false)
  54. const yearList = ref([
  55. {
  56. value: '2025',
  57. label: '2025'
  58. },
  59. {
  60. value: '2024',
  61. label: '2024'
  62. }
  63. ])
  64. function onYearConfirm(val) {
  65. formData.form.year = val[0].value
  66. }
  67. function onSubmit() {
  68. formRef.value.validate((valid) => {
  69. if (valid) {
  70. // 查询到的ID
  71. const id = '1'
  72. uni.navigateTo({
  73. url: `/pages/daiJiaoDanWeiChaXunJieGuo/daiJiaoDanWeiChaXunJieGuo?id=${id}`
  74. })
  75. }
  76. })
  77. }
  78. onReady(() => {
  79. formRef.value.setRules(formData.rules)
  80. })
  81. onLoad(() => {
  82. console.log('onLoad')
  83. })
  84. </script>
  85. <style lang="scss" scoped>
  86. .container {
  87. height: 100vh;
  88. width: 100vw;
  89. background-color: $uni-bg-color;
  90. padding: 20rpx;
  91. .form-box {
  92. padding: 20rpx 0;
  93. }
  94. .bottom-box {
  95. margin-top: 100rpx;
  96. padding: 0 50rpx;
  97. }
  98. }
  99. </style>