chenhaozhe
2025-08-12 5070a2136a290d2de489cdb7b4d2ae7bc094a91e
pages/caigoutuiliao/form.vue
@@ -31,7 +31,7 @@
                        v-model="hform.HStockPlaceName" @input="HStockPlaceNameChange"></uni-combox>
                </view>
                <view class="righton" v-show="!showHStockPlaceName"><input v-model="hform.HStockPlaceName"
                        placeholder="不可操作" /></view>
                        placeholder="不可操作" disabled="" /></view>
            </view>
            <view class="tabs">
@@ -49,7 +49,8 @@
                            @change="HMainSourceBillTypeChange">
                            <input name="HMainSourceBillType" disabled v-model="HMainSourceBillType"
                                placeholder="请选择源单类型" />
                        </picker>
                        <view class="picker-overlay"></view>
                  </picker>
                    </view>
                    <view class="righton" v-show="!showHMainSourceBillType">
                        <input name="HMainSourceBillType" disabled v-model="HMainSourceBillType"
@@ -58,13 +59,22 @@
                </view>
                <view class="form-item">
                    <view class="title">源单单号:</view>
                    <view class="right" v-show="showHSourceBillNo">
                        <!-- <uni-combox v-if="reHSourceBillNo" :candidates="arrayHSourceBillNo" placeholder="请输入源单单号" v-model="hform.HSourceBillNo" @input="HSourceBillNoChange"></uni-combox> -->
                   <!-- <view class="right" v-show="showHSourceBillNo">
                        <uni-combox :isFocus="HSourceBillNoFocus" ref="uniComboxSourceBill"
                            :confirm-call="onSourceBillBlurHandler" v-if="reHSourceBillNo"
                            :candidates="arrayHSourceBillNo" placeholder="请输入源单单号" v-model="hform.HSourceBillNo"
                            @input="HSourceBillNoChange"></uni-combox>
                    </view>
                    </view> -->
               <view class="right" v-show="showHSourceBillNo">
                  <!-- <uni-combox v-if="reHSourceBillNo" :candidates="arrayHSourceBillNo" placeholder="请输入源单单号"
                     v-model="hform.HSourceBillNo" @input="HSourceBillNoChange"></uni-combox> -->
                  <input :focus="HSourceBillNoFocus" @confirm="onHSourceBillNoConfirmHandler" type="text"
                     name="HSourceBillNo" v-model="hform.HSourceBillNo" placeholder="请输入源单单号" />
               </view>
               <view class="icon-wrapper" v-show="showHSourceBillNo" :disabled="hform.HMainSourceBillType === -1">
                  <uni-icons type="search" size="20" @click="showBillList"></uni-icons>
               </view>
                    <view class="righton" v-show="!showHSourceBillNo">
                        <input name="HSourceBillNo" disabled v-model="hform.HSourceBillNo" placeholder="请输入源单单号" />
                    </view>
@@ -74,7 +84,8 @@
                    <view class="right">
                        <picker mode="date" v-model="hform.HDate" @change="HDateChange">
                            <input disabled v-model="hform.HDate" placeholder="请选择日期" />
                        </picker>
                     <view class="picker-overlay"></view>
                  </picker>
                    </view>
                </view>
                <view class="form-item">
@@ -121,11 +132,11 @@
                </view>
                <view class="form-item">
                    <view class="title">供应商:</view>
                    <view class="right" v-show="showHSupName">
                    <!-- <view class="right" v-show="showHSupName">
                        <uni-combox :candidates="arrayHSupName" placeholder="请选择供应商" v-model="hform.HSupName"
                            @input="HSupNameChange"></uni-combox>
                    </view>
                    <view class="righton" v-show="!showHSupName">
                    </view> -->
                    <view class="righton">
                        <input name="HSupName" disabled v-model="hform.HSupName" placeholder="请选择供应商" />
                    </view>
                </view>
@@ -229,6 +240,8 @@
                <button class="btn-c" size="mini" @tap="goBack">退出</button>
            </view>
        </view>
      <BillListPopupVue ref="billList" :HBillType="hform.HBillType" :HSourceBillType="hform.HMainSourceBillType"
         :HStockOrgID="hform.HStockOrgID"></BillListPopupVue>
    </view>
