index.vue 8.57 KB
Newer Older
Marcus's avatar
Marcus committed
1 2
<template>
  <div>
Marcus's avatar
Marcus committed
3
    <div style="display: flex;justify-content: right;margin-bottom: 15px">
邓春圆's avatar
邓春圆 committed
4
      <el-button type="primary" style="text-align: right" @click="customerFollow.dialogVisible = true">{{$t('新增')}}</el-button>
Marcus's avatar
Marcus committed
5 6
    </div>

Marcus's avatar
Marcus committed
7 8 9 10 11
    <el-table
      :data="customerFollowList"
      style="width: 100%"
    >
      <el-table-column
黄卓's avatar
黄卓 committed
12
        type="index"
邓春圆's avatar
邓春圆 committed
13
        :label="$t('序号')"
Marcus's avatar
Marcus committed
14 15 16 17
      >
      </el-table-column>
      <el-table-column
        prop="followType"
邓春圆's avatar
邓春圆 committed
18
        :label="$t('跟进类型')"
黄卓's avatar
黄卓 committed
19
        :formatter="(row, column, cellValue) => getDictDataLabel(DICT_TYPE.CUSTOMER_FOLLOW_TYPE, cellValue)"
Marcus's avatar
Marcus committed
20 21 22 23
      >
      </el-table-column>
      <el-table-column
        prop="contactName"
邓春圆's avatar
邓春圆 committed
24
        :label="$t('联系人')"
Marcus's avatar
Marcus committed
25 26 27 28
      >
      </el-table-column>
      <el-table-column
        prop="followMethod"
邓春圆's avatar
邓春圆 committed
29
        :label="$t('跟进方式')"
黄卓's avatar
黄卓 committed
30
        :formatter="(row, column, cellValue) => getDictDataLabel(DICT_TYPE.CUSTOMER_FOLLOW_METHOD, cellValue)"
Marcus's avatar
Marcus committed
31 32 33 34
      >
      </el-table-column>
      <el-table-column
        prop="followTime"
邓春圆's avatar
邓春圆 committed
35
        :label="$t('跟进时间')"
黄卓's avatar
黄卓 committed
36
        :formatter="(row, column, cellValue) => parseTime(cellValue)"
Marcus's avatar
Marcus committed
37 38 39 40
      >
      </el-table-column>
      <el-table-column
        prop="feedback"
邓春圆's avatar
邓春圆 committed
41
        :label="$t('客户反馈')"
Marcus's avatar
Marcus committed
42 43 44 45
      >
      </el-table-column>
      <el-table-column
        prop="result"
邓春圆's avatar
邓春圆 committed
46
        :label="$t('处理结果')"
Marcus's avatar
Marcus committed
47 48 49
      >
      </el-table-column>
      <el-table-column
50
        prop="followUserName"
邓春圆's avatar
邓春圆 committed
51
        :label="$t('客户经理')"
Marcus's avatar
Marcus committed
52 53 54
      >
      </el-table-column>
    </el-table>
dcy's avatar
dcy committed
55 56
    <pagination  :total="total" :page.sync="pageNo" :limit.sync="pageSize"
                @pagination="getCustomerFollowList"/>
Marcus's avatar
Marcus committed
57
    <el-dialog
Marcus's avatar
Marcus committed
58
      append-to-body
邓春圆's avatar
邓春圆 committed
59
      :title="$t('客户跟进')"
Marcus's avatar
Marcus committed
60 61
      :visible.sync="customerFollow.dialogVisible"
      :close-on-click-modal="false"
我在何方's avatar
我在何方 committed
62
      :before-close="customerFollowClose"
Marcus's avatar
Marcus committed
63 64 65 66
      width="680px">
      <el-form ref="customerFollowForm" :model="customerFollow.form" label-width="80px">
        <el-row :gutter="10">
          <el-col>
邓春圆's avatar
邓春圆 committed
67
            <el-form-item :label="$t('跟进类型')" required>
我在何方's avatar
我在何方 committed
68
              <!-- <dict-selector ref="dictType" form-type="radio" v-model="customerFollow.form.followType" :type="DICT_TYPE.CUSTOMER_FOLLOW_TYPE"></dict-selector> -->
我在何方's avatar
我在何方 committed
69
              <el-radio v-model="customerFollow.form.followType" label="3">{{$t('投诉回访')}}</el-radio>
Marcus's avatar
Marcus committed
70 71 72
            </el-form-item>
          </el-col>
          <el-col :span="12">
