hldy_app_mini/pages/NursingNew/component/pleasetake/common/addwl.vue

377 lines
8.4 KiB
Vue
Raw Normal View History

2025-11-28 17:34:02 +08:00
<template>
<view>
<view class="kcyj">
<view class="kjlt">
请领物料
2025-12-11 17:30:09 +08:00
<view class="mhao" v-if="Material.length>0">
<view class="mhao-font">
{{Material.length}}
</view>
</view>
2025-11-28 17:34:02 +08:00
</view>
2025-12-11 10:09:33 +08:00
<scroll-view scroll-x="true" class="kcscrol guodu" @scroll="onScroll" scroll-with-animation
:scroll-left="scrollleft" :style="qb?'width:calc(100% - 21.8vw)':'width:calc(100% - 10vw)' ">
<view class="yjbox" v-for="(v,i) in Material" :key="i">
<image
:src="v.materialInfo?.materialImg?serverUrl+v.materialInfo?.materialImg:'/static/index/procurement/k.png'"
2025-11-28 17:34:02 +08:00
mode="aspectFill"></image>
2025-12-09 15:05:45 +08:00
<view>{{v.materialInfo?.materialName}}</view>
2025-12-02 15:59:32 +08:00
<text class="ytj" v-if="v.qlNum>=0">{{v.qlNum}}</text>
2025-12-03 14:15:33 +08:00
<view class="zhanwei" v-if="moredex==1" @click.stop="del(v)">
<view>-</view>
</view>
2025-11-28 17:34:02 +08:00
</view>
2025-12-11 17:30:09 +08:00
<view class="que" v-if="Material.length==0&&timeout">
<image src="/static/index/procurement/que.png" mode="aspectFill"></image>
<view>暂无数据</view>
</view>
<!-- <defaultr cont="暂无数据" v-if="Material.length==0&&timeout"
style="position: absolute;width: 10vw;height: 10vw;"></defaultr> -->
2025-11-28 17:34:02 +08:00
</scroll-view>
2025-12-11 10:09:33 +08:00
<view class="kjlt more guodu" :style="qb?'width:15vw':'' " @touchstart="ts" @touchmove="canmove"
v-if="Material.length>0">
2025-12-03 14:15:33 +08:00
<view @click="zksq" class="righ0">
2025-11-28 17:34:02 +08:00
{{!qb?'更多':'收起'}}
<image class="guodu" :style="qb?'transform: rotate(180deg);':''"
src="/static/index/procurement/zjt.png" mode="aspectFill"></image>
</view>
2025-12-05 16:13:49 +08:00
<view class="guodu" :class="qb?(moredex==1?'avt':''):'righ0'" @click="moredex = moredex==1?0:1; ">
2025-12-02 15:59:32 +08:00
批量移除
</view>
2025-12-03 14:15:33 +08:00
<view class="guodu" :class="qb?(moredex==2?'avt':''):'righ0'" @click="moredex=2; ">
2025-12-02 15:59:32 +08:00
清空列表
</view>
2025-12-03 14:15:33 +08:00
<view class="guodu" :class="qb?(moredex==3?'avt':''):'righ0'" @click="moredex=3;emit('submit')">
2025-12-02 15:59:32 +08:00
提交请领单
2025-11-28 17:34:02 +08:00
</view>
</view>
</view>
2025-12-03 14:15:33 +08:00
<tanchuang @back="moredex = 0" :show="moredex==2" font="确定将本次请领清单中的所有物料都移除吗?" @right="delall"></tanchuang>
2025-11-28 17:34:02 +08:00
</view>
</template>
<script setup lang="ts">
2025-12-11 10:09:33 +08:00
import { ref, onMounted, onBeforeUnmount, computed, nextTick, watch, reactive } from 'vue';
2025-12-02 16:30:29 +08:00
import defaultr from './default.vue'
2025-12-03 14:15:33 +08:00
import tanchuang from '../common/tanchuang.vue';
2025-11-28 17:34:02 +08:00
const props = defineProps({
2025-12-11 10:09:33 +08:00
Material: {
type: Array,
2025-11-28 17:34:02 +08:00
required: true,
}
});
2025-12-11 10:09:33 +08:00
const emit = defineEmits(['delall', 'del', 'submit'])
2025-12-02 13:44:01 +08:00
const serverUrl = ref(uni.getStorageSync('serverUrl') + '/sys/common/static/')
2025-12-02 15:59:32 +08:00
const qb = ref(false)
const moredex = ref(0)
2025-12-11 10:09:33 +08:00
watch(() => props.Material,
() => {
if (props.Material.length == 0) {
qb.value = false;
moredex.value = 0;
}
})
const delall = () => {
2025-12-03 14:15:33 +08:00
emit('delall');
2025-12-11 10:09:33 +08:00
setTimeout(() => {
2025-12-03 14:15:33 +08:00
moredex.value = 0;
qb.value = false;
2025-12-11 10:09:33 +08:00
}, 100)
2025-12-03 14:15:33 +08:00
}
2025-12-11 10:09:33 +08:00
const del = (v) => {
emit('del', v)
2025-12-03 14:15:33 +08:00
}
2025-12-11 10:09:33 +08:00
const zksq = () => {
if (props.Material.length == 0) {
2025-12-03 14:15:33 +08:00
uni.showToast({
2025-12-11 10:09:33 +08:00
icon: 'none',
title: '请添加请领物料!'
2025-12-03 14:15:33 +08:00
})
return
}
2025-12-11 10:09:33 +08:00
qb.value = !qb.value;
moredex.value = 0;
2025-12-03 14:15:33 +08:00
moveleft();
}
2025-12-02 16:58:09 +08:00
const startX = ref(0)
const ts = (e) => {
startX.value = e.touches[0].clientX
}
const savescrollleft = ref(0)
// 监听用户滚动
function onScroll(e : any) {
savescrollleft.value = e?.detail?.scrollLeft ?? 0
}
const scrollleft = ref(0)
const canmove = (e : any) => {
2025-12-11 10:09:33 +08:00
if (props.Material.length == 0) { return }
2025-12-02 16:58:09 +08:00
const moveX = e.touches[0].clientX
const diff = moveX - startX.value
// diff 为负值就是向左滑
if (diff < -60 && !qb.value) { // 👉 60px 阈值,随便改
qb.value = !qb.value;
moredex.value = 0;
// 这么写是解决这个组件的响应丢失的bug
scrollleft.value = savescrollleft.value + 125.99
setTimeout(() => {
scrollleft.value = savescrollleft.value + 126
}, 50)
}
if (diff > 60 && qb.value) { // 👉 60px 阈值,随便改
qb.value = !qb.value;
moredex.value = 0;
scrollleft.value = savescrollleft.value - 125.99
setTimeout(() => {
scrollleft.value = savescrollleft.value - 126
}, 50)
}
}
const moveleft = () => {
if (qb.value) {
scrollleft.value = savescrollleft.value + 125.99
setTimeout(() => {
scrollleft.value = savescrollleft.value + 126
}, 50)
} else {
scrollleft.value = savescrollleft.value - 125.99
setTimeout(() => {
scrollleft.value = savescrollleft.value - 126
}, 50)
}
}
2025-12-02 13:33:11 +08:00
const timeout = ref(false)
2025-12-11 10:09:33 +08:00
onMounted(() => {
setTimeout(() => {
2025-12-02 13:33:11 +08:00
timeout.value = true
2025-12-11 10:09:33 +08:00
}, 500)
2025-12-02 13:33:11 +08:00
})
2025-11-28 17:34:02 +08:00
</script>
<style scoped lang="less">
.kcyj {
width: 100%;
height: 10vw;
display: flex;
margin-top: 1vw;
position: relative;
.kjlt {
width: 3.2vw;
height: 10vw;
background: rgba(255, 255, 255, 0.5);
border-radius: 1.1vw;
writing-mode: vertical-rl;
align-items: center;
display: flex;
justify-content: center;
letter-spacing: 3px;
font-size: 1.4vw;
position: relative;
2025-12-02 15:59:32 +08:00
z-index: 10;
2025-12-11 10:09:33 +08:00
.mhao {
position: absolute;
2025-12-11 17:30:09 +08:00
top: -0.2vw;
2025-12-11 10:09:33 +08:00
/* 根据视觉需要微调 */
2025-12-11 17:30:09 +08:00
right: -0.2vw;
2025-12-11 10:09:33 +08:00
box-sizing: border-box;
width: 1.8vw;
height: 1.8vw;
border-radius: 50%;
2025-12-02 15:59:32 +08:00
border: 1px solid #FF4E4E;
color: #FF4E4E;
display: flex;
align-items: center;
2025-12-11 10:09:33 +08:00
justify-content: center;
background: transparent;
writing-mode: horizontal-tb;
overflow: hidden;
2025-12-11 17:30:09 +08:00
.mhao-font{
font-size: 25rpx;
letter-spacing: -0.05em; /* 负值 = 字符之间更近 */
}
2025-12-02 15:59:32 +08:00
}
2025-11-28 17:34:02 +08:00
}
.more {
margin-left: 0.6vw;
position: relative;
background: RGBA(239, 240, 244, 1);
.righ0 {
right: 0 !important;
}
view {
writing-mode: vertical-rl;
align-items: center;
display: flex;
justify-content: center;
letter-spacing: 3px;
width: 3.2vw;
height: 10vw;
position: absolute;
top: 0;
border-radius: 1.1vw;
font-size: 1.4vw;
color: #888888;
background: #fff;
&:nth-child(1) {
letter-spacing: 6px;
padding-top: 2vw;
z-index: 5;
image {
width: 1.6vw;
height: 1.6vw;
margin-top: 10px;
}
}
&:nth-child(2) {
2025-12-02 16:58:09 +08:00
right: 3.9vw;
2025-11-28 17:34:02 +08:00
z-index: 3;
}
&:nth-child(3) {
2025-12-02 16:58:09 +08:00
right: 7.7vw;
2025-11-28 17:34:02 +08:00
z-index: 2;
}
2025-12-11 10:09:33 +08:00
2025-12-02 16:30:29 +08:00
&:nth-child(4) {
2025-12-02 16:58:09 +08:00
right: 11.6vw;
2025-12-02 16:30:29 +08:00
z-index: 2;
}
2025-11-28 17:34:02 +08:00
}
.avt {
background: rgba(85, 166, 249, 1);
color: #FFFFFF;
}
}
2025-12-11 10:09:33 +08:00
2025-11-28 17:34:02 +08:00
.kcscrol {
2025-12-11 10:09:33 +08:00
width: calc(100% - 10vw);
2025-11-28 17:34:02 +08:00
height: 10vw;
white-space: nowrap;
margin-left: 0.6vw;
position: relative;
2025-12-02 15:59:32 +08:00
z-index: 9;
2025-11-28 17:34:02 +08:00
.yjbox {
display: inline-block;
2025-12-02 13:33:11 +08:00
width: 12vw;
2025-11-28 17:34:02 +08:00
height: 10vw;
background: rgba(255, 255, 255, 0.5);
border-radius: 1.1vw;
2025-12-02 15:59:32 +08:00
margin-right: 0.8vw;
2025-11-28 17:34:02 +08:00
position: relative;
2025-12-11 10:09:33 +08:00
.zhanwei {
2025-12-03 14:15:33 +08:00
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 200;
2025-12-11 10:09:33 +08:00
view {
2025-12-03 14:15:33 +08:00
position: absolute;
width: 2.2vw;
height: 2.2vw;
display: flex;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
border-radius: 50%;
border: 2px solid rgba(255, 78, 78, 1);
display: flex;
justify-content: center;
align-items: center;
font-size: 3vw;
color: rgba(255, 78, 78, 1);
}
}
2025-12-11 10:09:33 +08:00
2025-11-28 17:34:02 +08:00
.ytj {
2025-12-02 15:59:32 +08:00
min-width: 1.5vw;
2025-11-28 17:34:02 +08:00
height: 1.8vw;
background: #E3EEF7;
border-radius: 0.9vw;
border: 1px solid rgba(3, 133, 250, 0.34);
font-weight: 400;
font-size: 1.1vw;
color: #1083F8;
text-align: center;
line-height: 1.75vw;
position: absolute;
2025-12-11 10:09:33 +08:00
padding: 0 0.8vw;
2025-11-28 17:34:02 +08:00
top: 0.8vw;
right: 0.8vw;
}
image {
width: 7vw;
height: 7vw;
margin: 0.5vw auto 0.5vw;
display: block;
border-radius: 1vw;
}
>view {
width: 100%;
height: 1.4vw;
font-weight: 400;
font-size: 1.3vw;
color: #212327;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
padding: 0 1vw;
text-align: center;
}
}
}
}
2025-12-11 10:09:33 +08:00
2025-12-02 15:59:32 +08:00
.guodu {
transition: .4s;
-webkit-transform-style: preserve-3d;
-webkit-overflow-scrolling: touch;
}
2025-12-11 17:30:09 +08:00
.que{
width: 16vw;
height: 16vw;
position: fixed;
top: 0;
left: 0;
width: 82.2vw;
height: 10vw;
background: rgba(245, 246, 248, 1);
display: flex;
justify-content: center;
align-items: center;
border-radius: 20rpx;
image{
width: 12vw;
height: 12vw;
}
view{
width: 12vw;
text-align: center;
position: absolute;
bottom: 0.5vw;
left: 50%;
transform: translateX(-50%);
font-weight: 300;
font-size: 1.4vw;
color: #555555;
}
}
2025-11-28 17:34:02 +08:00
</style>