index.vue 6.7 KB

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