pharmacy.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. <template>
  2. <view class="pharmacy">
  3. <view
  4. class="scanning_btn"
  5. hover-class="seimin-btn-hover"
  6. @click="drugsScanning()"
  7. >
  8. <text class="icon_transport transport-saoma"></text>
  9. </view>
  10. <view class="scanFont">扫一扫</view>
  11. <view class="pharmacy-heng">
  12. <view
  13. class="pharmacy-heng-tab"
  14. :class="{ 'cube-tab_active': selectedLabelSlots === item.label }"
  15. v-for="(item, i) in tabs"
  16. :key="i"
  17. @click="clickHandler(item.label)"
  18. >
  19. <view class="pharmacy-heng-label">{{ item.label }}</view>
  20. </view>
  21. </view>
  22. <view>
  23. <scroll-view
  24. scroll-y
  25. :refresher-enabled="scroll_refresher_enabled"
  26. :refresher-triggered="triggered"
  27. @refresherrefresh="refresherrefresh"
  28. @refresherrestore="refresherrestore"
  29. @scroll="scroll"
  30. @scrolltolower="scrolltolower"
  31. :scroll-top="scroll_top"
  32. @refresherabort="refresherabort"
  33. >
  34. <view class="page_scrollIt">
  35. <view
  36. class="page_item_wrap"
  37. v-for="row in list"
  38. :key="row.id"
  39. @click="getDetails(row.id)"
  40. >
  41. <view class="page_item">
  42. <view class="page_item_top">
  43. <view class="page_item_top-inner">
  44. <view class="page_item_top_L">
  45. <text class="L_text">请领单:{{ row.packid }}</text>
  46. </view>
  47. <view class="page_item_top_R">
  48. <text class="L_iocn">{{
  49. row.drugsState && row.drugsState.name
  50. }}</text>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="page_item_cont">
  55. <view class="page_item_cont_T">
  56. <view class="page_item_cont_title">
  57. <text>批次号</text>
  58. <text class="text_big">{{ row.batchNo }}</text>
  59. </view>
  60. </view>
  61. <view class="page_item_cont_B">
  62. <view class="page_item_cont_title">
  63. <text>请领时间</text>
  64. <text class="text_big">
  65. <text>{{ row.creatTime }}</text>
  66. </text>
  67. </view>
  68. </view>
  69. <view class="page_item_cont_C">
  70. <view class="page_item_cont_title_C">
  71. <text>请领科室</text>
  72. <text class="text_big">
  73. <text>{{ row.target && row.target.dept }}</text>
  74. </text>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="L"></view>
  79. <view class="R"></view>
  80. </view>
  81. <view class="L-l"></view>
  82. <view class="R-l"></view>
  83. </view>
  84. <view v-if="list.length == 0" class="zwsj">
  85. <image
  86. class="zwsj_img"
  87. mode="widthFix"
  88. src="../../static/img/zanwushuju.png"
  89. ></image>
  90. <view class="zwsj_txt">暂无数据</view>
  91. </view>
  92. </view>
  93. </scroll-view>
  94. </view>
  95. </view>
  96. </template>
  97. <script>
  98. import { get, post, SM, webHandle } from "../../http/http.js";
  99. export default {
  100. data() {
  101. return {
  102. triggered: false, //下拉刷新状态
  103. freshing: false, //上拉加载开关
  104. scroll_top: 0, //距离顶部的距离
  105. scroll_refresher_enabled: true, //是否开启自定义下拉刷新
  106. selectedLabelSlots: "待配药",
  107. list: [],
  108. idx: 0,
  109. totalNum: -1,
  110. tabs: [
  111. {
  112. label: "待配药",
  113. },
  114. {
  115. label: "配药中",
  116. },
  117. {
  118. label: "核对中",
  119. },
  120. ],
  121. };
  122. },
  123. methods: {
  124. // tab切换
  125. clickHandler(key) {
  126. this.selectedLabelSlots = key;
  127. this.idx = 0;
  128. this.totalNum = -1;
  129. this.scroll_top = Math.random();
  130. //4为微信待配药、5为微信配药中、6为微信核对中
  131. if (key == "待配药") {
  132. this.getPharmacyListData(4, 0);
  133. } else if (key == "配药中") {
  134. this.getPharmacyListData(5, 0);
  135. } else if (key == "核对中") {
  136. this.getPharmacyListData(6, 0);
  137. }
  138. },
  139. // 请求列表数据
  140. getPharmacyListData(type, idx) {
  141. if (this.list.length == this.totalNum) {
  142. uni.showToast({
  143. icon: "none",
  144. title: "没有更多数据了!",
  145. });
  146. this.freshing = true;
  147. return;
  148. }
  149. let data = {
  150. idx,
  151. sum: 20,
  152. drugsBag: {
  153. searchType: type,
  154. },
  155. };
  156. uni.showLoading({
  157. title: "加载中",
  158. mask: true,
  159. });
  160. post("/api/fetchDataList/drugsBag", data).then((res) => {
  161. uni.hideLoading();
  162. if (res.status == 200) {
  163. this.triggered = false;
  164. this.freshing = true;
  165. this.totalNum = res.totalNum;
  166. if (idx === 0) {
  167. this.list = res.list;
  168. } else {
  169. this.list.push(...res.list);
  170. }
  171. } else {
  172. uni.showToast({
  173. icon: "none",
  174. title: "请求失败!",
  175. });
  176. }
  177. });
  178. },
  179. // 扫一扫
  180. drugsScanning() {
  181. SM().then((ress) => {
  182. uni.navigateTo({
  183. url: "../pharmacyDetails/pharmacyDetails?qrcode=" + ress,
  184. });
  185. });
  186. },
  187. //刷新
  188. refresherrefresh() {
  189. if (this.triggered) {
  190. return;
  191. }
  192. this.triggered = true;
  193. this.idx = 0;
  194. this.totalNum = -1;
  195. if (this.selectedLabelSlots == "待配药") {
  196. this.getPharmacyListData(4, 0);
  197. } else if (this.selectedLabelSlots == "配药中") {
  198. this.getPharmacyListData(5, 0);
  199. } else if (this.selectedLabelSlots == "核对中") {
  200. this.getPharmacyListData(6, 0);
  201. }
  202. },
  203. // 滚动
  204. scroll(e) {
  205. if (e.detail.scrollTop < 20) {
  206. this.scroll_refresher_enabled = true;
  207. } else {
  208. this.scroll_refresher_enabled = false;
  209. }
  210. },
  211. // 下拉刷新复位
  212. refresherrestore() {
  213. this.triggered = false;
  214. console.log("下拉刷新复位");
  215. },
  216. //下拉刷新中止
  217. refresherabort() {
  218. this.triggered = false;
  219. console.log("下拉刷新中止");
  220. },
  221. //分页,上拉加载
  222. scrolltolower() {
  223. if (this.freshing) {
  224. this.freshing = false;
  225. if (this.selectedLabelSlots == "待配药") {
  226. this.getPharmacyListData(4, ++this.idx);
  227. } else if (this.selectedLabelSlots == "配药中") {
  228. this.getPharmacyListData(5, ++this.idx);
  229. } else if (this.selectedLabelSlots == "核对中") {
  230. this.getPharmacyListData(6, ++this.idx);
  231. }
  232. }
  233. },
  234. // 详情页面
  235. getDetails(id) {
  236. uni.navigateTo({
  237. url: `../pharmacyDetails/pharmacyDetails?id=${id}`,
  238. });
  239. },
  240. // 阻止浏览器滑动
  241. stop(e) {
  242. e.preventDefault();
  243. },
  244. },
  245. onLoad(options) {
  246. //#ifdef H5
  247. console.log(options.login, "login");
  248. if (options.login == 1) {
  249. // uni.setStorageSync('type', 'pharmacy')
  250. uni.redirectTo({
  251. url: "../homePage/homePage?type=pharmacy",
  252. });
  253. }
  254. //#endif
  255. // 待配药
  256. this.getPharmacyListData(4, 0);
  257. // #ifdef APP-PLUS
  258. webHandle("no", "app");
  259. // #endif
  260. // #ifdef H5
  261. webHandle("no", "wx");
  262. // #endif
  263. },
  264. onShow() {
  265. // #ifdef H5
  266. document.body.addEventListener("touchmove", this.stop, { passive: false });
  267. // #endif
  268. },
  269. onUnload() {
  270. // #ifdef H5
  271. document.body.removeEventListener("touchmove", this.stop, {
  272. passive: false,
  273. });
  274. // #endif
  275. },
  276. };
  277. </script>
  278. <style lang="less">
  279. // 覆盖cube
  280. .cube-tab-bar {
  281. display: block !important;
  282. }
  283. .pharmacy /deep/ .cube-tab-bar-slider {
  284. display: none !important;
  285. }
  286. .pharmacy {
  287. background-color: rgb(249, 250, 251);
  288. padding-top: 36rpx;
  289. .scanning_btn {
  290. margin: 0 auto;
  291. width: 138rpx;
  292. height: 138rpx;
  293. background: #72c172;
  294. border-radius: 50%;
  295. /*偏移*/
  296. line-height: 200rpx;
  297. color: #fff;
  298. font-size: 36rpx;
  299. display: flex;
  300. justify-content: center;
  301. align-items: center;
  302. text {
  303. font-size: 48rpx;
  304. }
  305. }
  306. .zwsj {
  307. // margin-top: 180rpx;
  308. padding-top: 10%;
  309. display: flex;
  310. flex-direction: column;
  311. align-items: center;
  312. .zwsj_txt {
  313. font-size: 36rpx;
  314. font-weight: 700;
  315. margin-top: 20rpx;
  316. }
  317. .zwsj_img {
  318. width: 582rpx;
  319. }
  320. }
  321. .page_item_wrap {
  322. position: relative;
  323. margin-bottom: 32rpx;
  324. .page_item {
  325. margin-top: 16rpx;
  326. margin-bottom: 124rpx;
  327. background: #fff;
  328. border-radius: 8rpx;
  329. margin: 0 20rpx;
  330. border: 2rpx solid #e5e9ed;
  331. position: relative;
  332. overflow: hidden;
  333. padding: 0 16rpx;
  334. .L {
  335. width: 40rpx;
  336. height: 40rpx;
  337. border-radius: 50%;
  338. background: #f9fafb;
  339. position: absolute;
  340. left: -20rpx;
  341. top: 68rpx;
  342. border: 2rpx solid #e5e9ed;
  343. }
  344. .R {
  345. width: 40rpx;
  346. height: 40rpx;
  347. border-radius: 50%;
  348. background: #f9fafb;
  349. position: absolute;
  350. float: right;
  351. right: -20rpx;
  352. top: 68rpx;
  353. border: 2rpx solid #e5e9ed;
  354. }
  355. .page_item_top {
  356. height: 88rpx;
  357. border-bottom: 2rpx dashed #e5e9ed;
  358. padding: 0 16rpx;
  359. .page_item_top-inner {
  360. display: flex;
  361. justify-content: space-between;
  362. align-items: center;
  363. height: 100%;
  364. .page_item_top_L {
  365. .L_text {
  366. font-size: 32rpx;
  367. font-weight: 700;
  368. }
  369. }
  370. .page_item_top_R {
  371. font-size: 32rpx;
  372. .L_iocn {
  373. color: rgb(7, 134, 60);
  374. font-size: 36rpx;
  375. font-weight: 700;
  376. }
  377. }
  378. }
  379. }
  380. .page_item_cont {
  381. min-height: 180rpx;
  382. max-height: 424rpx;
  383. padding: 0 16rpx;
  384. text-align: left;
  385. position: relative;
  386. .text_big {
  387. font-size: 32rpx;
  388. font-weight: 700;
  389. text {
  390. font-weight: 700;
  391. line-height: 1.5;
  392. }
  393. }
  394. .line {
  395. height: 20rpx;
  396. width: 2rpx;
  397. border-left: 2rpx solid #e5e9ed;
  398. position: absolute;
  399. top: 82rpx;
  400. left: 40rpx;
  401. }
  402. .page_item_cont_T {
  403. padding-top: 28rpx;
  404. font-size: 28rpx;
  405. .page_item_cont_title {
  406. height: 100%;
  407. font-size: 32rpx;
  408. display: flex;
  409. justify-content: space-between;
  410. align-items: center;
  411. }
  412. }
  413. .page_item_cont_B {
  414. padding-top: 28rpx;
  415. margin-bottom: 28rpx;
  416. .page_item_cont_title {
  417. font-size: 32rpx;
  418. display: flex;
  419. justify-content: space-between;
  420. align-items: center;
  421. }
  422. }
  423. .page_item_cont_C {
  424. margin-bottom: 28rpx;
  425. .page_item_cont_title_C {
  426. font-size: 32rpx;
  427. display: flex;
  428. justify-content: space-between;
  429. }
  430. }
  431. }
  432. #infos {
  433. display: none;
  434. }
  435. }
  436. .L-l {
  437. width: 2rpx;
  438. height: 40rpx;
  439. background: #f9fafb;
  440. position: absolute;
  441. left: 20rpx;
  442. top: 72rpx;
  443. }
  444. .R-l {
  445. width: 2rpx;
  446. height: 40rpx;
  447. background: #f9fafb;
  448. position: absolute;
  449. right: 20rpx;
  450. top: 72rpx;
  451. }
  452. }
  453. .pharmacy-heng {
  454. height: 90rpx;
  455. display: flex;
  456. background-color: #fff;
  457. margin-bottom: 32rpx;
  458. .pharmacy-heng-tab {
  459. flex: 1 !important;
  460. display: flex;
  461. align-items: center;
  462. .pharmacy-heng-label {
  463. flex: 1;
  464. display: flex;
  465. justify-content: center;
  466. align-items: center;
  467. font-size: 36rpx;
  468. width: 204rpx;
  469. height: 60rpx;
  470. border-radius: 30rpx;
  471. background-color: #fff;
  472. color: rgb(102, 102, 102);
  473. }
  474. &.cube-tab_active {
  475. .pharmacy-heng-label {
  476. display: flex;
  477. justify-content: center;
  478. align-items: center;
  479. font-size: 36rpx;
  480. width: 204rpx;
  481. height: 60rpx;
  482. border-radius: 30rpx;
  483. background-color: rgb(229, 233, 237);
  484. color: rgb(51, 51, 51);
  485. }
  486. }
  487. }
  488. }
  489. // 滚动区域
  490. .page_scrollIt {
  491. height: calc(100vh - 380rpx);
  492. }
  493. // “扫一扫”文字
  494. .scanFont {
  495. font-size: 36rpx;
  496. font-weight: 700;
  497. margin-top: 16rpx;
  498. margin-bottom: 32rpx;
  499. text-align: center;
  500. }
  501. }
  502. </style>