pharmacy.vue 14 KB

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