whycq
2024-06-06 c48093016b1511ce8b33ffb49062a3bf7a1aed16
pages/phyz/order/orderList.vue
@@ -15,16 +15,32 @@
            <view>编号:{{item.matnr}}</view>
            <view>名称:{{item.maktx}}</view>
            <view>规格:{{item.specs}}</view>
            <view>数量:{{item.anfme}}</view>
            <view>批号:{{item.batch}}</view>
            <view class="list-anfme">数量:{{item.anfme}}</view>
            <view class="list-qty-1" v-if="item.anfme > item.qty">作业数量:{{item.qty}}</view>
            <view class="list-qty-2" v-if="item.anfme <= item.qty">作业数量:{{item.qty}}</view>
            <view class="card-id">{{i + 1}}</view>
         </view>
         <view class="list-right" @click="checkboxChange(item)">
            <label >
               <checkbox :value="item.orderNo" :checked="item.checked" color="#FFCC33" style="transform:scale(0.7)" /><text></text>
               <checkbox :value="item.orderNo" :checked="item.checked" color="" :disabled="item.anfme <= item.qty" style="transform:scale(0.7)" /><text></text>
            </label>
         </view>
      </view>
      <view style="height: 100rpx;"></view>
      <!-- 底部操作按钮 -->
      <view class="buttom" v-if="orderType == 'in'">
         <button size="mini" @click="reset('warn')">重置</button>
         <button size="mini" type="primary" @click="combConfirm('warn')">去组托</button>
      </view>
      <!-- 底部操作按钮 -->
      <view class="buttom" v-if="orderType == 'out'">
         <button size="mini" @click="reset('warn')">重置</button>
         <button size="mini" type="primary" @click="combConfirm2('warn')">去出库</button>
      </view>
   </view>
</template>
@@ -38,94 +54,18 @@
            matFocus: true,
            matnr: '',
            checck: true,
            dataList: [
               {
                  orderNo: 'cg0931241',
                  matnr: 'cg0931255',
                  maktx: '你好',
                  anfme: 10,
                  specs: '10-z',
                  checked: true
               },
               {
                  orderNo: 'cg0931241',
                  matnr: 'cg0931241',
                  maktx: '你好',
                  anfme: 10,
                  specs: '10-z'
               },
               {
                  orderNo: 'cg0931241',
                  matnr: 'cg0931225',
                  maktx: '你好',
                  anfme: 10,
                  specs: '10-z'
               },
               {
                  orderNo: 'cg0931241',
                  matnr: 'cg0931241',
                  maktx: '你好',
                  anfme: 10,
                  specs: '10-z'
               },
               {
                  orderNo: 'cg0931241',
                  matnr: 'cg0931241',
                  maktx: '你好',
                  anfme: 10,
                  specs: '10-z'
               },
               {
                  orderNo: 'cg0931241',
                  matnr: 'cg0931241',
                  maktx: '你好',
                  anfme: 10,
                  specs: '10-z'
               },
               {
                  orderNo: 'cg0931241',
                  matnr: 'cg0931241',
                  maktx: '你好',
                  anfme: 10,
                  specs: '10-z'
               },
               {
                  orderNo: 'cg0931241',
                  matnr: 'cg0931241',
                  maktx: '你好',
                  anfme: 10,
                  specs: '10-z'
               },
               {
                  orderNo: 'cg0931241',
                  matnr: 'cg0931241',
                  maktx: '你好',
                  anfme: 10,
                  specs: '10-z'
               },
               {
                  orderNo: 'cg0931241',
                  matnr: 'cg0931241',
                  maktx: '你好',
                  anfme: 10,
                  specs: '10-z'
               },
               {
                  orderNo: 'cg0931241',
                  matnr: 'cg0931241',
                  maktx: '你好',
                  anfme: 10,
                  specs: '10-z'
               },
            ],
            dataList: [],
            oldDataList: [],
            newDataList: [],
            allCheck: false,
            allCheckBtnTitle: '全选'
            allCheckBtnTitle: '全选',
            orderType: 'out'
         }
      },
      onLoad() {
         let that = this
         this.baseUrl = uni.getStorageSync('baseUrl');
         this.token = uni.getStorageSync('token');
         // const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
         const eventChannel = this.getOpenerEventChannel();
         
@@ -133,14 +73,31 @@
         eventChannel.on('item', function(data) {
            console.log(data);
            that.orderId = data.item.orderId 
            console.log(data.item.id);
            uni.setNavigationBarTitle({
               title: data.item.orderNo,
            })
            that.getOrderDetl(data.item.id)
            that.orderType = 'in'
         })
         eventChannel.on('item1', function(data) {
            console.log(data);
            that.orderId = data.item.orderId
            console.log(data.item.id);
            uni.setNavigationBarTitle({
               title: data.item.orderNo,
            })
            that.getOrderDetl(data.item.id)
            that.orderType = 'out'
         })
      },
      onShow() {
         this.baseUrl = uni.getStorageSync('baseUrl');
         this.token = uni.getStorageSync('token');
         this.oldDataList = [...this.dataList]
         this.getOrderDetl(this.orderId)
         if (this.dataList.length > 0) {
            this.oldDataList = [...this.dataList]
         }
         // this.getOrderDetl(this.orderId)
      },
      methods: {
         // 订单明细
@@ -159,7 +116,10 @@
                  res = res.data
                  console.log(res);
                  if (res.code === 200) {
                     res.data.records
                     _this.dataList = res.data.records
                     _this.oldDataList = [..._this.dataList]
                  } 
               }
            })
