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

248 lines
6.2 KiB

  1. <template>
  2. <view class="uploadPapers">
  3. <view class="p-l-30 p-r-30">
  4. <view class="uploadPapers-form">
  5. <view class="uploadPapers-form-item flex align-center m-b-40">
  6. <text class="font-32 text-black m-r-10">证件类型</text>
  7. <u-input class="flex-1" v-model="form.type" disabled placeholder="请选择证件类型" input-align="right" @click="papersShow = true" />
  8. </view>
  9. <view class="uploadPapers-form-item flex align-center">
  10. <text class="font-32 text-black m-r-10">证件号码</text>
  11. <u-input class="flex-1" v-model="form.idCard" placeholder="请输入证件号码" input-align="right" />
  12. </view>
  13. </view>
  14. <!--
  15. <view class="uploadPapers-upload">
  16. <view class="uploadPapers-upload-title font-32 text-black font-weight-bold">身份证照片</view>
  17. <view class="flex align-center justify-between">
  18. <view class="flex align-center flex-column">
  19. <u-upload
  20. ref="uUpload1"
  21. :header="headerInfo"
  22. :action="upload_img"
  23. :custom-btn="true"
  24. image-mode="none"
  25. @on-success="onSuccess"
  26. @on-error="onErrorInfo"
  27. max-count="1" width="281" height="192"
  28. >
  29. <image class="uploadPapers-upload-image" :src="form.idPhoto !==''?form.idPhoto : (IMG_URL + 'idCardFront.png')" slot="addBtn"></image>
  30. </u-upload>
  31. <text class="font-32 text-grey m-t-40">身份证头像面</text>
  32. </view>
  33. <view class="flex align-center flex-column">
  34. <u-upload
  35. ref="uUpload2"
  36. :header="headerInfo"
  37. :action="upload_img"
  38. :custom-btn="true"
  39. image-mode="none"
  40. @on-success="onSuccess2"
  41. @on-error="onErrorInfo"
  42. max-count="1" width="281" height="192"
  43. >
  44. <image class="uploadPapers-upload-image" :src="form.idPhotoImage !==''?form.idPhotoImage : (IMG_URL + 'idCardOpposite.png')" slot="addBtn"></image>
  45. </u-upload>
  46. <text class="font-32 text-grey m-t-40">身份证国徽面</text>
  47. </view>
  48. </view>
  49. </view>
  50. -->
  51. <u-button type="primary" shape="circle" class="confirm-order-footer-button" @click="submit">提交认证</u-button>
  52. </view>
  53. <u-select v-model="papersShow" :list="papersList" @confirm="selectConfirm" confirm-color="#01AEEA"></u-select>
  54. </view>
  55. </template>
  56. <script>
  57. import { IMG_URL } from '@/env.js'
  58. // const papersList = [
  59. // {
  60. // value: '1',
  61. // label: '身份证'
  62. // },
  63. // {
  64. // value: '2',
  65. // label: '港澳身份证'
  66. // },
  67. // {
  68. // value: '3',
  69. // label: '台湾身份证'
  70. // },
  71. // {
  72. // value: '4',
  73. // label: '护照'
  74. // },
  75. // {
  76. // value: '5',
  77. // label: '警官证'
  78. // },
  79. // {
  80. // value: '6',
  81. // label: '军官证'
  82. // }
  83. // ];
  84. export default {
  85. data() {
  86. return {
  87. IMG_URL,
  88. papersList: [],
  89. papersShow: false,
  90. upload_img: '',
  91. href: 'api/info/upload',
  92. headerInfo: {
  93. "content-type": "application/x-www-form-urlencoded",
  94. "X-Access-Token": ''
  95. },
  96. form: {
  97. type: '',
  98. cardType: '',
  99. idCard: '',
  100. idPhoto: "", //正面身份证
  101. idPhotoImage: "", //反面身份证
  102. front: [],
  103. opposite: []
  104. },
  105. fileList: [],
  106. rules: {
  107. type: {
  108. message: '请选择证件类型'
  109. },
  110. idCard: {
  111. message: '请输入身份证号码'
  112. },
  113. front: {
  114. message: '请上传身份证头像面照片'
  115. },
  116. opposite: {
  117. message: '请上传身份证国徽面照片'
  118. }
  119. },
  120. info: {}
  121. };
  122. },
  123. onReady() {},
  124. async onLoad(options) {
  125. await this.getLabelList();
  126. if(options.form){
  127. this.info = JSON.parse(options.form)
  128. if(this.info.Id !== ''){
  129. console.log(options.form,"ssss")
  130. this.form.type = this.info.cardName
  131. this.form.cardType =this.info.cardType
  132. this.form.idCard = this.info.cardId;
  133. // this.form.idPhoto = this.info.cardPhoto //正面身份证
  134. // this.form.idPhotoImage = this.info.cardPic//反面身份证
  135. }
  136. }
  137. console.log(this.info,'接收到了')
  138. let token = uni.getStorageSync("__user_token");
  139. this.headerInfo["X-Access-Token"] = token;
  140. this.upload_img = this.$upload_img;
  141. console.log(this.upload_img)
  142. },
  143. methods: {
  144. // 获取证件类型
  145. getLabelList () {
  146. this.$api('addCardLabelList').then(res => {
  147. const { code, result, message} = res;
  148. if(code == 200) {
  149. console.log(result)
  150. const list = []
  151. result.forEach(item => {
  152. console.log(item)
  153. list.push({
  154. label: item.name,
  155. value: item.id
  156. })
  157. });
  158. this.papersList.forEach((item,index) => {
  159. console.log(item.name == result.cardName, item.name, result.cardName)
  160. if(item.name == result.cardName) {
  161. }
  162. })
  163. console.log(list)
  164. this.papersList = list;
  165. }else{
  166. this.$Toast(message)
  167. }
  168. }).catch(err => {
  169. this.$Toast(err.message)
  170. })
  171. },
  172. submit() {
  173. // console.log(this.$util.validate(this.rules, this.form))
  174. // let { disabled, message } = this.$util.validate(this.rules, this.form);
  175. // if (disabled) return this.$Toast(message);
  176. // if(this.form.idPhoto == '') {
  177. // this.$Toast("请上传身份证正面图片!")
  178. // return
  179. // }
  180. // if(this.form.idPhotoImage == '') {
  181. // this.$Toast("请上传身份证反面图片!")
  182. // return
  183. // }
  184. const form = {
  185. ...this.info,
  186. ...this.form
  187. }
  188. this.$tools.navigateTo({
  189. url: '/pagesA/my_other_list/healthInfo/index?form='+JSON.stringify(form)
  190. })
  191. },
  192. // onSuccess(data) {
  193. // this.form.idPhoto = data.result
  194. // },
  195. // onSuccess2(data){
  196. // this.form.idPhotoImage = data.result
  197. // },
  198. selectConfirm(arr) {
  199. this.form.type = arr[0].label;
  200. this.form.cardType = arr[0].value;
  201. },
  202. uplpadComplete(lists, name) {
  203. let { error, file } = lists[0];
  204. if (error) return this.$Toast(error);
  205. this.form[name] = file;
  206. }
  207. }
  208. };
  209. </script>
  210. <style lang="scss" scoped>
  211. /deep/ .u-input__input{
  212. font-size: 32rpx !important;
  213. }
  214. /deep/.u-form-item--left__content__label {
  215. width: 140rpx !important;
  216. font-size: 32rpx;
  217. }
  218. /deep/ .u-size-default {
  219. font-size: 32rpx !important;
  220. }
  221. .uploadPapers {
  222. &-form {
  223. margin-bottom: 60rpx;
  224. &-item {
  225. height: 80rpx;
  226. border-bottom: 2rpx solid #f1f1f1;
  227. }
  228. }
  229. &-upload {
  230. margin-bottom: 120rpx;
  231. &-title {
  232. margin-bottom: 50rpx;
  233. }
  234. &-image {
  235. width: 280rpx;
  236. height: 190rpx;
  237. }
  238. }
  239. }
  240. </style>