detailFinanceRecord.vue 18 KB

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