addCredit.vue 43 KB

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