郑永安
2023-06-19 2befd4a5d3733520b69ed97da88e675b6b086a3c
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
<template>
 
    <el-dialog
        title="身份证更新"
        :visible.sync="dialogVisible"
        width="30%">
        <el-form ref="form"  label-width="80px">
            <el-form-item label="身份证">
                <el-input
                    placeholder="请输入内容"
                    v-model="idCard"
                    style="width: 200px"
                    :disabled="true">
                </el-input>
            </el-form-item>
 
            <el-form-item label="照片">
                <el-upload
                    ref="upload"
                    :action="url"
                    :headers="headers"
                    :on-success="handleSuccess"
                    :limit="1"
                    :auto-upload="false"
                    list-type="picture-card">
                    <i class="el-icon-plus"></i>
                </el-upload>
            </el-form-item>
 
        </el-form>
 
        <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" :disabled="!isReturn" @click="uploadHandler">确 定</el-button>
  </span>
    </el-dialog>
</template>
 
<script>
 
  import { getToken } from '@/utils/auth'
 
  export default {
    name: 'photo',
    data() {
      return {
        dialogVisible: false,
        idCard: '',
        headers: { 'Authorization': getToken() },
        url: '',
        isReturn: true
      }
    },
    created() {
    },
    watch: {},
    methods: {
 
      showDialog(idCard) {
        this.idCard = idCard
        this.url = process.env.BASE_API + '/order/customer/upload/' + idCard
        this.dialogVisible = true
      },
      uploadHandler(){
        this.isReturn = false
        this.$refs.upload.submit()
 
      },
      handleSuccess(response, file, fileList) {
        this.isReturn = true
        if (response.code === '200') {
          this.dialogVisible = false
          this.$notify({
            title: '成功',
            duration: 2000,
            message: '上传成功',
            type: 'success'
          })
          this.$emit('refresh')
        }else{
          this.$message.warning(response.message);
        }
      },
 
 
    }
  }
</script>
 
<style scoped>
.basic_search{
    display:inline-block;
}
 
</style>