马宇豪
2025-04-29 9d5b4d650e5b01081d3537c750e7469db4d161e3
pages/tabBar/current/current.vue
@@ -10,8 +10,9 @@
         </view>
      </view>
      <!-- 页面内容 -->
    <u-toast ref="uToast"></u-toast>
    <view class="m-p-15">
      <u-sticky>
      <view class="searchBar">
        <u-input placeholder="请输入或扫描二维码编号进行搜索" v-model="searchContent">
          <template slot="prefix">
            <u-icon name="scan" color="#2979ff" size="28" @click="scanCode()"></u-icon>
@@ -20,7 +21,7 @@
            <u-button type="primary" class="searchBtn" size="small" text="溯源查询" shape="circle" @click="getList()"></u-button>
          </template>
        </u-input>
      </u-sticky>
      </view>
      <view class="productCard" v-if="dataList && dataList.length>0">
        <view v-if="dataList[0].hazmatBasic">
          <view>名称:<span>{{dataList[0].hazmatBasic?dataList[0].hazmatBasic.name:''}}({{dataList[0].hazmatBasic?dataList[0].hazmatBasic.productSn :''}})</span></view>
@@ -36,7 +37,7 @@
          <view class="card-i-l">
            <span><u-icon name="clock-fill" color="#2979ff" size="18" style="margin-right: 4px"></u-icon>{{item.updateTime}}</span>
            <view v-if="item.user">
              <span></span>{{item.user.departName}}部门的<span style="font-weight: bold">{{item.user.name }}</span>进行了<span :class="item.num>=0?'green':'red'">{{item.state==0?'入库':item.state==1?'取用':item.state==2?'归还':item.state==3?'标签作废':item.state==4?'用尽登记':item.state==5?'销售':'--'}}</span>
              <span></span>{{item.user.departName}}部门的<span style="font-weight: bold">{{item.user.name }}</span>进行了<span :class="item.num>=0?'green':'red'">{{item.state==0?'入库':item.state==1?'取用':item.state==2?'归还':item.state==3?'标签作废':item.state==4?'用尽登记':item.state==5?'销售':item.state==6?'零头入库 ':'--'}}</span>
            </view>
          </view>
          <view v-if="item.hazmatBasic" class="card-i-r" :class="item.num>=0?'green':'red'">
@@ -71,7 +72,7 @@
      data() {
         return {
            page: 'pages/tabBar/current/current',
            statusBarHeight: 0,
            statusBarHeight: '',
        searchContent: '',
        dataList: []
         }
@@ -80,6 +81,7 @@
         this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight'];
      },
      onShow() {
      // this.getList()
         // this.role = uni.getStorageSync('roleName');
      },
    created(){
@@ -88,10 +90,21 @@
      methods: {
      scanCode(){
        const t = this
        t.dataList = []
        t.searchContent = ''
        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
              }
              t.searchContent = res.result
              getHazmatFlowByCode({code: res.result}).then(re => {
                if(re.code == 200) {
@@ -153,7 +166,7 @@
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1;
  z-index: 9999;
}
.statusBar{
  background-color:lightgrey;
@@ -167,10 +180,9 @@
}
.u-input{
  border-color: #f5f5f5 !important;
  border-color: #f5f7fa !important;
  border-radius: 99px;
  background: #f5f5f5;
  background: #f5f7fa;
  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.1) inset !important;
  transition: box-shadow .1s ease !important;
}
@@ -184,6 +196,15 @@
  padding: 0 15px;
  margin-top: 20px;
  box-sizing: border-box;
  .searchBar{
    position: -webkit-sticky;
    position: sticky;
    top: 50px;
    left: 0;
    right: 0;
    z-index: 9998;
  }
  .productCard{
    width: 100%;
@@ -215,14 +236,15 @@
    box-sizing: border-box;
    margin-top: 15px;
    box-shadow: 4px 4px 12px rgba(150,150,150,.05);
    padding-bottom: 75px;
    .card-i{
      width: 100%;
      background: #fff;
      border-radius: 12px;
      padding: 20px 15px;
      margin: 0 auto;
      box-sizing: border-box;
      margin: 0 auto;
      display: flex;
      justify-content: space-between;
      align-items: center;