From 9d5b4d650e5b01081d3537c750e7469db4d161e3 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期二, 29 四月 2025 08:53:20 +0800
Subject: [PATCH] 提交

---
 pages/tabBar/firstPage/firstPage.vue |   78 +++++++++++++++++++++++++++++++++++----
 1 files changed, 70 insertions(+), 8 deletions(-)

diff --git a/pages/tabBar/firstPage/firstPage.vue b/pages/tabBar/firstPage/firstPage.vue
index 307761e..80a7434 100644
--- a/pages/tabBar/firstPage/firstPage.vue
+++ b/pages/tabBar/firstPage/firstPage.vue
@@ -13,7 +13,7 @@
 			</view>
 		</view>
     <u-toast ref="uToast"></u-toast>
-    <view class="cardList" v-if="user.useProd == 1">
+    <view class="tabList" v-if="user.useProd == 1">
       <view class="switchPanel">
         <view class="switchBtns">
           <view class="btnItem" @click="changeTab(1)">
@@ -59,7 +59,7 @@
       <view>
         入库时间:{{tabNum == 1?hazmat.createTime:product.createTime}}
       </view>
-      <view v-if="modalTitle == '取用' || modalTitle == '扫码作废'">
+      <view v-if="modalTitle == '常规取用' || modalTitle == '用尽取用' || modalTitle == '扫码作废'">
         <span v-if="tabNum == 1">当前包装存量:{{hazmat.remaining}}{{hazmat.hazmatBasic?hazmat.hazmatBasic.unit:''}}</span>
         <span v-else>当前包装存量:{{product.remaining}}{{product.productBasic?product.productBasic.unit:''}}</span>
       </view>
@@ -82,7 +82,8 @@
           </u-form-item>
         </u--form>
       </view>
-      <u-button v-if="modalTitle == '取用'" type="primary" style="margin-top: 20px" text="确认取用" @click="confirmTake()"></u-button>
+      <u-button v-if="modalTitle == '常规取用'" type="primary" style="margin-top: 20px" text="确认取用" @click="confirmTake1()"></u-button>
+	  <u-button v-if="modalTitle == '用尽取用'" type="primary" style="margin-top: 20px" text="确认取用" @click="confirmTake2()"></u-button>
       <u-button v-if="modalTitle == '归还'" type="primary" style="margin-top: 20px" text="确认归还" @click="confirmBack()"></u-button>
       <u-button v-if="modalTitle == '用尽登记'" type="warning" style="margin-top: 20px" text="确认用尽登记" @click="confirmCheck()"></u-button>
       <u-button v-if="modalTitle == '销售'" type="primary" style="margin-top: 20px" text="确认销售" @click="confirmSell()"></u-button>
@@ -105,6 +106,7 @@
   } from '../../../api/index.js'
   import VUE_APP_BASE_URL from 'common/constant.js'
   import take from '../../../static/take.png'
+  import takeAll from '../../../static/takeAll.png'
   import takeBack from '../../../static/return.png'
   import check from '../../../static/check.png'
   import del from '../../../static/delete.png'
@@ -121,8 +123,13 @@
         cardList1: [
           {
             icon: take,
-            title: '取用',
+            title: '常规取用',
             type: 1
+          },
+          {
+            icon: takeAll,
+            title: '用尽取用',
+            type: 5
           },
           {
             icon: takeBack,
@@ -212,8 +219,17 @@
         t.modalTitle = title
         uni.scanCode({
           autoZoom: false,
+          scanType: ['qrCode'],
           success: function (res) {
             if(res && res.result){
+              if(res.result.indexOf('SJ') == -1 && res.result.indexOf('CP') == -1){
+                t.$refs.uToast.show({
+                  type: 'default',
+                  message: '没有识别到正确的编码,请重新扫码',
+                  duration: 2000
+                })
+                return
+              }
               if(t.tabNum == 1){
                 getHazmatByCode({code: res.result}).then((re)=>{
                   if(re.code == 200){
@@ -259,9 +275,9 @@
         })
       },
 
-      confirmTake(){
+      confirmTake1(){
         const t = this
-        postHazmatUse(t.hazmat.id).then((r)=>{
+        postHazmatUse(t.hazmat.id,0).then((r)=>{
           if(r.code == 200){
             t.$refs.uToast.show({
               type: 'default',
@@ -281,6 +297,29 @@
         })
         t.closeModal()
       },
+	  
+	  confirmTake2(){
+	    const t = this
+	    postHazmatUse(t.hazmat.id,1).then((r)=>{
+	      if(r.code == 200){
+	        t.$refs.uToast.show({
+	          type: 'default',
+	          message: r.message
+	        })
+	      }else{
+	        t.$refs.uToast.show({
+	          type: 'default',
+	          message: r.message
+	        })
+	      }
+	    }).catch((err) => {
+	      uni.showToast({
+	        title: err,
+	        duration: 2000
+	      })
+	    })
+	    t.closeModal()
+	  },
 
       confirmBack() {
         const t = this
@@ -457,7 +496,7 @@
 	left: 0;
 	right: 0;
 	width: 100%;
-	z-index: 1;
+	z-index: 9999;
 }
 .barText{
   /* text-align: center; */
@@ -484,6 +523,23 @@
     width: 100%;
   }
 }
+
+.tabList{
+  width: 100%;
+  box-sizing: border-box;
+  padding: 0 15px;
+  margin-top: 15px;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  position: -webkit-sticky;
+  position: sticky;
+  top: 50px;
+  left: 0;
+  right: 0;
+  z-index: 9998;
+}
+
 .switchPanel{
   width: 100%;
   height: 84rpx;
@@ -492,6 +548,7 @@
   box-sizing: border-box;
   border-radius: 8px;
   box-shadow: 0px -6px 10px rgba(255, 255, 255, 1), 0px 4px 15px rgba(0, 0, 0, 0.1),0px 3px 6px rgba(0, 0, 0, 0.05) inset !important;
+  background: #f5f7fa;
 
   .switchBtns{
     width: 100%;
@@ -533,11 +590,12 @@
     border: 2rpx solid #fff;
   }
 }
+
 .cardList{
   width: 100%;
   box-sizing: border-box;
   padding: 0 15px;
-  margin-top: 20px;
+  margin-top: 15px;
   display: flex;
   flex-direction: column;
   align-items: center;
@@ -559,6 +617,10 @@
       box-shadow: none;
     }
 
+    &:last-of-type{
+      margin-bottom: 75px;
+    }
+
     .cardTit{
       font-size: 36rpx;
       font-weight: bold;

--
Gitblit v1.9.2