companyIdentityTwo.vue 8.3 KB

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