yyb
8 天以前 8b1b8a60b6280c4aae555e6914103db644c36c4e
pages/storeManagement/MaterialRequisition/index.vue
@@ -51,7 +51,7 @@
                  <view class="_label-name">净重:</view>
                </view>
                <view class="_content">
                  {{ item.NW }}
                  {{ item.KW }}
                </view>
              </view>
            </view>
@@ -74,9 +74,7 @@
                  <text class="item-one">批次号:</text>
                </view>
                <view class="packing-registration-param-item-right">
                  <text class="item-one item-two">{{
                    detailedList.BN
                  }}</text>
                  <text class="item-one item-two">{{ detailedList.BN }}</text>
                </view>
              </view>
              <view class="packing-registration-param-item param-extra">
@@ -84,9 +82,7 @@
                  <text class="item-one">品牌:</text>
                </view>
                <view class="packing-registration-param-item-right">
                  <text class="item-one item-two">{{
                    detailedList.BR
                  }}</text>
                  <text class="item-one item-two">{{ detailedList.BR }}</text>
                </view>
              </view>
              <view class="packing-registration-param-item param-extra">
@@ -94,9 +90,7 @@
                  <text class="item-one">净重:</text>
                </view>
                <view class="packing-registration-param-item-right">
                  <text class="item-one item-two">{{
                    detailedList.NW
                  }}</text>
                  <text class="item-one item-two">{{ detailedList.KW }}</text>
                </view>
              </view>
            </view>
@@ -127,7 +121,7 @@
        whiteSpace: "nowrap",
      },
      hasScanSnList: [],
      showModal: false, // 控制弹窗显示隐藏的变量
      showModal: false, // 控制弹窗显示隐藏的变量
      detailedList: {},
    };
  },
@@ -135,9 +129,8 @@
  onShow() {
    let that = this;
    uni.$off("scan"); // 每次进来先 移除全局自定义事件监听器
     uni.$on("scan", function (data) {
      this.detailedList = {},
      console.log("onscan");
    uni.$on("scan", function (data) {
      (this.detailedList = {}), console.log("onscan");
      //扫码成功后的回调,你可以写自己的逻辑代码在这里
      console.log("页面扫码结果:", data.code);
      if (data.code) {
@@ -150,23 +143,32 @@
    });
  },
  methods: {
       // 回显扫码的信息
    cancel() {
      // 处理取消逻辑
      this.showModal = false;
    },
    // 回显扫码的信息
    saveForm(val) {
      this.detailedList = val;
        this.showModal = true;
     },
   confirm() {
    //   // 处理确认逻辑
    //   this.$u.api.materialRequisition
    //     .materialRequisition({
    //       ...this.detailedList,
    //     })
    //     .then((res) => {
    //       this.hasScanSnList.push(this.detailedList);
    //       console.log("记录", this.hasScanSnList);
    //       this.$u.toast("领料成功");
      //     });
      this.detailedList = val;
      this.showModal = true;
    },
    confirm() {
      // 处理确认逻辑
      this.$u.api.materialRequisition
        .materialRequisition({
          ...this.detailedList,
        })
        .then((res) => {
          this.hasScanSnList.push(this.detailedList);
          console.log("记录", this.hasScanSnList);
          this.$u.toast("领料成功");
        })
        .catch((err) => {
          uni.showToast({
            title: res.msg || "网络错误,领料失败",
            icon: "none",
          });
        });
    },
  },
};