seimin 3 роки тому
батько
коміт
c499eae65c
1 змінених файлів з 86 додано та 35 видалено
  1. 86 35
      pages/pharmacy/pharmacy.vue

+ 86 - 35
pages/pharmacy/pharmacy.vue

@@ -1,20 +1,25 @@
1 1
 <template>
2 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>
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>
9 15
     </view>
10
-    <view class="scanFont">扫一扫</view>
11 16
     <view class="pharmacy-heng">
12 17
       <view
13 18
         class="pharmacy-heng-tab"
14
-        :class="{ 'cube-tab_active': selectedLabelSlots === item.label }"
19
+        :class="{ 'cube-tab_active': selectedLabelSlots === item.id }"
15 20
         v-for="(item, i) in tabs"
16 21
         :key="i"
17
-        @click="clickHandler(item.label)"
22
+        @click="clickHandler(item.id)"
18 23
       >
19 24
         <view class="pharmacy-heng-label">{{ item.label }}</view>
20 25
       </view>
@@ -103,38 +108,38 @@ export default {
103 108
       freshing: false, //上拉加载开关
104 109
       scroll_top: 0, //距离顶部的距离
105 110
       scroll_refresher_enabled: true, //是否开启自定义下拉刷新
106
-      selectedLabelSlots: "待配药",
111
+      selectedLabelSlots: 4,
107 112
       list: [],
108 113
       idx: 0,
109 114
       totalNum: -1,
110 115
       tabs: [
111 116
         {
117
+          id: 4,
112 118
           label: "待配药",
113 119
         },
114 120
         {
121
+          id: 5,
115 122
           label: "配药中",
116 123
         },
117 124
         {
125
+          id: 6,
118 126
           label: "核对中",
119 127
         },
120 128
       ],
129
+      depts: [],//下拉框选项
130
+      index: 0,//下拉框索引
131
+      hosId: uni.getStorageSync("userData").user.currentHospital.id,//当前院区
121 132
     };
122 133
   },
123 134
   methods: {
124 135
     // tab切换
125
-    clickHandler(key) {
126
-      this.selectedLabelSlots = key;
136
+    clickHandler(id) {
137
+      this.selectedLabelSlots = id;
127 138
       this.idx = 0;
128 139
       this.totalNum = -1;
129 140
       this.scroll_top = Math.random();
130 141
       //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
-      }
142
+      this.getPharmacyListData(id, 0);
138 143
     },
139 144
     // 请求列表数据
140 145
     getPharmacyListData(type, idx) {
@@ -151,6 +156,7 @@ export default {
151 156
         sum: 20,
152 157
         drugsBag: {
153 158
           searchType: type,
159
+          launch:{id:this.depts[this.index].id}
154 160
         },
155 161
       };
156 162
       uni.showLoading({
@@ -192,13 +198,7 @@ export default {
192 198
       this.triggered = true;
193 199
       this.idx = 0;
194 200
       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
-      }
201
+      this.getPharmacyListData(this.selectedLabelSlots, 0);
202 202
     },
203 203
     // 滚动
204 204
     scroll(e) {
@@ -222,13 +222,7 @@ export default {
222 222
     scrolltolower() {
223 223
       if (this.freshing) {
224 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
-        }
225
+        this.getPharmacyListData(this.selectedLabelSlots, ++this.idx);
232 226
       }
233 227
     },
234 228
     // 详情页面
@@ -241,6 +235,46 @@ export default {
241 235
     stop(e) {
242 236
       e.preventDefault();
243 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
+    }
244 278
   },
245 279
   onLoad(options) {
246 280
     //#ifdef H5
@@ -252,8 +286,8 @@ export default {
252 286
       });
253 287
     }
254 288
     //#endif
255
-    // 待配药
256
-    this.getPharmacyListData(4, 0);
289
+    // 获取药房类型的科室
290
+    this.getDeptByPharmacy();
257 291
     // #ifdef APP-PLUS
258 292
     webHandle("no", "app");
259 293
     // #endif
@@ -288,6 +322,23 @@ export default {
288 322
 .pharmacy {
289 323
   background-color: rgb(249, 250, 251);
290 324
   padding-top: 36rpx;
325
+  .pharmacy_header{
326
+    position: relative;
327
+    .pharmacy_changeDept{
328
+      position: absolute;
329
+      top: 50%;
330
+      right: 52rpx;
331
+      transform: translateY(-50%);
332
+      .pharmacy_input{
333
+        background-image: linear-gradient(to right, #72c172, #3bb197);
334
+        border-radius: 8rpx;
335
+        color: #fff;
336
+        font-size: 36rpx;
337
+        font-weight: 700;
338
+        padding: 8rpx 16rpx;
339
+      }
340
+    }
341
+  }
291 342
 
292 343
   .scanning_btn {
293 344
     margin: 0 auto;