transferCustomer.vue 2.52 KB
Newer Older
1 2 3
<template>
  <el-dialog
    center
4
    :title="$t('客服')"
5 6
    :visible="show"
    @close="close"
7 8 9
    width="30%">
    <div style="width: 100%;min-height: 200px;text-align: center">
      <el-select filterable v-model="service">
邓春圆's avatar
邓春圆 committed
10
        <el-option v-for="(item,index) in customerServiceList" :key="index" :label="item.deptName ? item.nickname + `(${item.deptName})`  : item.nickname  " :value="item.id"></el-option>
11
      </el-select>
邓春圆's avatar
邓春圆 committed
12 13 14 15
      <div style="display: flex;margin-top: 20px;">
        <label style="width:100px;" >申请理由</label>
        <el-input v-model="textarea" type="textarea"></el-input>
      </div>
16 17
    </div>
    <span slot="footer" class="dialog-footer">
18 19
    <el-button @click="$emit('update:show',false)" >{{$t('取 消')}}</el-button>
    <el-button type="primary" @click="submit">{{$t('确 定')}}</el-button>
20 21 22 23 24 25
  </span>
  </el-dialog>
</template>

<script>
import {listServiceUser} from "@/api/system/user";
邓春圆's avatar
邓春圆 committed
26
import {handoverApproval, handOverCustomer} from "@/api/ecw/customer";
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

export default {
  name: "transferCustomer",
  props:{
    show:{
      type:Boolean ,
      default:false
    },
    customerIds:[Array,String],
    tableName:String
  },
  created() {
    listServiceUser().then(r=>{
      this.customerServiceList = r.data;
    })
  },
  computed:{
    getCustomerIds(){
邓春圆's avatar
邓春圆 committed
45
      console.log(this.customerIds,'this.customerIds')
46 47 48 49 50 51 52 53
      if(this.customerIds instanceof Array) return this.customerIds
      else return this.customerIds.split(',')
    }
  },
  data(){
    return {
      customerServiceList:[],
      service:'',
邓春圆's avatar
邓春圆 committed
54
      textarea:''
55 56 57 58 59
    }
  },
  methods:{
    submit(){
      if(!this.service){
60
        return this.$message.warning(this.$t('请选择客户经理!'));
61
      }
邓春圆's avatar
邓春圆 committed
62
      handoverApproval({
63
        customerServiceId:this.service,
邓春圆's avatar
邓春圆 committed
64 65
        customerIdList:this.getCustomerIds,
        reason:this.textarea
66 67
      }).then(r=>{
        if(r.code === 0){
邓春圆's avatar
邓春圆 committed
68
          if(r.data){
邓春圆's avatar
邓春圆 committed
69
            this.$message.success(r.data)
邓春圆's avatar
邓春圆 committed
70 71 72 73
            this.$emit('update:show',false)
            this.$emit('update:customerIds',[])
            this. service = '';
            this.textarea = '';
邓春圆's avatar
邓春圆 committed
74 75 76 77 78 79 80
          }else {
            this.$emit('update:show',false)
            this.$emit('update:customerIds',[])
            this. service = '';
            this.textarea = '';
            this.$message.success(this.$t('用户批量转移成功!'))
          }
81 82 83
        }
      })
    },
84 85 86 87 88 89
    close(){
      this. service = '';
      this.textarea = '';
      this.$emit('update:show',false)

    },
90 91 92 93 94 95 96
  }
}
</script>

<style scoped>

</style>