index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <div class="homePage" ref="homePage">
  3. <van-nav-bar class="navBar" left-arrow title="门店拜访" @click-left="onClickLeft" />
  4. <van-tabs
  5. class="myTab"
  6. type="card"
  7. v-model="tabVal"
  8. color="#0057ba"
  9. @click="onClickTabs"
  10. v-if="isGZorJZ">
  11. <van-tab title="提示类" name="-1" v-if="isGZorJZ == 'false'">
  12. <hintTabPage :tabVal="tabVal" ref="hintTabPage"></hintTabPage
  13. ></van-tab>
  14. <van-tab title="A类指标" name="0"
  15. ><ABtarget :tabVal="tabVal" ref="Atarget"></ABtarget
  16. ></van-tab>
  17. <van-tab title="B类指标" name="1"
  18. ><ABtarget :tabVal="tabVal" ref="Btarget"></ABtarget
  19. ></van-tab>
  20. </van-tabs>
  21. <div class="bottomBtn">
  22. <bottomBtn :tabVal="tabVal"></bottomBtn>
  23. </div>
  24. <!-- <van-dialog v-model="shows" @confirm="titleconfirm">
  25. <div class="tipTitleBox" style="padding: 10px">
  26. <p class="p">系统提示</p>
  27. <p>各位好,因五一假期,汇报提交时间有调整。</p>
  28. <div style="font-size: 14px">
  29. <p style="margin-bottom: 6px; line-height: 20px">1、5月1-3日,销售员无需提交日报。</p>
  30. <p style="margin-bottom: 6px; line-height: 20px">
  31. 2、销售部主管周报提交时间改为4月27日-30日。
  32. </p>
  33. <p>3、大区主管半月报提交时间改为5月4日-7日。</p>
  34. </div>
  35. <br />
  36. <p style="text-align: right">祝大家假期愉快!</p>
  37. </div>
  38. </van-dialog> -->
  39. <tab-bar></tab-bar>
  40. </div>
  41. </template>
  42. <script>
  43. import { getReportInfo, getDictOption } from '@/api/index';
  44. import hintTabPage from './hintTabPage/index.vue';
  45. import tabBar from '@/components/tabBar';
  46. import ABtarget from './ABtarget.vue';
  47. import { mapState } from 'vuex';
  48. import bottomBtn from './bottomBtn.vue';
  49. export default {
  50. name: 'home',
  51. components: { tabBar, hintTabPage, ABtarget, bottomBtn },
  52. computed: {
  53. ...mapState({
  54. userInfo: (state) => state.user.userInfo,
  55. }),
  56. },
  57. data() {
  58. return {
  59. tabVal: '-1',
  60. hintTabPageIndex: 0,
  61. isGZorJZ: null,
  62. };
  63. },
  64. watch: {
  65. // 监听切换用户
  66. 'userInfo.userName': {
  67. handler(val) {
  68. if (val) {
  69. this.getDict();
  70. // this.getReportInfo();
  71. }
  72. },
  73. immediete: true,
  74. },
  75. },
  76. activated() {
  77. if (this.tabVal == '-1') {
  78. // 从其他页面跳转过来如果;要重新获取对应tab数据
  79. if (this.$refs.hintTabPage) this.$refs.hintTabPage.initData();
  80. } else if (this.tabVal == '0') {
  81. if (this.$refs.Atarget) this.$refs.Atarget.initData();
  82. } else if (this.tabVal == '1') {
  83. if (this.$refs.Btarget) this.$refs.Btarget.initData();
  84. }
  85. },
  86. created() {
  87. this.getDict();
  88. },
  89. methods: {
  90. async getDict() {
  91. this.isGZorJZ = null;
  92. let gz_Option = await getDictOption({}, 'gz_customer_post'); //公装业务员岗位
  93. let jz_Option = await getDictOption({}, 'jz_post_name'); //家装业务员岗位
  94. let postName = this.userInfo.postName;
  95. let is_gz = gz_Option.data.find((res) => res.dictLabel == postName);
  96. let is_jz = jz_Option.data.find((res) => res.dictLabel == postName);
  97. if (is_gz || is_jz) {
  98. localStorage.setItem('isGZorJZ', 'true');
  99. this.isGZorJZ = 'true';
  100. } else {
  101. localStorage.setItem('isGZorJZ', 'false');
  102. this.isGZorJZ = 'false';
  103. }
  104. // 家装或工装不显示提示类tab
  105. this.$nextTick(() => {
  106. if (this.isGZorJZ == 'true') {
  107. this.tabVal = '0';
  108. } else {
  109. this.tabVal = '-1';
  110. }
  111. });
  112. },
  113. onClickTabs(val) {
  114. this.$nextTick(() => {
  115. // this.tabVal == '-1' 有watch监听不需要在触发
  116. // if (this.tabVal == '0') {
  117. // if (this.$refs.Atarget) this.$refs.Atarget.initData();
  118. // } else
  119. if (this.tabVal == '1') {
  120. if (this.$refs.Btarget) this.$refs.Btarget.initData();
  121. }
  122. });
  123. },
  124. onClickLeft() {
  125. this.$router.go(-1);
  126. // window.location.href = process.env.VUE_APP_SSB_LINK + "/homeIndex"
  127. },
  128. getReportInfo() {
  129. getReportInfo({ isContent: false }).then((res) => {
  130. if (res.code == 200) {
  131. localStorage.setItem('powerGrade', res.data.positionId);
  132. localStorage.setItem('isDiy', res.data.diy);
  133. localStorage.setItem('uType', res.data.userType);
  134. localStorage.setItem('jzType', res.data.jzType);
  135. localStorage.setItem('customerVisits', res.data.customerManagerVisits);
  136. localStorage.setItem('postType', res.data.postType);
  137. } else {
  138. this.$toast(res.msg);
  139. }
  140. });
  141. },
  142. },
  143. };
  144. </script>
  145. <style scoped lang="scss">
  146. #app {
  147. width: 100%;
  148. height: 100%;
  149. overflow: hidden;
  150. .bgcolor {
  151. width: 100%;
  152. height: 100%;
  153. .homePage {
  154. width: 100%;
  155. height: 100%;
  156. /* overflow-y: auto; */
  157. }
  158. }
  159. }
  160. </style>
  161. <style lang="scss">
  162. .homePage {
  163. display: flex;
  164. flex-direction: column;
  165. .myTab {
  166. flex: 1;
  167. display: flex;
  168. flex-direction: column;
  169. /* position: sticky; */
  170. /* top: 0px; */
  171. .van-tabs__wrap {
  172. position: sticky;
  173. top: 0px;
  174. z-index: 10;
  175. }
  176. .van-tabs__content {
  177. flex: 1;
  178. /* margin-bottom: 50px; */
  179. }
  180. }
  181. .myTab .van-tabs__nav--card {
  182. margin: 0 !important;
  183. border-left: 0;
  184. border-right: 0;
  185. }
  186. .myTab .van-tabs__wrap,
  187. .van-tabs__nav--card {
  188. height: 39px;
  189. }
  190. .myTab .van-tab {
  191. line-height: 40px;
  192. }
  193. .bottomBtn {
  194. margin-bottom: 55px;
  195. }
  196. }
  197. </style>