Browse Source

收入分析

2545307760@qq.com 2 months ago
parent
commit
d2b0cc3c24

+ 2 - 2
web/src/api/progress.js

@@ -20,8 +20,8 @@ export const postUserProgress = (data) => {
 // 修改进度
 export const putUserProgress = (data) => {
   return service({
-    url: '/progress/createProgress',
-    method: 'post',
+    url: '/progress/updateProgress',
+    method: 'put',
     data
   })
 }

+ 26 - 2
web/src/pinia/customer/customer.js

@@ -1,23 +1,47 @@
 import { defineStore } from 'pinia'
 import { reactive, ref } from 'vue'
 import { getUserProgress } from '@/api/progress'
+import { getUserDemand } from '@/api/demand'
 
 export const useCustomer = defineStore('customer', () => {
+  // 进度
   const progressList = reactive([])
   const customerId = ref(0)
   const getProgressList = (id) => {
-    customerId.value = id
     getUserProgress(id).then(res => {
       if (res.code === 0) {
         progressList.length = 0
+        console.log('数据', res.data)
         progressList.push(...res.data)
       }
     })
   }
+  const changeCustomerId = (id) => {
+    customerId.value = id
+  }
+  // 需求
+  const demandList = reactive([])
+  const demandId = ref(0)
+  const getDemandList = (id) => {
+    getUserDemand(id).then(res => {
+      if (res.code === 0) {
+        demandList.length = 0
+        demandList.push(...res.data)
+      }
+    })
+  }
+  const changeDemandId = (id) => {
+    demandId.value = id
+  }
   return {
     progressList,
     getProgressList,
-    customerId
+    customerId,
+    changeCustomerId,
+    demandList,
+    demandId,
+    getDemandList,
+    changeDemandId
   }
 })
 

+ 76 - 5
web/src/view/customer/component/demand.vue

@@ -1,11 +1,82 @@
-<script setup>
-
-</script>
-
 <template>
-
+  <div>
+    <div>
+      <el-button
+        icon="plus"
+        @click="openAddDemand"
+      >
+        新增需求信息
+      </el-button>
+    </div>
+    <div style="margin-top: 20px">
+      <el-table
+        :data="customerData.demandList"
+        height="750px"
+        stripe
+      >
+        <el-table-column
+          label="提出时间"
+          align="center"
+          width="150px"
+          prop="customerId"
+        />
+        <el-table-column
+          label="是否完成"
+          align="center"
+          width="150px"
+          prop="followUpTime"
+        />
+        <el-table-column
+          label="需求内容"
+          align="center"
+          width="300px"
+        >
+          <template #default="scope">
+            <el-input
+              v-model="scope.row.content"
+              type="textarea"
+              :rows="3"
+            />
+          </template>
+        </el-table-column>
+        <el-table-column
+          label="操作"
+          align="center"
+        >
+          <template #default="scope">
+            <el-button
+              type="primary"
+              text
+              icon="Edit"
+              @click="progressEdit(scope.row)"
+            >
+              编辑
+            </el-button>
+            <el-button
+              type="primary"
+              text
+              icon="delete"
+              @click="deleteProgress(scope.row)"
+            >
+              删除
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+  </div>
 </template>
 
+<script setup>
+import { useCustomer } from '@/pinia/customer/customer'
+defineOptions({
+  name: 'DemandUnit'
+})
+const customerData = useCustomer()
+const openAddDemand = () => {
+}
+</script>
+
 <style scoped lang="scss">
 
 </style>

+ 12 - 20
web/src/view/customer/component/progress.vue

@@ -14,18 +14,6 @@
         height="750px"
         stripe
       >
-        <el-table-column
-          label="填写用户"
-          align="center"
-          width="180px"
-          prop="userId"
-        />
-        <el-table-column
-          label="所属客户"
-          align="center"
-          width="180px"
-          prop="customerId"
-        />
         <el-table-column
           label="跟进时间"
           align="center"
@@ -42,6 +30,7 @@
               v-model="scope.row.content"
               type="textarea"
               :rows="3"
+              disabled
             />
           </template>
         </el-table-column>
@@ -187,13 +176,8 @@ const addProgress = () => {
   })
 }
 
-const progressEdit = (row) => {
-  editProgressShow.value = true
-  editProgressData.content = row.content
-  editProgressData.followUpTime = row.followUpTime
-}
-
 const deleteProgress = (row) => {
+  console.log(row)
   ElMessageBox.confirm(
     '确定删除此客户进度吗?',
     '删除',
@@ -207,7 +191,7 @@ const deleteProgress = (row) => {
       delUserProgress(row.ID).then(res => {
         if (res.code === 0) {
           ElMessage.success(res.msg)
-          customerData.getProgressList(row.ID)
+          customerData.getProgressList(customerData.customerId)
         }
       })
     })
@@ -220,9 +204,17 @@ const deleteProgress = (row) => {
 }
 
 // 编辑进度
+const progressEdit = (row) => {
+  editProgressShow.value = true
+  editProgressData.id = row.ID
+  editProgressData.content = row.content
+  editProgressData.followUpTime = row.followUpTime
+}
+
 const editProgressShow = ref(false)
 
 const editProgressData = reactive({
+  id: 0,
   content: '',
   userId: userData.userInfo.ID,
   customerId: customerData.customerId,
@@ -233,7 +225,7 @@ const editProgress = () => {
   putUserProgress(editProgressData).then(res => {
     if (res.code === 0) {
       editProgressShow.value = false
-      customerData.getProgressList(userData.userInfo.ID)
+      customerData.getProgressList(customerData.customerId)
       console.log(res.data)
     }
   })

+ 26 - 2
web/src/view/customer/customer.vue

@@ -124,6 +124,7 @@
                   type="primary"
                   text
                   icon="Document"
+                  @click="openDemandEdit(scope.row)"
                 >
                   需求
                 </el-button>
@@ -341,11 +342,18 @@
     </el-drawer>
     <el-drawer
       v-model="progressShow"
-      title="客户进度信息"
-      size="60%"
+      :title="progressTitle"
+      size="40%"
     >
       <progress-unit />
     </el-drawer>
+    <el-drawer
+      v-model="demandShow"
+      :title="demandTitle"
+      size="50%"
+    >
+      <demand-unit />
+    </el-drawer>
   </div>
 </template>
 
@@ -363,6 +371,7 @@ import {
 } from '@/api/customer'
 import { ElMessage, ElMessageBox } from 'element-plus'
 import progressUnit from './component/progress.vue'
+import demandUnit from './component/demand.vue'
 import { useCustomer } from '@/pinia/customer/customer'
 defineOptions({
   name: 'Customer'
@@ -565,9 +574,24 @@ const editUserInfo = () => {
 
 // 客户进度信息
 const progressShow = ref(false)
+
+const progressTitle = ref('')
+
 const openProgressEdit = (row) => {
   progressShow.value = true
+  progressTitle.value = '客户进度信息:' + row.name
   customerData.getProgressList(row.ID)
+  customerData.changeCustomerId(row.ID)
+}
+
+// 客户需求信息
+const demandShow = ref(false)
+
+const demandTitle = ref('')
+
+const openDemandEdit = (row) => {
+  console.log(row)
+  demandShow.value = true
 }
 
 onMounted(() => {