authInfo.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  1. <template>
  2. <view class="page">
  3. <view class="headers ">
  4. <view class="header">
  5. <view class="dis a-c j-start ">
  6. <u-icon name="arrow-left" size="40" @tap="back"></u-icon>
  7. <text style="margin: auto;">我的认证</text>
  8. </view>
  9. </view>
  10. </view>
  11. <view :style="{padding:desc?'12px 15px 74px':'108px 15px 74px'}">
  12. <view class="reviewResult dis f-c mb-3" v-if="desc">
  13. <view class="dis a-c">
  14. <image src="../../static/image/user/error.png" mode=""
  15. style="width: 28rpx;height: 35rpx;margin-right: 4px;"></image>
  16. <text style="color: #F44149;font-size: 13px;">尊敬的{{this.userInfo.sysUser.name}}:</text>
  17. </view>
  18. <text>{{desc}}</text>
  19. </view>
  20. <view class="ImgInfo">
  21. <view class="title dis a-c ">
  22. <view class="tag"></view>
  23. <text>请上传身份证的正反面</text>
  24. </view>
  25. <view class="content">
  26. <view class="avatar dis j-s">
  27. <view class="infoText dis f-c ">
  28. <text>头像面</text>
  29. <text>上传您的证件头像面</text>
  30. </view>
  31. <view class="avatar-img">
  32. <image :src="userfrontImg?userfrontImg:'../../static/image/user/asset2.png'" mode=""
  33. @click="userfrontChange"></image>
  34. <image v-if="userfrontImg" src="../../static/image/user/del.png" mode="" class="imgdel"
  35. @click="imgDel('userfrontImg')">
  36. </image>
  37. </view>
  38. </view>
  39. <view class="avatar dis j-s mt-2">
  40. <view class="infoText dis f-c ">
  41. <text>国徽面</text>
  42. <text>上传您的证件国徽面</text>
  43. </view>
  44. <view class="avatar-img">
  45. <image :src="userbackImg?userbackImg:'../../static/image/user/asset1.png'" mode=""
  46. @click="userbackChange"></image>
  47. <image v-if="userbackImg" src="../../static/image/user/del.png" mode="" class="imgdel"
  48. @click="imgDel('userbackImg')">
  49. </image>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="ImgInfo" style="margin-top: 12px;">
  55. <view class="title dis a-c ">
  56. <view class="tag"></view>
  57. <text>请完善您的个人信息</text>
  58. </view>
  59. <view class="infoForm">
  60. <uni-forms :value="authInfo" ref="authForm" validate-trigger="bind" style="padding: 0 10px;"
  61. err-show-type="toast" label-width="70">
  62. <uni-forms-item label="姓名: " required name="name">
  63. <input class="uni-input-input textColor" placeholder="待自动录入" v-model="authInfo.name"
  64. placeholder-style="font-size:28upx" disabled />
  65. </uni-forms-item>
  66. <uni-forms-item label="身份证号: " required name="identifyNumber">
  67. <input class="uni-input-input textColor" placeholder="待自动录入" v-model="authInfo.identity"
  68. placeholder-style="font-size:28upx" disabled />
  69. </uni-forms-item>
  70. <uni-forms-item label="有效期限: " required>
  71. <input class="uni-input-input textColor" placeholder="待自动录入" v-if="!authInfo.identityTime"
  72. v-model="authInfo.identityTime" placeholder-style="font-size:28upx" disabled />
  73. <text v-else>{{authInfo.identityTime}}</text>
  74. </uni-forms-item>
  75. <uni-forms-item label="手机号: " required>
  76. <input class="uni-input-input textColor" placeholder="请输入手机号" v-model="authInfo.mobile"
  77. placeholder-style="font-size:28upx" />
  78. </uni-forms-item>
  79. <uni-forms-item label="开户行: " required>
  80. <input class="uni-input-input textColor" placeholder="请输入开户行" v-model="authInfo.accountno"
  81. placeholder-style="font-size:28upx" />
  82. </uni-forms-item>
  83. <uni-forms-item label="开户账号: " required>
  84. <input class="uni-input-input textColor" placeholder="请输入开户账号" v-model="authInfo.bankName"
  85. placeholder-style="font-size:28upx" />
  86. </uni-forms-item>
  87. </uni-forms>
  88. </view>
  89. </view>
  90. </view>
  91. <view class="footer">
  92. <view class="btn dis j-c a-c"
  93. :style="{background:disabled?'linear-gradient(90deg, #499DFF 0%, #0052FF 100%)':'linear-gradient(90deg, rgba(73, 157, 255, 0.4) 0%, rgba(0, 82, 255, 0.4) 100%)',pointerEvents:disabled?'auto':'none'}"
  94. @tap="$u.throttle(authSubmit, 3000)">提交认证</view>
  95. </view>
  96. <auth-Modal :authShow="authShow" @btnClick="authShow=false" @maskClick="authShow=false"></auth-Modal>
  97. </view>
  98. </template>
  99. <script>
  100. import {
  101. mapState
  102. } from "vuex"
  103. import authModal from '@/components/modules/user/authModal.vue'; //实名认证弹窗
  104. export default {
  105. components: {
  106. authModal,
  107. },
  108. data() {
  109. return {
  110. disabled: true,
  111. userfrontImg: "",
  112. userbackImg: "",
  113. authShow: false,
  114. authInfo: {
  115. name: "",
  116. mobile: "",
  117. identityTime: "", //有效期
  118. identity: "", //证件号
  119. accountno: "", //开户行
  120. bankName: "", //开户账号
  121. userId: "",
  122. esmUserImageVo: [] //img
  123. },
  124. desc: "",
  125. }
  126. },
  127. watch: {
  128. "authInfo.name": {
  129. handler(val) {
  130. this.OnBtnChange();
  131. },
  132. },
  133. "authInfo.identityTime": {
  134. handler(val) {
  135. this.OnBtnChange();
  136. },
  137. },
  138. "authInfo.identity": {
  139. handler(val) {
  140. this.OnBtnChange();
  141. },
  142. },
  143. "authInfo.accountno": {
  144. handler(val) {
  145. this.OnBtnChange();
  146. },
  147. },
  148. "authInfo.bankName": {
  149. handler(val) {
  150. this.OnBtnChange();
  151. },
  152. },
  153. "authInfo.mobile": {
  154. handler(val) {
  155. this.OnBtnChange();
  156. },
  157. },
  158. },
  159. computed: {
  160. ...mapState(['userInfo', 'token']),
  161. },
  162. onShow() {
  163. },
  164. async onLoad(params) {
  165. if (!!params.desc) {
  166. this.desc = params.desc;
  167. }
  168. this.authInfo.userId = this.userInfo.sysUser.id;
  169. let res = await this.$http.post('/userAgent/getAuthResult', {
  170. userId: this.authInfo.userId,
  171. });
  172. if (res.code == '200') {
  173. this.desc = res.data.desc;
  174. this.authInfo.name = res.data.sysUser.name;
  175. this.authInfo.identity = res.data.sysUser.identity;
  176. this.authInfo.identityTime = res.data.sysUser.identityTime;
  177. this.authInfo.mobile = res.data.sysUser.mobile;
  178. this.authInfo.accountno = res.data.sysUserInfo?.accountno;
  179. this.authInfo.bankName = res.data.sysUserInfo?.bankName;
  180. if (res.data.esmUserImageVo) this.authInfo.esmUserImageVo = res.data.esmUserImageVo;
  181. res.data.esmUserImageVo?.map(val => {
  182. if (val.type == 'SFZ_01') {
  183. this.userfrontImg = this.$base.baseUrl + val.path;
  184. } else {
  185. this.userbackImg = this.$base.baseUrl + val.path;
  186. }
  187. return val;
  188. })
  189. }
  190. },
  191. methods: {
  192. async authSubmit() {
  193. uni.showLoading({
  194. mask: true,
  195. title: '正在提交,请稍等片刻'
  196. });
  197. let res = await this.$http.post('/userAgent/agentAuth', this.authInfo);
  198. if (res.code == '200' && res.data.status) {
  199. uni.hideLoading();
  200. uni.navigateTo({
  201. url: "/pages/user/authResult?status=" + res.data.status + '&desc=' + res.data.desc
  202. })
  203. } else {
  204. uni.hideLoading();
  205. uni.showToast({
  206. title: res.msg,
  207. icon: 'none',
  208. });
  209. }
  210. },
  211. // 改变按钮状态
  212. OnBtnChange() {
  213. if (this.authInfo.name && this.authInfo.identity && this.authInfo.identityTime && this.authInfo
  214. .accountno && this.authInfo.bankName && this.authInfo.mobile) {
  215. this.disabled = true;
  216. return;
  217. }
  218. this.disabled = false;
  219. },
  220. async userfrontChange() {
  221. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  222. count: 1,
  223. sizeType: ['compressed']
  224. });
  225. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  226. if (!size) {
  227. this.$refs.uToast.show({
  228. title: '上传图片大小不能超过 5MB!',
  229. type: 'error',
  230. })
  231. return false
  232. }
  233. if (chooseImageRes) {
  234. this.userfrontImg = chooseImageRes.tempFilePaths[0];
  235. uni.uploadFile({
  236. url: this.$base.baseUrl + '/ins/taskImage/uploadFile',
  237. filePath: chooseImageRes.tempFilePaths[0],
  238. name: "multipartFile",
  239. formData: {
  240. 'type': 'image',
  241. },
  242. header: {
  243. Authorization: this.token,
  244. },
  245. success: (imgRes) => {
  246. let data = JSON.parse(imgRes.data);
  247. if (data.code == '200') {
  248. console.log(this.authInfo);
  249. if (this.authInfo.esmUserImageVo.some(v => v.type == 'SFZ_01')) {
  250. this.authInfo.esmUserImageVo.map(val => {
  251. if (val.type == 'SFZ_01') {
  252. val.imageId = data.data.id;
  253. }
  254. })
  255. } else {
  256. this.authInfo.esmUserImageVo.push({
  257. imageId: data.data.id,
  258. type: "SFZ_01",
  259. })
  260. }
  261. uni.uploadFile({
  262. url: this.$base.baseUrl + '/order/identify/idCard',
  263. filePath: chooseImageRes.tempFilePaths[0],
  264. name: "image1",
  265. header: {
  266. Authorization: this.token,
  267. },
  268. success: (uploadFileRes) => {
  269. let data = JSON.parse(uploadFileRes.data).data;
  270. this.authInfo.name = data.customerInfo.name;
  271. this.authInfo.identity = data.customerInfo
  272. .identifyNumber;
  273. }
  274. });
  275. }
  276. }
  277. })
  278. }
  279. },
  280. async userbackChange() {
  281. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  282. count: 1,
  283. sizeType: ['compressed']
  284. });
  285. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  286. if (!size) {
  287. this.$refs.uToast.show({
  288. title: '上传图片大小不能超过 5MB!',
  289. type: 'error',
  290. })
  291. return false
  292. }
  293. if (chooseImageRes) {
  294. this.userbackImg = chooseImageRes.tempFilePaths[0];
  295. uni.uploadFile({
  296. url: this.$base.baseUrl + '/ins/taskImage/uploadFile',
  297. filePath: chooseImageRes.tempFilePaths[0],
  298. name: "multipartFile",
  299. formData: {
  300. 'type': 'image',
  301. },
  302. header: {
  303. Authorization: this.token,
  304. },
  305. success: (imgRes) => {
  306. let data = JSON.parse(imgRes.data);
  307. if (data.code == '200') {
  308. if (this.authInfo.esmUserImageVo.some(v => v.type == 'SFZ_02')) {
  309. this.authInfo.esmUserImageVo.map(val => {
  310. if (val.type == 'SFZ_02') {
  311. val.imageId = data.data.id;
  312. }
  313. })
  314. } else {
  315. this.authInfo.esmUserImageVo.push({
  316. imageId: data.data.id,
  317. type: "SFZ_02",
  318. })
  319. }
  320. uni.uploadFile({
  321. url: this.$base.baseUrl + '/order/identify/idCard',
  322. filePath: chooseImageRes.tempFilePaths[0],
  323. name: "image2",
  324. header: {
  325. Authorization: this.token,
  326. },
  327. success: (uploadFileRes) => {
  328. let data1 = JSON.parse(uploadFileRes.data).data;
  329. let identifyValidDate = '';
  330. if (!!data1.customerInfo
  331. .identifyValidDate) {
  332. identifyValidDate = data1
  333. .customerInfo
  334. .identifyValidDate
  335. .substr(0, 4) +
  336. '-' + data1
  337. .customerInfo
  338. .identifyValidDate
  339. .substr(4, 2) + '-' +
  340. data1
  341. .customerInfo
  342. .identifyValidDate
  343. .substr(6,
  344. 2)
  345. }
  346. let identifyValidEndDate = '';
  347. if (!!data1.customerInfo
  348. .identifyValidEndDate) {
  349. identifyValidEndDate =
  350. data1.customerInfo
  351. .identifyValidEndDate
  352. .substr(0,
  353. 4) + '-' + data1
  354. .customerInfo
  355. .identifyValidEndDate
  356. .substr(4, 2) + '-' +
  357. data1
  358. .customerInfo
  359. .identifyValidEndDate
  360. .substr(6, 2)
  361. }
  362. this.authInfo.identityTime = identifyValidDate + "," +
  363. identifyValidEndDate;
  364. }
  365. });
  366. }
  367. }
  368. })
  369. }
  370. },
  371. imgDel(name) {
  372. this[name] = "";
  373. },
  374. //页面返回按钮
  375. back() {
  376. uni.navigateBack({
  377. delta: 1, // 返回的页面数,如果是1表示返回上一页
  378. success: function() {}
  379. });
  380. },
  381. }
  382. }
  383. </script>
  384. <style lang="scss" scoped>
  385. ::v-deep .uni-forms-item {
  386. border-bottom: 1px solid #f2f2f2;
  387. }
  388. ::v-deep .uni-forms-item:last-child {
  389. border: none;
  390. }
  391. ::v-deep .uni-forms-item__content {
  392. display: flex;
  393. align-items: center;
  394. }
  395. page {
  396. background: #F7F7F7;
  397. }
  398. .headers {
  399. position: fixed;
  400. top: 0;
  401. left: 0;
  402. z-index: 999999;
  403. width: 100%;
  404. border-bottom: 1px solid #EEEEEE;
  405. .header {
  406. width: 100%;
  407. height: auto;
  408. padding: 50px 16px 14px;
  409. background: linear-gradient(180deg, #D1E3FE 0%, #FFFFFF 100%);
  410. text {
  411. font-size: 18px;
  412. font-weight: bold;
  413. color: #000;
  414. }
  415. }
  416. }
  417. .reviewResult {
  418. width: 100%;
  419. background: linear-gradient(90deg, #FFE2E0 0%, #FBF3F3 100%);
  420. border-radius: 0px 0px 0px 0px;
  421. border: 1px solid #FF535B;
  422. border-radius: 4px;
  423. padding: 8px 15px;
  424. margin-top: 96px;
  425. text:last-child {
  426. color: #333;
  427. font-size: 12px;
  428. }
  429. }
  430. .ImgInfo {
  431. background: #FFFFFF;
  432. border-radius: 5px;
  433. border-bottom: 1px solid #EEEEEE;
  434. .title {
  435. padding: 10px 0;
  436. .tag {
  437. width: 4px;
  438. height: 16px;
  439. background: linear-gradient(132deg, #83B4FC 0%, #3D74FE 100%);
  440. border-radius: 5px;
  441. }
  442. text {
  443. font-size: 16px;
  444. color: #333;
  445. font-weight: bold;
  446. margin-left: 6px;
  447. }
  448. }
  449. .content {
  450. padding: 0 10px 10px;
  451. .avatar {
  452. background: #FBFBFB;
  453. border-radius: 4px;
  454. padding: 7px 8px;
  455. .infoText {
  456. text:first-child {
  457. font-size: 14px;
  458. color: #333;
  459. font-weight: bold;
  460. }
  461. text:last-child {
  462. font-size: 12px;
  463. color: #999;
  464. }
  465. }
  466. .avatar-img {
  467. width: 180px;
  468. height: 109px;
  469. position: relative;
  470. padding: 7px;
  471. margin-top: 21px;
  472. background-image: url("/static/image/user/asset3.png");
  473. background-size: 100% 100%;
  474. image {
  475. width: 100%;
  476. height: 100%;
  477. border-radius: 4px;
  478. }
  479. .imgdel {
  480. width: 14px;
  481. height: 14px;
  482. position: absolute;
  483. right: 9px;
  484. bottom: 9px;
  485. border-radius: 0px;
  486. }
  487. }
  488. }
  489. }
  490. .infoForm {
  491. padding: 0 0 0;
  492. }
  493. }
  494. .footer {
  495. position: fixed;
  496. bottom: 0;
  497. height: 62px;
  498. background: #FFFFFF;
  499. box-shadow: 0px -4px 10px 0px rgba(1, 83, 255, 0.05);
  500. padding: 12px 16px;
  501. width: 100%;
  502. .btn {
  503. background: linear-gradient(90deg, rgba(73, 157, 255, 0.4) 0%, rgba(0, 82, 255, 0.4) 100%);
  504. background: linear-gradient(90deg, #499DFF 0%, #0052FF 100%);
  505. border-radius: 4px;
  506. padding: 7px;
  507. color: #FFFFFF;
  508. font-size: 16px;
  509. }
  510. }
  511. </style>