Ver código fonte

家装客资

zhujindu 1 ano atrás
pai
commit
2e1b6f7081

+ 9 - 0
src/api/assignAwait.js

@@ -62,3 +62,12 @@ export function allocationSubCustomer(data) {
     data: data,
   });
 }
+
+// 家装客资-新增客资跟进信息答案接口
+export function insertFollowCustomerClueAnswer(data) {
+  return request({
+    url: 'mobile/customerClueInfo/insertFollowCustomerClueAnswer',
+    method: 'post',
+    data: data,
+  });
+}

+ 1 - 1
src/views/clew/index.vue

@@ -111,7 +111,7 @@ export default {
         });
     },
     approveFn(row) {
-      if (row.cid !== 7) {
+      if (row.cid == 7) {
         // 家装客资跟进
         this.$router.push({
           path: '/JZfollowUp',

+ 52 - 21
src/views/week/assignAwait/JZfollowUp.vue

@@ -17,8 +17,14 @@
         <span v-if="infoData.isClose == -1">未跟进</span>
       </div>
       <!-- 转交 -->
-      <!-- v-if="infoData.customerClueStatus == 0 && postName && postName == '区域家装销售负责人'" -->
-      <van-button type="info" size="small" plain class="centerBtn" @click="showPicker = true">
+      <!--  -->
+      <van-button
+        v-if="infoData.customerClueStatus == 0 && postName && postName == '区域家装销售负责人'"
+        type="info"
+        size="small"
+        plain
+        class="centerBtn"
+        @click="showPicker = true">
         转交下属
       </van-button>
     </assignAwaitDetail>
@@ -45,12 +51,9 @@
     <!-- 跟进任务填写 -->
     <div class="assign">
       <div class="followUp required">跟进结果</div>
-      <!-- <div
-        class="taskGather"
-        v-if="taskGather && taskGather.customerClueItemList.customerClueOptionList">
-        <radioGroup
-          :clueOptionList="taskGather.customerClueItemList.customerClueOptionList"></radioGroup>
-      </div> -->
+      <div class="taskGather" v-if="taskGather && taskGather">
+        <radioGroup :clueOptionList="taskGather"></radioGroup>
+      </div>
       <div v-if="infoData.isClose != 1" class="tc" style="padding: 0 16px">
         <van-button class="submitBtn" block type="info" color="#0057ba" @click="onSubmit">
           提交
@@ -87,6 +90,7 @@ import {
   selectCustomerClueInfoById,
   selectSubUserList,
   allocationSubCustomer,
+  insertFollowCustomerClueAnswer,
 } from '@/api/assignAwait';
 import { mapState } from 'vuex';
 import radioGroup from './radioGroup';
@@ -154,7 +158,8 @@ export default {
     getSelectCustomerClueInfoById() {
       selectCustomerClueInfoById({ customerClueInfoId: this.id }).then((res) => {
         if (res.code == 200) {
-          this.taskGather = res.data;
+          // res.data.customerClue.searchValue.customerClueItemList
+          this.taskGather = res.data.customerClue.customerClueItemList;
         } else {
           this.$toast(res.msg);
         }
@@ -189,18 +194,44 @@ export default {
       this.showView = true;
     },
     onSubmit() {
-      //   allocationCustomer({
-      //     userId: this.assignUserItem.userId || '', //	string	用户ID
-      //     customerClueInfoId: this.id, //	string	客资主键ID
-      //     customerClassify: this.activaAssignTypeItem.dictValue || '', //	string	客资类型,(取值页面字典选择的值 jz_customer_type)
-      //   }).then((res) => {
-      //     if (res.code == 200) {
-      //       this.$toast(res.msg);
-      //       this.onClickLeft();
-      //     } else {
-      //       this.$toast(res.msg);
-      //     }
-      //   });
+      // 没有选择跟进记录
+      if (!this.taskGather[0].searchValue) {
+        this.$toast('请选择跟进结果');
+        return;
+      }
+      let customerClueItemList = [];
+      // 每一个层级都是一道题的题目,子级就是题,被选中和填写的题要带上题目一块上传(题的同级也要上传)
+      // 第一级题目下的题默认都要上传
+      this.copyData(this.taskGather);
+      // 过滤最外层题目
+      let topOptionList = this.taskGather[0].customerClueOptionList.find(
+        (val) => val.customerClueOptionId == this.taskGather[0].searchValue
+      );
+      // console.log(topOptionList);
+      // insertFollowCustomerClueAnswer({ customerClueItemList: [this.taskGather] }).then((res) => {
+      //   if (res.code == 200) {
+      //     this.$toast(res.msg);
+      //   } else {
+      //     this.$toast(res.msg);
+      //   }
+      // });
+    },
+    copyData(data) {
+      for (let i = 0; i < data.length; i++) {
+        console.log(data[i]);
+        // numbersCopy = [];
+        // const target = Array.isArray(source) ? [] : {};
+        // for (const key in data[0]) {
+        //   if (Object.prototype.hasOwnProperty.call(data[0], key)) {
+        //     if (typeof data[0][key] === 'object' && data[0][key] !== null) {
+        //       target[key] = deepClone(data[0][key]);
+        //     } else {
+        //       target[key] = data[0][key];
+        //     }
+        //   }
+        // }
+        // return target;
+      }
     },
     // 校验错误返回信息
     onFailed(errorInfo) {

+ 115 - 0
src/views/week/assignAwait/radioGroup copy.vue

@@ -0,0 +1,115 @@
+<template>
+  <div class="radioGroup">
+    <template v-if="clueOptionList && clueOptionList.length && clueOptionList[0]">
+      <template v-if="clueOptionList[0].answerType == 'dx'">
+        <van-radio-group v-model="clueOptionList[0].searchValue" @change="radioGroupChange">
+          <template v-for="(item, index) in clueOptionList[0].customerClueOptionList">
+            <van-radio :name="item.customerClueOptionId" :key="index" @click="radioClick">
+              {{ item.customerClueOption }}
+            </van-radio>
+            <radioGroup
+              :clueOptionList="item.customerClueItemList"
+              :parentOptionList="item"></radioGroup>
+          </template>
+        </van-radio-group>
+      </template>
+      <template v-if="clueOptionList[0].answerType == 'wb'">
+        {{ clueOptionList[0].customerClueName }}
+        <van-field
+          v-model="clueOptionList[0].searchValue"
+          :placeholder="clueOptionList[0].customerClueName" />
+      </template>
+    </template>
+  </div>
+</template>
+<script>
+export default {
+  name: 'radioGroup',
+  props: {
+    clueOptionList: {
+      type: Array,
+      default: () => [],
+    },
+    parentOptionList: {
+      type: Object,
+      default: () => {},
+    },
+  },
+  data() {
+    return {};
+  },
+  methods: {
+    getParentId(list, name) {
+      debugger;
+      for (let i in list) {
+        if (list[i].customerClueOptionId == name) {
+          return [list[i]];
+        }
+        if (list[i].customerClueItemList) {
+          let node = this.getParentId(list[i].customerClueOptionList, name);
+          if (node !== undefined) {
+            return node.concat(list[i]);
+          }
+        }
+      }
+    },
+    radioGroupChange(name) {
+      if (!name) return;
+      console.log(name);
+      // console.log(this.clueOptionList);
+      // 如果选中的数据有父级,将父级数据修改为选中状态
+      if (this.parentOptionList) {
+        // console.log(this.parentOptionList);
+        // this.$set(this.parentOptionList, 'searchValue', 'Y');
+        // console.log(this.getParentId(this.parentOptionList.customerClueOptionList, name));
+        // 获取选中数据
+        // let activaRadio = this.parentOptionList.customerClueOptionList.find(
+        //   (val) => val.customerClueOptionId == name
+        // );
+      } else {
+      }
+      // 获取选中数据
+      let activaRadio = this.clueOptionList[0].customerClueOptionList.find(
+        (val) => val.customerClueOptionId == name
+      );
+      console.log(this.parentOptionList);
+      // 修改选中状态
+      // console.log(activaRadio);
+      this.$set(activaRadio, 'value', 'Y');
+
+      // 过滤未选中的数据
+      let exceptItself = this.clueOptionList[0].customerClueOptionList.filter(
+        (val) => val.customerClueOptionId !== name
+      );
+      // 删除未选中数据状态兄弟级和子级
+      // console.log(exceptItself);
+      this.toggleOtheChildren(exceptItself);
+    },
+    toggleOtheChildren(exceptItself) {
+      if (!exceptItself) return;
+      exceptItself.forEach((val) => {
+        this.$set(val, 'value', 'N');
+        if (val.customerClueItemList && val.customerClueItemList[0]) {
+          this.$set(val.customerClueItemList[0], 'searchValue', null);
+          if (
+            val.customerClueItemList[0] &&
+            val.customerClueItemList[0].customerClueOptionList.length
+          ) {
+            this.toggleOtheChildren(val.customerClueItemList[0].customerClueOptionList);
+          }
+        }
+      });
+    },
+    radioClick(event) {
+      // console.log(event);
+    },
+  },
+};
+</script>
+<style lang="scss">
+.radioGroup {
+  .van-radio-group {
+    padding-left: 20px;
+  }
+}
+</style>

+ 110 - 8
src/views/week/assignAwait/radioGroup.vue

@@ -1,13 +1,29 @@
 <template>
   <div class="radioGroup">
-    <van-radio-group
-      v-model="item.searchValue"
-      v-if="clueOptionList.length"
-      v-for="(item, index) in clueOptionList"
-      :key="index">
-      <van-radio :name="item.customerClueOptionId">{{ item.customerClueOption }}</van-radio>
-      <radioGroup :clueOptionList="item.customerClueItemList"></radioGroup>
-    </van-radio-group>
+    <template v-if="clueOptionList && clueOptionList.length">
+      <template v-if="clueOptionList[0].answerType == 'dx'">
+        <van-radio-group v-model="clueOptionList[0].searchValue" @change="radioGroupChange">
+          <template v-for="(item, index) in clueOptionList[0].customerClueOptionList">
+            <van-radio :name="item.customerClueOptionId" :key="index" @click="radioClick">
+              {{ item.customerClueOption }}
+            </van-radio>
+            <radioGroup
+              :clueOptionList="item.customerClueItemList"
+              :parentOptionList="clueOptionList[0]"
+              :parentId="item.customerClueOptionId"></radioGroup>
+          </template>
+        </van-radio-group>
+      </template>
+      <template v-if="clueOptionList[0].answerType == 'wb'">
+        <template v-if="parentOptionList.searchValue == clueOptionList[0].itemOptionParentId">
+          <span class="van-f-red" v-if="clueOptionList[0].isMust == 0">*</span>
+          {{ clueOptionList[0].customerClueName }}
+          <van-field
+            v-model="clueOptionList[0].searchValue"
+            :placeholder="clueOptionList[0].customerClueName" />
+        </template>
+      </template>
+    </template>
   </div>
 </template>
 <script>
@@ -18,9 +34,95 @@ export default {
       type: Array,
       default: () => [],
     },
+    parentOptionList: {
+      type: Object,
+      default: () => {},
+    },
+    parentId: {
+      type: [Number, null],
+      default: null,
+    },
   },
   data() {
     return {};
   },
+  created() {
+    // console.log(this.clueOptionList);
+  },
+  methods: {
+    radioGroupChange(name) {
+      if (!name) return;
+      // console.log(name);
+      // console.log(this.clueOptionList);
+      // 如果选中的数据有父级,将父级数据修改为选中状态
+      if (this.parentOptionList && this.parentId) {
+        this.$set(this.parentOptionList, 'searchValue', this.parentId);
+      }
+      // 获取选中数据
+      let activaRadio = this.clueOptionList[0].customerClueOptionList.find(
+        (val) => val.customerClueOptionId == name
+      );
+      // 修改选中状态
+      this.$set(activaRadio, 'value', 'Y');
+
+      // 过滤未选中的数据
+      let exceptItself = this.clueOptionList[0].customerClueOptionList.filter(
+        (val) => val.customerClueOptionId !== name
+      );
+      // 删除未选中数据状态兄弟级和子级
+      // console.log(exceptItself);
+      this.toggleOtheChildren(exceptItself);
+    },
+    toggleOtheChildren(exceptItself) {
+      if (!exceptItself) return;
+      exceptItself.forEach((val) => {
+        this.$set(val, 'value', 'N');
+        if (val.customerClueItemList && val.customerClueItemList[0]) {
+          this.$set(val.customerClueItemList[0], 'searchValue', null);
+          if (
+            val.customerClueItemList[0] &&
+            val.customerClueItemList[0].customerClueOptionList.length
+          ) {
+            this.toggleOtheChildren(val.customerClueItemList[0].customerClueOptionList);
+          }
+        }
+      });
+    },
+    radioClick(event) {
+      // console.log(event);
+    },
+  },
 };
 </script>
+<style lang="scss">
+.radioGroup {
+  padding: 5px;
+  .van-radio-group {
+    padding-left: 20px;
+  }
+  .van-cell {
+    padding: 10px 0;
+    font-size: 14px;
+  }
+  .van-cell::after {
+    border: 0;
+  }
+  .van-field {
+    border: 1px solid #cdc8c8;
+    padding: 0;
+    width: 100%;
+    border-radius: 4px;
+    overflow: hidden;
+    background-color: unset;
+    height: 30px;
+    line-height: 30px;
+    margin: 5px 0;
+  }
+  .van-field__control {
+    padding: 0 10px;
+  }
+  .van-field__control {
+    padding: 0 10px;
+  }
+}
+</style>