index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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. getTicketFun(['onMenuShareAppMessage'], 'agentConfig').then(() => {
  88. wx.onMenuShareAppMessage({
  89. title: '企业微信',
  90. desc: '让每个企业都有自己的微信',
  91. link: 'https://work.weixin.qq.com/',
  92. imgUrl: 'https://res.mail.qq.com/node/ww/wwmng/style/images/index_share_logo$13c64306.png',
  93. success() {
  94. // 用户确认分享后回调
  95. },
  96. cancel() {
  97. // 用户取消分享后回调
  98. },
  99. });
  100. });
  101. this.getDict();
  102. },
  103. methods: {
  104. async getDict() {
  105. this.isGZorJZ = null;
  106. let gz_Option = await getDictOption({}, 'gz_customer_post'); //公装业务员岗位
  107. let jz_Option = await getDictOption({}, 'jz_post_name'); //家装业务员岗位
  108. let postName = this.userInfo.postName;
  109. let is_gz = gz_Option.data.find((res) => res.dictLabel == postName);
  110. let is_jz = jz_Option.data.find((res) => res.dictLabel == postName);
  111. if (is_gz || is_jz) {
  112. localStorage.setItem('isGZorJZ', 'true');
  113. this.isGZorJZ = 'true';
  114. } else {
  115. localStorage.setItem('isGZorJZ', 'false');
  116. this.isGZorJZ = 'false';
  117. }
  118. // 家装或工装不显示提示类tab
  119. this.$nextTick(() => {
  120. if (this.isGZorJZ == 'true') {
  121. this.tabVal = '0';
  122. } else {
  123. this.tabVal = '-1';
  124. }
  125. });
  126. },
  127. onClickTabs(val) {
  128. this.$nextTick(() => {
  129. // this.tabVal == '-1' 有watch监听不需要在触发
  130. // if (this.tabVal == '0') {
  131. // if (this.$refs.Atarget) this.$refs.Atarget.initData();
  132. // } else
  133. if (this.tabVal == '1') {
  134. if (this.$refs.Btarget) this.$refs.Btarget.initData();
  135. }
  136. });
  137. },
  138. onClickLeft() {
  139. this.$router.go(-1);
  140. // window.location.href = process.env.VUE_APP_SSB_LINK + "/homeIndex"
  141. },
  142. getReportInfo() {
  143. getReportInfo({ isContent: false }).then((res) => {
  144. if (res.code == 200) {
  145. localStorage.setItem('powerGrade', res.data.positionId);
  146. localStorage.setItem('isDiy', res.data.diy);
  147. localStorage.setItem('uType', res.data.userType);
  148. localStorage.setItem('jzType', res.data.jzType);
  149. localStorage.setItem('customerVisits', res.data.customerManagerVisits);
  150. localStorage.setItem('postType', res.data.postType);
  151. } else {
  152. this.$toast(res.msg);
  153. }
  154. });
  155. },
  156. },
  157. };
  158. </script>
  159. <style scoped lang="scss">
  160. #app {
  161. width: 100%;
  162. height: 100%;
  163. overflow: hidden;
  164. .bgcolor {
  165. width: 100%;
  166. height: 100%;
  167. .homePage {
  168. width: 100%;
  169. height: 100%;
  170. /* overflow-y: auto; */
  171. }
  172. }
  173. }
  174. </style>
  175. <style lang="scss">
  176. .homePage {
  177. display: flex;
  178. flex-direction: column;
  179. .myTab {
  180. /* flex: 1; */
  181. display: flex;
  182. flex-direction: column;
  183. /* position: sticky; */
  184. /* top: 0px; */
  185. .van-tabs__wrap {
  186. position: sticky;
  187. top: 0px;
  188. z-index: 10;
  189. }
  190. .van-tabs__content {
  191. flex: 1;
  192. /* margin-bottom: 50px; */
  193. }
  194. }
  195. .myTab .van-tabs__nav--card {
  196. margin: 0 !important;
  197. border-left: 0;
  198. border-right: 0;
  199. }
  200. .myTab .van-tabs__wrap,
  201. .van-tabs__nav--card {
  202. height: 39px;
  203. }
  204. .myTab .van-tab {
  205. line-height: 40px;
  206. }
  207. .bottomBtn {
  208. margin-bottom: 55px;
  209. }
  210. }
  211. </style>