<template>
    <div>
        <div class="content-head">
            <dataBreadcrumb :breads="breads"></dataBreadcrumb>
            <h3>上传凭证</h3>
            <h5>上传应收账款等凭证</h5>
        </div>
        <div class="content">
            <div class="flex">
                <div>上传图片：</div>
                <!-- <singleUpload :limit="1" :max="10" tips="最多上传一份，大小不超过10M." @input="getfile"></singleUpload> -->
                <Upload  :limit="6" :max="10" :fileList="fileList" tip="支持上传6张图片，单张图片大小不超过10M。" @input="getfile"></Upload>
            </div>
            <div class="backButton">
                <el-button @click="back">返回</el-button>
                <el-button @click="sure">确认</el-button>
            </div>
        </div>
    </div>
</template>

<script>
import { evidenceOperation } from '@api/supply/organization';
import dataBreadcrumb from '@components/dataBreadcrumb.vue';
import Upload from '@components/Upload/imgUpload.vue';
export default {
    components: {
        dataBreadcrumb,
        Upload
    },
    data() {
        return {
            imgList: [
                'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
                'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
            ],
            breads: ['应收账款买断管理', '应收账款买断列表'],
            fileList: [],
            voucherList: []
        };
    },
    methods: {
        back() {
            this.$router.go(-1);
        },
        getfile(val) {
          console.log(val)
            this.voucherList = val;
        },
        async sure() {
            try {
              let message={}
              message.projectId=localStorage.getItem("projectId")
              message.companyId=localStorage.getItem("companyId")
              message.voucherList=this.voucherList
                const { code, msg } = await evidenceOperation(message);
                if (code == 200) {
                    this.$message({
                        message: msg,
                        type: 'success',
                        duration: 1500
                    });
                    setTimeout(() => {
                        this.$router.go(-1);
                    }, 1500);
                } else {
                    this.$message.error(msg);
                }
            } catch (e) {}
        },
    }
};
</script>

<style scoped>
.img-list {
    flex-wrap: wrap;
}
.img-list > div {
    margin-right: 20px;
}
ul > li > div {
    margin-right: 10px;
}
.backButton {
    width: 200px;
    margin: 200px auto 30px;
}
</style>

