fuliqi
2024-01-24 29c1e7eb5ac16e90d8991a86c1c071bc312ec8d9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<template>
    <div>
        <invoice-info ref="invoiceInfo">
            <template slot="aduitInfo" slot-scope="form">
              <div v-if="form.data.pushStatus === '0'">
                <p class="formTitle">审核信息</p>
                  <el-form-item prop="auditRemarke" label="备注:">
                      <el-input type="textarea" v-model="form.data.auditRemarke" placeholder="请输入备注"></el-input>
                  </el-form-item>
                  <el-form-item label="图片:">
                    <custom-upload-img
                        :limitNumber="6"
                        @handle-success="handleSuccess"
                        @handle-remove="handleRemove"
                        :fileList="fileList"
                      ></custom-upload-img>
                  </el-form-item>
               </div>
                <el-row class="buttonPosition">
                  <el-button type="primary" size="mini" @click="submit">提交</el-button>
                  <el-button  size="mini" @click="cancel">返回</el-button>
                </el-row>
            </template>
        </invoice-info>
    </div>
</template>
 
<script>
import invoiceInfo from '@/views/invoice/components/invoiceInfo.vue'
import invoiceApi from '@/api/invoice/invoiceapi.js'
import uploadFileApi from '@/api/uploadFile'
 
export default {
  components: { invoiceInfo },
  data () {
    return {
      fileList: [],
      auditFileId: null
    }
  },
  methods: {
    // 返回
    cancel () {
      this.$router.push({ name: 'invoiceList' })
    },
    // 提交
    submit () {
      this.$refs.invoiceInfo.$refs.form.validate(async (valid) => {
        if (valid) {
          const param = {
            auditFileId: this.auditFileId,
            auditRemarke: this.$refs.invoiceInfo.form.auditRemarke,
            orderId: this.$refs.invoiceInfo.form.orderId,
            auditStatus: '1'
          }
          const res = await invoiceApi.auditInfo(param)
          if (res.code === '0') {
            this.$message({
              message: '审核成功',
              type: 'success'
            })
            this.$router.push({ name: 'invoiceList' })
          }
        } else {
          console.log('error submit!!')
          return false
        }
      })
    },
    /**
     * 获取上传成功的图片
     */
    handleSuccess (data) {
      this.auditFileId = data.businessId
      this.fileList.push({
        url: data.url,
        id: data.id
      })
    },
    /**
     * 移除图片
     */
    handleRemove (file) {
      uploadFileApi.removeFile({ key: file.id }).then(res => {
        this.fileList = this.fileList.filter(v => {
          return v.id !== file.id
        })
        if (!this.fileList.length) {
          this.auditFileId = null
        }
      })
    }
  }
}
</script>
 
<style>
 
</style>