companyIdentityTwo.vue 7.2 KB

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