邓春圆's avatar
邓春圆 committed
73 74
            <el-form-item :label="$t('跟进时间')" required>
              <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="$t('选择跟进时间')"></el-date-picker>
Marcus's avatar
Marcus committed
75 76 77
            </el-form-item>
          </el-col>
          <el-col :span="12">
邓春圆's avatar
邓春圆 committed
78 79
            <el-form-item :label="$t('联系人')" required>
              <el-select v-model="customerFollow.form.contactName" :placeholder="$t('请选择')">
Marcus's avatar
Marcus committed
80 81 82 83 84 85 86 87 88 89
                <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">
邓春圆's avatar
邓春圆 committed
90 91
            <el-form-item :label="$t('客户经理')" required>
              <el-select v-model="customerFollow.form.followUserId" :placeholder="$t('请选择')">
Marcus's avatar
Marcus committed
92 93 94 95 96 97 98 99 100 101
                <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">
邓春圆's avatar
邓春圆 committed
102
            <el-form-item :label="$t('跟进方式')" required>
我在何方's avatar
我在何方 committed
103
              <dict-selector ref="dictMethod" v-model="customerFollow.form.followMethod" :type="DICT_TYPE.CUSTOMER_FOLLOW_METHOD"></dict-selector>
Marcus's avatar
Marcus committed
104 105 106
            </el-form-item>
          </el-col>
          <el-col>
邓春圆's avatar
邓春圆 committed
107
            <el-form-item :label="$t('客户反馈')" required>
Marcus's avatar
Marcus committed
108 109 110 111
              <el-input type="textarea" v-model="customerFollow.form.feedback"></el-input>
            </el-form-item>
          </el-col>
          <el-col>
邓春圆's avatar
邓春圆 committed
112
            <el-form-item :label="$t('处理结果')" required>
Marcus's avatar
Marcus committed
113 114 115 116 117 118
              <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">
邓春圆's avatar
邓春圆 committed
119 120
        <el-button @click="customerFollowClose">{{$t('取 消')}}</el-button>
        <el-button type="primary" @click="customerFollowSubmit">{{$t('确 定')}}</el-button>
Marcus's avatar
Marcus committed
121 122 123 124 125 126
      </span>
    </el-dialog>
  </div>
</template>

