1
MrShi
2025-01-18 b417a422c08ceabd31fa7feaba42fd8a7b1e86d2
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
<template>
    <GlobalWindow
        :title="title"
        :visible.sync="visible"
        :isDownload="true"
        width="100%"
        @downloadFile="downloadFile"
        @confirm="confirm">
        <el-form :model="form" label-position="top" ref="paramRef">
            <el-form-item label="通知方式">
                <el-checkbox-group v-model="form.type">
                    <el-checkbox label="短信"></el-checkbox>
                    <el-checkbox label="邮件"></el-checkbox>
                </el-checkbox-group>
            </el-form-item>
            <el-form-item label="通知接收人">
                <div style="display: flex; align-items: center; margin-bottom: 10px;" v-for="(item, index) in userList" :key="index">
                    <span style="margin-right: 15px; font-size: 15px; color: #222222;">{{item.customerName}}</span>
                    <el-select v-model="item.userId" placeholder="请选择">
                        <el-option
                            v-for="(item, index) in item.memberList"
                            :key="index"
                            :label="item.name"
                            :value="item.id" />
                    </el-select>
                </div>
            </el-form-item>
        </el-form>
    </GlobalWindow>
</template>
 
<script>
  import GlobalWindow from '@/components/common/GlobalWindow'
  import BaseOpera from '@/components/base/BaseOpera'
  import { getNoticeCustomerData, downloadCallFeeDoc, sendSmsEmail } from '@/api/ywContractBill'
  export default {
    name: "batchCall",
    components: { GlobalWindow },
    extends: BaseOpera,
    data() {
      return {
        ids: null,
        form: {
          type: []
        },
        userList: []
      }
    },
    methods: {
      open (title, ids) {
        this.title = title
        this.ids = ids
        this.form.type = []
        this.userList = []
        this.visible = true
        this.getUser()
      },
      downloadFile() {
        downloadCallFeeDoc(this.ids)
          .then(response => {
            this.download(response)
          })
          .catch(e => {
            this.$tip.apiFailed(e)
          })
      },
      getUser() {
        getNoticeCustomerData(this.ids)
          .then(res => {
            this.userList = res
          })
      },
      confirm() {
        if (this.form.type.length === 0) return this.$message.warning('通知方式不能为空')
          let arr = this.userList.map(item => {
            return {
              billId: item.billId,
              sendEmail: this.form.type.includes('邮件') ? 1 : 0,
              sendSms: this.form.type.includes('短信') ? 1 : 0,
              userId: item.userId
            }
          })
          sendSmsEmail(arr).then(res => {
            this.$message.success('发送成功!')
            this.visible = false
          })
      }
    }
  }
</script>