addInformation.vue 35 KB

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