index.vue 5.93 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<template>
  <div>
    <el-dialog
      append-to-body
      title="客户跟进"
      :visible.sync="customerFollow.dialogVisible"
      :close-on-click-modal="false"
      width="680px">
      <el-form ref="customerFollowForm" :model="customerFollow.form" label-width="80px">
        <el-row :gutter="10">
          <el-col>
            <el-form-item label="跟进类型" required>
              <dict-selector form-type="radio" v-model="customerFollow.form.followType" :type="DICT_TYPE.CUSTOMER_FOLLOW_TYPE"></dict-selector>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="跟进时间" required>
我在何方's avatar
我在何方 committed
18
              <el-date-picker v-model="customerFollow.form.followTime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择跟进时间"></el-date-picker>
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
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="联系人" required>
              <el-select v-model="customerFollow.form.contactName" placeholder="请选择">
                <el-option
                  v-for="(item, index) in customerContactsList"
                  :key="index"
                  :label="item.name"
                  :value="item.name">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="跟进业务" required>
              <el-select v-model="customerFollow.form.followUserId" placeholder="请选择">
                <el-option
                  v-for="item in serviceUserList"
                  :key="item.id"
                  :label="item.nickname"
                  :value="item.id">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="跟进方式" required>
              <dict-selector v-model="customerFollow.form.followMethod" :type="DICT_TYPE.CUSTOMER_FOLLOW_METHOD"></dict-selector>
            </el-form-item>
          </el-col>
          <el-col>
            <el-form-item label="客户反馈" required>
              <el-input type="textarea" v-model="customerFollow.form.feedback"></el-input>
            </el-form-item>
          </el-col>
          <el-col>
            <el-form-item label="处理结果" required>
              <el-input type="textarea" v-model="customerFollow.form.result"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="customerFollow.dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="customerFollowSubmit">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import {createCustomerFollow, getCustomerFollowPage} from "@/api/ecw/customerFollow"
import { DICT_TYPE, getDictDataLabel } from '@/utils/dict'
import { getCustomerContactsListByCustomer } from '@/api/ecw/customerContacts'
import {listServiceUser} from "@/api/system/user"
import { parseTime } from '@/utils/ruoyi'
export default {
  /**
   * 客户跟进
   * 客户投诉跟进
   */
  name: "CustomerFollow",
  props: {
    /**
     * 如果是客户投诉跟进,则id为客户投诉id;如果是客户跟进,则id为客户id
     */
    id: Number,
    customerId: Number,
  },
  data() {
    return {
      DICT_TYPE,
      getDictDataLabel,
      parseTime,
      customerFollowList: [],
      serviceUserList: [],
      customerContactsList: [],

      customerFollow: {
        dialogVisible: false,
        form: {}
      },
    }
  },

  created() {
我在何方's avatar
我在何方 committed
106
    this.resetCustomerFollowForm()
107 108
    if (!!this.customerId) getCustomerContactsListByCustomer({customerId: this.customerId}).then(r => {
      this.customerContactsList = r.data
我在何方's avatar
我在何方 committed
109 110
      this.$set(this.customerFollow.form, 'customerId', this.customerId)
      // this.customerFollow.form.customerId = this.customerId
111 112 113 114 115 116 117 118 119 120 121
    })
    listServiceUser().then(r => {
      this.serviceUserList = r.data
    })
  },
  methods: {
    customerFollowSubmit() {
      this.$refs["customerFollowForm"].validate(valid => {
        if (!valid) {
          return
        }
我在何方's avatar
我在何方 committed
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
       if(!this.customerFollow.form.followType){
          this.$modal.msgError("请选择跟进类型");
          return
        }
        if(!this.customerFollow.form.followTime){
          this.$modal.msgError("请选择跟进时间");
          return
        }
        if(!this.customerFollow.form.contactName){
          this.$modal.msgError("请选择联系人");
          return
        }
        if(!this.customerFollow.form.followUserId){
          this.$modal.msgError("请选择跟进业务");
          return
        }
        if(!this.customerFollow.form.followMethod){
          this.$modal.msgError("请选择跟进方式");
          return
        }
        if(!this.customerFollow.form.feedback){
          this.$modal.msgError("请输入客户反馈");
          return
        }
        if(!this.customerFollow.form.result){
          this.$modal.msgError("请输入处理结果");
          return
        }
150 151 152 153 154 155 156 157 158
        createCustomerFollow(this.customerFollow.form).then(r => {
          this.resetCustomerFollowForm()
          this.customerFollow.dialogVisible = false
        })
      })
    },

    resetCustomerFollowForm() {
      this.customerFollow.form = {
我在何方's avatar
我在何方 committed
159 160
        "bizId":this.id,
        "customerId":this.customerId,
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
        "contactName": undefined,
        "feedback": undefined,
        "followMethod": undefined,
        "followTime": undefined,
        "followType": undefined,
        "followUserId": undefined,
        "result": undefined
      }
    },

  },
  watch:{
    customerId(val){
      this.customerFollow.form.bizId = val;
      if (!!this.customerId) getCustomerContactsListByCustomer({customerId: this.customerId}).then(r => {
        this.customerContactsList = r.data
      })
    }
  }
}
</script>

<style scoped>

</style>