authInfo.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  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. @click="authSubmit">提交认证</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. let res = await this.$http.post('/userAgent/agentAuth', this.authInfo);
  194. if (res.code == '200' && res.data.status) {
  195. uni.navigateTo({
  196. url: "/pages/user/authResult?status=" + res.data.status + '&desc=' + res.data.desc
  197. })
  198. } else {
  199. uni.showToast({
  200. title: res.msg,
  201. icon: 'none',
  202. });
  203. }
  204. },
  205. // 改变按钮状态
  206. OnBtnChange() {
  207. if (this.authInfo.name && this.authInfo.identity && this.authInfo.identityTime && this.authInfo
  208. .accountno && this.authInfo.bankName && this.authInfo.mobile) {
  209. this.disabled = true;
  210. return;
  211. }
  212. this.disabled = false;
  213. },
  214. async userfrontChange() {
  215. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  216. count: 1,
  217. sizeType: ['compressed']
  218. });
  219. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  220. if (!size) {
  221. this.$refs.uToast.show({
  222. title: '上传图片大小不能超过 5MB!',
  223. type: 'error',
  224. })
  225. return false
  226. }
  227. if (chooseImageRes) {
  228. this.userfrontImg = chooseImageRes.tempFilePaths[0];
  229. uni.uploadFile({
  230. url: this.$base.baseUrl + '/ins/taskImage/uploadFile',
  231. filePath: chooseImageRes.tempFilePaths[0],
  232. name: "multipartFile",
  233. formData: {
  234. 'type': 'image',
  235. },
  236. header: {
  237. Authorization: this.token,
  238. },
  239. success: (imgRes) => {
  240. let data = JSON.parse(imgRes.data);
  241. if (data.code == '200') {
  242. console.log(this.authInfo);
  243. if (this.authInfo.esmUserImageVo.some(v => v.type == 'SFZ_01')) {
  244. this.authInfo.esmUserImageVo.map(val => {
  245. if (val.type == 'SFZ_01') {
  246. val.imageId = data.data.id;
  247. }
  248. })
  249. } else {
  250. this.authInfo.esmUserImageVo.push({
  251. imageId: data.data.id,
  252. type: "SFZ_01",
  253. })
  254. }
  255. uni.uploadFile({
  256. url: this.$base.baseUrl + '/order/identify/idCard',
  257. filePath: chooseImageRes.tempFilePaths[0],
  258. name: "image1",
  259. header: {
  260. Authorization: this.token,
  261. },
  262. success: (uploadFileRes) => {
  263. let data = JSON.parse(uploadFileRes.data).data;
  264. this.authInfo.name = data.customerInfo.name;
  265. this.authInfo.identity = data.customerInfo
  266. .identifyNumber;
  267. }
  268. });
  269. }
  270. }
  271. })
  272. }
  273. },
  274. async userbackChange() {
  275. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  276. count: 1,
  277. sizeType: ['compressed']
  278. });
  279. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  280. if (!size) {
  281. this.$refs.uToast.show({
  282. title: '上传图片大小不能超过 5MB!',
  283. type: 'error',
  284. })
  285. return false
  286. }
  287. if (chooseImageRes) {
  288. this.userbackImg = chooseImageRes.tempFilePaths[0];
  289. uni.uploadFile({
  290. url: this.$base.baseUrl + '/ins/taskImage/uploadFile',
  291. filePath: chooseImageRes.tempFilePaths[0],
  292. name: "multipartFile",
  293. formData: {
  294. 'type': 'image',
  295. },
  296. header: {
  297. Authorization: this.token,
  298. },
  299. success: (imgRes) => {
  300. let data = JSON.parse(imgRes.data);
  301. if (data.code == '200') {
  302. if (this.authInfo.esmUserImageVo.some(v => v.type == 'SFZ_02')) {
  303. this.authInfo.esmUserImageVo.map(val => {
  304. if (val.type == 'SFZ_02') {
  305. val.imageId = data.data.id;
  306. }
  307. })
  308. } else {
  309. this.authInfo.esmUserImageVo.push({
  310. imageId: data.data.id,
  311. type: "SFZ_02",
  312. })
  313. }
  314. uni.uploadFile({
  315. url: this.$base.baseUrl + '/order/identify/idCard',
  316. filePath: chooseImageRes.tempFilePaths[0],
  317. name: "image2",
  318. header: {
  319. Authorization: this.token,
  320. },
  321. success: (uploadFileRes) => {
  322. let data1 = JSON.parse(uploadFileRes.data).data;
  323. let identifyValidDate = '';
  324. if (!!data1.customerInfo
  325. .identifyValidDate) {
  326. identifyValidDate = data1
  327. .customerInfo
  328. .identifyValidDate
  329. .substr(0, 4) +
  330. '-' + data1
  331. .customerInfo
  332. .identifyValidDate
  333. .substr(4, 2) + '-' +
  334. data1
  335. .customerInfo
  336. .identifyValidDate
  337. .substr(6,
  338. 2)
  339. }
  340. let identifyValidEndDate = '';
  341. if (!!data1.customerInfo
  342. .identifyValidEndDate) {
  343. identifyValidEndDate =
  344. data1.customerInfo
  345. .identifyValidEndDate
  346. .substr(0,
  347. 4) + '-' + data1
  348. .customerInfo
  349. .identifyValidEndDate
  350. .substr(4, 2) + '-' +
  351. data1
  352. .customerInfo
  353. .identifyValidEndDate
  354. .substr(6, 2)
  355. }
  356. this.authInfo.identityTime = identifyValidDate + "," +
  357. identifyValidEndDate;
  358. }
  359. });
  360. }
  361. }
  362. })
  363. }
  364. },
  365. imgDel(name) {
  366. this[name] = "";
  367. },
  368. //页面返回按钮
  369. back() {
  370. uni.navigateBack({
  371. delta: 1, // 返回的页面数,如果是1表示返回上一页
  372. success: function() {}
  373. });
  374. },
  375. }
  376. }
  377. </script>
  378. <style lang="scss" scoped>
  379. ::v-deep .uni-forms-item {
  380. border-bottom: 1px solid #f2f2f2;
  381. }
  382. ::v-deep .uni-forms-item:last-child {
  383. border: none;
  384. }
  385. ::v-deep .uni-forms-item__content {
  386. display: flex;
  387. align-items: center;
  388. }
  389. page {
  390. background: #F7F7F7;
  391. }
  392. .headers {
  393. position: fixed;
  394. top: 0;
  395. left: 0;
  396. z-index: 999999;
  397. width: 100%;
  398. border-bottom: 1px solid #EEEEEE;
  399. .header {
  400. width: 100%;
  401. height: auto;
  402. padding: 50px 16px 14px;
  403. background: linear-gradient(180deg, #D1E3FE 0%, #FFFFFF 100%);
  404. text {
  405. font-size: 18px;
  406. font-weight: bold;
  407. color: #000;
  408. }
  409. }
  410. }
  411. .reviewResult {
  412. width: 100%;
  413. background: linear-gradient(90deg, #FFE2E0 0%, #FBF3F3 100%);
  414. border-radius: 0px 0px 0px 0px;
  415. border: 1px solid #FF535B;
  416. border-radius: 4px;
  417. padding: 8px 15px;
  418. margin-top: 96px;
  419. text:last-child {
  420. color: #333;
  421. font-size: 12px;
  422. }
  423. }
  424. .ImgInfo {
  425. background: #FFFFFF;
  426. border-radius: 5px;
  427. border-bottom: 1px solid #EEEEEE;
  428. .title {
  429. padding: 10px 0;
  430. .tag {
  431. width: 4px;
  432. height: 16px;
  433. background: linear-gradient(132deg, #83B4FC 0%, #3D74FE 100%);
  434. border-radius: 5px;
  435. }
  436. text {
  437. font-size: 16px;
  438. color: #333;
  439. font-weight: bold;
  440. margin-left: 6px;
  441. }
  442. }
  443. .content {
  444. padding: 0 10px 10px;
  445. .avatar {
  446. background: #FBFBFB;
  447. border-radius: 4px;
  448. padding: 7px 8px;
  449. .infoText {
  450. text:first-child {
  451. font-size: 14px;
  452. color: #333;
  453. font-weight: bold;
  454. }
  455. text:last-child {
  456. font-size: 12px;
  457. color: #999;
  458. }
  459. }
  460. .avatar-img {
  461. width: 180px;
  462. height: 109px;
  463. position: relative;
  464. padding: 7px;
  465. margin-top: 21px;
  466. background-image: url("/static/image/user/asset3.png");
  467. background-size: 100% 100%;
  468. image {
  469. width: 100%;
  470. height: 100%;
  471. border-radius: 4px;
  472. }
  473. .imgdel {
  474. width: 14px;
  475. height: 14px;
  476. position: absolute;
  477. right: 9px;
  478. bottom: 9px;
  479. border-radius: 0px;
  480. }
  481. }
  482. }
  483. }
  484. .infoForm {
  485. padding: 0 0 0;
  486. }
  487. }
  488. .footer {
  489. position: fixed;
  490. bottom: 0;
  491. height: 62px;
  492. background: #FFFFFF;
  493. box-shadow: 0px -4px 10px 0px rgba(1, 83, 255, 0.05);
  494. padding: 12px 16px;
  495. width: 100%;
  496. .btn {
  497. background: linear-gradient(90deg, rgba(73, 157, 255, 0.4) 0%, rgba(0, 82, 255, 0.4) 100%);
  498. background: linear-gradient(90deg, #499DFF 0%, #0052FF 100%);
  499. border-radius: 4px;
  500. padding: 7px;
  501. color: #FFFFFF;
  502. font-size: 16px;
  503. }
  504. }
  505. </style>