</template>
<script>
@@ -239,7 +252,10 @@
    import {
        CommonUtils
    } from '../../utils/common';
   import { getUserStockRelation } from '../../utils/userRelationManager';
   import BillListPopupVue from '../../components/BillListPopup/BillListPopup.vue';
    export default {
      components: {BillListPopupVue},
        data() {
            return {
                HSourceBillNoFocus: false,
@@ -252,7 +268,7 @@
                OperationType: 1,
                HInterID_Temp: '',
                showHStockPlaceName: true,
                showHStockPlaceName: false,
                showHMainSourceBillType: true,
                showHSourceBillNo: true,
                reHSourceBillNo: true,
@@ -337,12 +353,46 @@
                this.getNewData()
                this.HSourceBillNoFocus = true
            }
            this.getHBaseList()
            this.getHSupList()
         this.getRelationStore()
            // this.getHBaseList()
            // this.getHSupList()
            this.getHEmpList()
            this.getHDeptList()
         uni.$on('BillSelectComplete', (e) => {
            console.log("接收到的消息: ", e.HBillNo)
            this.getHBarCodeData(e.HBillNo)
            this.$refs.billList.exit()
         })
        },
      beforeDestroy() {
         uni.$off('BillSelectComplete')
      },
        methods: {
         async getRelationStore() {
            let {
               data,
               count
            } = await getUserStockRelation()
            if (count == 1) {
               let WHIDList = []
               Array.from(data).forEach(elem => {
                  WHIDList.push(elem.HItemID)
               })
               let sWhere = ` and HItemID in (${WHIDList.join(",")})`
               this.getHBaseList({
                  sWhere: sWhere
               })
            } else {
               this.getHBaseList()
            }
         },
         showBillList() {
            this.$refs.billList.showPopup()
         },
            async refreshHSourceBillState() {
                this.HSourceBillNoFocus = false
                await this.$nextTick(() => {
@@ -475,11 +525,11 @@
                this.hform.HDate = e.detail.value
            },
            //基础仓库资料
            getHBaseList() {
            getHBaseList({sWhere=""} = {}) {
                uni.request({
                    url: this.serverUrl + '/Gy_Warehouse/list',
                    data: {
                        sWhere: "",
                        sWhere: sWhere,
                        user: uni.getStorageSync('HUserName'),
                        Organization: uni.getStorageSync('Organization')
                    },
@@ -534,7 +584,7 @@
                    },
                });
                this.getHYDList()
                // this.getHYDList()
            },
            //源单资料
            getHYDList() {
@@ -581,6 +631,13 @@
                    if (this.HWHNameList[i].仓库名称 == e) {
                        this.hform.HWHName = this.HWHNameList[i].仓库名称
                        this.hform.HWHID = this.HWHNameList[i].HItemID
                  if (this.HWHNameList[i]['启用仓位'] == 'Y') {
                     this.showHStockPlaceName = true
                  } else {
                     this.hform.HStockPlaceName = ''
                     this.showHStockPlaceName = false
                  }
                    }
                }
            },
@@ -608,13 +665,13 @@
                this.HMainSourceBillType = this.arrayHMainSourceBillType[e.detail.value]
                if (this.HMainSourceBillType == '退料通知单') {
                    this.hform.HMainSourceBillType = 1105
                    this.getHYDList()
                    // this.getHYDList()
                } else if (this.HMainSourceBillType == '采购订单') {
                    this.hform.HMainSourceBillType = 1102
                    this.getHYDList()
                    // this.getHYDList()
                } else {
                    this.hform.HMainSourceBillType = -1
                    this.getHYDList()
                    // this.getHYDList()
                }
            },
@@ -1331,9 +1388,10 @@
        align-items: center;
        font-size: 30rpx;
        padding: 6rpx 0;
      gap: 12rpx;
        .title {
            width: 208rpx;
            width: 200rpx;
            text {
                color: red;
@@ -1342,13 +1400,19 @@
        }
        .right {
            width: 450rpx;
            flex: 1;
            border-radius: 22rpx;
            border: 1px solid #acacac;
         position: relative;
         display: flex;
         .uni-combox {
            width: 100%;
         }
        }
        .righton {
            width: 450rpx;
            flex: 1;
            border-radius: 22rpx;
            border: 1px solid #e4e4e4;
            background-color: #e4e4e4;
@@ -1450,4 +1514,25 @@
            }
        }
    }
   .icon-wrapper {
      background-color: #3A78FF;
      width: 52rpx;
      height: 52rpx;
      border-radius: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
      .uni-icons {
         color: #fff !important;
      }
   }
   .icon-wrapper[disabled] {
      background-color: rgba(228, 228, 228, 1);
      pointer-events: none;
      touch-action: none;
   }
</style>