123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- <template>
- <view class="content">
- <view class="topbar" v-show="isIphone">
- </view>
- <view class="status_bar">
- <view class="left" @click="goBack"><u-icon name="arrow-left"></u-icon>返回</view>
- <span style="font-size: 36rpx;">批次列表</span>
- <view class="right"></view>
- </view>
- <scroll-view :style="{paddingBottom: '10px'}" scroll-y class="scroll-box mainCont"
- @scrolltolower="handleLoadMore" @scroll="scroll" :refresher-enabled="scroll_refresher_enabled"
- :refresher-triggered="triggered" :refresher-threshold="100" refresher-background="white"
- @refresherrefresh="onRefresh" @refresherrestore="onRestore">
- <view class="pcTop" v-show="tableList.length">{{ text }}<span style="float: right">{{ weight }}kg</span>
- </view>
- <view class="card" @click="goInfo(item.packageId)" v-for="(item, index) in tableList" :key="index">
- <view class="top">
- <view class="left">{{ item.packCode }}</view>
- </view>
- <view class="bottom">
- <view>科  室:{{ item.positionName }}<span
- style="float: right">{{ item.packWeight }}kg</span></view>
- <view>医废分类:{{ item.rubbishCategoryStr }}</view>
- <view>打 包 人:{{ item.createUserName }}<span
- style="float: right">{{ item.createTime }}</span></view>
- </view>
- </view>
- <view style="margin-top: 100px;text-align: center;" v-show="!tableList.length">暂无数据</view>
- </scroll-view>
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- const NET = require('@/utils/request')
- const API = require('@/config/api')
- export default {
- data() {
- return {
- triggered: false,
- isOver: false,
- tableList: [],
- pageIndex: 1,
- scroll_refresher_enabled: true,
- loading: false,
- id: "",
- isIphone: false,
- weight: "",
- text: "",
- }
- },
- onLoad(options) {
- uni.getSystemInfo({
- success: (res) => {
- console.log(res)
- if (res.model == 'iPhone') {
- this.isIphone = true;
- }
- },
- fail: (err) => {
- console.log(err)
- }
- })
- this.id = options.id
- this.text = options.text
- this.weight = options.weight
- this.onRefresh()
- },
- onReady() {
- if (this.isIphone) {
- document.getElementsByClassName('mainCont')[0].style.height = document.getElementsByClassName('mainCont')[
- 0].clientHeight - 45 + 'px'
- }
- },
- methods: {
- goBack() {
- uni.navigateBack({
- delta: 1
- });
- },
- getTableList() {
- if (this.loading || this.isOver) {
- return false;
- }
- this.loading = true;
- let postData = {
- pageIndex: this.pageIndex,
- pageSize: 10,
- batchId: this.id
- }
- NET.request(API.getPackageListByBatchId, postData, 'POST').then(res => {
- this.triggered = false;
- this.loading = false;
- if (res.data.records.length < 10) {
- this.isOver = true
- }
- for (let i in res.data.records) {
- this.tableList.push(res.data.records[i])
- }
- }).catch(error => {
- this.$refs.uToast.show({
- title: error.msg,
- type: 'warning',
- })
- })
- },
- scroll(e) {
- if (e.detail.scrollTop === 0) {
- this.scroll_refresher_enabled = true
- } else {
- this.scroll_refresher_enabled = false
- }
- },
- // 下拉刷新
- onRefresh() {
- this.triggered = true
- this.isOver = false
- this.pageIndex = 1
- this.tableList = []
- this.getTableList()
- },
- // 重置下拉刷新状态
- onRestore() {
- this.triggered = 'restore'
- this.triggered = false
- },
- //获取更多数据
- handleLoadMore() {
- if (this.isOver) {
- } else if (this.loading) {
- } else {
- this.pageIndex++;
- this.getTableList()
- }
- },
- goInfo(id) {
- uni.navigateTo({
- url: `/collection/infor2?id=${id}`
- });
- }
- }
- }
- </script>
- <style lang="scss">
- .mainCont {
- height: calc(100% - 80rpx);
- padding-bottom: 60px;
- overflow-y: scroll;
- }
- .pcTop {
- width: calc(100% - 20px);
- padding: 0 10px;
- height: 20px;
- line-height: 20px;
- margin: 0 auto;
- margin-top: 10px;
- margin-bottom: 10px;
- position: relative;
- &:after {
- content: '';
- position: absolute;
- height: 20px;
- top: 0;
- left: 0;
- width: 2px;
- background-color: #6aa0f7;
- }
- }
- .bottomButtons {
- box-shadow: 0px -5px 5px #d0cece;
- position: fixed;
- display: flex;
- justify-content: space-between;
- width: 100%;
- height: 40px;
- line-height: 40px;
- bottom: 0;
- left: 0;
- view {
- width: 50%;
- height: 40px;
- line-height: 40px;
- text-align: center;
- }
- }
- </style>
|