zhujindu 8 bulan lalu
induk
melakukan
54002dc15b

+ 10 - 0
src/api/visitapi.js

@@ -0,0 +1,10 @@
+import request from '@/utils/request';
+
+// 经销商未拜访列表接口
+export function chainNoVisitList(query) {
+  return request({
+    url: '/mobile/target/chainNoVisitList',
+    method: 'get',
+    params: query,
+  });
+}

TEMPAT SAMPAH
src/assets/icon/fenghuangjihua.png


TEMPAT SAMPAH
src/assets/icon/ord.png


+ 8 - 0
src/router/index.js

@@ -32,6 +32,14 @@ const router = new VueRouter({
             title: '首页',
           },
         },
+        {
+          path: '/noVisit',
+          name: 'noVisit',
+          component: () => import('@/views/home/noVisit.vue'),
+          meta: {
+            title: '未拜访',
+          },
+        },
       ],
     },
     {

+ 262 - 2
src/views/agentList/index.vue

@@ -51,7 +51,194 @@
                       style="top: 6px; margin-left: 4px" />
                   </span>
                 </div>
-                <div class="info">客户分类:{{ verifyChainType(item.typeCode2) }}</div>
+                <div class="info" style="position: relative">
+                  客户分类:{{ verifyChainType(item.typeCode2) }}
+                  <div style="position: absolute; bottom: 0px; right: 0px">
+                    <!-- 凤凰客户 -->
+                    <el-popover
+                      popper-class="zpover"
+                      placement="bottom"
+                      width="120"
+                      trigger="click"
+                      content="该客户为凤凰客户">
+                      <div
+                        v-if="item.storeLabels && item.storeLabels.fhCustomer"
+                        class="visitStoreIco"
+                        style="background-color: #fff"
+                        slot="reference">
+                        <van-icon :name="require('@/assets/icon/fenghuangjihua.png')" size="26" />
+                      </div>
+                    </el-popover>
+                    <!-- 本月已出货 -->
+                    <el-popover
+                      popper-class="zpover"
+                      placement="bottom"
+                      width="120"
+                      trigger="click"
+                      content="本月已出货">
+                      <div
+                        v-if="item.storeLabels && item.storeLabels.fhCustomer"
+                        class="visitStoreIco"
+                        style="background-color: #fff"
+                        slot="reference">
+                        <van-icon :name="require('@/assets/icon/fenghuangjihua.png')" size="26" />
+                      </div>
+                    </el-popover>
+                    <el-popover
+                      popper-class="zpover zpover6"
+                      placement="bottom-start"
+                      trigger="click">
+                      <div>
+                        <p>
+                          本店{{ timeData }}下单SKU数:<a
+                            @click="linkList(item)"
+                            style="text-decoration: underline"
+                            >点击查看详情</a
+                          >
+                        </p>
+                      </div>
+                      <div
+                        class="visitStoreIco"
+                        style="background-color: #fff; position: relative"
+                        slot="reference">
+                        <p
+                          style="
+                            width: 100%;
+                            position: absolute;
+                            z-index: 1;
+                            top: 0.2px;
+                            width: 22px;
+                            margin: 0;
+                            margin-left: 3.6px;
+                            text-align: center;
+                            font-size: 12px;
+                          ">
+                          <!-- {{ item.storeLabels.zysslNums }} -->
+                          111
+                        </p>
+                        <van-icon :name="require('@/assets/icon/ord.png')" size="26" />
+                      </div>
+                    </el-popover>
+                    <!-- <el-popover
+                      popper-class="zpover zpover5"
+                      placement="bottom"
+                      width="200"
+                      trigger="click">
+                      <div v-if="item.storeLabels">
+                        <p>已参加:</p>
+                        <p v-for="tt in (item.storeLabels.targetOne + '').split(';')">
+                          {{ tt }}
+                        </p>
+                      </div>
+                      <div
+                        class="visitStoreIco"
+                        v-if="item.storeLabels.targetOne"
+                        style="background-color: #fff"
+                        slot="reference">
+                        <van-icon :name="targetOne" size="26" />
+                      </div>
+                    </el-popover>
+                    <el-popover
+                      popper-class="zpover"
+                      placement="bottom"
+                      width="120"
+                      trigger="click"
+                      content="调色机5天未联网">
+                      <div
+                        v-if="item.storeLabels.ccmOffline"
+                        class="visitStoreIco"
+                        style="background-color: #fff"
+                        slot="reference">
+                        <van-icon :name="Network" size="26" />
+                      </div>
+                    </el-popover>
+                    <el-popover
+                      popper-class="zpover"
+                      placement="bottom"
+                      width="200"
+                      trigger="click"
+                      content="同城店近60天未下单">
+                      <div
+                        v-if="item.storeLabels.fxNoOrder"
+                        class="visitStoreIco"
+                        style="background-color: #fff"
+                        slot="reference">
+                        <van-icon :name="order60" size="26" />
+                      </div>
+                    </el-popover>
+                    <el-popover
+                      popper-class="zpover"
+                      placement="bottom"
+                      width="200"
+                      trigger="click"
+                      content="金牌店近30天未下单">
+                      <div
+                        v-if="item.storeLabels.noOrder"
+                        class="visitStoreIco"
+                        style="background-color: #fff"
+                        slot="reference">
+                        <van-icon :name="order" size="26" />
+                      </div>
+                    </el-popover>
+                    <el-popover
+                      popper-class="zpover"
+                      placement="bottom"
+                      width="200"
+                      trigger="click"
+                      content="本店本月进过专业时时丽">
+                      <div
+                        class="visitStoreIco"
+                        v-if="item.storeLabels.zyssl"
+                        style="background-color: #ed5c68"
+                        slot="reference">
+                        专
+                      </div>
+                    </el-popover>
+                    <el-popover
+                      popper-class="zpover zpover1"
+                      placement="bottom"
+                      width="200"
+                      trigger="click"
+                      content="本店本月进过超好贴">
+                      <div
+                        v-if="item.storeLabels.chtczj"
+                        class="visitStoreIco"
+                        style="background-color: #0057ba"
+                        slot="reference">
+                        超
+                      </div>
+                    </el-popover>
+                    <el-popover
+                      placement="bottom"
+                      popper-class="zpover zpover1 zpover1sb"
+                      :disabled="!item.userVisitTimesMap"
+                      trigger="click">
+                      <div
+                        v-if="item.storeLabels.visitTimes && item.storeLabels.visitTimes > 0"
+                        class="visitStoreIco"
+                        slot="reference"
+                        style="background-color: #fff; position: relative">
+                        <p
+                          style="
+                            width: 100%;
+                            position: absolute;
+                            z-index: 10;
+                            top: -2px;
+                            margin: 0;
+                            text-align: center;
+                            font-size: 12px;
+                          ">
+                          {{ item.storeLabels.visitTimes }}
+                        </p>
+                        <van-icon :name="ordernum" size="26" />
+                      </div>
+                      <el-table :data="item.userVisitTimesMap" border max-height="180px">
+                        <el-table-column label="业务员" prop="userName" />
+                        <el-table-column label="拜访次数" prop="visitTimes" width="110px" />
+                      </el-table>
+                    </el-popover> -->
+                  </div>
+                </div>
                 <div class="info">实际经营者:{{ item.customerManager }}</div>
                 <div class="info">开户日期:{{ formatCompactDate(item.openDate) }}</div>
                 <div class="info">是否冻结:{{ item.freeze }}</div>
@@ -222,6 +409,15 @@
         @cancel="moreTypeShow = false"
         visible-item-count="10" />
     </van-popup>
+    <van-popup v-model="SKUDateShow">
+      <div v-for="item in SKUList">
+        <p style="font-weight: bold; font-size: 14px">&nbsp;&nbsp;&nbsp;{{ item.m01Name }}</p>
+        <el-table :data="item.productDetailList" border style="width: 100%">
+          <el-table-column label="物料名称" prop="productName" />
+          <el-table-column label="规格" prop="productSku" />
+        </el-table>
+      </div>
+    </van-popup>
     <!-- 测试用 -->
     <!-- 下单系统 -->
     <div
@@ -256,7 +452,13 @@
 </template>
 
 <script>
-import { addVisitsPosition, mobileReposition, getStoreLabels, buryingPoint } from '@/api/index';
+import {
+  addVisitsPosition,
+  mobileReposition,
+  getStoreLabels,
+  buryingPoint,
+  getItemList,
+} from '@/api/index';
 import { getPosition, getTicketFun } from '@/utils/TXApiFun';
 import { mapState } from 'vuex';
 import store from '@/store';
@@ -327,12 +529,16 @@ export default {
       monthVisited: '', //本月是否拜访
       isMonthVisited: true,
       num: 1,
+      timeData: '',
+      SKUDateShow: false,
+      SKUList: [],
     };
   },
   created() {
     // 当前tabs,0:销售部;1:我的
     this.tabVal = localStorage.getItem('tabVal') == '0' ? '0' : '1';
     store.dispatch('setDeviceOutsidePage', false);
+    this.getMonth();
   },
   mounted() {
     if (this.deviceOutsidePage) this.initData();
@@ -352,6 +558,50 @@ export default {
     );
   },
   methods: {
+    getMonth() {
+      // 获取当前日期
+      var currentDate = new Date();
+
+      // 获取当前月份
+      var currentMonth = currentDate.getMonth();
+
+      // 获取当前年份
+      // var currentYear = currentDate.getFullYear();
+
+      var previousMonthDate1 = new Date();
+      if (currentDate.getDate() == 1) {
+        previousMonthDate1.setMonth(currentMonth - 1);
+      } else {
+      }
+      var previousMonth1 = previousMonthDate1.getMonth();
+      var previousYear1 = previousMonthDate1.getFullYear();
+
+      // 计算前三个月的年份和月份
+      var previousMonthDate = new Date();
+      if (currentDate.getDate() == 1) {
+        previousMonthDate.setMonth(currentMonth - 3);
+      } else {
+        previousMonthDate.setMonth(currentMonth - 2);
+      }
+      1;
+      var previousMonth = previousMonthDate.getMonth();
+      var previousYear = previousMonthDate.getFullYear();
+
+      //前三个月
+      if (previousYear1 == previousYear) {
+        var formattedPreviousMonth1 = previousYear1 + '-' + (previousMonth1 + 1);
+        // 格式化年份和月份
+        var formattedPreviousMonth = previousYear + '-' + (previousMonth + 1);
+        this.timeData =
+          formattedPreviousMonth.split('-')[1] + '-' + formattedPreviousMonth1.split('-')[1] + '月';
+      } else {
+        var formattedPreviousMonth1 = previousYear1 + '年' + (previousMonth1 + 1) + '月';
+        // .toString().padStart(2, '0');
+        // 格式化年份和月份
+        var formattedPreviousMonth = previousYear + '年' + (previousMonth + 1) + '月';
+        this.timeData = formattedPreviousMonth + '-' + formattedPreviousMonth1;
+      }
+    },
     onRefresh() {
       this.onSearch();
       this.isLoading = false;
@@ -927,6 +1177,16 @@ export default {
         this.num = this.num + 1;
       }
     },
+    linkList(val) {
+      getItemList({ storeCode: val.chainId }).then((res) => {
+        if (res.code == 200) {
+          this.SKUDateShow = true;
+          this.SKUList = res.data;
+        } else {
+          this.$toast.fail(res.msg);
+        }
+      });
+    },
   },
 };
 </script>

