index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <view class="page" @click.stop="closeDropdowns">
  3. <view class="tabs-container">
  4. <view class="tabs">
  5. <view class="tab" :class="{ active: activeTab === 'scan' }" @click="activeTab = 'scan'">扫码率</view>
  6. <view v-if="!hasReportFunction" class="tab" :class="{ active: activeTab === 'export' }" @click="activeTab = 'export'">报表导出</view>
  7. <view class="tab" :class="{ active: activeTab === 'blacklist' }" @click="activeTab = 'blacklist'">黑名单汇总</view>
  8. </view>
  9. </view>
  10. <view class="content" v-show="activeTab === 'scan'">
  11. <ScanningRate ref="scanRate" />
  12. </view>
  13. <view class="content" :style="{ padding: '0', marginTop: '85rpx' }" v-show="activeTab === 'export'">
  14. <ReportExport />
  15. </view>
  16. <view class="content" :style="{ padding: '0', marginTop: '85rpx' }" v-show="activeTab === 'blacklist'">
  17. <Blacklist />
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import LoadingImg from "../../static/images/loading.png";
  23. import ReportExport from "./reportExport/index.vue";
  24. import ScanningRate from "./customerScanningRate/index.vue";
  25. import Blacklist from "./blacklist/index.vue";
  26. import { hasFunction } from '../../utils/utils.js'
  27. export default {
  28. components: {
  29. ScanningRate,
  30. ReportExport,
  31. Blacklist,
  32. },
  33. data() {
  34. return {
  35. hasReportFunction: false,
  36. loading: true,
  37. LoadingImg,
  38. activeTab: "scan",
  39. activeRange: 1,
  40. filterModalOpen: false,
  41. filterForm: { report: "", product: "" },
  42. filterDropdown: { report: false, product: false },
  43. filterDateRange: [],
  44. };
  45. },
  46. created() {
  47. uni.showLoading({
  48. title: '加载中',
  49. })
  50. hasFunction('trace-code-task').then(res => {
  51. this.hasReportFunction = res
  52. uni.hideLoading()
  53. }).catch(err => {
  54. this.hasReportFunction = false
  55. uni.hideLoading()
  56. })
  57. },
  58. methods: {
  59. closeDropdowns() {
  60. this.$refs.scanRate.closeDropdown();
  61. },
  62. },
  63. };
  64. </script>
  65. <style>
  66. .page {
  67. box-sizing: border-box;
  68. height: calc(100vh - env(safe-area-inset-bottom));
  69. overflow-y: auto;
  70. box-sizing: border-box;
  71. background: #f3f6f9;
  72. padding-bottom: calc(50rpx + env(safe-area-inset-bottom));
  73. }
  74. .content {
  75. padding: 30rpx;
  76. margin-top: 180rpx;
  77. padding-bottom: 160rpx;
  78. }
  79. .tabs-container {
  80. position: fixed;
  81. top: 0;
  82. left: 0;
  83. width: 100%;
  84. height: 116rpx;
  85. background: #f3f6f9;
  86. z-index: 99;
  87. margin-top: -8rpx;
  88. }
  89. .tabs {
  90. box-sizing: border-box;
  91. width: calc(100% - 16rpx);
  92. display: flex;
  93. background: #fff;
  94. border-radius: 16rpx;
  95. padding: 12rpx;
  96. margin: 8rpx;
  97. }
  98. .tab {
  99. flex: 1;
  100. text-align: center;
  101. padding: 18rpx 0;
  102. border-radius: 12rpx;
  103. font-size: 28rpx;
  104. }
  105. .tab.active {
  106. background: #2c69ff;
  107. color: #fff;
  108. }
  109. </style>