hldy_app_mini/pages/procurement/addtory.vue

381 lines
8.7 KiB
Vue
Raw Normal View History

2025-12-12 14:41:44 +08:00
<template>
<view class="all-bgc">
<view class="topcard">
<!-- <text>盘点单号101P20251012001</text> -->
</view>
<view class="tablist">
<view class="lefts">
<view class="pddl">盘点单</view>
2025-12-12 17:30:33 +08:00
<view class="pdh">{{pddobj.pddNo}}</view>
<view class="nms">{{pddobj.pddStartBy}} | {{pddobj.pddStartTime.substring(0,10)}}</view>
2025-12-12 14:41:44 +08:00
<view class="shypk">
2025-12-12 17:30:33 +08:00
{{pddobj.nuName}}
2025-12-12 14:41:44 +08:00
</view>
</view>
<view class="rith">
<view class="left-selecttype">
<view :class="selectType===index?`selecttype-target`: `selecttype`"
2025-12-12 17:30:33 +08:00
v-for="(item,index) in ['全部','盘盈','盘亏','已盘点','未盘点']" @click="changetype(index)">
2025-12-12 14:41:44 +08:00
{{ item }}
</view>
<view class="heng-blue" :style="{ left: `${selectType === 0 ? 11.5 : 10.6 + selectType * 19}%` }">
</view>
</view>
2025-12-12 17:30:33 +08:00
<view class="pdbt">{{pddobj.pddType_dictText}}</view>
<!-- <view class="pdbt">{{已完成}}</view> -->
2025-12-12 14:41:44 +08:00
</view>
2025-12-12 14:53:37 +08:00
2025-12-12 14:41:44 +08:00
</view>
<view class="list">
2025-12-15 17:13:43 +08:00
<toryitem :pddlist="pddlist" @scrolltolower="scrolltolower" :pddType="pddobj?.pddType" :status="status" @tabitem="tabitem" @right="right"></toryitem>
2025-12-12 14:41:44 +08:00
</view>
2025-12-15 17:13:43 +08:00
<view class="submit" v-if="pddobj.pddType=='1'">
2025-12-16 08:48:22 +08:00
<view @click="pddzfshow = true">取消盘点</view>
2025-12-15 17:13:43 +08:00
<view @click="subitshowing">提交盘点单</view>
2025-12-12 14:41:44 +08:00
</view>
2025-12-15 17:13:43 +08:00
<errorshow :show="openerror" :font="errmsg" @close="openerror=false" />
<pddsub :show="subitshow" :pddobj="pddobj" @close="subitshow=false"></pddsub>
2025-12-16 08:48:22 +08:00
<tanchuang :show="pddzfshow" font="确定要作废盘点单吗" @back="pddzfshow=false;" @right="pddzf"> </tanchuang>
2025-12-12 14:41:44 +08:00
</view>
</template>
<script setup lang="ts">
import { ref, onMounted, onBeforeUnmount, computed, nextTick, watch, reactive } from 'vue';
2025-12-15 17:13:43 +08:00
import { onShow, onLoad, onHide, onPageScroll} from "@dcloudio/uni-app"
2025-12-16 08:48:22 +08:00
import { queryPddInfoList,editPddInfo,voidedPddMain } from './api/lunpan.js'
2025-12-12 14:41:44 +08:00
import toryitem from './common/toryitem.vue'
2025-12-15 17:13:43 +08:00
import pddsub from './common/pddsub.vue'
2025-12-12 14:41:44 +08:00
const leftscrolltop = ref(0)
2025-12-12 17:30:33 +08:00
const pddobj = ref({})
2025-12-15 17:13:43 +08:00
const openerror = ref(false)
const errmsg = ref('');
const subitshow = ref(false)
2025-12-16 08:48:22 +08:00
const pddzfshow = ref(false)
2025-12-12 14:41:44 +08:00
const selectType = ref(0)
const changetype = (index : number) => {
if ((selectType.value == index) && index) {
return
}
leftscrolltop.value = 1
setTimeout(() => {
leftscrolltop.value = 0
}, 50)
2025-12-15 17:13:43 +08:00
selectType.value = index;
pageNo.value = 1;
pddlist.value = [];
pandian();
2025-12-12 17:30:33 +08:00
}
onLoad((e)=>{
pddobj.value = JSON.parse(e.pddobj)
pandian()
})
const pageNo = ref(1);
const status = ref('loadmore');
const pddlist = ref([]);
const pandian = ()=>{
let obj = {
pddId:pddobj.value.id,
paramType:selectType.value==0?'':selectType.value,
pageNo:pageNo.value,
pageSize:10
}
queryPddInfoList(obj).then(res=>{
pddlist.value.push(...res.result.records);
2025-12-15 17:13:43 +08:00
status.value = (res.result.total == pddlist.value.length ? 'nomore' : 'loadmore');
let s = Math.ceil(res.result.total / 3);
pddlist.value.forEach((item,i)=>{
item.picPatharr = [];
item.zk = false;
item.yczk=false;
item.bz=false;
item.pz=false;
if(item.picPath!=''&&item.picPath!=null){
item.picPatharr = item.picPath.split(",");
item.picPatharr = item.picPatharr.filter(item => item !== '');
}
if(Math.ceil((i + 1) / 3) == s && s>2){
item.dczk = true;
}
})
2025-12-12 17:30:33 +08:00
})
}
const scrolltolower = () =>{
if(status.value == 'loading' || status.value == 'nomore'){return}
status.value = 'loading'
pageNo.value++;
pandian()
2025-12-12 14:41:44 +08:00
}
2025-12-15 17:13:43 +08:00
const tabitem = (i,v) =>{
pddlist.value[i] = v;
}
const right = (e,i)=>{
let obj = {
id:e.id,
dqkcsl:e.dqkcsl,
pdsl:e.pdsl,
content:e.content,
picPath:e.picPath
}
editPddInfo(obj).then(res=>{
if(res.success){
res.result.zk = false;
res.result.yczk=false;
res.result.bz=false;
res.result.pz=false;
res.result.picPatharr = [];
if(res.result.picPath!=''&&res.result.picPath!=null){
res.result.picPatharr = res.result.picPath.split(",");
res.result.picPatharr = res.result.picPatharr.filter(item => item !== '');
}
2025-12-16 11:26:01 +08:00
if(e.dczk == true){
res.result.dczk = true;
}
2025-12-15 17:13:43 +08:00
pddlist.value[i] = res.result;
uni.removeStorage({ key: 'valitem'})
}else{
errmsg.value = res.message;
openerror.value = true;
}
})
}
const subitshowing = ()=>{
let obj = {
pddId:pddobj.value.id,
paramType:4,
pageNo:-1,
pageSize:10
}
queryPddInfoList(obj).then(res=>{
if(res.result.total == 0){
subitshow.value = true;
}else{
errmsg.value = '有未完成的盘点信息,不能提交盘点单';
openerror.value = true;
}
})
}
2025-12-16 08:48:22 +08:00
const pddzf = ()=>{
voidedPddMain({id:pddobj.value.id}).then(res=>{
if(res.success){
pddzfshow.value = true;
setTimeout(()=>{
uni.navigateBack()
},800)
}else{
errmsg.value = res.message;
openerror.value = true;
}
})
}
2025-12-12 14:41:44 +08:00
</script>
<style scoped lang="less">
2025-12-12 14:53:37 +08:00
.pdbt{
width: 7.1vw;
height: 3.2vw;
background: linear-gradient(0deg, #CAE0F9, #E9F4FF);
border-radius: 1.6vw;
border: 1px solid rgba(3,133,250,0.34);
font-weight: 400;
font-size: 1.4vw;
color: #1083F8;
margin-left: 0.7vw;
display: flex;
justify-content: center;
align-items: center;
}
2025-12-12 14:41:44 +08:00
.submit{
width: 100%;
height: 3.2vw;
margin-top: 0.4vw;
padding-right: 2vw;
display: flex;
justify-content: flex-end;
view{
display: flex;
justify-content: center;
align-items: center;
&:nth-child(1){
width: 8.7vw;
height: 3.2vw;
background: #F8F8F8;
border-radius: 1.6vw;
border: 1px solid #E5E5E5;
font-weight: 400;
font-size: 1.4vw;
color: #555555;
}
&:nth-child(2){
width: 10.2vw;
height: 3.2vw;
background: linear-gradient(0deg, #CAE0F9, #E9F4FF);
border-radius: 1.6vw;
border: 1px solid rgba(3,133,250,0.34);
font-weight: 400;
font-size: 1.4vw;
color: #1083F8;
margin-left: 0.7vw;
}
}
}
.list{
width: 100vw;
height: 50vw;
margin: 0.8vw auto 0;
padding:0 0 0 2vw;
overflow: hidden;
}
.tablist{
width: 100vw;
height: 3.3vw;
display: flex;
justify-content: space-between;
padding:0 2vw;
margin-top: -3.3vw;
.rith{
.left-selecttype {
width: 30vw;
height: 70rpx;
border-radius: 40rpx;
// background-color: #FFFFFF;
display: flex;
padding-right: 30rpx;
padding-left: 15rpx;
position: relative;
.heng-blue {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 25rpx;
height: 8rpx;
border-radius: 10rpx;
background-color: #1083F8;
transition: 0.3s all ease;
}
.selecttype {
width: 20%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
color: #999999;
font-size: 31rpx;
position: relative;
}
.selecttype-target {
width: 20%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
color: #222222;
font-size: 31rpx;
font-weight: 600;
position: relative;
}
}
}
.lefts{
height: 100%;
align-items: center;
.shypk{
width: 7.5vw;
height: 2.3vw;
background: #DFEFFF;
border-radius: 0.5vw;
border: 1px solid #C7D2E4;
font-weight: 400;
font-size: 1.2vw;
color: #1083F8;
display: flex;
justify-content: center;
align-items: center;
margin-left: 0.9vw;
}
.nms{
font-weight: 400;
font-size: 1.3vw;
color: #222222;
margin-left: 1.3vw;
}
.pdh{
font-weight: bold;
font-size: 1.8vw;
color: #222222;
margin-left: 0.7vw;
}
.pddl{
width: 5.7vw;
height: 2.2vw;
background: #DADADA;
border-radius: 0.5vw;
font-weight: 400;
font-size: 1.4vw;
color: #555555;
display: flex;
justify-content: center;
align-items: center;
}
}
>view{
width: 50%;
display: flex;
&:nth-child(2){
justify-content: flex-end;
}
}
}
.topcard{
width: 100vw;
height: 3.3vw;
position: relative;
display: flex;
justify-content: center;
align-items: center;
padding:0 2vw;
text{
font-weight: bold;
font-size: 1.8vw;
color: #222222;
}
view{
width: 7.3vw;
height: 3.3vw;
background: #FFFFFF;
position: absolute;
right: 2vw;
top: 0;
border-radius: 1.65vw;
border: 1px solid #D9DADC;
font-weight: 400;
font-size: 1.4vw;
color: #222;
display: flex;
justify-content: center;
align-items: center;
margin: 0 0 0 0.7vw;
color: #555555;
image {
width: 1.5vw;
height: 1.5vw;
margin: 0 0.2vw 0 0;
}
}
}
.all-bgc {
width: 100vw;
height: 100vh;
background-color: rgb(239, 240, 244);
padding-top: 4.5vh;
}
</style>