information.vue 15 KB

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