index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  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天 </view> -->
  7. <view class="scan-rate-range" :class="{ 'scan-rate-active': activeRange === 2 }" @click="activeRange = 2">当月 </view>
  8. <view class="scan-rate-range" :class="{ 'scan-rate-active': activeRange === 3 }" @click="activeRange = 3">上个月 </view>
  9. <!-- <view class="scan-rate-range" :class="{ 'scan-rate-active': activeRange === 4 }" @click="activeRange = 4">近60天 </view> -->
  10. <view class="scan-rate-range" :class="{ 'scan-rate-active': activeRange === 5 }" @click="activeRange = 5">当年 </view>
  11. </view>
  12. </view>
  13. </view>
  14. <view class="scan-rate-content">
  15. <ScanRateTable
  16. ref="scanTableVip"
  17. title="VIP客户扫码率"
  18. :api="`/bills/getVipScanRate`"
  19. :params="{
  20. type: activeRange + '',
  21. pageSize: 40,
  22. }"
  23. scanType="1"
  24. :products="products"
  25. :entNames="entNames"
  26. @dropdown-open="closeDropdown"
  27. tableType="VIP"
  28. headerFontSize="28rpx"
  29. tableHeightAuto="true"
  30. showAreaSearch="false" />
  31. <ScanRateTable
  32. ref="scanTableL2"
  33. title="二级客户扫码率"
  34. :api="`/bills/getSecondCustomerScanRate`"
  35. :params="{
  36. type: activeRange + '',
  37. pageSize: 40,
  38. }"
  39. scanType="2"
  40. :products="products"
  41. :entNames="entNames"
  42. @dropdown-open="closeDropdown"
  43. tableType="二级"
  44. headerFontSize="28rpx"
  45. tableHeightAuto="true"
  46. showAreaSearch="false" />
  47. <ScanRateTable
  48. ref="scanTableL3"
  49. title="三级客户扫码率"
  50. :api="`/bills/getThreeCustomerScanRate`"
  51. :params="{
  52. type: activeRange + '',
  53. pageSize: 40,
  54. }"
  55. scanType="3"
  56. :products="products"
  57. :entNames="entNames"
  58. @dropdown-open="closeDropdown"
  59. tableType="三级"
  60. headerFontSize="28rpx"
  61. tableHeightAuto="true"
  62. showAreaSearch="false" />
  63. <ScanRateTable
  64. ref="scanTableVariety"
  65. title="品种扫码率"
  66. :columns="varietyColumns"
  67. tableWidth="1200rpx"
  68. headerFontSize="24rpx"
  69. bodyFontColor="#000"
  70. :api="`/bills/geVarietyScanRate`"
  71. tableType="variety"
  72. :params="{
  73. type: activeRange + '',
  74. }"
  75. :showSummary="false"
  76. :products="products"
  77. :entNames="entNames"
  78. :regions="regions"
  79. dropdownDirection="top"
  80. @dropdown-open="closeDropdown" />
  81. <!-- <view class="scan-rate-footer">
  82. <view class="scan-rate-footer-btn" @click="onExport">导出数据</view>
  83. </view> -->
  84. </view>
  85. </view>
  86. <BottomScrollTip :text="'下滑查看更多内容'" />
  87. </template>
  88. <script>
  89. import ScanRateTable from "./wigets/ScanRateTable.vue";
  90. import request from "../../../request/index";
  91. import BottomScrollTip from "../../../wigets/BottomScrollTip.vue";
  92. export default {
  93. components: {
  94. ScanRateTable,
  95. BottomScrollTip,
  96. },
  97. data() {
  98. return {
  99. activeRange: 3,
  100. varietyColumns: [
  101. {
  102. key: "physicName",
  103. title: "品种名",
  104. fixed: true,
  105. width: "220rpx",
  106. },
  107. {
  108. key: "oneInScanRate",
  109. title: `<view :style="{ textAlign: 'center' }">
  110. <view>一级客户</view>
  111. <view>入库扫码率</view>
  112. </view>`,
  113. width: "165rpx",
  114. unit: "%",
  115. },
  116. {
  117. key: "oneOutScanRate",
  118. title: `<view :style="{ textAlign: 'center' }">
  119. <view>一级客户</view>
  120. <view>出库扫码率</view>
  121. </view>`,
  122. width: "165rpx",
  123. unit: "%",
  124. },
  125. {
  126. key: "twoCustomerInScanRate",
  127. title: `<view :style="{ textAlign: 'center' }">
  128. <view>二级客户</view>
  129. <view>入库扫码率</view>
  130. </view>`,
  131. width: "165rpx",
  132. unit: "%",
  133. },
  134. {
  135. key: "twoCustomerOutScanRate",
  136. title: `<view :style="{ textAlign: 'center' }">
  137. <view>二级客户</view>
  138. <view>出库扫码率</view>
  139. </view>`,
  140. width: "165rpx",
  141. unit: "%",
  142. },
  143. {
  144. key: "threeCustomerInScanRate",
  145. title: `<view :style="{ textAlign: 'center' }">
  146. <view>三级客户</view>
  147. <view>入库扫码率</view>
  148. </view>`,
  149. width: "165rpx",
  150. unit: "%",
  151. },
  152. {
  153. key: "threeCustomerOutScanRate",
  154. title: `<view :style="{ textAlign: 'center' }">
  155. <view>三级客户</view>
  156. <view>出库扫码率</view>
  157. </view>`,
  158. width: "165rpx",
  159. unit: "%",
  160. },
  161. ],
  162. products: [],
  163. regions: [],
  164. entNames: [],
  165. };
  166. },
  167. created() {
  168. Promise.all([this.getEntNameList(), this.getProviceList(), this.getDrugInfoName()]).then(() => {});
  169. },
  170. methods: {
  171. // onExport() {
  172. // uni.showToast({ title: "开始导出", icon: "none" });
  173. // },
  174. getEntNameList() {
  175. request(
  176. "/bills/getEntNameList",
  177. {
  178. path: "customerScanningRate/wigets/ScanRateTable.vue",
  179. },
  180. "get",
  181. ).then((res) => {
  182. if (res.code == 200) {
  183. const _data = res.data || [];
  184. this.entNames = [
  185. { entNameId: null, entName: "全厂家" },
  186. ..._data.map((item) => {
  187. return { entNameId: item, entName: String(item) };
  188. }),
  189. ];
  190. }
  191. });
  192. },
  193. getProviceList() {
  194. request("/common/getProviceOfRegionList", {
  195. path: "customerScanningRate/wigets/ScanRateTable.vue",
  196. }).then((res) => {
  197. if (res.code == 200) {
  198. const _data = res.data;
  199. this.regions = [{ regionCode: null, regionName: "全片区" }, ..._data];
  200. }
  201. });
  202. },
  203. getDrugInfoName() {
  204. request("/bills/getDrugInfoName", {
  205. path: "customerScanningRate/wigets/ScanRateTable.vue",
  206. }).then((res) => {
  207. if (res.code == 200) {
  208. const _data = res.data;
  209. this.products = [
  210. {
  211. drugEntBaseInfoId: null,
  212. physicName: "全品种",
  213. pkgSpec: [],
  214. },
  215. ..._data.map((row) => ({
  216. drugEntBaseInfoId: row.drugEntBaseInfoId,
  217. physicName: row.physicName,
  218. pkgSpec: (row.pkgSpec || []).map((sp) => ({
  219. pkgSpec: sp,
  220. pkgSpecName: String(sp),
  221. })),
  222. })),
  223. ];
  224. }
  225. });
  226. },
  227. closeDropdown() {
  228. const r = this.$refs || {};
  229. const keys = ["scanTableVip", "scanTableL2", "scanTableL3", "scanTableVariety"];
  230. keys.forEach((k) => {
  231. const c = r[k];
  232. if (c && typeof c.closeDropdown === "function") c.closeDropdown();
  233. if (c && typeof c.closeAllTooltip === "function") c.closeAllTooltip();
  234. });
  235. },
  236. },
  237. };
  238. </script>
  239. <style>
  240. .scan-rate-ranges-container {
  241. position: fixed;
  242. top: 100rpx;
  243. left: 0;
  244. width: 100%;
  245. height: 140rpx;
  246. background: #f3f6f9;
  247. z-index: 90;
  248. }
  249. .scan-rate-ranges {
  250. padding: 20rpx 30rpx;
  251. }
  252. .scan-rate-ranges-content {
  253. display: flex;
  254. background: #fff;
  255. padding: 20rpx 30rpx;
  256. border-radius: 16rpx;
  257. justify-content: space-between;
  258. }
  259. .scan-rate-range {
  260. padding: 12rpx 24rpx;
  261. border-radius: 5rpx;
  262. background: rgb(240, 240, 240);
  263. font-size: 26rpx;
  264. width: 20%;
  265. text-align: center;
  266. }
  267. .scan-rate-range.scan-rate-active {
  268. background: #2c69ff;
  269. color: #fff;
  270. }
  271. /* .scan-rate-footer {
  272. position: fixed;
  273. left: 0;
  274. right: 0;
  275. bottom: 0;
  276. padding: 12rpx 30rpx calc(env(safe-area-inset-bottom));
  277. background: #fff;
  278. z-index: 91;
  279. }
  280. .scan-rate-footer-btn {
  281. height: 86rpx;
  282. border-radius: 999rpx;
  283. background: #2c69ff;
  284. color: #fff;
  285. display: flex;
  286. align-items: center;
  287. justify-content: center;
  288. font-size: 30rpx;
  289. box-shadow: 0 8rpx 24rpx rgba(44, 105, 255, 0.35);
  290. } */
  291. </style>