Browse Source

替换配药人

seimin 3 years ago
parent
commit
4fe789c5c4
1 changed files with 367 additions and 282 deletions
  1. 367 282
      pages/pharmacyDetails/pharmacyDetails.vue

+ 367 - 282
pages/pharmacyDetails/pharmacyDetails.vue

@@ -45,115 +45,231 @@
45 45
       <view class="L-l"></view>
46 46
       <view class="R-l"></view>
47 47
     </view>
48
-    <button
49
-      class="cube-toolbar-item"
50
-      :loading="isLoading"
51
-      :disabled="isLoading"
52
-      @click="dispensing(1)"
53
-      v-if="infoDATA.drugsState && infoDATA.drugsState.name == '待配药'"
54
-    >
48
+    <button class="cube-toolbar-item" :loading="isLoading" :disabled="isLoading" @click="dispensing(1)"
49
+      v-if="infoDATA.drugsState && infoDATA.drugsState.name == '待配药'">
55 50
       开始配药
56 51
     </button>
57
-    <button
58
-      class="cube-toolbar-item"
59
-      :loading="isLoading"
60
-      :disabled="isLoading"
61
-      @click="dispensing(2)"
62
-      v-if="infoDATA.drugsState && infoDATA.drugsState.name == '配药中'"
63
-    >
64
-      完成配药
65
-    </button>
52
+    <view v-if="infoDATA.drugsState && infoDATA.drugsState.name == '配药中'" class="btn-wrap">
53
+      <button class="cube-toolbar-item1" :loading="isLoading" :disabled="isLoading" @click="dispensing(2)">
54
+        完成配药
55
+      </button>
56
+      <button class="cube-toolbar-item1" :loading="isTLoading" :disabled="isTLoading" @click="replaceOperator()">
57
+        替换配药人
58
+      </button>
59
+    </view>
66 60
   </view>
67 61
 </template>
68 62
 <script>
