information.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  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. 'https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task/task-credit.png'
  164. ],
  165. 'deal_data': [],
  166. 'overdue_data': [],
  167. 'query_data': [],
  168. },
  169. "post_loan": {
  170. 'bank_id': '',
  171. 'loans_money': '',
  172. 'interest_rate': '',
  173. 'repayment_money': '',
  174. 'refund_num': '',
  175. 'repayment_type': '',
  176. 'repayment_date': '',
  177. },
  178. },
  179. isCache: true,
  180. isNew: true
  181. }
  182. },
  183. watch: {
  184. 'taskData': {
  185. handler() {
  186. this.setBusinessCache()
  187. },
  188. deep: true
  189. },
  190. 'productInfo.product_types': function() {
  191. let productTypes = this.productInfo.product_types
  192. if (typeof productTypes === 'string') {
  193. productTypes = productTypes.split(',')
  194. }
  195. this.informationList.forEach(item => {
  196. item.is_show = productTypes.indexOf(item.type + '') >= 0;
  197. this.productInfo.type_data.forEach(val => {
  198. if (val.type === item.type + '') {
  199. item.type_keys = val.type_keys
  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. },
  254. methods: {
  255. addTask() {
  256. console.log('addTask----start')
  257. // let isEnd=false;
  258. // this.productInfo.type_data.forEach((typeItem,typeKey)=>{
  259. // if(!typeItem.is_end && !isEnd && typeKey!==this.stepsNum){
  260. // isEnd=true
  261. // tools.error('完善'+typeItem.type_name)
  262. // }
  263. // })
  264. // if(isEnd){
  265. // return;
  266. // }
  267. if (this.isAjax) {
  268. return;
  269. }
  270. this.isAjax = true;
  271. addTask(this.taskData).then((res) => {
  272. if (res.code === 1) {
  273. tools.success(res.msg)
  274. // uni.$emit('goToTaskList', 0)
  275. setTimeout(() => {
  276. uni.redirectTo({
  277. url: 'page_task/task_details/task_details?taskId=' + res.data.id
  278. });
  279. }, 1500)
  280. } else {
  281. this.isAjax = false;
  282. tools.error(res.msg)
  283. }
  284. })
  285. },
  286. addDraft() {
  287. addDraft(this.taskData).then((res) => {
  288. if (res.code === 1) {
  289. tools.success(res.msg)
  290. delBusinessCache({
  291. 'productId': this.productInfo.id
  292. }).then((res) => {
  293. uni.$emit('setNewDraft')
  294. setTimeout(() => {
  295. tools.leftClick()
  296. }, 1000)
  297. })
  298. } else {
  299. tools.error(res.msg)
  300. }
  301. })
  302. },
  303. verifyBusinessModuleKey(verifyKey) {
  304. let data = {}
  305. if (verifyKey === 1) {
  306. data = this.taskData.clientInfo
  307. } else if (verifyKey === 2) {
  308. data = this.taskData.property
  309. } else if (verifyKey === 3) {
  310. data = this.taskData.applies
  311. } else if (verifyKey === 4) {
  312. data = this.taskData.tripartite
  313. } else if (verifyKey === 5) {
  314. data = this.taskData.linkman
  315. } else if (verifyKey === 6) {
  316. data = this.taskData.credit
  317. } else if (verifyKey === 7) {
  318. data = this.taskData.post_loan
  319. }
  320. this.setBusinessCache()
  321. verifyBusinessModuleKey({
  322. 'productId': this.productInfo.id,
  323. 'data': data,
  324. 'type': verifyKey
  325. }).then((res) => {
  326. this.informationList.forEach(item => {
  327. if (item.type === verifyKey) {
  328. item.is_finish = res.code === 1;
  329. }
  330. })
  331. })
  332. },
  333. getClientInfo() {
  334. //获取客户原始数据
  335. if (this.taskData.clientInfo.id_number === '') {
  336. return;
  337. }
  338. getClientInfo({
  339. 'id_number': this.taskData.clientInfo.id_number,
  340. 'productId': this.taskData.productId
  341. }).then((res) => {
  342. if (res.code === 1) {
  343. this.isNew = false
  344. if (res.data.business) {
  345. res.data.business.id = ''
  346. this.taskData.clientInfo = res.data.business
  347. uni.$emit('setClientData', this.taskData.clientInfo)
  348. }
  349. if (res.data.propertyList) {
  350. this.taskData.property = res.data.propertyList
  351. if (this.taskData.property) {
  352. this.taskData.property.forEach((item) => {
  353. item.id = ''
  354. })
  355. }
  356. }
  357. if (res.data.applyFor) {
  358. res.data.applyFor.id = ''
  359. this.taskData.applies = res.data.applyFor
  360. if (this.taskData.applies.apply_data) {
  361. this.taskData.applies.apply_data.forEach((item) => {
  362. item.id = ''
  363. })
  364. }
  365. }
  366. if (res.data.tripartite) {
  367. this.taskData.tripartite = res.data.tripartite
  368. this.taskData.tripartite.forEach((item) => {
  369. item.id = ''
  370. })
  371. }
  372. if (res.data.linkman) {
  373. res.data.linkman.forEach((item) => {
  374. item.id = ''
  375. })
  376. this.taskData.linkman = res.data.linkman
  377. }
  378. if (res.data.credit) {
  379. this.taskData.credit = res.data.credit
  380. this.taskData.credit.deal_data.forEach((item) => {
  381. item.id = ''
  382. })
  383. this.taskData.credit.overdue_data.forEach((item) => {
  384. item.id = ''
  385. })
  386. this.taskData.credit.query_data.forEach((item) => {
  387. item.id = ''
  388. })
  389. }
  390. if (res.data.postLoan) {
  391. this.taskData.post_loan = res.data.postLoan
  392. }
  393. }
  394. })
  395. },
  396. setBusinessCache() {
  397. //设置缓存
  398. if (this.isCache) {
  399. return false
  400. }
  401. this.isCache = true
  402. setBusinessCache(this.taskData).then((res) => {
  403. setTimeout(() => {
  404. this.isCache = false;
  405. }, 2000)
  406. })
  407. },
  408. getBusinessCache(productId) {
  409. //获取缓存
  410. getBusinessCache({
  411. 'productId': productId
  412. }).then((res) => {
  413. if (res.code === 1) {
  414. if (res.data.productId !== 0) {
  415. this.isNew = false
  416. this.taskData = res.data
  417. }
  418. }
  419. })
  420. },
  421. getTaskTypeInfo(id) {
  422. getTaskTypeInfo({
  423. 'id': id
  424. }).then((res) => {
  425. if (res.code === 1) {
  426. this.productInfo = res.data;
  427. if (this.isNew) this.getBusinessCache(id)
  428. } else {
  429. tools.error(res.msg)
  430. setTimeout(() => {
  431. this.closePage();
  432. }, 1000)
  433. }
  434. })
  435. },
  436. getDraftItem(draftId) {
  437. getDraftItem({
  438. 'draftId': draftId
  439. }).then((res) => {
  440. if (res.code === 1) {
  441. this.productInfo = res.data.productInfo
  442. this.taskData = res.data.taskData
  443. this.getTaskTypeInfo(this.taskData.productId)
  444. } else {
  445. this.closePage();
  446. }
  447. })
  448. },
  449. async getTaskDetail(businessId) {
  450. const res = await getTaskDetail({
  451. id: businessId
  452. })
  453. if (res.code === 1) {
  454. if (res.data.product) {
  455. this.productInfo = res.data.product
  456. this.taskData.productId = res.data.product.id
  457. }
  458. if (res.data.business) {
  459. this.taskData.clientInfo = res.data.business
  460. }
  461. if (res.data.propertyList) {
  462. this.taskData.property = res.data.propertyList
  463. }
  464. if (res.data.applyFor) {
  465. this.taskData.applies = res.data.applyFor
  466. }
  467. if (res.data.tripartite) {
  468. this.taskData.tripartite = res.data.tripartite
  469. }
  470. if (res.data.linkman) {
  471. this.taskData.linkman = res.data.linkman
  472. console.log('this.taskData.linkman:', this.taskData.linkman)
  473. }
  474. if (res.data.credit) {
  475. this.taskData.credit = res.data.credit
  476. }
  477. if (res.data.postLoan) {
  478. this.taskData.post_loan = res.data.postLoan
  479. }
  480. this.getTaskTypeInfo(this.taskData.productId)
  481. } else {
  482. this.closePage();
  483. }
  484. },
  485. delBusinessCache() {
  486. uni.showModal({
  487. title: '警告',
  488. content: '是否退出当前任务,并清除缓存!',
  489. success: (res) => {
  490. if (res.confirm) {
  491. delBusinessCache({
  492. 'productId': this.productInfo.id
  493. }).then((res) => {
  494. tools.leftClick()
  495. })
  496. uni.removeStorageSync('creditImg');
  497. } else {
  498. tools.leftClick()
  499. }
  500. }
  501. });
  502. },
  503. onAuthentication(item) {
  504. if (item.type === 1) {
  505. uni.setStorageSync('clientInfoKey', item.type_keys)
  506. uni.setStorageSync('clientInfoData', this.taskData.clientInfo)
  507. } else if (item.type === 2) {
  508. uni.setStorageSync('propertyKey', item.type_keys)
  509. uni.setStorageSync('propertyData', this.taskData.property)
  510. } else if (item.type === 3) {
  511. uni.setStorageSync('propertyData', this.taskData.property)
  512. uni.setStorageSync('appliesKey', item.type_keys)
  513. uni.setStorageSync('appliesData', this.taskData.applies)
  514. } else if (item.type === 4) {
  515. uni.setStorageSync('tripartiteKey', item.type_keys)
  516. uni.setStorageSync('tripartiteData', this.taskData.tripartite)
  517. } else if (item.type === 5) {
  518. uni.setStorageSync('linkmanKey', item.type_keys)
  519. uni.setStorageSync('linkmanData', this.taskData.linkman)
  520. } else if (item.type === 6) {
  521. uni.setStorageSync('creditKey', item.type_keys)
  522. uni.setStorageSync('creditData', this.taskData.credit)
  523. } else if (item.type === 7) {
  524. uni.setStorageSync('postLoanKey', item.type_keys)
  525. uni.setStorageSync('postLoanData', this.taskData.post_loan)
  526. }
  527. uni.navigateTo({
  528. url: `${item.path}?title=${item.name}`
  529. })
  530. },
  531. closePage() {
  532. tools.leftClick()
  533. },
  534. }
  535. }
  536. </script>
  537. <style lang="scss" scoped>
  538. .info_button {
  539. width: 130rpx;
  540. height: 60rpx;
  541. border: none;
  542. line-height: 60rpx;
  543. }
  544. button::after {
  545. border: none;
  546. }
  547. </style>