index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <view class="scan-rate-page">
  3. <view class="scan-rate-ranges-container">
  4. <view class="scan-rate-ranges">
  5. <view class="scan-rate-ranges-content">
  6. <view class="scan-rate-range" :class="{ 'scan-rate-active': activeRange === 1 }" @click="activeRange = 1">近7天
  7. </view>
  8. <view class="scan-rate-range" :class="{ 'scan-rate-active': activeRange === 2 }" @click="activeRange = 2">当月
  9. </view>
  10. <view class="scan-rate-range" :class="{ 'scan-rate-active': activeRange === 3 }" @click="activeRange = 3">上个月
  11. </view>
  12. <view class="scan-rate-range" :class="{ 'scan-rate-active': activeRange === 4 }" @click="activeRange = 4">近60天
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="scan-rate-content">
  18. <ScanRateTable ref="scanTableVip" title="VIP客户扫码率" :api="`/bills/getVipScanRate`" :params="{
  19. type: activeRange,
  20. }" scanType="1" :products="products" @dropdown-open="closeDropdown" tableType="VIP" headerFontSize="28rpx" />
  21. <ScanRateTable ref="scanTableL2" title="二级客户扫码率" :api="`/bills/getSecondCustomerScanRate`" :params="{
  22. type: activeRange,
  23. }" scanType="2" :products="products" @dropdown-open="closeDropdown" tableType="二级" headerFontSize="28rpx" />
  24. <ScanRateTable ref="scanTableL3" title="三级客户扫码率" :api="`/bills/getThreeCustomerScanRate`" :params="{
  25. type: activeRange,
  26. }" scanType="3" :products="products" @dropdown-open="closeDropdown" tableType="三级" headerFontSize="28rpx" />
  27. <ScanRateTable ref="scanTableVariety" title="品种扫码率" :columns="varietyColumns" tableWidth="1120rpx"
  28. headerFontSize="24rpx" bodyFontColor="#000" :api="`/bills/geVarietyScanRate`" tableType="variety" :params="{
  29. type: activeRange,
  30. }" :showSummary="false" :products="products" :regions="regions" dropdownDirection="top"
  31. @dropdown-open="closeDropdown" />
  32. <!-- <view class="scan-rate-footer">
  33. <view class="scan-rate-footer-btn" @click="onExport">导出数据</view>
  34. </view> -->
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import ScanRateTable from "./wigets/ScanRateTable.vue";
  40. import request from "../../../request/index";
  41. export default {
  42. components: {
  43. ScanRateTable,
  44. },
  45. data() {
  46. return {
  47. activeRange: 1,
  48. varietyColumns: [
  49. {
  50. key: "regionName",
  51. title: "品种名",
  52. fixed: true,
  53. width: "140rpx",
  54. },
  55. {
  56. key: "oneInScanRate",
  57. title: `<view :style="{ textAlign: 'center' }">
  58. <view>一级客户</view>
  59. <view>入库扫码率</view>
  60. </view>`,
  61. width: "165rpx",
  62. },
  63. {
  64. key: "oneOutScanRate",
  65. title: `<view :style="{ textAlign: 'center' }">
  66. <view>一级客户</view>
  67. <view>出库扫码率</view>
  68. </view>`,
  69. width: "165rpx",
  70. },
  71. {
  72. key: "twoCustomerInScanRate",
  73. title: `<view :style="{ textAlign: 'center' }">
  74. <view>二级客户</view>
  75. <view>入库扫码率</view>
  76. </view>`,
  77. width: "165rpx",
  78. },
  79. {
  80. key: "twoCustomerOutScanRate",
  81. title: `<view :style="{ textAlign: 'center' }">
  82. <view>二级客户</view>
  83. <view>出库扫码率</view>
  84. </view>`,
  85. width: "165rpx",
  86. },
  87. {
  88. key: "threeCustomerInScanRate",
  89. title: `<view :style="{ textAlign: 'center' }">
  90. <view>三级客户</view>
  91. <view>入库扫码率</view>
  92. </view>`,
  93. width: "165rpx",
  94. },
  95. {
  96. key: "threeCustomerOutScanRate",
  97. title: `<view :style="{ textAlign: 'center' }">
  98. <view>三级客户</view>
  99. <view>出库扫码率</view>
  100. </view>`,
  101. width: "165rpx",
  102. },
  103. ],
  104. products: [],
  105. regions: [],
  106. };
  107. },
  108. created() {
  109. Promise.all([this.getProviceList(), this.getDrugInfoName()]).then(
  110. () => { }
  111. );
  112. },
  113. methods: {
  114. // onExport() {
  115. // uni.showToast({ title: "开始导出", icon: "none" });
  116. // },
  117. getProviceList() {
  118. request('/common/getProviceList', {
  119. path: 'customerScanningRate/wigets/ScanRateTable.vue',
  120. }).then(res => {
  121. if (res.code == 200) {
  122. const _data = res.data;
  123. this.regions = [{ regionCode: null, regionName: '全省份' }, ..._data];
  124. }
  125. })
  126. },
  127. getDrugInfoName() {
  128. request('/bills/getDrugInfoName', {
  129. path: 'customerScanningRate/wigets/ScanRateTable.vue',
  130. }).then(res => {
  131. if (res.code == 200) {
  132. const _data = res.data;
  133. this.products = [{ drugEntBaseInfoId: null, physicName: '全品种' }, ..._data];
  134. }
  135. })
  136. },
  137. closeDropdown() {
  138. const r = this.$refs || {};
  139. const keys = [
  140. "scanTableVip",
  141. "scanTableL2",
  142. "scanTableL3",
  143. "scanTableVariety",
  144. ];
  145. keys.forEach((k) => {
  146. const c = r[k];
  147. if (c && typeof c.closeDropdown === "function") c.closeDropdown();
  148. if (c && typeof c.closeAllTooltip === "function") c.closeAllTooltip();
  149. });
  150. },
  151. },
  152. };
  153. </script>
  154. <style>
  155. .scan-rate-ranges-container {
  156. position: fixed;
  157. top: 100rpx;
  158. left: 0;
  159. width: 100%;
  160. height: 140rpx;
  161. background: #f3f6f9;
  162. z-index: 99;
  163. }
  164. .scan-rate-ranges {
  165. padding: 20rpx 30rpx;
  166. }
  167. .scan-rate-ranges-content {
  168. display: flex;
  169. background: #fff;
  170. padding: 20rpx 30rpx;
  171. border-radius: 16rpx;
  172. justify-content: space-between;
  173. }
  174. .scan-rate-range {
  175. padding: 12rpx 35rpx;
  176. border-radius: 5rpx;
  177. background: rgb(240, 240, 240);
  178. font-size: 26rpx;
  179. }
  180. .scan-rate-range.scan-rate-active {
  181. background: #2c69ff;
  182. color: #fff;
  183. }
  184. /* .scan-rate-footer {
  185. position: fixed;
  186. left: 0;
  187. right: 0;
  188. bottom: 0;
  189. padding: 12rpx 30rpx calc(env(safe-area-inset-bottom));
  190. background: #fff;
  191. z-index: 999;
  192. }
  193. .scan-rate-footer-btn {
  194. height: 86rpx;
  195. border-radius: 999rpx;
  196. background: #2c69ff;
  197. color: #fff;
  198. display: flex;
  199. align-items: center;
  200. justify-content: center;
  201. font-size: 30rpx;
  202. box-shadow: 0 8rpx 24rpx rgba(44, 105, 255, 0.35);
  203. } */
  204. </style>