#
whycq
2022-04-02 0a90905d8b133b4213e760355aab141347fec999
pages/basics/demo.vue
@@ -2,35 +2,49 @@
   <view>
      <scroll-view>
         <view>
            <view class="search-box">
               <view class="search-area">
                  <view class="search-icon"><uni-icons type="search" size="25" color="#a5a5a5"></uni-icons></view>
                  <input type="text" v-model="orderNo" placeholder="扫码 / 输入(订单编号)" @input="search()"/>
                  <view class="close-icon" @click="reset()"><uni-icons type="closeempty" size="25" color="#a5a5a5"></uni-icons></view>
               </view>
            </view>
            <checkbox-group @change="checkbox">
               <label v-for="(item,index) in data" :key="index" class="demo-list bg-false" :class="'bg-'+item.checked" >
                  <view class="demo-list-left">
                     <checkbox :value="item.id+''" :checked="item.checked" style="display: block;" />
                  </view>
                  <view class="demo-list-right">
                     <view><text style="font-weight: bold;">序号:{{index+1}}</text><text>订单 | </text>{{item.orderNo}}</view>
                     <view><text style="font-size: 15rpx;">商品编码:</text>{{item.matnr}}</view>
                     <view><text style="font-size: 15rpx;">应入数量:</text><view class="text-num">{{item.anfme}}</view><text>商品名称:</text>{{item.maktx}}</view>
                     <view><text>已入数量:</text><view class="text-num">{{item.inQty}}</view><text>订单状态:</text>{{item.state$}}</view>
                     <!-- <view><text style="font-weight: bold;">序号:{{index+1}}</text></view> -->
                     <view class="order-ditel"><text class="index">No.{{index+1}}</text><text class="orderNo">{{item.orderNo}}</text></view>
                     <view><text style="width: 400rpx;">商品编码:{{item.matnr}}</text></view>
                     <view>
                        <text>应入数量:{{item.anfme}}</text>
                        <text>商品名称:{{item.maktx}}</text>
                     </view>
                     <view>
                        <text>已入数量:{{item.inQty}}</text>
                        <text style="width: auto;">订单状态:</text><text :class="state$"> {{item.state$}}</text>
                     </view>
                  </view>
               </label>
            </checkbox-group>
         </view>
      </scroll-view>
      <view class="foot flex justify-around">
         <label>
         <label class="label-btn" style="width: 150rpx;">
            <checkbox :checked="check" @click="allChecked()">{{checkText}}</checkbox>
         </label>
         <label>
         <label class="label-btn" style="width: 100rpx;">
            <text  @click="reChecked()">反选</text>
         </label>
         <label for="">
            <button class="cu-btn bg-yellow lg" @click="shangjia()">上架</button>
         </label>
         <label for="">
            <button class="cu-btn bg-yellow lg">撤销上架</button>
         </label>
         
         <label class="label-btn" style="width: 170rpx;">
            <button class="cu-btn bg-red ">撤销上架</button>
         </label>
         <label class="label-btn">
            <button class="cu-btn bg-blue " @click="shangjia()">上架</button>
         </label>
      </view>
   </view>
</template>
@@ -40,9 +54,12 @@
      data() {
         return {
            data: [],
            orderNo:'',
            needData:{},
            check:false,
            checkText:'全选',
            checkedData:[],
            state$:'',
         }
      },
      mounted() {
@@ -53,6 +70,28 @@
         this.render()
      },
      methods: {
         // 搜索
         search() {
            let that = this;
            // that.tabData.forEach(function(e){
            //    that.searchData = e.orderNo
            // })
            this.render(that.orderNo)
         },
         // 重置
         reset() {
            let that = this;
            if (that.orderNo == '') {
               uni.vibrateShort();
            } else {
               uni.vibrateLong();
            }
            that.orderNo = '';
            that.needData['order_no'] = '';
            that.getData();
         },
         // 表格加载
         render(param) {
            let that = this;
@@ -73,6 +112,14 @@
                  var res = res.data
                  if (res.code === 200) {
                     that.data = res.data.records
                  }
                  for (var i = 0; i < that.data.length; i++) {
                     if (that.data[i].state$ == "未入库") {
                        that.state$ = 'color-red'
                     } else {
                        console.log(2)
                     }
                  }
               }
            })
