123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343 |
- <template>
- <view class="container">
- <u-navbar leftIconColor="#fff" titleStyle="color:#fff;fontSize:36rpx;" :autoBack="true" bgColor="#2C6FF3"
- :placeholder="true" title="库存查询"></u-navbar>
- <view class="content">
- <!-- <view class="radio-container">
- <u-tabs :list="typeList" @click="tabChange" lineColor="#2C6FF3" :scrollable="true"></u-tabs>
- </view> -->
- <!-- <view class="flex justify-end radio-container">
- <view class="flex-sub"></view>
- <view class="">
- <xbutton size="large">查询</xbutton>
- </view>
- </view> -->
- <view class="tab-list flex flex-wrap">
- <block v-for="(item,index) in typeList" :key="item.name">
- <view :class="[type==item.name?'tab-item tab-show':'tab-item']" @click="tabClick(item.name)">
- {{item.name}}
- </view>
- </block>
- </view>
- <view class="title">按<text style="color: #2C6FF3;">{{type}}</text>盘点<text style="color:red;font-size: 24rpx;">(左右滑动查看更多数据)</text></view>
- <view class="table card">
- <uni-table border stripe emptyText="暂无更多数据" v-if="type=='商品'">
- <!-- 表头行 -->
- <uni-tr>
- <uni-th align="left">商品名称</uni-th>
- <uni-th align="center">库存数量</uni-th>
- <uni-th align="center">缺货数量</uni-th>
- <uni-th align="center">库存容量</uni-th>
- <uni-th align="center">缺货占比</uni-th>
- </uni-tr>
- <!-- 表格数据行 -->
- <uni-tr v-for="(item,index) in listA" :key="item.goodsId">
- <uni-td>{{item.goodsName}}</uni-td>
- <uni-td align="center">{{item.stockSum}}</uni-td>
- <uni-td align="center">{{item.lackSum}}</uni-td>
- <uni-td align="center">{{item.capacitySum}}</uni-td>
- <uni-td align="center">{{item.percentText}}</uni-td>
- </uni-tr>
- </uni-table>
- <uni-table border stripe emptyText="暂无更多数据" v-if="type=='设备'">
- <!-- 表头行 -->
- <uni-tr>
- <uni-th align="left">设备名称</uni-th>
- <uni-th align="center">库存数量</uni-th>
- <uni-th align="center">缺货数量</uni-th>
- <uni-th align="center">库存容量</uni-th>
- <uni-th align="center">缺货占比</uni-th>
- </uni-tr>
- <!-- 表格数据行 -->
- <uni-tr v-for="(item,index) in listB" :key="item.deviceId">
- <uni-td>{{item.deviceName?item.deviceName:item.deviceId}}</uni-td>
- <uni-td align="center">{{item.stockSum}}</uni-td>
- <uni-td align="center">{{item.lackSum}}</uni-td>
- <uni-td align="center">{{item.capacitySum}}</uni-td>
- <uni-td align="center">{{item.percentText}}</uni-td>
- </uni-tr>
- </uni-table>
- <uni-table border stripe emptyText="暂无更多数据" v-if="type=='线路'">
- <!-- 表头行 -->
- <uni-tr>
- <uni-th align="left">线路名称</uni-th>
- <uni-th align="left">库存数量</uni-th>
- <uni-th align="left">缺货数量</uni-th>
- <uni-th align="left">库存容量</uni-th>
- </uni-tr>
- <!-- 表格数据行 -->
- <uni-tr v-for="(item,index) in listC" :key="item.placeLineId">
- <uni-td>{{item.placeLineName&&item.placeLineName!=null?item.placeLineName:item.placeLineId}}</uni-td>
- <uni-td>{{item.stockSum}}</uni-td>
- <uni-td>{{item.lackSum}}</uni-td>
- <uni-td>{{item.capacitySum}}</uni-td>
- </uni-tr>
- </uni-table>
- <uni-table border stripe emptyText="暂无更多数据" v-if="type=='设备+商品'">
- <!-- 表头行 -->
- <uni-tr>
- <uni-th align="left">设备名称</uni-th>
- <uni-th align="left">商品名称</uni-th>
- <uni-th align="left">库存数量</uni-th>
- <uni-th align="left">缺货数量</uni-th>
- <uni-th align="left">库存容量</uni-th>
- </uni-tr>
- <!-- 表格数据行 -->
- <uni-tr v-for="(item,index) in listD" :key="item.goodsId">
- <uni-td>{{item.deviceName?item.deviceName:item.deviceId}}</uni-td>
- <uni-td>{{item.goodsName}}</uni-td>
- <uni-td>{{item.stockSum}}</uni-td>
- <uni-td>{{item.lackSum}}</uni-td>
- <uni-td>{{item.capacitySum}}</uni-td>
- </uni-tr>
- </uni-table>
- <uni-table border stripe emptyText="暂无更多数据" v-if="type=='线路+商品'">
- <!-- 表头行 -->
- <uni-tr>
- <uni-th align="left">线路名称</uni-th>
- <uni-th align="left">商品名称</uni-th>
- <uni-th align="left">库存数量</uni-th>
- <uni-th align="left">缺货数量</uni-th>
- <uni-th align="left">库存容量</uni-th>
- </uni-tr>
- <!-- 表格数据行 -->
- <uni-tr v-for="(item,index) in listE" :key="item.goodsId">
- <uni-td>{{item.placeLineName&&item.placeLineName!=null?item.placeLineName:item.placeLineId}}</uni-td>
- <uni-td>{{item.goodsName}}</uni-td>
- <uni-td>{{item.stockSum}}</uni-td>
- <uni-td>{{item.lackSum}}</uni-td>
- <uni-td>{{item.capacitySum}}</uni-td>
- </uni-tr>
- </uni-table>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- stockByLineAndGoods, //按线路+商品分组
- stockByDeviceAndGoods, // 按设备+商品分组
- stockByDevice, //按设备分组
- stockByGoods, // 按商品分组
- stockByLine, //按线路分组
- } from '@/api/replenishment/replenishment.js'
- export default {
- data() {
- return {
- // 基本案列数据
- typeList: [{
- name: '商品'
- },
- {
- name: '设备'
- },
- // {
- // name: '线路'
- // }, {
- // name: '设备+商品'
- // }, {
- // name: '线路+商品'
- // }
- ],
- type: '商品',
- listA: [],
- listB: [],
- listC: [],
- listD: [],
- listE: [],
- }
- },
- onShow() {
- this.getData()
- },
- methods: {
- tabClick(name) {
- this.type = name;
- this.getData()
- },
- getData() {
- switch (this.type) {
- case '商品':
- this.getListA()
- break;
- case '设备':
- this.getListB()
- break;
- case '线路':
- this.getListC()
- break;
- case '设备+商品':
- this.getListD()
- break;
- case '线路+商品':
- this.getListE()
- break;
- default:
- break;
- }
- },
- //按商品分组
- getListA() {
- stockByGoods({
- orderBy:'',
- orderByKey:''
- }).then(res => {
- if (res.code == 200) {
- if (res.data && res.data.length > 0) {
- this.listA = res.data
- } else {
- this.listA = []
- }
- } else {
- this.listA = []
- }
- })
- },
- //按设备分组
- getListB() {
- stockByDevice({
- orderBy:'',
- orderByKey:''
- }).then(res => {
- if (res.code == 200) {
- if (res.data && res.data.length > 0) {
- this.listB = res.data
- } else {
- this.listB = []
- }
- } else {
- this.listB = []
- }
- })
- },
- //按线路分组
- getListC() {
- stockByLine().then(res => {
- if (res.code == 200) {
- if (res.data && res.data.length > 0) {
- this.listC = res.data
- } else {
- this.listC = []
- }
- } else {
- this.listC = []
- }
- })
- },
- //按设备+商品分组
- getListD() {
- stockByDeviceAndGoods().then(res => {
- if (res.code == 200) {
- if (res.data && res.data.length > 0) {
- this.listD = res.data
- } else {
- this.listD = []
- }
- } else {
- this.listD = []
- }
- })
- },
- //按线路+商品分组
- getListE() {
- stockByLineAndGoods().then(res => {
- if (res.code == 200) {
- if (res.data && res.data.length > 0) {
- this.listE = res.data
- this.isEmpty = false
- } else {
- this.listE = []
- this.isEmpty = false
- }
- } else {
- this.listE = []
- this.isEmpty = true
- }
- })
- },
- }
- }
- </script>
- <style scoped lang="scss">
- .container {
- min-height: 100vh;
- background-color: #fff;
- padding-bottom: 24rpx;
- // padding-top: 120rpx;
- .tab-list {
- width: 100%;
- background-color: #fff;
- padding: 12rpx;
- .tab-item {
- padding: 0 64rpx;
- height: 62rpx;
- background: #F7F7F7;
- border-radius: 10rpx;
- font-size: 28rpx;
- font-weight: 500;
- color: #777777;
- margin-right: 20rpx;
- line-height: 62rpx;
- margin-bottom: 14rpx;
- &.tab-show {
- background: #F4F8FF;
- color: #2C6FF3;
- }
- }
- }
- .title {
- font-size: 32rpx;
- line-height: 32rpx;
- font-weight: bold;
- padding: 12rpx 24rpx 12rpx 36rpx;
- margin-top: 24rpx;
- }
- .card {
- width: 724rpx;
- margin-left: 13rpx;
- margin-top: 28rpx;
- background-color: #fff;
- margin-top: 20rpx;
- box-shadow: 0px 0px 10rpx 0px rgba(174, 201, 255, 0.2);
- border-radius: 14rpx;
- }
- /deep/.uni-table-th {
- font-size: 30rpx;
- color: #555;
- }
- /deep/.uni-table-td {
- color: #555;
- }
- /deep/.uni-table-scroll {
- border: none;
- }
- /deep/.table--border {
- border-right: none;
- }
- }
- </style>
|