approvalRecordDetail.vue 19 KB

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