creditApply.vue 37 KB

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