index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. if (!this.$refs.scanRate) return
  87. this.$refs.scanRate.closeDropdown();
  88. },
  89. async getFunc() {
  90. uni.showLoading({
  91. title: '加载中',
  92. mask: true,
  93. })
  94. await hasFunction(['scan-rate-list', 'trace-code-task', 'blacklist-customers-list', 'large-medicines-list']).then(res => {
  95. this.hasScanFunction = res[0]
  96. this.hasReportFunction = res[1]
  97. this.hasBlacklistFunction = res[2]
  98. this.hasGanmaolingFunction = res[3]
  99. }).catch(err => {
  100. this.hasScanFunction = false
  101. this.hasReportFunction = false
  102. this.hasBlacklistFunction = false
  103. this.hasGanmaolingFunction = false
  104. // uni.hideLoading()
  105. })
  106. if (this.hasScanFunction) {
  107. this.active = 'scan'
  108. } else if (this.hasReportFunction) {
  109. this.activeTab = 'export'
  110. } else if (this.hasBlacklistFunction) {
  111. this.activeTab = 'blacklist'
  112. } else if (this.hasGanmaolingFunction) {
  113. this.activeTab = 'ganmaoling'
  114. }
  115. this.functionLoading = false
  116. uni.hideLoading()
  117. }
  118. },
  119. };
  120. </script>
  121. <style>
  122. .page {
  123. box-sizing: border-box;
  124. height: calc(100vh - env(safe-area-inset-bottom));
  125. overflow-y: auto;
  126. box-sizing: border-box;
  127. background: #f3f6f9;
  128. padding-bottom: calc(env(safe-area-inset-bottom));
  129. }
  130. .content {
  131. padding: 30rpx;
  132. margin-top: 180rpx;
  133. }
  134. .tabs-container {
  135. position: fixed;
  136. top: 0;
  137. left: 0;
  138. width: 100%;
  139. height: 116rpx;
  140. background: #f3f6f9;
  141. z-index: 90;
  142. margin-top: -8rpx;
  143. }
  144. .tabs {
  145. box-sizing: border-box;
  146. width: calc(100% - 16rpx);
  147. display: flex;
  148. background: #fff;
  149. border-radius: 16rpx;
  150. padding: 12rpx;
  151. margin: 8rpx;
  152. }
  153. .tab {
  154. flex: 1;
  155. text-align: center;
  156. padding: 18rpx 0;
  157. border-radius: 12rpx;
  158. font-size: 28rpx;
  159. }
  160. .tab.active {
  161. background: #2c69ff;
  162. color: #fff;
  163. }
  164. </style>