<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> 
 |