| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136 |
- <template>
- <div class="app-container">
- <el-container>
- <el-container>
- <el-aside
- style="
- background-color: white;
- line-height: 0px;
- width: 300px;
- height: 400px;
- "
- >
- <el-steps
- :active="active"
- direction="vertical"
- process-status="finish"
- finish-status="success"
- >
- <el-step title="基本信息"></el-step>
- <el-step title="发票列表"></el-step>
- <el-step title="合同附件"></el-step>
- <el-step title="物流附件"></el-step>
- <el-step title="其他附件"></el-step>
- </el-steps>
- </el-aside>
- <el-main>
- <el-form ref="bill" label-width="auto" :inline="true" style="margin-bottom:50px">
- <el-form-item label="创建人:" style="float: right">{{ form.createUser }}</el-form-item>
- <el-form-item label="创建时间:" style="float: right">{{ parseTime(new Date(form.createTime)) }}</el-form-item>
- <el-form-item label="编号:" style="float: right">{{ form.zbiNumber }}</el-form-item>
- </el-form>
- <!-- 基本信息 -->
- <div v-if="active == 0">
- <el-divider content-position="left">基本信息</el-divider>
- <el-form
- ref="form"
- :model="form"
- :rules="rules"
- label-width="auto"
- label-position="top"
- :inline="true"
- >
- <el-form-item
- label="账款类型"
- prop="wplIsInput"
- style="width: 300px"
- >
- <el-radio-group v-model="type" prop="type" :disabled="true">
- <el-radio-button label="00"
- v-if="type == '00'"
- >应付账款</el-radio-button
- >
- <el-radio-button label="01"
- v-if="type == '01'"
- >应收账款</el-radio-button
- >
- </el-radio-group>
- </el-form-item>
- <el-form-item label="账款名称" prop="zbiName">
- <el-input
- v-model="form.zbiName"
- placeholder="请输入账款名称"
- maxlength="20"
- style="width: 300px"
- />
- </el-form-item>
- <el-form-item label="应付方" prop="zbiPayerId">
- <el-select style="width: 300px" v-model="form.zbiPayerId" :disabled="true" filterable remote
- v-if="type == '00'">
- <el-option :label="company.scyName" :value="company.scyId">
- </el-option>
- </el-select>
- <el-select style="width: 300px" v-model="form.zbiPayerId" filterable clearable remote
- v-if="type == '01'">
- <el-option v-for="(item,index) in companyRelList" :key="index" :label="item.launchScyId == company.scyId ? item.receiveScyName : item.launchScyName" :value="item.launchScyId == company.scyId ? item.receiveScyId : item.launchScyId">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="贸易日期" prop="zbiDate">
- <el-date-picker
- style="width: 300px"
- v-model="form.zbiDate"
- value-format="yyyy-MM-dd"
- type="date"
- placeholder="选择日期"
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item
- :label="
- type == '00'
- ? '预计付款日期'
- : type == '01'
- ? '预计收款日期'
- : '预计收/付款日期'
- "
- prop="zbiPayDate"
- >
- <el-date-picker
- style="width: 300px"
- v-model="form.zbiPayDate"
- value-format="yyyy-MM-dd"
- type="date"
- placeholder="选择日期"
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item label="应收方" prop="zbiPayeeId">
- <el-select style="width: 300px" v-model="form.zbiPayeeId" :disabled="true" filterable remote
- v-if="type == '01'">
- <el-option :label="company.scyName" :value="company.scyId">
- </el-option>
- </el-select>
- <el-select style="width: 300px" v-model="form.zbiPayeeId" filterable clearable remote
- v-if="type == '00'">
- <el-option v-for="(item,index) in companyRelList" :key="index" :label="item.launchScyId == company.scyId ? item.receiveScyName : item.launchScyName" :value="item.launchScyId == company.scyId ? item.receiveScyId : item.launchScyId">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="金额" prop="zbiAmount">
- <el-input
- v-model="form.zbiAmount"
- placeholder="请输入金额"
- maxlength="20"
- style="width: 300px"
- >
- <template slot="append">元</template>
- </el-input>
- </el-form-item>
- <el-form-item label="合同编号" prop="zbiContractNo">
- <el-input
- v-model="form.zbiContractNo"
- placeholder="请输入合同编号"
- maxlength="20"
- style="width: 300px"
- />
- </el-form-item>
- <el-form-item label="账款服务">
- <el-input
- v-model="form.zbiService"
- placeholder="请输入账款服务"
- maxlength="20"
- style="width: 300px"
- />
- </el-form-item>
- <el-form-item label="配送订单">
- <el-input
- v-model="form.zbiOrderNo"
- placeholder="请输入配送订单"
- maxlength="20"
- style="width: 300px"
- />
- </el-form-item>
- <el-form-item label="配送企业">
- <el-input
- v-model="form.zbiDistributor"
- placeholder="请输入配送企业"
- maxlength="20"
- style="width: 300px"
- />
- </el-form-item>
- <el-form-item label="备注">
- <el-input
- v-model="form.zbiRemark"
- placeholder="请输入备注"
- :autosize="{ minRows: 2, maxRows: 4 }"
- maxlength="100"
- type="textarea"
- style="width: 615px"
- />
- </el-form-item>
- </el-form>
- </div>
- <!-- 发票列表 -->
- <div v-if="active == 1">
- <el-divider content-position="left">发票列表</el-divider>
- <el-form ref="invoice" label-width="auto" :inline="true">
- <el-form-item label="合计:">{{ allAmount() }}</el-form-item>
- <el-form-item label="大写:">{{ smallToBig(allAmount()) }}</el-form-item>
- <el-form-item style="float: right"
- ><el-button type="primary" @click="delInvoice"
- >删除</el-button
- ></el-form-item
- >
- <el-form-item style="float: right"
- ><el-button type="primary" @click="openUpload()"
- >上传</el-button
- ></el-form-item
- >
- </el-form>
- <el-table
- stripe
- :data="fileList"
- @selection-change="handleInvoiceSelectionChange"
- row-key="ziiId"
- default-expand-all
- border
- >
- <el-table-column
- type="selection"
- width="50"
- align="center"
- />
- <el-table-column
- label="发票代码"
- align="center"
- prop="ziiNo"
- maxlength="10"
- />
- <el-table-column
- label="发票号码"
- align="center"
- prop="ziiNumber"
- maxlength="10"
- />
- <el-table-column label="开票日期" align="center" prop="ziiDate" />
- <el-table-column
- label="购方识别号"
- align="center"
- prop="ziiPurchaserNo"
- />
- <el-table-column
- label="销方识别号"
- align="center"
- prop="ziiSellerNo"
- />
- <el-table-column
- label="合计金额"
- align="center"
- prop="ziiTotalAmount"
- />
- <el-table-column
- label="价税合计"
- align="center"
- prop="ziiAmount"
- />
- <el-table-column
- label="校验结果"
- align="center"
- prop="ziiCheckStt"
- :formatter="checkSttFormat"
- />
- <el-table-column
- label="附件"
- align="center"
- class-name="small-padding fixed-width"
- fixed="right"
- width="200"
- >
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- @click="invoicePictureCardPreview(scope.row)"
- >详情</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- <!-- 上传附件 -->
- <el-dialog
- title="上传发票"
- :visible.sync="uploadOpen"
- width="500px"
- append-to-body
- >
- <el-upload
- class="upload-demo"
- drag
- ref="upload"
- :file-list="fileList"
- :auto-upload="false"
- :http-request="httpRequest"
- :before-remove="beforeRemove"
- :on-remove="invoiceRemove"
- action=""
- multiple
- >
- <i class="el-icon-upload"></i>
- <div class="el-upload__text">
- 将文件拖到此处,或<em>点击选择文件</em>
- </div>
- <div class="el-upload__tip">
- 按住Ctrl可同时多选,单个文件不能超过4mb
- </div>
- <div class="el-upload__tip">
- 严禁上传包含色情、暴力、反动等相关违法信息的文件。
- </div>
- </el-upload>
- <el-button type="primary" @click="submitUpload()"
- >点击上传</el-button
- >
- <el-button type="primary" @click="toCheck()"
- >完成去验真</el-button
- >
- </el-dialog>
- <!-- 发票验真 -->
- <el-dialog
- title="发票验真"
- :visible.sync="open"
- width="1050px"
- append-to-body
- >
- <el-container>
- <el-aside width="300px" style="background-color: white">
- <el-header
- style="background-color: #dfe2e8; text-align: center"
- >
- <el-checkbox
- :indeterminate="isIndeterminate"
- v-model="checkAll"
- @change="handleCheckAllChange"
- >全选</el-checkbox
- >
- <label>已上传发票列表</label>
- </el-header>
- <el-main style="height: 550px; border: groove">
- <el-checkbox-group
- v-model="checkedInvoice"
- @change="handleCheckedInvoiceChange"
- >
- <el-checkbox
- v-for="(item, index) in fileList"
- :label="item"
- :key="index"
- style="width: 100%"
- ><label @click="changeInvoice(item)"
- ><el-link :underline="false">{{
- item.name
- }}</el-link></label
- ><i
- class="el-icon-success"
- style="color: green"
- v-if="item.ziiCheckStt == '1'"
- ></i>
- <i
- class="el-icon-error"
- style="color: red"
- v-if="item.ziiCheckStt == '2' || item.ziiCheckStt == '3'"
- ></i
- ></el-checkbox>
- </el-checkbox-group>
- </el-main>
- <el-button
- type="primary"
- @click="toCheckAgian()"
- style="float: right"
- >重新验真</el-button
- >
- </el-aside>
- <el-container>
- <el-header height="270px">
- <el-image
- style="width: 650px; height: 267px"
- :src="invoice.url"
- fit="scale-down"
- @click="invoicePictureCardPreview(invoice)"
- ></el-image>
- </el-header>
- <el-main>
- <el-form
- ref="invoice"
- label-width="auto"
- :inline="true"
- label-position="top"
- >
- <el-form-item label="发票代码:">
- <el-input
- v-model="invoice.ziiNo"
- maxlength="20"
- />
- </el-form-item>
- <el-form-item label="发票号码:">
- <el-input
- v-model="invoice.ziiNumber"
- maxlength="20"
- />
- </el-form-item>
- <el-form-item label="开票日期:">
- <el-date-picker
- v-model="invoice.ziiDate"
- value-format="yyyy-MM-dd"
- type="date"
- placeholder="选择日期"
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item label="购货纳税人编号:">
- <el-input
- v-model="invoice.ziiPurchaserNo"
- maxlength="20"
- />
- </el-form-item>
- <el-form-item label="销货纳税人编号:">
- <el-input
- v-model="invoice.ziiSellerNo"
- maxlength="20"
- />
- </el-form-item>
- <el-form-item label="发票金额:">
- <el-input
- v-model="invoice.ziiTotalAmount"
- maxlength="16"
- />
- </el-form-item>
- <el-form-item label="税价金额:">
- <el-input
- v-model="invoice.ziiAmount"
- maxlength="16"
- />
- </el-form-item>
- </el-form>
- </el-main>
- <el-footer>
- <el-button
- type="primary"
- @click="submitCheck()"
- style="float: right"
- >确定</el-button
- >
- </el-footer>
- </el-container>
- </el-container>
- </el-dialog>
- </div>
- <!-- 合同附件 -->
- <div v-if="active == 2">
- <el-divider content-position="left">合同附件</el-divider>
- <el-form ref="contract" label-width="auto" :inline="true">
- <el-form-item style="float: right"
- ><el-button type="primary" @click="submitUploadContract()"
- >上传</el-button
- ></el-form-item
- >
- </el-form>
- <el-upload
- :file-list="contractList"
- :auto-upload="false"
- :http-request="httpRequestContract"
- action=""
- ref="contractUpload"
- list-type="picture-card"
- :on-preview="invoicePictureCardPreview"
- :before-remove="beforeRemove"
- :on-remove="handleRemove">
- <i class="el-icon-plus"></i>
- </el-upload>
- </div>
- <!-- 物流附件 -->
- <div v-if="active == 3">
- <el-divider content-position="left">物流附件</el-divider>
- <el-form ref="logistics" label-width="auto" :inline="true">
- <el-form-item style="float: right"
- ><el-button type="primary" @click="submitUploadLogistics()"
- >上传</el-button
- ></el-form-item
- >
- </el-form>
- <el-upload
- :file-list="logisticsList"
- :auto-upload="false"
- :http-request="httpRequestLogistics"
- action=""
- ref="logisticsUpload"
- list-type="picture-card"
- :on-preview="invoicePictureCardPreview"
- :before-remove="beforeRemove"
- :on-remove="handleRemove">
- <i class="el-icon-plus"></i>
- </el-upload>
- </div>
- <!-- 其他附件 -->
- <div v-if="active == 4">
- <el-divider content-position="left">其他附件</el-divider>
- <el-form ref="other" label-width="auto" :inline="true">
- <el-form-item style="float: right"
- ><el-button type="primary" @click="submitUploadOther()"
- >上传</el-button
- ></el-form-item
- >
- </el-form>
- <el-upload
- :file-list="otherList"
- :auto-upload="false"
- :http-request="httpRequestOther"
- action=""
- ref="otherUpload"
- list-type="picture-card"
- :on-preview="invoicePictureCardPreview"
- :before-remove="beforeRemove"
- :on-remove="handleRemove">
- <i class="el-icon-plus"></i>
- </el-upload>
- </div>
- </el-main>
- </el-container>
- </el-container>
-
- <!-- 查看图片 -->
- <el-dialog :visible.sync="invoiceVisible">
- <img width="100%" :src="invoiceImageUrl" alt="" />
- </el-dialog>
- <div style="text-align: center">
- <el-button type="primary" @click="back()" v-if="active != 0"
- >上一步</el-button
- >
- <el-button type="primary" @click="next()" v-if="active != 4"
- v-loading.fullscreen.lock="fullscreenLoading"
- >下一步</el-button
- >
- <el-button type="primary" @click="submit()" v-if="active == 4"
- >提交</el-button
- >
- </div>
- </div>
- </template>
- <script>
- import {
- getBill,
- getInvoice,
- addBill,
- getInvoiceText,
- invoiceVerification,
- delInvoice,
- uploadBillFile,
- getFile,
- delFile,
- commitBill
- } from "@/api/service/bill/bill";
- import {
- getOwnCompany,
- companyRelList
- } from "@/api/common/company";
- import { amtformat } from "@/utils/amtCommon"
- import { getToken } from "@/utils/auth";
- export default {
- name: "BillEdit",
- components: {},
- data() {
- return {
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 是否显示弹出层
- open: false,
- uploadOpen: false,
- // 查询参数
- queryParams: {},
- // 表单参数
- form: {
- },
- // 表单校验
- rules: {
- zbiName: [
- {
- required: true,
- message: "账款名称不能为空",
- trigger: ["blur", "change"],
- },
- ],
- zbiPayerId: [
- {
- required: true,
- message: "应付方不能为空",
- trigger: ["blur", "change"],
- },
- ],
- zbiDate: [
- {
- required: true,
- message: "贸易日期不能为空",
- trigger: ["blur", "change"],
- },
- ],
- zbiPayDate: [
- {
- required: true,
- message: "预计收/付款日期不能为空",
- trigger: ["blur", "change"],
- },
- ],
- zbiPayeeId: [
- {
- required: true,
- message: "应收方不能为空",
- trigger: ["blur", "change"],
- },
- ],
- zbiAmount: [
- {
- required: true,
- message: "贸易金额不能为空",
- trigger: ["blur", "change"],
- },
- {
- pattern: /^(?:0|[1-9]\d{0,13})(?:\.\d{1,2})?$/,
- message: "请输入正确的金额",
- trigger: ["blur", "change"],
- },
- ],
- zbiContractNo: [
- {
- required: true,
- message: "合同编号不能为空",
- trigger: ["blur", "change"],
- },
- ],
- },
- //进度
- active: 0,
- //类型
- type: "00",
- //合同附件
- contractList: [],
- //物流附件
- logisticsList: [],
- //其他附件
- otherList: [],
- //发票列表
- fileList: [],
- //全选状态
- checkAll: false,
- //全选状态
- isIndeterminate: false,
- //选中值
- checkedInvoice: [],
- //发票对象
- invoice: {},
- //合计金额
- totalPrice: 0,
- //验证结果
- checkSttOptions: [],
- //图片路径
- invoiceImageUrl: null,
- //图片显示
- invoiceVisible: false,
- //等待框
- fullscreenLoading: false,
- //链属企业
- companyRelList:[],
- //链属企业
- company:{},
- };
- },
- created() {
- //进度
- this.active = 0;
- const zbiId = this.$route.params && this.$route.params.zbiId;
- this.fullscreenLoading = true
- getOwnCompany().then((response) => {
- console.log(response);
- this.company = response.data;
- });
- this.getCompanyRel()
- this.getDetail(zbiId)
- this.getDicts("zc_invoice_checkStt").then((response) => {
- this.checkSttOptions = response.data;
- });
- },
- activated() {},
- methods: {
- //查询往来账款详情
- getDetail(zbiId){
- getBill(zbiId).then((response) => {
- console.log(response);
- this.form = response.data;
- if(this.form.zbiPayerId == this.company.scyId){
- this.type = "00"
- }else{
- this.type = "01"
- }
- this.fullscreenLoading = false
- });
- },
- //切换账款类型
- changePayer(val){
- console.log(val);
- if(val == '00'){
- this.form.zbiPayerId = this.company.scyId
- this.form.zbiPayeeId = null
- }else if(val == '01'){
- this.form.zbiPayerId = null
- this.form.zbiPayeeId = this.company.scyId
- }
- },
- //查询链属企业
- getCompanyRel(val){
- this.queryParams.companyName = val
- companyRelList(this.queryParams).then((response) => {
- console.log(response);
- this.companyRelList = response.data;
- });
- },
- //全选
- handleCheckAllChange(val) {
- this.checkedInvoice = val ? this.fileList : [];
- this.isIndeterminate = false;
- },
- //全选状态
- handleCheckedInvoiceChange(value) {
- let checkedCount = value.length;
- this.checkAll = checkedCount === this.fileList.length;
- this.isIndeterminate =
- checkedCount > 0 && checkedCount < this.fileList.length;
- },
- // 多选框选中数据
- handleInvoiceSelectionChange(selection) {
- this.ids = selection.map((item) => item.ziiId);
- this.single = selection.length !== 1;
- this.multiple = !selection.length;
- },
- //发票上传窗口
- openUpload() {
- this.uploadOpen = true;
- },
- //上传
- submitUpload() {
- this.$refs.upload.submit();
- },
- //去验真
- toCheck() {
- this.uploadOpen = false;
- this.open = true;
- this.fullscreenLoading = true
- let fd = new FormData(); // FormData 对象
- fd.append("fileList", JSON.stringify(this.fileList)); // 文件对象
- invoiceVerification(fd).then((response) => {
- response.forEach((element) => {
- this.fileList.forEach((file) => {
- if (element.ziiId == file.ziiId) {
- file.ziiCheckStt = element.ziiCheckStt;
- }
- });
- });
- this.invoice = response[0] ? response[0] : {};
- this.fullscreenLoading = false
- }).catch(() => {
- this.fullscreenLoading = false
- });
- },
- //重新验真
- toCheckAgian() {
- this.fullscreenLoading = true
- let fd = new FormData(); // FormData 对象
- fd.append("fileList", JSON.stringify(this.checkedInvoice)); // 文件对象
- invoiceVerification(fd).then((response) => {
- response.forEach((element) => {
- this.fileList.forEach((file) => {
- if (element.ziiId == file.ziiId) {
- file.ziiCheckStt = element.ziiCheckStt;
- }
- });
- });
- this.fullscreenLoading = false
- }).catch(() => {
- this.fullscreenLoading = false
- });
- },
- //切换发票
- changeInvoice(item) {
- this.invoice = item;
- },
- //手动上传发票触发
- httpRequest(param) {
- this.fullscreenLoading = true
- let fileObj = param.file; // 相当于input里取得的files
- console.log(param);
- let fd = new FormData(); // FormData 对象
- fd.append("file", fileObj); // 文件对象
- fd.append("zbiId", this.form.zbiId); //文件类型
- getInvoiceText(fd).then((response) => {
- response.url = response.url + "/" + getToken()
- this.fileList.push(response.data);
- this.fullscreenLoading = false
- }).catch(() => {
- this.fullscreenLoading = false
- });
- },
- //上传合同
- submitUploadContract() {
- this.$refs.contractUpload.submit();
- },
- //上传物流
- submitUploadLogistics() {
- this.$refs.logisticsUpload.submit();
- },
- //上传其他
- submitUploadOther() {
- this.$refs.otherUpload.submit();
- },
- //手动上传合同触发
- httpRequestContract(param) {
- this.fullscreenLoading = true
- let fileObj = param.file; // 相当于input里取得的files
- console.log(param);
- let fd = new FormData(); // FormData 对象
- fd.append("file", fileObj); // 文件对象
- fd.append("zbiId", this.form.zbiId); //文件类型
- fd.append("type", "0"); //文件类型
- uploadBillFile(fd).then((response) => {
- response.url = response.url + "/" + getToken()
- this.contractList.push(response.data);
- this.fullscreenLoading = false
- }).catch(() => {
- this.fullscreenLoading = false
- });
- },
- //手动上传物流触发
- httpRequestLogistics(param) {
- this.fullscreenLoading = true
- let fileObj = param.file; // 相当于input里取得的files
- console.log(param);
- let fd = new FormData(); // FormData 对象
- fd.append("file", fileObj); // 文件对象
- fd.append("zbiId", this.form.zbiId); //文件类型
- fd.append("type", "1"); //文件类型
- uploadBillFile(fd).then((response) => {
- response.url = response.url + "/" + getToken()
- this.logisticsList.push(response.data);
- this.fullscreenLoading = false
- }).catch(() => {
- this.fullscreenLoading = false
- });
- },
- //手动上传其他触发
- httpRequestOther(param) {
- this.fullscreenLoading = true
- let fileObj = param.file; // 相当于input里取得的files
- console.log(param);
- let fd = new FormData(); // FormData 对象
- fd.append("file", fileObj); // 文件对象
- fd.append("zbiId", this.form.zbiId); //文件类型
- fd.append("type", "2"); //文件类型
- uploadBillFile(fd).then((response) => {
- response.url = response.url + "/" + getToken()
- this.otherList.push(response.data);
- this.fullscreenLoading = false
- }).catch(() => {
- this.fullscreenLoading = false
- });
- },
- //删除图片
- beforeRemove(file, fileList) {
- console.log(file)
- let a = true;
- if (file && file.status==="success") {
- a = this.$confirm(`确定移除 ${ file.name }?`);
- }
- return a;
- },
- //删除合同附件
- handleRemove(file, fileList) {
- console.log(fileList);
- if(this.active == 2){
- if (this.contractList) {
- this.contractList = this.contractList.filter((item) =>{
- if(item.uid !== file.uid){
- return item
- }else{
- this.delFile(item)
- }
- });
- }
- // console.log(this.contractList);
- } else if(this.active == 3) {
- if (this.logisticsList) {
- this.logisticsList = this.logisticsList.filter((item) =>{
- if(item.uid !== file.uid){
- return item
- }else{
- this.delFile(item)
- }
- });
- }
- } else if(this.active == 4) {
- if (this.otherList) {
- this.otherList = this.otherList.filter((item) =>{
- if(item.uid !== file.uid){
- return item
- }else{
- this.delFile(item)
- }
- });
- }
- }
- },
- //删除附件
- delFile(row){
- var self = this;
- const ids = row.id || this.ids;
- self.fullscreenLoading = true;
- delFile(ids).then(function() {
- self.fullscreenLoading = false;
- })
- },
- //查看图片
- invoicePictureCardPreview(file) {
- console.log(file)
- this.invoiceImageUrl = file.url;
- this.invoiceVisible = true;
- },
- //删除发票
- invoiceRemove(file, fileList) {
- var self = this;
- if (file && file.status==="success") {
- this.fileList = this.fileList.filter((item) =>{
- if(item.uid !== file.uid){
- return item
- }else{
- self.fullscreenLoading = true;
- delInvoice(item.ziiId).then(function() {
- self.fullscreenLoading = false;
- this.msgSuccess("删除成功");
- }).catch(() => {
- self.fullscreenLoading = false
- });
- }
- });
- }
- console.log(this.fileList);
- },
- //删除发票
- delInvoice(row){
- var self = this
- console.log(this.ids)
- const ziiIds = row.ziiId || this.ids;
- this.$confirm("是否确认删除此数据项?", "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(function() {
- self.fullscreenLoading = true;
- return delInvoice(ziiIds);
- })
- .then(() => {
- this.getInvoiceList();
- this.msgSuccess("删除成功");
- });
- },
- //确认发票
- submitCheck() {
- this.open = false;
- },
- //发票合计
- allAmount() {
- var strarr = [0.00];
- for (let i in this.fileList) {
- strarr.push(this.fileList[i]["ziiAmount"]);
- }
- return Math.floor(eval(strarr.join("+")) * 100) / 100; //结果
- // return this.handleInput(eval(strarr.join("+"))); //结果
- },
- // 取消按钮
- cancel() {},
- // 下一步
- next() {
- this.fullscreenLoading = true
- if (this.active == 0) {
- this.$refs["form"].validate((valid) => {
- if (valid) {
- addBill(this.form)
- .then((response) => {
- this.form.zbiId = response.data.zbiId;
- this.getInvoiceList();
- this.active++;
- })
- .catch((res) => {
- this.fullscreenLoading = false
- return false;
- });
- } else {
- this.fullscreenLoading = false
- return false;
- }
- });
- } else if(this.active == 1) {
- //查询合同
- getFile("0",this.form.zbiId).then((response) => {
- response.data.forEach(element => {
- element.url = element.url + "/" + getToken()
- });
- this.contractList = response.data;
- this.fullscreenLoading = false
- }).catch(() => {
- this.fullscreenLoading = false
- })
- this.active++;
- } else if(this.active == 2) {
- //查询物流
- getFile("1",this.form.zbiId).then((response) => {
- response.data.forEach(element => {
- element.url = element.url + "/" + getToken()
- });
- this.logisticsList = response.data;
- this.fullscreenLoading = false
- }).catch(() => {
- this.fullscreenLoading = false
- })
- this.active++;
- } else if(this.active == 3) {
- //查询其他附件
- getFile("2",this.form.zbiId).then((response) => {
- response.data.forEach(element => {
- element.url = element.url + "/" + getToken()
- });
- this.otherList = response.data;
- this.fullscreenLoading = false
- }).catch(() => {
- this.fullscreenLoading = false
- })
- this.active++;
- } else {
- this.fullscreenLoading = false
- this.active++;
- }
- },
- //查询合同
- getInvoiceList(){
- getInvoice(this.form.zbiId).then((response) => {
- response.data.forEach(element => {
- element.url = element.url + "/" + getToken()
- });
- this.fileList = response.data;
- this.fullscreenLoading = false
- }).catch(() => {
- this.fullscreenLoading = false
- });
- },
- // 上一步
- back() {
- this.active--;
- },
- // 结束
- submit() {
- commitBill(this.form.zbiId).then((response) => {
- this.msgSuccess("保存成功");
- this.$store.dispatch("tagsView/delView", this.$route);
- this.$router.go(-1);
- });
- },
- //校验结果字典
- checkSttFormat(row, column) {
- return this.selectDictLabel(this.checkSttOptions, row.ziiCheckStt);
- },
- /* 金额展示 */
- handleInput(str) {
- return amtformat(str,2, ".", ",");
- },
- /* // 将数字金额转换为大写金额 */
- 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;
- },
- },
- };
- </script>
|