zrg
2025-09-05 46cc7a29dc1f9b3dffee5cdcb9b7f9dfdac3b16d
pages/caigouruku/form.vue
@@ -103,6 +103,9 @@
               <view class="righton">
                  <input name="HBillNo" disabled v-model="hform.HBillNo" />
               </view>
                    <view class="icon-wrapper">
                       <uni-icons type="scan" size="20" @click="qrCodeDisplay"></uni-icons>
                    </view>
            </view>
            <view class="form-item">
               <view class="title">单据ID:</view>
@@ -173,6 +176,9 @@
                     </view>
                     <view class="detail" v-if="item.辅助属性">
                        <text>辅助属性:</text>{{item.辅助属性}}
                     </view>
                     <view class="detail" v-if="item.款号">
                        <text>款号:</text>{{item.款号}}
                     </view>
                  </view>
               </uni-card>
@@ -246,7 +252,8 @@
      </view>
      <BillListPopupVue ref="billList" :HBillType="hform.HBillType" :HSourceBillType="hform.HMainSourceBillType"
         :HStockOrgID="hform.HStockOrgID"></BillListPopupVue>
   </view>
        <BarCodePopupVue ref="barcodePopup"></BarCodePopupVue>
    </view>
</template>
<script>
   import getDateTime from '@/utils/getdateTime.js';
@@ -260,7 +267,8 @@
      getUserStockRelation
   } from "@/utils/userRelationManager.js"
   import BillListPopupVue from '../../components/BillListPopup/BillListPopup.vue';
   export default {
   import BarCodePopupVue from "../../components/BarCodePopup/BarCodePopup.vue";
    export default {
      data() {
         return {
            HSourceBillNoFocus: false,
@@ -274,6 +282,10 @@
            HPageTitle: '采购入库单',
                materMeta: [
                ],
            showHStockPlaceName: false,
            showHMainSourceBillType: true,
            showHSourceBillNo: true,
@@ -348,7 +360,7 @@
         }
      },
      components: {
         BillListPopupVue
         BillListPopupVue, BarCodePopupVue
      },
      onLoad(e) {
         console.log(e, this.userInfo)
@@ -378,6 +390,18 @@
         uni.$off('BillSelectComplete')
      },
      methods: {
            async qrCodeDisplay() {
                try {
                    this.$refs.barcodePopup.setCodeInfo(this.hform.HBillNo)
                    await this.$nextTick()
                    this.$refs.barcodePopup.open()
                }catch(err) {
                    uni.showToast({
                        icon: 'none',
                        title: err
                    })
                }
            },
         async getRelationStore() {
            let {
               data,
@@ -534,7 +558,8 @@
            } else {
               inputVal = this.hform.HSourceBillNo
            }
                console.log('inputVal: ',inputVal);
            if (inputVal == '') {
               CommonUtils.playSound(0)
               this.refreshHSourceBillState()
@@ -1077,6 +1102,7 @@
                           this.showHSupName = false
                           this.tabs = 2
                        } else { //物料条码
                                    this.materMeta.push(data)
                           this.tabs = 2
                           if (!this.hform.HSourceBillNo) {
                              this.hform.HSupName = data.hSupNameField
@@ -1115,6 +1141,8 @@
                              }
                              //供应商不可编辑
                              this.showHSupName = false
                              //光标对准物料
                              this.barCodeFocus = true;
                           }
                        }
                        //显示表体明细
@@ -1156,6 +1184,7 @@
                  console.log('物料', res.data)
                  if (res.data.count == 1) {
                     var data = res.data.data
                            this.materMeta = data.BarCodeDetailslist
                     this.Materlist = data.Materlist
                     if (!data.BarCodeDetailslist[0].HBarCode) {
                        this.hform.HMaterName_B = ''
@@ -1167,6 +1196,7 @@
                        this.hform.HWHName_B = ''
                        this.hform.HSPName_B = ''
                     } else {
                                this.hform.HBarCode_B = data.BarCodeDetailslist[0].HBarCode
                        this.hform.HMaterName_B = data.BarCodeDetailslist[0].HMaterName
                        this.hform.HMaterModel_B = data.BarCodeDetailslist[0].HMaterModel
                        this.hform.HBatchNo_B = data.BarCodeDetailslist[0].HBatchNo
@@ -1385,31 +1415,44 @@
                  uni.request({
                     url: this.serverUrl + '/WEBSController/set_SavePOStockInBill_Json',
                     method: 'POST',
                     dataType: "json",
                     dataType: "json",
                            timeout: 10000,
                     data: {
                        oMain: sMainStr
                     },
                     success: (res) => {
                     success: async (res) => {
                        console.log(1, res);
                        uni.hideLoading()
                        if (res.data.count == 1) {
                           uni.showModal({
                              title: '提示',
                              content: res.data.Message + '。是否继续新增?(点击取消返回上级页面)',
                              success: (res) => {
                                 if (res.confirm) {
                                    console.log('用户点击确定');
                                    uni.redirectTo({
                                       url: '/pages/caigouruku/form?OperationType=1'
                                    })
                                 } else if (res.cancel) {
                                    console.log('用户点击取消');
                                    setTimeout(() => {
                                       uni.navigateBack();
                                    }, 50)
                                 }
                              }
                           });
                                    let sMain = JSON.stringify(this.materMeta) + ';' + this.hform.HBillType + ';' + this.hform.HSourceBillNo
                                    try {
                                        // 为条码设置出库单号和出库次数
                                        // await this.Set_BarCodeBill(sMain)
                                        uni.showModal({
                                           title: '提示',
                                           content: res.data.Message + '。是否继续新增?(点击取消返回上级页面)',
                                           success: (res) => {
                                              if (res.confirm) {
                                                 console.log('用户点击确定');
                                                 uni.redirectTo({
                                                    url: '/pages/caigouruku/form?OperationType=1'
                                                 })
                                              } else if (res.cancel) {
                                                 console.log('用户点击取消');
                                                 // setTimeout(() => {
                                                 //    uni.navigateBack();
                                                 // }, 50)
                                              }
                                           }
                                        });
                                    }catch(err) {
                                        uni.showToast({
                                           title: err,
                                           icon: 'none'
                                        })
                                    }
                        } else {
                           uni.showToast({
                              title: res.data.Message,
@@ -1432,7 +1475,25 @@
         showBillList() {
            this.$refs.billList.showPopup()
         },
            Set_BarCodeBill(sMain) {
                return new Promise((resolve, reject) => {
                    CommonUtils.doRequest2({
                        method: 'POST',
                        url: 'Sc_BarCode/Set_BarCodeBill',
                        data: {
                            msg: sMain
                        },
                        resFunction: (res) => {
                            let {data, count, Message} = res.data
                            if(count == 1) {
                                resolve()
                            }else {
                                reject(Message)
                            }
                        }
                    })
                })
            },
         goBack() {
            uni.showModal({
               title: '提示',
@@ -1536,7 +1597,7 @@
      }
      input {
         width: 100%;
         width: inherit;
         padding: 8rpx 20rpx;
         font-size: 30rpx;
      }