pharmacy.vue 15 KB

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