addCredit.vue 45 KB

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