<template>
|
<view>
|
<view>
|
<uni-table border stripe type="selection" emptyText="没有更多数据" @selection-change="selectionChange">
|
<uni-tr>
|
<uni-th>商品编号</uni-th>
|
<uni-th>商品名称</uni-th>
|
<uni-th>规格</uni-th>
|
<uni-th>单价</uni-th>
|
<uni-th>修改时间</uni-th>
|
</uni-tr>
|
<uni-tr v-for="(item,index) in stockData" :key="index">
|
<uni-td>{{item.matnr}}</uni-td>
|
<uni-td>{{item.maktx}}</uni-td>
|
<uni-td>{{item.specs}}</uni-td>
|
<uni-td>{{item.price}}</uni-td>
|
<uni-td>{{item.updateTime$}}</uni-td>
|
</uni-tr>
|
</uni-table>
|
</view>
|
<view class="cu-bar foot input justify-center" style="height: 150rpx;">
|
<view style="width: 30%;">
|
<button class="cu-btn bg-yellow lg shadow-blur" style="width: 250rpx;color: #fff;" @click="getMat()">提取</button>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
baseIP: '',
|
basePORT: '',
|
stockData: [],
|
selectionData: [],
|
}
|
},
|
onLoad(option) {
|
this.baseIP = option.baseIP
|
this.basePORT = option.basePORT
|
this.getMatData()
|
},
|
methods: {
|
getMatData() {
|
let that = this
|
uni.request({
|
url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/list/auth',
|
header: {'token':uni.getStorageSync('token')},
|
success(res) {
|
var res = res.data
|
if (res.code === 200) {
|
that.stockData = res.data.records
|
}
|
}
|
})
|
},
|
// 多选
|
selectionChange(e) {
|
// 获取选中状态
|
this.selectedIndexs = e.detail.index
|
this.selectedIndexs.sort(function(a,b){
|
return a-b
|
});// 重新排序(升序)
|
},
|
getMat() {
|
let that = this
|
var index = this.selectedIndexs
|
// 获取当前页面栈
|
let pages = getCurrentPages()
|
// pages数组中的最后一个为当前页面,倒数第二个为上一个页面
|
let prevPage = pages[pages.length - 2]
|
for (var i = 0;i < index.length; i++) {
|
that.selectionData.push(that.stockData[index[i]])
|
}
|
prevPage.$vm.otherFun(that.selectionData)
|
uni.navigateBack()
|
}
|
}
|
}
|
</script>
|
|
<style>
|
</style>
|