goFinance.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. <template>
  2. <div class="app-container">
  3. <!-- 添加或修改融资记录对话框 -->
  4. <el-form ref="form" :label-position="labelPosition" :model="form" :rules="rules" label-width="80px">
  5. <el-divider content-position="left">融资信息</el-divider>
  6. <el-row>
  7. <el-col :span="8">
  8. <el-form-item label="融信编号:" prop="zfrFinanceId">
  9. <el-select v-model="form.zfrFinanceId" style="width : 284px" :disabled="true" clearable @clear="clearBoth">
  10. <el-option
  11. v-for="(item,index) in financeInfList"
  12. :key="index"
  13. :label="item.zfiNumber"
  14. :value="item.zfiId"
  15. @click.native="amount(item)"
  16. ></el-option>
  17. </el-select>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :span="8">
  21. <el-form-item label="融资金额:" prop="zfrAmount">
  22. <el-input v-model="form.zfrAmount" placeholder="请输入融资金额" disabled style="width: 284px;"/>
  23. </el-form-item>
  24. </el-col>
  25. <el-col :span="8">
  26. <el-form-item label="融资账户:" prop="zfrCollectionAccount">
  27. <el-input v-model="form.zfrCollectionAccount" placeholder="请输入融资账户" style="width: 284px;" :readonly="readonly"/>
  28. </el-form-item>
  29. </el-col>
  30. </el-row>
  31. <el-row>
  32. <el-col :span="8">
  33. <el-form-item label="承诺还款日" prop="zfrRepaymentDate" v-if="false">
  34. <el-input v-model="form.zfrRepaymentDate" placeholder="请输入承诺还款日" style="width: 284px;"/>
  35. </el-form-item>
  36. </el-col>
  37. <el-col :span="8">
  38. <el-form-item label="融资利率" prop="zfrRate" v-if="false">
  39. <el-input v-model="form.zfrRate" placeholder="请输入融资利率" style="width: 284px;"/>
  40. </el-form-item>
  41. </el-col>
  42. <el-col :span="8">
  43. <el-form-item label="融资放款方式" prop="zfpcrLoanType" label-width="90px" v-if="false">
  44. <el-input v-model="form.zfpcrLoanType" placeholder="请输入融资账户" style="width: 284px;"/>
  45. </el-form-item>
  46. </el-col>
  47. </el-row>
  48. <el-row>
  49. <el-col :span="8">
  50. <el-form-item label="融资产品" prop="zfiProductId" v-if="false">
  51. <el-input v-model="form.zfiProductId" placeholder="请输入融资产品" style="width: 284px;"/>
  52. </el-form-item>
  53. </el-col>
  54. <el-col :span="8">
  55. <el-form-item label="平台服务费收取费率" prop="zfpcrChargeRate" v-if="false">
  56. <el-input v-model="form.zfpcrChargeRate" clearable placeholder="请输入平台服务费收取费率" style="width: 284px;"/>
  57. </el-form-item>
  58. </el-col>
  59. </el-row>
  60. </el-form>
  61. <el-divider content-position="left">应收账款</el-divider>
  62. <span style="float: right; margin-right: 125px;">金额大写:{{ smallToBig(allAmount()) }}</span>
  63. <span style="float: right; margin-right: 125px;">消费金额:{{ allAmount() }} 元</span>
  64. <el-table :data="billInfList" >
  65. <el-table-column label="序号" type="index" width="50" align="center">
  66. <template slot-scope="scope">
  67. <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="编号" align="center" prop="zbiNumber" />
  71. <el-table-column label="账款名称" align="center" prop="zbiName" />
  72. <el-table-column label="应收企业" align="center" prop="payee" />
  73. <el-table-column label="应付企业" align="center" prop="payer" />
  74. <el-table-column label="还款时间" align="center" prop="zbiPayDate" />
  75. <el-table-column label="金额" align="center" prop="zbiAmount" />
  76. </el-table>
  77. <!-- 发票附件 -->
  78. <el-divider content-position="left">发票附件</el-divider>
  79. <el-table :data="invoiceFileList" style="width: 100%">
  80. <el-table-column label="文件名称" align="center" prop="pfiFileName" show-overflow-tooltip />
  81. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width='300' fixed="right" >
  82. <template slot-scope="scope">
  83. <el-button
  84. size="mini"
  85. type="text"
  86. icon="el-icon-view"
  87. @click="handleDownload(scope.row)"
  88. >下载</el-button>
  89. <el-button
  90. size="mini"
  91. type="text"
  92. icon="el-icon-view"
  93. @click="handlePreview(scope.row)"
  94. >预览</el-button>
  95. </template>
  96. </el-table-column>
  97. </el-table>
  98. <!-- 合同附件 -->
  99. <el-divider content-position="left">合同附件</el-divider>
  100. <el-table :data="contractFileList" style="width: 100%">
  101. <el-table-column label="文件名称" align="center" prop="pfiFileName" show-overflow-tooltip />
  102. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width='300' fixed="right" >
  103. <template slot-scope="scope">
  104. <el-button
  105. size="mini"
  106. type="text"
  107. icon="el-icon-view"
  108. @click="handleDownload(scope.row)"
  109. >下载</el-button>
  110. <el-button
  111. size="mini"
  112. type="text"
  113. icon="el-icon-view"
  114. @click="handlePreview(scope.row)"
  115. >预览</el-button>
  116. </template>
  117. </el-table-column>
  118. </el-table>
  119. <!-- 其他附件 -->
  120. <el-divider content-position="left">其他附件</el-divider>
  121. <el-table :data="otherFileList" style="width: 100%">
  122. <el-table-column label="文件名称" align="center" prop="pfiFileName" show-overflow-tooltip />
  123. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width='300' fixed="right" >
  124. <template slot-scope="scope">
  125. <el-button
  126. size="mini"
  127. type="text"
  128. icon="el-icon-view"
  129. @click="handleDownload(scope.row)"
  130. >下载</el-button>
  131. <el-button
  132. size="mini"
  133. type="text"
  134. icon="el-icon-view"
  135. @click="handlePreview(scope.row)"
  136. >预览</el-button>
  137. </template>
  138. </el-table-column>
  139. </el-table>
  140. <div class="footer" style="float: right;
  141. margin-bottom:2px;">
  142. <el-button type="primary" @click="submitForm">确 定</el-button>
  143. <el-button @click="cancel">取 消</el-button>
  144. </div>
  145. <!--预览-->
  146. <el-dialog :visible.sync="openFile" width="1000px" append-to-body>
  147. <img :src="wordUrl" v-if="show" width='450px' height='500px'/>
  148. <iframe :src="wordUrl" width='800px' height='600px' frameborder='1' v-if="heid"/>
  149. </el-dialog>
  150. </div>
  151. </template>
  152. <script>
  153. import {addRecord,listBillInf,listAccInf} from "@/api/service/financeRecord/record";
  154. import { listFinanceInf } from "@/api/common/financeInf";
  155. import { getFile } from "@/api/service/credit/credit";
  156. import {getToken} from "@/utils/auth";
  157. export default {
  158. name: "financeRecord",
  159. components: {
  160. },
  161. data() {
  162. return {
  163. //融资账户是够编辑
  164. readonly:false,
  165. labelPosition: 'top',
  166. // 遮罩层
  167. loading: true,
  168. // 选中数组
  169. ids: [],
  170. // 非单个禁用
  171. single: true,
  172. // 非多个禁用
  173. multiple: true,
  174. // 显示搜索条件
  175. showSearch: true,
  176. // 总条数
  177. total: 0,
  178. // 全部融资记录表格数据
  179. recordList: [],
  180. //融信编号数据
  181. financeInfList: [],
  182. //应收账款
  183. billInfList: [],
  184. //合同附件
  185. contractFileList:[],
  186. //发票附件
  187. invoiceFileList:[],
  188. //其他文件
  189. otherFileList:[],
  190. // 弹出层标题
  191. title: "",
  192. // 是否显示弹出层
  193. open: false,
  194. // 查询参数
  195. queryParams: {
  196. pageNum: 1,
  197. pageSize: 10,
  198. zfrFinanceId: null,
  199. zfrNumber: null,
  200. zfrAmount: null,
  201. zfrRate: null,
  202. zfrHandler: null,
  203. zfrRepaymentDate: null,
  204. zfrApplyDate: null,
  205. zfrLoanDate: null,
  206. zfrApplyAmount: null,
  207. zfrApplyType: null,
  208. zfrStatus: null,
  209. zfrApproveStt: null,
  210. zfpcrLoanType: null,
  211. zfiProductId: null
  212. },
  213. // 表单参数
  214. form: {},
  215. openFile:false,
  216. wordUrl: "",
  217. show:false,
  218. heid:false,
  219. // 表单校验
  220. rules: {
  221. zfrFinanceId: [
  222. { required: true, message: "融信编号不能为空", trigger: "blur" }
  223. ],
  224. zfrAmount: [
  225. { required: true, message: "融资金额不能为空", trigger: "blur" }
  226. ],
  227. },
  228. };
  229. },
  230. created() {
  231. const zfiId = this.$route.params && this.$route.params.zfiId;
  232. this.$set(this.form, "zfrFinanceId", zfiId);
  233. this.getFinanceInf(zfiId);
  234. },
  235. methods: {
  236. /** 查询融信编号 */
  237. getFinanceInf(zfrFinanceId){
  238. this.loading = true;
  239. listFinanceInf(zfrFinanceId).then(response => {
  240. debugger
  241. if(response.data){
  242. this.financeInfList = response.data;
  243. for (let item of this.financeInfList) {
  244. if (item.zfiId == zfrFinanceId) {
  245. this.amount(item);
  246. }
  247. }
  248. this.loading = false;
  249. }
  250. });
  251. },
  252. // 取消按钮
  253. cancel() {
  254. this.$store.dispatch("tagsView/delView", this.$route);
  255. this.$router.go(-1);
  256. },
  257. //文件下载
  258. handleDownload(row){
  259. const pfiUrl = row.pfiUrl;
  260. if(pfiUrl != null && pfiUrl != ''){
  261. window.open(pfiUrl +"/"+ getToken());
  262. }else{
  263. this.$message({
  264. message: '该附件不存在!',
  265. type: 'warning'
  266. });
  267. return;
  268. }
  269. },
  270. // 表单重置
  271. reset() {
  272. this.form = {
  273. zfrId: null,
  274. zfrFinanceId: null,
  275. zfrNumber: null,
  276. zfrAmount: null,
  277. zfrRate: null,
  278. zfrHandler: null,
  279. zfrRepaymentDate: null,
  280. zfrApplyDate: null,
  281. zfrLoanDate: null,
  282. zfrApplyAmount: null,
  283. zfrApplyType: null,
  284. zfrStatus: "00",
  285. zfrApproveStt: null,
  286. zfrProfitSpare1: null,
  287. zfrProfitSpare2: null,
  288. zfrProfitSpare3: null,
  289. zfrProfitSpare4: null,
  290. zfrProfitSpare5: null,
  291. zfrProfitSpare6: null,
  292. zfrProfitSpare7: null,
  293. zfrProfitSpare8: null,
  294. zfrProfitSpare9: null,
  295. createBy: null,
  296. createTime: null,
  297. updateBy: null,
  298. updateTime: null
  299. };
  300. this.resetForm("form");
  301. },
  302. /** 全部搜索按钮操作 */
  303. handleQuery() {
  304. this.queryParams.pageNum = 1;
  305. this.getList();
  306. },
  307. /** 全部重置按钮操作 */
  308. resetQuery() {
  309. this.resetForm("queryForm");
  310. this.handleQuery();
  311. },
  312. //全部 多选框选中数据
  313. handleSelectionChange(selection) {
  314. this.ids = selection.map(item => item.zfrId)
  315. this.single = selection.length!==1
  316. this.multiple = !selection.length
  317. },
  318. /* 融信编号赋值融资金额 */
  319. amount(item) {
  320. debugger
  321. this.$set(this.form, "zfrAmount", item.zfiAmount);
  322. this.$set(this.form, "zfrRepaymentDate", item.zfiExpireDate);
  323. this.$set(this.form, "zfrRate", item.zfpcrRate);
  324. this.$set(this.form, "zfpcrLoanType", item.zfpcrLoanType);
  325. this.$set(this.form, "zfiProductId", item.zfiProductId);
  326. this.$set(this.form, "zfpcrChargeRate", item.zfpcrChargeRate);
  327. if(item.zfiId){
  328. this.loading = true;
  329. listBillInf(item.zfiId).then(response => {
  330. this.billInfList = response.data;
  331. this.loading = false;
  332. }).then(() =>{
  333. var queryParamsFile = {};
  334. queryParamsFile.ticketList = this.billInfList;
  335. getFile(queryParamsFile).then((response) => {
  336. if(response.data){
  337. //获取发票文件
  338. this.invoiceFileList = response.data.invoiceFileList;
  339. //获取合同文件
  340. this.contractFileList = response.data.contractFileList;
  341. //获取其他文件
  342. this.otherFileList = response.data.otherFileList;
  343. }
  344. });
  345. if(item.zfpcrLoanType == '0'){
  346. listAccInf(item.zfiProductId).then((response) => {
  347. this.$set(this.form, "zfrCollectionAccount", response.msg);
  348. this.readonly = true
  349. })
  350. }
  351. })
  352. }
  353. },
  354. /** 提交按钮 */
  355. submitForm() {
  356. this.$refs["form"].validate(valid => {
  357. if (valid) {
  358. const loading = this.$loading({
  359. lock: true,
  360. text: "Loading",
  361. spinner: "el-icon-loading",
  362. background: "rgba(0, 0, 0, 0.7)",
  363. });
  364. console.log(this.form,"AAHAHAHAH")
  365. addRecord(this.form).then(response => {
  366. this.msgSuccess("融资申请成功");
  367. loading.close();
  368. this.$store.dispatch("tagsView/delView", this.$route);
  369. this.$router.go(-1);
  370. }).catch((response) => {
  371. loading.close();
  372. });
  373. }
  374. });
  375. },
  376. /* 清空 */
  377. clearBoth() {
  378. this.form.zfrAmount = '';
  379. this.form,zfrRepaymentDate = '';
  380. this.form.zfrRate = '';
  381. this.form.zfpcrLoanType = '';
  382. this.billInfList = [];
  383. this.contractFileList = [];
  384. this.invoiceFileList = [];
  385. this.otherFileList = [];
  386. },
  387. //应收账款合计
  388. allAmount() {
  389. var strarr = [0.00];
  390. for (let i in this.billInfList) {
  391. strarr.push(this.billInfList[i]["zbiAmount"]);
  392. }
  393. return Math.floor(eval(strarr.join("+")) * 100) / 100; //结果
  394. },
  395. /* // 将数字金额转换为大写金额 */
  396. smallToBig(money) {
  397. // 将数字金额转换为大写金额
  398. var cnNums = new Array(
  399. "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" ); //汉字的数字
  400. var cnIntRadice = new Array("", "拾", "佰", "仟"); //基本单位
  401. var cnIntUnits = new Array("", "万", "亿", "兆"); //对应整数部分扩展单位
  402. var cnDecUnits = new Array("角", "分", "毫", "厘"); //对应小数部分单位
  403. var cnInteger = "整"; //整数金额时后面跟的字符
  404. var cnIntLast = "元"; //整数完以后的单位
  405. //最大处理的数字
  406. var maxNum = 999999999999999.9999;
  407. var integerNum; //金额整数部分
  408. var decimalNum; //金额小数部分
  409. //输出的中文金额字符串
  410. var chineseStr = "";
  411. var parts; //分离金额后用的数组,预定义
  412. if (money == "" || money == null || money == undefined) {
  413. return "零元零角零分";
  414. }
  415. money = parseFloat(money);
  416. if (money >= maxNum) {
  417. //超出最大处理数字
  418. return "超出最大处理数字";
  419. }
  420. if (money == 0) {
  421. chineseStr = cnNums[0] + cnIntLast + cnInteger;
  422. return chineseStr;
  423. }
  424. //四舍五入保留两位小数,转换为字符串
  425. money = Math.round(money * 100).toString();
  426. integerNum = money.substr(0, money.length - 2);
  427. decimalNum = money.substr(money.length - 2);
  428. //获取整型部分转换
  429. if (parseInt(integerNum, 10) > 0) {
  430. var zeroCount = 0;
  431. var IntLen = integerNum.length;
  432. for (var i = 0; i < IntLen; i++) {
  433. var n = integerNum.substr(i, 1);
  434. var p = IntLen - i - 1;
  435. var q = p / 4;
  436. var m = p % 4;
  437. if (n == "0") {
  438. zeroCount++;
  439. } else {
  440. if (zeroCount > 0) {
  441. chineseStr += cnNums[0];
  442. }
  443. //归零
  444. zeroCount = 0;
  445. chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
  446. }
  447. if (m == 0 && zeroCount < 4) {
  448. chineseStr += cnIntUnits[q];
  449. }
  450. }
  451. chineseStr += cnIntLast;
  452. }
  453. //小数部分
  454. if (decimalNum != "") {
  455. var decLen = decimalNum.length;
  456. for (var i = 0; i < decLen; i++) {
  457. var n = decimalNum.substr(i, 1);
  458. if (n != "0") {
  459. chineseStr += cnNums[Number(n)] + cnDecUnits[i];
  460. }
  461. }
  462. }
  463. if (chineseStr == "") {
  464. chineseStr += cnNums[0] + cnIntLast + cnInteger;
  465. } else if (decimalNum == "" || /^0*$/.test(decimalNum)) {
  466. chineseStr += cnInteger;
  467. }
  468. return chineseStr;
  469. },
  470. /** 导出按钮操作 */
  471. handleExport() {
  472. this.download('sc-service/record/export', {
  473. ...this.queryParams
  474. }, `sc-service_record.xlsx`)
  475. },
  476. //预览
  477. handlePreview(row) {
  478. const pfiUrl = row.pfiUrl;
  479. const pfiFileName = row.pfiFileName;
  480. if (row.pfiUrl) {
  481. console.log(pfiFileName.substr(-3));
  482. if (pfiFileName.substr(-3) == "pdf") {
  483. this.wordUrl = pfiUrl + "/" + getToken();
  484. this.show=false;
  485. this.heid=true;
  486. } else if (
  487. pfiFileName.substr(-3) == "jpg" ||
  488. pfiFileName.substr(-3) == "png" ||
  489. pfiFileName.substr(-3) == "JPG" ||
  490. pfiFileName.substr(-3) == "PNG" ||
  491. pfiFileName.substr(-4) == "jpeg" ||
  492. pfiFileName.substr(-3) == "JPEG"
  493. ) {
  494. this.wordUrl =
  495. pfiUrl +
  496. "/" +
  497. getToken();
  498. this.show=true;
  499. this.heid=false;
  500. console.log("====>",this.wordUrl);
  501. } else if (
  502. pfiFileName.substr(-3) == "doc" ||
  503. pfiFileName.substr(-3) == "DOC"||
  504. pfiFileName.substr(-4) == "docx" ||
  505. pfiFileName.substr(-3) == "DOCX"
  506. ) {
  507. this.wordUrl =
  508. "https://view.officeapps.live.com/op/view.aspx?src=" +
  509. pfiUrl +
  510. "/" +
  511. getToken() +
  512. "/" +
  513. pfiFileName;
  514. this.show=false;
  515. this.heid=true;
  516. console.log("====>",this.wordUrl);
  517. } else {
  518. this.$message({
  519. message: "暂不支持该类型文件预览",
  520. type: "warning",
  521. });
  522. return;
  523. }
  524. }
  525. this.openFile = true;
  526. },
  527. }
  528. };
  529. </script>