hldy_app_mini/pages/procurement/addtory.vue

376 lines
8.3 KiB
Vue

<template>
<view class="all-bgc">
<view class="tablist">
<view class="lefts">
<view class="pddl">盘点单</view>
<view class="pdh">{{pddobj.pddNo}}</view>
<view class="nms">{{pddobj.pddStartBy}} | {{pddobj.pddStartTime?.substring(0,10).replace(/-/g, '.')}}
</view>
<view class="shypk">
{{pddobj.nuName}}
</view>
</view>
<view class="rith">
<view class="left-selecttype">
<view :class="selectType===index?`selecttype-target`: `selecttype`"
v-for="(item,index) in ['全部','盘盈','盘亏','已盘点','未盘点']" @click="changetype(index)">
{{ item }}
</view>
<view class="heng-blue" :style="{ left: `${selectType === 0 ? 11.5 : 10.6 + selectType * 19}%` }">
</view>
</view>
<view class="pdbt">{{pddobj.pddType_dictText}}</view>
<!-- <view class="pdbt">{{已完成}}</view> -->
</view>
</view>
<view class="list">
<toryitem :pddlist="pddlist" @scrolltolower="scrolltolower" :pddType="pddobj?.pddType" :status="status"
@tabitem="tabitem" @right="right"></toryitem>
</view>
<view class="submit" v-if="pddobj.pddType=='1'">
<view @click="pddzfshow = true">取消盘点</view>
<view @click="subitshowing">提交盘点单</view>
</view>
<errorshow :show="openerror" :font="errmsg" @close="openerror=false" />
<pddsub :show="subitshow" :pddobj="pddobj" @close="subitshow=false"></pddsub>
<tanchuang :show="pddzfshow" font="确定要作废盘点单吗" @back="pddzfshow=false;" @right="pddzf"> </tanchuang>
</view>
</template>
<script setup lang="ts">
import { ref, onMounted, onBeforeUnmount, computed, nextTick, watch, reactive } from 'vue';
import { onShow, onLoad, onHide, onPageScroll } from "@dcloudio/uni-app"
import { queryPddInfoList, editPddInfo, voidedPddMain } from './api/lunpan.js'
import toryitem from './common/toryitem.vue'
import pddsub from './common/pddsub.vue'
const leftscrolltop = ref(0)
const pddobj = ref({})
const openerror = ref(false)
const errmsg = ref('');
const subitshow = ref(false)
const pddzfshow = ref(false)
const selectType = ref(0)
const props = defineProps({
specialitem: {
type: Object
},
});
const changetype = (index : number) => {
if ((selectType.value == index) && index) {
return
}
leftscrolltop.value = 1
setTimeout(() => {
leftscrolltop.value = 0
}, 50)
selectType.value = index;
pageNo.value = 1;
pddlist.value = [];
uni.removeStorage({ key: 'valitem' })
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 => {
res.result.records.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 !== '');
}
})
pddlist.value.push(...res.result.records);
let s = Math.ceil(res.result.total / 3);
pddlist.value.forEach((item, i) => {
if (Math.ceil((i + 1) / 3) == s && s > 2) {
item.dczk = true;
}
})
status.value = (res.result.total == pddlist.value.length ? 'nomore' : 'loadmore');
})
}
const scrolltolower = () => {
if (status.value == 'loading' || status.value == 'nomore') { return }
status.value = 'loading'
pageNo.value++;
pandian()
}
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 !== '');
}
if (e.dczk == true) {
res.result.dczk = true;
}
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;
}
})
}
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;
}
})
}
onMounted(() => {
pddobj.value = props.specialitem
pandian()
})
</script>
<style scoped lang="less">
.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;
margin-right: 2vw;
}
.submit {
width: 100.5%;
height: 4vw;
margin-top: 0.5vw;
padding-right: 0.7vw;
display: flex;
justify-content: flex-end;
align-items: center;
background-color: #fff;
border-radius: 35rpx;
view {
display: flex;
justify-content: center;
align-items: center;
&:nth-child(1) {
width: 8.7vw;
height: 3.2vw;
background: #fff;
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: 91vw;
height: 53vw;
margin: 0vw auto 0;
overflow: hidden;
}
.tablist {
width: 91vw;
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: 3rpx;
left: 50%;
transform: translateX(-50%);
width: 30rpx;
height: 5rpx;
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;
padding: 0 15rpx;
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: #fff;
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;
}
}
}
.all-bgc {
width: 91vw;
height: 100vh;
padding: 0 1vw;
// background-color: red;
// padding-top: 2.5vh;
}
</style>