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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
  | <template> 
 |      <GlobalWindow 
 |          :title="title" 
 |          width="50%" 
 |          :visible.sync="visible" 
 |          :confirm-working="isWorking" 
 |          @confirm="confirm" 
 |      > 
 |        <el-form :model="form" ref="form" :rules="rules" style="width: 50%;"> 
 |          <el-form-item label="发票号" prop="doneCode"> 
 |            <el-input v-model="form.doneCode" placeholder="请输入" v-trim/> 
 |          </el-form-item> 
 |          <el-form-item label="电子发票" prop="imgurl"> 
 |            <UploadAvatarImage :uploadData="{ folder: 'taxes' }" :file="form.file" @uploadSuccess="result3" /> 
 |          </el-form-item> 
 |        </el-form> 
 |        <template v-slot:footer> 
 |          <el-button type="primary" @click="doSubmit">确 定</el-button> 
 |          <el-button @click="visible=false">取消</el-button> 
 |        </template> 
 |      </GlobalWindow> 
 |  </template> 
 |    
 |  <script> 
 |  import BaseOpera from '@/components/base/BaseOpera' 
 |  import GlobalWindow from '@/components/common/GlobalWindow' 
 |  import { doneApply } from '@/api/business/taxes' 
 |  import UploadAvatarImage from '@/components/common/UploadAvatarImage' 
 |  export default { 
 |    name: 'OperaTaxesUploadWindow', 
 |    extends: BaseOpera, 
 |    components: { GlobalWindow, UploadAvatarImage }, 
 |    data () { 
 |      return { 
 |        // 表单数据 
 |        // 搜索 
 |        form: { 
 |          id: null, 
 |          doneCode: null, 
 |          imgurl: null, 
 |          file: { } 
 |        }, 
 |        // 验证规则 
 |        rules: { 
 |          doneCode: [ 
 |            { required: true, message: '请输入发票号' } 
 |          ], 
 |          imgurl: [ 
 |            { required: true, message: '请上传发票电子版' } 
 |          ] 
 |        } 
 |      } 
 |    }, 
 |    created () { 
 |      this.config({ 
 |        api: '/business/taxes', 
 |        'field.id': 'id' 
 |      }) 
 |    }, 
 |    methods: { 
 |      open (title, target) { 
 |        this.title = title 
 |        this.visible = true 
 |        this.form = { 
 |          id: null, 
 |          doneCode: null, 
 |          imgurl: null, 
 |          file: { } 
 |        }, 
 |        this.form.id = target.id 
 |        this.form.doneCode = target.doneCode 
 |        this.form.file = { imgurl: target.imgurl, imgurlfull: target.imgurlFull } 
 |      }, 
 |      result3 (data) { 
 |        this.form.imgurl = null 
 |        this.form.imgurl = data.imgurl 
 |      }, 
 |      doSubmit () { 
 |        this.$refs.form.validate((valid) => { 
 |          // debugger 
 |          if (!valid) { 
 |            return 
 |          } 
 |          doneApply(this.form) 
 |            .then(response => { 
 |              this.visible = false 
 |              this.$emit('success') 
 |            }).catch(err => { 
 |              console.log(err) 
 |              this.$tip.apiFailed(err) 
 |            }).finally(() => { 
 |              this.isWorking = false 
 |            }) 
 |        }) 
 |      } 
 |    } 
 |  } 
 |  </script> 
 |    
 |  <style lang="scss" scoped> 
 |      .info { 
 |          width: 100%; 
 |          .info_label { 
 |              width: 100%; 
 |              display: flex; 
 |              align-items: center; 
 |              justify-content: space-between; 
 |              margin-bottom: 20px; 
 |              span { 
 |                  font-size: 18px; 
 |                  font-weight: 500; 
 |                  color: #000000; 
 |              } 
 |          } 
 |          .info_list { 
 |              width: 100%; 
 |              display: flex; 
 |              align-items: center; 
 |              flex-wrap: wrap; 
 |              .info_list_item { 
 |                  width: 50%; 
 |                  display: flex; 
 |                  align-items: start; 
 |                  margin-bottom: 20px; 
 |                  .info_list_item_label { 
 |                      width: 150px; 
 |                      flex-shrink: 0; 
 |                  } 
 |                  .info_list_item_val { 
 |                      flex: 1; 
 |                      display: flex; 
 |                      align-items: center; 
 |                      .image { 
 |                          width: 100px; 
 |                          height: 100px; 
 |                          display: flex; 
 |                          align-items: center; 
 |                          justify-content: center; 
 |                          overflow: hidden; 
 |                          img { 
 |                              width: 100%; 
 |                          } 
 |                      } 
 |                  } 
 |              } 
 |          } 
 |      } 
 |  </style> 
 |  
  |