creditApply.vue 37 KB

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