company.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view>
  3. <view class="img" @click="jumpMap"><image src="/static/image/map2.png"></image></view>
  4. <view class="no-data" v-if="!id"><image src="/static/image/no-data.png" mode="scaleToFill"></image></view>
  5. <view class="" v-if="id">
  6. <u-sticky bgColor="#fff">
  7. <u-tabs
  8. :list="tabList"
  9. :current="currentTabIndex"
  10. :activeStyle="{
  11. color: '#303133',
  12. fontWeight: 'bold',
  13. transform: 'scale(1.05)',
  14. }"
  15. :lineWidth="tabLineWidth"
  16. :inactiveStyle="{
  17. color: '#606266',
  18. transform: 'scale(1)',
  19. }"
  20. @click="click"
  21. style="justify-content: center;"
  22. ></u-tabs>
  23. </u-sticky>
  24. <scroll-view>
  25. <Charts v-if="currentTabIndex == 0" :companyId="id"></Charts>
  26. <Alarm v-if="currentTabIndex == 1" :companyId="id"></Alarm>
  27. <Info v-if="currentTabIndex == 2" :companyId="id"></Info>
  28. </scroll-view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import { log } from "@/utils/base.js";
  34. import Charts from "./components/charts.vue";
  35. import Alarm from "./components/alarm.vue";
  36. import Info from "./components/info.vue";
  37. export default {
  38. components: {
  39. Charts,
  40. Info,
  41. Alarm,
  42. },
  43. data() {
  44. return {
  45. id: "",
  46. tabList: [],
  47. currentTabIndex: 0,
  48. tabLineWidth: 80,
  49. name: "",
  50. };
  51. },
  52. onLoad(opt) {
  53. this.id = opt.id ? decodeURIComponent(opt.id) : "";
  54. this.name = opt.name ? decodeURIComponent(opt.name) : "";
  55. if (this.name) {
  56. uni.setNavigationBarTitle({
  57. title: this.name,
  58. });
  59. }
  60. this.currentTabIndex = 0;
  61. log("===>COMPANY_ID_NAME", this.id, this.name, this.currentTabIndex);
  62. this.tabList.push(
  63. ...[
  64. {
  65. id: "1",
  66. name: "商户概览",
  67. badge: {
  68. value: 0,
  69. },
  70. },
  71. {
  72. id: "2",
  73. name: "报警信息",
  74. },
  75. {
  76. id: "3",
  77. name: "商户档案",
  78. },
  79. ]
  80. );
  81. },
  82. mounted() {
  83. this.currentTabIndex = 0;
  84. },
  85. methods: {
  86. jumpMap() {
  87. uni.navigateTo({
  88. url: `/pages_map/map?id=${this.id}&name=${this.name}`,
  89. });
  90. },
  91. click(item) {
  92. //console.log("item", item);
  93. this.currentTabIndex = item.index;
  94. //#ifdef MP-WEIXIN
  95. /* if (item.index > 0) {
  96. uni.navigateTo({
  97. url: `/pages_company/info?id=${this.id}&name=${this.name}&index=${item.index}`,
  98. });
  99. } */
  100. //#endif
  101. },
  102. },
  103. };
  104. </script>
  105. <style lang="scss">
  106. .no-data {
  107. width: 100%;
  108. height: 300px;
  109. margin-top: 10%;
  110. image {
  111. width: 100%;
  112. height: 100%;
  113. }
  114. }
  115. .img {
  116. position: absolute;
  117. right: 25px;
  118. top: 10px;
  119. width: 40px;
  120. height: 40px;
  121. cursor: pointer;
  122. // background-color: $uni-color-primary;
  123. display: flex;
  124. justify-content: center;
  125. align-items: center;
  126. border-radius: 50%;
  127. z-index: 1000;
  128. image {
  129. width: 100%;
  130. height: 100%;
  131. cursor: pointer;
  132. }
  133. }
  134. </style>