financeOpenUpdate.vue 37 KB

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