@@ -167,7 +127,9 @@
         matInput() {
            let count = 0
            let sign = 0
            this.dataList = [...this.oldDataList]
            if (this.oldDataList.length > 0) {
               this.dataList = [...this.oldDataList]
            }
            this.newDataList = []
            for (let k in this.dataList) {
               if (!this.dataList[k].matnr.includes(this.matnr)) {
@@ -199,7 +161,12 @@
            if (e.checked) {
               this.$set(e,'checked',false)
            } else {
               this.$set(e,'checked',true)
               if (e.anfme == e.qty) {
                  this.$set(e,'checked',false)
               } else {
                  this.$set(e,'checked',true)
               }
            }
         },
         allChecked() {
@@ -212,7 +179,11 @@
            }
            for (let item of this.dataList) {
               if (this.allCheck) {
                  this.$set(item,'checked',true)
                  if (item.anfme == item.qty) {
                     this.$set(item,'checked',false)
                  } else {
                     this.$set(item,'checked',true)
                  }
               } else {
                  this.$set(item,'checked',false)
               }
@@ -221,12 +192,68 @@
         clear() {
            this.matnr = ''
            this.dataList = [...this.oldDataList]
         }
         },
         combConfirm(type) {
            let _this = this
            let combList = []
            for (let k of _this.dataList) {
               k['csocode'] = k.threeCode
               if (k.checked) {
                  combList.push(k)
               }
            }
            if (combList.length == 0) {
               uni.showToast({ title: '请选择组托商品', icon: "error", position: 'top'})
               return
            }
            uni.navigateTo({
               url: "../AGV/AGVPakin3",
               success: function(res) {
                  // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的
                  res.eventChannel.emit('mats', {
                     mats: combList
                  })
               },
            });
         },
         combConfirm2(type) {
            let _this = this
            let combList = []
            for (let k of _this.dataList) {
               if (k.checked) {
                  combList.push(k)
               }
            }
            if (combList.length == 0) {
               uni.showToast({ title: '请选择出库商品', icon: "error", position: 'top'})
               return
            }
            uni.navigateTo({
               url: "./preview",
               success: function(res) {
                  // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的
                  res.eventChannel.emit('mats', {
                     mats: combList
                  })
               },
            });
         },
      }
   }
</script>
<style>
   @import url('../../../static/css/common/order.css');
   .list-anfme {
      color: #0082ff;
      font-weight: bold;
   }
   .list-qty-1 {
      color: #33ba43;
      font-weight: bold;
   }
   .list-qty-2 {
      color: #e2231a;
      font-weight: bold;
   }
</style>