pharmacy.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  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").user,
  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.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. uni.setStorageSync('userData', this.loginUser);
  269. }
  270. })
  271. }
  272. },
  273. onLoad(options) {
  274. //#ifdef H5
  275. console.log(options.login, "login");
  276. if (options.login == 1) {
  277. // uni.setStorageSync('type', 'pharmacy')
  278. uni.redirectTo({
  279. url: "../homePage/homePage?type=pharmacy",
  280. });
  281. }
  282. //#endif
  283. if (options.id && options.dept) {
  284. let {
  285. id,
  286. dept
  287. } = options;
  288. this.currenDept.id = id;
  289. this.currenDept.dept = dept;
  290. this.updateUser(this.currenDept)
  291. } else {
  292. this.currenDept = uni.getStorageSync("userData").user.dept;
  293. }
  294. // 请求列表
  295. this.getPharmacyListData(this.selectedLabelSlots, 0);
  296. // #ifdef APP-PLUS
  297. webHandle("no", "app");
  298. // #endif
  299. // #ifdef H5
  300. webHandle("no", "wx");
  301. // #endif
  302. },
  303. onShow() {
  304. // #ifdef H5
  305. document.body.addEventListener("touchmove", this.stop, { passive: false });
  306. // #endif
  307. },
  308. onUnload() {
  309. // #ifdef H5
  310. document.body.removeEventListener("touchmove", this.stop, {
  311. passive: false,
  312. });
  313. // #endif
  314. },
  315. };
  316. </script>
  317. <style lang="less">
  318. // 覆盖cube
  319. .cube-tab-bar {
  320. display: block !important;
  321. }
  322. .pharmacy /deep/ .cube-tab-bar-slider {
  323. display: none !important;
  324. }
  325. .pharmacy {
  326. background-color: rgb(249, 250, 251);
  327. // padding-top: 36rpx;
  328. .pharmacy_header{
  329. position: relative;
  330. .pharmacy_changeDept{
  331. padding: 16rpx 0;
  332. &.page_tab_bar {
  333. flex: 1;
  334. font-size: 36rpx;
  335. background: #fff;
  336. display: flex;
  337. justify-content: center;
  338. align-items: center;
  339. position: relative;
  340. &:after {
  341. content: "";
  342. position: absolute;
  343. left: 0;
  344. bottom: 0;
  345. height: 2rpx;
  346. width: 100%;
  347. background-color: transparent;
  348. }
  349. .tab_dept {
  350. position: relative;
  351. .changeDept {
  352. white-space: nowrap;
  353. margin: 0;
  354. position: absolute;
  355. right: 0;
  356. top: 50%;
  357. transform: translate(105%, -50%);
  358. padding: 0 0.5em;
  359. line-height: 2;
  360. }
  361. }
  362. &.active {
  363. color: #49b856;
  364. &:after {
  365. background-color: #49b856;
  366. }
  367. }
  368. }
  369. }
  370. }
  371. .scanning_btn {
  372. margin: 16rpx auto;
  373. width: 138rpx;
  374. height: 138rpx;
  375. background: #72c172;
  376. border-radius: 50%;
  377. /*偏移*/
  378. line-height: 200rpx;
  379. color: #fff;
  380. font-size: 36rpx;
  381. display: flex;
  382. justify-content: center;
  383. align-items: center;
  384. text {
  385. font-size: 48rpx;
  386. }
  387. }
  388. .zwsj {
  389. // margin-top: 180rpx;
  390. padding-top: 10%;
  391. display: flex;
  392. flex-direction: column;
  393. align-items: center;
  394. .zwsj_txt {
  395. font-size: 36rpx;
  396. font-weight: 700;
  397. margin-top: 20rpx;
  398. }
  399. .zwsj_img {
  400. width: 582rpx;
  401. }
  402. }
  403. .page_item_wrap {
  404. position: relative;
  405. margin-bottom: 32rpx;
  406. .page_item {
  407. margin-top: 16rpx;
  408. margin-bottom: 124rpx;
  409. background: #fff;
  410. border-radius: 8rpx;
  411. margin: 0 20rpx;
  412. border: 2rpx solid #e5e9ed;
  413. position: relative;
  414. overflow: hidden;
  415. padding: 0 16rpx;
  416. .L {
  417. width: 40rpx;
  418. height: 40rpx;
  419. border-radius: 50%;
  420. background: #f9fafb;
  421. position: absolute;
  422. left: -20rpx;
  423. top: 68rpx;
  424. border: 2rpx solid #e5e9ed;
  425. }
  426. .R {
  427. width: 40rpx;
  428. height: 40rpx;
  429. border-radius: 50%;
  430. background: #f9fafb;
  431. position: absolute;
  432. float: right;
  433. right: -20rpx;
  434. top: 68rpx;
  435. border: 2rpx solid #e5e9ed;
  436. }
  437. .page_item_top {
  438. height: 88rpx;
  439. border-bottom: 2rpx dashed #e5e9ed;
  440. padding: 0 16rpx;
  441. .page_item_top-inner {
  442. display: flex;
  443. justify-content: space-between;
  444. align-items: center;
  445. height: 100%;
  446. .page_item_top_L {
  447. .L_text {
  448. font-size: 32rpx;
  449. font-weight: 700;
  450. }
  451. }
  452. .page_item_top_R {
  453. font-size: 32rpx;
  454. .L_iocn {
  455. color: rgb(7, 134, 60);
  456. font-size: 36rpx;
  457. font-weight: 700;
  458. }
  459. }
  460. }
  461. }
  462. .page_item_cont {
  463. min-height: 180rpx;
  464. max-height: 424rpx;
  465. padding: 0 16rpx;
  466. text-align: left;
  467. position: relative;
  468. .text_big {
  469. font-size: 32rpx;
  470. font-weight: 700;
  471. text {
  472. font-weight: 700;
  473. line-height: 1.5;
  474. }
  475. }
  476. .line {
  477. height: 20rpx;
  478. width: 2rpx;
  479. border-left: 2rpx solid #e5e9ed;
  480. position: absolute;
  481. top: 82rpx;
  482. left: 40rpx;
  483. }
  484. .page_item_cont_T {
  485. padding-top: 28rpx;
  486. font-size: 28rpx;
  487. .page_item_cont_title {
  488. height: 100%;
  489. font-size: 32rpx;
  490. display: flex;
  491. justify-content: space-between;
  492. align-items: center;
  493. }
  494. }
  495. .page_item_cont_B {
  496. padding-top: 28rpx;
  497. margin-bottom: 28rpx;
  498. .page_item_cont_title {
  499. font-size: 32rpx;
  500. display: flex;
  501. justify-content: space-between;
  502. align-items: center;
  503. }
  504. }
  505. .page_item_cont_C {
  506. margin-bottom: 28rpx;
  507. .page_item_cont_title_C {
  508. font-size: 32rpx;
  509. display: flex;
  510. justify-content: space-between;
  511. }
  512. }
  513. }
  514. #infos {
  515. display: none;
  516. }
  517. }
  518. .L-l {
  519. width: 2rpx;
  520. height: 40rpx;
  521. background: #f9fafb;
  522. position: absolute;
  523. left: 20rpx;
  524. top: 72rpx;
  525. }
  526. .R-l {
  527. width: 2rpx;
  528. height: 40rpx;
  529. background: #f9fafb;
  530. position: absolute;
  531. right: 20rpx;
  532. top: 72rpx;
  533. }
  534. }
  535. .pharmacy-heng {
  536. height: 90rpx;
  537. display: flex;
  538. background-color: #fff;
  539. margin-bottom: 32rpx;
  540. .pharmacy-heng-tab {
  541. flex: 1 !important;
  542. display: flex;
  543. align-items: center;
  544. .pharmacy-heng-label {
  545. flex: 1;
  546. display: flex;
  547. justify-content: center;
  548. align-items: center;
  549. font-size: 36rpx;
  550. width: 204rpx;
  551. height: 60rpx;
  552. border-radius: 30rpx;
  553. background-color: #fff;
  554. color: rgb(102, 102, 102);
  555. }
  556. &.cube-tab_active {
  557. .pharmacy-heng-label {
  558. display: flex;
  559. justify-content: center;
  560. align-items: center;
  561. font-size: 36rpx;
  562. width: 204rpx;
  563. height: 60rpx;
  564. border-radius: 30rpx;
  565. background-color: rgb(229, 233, 237);
  566. color: rgb(51, 51, 51);
  567. }
  568. }
  569. }
  570. }
  571. // 滚动区域
  572. .page_scrollIt {
  573. height: calc(100vh - 380rpx);
  574. }
  575. // “扫一扫”文字
  576. .scanFont {
  577. font-size: 36rpx;
  578. font-weight: 700;
  579. margin-top: 16rpx;
  580. margin-bottom: 16rpx;
  581. text-align: center;
  582. }
  583. }
  584. </style>