information.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. <template>
  2. <view class="total-page page-box task-bg">
  3. <Nav :title="productInfo.product_name" :genre="1" :toBack="false" @onBack="delBusinessCache" 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=[]
  356. // let pKey=[]
  357. // for (const informationKey in this.informationList) {
  358. // if(this.informationList[informationKey].type===2){
  359. // pKey=this.informationList[informationKey].type_keys
  360. // }
  361. // }
  362. // res.data.propertyList.forEach(item=>{
  363. // item.id = ''
  364. // if(item.property_type*1===1){
  365. // if(pKey.indexOf('house_item')>=0){
  366. // this.taskData.property.push(item)
  367. // }
  368. // }else if(item.property_type*1===2){
  369. // if(pKey.indexOf('car_item')>=0){
  370. // this.taskData.property.push(item)
  371. // }
  372. // }else if(item.property_type*1===3){
  373. // if(pKey.indexOf('insurance_item')>=0){
  374. // this.taskData.property.push(item)
  375. // }
  376. // }else if(item.property_type*1===4){
  377. // if(pKey.indexOf('firm_item')>=0){
  378. // this.taskData.property.push(item)
  379. // }
  380. // }
  381. // })
  382. }
  383. if (res.data.applyFor) {
  384. res.data.applyFor.id = ''
  385. this.taskData.applies = res.data.applyFor
  386. if (this.taskData.applies.apply_data) {
  387. this.taskData.applies.apply_data.forEach((item) => {
  388. item.id = ''
  389. })
  390. }
  391. }
  392. if (res.data.tripartite) {
  393. this.taskData.tripartite = res.data.tripartite
  394. this.taskData.tripartite.forEach((item) => {
  395. item.id = ''
  396. })
  397. }
  398. if (res.data.linkman) {
  399. res.data.linkman.forEach((item) => {
  400. item.id = ''
  401. })
  402. this.taskData.linkman = res.data.linkman
  403. }
  404. if (res.data.credit) {
  405. this.taskData.credit = res.data.credit
  406. this.taskData.credit.deal_data.forEach((item) => {
  407. item.id = ''
  408. })
  409. this.taskData.credit.overdue_data.forEach((item) => {
  410. item.id = ''
  411. })
  412. this.taskData.credit.query_data.forEach((item) => {
  413. item.id = ''
  414. })
  415. }
  416. if (res.data.postLoan) {
  417. this.taskData.post_loan = res.data.postLoan
  418. }
  419. }
  420. })
  421. },
  422. setBusinessCache() {
  423. //设置缓存
  424. if (this.isCache) {
  425. return false
  426. }
  427. this.isCache = true
  428. setBusinessCache(this.taskData).then((res) => {
  429. setTimeout(() => {
  430. this.isCache = false;
  431. }, 2000)
  432. })
  433. },
  434. getBusinessCache(productId) {
  435. //获取缓存
  436. getBusinessCache({
  437. 'productId': productId
  438. }).then((res) => {
  439. if (res.code === 1) {
  440. if (res.data.productId !== 0) {
  441. this.isNew = false
  442. this.taskData = res.data
  443. }
  444. }
  445. })
  446. },
  447. getTaskTypeInfo(id) {
  448. getTaskTypeInfo({
  449. 'id': id
  450. }).then((res) => {
  451. if (res.code === 1) {
  452. this.productInfo = res.data;
  453. if (this.isNew) this.getBusinessCache(id)
  454. } else {
  455. tools.error(res.msg)
  456. setTimeout(() => {
  457. this.closePage();
  458. }, 1000)
  459. }
  460. })
  461. },
  462. getDraftItem(draftId) {
  463. getDraftItem({
  464. 'draftId': draftId
  465. }).then((res) => {
  466. if (res.code === 1) {
  467. this.productInfo = res.data.productInfo
  468. this.taskData = res.data.taskData
  469. for (const resKey in this.productInfo.product_types) {
  470. let productType=this.productInfo.product_types[resKey]*1
  471. this.verifyBusinessModuleKey(productType)
  472. }
  473. this.getTaskTypeInfo(this.taskData.productId)
  474. } else {
  475. this.closePage();
  476. }
  477. })
  478. },
  479. async getTaskDetail(businessId) {
  480. const res = await getTaskDetail({
  481. id: businessId
  482. })
  483. if (res.code === 1) {
  484. if (res.data.product) {
  485. this.productInfo = res.data.product
  486. this.taskData.productId = res.data.product.id
  487. }
  488. if (res.data.business) {
  489. this.taskData.clientInfo = res.data.business
  490. }
  491. if (res.data.propertyList) {
  492. this.taskData.property = res.data.propertyList
  493. }
  494. if (res.data.applyFor) {
  495. this.taskData.applies = res.data.applyFor
  496. }
  497. if (res.data.tripartite) {
  498. this.taskData.tripartite = res.data.tripartite
  499. }
  500. if (res.data.linkman) {
  501. this.taskData.linkman = res.data.linkman
  502. }
  503. if (res.data.credit) {
  504. this.taskData.credit = res.data.credit
  505. }
  506. if (res.data.postLoan) {
  507. this.taskData.post_loan = res.data.postLoan
  508. }
  509. this.getTaskTypeInfo(this.taskData.productId)
  510. } else {
  511. this.closePage();
  512. }
  513. },
  514. delBusinessCache() {
  515. uni.showModal({
  516. title: '警告',
  517. content: '是否退出当前任务,并清除缓存!',
  518. success: (res) => {
  519. if (res.confirm) {
  520. delBusinessCache({
  521. 'productId': this.productInfo.id
  522. }).then((res) => {
  523. tools.leftClick()
  524. })
  525. uni.removeStorageSync('creditImg');
  526. } else {
  527. tools.leftClick()
  528. }
  529. }
  530. });
  531. },
  532. onAuthentication(item) {
  533. if (item.type === 1) {
  534. uni.setStorageSync('clientInfoKey', item.type_keys)
  535. uni.setStorageSync('clientInfoData', this.taskData.clientInfo)
  536. } else if (item.type === 2) {
  537. uni.setStorageSync('propertyKey', item.type_keys)
  538. uni.setStorageSync('propertyData', this.taskData.property)
  539. } else if (item.type === 3) {
  540. uni.setStorageSync('propertyData', this.taskData.property)
  541. uni.setStorageSync('appliesKey', item.type_keys)
  542. uni.setStorageSync('appliesData', this.taskData.applies)
  543. } else if (item.type === 4) {
  544. uni.setStorageSync('tripartiteKey', item.type_keys)
  545. uni.setStorageSync('tripartiteData', this.taskData.tripartite)
  546. } else if (item.type === 5) {
  547. uni.setStorageSync('linkmanKey', item.type_keys)
  548. uni.setStorageSync('linkmanData', this.taskData.linkman)
  549. } else if (item.type === 6) {
  550. uni.setStorageSync('creditKey', item.type_keys)
  551. uni.setStorageSync('creditData', this.taskData.credit)
  552. } else if (item.type === 7) {
  553. uni.setStorageSync('postLoanKey', item.type_keys)
  554. uni.setStorageSync('postLoanData', this.taskData.post_loan)
  555. }
  556. uni.navigateTo({
  557. url: `${item.path}?title=${item.name}`
  558. })
  559. },
  560. closePage() {
  561. tools.leftClick()
  562. },
  563. }
  564. }
  565. </script>
  566. <style lang="scss" scoped>
  567. .info_button {
  568. width: 130rpx;
  569. height: 60rpx;
  570. border: none;
  571. line-height: 60rpx;
  572. }
  573. button::after {
  574. border: none;
  575. }
  576. </style>