69
-import { get, post, SM, webHandle } from "../../http/http.js";
70
-export default {
71
-  data() {
72
-    return {
73
-      infoDATA: [],
74
-      isLoading: false,
75
-    };
76
-  },
77
-  methods: {
78
-    // 开始配药,完成配药,,,1是待配药,2是配药中
79
-    dispensing(type) {
80
-      this.isLoading = true;
81
-      uni.showLoading({
82
-        title: "加载中",
83
-        mask: true,
84
-      });
85
-      if (type == 1) {
86
-        post("/drugsBag/changeToIng", {
87
-          id: this.infoDATA.id,
63
+  import {
64
+    get,
65
+    post,
66
+    SM,
67
+    webHandle
68
+  } from "../../http/http.js";
69
+  export default {
70
+    data() {
71
+      return {
72
+        infoDATA: [],
73
+        isLoading: false,
74
+        isTLoading: false,
75
+      };
76
+    },
77
+    methods: {
78
+      // 替换配药人
79
+      replaceOperator(){
80
+        this.isTLoading = true;
81
+        uni.showLoading({
82
+          title: "加载中",
83
+          mask: true,
84
+        });
85
+        post("/drugsBag/replaceOperator", {
86
+          packId: this.infoDATA.packid,
88 87
         }).then((result) => {
89
-          this.isLoading = false;
88
+          this.isTLoading = false;
90 89
           uni.hideLoading();
91
-          if (result.state == 200) {
92
-            uni.showToast({
93
-              title: result.info || "开始配药成功!",
94
-              duration: 5000,
95
-              success() {
96
-                uni.navigateTo({
97
-                  url: "../pharmacy/pharmacy",
98
-                });
99
-              },
90
+          if(result.state == 200){
91
+            uni.showModal({
92
+              title: '提示',
93
+              content: result.info,
94
+              showCancel: false,
95
+              success: function(res) {
96
+                if (res.confirm) {
97
+                  console.log('用户点击确定');
98
+                } else if (res.cancel) {
99
+                  console.log('用户点击取消');
100
+                }
101
+              }
100 102
             });
101
-            // let data = {
102
-            //   launchId: this.infoDATA.launch.id,
103
-            //   drugsBagId: this.infoDATA.id,
104
-            // };
105
-            // post("/drugsBag/autoDrugsBags", data).then((result1) => {
106
-            //   this.isLoading = false;
107
-            //   if (result1.status == 200) {
108
-            //     uni.showToast({
109
-            //       title: "操作成功!",
110
-            //       success() {
111
-            //         uni.navigateTo({
112
-            //           url: "../pharmacy/pharmacy",
113
-            //         });
114
-            //       },
115
-            //     });
116
-            //   }else if(result1.status == 501){
117
-            //     uni.showToast({
118
-            //       icon: "none",
119
-            //       title: result1.error,
120
-            //     });
121
-            //   }else {
122
-            //     uni.showToast({
123
-            //       icon: "none",
124
-            //       title: "请求失败!",
125
-            //     });
126
-            //   }
127
-            // });
128
-          // } else if(result.state == 503){//未建单
129
-          //   uni.showToast({
130
-          //     icon: "none",
131
-          //     title: result.error,
132
-          //   });
133
-          } else {
134
-            // this.isLoading = false;
135
-            uni.showToast({
136
-              icon: "none",
137
-              title: "请求失败!",
103
+          }else{
104
+            uni.showModal({
105
+              title: '提示',
106
+              content: "请求失败!",
107
+              showCancel: false,
108
+              success: function(res) {
109
+                if (res.confirm) {
110
+                  console.log('用户点击确定');
111
+                } else if (res.cancel) {
112
+                  console.log('用户点击取消');
113
+                }
114
+              }
138 115
             });
139 116
           }
117
+        })
118
+      },
119
+      // 开始配药,完成配药,,,1是待配药,2是配药中
120
+      dispensing(type) {
121
+        this.isLoading = true;
122
+        uni.showLoading({
123
+          title: "加载中",
124
+          mask: true,
125
+        });
126
+        if (type == 1) {
127
+          post("/drugsBag/changeToIng", {
128
+            id: this.infoDATA.id,
129
+          }).then((result) => {
130
+            this.isLoading = false;
131
+            uni.hideLoading();
132
+            if (result.state == 200) {
133
+              uni.showModal({
134
+                title: '提示',
135
+                content: result.info || "开始配药成功!",
136
+                showCancel: false,
137
+                success: function(res) {
138
+                  if (res.confirm) {
139
+                    uni.navigateTo({
140
+                      url: "../pharmacy/pharmacy",
141
+                    });
142
+                  } else if (res.cancel) {
143
+                    console.log('用户点击取消');
144
+                  }
145
+                }
146
+              });
147
+              // let data = {
148
+              //   launchId: this.infoDATA.launch.id,
149
+              //   drugsBagId: this.infoDATA.id,
150
+              // };
151
+              // post("/drugsBag/autoDrugsBags", data).then((result1) => {
152
+              //   this.isLoading = false;
153
+              //   if (result1.status == 200) {
154
+              //     uni.showToast({
155
+              //       title: "操作成功!",
156
+              //       success() {
157
+              //         uni.navigateTo({
158
+              //           url: "../pharmacy/pharmacy",
159
+              //         });
160
+              //       },
161
+              //     });
162
+              //   }else if(result1.status == 501){
163
+              //     uni.showToast({
164
+              //       icon: "none",
165
+              //       title: result1.error,
166
+              //     });
167
+              //   }else {
168
+              //     uni.showToast({
169
+              //       icon: "none",
170
+              //       title: "请求失败!",
171
+              //     });
172
+              //   }
173
+              // });
174
+              // } else if(result.state == 503){//未建单
175
+              //   uni.showToast({
176
+              //     icon: "none",
177
+              //     title: result.error,
178
+              //   });
179
+            } else {
180
+              // this.isLoading = false;
181
+              uni.showModal({
182
+                title: '提示',
183
+                content: "请求失败!",
184
+                showCancel: false,
185
+                success: function(res) {
186
+                  if (res.confirm) {
187
+                    console.log('用户点击确定');
188
+                  } else if (res.cancel) {
189
+                    console.log('用户点击取消');
190
+                  }
191
+                }
192
+              });
193
+            }
194
+          });
195
+        } else if (type == 2) {
196
+          post("/drugsBag/changeToCheck", {
197
+            id: this.infoDATA.id,
198
+          }).then((result) => {
199
+            this.isLoading = false;
200
+            uni.hideLoading();
201
+            if (result.state == 200) {
202
+              uni.showModal({
203
+                title: '提示',
204
+                content: result.info || "完成配药成功!",
205
+                showCancel: false,
206
+                success: function(res) {
207
+                  if (res.confirm) {
208
+                    uni.navigateTo({
209
+                      url: "../pharmacy/pharmacy",
210
+                    });
211
+                  } else if (res.cancel) {
212
+                    console.log('用户点击取消');
213
+                  }
214
+                }
215
+              });
216
+            } else {
217
+              uni.showModal({
218
+                title: '提示',
219
+                content: "请求失败!",
220
+                showCancel: false,
221
+                success: function(res) {
222
+                  if (res.confirm) {
223
+                    console.log('用户点击确定');
224
+                  } else if (res.cancel) {
225
+                    console.log('用户点击取消');
226
+                  }
227
+                }
228
+              });
229
+            }
230
+          });
231
+        }
232
+      },
233
+    },
234
+    onLoad(options) {
235
+      // #ifdef APP-PLUS
236
+      webHandle("no", "app");
237
+      // #endif
238
+      // #ifdef H5
239
+      webHandle("no", "wx");
240
+      // #endif
241
+      //扫码进入详情
242
+      let qrcode = options.qrcode;
243
+      if (qrcode) {
244
+        uni.showLoading({
245
+          title: "加载中",
246
+          mask: true,
140 247
         });
141
-      } else if (type == 2) {
142
-        post("/drugsBag/changeToCheck", {
143
-          id: this.infoDATA.id,
248
+        post("/drugsBag/getDrugsBagByQr", {
249
+          qrcode,
144 250
         }).then((result) => {
145
-          this.isLoading = false;
146 251
           uni.hideLoading();
147 252
           if (result.state == 200) {
253
+            this.infoDATA = result.result;
254
+          } else {
148 255
             uni.showToast({
149
-              title: result.info || "完成配药成功!",
150
-              duration: 5000,
151
-              success() {
152
-                uni.navigateTo({
153
-                  url: "../pharmacy/pharmacy",
154
-                });
155
-              },
256
+              icon: "none",
257
+              title: "请求失败!",
156 258
             });
259
+          }
260
+        });
261
+      }
262
+      // 点击列表进入详情
263
+      let id = options.id;
264
+      if (id) {
265
+        uni.showLoading({
266
+          title: "加载中",
267
+          mask: true,
268
+        });
269
+        get("/api/fetchData/drugsBag/" + id).then((res) => {
270
+          uni.hideLoading();
271
+          if (res.status == 200) {
272
+            this.infoDATA = res.data;
157 273
           } else {
158 274
             uni.showToast({
159 275
               icon: "none",
@@ -163,234 +279,203 @@ export default {
163 279
         });
164 280
       }
165 281
     },
166
-  },
167
-  onLoad(options) {
168
-    // #ifdef APP-PLUS
169
-    webHandle("no", "app");
170
-    // #endif
171
-    // #ifdef H5
172
-    webHandle("no", "wx");
173
-    // #endif
174
-    //扫码进入详情
175
-    let qrcode = options.qrcode;
176
-    if (qrcode) {
177
-      uni.showLoading({
178
-        title: "加载中",
179
-        mask: true,
180
-      });
181
-      post("/drugsBag/getDrugsBagByQr", {
182
-        qrcode,
183
-      }).then((result) => {
184
-        uni.hideLoading();
185
-        if (result.state == 200) {
186
-          this.infoDATA = result.result;
187
-        } else {
188
-          uni.showToast({
189
-            icon: "none",
190
-            title: "请求失败!",
191
-          });
192
-        }
193
-      });
194
-    }
195
-    // 点击列表进入详情
196
-    let id = options.id;
197
-    if (id) {
198
-      uni.showLoading({
199
-        title: "加载中",
200
-        mask: true,
201
-      });
202
-      get("/api/fetchData/drugsBag/" + id).then((res) => {
203
-        uni.hideLoading();
204
-        if (res.status == 200) {
205
-          this.infoDATA = res.data;
206
-        } else {
207
-          uni.showToast({
208
-            icon: "none",
209
-            title: "请求失败!",
210
-          });
211
-        }
212
-      });
213
-    }
214
-  },
215
-};
282
+  };
216 283
 </script>
217 284
 <style lang="less">
218
-.pharmacyDetails {
219
-  background-color: rgb(249, 250, 251);
220
-  padding-top: 10%;
285
+  .pharmacyDetails {
286
+    background-color: rgb(249, 250, 251);
287
+    padding-top: 10%;
221 288
 
222
-  .pharmacyDetails_title {
223
-    font-size: 46rpx;
224
-    font-weight: 550;
225
-    text-align: center;
226
-  }
227
-
228
-  .page_item_wrap {
229
-    position: relative;
230
-    margin-top: 32rpx;
289
+    .pharmacyDetails_title {
290
+      font-size: 46rpx;
291
+      font-weight: 550;
292
+      text-align: center;
293
+    }
231 294
 
232
-    .page_item {
233
-      margin-top: 16rpx;
234
-      margin-bottom: 124rpx;
235
-      background: #fff;
236
-      border-radius: 8rpx;
237
-      margin: 0 20rpx;
238
-      border: 2rpx solid #e5e9ed;
295
+    .page_item_wrap {
239 296
       position: relative;
240
-      overflow: hidden;
241
-      padding: 0 16rpx;
297
+      margin-top: 32rpx;
242 298
 
243
-      .L {
244
-        width: 40rpx;
245
-        height: 40rpx;
246
-        border-radius: 50%;
247
-        background: #f9fafb;
248
-        position: absolute;
249
-        left: -20rpx;
250
-        top: 68rpx;
299
+      .page_item {
300
+        margin-top: 16rpx;
301
+        margin-bottom: 124rpx;
302
+        background: #fff;
303
+        border-radius: 8rpx;
304
+        margin: 0 20rpx;
251 305
         border: 2rpx solid #e5e9ed;
252
-      }
306
+        position: relative;
307
+        overflow: hidden;
308
+        padding: 0 16rpx;
253 309
 
254
-      .R {
255
-        width: 40rpx;
256
-        height: 40rpx;
257
-        border-radius: 50%;
258
-        background: #f9fafb;
259
-        position: absolute;
260
-        float: right;
261
-        right: -20rpx;
262
-        top: 68rpx;
263
-        border: 2rpx solid #e5e9ed;
264
-      }
310
+        .L {
311
+          width: 40rpx;
312
+          height: 40rpx;
313
+          border-radius: 50%;
314
+          background: #f9fafb;
315
+          position: absolute;
316
+          left: -20rpx;
317
+          top: 68rpx;
318
+          border: 2rpx solid #e5e9ed;
319
+        }
265 320
 
266
-      .page_item_top {
267
-        height: 88rpx;
268
-        border-bottom: 2rpx dashed #e5e9ed;
269
-        padding: 0 16rpx;
321
+        .R {
322
+          width: 40rpx;
323
+          height: 40rpx;
324
+          border-radius: 50%;
325
+          background: #f9fafb;
326
+          position: absolute;
327
+          float: right;
328
+          right: -20rpx;
329
+          top: 68rpx;
330
+          border: 2rpx solid #e5e9ed;
331
+        }
270 332
 
271
-        .page_item_top-inner {
272
-          display: flex;
273
-          justify-content: space-between;
274
-          align-items: center;
275
-          height: 100%;
333
+        .page_item_top {
334
+          height: 88rpx;
335
+          border-bottom: 2rpx dashed #e5e9ed;
336
+          padding: 0 16rpx;
337
+
338
+          .page_item_top-inner {
339
+            display: flex;
340
+            justify-content: space-between;
341
+            align-items: center;
342
+            height: 100%;
276 343
 
277
-          .page_item_top_L {
278
-            .L_text {
344
+            .page_item_top_L {
345
+              .L_text {
346
+                font-size: 32rpx;
347
+                font-weight: 700;
348
+              }
349
+            }
350
+
351
+            .page_item_top_R {
279 352
               font-size: 32rpx;
280
-              font-weight: 700;
353
+
354
+              .L_iocn {
355
+                color: rgb(7, 134, 60);
356
+                font-size: 36rpx;
357
+                font-weight: 700;
358
+              }
281 359
             }
282 360
           }
361
+        }
362
+
363
+        .page_item_cont {
364
+          min-height: 180rpx;
365
+          max-height: 424rpx;
366
+          padding: 0 16rpx;
367
+          text-align: left;
368
+          position: relative;
283 369
 
284
-          .page_item_top_R {
370
+          .text_big {
285 371
             font-size: 32rpx;
372
+            font-weight: 700;
286 373
 
287
-            .L_iocn {
288
-              color: rgb(7, 134, 60);
289
-              font-size: 36rpx;
374
+            text {
290 375
               font-weight: 700;
376
+              line-height: 1.5;
291 377
             }
292 378
           }
293
-        }
294
-      }
295 379
 
296
-      .page_item_cont {
297
-        min-height: 180rpx;
298
-        max-height: 424rpx;
299
-        padding: 0 16rpx;
300
-        text-align: left;
301
-        position: relative;
380
+          .line {
381
+            height: 20rpx;
382
+            width: 2rpx;
383
+            border-left: 2rpx solid #e5e9ed;
384
+            position: absolute;
385
+            top: 82rpx;
386
+            left: 40rpx;
387
+          }
302 388
 
303
-        .text_big {
304
-          font-size: 32rpx;
305
-          font-weight: 700;
389
+          .page_item_cont_T {
390
+            padding-top: 28rpx;
391
+            font-size: 28rpx;
306 392
 
307
-          text {
308
-            font-weight: 700;
309
-            line-height: 1.5;
393
+            .page_item_cont_title {
394
+              height: 100%;
395
+              font-size: 32rpx;
396
+              display: flex;
397
+              justify-content: space-between;
398
+            }
310 399
           }
311
-        }
312 400
 
313
-        .line {
314
-          height: 20rpx;
315
-          width: 2rpx;
316
-          border-left: 2rpx solid #e5e9ed;
317
-          position: absolute;
318
-          top: 82rpx;
319
-          left: 40rpx;
320
-        }
401
+          .page_item_cont_B {
402
+            padding-top: 28rpx;
403
+            margin-bottom: 28rpx;
321 404
 
322
-        .page_item_cont_T {
323
-          padding-top: 28rpx;
324
-          font-size: 28rpx;
325
-
326
-          .page_item_cont_title {
327
-            height: 100%;
328
-            font-size: 32rpx;
329
-            display: flex;
330
-            justify-content: space-between;
405
+            .page_item_cont_title {
406
+              font-size: 32rpx;
407
+              display: flex;
408
+              justify-content: space-between;
409
+              align-items: center;
410
+            }
331 411
           }
332
-        }
333 412
 
334
-        .page_item_cont_B {
335
-          padding-top: 28rpx;
336
-          margin-bottom: 28rpx;
413
+          .page_item_cont_C {
414
+            margin-bottom: 28rpx;
337 415
 
338
-          .page_item_cont_title {
339
-            font-size: 32rpx;
340
-            display: flex;
341
-            justify-content: space-between;
342
-            align-items: center;
416
+            .page_item_cont_title_C {
417
+              font-size: 32rpx;
418
+              display: flex;
419
+              justify-content: space-between;
420
+              align-items: center;
421
+            }
343 422
           }
344
-        }
345
-
346
-        .page_item_cont_C {
347
-          margin-bottom: 28rpx;
348 423
 
349
-          .page_item_cont_title_C {
350
-            font-size: 32rpx;
351
-            display: flex;
352
-            justify-content: space-between;
353
-            align-items: center;
424
+          #infos {
425
+            display: none;
354 426
           }
355 427
         }
428
+      }
356 429
 
357
-        #infos {
358
-          display: none;
359
-        }
430
+      .L-l {
431
+        width: 2rpx;
432
+        height: 40rpx;
433
+        background: #f9fafb;
434
+        position: absolute;
435
+        left: 20rpx;
436
+        top: 72rpx;
437
+      }
438
+
439
+      .R-l {
440
+        width: 2rpx;
441
+        height: 40rpx;
442
+        background: #f9fafb;
443
+        position: absolute;
444
+        right: 20rpx;
445
+        top: 72rpx;
360 446
       }
361 447
     }
362 448
 
363
-    .L-l {
364
-      width: 2rpx;
365
-      height: 40rpx;
366
-      background: #f9fafb;
367
-      position: absolute;
449
+    .cube-toolbar-item {
450
+      width: 710rpx;
451
+      height: 68rpx;
452
+      line-height: 68rpx;
453
+      position: fixed;
368 454
       left: 20rpx;
369
-      top: 72rpx;
455
+      bottom: 160rpx;
456
+      border-radius: 8rpx;
457
+      background: linear-gradient(to right, #72c172, #3bb197);
458
+      font-size: 36rpx;
459
+      color: #fff;
460
+      text-align: center;
370 461
     }
371
-
372
-    .R-l {
373
-      width: 2rpx;
374
-      height: 40rpx;
375
-      background: #f9fafb;
376
-      position: absolute;
377
-      right: 20rpx;
378
-      top: 72rpx;
462
+    .btn-wrap{
463
+      display: flex;
464
+      justify-content: space-between;
465
+      position: fixed;
466
+      left: 20rpx;
467
+      bottom: 160rpx;
468
+    }
469
+    .cube-toolbar-item1 {
470
+      width: 350rpx;
471
+      height: 68rpx;
472
+      line-height: 68rpx;
473
+      border-radius: 8rpx;
474
+      margin: 0 5rpx;
475
+      background: linear-gradient(to right, #72c172, #3bb197);
476
+      font-size: 36rpx;
477
+      color: #fff;
478
+      text-align: center;
379 479
     }
380 480
   }
381
-
382
-  .cube-toolbar-item {
383
-    width: 710rpx;
384
-    height: 68rpx;
385
-    line-height: 68rpx;
386
-    position: fixed;
387
-    left: 20rpx;
388
-    bottom: 160rpx;
389
-    border-radius: 8rpx;
390
-    background: linear-gradient(to right, #72c172, #3bb197);
391
-    font-size: 36rpx;
392
-    color: #fff;
393
-    text-align: center;
394
-  }
395
-}
396 481
 </style>