ll
liukangdong
2025-01-24 e597d2905326e907f4ff5ad3665b882239b6fb11
h5/pages/inventory/detail.vue
@@ -14,25 +14,25 @@
         <view class="head_wrap">
            <view class="search_wrap">
               <image class="mr12 search" src="@/static/home/ic_search@2x.png" mode="widthFix"></image>
               <input v-model="param.materialCode" @confirm="handleQuery" type="text" placeholder="搜索资产编码/资产名称"
               <input v-model="param.materialCode" @confirm="handleQuery()" type="text" placeholder="搜索物料编码/物料名称"
                  placeholder-class="placeholder9" />
            </view>
         </view>
         <!--  -->
         <scroll-view scroll-y="true" class="scroll_Y" @scrolltolower="scrolltolower">
            <view class="list">
               <view class="item" v-for="item in list">
                  <view class="line">
               <view class="item" v-for="item in list" @click="itemClick(item)">
                  <view class="head">
                     <view class="title">{{item.materialName}}</view>
                     <view class="status red" v-if="item.type == 1">盘亏</view>
                     <view class="status primaryColor" v-if="item.type == 2">盘盈</view>
                  </view>
                  <view class="line">资产编码:{{item.materialCode}}</view>
                  <view class="line">物料编码:{{ item.materialCode }}</view>
                  <view class="line">条码:{{item.materialQrcode}}</view>
                  <view class="line">规格型号:{{item.materialAttr}}</view>
                  <view class="line">
                  <view class="line" v-if="item.status == 0">
                     <view class="">账面数量:{{item.stock}}{{item.materialUnitName}}</view>
                     <view v-if="item.status == 0" @click="openEheck(item)" class="btn">执行盘点</view>
                     <view @click.stop="openEheck(item)" class="btn">执行盘点</view>
                  </view>
                  <view class="static" v-if="item.status == 1">
                     <view class="ite">
@@ -52,11 +52,11 @@
            </view>
         </scroll-view>
         <view class="footer_btn">
            <view @click="openQrcode" v-if="activeTab== 0" class="sweep">
            <view @click="openQrcode" v-if="activeTab == 0 && info.status == 1" class="sweep">
               <image src="@/static/side/ic_saoma@2x.png" mode=""></image>
               <view class="">扫码盘点</view>
            </view>
            <view @click="showTip = true" v-if="activeTab== 1" class="sweep sub_result">
            <view @click="showTip = true" v-if="activeTab == 1 && info.status == 1" class="sweep sub_result">
               <view class="">提交盘点结果</view>
            </view>
         </view>
@@ -65,7 +65,7 @@
            <view class="modal_wrap">
               <view class="modal_title">执行盘点</view>
               <view class="title">{{modalForm.materialName}}</view>
               <view class="item">资产编码:{{modalForm.materialCode}}</view>
               <view class="item">物料编码:{{ modalForm.materialCode }}</view>
               <view class="item">条码:{{modalForm.materialQrcode}}</view>
               <view class="item">品牌:{{modalForm.materialBrand}}</view>
               <view class="item">规格型号:{{modalForm.materialAttr}}</view>
@@ -82,10 +82,12 @@
                     <view class="la">盘点数量:</view>
                     <view class="val">
                        <view class="wrap">
                           <template v-if="!modalForm.handleType">
                           <image v-if="!modalForm.actStock" src="@/static/side/btn_jian_grey@2x.png" mode=""></image>
                           <image v-else @click="changeAct(-1)" src="@/static/side/btn_jian@3x.png" mode=""></image>
                           <input type="number" v-model="modalForm.actStock"></input>
                           <image @click="changeAct(1)" src="@/static/side/btn_jia@3x.png" mode=""></image>
                           </template>
                           <input :disabled="Boolean(modalForm.handleType && modalForm.handleType == 'detail')" type="digit" v-model="modalForm.actStock"></input>
                           <image v-if="!modalForm.handleType" @click="changeAct(1)" src="@/static/side/btn_jia@3x.png" mode=""></image>
                        </view>
                        <view class="unit">{{modalForm.materialUnitName}}</view>
                     </view>
