creditApply.vue 34 KB

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