bindCompanies.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <!-- @format -->
  2. <template>
  3. <view class="container">
  4. <u-form ref="uForm" :model="form" labelWidth="160" labelPosition="top">
  5. <u-form-item label="绑定人真实姓名">
  6. <u-input disabled :value="form.name"></u-input>
  7. </u-form-item>
  8. <u-form-item label="绑定账号">
  9. <u-input disabled :value="form.userName"> </u-input>
  10. </u-form-item>
  11. <u-form-item label="单位统一社会信用代码" prop="mechanismName">
  12. <u-input
  13. :required="true"
  14. placeholder="请输入单位的信用代码"
  15. v-model="form.mechanismName"
  16. ></u-input>
  17. </u-form-item>
  18. <u-form-item label="单位管理码" prop="mechanismPassword">
  19. <u-input
  20. :required="true"
  21. placeholder="请输入单位管理码"
  22. v-model="form.mechanismPassword"
  23. ></u-input>
  24. </u-form-item>
  25. <u-form-item>
  26. <u-button @click="onSubmit" type="primary">提交</u-button>
  27. </u-form-item>
  28. </u-form>
  29. </view>
  30. </template>
  31. <script>
  32. import { userBindMechanism } from "@/api/personRegistered";
  33. export default {
  34. data() {
  35. return {
  36. form: {
  37. name: "",
  38. password: "", //注册密码
  39. mechanismName: "", //社会代码
  40. mechanismPassword: "", //单位管理码
  41. userName: "", //个人账号
  42. },
  43. rules: {
  44. mechanismName: [
  45. {
  46. required: true,
  47. message: "社会代码不能为空",
  48. trigger: "blur",
  49. },
  50. ],
  51. mechanismPassword: [
  52. {
  53. required: true,
  54. message: "单位管理码不能为空",
  55. trigger: "blur",
  56. },
  57. ],
  58. },
  59. };
  60. },
  61. onReady() {
  62. //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
  63. this.$refs.uForm.setRules(this.rules);
  64. },
  65. onLoad(options) {
  66. this.form.name = options.name;
  67. this.form.userName = options.idNum;
  68. this.form.password = options.password;
  69. },
  70. methods: {
  71. onSubmit() {
  72. this.$refs.uForm.validate().then((res) => {
  73. uni.showLoading({
  74. title: "提交中...",
  75. });
  76. userBindMechanism(this.form).then(() => {
  77. uni.showToast({
  78. title: "提交成功",
  79. duration: 2000,
  80. });
  81. uni.navigateBack({
  82. delta: 2,
  83. });
  84. });
  85. });
  86. },
  87. },
  88. };
  89. </script>
  90. <style lang="scss">
  91. .container {
  92. height: 100vh;
  93. background: rgb(248, 249, 250);
  94. padding: 30rpx;
  95. }
  96. </style>