addCredit.vue 43 KB

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