information.vue 13 KB

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