+ 180 - 0
src/views/agentList/visitHistoryDetail copy.vue

@@ -0,0 +1,180 @@
+<template>
+  <!-- 拜访历史详情 -->
+  <div class="visitHistoryDetail">
+    <div class="headers">
+      <van-nav-bar class="navBar" :title="$route.meta.title" left-arrow @click-left="onClickLeft">
+      </van-nav-bar>
+    </div>
+    <div class="container">
+      <div class="lineGrey"></div>
+      <div class="card mt10">
+        <div class="title">
+          {{ urlParameter.chainName }}(<span style="color: #1989fa">{{
+            urlParameter.chainCode
+          }}</span
+          >)
+        </div>
+        <div class="info">客户分类:{{ verifyChainType(urlParameter.typeCode2) }}</div>
+        <div class="info">实际经营者:{{ urlParameter.customerManager }}</div>
+        <div class="info">开户日期:{{ formatCompactDate(urlParameter.openDate) }}</div>
+        <div class="info">是否冻结:{{ urlParameter.freeze }}</div>
+        <div class="info">是否关户:{{ urlParameter.close }}</div>
+      </div>
+      <div style="padding: 10px 16px; font-size: 16px; font-weight: bold">任务</div>
+      <div class="card" v-if="list.visitSource != 2">
+        <div
+          class="info"
+          style="line-height: 44px; font-size: 14px"
+          v-for="(item, index) in list.sfaTaskList"
+          :key="index"
+          @click="historiStoreVisit(item, index)">
+          <p
+            style="
+              width: 94%;
+              margin: 0;
+              line-height: 24px;
+              padding: 10px 0;
+              display: inline-block;
+            ">
+            {{ item.taskName }}
+          </p>
+          <p class="arrowdetils1">
+            <van-icon name="arrow" />
+          </p>
+        </div>
+      </div>
+      <div v-if="list.visitSource == 2" style="background-color: #fff">
+        <van-cell title="异常事由" :value="selectDictLabel(typeList, list.abnormalReason)" />
+        <van-cell title="异常信息照" />
+        <div style="padding: 10px 16px 0">
+          <delete-upload-img :imgs="imgs"></delete-upload-img>
+        </div>
+        <van-cell title="异常信息" :value="list.remark" />
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import deleteUploadImg from '@/components/deleteUploadImg';
+import { getPhotoTypeList1 } from '@/api/index';
+import { getVisitsDetail } from '@/api/agentList';
+
+export default {
+  components: { deleteUploadImg },
+  data() {
+    return {
+      visitsId: '',
+      imgs: '',
+      typeList: [],
+      ListHistoryTOTLE: '',
+      managerRemarkContent: '',
+      updateTimeShow: false,
+      insert: true,
+      list: '',
+      urlParameter: null,
+      imgs: '',
+    };
+  },
+  created() {
+    this.urlParameter = this.$route.query;
+    this.getVisitsDetailFn();
+    this.getPhotoTypeList();
+  },
+  methods: {
+    getPhotoTypeList() {
+      getPhotoTypeList1({}).then((res) => {
+        this.typeList = res.data;
+      });
+    },
+    getVisitsDetailFn() {
+      getVisitsDetail({ visitsId: this.urlParameter.id }).then((res) => {
+        if (res.code == 200) {
+          this.list = res.data;
+          if (res.data.visitSource == 2) {
+            this.imgs = res.data.sysFileInfos;
+          }
+        } else {
+          this.$toast.fail(res.msg);
+        }
+      });
+    },
+    historiStoreVisit(val, index) {
+      this.$router.push({
+        path: '/visitedTaskDetail',
+        query: { ...this.urlParameter, activatedIndex: index, taskType: val.taskType },
+      });
+      sessionStorage.setItem('collectionItemList', JSON.stringify(val.collectionItemList));
+    },
+    onClickLeft() {
+      this.$router.go(-1);
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.visitHistoryDetail {
+  width: 100%;
+  height: 100%;
+  overflow: hidden;
+  display: flex;
+  flex-direction: column;
+  .container {
+    overflow-y: auto;
+    flex: 1;
+    margin-bottom: 10px;
+    background-color: white;
+    .custom-titles {
+      white-space: break-spaces;
+    }
+    .card {
+      background: #fff;
+      padding: 10px 15px;
+      box-sizing: border-box;
+      .title {
+        line-height: 30px;
+        font-size: 16px;
+        font-weight: bold;
+        color: #333;
+      }
+      .subtitle {
+        line-height: 24px;
+        font-size: 14px;
+        color: #7b7b7b;
+      }
+      .info {
+        font-size: 16px;
+        color: #484848;
+        line-height: 40px;
+        border-bottom: 1px solid #dedede;
+        position: relative;
+        &:last-child {
+          // border-bottom: 0;
+        }
+        .arrow {
+          float: right;
+          display: inline-block;
+          height: 20px;
+          width: 20px;
+          line-height: 20px;
+          text-align: center;
+          border-radius: 50%;
+          background: #1989fa;
+          color: #fff;
+          font-weight: bold;
+          font-size: 14px;
+          margin-top: 9px;
+        }
+        .arrowdetils1 {
+          background: #fff;
+          position: absolute;
+          top: 50%;
+          color: #444;
+          right: 0;
+          margin-top: -22px;
+        }
+      }
+    }
+  }
+}
+</style>

+ 262 - 67
src/views/agentList/visitHistoryDetail.vue

@@ -1,10 +1,23 @@
 <template>
-  <!-- 拜访历史详情 -->
-  <div class="visitHistoryDetail">
-    <div class="headers">
-      <van-nav-bar class="navBar" :title="$route.meta.title" left-arrow @click-left="onClickLeft">
-      </van-nav-bar>
-    </div>
+  <div>
+    <!--        顶部条-->
+    <van-nav-bar class="navBar" title="拜访任务" left-arrow @click-left="onClickLeft">
+      <template #right>
+        <span
+          style="
+            color: white;
+            background: #74a4d9;
+            display: block;
+            padding: 6px 10px;
+            border-radius: 6px;
+          "
+          @click="editorFn"
+          v-if="!remarkShow && sameDay"
+          >编辑</span
+        >
+      </template>
+    </van-nav-bar>
+    <!--        主体内容-->
     <div class="container">
       <div class="lineGrey"></div>
       <div class="card mt10">
@@ -20,6 +33,26 @@
         <div class="info">是否冻结:{{ urlParameter.freeze }}</div>
         <div class="info">是否关户:{{ urlParameter.close }}</div>
       </div>
+      <van-collapse
+        v-model="active"
+        class="fontWeit"
+        v-if="managerRemarkContents != null && managerRemarkContents.length > 0">
+        <van-collapse-item name="1" title="点评">
+          <p>
+            {{ managerRemarkContents[0].deptName }} - {{ managerRemarkContents[0].postName }} -
+            {{ managerRemarkContents[0].nickName }}的点评
+          </p>
+          <p class="contern">
+            <van-field
+              v-model="managerRemarkContents[0].remarkContent"
+              rows="4"
+              autosize
+              readonly
+              type="textarea" />
+          </p>
+          <p style="text-align: right">点评时间:{{ managerRemarkContents[0].createTime }}</p>
+        </van-collapse-item>
+      </van-collapse>
       <div style="padding: 10px 16px; font-size: 16px; font-weight: bold">任务</div>
       <div class="card" v-if="list.visitSource != 2">
         <div
@@ -51,6 +84,7 @@
         </div>
         <van-cell title="异常信息" :value="list.remark" />
       </div>
+
       <!-- <div style="padding: 10px 16px; font-size: 16px; font-weight: bold">更多记录</div>
       <van-cell-group>
         <van-cell v-for="(item1, index1) in list.visitsMore" :key="index1">
@@ -65,26 +99,63 @@
           </template>
         </van-cell>
       </van-cell-group> -->
+      <div
+        style="padding: 10px 16px; font-size: 16px; font-weight: bold"
+        v-if="managerRemarkContents == null && remarkShow">
+        点评
+      </div>
+      <div class="comment" v-if="managerRemarkContents == null && remarkShow">
+        <van-field
+          v-model="dataform.remarkContent"
+          rows="4"
+          autosize
+          maxlength="800"
+          show-word-limit
+          type="textarea"
+          :formatter="formatter" />
+        <br />
+        <br />
+        <div class="contentborder">
+          <van-button type="info" size="small" plain class="Btn1" @click="submint"
+            >提交点评</van-button
+          >
+        </div>
+      </div>
     </div>
   </div>
 </template>
 
 <script>
 import deleteUploadImg from '@/components/deleteUploadImg';
-import { getPhotoTypeList1 } from '@/api/index';
-import { getVisitsDetail } from '@/api/agentList';
+import {
+  getVisitsDetail,
+  getPhotoTypeList1,
+  insertVisitRemark,
+  getListHistoryList,
+} from '@/api/index';
 
 export default {
   components: { deleteUploadImg },
   data() {
     return {
+      userShow: false,
       visitsId: '',
       imgs: '',
       typeList: [],
+      active: ['1'],
+      sameDay: false,
       ListHistoryTOTLE: '',
+      managerRemarkContents: null,
       managerRemarkContent: '',
+      CWShow: false,
+      dataform: {
+        remarkContent: '',
+        visitsId: 0,
+      },
       updateTimeShow: false,
       insert: true,
+      remarkShow: false,
+      ListHistoryList: [],
       list: '',
       urlParameter: null,
       imgs: '',
@@ -96,6 +167,81 @@ export default {
     this.getPhotoTypeList();
   },
   methods: {
+    getListHistoryList(instanceId) {
+      var form = { visitsId: this.$route.query.visitId, pageNum: 1, pageSize: 999 };
+      getListHistoryList(form).then((res) => {
+        this.ListHistoryList = res.data;
+      });
+    },
+    formatter(value) {
+      return value.replace(
+        /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/gi,
+        ''
+      );
+    },
+    editorFn() {
+      if (this.list.hideStr != '' && this.list.hideStr != null) {
+        this.$toast(this.list.hideStr);
+      } else {
+        localStorage.setItem('ORGName', this.list.deptName);
+        localStorage.setItem('chainNameR', this.list.storeName);
+        if (this.list.visitSource == '2') {
+          this.$router.push({
+            path: '/abnormalVisit',
+            query: {
+              type: 'edit',
+              storeCode: this.$route.query.storeCode || this.list.storeCode,
+              rdId: this.$route.query.visitId,
+              visitId: this.$route.query.visitId,
+              storeId: this.list.storeId,
+              visitSource: this.list.visitSource,
+              visitModel: this.list.visitModel,
+              marklat: this.list.lat,
+              marklon: this.list.lon,
+            },
+          });
+        } else {
+          var LCshow = false;
+          if (this.$route.query.taskId != null) {
+            LCshow = true;
+          } else {
+            LCshow = false;
+          }
+          this.$router.push({
+            path: '/storeVisitpage',
+            query: {
+              type: 'edit',
+              storeGroupId: this.list.storeGroupId,
+              storeCode: this.$route.query.storeCode || this.list.storeCode,
+              storeName: this.list.storeName,
+              addressLine: this.list.addressLine,
+              rdId: this.$route.query.visitId,
+              visitId: this.$route.query.visitId,
+              storeId: this.list.storeId,
+              visitSource: this.list.visitSource,
+              visitModel: this.list.visitModel,
+              LCshow: LCshow,
+              instanceId: this.list.instanceId,
+              taskId: this.$route.query.taskId,
+              marklat: this.list.lat,
+              marklon: this.list.lon,
+              from: 'outPlan',
+            },
+          });
+        }
+      }
+    },
+    submint() {
+      if (this.dataform.remarkContent.trim() == '') {
+        this.$toast('请填写点评内容!');
+      } else {
+        insertVisitRemark(this.dataform).then((res) => {
+          if (res.code == 200) {
+            this.getVisitsDetailFn();
+          }
+        });
+      }
+    },
     getPhotoTypeList() {
       getPhotoTypeList1({}).then((res) => {
         this.typeList = res.data;
@@ -105,6 +251,38 @@ export default {
       getVisitsDetail({ visitsId: this.urlParameter.id }).then((res) => {
         if (res.code == 200) {
           this.list = res.data;
+          if (res.data.visitSource != 2) {
+            // this.getListHistoryList(res.data.instanceId);
+          }
+          if (res.data.stopTime != res.data.updateTime) {
+            this.updateTimeShow = true;
+          } else {
+            this.updateTimeShow = false;
+          }
+          if (localStorage.getItem('userId') == this.$route.query.userId) {
+            this.userShow = true;
+          } else {
+            this.userShow = false;
+          }
+          if (this.$route.query.taskId != null) {
+            this.CWShow = true;
+          } else {
+            this.CWShow = false;
+          }
+          this.sameDay = res.data.sameDay;
+          if (localStorage.getItem('userId') == res.data.userId) {
+            this.remarkShow = false;
+          } else {
+            this.remarkShow = true;
+          }
+          if (res.data.visitRemarks != null) {
+            if (res.data.visitRemarks.length > 0) {
+              this.managerRemarkContents = res.data.visitRemarks;
+            } else {
+              this.managerRemarkContents = null;
+            }
+          }
+
           if (res.data.visitSource == 2) {
             this.imgs = res.data.sysFileInfos;
           }
@@ -127,68 +305,85 @@ export default {
 };
 </script>
 <style lang="scss" scoped>
-.visitHistoryDetail {
-  width: 100%;
-  height: 100%;
-  overflow: hidden;
-  display: flex;
-  flex-direction: column;
-  .container {
-    overflow-y: auto;
-    flex: 1;
-    margin-bottom: 10px;
-    background-color: white;
-    .custom-titles {
-      white-space: break-spaces;
+.container {
+  padding-bottom: 50px;
+}
+.container .custom-titles {
+  white-space: break-spaces;
+}
+.card {
+  background: #fff;
+  padding: 10px 15px;
+  box-sizing: border-box;
+  .title {
+    line-height: 30px;
+    font-size: 16px;
+    font-weight: bold;
+    color: #333;
+  }
+  .subtitle {
+    line-height: 24px;
+    font-size: 14px;
+    color: #7b7b7b;
+  }
+  .info {
+    font-size: 16px;
+    color: #484848;
+    line-height: 40px;
+    border-bottom: 1px solid #dedede;
+    position: relative;
+    &:last-child {
+      border-bottom: 0;
+    }
+    .arrow {
+      float: right;
+      display: inline-block;
+      height: 20px;
+      width: 20px;
+      line-height: 20px;
+      text-align: center;
+      border-radius: 50%;
+      background: #1989fa;
+      color: #fff;
+      font-weight: bold;
+      font-size: 14px;
+      margin-top: 9px;
     }
-    .card {
+    .arrowdetils1 {
       background: #fff;
-      padding: 10px 15px;
-      box-sizing: border-box;
-      .title {
-        line-height: 30px;
-        font-size: 16px;
-        font-weight: bold;
-        color: #333;
-      }
-      .subtitle {
-        line-height: 24px;
-        font-size: 14px;
-        color: #7b7b7b;
-      }
-      .info {
-        font-size: 16px;
-        color: #484848;
-        line-height: 40px;
-        border-bottom: 1px solid #dedede;
-        position: relative;
-        &:last-child {
-          // border-bottom: 0;
-        }
-        .arrow {
-          float: right;
-          display: inline-block;
-          height: 20px;
-          width: 20px;
-          line-height: 20px;
-          text-align: center;
-          border-radius: 50%;
-          background: #1989fa;
-          color: #fff;
-          font-weight: bold;
-          font-size: 14px;
-          margin-top: 9px;
-        }
-        .arrowdetils1 {
-          background: #fff;
-          position: absolute;
-          top: 50%;
-          color: #444;
-          right: 0;
-          margin-top: -22px;
-        }
-      }
+      position: absolute;
+      top: 50%;
+      color: #444;
+      right: 0;
+      margin-top: -22px;
+    }
+  }
+}
+.TCFXList {
+  .van-field__control--custom {
+    flex-direction: column;
+    align-items: self-start;
+    .TCFXListTreeSelec {
+      padding: 3px;
     }
   }
 }
 </style>
+<style>
+.fontWeit .van-cell__title {
+  font-weight: bold;
+  font-size: 16px;
+}
+.fontWeit .van-cell__title p {
+  margin: 0;
+}
+.comment .van-field__control {
+  background-color: #ebf4ff;
+  border-radius: 6px;
+}
+.contern .van-cell {
+  background-color: #ebf4ff;
+  border-radius: 6px;
+  overflow: hidden;
+}
+</style>

+ 2 - 0
src/views/home/index.vue

@@ -36,7 +36,9 @@ export default {
   },
   methods: {
     getVisitCollapse() {
+      this.toastLoading(0, '加载中...', true);
       chainTargetList().then((res) => {
+        this.toastLoading().clear();
         if (res.code == 200) {
           this.visitCollapse = res.data;
         }

+ 390 - 0
src/views/home/noVisit.vue

@@ -0,0 +1,390 @@
+<template>
+  <div class="noVisit">
+    <div class="header">
+      <van-nav-bar class="navBar" title="未拜访门店" left-arrow @click-left="onClickLeft" />
+    </div>
+    <div class="content">
+      <van-collapse v-model="activeName" accordion @change="collapseCange">
+        <van-collapse-item v-for="(val, ind) in list" :key="ind" :name="val.targetName">
+          <template #title>
+            <div class="title">{{ val.targetName }}</div>
+            <div class="num">{{ val.num }}家</div>
+          </template>
+          <div class="itemContent">
+            <template v-if="val.chainList && val.chainList.length">
+              <div class="item" v-for="(item, index) in val.chainList" :key="index">
+                <div class="itemLeft">
+                  <div class="storeName">
+                    {{ item.chainName }}
+                    <span>({{ item.chainCode }})</span>
+                  </div>
+                  <!-- <div class="address">
+                    <van-icon name="location-o" />
+                    {{ item.addressLine }}
+                  </div> -->
+                  <!-- <div class="distance" v-if="item.storeLonExist">
+                    (距离{{ Micrometer(item.distance) }}m)
+                  </div> -->
+                  <div class="bottomBtnBox">
+                    <div class="toVisit" @click="storeVisit(item)">
+                      进入拜访 <van-icon name="arrow" />
+                    </div>
+                  </div>
+                </div>
+              </div>
+            </template>
+            <van-empty description="暂无数据" v-else />
+          </div>
+        </van-collapse-item>
+      </van-collapse>
+    </div>
+  </div>
+</template>
+<script>
+import { addVisitsPosition, mobileReposition } from '@/api/index';
+import { chainNoVisitList } from '@/api/visitapi';
+import { checkChainsAddressByChainCode } from '@/api/agentList';
+import { getPosition, getTicketFun } from '@/utils/TXApiFun';
+import { mapState } from 'vuex';
+import store from '@/store';
+export default {
+  name: 'noVisit',
+  computed: {
+    ...mapState({
+      activaTypeStore: (state) => state.user.activaTypeStore,
+    }),
+  },
+  data() {
+    return {
+      activeName: '',
+      list: {},
+      TXPiont: {}, //腾讯定位数据
+      TXisBD: {}, // 腾讯定位数据转百度
+      activatStoreVal: {}, //当前点击门店数据
+      clickIsFlage: true,
+    };
+  },
+  created() {
+    // 授权
+    getTicketFun().then(() => {
+      // 获取定位
+      getPosition()
+        .then((res) => {
+          let { TXisBD } = res;
+          this.getList(TXisBD);
+        })
+        .catch((error) => {
+          this.$dialog.alert({
+            message: error,
+          });
+        });
+    });
+    this.activeName = this.activaTypeStore || '';
+  },
+  methods: {
+    collapseCange(value) {
+      store.dispatch('setActivaTypeStore', value);
+    },
+    getList(TXisBD) {
+      this.toastLoading(0, '加载中...', true);
+      chainNoVisitList({
+        lat: TXisBD.lat,
+        lon: TXisBD.lon,
+      }).then((res) => {
+        this.toastLoading().clear();
+        this.list = res.data;
+        console.log(this.list);
+      });
+    },
+    tabChange(val) {},
+    // 进入拜访
+    storeVisit(val) {
+      if (!this.clickIsFlage) return;
+      this.clickIsFlage = false;
+      this.toastLoading(0, '加载中...', true);
+      this.activatStoreVal = val;
+      // 拜访时重新获取定位
+      getPosition()
+        .then((res) => {
+          let { TXisBD, resData } = res;
+          this.TXisBD = TXisBD;
+          this.TXPiont = resData;
+          localStorage.setItem('lat', TXisBD.lat);
+          localStorage.setItem('lon', TXisBD.lon);
+          this.checkStoreAddressByStoreCodeFun();
+        })
+        .catch((error) => {
+          this.clickIsFlage = true;
+          this.$dialog.alert({
+            message: error,
+          });
+        });
+    },
+    checkStoreAddressByStoreCodeFun() {
+      this.toastLoading(0, '加载中...', true);
+      let PointSumval = this.twoPointSum(
+        this.TXisBD.lat,
+        this.TXisBD.lon,
+        this.TXisBD.lat,
+        this.TXisBD.lon
+      ).toFixed(2);
+      checkChainsAddressByChainCode({
+        chainId: this.activatStoreVal.chainId,
+        lon: this.TXisBD.lon,
+        lat: this.TXisBD.lat,
+      })
+        .then((response) => {
+          this.clickIsFlage = true;
+          // 门店校验 地址不通过
+          if (response.code != 200) {
+            this.toastLoading().clear();
+            // updateAddress : ,1:同城AB+金牌,去修改地址;2:非金牌店铺,非同城店铺偏差过大不允许拜访,可以重置定位;0非金牌店铺,非同城店铺 位置信息不存在 可以继续拜访
+            if (response.data) {
+              if (response.data.updateAddress == 0) {
+                // 非金牌店铺,非同城店铺 位置信息不存在 可以继续拜访
+                this.$dialog
+                  .confirm({
+                    confirmButtonText: '确定拜访',
+                    cancelButtonText: '取消拜访',
+                    title: '系统提示',
+                    message:
+                      '该客户没有经纬度,此次拜访会保存定位点作为客户经纬度,下次拜访时判断是否偏差过大。',
+                    closeOnClickOverlay: true,
+                  })
+                  .then(() => {
+                    this.toSuishenbangOutstoreVisit(PointSumval);
+                  });
+              } else if (response.data.updateAddress == 1) {
+                // 同城AB+金牌,去修改地址
+                // addressUpdateTimesOver: true=已经达到最大次数,不让修改; false=没有达到可以修改
+                if (!response.data.addressUpdateTimesOver) {
+                  this.$dialog
+                    .confirm({
+                      title: '系统提示',
+                      message: response.msg + '请立即修改后再拜访',
+                      messageAlign: 'left',
+                      confirmButtonText: '立即修改',
+                      cancelButtonText: '取消',
+                    })
+                    .then(() => {
+                      this.$router.push({
+                        path: '/storeDetail',
+                        query: {
+                          id: this.activatStoreVal.storeId,
+                          type: 'address',
+                          storeAddressId: this.activatStoreVal.storeAddressId,
+                        },
+                      });
+                    });
+                } else {
+                  this.$dialog.confirm({
+                    title: '系统提示',
+                    message: '已经达到最大修改次数',
+                    messageAlign: 'left',
+                    confirmButtonText: '确定',
+                  });
+                }
+              } else if (response.data.updateAddress == 2) {
+                // 1.非金牌店铺,非同城店铺 位置偏差过大 重置经纬度
+                this.resetCoord(PointSumval);
+                return;
+              }
+            } else {
+              this.$dialog.confirm({
+                title: '系统提示',
+                message: response.msg,
+                showCancelButton: false,
+                confirmButtonText: '确定',
+              });
+            }
+          } else {
+            // 门店编码校验门店地址通过 进入拜访
+            this.toSuishenbangOutstoreVisit(PointSumval);
+          }
+        })
+        .catch((error) => {
+          this.clickIsFlage = true;
+        });
+    },
+    // 进入拜访
+    toSuishenbangOutstoreVisit(PointSumval) {
+      addVisitsPosition({
+        chainId: this.activatStoreVal.chainId,
+        visitsId: '',
+        lon: this.TXPiont.longitude,
+        lat: this.TXPiont.latitude,
+        sourceLon: this.TXisBD.lon,
+        sourceLat: this.TXisBD.lat,
+        positionDesc: '',
+        accuracy: this.TXPiont.accuracy,
+      });
+      this.clickIsFlage = true;
+      this.toastLoading().clear();
+      this.$router.push({
+        path: '/visitPage',
+        query: {
+          chainId: this.activatStoreVal.chainId,
+          rdId: this.activatStoreVal.rdId,
+          lat: this.TXisBD.lat,
+          lon: this.TXisBD.lon,
+          visitId: this.activatStoreVal.visitId,
+          pageType: 'out',
+          addressLine: this.activatStoreVal.addressLine,
+          storeCategory: this.activatStoreVal.storeCategoryName,
+          chainName: this.activatStoreVal.chainName,
+          hisTime: this.activatStoreVal.hisTime,
+          contactName: this.activatStoreVal.contactName,
+          chainCode: this.activatStoreVal.chainCode,
+          visitModel: '1',
+          latNew: this.TXisBD.lat,
+          lonNew: this.TXisBD.lon,
+          PointSum: PointSumval,
+          marklat: this.TXPiont.latitude,
+          marklon: this.TXPiont.longitude,
+          from: 'outPlan',
+        },
+      });
+    },
+    // 重置经纬度
+    resetCoord(PointSumval) {
+      this.$dialog
+        .confirm({
+          confirmButtonText: '初始化定位',
+          cancelButtonText: '取消拜访',
+          title: '系统提示',
+          message: '偏差过大,不允许拜访。可修改本店定位.',
+          closeOnClickOverlay: true,
+        })
+        .then(() => {
+          mobileReposition({
+            chainId: this.activatStoreVal.chainId,
+            lat: this.TXisBD.lat,
+            lon: this.TXisBD.lon,
+          }).then((response) => {
+            if (response.code == 200) {
+              this.$dialog
+                .alert({
+                  title: '系统提示',
+                  message: '本信息定位已更新成功!',
+                })
+                .then(() => {
+                  this.toSuishenbangOutstoreVisit(PointSumval);
+                });
+              localStorage.setItem('startTime', new Date());
+              localStorage.setItem('ORGName', this.activatStoreVal.deptName);
+              localStorage.setItem('chainNameR', this.activatStoreVal.storeName);
+            } else {
+              this.$toast(response.msg);
+            }
+          });
+        });
+    },
+    onClickLeft() {
+      this.$router.go(-1);
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.noVisit {
+  height: 100%;
+  width: 100%;
+  /* overflow-y: auto; */
+  .content {
+    padding: 8px 10px;
+    .item {
+      background: #deedff;
+      padding: 8px;
+      margin: 10px 0;
+      border-radius: 5px;
+      display: flex;
+      position: relative;
+      .storeName {
+        font-size: 15px;
+        font-weight: bold;
+        color: #333;
+        padding: 3px 0;
+        width: 80%;
+      }
+      .address,
+      .distance {
+        font-size: 14px;
+        color: #909090;
+        padding: 3px 0;
+      }
+      .distance {
+        // padding-left: 12px;
+      }
+      .itemLeft {
+        flex: 1;
+        .bottomBtnBox {
+          display: flex;
+          justify-content: flex-end;
+          align-items: center;
+          .toVisit {
+            height: 32px;
+            font-size: 15px;
+            color: #1989fa;
+            display: flex;
+            align-items: center;
+            white-space: nowrap;
+          }
+          .joinVisit {
+            span {
+              display: inline-block;
+              border-radius: 20px;
+              padding: 5px 10px;
+              background: #1989fa;
+              color: #fff;
+            }
+          }
+        }
+      }
+      .itemRight {
+        position: absolute;
+        right: 0;
+        .statstext {
+          background-color: #0057ba;
+          padding: 2px 6px 2px 12px;
+          border-bottom-left-radius: 60px;
+          border-top-left-radius: 60px;
+          color: #fff;
+          width: 60px;
+          // margin-right: -8px;
+          /* overflow: hidden; */
+          white-space: nowrap;
+          .van-icon__image {
+            height: 0.7em;
+          }
+        }
+      }
+    }
+  }
+  .van-collapse-item {
+    border-bottom: 1px solid #dcdcdc;
+  }
+}
+</style>
+<style lang="scss">
+.noVisit {
+  .van-cell__title {
+    font-size: 15px;
+    font-weight: bold;
+    color: #333;
+    display: flex;
+    justify-content: space-between;
+    .num {
+      color: #909090;
+      margin-right: 5px;
+    }
+  }
+  .van-collapse-item__wrapper {
+    border-top: 1px solid #dcdcdc;
+  }
+  .van-collapse-item__title--expanded {
+    position: sticky;
+    top: 0px;
+    z-index: 10;
+  }
+}
+</style>

+ 68 - 27
src/views/home/visitCollapse.vue

@@ -1,27 +1,24 @@
 <template>
   <div class="visitCollapse">
     <div class="visitCollapse-box" v-for="(item, index) in visitCollapse" :key="index">
-      <div class="targetName" v-if="item.targetName">{{ item.targetName }}</div>
+      <div class="targetName" :style="setTargetNameStyle(item.targetName)" v-if="item.targetName">
+        {{ item.targetName }}
+      </div>
       <div class="child" v-if="item.children">
-        <div
-          :class="['children-item', item1.targetLevel !== 2 ? 'targetLevel' : '']"
-          v-for="(item1, index1) in item.children"
-          :key="index1">
-          <template v-if="item1.targetLevel == 2">
-            <div class="child-targetName" v-if="item1.targetName">
-              {{ item1.targetName }}
-            </div>
-            <template v-if="item1.children">
-              <div class="value-box">
-                <div class="value" v-for="(item2, index2) in item1.children" :key="index2">
-                  {{ item2.targetName }}
-                </div>
+        <div :class="['children-item']" v-for="(item1, index1) in item.children" :key="index1">
+          <div class="child-targetName" v-if="item1.targetName">
+            {{ item1.targetName }}
+          </div>
+          <template v-if="item1.children">
+            <div class="target-box">
+              <div
+                :class="['target', item2.targetName == '未拜访' ? 'clickTarget' : '']"
+                v-for="(item2, index2) in item1.children"
+                :key="index2"
+                @click="clickTarget(item, item1, item2)">
+                <div class="target-label">{{ item2.targetName }}</div>
+                <div :class="['target-value']">{{ item2.targetValue }}</div>
               </div>
-            </template>
-          </template>
-          <template v-else>
-            <div class="value" v-if="item1.targetName">
-              {{ item1.targetName }}
             </div>
           </template>
         </div>
@@ -30,6 +27,7 @@
   </div>
 </template>
 <script>
+import store from '@/store';
 export default {
   name: 'visitCollapse',
   props: {
@@ -42,20 +40,63 @@ export default {
     return {};
   },
   created() {},
-  methods: {},
+  methods: {
+    setTargetNameStyle(targetName) {
+      let style = {};
+      if (targetName == '片区经销商') {
+        style.background = '#bd3124';
+      } else if (targetName == '非片经销商') {
+        style.background = '#cba43f';
+      }
+      return style;
+    },
+    clickTarget(item, item1, item2) {
+      store.dispatch(
+        'setActivaTypeStore',
+        item1.targetName ? item1.targetName + '经销商' : item.targetName
+      );
+      if (item2.targetName != '未拜访') return;
+      this.$router.push({
+        path: '/noVisit',
+      });
+    },
+  },
 };
 </script>
 <style lang="scss" scoped>
 .visitCollapse {
   .visitCollapse-box {
-    .value-box {
-      // display: flex;
-      .value {
-        float: left;
-      }
+    .targetName {
+      width: 120px;
+      padding: 8px 10px;
+      color: #fff;
+      text-align: center;
+      border-radius: 3px;
+    }
+    .child {
+      padding-top: 10px;
     }
-    .targetLevel {
-      float: left;
+    .children-item {
+      .child-targetName {
+        // padding-top: 10px;
+        padding-bottom: 5px;
+      }
+      .target-box {
+        overflow: hidden;
+        padding-bottom: 8px;
+        .target {
+          width: 30%;
+          float: left;
+          .target-value {
+            padding-left: 10px;
+          }
+        }
+        .clickTarget {
+          .target-value {
+            color: #1989fa;
+          }
+        }
+      }
     }
   }
 }

+ 1 - 0
src/views/info/index.vue

@@ -64,6 +64,7 @@ export default {
       });
       getReportInfo({ isContent: false }).then((res) => {
         loading1.clear();
+        localStorage.setItem('powerGrade', res.data.positionId);
       });
     },
     login() {

+ 291 - 0
src/views/info/infoHistorVisit copy.vue

@@ -0,0 +1,291 @@
+<template>
+  <div class="bgcolor infoHistorVisit">
+    <div class="header">
+      <van-nav-bar class="navBar" title="经销商拜访" left-arrow @click-left="onClickLeft" />
+    </div>
+    <div class="container">
+      <van-list
+        class="myList1"
+        v-model="loading"
+        :finished="finished"
+        finished-text="没有更多了"
+        @load="onLoad">
+        <div v-if="list.length > 0">
+          <div class="cellcontent" v-for="(item, index) in list" :key="index">
+            <van-cell>
+              <div class="card" style="position: relative" @click="detilsFn(item)">
+                <span v-if="item.visitSource == 2" class="stateAbnormal">异常拜访</span>
+                <span v-if="item.visitSource == 1" class="state">正常拜访</span>
+                <div class="title">
+                  <span>{{ item.chainName }}</span> (<span style="color: #0057ba">{{
+                    item.chainCode
+                  }}</span
+                  >)
+                </div>
+                <div class="info">经销商类型:{{ verifyChainType(item.typeCode2) }}</div>
+                <div class="info">拜访人:{{ item.nickName }}</div>
+                <div class="info">拜访时间:{{ item.visitsTime }}</div>
+              </div>
+            </van-cell>
+            <div class="lineGrey"></div>
+          </div>
+        </div>
+      </van-list>
+    </div>
+  </div>
+</template>
+
+<script>
+import { myChainsVisits } from '@/api/info';
+
+export default {
+  name: 'infoHistorVisit',
+  data() {
+    return {
+      list: [],
+      loading: false,
+      finished: true,
+      pageNum: 1, // 当前页码  int类型
+      pageSize: 10, // 当前每页条数  int类型
+    };
+  },
+  created() {
+    this.pageNum = 1;
+    this.list = [];
+    this.powerGrade = localStorage.getItem('powerGrade');
+    this.getVisitsListFn();
+  },
+  methods: {
+    onLoad() {
+      this.getVisitsListFn();
+    },
+    detilsFn(val) {
+      this.$router.push({
+        path: '/visitHistoryDetail',
+        query: {
+          id: val.id,
+          typeCode2: val.typeCode2,
+          chainId: val.chainId,
+          customerManager: val.customerManager,
+          close: val.close,
+          freeze: val.freeze,
+          visitId: val.visitId,
+          chainName: val.chainName,
+          chainCode: val.chainCode,
+          openDate: val.openDate,
+        },
+      });
+    },
+    onClickLeft() {
+      this.$router.go(-1);
+    },
+    getVisitsListFn() {
+      let loading1 = this.$toast.loading({
+        duration: 0,
+        message: '数据获取中...',
+        forbidClick: true,
+      });
+      if (this.refreshing) {
+        this.list = [];
+        this.refreshing = false;
+      }
+      myChainsVisits({
+        pageNum: this.pageNum,
+        pageSize: this.pageSize,
+      }).then((res) => {
+        loading1.clear();
+        if (res.code == 200) {
+          this.loading = false;
+          this.list = this.list.concat(res.rows);
+          if (this.list.length >= res.total) {
+            this.finished = true;
+          } else {
+            this.finished = false;
+          }
+          this.pageNum = this.pageNum + 1;
+        } else {
+          this.$toast.fail(res.msg);
+        }
+      });
+    },
+  },
+};
+</script>
+<style lang="scss">
+.searchDiv {
+  .van-search {
+    background: #fff;
+  }
+  .van-search__action {
+    font-size: 14px;
+    color: #1989fa;
+    font-weight: bold;
+    background: #f5f5f5;
+    border-bottom-right-radius: 60px;
+    border-top-right-radius: 60px;
+    border: 1px solid #ccc;
+    padding: 0 20px;
+  }
+
+  .van-search--show-action {
+    padding-right: 12px;
+  }
+
+  .van-search__content {
+    border: 1px solid #ccc;
+    border-bottom-left-radius: 60px;
+    border-top-left-radius: 60px;
+    background: #f5f5f5;
+    border-right: 0;
+  }
+}
+
+.myList1 {
+  .van-cell {
+    padding: 10px 16px;
+
+    &:after {
+      border-bottom: none;
+    }
+  }
+}
+.historAllVisit {
+  .TCFXListItem {
+    display: inline-block;
+    border: 1px solid #ccc;
+    padding: 3px 5px;
+    margin: 0 5px;
+    border-radius: 6px;
+  }
+}
+</style>
+<style lang="scss" scoped>
+.infoHistorVisit {
+  height: 100%;
+  width: 100%;
+  display: flex;
+  flex-direction: column;
+  overflow: hidden;
+}
+.bgcolor {
+  background-color: #f5f5f5;
+}
+
+.container {
+  overflow-y: auto;
+  flex: 1;
+  padding-bottom: 10px;
+}
+
+.monthNow {
+  height: 34px;
+  line-height: 34px;
+  text-align: left;
+  font-weight: bold;
+  padding: 0 16px;
+  box-sizing: border-box;
+  background-color: #f1f1f1;
+  border-radius: 20px;
+  margin: 8px;
+  border: 1px solid #ccc;
+  position: relative;
+  color: #333;
+  font-size: 14px;
+  .van-cell__left-icon,
+  .van-cell__right-icon {
+    line-height: 34px;
+  }
+  .CalendarIcon {
+    float: right;
+    font-size: 24px;
+    color: #1989fa;
+    margin-top: 6px;
+    position: absolute;
+    right: 12px;
+    img {
+      height: 0.8em;
+    }
+  }
+}
+.serchInput {
+  padding: 0 4px;
+}
+.selectcell {
+  width: 92%;
+}
+.card {
+  box-sizing: border-box;
+
+  .title {
+    font-size: 16px;
+    font-weight: bold;
+    color: #333;
+    line-height: 30px;
+    width: 78%;
+  }
+
+  .info {
+    font-size: 14px;
+    color: #909090;
+    line-height: 26px;
+  }
+}
+
+/**/
+.searcTime {
+  background-color: white;
+}
+.btnbox {
+  padding: 0 16px;
+}
+.cellcontent .centerBtn {
+  margin: 0 auto 10px;
+  display: block;
+  width: 92%;
+  border-radius: 5px;
+}
+
+.statstext {
+  background-color: #1c84c6;
+  position: absolute;
+  right: 0;
+  top: 16px;
+  padding: 2px 6px 2px 12px;
+  border-bottom-left-radius: 60px;
+  border-top-left-radius: 60px;
+  color: #fff;
+}
+
+.stateAbnormal {
+  position: absolute;
+  right: 0;
+  top: 0;
+  color: #fff;
+  background-color: red;
+  border-radius: 5px;
+  display: inline-block;
+  padding: 0 5px;
+}
+
+.state {
+  position: absolute;
+  right: 0;
+  top: 0;
+  color: #fff;
+  background-color: #1c84c6;
+  border-radius: 5px;
+  display: inline-block;
+  padding: 0 5px;
+}
+
+.navBarTOP {
+  position: fixed;
+  width: 100%;
+  z-index: 2;
+  top: 0;
+}
+.cellcontent .textRight {
+  float: right;
+  color: #0057ba;
+}
+</style>

+ 435 - 18
src/views/info/infoHistorVisit.vue

@@ -1,9 +1,67 @@
 <template>
-  <div class="bgcolor infoHistorVisit">
-    <div class="header">
-      <van-nav-bar class="navBar" title="经销商拜访" left-arrow @click-left="onClickLeft" />
+  <div class="bgcolor historAllVisit">
+    <div class="navBarTOP">
+      <!--        顶部条-->
+      <van-nav-bar class="navBar" title="历史拜访" left-arrow @click-left="onClickLeft" />
+      <div class="searcTime">
+        <van-row class="serchInput">
+          <van-col span="12">
+            <van-cell
+              class="monthNow selectcell"
+              :title="companyName"
+              is-link
+              arrow-direction="down"
+              @click="regionClick" />
+          </van-col>
+          <van-col span="12">
+            <van-cell
+              class="monthNow selectcell"
+              :title="regionName"
+              is-link
+              @click="SalesRegionClick"
+              arrow-direction="down" />
+          </van-col>
+          <van-col span="12">
+            <van-cell
+              class="monthNow selectcell"
+              :title="deptName"
+              is-link
+              @click="SalesDepartmentClick"
+              arrow-direction="down" />
+          </van-col>
+          <van-col span="12">
+            <van-cell
+              class="monthNow selectcell"
+              :title="userName"
+              is-link
+              @click="StaffClick"
+              arrow-direction="down" />
+          </van-col>
+          <van-col span="12">
+            <div class="monthNow" @click="startTimeshow = true">
+              <span class="month">{{ startTime }}</span>
+              <!-- <van-icon class="CalendarIcon" :name="timeico" /> -->
+            </div>
+          </van-col>
+          <van-col span="12">
+            <div class="monthNow" @click="endTimeshow = true">
+              <span class="month">{{ endTime }}</span>
+              <!-- <van-icon class="CalendarIcon" :name="timeico" /> -->
+            </div>
+          </van-col>
+        </van-row>
+      </div>
+      <div class="searchDiv">
+        <van-search v-model="storeName" show-action placeholder="搜索名称/编号/地址/拜访人">
+          <template #action>
+            <div @click="onSearch">搜索</div>
+          </template>
+        </van-search>
+      </div>
+      <div class="lineGrey"></div>
     </div>
-    <div class="container">
+    <!--        主体内容-->
+    <div class="container" style="margin-top: 262px">
       <van-list
         class="myList1"
         v-model="loading"
@@ -22,43 +80,239 @@
                   }}</span
                   >)
                 </div>
-                <div class="info">经销商类型:{{ verifyChainType(item.typeCode2) }}</div>
                 <div class="info">拜访人:{{ item.nickName }}</div>
-                <div class="info">拜访时间:{{ item.visitsTime }}</div>
+                <div class="info">
+                  拜访时间:{{ item.visitsTime }}
+                  <span class="textRight" v-if="item.status == '1' && item.taskId == null"
+                    >审批中</span
+                  >
+                  <span
+                    class="textRight"
+                    v-if="item.status == '1' && item.taskId != null"
+                    style="color: red"
+                    >退回修改</span
+                  >
+                  <span class="textRight" style="color: #07c160" v-if="item.status == 2"
+                    >审批完成</span
+                  >
+                  <span class="textRight" v-if="item.status == '3'" style="color: red">拒绝</span>
+                </div>
+                <div class="info" v-if="item.dwellTime">拜访时长:{{ item.dwellTime }}</div>
+                <div class="info">地址:{{ item.addressLine }}</div>
               </div>
+              <!-- 分销店 -->
+              <template
+                v-if="
+                  item.sfaStoreType &&
+                  item.sfaStoreType.type == 'fxd' &&
+                  item.sfaStoreChainsContactList
+                ">
+                <div class="info">
+                  经销商:
+                  <div class="TCFXListItem" v-for="(item, index) in item.sfaStoreChainsContactList">
+                    <el-popover
+                      popper-class="zpover zpoverStoreztype"
+                      placement="bottom-start"
+                      trigger="click">
+                      <div>
+                        <div>{{ item.chainCode }}</div>
+                        <div>{{ item.chainName }}</div>
+                      </div>
+                      <div slot="reference" :key="index">
+                        {{ item.categoryDescribe }}
+                      </div>
+                    </el-popover>
+                  </div>
+                </div>
+              </template>
+              <template v-else>
+                <div class="info">经销商:{{ item.chainName }}</div>
+              </template>
             </van-cell>
             <div class="lineGrey"></div>
           </div>
         </div>
       </van-list>
     </div>
+    <van-popup v-model="startTimeshow" position="bottom" :style="{ height: '30%' }">
+      <van-datetime-picker
+        v-model="startcurrentDate"
+        type="date"
+        title="开始日期"
+        :min-date="minDate"
+        :max-date="startmaxDate"
+        @confirm="dateeconfirm"
+        @cancel="startTimeshow = false" />
+    </van-popup>
+    <van-popup v-model="endTimeshow" position="bottom" :style="{ height: '50%' }">
+      <van-datetime-picker
+        v-model="currentDate"
+        type="date"
+        title="开始日期"
+        :min-date="endminDate"
+        :max-date="maxDate"
+        @confirm="endTimeconfirm"
+        @cancel="endTimeshow = false" />
+    </van-popup>
+    <van-popup v-model="RegionShow" capture position="bottom">
+      <van-picker
+        show-toolbar
+        :columns="companyList"
+        value-key="deptName"
+        @confirm="onregionConfirm"
+        @cancel="RegionShow = false" />
+    </van-popup>
+    <van-popup v-model="SalesRegionShow" capture position="bottom">
+      <van-picker
+        show-toolbar
+        :columns="regionList"
+        value-key="deptName"
+        @confirm="onSalesRegionConfirm"
+        @cancel="SalesRegionShow = false" />
+    </van-popup>
+    <van-popup v-model="SalesDepartmentShow" capture position="bottom">
+      <van-picker
+        show-toolbar
+        :columns="deptList"
+        value-key="deptName"
+        @confirm="onSalesDepartmentConfirm"
+        @cancel="SalesDepartmentShow = false" />
+    </van-popup>
+    <van-popup v-model="StaffShow" capture position="bottom">
+      <van-picker
+        show-toolbar
+        :columns="userList"
+        @confirm="onStaffConfirm"
+        value-key="nickName"
+        @cancel="StaffShow = false" />
+    </van-popup>
   </div>
 </template>
 
 <script>
 import { myChainsVisits } from '@/api/info';
+import { getvisitDeptInfo } from '@/api/index';
+// import timeico from '@/assets/Icon/datatims.png';
 
 export default {
-  name: 'infoHistorVisit',
+  name: 'index.vue',
   data() {
     return {
+      // timeico: timeico,
+      defaultDate: new Date(),
+      searchValue: '',
+      calendarShow: '',
+      monthNames: [
+        '-01',
+        '-02',
+        '-03',
+        '-04',
+        '-05',
+        '-06',
+        '-07',
+        '-08',
+        '-09',
+        '-10',
+        '-11',
+        '-12',
+      ],
+      calendarIsshow: false,
+      tabVal: 'insidePlan',
       list: [],
       loading: false,
       finished: true,
+      listActive: null,
+      query: '',
+      show: false,
+      minDate: new Date(2022, 0, 1),
+      maxDate: new Date(),
+      currentDate: new Date(),
+      startcurrentDate: new Date(),
+      endminDate: new Date(),
+      startmaxDate: new Date(),
+      endTime: '',
+      startTime: '',
+      endTimeshow: false,
+      startTimeshow: false,
+      storeName: '',
+      companyName: '全部公司',
+      deptName: '全部销售部',
+      regionName: '全部大区',
+      userName: '全部业务员',
+      companyCode: '',
+      deptCode: '',
+      regionCode: '',
+      userCode: '',
+      companyList: [],
+      deptList: [],
+      regionList: [],
+      userList: [],
+      RegionShow: false,
+      SalesRegionShow: false,
+      SalesDepartmentShow: false,
+      StaffShow: false,
+      deptForm: { type: '', parentId: '' },
       pageNum: 1, // 当前页码  int类型
       pageSize: 10, // 当前每页条数  int类型
+      formData: {
+        companyId: '', // 公司id,必传 Long类型
+        regionId: '', // 大区id,必传  Long类型
+        deptId: '', // 部门id,如果为周报或日报为必传  Long类型
+        userId: '', // 业务员id,如果为日报为必传      Long类型
+        startTime: '', // 开始时间,必传  格式:yyyy-MM-dd  String类型
+        endTime: '', // 结束时间,必传  格式:yyyy-MM-dd  String类型
+        pageNum: 1, // 当前页码  int类型
+        pageSize: 10, // 当前每页条数  int类型
+      },
     };
   },
   created() {
+    this.info();
+    this.userList = [];
     this.pageNum = 1;
     this.list = [];
     this.powerGrade = localStorage.getItem('powerGrade');
-    this.getVisitsListFn();
+    this.getDeptInfo('dept', null, () => {
+      this.onSearch();
+    });
+    if (this.powerGrade == 5) {
+      setTimeout(() => {
+        if (this.$route.query.userCode == undefined) {
+          this.companyName = this.companyList[0].deptName;
+          this.companyCode = this.companyList[0].deptId;
+        }
+        this.getDeptInfo('dept', 1);
+      }, 1000);
+    }
+    if (this.powerGrade == 4) {
+      setTimeout(() => {
+        this.getDeptInfo('dept', 1);
+      }, 1000);
+    }
+    if (this.powerGrade == 3) {
+      setTimeout(() => {
+        this.getDeptInfo('dept', 2);
+      }, 1000);
+    }
+    if (this.powerGrade == 2 || this.powerGrade == 1) {
+      setTimeout(() => {
+        this.getDeptInfo('user');
+      }, 2000);
+    }
   },
+  mounted() {},
   methods: {
     onLoad() {
+      // this.loading = false;
       this.getVisitsListFn();
     },
+    info() {
+      this.query = this.$route.query;
+      this.startTime = this.getDay(-7);
+      this.startcurrentDate = new Date(this.getDay(-7));
+      this.endTime = this.parseTime(new Date(), '{y}-{m}-{d}');
+      this.endminDate = new Date(this.getDay(-7));
+    },
     detilsFn(val) {
       this.$router.push({
         path: '/visitHistoryDetail',
@@ -76,9 +330,60 @@ export default {
         },
       });
     },
+    timeBefore7(date) {
+      if (!date) {
+        date = new Date();
+      }
+      var y = date.getFullYear();
+      var m = date.getMonth() + 1;
+      var d = date.getDate() - 6;
+      if (d < 0) {
+        m = date.getMonth();
+        var d1 = new Date(y, m, 0);
+        var d2 = d1.getDate();
+        return y + '/' + (m < 10 ? '0' + m : m) + '/' + (d2 + d);
+      } else {
+        return y + '/' + (m < 10 ? '0' + m : m) + '/' + (d < 10 ? '0' + d : d);
+      }
+    },
+    getDay(day) {
+      var today = new Date();
+      var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;
+      today.setTime(targetday_milliseconds); //注意,这行是关键代码
+      var tYear = today.getFullYear();
+      var tMonth = today.getMonth();
+      var tDate = today.getDate();
+      tMonth = this.doHandleMonth(tMonth + 1);
+      tDate = this.doHandleMonth(tDate);
+      return tYear + '-' + tMonth + '-' + tDate;
+    },
+    doHandleMonth(month) {
+      var m = month;
+      if (month.toString().length == 1) {
+        m = '0' + month;
+      }
+      return m;
+    },
+    dateeconfirm() {
+      this.startTimeshow = false;
+      this.startTime = this.parseTime(this.startcurrentDate, '{yy}-{mm}-{dd}');
+      this.endminDate = new Date(this.startcurrentDate);
+      this.onSearch();
+    },
+    endTimeconfirm() {
+      this.endTimeshow = false;
+      this.endTime = this.parseTime(this.currentDate, '{yy}-{mm}-{dd}');
+      this.startmaxDate = new Date(this.currentDate);
+      this.onSearch();
+    },
     onClickLeft() {
       this.$router.go(-1);
     },
+    onSearch() {
+      this.pageNum = 1;
+      this.list = [];
+      this.getVisitsListFn();
+    },
     getVisitsListFn() {
       let loading1 = this.$toast.loading({
         duration: 0,
@@ -90,8 +395,15 @@ export default {
         this.refreshing = false;
       }
       myChainsVisits({
+        startTime: this.startTime + ' 00:00:00', //
+        stopTime: this.endTime + ' 24:00:00', //
+        storeRequest: this.storeName.trim(),
         pageNum: this.pageNum,
         pageSize: this.pageSize,
+        companyId: this.companyCode,
+        regionId: this.regionCode,
+        userId: this.userCode,
+        deptId: this.deptCode,
       }).then((res) => {
         loading1.clear();
         if (res.code == 200) {
@@ -108,6 +420,120 @@ export default {
         }
       });
     },
+    regionClick() {
+      // if(this.powerGrade>4){
+      this.RegionShow = true;
+      // }
+    },
+    SalesRegionClick(val) {
+      // if(this.powerGrade>3){
+      this.SalesRegionShow = true;
+      // }
+    },
+    SalesDepartmentClick() {
+      // if(this.powerGrade>2){
+      this.SalesDepartmentShow = true;
+      // }
+    },
+    StaffClick() {
+      this.StaffShow = true;
+    },
+    StartTimeClick() {
+      this.StartTimeShow = true;
+    },
+    onregionConfirm(val) {
+      this.RegionShow = false;
+      this.companyName = val.deptName;
+      this.companyCode = val.deptId;
+      this.regionName = '全部大区';
+      this.regionCode = '';
+      this.deptName = '全部销售部';
+      this.deptCode = '';
+      this.userName = '全部业务员';
+      this.userCode = '';
+      this.getDeptInfo('dept', 1);
+    },
+    onSalesRegionConfirm(val) {
+      this.SalesRegionShow = false;
+      this.regionName = val.deptName;
+      this.regionCode = val.deptId;
+      if (val.deptId != '') {
+        this.getDeptInfo('dept', 2);
+      }
+      this.deptName = '全部销售部';
+      this.deptCode = '';
+      this.userName = '全部业务员';
+      this.userCode = '';
+      this.userList = [];
+    },
+    onSalesDepartmentConfirm(val) {
+      this.SalesDepartmentShow = false;
+      this.deptName = val.deptName;
+      this.deptCode = val.deptId;
+      if (val.deptId != '') {
+        this.getDeptInfo('user');
+      }
+      this.userName = '全部业务员';
+      this.userCode = '';
+    },
+    onStaffConfirm(val) {
+      this.StaffShow = false;
+      this.userName = val.nickName;
+      this.userCode = val.userId;
+    },
+    getDeptInfo(type, grade, callback) {
+      this.deptForm.type = type;
+      if (type == 'dept') {
+        if (grade == '1') {
+          this.deptForm.parentId = this.companyCode;
+        } else if (grade == '2') {
+          this.deptForm.parentId = this.regionCode;
+        } else {
+          this.deptForm.type = '';
+          this.deptForm.parentId = '';
+        }
+      } else if (type == 'user') {
+        this.deptForm.parentId = this.deptCode;
+      }
+      getvisitDeptInfo(this.deptForm).then((res) => {
+        if (type == 'dept') {
+          if (grade == '1') {
+            if (res.data.region != null) {
+              this.regionList = [{ deptName: '全部大区', deptId: '' }].concat(res.data.region);
+            }
+          } else if (grade == '2') {
+            if (res.data.dept != null) {
+              this.deptList = [{ deptName: '全部销售部', deptId: '' }].concat(res.data.dept);
+            }
+          } else {
+            this.companyList = res.data.company;
+            if (this.$route.query.userCode == undefined) {
+              this.companyName = res.data.company[0].deptName;
+              this.companyCode = res.data.company[0].deptId;
+            }
+            if (res.data.dept != null) {
+              this.deptName = res.data.dept[0].deptName;
+              this.deptCode = res.data.dept[0].deptId;
+              this.deptList = res.data.dept;
+            }
+            if (res.data.region != null) {
+              this.regionName = res.data.region[0].deptName;
+              this.regionCode = res.data.region[0].deptId;
+              this.regionList = res.data.region;
+            }
+            if (res.data.user != null) {
+              this.userList = res.data.user;
+              this.userCode = '';
+            }
+          }
+          callback && callback();
+        } else if (type == 'user') {
+          if (res.data.user != null) {
+            this.userList = [{ nickName: '全部业务员', userId: '' }].concat(res.data.user);
+          }
+        }
+      });
+    },
   },
 };
 </script>
@@ -160,21 +586,12 @@ export default {
 }
 </style>
 <style lang="scss" scoped>
-.infoHistorVisit {
-  height: 100%;
-  width: 100%;
-  display: flex;
-  flex-direction: column;
-  overflow: hidden;
-}
 .bgcolor {
   background-color: #f5f5f5;
 }
 
 .container {
-  overflow-y: auto;
-  flex: 1;
-  padding-bottom: 10px;
+  padding-bottom: 50px;
 }
 
 .monthNow {