205 lines
4.8 KiB
Vue
Raw Permalink Normal View History

2025-04-09 18:55:14 +08:00
<template>
<view class="app status-bar-gap">
<view class="page">
2025-04-29 13:26:19 +08:00
<l-header :title="t('home.llyz')" sticky></l-header>
2025-06-03 02:55:34 +08:00
<architecture ref="architectureRef" :dataType="t('home.llyz')" :placeholder="t('verify.grn')"
@scanConfirm="scanConfirmFun" @inputConfirm="changeFun" />
2025-04-09 18:55:14 +08:00
<view class="receive-listBox" ref="listBoxRef">
2025-06-03 02:55:34 +08:00
<scroll-view id="scroll-box" class="scroll-box" scroll-y="true" :style="{'height':state.scrollHeight+'px'}"
@scrolltolower="fnScrollBottom()">
2025-04-09 18:55:14 +08:00
<view class="list-box-list" v-if="state.dataList.length > 0">
2025-04-29 13:26:19 +08:00
<view class="data-item" @click.stop="fnToUrl(item)" v-for="(item, index) in state.dataList" :key="index">
<view class="tit">{{ t('verify.grn') }}{{item.FBillNo}}</view>
2025-04-09 18:55:14 +08:00
<view class="line-p"></view>
2025-04-29 13:26:19 +08:00
<view class="b-font">{{ t('verify.date') }}{{item.FDateFormat}}</view>
2025-04-09 18:55:14 +08:00
</view>
</view>
2025-06-03 02:55:34 +08:00
<view v-if="state.dataList.length==0">
2025-04-09 18:55:14 +08:00
<up-empty mode="list"></up-empty>
</view>
</scroll-view>
</view>
</view>
</view>
</template>
<script lang="ts" setup>
import { reactive, nextTick, onMounted, ref } from 'vue';
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app'
import { useI18n } from 'vue-i18n'
import { parseTime } from '../../utils/tools.js';
import { checkList } from '../../common/request/api/api';
2025-06-03 02:55:34 +08:00
const architectureRef = ref()
2025-04-09 18:55:14 +08:00
const listBoxRef = ref(null)
const getI18n = useI18n()
const { t, locale } = getI18n
const state = reactive({
queryString: '',
dataList: [],
scrollHeight: 0,
page: {
pageIndex: 1,
pageSize: 200,
totalCount: 0
}
})
2025-04-29 13:26:19 +08:00
onShow(() => { })
2025-04-09 18:55:14 +08:00
onMounted(() => {
const query = uni.createSelectorQuery().in(this);
query.select(".receive-listBox").boundingClientRect((data) => {
state.scrollHeight = data.height
}).exec();
fnDataList()
})
2025-06-03 02:55:34 +08:00
const scanConfirmFun = (e : any) => {
state.queryString = e
state.page.pageIndex = 1
state.dataList = []
fnDataList()
architectureRef.value.closeFun()
}
2025-04-09 18:55:14 +08:00
const fnScrollBottom = () => {
2025-06-03 02:55:34 +08:00
console.log(state.page.pageIndex * state.page.pageSize, state.page.totalCount);
2025-04-09 18:55:14 +08:00
if (state.page.pageIndex * state.page.pageSize <= state.page.totalCount) {
debugger
2025-06-03 02:55:34 +08:00
state.page.pageIndex++;
2025-04-09 18:55:14 +08:00
uni.showLoading({ mask: true });
setTimeout(() => {
fnDataList();
}, 500);
}
}
const fnToUrl = (item : any) => {
2025-06-03 02:55:34 +08:00
toPages('/pages/verify/material', { id: item.FID, fBillNo: item.FBillNo })
2025-04-09 18:55:14 +08:00
}
const debounceTimer = ref()
const changeFun = (e : any) => {
if (debounceTimer.value !== null) clearTimeout(debounceTimer.value)
debounceTimer.value = setTimeout(() => {
state.queryString = e
state.page.pageIndex = 1
state.dataList = []
fnDataList()
2025-06-03 02:55:34 +08:00
})
2025-04-09 18:55:14 +08:00
}
const fnDataList = () => {
let param = {
queryString: state.queryString,
pageIndex: state.page.pageIndex,
pageSize: state.page.pageSize,
};
if (state.page.pageIndex == 1) {
uni.showLoading({ mask: true });
}
checkList(param).then(res => {
uni.hideLoading();
if (res.code == 200) {
let result = res.data;
let dataArray = result.list;
dataArray.forEach(p => {
p.FDateFormat = parseTime(p.FDate, '{y}-{m}-{d}');
});
if (state.page.pageIndex == 1) {
state.dataList = dataArray;
}
else {
state.dataList = state.dataList.concat(dataArray);
}
state.page.totalCount = result.total;
if (state.dataList.length == state.page.totalCount) {
// more_status.value = 'nomore';
}
}
});
}
const toPages = (url : string, data : any = {}) => {
uni.$u.route({
url: url,
params: data
})
}
</script>
<style lang="scss">
.app {
background-color: #F5F5F5;
.page {
padding: 18px 32rpx;
display: flex;
flex-direction: column;
height: 100%;
flex: 1;
.input-box {
background-color: white;
box-sizing: border-box;
padding: 0 16rpx;
border-radius: 24rpx;
margin: 0 0 32rpx 0;
.u-textarea {
padding: 0 !important;
font-size: 24rpx !important;
color: #999999 !important;
}
.input-item {
box-sizing: border-box;
padding: 16rpx 0;
color: #222222;
font-size: 28rpx;
font-weight: 400;
.item-title {
//font-weight: 500;
font-size: 32rpx;
color: #333333;
}
.item-text {
font-weight: 400;
font-size: 27rpx;
color: #999999;
}
}
}
.receive-listBox {
flex: 1;
2025-06-03 02:55:34 +08:00
.list-box-list {
2025-04-09 18:55:14 +08:00
width: 100%;
2025-06-03 02:55:34 +08:00
2025-04-09 18:55:14 +08:00
// margin: 20rpx auto;
2025-06-03 02:55:34 +08:00
.data-item {
2025-04-09 18:55:14 +08:00
border: 1px solid #efeaea;
border-radius: 20rpx;
2025-06-03 02:55:34 +08:00
box-shadow: 0rpx 15rpx 15rpx #efeaea;
2025-04-09 18:55:14 +08:00
padding: 20rpx 20rpx 0;
margin-bottom: 20rpx;
background-color: #ffffff;
2025-06-03 02:55:34 +08:00
.tit {
2025-04-09 18:55:14 +08:00
font-size: 30rpx;
font-weight: bold;
padding: 20rpx 0;
}
2025-06-03 02:55:34 +08:00
.line-p {
2025-04-09 18:55:14 +08:00
border: 1px solid #efeaea;
}
2025-06-03 02:55:34 +08:00
.b-font {
2025-04-09 18:55:14 +08:00
font-size: 25rpx;
padding: 20rpx 0;
}
}
}
}
}
}
</style>