@@ -93,10 +95,10 @@
               </view>
               <view class="remark">
                  <view class="la">备注:</view>
                  <textarea v-model="modalForm.remark" placeholder="请填写备注" :maxlength="-1" placeholder-class="placeholder9"
                  <textarea v-model="modalForm.remark" :disabled="Boolean(modalForm.handleType && modalForm.handleType == 'detail')" placeholder="请填写备注" :maxlength="-1" placeholder-class="placeholder9"
                     cols="30" rows="10"></textarea>
               </view>
               <view class="btns">
               <view v-if="!modalForm.handleType" class="btns">
                  <view class="btn" @click="showModal = false">取消</view>
                  <view class="btn sub" @click="onSubmit">提交</view>
               </view>
@@ -133,7 +135,7 @@
   } from '@/api'
   import {
      Html5Qrcode
   } from 'html5-qrcode';
} from 'html5-qrcode'
   export default {
      data() {
         return {
@@ -153,7 +155,7 @@
            html5Qrcode: null,
            isScaning: false,
         };
      }
      },
      onLoad(op) {
         this.id = op.id
@@ -161,11 +163,18 @@
         this.getList()
      },
      methods: {
         checkSub() {
            const {
               modalForm
            } = this
            // let str = modalForm.unFinishAmount > 0 ? '还有三项物料'
      itemClick(item) {
         if(item.status == 1){
            this.showItem(item)
         }
      },
      showItem(item){
         this.showModal = true
         this.modalForm = {
            ...item,
            handleType: this.info.status != 1 ? 'detail' : ''
         }
         console.log('modalForm', this.modalForm);
         },
         getDetail() {
            const {
@@ -176,12 +185,12 @@
            })
         },
         handleQuery() {
      handleQuery(str) {
            this.list = []
            this.page = 1
            this.getList()
         this.getList(str)
         },
         getList() {
      getList(str) {
            const {
               page,
               activeTab,
@@ -192,7 +201,7 @@
               capacity: 20,
               page,
               model: {
                  status: activeTab,
               status: str || activeTab,
                  stocktakingId: id,
                  ...param
               }
@@ -203,8 +212,6 @@
                  this.openEheck(this.list[0])
                  this.$set(this.param, 'materialQrcode', null)
               }
            })
         },
         scrolltolower() {
@@ -260,10 +267,10 @@
            
         },
         openQrcode() {
            this.isScaning = true;
         this.isScaning = true
            Html5Qrcode.getCameras().then((devices) => {
               if (devices && devices.length) {
                  this.html5Qrcode = new Html5Qrcode('reader');
               this.html5Qrcode = new Html5Qrcode('reader')
                  this.html5Qrcode.start({
                        facingMode: 'environment'
                     }, {
@@ -275,22 +282,22 @@
                        if (decodeText) { //这里decodeText就是通过扫描二维码得到的内容
                           this.stopScan()
                           this.$set(this.param, 'materialQrcode', decodeText)
                           this.handleQuery()
                        this.handleQuery('null')
                        }
                     },
                     (err) => {
                        // console.log(err);  //错误信息
                     }
                  );
               )
               }
            });
         })
         },
         stopScan() {
            console.log('停止扫码')
            this.isScaning = false;
         this.isScaning = false
            if (this.html5Qrcode) {
               this.html5Qrcode.stop();
            this.html5Qrcode.stop()
            }
         }
      }
@@ -388,8 +395,19 @@
            font-size: 34rpx;
            color: #222222;
            margin-bottom: 10rpx;
         flex: 1;
         }
      .head{
         display: flex;
         // align-items: center;
         justify-content: space-between;
         color: #666666;
         .status{
            width: 76rpx;
            text-align: right;
            padding-top: 3rpx;
         }
      }
         .line {
            height: 60rpx;
            display: flex;