k94314517
2025-05-29 e1c072109e62f4adcb53af0d2c69b896b9159059
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<template>
    <GlobalWindow
        :title="title"
        width="500px"
        :visible.sync="visible"
        :confirm-working="isWorking"
        @confirm="confirm"
    >
        <div class="dakuan">
            <el-form :model="form" :rules="rules" ref="form" label-width="100px" class="demo-ruleForm">
                <el-form-item label="打款说明" prop="describe">
                    <el-input v-model="form.describe" placeholder="请输入"></el-input>
                </el-form-item>
                <el-form-item label="打款凭证" prop="multifileList">
                    <div style="width: 100%; display: flex; align-items: center;">
                        <el-upload
                            :action="uploadImgUrl"
                            list-type="picture-card"
                            accept=".png,.jpg"
                            :file-list="form.multifileList"
                            :data="uploadData"
                            :on-success="handleAvatarSuccess"
                            :on-error="uploadError"
                            :before-remove="removeRow">
                            <i class="el-icon-plus"></i>
                        </el-upload>
<!--                        <upload width="100px" height="100px" :list="[]" accept=".png,.jpg,.jpeg" folder="settle" @success="claimsUploadFile" />-->
                    </div>
                </el-form-item>
            </el-form>
        </div>
    </GlobalWindow>
</template>
 
<script>
    import BaseOpera from '@/components/base/BaseOpera'
    import GlobalWindow from '@/components/common/GlobalWindow'
    import { payCash } from '@/api/business/settleRisk'
    export default {
        name: 'makePayment',
        extends: BaseOpera,
        components: { GlobalWindow },
        data () {
            return {
                uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/upload',
                uploadData: {
                    folder: 'settle'
                },
                // 表单数据
                form: {
                    id: null,
                    describe: '',
                    multifileList: []
                },
                // 验证规则
                rules: {
                    describe: [
                        { required: true, message: '不能为空', trigger: 'blur' }
                    ]
                }
            }
        },
        methods: {
            open(title, id) {
                this.title = title
                this.form.id = id
                this.form.describe = ''
                this.form.multifileList = []
                this.visible = true
            },
            // 上传图片
            handleAvatarSuccess(res) {
                this.form.multifileList.push({...res.data, fileurl: res.data.imgaddr, name:res.data.originname})
            },
            uploadError() {
                this.$tip.apiFailed('上传失败')
            },
            removeRow(e) {
                this.form.multifileList.forEach((item, index) => {
                    if (item.imgaddr === e.imgaddr) {
                        this.form.multifileList.splice(index, 1)
                    }
                })
            },
            confirm() {
                this.$refs.form.validate((valid) => {
                    if (valid) {
                        this.isWorking = true
                        payCash(this.form)
                            .then(() => {
                                this.visible = false
                                this.$tip.apiSuccess('操作成功')
                                this.$emit('success')
                            })
                            .catch(e => {
                                this.$tip.apiFailed(e)
                            })
                            .finally(() => {
                                this.isWorking = false
                            })
                    }
                });
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .dakuan {
        width: 100%;
 
    }
</style>