signFor.vue 32 KB

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