information.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. <template>
  2. <view class="total-page page-box task-bg">
  3. <Nav :title="productInfo.product_name" :genre="1" is_fixed></Nav>
  4. <view class="task-tabs" :style="{top:`${$tools.topHeight()}px`}">
  5. <view class="m-t20">
  6. <view class="creation_item row-justify-sb center sys-background-fff m-lr30 m-b20 p-30 r-20"
  7. v-for="(item,index) in informationList" :key="index" v-show="item.is_show"
  8. @click="onAuthentication(item)">
  9. <view class="row-c">
  10. <image class="wh-80 m-r20 r-100" :src="item.icon" mode="aspectFill"></image>
  11. <view>
  12. <text class="size-28 text-color-12 sys-weight-600">{{item.name}}</text>
  13. <view class="size-24 text-color-999 m-t10">{{item.explain}}</view>
  14. </view>
  15. </view>
  16. <view class="">
  17. <button class="button-background info_button sys-weight-500 text-color-fff size-26 r-100"
  18. v-if="item.is_finish">已完成</button>
  19. <button class="sys-bg-CBCBCB info_button sys-weight-500 text-color-fff size-26 r-100"
  20. v-else>待上传</button>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. <EnButton :is_both="1" :leftText="'保存草稿'" :rightText="'提交资料'" @onLeftSubmit="addDraft" @onSubmit="addTask">
  26. </EnButton>
  27. </view>
  28. </template>
  29. <script>
  30. import TaskImgTab from "@/common/task/task_ima_tab.vue"
  31. import tools from "@/service/tools";
  32. import {
  33. addDraft,
  34. addTask,
  35. delBusinessCache,
  36. getBusinessCache,
  37. getClientInfo,
  38. getDraftItem,
  39. getTaskDetail,
  40. getTaskTypeInfo,
  41. setBusinessCache,
  42. verifyBusinessModuleKey
  43. } from "@/api/task";
  44. export default {
  45. components: {
  46. TaskImgTab,
  47. },
  48. data() {
  49. return {
  50. title: '',
  51. informationList: [{
  52. name: '身份信息',
  53. explain: '身份证、婚姻、职业、社保信息',
  54. icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-identity.png',
  55. path: '/page_task/identity/identity',
  56. type: 1,
  57. is_finish: false,
  58. is_show: false,
  59. type_keys: []
  60. }, {
  61. name: '资产信息',
  62. explain: '房产、车辆等资产',
  63. icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-property.png',
  64. path: '/page_task/property/property',
  65. type: 2,
  66. is_finish: false,
  67. is_show: false,
  68. type_keys: []
  69. }, {
  70. name: '申请信息',
  71. explain: '贷款额度信息',
  72. icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-apply.png',
  73. path: '/page_task/apply/apply',
  74. type: 3,
  75. is_finish: false,
  76. is_show: false,
  77. type_keys: []
  78. }, {
  79. name: '第三方信息',
  80. explain: '第三方企业/人员相关信息',
  81. icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-three.png',
  82. path: '/page_task/tripartite_info/tripartite_info',
  83. type: 4,
  84. is_finish: false,
  85. is_show: false,
  86. type_keys: []
  87. }, {
  88. name: '联系人信息',
  89. explain: '其他联系人',
  90. icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-contacts.png',
  91. type: 5,
  92. path: '/page_task/linkman/linkman',
  93. is_finish: false,
  94. is_show: false,
  95. type_keys: []
  96. }, {
  97. name: '征信信息',
  98. explain: '银行征信信息',
  99. icon: 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-credit.png',
  100. path: '/page_task/credit_upload/credit_upload',
  101. type: 6,
  102. is_finish: false,
  103. is_show: false,
  104. type_keys: []
  105. }, ],
  106. stepsNum: 0,
  107. stepsKey: 0,
  108. productInfo: {
  109. id: 1,
  110. product_name: "",
  111. product_types: '',
  112. field_ids: [],
  113. type_data: [],
  114. },
  115. taskData: {
  116. 'productId': '',
  117. "clientInfo": {
  118. "name": "",
  119. "birthday": "",
  120. "sex": 1,
  121. "id_number": "",
  122. "identity_one": "",
  123. "identity_two": "",
  124. "phone": "",
  125. "marriage_type": 1,
  126. "education_type": '',
  127. "education_name": '',
  128. "employ_type": 1,
  129. "firm_name": "",
  130. "firm_address": "",
  131. "resident_city": "",
  132. "resident_address": "",
  133. "mate_name": "",
  134. "mate_phone": "",
  135. "mate_id_number": "",
  136. "mate_firm": "",
  137. "m_code": "",
  138. "code": "",
  139. "m_identity_one": "",
  140. "m_identity_two": "",
  141. "firm_city": "",
  142. "social_num": "",
  143. "reserved_money": "",
  144. "marriage_img": [],
  145. "credit_img": []
  146. },
  147. "property": [],
  148. "applies": {
  149. "is_farming": '1',
  150. "loan_form": '',
  151. "loan_type": '',
  152. "loan_industry": [],
  153. "enterprise_type": "",
  154. "use_date": "",
  155. "pay_status": '1',
  156. "quota": "",
  157. "apply_data": []
  158. },
  159. "tripartite": [],
  160. "linkman": [],
  161. "credit": {
  162. 'credit_img': [],
  163. 'deal_data': [],
  164. 'overdue_data': [],
  165. 'query_data': [],
  166. },
  167. "post_loan": {
  168. 'bank_id': '',
  169. 'loans_money': '',
  170. 'interest_rate': '',
  171. 'repayment_money': '',
  172. 'refund_num': '',
  173. 'repayment_type': '',
  174. 'repayment_date': '',
  175. },
  176. },
  177. isCache: true,
  178. isNew: true
  179. }
  180. },
  181. watch: {
  182. 'taskData': {
  183. handler() {
  184. this.setBusinessCache()
  185. },
  186. deep: true
  187. },
  188. 'productInfo.product_types': function() {
  189. let productTypes = this.productInfo.product_types
  190. if (typeof productTypes === 'string') {
  191. productTypes = productTypes.split(',')
  192. }
  193. this.informationList.forEach(item => {
  194. item.is_show = productTypes.indexOf(item.type + '') >= 0;
  195. if(this.productInfo.type_data){
  196. this.productInfo.type_data.forEach(val => {
  197. if (val.type === item.type + '') {
  198. item.type_keys = val.type_keys
  199. }
  200. })
  201. }
  202. })
  203. }
  204. },
  205. onLoad(data) {
  206. if (data.draftId) {
  207. this.getDraftItem(data.draftId)
  208. this.isNew = false
  209. } else if (data.businessId) {
  210. this.getTaskDetail(data.businessId)
  211. this.isNew = false
  212. } else {
  213. if (data.productId === undefined) {
  214. tools.leftClick()
  215. } else {
  216. this.taskData.productId = data.productId
  217. this.getTaskTypeInfo(data.productId)
  218. }
  219. }
  220. setTimeout(() => {
  221. //5秒后开启缓记录
  222. this.isCache = false;
  223. }, 8000)
  224. uni.$on('putClientInfo', clientInfo => {
  225. if (this.taskData.clientInfo.id_number !== clientInfo.id_number) {
  226. this.taskData.clientInfo = clientInfo
  227. this.getClientInfo()
  228. } else {
  229. this.taskData.clientInfo = clientInfo
  230. this.verifyBusinessModuleKey(1)
  231. }
  232. })
  233. //更新资产信息
  234. uni.$on('putPropertyInfo', propertyInfo => {
  235. this.taskData.property = propertyInfo
  236. this.verifyBusinessModuleKey(2)
  237. })
  238. //更新申请信息
  239. uni.$on('putAppliesInfo', appliesInfo => {
  240. this.taskData.applies = appliesInfo
  241. this.verifyBusinessModuleKey(3)
  242. })
  243. //更新第三方信息
  244. uni.$on('putTripartiteInfo', tripartiteInfo => {
  245. this.taskData.tripartite = tripartiteInfo
  246. this.verifyBusinessModuleKey(4)
  247. })
  248. //更新联系人信息
  249. uni.$on('putLinkmenInfo', linkmenInfo => {
  250. this.taskData.linkman = linkmenInfo
  251. this.verifyBusinessModuleKey(5)
  252. })
  253. //putCreditData
  254. uni.$on('putCreditData', creditInfo => {
  255. this.taskData.credit = creditInfo
  256. this.verifyBusinessModuleKey(6)
  257. })
  258. },
  259. methods: {
  260. addTask() {
  261. console.log('addTask----start')
  262. // let isEnd=false;
  263. // this.productInfo.type_data.forEach((typeItem,typeKey)=>{
  264. // if(!typeItem.is_end && !isEnd && typeKey!==this.stepsNum){
  265. // isEnd=true
  266. // tools.error('完善'+typeItem.type_name)
  267. // }
  268. // })
  269. // if(isEnd){
  270. // return;
  271. // }
  272. if (this.isAjax) {
  273. return;
  274. }
  275. this.isAjax = true;
  276. addTask(this.taskData).then((res) => {
  277. if (res.code === 1) {
  278. tools.success(res.msg)
  279. // uni.$emit('goToTaskList', 0)
  280. setTimeout(() => {
  281. uni.redirectTo({
  282. url: 'page_task/task_details/task_details?taskId=' + res.data.id
  283. });
  284. }, 1500)
  285. } else {
  286. this.isAjax = false;
  287. tools.error(res.msg)
  288. }
  289. })
  290. },
  291. addDraft() {
  292. addDraft(this.taskData).then((res) => {
  293. if (res.code === 1) {
  294. tools.success(res.msg)
  295. delBusinessCache({
  296. 'productId': this.productInfo.id
  297. }).then((res) => {
  298. uni.$emit('setNewDraft')
  299. setTimeout(() => {
  300. tools.leftClick()
  301. }, 1000)
  302. })
  303. } else {
  304. tools.error(res.msg)
  305. }
  306. })
  307. },
  308. verifyBusinessModuleKey(verifyKey) {
  309. let data = {}
  310. if (verifyKey === 1) {
  311. data = this.taskData.clientInfo
  312. } else if (verifyKey === 2) {
  313. data = this.taskData.property
  314. } else if (verifyKey === 3) {
  315. data = this.taskData.applies
  316. } else if (verifyKey === 4) {
  317. data = this.taskData.tripartite
  318. } else if (verifyKey === 5) {
  319. data = this.taskData.linkman
  320. } else if (verifyKey === 6) {
  321. data = this.taskData.credit
  322. } else if (verifyKey === 7) {
  323. data = this.taskData.post_loan
  324. }
  325. this.setBusinessCache()
  326. verifyBusinessModuleKey({
  327. 'productId': this.productInfo.id,
  328. 'data': data,
  329. 'type': verifyKey
  330. }).then((res) => {
  331. this.informationList.forEach(item => {
  332. if (item.type === verifyKey) {
  333. item.is_finish = res.code === 1;
  334. }
  335. })
  336. })
  337. },
  338. getClientInfo() {
  339. //获取客户原始数据
  340. if (this.taskData.clientInfo.id_number === '') {
  341. return;
  342. }
  343. getClientInfo({
  344. 'id_number': this.taskData.clientInfo.id_number,
  345. 'productId': this.taskData.productId
  346. }).then((res) => {
  347. if (res.code === 1) {
  348. this.isNew = false
  349. if (res.data.business) {
  350. res.data.business.id = ''
  351. this.taskData.clientInfo = res.data.business
  352. uni.$emit('setClientData', this.taskData.clientInfo)
  353. }
  354. if (res.data.propertyList) {
  355. this.taskData.property = res.data.propertyList
  356. if (this.taskData.property) {
  357. this.taskData.property.forEach((item) => {
  358. item.id = ''
  359. })
  360. }
  361. }
  362. if (res.data.applyFor) {
  363. res.data.applyFor.id = ''
  364. this.taskData.applies = res.data.applyFor
  365. if (this.taskData.applies.apply_data) {
  366. this.taskData.applies.apply_data.forEach((item) => {
  367. item.id = ''
  368. })
  369. }
  370. }
  371. if (res.data.tripartite) {
  372. this.taskData.tripartite = res.data.tripartite
  373. this.taskData.tripartite.forEach((item) => {
  374. item.id = ''
  375. })
  376. }
  377. if (res.data.linkman) {
  378. res.data.linkman.forEach((item) => {
  379. item.id = ''
  380. })
  381. this.taskData.linkman = res.data.linkman
  382. }
  383. if (res.data.credit) {
  384. this.taskData.credit = res.data.credit
  385. this.taskData.credit.deal_data.forEach((item) => {
  386. item.id = ''
  387. })
  388. this.taskData.credit.overdue_data.forEach((item) => {
  389. item.id = ''
  390. })
  391. this.taskData.credit.query_data.forEach((item) => {
  392. item.id = ''
  393. })
  394. }
  395. if (res.data.postLoan) {
  396. this.taskData.post_loan = res.data.postLoan
  397. }
  398. }
  399. })
  400. },
  401. setBusinessCache() {
  402. //设置缓存
  403. if (this.isCache) {
  404. return false
  405. }
  406. this.isCache = true
  407. setBusinessCache(this.taskData).then((res) => {
  408. setTimeout(() => {
  409. this.isCache = false;
  410. }, 2000)
  411. })
  412. },
  413. getBusinessCache(productId) {
  414. //获取缓存
  415. getBusinessCache({
  416. 'productId': productId
  417. }).then((res) => {
  418. if (res.code === 1) {
  419. if (res.data.productId !== 0) {
  420. this.isNew = false
  421. this.taskData = res.data
  422. }
  423. }
  424. })
  425. },
  426. getTaskTypeInfo(id) {
  427. getTaskTypeInfo({
  428. 'id': id
  429. }).then((res) => {
  430. if (res.code === 1) {
  431. this.productInfo = res.data;
  432. if (this.isNew) this.getBusinessCache(id)
  433. } else {
  434. tools.error(res.msg)
  435. setTimeout(() => {
  436. this.closePage();
  437. }, 1000)
  438. }
  439. })
  440. },
  441. getDraftItem(draftId) {
  442. getDraftItem({
  443. 'draftId': draftId
  444. }).then((res) => {
  445. if (res.code === 1) {
  446. this.productInfo = res.data.productInfo
  447. this.taskData = res.data.taskData
  448. for (const resKey in this.productInfo.product_types) {
  449. let productType=this.productInfo.product_types[resKey]*1
  450. this.verifyBusinessModuleKey(productType)
  451. }
  452. this.getTaskTypeInfo(this.taskData.productId)
  453. } else {
  454. this.closePage();
  455. }
  456. })
  457. },
  458. async getTaskDetail(businessId) {
  459. const res = await getTaskDetail({
  460. id: businessId
  461. })
  462. if (res.code === 1) {
  463. if (res.data.product) {
  464. this.productInfo = res.data.product
  465. this.taskData.productId = res.data.product.id
  466. }
  467. if (res.data.business) {
  468. this.taskData.clientInfo = res.data.business
  469. }
  470. if (res.data.propertyList) {
  471. this.taskData.property = res.data.propertyList
  472. }
  473. if (res.data.applyFor) {
  474. this.taskData.applies = res.data.applyFor
  475. }
  476. if (res.data.tripartite) {
  477. this.taskData.tripartite = res.data.tripartite
  478. }
  479. if (res.data.linkman) {
  480. this.taskData.linkman = res.data.linkman
  481. console.log('this.taskData.linkman:', this.taskData.linkman)
  482. }
  483. if (res.data.credit) {
  484. this.taskData.credit = res.data.credit
  485. }
  486. if (res.data.postLoan) {
  487. this.taskData.post_loan = res.data.postLoan
  488. }
  489. this.getTaskTypeInfo(this.taskData.productId)
  490. } else {
  491. this.closePage();
  492. }
  493. },
  494. delBusinessCache() {
  495. uni.showModal({
  496. title: '警告',
  497. content: '是否退出当前任务,并清除缓存!',
  498. success: (res) => {
  499. if (res.confirm) {
  500. delBusinessCache({
  501. 'productId': this.productInfo.id
  502. }).then((res) => {
  503. tools.leftClick()
  504. })
  505. uni.removeStorageSync('creditImg');
  506. } else {
  507. tools.leftClick()
  508. }
  509. }
  510. });
  511. },
  512. onAuthentication(item) {
  513. if (item.type === 1) {
  514. uni.setStorageSync('clientInfoKey', item.type_keys)
  515. uni.setStorageSync('clientInfoData', this.taskData.clientInfo)
  516. } else if (item.type === 2) {
  517. uni.setStorageSync('propertyKey', item.type_keys)
  518. uni.setStorageSync('propertyData', this.taskData.property)
  519. } else if (item.type === 3) {
  520. uni.setStorageSync('propertyData', this.taskData.property)
  521. uni.setStorageSync('appliesKey', item.type_keys)
  522. uni.setStorageSync('appliesData', this.taskData.applies)
  523. } else if (item.type === 4) {
  524. uni.setStorageSync('tripartiteKey', item.type_keys)
  525. uni.setStorageSync('tripartiteData', this.taskData.tripartite)
  526. } else if (item.type === 5) {
  527. uni.setStorageSync('linkmanKey', item.type_keys)
  528. uni.setStorageSync('linkmanData', this.taskData.linkman)
  529. } else if (item.type === 6) {
  530. uni.setStorageSync('creditKey', item.type_keys)
  531. uni.setStorageSync('creditData', this.taskData.credit)
  532. } else if (item.type === 7) {
  533. uni.setStorageSync('postLoanKey', item.type_keys)
  534. uni.setStorageSync('postLoanData', this.taskData.post_loan)
  535. }
  536. uni.navigateTo({
  537. url: `${item.path}?title=${item.name}`
  538. })
  539. },
  540. closePage() {
  541. tools.leftClick()
  542. },
  543. }
  544. }
  545. </script>
  546. <style lang="scss" scoped>
  547. .info_button {
  548. width: 130rpx;
  549. height: 60rpx;
  550. border: none;
  551. line-height: 60rpx;
  552. }
  553. button::after {
  554. border: none;
  555. }
  556. </style>