| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- <template>
- <!-- 库存明细 -->
- <view class="main-wrap" :class="{ info: isInfo }">
- <uni-search-bar class="uni-search-bar" @confirm="search" v-model="searchValue" @input="search" cancelButton="none"
- placeholder="搜索关键字">
- </uni-search-bar>
- <scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="lower">
- <view class="order-list">
- <view class="item" v-for="(item, index) in listData" :key="index">
- <view class="title">
- <view class="s1">
- {{ item.onlyCode }}
- </view>
- </view>
- <view class="main">
- <view class="row">
- <view class="row-item">
- <text class="t1">批次号</text>
- <text class="t2">{{ item.batchNum }}</text>
- </view>
- <view class="row-item">
- <text class="t1">包装编码</text>
- <text class="t2">{{ item.num }}</text>
- </view>
- </view>
- <view class="row">
- <view class="row-item" v-if="!baseInfo.isUnpack">
- <text class="t1">最小包装单位</text>
- <text class="t2">{{ item.measurementUnit }}{{ item.unit }} /{{
- item.minPackUnit
- }}</text>
- </view>
- <view class="row-item">
- <text class="t1">入库天数</text>
- <text class="t2">{{ item.day }}</text>
- </view>
- </view>
- <view class="row">
- <view class="row-item">
- <text class="t1">{{
- item.manufactureTime ? '生产日期' : '采购日期'
- }}</text>
- <text class="t2">{{
- item.manufactureTime || item.procurementTime
- }}</text>
- </view>
- </view>
- <view class="row">
- <view class="row-item">
- <text class="t1">过期时间</text>
- <text class="t2">{{ item.expirationTime }}</text>
- </view>
- </view>
- <view class="row">
- <view class="row-item">
- <text class="t1">货位</text>
- <text class="t2">{{
- `${item.warehouseName}-${item.areaName}-${item.shelfCode}-${item.cargoSpaceCode}`
- }}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- <u-loadmore :status="status" style="margin-top: 20rpx" />
- </scroll-view>
- </view>
- </template>
- <script>
- let [page, size, isEnd] = [1, 20, true]
- import {
- post,
- get
- } from '@/utils/api.js'
- export default {
- props: ['batchNum', 'inventoryCode', 'isInfo', 'baseInfo'],
- data() {
- return {
- listData: [],
- status: 'loading',
- searchValue: ''
- }
- },
- created() {
- this.getData()
- },
- methods: {
- sortChange(type, e) {
- let order = e.order
- this.listData.sort((a, b) => {
- switch (order) {
- // 下降
- case 'descending':
- return a[type] - b[type]
- break
- // 上降
- case 'ascending':
- return b[type] - a[type]
- break
- // 正常
- case null:
- break
- default:
- break
- }
- })
- },
- // 触底
- lower() {
- console.log('lower')
- if (isEnd) {
- return
- }
- this.getMoreLists()
- },
- getData() {
- let par = {
- page,
- size,
- batchNum: this.batchNum,
- inventoryCode: this.inventoryCode
- }
- if (this.searchValue !== '') {
- par.key = this.searchValue
- }
- par = this.URLSearchParams(par)
- get(this.apiUrl + '/InventoryBook/select/inventoryDetails?' + par).then(
- res => {
- if (res.success) {
- this.listData = [...this.listData, ...res.data.records]
- let pages = res.data.pages
- console.log('lower', page < page)
- if (page < pages) {
- isEnd = false
- } else {
- isEnd = true
- this.status = 'nomore'
- }
- }
- }
- )
- },
- getMoreLists() {
- page++
- this.getData()
- },
- search() {
- this.page = 1
- this.listData = []
- this.status = 'loading'
- this.getData()
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .main-wrap {
- height: calc(100% - 176rpx);
- &.info {
- height: calc(100% - 236rpx);
- }
- }
- .scroll-Y {
- height: calc(100vh - 112rpx);
- //height:100%;
- }
- .order-list {
- .item {
- background-color: #fff;
- margin-bottom: 30rpx;
- margin-bottom: 30rpx;
- .title {
- display: flex;
- padding: 20rpx;
- justify-content: space-between;
- align-items: center;
- border-bottom: 1px solid #dedede;
- .s1 {
- color: #333333;
- font-size: 28rpx;
- font-weight: bold;
- }
- .s2 {
- font-size: 28rpx;
- font-weight: bold;
- color: #333333;
- }
- }
- .main {
- padding: 0 30rpx;
- .row {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 20rpx 0;
- border-bottom: 1px dashed #dedede;
- .row-item {
- .t1 {
- font-weight: bold;
- font-size: 28rpx;
- color: #333333;
- margin-right: 20rpx;
- }
- .t2 {
- font-size: 28rpx;
- color: #333333;
- }
- }
- }
- .ckmx {
- color: #70b603;
- font-size: 28rpx;
- font-weight: bold;
- padding: 20rpx;
- display: flex;
- justify-content: flex-end;
- }
- }
- }
- }
- </style>
|