Jelajahi Sumber

fix:跟进模块获取客户项目数据方式重写,解决项目跟进传参错误的问题

liuzl 2 tahun lalu
induk
melakukan
cefc4a0848

+ 0 - 12
api/customer/index.js

@@ -43,16 +43,4 @@ export default {
   getAbstract(query) {
     return micro_request.postRequest(basePath, 'Customer', 'GetCustAbstract', query)
   },
-  // 创建跟进
-  createFollow(query) {
-    return micro_request.postRequest(basePath, 'FollowUp', 'Create', query)
-  },
-  // 跟进信息
-  followList(query) {
-    return micro_request.postRequest(basePath, 'FollowUp', 'GetList', query)
-  },
-  // 跟进记录详情
-  getListByDay(query) {
-    return micro_request.postRequest(basePath, 'FollowUp', 'GetListByDay', query)
-  },
 }

+ 26 - 0
api/follow/index.js

@@ -0,0 +1,26 @@
+/*
+ * @Author: liuzhenlin 461480418@qq.ocm
+ * @Date: 2023-01-29 16:17:15
+ * @LastEditors: liuzhenlin
+ * @LastEditTime: 2023-02-14 16:45:06
+ * @Description: file content
+ * @FilePath: \crm\api\customer\index.js
+ */
+
+import micro_request from '@/utils/micro_request'
+
+const basePath = process.uniEnv.VUE_APP_ParentPath
+export default {
+  // 创建跟进
+  createFollow(query) {
+    return micro_request.postRequest(basePath, 'FollowUp', 'Create', query)
+  },
+  // 跟进信息
+  followList(query) {
+    return micro_request.postRequest(basePath, 'FollowUp', 'GetList', query)
+  },
+  // 跟进记录详情
+  getListByDay(query) {
+    return micro_request.postRequest(basePath, 'FollowUp', 'GetListByDay', query)
+  },
+}

+ 3 - 2
pages/customer/components/followRecords.vue

@@ -37,7 +37,7 @@
 
 <script>
   import to from 'await-to-js'