<script>
dcy's avatar
dcy committed
127
import {createCustomerFollow, getCustomerFollowPage, getCustomerFollowPage2} from "@/api/ecw/customerFollow"
Marcus's avatar
Marcus committed
128
import { DICT_TYPE, getDictDataLabel } from '@/utils/dict'
黄卓's avatar
黄卓 committed
129
import { getCustomerContactsListByCustomer } from '@/api/ecw/customerContacts'
Marcus's avatar
Marcus committed
130
import {listServiceUser} from "@/api/system/user"
黄卓's avatar
黄卓 committed
131
import { parseTime } from '@/utils/ruoyi'
Marcus's avatar
Marcus committed
132 133 134 135 136 137 138
export default {
  /**
   * 客户跟进
   * 客户投诉跟进
   */
  name: "CustomerFollow",
  props: {
139 140 141
    /**
     * 如果是客户投诉跟进,则id为客户投诉id;如果是客户跟进,则id为客户id
     */
142 143
    id: Number,
    customerId: Number,
Marcus's avatar
Marcus committed
144 145 146 147
  },
  data() {
    return {
      DICT_TYPE,
黄卓's avatar
黄卓 committed
148
      getDictDataLabel,
黄卓's avatar
黄卓 committed
149
      parseTime,
Marcus's avatar
Marcus committed
150 151 152 153 154 155
      customerFollowList: [],
      serviceUserList: [],
      customerContactsList: [],

      customerFollow: {
        dialogVisible: false,
156
        form: {
我在何方's avatar
我在何方 committed
157
          followType:'3'
158
        }
Marcus's avatar
Marcus committed
159
      },
dcy's avatar
dcy committed
160 161 162
      pageNo:1,
      pageSize:10,
      total:10,
Marcus's avatar
Marcus committed
163 164 165 166
    }
  },

  created() {
我在何方's avatar
我在何方 committed
167
    // this.resetCustomerFollowForm()
黄卓's avatar
黄卓 committed
168 169
    if (!!this.customerId) getCustomerContactsListByCustomer({customerId: this.customerId}).then(r => {
      this.customerContactsList = r.data
我在何方's avatar
我在何方 committed
170
      this.customerFollow.form.customerId = this.customerId
dcy's avatar
dcy committed
171
      this.customerFollow.form.bizId = this.id
Marcus's avatar
Marcus committed
172 173
    })
    listServiceUser().then(r => {
174
      console.log( r.data,'r.data跟进业务')
Marcus's avatar
Marcus committed
175 176 177 178 179 180 181 182 183 184
      this.serviceUserList = r.data
    })
    this.getCustomerFollowList()
  },
  methods: {
    customerFollowSubmit() {
      this.$refs["customerFollowForm"].validate(valid => {
        if (!valid) {
          return
        }
我在何方's avatar
我在何方 committed
185 186 187 188 189
        if(!this.customerFollow.form.followType){
          this.$modal.msgError("请选择跟进类型");
          return
        }
        if(!this.customerFollow.form.followTime){
邓春圆's avatar
邓春圆 committed
190
          this.$modal.msgError(this.$t('请选择跟进时间'));
我在何方's avatar
我在何方 committed
191 192 193
          return
        }
        if(!this.customerFollow.form.contactName){
邓春圆's avatar
邓春圆 committed
194
          this.$modal.msgError(this.$t('请选择联系人'));
我在何方's avatar
我在何方 committed
195 196 197
          return
        }
        if(!this.customerFollow.form.followUserId){
邓春圆's avatar
邓春圆 committed
198
          this.$modal.msgError(this.$t('请选择跟进业务'));
我在何方's avatar
我在何方 committed
199 200 201
          return
        }
        if(!this.customerFollow.form.followMethod){
邓春圆's avatar
邓春圆 committed
202
          this.$modal.msgError(this.$t('请选择跟进方式'));
我在何方's avatar
我在何方 committed
203 204 205
          return
        }
        if(!this.customerFollow.form.feedback){
邓春圆's avatar
邓春圆 committed
206
          this.$modal.msgError(this.$t('请输入客户反馈'));
我在何方's avatar
我在何方 committed
207 208 209
          return
        }
        if(!this.customerFollow.form.result){
邓春圆's avatar
邓春圆 committed
210
          this.$modal.msgError(this.$t('请输入处理结果'));
我在何方's avatar
我在何方 committed
211 212
          return
        }
Marcus's avatar
Marcus committed
213
        createCustomerFollow(this.customerFollow.form).then(r => {
我在何方's avatar
我在何方 committed
214
          this.customerFollowClose()
Marcus's avatar
Marcus committed
215 216 217 218
          this.getCustomerFollowList()
        })
      })
    },
我在何方's avatar
我在何方 committed
219 220 221 222
    customerFollowClose(){
      this.resetCustomerFollowForm()
      this.customerFollow.dialogVisible = false
    },
Marcus's avatar
Marcus committed
223
    resetCustomerFollowForm() {
我在何方's avatar
我在何方 committed
224
      console.log(11)
Marcus's avatar
Marcus committed
225
      this.customerFollow.form = {
226
        "bizId": this.id,
Marcus's avatar
Marcus committed
227 228 229 230 231 232
        "contactName": undefined,
        "feedback": undefined,
        "followMethod": undefined,
        "followTime": undefined,
        "followType": undefined,
        "followUserId": undefined,
233 234
        "result": undefined,
        "customerId":this.customerId
Marcus's avatar
Marcus committed
235
      }
我在何方's avatar
我在何方 committed
236
      // this.$refs.dictType.changeValue(this.customerFollow.form.followType);
我在何方's avatar
我在何方 committed
237
       this.$refs.dictMethod.changeValue(this.customerFollow.form.followMethod);
Marcus's avatar
Marcus committed
238 239
    },
    getCustomerFollowList() {
dcy's avatar
dcy committed
240
    if(this.$route.name === 'customerQuery'){
dcy's avatar
dcy committed
241
      getCustomerFollowPage({customerId: this.customerId,pageNo:this.pageNo,pageSize:this.pageSize}).then(r => {
dcy's avatar
dcy committed
242 243
        this.customerFollowList = r.data.list;
        this.total = r.data.total;
Marcus's avatar
Marcus committed
244
      })
dcy's avatar
dcy committed
245
    }else {
我在何方's avatar
我在何方 committed
246
      getCustomerFollowPage2({bizId: this.id,followType:3,pageNo:this.pageNo,pageSize:this.pageSize}).then(r => {
dcy's avatar
dcy committed
247 248 249 250
        this.customerFollowList = r.data.list;
        this.total = r.data.total;
      })
    }
Marcus's avatar
Marcus committed
251 252 253 254 255 256 257 258 259
    }

  }
}
</script>

<style scoped>

</style>