information.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  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. this.productInfo.type_data.forEach(val => {
  196. if (val.type === item.type + '') {
  197. item.type_keys = val.type_keys
  198. }
  199. })
  200. })
  201. }
  202. },
  203. onLoad(data) {
  204. if (data.draftId) {
  205. this.getDraftItem(data.draftId)
  206. this.isNew = false
  207. } else if (data.businessId) {
  208. this.getTaskDetail(data.businessId)
  209. this.isNew = false
  210. } else {
  211. if (data.productId === undefined) {
  212. tools.leftClick()
  213. } else {
  214. this.taskData.productId = data.productId
  215. this.getTaskTypeInfo(data.productId)
  216. }
  217. }
  218. setTimeout(() => {
  219. //5秒后开启缓记录
  220. this.isCache = false;
  221. }, 8000)
  222. uni.$on('putClientInfo', clientInfo => {
  223. if (this.taskData.clientInfo.id_number !== clientInfo.id_number) {
  224. this.taskData.clientInfo = clientInfo
  225. this.getClientInfo()
  226. } else {
  227. this.taskData.clientInfo = clientInfo
  228. this.verifyBusinessModuleKey(1)
  229. }
  230. })
  231. //更新资产信息
  232. uni.$on('putPropertyInfo', propertyInfo => {
  233. this.taskData.property = propertyInfo
  234. this.verifyBusinessModuleKey(2)
  235. })
  236. //更新申请信息
  237. uni.$on('putAppliesInfo', appliesInfo => {
  238. this.taskData.applies = appliesInfo
  239. this.verifyBusinessModuleKey(3)
  240. })
  241. //更新第三方信息
  242. uni.$on('putTripartiteInfo', tripartiteInfo => {
  243. this.taskData.tripartite = tripartiteInfo
  244. this.verifyBusinessModuleKey(4)
  245. })
  246. //更新联系人信息
  247. uni.$on('putLinkmenInfo', linkmenInfo => {
  248. this.taskData.linkman = linkmenInfo
  249. this.verifyBusinessModuleKey(5)
  250. })
  251. //putCreditData
  252. uni.$on('putCreditData', creditInfo => {
  253. this.taskData.credit = creditInfo
  254. this.verifyBusinessModuleKey(6)
  255. })
  256. },
  257. methods: {
  258. addTask() {
  259. console.log('addTask----start')
  260. // let isEnd=false;
  261. // this.productInfo.type_data.forEach((typeItem,typeKey)=>{
  262. // if(!typeItem.is_end && !isEnd && typeKey!==this.stepsNum){
  263. // isEnd=true
  264. // tools.error('完善'+typeItem.type_name)
  265. // }
  266. // })
  267. // if(isEnd){
  268. // return;
  269. // }
  270. if (this.isAjax) {
  271. return;
  272. }
  273. this.isAjax = true;
  274. addTask(this.taskData).then((res) => {
  275. if (res.code === 1) {
  276. tools.success(res.msg)
  277. // uni.$emit('goToTaskList', 0)
  278. setTimeout(() => {
  279. uni.redirectTo({
  280. url: 'page_task/task_details/task_details?taskId=' + res.data.id
  281. });
  282. }, 1500)
  283. } else {
  284. this.isAjax = false;
  285. tools.error(res.msg)
  286. }
  287. })
  288. },
  289. addDraft() {
  290. addDraft(this.taskData).then((res) => {
  291. if (res.code === 1) {
  292. tools.success(res.msg)
  293. delBusinessCache({
  294. 'productId': this.productInfo.id
  295. }).then((res) => {
  296. uni.$emit('setNewDraft')
  297. setTimeout(() => {
  298. tools.leftClick()
  299. }, 1000)
  300. })
  301. } else {
  302. tools.error(res.msg)
  303. }
  304. })
  305. },
  306. verifyBusinessModuleKey(verifyKey) {
  307. let data = {}
  308. if (verifyKey === 1) {
  309. data = this.taskData.clientInfo
  310. } else if (verifyKey === 2) {
  311. data = this.taskData.property
  312. } else if (verifyKey === 3) {
  313. data = this.taskData.applies
  314. } else if (verifyKey === 4) {
  315. data = this.taskData.tripartite
  316. } else if (verifyKey === 5) {
  317. data = this.taskData.linkman
  318. } else if (verifyKey === 6) {
  319. data = this.taskData.credit
  320. } else if (verifyKey === 7) {
  321. data = this.taskData.post_loan
  322. }
  323. this.setBusinessCache()
  324. verifyBusinessModuleKey({
  325. 'productId': this.productInfo.id,
  326. 'data': data,
  327. 'type': verifyKey
  328. }).then((res) => {
  329. this.informationList.forEach(item => {
  330. if (item.type === verifyKey) {
  331. item.is_finish = res.code === 1;
  332. }
  333. })
  334. })
  335. },
  336. getClientInfo() {
  337. //获取客户原始数据
  338. if (this.taskData.clientInfo.id_number === '') {
  339. return;
  340. }
  341. getClientInfo({
  342. 'id_number': this.taskData.clientInfo.id_number,
  343. 'productId': this.taskData.productId
  344. }).then((res) => {
  345. if (res.code === 1) {
  346. this.isNew = false
  347. if (res.data.business) {
  348. res.data.business.id = ''
  349. this.taskData.clientInfo = res.data.business
  350. uni.$emit('setClientData', this.taskData.clientInfo)
  351. }
  352. if (res.data.propertyList) {
  353. this.taskData.property = res.data.propertyList
  354. if (this.taskData.property) {
  355. this.taskData.property.forEach((item) => {
  356. item.id = ''
  357. })
  358. }
  359. }
  360. if (res.data.applyFor) {
  361. res.data.applyFor.id = ''
  362. this.taskData.applies = res.data.applyFor
  363. if (this.taskData.applies.apply_data) {
  364. this.taskData.applies.apply_data.forEach((item) => {
  365. item.id = ''
  366. })
  367. }
  368. }
  369. if (res.data.tripartite) {
  370. this.taskData.tripartite = res.data.tripartite
  371. this.taskData.tripartite.forEach((item) => {
  372. item.id = ''
  373. })
  374. }
  375. if (res.data.linkman) {
  376. res.data.linkman.forEach((item) => {
  377. item.id = ''
  378. })
  379. this.taskData.linkman = res.data.linkman
  380. }
  381. if (res.data.credit) {
  382. this.taskData.credit = res.data.credit
  383. this.taskData.credit.deal_data.forEach((item) => {
  384. item.id = ''
  385. })
  386. this.taskData.credit.overdue_data.forEach((item) => {
  387. item.id = ''
  388. })
  389. this.taskData.credit.query_data.forEach((item) => {
  390. item.id = ''
  391. })
  392. }
  393. if (res.data.postLoan) {
  394. this.taskData.post_loan = res.data.postLoan
  395. }
  396. }
  397. })
  398. },
  399. setBusinessCache() {
  400. //设置缓存
  401. if (this.isCache) {
  402. return false
  403. }
  404. this.isCache = true
  405. setBusinessCache(this.taskData).then((res) => {
  406. setTimeout(() => {
  407. this.isCache = false;
  408. }, 2000)
  409. })
  410. },
  411. getBusinessCache(productId) {
  412. //获取缓存
  413. getBusinessCache({
  414. 'productId': productId
  415. }).then((res) => {
  416. if (res.code === 1) {
  417. if (res.data.productId !== 0) {
  418. this.isNew = false
  419. this.taskData = res.data
  420. }
  421. }
  422. })
  423. },
  424. getTaskTypeInfo(id) {
  425. getTaskTypeInfo({
  426. 'id': id
  427. }).then((res) => {
  428. if (res.code === 1) {
  429. this.productInfo = res.data;
  430. if (this.isNew) this.getBusinessCache(id)
  431. } else {
  432. tools.error(res.msg)
  433. setTimeout(() => {
  434. this.closePage();
  435. }, 1000)
  436. }
  437. })
  438. },
  439. getDraftItem(draftId) {
  440. getDraftItem({
  441. 'draftId': draftId
  442. }).then((res) => {
  443. if (res.code === 1) {
  444. this.productInfo = res.data.productInfo
  445. this.taskData = res.data.taskData
  446. this.productInfo.product_types.forEach(item=>{
  447. this.verifyBusinessModuleKey(item*1)
  448. })
  449. // this.getTaskTypeInfo(this.taskData.productId)
  450. } else {
  451. this.closePage();
  452. }
  453. })
  454. },
  455. async getTaskDetail(businessId) {
  456. const res = await getTaskDetail({
  457. id: businessId
  458. })
  459. if (res.code === 1) {
  460. if (res.data.product) {
  461. this.productInfo = res.data.product
  462. this.taskData.productId = res.data.product.id
  463. }
  464. if (res.data.business) {
  465. this.taskData.clientInfo = res.data.business
  466. }
  467. if (res.data.propertyList) {
  468. this.taskData.property = res.data.propertyList
  469. }
  470. if (res.data.applyFor) {
  471. this.taskData.applies = res.data.applyFor
  472. }
  473. if (res.data.tripartite) {
  474. this.taskData.tripartite = res.data.tripartite
  475. }
  476. if (res.data.linkman) {
  477. this.taskData.linkman = res.data.linkman
  478. console.log('this.taskData.linkman:', this.taskData.linkman)
  479. }
  480. if (res.data.credit) {
  481. this.taskData.credit = res.data.credit
  482. }
  483. if (res.data.postLoan) {
  484. this.taskData.post_loan = res.data.postLoan
  485. }
  486. this.getTaskTypeInfo(this.taskData.productId)
  487. } else {
  488. this.closePage();
  489. }
  490. },
  491. delBusinessCache() {
  492. uni.showModal({
  493. title: '警告',
  494. content: '是否退出当前任务,并清除缓存!',
  495. success: (res) => {
  496. if (res.confirm) {
  497. delBusinessCache({
  498. 'productId': this.productInfo.id
  499. }).then((res) => {
  500. tools.leftClick()
  501. })
  502. uni.removeStorageSync('creditImg');
  503. } else {
  504. tools.leftClick()
  505. }
  506. }
  507. });
  508. },
  509. onAuthentication(item) {
  510. if (item.type === 1) {
  511. uni.setStorageSync('clientInfoKey', item.type_keys)
  512. uni.setStorageSync('clientInfoData', this.taskData.clientInfo)
  513. } else if (item.type === 2) {
  514. uni.setStorageSync('propertyKey', item.type_keys)
  515. uni.setStorageSync('propertyData', this.taskData.property)
  516. } else if (item.type === 3) {
  517. uni.setStorageSync('propertyData', this.taskData.property)
  518. uni.setStorageSync('appliesKey', item.type_keys)
  519. uni.setStorageSync('appliesData', this.taskData.applies)
  520. } else if (item.type === 4) {
  521. uni.setStorageSync('tripartiteKey', item.type_keys)
  522. uni.setStorageSync('tripartiteData', this.taskData.tripartite)
  523. } else if (item.type === 5) {
  524. uni.setStorageSync('linkmanKey', item.type_keys)
  525. uni.setStorageSync('linkmanData', this.taskData.linkman)
  526. } else if (item.type === 6) {
  527. uni.setStorageSync('creditKey', item.type_keys)
  528. uni.setStorageSync('creditData', this.taskData.credit)
  529. } else if (item.type === 7) {
  530. uni.setStorageSync('postLoanKey', item.type_keys)
  531. uni.setStorageSync('postLoanData', this.taskData.post_loan)
  532. }
  533. uni.navigateTo({
  534. url: `${item.path}?title=${item.name}`
  535. })
  536. },
  537. closePage() {
  538. tools.leftClick()
  539. },
  540. }
  541. }
  542. </script>
  543. <style lang="scss" scoped>
  544. .info_button {
  545. width: 130rpx;
  546. height: 60rpx;
  547. border: none;
  548. line-height: 60rpx;
  549. }
  550. button::after {
  551. border: none;
  552. }
  553. </style>