-  import followApi from '../../../api/customer'
+  import followApi from '../../../api/follow'
   export default {
     name: 'OmsCustomerDetail',
     props: {
@@ -61,7 +61,8 @@
       async getRecords() {
         let params = {
           custId: '' + this.customerId,
-          DaysBeforeToday: 9999,
+          targetType: '10',
+          pageSize: 9999,
         }
         const [err, res] = await to(followApi.getListByDay(params))
         if (err) return

+ 2 - 2
pages/customer/details.vue

@@ -122,7 +122,7 @@
     data() {
       return {
         openBtnWidth: false,
-        curTabIndex: 1,
+        curTabIndex: 0,
         fllowList: [], //跟进数据
         list: [
           {
@@ -190,7 +190,7 @@
         this.$store.commit('setDetails', this.customerData)
         uni.navigateTo({
           //保留当前页面,跳转到应用内的某个页面
-          url: '/pages/publicPages/follow?targetType=10',
+          url: '/pages/publicPages/follow?targetType=10&id=' + this.customerData.id,
         })
       },
       // 跳转到转移客户

+ 1 - 1
pages/distributor/components/followRecords.vue

@@ -37,7 +37,7 @@
 
 <script>
   import to from 'await-to-js'
-  import followApi from '../../../api/customer'
+  import followApi from '../../../api/follow'
   export default {
     name: 'OmsCustomerDetail',
     props: {

+ 6 - 6
pages/project/components/followRecords.vue

@@ -37,11 +37,11 @@
 
 <script>
   import to from 'await-to-js'
-  import followApi from '../../../api/customer'
+  import followApi from '../../../api/follow'
   export default {
     name: 'OmsCustomerDetail',
     props: {
-      custId: {
+      projectId: {
         type: [String, Number],
         default: '0',
       },
@@ -54,15 +54,15 @@
 
     mounted() {
       this.getRecords()
-      console.log('custId', this.custId)
+      console.log('projectId', this.projectId)
     },
 
     methods: {
       async getRecords() {
         let params = {
-          TargetType: '20',
-          custId: '' + this.custId,
-          DaysBeforeToday: 9999,
+          targetType: '20',
+          targetId: '' + this.projectId,
+          pageSize: 9999,
         }
         const [err, res] = await to(followApi.getListByDay(params))
         if (err) return

+ 2 - 2
pages/project/details.vue

@@ -80,7 +80,7 @@
       </view>
       <view class="data-list">
         <!-- 跟进记录 -->
-        <follow-records v-if="curTabIndex == 0" ref="follow" :custId="projectData.custId"></follow-records>
+        <follow-records v-if="curTabIndex == 0" ref="follow" :projectId="projectId"></follow-records>
         <!-- 详情 -->
         <project-detail v-if="curTabIndex == 1" :detail="projectData"></project-detail>
         <!-- 联系人 -->
@@ -186,7 +186,7 @@
         this.$store.commit('setDetails', this.projectData)
         uni.navigateTo({
           //保留当前页面,跳转到应用内的某个页面
-          url: '/pages/publicPages/follow?targetType=20',
+          url: '/pages/publicPages/follow?targetType=20&id=' + this.projectData.id,
         })
       },
       // 跳转到转移客户

+ 42 - 17
pages/publicPages/follow.vue

@@ -2,7 +2,7 @@
  * @Author: liuzhenlin 461480418@qq.ocm
  * @Date: 2023-01-12 11:57:48
  * @LastEditors: liuzhenlin
- * @LastEditTime: 2023-02-17 16:55:08
+ * @LastEditTime: 2023-03-01 16:17:37
  * @Description: file content
  * @FilePath: \oms\pages\publicPages\follow.vue
 -->
@@ -121,7 +121,9 @@
 <script>
   import { mapGetters } from 'vuex'
   import to from 'await-to-js'
-  import customerApi from '../../api/customer'
+  import followApi from '../../api/follow'
+  import custApi from '../../api/customer'
+  import prodApi from '../../api/project'
   import ProjectContact from '../../components/ProjectContact'
   import CustomerContact from '../../components/CustomerContact'
   export default {
@@ -187,13 +189,17 @@
             trigger: ['blur', 'change'],
           },
         },
+        details: {},
+        curId: 0,
       }
     },
     computed: {
-      ...mapGetters(['followPageDetail']),
+      // ...mapGetters(['details']),
     },
     onLoad(option) {
+      console.log(option)
       this.targetType = option.targetType
+      this.curId = parseInt(option.id)
     },
     created() {
       const navData = uni.getMenuButtonBoundingClientRect()
@@ -201,16 +207,35 @@
       this.paddingTop = navData.top + 'px'
     },
     mounted() {
-      console.log(this.followPageDetail)
+      console.log(this.details)
+      this.initData()
     },
     methods: {
+      // 获取客户/项目信息
+      async initData() {
+        if (this.targetType == '10') {
+          //客户
+          const [err, res] = await to(custApi.getDetail({ ids: [this.curId] }))
+          if (err) return
+          if (res && res.code == 200) {
+            this.details = res.data.list[0]
+          }
+        } else if (this.targetType == '20') {
+          //项目
+          const [err, res] = await to(prodApi.getDetail({ id: this.curId }))
+          if (err) return
+          if (res && res.code == 200) {
+            this.details = res.data
+          }
+        }
+      },
       // 打开客户联系人
       open() {
-        console.log(this.followPageDetail)
+        console.log(this.details)
         if (this.targetType == '10') {
-          this.$refs.concat.open(this.followPageDetail.id)
+          this.$refs.concat.open(this.details.id)
         } else if (this.targetType == '20') {
-          this.$refs.projectConcat.open(this.followPageDetail.id, this.followPageDetail.custId)
+          this.$refs.projectConcat.open(this.details.id, this.details.custId)
         }
       },
       // 行业选择
@@ -236,24 +261,24 @@
         }
       },
       handleAdd() {
-        console.log(this.followPageDetail)
+        console.log(this.details)
         this.$refs.addForm
           .validate()
           .then(async () => {
             let idParams = {}
             if (this.targetType == '10') {
               idParams = {
-                custId: this.followPageDetail.id,
-                custName: this.followPageDetail.custName,
-                targetId: this.followPageDetail.id,
-                targetName: this.followPageDetail.custName,
+                custId: this.details.id,
+                custName: this.details.custName,
+                targetId: this.details.id,
+                targetName: this.details.custName,
               }
             } else if (this.targetType == '20') {
               idParams = {
-                custId: this.followPageDetail.custId,
-                custName: this.followPageDetail.custName,
-                targetId: this.followPageDetail.custId,
-                targetName: this.followPageDetail.custName,
+                custId: this.details.custId,
+                custName: this.details.custName,
+                targetId: this.details.id,
+                targetName: this.details.nboName,
               }
             }
             let params = Object.assign(
@@ -268,7 +293,7 @@
               },
               idParams
             )
-            const [err, res] = await to(customerApi.createFollow(params))
+            const [err, res] = await to(followApi.createFollow(params))
             if (err) return
             if (res && res.code == 200) {
               this.$refs.uToast.show({

+ 1 - 1
pages/schedule/components/log.vue

@@ -61,7 +61,7 @@
 </template>
 
 <script>
-  import followApi from '../../../api/customer'
+  import followApi from '../../../api/follow'
   import to from 'await-to-js'
   export default {
     name: 'omsTodo',