Browse Source

收入分析

2545307760@qq.com 2 months ago
parent
commit
d1cb972c5f

+ 1 - 1
server/dao/crm/customer.go

@@ -46,7 +46,7 @@ func (c Customer) CreateCustomer() error {
 }
 
 func (c Customer) UpdateCustomer() error {
-	return global.GVA_DB.Model(&Customer{}).Updates(&c).Error
+	return global.GVA_DB.Model(&Customer{}).Where("id = ?", c.ID).Updates(&c).Error
 }
 
 func DeleteCustomer(id int) error {

+ 35 - 0
web/src/api/demand.js

@@ -0,0 +1,35 @@
+import service from '@/utils/request'
+
+// 按客户id 查询需求
+export const getUserDemand = (id) => {
+  return service({
+    url: '/demand/queryDemandsByCustomerId?id=' + id,
+    method: 'get'
+  })
+}
+
+// 新增需求
+export const postUserDemand = (data) => {
+  return service({
+    url: '/demand/createDemand',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改需求
+export const putUserDemand = (data) => {
+  return service({
+    url: '/demand/updateDemand',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除需求
+export const delUserDemand = (id) => {
+  return service({
+    url: '/demand/deleteDemand?id=' + id,
+    method: 'delete'
+  })
+}

+ 36 - 0
web/src/api/progress.js

@@ -0,0 +1,36 @@
+import service from '@/utils/request'
+
+// 按客户id 查询进度信息
+export const getUserProgress = (id) => {
+  return service({
+    url: '/progress/queryProgressByCustomerId?id=' + id,
+    method: 'get'
+  })
+}
+
+// 新增进度内容
+export const postUserProgress = (data) => {
+  return service({
+    url: '/progress/createProgress',
+    method: 'post',
+    data
+  })
+}
+
+// 修改进度
+export const putUserProgress = (data) => {
+  return service({
+    url: '/progress/createProgress',
+    method: 'post',
+    data
+  })
+}
+
+// 删除进度
+export const delUserProgress = (data) => {
+  return service({
+    url: '/progress/deleteProgress',
+    method: 'delete',
+    data
+  })
+}

+ 0 - 0
web/src/pinia/customer/customer.js


+ 11 - 0
web/src/view/customer/component/demand.vue

@@ -0,0 +1,11 @@
+<script setup>
+
+</script>
+
+<template>
+
+</template>
+
+<style scoped lang="scss">
+
+</style>

+ 47 - 0
web/src/view/customer/component/progress.vue

@@ -0,0 +1,47 @@
+<template>
+  <div>
+    <div>
+      <el-button
+          icon="plus"
+          @click="addProgress"
+      >
+        新增进度信息
+      </el-button>
+    </div>
+    <div style="margin-top: 20px">
+      <el-table :data="progressInfo">
+        <el-table-column
+            label="填写用户"
+            align="center"
+            width="180px"
+        />
+        <el-table-column
+            label="所属客户"
+            align="center"
+            width="180px"
+        />
+        <el-table-column
+            label="跟进时间"
+            align="center"
+            width="180px"
+        />
+        <el-table-column
+            label="内容"
+            align="center"
+        >
+          <template #default="scope">
+            <el-input v-model="scope.row.content" />
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+  </div>
+</template>
+
+<script setup>
+
+</script>
+
+<style scoped lang="scss">
+
+</style>

+ 192 - 13
web/src/view/customer/customer.vue

@@ -55,36 +55,43 @@
             size="small"
           >
             <el-table-column
+              width="150px"
               label="客户名称"
               prop="name"
               align="center"
             />
             <el-table-column
+              width="180px"
               label="客户电话"
               prop="phone"
               align="center"
             />
             <el-table-column
+              width="180px"
               label="客户邮箱"
               prop="email"
               align="center"
             />
             <el-table-column
+              width="250px"
               label="公司"
               prop="company"
               align="center"
             />
             <el-table-column
+              width="150px"
               label="职位"
               prop="posts"
               align="center"
             />
             <el-table-column
+              width="150px"
               label="客户类型"
               prop="customerGenre.name"
               align="center"
             />
             <el-table-column
+              width="150px"
               label="直系上司"
               prop="genre"
               align="center"
@@ -103,6 +110,23 @@
                 >
                   编辑
                 </el-button>
+                <el-button
+                  size="small"
+                  type="primary"
+                  text
+                  icon="DocumentChecked"
+                  @click="openProgressEdit(scope.row)"
+                >
+                  进度
+                </el-button>
+                <el-button
+                  size="small"
+                  type="primary"
+                  text
+                  icon="Document"
+                >
+                  需求
+                </el-button>
                 <el-button
                   size="small"
                   type="primary"
@@ -247,20 +271,131 @@
     <el-drawer
       v-model="editUserShow"
       title="编辑客户"
-      width="40%"
     >
-      <el-tabs>
-        <el-tab-pane label="基本信息"></el-tab-pane>
-        <el-tab-pane label="进度信息"></el-tab-pane>
-        <el-tab-pane label="需求信息"></el-tab-pane>
-      </el-tabs>
+      <el-form
+        label-width="100px"
+        label-position="left"
+        size="large"
+      >
+        <el-form-item label="客户名称:">
+          <el-input
+            v-model="basicInfo.name"
+            placeholder="请输入客户名称"
+          />
+        </el-form-item>
+        <el-form-item label="客户电话:">
+          <el-input
+            v-model="basicInfo.phone"
+            placeholder="请输入客户电话"
+          />
+        </el-form-item>
+        <el-form-item label="客户邮箱:">
+          <el-input
+            v-model="basicInfo.email"
+            placeholder="请输入客户邮箱"
+          />
+        </el-form-item>
+        <el-form-item label="公司:">
+          <el-input
+            v-model="basicInfo.company"
+            placeholder="请输入公司名称"
+          />
+        </el-form-item>
+        <el-form-item label="职位:">
+          <el-input
+            v-model="basicInfo.posts"
+            placeholder="请输入公司职位"
+          />
+        </el-form-item>
+        <el-form-item label="客户类型:">
+          <el-select
+            v-model="basicInfo.genre"
+            placeholder="类型"
+            clearable
+            @clear="basicInfo.genre = 0"
+          >
+            <el-option
+              v-for="item in userTypeList"
+              :key="item.ID"
+              :label="item.name"
+              :value="item.ID"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="直系上司:">
+          <el-input
+            v-model="basicInfo.supervisorId"
+            placeholder="选填"
+          />
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <el-button
+          type="primary"
+          size="large"
+          @click="editUserInfo"
+        >
+          确认
+        </el-button>
+      </template>
+    </el-drawer>
+    <el-drawer
+      v-model="progressShow"
+      title="客户进度信息"
+      size="50%"
+    >
+      <div>
+        <el-button
+          icon="plus"
+          @click="addProgress"
+        >
+          新增进度信息
+        </el-button>
+      </div>
+      <div style="margin-top: 20px">
+        <el-table :data="progressInfo">
+          <el-table-column
+            label="填写用户"
+            align="center"
+            width="180px"
+          />
+          <el-table-column
+            label="所属客户"
+            align="center"
+            width="180px"
+          />
+          <el-table-column
+            label="跟进时间"
+            align="center"
+            width="180px"
+          />
+          <el-table-column
+            label="内容"
+            align="center"
+          >
+            <template #default="scope">
+              <el-input v-model="scope.row.content" />
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
     </el-drawer>
   </div>
 </template>
 
 <script setup>
 import { reactive, onMounted, ref } from 'vue'
-import { getCustomerList, postCustomer, delCustomer, getCustomerType, postCustomerType, putCustomerType, delCustomerType } from '@/api/customer'
+import {
+  getCustomerList,
+  postCustomer,
+  delCustomer,
+  getCustomerType,
+  postCustomerType,
+  putCustomerType,
+  delCustomerType,
+  putCustomer
+} from '@/api/customer'
+import { getUserProgress } from '@/api/progress'
 import { ElMessage, ElMessageBox } from 'element-plus'
 defineOptions({
   name: 'Customer'
@@ -271,11 +406,6 @@ const searchData = reactive({
   customerType: ''
 })
 
-const customerEdit = (scope) => {
-  editUserShow.value = true
-  console.log(scope)
-}
-
 const pageSet = reactive({
   page: 1,
   pageSize: 10,
@@ -388,7 +518,7 @@ const addCustomer = () => {
       continue
     }
     if (addCustomerJson[key] === '' || addCustomerJson[key] === 0) {
-      ElMessage.error('请将除直系上司id以外的所有信心填写完整')
+      ElMessage.error('请将除直系上司以外的所有信息填写完整')
       return
     }
   }
@@ -431,6 +561,55 @@ const deleteCustomer = (row) => {
 // 编辑客户信息
 const editUserShow = ref(false)
 
+const customerEdit = (scope) => {
+  editUserShow.value = true
+  Object.assign(basicInfo, scope)
+}
+
+const basicInfo = reactive({})
+
+const editUserInfo = () => {
+  const basic = {
+    id: basicInfo.ID,
+    name: basicInfo.name,
+    phone: basicInfo.phone,
+    email: basicInfo.email,
+    company: basicInfo.company,
+    posts: basicInfo.posts,
+    genre: basicInfo.genre,
+    supervisorId: basicInfo.supervisorId
+  }
+  for (const key in basic) {
+    if (key === 'supervisorId') {
+      continue
+    }
+    if (addCustomerJson[key] === '' || addCustomerJson[key] === 0) {
+      ElMessage.error('请将除直系上司以外的所有信息填写完整')
+      return
+    }
+  }
+  putCustomer(basic).then(res => {
+    if (res.code === 0) {
+      queryCustomerList()
+      ElMessage.success('编辑成功')
+    }
+  })
+}
+
+// 客户进度信息
+const progressShow = ref(false)
+const progressInfo = reactive([])
+const openProgressEdit = (row) => {
+  getUserProgress(row.ID).then(res => {
+    if (res.code === 0) {
+      console.log(res.data)
+      progressShow.value = true
+    }
+  })
+}
+// 添加客户进度信息
+const addProgress = () => {}
+
 onMounted(() => {
   queryUserTypeList()
   queryCustomerList()