Browse Source

feature(400资讯): 400咨询优化:点击进入详情请增加功能按钮三个,分别为上一条、下一条、返回

likai 1 year ago
parent
commit
26d5f29c63
2 changed files with 50 additions and 1 deletions
  1. 3 0
      src/api/consult/index.js
  2. 47 1
      src/views/consult/detail.vue

+ 3 - 0
src/api/consult/index.js

@@ -19,4 +19,7 @@ export default {
   followUp(query) {
     return micro_request.postRequest(basePath, 'ProductConsultRecord', 'FollowUp', query)
   },
+  getOperateEntity(query) {
+    return micro_request.postRequest(basePath, 'ProductConsultRecord', 'GetOperateEntity', query)
+  },
 }

+ 47 - 1
src/views/consult/detail.vue

@@ -91,6 +91,15 @@
                 {{ details.nextPlan }}
               </el-descriptions-item>
             </el-descriptions>
+            <div style="margin-top: 20px">
+              <el-button :disabled="!operateData.hasLast" type="primary" @click="getOperateData('Last')">
+                上一条
+              </el-button>
+              <el-button :disabled="!operateData.hasNext" type="primary" @click="getOperateData('Next')">
+                下一条
+              </el-button>
+              <el-button @click="back">返回</el-button>
+            </div>
           </el-tab-pane>
         </el-tabs>
       </div>
@@ -116,6 +125,8 @@
           40: '信息有效,可转为经销商',
           30: '信息无效,不再跟进',
         },
+        // 可操作数据
+        operateData: { hasLast: false, hasNext: false },
       }
     },
     computed: {
@@ -132,10 +143,45 @@
     methods: {
       init() {
         Promise.all([api.get({ id: this.id })]).then(([details]) => {
-          if (details.data) this.details = details.data
+          if (details.data) {
+            this.details = details.data
+            this.getOperateData('Now')
+          }
         })
       },
       handleClick() {},
+      // 获取操作数据
+      getOperateData(operateType) {
+        this.operateData.hasLast = false
+        this.operateData.hasNext = false
+        api
+          .getOperateEntity({ id: this.id, operateType: operateType, createdTime: this.details.createdTime })
+          .then((res) => {
+            if (res.data) {
+              this.operateData.hasLast = res.data.hasLast
+              this.operateData.hasNext = res.data.hasNext
+              if (operateType != 'Now') {
+                this.$router.push({
+                  path: '/consult/detail',
+                  query: {
+                    id: res.data.id,
+                  },
+                })
+                this.id = res.data.id
+                this.init()
+              }
+            }
+          })
+          .catch((err) => {
+            console.error(err)
+          })
+      },
+      // 返回
+      back() {
+        this.$router.push({
+          path: '/consult',
+        })
+      },
     },
   }
 </script>