zhujindu 11 月之前
父節點
當前提交
f13481baad
共有 1 個文件被更改,包括 63 次插入46 次删除
  1. 63 46
      src/views/home/index.vue

+ 63 - 46
src/views/home/index.vue

@@ -1,41 +1,30 @@
 <template>
   <div class="homePage" ref="homePage">
-    <van-nav-bar class="navBar" left-arrow title="门店拜访" @click-left="onClickLeft" />
-    <van-tabs
-      class="myTab"
-      type="card"
-      v-model="tabVal"
-      color="#0057ba"
-      @click="onClickTabs"
-      v-if="isGZorJZ">
-      <van-tab title="提示类" name="-1" v-if="isGZorJZ == 'false'">
-        <hintTabPage :tabVal="tabVal" ref="hintTabPage"></hintTabPage
-      ></van-tab>
-      <van-tab title="A类指标" name="0"
-        ><ABtarget :tabVal="tabVal" ref="Atarget"></ABtarget
-      ></van-tab>
-      <van-tab title="B类指标" name="1"
-        ><ABtarget :tabVal="tabVal" ref="Btarget"></ABtarget
-      ></van-tab>
-    </van-tabs>
-    <div class="bottomBtn">
-      <bottomBtn :tabVal="tabVal"></bottomBtn>
-    </div>
-    <!-- <van-dialog v-model="shows" @confirm="titleconfirm">
-      <div class="tipTitleBox" style="padding: 10px">
-        <p class="p">系统提示</p>
-        <p>各位好,因五一假期,汇报提交时间有调整。</p>
-        <div style="font-size: 14px">
-          <p style="margin-bottom: 6px; line-height: 20px">1、5月1-3日,销售员无需提交日报。</p>
-          <p style="margin-bottom: 6px; line-height: 20px">
-            2、销售部主管周报提交时间改为4月27日-30日。
-          </p>
-          <p>3、大区主管半月报提交时间改为5月4日-7日。</p>
-        </div>
-        <br />
-        <p style="text-align: right">祝大家假期愉快!</p>
+    <div class="content">
+      <van-nav-bar class="navBar" left-arrow title="门店拜访" @click-left="onClickLeft" />
+      <van-tabs
+        class="myTab"
+        type="card"
+        v-model="tabVal"
+        color="#0057ba"
+        @click="onClickTabs"
+        v-if="isGZorJZ">
+        <van-tab title="提示类" name="-1" v-if="isGZorJZ == 'false'">
+          <van-pull-refresh v-model="isLoading" @refresh="onRefresh">
+            <hintTabPage :tabVal="tabVal" ref="hintTabPage"></hintTabPage>
+          </van-pull-refresh>
+        </van-tab>
+        <van-tab title="A类指标" name="0">
+          <ABtarget :tabVal="tabVal" ref="Atarget"></ABtarget>
+        </van-tab>
+        <van-tab title="B类指标" name="1">
+          <ABtarget :tabVal="tabVal" ref="Btarget"></ABtarget>
+        </van-tab>
+      </van-tabs>
+      <div class="bottomBtn">
+        <bottomBtn :tabVal="tabVal" ref="bottomBtn"></bottomBtn>
       </div>
-    </van-dialog> -->
+    </div>
     <tab-bar></tab-bar>
   </div>
 </template>
@@ -61,6 +50,7 @@ export default {
       tabVal: '-1',
       hintTabPageIndex: 0,
       isGZorJZ: null,
+      isLoading: false,
     };
   },
   watch: {
@@ -78,17 +68,18 @@ export default {
   activated() {
     if (this.tabVal == '-1') {
       // 从其他页面跳转过来如果;要重新获取对应tab数据
-      if (this.$refs.hintTabPage) this.$refs.hintTabPage.initData();
+      // if (this.$refs.hintTabPage) this.$refs.hintTabPage.initData();
     } else if (this.tabVal == '0') {
-      if (this.$refs.Atarget) this.$refs.Atarget.initData();
+      // if (this.$refs.Atarget) this.$refs.Atarget.initData();
     } else if (this.tabVal == '1') {
-      if (this.$refs.Btarget) this.$refs.Btarget.initData();
+      // if (this.$refs.Btarget) this.$refs.Btarget.initData();
     }
   },
   created() {
     getTicketFun(['onMenuShareAppMessage']).then((res) => {
       this.wx.ready(() => {
         console.log('this.wx.ready');
+        console.log(this.wx);
         this.wx.onMenuShareAppMessage({
           title: '企业微信',
           desc: '让每个企业都有自己的微信',
@@ -108,11 +99,17 @@ export default {
     });
     this.getDict();
   },
+  mounted() {},
   methods: {
-    async getDict() {
-      this.isGZorJZ = null;
+    onRefresh() {
+      this.getDict(true);
+      this.isLoading = false;
+    },
+    async getDict(isRefresh) {
+      this.toastLoading(0, '加载中...', true);
       let gz_Option = await getDictOption({}, 'gz_customer_post'); //公装业务员岗位
       let jz_Option = await getDictOption({}, 'jz_post_name'); //家装业务员岗位
+      this.toastLoading().clear();
       let postName = this.userInfo.postName;
       let is_gz = gz_Option.data.find((res) => res.dictLabel == postName);
       let is_jz = jz_Option.data.find((res) => res.dictLabel == postName);
@@ -125,11 +122,22 @@ export default {
       }
       // 家装或工装不显示提示类tab
       this.$nextTick(() => {
-        if (this.isGZorJZ == 'true') {
-          this.tabVal = '0';
-        } else {
-          this.tabVal = '-1';
+        // 刷新状态
+        if (!isRefresh) {
+          if (this.isGZorJZ == 'true') {
+            this.tabVal = '0';
+          } else {
+            this.tabVal = '-1';
+          }
+        }
+        if (this.tabVal == '-1') {
+          if (this.$refs.hintTabPage) this.$refs.hintTabPage.initData();
+        } else if (this.tabVal == '0') {
+          if (this.$refs.Atarget) this.$refs.Atarget.initData();
+        } else if (this.tabVal == '1') {
+          if (this.$refs.Btarget) this.$refs.Btarget.initData();
         }
+        if (this.$refs.bottomBtn) this.$refs.bottomBtn.getReportInfo();
       });
     },
     onClickTabs(val) {
@@ -173,9 +181,18 @@ export default {
     width: 100%;
     height: 100%;
     .homePage {
-      width: 100%;
       height: 100%;
-      /* overflow-y: auto; */
+      width: 100%;
+      display: flex;
+      flex-direction: column;
+      overflow: hidden;
+      .content {
+        flex: 1;
+        overflow-y: auto;
+      }
+      .tabBar {
+        height: 50px;
+      }
     }
   }
 }