12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199 |
- <template>
- <div>
- <avue-crud :option="optionD" :table-loading="loading" :data="form.feeCenterListD" id="out-table" ref="crudD"
- @selection-change="selectionDChange" @resetColumn="resetColumn('crudD', 'optionD', 'optionDBack', 381)"
- @saveColumn="saveColumn('crudD', 'optionD', 'optionDBack', 381)">
- <template slot="menuLeft">
- <div style="display: inline-block;margin-right: 20px" class="disabledBox fontSize">
- <i class="el-icon-coin"></i>
- <span>应收费用</span>
- </div>
- <el-button type="info" plain size="small" :disabled="disabled"
- @click="allClick('一键保存', 'D')">一键保存</el-button>
- <el-button type="info" plain size="small" :disabled="disabled"
- @click="allClick('一键编辑', 'D')">一键编辑</el-button>
- <el-button type="danger" plain size="small" :disabled="disabled || selectionDList.length == 0"
- @click="allClick('批量删除', 'D')">批量删除</el-button>
- <el-button type="primary" plain size="small" :disabled="disabled || selectionDList.length == 0"
- @click="allClick('生成账单', 'D')">生成账单</el-button>
- <el-button type="danger" plain size="small" :disabled="disabled || selectionDList.length == 0"
- @click="allClick('撤销账单', 'D')">撤销账单</el-button>
- <el-button type="primary" plain size="small" @click="$refs.printD.openDialog()">打印账单</el-button>
- <el-button type="success" plain size="small" :disabled="disabled"
- @click="allClick('应收模板', 'D')">应收模板</el-button>
- <!-- <el-button type="primary" plain size="small" :disabled="disabled"
- @click="allClick('生成应收', 'D')">生成应收</el-button> -->
- </template>
- <template slot="indexHeader" slot-scope="{row,index}">
- <el-button type="primary" size="mini" icon="el-icon-plus" :disabled="disabled" circle @click="addRow('D')">
- </el-button>
- </template>
- <template slot="index" slot-scope="{row,index}">
- <span>{{ index + 1 }}</span>
- </template>
- <template slot="corpCnNameForm" slot-scope="{ row }">
- <dic-select v-if="row.$cellEdit" v-model="row.corpCnName" placeholder="往来单位" key="id" label="cnName"
- res="records" url="/blade-los/bcorps/listByType?corpTypeName=客户" :filterable="true" :remote="true"
- dataName="cnName" @selectChange="rowDicChange('corpCnName', $event, row)"></dic-select>
- <span v-else>{{ row.corpCnName }}</span>
- </template>
- <template slot="feeCnNameForm" slot-scope="{ row }">
- <dic-select v-if="row.$cellEdit" v-model="row.feeCnName" placeholder="费用名称" key="id" label="cnName"
- res="records" url="/blade-los/bfees/list" :filterable="true" :remote="true" dataName="cnName"
- @selectChange="rowDicChange('feeCnName', $event, row)"></dic-select>
- <span v-else>{{ row.feeCnName }}</span>
- </template>
- <template slot="unitNoForm" slot-scope="{ row }">
- <dic-select v-if="row.$cellEdit" v-model="row.unitNo" placeholder="收费标准" key="id" label="code"
- url="/blade-los/bunits/selectList" :filterable="true"
- @selectChange="rowDicChange('unitNo', $event, row)"></dic-select>
- <span v-else>{{ row.unitNo }}</span>
- </template>
- <tempalte slot="quantityForm" slot-scope="{ row }">
- <el-input-number v-if="row.$cellEdit" v-model="row.quantity" @change="countChange(row)" :controls="false"
- placeholder="请输入 数量" size="small" style="width: 100%;"></el-input-number>
- <span v-else>{{ row.quantity }}</span>
- </tempalte>
- <tempalte slot="priceForm" slot-scope="{ row }">
- <el-input-number v-if="row.$cellEdit" v-model="row.price" @change="countChange(row)" :controls="false"
- placeholder="请输入 单价" size="small" style="width: 100%;"></el-input-number>
- <span v-else>{{ row.price }}</span>
- </tempalte>
- <template slot="curCodeForm" slot-scope="{ row }">
- <dic-select v-if="row.$cellEdit" v-model="row.curCode" placeholder="币别" key="id" label="code"
- :url="'/blade-los/bcurrency/getExrate?date=' + form.contractDate + '&dc=' + row.dc" :filterable="true"
- @selectChange="rowDicChange('curCode', $event, row)"></dic-select>
- <span v-else>{{ row.curCode }}</span>
- </template>
- <tempalte slot="exrate" slot-scope="{ row }">
- <el-input-number v-if="row.$cellEdit" v-model="row.exrate" @change="countChange(row)" :controls="false"
- placeholder="请输入 汇率" size="small" style="width: 100%;"></el-input-number>
- <span v-else>{{ row.exrate }}</span>
- </tempalte>
- <tempalte slot="stlExrate" slot-scope="{ row }">
- <el-input-number v-if="row.$cellEdit" v-model="row.stlExrate" :controls="false" placeholder="请输入 结算汇率"
- size="small" style="width: 100%;"></el-input-number>
- <span v-else>{{ row.stlExrate }}</span>
- </tempalte>
- </avue-crud>
- <avue-crud style="margin-top: 10px;" :option="optionC" :table-loading="loading" :data="form.feeCenterListC"
- id="out-table" ref="crudC" @selection-change="selectionCChange"
- @resetColumn="resetColumn('crudC', 'optionC', 'optionCBack', 382)"
- @saveColumn="saveColumn('crudC', 'optionC', 'optionCBack', 382)">
- <template slot="menuLeft">
- <div style="display: inline-block;margin-right: 20px" class="disabledBox fontSize">
- <i class="el-icon-coin"></i>
- <span>应付费用</span>
- </div>
- <el-button type="info" plain size="small" :disabled="disabled"
- @click="allClick('一键保存', 'C')">一键保存</el-button>
- <el-button type="info" plain size="small" :disabled="disabled"
- @click="allClick('一键编辑', 'C')">一键编辑</el-button>
- <el-button type="danger" plain size="small" :disabled="disabled || selectionCList.length == 0"
- @click="allClick('批量删除', 'C')">批量删除</el-button>
- <el-button type="primary" plain size="small" :disabled="disabled || selectionCList.length == 0"
- @click="allClick('生成账单', 'C')">生成账单</el-button>
- <el-button type="danger" plain size="small" :disabled="disabled || selectionCList.length == 0"
- @click="allClick('撤销账单', 'C')">撤销账单</el-button>
- <el-button type="primary" plain size="small" @click="$refs.printC.openDialog()">打印账单</el-button>
- <el-button type="success" plain size="small" :disabled="disabled"
- @click="allClick('应付模板', 'C')">应付模板</el-button>
- <!-- <el-button type="primary" plain size="small" :disabled="disabled"
- @click="allClick('生成应付', 'C')">生成应付</el-button> -->
- </template>
- <template slot="indexHeader" slot-scope="{row,index}">
- <el-button type="primary" size="mini" icon="el-icon-plus" :disabled="disabled" circle @click="addRow('C')">
- </el-button>
- </template>
- <template slot="index" slot-scope="{row,index}">
- <span>{{ index + 1 }}</span>
- </template>
- <template slot="corpCnNameForm" slot-scope="{ row }">
- <dic-select v-if="row.$cellEdit" v-model="row.corpCnName" placeholder="往来单位" key="id" label="cnName"
- res="records" url="/blade-los/bcorps/listByType?corpTypeName=客户" :filterable="true" :remote="true"
- dataName="cnName" @selectChange="rowDicChange('corpCnName', $event, row)"></dic-select>
- <span v-else>{{ row.corpCnName }}</span>
- </template>
- <template slot="feeCnNameForm" slot-scope="{ row }">
- <dic-select v-if="row.$cellEdit" v-model="row.feeCnName" placeholder="费用名称" key="id" label="cnName"
- res="records" url="/blade-los/bfees/list" :filterable="true" :remote="true" dataName="cnName"
- @selectChange="rowDicChange('feeCnName', $event, row)"></dic-select>
- <span v-else>{{ row.feeCnName }}</span>
- </template>
- <template slot="unitNoForm" slot-scope="{ row }">
- <dic-select v-if="row.$cellEdit" v-model="row.unitNo" placeholder="收费标准" key="id" label="code"
- url="/blade-los/bunits/selectList" :filterable="true"
- @selectChange="rowDicChange('unitNo', $event, row)"></dic-select>
- <span v-else>{{ row.unitNo }}</span>
- </template>
- <tempalte slot="quantityForm" slot-scope="{ row }">
- <el-input-number v-if="row.$cellEdit" v-model="row.quantity" @change="countChange(row)" :controls="false"
- placeholder="请输入 数量" size="small" style="width: 100%;"></el-input-number>
- <span v-else>{{ row.quantity }}</span>
- </tempalte>
- <tempalte slot="priceForm" slot-scope="{ row }">
- <el-input-number v-if="row.$cellEdit" v-model="row.price" @change="countChange(row)" :controls="false"
- placeholder="请输入 单价" size="small" style="width: 100%;"></el-input-number>
- <span v-else>{{ row.price }}</span>
- </tempalte>
- <template slot="curCodeForm" slot-scope="{ row }">
- <dic-select v-if="row.$cellEdit" v-model="row.curCode" placeholder="币别" key="id" label="code"
- :url="'/blade-los/bcurrency/getExrate?date=' + form.contractDate + '&dc=' + row.dc" :filterable="true"
- @selectChange="rowDicChange('curCode', $event, row)"></dic-select>
- <span v-else>{{ row.curCode }}</span>
- </template>
- <tempalte slot="exrate" slot-scope="{ row }">
- <el-input-number v-if="row.$cellEdit" v-model="row.exrate" @change="countChange(row)" :controls="false"
- placeholder="请输入 汇率" size="small" style="width: 100%;"></el-input-number>
- <span v-else>{{ row.exrate }}</span>
- </tempalte>
- <tempalte slot="stlExrate" slot-scope="{ row }">
- <el-input-number v-if="row.$cellEdit" v-model="row.stlExrate" :controls="false" placeholder="请输入 结算汇率"
- size="small" style="width: 100%;"></el-input-number>
- <span v-else>{{ row.stlExrate }}</span>
- </tempalte>
- </avue-crud>
- <business-reports :id="form.id" :itemIds="itemIds" ref="printD" businessValue="MYDL" classifyCode="费用"
- groupCode="应收" :selecList="selectionDList"></business-reports>
- <business-reports :id="form.id" :itemIds="itemIds" ref="printC" businessValue="MYDL" classifyCode="费用"
- groupCode="应付" :selecList="selectionCList"></business-reports>
- <!--模板弹窗-->
- <el-dialog title="提示" :visible.sync="templateVisible" append-to-body width="70%" :close-on-click-modal="false"
- :before-close="handleClose">
- <div>
- <el-row>
- <el-col :span="5">
- <basic-container>
- <avue-tree :option="treeOption" :data="templateData" @node-click="nodeClick">
- </avue-tree>
- </basic-container>
- </el-col>
- <el-col :span="19">
- <avue-crud :option="templateOption" :data="templateRightData" ref="templateRef"
- @selection-change="feeselectionChange">
- </avue-crud>
- </el-col>
- </el-row>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button size="mini" @click="templateVisible = false; feesselectionList = []; templateRightData = []">取
- 消</el-button>
- <el-button type="primary" size="mini" @click="templateExport">导 入</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import dicSelect from "@/components/dicSelect/main";
- import { bcurrencyGetExrate } from "@/api/iosBasicData/rateManagement";
- import { submitListTrade, feeRemove, generateBill, revokeBill, feecenterTemplateImport } from "@/api/tradeAgency/tradeAgency";
- import { losbfeestemplateDetail } from "@/api/iosBasicData/losbfeestemplate";
- import { losbfeestemplateGetListTemplate } from "@/api/iosBasicData/bills";
- import businessReports from "@/components/tradeAgency/businessReports.vue";
- import _ from "lodash";
- export default {
- components: {
- dicSelect,
- businessReports
- },
- props: {
- detailData: {},
- disabled: {
- type: Boolean,
- default: false,
- },
- form: {
- type: Object,
- default: () => {
- }
- }
- },
- data() {
- return {
- treeOption: {
- nodeKey: "id",
- // lazy: true,
- addBtn: false,
- menu: false,
- size: "small",
- props: {
- labelText: "标题",
- label: "cnName",
- value: "value",
- children: "children"
- }
- },
- templateOption: {
- height: 400,
- menu: false,
- tip: false,
- stripe: true,
- addBtn: false,
- editBtn: false,
- delBtn: false,
- viewBtn: false,
- index: true,
- selection: true,
- header: false,
- column: [
- {
- label: '客户',
- prop: 'corpCnName',
- overHidden: true,
- },
- {
- label: '客户类型',
- prop: 'corpType',
- overHidden: true,
- },
- {
- label: '费用',
- prop: 'feeCnName',
- overHidden: true,
- },
- {
- label: '数量',
- prop: 'quantity',
- overHidden: true,
- },
- {
- label: '单价',
- prop: 'price',
- overHidden: true,
- },
- {
- label: '计量单位',
- prop: 'unitNo',
- overHidden: true,
- },
- {
- label: '币别',
- prop: 'curCode',
- overHidden: true,
- }
- ]
- },
- templateVisible: false,
- optionD: {},
- optionDBack: {
- maxHeight: 300,
- calcHeight: 30,
- menuWidth: 140,
- tip: false,
- border: true,
- addBtn: false,
- viewBtn: false,
- editBtn: false,
- delBtn: false,
- menu: false,
- refreshBtn: false,
- selection: true,
- align: 'center',
- column: [
- {
- label: "index",
- prop: "index",
- width: "55",
- headerslot: true,
- },
- {
- label: "账单",
- prop: "accStatus",
- width: '80',
- overHidden: true,
- dicData: [{
- label: '否',
- value: 0
- }, {
- label: '是',
- value: 1
- }]
- },
- {
- label: "往来单位",
- prop: "corpCnName",
- width: '160',
- cell: true,
- slot: true,
- formslot: true,
- overHidden: true,
- rules: [
- {
- required: true,
- message: '请选择往来单位',
- trigger: 'blur'
- }
- ]
- },
- {
- label: "提单号",
- prop: "mblno",
- width: '160',
- overHidden: true,
- },
- {
- label: "费用名称",
- prop: "feeCnName",
- width: '120',
- cell: true,
- slot: true,
- formslot: true,
- overHidden: true,
- rules: [
- {
- required: true,
- message: '请选择费用名称',
- trigger: 'blur'
- }
- ]
- },
- {
- label: "收费标准",
- prop: "unitNo",
- width: '120',
- overHidden: true,
- },
- {
- label: "单价",
- prop: "price",
- cell: true,
- slot: true,
- formslot: true,
- overHidden: true,
- rules: [
- {
- required: true,
- message: '请输入单价',
- trigger: 'blur'
- }
- ]
- },
- {
- label: "数量",
- prop: "quantity",
- cell: true,
- slot: true,
- formslot: true,
- overHidden: true,
- rules: [
- {
- required: true,
- message: '请输入数量',
- trigger: 'blur'
- }
- ]
- },
- {
- label: "金额",
- prop: "amount",
- overHidden: true,
- },
- {
- label: "币别",
- prop: "curCode",
- cell: true,
- slot: true,
- formslot: true,
- overHidden: true,
- rules: [
- {
- required: true,
- message: '请选择币别',
- trigger: 'blur'
- }
- ]
- },
- {
- label: "外币金额",
- prop: "amountLoc",
- overHidden: true,
- },
- {
- label: "汇率",
- prop: "exrate",
- overHidden: true,
- },
- {
- label: "结算汇率",
- prop: "stlExrate",
- overHidden: true,
- },
- {
- label: "结算日期",
- prop: "stlDate",
- width: "120",
- // cell: true,
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd 00:00:00",
- overHidden: true
- },
- {
- label: "备注",
- prop: "remarks",
- cell: true,
- width: '200',
- overHidden: true,
- },
- ]
- },
- optionC: {},
- optionCBack: {
- maxHeight: 300,
- calcHeight: 30,
- menuWidth: 140,
- tip: false,
- border: true,
- addBtn: false,
- viewBtn: false,
- editBtn: false,
- delBtn: false,
- menu: false,
- refreshBtn: false,
- selection: true,
- align: 'center',
- column: [
- {
- label: "index",
- prop: "index",
- width: "55",
- headerslot: true,
- },
- {
- label: "账单",
- prop: "accStatus",
- width: '80',
- overHidden: true,
- dicData: [{
- label: '否',
- value: 0
- }, {
- label: '是',
- value: 1
- }]
- },
- {
- label: "往来单位",
- prop: "corpCnName",
- width: '160',
- cell: true,
- slot: true,
- formslot: true,
- overHidden: true,
- rules: [
- {
- required: true,
- message: '请选择往来单位',
- trigger: 'blur'
- }
- ]
- },
- {
- label: "提单号",
- prop: "mblno",
- width: '160',
- overHidden: true,
- },
- {
- label: "费用名称",
- prop: "feeCnName",
- width: '120',
- cell: true,
- slot: true,
- formslot: true,
- overHidden: true,
- rules: [
- {
- required: true,
- message: '请选择费用名称',
- trigger: 'blur'
- }
- ]
- },
- {
- label: "收费标准",
- prop: "unitNo",
- width: '120',
- overHidden: true,
- },
- {
- label: "单价",
- prop: "price",
- cell: true,
- slot: true,
- formslot: true,
- overHidden: true,
- rules: [
- {
- required: true,
- message: '请输入单价',
- trigger: 'blur'
- }
- ]
- },
- {
- label: "数量",
- prop: "quantity",
- cell: true,
- slot: true,
- formslot: true,
- overHidden: true,
- rules: [
- {
- required: true,
- message: '请输入数量',
- trigger: 'blur'
- }
- ]
- },
- {
- label: "金额",
- prop: "amount",
- overHidden: true,
- },
- {
- label: "币别",
- prop: "curCode",
- cell: true,
- slot: true,
- formslot: true,
- overHidden: true,
- rules: [
- {
- required: true,
- message: '请选择币别',
- trigger: 'blur'
- }
- ]
- },
- {
- label: "外币金额",
- prop: "amountLoc",
- overHidden: true,
- },
- {
- label: "汇率",
- prop: "exrate",
- overHidden: true,
- },
- {
- label: "结算汇率",
- prop: "stlExrate",
- overHidden: true,
- },
- {
- label: "结算日期",
- prop: "stlDate",
- width: "120",
- // cell: true,
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd 00:00:00",
- overHidden: true
- },
- {
- label: "优惠汇率",
- prop: "discountExrate",
- cell: true,
- type: 'number',
- controls: false,
- width: "120",
- overHidden: true
- },
- {
- label: "利润",
- prop: "profit",
- overHidden: true,
- },
- {
- label: "备注",
- prop: "remarks",
- cell: true,
- width: '200',
- overHidden: true,
- },
- ]
- },
- selectionDList: [],
- selectionCList: [],
- templateData: [],
- lefttemplate: {}, // 左侧选择的数据
- feesselectionList: [], // 清空多选
- templateRightData: [],
- itemIds: null,
- }
- },
- async created() {
- this.optionD = await this.getColumnData(this.getColumnName(381), this.optionDBack);
- this.optionC = await this.getColumnData(this.getColumnName(382), this.optionCBack);
- },
- methods: {
- // 模板导入
- templateExport() {
- if (!this.lefttemplate.id) {
- this.$message.warning('请选择左侧客户')
- return
- }
- if (this.feesselectionList.length > 0) {
- feecenterTemplateImport({
- ...this.lefttemplate,
- feesTemplateItemsList: this.feesselectionList,
- billNoId: this.form.id
- }).then(res => {
- if (res.data.msg.indexOf('未导入') >= 0) {
- this.$message({
- type: "error",
- message: res.data.msg
- });
- } else {
- this.$message({
- type: "success",
- message: res.data.msg
- });
- }
- this.feesselectionList = [] // 清空多选
- this.templateRightData = [] // 清空数据
- this.lefttemplate = {}//左侧数据
- this.$emit('getDetails', this.form.id)
- this.templateVisible = false
- })
- } else {
- this.$message.warning('请先选择要导入的数据')
- }
- },
- // 模板
- // 左侧选择
- nodeClick(e) {
- this.lefttemplate = e
- losbfeestemplateDetail(e.id).then(res => {
- this.templateRightData = res.data.data.feesTemplateItemsList
- })
- },
- // 关闭弹窗
- handleClose(done) {
- this.feesselectionList = [] // 清空多选
- this.templateRightData = [] // 清空数据
- done();
- },
- feeselectionChange(list) {
- this.feesselectionList = list;
- },
- addRow(type) {
- if (!this.form.id) return this.$message.error('请保存数据');
- if (type == 'D') {
- if (this.form.feeCenterListD.length == 0) {
- this.form.feeCenterListD.push({
- $cellEdit: true,
- pid: this.form.id,
- dc: type,
- accStatus: 0,
- businessType: this.form.businessType,
- billNo: this.form.businessNo,
- billDate: this.form.businessDate,
- discountExrate: 0,
- })
- } else {
- this.form.feeCenterListD.push({
- $cellEdit: true,
- pid: this.form.id,
- dc: type,
- accStatus: 0,
- businessType: this.form.businessType,
- billNo: this.form.businessNo,
- billDate: this.form.businessDate,
- discountExrate: 0,
- corpCnName: this.form.feeCenterListD[this.form.feeCenterListD.length - 1].corpCnName,
- corpId: this.form.feeCenterListD[this.form.feeCenterListD.length - 1].corpId,
- corpEnName: this.form.feeCenterListD[this.form.feeCenterListD.length - 1].corpEnName,
- billCorpId: this.form.feeCenterListD[this.form.feeCenterListD.length - 1].billCorpId,
- billCorpCnName: this.form.feeCenterListD[this.form.feeCenterListD.length - 1].billCorpCnName,
- })
- }
- }
- if (type == 'C') {
- if (this.form.feeCenterListC.length == 0) {
- this.form.feeCenterListC.push({
- $cellEdit: true,
- pid: this.form.id,
- dc: type,
- accStatus: 0,
- businessType: this.form.businessType,
- billNo: this.form.businessNo,
- billDate: this.form.businessDate,
- discountExrate: 0,
- })
- } else {
- this.form.feeCenterListC.push({
- $cellEdit: true,
- pid: this.form.id,
- dc: type,
- accStatus: 0,
- businessType: this.form.businessType,
- billNo: this.form.businessNo,
- billDate: this.form.businessDate,
- discountExrate: 0,
- corpCnName: this.form.feeCenterListC[this.form.feeCenterListC.length - 1].corpCnName,
- corpId: this.form.feeCenterListC[this.form.feeCenterListC.length - 1].corpId,
- corpEnName: this.form.feeCenterListC[this.form.feeCenterListC.length - 1].corpEnName,
- billCorpId: this.form.feeCenterListC[this.form.feeCenterListC.length - 1].billCorpId,
- billCorpCnName: this.form.feeCenterListC[this.form.feeCenterListC.length - 1].billCorpCnName,
- })
- }
- }
- },
- countChange(row) {
- row.amount = _.multiply(Number(row.quantity ? row.quantity : 0), Number(row.price ? row.price : 0))
- if (row.feeCode == 'SFK' || row.feeCode == 'WK') {
- row.amount = _.multiply(Number(row.amountLoc ? row.amountLoc : 0), Number(row.exrate ? row.exrate : 0))
- }
- },
- selectionDChange(list) {
- let ids = []
- list.forEach(e => {
- ids.push(e.id)
- })
- if (ids.length) {
- this.itemIds = ids.join(',')
- } else {
- this.itemIds = null
- }
- this.selectionDList = list
- },
- selectionCChange(list) {
- let ids = []
- list.forEach(e => {
- ids.push(e.id)
- })
- if (ids.length) {
- this.itemIds = ids.join(',')
- } else {
- this.itemIds = null
- }
- this.selectionCList = list
- },
- rowDicChange(name, row, el) {
- if (name == 'corpCnName') {
- if (row) {
- el.corpId = row.id
- el.corpEnName = row.enName
- el.billCorpId = row.id
- el.billCorpCnName = row.cnName
- } else {
- el.corpId = null
- el.corpEnName = null
- el.billCorpId = null
- el.billCorpCnName = null
- }
- }
- if (name == 'feeCnName') {
- if (row) {
- el.feeId = row.id
- el.feeCode = row.code
- el.feeEnName = row.enName
- el.curCode = row.curNo
- el.elementsId = row.accElementId
- el.elementsCode = row.elementsCode
- el.elementsCnName = row.accElementName
- el.elementsEnName = row.elementsEnName
- bcurrencyGetExrate({ date: this.form.contractDate, dc: el.dc }).then(res => {
- res.data.data.forEach(e => {
- if (row.curNo == e.code) {
- this.$set(el, 'exrate', e.exrate)
- }
- })
- })
- } else {
- el.feeId = null
- el.feeCode = null
- el.feeEnName = null
- el.curCode = null
- el.elementsId = null
- el.elementsCode = null
- el.elementsCnName = null
- el.elementsEnName = null
- }
- }
- if (name == 'curCode') {
- if (row) {
- bcurrencyGetExrate({ date: this.form.contractDate, dc: el.dc }).then(res => {
- res.data.data.forEach(e => {
- if (el.curCode == e.code) {
- this.$set(el, 'exrate', e.exrate)
- }
- })
- })
- } else {
- el.exrate = null
- }
- }
- },
- allClick(name, type) {
- if (name == '一键保存') {
- if (type == 'D') {
- for (let row of this.form.feeCenterListD) {
- if (!row.corpCnName || !row.feeCnName || !row.price || !row.quantity || !row.curCode) {
- this.$refs.crudD.rowCell(row, row.$index)
- return this.$message.error("请完善应收费用信息");
- }
- }
- this.form.feeCenterListD.forEach(e => {
- this.$set(e, '$cellEdit', false)
- })
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- submitListTrade(this.form.feeCenterListD).then(res => {
- this.form.feeCenterListD = res.data.data
- this.$message.success("保存成功");
- }).finally(() => {
- loading.close();
- })
- }
- if (type == 'C') {
- for (let row of this.form.feeCenterListC) {
- if (!row.corpCnName || !row.feeCnName || !row.price || !row.quantity || !row.curCode) {
- this.$refs.crudC.rowCell(row, row.$index)
- return this.$message.error("请完善应付费用信息");
- }
- }
- for (let index in this.form.feeCenterListC) {
- if (this.form.feeCenterListC[index].feeCnName == '首款' || this.form.feeCenterListC[index].feeCnName == '尾款' || this.form.feeCenterListC[index].feeCnName == '手续费') {
- this.$refs.crudC.rowCell(this.form.feeCenterListC[index], index)
- if (!this.form.feeCenterListC[index].discountExrate) return this.$message.error("第" + (Number(index) + 1) + "行" + this.form.feeCenterListC[index].feeCnName + "费用优惠汇率不能为空");
- }
- }
- this.form.feeCenterListC.forEach(e => {
- this.$set(e, '$cellEdit', false)
- })
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- submitListTrade(this.form.feeCenterListC).then(res => {
- this.form.feeCenterListC = res.data.data
- this.$message.success("保存成功");
- }).finally(() => {
- loading.close();
- })
- }
- }
- if (name == '一键编辑') {
- if (type == 'D') {
- this.form.feeCenterListD.forEach(e => {
- this.$set(e, '$cellEdit', true)
- })
- }
- if (type == 'C') {
- this.form.feeCenterListC.forEach(e => {
- this.$set(e, '$cellEdit', true)
- })
- }
- }
- if (name == '批量删除') {
- let multiList = []
- let arr = []
- for (let index in this.selectionDList) {
- if (this.selectionDList[index].accStatus == 1) return this.$message.error("第" + (Number(this.selectionDList[index].$index) + 1) + "行不允许删除");
- }
- for (let index in this.selectionCList) {
- if (this.selectionCList[index].accStatus == 1) return this.$message.error("第" + (Number(this.selectionCList[index].$index) + 1) + "行不允许删除");
- }
- if (type == 'D') {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- multiList = this.selectionDList
- arr = this.form.feeCenterListD
- // 获取有id 的数据
- const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
- let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
- // 把选中的删除掉
- multiList.forEach((item) => {
- for (let index in arr) {
- if (JSON.stringify(item) == JSON.stringify(arr[index])) {
- arr.splice(Number(index), 1)
- }
- }
- })
- if (itemsWithId.length != 0) {
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- feeRemove({ ids: arrIds.join(',') }).then(res => {
- this.$message.success("删除成功");
- }).finally(() => {
- loading.close();
- })
- }
- })
- }
- if (type == 'C') {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- multiList = this.selectionCList
- arr = this.form.feeCenterListC
- // 获取有id 的数据
- const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
- let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
- // 把选中的删除掉
- multiList.forEach((item) => {
- for (let index in arr) {
- if (JSON.stringify(item) == JSON.stringify(arr[index])) {
- arr.splice(Number(index), 1)
- }
- }
- })
- if (itemsWithId.length != 0) {
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- feeRemove({ ids: arrIds.join(',') }).then(res => {
- this.$message.success("删除成功");
- }).finally(() => {
- loading.close();
- })
- }
- })
- }
- }
- if (name == '生成账单') {
- if (type == 'D') {
- for (let index in this.selectionDList) {
- if (this.selectionDList[index].accStatus != 0) {
- return this.$message.error("已生成账单");
- }
- }
- this.$confirm("确定将选择数据生成账单?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- generateBill({ id: this.form.id, feeCenterListD: this.selectionDList }).then(res => {
- this.$message.success("成功生成账单");
- this.$emit('getDetails', this.form.id)
- }).finally(() => {
- loading.close();
- })
- })
- }
- if (type == 'C') {
- for (let index in this.selectionCList) {
- if (this.selectionCList[index].accStatus != 0) {
- return this.$message.error("已生成账单");
- }
- }
- this.$confirm("确定将选择数据生成账单?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- generateBill({ id: this.form.id, feeCenterListC: this.selectionCList }).then(res => {
- this.$message.success("成功生成账单");
- this.$emit('getDetails', this.form.id)
- }).finally(() => {
- loading.close();
- })
- })
- }
- }
- if (name == '撤销账单') {
- if (type == 'D') {
- for (let index in this.selectionDList) {
- if (this.selectionDList[index].accStatus != 1) {
- return this.$message.error("未生成账单");
- }
- }
- this.$confirm("确定将选择数据撤销账单?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- revokeBill({ id: this.form.id, feeCenterListD: this.selectionDList }).then(res => {
- this.$message.success("成功撤销账单");
- this.$emit('getDetails', this.form.id)
- }).finally(() => {
- loading.close();
- })
- })
- }
- if (type == 'C') {
- for (let index in this.selectionCList) {
- if (this.selectionCList[index].accStatus != 1) {
- return this.$message.error("未生成账单");
- }
- }
- this.$confirm("确定将选择数据撤销账单?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- revokeBill({ id: this.form.id, feeCenterListC: this.selectionCList }).then(res => {
- this.$message.success("成功撤销账单");
- this.$emit('getDetails', this.form.id)
- }).finally(() => {
- loading.close();
- })
- })
- }
- }
- if (name == '应收模板') {
- this.templateVisible = true
- losbfeestemplateGetListTemplate(1, 50, {
- dc: type,
- status: 0,
- type: 'MYDL'
- }).then(res => {
- this.templateData = res.data.data.records
- // 查第一条的明细
- losbfeestemplateDetail(this.templateData[0].id).then(res => {
- this.templateRightData = res.data.data.feesTemplateItemsList
- })
- })
- }
- if (name == '应付模板') {
- this.templateVisible = true
- losbfeestemplateGetListTemplate(1, 50, {
- dc: type,
- status: 0,
- type: 'MYDL'
- }).then(res => {
- this.templateData = res.data.data.records
- // 查第一条的明细
- losbfeestemplateDetail(this.templateData[0].id).then(res => {
- this.templateRightData = res.data.data.feesTemplateItemsList
- })
- })
- }
- },
- submitValidate() {
- for (let row of this.form.feeCenterListD) {
- if (!row.corpCnName || !row.feeCnName || !row.price || !row.quantity || !row.curCode) {
- this.$refs.crudD.rowCell(row, row.$index)
- this.$message.error("请完善应收费用信息");
- return false
- }
- }
- for (let row of this.form.feeCenterListC) {
- if (!row.corpCnName || !row.feeCnName || !row.price || !row.quantity || !row.curCode) {
- this.$refs.crudC.rowCell(row, row.$index)
- this.$message.error("请完善应付费用信息");
- return false
- }
- }
- for (let index in this.form.feeCenterListC) {
- if (this.form.feeCenterListC[index].feeCnName == '首款' || this.form.feeCenterListC[index].feeCnName == '尾款' || this.form.feeCenterListC[index].feeCnName == '手续费') {
- if (!this.form.feeCenterListC[index].discountExrate) {
- this.$message.error("第" + (Number(index) + 1) + "行" + this.form.feeCenterListC[index].feeCnName + "费用优惠汇率不能为空");
- return false
- }
- }
- }
- return true
- },
- //自定义列保存
- async saveColumn(ref, option, optionBack, code) {
- /**
- * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
- * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
- * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
- */
- const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
- if (inSave) {
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- //自定义列重置
- async resetColumn(ref, option, optionBack, code) {
- this[option] = this[optionBack];
- const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
- if (inSave) {
- this.$message.success("重置成功");
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- },
- }
- </script>
- <style scoped lang="scss">
- .disabledBox {
- display: flex;
- align-items: center;
- }
- .fontSize {
- font-size: 16px;
- color: #81B337;
- }
- .meetSize {
- font-size: 16px;
- color: #54BCBD;
- }
- ::v-deep#out-table .back-one {
- background: #ecf5ff !important;
- text-align: center;
- padding: 4px 0;
- }
- ::v-deep#out-table .back-two {
- background: #ecf5ff !important;
- text-align: center;
- padding: 4px 0;
- }
- ::v-deep .el-table--small td,
- .el-table--small th {
- padding: 2px !important;
- }
- </style>
|