yyb
2025-06-18 76486524892abdfd3039eedc28d83cbbfb56d042
pages/product/WorkshopOrderCancellationIssued/index.vue
@@ -2,8 +2,14 @@
<template>
   <view class="page">
      <view class="packing-registration-bg" />
      <u-navbar title="订单取消下发" :background="background" :border-bottom="false" :title-bold="true" title-color="#000"
         back-icon-color="#000" />
    <u-navbar
      title="订单取消下发"
      :background="background"
      :border-bottom="false"
      :title-bold="true"
      title-color="#000"
      back-icon-color="#000"
    />
      <view class="packing-registration-param">
         <view class="packing-registration-param-view">
            <view class="packing-registration-param-item param-extra">
@@ -12,10 +18,15 @@
               </view>
               <view class="packing-registration-param-item-right">
                  <text class="item-one item-two" @click="seachPersonnelNo()">{{
              registerInfo.value1 == "" ? "点击选择" : registerInfo.value1
              registerInfo.moNo == "" ? "点击选择" : registerInfo.moNo
            }}</text>
                  <u-icon name="arrow-right" color="#687792" size="28" @click="seachPersonnelNo()"
                     v-show="registerInfo.value1 == ''"></u-icon>
            <u-icon
              name="arrow-right"
              color="#687792"
              size="28"
              @click="seachPersonnelNo()"
              v-show="registerInfo.moNo == ''"
            ></u-icon>
               </view>
            </view>
            <view class="packing-registration-param-item param-extra">
@@ -27,9 +38,17 @@
      </view>
      <view class="wrap">
         <scroll-view class="packing-registration-scroll-list" scroll-y="true">
            <u-cell-group class="packing-registration-scroll-list-group" :border="false">
        <u-cell-group
          class="packing-registration-scroll-list-group"
          :border="false"
        >
               <!-- <div class="tip" style="text-align: center;" v-if="hasScanSnList.length==0">-请扫码-</div> -->
               <view class="content" v-for="(item, index) in hasScanSnList" :key="index" :index="index">
          <view
            class="content"
            v-for="(item, index) in hasScanSnList"
            :key="index"
            :index="index"
          >
                  <view class="content-header">
                     <view class="content-header-title">{{ index + 1 }}</view>
                  </view>
@@ -39,7 +58,7 @@
                           <view class="_label-name">批号</view>
                        </view>
                        <view class="_content">
                           {{ item.value0 }}
                  {{ item.moOn }}
                        </view>
                     </view>
                     <view class="row-list">
@@ -47,7 +66,7 @@
                           <view class="_label-name">零件号:</view>
                        </view>
                        <view class="_content">
                           {{ item.value1 }}
                  {{ item.partNo }}
                        </view>
                     </view>
                     <view class="row-list">
@@ -55,7 +74,7 @@
                           <view class="_label-name">零件描述:</view>
                        </view>
                        <view class="_content">
                           {{ item.value2 }}
                  {{ item.partName }}
                        </view>
                     </view>
                     <view class="row-list">
@@ -72,8 +91,14 @@
         </scroll-view>
         <scan></scan>
      </view>
      <u-modal v-model="showModal" title="" :show-cancel-button="true" :show-confirm-button="true" @confirm="confirm"
         @cancel="cancel">
    <u-modal
      v-model="showModal"
      title=""
      :show-cancel-button="true"
      :show-confirm-button="true"
      @confirm="confirm"
      @cancel="cancel"
    >
         <view class="popup-content">
            <view class="packing-registration-param">
               <view class="packing-registration-param-view">
@@ -82,7 +107,7 @@
                        <text class="item-one">批号</text>
                     </view>
                     <view class="packing-registration-param-item-right">
                        <text class="item-one item-two">{{ modalList.value }}</text>
                <text class="item-one item-two">{{ modalList.moOn }}</text>
                     </view>
                  </view>
                  <view class="packing-registration-param-item param-extra">
@@ -90,7 +115,7 @@
                        <text class="item-one">零件号</text>
                     </view>
                     <view class="packing-registration-param-item-right">
                        <text class="item-one item-two">{{ modalList.value1 }}</text>
                <text class="item-one item-two">{{ modalList.partNo }}</text>
                     </view>
                  </view>
                  <view class="packing-registration-param-item param-extra">
@@ -98,7 +123,7 @@
                        <text class="item-one">零件描述</text>
                     </view>
                     <view class="packing-registration-param-item-right">
                        <text class="item-one item-two">{{ modalList.value2 }}</text>
                <text class="item-one item-two">{{ modalList.partName }}</text>
                     </view>
                  </view>
                  <view class="packing-registration-param-item param-extra">
@@ -137,57 +162,75 @@
            },
            //弹窗列表
            modalList: {
               value: "",
               value1: "",
               value2: "",
               value3: "",
        partName: "",
        partNo: "",
        moNo: "",
        num: "",
            },
            registerInfo: {
               value1: "",
        moNo: "",
            },
            hasScanSnList: [{
                  value0: "11111111111111111111111",
                  value1: "111",
                  value2: "111",
                  value3: "111",
               },
               {
                  value0: "111",
                  value1: "111",
                  value2: "111",
                  value3: "111",
               },
               {
                  value0: "111",
                  value1: "111",
                  value2: "111",
                  value3: "111",
               },
            ],
      hasScanSnList: [],
      codeInfoId: "",
         };
      },
      onShow() {
         let that = this;
         uni.$off("scan"); // 每次进来先 移除全局自定义事件监听器
    if (registerInfo.moNO == null) {
      uni.showToast({
        icon: "none",
        title: "请先选择订单号!",
        duration: 2 * 1000,
      });
      return;
    }
         uni.$on("scan", function(data) {
            console.log("onscan");
            //扫码成功后的回调,你可以写自己的逻辑代码在这里
            console.log("扫码结果:", data.code);
      if (data.code) {
        let codeInfo = JSON.parse(data.code);
        this.codeInfoId = codeInfo.id;
        if (codeInfo.moOn) {
          // 扫描报工单二维码
            that.scanHandle(data.code);
            this.showModal = true;
            that.$forceUpdate();
          that.getHandelList();
        }
      }
         });
      },
      methods: {
    getHandelList() {
      this.$u.api.workReporting
        .getProductMainV1({
          current: 1,
          size: -1,
          id: this.codeInfoId,
        })
        .then((res) => {
          this.hasScanSnList = res.data.productOutputList;
        });
    },
    // 扫码后数据回显
    scanHandle(val) {
      let { moNo, partNo, partName } = val;
      this.modalList.moNo = moNo;
      this.modalList.partNo = partNo;
      this.modalList.partName = partName;
      this.showModal = true;
    },
         // 点击确认后获取下发记录
         confirm() {
            // 处理确认逻辑
            this.showModal = false;
            this.$u.api.workReporting
            ._({}).then((res) => {
      this.$u.api.workReporting._(this.modalList).then((res) => {
               console.log("res", res);
               this.hasScanSnList = res.data.records;
        this.showModal = false;
        this.getHandelList();
            });
         },
         // 模态框取消
@@ -196,7 +239,7 @@
         },
         setNo(val) {
            console.log("11111", val);
            this.registerInfo.value1 = val.value1;
      this.registerInfo.moNo = val.moNo;
         },
         //订单号
         seachPersonnelNo() {
@@ -205,7 +248,6 @@
               url: "/pages/product/report/orderList",
            });
         },
      },
   };
</script>