MrShi
2024-11-29 642ae007fd098f5596d44d79148318ac7914e568
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<template>
    <GlobalWindow width="100%" :title="title" :visible.sync="visible" :confirm-working="isWorking" @close="close"
      @confirm="confirm">
        <div class="main">
            <div class="main_content">
                <el-form :model="form" label-position="top" ref="form" :rules="rules">
                    <div class="head">
                        <div class="m_title">流水信息</div>
                    </div>
                    <div class="list">
                        <el-form-item label="关联合同" required>
                            <el-input v-model="form.contractCode" disabled placeholder="请输入" v-trim />
                        </el-form-item>
                        <el-form-item label="费用类型" required>
                            <el-input v-model="form.costTypeName" disabled placeholder="请输入" v-trim />
                        </el-form-item>
                        <el-form-item label="计费周期" required>
                            <el-input v-model="form.date" disabled placeholder="请输入" v-trim />
                        </el-form-item>
                        <el-form-item label="应收金额" prop="receivableFee">
                            <el-input v-model="form.receivableFee" placeholder="请输入" v-trim />
                        </el-form-item>
                        <el-form-item label="实收金额" prop="actReceivableFee">
                            <el-input v-model="form.actReceivableFee" placeholder="请输入" v-trim />
                        </el-form-item>
                        <el-form-item label="入账日期" prop="actPayDate">
                            <el-date-picker type="date" v-model="form.actPayDate" value-format="yyyy-MM-dd" placeholder="请选择" />
                        </el-form-item>
                        <el-form-item label="收款方式" prop="payType">
                            <el-select v-model="form.payType" placeholder="请选择">
                                <el-option label="现金" :value="1"></el-option>
                                <el-option label="网银转账" :value="2"></el-option>
                                <el-option label="POS机" :value="3"></el-option>
                                <el-option label="支付宝" :value="4"></el-option>
                                <el-option label="微信" :value="5"></el-option>
                                <el-option label="转账支票" :value="6"></el-option>
                                <el-option label="其它方式" :value="7"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="所属公司" prop="companyName">
                            <el-input disabled v-model="form.companyName" placeholder="请输入" />
                        </el-form-item>
                        <el-form-item label="收支账户" prop="accountId">
                            <el-select v-model="form.accountId" placeholder="请选择" clearable>
                                <el-option v-for="item in agentList" :value="item.id" :label="item.title"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="备注" prop="remark" style="width: 100%;">
                            <el-input type="textarea" :rows="6" v-model="form.remark" placeholder="请输入" />
                        </el-form-item>
                    </div>
                </el-form>
            </div>
        </div>
        <div class="file_wrap">
            <div class="head">
                <div>账单附件</div>
                <el-upload class="upload-demo" :show-file-list="false" :data="uploadData" :action="uploadImgUrl"
                   :on-success="uploadAvatarSuccess" :before-upload="beforeUpload" :on-error="uploadError">
                    <el-button icon="el-icon-plus" plain>添加附件</el-button>
                </el-upload>
            </div>
            <el-table :data="form.multifileList" stripe>
                <el-table-column prop="name" label="附件名称" align="center" min-width="100" show-overflow-tooltip />
                <el-table-column prop="userName" label="操作人" align="center" min-width="100" show-overflow-tooltip />
                <el-table-column prop="createTime" label="操作时间" align="center" min-width="100" show-overflow-tooltip />
                <el-table-column label="操作" align="center" min-width="100">
                    <template slot-scope="{ row }">
                        <span class="cu red" @click="dele(row.imgaddr)">删除</span>
                    </template>
                </el-table-column>
            </el-table>
        </div>
    </GlobalWindow>
</template>
 
