information.vue 15 KB

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