companyIdentityTwo.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <view class="center">
  3. <view>
  4. <!-- 个人身份证正面 -->
  5. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  6. :size-type="['compressed']" @on-success="getImgUrl1" @on-remove="onRemove"
  7. @on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions1"
  8. :custom="uploadCustom1" ></upload>
  9. <!-- 个人身份证反面 -->
  10. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  11. :size-type="['compressed']" @on-success="getImgUrl2" @on-remove="onRemove"
  12. @on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions2"
  13. :custom="uploadCustom1" ></upload>
  14. </view>
  15. <view class="c-row b-b">
  16. <text class="tit_red">*</text>
  17. <text class="tit">姓名</text>
  18. <view class="con-list">
  19. <input placeholder="请填写姓名" name="input" v-model="identityAuthenticationInfo.customerName"></input>
  20. </view>
  21. </view>
  22. <view class="c-row b-b">
  23. <text class="tit">身份证号</text>
  24. <view class="con-list">
  25. <input placeholder="请填写身份证号" name="input"
  26. v-model="identityAuthenticationInfo.customerNumberCard"></input>
  27. </view>
  28. </view>
  29. <button class="btns btn" @click="jumpUrl">下一步</button>
  30. </view>
  31. </template>
  32. <script>
  33. import upload from '@/components/upload.vue';
  34. import {
  35. mapState
  36. } from 'vuex';
  37. export default {
  38. components: {
  39. upload
  40. },
  41. data() {
  42. return {
  43. action: this.$uploadUrl,
  44. maxSize: 50 * 1024 * 1024, //限制文件大小 50M
  45. btnLoading: false, //防止重复点击
  46. isAdd: true,
  47. imgUrls: [],
  48. uploadCustom1: true,
  49. uploadCustom2: true,
  50. uploadOptions1: {
  51. "text": "上传身份证头像页",
  52. "bgc": "https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/tmp/identityup%282%29.png"
  53. },
  54. uploadOptions2: {
  55. "text": "上传身份证国徽页",
  56. "bgc": "https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/tmp/identitylow%282%29.png"
  57. },
  58. id: [],
  59. id1: "../../static/img/authentication/identityup(3).png",
  60. id2: "../../static/img/authentication/identitylow(3).png",
  61. identityImgs1: {},
  62. identityAuthenticationInfo: {},
  63. certificates: true,
  64. certificatesTwo: true,
  65. }
  66. },
  67. onLoad(options) {
  68. this.identityAuthenticationInfo = JSON.parse(options.identityAuthenticationInfo)
  69. console.log(this.identityAuthenticationInfo)
  70. },
  71. methods: {
  72. filterFileType(index, lists) {
  73. if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
  74. lists.splice(index, 1);
  75. // 当前文件不支持
  76. uni.showModal({
  77. title: '暂不支持当前图片类型',
  78. showCancel: false
  79. });
  80. } else {
  81. this.isAdd = false;
  82. }
  83. },
  84. getImgUrl1(res) {
  85. console.log(res)
  86. console.log('------------res-----------')
  87. let that = this;
  88. that.id[0] = res
  89. that.id1 = res
  90. that.certificates = false
  91. that.identityImgs1.personImg = res
  92. that.$api.doRequest('get', '/driverViewInfo/personShibie', that.identityImgs1).then(res => {
  93. if (res.data.data.recPerson != null) {
  94. if (res.data.data.recPerson != "") {
  95. that.$set(that.identityAuthenticationInfo, 'customerName', res.data.data.recPerson)
  96. }
  97. }
  98. if (res.data.data.recPersonNo != null) {
  99. if (res.data.data.recPersonNo != "") {
  100. that.$set(that.identityAuthenticationInfo, 'customerNumberCard', res.data.data
  101. .recPersonNo)
  102. }
  103. }
  104. }).catch(res => {
  105. uni.showToast({
  106. title: res.data.message,
  107. icon: 'none',
  108. duration: 2000
  109. })
  110. })
  111. },
  112. getImgUrl2(res) {
  113. console.log(res)
  114. console.log('------------res-----------')
  115. let that = this;
  116. that.id[1] = res
  117. that.id2 = res
  118. that.certificatesTwo = false
  119. that.identityImgs1.personImg = res
  120. that.$api.doRequest('get', '/driverViewInfo/personShibie', that.identityImgs1).then(res => {
  121. if (res.data.data.recPerson != null) {
  122. if (res.data.data.recPerson != "") {
  123. that.$set(that.identityAuthenticationInfo, 'customerName', res.data.data.recPerson)
  124. }
  125. }
  126. if (res.data.data.recPersonNo != null) {
  127. if (res.data.data.recPersonNo != "") {
  128. that.$set(that.identityAuthenticationInfo, 'customerNumberCard', res.data.data
  129. .recPersonNo)
  130. }
  131. }
  132. }).catch(res => {
  133. uni.showToast({
  134. title: res.data.message,
  135. icon: 'none',
  136. duration: 2000
  137. })
  138. })
  139. },
  140. onError(error) {
  141. alert(error)
  142. console.log('------------error-----------')
  143. console.log(error)
  144. },
  145. onProgress(e) {
  146. console.log(e)
  147. },
  148. onRemove(index) {
  149. this.imgUrls.splice(index, 1);
  150. },
  151. jumpUrl() {
  152. this.identityAuthenticationInfo.cardAddressUrl = this.id.toString()
  153. // if (this.id[0] == '' || this.id[0] == null) {
  154. // this.$api.msg('请上传身份证正面')
  155. // return
  156. // }
  157. // if (this.id[1] == '' || this.id[1] == null) {
  158. // this.$api.msg('请上传身份证反面')
  159. // return
  160. // }
  161. if (!this.identityAuthenticationInfo.customerName) {
  162. this.$api.msg('姓名不能为空')
  163. return
  164. }
  165. if (this.identityAuthenticationInfo.customerName.length < 2 || this.identityAuthenticationInfo.customerName
  166. .length > 10) {
  167. this.$api.msg('姓名输入错误')
  168. return
  169. }
  170. // if (!this.identityAuthenticationInfo.customerNumberCard) {
  171. // this.$api.msg('身份证号不能为空')
  172. // return
  173. // }
  174. // if (this.identityAuthenticationInfo.customerNumberCard.length != 18) {
  175. // this.$api.msg('身份证号输入错误')
  176. // return
  177. // }
  178. var model = JSON.stringify(this.identityAuthenticationInfo);
  179. uni.navigateTo({
  180. url: `/pageD/identity/companyIdentityThree?identityAuthenticationInfo=` + model,
  181. })
  182. },
  183. }
  184. }
  185. </script>
  186. <style>
  187. .center {
  188. padding: 10px 20px;
  189. background-color: #F5F6FA;
  190. }
  191. .c-row {
  192. display: -webkit-box;
  193. display: -webkit-flex;
  194. display: flex;
  195. -webkit-box-align: center;
  196. -webkit-align-items: center;
  197. align-items: center;
  198. padding: 20rpx 30rpx;
  199. position: relative;
  200. }
  201. .con-list {
  202. -webkit-box-flex: 1;
  203. -webkit-flex: 1;
  204. flex: 1;
  205. display: -webkit-box;
  206. display: -webkit-flex;
  207. display: flex;
  208. -webkit-box-orient: vertical;
  209. -webkit-box-direction: normal;
  210. -webkit-flex-direction: column;
  211. flex-direction: column;
  212. color: #303133;
  213. line-height: 40rpx;
  214. text-align: right;
  215. padding-right: 20rpx;
  216. font-size: 14px;
  217. }
  218. .btn {
  219. margin-top: 10px;
  220. background-color: #FFFFFF;
  221. border-radius: 25px;
  222. border: none;
  223. }
  224. .btns {
  225. background-color: #22C572;
  226. color: white;
  227. }
  228. .picture {
  229. width: 100%;
  230. height: 220px;
  231. text-align: center;
  232. margin-top: 10px;
  233. }
  234. .words {
  235. font-size: 18px;
  236. font-weight: 600;
  237. color: #617E8B;
  238. }
  239. .floats {
  240. position: relative;
  241. top: -150px;
  242. text-align: center;
  243. }
  244. .upload {
  245. margin: 20rpx 0;
  246. }
  247. .tit_red{
  248. color: #E54D42;
  249. }
  250. </style>