goFinance.vue 18 KB

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