index.vue 6.2 KB

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