creditApply.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835
  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. var changeSelectionTemp = eval("(" + JSON.stringify(this.chooseTicket) + ")")
  303. this.$nextTick(() => {
  304. this.$refs.tablePay.clearSelection();
  305. changeSelectionTemp.forEach((item) => {
  306. var f = true;
  307. for (var i=0; i < this.payList.length; i++) {
  308. var row = this.payList[i];
  309. if (row.zbiId == item.zbiId) {
  310. this.$refs.tablePay && this.$refs.tablePay.toggleRowSelection(row, true);
  311. f = false;
  312. break;
  313. }
  314. };
  315. if (f) {
  316. this.$refs.tablePay && this.$refs.tablePay.toggleRowSelection(item, true);
  317. }
  318. });
  319. })
  320. //合计
  321. // this.getReTotal(this.ticketList);
  322. //附件
  323. // this.getFile(this.ticketList);
  324. },
  325. /* 多选框跨页 */
  326. rowkey(row) {
  327. return row.zbiId;
  328. },
  329. // 多选框选中数据
  330. handleSelectionChange(val) {
  331. this.chooseTicket = val
  332. },
  333. //文件下载
  334. handleDownload(row) {
  335. const pfiUrl = row.pfiUrl;
  336. if (pfiUrl != null && pfiUrl != '') {
  337. window.open(pfiUrl + "/" + getToken());
  338. } else {
  339. this.$message({
  340. message: '该附件不存在!',
  341. type: 'warning'
  342. });
  343. return;
  344. }
  345. },
  346. // 确认选择
  347. closeTicket() {
  348. if (this.chooseTicket.length > 0) {
  349. var flag = true;
  350. //获取选中第一个的应付企业
  351. var payName = this.chooseTicket[0].payName;
  352. //获取选中第一个的预计还款日期
  353. var zbiPayDate = this.chooseTicket[0].zbiPayDate;
  354. for (var i = 0; i < this.chooseTicket.length; i++) {
  355. if (payName != this.chooseTicket[i].payName) {
  356. flag = false;
  357. this.$message({
  358. message: '请选择应付企业相同的应付账款',
  359. type: 'warning'
  360. });
  361. break;
  362. } else if (zbiPayDate != this.chooseTicket[i].zbiPayDate) {
  363. flag = false;
  364. this.$message({
  365. message: '请选择预计还款日期相同的应付账款',
  366. type: 'warning'
  367. });
  368. break;
  369. }
  370. }
  371. if (flag) {
  372. //合计
  373. this.getReTotal(this.chooseTicket);
  374. this.ticketList = this.chooseTicket;
  375. //更新附件信息
  376. this.getFile(this.ticketList);
  377. this.open = false;
  378. //开立方赋值
  379. this.$set(this.form, "openName", this.chooseTicket[0].payName);
  380. }
  381. } else {
  382. this.$message({
  383. message: '请选择应收账款',
  384. type: 'warning'
  385. });
  386. }
  387. },
  388. //重新合计
  389. getReTotal(chooseTicket) {
  390. //合计
  391. this.checkTotalAmt = "0.00";
  392. for (var i = 0; i < chooseTicket.length; i++) {
  393. this.checkTotalAmt = accAdd(this.checkTotalAmt, chooseTicket[i].zbiAmount, 2);
  394. }
  395. //签发金额
  396. this.$set(this.form, "zfiAmount", this.checkTotalAmt);
  397. //签发金额大写
  398. this.issuedAmount = this.smallToBig(this.checkTotalAmt);
  399. this.checkTotalBigAmt = this.smallToBig(this.checkTotalAmt);
  400. this.checkTotalAmt = this.amtFormat(this.checkTotalAmt);
  401. },
  402. //取消选择按钮
  403. cancelTicket() {
  404. /* this.ticketList = [];
  405. if(this.$refs.tablePay){
  406. this.$refs.tablePay.clearSelection();
  407. } */
  408. this.open = false;
  409. },
  410. /** 清空选择信息 */
  411. deleteTicekt() {
  412. this.ticketList = [];
  413. this.checkTotalAmt = "0.00";
  414. this.checkTotalBigAmt = this.smallToBig(this.checkTotalAmt);
  415. //签发金额
  416. this.$set(this.form, "zfiAmount", "0.00");
  417. this.issuedAmount = this.smallToBig(this.checkTotalAmt);
  418. //开立方清空
  419. this.$set(this.form, "openName", "");
  420. //附件
  421. this.getFile(this.ticketList);
  422. if (this.$refs.tablePay) {
  423. this.$refs.tablePay.clearSelection();
  424. }
  425. },
  426. /* 删除按钮 */
  427. handleDelete(index, rows) {
  428. rows.splice(index, 1);
  429. if (this.$refs.tablePay) {
  430. this.$refs.tablePay.clearSelection();
  431. }
  432. this.selectChecked();
  433. },
  434. //详情按钮
  435. handleDetail(index, rows) {
  436. this.zbiId = rows[index].zbiId
  437. this.openDetailBill = true
  438. },
  439. /* 修改按钮 */
  440. handleUpdate(index, rows) {
  441. this.zbiId = rows[index].zbiId;
  442. this.openEditBill = true
  443. },
  444. onSelectAll() {
  445. if (this.$refs.tablePay) {
  446. this.$refs.tablePay.clearSelection();
  447. }
  448. },
  449. //格式化金额
  450. amtFormat(cellValue) {
  451. if (cellValue == null || cellValue == undefined || cellValue == '') {
  452. cellValue = '0.00'
  453. }
  454. cellValue += '';
  455. if (!cellValue.includes('.')) {
  456. cellValue += '.00';
  457. }
  458. console.log(cellValue);
  459. return cellValue.replace(/(\d)(?=(\d{3})+\.)/g, function ($0, $1) {
  460. return $1 + ',';
  461. }).replace(/\.$/, '');
  462. },
  463. /* // 将数字金额转换为大写金额 */
  464. smallToBig(money) {
  465. // 将数字金额转换为大写金额
  466. var cnNums = new Array(
  467. "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"); //汉字的数字
  468. var cnIntRadice = new Array("", "拾", "佰", "仟"); //基本单位
  469. var cnIntUnits = new Array("", "万", "亿", "兆"); //对应整数部分扩展单位
  470. var cnDecUnits = new Array("角", "分", "毫", "厘"); //对应小数部分单位
  471. var cnInteger = "整"; //整数金额时后面跟的字符
  472. var cnIntLast = "元"; //整数完以后的单位
  473. //最大处理的数字
  474. var maxNum = 999999999999999.9999;
  475. var integerNum; //金额整数部分
  476. var decimalNum; //金额小数部分
  477. //输出的中文金额字符串
  478. var chineseStr = "";
  479. var parts; //分离金额后用的数组,预定义
  480. if (money == "" || money == null || money == undefined) {
  481. return "零元零角零分";
  482. }
  483. money = parseFloat(money);
  484. if (money >= maxNum) {
  485. //超出最大处理数字
  486. return "超出最大处理数字";
  487. }
  488. if (money == 0) {
  489. chineseStr = cnNums[0] + cnIntLast + cnInteger;
  490. return chineseStr;
  491. }
  492. //四舍五入保留两位小数,转换为字符串
  493. money = Math.round(money * 100).toString();
  494. integerNum = money.substr(0, money.length - 2);
  495. decimalNum = money.substr(money.length - 2);
  496. //获取整型部分转换
  497. if (parseInt(integerNum, 10) > 0) {
  498. var zeroCount = 0;
  499. var IntLen = integerNum.length;
  500. for (var i = 0; i < IntLen; i++) {
  501. var n = integerNum.substr(i, 1);
  502. var p = IntLen - i - 1;
  503. var q = p / 4;
  504. var m = p % 4;
  505. if (n == "0") {
  506. zeroCount++;
  507. } else {
  508. if (zeroCount > 0) {
  509. chineseStr += cnNums[0];
  510. }
  511. //归零
  512. zeroCount = 0;
  513. chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
  514. }
  515. if (m == 0 && zeroCount < 4) {
  516. chineseStr += cnIntUnits[q];
  517. }
  518. }
  519. chineseStr += cnIntLast;
  520. }
  521. //小数部分
  522. if (decimalNum != "") {
  523. var decLen = decimalNum.length;
  524. for (var i = 0; i < decLen; i++) {
  525. var n = decimalNum.substr(i, 1);
  526. if (n != "0") {
  527. chineseStr += cnNums[Number(n)] + cnDecUnits[i];
  528. }
  529. }
  530. }
  531. if (chineseStr == "") {
  532. chineseStr += cnNums[0] + cnIntLast + cnInteger;
  533. } else if (decimalNum == "" || /^0*$/.test(decimalNum)) {
  534. chineseStr += cnInteger;
  535. }
  536. return chineseStr;
  537. },
  538. //新增
  539. submitForm() {
  540. if (this.ticketList.length < 1) {
  541. this.$message({
  542. message: '请选择应收账款',
  543. type: 'warning'
  544. });
  545. return;
  546. }
  547. if (parseFloat(this.form.zfiAmount) > parseFloat(this.moneyDelete(this.checkTotalAmt))) {
  548. this.$message({
  549. message: '签发金额不可大于合计金额',
  550. type: 'warning'
  551. });
  552. return;
  553. }
  554. this.$refs["form"].validate(valid => {
  555. if (valid) {
  556. const loading = this.$loading({
  557. lock: true,
  558. text: 'Loading',
  559. background: 'rgba(0, 0, 0,0)'
  560. });
  561. //如果签发金额小于合计金额
  562. if ((parseFloat(this.form.zfiAmount)) < (parseFloat(this.moneyDelete(this.checkTotalAmt)))) {
  563. var _this = this;
  564. this.$confirm('签发金额小于应付金额合计,是否确认提交', "警告", {
  565. confirmButtonText: "确定",
  566. cancelButtonText: "取消",
  567. type: "warning"
  568. }).then(function () {
  569. //应收账款
  570. _this.form.ticketList = _this.ticketList;
  571. //融信类型
  572. _this.form.type = "0";
  573. //合计金额
  574. _this.form.checkTotalAmt = _this.moneyDelete(_this.checkTotalAmt);
  575. addCredit(_this.form).then(response => {
  576. loading.close();
  577. //判断是否开启内部审批
  578. var params = {};
  579. params.menuId = "1000000002";
  580. isOpenApproval(params).then((response) => {
  581. var result = response.data.isOpen;
  582. //开启内部审批
  583. if (result == true) {
  584. _this.msgSuccess("申请融信资料已提交企业内部审批");
  585. _this.$store.dispatch("tagsView/delView", _this.$route);
  586. _this.$router.go(-1);
  587. } else {
  588. //没有开启内部审批
  589. //判断有没有开启平台审批
  590. var platParam = {};
  591. platParam.menuId = "1000000004";
  592. isOpenApproval(platParam).then((response) => {
  593. var platResult = response.data.isOpen;
  594. //开启平台审批
  595. if (platResult) {
  596. _this.msgSuccess("融信资料已提交平台审核,平台审核时间为工作日:9:00—18:00;单日16:00之前提交资料,预计2小时内完成,请留意站内信息");
  597. _this.$store.dispatch("tagsView/delView", _this.$route);
  598. _this.$router.go(-1);
  599. } else {
  600. //未开启平台审批
  601. _this.msgSuccess("融信资料已提交,待:" + _this.form.openName + "确权;确权结果请留意待办事项与站内消息");
  602. _this.$store.dispatch("tagsView/delView", _this.$route);
  603. _this.$router.go(-1);
  604. }
  605. });
  606. }
  607. })
  608. }).catch((response) => {
  609. loading.close();
  610. });
  611. }).catch((e) => {
  612. loading.close();
  613. });
  614. } else {
  615. //应收账款
  616. this.form.ticketList = this.ticketList;
  617. //融信类型
  618. this.form.type = "0";
  619. //合计金额
  620. this.form.checkTotalAmt = this.moneyDelete(this.checkTotalAmt);
  621. addCredit(this.form).then(response => {
  622. loading.close();
  623. //判断是否开启内部审批
  624. var params = {};
  625. params.menuId = "1000000002";
  626. isOpenApproval(params).then((response) => {
  627. var result = response.data.isOpen;
  628. //开启内部审批
  629. if (result == true) {
  630. this.msgSuccess("申请融信资料已提交企业内部审批");
  631. this.$store.dispatch("tagsView/delView", this.$route);
  632. this.$router.go(-1);
  633. } else {
  634. //没有开启内部审批
  635. //判断有没有开启平台审批
  636. var platParam = {};
  637. platParam.menuId = "1000000004";
  638. isOpenApproval(platParam).then((response) => {
  639. var platResult = response.data.isOpen;
  640. //开启平台审批
  641. if (platResult) {
  642. this.msgSuccess("融信资料已提交平台审核,平台审核时间为工作日:9:00—18:00;单日16:00之前提交资料,预计2小时内完成,请留意站内信息");
  643. this.$store.dispatch("tagsView/delView", this.$route);
  644. this.$router.go(-1);
  645. } else {
  646. //未开启平台审批
  647. this.msgSuccess("融信资料已提交,待:" + this.form.openName + "确权;确权结果请留意待办事项与站内消息");
  648. this.$store.dispatch("tagsView/delView", this.$route);
  649. this.$router.go(-1);
  650. }
  651. });
  652. }
  653. })
  654. }).catch((response) => {
  655. loading.close();
  656. });
  657. }
  658. }
  659. });
  660. },
  661. //金额去掉千分位
  662. moneyDelete(num) {
  663. if (num && num != undefined && num != null) {
  664. let _num = num;
  665. _num = _num.toString();
  666. _num = _num.replace(/,/gi, '');
  667. return _num;
  668. } else {
  669. return num;
  670. }
  671. },
  672. //预览
  673. handlePreview(row) {
  674. const pfiUrl = row.pfiUrl;
  675. const pfiFileName = row.pfiFileName;
  676. if (row.pfiUrl) {
  677. console.log(pfiFileName.substr(-3));
  678. if (pfiFileName.substr(-3) == "pdf") {
  679. this.wordUrl = pfiUrl + "/" + getToken();
  680. this.show = false;
  681. this.heid = true;
  682. } else if (
  683. pfiFileName.substr(-3) == "jpg" ||
  684. pfiFileName.substr(-3) == "png" ||
  685. pfiFileName.substr(-3) == "JPG" ||
  686. pfiFileName.substr(-3) == "PNG" ||
  687. pfiFileName.substr(-4) == "jpeg" ||
  688. pfiFileName.substr(-3) == "JPEG"
  689. ) {
  690. this.wordUrl =
  691. pfiUrl +
  692. "/" +
  693. getToken();
  694. this.show = true;
  695. this.heid = false;
  696. console.log("====>", this.wordUrl);
  697. } else if (
  698. pfiFileName.substr(-3) == "doc" ||
  699. pfiFileName.substr(-3) == "DOC" ||
  700. pfiFileName.substr(-4) == "docx" ||
  701. pfiFileName.substr(-3) == "DOCX"
  702. ) {
  703. this.wordUrl =
  704. "https://view.officeapps.live.com/op/view.aspx?src=" +
  705. pfiUrl +
  706. "/" +
  707. getToken() +
  708. "/" +
  709. pfiFileName;
  710. this.show = false;
  711. this.heid = true;
  712. console.log("====>", this.wordUrl);
  713. } else {
  714. this.$message({
  715. message: "暂不支持该类型文件预览",
  716. type: "warning",
  717. });
  718. return;
  719. }
  720. }
  721. this.openFile = true;
  722. },
  723. changeRate(e, input) {
  724. e.target.value = (e.target.value.match(/^\d*(\.?\d{0,2})/g)[0]) || null
  725. this.input = e.target.value
  726. this.form.zfiAmount = this.input
  727. },
  728. //新增应付
  729. addPay() {
  730. //获取选中第一个的预计还款日期
  731. if (this.chooseTicket[0]) {
  732. var zbiPayDate = this.chooseTicket[0].zbiPayDate;
  733. this.payDate = zbiPayDate;
  734. }
  735. this.openAddBill = true
  736. },
  737. //新增账款回调
  738. emitAddClick(val) {
  739. var self = this
  740. this.getAccountsCollection().then((response) => {
  741. //新增付款返回id直接选中
  742. if (val) {
  743. self.payList.forEach(element => {
  744. if (element.zbiId == val) {
  745. // 将当前点击项选中
  746. self.chooseTicket.push(element)
  747. self.closeTicket()
  748. }
  749. });
  750. }
  751. })
  752. self.openAddBill = false
  753. },
  754. //修改账款回调
  755. emitEditClick(val) {
  756. var self = this
  757. getBill(val).then((response) => {
  758. for (var i = 0; i < this.ticketList.length; i ++) {
  759. if (response.data.zbiId == this.ticketList[i].zbiId) {
  760. this.$set(this.ticketList, i, response.data)
  761. break;
  762. }
  763. }
  764. for (var i = 0; i < this.ticketList.length; i ++) {
  765. if (response.data.zbiId == this.ticketList[i].zbiId) {
  766. this.$set(this.chooseTicket, i, response.data)
  767. break;
  768. }
  769. }
  770. self.closeTicket();
  771. })
  772. self.openEditBill = false
  773. },
  774. }
  775. };
  776. </script>
  777. <style lang="scss">
  778. .contain p {
  779. color: #696969;
  780. }
  781. .uoloadfj .el-upload--picture-card {
  782. width: 110px;
  783. height: 110px;
  784. line-height: 110px;
  785. }
  786. .fjUoloadSty .el-upload--picture-card {
  787. display: none;
  788. }
  789. table th.star div::before {
  790. content: '*';
  791. color: red;
  792. }
  793. </style><style lang="scss" scoped>
  794. .zap-available-credit {
  795. height: 40px;
  796. margin-bottom: 22px;
  797. }
  798. .zap-title {
  799. padding: 20px 25px;
  800. font-size: 16px;
  801. color: #333333;
  802. background-color: #ffffff;
  803. }
  804. .zap-form {
  805. padding: 10px 25px 8px;
  806. background-color: #ffffff;
  807. box-sizing: border-box;
  808. }
  809. .zap-form--clear {
  810. padding-left: 0;
  811. padding-right: 0;
  812. }
  813. </style>