companyIdentityTwo.vue 6.8 KB

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