index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <div class="homePage" ref="homePage">
  3. <div class="content">
  4. <van-nav-bar class="navBar" left-arrow title="门店拜访" @click-left="onClickLeft">
  5. </van-nav-bar>
  6. <van-tabs
  7. class="myTab"
  8. type="card"
  9. v-model="tabVal"
  10. color="#0057ba"
  11. @click="onClickTabs"
  12. v-if="isGZorJZ">
  13. <van-tab title="提示类" name="-1" v-if="isGZorJZ == 'false' && userType != '4'">
  14. <van-pull-refresh v-model="isLoading" @refresh="onRefresh">
  15. <hintTabPage :tabVal="tabVal" ref="hintTabPage" :userType="userType"></hintTabPage>
  16. </van-pull-refresh>
  17. </van-tab>
  18. <van-tab
  19. title="A类指标"
  20. name="0"
  21. v-if="userType != '1' && userType != '3' && userType != '4'">
  22. <ABtarget :tabVal="tabVal" ref="Atarget"></ABtarget>
  23. </van-tab>
  24. <van-tab title="B类指标" name="1" v-if="isGZorJZ == 'false'">
  25. <ABtarget :tabVal="tabVal" ref="Btarget" :userType="userType"></ABtarget>
  26. </van-tab>
  27. </van-tabs>
  28. <div class="bottomBtn">
  29. <bottomBtn :tabVal="tabVal" ref="bottomBtn"></bottomBtn>
  30. </div>
  31. </div>
  32. <div class="floatingIcon" :style="setSIcontyle" v-dialogDrag>
  33. <div class="AIIcon" @click="deepseek">
  34. <van-icon class="img" :name="require('@/assets/ai.png')" size="40" />
  35. </div>
  36. <a
  37. class="feedback"
  38. href="https://qiweitest.nipponpaint.com.cn/weixin/ecoRules/redirect/1064/0"
  39. target="_blank"
  40. ><img src="./../../assets/feedback.png"
  41. /></a>
  42. </div>
  43. <tab-bar></tab-bar>
  44. </div>
  45. </template>
  46. <script>
  47. import { getReportInfo, getDictOption, buryingPoint } from '@/api/index';
  48. import hintTabPage from './hintTabPage/index.vue';
  49. import tabBar from '@/components/tabBar';
  50. import ABtarget from './ABtarget.vue';
  51. import { mapState } from 'vuex';
  52. import bottomBtn from './bottomBtn.vue';
  53. import { WXdigest } from '@/utils/digest';
  54. export default {
  55. name: 'home',
  56. components: { tabBar, hintTabPage, ABtarget, bottomBtn },
  57. computed: {
  58. ...mapState({
  59. userInfo: (state) => state.user.userInfo,
  60. }),
  61. },
  62. data() {
  63. return {
  64. tabVal: '-1',
  65. hintTabPageIndex: 0,
  66. isGZorJZ: null,
  67. isLoading: false,
  68. userType: null,
  69. setSIcontyle: {
  70. bottom: '85px',
  71. right: '14px',
  72. },
  73. };
  74. },
  75. watch: {
  76. // 监听切换用户
  77. 'userInfo.userName': {
  78. handler(val) {
  79. if (val) {
  80. this.getDict();
  81. // this.getReportInfo();
  82. }
  83. },
  84. immediete: true,
  85. },
  86. },
  87. activated() {
  88. WXdigest();
  89. if (this.tabVal == '-1') {
  90. // 从其他页面跳转过来如果;要重新获取对应tab数据
  91. // if (this.$refs.hintTabPage) this.$refs.hintTabPage.initData();
  92. } else if (this.tabVal == '0') {
  93. // if (this.$refs.Atarget) this.$refs.Atarget.initData();
  94. } else if (this.tabVal == '1') {
  95. // if (this.$refs.Btarget) this.$refs.Btarget.initData();
  96. }
  97. },
  98. created() {
  99. this.getDict();
  100. let floatingIconStyle = JSON.parse(localStorage.getItem('floatingIcon'));
  101. if (floatingIconStyle && floatingIconStyle.length) {
  102. this.setSIcontyle = {
  103. left: floatingIconStyle[0],
  104. top: floatingIconStyle[1],
  105. };
  106. }
  107. },
  108. mounted() {},
  109. methods: {
  110. onRefresh() {
  111. this.getDict(true);
  112. this.isLoading = false;
  113. },
  114. async getDict(isRefresh) {
  115. let postType = this.userInfo.postType;
  116. // postType:人员类型,JZ(家装)、GZ(公装)、YF(应服)、DIY(DIY)
  117. if (postType == 'JZ' || postType == 'GZ') {
  118. localStorage.setItem('isGZorJZ', 'true');
  119. this.isGZorJZ = 'true';
  120. } else {
  121. localStorage.setItem('isGZorJZ', 'false');
  122. this.isGZorJZ = 'false';
  123. }
  124. // 家装或工装不显示提示类tab
  125. this.$nextTick(() => {
  126. // 刷新状态
  127. if (!isRefresh) {
  128. if (this.isGZorJZ == 'true') {
  129. this.tabVal = '0';
  130. } else {
  131. this.tabVal = '-1';
  132. }
  133. }
  134. if (this.$refs.bottomBtn) {
  135. this.$refs.bottomBtn.getReportInfo(() => {
  136. // 用户类型(默认0):0=DIY员工;1=DIY经销商-分销人员;2=YSL;3=DIY经销商-倍增和先锋;4=DIY经销商-老板;经销商多身份时:1,4
  137. this.userType = localStorage.getItem('uType');
  138. });
  139. }
  140. if (this.tabVal == '-1') {
  141. if (this.$refs.hintTabPage) this.$refs.hintTabPage.initData();
  142. } else if (this.tabVal == '0') {
  143. if (this.$refs.Atarget) this.$refs.Atarget.initData();
  144. } else if (this.tabVal == '1') {
  145. if (this.$refs.Btarget) this.$refs.Btarget.initData();
  146. }
  147. });
  148. },
  149. onClickTabs(val) {
  150. this.$nextTick(() => {
  151. // this.tabVal == '-1' 有watch监听不需要在触发
  152. // if (this.tabVal == '0') {
  153. // if (this.$refs.Atarget) this.$refs.Atarget.initData();
  154. // } else
  155. if (this.tabVal == '1') {
  156. if (this.$refs.Btarget) this.$refs.Btarget.initData();
  157. }
  158. });
  159. },
  160. onClickLeft() {
  161. this.$router.go(-1);
  162. // window.location.href = process.env.VUE_APP_SSB_LINK + "/homeIndex"
  163. },
  164. getReportInfo() {
  165. getReportInfo({ isContent: false }).then((res) => {
  166. if (res.code == 200) {
  167. localStorage.setItem('powerGrade', res.data.positionId);
  168. localStorage.setItem('userDeptLevel', res.data.userDeptLevel);
  169. localStorage.setItem('isDiy', res.data.diy);
  170. localStorage.setItem('uType', res.data.userType);
  171. localStorage.setItem('jzType', res.data.jzType);
  172. localStorage.setItem('customerVisits', res.data.customerManagerVisits);
  173. localStorage.setItem('postType', res.data.postType);
  174. this.userType = res.data.userType;
  175. } else {
  176. this.$toast(res.msg);
  177. }
  178. });
  179. },
  180. deepseek() {
  181. buryingPoint({
  182. systemModel: '首页',
  183. buryingPointType: 10,
  184. buryingPointValue: '首页-Ai',
  185. buryingPointName: 'Ai',
  186. buryingPointPosition: '首页-Ai',
  187. });
  188. this.$router.push({
  189. path: '/chatAIPage',
  190. });
  191. // window.location.href = 'https://deepseek.nipponpaint.com.cn';
  192. },
  193. },
  194. };
  195. </script>
  196. <style scoped lang="scss">
  197. #app {
  198. width: 100%;
  199. height: 100%;
  200. overflow: hidden;
  201. .bgcolor {
  202. width: 100%;
  203. height: 100%;
  204. .homePage {
  205. height: 100%;
  206. width: 100%;
  207. display: flex;
  208. flex-direction: column;
  209. overflow: hidden;
  210. .content {
  211. flex: 1;
  212. overflow-y: auto;
  213. }
  214. .tabBar {
  215. height: 50px;
  216. }
  217. }
  218. }
  219. }
  220. </style>
  221. <style lang="scss">
  222. .homePage {
  223. position: relative;
  224. display: flex;
  225. flex-direction: column;
  226. .myTab {
  227. /* flex: 1; */
  228. display: flex;
  229. flex-direction: column;
  230. /* position: sticky; */
  231. /* top: 0px; */
  232. .van-tabs__wrap {
  233. position: sticky;
  234. top: 0px;
  235. z-index: 10;
  236. }
  237. .van-tabs__content {
  238. flex: 1;
  239. /* margin-bottom: 50px; */
  240. }
  241. }
  242. .myTab .van-tabs__nav--card {
  243. margin: 0 !important;
  244. border-left: 0;
  245. border-right: 0;
  246. }
  247. .myTab .van-tabs__wrap,
  248. .van-tabs__nav--card {
  249. height: 39px;
  250. }
  251. .myTab .van-tab {
  252. line-height: 40px;
  253. }
  254. .bottomBtn {
  255. margin-bottom: 55px;
  256. }
  257. .floatingIcon {
  258. position: absolute;
  259. width: 40px;
  260. z-index: 99999;
  261. height: min-content;
  262. .AIIcon {
  263. width: 100%;
  264. display: inline-block;
  265. cursor: pointer;
  266. }
  267. .AIIcon .img {
  268. border-radius: 100px;
  269. float: left;
  270. }
  271. .AIIcon .img .van-icon__image {
  272. border-radius: 100px;
  273. }
  274. .feedback {
  275. display: inline-block;
  276. width: 100%;
  277. }
  278. .feedback img {
  279. width: 100%;
  280. }
  281. }
  282. }
  283. </style>