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.

132 lines
3.1 KiB

10 months ago
  1. <template>
  2. <view>
  3. <u-navbar :title="$t('page.auth.title')" :safeAreaInsetTop="false" placeholder @leftClick="leftClick">
  4. </u-navbar>
  5. <u--form labelPosition="left" :model="userInfo" :rules="rules" class="line" ref="uForm">
  6. <u-form-item :label="$t('page.auth.name')" prop="name" borderBottom labelWidth="80px">
  7. <u--input v-model="userInfo.name" :placeholder="$t('page.auth.name-placeholder')"
  8. border="none"></u--input>
  9. </u-form-item>
  10. <u-form-item :label="$t('page.auth.id-type')" prop="noType" borderBottom labelWidth="80px"
  11. >
  12. <u--input v-model="userInfo.noType" border="none"
  13. :placeholder="$t('page.auth.id-type-placeholder')"></u--input>
  14. <!-- <u-action-sheet :show="showIdType" :actions="idTypeActions" :title="$t('page.auth.id-type-placeholder')"
  15. @close="showIdType = false" @select="idTypeSelect"></u-action-sheet> -->
  16. </u-form-item>
  17. <u-form-item :label="$t('page.auth.id-number')" prop="noNum" borderBottom labelWidth="80px">
  18. <u--input v-model="userInfo.noNum" :placeholder="$t('page.auth.id-number-placeholder')"></u--input>
  19. </u-form-item>
  20. </u--form>
  21. <u-button class="submit" size="large" @click="submit" :text="$t('page.auth.submit')"></u-button>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. data() {
  27. return {
  28. showIdType: false,
  29. idTypeActions: [{
  30. name: '美国通信证',
  31. }, ],
  32. userInfo: {
  33. name: "",
  34. noNum: "",
  35. noType: ""
  36. },
  37. rules: {
  38. 'name': {
  39. type: 'string',
  40. required: true,
  41. message: this.$t('page.auth.name-placeholder'),
  42. trigger: ['blur', 'change']
  43. },
  44. 'noType': {
  45. type: 'string',
  46. required: true,
  47. message: this.$t('page.auth.id-type-placeholder'),
  48. trigger: ['blur', 'change']
  49. },
  50. 'noNum': {
  51. type: 'string',
  52. required: true,
  53. message: this.$t('page.auth.id-number-placeholder'),
  54. trigger: ['blur', 'change']
  55. },
  56. },
  57. }
  58. },
  59. onShow() {
  60. this.getData()
  61. },
  62. methods: {
  63. getData() {
  64. this.request('getShopNo')
  65. .then(res => {
  66. if (res.code == 200) {
  67. this.userInfo = res.result || {}
  68. this.userInfo.createTime = null;
  69. }
  70. })
  71. },
  72. leftClick() {
  73. uni.switchTab({
  74. url: '/pages/user/user'
  75. })
  76. },
  77. submit() {
  78. this.$refs.uForm.validate().then(res => {
  79. this.request('saveShopNo', this.userInfo)
  80. .then(res => {
  81. if (res.code == 200) {
  82. uni.$u.toast(this.$t('success-operation'));
  83. setTimeout(() => {
  84. uni.switchTab({
  85. url: "/pages/user/user"
  86. })
  87. }, 500)
  88. }
  89. })
  90. })
  91. },
  92. idTypeSelect(e) {
  93. this.userInfo.noType = e.name
  94. },
  95. idTypeAuth() {
  96. let a = false
  97. this.idTypeActions.forEach(n => {
  98. if (n.name == this.userInfo.noType) {
  99. a = true
  100. }
  101. })
  102. if (!a) {
  103. this.userInfo.noType = ''
  104. }
  105. }
  106. }
  107. }
  108. </script>
  109. <style scoped lang="scss">
  110. .line {
  111. background-color: #fff;
  112. padding: 5px 10px;
  113. margin-top: 10px;
  114. .celi {
  115. border-radius: 10px;
  116. margin: 10px 0;
  117. }
  118. }
  119. .submit {
  120. border-radius: 30px;
  121. background-color: #ED762F;
  122. color: #fff;
  123. margin: 10px;
  124. width: calc(100% - 20px);
  125. }
  126. </style>