<script>
  import GlobalWindow from '@/components/common/GlobalWindow'
  import BaseOpera from '@/components/base/BaseOpera'
  import { ywAccountList } from '@/api/bill'
  import { create } from '@/api/ywContractRevenue'
  import { Message, Loading } from 'element-ui'
  import { mapState } from 'vuex'
  export default {
    name: "flowingWater",
    components: {
      GlobalWindow
    },
    computed: {
      ...mapState(['userInfo'])
    },
    extends: BaseOpera,
    data() {
      return {
        form: {
          billId: '',
          billType: '',
          costType: '',
          contractCode: '',
          contractId: '',
          startDate: '',
          endDate: '',
          date: '',
          companyId: '',
          actReceivableFee: '',
          actPayDate: '',
          payType: '',
          companyName: '',
          remark: '',
          accountId: '',
          multifileList: [],
          costTypeName: ''
        },
        rules: {
          receivableFee: [
            { required: true, message: '请输入', trigger: 'blur' }
          ],
          actPayDate: [
            { required: true, message: '请选择', trigger: 'blur' }
          ],
          payType: [
            { required: true, message: '请选择', trigger: 'blur' }
          ],
          accountId: [
            { required: true, message: '请选择', trigger: 'blur' }
          ]
        },
        loadingInstance: null,
        uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/visitsAdmin/cloudService/public/uploadBatch',
        uploadData: {
          folder: 'YW_CONTRACT_BILL'
        },
        agentList: []
      }
    },
    methods: {
      confirm () {
        this.$refs.form.validate((valid) => {
          if (!valid) return
          this.isWorking = true
          create(this.form)
            .then(() => {
              this.visible = false
              this.$tip.apiSuccess('创建成功')
              this.$emit('success')
            })
            .finally(() => {
              this.isWorking = false
            })
        })
      },
      handleRent() {
        this.$refs.MemberSearchRef.openModal()
      },
      houseChange(e) {
        console.log(e)
        console.log(this.value)
      },
      getDates (companyId) {
        ywAccountList({
          companyId,
          isdeleted: 0,
          status: 0
        }).then(res => {
          this.agentList = res
        })
      },
      dele (imgaddr) {
        this.form.multifileList.forEach((item, index) => {
          if (imgaddr === item.imgaddr) {
            this.form.multifileList.splice(index, 1)
          }
        })
      },
      beforeUpload(file) {
        this.loadingInstance = Loading.service({
          lock: true,
          text: 'Loading',
          spinner: 'el-icon-loading',
          background: 'rgba(0, 0, 0, 0.7)'
        })
      },
      uploadError() {
        this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
          if (this.loadingInstance) {
            this.loadingInstance.close()
          }
        })
      },
      getDay () {
        const now = new Date()
        const year = now.getFullYear()
        const month = now.getMonth() + 1 // 加1使其从1开始
        const day = now.getDate()
        const hours = now.getHours()
        const minutes = now.getMinutes()
        const seconds = now.getSeconds()
        return `${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')} ${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
      },
      uploadAvatarSuccess(file) {
        this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
          if (this.loadingInstance) {
            this.loadingInstance.close()
          }
        })
        const item = file.data[0]
        console.log(item)
        this.form.multifileList.push({ ...item, fileurl: item.imgaddr, name: item.originname, userName: this.userInfo.realname, createTime: this.getDay() })
      },
      close() {
        this.$emit('close')
      },
      open(title, target) {
        this.title = title
        this.visible = true
        this.$nextTick(() => {
          for (const key in this.form) {
            this.form[key] = target[key]
          }
        })
        console.log(this.form)
        this.getDates(target.companyId)
      }
    }
  }
</script>
 
<style lang="scss" scoped>
    @import '@/assets/style/variables.scss';
 
 
    .cost_tabs {
        justify-content: flex-start;
        border: none;
 
        .tab {
            height: 36px;
            line-height: 36px;
            font-size: 14px;
        }
    }
 
    .main {
        display: flex;
        margin-bottom: 20px;
 
        .main_content {
            flex: 1;
            margin-right: 20px;
 
            .head {
                display: flex;
                align-items: center;
                justify-content: space-between;
 
                .tabs {
                    display: flex;
                    margin-bottom: 20px;
                    display: flex;
                    justify-content: center;
 
                    .tab {
                        height: 14px;
                        line-height: 14px;
                        cursor: pointer;
                        border: 1px solid #ebebeb;
                        padding: 12px 24px;
                    }
 
                    .active {
                        font-weight: 500;
                        color: $primary-color;
                        border: 1px solid $primary-color;
                    }
                }
            }
 
            .list {
                display: flex;
                flex-wrap: wrap;
 
                .el-form-item {
                    width: 33.33%;
                    box-sizing: border-box;
                    padding: 0 12px;
                }
            }
        }
 
        .main_house {
            width: 320px;
            padding: 24px 12px;
            border: 1px solid #c3c6cd;
            border-radius: 2px;
 
            .title {
                font-size: 16px;
                font-weight: 500;
                margin-bottom: 30px;
            }
        }
 
    }
 
    .total {
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 32px;
        background-color: #e7e9f5;
 
        span {
            width: 160px;
            text-align: center;
        }
    }
 
    .file_wrap {
        
        .head {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
    }
 
    .m_title {
        font-weight: 500;
        font-size: 14px;
        margin-bottom: 15px;
        margin-top: 10px;
    }
</style>