index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <Water></Water>
  3. <view v-if="hasFunction" class="page" @click.stop="closeDropdowns">
  4. <view class="tabs-container">
  5. <view class="tabs">
  6. <view v-if="hasScanFunction" class="tab" :class="{ active: activeTab === 'scan' }" @click="activeTab = 'scan'">
  7. 扫码率</view>
  8. <view v-if="hasReportFunction" class="tab" :class="{ active: activeTab === 'export' }"
  9. @click="activeTab = 'export'">报表导出</view>
  10. <view v-if="hasBlacklistFunction" class="tab" :class="{ active: activeTab === 'blacklist' }"
  11. @click="activeTab = 'blacklist'">黑名单汇总</view>
  12. <view v-if="hasGanmaolingFunction" class="tab" :class="{ active: activeTab === 'ganmaoling' }"
  13. @click="activeTab = 'ganmaoling'">感冒灵大批量</view>
  14. </view>
  15. </view>
  16. <view class="content" v-if="activeTab === 'scan' && hasScanFunction">
  17. <ScanningRate ref="scanRate" />
  18. </view>
  19. <view class="content" :style="{ padding: '0', marginTop: '85rpx' }"
  20. v-if="activeTab === 'export' && hasReportFunction">
  21. <ReportExport />
  22. </view>
  23. <view class="content" :style="{ padding: '0', marginTop: '85rpx' }"
  24. v-if="activeTab === 'blacklist' && hasBlacklistFunction">
  25. <Blacklist />
  26. </view>
  27. <view class="content" :style="{ padding: '0', marginTop: '85rpx' }"
  28. v-if="activeTab === 'ganmaoling' && hasGanmaolingFunction">
  29. <Ganmaoling />
  30. </view>
  31. </view>
  32. <view v-else-if="!functionLoading" class="page">
  33. <Empty text="您无权限访问" />
  34. </view>
  35. </template>
  36. <script>
  37. import LoadingImg from "../../static/images/loading.png";
  38. import ReportExport from "./reportExport/index.vue";
  39. import ScanningRate from "./customerScanningRate/index.vue";
  40. import Blacklist from "./blacklist/index.vue";
  41. import Ganmaoling from "./ganmaoling/index.vue";
  42. import Empty from "../../wigets/empty.vue";
  43. import Water from "@/components/water/water.vue";
  44. import { hasFunction } from '../../utils/utils.js'
  45. export default {
  46. components: {
  47. ScanningRate,
  48. ReportExport,
  49. Blacklist,
  50. Ganmaoling,
  51. Empty,
  52. Water,
  53. },
  54. data() {
  55. return {
  56. hasScanFunction: false,
  57. hasReportFunction: false,
  58. hasBlacklistFunction: false,
  59. hasGanmaolingFunction: false,
  60. // hasScanFunction: true,
  61. // hasReportFunction: true,
  62. // hasBlacklistFunction: true,
  63. // hasGanmaolingFunction: true,
  64. loading: true,
  65. LoadingImg,
  66. activeTab: "scan",
  67. activeRange: 1,
  68. filterModalOpen: false,
  69. filterForm: { report: "", product: "" },
  70. filterDropdown: { report: false, product: false },
  71. filterDateRange: [],
  72. functionLoading: true,
  73. // functionLoading: false,
  74. };
  75. },
  76. created() {
  77. this.getFunc()
  78. },
  79. computed: {
  80. hasFunction() {
  81. return this.hasScanFunction || this.hasReportFunction || this.hasBlacklistFunction || this.hasGanmaolingFunction
  82. }
  83. },
  84. methods: {
  85. closeDropdowns() {
  86. this.$refs.scanRate.closeDropdown();
  87. },
  88. async getFunc() {
  89. uni.showLoading({
  90. title: '加载中',
  91. mask: true,
  92. })
  93. await hasFunction(['scan-rate-list', 'trace-code-task', 'blacklist-customers-list', 'large-medicines-list']).then(res => {
  94. this.hasScanFunction = res[0]
  95. this.hasReportFunction = res[1]
  96. this.hasBlacklistFunction = res[2]
  97. this.hasGanmaolingFunction = res[3]
  98. }).catch(err => {
  99. this.hasScanFunction = false
  100. this.hasReportFunction = false
  101. this.hasBlacklistFunction = false
  102. this.hasGanmaolingFunction = false
  103. // uni.hideLoading()
  104. })
  105. if (this.hasScanFunction) {
  106. this.active = 'scan'
  107. } else if (this.hasReportFunction) {
  108. this.activeTab = 'export'
  109. } else if (this.hasBlacklistFunction) {
  110. this.activeTab = 'blacklist'
  111. } else if (this.hasGanmaolingFunction) {
  112. this.activeTab = 'ganmaoling'
  113. }
  114. this.functionLoading = false
  115. uni.hideLoading()
  116. }
  117. },
  118. };
  119. </script>
  120. <style>
  121. .page {
  122. box-sizing: border-box;
  123. height: calc(100vh - env(safe-area-inset-bottom));
  124. overflow-y: auto;
  125. box-sizing: border-box;
  126. background: #f3f6f9;
  127. padding-bottom: calc(env(safe-area-inset-bottom));
  128. }
  129. .content {
  130. padding: 30rpx;
  131. margin-top: 180rpx;
  132. }
  133. .tabs-container {
  134. position: fixed;
  135. top: 0;
  136. left: 0;
  137. width: 100%;
  138. height: 116rpx;
  139. background: #f3f6f9;
  140. z-index: 90;
  141. margin-top: -8rpx;
  142. }
  143. .tabs {
  144. box-sizing: border-box;
  145. width: calc(100% - 16rpx);
  146. display: flex;
  147. background: #fff;
  148. border-radius: 16rpx;
  149. padding: 12rpx;
  150. margin: 8rpx;
  151. }
  152. .tab {
  153. flex: 1;
  154. text-align: center;
  155. padding: 18rpx 0;
  156. border-radius: 12rpx;
  157. font-size: 28rpx;
  158. }
  159. .tab.active {
  160. background: #2c69ff;
  161. color: #fff;
  162. }
  163. </style>