12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058 |
- <template>
- <div class="app-container">
- <el-form ref="form" :model="form" :rules="rules" :inline="true" style="margin-top: 20px" label-width="auto">
- <el-divider content-position="left">开立融信</el-divider>
- <el-row>
- <el-col :span="8">
- <el-form-item label="开立方" prop="openName">
- <el-input v-model="form.openName" style="width: 200px" disabled />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="授信额度" prop="zfiCoreQuotaId">
- <el-select style="width: 200px" v-model="form.zfiCoreQuotaId" filterable clearable remote @change="change">
- <el-option v-for="item in creditLineList" :key="item.value" :label="item.label+item.remaining" :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <span>可用额度:</span>
- <span>{{availableAmt}}</span>
- <br>
- <span>有效期:</span>
- <span>{{validityDate}}</span>
- <br>
- <span>最小融资金额:</span>
- <span>{{zfpMinimumAmount}}</span>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="8">
- <el-form-item label="接收方" prop="zfiSupplierId">
- <el-select style="width: 200px" v-model="form.zfiSupplierId" filterable clearable remote>
- <el-option v-for="item in supplierList" :key="item.value" :label="item.label" :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="签发有效期" prop="zfiEffectiveDate">
- <el-date-picker clearable size="small" style="width: 200px" v-model="form.zfiEffectiveDate"
- type="date" value-format="yyyy-MM-dd"
- placeholder="选择签发有效期"
- :picker-options="pickerOptions">
- </el-date-picker>
- </el-form-item>
- </el-col>
- </el-row>
- <el-divider content-position="left">应付账款</el-divider>
- <el-form-item style="margin-left: 100px">
- <el-button size="mini" type="success" @click="addPay">新增应付账款</el-button>
- <el-button size="mini" type="primary" @click="openTicket">选择</el-button>
- <el-button size="mini" @click="deleteTicekt">清空全部</el-button>
- <el-form-item label="合计金额:">
- <span>{{checkTotalAmt}}</span>
- </el-form-item>
- <el-form-item label="金额大写:">
- <span>{{checkTotalBigAmt}}</span>
- </el-form-item>
- <el-table :data="ticketList" style="width: 1100px">
- <el-table-column label="账款名称" align="center" prop="zbiName" show-overflow-tooltip />
- <el-table-column label="应收企业" align="center" prop="receiveName" />
- <el-table-column label="应付企业" align="center" prop="payName" />
- <el-table-column label="预计还款期" align="center" prop="zbiPayDate" show-overflow-tooltip />
- <el-table-column label="金额" align="center" prop="zbiAmount" />
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="250">
- <template slot-scope="scope">
- <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.$index, ticketList)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-form-item>
- <el-row>
- <el-col :span="8">
- <el-form-item label="签发金额" prop="zfiAmount">
- <el-input v-model="form.zfiAmount" style="width: 200px" @input="getBigSmall" @input.native="changeRate($event,form.zfiAmount)" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="承诺还款日" prop="zfiExpireDate">
- <el-date-picker clearable size="small" style="width: 200px" v-model="form.zfiExpireDate"
- type="date" value-format="yyyy-MM-dd"
- placeholder="选择承诺还款日"
- :picker-options="pickerOptions">
- </el-date-picker>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="8">
- <el-form-item label="金额大写" prop="issuedAmount">
- {{issuedAmount}}
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <!-- 发票附件 -->
- <el-divider content-position="left">发票附件</el-divider>
- <el-table :data="invoiceFileList" style="width: 100%">
- <el-table-column label="文件名称" align="center" prop="pfiFileName" show-overflow-tooltip />
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width='300' fixed="right" >
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-view"
- @click="handleDownload(scope.row)"
- >下载</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-view"
- @click="handlePreview(scope.row)"
- >预览</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!-- 合同附件 -->
- <el-divider content-position="left">合同附件</el-divider>
- <el-table :data="contractFileList" style="width: 100%">
- <el-table-column label="文件名称" align="center" prop="pfiFileName" show-overflow-tooltip />
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width='300' fixed="right" >
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-view"
- @click="handleDownload(scope.row)"
- >下载</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-view"
- @click="handlePreview(scope.row)"
- >预览</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!-- 其他附件 -->
- <el-divider content-position="left">其他附件</el-divider>
- <el-table :data="otherFileList" style="width: 100%">
- <el-table-column label="文件名称" align="center" prop="pfiFileName" show-overflow-tooltip />
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width='300' fixed="right" >
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-view"
- @click="handleDownload(scope.row)"
- >下载</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-view"
- @click="handlePreview(scope.row)"
- >预览</el-button>
- </template>
- </el-table-column>
- </el-table>
- <div class="footer" style="float: right;
- margin-bottom:14px; margin-top:15px">
- <el-button type="primary" @click="submitForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- <!-- 应付账款信息 -->
- <el-dialog :title="payTitle" :visible.sync="open" width="1120px" append-to-body>
- <el-form :model="queryParamsPay" ref="formQuery" :inline="true" label-width="68px" style="margin-bottom: -21px">
- <el-form-item label="账款名称" prop="zbiName">
- <el-input v-model="queryParamsPay.zbiName" placeholder="请输入账款名称" clearable size="small" maxlength="11" @keyup.enter.native="handleQuerys" />
- </el-form-item>
- <el-form-item label="应收企业" prop="receiveName">
- <el-input v-model="queryParamsPay.receiveName" placeholder="请输入应收企业" clearable size="small" maxlength="11" @keyup.enter.native="handleQuerys" />
- </el-form-item>
- <el-form-item>
- <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuerys">搜索</el-button>
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuerys">重置</el-button>
- </el-form-item>
- </el-form>
- <el-table :data="payList" ref="tablePay" class="single-select-table" @selection-change="handleSelectionChange" :row-key="rowkey">
- <el-table-column type="selection" :reserve-selection="true" width="50" align="center" />
- <el-table-column label="序号" type="index" width="50" align="center">
- <template slot-scope="scope">
- <span>{{ (queryParamsPay.pageNum - 1) * queryParamsPay.pageSize + scope.$index + 1}}</span>
- </template>
- </el-table-column>
- <el-table-column label="账款名称" align="center" prop="zbiName" show-overflow-tooltip />
- <el-table-column label="应收企业" align="center" prop="receiveName" />
- <el-table-column label="应付企业" align="center" prop="payName" />
- <el-table-column label="预计还款期" align="center" prop="zbiPayDate" show-overflow-tooltip />
- <el-table-column label="金额" align="center" prop="zbiAmount" />
- </el-table>
- <pagination v-show="total > 0" :total="total" :page.sync="queryParamsPay.pageNum" :limit.sync="queryParamsPay.pageSize" @pagination="getAccountsPay" />
- <span slot="footer" class="dialog-footer">
- <el-button size="mini" @click="cancelTicket">取消</el-button>
- <el-button size="mini" type="primary" @click="closeTicket">确认</el-button>
- </span>
- </el-dialog>
-
- <!-- 新增往来账款 -->
- <el-dialog title="新增往来账款" :visible.sync="openAddBill" width="1120px" append-to-body>
- <add-bill :companyId="form.zfiSupplierId" companyType="00" @addClick="emitAddClick"></add-bill>
- </el-dialog>
- <el-dialog
- title="预览"
- :visible.sync="pdfShowDialog"
- width="30%">
- <pdf-show :pdfFileList="pdfFileList">
- </pdf-show>
- </el-dialog>
- <!--预览-->
- <el-dialog :visible.sync="openFile" width="1000px" append-to-body>
- <img :src="wordUrl" v-if="show" width='450px' height='500px'/>
- <iframe :src="wordUrl" width='800px' height='600px' frameborder='1' v-if="heid"/>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- listCreditLine,
- getReceiverList,
- getAccountsPay,
- getAvailableBalance,
- addCredit,
- getFile
- } from "@/api/service/credit/credit";
- import { getRandom } from "@/api/common/getRandom";
- import { accAdd } from "@/utils/calculation";
- import pdfShow from "./pdfShow";
- import {getToken} from "@/utils/auth";
- import AddBill from "@/views/service/bill/addBill";
- export default {
- name: "addCredit",
- components: {pdfShow,AddBill},
- data() {
- return {
- // 总条数
- total: 0,
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- },
- creditParams: {
- zfpcrId: null,
- type: "1",
- },
- queryParamsPay: {
- pageNum: 1,
- pageSize: 10,
- receiveName: null,
- zbiName: null,
- },
- // 表单参数
- form: {},
- // 表单校验
- rules: {
- //授信额度
- zfiCoreQuotaId: [
- {
- required: true,
- message: "请选择授信额度",
- trigger: ["blur", "change"],
- },
- ],
- //接收方
- zfiSupplierId: [
- {
- required: true,
- message: "请选择接收方",
- trigger: ["blur", "change"],
- },
- ],
- //签发有效期
- zfiEffectiveDate: [
- {
- required: true,
- message: "请选择签发有效期",
- trigger: ["blur", "change"],
- },
- ],
- //签发金额
- zfiAmount: [
- {
- required: true,
- message: "请输入签发金额",
- trigger: ["blur", "change"],
- },
- {
- pattern: /^(?:0|[1-9]\d{0,8})(?:\.\d{1,2})?$/,
- message: "请输入正确的签发金额",
- trigger: ["blur", "change"],
- },
- ],
- //承诺还款日
- zfiExpireDate: [
- {
- required: true,
- message: "请选择承诺还款日",
- trigger: ["blur", "change"],
- },
- ]
- },
- // 是否显示弹出层
- open: false,
- openAddBill: false,
- //授信
- creditLineList: [],
- //接收方
- supplierList: [],
- //应付账款
- payList: [],
- //应付账款表格数据
- ticketList: [],
- //应付标题
- payTitle: "",
- //可用额度
- availableAmt: "0.00",
- //有效期
- validityDate: "",
- //有效期类型
- zfpcrDateType: "",
- //合计选中的应付账款的金额
- checkTotalAmt: "0.00",
- //合计选中的应付账款的大写金额
- checkTotalBigAmt: "零元整",
- //签发金额大写
- issuedAmount: "零元整",
- //产品是否可拆分
- zfpSplit: "",
- //融资放款方式
- zfpcrLoanType: "",
- //产品编号
- zfpId: "",
- //利率
- zfpcrRate:"",
- //最小融资额度
- zfpMinimumAmount:"",
- //合同附件
- contractFileList:[],
- //发票附件
- invoiceFileList:[],
- //其他文件
- otherFileList:[],
- //签署意愿
- zfpAuthType:"",
- //展示选择意愿
- confirmIsShow:false,
- //意愿
- updateForm:{},
- pdfShowDialog : false,
- pdfFileList : [],
- pickerOptions:{
- disabledDate(v){
- return v.getTime() < new Date().getTime()-86400000;
- }
- },
- openFile:false,
- wordUrl: "",
- show:false,
- heid:false,
- chooseTicket:[]
- };
- },
- created() {
- //获取当前公司
- getRandom().then((response) => {
- if (response.data) {
- this.$set(this.form, "openName", response.data.companyName);
- this.$set(this.form, "zfiCoreId", response.data.companyId);
- }
- }),
- //获取授信额度
- listCreditLine(this.creditParams).then((response) => {
- this.creditLineList = response.data.map((item) => {
- 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,
- zfpAuthType:item.zfpAuthType,
- remaining:item.remaining,
- zfpMinimumAmount:item.zfpMinimumAmount
- };
- });
- });
- //获取接收方
- getReceiverList(null).then((response) => {
- this.supplierList = response.data.records.map((item) => {
- return { value: item.scyId, label: item.scyName };
- });
- });
- //签发金额
- this.$set(this.form, "zfiAmount", "0.00");
- },
- methods: {
- //合并单元格
- arraySpanMethod({ row, column, rowIndex, columnIndex }) {
- if (rowIndex % 2 === 0) {
- if (columnIndex === 0) {
- return [1, 2];
- } else if (columnIndex === 1) {
- return [0, 0];
- }
- }
- },
- objectSpanMethod({ row, column, rowIndex, columnIndex }) {
- if (columnIndex === 3) { //合并单元格
- if (rowIndex % 4 === 0) {
- return {
- rowspan: 4,//合并行
- colspan: 0,//合并列
- };
- } else {
- return {
- rowspan:0,
- colspan: 1,//合并列
- };
- }
- }
- },
- // 取消按钮
- cancel() {
- this.$store.dispatch("tagsView/delView", this.$route);
- this.$router.go(-1);
- },
- //应付账款查询列表
- getAccountsPay() {
- this.queryParamsPay.zbiPayeeId = this.form.zfiSupplierId;
- return getAccountsPay(this.queryParamsPay).then((response) => {
- this.payList = response.data.records;
- this.selectChecked();
- this.total = response.data.total;
- return Promise.resolve(response)
- });
- },
- resetQuerys() {
- this.resetForm("formQuery");
- this.handleQuerys();
- },
- handleQuerys() {
- this.queryParamsPay.pageNum = 1;
- this.getAccountsPay();
- },
- //取消选择意愿
- cancelUpdate(){
- this.confirmIsShow = false;
- this.resetUpdate();
- },
- resetUpdate() {
- this.updateForm = {
- radio:"1"
- };
- this.resetForm("updateForm");
- },
- //打开应付账款选择列表
- openTicket() {
- //清空搜索条件
- this.queryParamsPay.zbiName = "";
- this.queryParamsPay.receiveName = "";
- if(!this.form.zfiSupplierId){
- this.$message({
- message: "请选择接收方",
- type: "warning",
- });
- return false;
- }
- this.getAccountsPay();
- this.open = true;
- this.payTitle = "应付账款";
- },
- //获取签发金额大写
- getBigSmall() {
- this.issuedAmount = this.smallToBig(this.form.zfiAmount);
- },
- selectChecked() {
- this.ticketList.forEach((item) => {
- this.payList.forEach((row) => {
- if (row.zbiId == item.zbiId) {
- this.$nextTick(() => {
- this.$refs.tablePay &&
- this.$refs.tablePay.toggleRowSelection(
- row,
- true
- );
- });
- }
- });
- });
- //合计
- this.getReTotal(this.ticketList);
- //附件
- this.getFile(this.ticketList);
- },
- /* 多选框跨页 */
- rowkey(row) {
- return row.zbiId;
- },
- // 多选框选中数据
- handleSelectionChange(val) {
- this.chooseTicket = val;
- },
- //文件下载
- handleDownload(row){
- const pfiUrl = row.pfiUrl;
- if(pfiUrl != null && pfiUrl != ''){
- window.open(pfiUrl +"/"+ getToken());
- }else{
- this.$message({
- message: '该附件不存在!',
- type: 'warning'
- });
- return;
- }
- },
- // 确认选择
- closeTicket() {
- if (this.chooseTicket) {
- var flag = true;
- //如果长度大于1,则需要进行对比应收企业和预计还款日期是否一致
- if (this.chooseTicket.length > 0) {
- //获取选中第一个的应收企业
- var receiveName = this.chooseTicket[0].receiveName;
- //获取选中第一个的预计还款日期
- var zbiPayDate = this.chooseTicket[0].zbiPayDate;
- for (var i = 0; i < this.chooseTicket.length; i++) {
- if (receiveName != this.chooseTicket[i].receiveName) {
- flag = false
- this.chooseTicket.splice(i, 1)
- this.$message({
- message: "请选择应收企业相同的应付账款",
- type: "warning",
- });
- this.open = false;
- return false;
- }
- if (zbiPayDate != this.chooseTicket[i].zbiPayDate) {
- flag = false
- this.chooseTicket.splice(i, 1)
- this.$message({
- message: "请选择预计还款日期相同的应付账款",
- type: "warning",
- });
- this.open = false;
- return false;
- }
- }
- if(flag){
- //合计
- this.getReTotal(this.chooseTicket);
- this.ticketList = this.chooseTicket;
- //更新附件信息
- this.getFile(this.ticketList);
- }
- }
-
- this.open = false;
- } else {
- this.$message({
- message: "请选择应付账款",
- type: "warning",
- });
- }
- },
- //获取附件信息
- getFile(datas){
- var queryParamsFile = {};
- queryParamsFile.ticketList = datas;
- getFile(queryParamsFile).then((response) => {
- if(response.data){
- //获取发票文件
- this.invoiceFileList = response.data.invoiceFileList;
- //获取合同文件
- this.contractFileList = response.data.contractFileList;
- //获取其他文件
- this.otherFileList = response.data.otherFileList;
- }
- });
- },
- //重新合计
- getReTotal(chooseTicket) {
- //合计
- this.checkTotalAmt = "0.00";
- for (var i = 0; i < chooseTicket.length; i++) {
- this.checkTotalAmt = accAdd(
- this.checkTotalAmt,
- chooseTicket[i].zbiAmount,
- 2
- );
- }
- //签发金额
- this.$set(this.form, "zfiAmount", this.checkTotalAmt);
- //签发金额大写
- this.issuedAmount = this.smallToBig(this.checkTotalAmt);
- this.checkTotalBigAmt = this.smallToBig(this.checkTotalAmt);
- this.checkTotalAmt = this.amtFormat(this.checkTotalAmt);
- },
- //取消选择按钮
- cancelTicket() {
- /* this.ticketList = [];
- if (this.$refs.tablePay) {
- this.$refs.tablePay.clearSelection();
- } */
- this.open = false;
- },
- /** 清空选择信息 */
- deleteTicekt() {
- this.ticketList = [];
- this.checkTotalAmt = "0.00";
- this.checkTotalBigAmt = this.smallToBig(this.checkTotalAmt);
- //签发金额
- this.$set(this.form, "zfiAmount", "0.00");
- this.issuedAmount = this.smallToBig(this.checkTotalAmt);
- if (this.$refs.tablePay) {
- this.$refs.tablePay.clearSelection();
- }
- //更新附件
- this.getFile(this.ticketList);
- },
- /* 删除按钮 */
- handleDelete(index, rows) {
- rows.splice(index, 1);
- if (this.$refs.tablePay) {
- this.$refs.tablePay.clearSelection();
- }
- this.selectChecked();
- },
- onSelectAll() {
- if (this.$refs.tablePay) {
- this.$refs.tablePay.clearSelection();
- }
- },
- //选择授信触发
- change(val) {
- if (!val) {
- //可用额度
- this.availableAmt = "0.00";
- //有效期
- this.validityDate = "";
- //产品是否可拆分
- this.zfpSplit = "",
- //融资放款方式
- this.zfpcrLoanType = "";
- //产品
- this.zfpId = "";
- //利率
- this.zfpcrRate = "";
- //有效期类型
- this.zfpcrDateType = "";
- //签署意愿
- this.zfpAuthType ="";
- //最小融资额度
- this.zfpMinimumAmount = "";
- return;
- }
- let obj = {};
- obj = this.creditLineList.find((item) => {
- return item.value === val;
- });
- //获取有效期的类型
- this.zfpcrDateType = obj.zfpcrDateType;
- //产品是否可拆分
- this.zfpSplit = obj.zfpSplit;
- //放款方式
- this.zfpcrLoanType = obj.zfpcrLoanType;
- //产品
- this.zfpId = obj.zfpId;
- //利率
- this.zfpcrRate = obj.zfpcrRate;
- //签署意愿
- this.zfpAuthType = obj.zfpAuthType;
- //最小融资额度
- this.zfpMinimumAmount = obj.zfpMinimumAmount;
- //长期
- if ("0" == this.zfpcrDateType) {
- this.validityDate = "长期";
- } else {
- this.validityDate = obj.zfpcrEndDate;
- }
- var lineQueryParam = {};
- lineQueryParam.zfpcrId = val;
- //获取可用额度
- getAvailableBalance(lineQueryParam).then((response) => {
- this.availableAmt = response.data.remaining;
- });
- },
- //格式化金额
- amtFormat(cellValue) {
- if (
- cellValue == null ||
- cellValue == undefined ||
- cellValue == ""
- ) {
- cellValue = "0.00";
- }
- cellValue += "";
- if (!cellValue.includes(".")) {
- cellValue += ".00";
- }
- console.log(cellValue);
- return cellValue
- .replace(/(\d)(?=(\d{3})+\.)/g, function ($0, $1) {
- return $1 + ",";
- })
- .replace(/\.$/, "");
- },
- /* // 将数字金额转换为大写金额 */
- smallToBig(money) {
- // 将数字金额转换为大写金额
- var cnNums = new Array(
- "零",
- "壹",
- "贰",
- "叁",
- "肆",
- "伍",
- "陆",
- "柒",
- "捌",
- "玖"
- ); //汉字的数字
- var cnIntRadice = new Array("", "拾", "佰", "仟"); //基本单位
- var cnIntUnits = new Array("", "万", "亿", "兆"); //对应整数部分扩展单位
- var cnDecUnits = new Array("角", "分", "毫", "厘"); //对应小数部分单位
- var cnInteger = "整"; //整数金额时后面跟的字符
- var cnIntLast = "元"; //整数完以后的单位
- //最大处理的数字
- var maxNum = 999999999999999.9999;
- var integerNum; //金额整数部分
- var decimalNum; //金额小数部分
- //输出的中文金额字符串
- var chineseStr = "";
- var parts; //分离金额后用的数组,预定义
- if (money == "" || money == null || money == undefined) {
- return "零元零角零分";
- }
- money = parseFloat(money);
- if (money >= maxNum) {
- //超出最大处理数字
- return "超出最大处理数字";
- }
- if (money == 0) {
- chineseStr = cnNums[0] + cnIntLast + cnInteger;
- return chineseStr;
- }
- //四舍五入保留两位小数,转换为字符串
- money = Math.round(money * 100).toString();
- integerNum = money.substr(0, money.length - 2);
- decimalNum = money.substr(money.length - 2);
- //获取整型部分转换
- if (parseInt(integerNum, 10) > 0) {
- var zeroCount = 0;
- var IntLen = integerNum.length;
- for (var i = 0; i < IntLen; i++) {
- var n = integerNum.substr(i, 1);
- var p = IntLen - i - 1;
- var q = p / 4;
- var m = p % 4;
- if (n == "0") {
- zeroCount++;
- } else {
- if (zeroCount > 0) {
- chineseStr += cnNums[0];
- }
- //归零
- zeroCount = 0;
- chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
- }
- if (m == 0 && zeroCount < 4) {
- chineseStr += cnIntUnits[q];
- }
- }
- chineseStr += cnIntLast;
- }
- //小数部分
- if (decimalNum != "") {
- var decLen = decimalNum.length;
- for (var i = 0; i < decLen; i++) {
- var n = decimalNum.substr(i, 1);
- if (n != "0") {
- chineseStr += cnNums[Number(n)] + cnDecUnits[i];
- }
- }
- }
- if (chineseStr == "") {
- chineseStr += cnNums[0] + cnIntLast + cnInteger;
- } else if (decimalNum == "" || /^0*$/.test(decimalNum)) {
- chineseStr += cnInteger;
- }
- return chineseStr;
- },
- //新增
- submitForm() {
- this.$refs["form"].validate((valid) => {
- if(parseFloat(this.form.zfiAmount) > parseFloat(this.moneyDelete(this.availableAmt))){
- this.$message({
- message: '签发金额不可大于可用金额',
- type: 'warning'
- });
- return;
- }
- if(parseFloat(this.form.zfiAmount) < parseFloat(this.zfpMinimumAmount)){
- this.$message({
- message: '签发金额不可小于产品的最小融资金额',
- type: 'warning'
- });
- return;
- }
- if (valid) {
- const loading = this.$loading({
- lock: true,
- text: 'Loading',
- background: 'rgba(0, 0, 0,0)'
- });
- //选择了应付款,如果申请金额小于合计金额增加提示
- debugger;
- if(this.ticketList.length > 0){
- if((parseFloat(this.form.zfiAmount)) < (parseFloat(this.moneyDelete(this.checkTotalAmt)))){
- var _this = this;
- this.$confirm('签发金额小于应付金额合计,是否确认提交', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- //产品是否可拆分
- _this.form.zfpSplit = _this.zfpSplit;
- //放款方式
- _this.form.zfpcrLoanType = _this.zfpcrLoanType;
- //融信类型
- _this.form.type = "1";
- //利率
- _this.form.zfiRate = _this.zfpcrRate;
- //产品
- _this.form.zfpId = _this.zfpId;
- //应付账款
- _this.form.ticketList = _this.ticketList;
- //可用额度
- _this.form.availableAmt = _this.moneyDelete(_this.availableAmt);
- //最小融资金额
- _this.form.zfpMinimumAmount = _this.zfpMinimumAmount;
- addCredit(_this.form).then((response) => {
- loading.close();
- _this.msgSuccess("新增成功");
- _this.$store.dispatch(
- "tagsView/delView",
- _this.$route
- );
- _this.$router.go(-1);
- }).catch((e) => {
- loading.close();
- });
- }).catch((e) => {
- loading.close();
- });
- }else{
- //产品是否可拆分
- this.form.zfpSplit = this.zfpSplit;
- //放款方式
- this.form.zfpcrLoanType = this.zfpcrLoanType;
- //融信类型
- this.form.type = "1";
- //利率
- this.form.zfiRate = this.zfpcrRate;
- //产品
- this.form.zfpId = this.zfpId;
- //应付账款
- this.form.ticketList = this.ticketList;
- //可用额度
- this.form.availableAmt = this.moneyDelete(this.availableAmt);
- //最小融资金额
- this.form.zfpMinimumAmount = this.zfpMinimumAmount;
- addCredit(this.form).then((response) => {
- loading.close();
- this.msgSuccess("新增成功");
- this.$store.dispatch(
- "tagsView/delView",
- this.$route
- );
- this.$router.go(-1);
- }).catch((response) => {
- loading.close();
- });
- }
- }else{
- //产品是否可拆分
- this.form.zfpSplit = this.zfpSplit;
- //放款方式
- this.form.zfpcrLoanType = this.zfpcrLoanType;
- //融信类型
- this.form.type = "1";
- //利率
- this.form.zfiRate = this.zfpcrRate;
- //产品
- this.form.zfpId = this.zfpId;
- //应付账款
- this.form.ticketList = this.ticketList;
- //可用额度
- this.form.availableAmt = this.moneyDelete(this.availableAmt);
- //最小融资金额
- this.form.zfpMinimumAmount = this.zfpMinimumAmount;
- addCredit(this.form).then((response) => {
- loading.close();
- this.msgSuccess("新增成功");
- this.$store.dispatch(
- "tagsView/delView",
- this.$route
- );
- this.$router.go(-1);
- }).catch((response) => {
- loading.close();
- });
- }
-
- }
- });
- },
- //金额去掉千分位
- moneyDelete(num){
- if(num &&num != undefined && num != null){
- let _num = num;
- _num = _num.toString();
- _num = _num.replace(/,/gi,'');
- return _num;
- }else{
- return num;
- }
- },
- //预览
- handlePreview(row) {
- const pfiUrl = row.pfiUrl;
- const pfiFileName = row.pfiFileName;
- if (row.pfiUrl) {
- console.log(pfiFileName.substr(-3));
- if (pfiFileName.substr(-3) == "pdf") {
- this.wordUrl = pfiUrl + "/" + getToken();
- this.show=false;
- this.heid=true;
- } else if (
- pfiFileName.substr(-3) == "jpg" ||
- pfiFileName.substr(-3) == "png" ||
- pfiFileName.substr(-3) == "JPG" ||
- pfiFileName.substr(-3) == "PNG" ||
- pfiFileName.substr(-4) == "jpeg" ||
- pfiFileName.substr(-3) == "JPEG"
- ) {
- this.wordUrl =
- pfiUrl +
- "/" +
- getToken();
- this.show=true;
- this.heid=false;
- console.log("====>",this.wordUrl);
- } else if (
- pfiFileName.substr(-3) == "doc" ||
- pfiFileName.substr(-3) == "DOC"||
- pfiFileName.substr(-4) == "docx" ||
- pfiFileName.substr(-3) == "DOCX"
- ) {
- this.wordUrl =
- "https://view.officeapps.live.com/op/view.aspx?src=" +
- pfiUrl +
- "/" +
- getToken() +
- "/" +
- pfiFileName;
- this.show=false;
- this.heid=true;
- console.log("====>",this.wordUrl);
- } else {
- this.$message({
- message: "暂不支持该类型文件预览",
- type: "warning",
- });
- return;
- }
- }
- this.openFile = true;
- },
- changeRate(e,input){
- e.target.value=(e.target.value.match(/^\d*(\.?\d{0,2})/g)[0]) || null
- this.input=e.target.value
- this.form.zfiAmount=this.input
- },
- //新增应付
- addPay(){
- if(this.form.zfiSupplierId){
- this.openAddBill = true
- }else{
- this.$message({
- message: "请选择接收方",
- type: "warning",
- });
- }
- },
- //新增账款回调
- emitAddClick(val){
- var self = this
- this.getAccountsPay().then((response) => {
- //新增付款返回id直接选中
- if (val) {
- self.payList.forEach(element => {
- if(element.zbiId == val){
- // 将当前点击项选中
- self.chooseTicket.push(element)
- self.closeTicket()
- }
- });
- }
- })
- self.openAddBill = false
- }
- },
- };
- </script>
- <style lang="scss">
- .uoloadfj .el-upload--picture-card {
- width: 110px;
- height: 110px;
- line-height: 110px;
- }
- .fjUoloadSty .el-upload--picture-card {
- display: none;
- }
- table th.star div::before {
- content: "*";
- color: red;
- }
- .el-dialog{
- display: flex;
- flex-direction: column;
- margin:0 !important;
- position:absolute;
- top:50%;
- left:50%;
- transform:translate(-50%,-50%);
- /*height:600px;*/
- max-height:calc(100% - 30px);
- max-width:calc(100% - 30px);
- }
- .el-dialog .el-dialog__body{
- flex:1;
- overflow: auto;
- }
- </style>
|