hldy_app_mini/pages/procurement/retstock.vue

1012 lines
22 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="all-bgc guodu" :style="!transition?'opacity: 0':'opacity: 1'" style="transition: opacity 1s ease;">
<view class="serchs">
<view class="leftbtn">
<view class="ipt" @click="opendata=true">
<view class="more-time-select">
<view class="more-gray" v-show="!form.fqStartTime">
开始日期
</view>
<view class="more-black" v-show="form.fqStartTime">
{{ form.showstart }}
</view>
<view style="font-size: 32rpx;">
</view>
<view class="more-gray" v-show="!form.fqEndTime">
结束日期
</view>
<view class="more-black" v-show="form.fqEndTime">
{{ form.showend }}
</view>
</view>
</view>
<view @click="opendata=true" class="scr">
<image src="/static/index/procurement/sh.png" mode="aspectFill" class="sh"></image>
检索
</view>
<view class="scr" @click="chongzhi">
<image src="/static/index/requestform/chongzhi.png" mode="aspectFill"></image>
<view>
重置
</view>
</view>
</view>
<!-- <view class="rightbtn">
<view class="back" @click="uni.navigateBack()">
<image src="/static/index/procurement/bk.png" mode="aspectFill"></image>
返回
</view>
</view> -->
</view>
<view class="t-box">
<view class="leftscr">
<scroll-view scroll-y="true" class="leftscrol" :scroll-top="cardtop" scroll-with-animation
@scrolltolower="plsbuytolower">
<view class="card" v-for="(v,i) in tharrlist" :key="i" :class="i==cardindex?'act':''"
@click="cardcon(v,i)">
<view class="rad" v-if="v.izRead=='N'"></view>
<view class="hli">
<view class="lig">
<image src="/static/index/procurement/gys.png" mode="aspectFill"></image>
{{v.nuName}}
</view>
<view class="rig">
<image src="/static/index/procurement/jx.png" mode="aspectFill"></image>
<text>{{v.statusText}}</text>
</view>
</view>
<view class="cont">
<view class="conle">
<image :src=" '/static/index/procurement/k.png'" mode="aspectFill" />
<text>退货</text>
</view>
<view class="ritcon" style="margin-top: 1.5vw;">
<view class="rq">
退货日期:<text>{{v.fqTime?.replace(/-/g, '.').substring(0, 10)}}</text>
</view>
<view class="rq">
申请人:{{v.fqrName}}
</view>
<!-- <view class="fwjd" v-if="v.status==0">
<view class="jx" @click="start(v,i)">开始服务</view>
<view>服务结束</view>
</view>
<view class="fwjd" v-if="v.status==1">
<view>开始服务</view>
<view class="jx">服务中</view>
</view>
<view class="fwjd" v-if="v.status==2">
<view>开始服务</view>
<view class="jx" @click="end(v,i)">服务结束</view>
</view>
<view class="fwjd" v-if="v.status==3">
<view>开始服务</view>
<view>服务结束</view>
</view> -->
</view>
</view>
</view>
<defaultr cont="暂无数据" v-if="tharrlist.length==0 "
style="position: absolute;width: 10vw;height: 10vw;"></defaultr>
<view style="height:3vw;width: 100%;display: flex;align-items: center;justify-content: center;">
<u-loadmore :status="status" :loadText="{nomore:'暂无更多数据'}" v-if="tharrlist.length>4" />
</view>
</scroll-view>
</view>
<view class="rightscr">
<view class="thwl">
<thwl :Material="addMaterial" @delall="delall" @del="adddel" @submit="submit"
:status="tharrlist[cardindex]?.status"></thwl>
<!-- -->
</view>
<view class="carditem">
<thitem :InvoicingList="cardarr" :status="tharrlist[cardindex]?.status" @comfig="comfig"></thitem>
</view>
</view>
</view>
<tanchuang @back="tanshow = false" :show="tanshow" font="确定将该物料从本次退货清单中移除吗?" @right="del"></tanchuang>
<submits :show="subshow" :list="addMaterial" @fill="subshow = false" :thdt="tharrlist[cardindex]"
@config="tijiao"></submits>
<view class="thdfed" @click="uni.navigateTo({ url:'/pages/procurement/authorization' })" v-if="carnum>0">
<image src="/static/index/procurement/thd.png" mode="aspectFill"></image>
<!-- <text v-if="carnum>0">{{carnum>99?'99+':carnum}}</text> -->
<view class="mhao" v-if="carnum>0">
<view class="mhao-font">
{{carnum}}
</view>
</view>
</view>
<!-- 日期 -->
<view class="calendar-father" v-show="opendata" v-if="xiaohui">
<calendar @datachange="dateget" />
</view>
<view v-show="opendata" class="mengban" :style="opendata ?{background:`transparent`}:{}"
@click="opendata=false;">
</view>
<errorshow :show="openmessage" :font="errormessage" @close="openmessage=false" />
<view class="fixed-card" :style="openleft?{}:{right:`-34vw`}" v-if="tharrlist[cardindex]?.orderIzFinish=='N'&&qcobj">
<view class="fixed-card-left">
<image class="card-left-img" :src="serverUrl+(qcobj?.netPreviewFileSmall?qcobj?.netPreviewFileSmall:qcobj?.netPreviewFile)" />
<view class="">
{{qcobj.directiveName}}
</view>
</view>
<view>
<view class="big-time">
{{qcobj.startTime.substring(0, 10)}} - {{qcobj.endTime.substring(0, 10)}}
</view>
<view class="icon-people">
<image class="people-img" src="/static/index/newindex/leftmenu/iconleft.png" />
{{qcobj.optTypeName}}
<image style="margin-left: 1vw;" class="people-img"
src="/static/index/newindex/leftmenu/iconright.png" />
{{qcobj.employeeName}}
</view>
<view style="color: #555555;">
业务单号:{{qcobj.orderNo}}
</view>
<view class="icon-button">
<view class="" :class="qcobj.izStart=='N'?'button-right':'button-left'" @click="start()">
开始服务
</view>
<view :class="(qcobj.izFinish=='N'&&qcobj.izStart=='Y')?'button-right':'button-left'" @click="end()">
结束服务
</view>
</view>
</view>
<view class="left-open" @click="openleft = !openleft">
<image :style="openleft?{}:{transform: `rotate(180deg)`}" class="open-img"
src="/static/index/newindex/leftmenu/openleft.png" />
</view>
</view>
<severcard></severcard>
</view>
</template>
<script setup lang="ts">
import { ref, onMounted, reactive, onBeforeUnmount, computed, nextTick, defineComponent,watch } from 'vue';
import { onShow, onLoad, onHide, onPageScroll } from "@dcloudio/uni-app"
import { thdList, transRead, thdNuMaterialList, addThc, thcList, removeWl, removeAll, submitThd, startServe, finishServe,queryOrderList,startDirectiveServe,finishDirectiveServe } from './api/lunpan.js'
import thwl from './common/thwl.vue'
import thitem from './common/thitem.vue'
import tanchuang from './components/tanchuang.vue'
import submits from './common/submits.vue'
import calendar from '@/component/public/calendar.vue'
import defaultr from './components/default.vue'
const openleft = ref(true)
const props = defineProps({
isShow: { type: Boolean }
});
const transition = ref(false);
watch(
() => props.isShow,
(newVal, oldVal) => {
// 当旧值为false新值为true时延迟0.2秒调用方法
if (!oldVal && newVal) {
transition.value = false;
setTimeout(() => {
transition.value = true;
}, 50)
} else {
transition.value = false;
}
}
)
const serverUrl = ref(uni.getStorageSync('serverUrl') + '/sys/common/static/')
const opendata = ref(false);
const form = reactive({
pageNo: 1,
pageSize: 10,
searchContent: '',
fqStartTime: "",
fqEndTime: "",
showstart:"",
showend:""
})
const tanshow = ref(false)
const subshow = ref(false)
const carnum = ref(0)
onMounted(() => {
thlist()
transition.value = false;
setTimeout(() => {
transition.value = true;
}, 50)
})
onShow(() => {
ritbot();
})
const ritbot = () => {
let forms = {
pageNo: 1,
pageSize: 10,
status: 3,
searchContent: ''
}
thdList(forms).then(res => {
carnum.value = res.result.total;
})
}
const submit = () => {
cardcon(tharrlist.value[cardindex.value], cardindex.value);
nextTick(() => {
subshow.value = true;
})
}
const errormessage = ref("");
const openmessage = ref(false)
const tijiao = () => {
submitThd({ id: tharrlist.value[cardindex.value].id }).then(res => {
console.log("入库退货单",res)
if (res.success) {
subshow.value = false;
th(tharrlist.value[cardindex.value], cardindex.value)
setTimeout(() => {
cardcon(tharrlist.value[cardindex.value], cardindex.value);
}, 200)
} else {
errormessage.value = res.message;
openmessage.value = true
}
})
}
const th = (v, i) => {
let obj = { refreshDataKey: v.id }
thdList(obj).then(res => {
tharrlist.value[i] = res.result.records[0];
ritbot();
})
}
const start = () => {
startDirectiveServe({ id: qcobj.value.id }).then(res => {
if (res.success) {
qcobj.value.izStart = 'Y';
// th(tharrlist.value[cardindex.value],cardindex.value);
qCareList(tharrlist.value[cardindex.value])
} else {
uni.showToast({
icon: 'none',
title: res.message
})
}
})
}
const end = () => {
finishDirectiveServe({ id: qcobj.value.id }).then(res => {
if (res.success) {
qcobj.value.izFinish = 'Y';
qCareList(tharrlist.value[cardindex.value])
} else {
uni.showToast({
icon: 'none',
title: res.message
})
}
})
}
const status = ref('loadmore')
const plsbuytolower = () => {
if (status.value == 'loading' || status.value == 'nomore') { return }
status.value = 'loading';
form.pageNo++;
thlist();
}
const tharrlist = ref([])
const thlist = () => {
thdList(form).then(res => {
tharrlist.value.push(...res.result.records);
console.log("red", res.result.records)
status.value = res.result.total == tharrlist.value.length ? 'nomore' : 'loadmore';
if (form.pageNo == 1 && tharrlist.value.length>0) {
cardcon(tharrlist.value[cardindex.value], cardindex.value);
// 取消红点
cardindex.value = cardindex.value;
cardtop.value = Math.floor(cardindex.value - 1) * 154;
console.log(tharrlist.value[cardindex.value])
wuliao();
thdNuMaterialList({ nuId: tharrlist.value[cardindex.value].nuId, id: tharrlist.value[cardindex.value].id }).then(res => {
console.log(res)
cardarr.value = res.result
})
}
if(tharrlist.value.length==0){
cardarr.value = [];
}
})
}
const cardindex = ref(0);
const cardtop = ref(0);
const cardarr = ref([])
const cardcon = (v, i) => {
cardindex.value = i;
cardtop.value = Math.floor(i - 1) * 154;
console.log(v)
wuliao();
qCareList(v)
thdNuMaterialList({ nuId: v.nuId, id: v.id }).then(res => {
console.log({ nuId: v.nuId, id: v.id })
cardarr.value = res.result
})
if (v.izRead == 'N') {
transReads(v, i)
}
}
const qcobj = ref({})
const qCareList = (v)=>{
console.log({id:v.orderId})
queryOrderList({id:v.orderId}).then(res=>{
qcobj.value = res.result;
console.log(res)
if(qcobj.value.izStart == 'N'&&qcobj.value.izFinish == 'N'){
openleft.value = true
}
if(qcobj.value.izStart == 'Y'&&qcobj.value.izFinish == 'N'){
openleft.value = false
}
})
}
const addMaterial = ref([])
const transReads = (v, i) => {
transRead({ id: v.id })
v.izRead = 'Y'
}
const comfig = (e, v) => {
let obj = {
pkId: tharrlist.value[cardindex.value].id,
kfId: v.kfId,
wlId: v.materialInfo?.id,
thNum: e,
nuId: tharrlist.value[cardindex.value].nuId,
elderId: tharrlist.value[cardindex.value].elderId
}
console.log(obj)
addThc(obj).then(res => {
console.log(res)
if (res.success) {
uni.showToast({
icon: 'success',
title: '提交成功'
})
setTimeout(() => {
th(tharrlist.value[cardindex.value], cardindex.value);
cardcon(tharrlist.value[cardindex.value], cardindex.value);
}, 800)
} else {
uni.showToast({
icon: 'none',
title: res.result.message ? res.result.message : res.message
})
}
})
}
const wuliao = () => {
let obj = {
pkId: tharrlist.value[cardindex.value].id
}
thcList(obj).then(res => {
addMaterial.value = res.result
})
}
const delall = () => {
let obj = { pkId: tharrlist.value[cardindex.value].id }
removeAll(obj).then(res => {
if (res.success) {
cardcon(tharrlist.value[cardindex.value], cardindex.value);
} else {
uni.showToast({
icon: 'none',
title: res.message
})
}
})
}
const objtake = ref({})
const adddel = (e) => {
objtake.value = e;
tanshow.value = true;
}
const del = () => {
let obj = {
pkId: tharrlist.value[cardindex.value].id,
wlId: objtake.value.materialInfo?.id
}
removeWl(obj).then(res => {
if (res.success) {
cardcon(tharrlist.value[cardindex.value], cardindex.value);
tanshow.value = false;
} else {
uni.showToast({
icon: 'none',
title: res.message
})
}
})
}
type datetype = {
start : string,
end : string
}
// 销毁日历
const xiaohui = ref(true);
const chongzhi = () => {
xiaohui.value = false;
setTimeout(() => {
xiaohui.value = true;
}, 300)
form.showstart = ""
form.showend = ""
form.fqStartTime = "";
form.fqEndTime = "";
form.pageNo = 1;
tharrlist.value = [];
thlist()
}
const dateget = (res : datetype) => {
console.log("res", res)
form.showstart = res.start.replace(/-/g, '.')
form.showend = res.end.replace(/-/g, '.')
form.fqStartTime = res.start.replace(/-/g, '.') + ` 00:00:00`;
form.fqEndTime = res.end.replace(/-/g, '.') + ` 00:00:00`;
form.pageNo = 1;
tharrlist.value = [];
console.log("0000",form)
thlist()
}
</script>
<style scoped lang="less">
.left-open {
position: absolute;
left: -1.5vw;
top: 50%;
transform: translateY(-50%);
width: 3vw;
height: 5vw;
border: 1rpx solid #B8C4DA;
background-color: #F2F7FD;
z-index: 999;
border-radius: 3vw;
display: flex;
justify-content: center;
align-items: center;
transition: all 0.5s ease;
.open-img {
width: 3vw;
height: 3vw;
}
}
.fixed-card {
position: fixed;
right: 1vw;
top: 2vh;
width: 35vw;
height: 28vh;
background-color: rgba(239, 246, 255, 0.95);
border-radius: 1.5vw;
border: 1rpx solid #638DFF;
box-shadow: 0 2rpx 6rpx #A0B9FF;
display: flex;
align-items: center;
transition: all 0.5s ease;
z-index: 999;
.fixed-card-left {
display: flex;
flex-direction: column;
align-items: center;
.card-left-img {
width: 12vw;
height: 8vw;
}
}
.big-time {
font-weight: 600;
font-size: 1.8vw;
}
.icon-people {
display: flex;
margin: 0.3vw 0;
color: #555555;
.people-img {
width: 1.5vw;
height: 1.5vw;
margin-right: 0.3vw;
margin-top: 0.1vw;
}
}
.icon-button {
display: flex;
margin-top: 1vw;
font-size: 1.5vw;
.button-left {
width: 8.5vw;
height: 3.3vw;
background-color: #fff;
display: flex;
justify-content: center;
align-items: center;
border-radius: 1.2vw;
border: 1rpx solid #C7D2E4;
margin:0 1vw;
color: #333333;
}
.button-right {
width: 8.5vw;
height: 3.3vw;
background-color: #fff;
display: flex;
justify-content: center;
align-items: center;
border-radius: 1.2vw;
border: 1rpx solid #5AAEFF;
color: #249BFA;
margin:0 1vw;
background: linear-gradient(to bottom, #fff, #D1EAFF);
}
}
}
.thdfed {
width: 4.9vw;
height: 4.9vw;
background: rgba(255, 255, 255, 0.86);
border-radius: 50%;
border: 1px solid #D9DADC;
display: flex;
justify-content: center;
align-items: center;
position: fixed;
right: 1vw;
bottom: 4.3vw;
text {
min-width: 1.8vw;
height: 1.8vw;
border-radius: 0.8vw;
border: 2px solid #E81D1D;
display: flex;
align-items: center;
justify-content: center;
padding: 0 0.5vw;
font-weight: 400;
font-size: 1.3vw;
color: #E81D1D;
position: absolute;
top: -0.8vw;
right: -0.8vw;
}
image {
width: 3.3vw;
height: 3.3vw;
}
}
.carditem {
width: 100%;
}
.thwl {
width: 100%;
height: 11vw;
}
.leftscrol {
width: 100%;
height: 100%;
.act {
border: 2px solid #0385FA !important;
background: rgba(255, 255, 255, 1) !important;
}
.card {
width: 30vw;
height: 13.6vw;
background: rgba(255, 255, 255, 0.6);
border-radius: 1.6vw;
padding: 1vw 1.4vw;
border: 2px solid rgba(255, 255, 255, 0.01);
margin-bottom: 0.8vw;
position: relative;
.rad {
width: 1.2vw;
height: 1.2vw;
border-radius: 50%;
position: absolute;
right: -0.3vw;
top: -0.5%;
background: rgba(255, 87, 87, 1);
}
.cont {
width: 100%;
height: 10vw;
display: flex;
justify-content: space-between;
.ritcon {
width: 19vw;
height: 100%;
.fwjd {
width: 100%;
display: flex;
justify-content: space-between;
view {
width: 8.1vw;
height: 3vw;
background: #EFF2F8;
border-radius: 1.2vw;
display: flex;
justify-content: center;
align-items: center;
border-radius: 1px solid #EFF2F8;
font-weight: 400;
font-size: 1.3vw;
color: #B6B8BA;
}
.jx {
background: linear-gradient(0deg, #F3FAFF, #E4F3FF, #CBE8FF);
color: #249BFA;
border: 1px solid #A8D4FF;
}
}
.rq {
font-weight: 400;
font-size: 1.3vw;
color: #888888;
margin-bottom: 1vw;
text {
font-size: 1.8vw;
font-weight: bolder;
color: rgba(85, 85, 85, 1);
}
}
}
.conle {
width: 10vw;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
image {
width: 6.3vw;
height: 6.3vw;
}
view {
font-weight: bold;
font-size: 1.4vw;
color: #555555;
margin-top: 1vw;
}
}
}
.hli {
width: 100%;
height: 2vw;
display: flex;
justify-content: space-between;
align-items: center;
.rig {
width: 3.7vw;
height: 1.6vw;
position: relative;
display: flex;
justify-content: center;
align-items: center;
image {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 1;
}
text {
position: relative;
z-index: 2;
font-weight: 400;
font-size: 1vw;
color: #FFFFFF;
}
}
.lig {
font-weight: 400;
font-size: 1.2vw;
color: #666666;
display: flex;
justify-content: center;
align-items: center;
image {
width: 1.7vw;
height: 1.7vw;
margin-right: 0.4vw;
}
}
}
}
}
.t-box {
width: 100%;
height: calc(100vh - 8vw);
display: flex;
justify-content: space-between;
padding-right: 0.6vw;
margin-top: 1vw;
.rightscr {
width: 58vw;
height: 100%;
background: #F9F9F9;
border-radius: 1.6vw;
overflow: hidden;
}
.leftscr {
width: 30.4vw;
height: 100%;
}
}
.serchs {
width: 90vw;
height: 3.3vw;
border-radius: 1.6vw;
display: flex;
align-items: center;
margin: 0.7vw 0 0;
justify-content: space-between;
.leftbtn {
width: 64vw;
height: 3.3vw;
display: flex;
align-items: center;
}
.rightbtn {
width: 30vw;
height: 3.3vw;
display: flex;
align-items: center;
justify-content: flex-end;
view {
width: 7.3vw;
height: 3.3vw;
border: 1px solid #D9DADC;
background: rgba(255, 255, 255, 1);
border-radius: 1.65vw;
font-weight: 400;
font-size: 1.4vw;
color: rgba(85, 85, 85, 1);
display: flex;
justify-content: center;
align-items: center;
margin-left: 0.7vw;
color: #555555;
border: 1px solid #D9DADC;
image {
width: 1.5vw;
height: 1.3vw;
margin: 0 0.5vw 0 0;
}
}
}
.ipt {
display: flex;
align-items: center;
width: 22.2vw;
background: #E2E4E9;
border-radius: 1.65vw;
height: 3.3vw;
image {
width: 1.8vw;
height: 1.8vw;
margin: 0 0.5vw;
}
input {
width: 25vw;
height: 3.3vw;
font-size: 1.4vw;
padding-left: 1.6vw;
// z-index: -1;
}
}
.back {
width: 8vw;
height: 3.3vw;
border-radius: 1.6vw;
background: rgba(255, 255, 255, 1);
border-radius: 1.65vw;
font-weight: 400;
font-size: 1.4vw;
color: rgba(85, 85, 85, 1);
display: flex;
justify-content: center;
align-items: center;
margin-left: 0.6vw;
border: 1px solid #D9DADC;
image {
width: 1.5vw !important;
height: 1.5vw !important;
margin: 0 0.5vw 0 0;
}
}
.rightbtn>view:active,
.scr:active {
color: #1083F8;
background: linear-gradient(-45deg, rgba(223, 244, 252, 1), rgba(204, 228, 249, 0.43));
border: 1px solid #1083F8;
}
.scr {
border-radius: 1.65vw;
font-weight: 400;
font-size: 1.4vw;
display: flex;
justify-content: center;
align-items: center;
width: 7.3vw;
height: 3.3vw;
margin: 0 0 0 0.7vw;
background: rgba(255, 255, 255, 1);
border: 1px solid #D9DADC;
color: #555555;
image {
width: 1.5vw;
height: 1.3vw;
margin: 0 0.5vw 0 0;
}
}
}
.guodu {
transition: .4s;
-webkit-transform-style: preserve-3d;
-webkit-overflow-scrolling: touch;
}
.mhao {
position: absolute;
top: -0.2vw;
/* 根据视觉需要微调 */
right: -0.2vw;
box-sizing: border-box;
width: 1.8vw;
height: 1.8vw;
border-radius: 50%;
border: 1px solid #FF4E4E;
color: #FF4E4E;
display: flex;
align-items: center;
justify-content: center;
background: transparent;
writing-mode: horizontal-tb;
overflow: hidden;
.mhao-font {
font-size: 25rpx;
letter-spacing: -0.05em;
/* 负值 = 字符之间更近 */
}
}
.calendar-father {
position: fixed;
top: 130rpx;
left: 30rpx;
width: 700rpx;
height: 600rpx;
background-color: #fff;
z-index: 999;
}
.mengban {
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
z-index: 100;
background: RGBA(239, 240, 244, 0.55);
}
.more-time-select {
// margin-top: 30rpx;
width: 100%;
height: 3vh;
display: flex;
align-items: center;
background-color: #E5E6EB;
border-radius: 30rpx;
position: relative;
.more-gray {
color: #999999;
font-size: 30rpx;
width: 220rpx;
display: flex;
justify-content: center;
align-items: center;
}
.more-black {
font-size: 28rpx;
width: 220rpx;
display: flex;
justify-content: center;
align-items: center;
}
}
.shx {
width: 7vw;
height: 3.3vw;
background-color: #fff;
border-radius: 1.65vw;
border: 1px solid #D9DADC;
font-weight: 400;
font-size: 1.4vw;
display: flex;
justify-content: center;
align-items: center;
margin: 0 0 0 0.5vw;
color: #555555;
image {
width: 1.5vw;
height: 1.5vw;
margin: 0 0.2vw 0 0;
}
}
</style>