<template>
|
<view>
|
<scroll-view>
|
<view class="demo-tab">
|
<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" />
|
</view>
|
<view class="demo-list-right">
|
<view><text style="width: 90rpx;">订单 | </text>{{item.orderNo}}<text>序号:{{index+1}} </text></view>
|
<view><text >商品编码:</text>{{item.matnr}}</view>
|
<view ><text>应入数量:</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>
|
</label>
|
</checkbox-group>
|
</view>
|
</scroll-view>
|
<view class="foot flex justify-around">
|
<label>
|
<checkbox :checked="check" @click="allChecked()">{{checkText}}</checkbox>
|
</label>
|
<label>
|
<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>
|
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
data: [],
|
check:false,
|
checkText:'全选',
|
checkedData:[],
|
}
|
},
|
mounted() {
|
const UIP = uni.getStorageSync('UIP');
|
this.baseIP = UIP;
|
const UPORT = uni.getStorageSync('UPORT');
|
this.basePORT = UPORT;
|
this.render()
|
},
|
methods: {
|
// 表格加载
|
render(param) {
|
let that = this;
|
if(param) {
|
that.needData['order_no'] = param;
|
that.getData();
|
} else {
|
that.getData();
|
}
|
},
|
getData() {
|
let that = this
|
uni.request({
|
url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + "/receiveDetl/list/auth",
|
header:{'token':uni.getStorageSync('token')},
|
data: that.needData,
|
success(res) {
|
var res = res.data
|
if (res.code === 200) {
|
that.data = res.data.records
|
}
|
}
|
})
|
},
|
checkbox: function (e) {
|
var items = this.data,
|
values = e.detail.value;
|
for (var i = 0, lenI = items.length; i < lenI; ++i) {
|
const item = items[i]
|
item.id = item.id + ''
|
if(values.indexOf(item.id) >= 0){
|
this.$set(item,'checked',true)
|
}else{
|
this.$set(item,'checked',false)
|
}
|
}
|
if (values.length == items.length) {
|
this.check = true
|
this.checkText = "取消全选"
|
} else {
|
this.check = false
|
this.checkText = "全选"
|
}
|
},
|
reChecked() { // 反选
|
var checkArr = []
|
for (var i = 0; i < this.data.length;i++) {
|
if (this.data[i].checked == true) {
|
this.$set(this.data[i],'checked',false)
|
}else{
|
this.$set(this.data[i],'checked',true)
|
}
|
if (this.data[i].checked == true) {
|
checkArr.push(this.data[i].checked)
|
}
|
}
|
if (checkArr.length == this.data.length) {
|
this.check = true
|
this.checkText = "取消全选"
|
} else {
|
this.check = false
|
this.checkText = "全选"
|
}
|
},
|
allChecked(e){ // 全选
|
if (this.check == true) {
|
for (var i = 0; i < this.data.length;i++) {
|
this.$set(this.data[i],'checked',false)
|
}
|
this.check = false
|
this.checkText = "全选"
|
} else {
|
for (var i = 0; i < this.data.length;i++) {
|
this.$set(this.data[i],'checked',true)
|
}
|
this.check = true
|
this.checkText = "取消全选"
|
}
|
|
},
|
shangjia() {
|
this.checkedData = []
|
for (var i = 0; i < this.data.length; i++) {
|
if (this.data[i].checked == true) {
|
this.checkedData.push(this.data[i])
|
}
|
}
|
console.log(this.checkedData)
|
}
|
}
|
}
|
</script>
|
|
<style>
|
.bg-false {
|
background-color: #FFFFFF;
|
}
|
.bg-true {
|
background-color: #ebebeb;
|
}
|
.demo-tab {
|
}
|
.demo-list {
|
|
border-bottom: 1px solid #d8d8d8;
|
height: 160rpx;
|
}
|
.demo-list:last-child {
|
margin-bottom: 99rpx;
|
}
|
label {
|
display: block;
|
}
|
.demo-list-left {
|
display: inline-block;
|
width: 100rpx;
|
text-align: center;
|
height: 150rpx;
|
line-height: 150rpx;
|
}
|
.demo-list-right {
|
display: inline-block;
|
width: 650rpx;
|
float: right;
|
}
|
|
.demo-list-right text {
|
display: inline-block;
|
width: 150rpx;
|
}
|
.text-num {
|
display: inline-block;
|
width: 90rpx;
|
}
|
|
.foot {
|
width: 100%;
|
height: 100rpx;
|
line-height: 100rpx;
|
background-color: #ffffff;
|
position: fixed;
|
bottom: 0;
|
border-top: 1rpx solid #d8d8d8;
|
}
|
checkbox {
|
/* transform:scale(0.7) */
|
}
|
|
</style>
|