耀实惠小程序
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.

150 lines
3.8 KiB

  1. <template>
  2. <view class="name-authentication">
  3. <view class="name-authentication-header flex justify-center flex-column m-b-40">
  4. <text class="text-white font-28 m-b-10">个人实名认证</text>
  5. <text class="text-white font-26">请如实填写个人信息</text>
  6. </view>
  7. <view class="p-l-30 p-r-30">
  8. <view class="name-authentication-form">
  9. <view class="name-authentication-form-item flex align-center m-b-40">
  10. <text class="font-28 text-black m-r-10">姓名</text>
  11. <u-input class="flex-1" v-model="form.name" placeholder="请输入真实姓名" />
  12. </view>
  13. <view class="name-authentication-form-item flex align-center">
  14. <text class="font-28 text-black m-r-10">身份证号</text>
  15. <u-input class="flex-1" v-model="form.idCard" placeholder="请输入身份证号码" />
  16. </view>
  17. </view>
  18. <view class="name-authentication-upload">
  19. <view class="name-authentication-upload-title font028 text-black font-weight-bold">身份证照片</view>
  20. <view class="flex align-center justify-between">
  21. <view class="flex align-center flex-column">
  22. <u-upload
  23. @on-choose-complete="list => uplpadComplete(list, 'front')"
  24. width="280"
  25. height="190"
  26. auto-upload
  27. max-count="1"
  28. customBtn
  29. :action="action"
  30. :file-list="form.front"
  31. >
  32. <image class="name-authentication-upload-image" :src="IMG_URL + 'idCardFront.png'" slot="addBtn"></image>
  33. </u-upload>
  34. <text class="font-28 text-grey m-t-40">身份证头像面</text>
  35. </view>
  36. <view class="flex align-center flex-column">
  37. <u-upload
  38. @on-choose-complete="list => uplpadComplete(list, 'opposite')"
  39. width="280"
  40. height="190"
  41. auto-upload
  42. max-count="1"
  43. customBtn
  44. :action="action"
  45. :file-list="form.opposite"
  46. >
  47. <image class="name-authentication-upload-image" :src="IMG_URL + 'idCardOpposite.png'" slot="addBtn"></image>
  48. </u-upload>
  49. <text class="font-28 text-grey m-t-40">身份证国徽面</text>
  50. </view>
  51. </view>
  52. </view>
  53. <u-button type="primary" shape="circle" class="confirm-order-footer-button" @click="submit">提交认证</u-button>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import { IMG_URL } from '@/env.js'
  59. export default {
  60. data() {
  61. return {
  62. IMG_URL,
  63. form: {
  64. name: '',
  65. idCard: '',
  66. front: [],
  67. opposite: []
  68. },
  69. fileList: [],
  70. rules: {
  71. name: [
  72. {
  73. message: '请输入姓名'
  74. },
  75. {
  76. validator: (rule, value, callback) => {
  77. let username = /^[\u4E00-\u9FA5\uf900-\ufa2d·s]{2,99}$/;
  78. return username.test(value);
  79. },
  80. message: '请输入正确格式的姓名',
  81. trigger: ['blur']
  82. }
  83. ],
  84. idCard: [
  85. {
  86. message: '请输入身份证号码'
  87. },
  88. {
  89. message: '请输入正确格式的身份证号码',
  90. validator: (rule, value, callback) => {
  91. return this.$u.test.idCard(value);
  92. }
  93. }
  94. ],
  95. front: {
  96. message: '请上传身份证头像面照片'
  97. },
  98. opposite: {
  99. message: '请上传身份证国徽面照片'
  100. }
  101. }
  102. };
  103. },
  104. onReady() {},
  105. methods: {
  106. submit() {
  107. console.log(this.form);
  108. let { disabled, message } = this.$util.validate(this.rules, this.form);
  109. if (disabled) return this.$Toast(message);
  110. },
  111. uplpadComplete(lists, name) {
  112. let { error, file } = lists[0];
  113. if (error) return this.$Toast(error);
  114. this.form[name] = file;
  115. }
  116. }
  117. };
  118. </script>
  119. <style lang="scss" scoped>
  120. .name-authentication {
  121. &-header {
  122. background: $u-type-primary;
  123. height: 160rpx;
  124. padding: 0 30rpx;
  125. }
  126. &-form {
  127. margin-bottom: 60rpx;
  128. &-item {
  129. height: 80rpx;
  130. border-bottom: 2rpx solid #f1f1f1;
  131. }
  132. }
  133. &-upload {
  134. margin-bottom: 120rpx;
  135. &-title {
  136. margin-bottom: 50rpx;
  137. }
  138. &-image {
  139. width: 280rpx;
  140. height: 190rpx;
  141. }
  142. }
  143. }
  144. </style>