@@ -96,6 +143,7 @@
               this.check = false
               this.checkText = "全选"
            }
            uni.vibrateShort();
         },
         reChecked() { // 反选
            var checkArr = []
@@ -116,6 +164,7 @@
               this.check = false
               this.checkText = "全选"
            }
            uni.vibrateShort();
         },
         allChecked(e){ // 全选
            if (this.check == true) {
@@ -131,7 +180,7 @@
               this.check = true
               this.checkText = "取消全选"
            }
            uni.vibrateShort();
         },
         shangjia() {
            this.checkedData = []
@@ -140,6 +189,7 @@
                  this.checkedData.push(this.data[i])
               }
            }
            uni.vibrateShort();
            console.log(this.checkedData)
         }
      }
@@ -147,6 +197,63 @@
</script>
<style>
   .search-box {
      position: fixed;
      left: 0;
      top: 0;
      width: 100%;
      height: 100rpx;
      background-color: #FFF;
      border-bottom: 1px solid #d8d8d8;
      border-radius: 0 0 20rpx 20rpx;
      z-index: 1;
   }
   /*#ifdef H5 */
   .search-box {
      position: fixed;
      left: 0;
      top: 60rpx;
      width: 100%;
      height: 100rpx;
      background-color: #ffffff;
      border-bottom: 1px solid #d8d8d8;
      border-radius: 0 0 20rpx 20rpx;
      z-index: 1;
   }
   /* #endif */
   .search-area {
      background-color: #EDEDED;
      width: 96%;
      height: 70%;
      margin: 15rpx;
      border-radius: 15rpx;
   }
   .search-area input {
      display: inline-block;
      height: 70rpx;
      width: 70%;
      line-height: 70rpx;
      /* color: #a5a5a5; */
      font-size: 25rpx;
      font-weight: 400;
   }
   .search-icon {
      display: inline-block;
      float: left;
      width: 70rpx;
      height: 70rpx;
      text-align: center;
      line-height: 70rpx;
   }
   .close-icon {
      display: inline-block;
      float: right;
      width: 70rpx;
      height: 70rpx;
      text-align: center;
      line-height: 70rpx;
   }
   .bg-false {
      background-color: #FFFFFF;
   }
@@ -156,46 +263,87 @@
   
   .demo-list {
      border-bottom: 1px solid #d8d8d8;
      height: 150rpx;
      height: 180rpx;
      margin: 15rpx;
      border-radius: 20rpx;
   }
   .demo-list:first-child {
      margin-top: 120rpx;
   }
   .demo-list:last-child {
      margin-bottom: 99rpx;
      margin-bottom: 120rpx;
   }
   label {
      display: block;
   }
   .demo-list-left {
      /* background-color: #007AFF; */
      display: inline-block;
      float: left;
      text-align: center;
      width: 100rpx;
      height: 150rpx;
      line-height: 150rpx;
      height: 180rpx;
      line-height: 180rpx;
   }
   .demo-list-right {
      /* background-color: #55ffff; */
      display: inline-block;
      float: left;
      height: 150rpx;
      height: 180rpx;
      color: #828282;
   }
   .order-ditel {
      height: 60rpx;
      width: 600rpx;
      line-height: 60rpx;
   }
   .demo-list-right .index {
      width: 120rpx;
      height: 25rpx;
      line-height: 25rpx;
      font-size: 40rpx;
      border-right: 4rpx solid #6f6f6f;
      padding-left: 0px;
      padding-right: 10rpx;
      color: #3b3b3b;
      /* background-color: #007AFF; */
   }
   .demo-list-right .orderNo {
      padding-left: 30rpx;
      font-size: 35rpx;
      width: 400rpx;
      color: #3b3b3b;
      /* background-color: #0A98D5; */
   }
   .demo-list-right .vertical-bar { // 竖杠
      /* background-color: #6739B6; */
      width: 50rpx;
      font-size: 30rpx;
      text-align: center;
   }
   .demo-list-right text {
      display: inline-block;
      width: 250rpx;
      font-size: 25rpx;
   }
   .text-num {
      display: inline-block;
      width: 90rpx;
   .color-red {
      width: auto;
      font-weight: 700;
      color: red;
   }
   
   .foot {
      width: 100%;
      height: 100rpx;
      line-height: 100rpx;
      background-color: #ffffff;
      background-color: #FFF;
      position: fixed;
      bottom: 0;
      border-top: 1rpx solid #d8d8d8;
      border-top: 1px solid #d8d8d8;
      border-radius: 20rpx 20rpx 0 0 ;
      z-index: 1;
   }
   .label-btn {
      width: 150rpx;
   }
   checkbox {
      /* transform:scale(0.7) */