companyIdentityTwo.vue 8.1 KB

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