financeOpen.vue 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065
  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>
  7. <el-row>
  8. <el-col :span="12" style="margin-bottom: 22px;">
  9. <el-button type="success" @click="openTicket">选择</el-button>
  10. <el-button type="primary" @click="addPay">新增应付账款</el-button>
  11. <el-button @click="deleteTicekt">清空全部</el-button>
  12. </el-col>
  13. <el-col :span="12">
  14. <el-row type="flex" align="middle" justify="end">
  15. <el-form-item label="合计金额:">
  16. <span>{{checkTotalAmt}}</span>
  17. </el-form-item>
  18. <el-form-item label="金额大写:">
  19. <span>{{checkTotalBigAmt}}</span>
  20. </el-form-item>
  21. </el-row>
  22. </el-col>
  23. </el-row>
  24. <el-row>
  25. <el-table class="zap-table" :data="ticketList" style="width: 100%;" stripe>
  26. <el-table-column label="账款名称" align="center" prop="zbiName" show-overflow-tooltip />
  27. <el-table-column label="应收企业" align="center" prop="receiveName" />
  28. <el-table-column label="应付企业" align="center" prop="payName" />
  29. <el-table-column label="预计还款期" align="center" prop="zbiPayDate" width="100" show-overflow-tooltip />
  30. <el-table-column label="金额" align="center" prop="zbiAmount" width="120" />
  31. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="250">
  32. <template slot-scope="scope">
  33. <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.$index, ticketList)">删除</el-button>
  34. <el-button size="mini" type="text" icon="el-icon-view" @click="handleDetail(scope.$index, ticketList)">详情</el-button>
  35. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.$index, ticketList)">修改</el-button>
  36. </template>
  37. </el-table-column>
  38. </el-table>
  39. </el-row>
  40. </el-row>
  41. <el-row class="zap-margin-top">
  42. <el-col :span="8">
  43. <el-form-item label="开立方" prop="openName" size="large">
  44. <el-input v-model="form.openName" disabled />
  45. </el-form-item>
  46. </el-col>
  47. <el-col :span="8">
  48. <el-form-item label="授信额度" prop="zfiSupplierQuotaId" size="large">
  49. <el-select v-model="form.zfiSupplierQuotaId" filterable clearable remote @change="change">
  50. <el-option v-for="item in creditLineList" :key="item.value" :label="item.label+'/'+item.remaining" :value="item.value">
  51. </el-option>
  52. </el-select>
  53. </el-form-item>
  54. </el-col>
  55. <el-col :span="8" style="height: 40px;line-height: 40px;margin-bottom: 22px;">
  56. <span style="display:none">可用额度:</span>
  57. <span style="display:none">{{availableAmt}}</span>
  58. <span>有效期:</span>
  59. <span style="margin-right: 40px;">{{validityDate}}</span>
  60. <span>最小融资金额:</span>
  61. <span>{{zfpMinimumAmount}}</span>
  62. </el-col>
  63. <el-col :span="8">
  64. <el-form-item label="接收方" prop="receiveName" size="large">
  65. <el-input v-model="form.receiveName" disabled />
  66. </el-form-item>
  67. </el-col>
  68. <el-col :span="8">
  69. <el-form-item label="签发有效期" prop="zfiEffectiveDate" size="large">
  70. <el-date-picker clearable v-model="form.zfiEffectiveDate" type="date" value-format="yyyy-MM-dd" placeholder="选择签发有效期" :picker-options="pickerOptions">
  71. </el-date-picker>
  72. </el-form-item>
  73. </el-col>
  74. <el-col :span="8">
  75. <el-form-item label="承诺还款日" prop="zfiExpireDate" size="large">
  76. <el-date-picker clearable v-model="form.zfiExpireDate" type="date" value-format="yyyy-MM-dd" placeholder="选择承诺还款日" :picker-options="pickerOptions">
  77. </el-date-picker>
  78. </el-form-item>
  79. </el-col>
  80. <el-col :span="8">
  81. <el-form-item label="签发金额" prop="zfiAmount" size="large">
  82. <el-input v-model="form.zfiAmount" @input="getBigSmall" @input.native="changeRate($event,form.zfiAmount)" />
  83. </el-form-item>
  84. </el-col>
  85. <el-col :span="8">
  86. <el-form-item label="金额大写" prop="issuedAmount" size="large">
  87. {{issuedAmount}}
  88. </el-form-item>
  89. </el-col>
  90. </el-row>
  91. </el-row>
  92. </el-form>
  93. <el-row type="flex" justify="center" align="middle" style="height: 96px;">
  94. <el-button type="primary" @click="submitForm">确 定</el-button>
  95. <el-button type="primary" plain @click="cancel">取 消</el-button>
  96. </el-row>
  97. <!-- 应付账款信息 -->
  98. <el-dialog :title="payTitle" :visible.sync="open" width="1120px" append-to-body>
  99. <el-form :model="queryParamsPay" ref="formQuery" :inline="true" label-width="68px" style="margin-bottom: -21px">
  100. <el-form-item label="账款名称" prop="zbiName">
  101. <el-input v-model="queryParamsPay.zbiName" placeholder="请输入账款名称" clearable size="small" maxlength="11" @keyup.enter.native="handleQuerys" />
  102. </el-form-item>
  103. <el-form-item label="应付企业" prop="payName">
  104. <el-input v-model="queryParamsPay.payName" placeholder="请输入应付企业" clearable size="small" maxlength="11" @keyup.enter.native="handleQuerys" />
  105. </el-form-item>
  106. <el-form-item>
  107. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuerys">搜索</el-button>
  108. <el-button icon="el-icon-refresh" size="mini" @click="resetQuerys">重置</el-button>
  109. </el-form-item>
  110. </el-form>
  111. <el-table :data="payList" ref="tablePay" class="single-select-table" @selection-change="handleSelectionChange" :row-key="rowkey">
  112. <el-table-column type="selection" :reserve-selection="true" width="50" align="center" />
  113. <el-table-column label="序号" type="index" width="50" align="center">
  114. <template slot-scope="scope">
  115. <span>{{ (queryParamsPay.pageNum - 1) * queryParamsPay.pageSize + scope.$index + 1}}</span>
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="账款名称" align="center" prop="zbiName" show-overflow-tooltip />
  119. <el-table-column label="应收企业" align="center" prop="receiveName" />
  120. <el-table-column label="应付企业" align="center" prop="payName" />
  121. <el-table-column label="预计还款期" align="center" prop="zbiPayDate" show-overflow-tooltip />
  122. <el-table-column label="金额" align="center" prop="zbiAmount" />
  123. </el-table>
  124. <pagination v-show="total > 0" :total="total" :page.sync="queryParamsPay.pageNum" :limit.sync="queryParamsPay.pageSize" @pagination="getAccountsCollection" />
  125. <span slot="footer" class="dialog-footer">
  126. <el-button size="mini" @click="cancelTicket">取消</el-button>
  127. <el-button size="mini" type="primary" @click="closeTicket">确认</el-button>
  128. </span>
  129. </el-dialog>
  130. <!-- 新增往来账款 -->
  131. <el-dialog title="新增往来账款" :visible.sync="openAddBill" width="1120px" append-to-body>
  132. <add-bill :companyId="form.zfiCoreId" companyType="01" :payDate="payDate" @addClick="emitAddClick" v-if="openAddBill"></add-bill>
  133. </el-dialog>
  134. <!-- 附件详情 -->
  135. <el-dialog title="详情" :visible.sync="openDetailBill" width="1120px" append-to-body>
  136. <detail-bill :zbiId="this.zbiId" v-if="openDetailBill"></detail-bill>
  137. </el-dialog>
  138. <!-- 修改往来账款 -->
  139. <el-dialog title="修改往来账款" :visible.sync="openEditBill" width="1120px" append-to-body>
  140. <edit-bill :zbiId="this.zbiId" @editClick="emitEditClick" v-if="openEditBill"></edit-bill>
  141. </el-dialog>
  142. <!--预览-->
  143. <el-dialog :visible.sync="openFile" width="1000px" append-to-body>
  144. <img :src="wordUrl" v-if="show" width='450px' height='500px' />
  145. <iframe :src="wordUrl" width='800px' height='600px' frameborder='1' v-if="heid" />
  146. </el-dialog>
  147. </div>
  148. </template>
  149. <script>
  150. import {
  151. listSupplierCreditLine,
  152. getAccountsCollection,
  153. getSupplierAvailableBalance,
  154. addCredit,
  155. getFile
  156. } from "@/api/service/credit/credit";
  157. import {
  158. getRandom
  159. } from "@/api/common/getRandom";
  160. import {
  161. accAdd
  162. } from "@/utils/calculation";
  163. import {
  164. getToken
  165. } from "@/utils/auth";
  166. import AddBill from "@/views/service/bill/addBill";
  167. import EditBill from "@/views/service/bill/editBill";
  168. import DetailBill from "@/views/service/credit/billDetail";
  169. import {
  170. isOpenApproval
  171. } from "@/api/service/credit/approvalRelatedCredit";
  172. import {
  173. listCompanyHandler
  174. } from "@/api/common/companyHandler";
  175. import Cookies from 'js-cookie'
  176. export default {
  177. name: "financeOpen",
  178. components: {
  179. AddBill,
  180. EditBill,
  181. DetailBill
  182. },
  183. data() {
  184. return {
  185. //往来账款id
  186. zbiId: '',
  187. // 总条数
  188. total: 0,
  189. // 查询参数
  190. queryParams: {
  191. pageNum: 1,
  192. pageSize: 10,
  193. },
  194. creditParams: {
  195. zfsqId: null
  196. },
  197. queryParamsPay: {
  198. pageNum: 1,
  199. pageSize: 10,
  200. payName: null,
  201. zbiName: null
  202. },
  203. // 表单参数
  204. form: {
  205. },
  206. // 表单校验
  207. rules: {
  208. //授信额度
  209. zfiSupplierQuotaId: [{
  210. required: true,
  211. message: "请选择授信额度",
  212. trigger: ["blur", "change"],
  213. }, ],
  214. //接收方
  215. zfiSupplierId: [{
  216. required: true,
  217. message: "请选择接收方",
  218. trigger: ["blur", "change"],
  219. }, ],
  220. //签发有效期
  221. zfiEffectiveDate: [{
  222. required: true,
  223. message: "请选择签发有效期",
  224. trigger: ["blur", "change"],
  225. }, ],
  226. //签发金额
  227. zfiAmount: [{
  228. required: true,
  229. message: "请输入签发金额",
  230. trigger: ["blur", "change"],
  231. },
  232. {
  233. pattern: /^(?:0|[1-9]\d{0,8})(?:\.\d{1,2})?$/,
  234. message: "请输入正确的签发金额",
  235. trigger: ["blur", "change"],
  236. },
  237. ],
  238. //承诺还款日
  239. zfiExpireDate: [{
  240. required: true,
  241. message: "请选择承诺还款日",
  242. trigger: ["blur", "change"],
  243. }, ],
  244. },
  245. // 是否显示弹出层
  246. open: false,
  247. openAddBill: false,
  248. openEditBill: false,
  249. openDetailBill: false,
  250. //授信
  251. creditLineList: [],
  252. //接收方
  253. supplierList: [],
  254. //应付账款
  255. payList: [],
  256. //应付账款表格数据
  257. ticketList: [],
  258. //应付标题
  259. payTitle: "",
  260. //可用额度
  261. availableAmt: "0.00",
  262. //有效期
  263. validityDate: "",
  264. //有效期类型
  265. zfpcrDateType: "",
  266. //合计选中的应付账款的金额
  267. checkTotalAmt: "0.00",
  268. //合计选中的应付账款的大写金额
  269. checkTotalBigAmt: "零元整",
  270. //签发金额大写
  271. issuedAmount: "零元整",
  272. //产品是否可拆分
  273. zfpSplit: "",
  274. //融资放款方式
  275. zfpcrLoanType: "",
  276. //产品编号
  277. zfpId: "",
  278. //利率
  279. zfpcrRate: '',
  280. //最小融资额度
  281. zfpMinimumAmount: "",
  282. //合同附件
  283. contractFileList: [],
  284. //发票附件
  285. invoiceFileList: [],
  286. //其他文件
  287. otherFileList: [],
  288. pickerOptions: {
  289. disabledDate(v) {
  290. return v.getTime() < new Date().getTime() - 86400000;
  291. }
  292. },
  293. openFile: false,
  294. wordUrl: "",
  295. show: false,
  296. heid: false,
  297. chooseTicket: [],
  298. payDate: null
  299. };
  300. },
  301. created() {
  302. //获取当前公司
  303. getRandom().then((response) => {
  304. if (response.data) {
  305. this.$set(this.form, "receiveName", response.data.companyName);
  306. }
  307. }),
  308. //获取授信额度
  309. listSupplierCreditLine(this.creditParams).then((response) => {
  310. this.creditLineList = response.data.map(item => {
  311. return {
  312. value: item.zfsqId,
  313. label: item.zfpName,
  314. zfpcrDateType: item.zfpcrDateType,
  315. zfpcrEndDate: item.zfpcrEndDate,
  316. zfpcrLoanType: item.zfpcrLoanType,
  317. zfpSplit: item.zfpSplit,
  318. zfpId: item.zfpId,
  319. zfpcrRate: item.zfpcrRate,
  320. remaining: item.remaining,
  321. zfpMinimumAmount: item.zfpMinimumAmount
  322. };
  323. });
  324. });
  325. //签发金额
  326. this.$set(this.form, "zfiAmount", "0.00");
  327. },
  328. methods: {
  329. // 取消按钮
  330. cancel() {
  331. this.$store.dispatch("tagsView/delView", this.$route);
  332. this.$router.go(-1);
  333. },
  334. /* 多选框跨页 */
  335. rowkeyCustomer(row) {
  336. return row.cciId;
  337. },
  338. //表格变动触发事件
  339. handle() {
  340. },
  341. //应收账款查询列表
  342. getAccountsCollection() {
  343. return getAccountsCollection(this.queryParamsPay).then((response) => {
  344. this.payList = response.data.records;
  345. this.selectChecked();
  346. this.total = response.data.total;
  347. return Promise.resolve(response)
  348. });
  349. },
  350. resetQuerys() {
  351. this.resetForm("formQuery");
  352. this.handleQuerys();
  353. },
  354. handleQuerys() {
  355. this.queryParamsPay.pageNum = 1;
  356. this.getAccountsCollection();
  357. },
  358. //打开应付账款选择列表
  359. openTicket() {
  360. //清空搜索条件
  361. this.queryParamsPay.zbiName = "";
  362. this.queryParamsPay.payName = "";
  363. this.queryParamsPay.pageNum = 1;
  364. this.getAccountsCollection();
  365. this.open = true;
  366. this.payTitle = "应收账款";
  367. },
  368. //获取签发金额大写
  369. getBigSmall() {
  370. this.issuedAmount = this.smallToBig(this.form.zfiAmount);
  371. },
  372. selectChecked() {
  373. //清空选择
  374. this.$refs.tablePay && this.$refs.tablePay.clearSelection();
  375. this.ticketList.forEach((item) => {
  376. this.payList.forEach(row => {
  377. if (row.zbiId == item.zbiId) {
  378. this.$nextTick(() => {
  379. this.$refs.tablePay && this.$refs.tablePay.toggleRowSelection(row, true);
  380. })
  381. }
  382. });
  383. });
  384. //合计
  385. this.getReTotal(this.ticketList);
  386. //附件
  387. this.getFile(this.ticketList);
  388. },
  389. //获取附件信息
  390. getFile(datas) {
  391. var queryParamsFile = {};
  392. queryParamsFile.ticketList = datas;
  393. getFile(queryParamsFile).then((response) => {
  394. if (response.data) {
  395. //获取发票文件
  396. this.invoiceFileList = response.data.invoiceFileList;
  397. //获取合同文件
  398. this.contractFileList = response.data.contractFileList;
  399. //获取其他文件
  400. this.otherFileList = response.data.otherFileList;
  401. }
  402. });
  403. },
  404. /* 多选框跨页 */
  405. rowkey(row) {
  406. return row.zbiId;
  407. },
  408. // 多选框选中数据
  409. handleSelectionChange(val) {
  410. this.chooseTicket = val
  411. },
  412. // 确认选择
  413. closeTicket() {
  414. if (this.chooseTicket.length > 0) {
  415. var flag = true;
  416. //获取选中第一个的应付企业
  417. var payName = this.chooseTicket[0].payName;
  418. //获取选中第一个的预计还款日期
  419. var zbiPayDate = this.chooseTicket[0].zbiPayDate;
  420. for (var i = 0; i < this.chooseTicket.length; i++) {
  421. if (payName != this.chooseTicket[i].payName) {
  422. flag = false;
  423. this.$message({
  424. message: '请选择应付企业相同的应付账款',
  425. type: 'warning'
  426. });
  427. break;
  428. } else if (zbiPayDate != this.chooseTicket[i].zbiPayDate) {
  429. flag = false;
  430. this.$message({
  431. message: '请选择预计还款日期相同的应付账款',
  432. type: 'warning'
  433. });
  434. break;
  435. }
  436. }
  437. if (flag) {
  438. //合计
  439. this.getReTotal(this.chooseTicket);
  440. this.ticketList = this.chooseTicket;
  441. //更新附件信息
  442. this.getFile(this.ticketList);
  443. //开立方赋值
  444. this.$set(this.form, "openName", this.chooseTicket[0].payName);
  445. if(new Date(this.ticketList[0].zbiPayDate) >= new Date()){
  446. // this.form.zfiExpireDate = this.ticketList[0].zbiPayDate
  447. this.$set(this.form, "zfiExpireDate", this.ticketList[0].zbiPayDate);
  448. }
  449. this.open = false;
  450. }
  451. } else {
  452. this.$message({
  453. message: '请选择应收账款',
  454. type: 'warning'
  455. });
  456. }
  457. },
  458. //重新合计
  459. getReTotal(chooseTicket) {
  460. //合计
  461. this.checkTotalAmt = "0.00";
  462. for (var i = 0; i < chooseTicket.length; i++) {
  463. this.checkTotalAmt = accAdd(this.checkTotalAmt, chooseTicket[i].zbiAmount, 2);
  464. }
  465. //签发金额
  466. this.$set(this.form, "zfiAmount", this.checkTotalAmt);
  467. //签发金额大写
  468. this.issuedAmount = this.smallToBig(this.checkTotalAmt);
  469. this.checkTotalBigAmt = this.smallToBig(this.checkTotalAmt);
  470. this.checkTotalAmt = this.amtFormat(this.checkTotalAmt);
  471. },
  472. //取消选择按钮
  473. cancelTicket() {
  474. /* this.ticketList = [];
  475. if(this.$refs.tablePay){
  476. this.$refs.tablePay.clearSelection();
  477. } */
  478. this.open = false;
  479. },
  480. /** 清空选择信息 */
  481. deleteTicekt() {
  482. this.ticketList = [];
  483. this.checkTotalAmt = "0.00";
  484. this.checkTotalBigAmt = this.smallToBig(this.checkTotalAmt);
  485. //签发金额
  486. this.$set(this.form, "zfiAmount", "0.00");
  487. this.issuedAmount = this.smallToBig(this.checkTotalAmt);
  488. //开立方清空
  489. this.$set(this.form, "openName", "");
  490. if (this.$refs.tablePay) {
  491. this.$refs.tablePay.clearSelection();
  492. }
  493. //更新附件
  494. this.getFile(this.ticketList);
  495. },
  496. /* 删除按钮 */
  497. handleDelete(index, rows) {
  498. rows.splice(index, 1);
  499. if (this.$refs.tablePay) {
  500. this.$refs.tablePay.clearSelection();
  501. }
  502. this.selectChecked();
  503. },
  504. //详情按钮
  505. handleDetail(index, rows) {
  506. this.zbiId = rows[index].zbiId
  507. this.openDetailBill = true
  508. },
  509. /* 修改按钮 */
  510. handleUpdate(index, rows) {
  511. this.zbiId = rows[index].zbiId;
  512. this.openEditBill = true
  513. },
  514. onSelectAll() {
  515. if (this.$refs.tablePay) {
  516. this.$refs.tablePay.clearSelection();
  517. }
  518. },
  519. //选择授信触发
  520. change(val) {
  521. if (!val) {
  522. //可用额度
  523. this.availableAmt = "0.00";
  524. //有效期
  525. this.validityDate = "";
  526. //产品是否可拆分
  527. this.zfpSplit = "",
  528. //融资放款方式
  529. this.zfpcrLoanType = "";
  530. //产品
  531. this.zfpId = "";
  532. //利率
  533. this.zfpcrRate = "";
  534. //有效期类型
  535. this.zfpcrDateType = "";
  536. //最小融资金额
  537. this.zfpMinimumAmount = "";
  538. return;
  539. }
  540. let obj = {};
  541. obj = this.creditLineList.find(item => {
  542. return item.value === val;
  543. });
  544. //获取有效期的类型
  545. this.zfpcrDateType = obj.zfpcrDateType;
  546. //产品是否可拆分
  547. this.zfpSplit = obj.zfpSplit;
  548. //放款方式
  549. this.zfpcrLoanType = obj.zfpcrLoanType;
  550. //产品
  551. this.zfpId = obj.zfpId;
  552. //利率
  553. this.zfpcrRate = obj.zfpcrRate;
  554. //最小融资金额
  555. this.zfpMinimumAmount = obj.zfpMinimumAmount;
  556. //长期
  557. if ("0" == this.zfpcrDateType) {
  558. this.validityDate = "长期";
  559. } else {
  560. this.validityDate = obj.zfpcrEndDate;
  561. }
  562. var lineQueryParam = {};
  563. lineQueryParam.zfsqId = val;
  564. //获取可用额度
  565. getSupplierAvailableBalance(lineQueryParam).then((response) => {
  566. this.availableAmt = response.data.remaining;
  567. });
  568. },
  569. //格式化金额
  570. amtFormat(cellValue) {
  571. if (cellValue == null || cellValue == undefined || cellValue == '') {
  572. cellValue = '0.00'
  573. }
  574. cellValue += '';
  575. if (!cellValue.includes('.')) {
  576. cellValue += '.00';
  577. }
  578. console.log(cellValue);
  579. return cellValue.replace(/(\d)(?=(\d{3})+\.)/g, function ($0, $1) {
  580. return $1 + ',';
  581. }).replace(/\.$/, '');
  582. },
  583. /* // 将数字金额转换为大写金额 */
  584. smallToBig(money) {
  585. // 将数字金额转换为大写金额
  586. var cnNums = new Array(
  587. "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"); //汉字的数字
  588. var cnIntRadice = new Array("", "拾", "佰", "仟"); //基本单位
  589. var cnIntUnits = new Array("", "万", "亿", "兆"); //对应整数部分扩展单位
  590. var cnDecUnits = new Array("角", "分", "毫", "厘"); //对应小数部分单位
  591. var cnInteger = "整"; //整数金额时后面跟的字符
  592. var cnIntLast = "元"; //整数完以后的单位
  593. //最大处理的数字
  594. var maxNum = 999999999999999.9999;
  595. var integerNum; //金额整数部分
  596. var decimalNum; //金额小数部分
  597. //输出的中文金额字符串
  598. var chineseStr = "";
  599. var parts; //分离金额后用的数组,预定义
  600. if (money == "" || money == null || money == undefined) {
  601. return "零元零角零分";
  602. }
  603. money = parseFloat(money);
  604. if (money >= maxNum) {
  605. //超出最大处理数字
  606. return "超出最大处理数字";
  607. }
  608. if (money == 0) {
  609. chineseStr = cnNums[0] + cnIntLast + cnInteger;
  610. return chineseStr;
  611. }
  612. //四舍五入保留两位小数,转换为字符串
  613. money = Math.round(money * 100).toString();
  614. integerNum = money.substr(0, money.length - 2);
  615. decimalNum = money.substr(money.length - 2);
  616. //获取整型部分转换
  617. if (parseInt(integerNum, 10) > 0) {
  618. var zeroCount = 0;
  619. var IntLen = integerNum.length;
  620. for (var i = 0; i < IntLen; i++) {
  621. var n = integerNum.substr(i, 1);
  622. var p = IntLen - i - 1;
  623. var q = p / 4;
  624. var m = p % 4;
  625. if (n == "0") {
  626. zeroCount++;
  627. } else {
  628. if (zeroCount > 0) {
  629. chineseStr += cnNums[0];
  630. }
  631. //归零
  632. zeroCount = 0;
  633. chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
  634. }
  635. if (m == 0 && zeroCount < 4) {
  636. chineseStr += cnIntUnits[q];
  637. }
  638. }
  639. chineseStr += cnIntLast;
  640. }
  641. //小数部分
  642. if (decimalNum != "") {
  643. var decLen = decimalNum.length;
  644. for (var i = 0; i < decLen; i++) {
  645. var n = decimalNum.substr(i, 1);
  646. if (n != "0") {
  647. chineseStr += cnNums[Number(n)] + cnDecUnits[i];
  648. }
  649. }
  650. }
  651. if (chineseStr == "") {
  652. chineseStr += cnNums[0] + cnIntLast + cnInteger;
  653. } else if (decimalNum == "" || /^0*$/.test(decimalNum)) {
  654. chineseStr += cnInteger;
  655. }
  656. return chineseStr;
  657. },
  658. //文件下载
  659. handleDownload(row) {
  660. const pfiUrl = row.pfiUrl;
  661. if (pfiUrl != null && pfiUrl != '') {
  662. window.open(pfiUrl + "/" + getToken());
  663. } else {
  664. this.$message({
  665. message: '该附件不存在!',
  666. type: 'warning'
  667. });
  668. return;
  669. }
  670. },
  671. //新增
  672. submitForm() {
  673. debugger;
  674. if (this.ticketList.length < 1) {
  675. this.$message({
  676. message: '请选择应收账款',
  677. type: 'warning'
  678. });
  679. return;
  680. }
  681. //放款方式==指定供应商时收款账号必输
  682. /* if("1"== this.zfpcrLoanType){
  683. if(!this.form.zfiCollectionAccount){
  684. this.$message({
  685. message: '请输入收款账号',
  686. type: 'warning'
  687. });
  688. return;
  689. }
  690. } */
  691. if (parseFloat(this.form.zfiAmount) < parseFloat(this.zfpMinimumAmount)) {
  692. this.$message({
  693. message: '签发金额不可小于产品的最小融资金额',
  694. type: 'warning'
  695. });
  696. return;
  697. }
  698. if (parseFloat(this.form.zfiAmount) > parseFloat(this.moneyDelete(this.availableAmt))) {
  699. this.$message({
  700. message: '签发金额不可大于可用金额',
  701. type: 'warning'
  702. });
  703. return;
  704. }
  705. if (parseFloat(this.form.zfiAmount) > parseFloat(this.moneyDelete(this.checkTotalAmt))) {
  706. this.$message({
  707. message: '签发金额不可大于合计金额',
  708. type: 'warning'
  709. });
  710. return;
  711. }
  712. this.$refs["form"].validate(valid => {
  713. if (valid) {
  714. const loading = this.$loading({
  715. lock: true,
  716. text: 'Loading',
  717. background: 'rgba(0, 0, 0,0)'
  718. })
  719. //签发金额小于合计金额
  720. if ((parseFloat(this.form.zfiAmount)) < (parseFloat(this.moneyDelete(this.checkTotalAmt)))) {
  721. var _this = this;
  722. this.$confirm('签发金额小于应付金额合计,是否确认提交', "警告", {
  723. confirmButtonText: "确定",
  724. cancelButtonText: "取消",
  725. type: "warning"
  726. }).then(function () {
  727. //应收账款
  728. _this.form.ticketList = _this.ticketList;
  729. //产品是否可拆分
  730. _this.form.zfpSplit = _this.zfpSplit;
  731. //放款方式
  732. _this.form.zfpcrLoanType = _this.zfpcrLoanType;
  733. //融信类型
  734. _this.form.type = "2";
  735. //利率
  736. _this.form.zfiRate = _this.zfpcrRate;
  737. //产品
  738. _this.form.zfpId = _this.zfpId;
  739. //可用额度
  740. _this.form.availableAmt = _this.availableAmt;
  741. //最小融资金额
  742. _this.form.zfpMinimumAmount = _this.zfpMinimumAmount;
  743. //合计金额
  744. _this.form.checkTotalAmt = _this.moneyDelete(_this.checkTotalAmt);
  745. addCredit(_this.form).then(response => {
  746. //获取融信编号
  747. var zfiId = response.data.zfiId;
  748. loading.close();
  749. //查询当前用户是否为经办人
  750. listCompanyHandler().then((response) => {
  751. if (false == response.data) {
  752. //当前用户不是经办人,返回到列表页
  753. _this.msgSuccess("融信资料已提交企业内部审批");
  754. _this.$store.dispatch(
  755. "tagsView/delView",
  756. _this.$route
  757. );
  758. _this.$router.go(-1);
  759. } else {
  760. //当前用户是经办人,判断有无融信开立融信的内部审批
  761. //查询有无融信开立内部审批
  762. var confirmParam = {};
  763. confirmParam.menuId = "1000000001";
  764. isOpenApproval(confirmParam).then((response) => {
  765. var result = response.data.isOpen;
  766. //有融信开立内部审批
  767. if (true == result) {
  768. _this.msgSuccess("融信资料已提交企业内部审批");
  769. _this.$store.dispatch(
  770. "tagsView/delView",
  771. _this.$route
  772. );
  773. _this.$router.go(-1);
  774. } else {
  775. //无融信开立内部审批
  776. //查询有无平台审批
  777. var platParam = {};
  778. platParam.menuId = "1000000004";
  779. isOpenApproval(platParam).then((response) => {
  780. var platResult = response.data.isOpen;
  781. //开启平台审批
  782. if (platResult) {
  783. _this.msgSuccess("融信资料已提交平台审核,平台审核时间为工作日:9:00—18:00;单日16:00之前提交资料,预计2小时内完成,请留意站内信息");
  784. _this.$store.dispatch("tagsView/delView", _this.$route);
  785. _this.$router.go(-1);
  786. } else {
  787. //未开启平台审批
  788. //关闭当前页面
  789. _this.$store.dispatch(
  790. "tagsView/delView",
  791. _this.$route
  792. );
  793. //跳转盖章页面
  794. Cookies.set("/credit/creditSeal/" + zfiId + "/", _this.$route.fullPath)
  795. _this.$router.push({
  796. path: "/credit/creditSeal/" + zfiId + "/"
  797. });
  798. }
  799. });
  800. }
  801. });
  802. }
  803. });
  804. }).catch((response) => {
  805. loading.close();
  806. });
  807. }).catch((e) => {
  808. loading.close();
  809. });
  810. } else {
  811. //应收账款
  812. this.form.ticketList = this.ticketList;
  813. //产品是否可拆分
  814. this.form.zfpSplit = this.zfpSplit;
  815. //放款方式
  816. this.form.zfpcrLoanType = this.zfpcrLoanType;
  817. //融信类型
  818. this.form.type = "2";
  819. //利率
  820. this.form.zfiRate = this.zfpcrRate;
  821. //产品
  822. this.form.zfpId = this.zfpId;
  823. //可用额度
  824. this.form.availableAmt = this.availableAmt;
  825. //最小融资金额
  826. this.form.zfpMinimumAmount = this.zfpMinimumAmount;
  827. //合计金额
  828. this.form.checkTotalAmt = this.moneyDelete(this.checkTotalAmt);
  829. addCredit(this.form).then(response => {
  830. loading.close();
  831. //获取融信编号
  832. var zfiId = response.data.zfiId;
  833. //查询当前用户是否为经办人
  834. listCompanyHandler().then((response) => {
  835. if (false == response.data) {
  836. //当前用户不是经办人,返回到列表页
  837. this.msgSuccess("融信资料已提交企业内部审批");
  838. this.$store.dispatch(
  839. "tagsView/delView",
  840. this.$route
  841. );
  842. this.$router.go(-1);
  843. } else {
  844. //当前用户是经办人,判断有无融信开立融信的内部审批
  845. //查询有无融信开立内部审批
  846. var confirmParam = {};
  847. confirmParam.menuId = "1000000001";
  848. isOpenApproval(confirmParam).then((response) => {
  849. var result = response.data.isOpen;
  850. //有融信开立内部审批
  851. if (true == result) {
  852. this.msgSuccess("融信资料已提交企业内部审批");
  853. this.$store.dispatch(
  854. "tagsView/delView",
  855. this.$route
  856. );
  857. this.$router.go(-1);
  858. } else {
  859. //无融信开立内部审批
  860. //查询有无平台审批
  861. var platParam = {};
  862. platParam.menuId = "1000000004";
  863. isOpenApproval(platParam).then((response) => {
  864. var platResult = response.data.isOpen;
  865. //开启平台审批
  866. if (platResult) {
  867. this.msgSuccess("融信资料已提交平台审核,平台审核时间为工作日:9:00—18:00;单日16:00之前提交资料,预计2小时内完成,请留意站内信息");
  868. this.$store.dispatch("tagsView/delView", this.$route);
  869. this.$router.go(-1);
  870. } else {
  871. //未开启平台审批
  872. //关闭当前页面
  873. this.$store.dispatch(
  874. "tagsView/delView",
  875. this.$route
  876. );
  877. //跳转盖章页面
  878. Cookies.set("/credit/creditSeal/" + zfiId + "/", this.$route.fullPath)
  879. this.$router.push({
  880. path: "/credit/creditSeal/" + zfiId + "/"
  881. });
  882. }
  883. });
  884. }
  885. });
  886. }
  887. });
  888. }).catch((response) => {
  889. loading.close();
  890. });
  891. }
  892. }
  893. });
  894. },
  895. //金额去掉千分位
  896. moneyDelete(num) {
  897. if (num && num != undefined && num != null) {
  898. let _num = num;
  899. _num = _num.toString();
  900. _num = _num.replace(/,/gi, '');
  901. return _num;
  902. } else {
  903. return num;
  904. }
  905. },
  906. //预览
  907. handlePreview(row) {
  908. const pfiUrl = row.pfiUrl;
  909. const pfiFileName = row.pfiFileName;
  910. if (row.pfiUrl) {
  911. console.log(pfiFileName.substr(-3));
  912. if (pfiFileName.substr(-3) == "pdf") {
  913. this.wordUrl = pfiUrl + "/" + getToken();
  914. this.show = false;
  915. this.heid = true;
  916. } else if (
  917. pfiFileName.substr(-3) == "jpg" ||
  918. pfiFileName.substr(-3) == "png" ||
  919. pfiFileName.substr(-3) == "JPG" ||
  920. pfiFileName.substr(-3) == "PNG" ||
  921. pfiFileName.substr(-4) == "jpeg" ||
  922. pfiFileName.substr(-3) == "JPEG"
  923. ) {
  924. this.wordUrl =
  925. pfiUrl +
  926. "/" +
  927. getToken();
  928. this.show = true;
  929. this.heid = false;
  930. console.log("====>", this.wordUrl);
  931. } else if (
  932. pfiFileName.substr(-3) == "doc" ||
  933. pfiFileName.substr(-3) == "DOC" ||
  934. pfiFileName.substr(-4) == "docx" ||
  935. pfiFileName.substr(-3) == "DOCX"
  936. ) {
  937. this.wordUrl =
  938. "https://view.officeapps.live.com/op/view.aspx?src=" +
  939. pfiUrl +
  940. "/" +
  941. getToken() +
  942. "/" +
  943. pfiFileName;
  944. this.show = false;
  945. this.heid = true;
  946. console.log("====>", this.wordUrl);
  947. } else {
  948. this.$message({
  949. message: "暂不支持该类型文件预览",
  950. type: "warning",
  951. });
  952. return;
  953. }
  954. }
  955. this.openFile = true;
  956. },
  957. changeRate(e, input) {
  958. e.target.value = (e.target.value.match(/^\d*(\.?\d{0,2})/g)[0]) || null
  959. this.input = e.target.value
  960. this.form.zfiAmount = this.input
  961. },
  962. //新增应付
  963. addPay() {
  964. //获取选中第一个的预计还款日期
  965. if (this.chooseTicket[0]) {
  966. var zbiPayDate = this.chooseTicket[0].zbiPayDate;
  967. this.payDate = zbiPayDate;
  968. }
  969. this.openAddBill = true
  970. },
  971. //新增账款回调
  972. emitAddClick(val) {
  973. var self = this
  974. this.getAccountsCollection().then((response) => {
  975. //新增付款返回id直接选中
  976. if (val) {
  977. self.payList.forEach(element => {
  978. if (element.zbiId == val) {
  979. // 将当前点击项选中
  980. self.chooseTicket.push(element)
  981. self.closeTicket()
  982. }
  983. });
  984. }
  985. })
  986. self.openAddBill = false
  987. },
  988. //修改账款回调
  989. emitEditClick(val) {
  990. var self = this
  991. this.getAccountsCollection().then((response) => {
  992. //修改付款返回id直接选中
  993. if (val) {
  994. // self.payList.forEach(element => {
  995. // if (element.zbiId == val) {
  996. // // 将当前点击项选中
  997. // // self.chooseTicket.push(element)
  998. // //self.closeTicket()
  999. // }
  1000. // });
  1001. console.log(self.chooseTicket)
  1002. self.ticketList = self.chooseTicket
  1003. self.closeTicket()
  1004. }
  1005. })
  1006. self.openEditBill = false
  1007. },
  1008. }
  1009. };
  1010. </script>
  1011. <style lang="scss">
  1012. .uoloadfj .el-upload--picture-card {
  1013. width: 110px;
  1014. height: 110px;
  1015. line-height: 110px;
  1016. }
  1017. .fjUoloadSty .el-upload--picture-card {
  1018. display: none;
  1019. }
  1020. table th.star div::before {
  1021. content: '*';
  1022. color: red;
  1023. }
  1024. </style><style lang="scss" scoped>
  1025. .zap-available-credit {
  1026. height: 40px;
  1027. margin-bottom: 22px;
  1028. }
  1029. .zap-title {
  1030. padding: 20px 25px;
  1031. font-size: 16px;
  1032. color: #333333;
  1033. background-color: #ffffff;
  1034. }
  1035. .zap-form {
  1036. padding: 10px 25px 8px;
  1037. background-color: #ffffff;
  1038. box-sizing: border-box;
  1039. }
  1040. .zap-form--clear {
  1041. padding-left: 0;
  1042. padding-right: 0;
  1043. }
  1044. </style>