creditApply.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808
  1. <template>
  2. <div class="app-container zap-main">
  3. <el-form ref="form" :model="form" :rules="rules" label-width="auto">
  4. <div class="zap-title">资产信息</div>
  5. <el-row class="zap-form">
  6. <el-row type="flex" justify="end" align="middle">
  7. <el-col :span="12" style="margin-bottom: 22px;">
  8. <el-button type="success" @click="addPay">新增应收账款</el-button>
  9. <el-button type="primary" @click="openTicket">选择</el-button>
  10. <el-button @click="deleteTicekt">清空全部</el-button>
  11. </el-col>
  12. <el-col :span="12">
  13. <el-row type="flex" justify="end" align="middle">
  14. <el-form-item label="合计金额:" style="margin-right: 40px;">
  15. <span>{{checkTotalAmt}}</span>
  16. </el-form-item>
  17. <el-form-item label="金额大写:">
  18. <span>{{checkTotalBigAmt}}</span>
  19. </el-form-item>
  20. </el-row>
  21. </el-col>
  22. </el-row>
  23. <el-table :data="ticketList" style="width: 100%;" stripe="">
  24. <el-table-column label="账款名称" align="center" prop="zbiName" show-overflow-tooltip />
  25. <el-table-column label="应收企业" align="center" prop="receiveName" />
  26. <el-table-column label="应付企业" align="center" prop="payName" />
  27. <el-table-column label="预计还款期" align="center" prop="zbiPayDate" show-overflow-tooltip />
  28. <el-table-column label="金额" align="center" prop="zbiAmount" />
  29. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="250">
  30. <template slot-scope="scope">
  31. <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.$index, ticketList)">删除</el-button>
  32. <el-button size="mini" type="text" icon="el-icon-view" @click="handleDetail(scope.$index, ticketList)">详情</el-button>
  33. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.$index, ticketList)">修改</el-button>
  34. </template>
  35. </el-table-column>
  36. </el-table>
  37. <el-row class="zap-margin-top">
  38. <el-col :span="8">
  39. <el-form-item label="签发金额" prop="zfiAmount" size="large">
  40. <el-input v-model="form.zfiAmount" @input="getBigSmall"  @input.native="changeRate($event,form.zfiAmount)" />
  41. </el-form-item>
  42. </el-col>
  43. <el-col :span="8">
  44. <el-form-item label="开立方" prop="openName" size="large">
  45. <el-input v-model="form.openName" disabled />
  46. </el-form-item>
  47. </el-col>
  48. <el-col :span="8">
  49. <el-form-item label="金额大写" prop="issuedAmount">
  50. {{issuedAmount}}
  51. </el-form-item>
  52. </el-col>
  53. </el-row>
  54. </el-row>
  55. </el-form>
  56. <div class="contain">
  57. <p>友情提醒:
  58. </p>
  59. <p>
  60. 1. 申请金额:须小于或等于选中资产的总额;
  61. </p>
  62. <p>
  63. 2. 选择账款:如需选择多笔账款同时提交,须满足预计还款日期一致;
  64. </p>
  65. <p>
  66. 3. 融信有效期:融信有效期非已核心企业最终确认还款时间为准,而非资产
  67. 中预计还款时间;
  68. </p>
  69. <p>
  70. 4. 请勿一笔账款,重复作为资产抵押;其中一笔融信抵押生效后,重复业务
  71. 将立即失效,因此引发的业务责任,将由申请发起人自行承担;
  72. </p>
  73. </div>
  74. <el-row type="flex" justify="center" align="middle" style="height: 96px;">
  75. <el-button type="primary" @click="submitForm">确 定</el-button>
  76. <el-button type="primary" plain @click="cancel">取 消</el-button>
  77. </el-row>
  78. <!-- 应收账款信息 -->
  79. <el-dialog :title="payTitle" :visible.sync="open" width="1120px" append-to-body>
  80. <el-form :model="queryParamsPay" ref="formQuery" :inline="true" label-width="68px" style="margin-bottom: -21px">
  81. <el-form-item label="账款名称" prop="zbiName">
  82. <el-input v-model="queryParamsPay.zbiName" placeholder="请输入账款名称" clearable size="small" maxlength="11" @keyup.enter.native="handleQuerys" />
  83. </el-form-item>
  84. <el-form-item label="应付企业" prop="payName">
  85. <el-input v-model="queryParamsPay.payName" placeholder="请输入应付企业" clearable size="small" maxlength="11" @keyup.enter.native="handleQuerys" />
  86. </el-form-item>
  87. <el-form-item>
  88. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuerys">搜索</el-button>
  89. <el-button icon="el-icon-refresh" size="mini" @click="resetQuerys">重置</el-button>
  90. </el-form-item>
  91. </el-form>
  92. <el-table :data="payList" ref="tablePay" class="single-select-table" @selection-change="handleSelectionChange" :row-key="rowkey">
  93. <el-table-column type="selection" :reserve-selection="true" width="50" align="center" />
  94. <el-table-column label="序号" type="index" width="50" align="center">
  95. <template slot-scope="scope">
  96. <span>{{ (queryParamsPay.pageNum - 1) * queryParamsPay.pageSize + scope.$index + 1}}</span>
  97. </template>
  98. </el-table-column>
  99. <el-table-column label="账款名称" align="center" prop="zbiName" show-overflow-tooltip />
  100. <el-table-column label="应收企业" align="center" prop="receiveName" />
  101. <el-table-column label="应付企业" align="center" prop="payName" />
  102. <el-table-column label="预计还款期" align="center" prop="zbiPayDate" show-overflow-tooltip />
  103. <el-table-column label="金额" align="center" prop="zbiAmount" />
  104. </el-table>
  105. <pagination v-show="total > 0" :total="total" :page.sync="queryParamsPay.pageNum" :limit.sync="queryParamsPay.pageSize" @pagination="getAccountsCollection" />
  106. <span slot="footer" class="dialog-footer">
  107. <el-button size="mini" @click="cancelTicket">取消</el-button>
  108. <el-button size="mini" type="primary" @click="closeTicket">确认</el-button>
  109. </span>
  110. </el-dialog>
  111. <!-- 新增往来账款 -->
  112. <el-dialog title="新增往来账款" :visible.sync="openAddBill" width="1120px" append-to-body>
  113. <add-bill :companyId="form.zfiCoreId" companyType="01" :payDate="payDate" @addClick="emitAddClick" v-if="openAddBill"></add-bill>
  114. </el-dialog>
  115. <!-- 附件详情 -->
  116. <el-dialog title="详情" :visible.sync="openDetailBill" width="1120px" append-to-body>
  117. <detail-bill :zbiId="this.zbiId" v-if="openDetailBill"></detail-bill>
  118. </el-dialog>
  119. <!-- 修改往来账款 -->
  120. <el-dialog title="修改往来账款" :visible.sync="openEditBill" width="1120px" append-to-body>
  121. <edit-bill :zbiId="this.zbiId" @editClick="emitEditClick" v-if="openEditBill"></edit-bill>
  122. </el-dialog>
  123. <!--预览-->
  124. <el-dialog :visible.sync="openFile" width="1000px" append-to-body>
  125. <img :src="wordUrl" v-if="show" width='450px' height='500px' />
  126. <iframe :src="wordUrl" width='800px' height='600px' frameborder='1' v-if="heid" />
  127. </el-dialog>
  128. </div>
  129. </template>
  130. <script>
  131. import {
  132. getAccountsCollection,
  133. addCredit,
  134. getFile
  135. } from "@/api/service/credit/credit";
  136. import {
  137. isOpenApproval
  138. } from "@/api/service/credit/approvalRelatedCredit";
  139. import {
  140. accAdd
  141. } from "@/utils/calculation";
  142. import {
  143. getToken
  144. } from "@/utils/auth";
  145. import AddBill from "@/views/service/bill/addBill";
  146. import DetailBill from "@/views/service/credit/billDetail";
  147. import EditBill from "@/views/service/bill/editBill";
  148. export default {
  149. name: "creditApply",
  150. components: {
  151. AddBill,
  152. DetailBill,
  153. EditBill
  154. },
  155. data() {
  156. return {
  157. //往来账款id
  158. zbiId: '',
  159. // 总条数
  160. total: 0,
  161. // 查询参数
  162. queryParams: {
  163. pageNum: 1,
  164. pageSize: 10,
  165. },
  166. creditParams: {
  167. zfsqId: null
  168. },
  169. queryParamsPay: {
  170. pageNum: 1,
  171. pageSize: 10,
  172. payName: null,
  173. zbiName: null
  174. },
  175. // 表单参数
  176. form: {
  177. },
  178. // 表单校验
  179. rules: {
  180. //签发金额
  181. zfiAmount: [{
  182. required: true,
  183. message: "请输入签发金额",
  184. trigger: ["blur", "change"],
  185. },
  186. {
  187. pattern: /^(?:0|[1-9]\d{0,8})(?:\.\d{1,2})?$/,
  188. message: "请输入正确的签发金额",
  189. trigger: ["blur", "change"],
  190. },
  191. ]
  192. },
  193. // 是否显示弹出层
  194. open: false,
  195. openAddBill: false,
  196. openDetailBill: false,
  197. openEditBill: false,
  198. //应付账款
  199. payList: [],
  200. //应付账款表格数据
  201. ticketList: [],
  202. //应付标题
  203. payTitle: "",
  204. //合计选中的应付账款的金额
  205. checkTotalAmt: "0.00",
  206. //合计选中的应付账款的大写金额
  207. checkTotalBigAmt: "零元整",
  208. //签发金额大写
  209. issuedAmount: "零元整",
  210. //合同附件
  211. contractFileList: [],
  212. //发票附件
  213. invoiceFileList: [],
  214. //其他文件
  215. otherFileList: [],
  216. openFile: false,
  217. wordUrl: "",
  218. show: false,
  219. heid: false,
  220. chooseTicket: [],
  221. payDate: null
  222. };
  223. },
  224. created() {
  225. //签发金额
  226. this.$set(this.form, "zfiAmount", "0.00");
  227. },
  228. methods: {
  229. // 取消按钮
  230. cancel() {
  231. this.$store.dispatch("tagsView/delView", this.$route);
  232. this.$router.go(-1);
  233. },
  234. //应收账款查询列表
  235. getAccountsCollection() {
  236. return getAccountsCollection(this.queryParamsPay).then((response) => {
  237. this.payList = response.data.records;
  238. this.selectChecked();
  239. this.total = response.data.total;
  240. return Promise.resolve(response)
  241. });
  242. },
  243. resetQuerys() {
  244. this.resetForm("formQuery");
  245. this.handleQuerys();
  246. },
  247. handleQuerys() {
  248. this.queryParamsPay.pageNum = 1;
  249. this.getAccountsCollection();
  250. },
  251. //打开应付账款选择列表
  252. openTicket() {
  253. //清空搜索条件
  254. this.queryParamsPay.zbiName = "";
  255. this.queryParamsPay.payName = "";
  256. this.queryParamsPay.pageNum = 1;
  257. this.getAccountsCollection();
  258. this.open = true;
  259. this.payTitle = "应收账款";
  260. },
  261. //获取附件信息
  262. getFile(datas) {
  263. var queryParamsFile = {};
  264. queryParamsFile.ticketList = datas;
  265. getFile(queryParamsFile).then((response) => {
  266. if (response.data) {
  267. //获取发票文件
  268. this.invoiceFileList = response.data.invoiceFileList;
  269. //获取合同文件
  270. this.contractFileList = response.data.contractFileList;
  271. //获取其他文件
  272. this.otherFileList = response.data.otherFileList;
  273. }
  274. });
  275. },
  276. //获取签发金额大写
  277. getBigSmall() {
  278. this.issuedAmount = this.smallToBig(this.form.zfiAmount);
  279. },
  280. selectChecked() {
  281. //清空选择
  282. this.$refs.tablePay && this.$refs.tablePay.clearSelection();
  283. this.ticketList.forEach((item) => {
  284. this.payList.forEach(row => {
  285. if (row.zbiId == item.zbiId) {
  286. this.$nextTick(() => {
  287. this.$refs.tablePay && this.$refs.tablePay.toggleRowSelection(row, true);
  288. })
  289. }
  290. });
  291. });
  292. //合计
  293. this.getReTotal(this.ticketList);
  294. //附件
  295. this.getFile(this.ticketList);
  296. },
  297. /* 多选框跨页 */
  298. rowkey(row) {
  299. return row.zbiId;
  300. },
  301. // 多选框选中数据
  302. handleSelectionChange(val) {
  303. this.chooseTicket = val
  304. },
  305. //文件下载
  306. handleDownload(row) {
  307. const pfiUrl = row.pfiUrl;
  308. if (pfiUrl != null && pfiUrl != '') {
  309. window.open(pfiUrl + "/" + getToken());
  310. } else {
  311. this.$message({
  312. message: '该附件不存在!',
  313. type: 'warning'
  314. });
  315. return;
  316. }
  317. },
  318. // 确认选择
  319. closeTicket() {
  320. if (this.chooseTicket.length > 0) {
  321. var flag = true;
  322. //获取选中第一个的应付企业
  323. var payName = this.chooseTicket[0].payName;
  324. //获取选中第一个的预计还款日期
  325. var zbiPayDate = this.chooseTicket[0].zbiPayDate;
  326. for (var i = 0; i < this.chooseTicket.length; i++) {
  327. if (payName != this.chooseTicket[i].payName) {
  328. flag = false;
  329. this.$message({
  330. message: '请选择应付企业相同的应付账款',
  331. type: 'warning'
  332. });
  333. break;
  334. } else if (zbiPayDate != this.chooseTicket[i].zbiPayDate) {
  335. flag = false;
  336. this.$message({
  337. message: '请选择预计还款日期相同的应付账款',
  338. type: 'warning'
  339. });
  340. break;
  341. }
  342. }
  343. if (flag) {
  344. //合计
  345. this.getReTotal(this.chooseTicket);
  346. this.ticketList = this.chooseTicket;
  347. //更新附件信息
  348. this.getFile(this.ticketList);
  349. this.open = false;
  350. //开立方赋值
  351. this.$set(this.form, "openName", this.chooseTicket[0].payName);
  352. }
  353. } else {
  354. this.$message({
  355. message: '请选择应收账款',
  356. type: 'warning'
  357. });
  358. }
  359. },
  360. //重新合计
  361. getReTotal(chooseTicket) {
  362. //合计
  363. this.checkTotalAmt = "0.00";
  364. for (var i = 0; i < chooseTicket.length; i++) {
  365. this.checkTotalAmt = accAdd(this.checkTotalAmt, chooseTicket[i].zbiAmount, 2);
  366. }
  367. //签发金额
  368. this.$set(this.form, "zfiAmount", this.checkTotalAmt);
  369. //签发金额大写
  370. this.issuedAmount = this.smallToBig(this.checkTotalAmt);
  371. this.checkTotalBigAmt = this.smallToBig(this.checkTotalAmt);
  372. this.checkTotalAmt = this.amtFormat(this.checkTotalAmt);
  373. },
  374. //取消选择按钮
  375. cancelTicket() {
  376. /* this.ticketList = [];
  377. if(this.$refs.tablePay){
  378. this.$refs.tablePay.clearSelection();
  379. } */
  380. this.open = false;
  381. },
  382. /** 清空选择信息 */
  383. deleteTicekt() {
  384. this.ticketList = [];
  385. this.checkTotalAmt = "0.00";
  386. this.checkTotalBigAmt = this.smallToBig(this.checkTotalAmt);
  387. //签发金额
  388. this.$set(this.form, "zfiAmount", "0.00");
  389. this.issuedAmount = this.smallToBig(this.checkTotalAmt);
  390. //开立方清空
  391. this.$set(this.form, "openName", "");
  392. //附件
  393. this.getFile(this.ticketList);
  394. if (this.$refs.tablePay) {
  395. this.$refs.tablePay.clearSelection();
  396. }
  397. },
  398. /* 删除按钮 */
  399. handleDelete(index, rows) {
  400. rows.splice(index, 1);
  401. if (this.$refs.tablePay) {
  402. this.$refs.tablePay.clearSelection();
  403. }
  404. this.selectChecked();
  405. },
  406. //详情按钮
  407. handleDetail(index, rows) {
  408. this.zbiId = rows[index].zbiId
  409. this.openDetailBill = true
  410. },
  411. /* 修改按钮 */
  412. handleUpdate(index, rows) {
  413. this.zbiId = rows[index].zbiId;
  414. this.openEditBill = true
  415. },
  416. onSelectAll() {
  417. if (this.$refs.tablePay) {
  418. this.$refs.tablePay.clearSelection();
  419. }
  420. },
  421. //格式化金额
  422. amtFormat(cellValue) {
  423. if (cellValue == null || cellValue == undefined || cellValue == '') {
  424. cellValue = '0.00'
  425. }
  426. cellValue += '';
  427. if (!cellValue.includes('.')) {
  428. cellValue += '.00';
  429. }
  430. console.log(cellValue);
  431. return cellValue.replace(/(\d)(?=(\d{3})+\.)/g, function ($0, $1) {
  432. return $1 + ',';
  433. }).replace(/\.$/, '');
  434. },
  435. /* // 将数字金额转换为大写金额 */
  436. smallToBig(money) {
  437. // 将数字金额转换为大写金额
  438. var cnNums = new Array(
  439. "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"); //汉字的数字
  440. var cnIntRadice = new Array("", "拾", "佰", "仟"); //基本单位
  441. var cnIntUnits = new Array("", "万", "亿", "兆"); //对应整数部分扩展单位
  442. var cnDecUnits = new Array("角", "分", "毫", "厘"); //对应小数部分单位
  443. var cnInteger = "整"; //整数金额时后面跟的字符
  444. var cnIntLast = "元"; //整数完以后的单位
  445. //最大处理的数字
  446. var maxNum = 999999999999999.9999;
  447. var integerNum; //金额整数部分
  448. var decimalNum; //金额小数部分
  449. //输出的中文金额字符串
  450. var chineseStr = "";
  451. var parts; //分离金额后用的数组,预定义
  452. if (money == "" || money == null || money == undefined) {
  453. return "零元零角零分";
  454. }
  455. money = parseFloat(money);
  456. if (money >= maxNum) {
  457. //超出最大处理数字
  458. return "超出最大处理数字";
  459. }
  460. if (money == 0) {
  461. chineseStr = cnNums[0] + cnIntLast + cnInteger;
  462. return chineseStr;
  463. }
  464. //四舍五入保留两位小数,转换为字符串
  465. money = Math.round(money * 100).toString();
  466. integerNum = money.substr(0, money.length - 2);
  467. decimalNum = money.substr(money.length - 2);
  468. //获取整型部分转换
  469. if (parseInt(integerNum, 10) > 0) {
  470. var zeroCount = 0;
  471. var IntLen = integerNum.length;
  472. for (var i = 0; i < IntLen; i++) {
  473. var n = integerNum.substr(i, 1);
  474. var p = IntLen - i - 1;
  475. var q = p / 4;
  476. var m = p % 4;
  477. if (n == "0") {
  478. zeroCount++;
  479. } else {
  480. if (zeroCount > 0) {
  481. chineseStr += cnNums[0];
  482. }
  483. //归零
  484. zeroCount = 0;
  485. chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
  486. }
  487. if (m == 0 && zeroCount < 4) {
  488. chineseStr += cnIntUnits[q];
  489. }
  490. }
  491. chineseStr += cnIntLast;
  492. }
  493. //小数部分
  494. if (decimalNum != "") {
  495. var decLen = decimalNum.length;
  496. for (var i = 0; i < decLen; i++) {
  497. var n = decimalNum.substr(i, 1);
  498. if (n != "0") {
  499. chineseStr += cnNums[Number(n)] + cnDecUnits[i];
  500. }
  501. }
  502. }
  503. if (chineseStr == "") {
  504. chineseStr += cnNums[0] + cnIntLast + cnInteger;
  505. } else if (decimalNum == "" || /^0*$/.test(decimalNum)) {
  506. chineseStr += cnInteger;
  507. }
  508. return chineseStr;
  509. },
  510. //新增
  511. submitForm() {
  512. if (this.ticketList.length < 1) {
  513. this.$message({
  514. message: '请选择应收账款',
  515. type: 'warning'
  516. });
  517. return;
  518. }
  519. if (parseFloat(this.form.zfiAmount) > parseFloat(this.moneyDelete(this.checkTotalAmt))) {
  520. this.$message({
  521. message: '签发金额不可大于合计金额',
  522. type: 'warning'
  523. });
  524. return;
  525. }
  526. this.$refs["form"].validate(valid => {
  527. if (valid) {
  528. const loading = this.$loading({
  529. lock: true,
  530. text: 'Loading',
  531. background: 'rgba(0, 0, 0,0)'
  532. });
  533. //如果签发金额小于合计金额
  534. if ((parseFloat(this.form.zfiAmount)) < (parseFloat(this.moneyDelete(this.checkTotalAmt)))) {
  535. var _this = this;
  536. this.$confirm('签发金额小于应付金额合计,是否确认提交', "警告", {
  537. confirmButtonText: "确定",
  538. cancelButtonText: "取消",
  539. type: "warning"
  540. }).then(function () {
  541. //应收账款
  542. _this.form.ticketList = _this.ticketList;
  543. //融信类型
  544. _this.form.type = "0";
  545. //合计金额
  546. _this.form.checkTotalAmt = _this.moneyDelete(_this.checkTotalAmt);
  547. addCredit(_this.form).then(response => {
  548. loading.close();
  549. //判断是否开启内部审批
  550. var params = {};
  551. params.menuId = "1000000002";
  552. isOpenApproval(params).then((response) => {
  553. var result = response.data.isOpen;
  554. //开启内部审批
  555. if (result == true) {
  556. _this.msgSuccess("申请融信资料已提交企业内部审批");
  557. _this.$store.dispatch("tagsView/delView", _this.$route);
  558. _this.$router.go(-1);
  559. } else {
  560. //没有开启内部审批
  561. //判断有没有开启平台审批
  562. var platParam = {};
  563. platParam.menuId = "1000000004";
  564. isOpenApproval(platParam).then((response) => {
  565. var platResult = response.data.isOpen;
  566. //开启平台审批
  567. if (platResult) {
  568. _this.msgSuccess("融信资料已提交平台审核,平台审核时间为工作日:9:00—18:00;单日16:00之前提交资料,预计2小时内完成,请留意站内信息");
  569. _this.$store.dispatch("tagsView/delView", _this.$route);
  570. _this.$router.go(-1);
  571. } else {
  572. //未开启平台审批
  573. _this.msgSuccess("融信资料已提交,待:" + _this.form.openName + "确权;确权结果请留意待办事项与站内消息");
  574. _this.$store.dispatch("tagsView/delView", _this.$route);
  575. _this.$router.go(-1);
  576. }
  577. });
  578. }
  579. })
  580. }).catch((response) => {
  581. loading.close();
  582. });
  583. }).catch((e) => {
  584. loading.close();
  585. });
  586. } else {
  587. //应收账款
  588. this.form.ticketList = this.ticketList;
  589. //融信类型
  590. this.form.type = "0";
  591. //合计金额
  592. this.form.checkTotalAmt = this.moneyDelete(this.checkTotalAmt);
  593. addCredit(this.form).then(response => {
  594. loading.close();
  595. //判断是否开启内部审批
  596. var params = {};
  597. params.menuId = "1000000002";
  598. isOpenApproval(params).then((response) => {
  599. var result = response.data.isOpen;
  600. //开启内部审批
  601. if (result == true) {
  602. this.msgSuccess("申请融信资料已提交企业内部审批");
  603. this.$store.dispatch("tagsView/delView", this.$route);
  604. this.$router.go(-1);
  605. } else {
  606. //没有开启内部审批
  607. //判断有没有开启平台审批
  608. var platParam = {};
  609. platParam.menuId = "1000000004";
  610. isOpenApproval(platParam).then((response) => {
  611. var platResult = response.data.isOpen;
  612. //开启平台审批
  613. if (platResult) {
  614. this.msgSuccess("融信资料已提交平台审核,平台审核时间为工作日:9:00—18:00;单日16:00之前提交资料,预计2小时内完成,请留意站内信息");
  615. this.$store.dispatch("tagsView/delView", this.$route);
  616. this.$router.go(-1);
  617. } else {
  618. //未开启平台审批
  619. this.msgSuccess("融信资料已提交,待:" + this.form.openName + "确权;确权结果请留意待办事项与站内消息");
  620. this.$store.dispatch("tagsView/delView", this.$route);
  621. this.$router.go(-1);
  622. }
  623. });
  624. }
  625. })
  626. }).catch((response) => {
  627. loading.close();
  628. });
  629. }
  630. }
  631. });
  632. },
  633. //金额去掉千分位
  634. moneyDelete(num) {
  635. if (num && num != undefined && num != null) {
  636. let _num = num;
  637. _num = _num.toString();
  638. _num = _num.replace(/,/gi, '');
  639. return _num;
  640. } else {
  641. return num;
  642. }
  643. },
  644. //预览
  645. handlePreview(row) {
  646. const pfiUrl = row.pfiUrl;
  647. const pfiFileName = row.pfiFileName;
  648. if (row.pfiUrl) {
  649. console.log(pfiFileName.substr(-3));
  650. if (pfiFileName.substr(-3) == "pdf") {
  651. this.wordUrl = pfiUrl + "/" + getToken();
  652. this.show = false;
  653. this.heid = true;
  654. } else if (
  655. pfiFileName.substr(-3) == "jpg" ||
  656. pfiFileName.substr(-3) == "png" ||
  657. pfiFileName.substr(-3) == "JPG" ||
  658. pfiFileName.substr(-3) == "PNG" ||
  659. pfiFileName.substr(-4) == "jpeg" ||
  660. pfiFileName.substr(-3) == "JPEG"
  661. ) {
  662. this.wordUrl =
  663. pfiUrl +
  664. "/" +
  665. getToken();
  666. this.show = true;
  667. this.heid = false;
  668. console.log("====>", this.wordUrl);
  669. } else if (
  670. pfiFileName.substr(-3) == "doc" ||
  671. pfiFileName.substr(-3) == "DOC" ||
  672. pfiFileName.substr(-4) == "docx" ||
  673. pfiFileName.substr(-3) == "DOCX"
  674. ) {
  675. this.wordUrl =
  676. "https://view.officeapps.live.com/op/view.aspx?src=" +
  677. pfiUrl +
  678. "/" +
  679. getToken() +
  680. "/" +
  681. pfiFileName;
  682. this.show = false;
  683. this.heid = true;
  684. console.log("====>", this.wordUrl);
  685. } else {
  686. this.$message({
  687. message: "暂不支持该类型文件预览",
  688. type: "warning",
  689. });
  690. return;
  691. }
  692. }
  693. this.openFile = true;
  694. },
  695. changeRate(e, input) {
  696. e.target.value = (e.target.value.match(/^\d*(\.?\d{0,2})/g)[0]) || null
  697. this.input = e.target.value
  698. this.form.zfiAmount = this.input
  699. },
  700. //新增应付
  701. addPay() {
  702. //获取选中第一个的预计还款日期
  703. if (this.chooseTicket[0]) {
  704. var zbiPayDate = this.chooseTicket[0].zbiPayDate;
  705. this.payDate = zbiPayDate;
  706. }
  707. this.openAddBill = true
  708. },
  709. //新增账款回调
  710. emitAddClick(val) {
  711. var self = this
  712. this.getAccountsCollection().then((response) => {
  713. //新增付款返回id直接选中
  714. if (val) {
  715. self.payList.forEach(element => {
  716. if (element.zbiId == val) {
  717. // 将当前点击项选中
  718. self.chooseTicket.push(element)
  719. self.closeTicket()
  720. }
  721. });
  722. }
  723. })
  724. self.openAddBill = false
  725. },
  726. //修改账款回调
  727. emitEditClick(val) {
  728. var self = this
  729. this.getAccountsPay().then((response) => {
  730. //修改付款返回id直接选中
  731. if (val) {
  732. // self.payList.forEach(element => {
  733. // if (element.zbiId == val) {
  734. // // 将当前点击项选中
  735. // // self.chooseTicket.push(element)
  736. // //self.closeTicket()
  737. // }
  738. // });
  739. console.log(self.chooseTicket)
  740. self.ticketList = self.chooseTicket
  741. self.closeTicket()
  742. }
  743. })
  744. self.openEditBill = false
  745. },
  746. }
  747. };
  748. </script>
  749. <style lang="scss">
  750. .contain p {
  751. color: #696969;
  752. }
  753. .uoloadfj .el-upload--picture-card {
  754. width: 110px;
  755. height: 110px;
  756. line-height: 110px;
  757. }
  758. .fjUoloadSty .el-upload--picture-card {
  759. display: none;
  760. }
  761. table th.star div::before {
  762. content: '*';
  763. color: red;
  764. }
  765. </style><style lang="scss" scoped>
  766. .zap-available-credit {
  767. height: 40px;
  768. margin-bottom: 22px;
  769. }
  770. .zap-title {
  771. padding: 20px 25px;
  772. font-size: 16px;
  773. color: #333333;
  774. background-color: #ffffff;
  775. }
  776. .zap-form {
  777. padding: 10px 25px 8px;
  778. background-color: #ffffff;
  779. box-sizing: border-box;
  780. }
  781. .zap-form--clear {
  782. padding-left: 0;
  783. padding-right: 0;
  784. }
  785. </style>