import Vue from 'vue' import Vuex from 'vuex' import axios from 'axios' import _ from 'lodash' import * as uiv from 'uiv' Vue.use(uiv) Vue.use(Vuex) const store = () => new Vuex.Store({ state: { //路由 route:{ path:'', query:'' }, option:{ userAgent: '', // 是否移动端 isMobile: false, // 身份token cookies: '', // 用户身份SessionId sessionId: '', // 用户信息 user: { // 是否登录 logged: false, fetching: false, compamy:'',//登录公司名 name:'',//登录人姓名 enuu:'',//公司UU data: {} }, // 系统设置 globalOptions: { fetching: false, data: {} } }, //保理申请单 apply: { cusId: '', id: '', fa_contact: '', fa_telphone: '', fa_phone: '', fa_appamount: '', fa_facorpname: '', fa_enname: '', submitTime:'', checkinfo:'' }, //单个上传的附件 attach1:{type: '', applyId: '', uid: ''}, //存储所有附件 attach:[], //附件1 fileList0: [], //附件2 fileList1: [], fileList2: [], fileList3: [], fileList4: [], fileList5: [], fileList6: [], fileList7: [], fileList8: [], fileList9: [], fileList10: [], fileList11: [], fileList12: [], fileList13: [], fileList14: [], fileList15: [], fileList16: [], fileList17: [], fileList18: [], fileList19: [], fileList20: [], fileList21: [], fileList22: [], //出账申请下附件 aafileList0 : [], aafileList1 : [], aafileList2 : [], aafileList3 : [], applyModal:false, visible: false, num: 0, tabInfo: {}, info: '客户资料填写', tabs: [ '客户基础资料', '股东构成', '主要关联企业', '高管信息', '经营状况', '贸易流程', '资产科目明细(上半年末)', '负债科目明细(上半年末)', '买方客户信息' ], //买方用户 mfmodal: [], // 客户资料,给表单默认为空的填写框,同下 tab1: { id: '', cu_officeadd: '', cu_name: '', cu_engname: '', cu_enterptype: '', cu_licensedate: '', cu_paperstype: '', cu_regcapital: '', cu_institutype: '', cu_paperscode: '', cu_ctfduedate: '', cu_businesscode: '', cu_nastdinducls: '', cu_capcurrency: '', cu_paidincapital: '', cu_regadd: '', cu_businsscope: '', cu_others: '', cu_highestauthority: '', cu_employeesnum: '', cu_departsituation: '', isDisabled: false }, // 股东构成 tab2: [{ cusId:'', id: '', cs_name: '', cs_paperstype: '', cs_paperscode: '', cs_investratio: '', cs_investamount: '', isDisabled: false }], // 主要关联企业 tab3: [{ id: '', cusId: '', cud_name: '', cud_association: '', cud_legalperson: '', cud_ratio: '', cud_product: '', cud_amount: '', isDisabled: false }], // 管理层背景 tab4: [{ cusId: '', id: '', ce_name: '', ce_sex: '', ce_paperstype: '', ce_paperscode: '', ce_education: '', ce_position: '', ce_stwkfpo: '', ce_workeyears: '', ce_nowaddress: '', ce_woekexper: '', isDisabled: false }], // 经营描述 condition: {bc_bcremark: '', bc_sweaterprocess: '', cusId: '', id: ''}, // 经营情况 tab5: [{ cusId: '', id: '', pm_kind: '', pm_tannualrevenue: '', pm_tratio: '', pm_annualrevenue: '', pm_ratio: '', isDisabled: false }], // 应收账款表单 tab7: [], // 其他应收账款 tab8: [], // 预付账款 tab9: [], // 固定资产 tab10: [], // 存货 tab11: [], // 短期借款 tab12: [], // 应付账款 tab13: [], // 其他应付账款 tab14: [], // 长期借款 tab15: [], // 经营情况描述 financecondition: { cusId: '', id: '', fc_arbalance: '', fc_agingamount1: '', fc_agingamount2: '', fc_agingamount4: '', fc_agingamount3: '', fc_apremark: '', year: '', month: '', fc_yeatmonth: '', isDisabled: false }, // 变更信息 changeInstruction: [{ cusId: '', id: '', cd_type: '股东', cs_date: '', cs_before: '', cs_after: '', isDisabled: false }, { cusId: '', id: '', cd_type: '法人', cs_date: '', cs_before: '', cs_after: '', isDisabled: false }, { cusId: '', id: '', cd_type: '住所', cs_date: '', cs_before: '', cs_after: '', isDisabled: false }], // 前五大供应商 tab6 :[{ cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '上游' }, { cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '上游' }, { cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '上游' }, { cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '上游' }, { cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '上游' }], // 前五大客户商 tab6_2: [{ cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '下游' }, { cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '下游' }, { cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '下游' }, { cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '下游' }, { cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '下游' }], show: [ {isshow: true}, {isshow: true}, {isshow: true}, {isshow: true}, {isshow: true}, {isshow: true}, {isshow: true}, {isshow: true}, {isshow: true}, {isshow: true}, {isshow: true}, {isshow: true}, {isshow: true}, {isshow: true}, ], open:false, //买方模态框打开状态 openmf:false, //出账申请单模态框打开状态 openTransfer:false, //授权书打开状态 openAuth:false, //保理申请弹框打开状态 openApply:false, //附件1 fileList: [], //附件2 fileList0: [], //附件3 fileList1: [], fileList2: [], fileList3: [], fileList4: [], fileList5: [], fileList6: [], fileList7: [], fileList8: [], fileList9: [], fileList10: [], fileList11: [], fileList12: [], fileList13: [], fileList14: [], fileList15: [], fileList16: [], fileList17: [], fileList18: [], fileList19: [], fileList20: [], fileList21: [], fileList22: [], //买方用户额度列表 credit:[], //英唐保理客户列表 baolilist:[], //判断要不要展示客户资料列表 showcustlist:false, //申请列表 applylist:[], //出账申请列表 transfer:[], //可以保存 cansave:true, //已经被客户经理确认 checkinfo:false, //出账转让所有附件 array:[], //出账转让单个附件 attach2:{type:'',aaid:'',name:'',size:'',path:'',id:''}, custFiles: [] }, mutations: { login(state){ state.option.user.logged=true }, //左侧菜单栏打开与关闭 openmenu(state){ state.open = state.open ? false :true; }, openAuth:function(state){ state.openAuth = true }, //同意企业征信授权 agreeAuth:function(state){ state.openAuth = false state.openApply = true }, //关闭企业授权 closeAuth:function (state) { state.openAuth = false }, //关闭保理申请弹框 closeApply:function(state){ state.openApply = false }, //tab标签的显示与隐藏 changeShow(state,table) { state.show[table.index].isshow = state.show[table.index].isshow ? false : true }, // 以下都是给表格增加一行新数据功能 addtab2 (state) { state.tab2.push({ cs_name: '', cs_paperstype: '', cs_paperscode: '', cs_investratio: '', cs_investamount: '', isDisabled:false }) }, addtab3(state) { state.tab3.push({ cud_name: '', cud_association: '', cud_legalperson: '', cud_ratio: '', cud_product: '', cud_amount: '', isDisabled:false }) }, addtab4: function (state) { state.tab4.push({ cusId: '', id: '', ce_name: '', ce_sex: '', ce_paperstype: '', ce_paperscode: '', ce_education: '', ce_position: '', ce_stwkfpo: '', ce_workeyears: '', ce_nowaddress: '', ce_woekexper: '', isDisabled:false }); }, addtab5(state) { state.tab5.push({ cusId: '', id: '', pm_kind: '', pm_tannualrevenue: '', pm_tratio: '', pm_annualrevenue: '', pm_ratio: '', isDisabled:false }); }, addtab7(state) { state.tab7.push( { cusId: '', id: '', ai_cuname: '', ai_remark: '', ai_caname: '', ai_payment: '', ai_kind: '应收账款', ai_amount: '', ai_rate: '', ai_leftamount: '', ai_bank: '',isDisabled:false }) }, addtab8(state) { state.tab8.push( { cusId: '', id: '', ai_cuname: '', ai_remark: '', ai_caname: '', ai_payment: '', ai_kind: '其他应收账款', ai_amount: '', ai_rate: '', ai_leftamount: '', ai_bank: '',isDisabled:false }) }, addtab9 (state) { state.tab9.push( { cusId: '', id: '', ai_cuname: '', ai_remark: '', ai_caname: '', ai_payment: '', ai_kind: '预付账款', ai_amount: '', ai_rate: '', ai_leftamount: '', ai_bank: '',isDisabled:false }) }, addtab10(state) { state.tab10.push( { cusId: '', id: '', ai_cuname: '', ai_remark: '', ai_caname: '', ai_payment: '', ai_kind: '固定资产', ai_amount: '', ai_rate: '', ai_leftamount: '', ai_bank: '',isDisabled:false }) }, addtab11(state) { state.tab11.push( { cusId: '', id: '', ai_cuname: '', ai_remark: '', ai_caname: '', ai_payment: '', ai_kind: '存货', ai_amount: '', ai_rate: '', ai_leftamount: '', ai_bank: '',isDisabled:false }) }, addtab12(state) { state.tab12.push( { cusId: '', id: '', ai_cuname: '', ai_remark: '', ai_caname: '', ai_payment: '', ai_kind: '短期借款', ai_amount: '', ai_rate: '', ai_leftamount: '', ai_bank: '',isDisabled:false }) }, addtab13(state) { state.tab13.push( { cusId: '', id: '', ai_cuname: '', ai_remark: '', ai_caname: '', ai_payment: '', ai_kind: '应付账款', ai_amount: '', ai_rate: '', ai_leftamount: '', ai_bank: '',isDisabled:false }) }, addtab14(state) { state.tab14.push( { cusId: '', id: '', ai_cuname: '', ai_remark: '', ai_caname: '', ai_payment: '', ai_kind: '其他应付账款', ai_amount: '', ai_rate: '', ai_leftamount: '', ai_bank: '',isDisabled:false }) }, addtab15(state) { state.tab15.push({ cusId: '', id: '', ai_cuname: '', ai_remark: '', ai_caname: '', ai_payment: '', ai_kind: '长期借款', ai_amount: '', ai_rate: '', ai_leftamount: '', ai_bank: '',isDisabled:false }) }, // 增加买方信息 addMfmodal(state){ var a = { cusId: '', id: '', mf_legrep: '', mf_custname: '', mf_credit: '', mf_regcapital: '', mf_addr: '', mf_estabtime: '', mf_contact: '', mf_contactnum: '', mf_fax: '', mf_email: '', mf_tradprod: '', mf_payterm: '', mf_shareholder: '', mf_businsscope: '', mf_coopohers: '', mf_hasinslimit: '', mf_balancebank: '', mf_bankaccount: '', mfCustInfoDetailList: [{ id: '', mfd_year: '', mfd_amount: '', mfd_chargeamount: '', mfd_discountamount: '', mfd_overdue: '', mfId: '', }], show: true }; state.mfmodal.push(a); for (var i = 0; i < (state.mfmodal.length - 1); i++) { state.mfmodal[i].show = false; } state.openmf = true; }, // 增加买方客户列表 addmfCustInfoDetailList(state,index) { state.mfmodal[index].mfCustInfoDetailList.push({ id: '', mfd_year: '', mfd_amount: '', mfd_chargeamount: '', mfd_discountamount: '', mfd_overdue: '', mfId: '', isDisabled:false }); }, //关闭买方模态框 cancleMf(state){ state.openmf = false }, //取出客户资料 getCustomer:function(state,result) { state.tab1={ id: '', cu_officeadd: '', cu_name: '', cu_engname: '', cu_enterptype: '', cu_licensedate: '', cu_paperstype: '', cu_regcapital: '', cu_institutype: '', cu_paperscode: '', cu_ctfduedate: '', cu_businesscode: '', cu_nastdinducls: '', cu_capcurrency: '', cu_paidincapital: '', cu_regadd: '', cu_businsscope: '', cu_others: '', cu_highestauthority: '', cu_employeesnum: '', cu_departsituation: '', isDisabled: false } if (result.customer != null) { state.tab1 = result.customer; } state.tab2 = [{ cusId:'', id: '', cs_name: '', cs_paperstype: '', cs_paperscode: '', cs_investratio: '', cs_investamount: '', isDisabled: false }] if (result && result.customer && result.customer.shareholders) { state.tab2 = result.customer.shareholders } state.tab3 = [{ id: '', cusId: '', cud_name: '', cud_association: '', cud_legalperson: '', cud_ratio: '', cud_product: '', cud_amount: '', isDisabled: false }] if(result && result.customer && result.customer.associateCompanies){ state.tab3 = result.customer.associateCompanies; } state.tab4 = [{ cusId: '', id: '', ce_name: '', ce_sex: '', ce_paperstype: '', ce_paperscode: '', ce_education: '', ce_position: '', ce_stwkfpo: '', ce_workeyears: '', ce_nowaddress: '', ce_woekexper: '', isDisabled: false }] if(result && result.customer && result.customer.customerExcutives){ state.tab4 = result.customer.customerExcutives; } state.changeInstruction = [{ cusId: '', id: '', cd_type: '股东', cs_date: '', cs_before: '', cs_after: '', isDisabled: false }, { cusId: '', id: '', cd_type: '法人', cs_date: '', cs_before: '', cs_after: '', isDisabled: false }, { cusId: '', id: '', cd_type: '住所', cs_date: '', cs_before: '', cs_after: '', isDisabled: false }] if (result && result.customer && result.customer.changesInstructions && result.customer.changesInstructions.length !=0 ) { state.changeInstruction = result.customer.changesInstructions; } state.condition = {bc_bcremark: '', bc_sweaterprocess: '', cusId: '', id: ''} if (result && result.customer && result.customer.businessCondition) { state.condition = result.customer.businessCondition; } state.financecondition = { cusId: '', id: '', fc_arbalance: '', fc_agingamount1: '', fc_agingamount2: '', fc_agingamount4: '', fc_agingamount3: '', fc_apremark: '', year: '', month: '', fc_yeatmonth: '', isDisabled: false } if (result && result.customer && result.customer.financeCondition) { state.financecondition = result.customer.financeCondition; } state.tab5 = [{ cusId: '', id: '', pm_kind: '', pm_tannualrevenue: '', pm_tratio: '', pm_annualrevenue: '', pm_ratio: '', isDisabled: false }] if (result && result.customer && result.customer.productMixes) { state.tab5 = result.customer.productMixes; } state.tab6 = [{ cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '上游' }, { cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '上游' }, { cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '上游' }, { cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '上游' }, { cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '上游' }] state.tab6_2 = [{ cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '下游' }, { cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '下游' }, { cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '下游' }, { cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '下游' }, { cusId: '', id: '', udc_name: '', udc_product: '', udc_lastyear: '', udc_thisyear: '', udc_payment: '', udc_cooperationyears: '', udc_kind: '下游' }] if (result && result.customer && result.customer.updowncasts && result.customer.updowncasts.length != 0) { var array1 = []; var array2 = []; for (var i = 0; i < result.customer.updowncasts.length; i++) { if (result.customer.updowncasts[i].udc_kind == '上游') { array1.push(result.customer.updowncasts[i]) } else { array2.push(result.customer.updowncasts[i]) } } state.tab6 = array1; state.tab6_2 = array2; } state.tab7=[]; state.tab8=[]; state.tab9=[]; state.tab10=[]; state.tab11=[]; state.tab12=[]; state.tab13=[]; state.tab14=[]; state.tab15=[]; if(result && result.customer && result.customer.accountInfoList) { for (var i = 0; i < result.customer.accountInfoList.length; i++) { if (result.customer.accountInfoList[i].ai_kind == '应收账款') { state.tab7.push(result.customer.accountInfoList[i]); } else if (result.customer.accountInfoList[i].ai_kind == '其他应收账款') { state.tab8.push(result.customer.accountInfoList[i]); } else if (result.customer.accountInfoList[i].ai_kind == '预付账款') { state.tab9.push(result.customer.accountInfoList[i]); } else if (result.customer.accountInfoList[i].ai_kind == '固定资产') { state.tab10.push(result.customer.accountInfoList[i]); } else if (result.customer.accountInfoList[i].ai_kind == '存货') { state.tab11.push(result.customer.accountInfoList[i]); } else if (result.customer.accountInfoList[i].ai_kind == '短期借款') { state.tab12.push(result.customer.accountInfoList[i]); } else if (result.customer.accountInfoList[i].ai_kind == '应付账款') { state.tab13.push(result.customer.accountInfoList[i]); } else if (result.customer.accountInfoList[i].ai_kind == '其他应付账款') { state.tab14.push(result.customer.accountInfoList[i]); } else { state.tab15.push(result.customer.accountInfoList[i]); } } } state.mfmodal=[]; if(result && result.customer && result.customer.mfCustInfos){ for (var i = 0; i < result.customer.mfCustInfos.length; i++) { state.mfmodal.push(result.customer.mfCustInfos[i]); Vue.set(this.state.mfmodal[i], 'show', true) } } if(result.apply != null){ state.apply = result.apply; if(result.apply.attachList){ state.attach = result.apply.attachList for (var i = 0; i < state.attach.length; i++) { if (state.attach[i].type == '保理业务申请书' && !state.fileList0.find(item => { return item.id === state.attach[i].id })) { state.fileList0.push(state.attach[i]); } else if (state.attach[i].type == '营业执照正副本' && !state.fileList1.find(item => { return item.id === state.attach[i].id })) { state.fileList1.push(state.attach[i]); } else if (state.attach[i].type == '开户许可证' && !state.fileList2.find(item => { return item.id === state.attach[i].id })) { state.fileList2.push(state.attach[i]); } else if (state.attach[i].type == '法人代表身份证' && !state.fileList3.find(item => { return item.id === state.attach[i].id })) { state.fileList3.push(state.attach[i]); } else if (state.attach[i].type == '实际控制人身份证' && !state.fileList4.find(item => { return item.id === state.attach[i].id })) { state.fileList4.push(state.attach[i]); } else if (state.attach[i].type == '法人代表证明书' && !state.fileList5.find(item => { return item.id === state.attach[i].id })) { state.fileList5.push(state.attach[i]); } else if (state.attach[i].type == '公司章程' && !state.fileList6.find(item => { return item.id === state.attach[i].id })) { state.fileList6.push(state.attach[i]); } else if (state.attach[i].type == '实际控制人征信授权书' && !state.fileList7.find(item => { return item.id === state.attach[i].id })) { state.fileList7.push(state.attach[i]); } else if (state.attach[i].type == '租赁合同/房产证' && !state.fileList8.find(item => { return item.id === state.attach[i].id })) { state.fileList8.push(state.attach[i]); } else if (state.attach[i].type == '法定代表人和实际控制人简历(Word版)' && !state.fileList9.find(item => { return item.id === state.attach[i].id })) { state.fileList9.push(state.attach[i]); } else if (state.attach[i].type == '近三年财务报表和近一期月度财报(含资产负债表、损益表、现金流量表)' && !state.fileList10.find(item => { return item.id === state.attach[i].id })) { state.fileList10.push(state.attach[i]); } else if (state.attach[i].type == '前五大上游企业贸易合同(两份)' && !state.fileList11.find(item => { return item.id === state.attach[i].id })) { state.fileList11.push(state.attach[i]); } else if (state.attach[i].type == '前五大下游企业贸易合同(两份)' && !state.fileList12.find(item => { return item.id === state.attach[i].id })) { state.fileList12.push(state.attach[i]); } else if (state.attach[i].type == '近1年税控系统导出的增值税发票清单(Excel版)' && !state.fileList13.find(item => { return item.id === state.attach[i].id })) { state.fileList13.push(state.attach[i]); } else if (state.attach[i].type == '近一年最大的五份贸易合同' && !state.fileList14.find(item => { return item.id === state.attach[i].id })) { state.fileList14.push(state.attach[i]); } else if (state.attach[i].type == '税控系统导出近一年全部发票(Excel版)' && !state.fileList15.find(item => { return item.id === state.attach[i].id })) { state.fileList15.push(state.attach[i]); } else if (state.attach[i].type == '公司人行征信报告及对外担保信息' && !state.fileList16.find(item => { return item.id === state.attach[i].id })) { state.fileList16.push(state.attach[i]); } else if (state.attach[i].type == '上一年度增值税(营业税)、所得税纳税证明' && !state.fileList17.find(item => { return item.id === state.attach[i].id })) { state.fileList17.push(state.attach[i]); } else if (state.attach[i].type == '企业近1年主要结算银行流水' && !state.fileList18.find(item => { return item.id === state.attach[i].id })) { state.fileList18.push(state.attach[i]); } else if (state.attach[i].type == '个人近1年主要结算银行流水' && !state.fileList19.find(item => { return item.id === state.attach[i].id })) { state.fileList19.push(state.attach[i]); } else if (state.attach[i].type == '近三个月水电费单据' && !state.fileList20.find(item => { return item.id === state.attach[i].id })) { state.fileList20.push(state.attach[i]); } else if (state.attach[i].type == '其他' && !state.fileList21.find(item => { return item.id === state.attach[i].id })) { state.fileList21.push(state.attach[i]); } else if (state.attach[i].type == '担保人的人行征信报告及对外担保信息' && !state.fileList22.find(item => { return item.id === state.attach[i].id })) { state.fileList22.push(state.attach[i]); } } } } if(result.status==202 || result.status==203 || result.status == 204){ state.cansave = false } }, //找到某一具体的客户资料 findcust:function(state,result){ if (result != null) { state.tab1 = result; } state.tab2 = result.shareholders state.tab3 = result.associateCompanies; state.tab4 = result.customerExcutives; state.tab5 = result.productMixes; state.changeInstruction=[{ cusId: '', id: '', cd_type: '股东', cs_date: '', cs_before: '', cs_after: '', isDisabled: false }, { cusId: '', id: '', cd_type: '法人', cs_date: '', cs_before: '', cs_after: '', isDisabled: false }, { cusId: '', id: '', cd_type: '住所', cs_date: '', cs_before: '', cs_after: '', isDisabled: false }] if(result.changesInstructions != null) { state.changeInstruction = result.changesInstructions; } state.condition= {bc_bcremark: '', bc_sweaterprocess: '', cusId: '', id: ''}; if(result.businessCondition != null){ state.condition = result.businessCondition;} state.financecondition={ cusId: '', id: '', fc_arbalance: '', fc_agingamount1: '', fc_agingamount2: '', fc_agingamount4: '', fc_agingamount3: '', fc_apremark: '', year: '', month: '', fc_yeatmonth: '', isDisabled: false }; if(result.financeCondition != null){ state.financecondition = result.financeCondition;} state.tab5 = result.productMixes; state.tab6 = []; state.tab6_2 = []; if(result && result.updowncasts){ for (var i = 0; i < result.updowncasts.length; i++) { if (result.updowncasts[i].udc_kind == '上游') { state.tab6.push(result.updowncasts[i]) } else { state.tab6_2.push(result.updowncasts[i]) } } } state.tab7=[]; state.tab8=[]; state.tab9=[]; state.tab10=[]; state.tab11=[]; state.tab12=[]; state.tab13=[]; state.tab14=[]; state.tab15=[]; if(result && result.accountInfoList){ for (var i = 0; i < result.accountInfoList.length; i++) { if (result.accountInfoList[i].ai_kind == '应收账款') { state.tab7.push(result.accountInfoList[i]); } else if (result.accountInfoList[i].ai_kind == '其他应收账款') { state.tab8.push(result.accountInfoList[i]); console.log('tab8',state.tab8) } else if (result.accountInfoList[i].ai_kind == '预付账款') { state.tab9.push(result.accountInfoList[i]); } else if (result.accountInfoList[i].ai_kind == '固定资产') { state.tab10.push(result.accountInfoList[i]); } else if (result.accountInfoList[i].ai_kind == '存货') { state.tab11.push(result.accountInfoList[i]); } else if (result.accountInfoList[i].ai_kind == '短期借款') { state.tab12.push(result.accountInfoList[i]); } else if (result.accountInfoList[i].ai_kind == '应付账款') { state.tab13.push(result.accountInfoList[i]); } else if (result.accountInfoList[i].ai_kind == '其他应付账款') { state.tab14.push(result.accountInfoList[i]); } else { state.tab15.push(result.accountInfoList[i]); } } } state.mfmodal=[] if(result && result.mfCustInfos){ for (var i = 0; i < result.mfCustInfos.length; i++) { state.mfmodal.push(result.mfCustInfos[i]); Vue.set(this.state.mfmodal[i], 'show', true) } } }, // 客户上传的附件 setCustFiles: function (state, res) { state.custFiles = res || [] }, //获取保理申请单 getApplyList:function(state,result){ state.applylist = result }, //获取出账申请单 getCreditList:function(state,result){ state.credit = result; }, getTransferList:function(state,result){ state.transfer = result }, //查看买方客户详情 infoMfmodal(state,index) { for (var i = 0; i < state.mfmodal.length; i++) { Vue.set(state.mfmodal[i],'show',false) } Vue.set(state.mfmodal[index],'show',true) state.openmf = true; }, addtransfer: function (state) { var a = window.location.href; var index = a.lastIndexOf("="); var creditId = a.substring(index + 1, a.length); var b = { aa_billamount: 0, aa_transferamount: '', aa_dueamount: '', aa_saamount: 0, aa_maturitydate: '', indate: '', aa_iscloseoff: '', fsSaleList: [], receipts: [], attaches: [], show: true, cq_id: creditId, id: '', erpstatus: '', status: '' } state.transfer.push(b) for (var i = 0; i < state.transfer.length - 1; i++) { state.transfer[i].show = false; } state.openTransfer = true }, //给保理模态框设置客户资料id setModalId:function(state,id){ state.apply.cusId = id }, //给客户基础资料从表设置id setCusId:function(state){ state.apply.cusId = state.tab1.id; for (var i = 0; i < state.tab2.length; i++) { state.tab2[i].cusId = state.tab1.id; } }, setPage1Id:function(state,id){ state.tab1.id = id }, //设置保理单id setApplyId:function(state,id){ state.apply.id = id; }, //保存完,将返回的id赋给他们 setcustomer:function(state,response){ state.tab1 = response }, setShareId:function(state,response){ for (var i = 0; i < response.data.length; i++) { state.tab2[i] = response.data[i]; } }, setAssociate:function(state,response){ for (var i = 0; i < response.data.length; i++) { state.tab3[i] = response.data[i]; } }, setChangeInstruction:function(state,response){ state.changeInstruction = response }, setExcutive:function(state,response){ state.tab4 = response }, setBusinessCon:function(state,response){ state.condition = response }, setProductmix:function (state,response) { state.tab5 = response }, setUpdowncast:function(state,response){ state.tab6 = response; }, setUpdowncast2:function(state,response){ state.tab6_2 = response; }, setAccountInfo1:function(state,response){ state.tab7 = response }, setFinanceCondition:function(state,response){ state.financecondition = response }, setAccountInfo2:function(state,response){ state.tab8 = response }, setAccountInfo3:function (state,response) { state.tab9 = response }, setAccountInfo4:function (state,response) { state.tab10 = response }, setAccountInfo5:function (state,response) { state.tab11 = response }, setAccountInfo6:function(state,response){ state.tab12 = response }, setAccountInfo7:function(state,response){ state.tab13 = response }, setAccountInfo8:function(state,response){ state.tab14 = response }, setAccountInfo9:function(state,response){ state.tab15 = response }, setMf:function(state,payload){ state.mfmodal[payload.index] = payload.response console.log('模态框里面买方的数据',payload.response) }, setMfDetail:function (state,payload) { state.mfmodal[payload.index].mfCustInfoDetailList = payload.response }, infotransfer:function(state,index){ let _this = this; //只展示点击查看的出账申请 for (var i = 0; i < state.transfer.length; i++) { state.transfer[i].show = false } state.transfer[index].show = true; state.openTransfer = true }, //关闭出账申请弹框 cancleTransfer:function(state){ state.openTransfer = false }, addfsSale:function(state,index){ state.transfer[index].fsSaleList.push({ sa_contractno:'', sa_contractamount:'', sa_code:'', sa_total:'', sa_payment:'', id:'', aa_id:'', }) }, //删除合同 deleteFsSale:function(state,params){ state.transfer[params.index].fsSaleList.splice(params.index1,1) }, addreceipt:function(state,index){ state.transfer[index].receipts.push({ aai_billdate:'', aai_invoiceno:'', aai_salesno:'', aai_amount:'', id:'', aa_id:'', }) }, //删除发票 deleteReceipt:function(state,params){ state.transfer[params.index].receipts.splice(params.index2,1) }, //查找英唐保理下所有客户资料 showbaolilist:function(state,params){ state.baolilist = params }, }, actions:{ // 全局服务初始化 nuxtServerInit (store, { params, route, isDev, req }) { let _this = this; store.state.route.query = route.query store.state.route.path = req.headers.host // Get user info from java server- return Promise.all([ store.dispatch('loadUserInfo'), ]) }, // 获取用户信息 loadUserInfo (store={}) { return this.$axios.get('/sso/account') .then(response => { if(response.data.success){ store.state.option.user.enuu = response.data.content.spaceUU store.state.option.user.compamy = response.data.content.spaceName store.state.option.user.name = response.data.content.vipName store.state.option.user.logged=true if(store.state.option.user.enuu == '10046945'){ store.state.showcustlist = true } return this.$axios.get('/financeapply/getHistory',{params:{ enuu: store.state.option.user.enuu }}) .then(response => { //如果有客户资料则直接取出 console.log('进入getcustomer') store.commit('getCustomer',response.data) }, err => { console.log(err) }) } }).catch(error => { console.log('error'+error) }) }, // 用户退出 logout ({ commit }) { return axios.get('/logout') .then(response => { commit('option/REQUEST_LOGOUT_SUCCESS', response.data) }) }, findNew({commit},params={}){ return this.$axios.get('/customer/findnew',{params:params}) .then(function (response) { if (response.data) { //没有客户资料则弹出弹框 commit('openAuth') } }).catch(function (error) { // alert('判断是否有客户资料失败') }); }, agreeApply(store){ let _this = this this.$axios.post('/customer/save',store.state.tab1) .then(function(response){ //设置模态框客户资料id store.commit('setModalId',response.data.id) //设置page1的id store.commit('setPage1Id',response.data.id) _this.$axios.post('/financeapply/save', store.state.apply) .then(function (response) { store.commit('setApplyId',response.data.id) alert('保存成功'); store.commit('closeApply') }).catch(function () { alert('保存失败'); }) }).catch(function(){ alert('保存失败') }) }, //保存客户资料基础资料 savepage1(params){ let _this = this; return this.$axios.post(`/customer/save`,params.state.tab1) .then(response => { params.commit('setPage1Id',response.data.id) alert('保存成功') }, err => { alert('保存失败') }) }, //保存客户资料股东构成 savepage2(params = {}){ params.commit('setCusId') return this.$axios.post('/shareholders/save',params.state.tab2) .then(response => { params.commit('setShareId',response) alert('保存成功') }, err => { alert('保存失败') }) }, //保存客户资料主要关联企业 savepage3(params={}){ for (var i = 0; i < params.state.tab3.length; i++) { params.state.tab3[i].cusId = params.state.tab1.id; } return this.$axios.post('/associate/save',params.state.tab3) .then(response => { params.commit('setAssociate',response) alert('保存成功') }, err => { alert('保存失败') }) }, //保存客户资料高管信息 savepage4(params = {}){ let _this = this; for (var i = 0; i < params.state.tab4.length; i++) { params.state.tab4[i].cusId = params.state.tab1.id; } for (var i = 0; i < params.state.changeInstruction.length; i++) { params.state.changeInstruction[i].cusId = params.state.tab1.id; } this.$axios.post('/customer/save',params.state.tab1) .then(response =>{ params.commit('setcustomer',response.data) savechange() },err=>{ alert('保存失败') }) var savechange = function(){ _this.$axios.post('/changesInstruction/save',params.state.changeInstruction) .then(response =>{ params.commit('setChangeInstruction',response.data) _this.$axios.post('/customerexcutive/save', params.state.tab4) .then(function (response) { params.commit('setExcutive',response.data) alert('保存成功'); }) .catch(function (error) { alert('保存管理层背景失败'); }); },err=>{ alert('保存失败') }) } }, //保存客户资料经营情况 savepage5(params={}){ let _this = this; //设置外键值 params.state.condition.cusId = params.state.tab1.id; for (var i = 0; i < params.state.tab5.length; i++) { params.state.tab5[i].cusId = params.state.tab1.id; } //保存经营情况描述 return this.$axios.post('/businesscondition/save',params.state.condition) .then(function (response) { params.commit('setBusinessCon',response.data) _this.$axios.post('/productmix/save', params.state.tab5) .then(function (response) { params.commit('setProductmix',response.data) alert('保存成功'); }) .catch(function (error) { alert('保存经营情况失败'); }); }),err=>{ alert('保存经营情况描述失败'); } }, //保存客户资料贸易流程 savepage6(params={}){ let _this = this; //设置外键值 params.state.condition.cusId = params.state.tab1.id; for (var i = 0; i < params.state.tab6.length; i++) { params.state.tab6[i].cusId = params.state.tab1.id; } for (var i = 0; i < params.state.tab6_2.length; i++) { params.state.tab6_2[i].cusId = params.state.tab1.id; } //保存贸易情况描述 this.$axios.post('/businesscondition/save', params.state.condition) .then(function (response) { params.commit('setBusinessCon',response.data) //保存前五大供应商 _this.$axios.post('/updowncast/save', params.state.tab6) .then(function (response) { params.commit('setUpdowncast',response.data) //保存前五大客户 _this.$axios.post('/updowncast/save', params.state.tab6_2) .then(function (response) { params.commit('setUpdowncast2',response.data) alert('保存成功'); }) .catch(function (error) { alert('保存前五大客户失败'); }); }) .catch(function (error) { alert('保存前五大供应商失败'); }); }) .catch(function (error) { alert('保存贸易情况描述失败'); }); }, savepage7(params={}){ let _this = this; //设置资产科目明细外键 for (var i = 0; i < params.state.tab7.length; i++) { params.state.tab7[i].cusId = params.state.tab1.id; } for (var i = 0; i < params.state.tab8.length; i++) { params.state.tab8[i].cusId = params.state.tab1.id; } for (var i = 0; i < params.state.tab9.length; i++) { params.state.tab9[i].cusId = params.state.tab1.id; } for (var i = 0; i < params.state.tab10.length; i++) { params.state.tab10[i].cusId = params.state.tab1.id; } for (var i = 0; i < params.state.tab11.length; i++) { params.state.tab11[i].cusId = params.state.tab1.id; } params.state.financecondition.cusId = params.state.tab1.id; //以下都是保存财务数据 this.$axios.post('/accountinfo/save', params.state.tab7) .then(function (response) { params.commit('setAccountInfo1',response.data) a1(); }) .catch(function (error) { alert('保存应收账目详情失败'); }); var a1 = function () { if (params.state.financecondition.year != undefined && params.state.financecondition.month != undefined) { if (params.state.financecondition.month.length == 1) { params.state.financecondition.fc_yeatmonth = params.state.financecondition.year + '0' + params.state.financecondition.month; } else { params.state.financecondition.fc_yeatmonth = params.state.financecondition.year + params.state.financecondition.month; } } //财务情况说明 _this.$axios.post('/financecondition/save', params.state.financecondition) .then(function (response) { params.commit('setFinanceCondition',response.data) b1(); }) .catch(function (error) { alert('保存财务情况说明失败'); }); } var b1 = function () { _this.$axios.post('/accountinfo/save', params.state.tab8) .then(function (response) { params.commit('setAccountInfo2',response.data) c1(); }) .catch(function (error) { alert('保存其他应收账款失败'); }); } var c1 = function () { _this.$axios.post('/accountinfo/save', params.state.tab9) .then(function (response) { params.commit('setAccountInfo3',response.data) d1(); }) .catch(function (error) { alert('保存预付账款失败'); }); } var d1 = function () { _this.$axios.post('/accountinfo/save', params.state.tab10) .then(function (response) { params.commit('setAccountInfo4',response.data) e1(); }) .catch(function (error) { alert('保存固定资产失败'); }); } var e1 = function () { _this.$axios.post('/accountinfo/save', params.state.tab11) .then(function (response) { params.commit('setAccountInfo5',response.data) alert('保存成功'); }) .catch(function (error) { alert('保存存货失败'); }); } }, //保存负债科目明细v savepage8(params={}){ let _this = this; //给以下表设置客户基础资料主键id for (var i = 0; i < params.state.tab12.length; i++) { params.state.tab12[i].cusId = params.state.tab1.id; } for (var i = 0; i < params.state.tab13.length; i++) { params.state.tab13[i].cusId = params.state.tab1.id; } for (var i = 0; i < params.state.tab14.length; i++) { params.state.tab14[i].cusId = params.state.tab1.id; } for (var i = 0; i < params.state.tab15.length; i++) { params.state.tab15[i].cusId = params.state.tab1.id; } params.state.financecondition.cusId = params.state.tab1.id; //保存财务数据 this.$axios.post('/accountinfo/save', params.state.tab12) .then(function (response) { params.commit('setAccountInfo6',response.data) a1(); }),err=>{ alert('保存短期借款失败'); } var a1 = function () { _this.$axios.post('/accountinfo/save', params.state.tab13) .then(function (response) { params.commit('setAccountInfo7',response.data) b1(); }),err=>{ alert('保存应付账款失败'); } }; var b1 = function () { _this.$axios.post('/accountinfo/save', params.state.tab14) .then(function (response) { params.commit('setAccountInfo8',response.data) c1(); }),err=>{ alert('保存其他应付账款失败'); } } var c1 = function () { _this.$axios.post('/financecondition/save', params.state.financecondition) .then(function (response) { params.commit('setFinanceCondition',response.data) d1(); }),err=>{ alert('保存说明失败'); } } var d1 = function () { _this.$axios.post('/accountinfo/save', params.state.tab15) .then(function (response) { params.commit('setAccountInfo9',response.data) alert('保存成功'); }),err=>{ alert('保存长期借款失败'); } } }, // 保存买方客户信息 savepage9(params={}) { let _this = this; var index; for (var i = 0; i < params.state.mfmodal.length; i++) { if (params.state.mfmodal[i].show == true) { params.state.mfmodal[i].cusId = params.state.tab1.id; index = i; } } this.$axios.post('/mfcustinfo/save', params.state.mfmodal[index]) .then(function (response) { for (var i = 0; i < params.state.mfmodal[index].mfCustInfoDetailList.length; i++) { params.state.mfmodal[index].mfCustInfoDetailList[i].mfId = response.data.id; } _this.$axios.post('/mfcustinfodetail/save', params.state.mfmodal[index].mfCustInfoDetailList) .then(function (response) { params.commit('setMfDetail',{response:response.data,index:index}) alert('保存成功') params.commit('cancleMf'); }) .catch(function (error) { params.commit('cancleMf'); alert('保护近三年双方交易情况失败'); }); }) .catch(function (error) { params.commit('cancleMf'); alert('保存买方客户失败'); }); }, //保理申请保存 saveapply: function (context) { context.commit('setCusId',context.state.tab1.id) return this.$axios.post('/financeapply/save', context.state.apply) .then(function (response) { context.state.apply = response.data alert('保存成功') }).catch(function () { alert('保存失败'); }) }, //正式提交 submitinfo: function (context) { return this.$axios.post('/financeapply/submit', context.state.apply) .then(function (response) { alert('成功提交'); }) .catch(function (error) { alert('提交失败'); }); }, //获取登录人所有的金融保理单 findApplyList:function({commit},params = {}){ //找到登录人申请过的所有保理申请单 return this.$axios.get('/financeapply/findByEnuu',{params:params}) .then(response => { commit('getApplyList',response.data) }, err => { console.log(err) }) }, //相关文件下载 download: function (context) { window.open("http://"+context.state.route.path+"/attach/download?fauu=10046945"); }, //查找登录用户下所有买方客户额度 findCredit:function({store,commit},params = {}){ return this.$axios.get('/sellerquota/findAll',{params:params}) .then(response => { commit('getCreditList',response.data) }, err => { console.log(err) }) }, getId:function(){ var a = window.location.href; var index = a.lastIndexOf("="); if(index>0){ var creditId = a.substring(index+1,a.length); return creditId; } }, //查找某买方客户的所有出账申请 findTransfer:function(context){ return this.$axios.get("/accountapply/find",{params:{id:context.state.route.query.id}}) .then(function(response){ context.commit('getTransferList',response.data) }).catch(function(){ alert('查找失败') }) }, infoTransfer:function(transfer,index){ //只展示点击查看的出账申请 for (var i = 0; i < state.transfer.length; i++) { _this.transfer[i].show = false || _this.$set(_this.transfer[i], 'show', false) } this.transfer[index].show = true; return this.$axios.get('/accountapply/findone',{params:{aaid:this.transfer[index].id}}) .then(function(response){ _this.aafileList0=[] _this.aafileList1=[] _this.aafileList2=[] _this.aafileList3=[] _this.attaches=[] for(var i=0;i params.aa_transferamount) { alert('保理首付款不能大于保理转让款') } else if (!params.aa_maturitydate) { alert('应收账款到期日不能为空') } else if (params.fsSaleList.length == 0) { alert('合同不能为空') } else if (params.fsSaleList.length > num) { alert('合同订单编号不能为空') } else { this.$axios.post('/accountapply/submit', params) .then(function (response) { //设置合同和支票的出账单外键 for (var i = 0; i < params.fsSaleList.length; i++) { params.fsSaleList[i].aa_id = response.data.id; } for (var i = 0; i < params.receipts.length; i++) { params.receipts[i].aa_id = response.data.id; } params = response.data savefssale(); }).catch(function () { }) var savefssale = function () { _this.$axios.post('/fssale/save', params.fsSaleList) .then(function (response) { savereceipt() }).catch(function () { alert("保存合同失败") }) } var savereceipt = function () { _this.$axios.post('/receipt/save', params.receipts) .then(function (response) { alert('保存成功') context.commit('cancleTransfer'); location.reload() }).catch(function () { alert("保存发票失败") }) } } }, //展示英唐保理下所有单据 showbaolilist:function (state,params) { return this.$axios.get('/financeapply/findAll') .then(function(response){ state.commit('showbaolilist',response.data) }) }, //展示客户资料详情 showcustdetail:function (context,params) { window.open("http://"+context.state.route.path+"/checkcustinfo/checkcust?id="+params); }, //查找某一具体客户信息 findcustomer:function (context,params) { return this.$axios.get('/customer/findone?id='+context.state.route.query.id) .then(function(response){ context.commit('findcust',response.data) }) }, findCustomerFiles: function (context, params) { return this.$axios.get('/attach/findattaches?cuId='+context.state.route.query.id) .then(function(response){ context.commit('setCustFiles',response.data) }) }, //客户经理确认客户资料 checkinfo:function (state,params) { return this.$axios.post('/financeapply/checkinfo?id='+params) .then(function(response){ alert('确认客户资料成功'); window.location.reload(); }) } } }) export default store