index.vue 6.6 KB

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