Эх сурвалжийг харах

feature(400资讯): 1、线上编辑400电话内容时,再次编辑无法查看
2、新增 信息有效,可转为经销商 --经销商编辑无法保存
3、所在地区新增搜索功能

likai 2 жил өмнө
parent
commit
b0ba950c95

+ 24 - 1
src/views/consult/components/Edit.vue

@@ -49,6 +49,9 @@
                       :value="item" />
                   </el-select>
                 </el-col>
+                <el-col :span="8">
+                  <el-button :disabled="areaEditDisable" type="primary" @click="showSelectCityDialog">搜索</el-button>
+                </el-col>
               </el-row>
             </el-form-item>
           </el-col>
@@ -93,6 +96,8 @@
     </el-dialog>
     <!-- 选择销售工程师弹窗 -->
     <select-user ref="selectSales" :query-params="{ roles: ['SalesEngineer'] }" @save="selectSales" />
+    <!-- 地区搜索 -->
+    <selectCity ref="selectCity" @submit="submitCity" />
   </div>
 </template>
 
@@ -101,9 +106,10 @@
   import customerApi from '@/api/customer'
   import consultApi from '@/api/consult'
   import SelectUser from '@/components/select/SelectUser'
+  import selectCity from './selectCity'
 
   export default {
-    components: { SelectUser },
+    components: { SelectUser, selectCity },
     data() {
       return {
         title: '',
@@ -201,6 +207,23 @@
         this.form.city = val.distName
         this.$forceUpdate()
       },
+      // 打开选择城市弹窗
+      showSelectCityDialog() {
+        this.$refs.selectCity.openDialog()
+      },
+      // 选中城市
+      submitCity(row) {
+        this.form.provinceId = row.provinceId
+        this.form.province = row.province
+        this.form.cityId = row.cityId
+        this.form.city = row.city
+        for (let item of this.provinceOptions) {
+          if (item.id == row.provinceId) {
+            this.currentProvince = item
+            break
+          }
+        }
+      },
       selectSales(val) {
         if (val && val.length > 0) {
           this.form.inchargeId = val[0].id

+ 12 - 5
src/views/consult/components/FollowUp.vue

@@ -194,6 +194,8 @@
           custName: '', // 客户
           nboId: 0, // 关联项目
           nboName: '', // 项目名称,
+          distributorId: 0, // 经销商
+          distributorName: '', // 经销商
           followCommunicateCase: '', // 10、信息有效,可继续跟进,转C类订单;20、信息有效,可转为储备用户;30、信息无效,不再跟进。
         },
         rules: {
@@ -293,6 +295,8 @@
           custName: '', // 客户
           nboId: 0, // 关联项目
           nboName: '', // 项目名称
+          distributorId: 0, // 经销商
+          distributorName: '', // 经销商
           followCommunicateCase: '', // 10、信息有效,可继续跟进,转C类订单;20、信息有效,可转为储备用户;30、信息无效,不再跟进。
         }
         this.$refs['form'].resetFields()
@@ -300,6 +304,8 @@
       changeIsProject() {
         this.form.nboId = 0
         this.form.nboName = ''
+        this.form.distributorId = 0
+        this.form.distributorName = ''
       },
       // 打开选择项目
       openProject() {
@@ -318,11 +324,12 @@
         this.form.nboName = business.nboName
       },
       selectDistributor(data) {
-        let business = data[0] || null
-        if (!business) return
-        console.log('business', business)
-        this.form.nboId = business.id
-        this.form.nboName = business.distName
+        this.form.distributorId = 0
+        this.form.distributorName = ''
+        let distributor = data[0] || null
+        if (!distributor) return
+        this.form.distributorId = distributor.id
+        this.form.distributorName = distributor.distName
       },
     },
   }

+ 120 - 0
src/views/consult/components/selectCity.vue

@@ -0,0 +1,120 @@
+<template>
+  <div>
+    <el-dialog append-to-body :title="title" :visible.sync="visible" @close="close">
+      <el-row>
+        <el-select v-model="searchForm.provinceId" clearable filterable placeholder="请选择省份" style="width: 250px">
+          <el-option v-for="item in provinceOptions" :key="item.id" :label="item.distName" :value="item.id" />
+        </el-select>
+        <el-input
+          v-model="searchForm.city"
+          clearable
+          placeholder="请输入市区"
+          style="width: 250px; margin-left: 10px" />
+        <el-button
+          :disabled="!searchForm.provinceId && !searchForm.city"
+          style="margin-left: 10px"
+          type="primary"
+          @click="search">
+          搜索
+        </el-button>
+      </el-row>
+      <el-row>
+        <el-table ref="cityTable" :data="tableData" height="450" style="margin-top: 10px">
+          <el-table-column :selectable="canSelect" type="selection" width="55" />
+          <el-table-column align="center" label="省份" prop="province" />
+          <el-table-column align="center" label="地区" prop="city" />
+          <el-table-column align="center" label="完整名称" prop="fullName" />
+        </el-table>
+      </el-row>
+      <span slot="footer">
+        <el-button
+          :disabled="!$refs.cityTable || !$refs.cityTable.selection || $refs.cityTable.selection.length == 0"
+          type="primary"
+          @click="submit">
+          保存
+        </el-button>
+        <el-button @click="visible = false">取消</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import customerApi from '@/api/customer'
+
+  export default {
+    components: {},
+    data() {
+      return {
+        title: '',
+        visible: false,
+        provinceOptions: [],
+        allData: [],
+        tableData: [],
+        searchForm: {
+          provinceId: '',
+          city: '',
+        },
+      }
+    },
+    mounted() {
+      this.allData.splice(0, this.allData.length)
+      Promise.all([customerApi.getProvinceDetail()])
+        .then(([province]) => {
+          this.provinceOptions = province.data.list || []
+          for (let item of this.provinceOptions) {
+            for (let city of item.children) {
+              let temp = {
+                provinceId: item.id,
+                province: item.distName,
+                cityId: city.id,
+                city: city.distName,
+                fullName: item.distName + '-' + city.distName,
+              }
+              this.allData.push(temp)
+            }
+          }
+        })
+        .catch((err) => console.log(err))
+    },
+    methods: {
+      openDialog() {
+        this.searchForm.provinceId = ''
+        this.searchForm.city = ''
+        this.tableData.splice(0, this.tableData.length)
+        this.visible = true
+      },
+      // 是否可选中
+      canSelect(row) {
+        // 只允许选中一条数据
+        return (
+          this.$refs.cityTable &&
+          this.$refs.cityTable.selection &&
+          (this.$refs.cityTable.selection.length == 0 || this.$refs.cityTable.selection[0] == row)
+        )
+      },
+      // 搜索
+      search() {
+        this.tableData.splice(0, this.tableData.length)
+        for (let item of this.allData) {
+          // 过滤掉省份
+          if (this.searchForm.provinceId && this.searchForm.provinceId != item.provinceId) {
+            continue
+          }
+          // 过滤掉地区
+          if (this.searchForm.city && item.city.indexOf(this.searchForm.city) < 0) {
+            continue
+          }
+          this.tableData.push(item)
+        }
+      },
+      // 保存
+      async submit() {
+        this.visible = false
+        this.$emit('submit', this.$refs.cityTable.selection[0])
+      },
+    },
+  }
+</script>
+
+<style></style>

+ 7 - 4
src/views/consult/detail.vue

@@ -67,9 +67,6 @@
               <el-descriptions-item label="对接人">
                 {{ details.inchargeName }}
               </el-descriptions-item>
-              <!-- <el-descriptions-item label="经销商/代理商">
-                {{ details.distributorName }}
-              </el-descriptions-item> -->
               <el-descriptions-item label="内容" :span="24">
                 {{ details.content }}
               </el-descriptions-item>
@@ -79,9 +76,14 @@
               <el-descriptions-item label="跟进沟通情况">
                 {{ caseMap[details.followCommunicateCase] }}
               </el-descriptions-item>
-              <el-descriptions-item label="项目">
+              <el-descriptions-item
+                v-if="details.followCommunicateCase == '10' || details.followCommunicateCase == '20'"
+                label="项目">
                 {{ details.nboName }}
               </el-descriptions-item>
+              <el-descriptions-item v-if="details.followCommunicateCase == '40'" label="经销商">
+                {{ details.distributorName }}
+              </el-descriptions-item>
               <el-descriptions-item label="进展描述" :span="24">
                 {{ details.progress }}
               </el-descriptions-item>
@@ -111,6 +113,7 @@
         caseMap: {
           10: '信息有效,可继续跟进,转C类订单',
           20: '信息有效,可转为储备用户',
+          40: '信息有效,可转为经销商',
           30: '信息无效,不再跟进',
         },
       }

+ 1 - 0
src/views/consult/index.vue

@@ -113,6 +113,7 @@
         caseMap: {
           10: '信息有效,可继续跟进,转C类订单',
           20: '信息有效,可转为储备用户',
+          40: '信息有效,可转为经销商',
           30: '信息无效,不再跟进',
         },
         height: this.$baseTableHeight(2),