hldy_app_mini/pages/material/component/inventory.vue

1025 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>
<view class="cont guodu" :style="!transition?'opacity: 0':'opacity: 1'" >
<view class="topbox">
<view class="carditem guodu" >
<view class="cgsl">
<text>325</text>
<view>差额</view>
</view>
<view class="kcpdsl">
<view style="border-right: 1px solid #E6E6E6;">
<text>25</text>
<text>库存数量</text>
</view>
<view>
<text>--</text>
<text>盘点数量</text>
</view>
</view>
<view class="speitem guodu">
<view class="imghs">
<image style="border-radius: 1vw;"
:src=" '/static/index/procurement/k.png'"
mode="aspectFill">
</image>
</view>
<view class="cardp">
<view>复健用品</view>
<view>复健用品</view>
</view>
</view>
<view class="msitem guodu">
<view>
<view>纸尿裤-拉拉裤纸尿裤拉拉裤纸尿裤</view><text style="white-space: nowrap;"> ZHYP044</text>
</view>
<view style="margin-top: 1.6vw;">
<text style="white-space: nowrap;"> 规格型号: 800mm*680mm</text>
</view>
<view>
<text style="white-space: nowrap;"> 品牌型号品牌型号名称</text>
</view>
<view>
<text style="white-space: nowrap;"> 生产厂家吉林省捌零信创科技有限...</text>
</view>
<view>
<text style="white-space: nowrap;"> 长春市天林商贸有限公司...</text>
</view>
</view>
</view>
</view>
<view class="jisuansl">
<!-- <torytor></torytor> -->
<view class="tan guodu" >
<view class="tbox guodu" >
<!-- :tb="v.dqkcsl" :pz="pz" @pddjjnum="pddjjnum" :pdsl="v.pdsl" :idex="i" -->
<torytor :show="true" :pddType='pddType'></torytor>
<view class="bpq" >
<view class="bp b" @click="bz = !bz;pz = false">
<image src="/static/index/procurement/th.png" mode="aspectFill"></image>
备注
<!-- <text :class="{r:v?.pdType == 2&&v?.cesl>0,g:v.pdType == 1}" v-if="v?.content">1</text> -->
<text class="r">1</text>
</view>
<view class="bp p" @click="pz = !pz;bz = false">
<image src="/static/index/procurement/xj.png" mode="aspectFill"></image>
拍照
<!-- <text :class="{r:v?.pdType == 2&&v?.cesl>0,g:v.pdType == 1}"
v-if="v?.picPatharr?.length>0">{{v?.picPatharr?.length}}</text> -->
<text class="g">2</text>
</view>
<view class="qued" @click="config(v,i)" v-if="pddType=='1'">
确定
</view>
<view class="triangle-leftbz" v-if="bz">
<image src="/static/index/procurement/jb.png" mode="aspectFill"></image>
</view>
<view class="triangle-leftpz" v-if="pz">
<image src="/static/index/procurement/jb.png" mode="aspectFill"></image>
</view>
<view class="gray-bgc guodu" :class="bz?'':'itemhei0'">
<view class="textare" v-if="bz">
<!-- <textarea v-model="v?.content" placeholder="请输入备注" maxlength="200"
:disabled="pddType!='1'"></textarea> -->
<textarea placeholder="请输入备注" maxlength="200"
:disabled="false"></textarea>
</view>
<view class="submit" v-if="bz">
<view @click="bz = false">{{pddType=='1'?'取消':'关闭'}}</view>
<view @click="bz = false" v-if="pddType=='1'">确定</view>
</view>
</view>
<view class="gray-pgc guodu" :class="pz?'':'itemhei0'">
<view class="pztit" v-if="pz">拍照</view>
<scroll-view scroll-x class="scrollbgc">
<view class="zpj" v-if="pz">
<view class="zpk" v-for="(p,o) in 5" :key="o"
@click="previewImage(v,p,o)">
<image :src="serverUrl+p" mode="aspectFill"></image>
<view @click.stop="open=1;del(v,o)">
<image src="/static/index/keyimg/deletebutton.png" mode="aspectFill"
style="width: 75%;height: 70%;"></image>
</view>
</view>
<view class="clkpz" @click="uplod(v,i)" >
<image src="/static/index/procurement/xjpz.png" mode="aspectFill"></image>
<text>点击拍照上传 </text>
</view>
<defaultr cont="暂无图片"
style="position: absolute;width: 10vw;height: 10vw;"></defaultr>
</view>
</scroll-view>
<view class="submit" v-if="pz" style="height: 3.5vw;">
<view @click="pz = false">{{pddType=='1'?'取消':'关闭'}}</view>
<view @click="pz = false">确定</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref, onMounted, reactive, onBeforeUnmount, computed, nextTick, defineComponent, inject, watch } from 'vue';
import { onShow, onLoad, onHide, onPageScroll } from "@dcloudio/uni-app"
import torytor from './torytor.vue'
const transition = ref(false)
const bz = ref(false)
const pz = ref(false)
const pddType = ref('1')
const props = defineProps({
isShow: {
type: Boolean
},
});
watch(
() => props.isShow,
(newVal, oldVal) => {
if (!oldVal && newVal) {
transition.value = false;
setTimeout(() => {
transition.value = true;
}, 10)
} else {
transition.value = false;
}
}
)
const open = ref(0)
const scrolltop = ref(0)
const serverUrl = ref(uni.getStorageSync('serverUrl') + '/sys/common/static/')
const emit = defineEmits(['scrolltolower', 'tabitem', 'right'])
const valitem = ref({});
const valindex = ref(-1);
const havezk = ref(false)
// 点击锁
const secondlock = ref(false)
// 检测上一次点击
const savelastvalue = ref(false)
const zhankai = (v, i) => {
let s = Math.ceil((i + 1) / 3);
if (valindex.value != i && valindex.value > -1 && uni.getStorageSync('valitem') && props.pddType == '1') {
emit('tabitem', valindex.value, uni.getStorageSync('valitem'))
}
valindex.value = i;
scrolltop.value = top.value;
v.zk = !v.zk;
savelastvalue.value = v.zk
if(savelastvalue.value && v.zk){
secondlock.value = true;
}
havezk.value = v.zk
if (v.zk) {
if (props.pddType == '1') { uni.setStorageSync('valitem', v); }
setTimeout(() => {
v.yczk = v.zk;
}, 200)
} else {
v.yczk = v.zk;
v.bz = false;
v.pz = false;
}
// if (v.dczk == true) {
// } else {
// // nextTick(() => {
// // // scrolltop.value = (top.value > (s - 2) * 182) ? top.value : (s - 2) * 182;
// // // scrolltop.value = (Math.ceil(i / 2) -1) * 200;
// // })
// }
gb(i)
}
const gb = (i) => {
props.pddlist.forEach((item, k) => {
if (i != k) {
item.zk = false;
item.bz = false;
item.pz = false;
item.yczk = false;
}
})
}
const top = ref(0)
const scroll = (e) => {
// console.log(e.detail.scrollTop)
top.value = e.detail.scrollTop;
}
const pddjjnum = (e, i) => {
let ce = 0;
props.pddlist[i].pdsl = e;
ce = e - props.pddlist[i].dqkcsl;
props.pddlist[i].cesl = Math.abs(ce);
props.pddlist[i].pdType = ce == 0 ? '' : (ce > 0 ? 1 : 2)
}
const config = (e, i) => {
// console.log("点击成功了吗?")
if ((e.content == '' || e.content == null) && e.cesl != 0) {
uni.showToast({
icon: 'error',
title: "请填写备注!"
})
return
}
emit('right', e, i)
}
const scrolltolower = () => {
emit('scrolltolower')
}
// 上传
const albumlist = ref([])
const uplod = (v, i) => {
uni.chooseImage({
count: 1, //默认9
sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['camera'], //从相册选择
success: (e) => {
let ar = JSON.stringify(e.tempFilePaths)
uni.compressImage({
src: JSON.parse(ar)[0],
quality: 60,
success: res => {
sxdupld(res.tempFilePath, v)
// v.picPatharr.push(res.tempFilePath);
// console.log(v.picPatharr)
}
})
}
});
}
const sxdupld = (e, v) => {
let now = new Date();
let year = now.getFullYear();
let month = now.getMonth() + 1;
uni.uploadFile({
url: uni.getStorageSync('serverUrl') + '/sys/common/upload',
filePath: e,
name: 'file',
formData: {
biz: year + '/' + month + '/pddPic'
},
header: {
'X-Access-Token': uni.getStorageSync('token')
},
success: res => {
const data = JSON.parse(res.data);
console.log(v)
v.picPatharr.push(data.message);
shuzhi(v)
},
fail: () => {
uni.showToast({ title: '上传失败', icon: 'none' })
}
})
}
const previewImage = (arr, p, i) => {
let u = []
arr.picPatharr.forEach(e => {
u.push(serverUrl.value + e)
})
uni.previewImage({
current: i,
urls: u,
showmenu: false,
longPressActions: {
itemList: [],
}
})
}
const shuzhi = (v) => {
v.picPath = '';
v.picPatharr.forEach((e, i) => {
v.picPath += e + ','
})
}
const picv = ref({});
const pici = ref(0);
const del = (v, o) => {
picv.value = v;
pici.value = o;
}
const del1 = () => {
picv.value.picPatharr.splice(pici.value, 1);
open.value = 0
}
/** 只针对 UniApp 原生 App 的最简判断函数true = 上半false = 下半null = 无法判断) */
function isTopHalfApp(e) {
if (!e) return null;
// 原生 app 常见changedTouches 或 touches
const touch = (e.changedTouches && e.changedTouches[0]) || (e.touches && e.touches[0]) || null;
const y = touch
? (typeof touch.clientY === 'number' ? touch.clientY : (typeof touch.pageY === 'number' ? touch.pageY : null))
: (e.detail && typeof e.detail.y === 'number' ? e.detail.y : null);
let h = null;
try {
h = uni.getSystemInfoSync().windowHeight; // UniApp 原生 App 推荐使用
} catch (err) {
h = null;
}
if (y == null || !h) return null;
return y <= (h * 1 / 2);
}
const isbottom = ref(false);
const clicklock = ref(false)
/** 事件处理示例 */
function onTap(e) {
const top = isTopHalfApp(e);
if (top === null) {
// uni.showToast({ title: '无法判断坐标', icon: 'none' });
return;
}
if (havezk.value) {
// console.log("top", top, clicklock.value)
if (!clicklock.value || secondlock.value ) {
if (!top) {
isbottom.value = true
// console.log("开启了")
} else {
isbottom.value = false
}
clicklock.value = true;
secondlock.value = false;
}
// if (!top) {
// isbottom.value = true
// // console.log("开启了")
// } else {
// isbottom.value = false
// }
} else {
clicklock.value = false
}
// uni.showToast({ title: top ? '上半部分' : '下半部分', icon: 'none' });
}
</script>
<style lang="less" scoped>
.cont{
width: 50vw;
height: 43vw;
background: #FFFFFF;
border-radius: 1.6vw;
position: fixed;
z-index: 110;
top: 9.8vw;
right: 24.8vw;
.jisuansl{
width: 100%;
height: 24vw;
margin-top: 2vw;
}
.topbox{
width: 100%;
height: 22vw;
position: relative;
}
}
.guodu {
transition: .4s;
-webkit-transform-style: preserve-3d;
-webkit-overflow-scrolling: touch;
}
.itemhei0 {
height: 0vw !important;
z-index: 27 !important;
}
.carditem {
position: absolute;
top: 2.5vw;
left: 0;
height: 17.5vw;
width: 100%;
display: flex;
transition: transform 500ms cubic-bezier(.2, .8, .2, 1);
will-change: transform;
.kcpdsl{
width: 16.4vw;
height: 3vw;
display: flex;
position: absolute;
bottom: 0;
left: 16vw;
view{
width: 50%;
height: 3vw;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-around;
text{
&:nth-child(1){
font-weight: bold;
font-size: 1.7vw;
color: #555555;
}
&:nth-child(2){
font-size: 1.1vw;
color: #999999;
}
}
}
}
.cgsl{
position: absolute;
width: 5vw;
height:4.5vw;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
right: 2.6vw;
top: 0vw;
text{
font-weight: bold;
font-size: 1.7vw;
color: #222222;
font-style: normal;
text-transform: none;
margin: 0.6vw 0;
}
view{
font-size: 1vw;
color: #777777;
font-style: normal;
text-transform: none;
}
}
.cgdh{
position: absolute;
width: 25vw;
height: 3vw;
display: flex;
align-items: center;
top: -2vw;
left: 2.3vw;
text{
width: 1.5vw;
height: 1.5vw;
border-radius: 0.3vw;
font-weight: bold;
font-size: 1vw;
line-height: 1.5vw;
text-align: center;
display: block;
color: #fff;
margin-left: 1.2vw;
}
.s{
background: #FF5B5B;
}
.j{
background: #1083F8;
}
}
.zkf {
width: 7vw;
right: -7vw;
}
.add {
width: 4.5vw;
height: 100%;
position: absolute;
display: flex;
justify-content: center;
align-items: center;
top: 50%;
transform: translateY(-50%);
// top: 0.8vw;
right: 16vw;
// background-color: red;
>view {
width: 5.5vw;
height: 2.2vw;
background: #fff;
border-radius: 0.9vw;
border: 1px solid #1083F8;
font-weight: 400;
font-size: 1.4vw;
color: #1083F8;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 2.3vw;
right: 0.8vw;
}
image {
width: 2.5vw;
height: 2.5vw;
}
}
.msitem {
min-width: 25vw;
height: 20vw;
margin-right: 4.2vw;
position: relative;
>view {
&:nth-child(2),
&:nth-child(3),
&:nth-child(4),
&:nth-child(6),
&:nth-child(5) {
margin-top: 0.25vw;
max-width: 25vw;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
text {
font-weight: 400;
font-size: 1.3vw;
color: #777777;
margin-top: 0.25vw;
}
}
&:nth-child(1) {
display: flex;
align-items: center;
height: 2vw;
margin-top: 1vw;
>view {
max-width: 13vw;
height: 2vw;
font-weight: bold;
font-size: 1.8vw;
color: #222222;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
text {
width: 6vw;
font-weight: 300;
font-size: 1.4vw;
color: #222222;
}
}
}
>.wlsy {
width: 100%;
height: 3.4vw;
display: flex;
justify-content: space-between;
margin-top: 0vw;
>view {
width: 33.3%;
height: 100%;
display: flex;
flex-direction: column;
position: relative;
margin-top: 1vw;
&:nth-child(1) {
width: 30%;
align-items: left;
}
&:nth-child(2) {
width: 40%;
align-items: center;
}
&:nth-child(3) {
width: 30%;
text-align: right;
align-items: right;
}
&:nth-child(2)::after {
content: '';
position: absolute;
right: 0;
width: 100%;
height: 2.2vw;
border-left: 1px solid #C9C9C9;
border-right: 1px solid #C9C9C9;
top: 0.6vw;
}
text {
&:nth-child(1) {
font-weight: bold;
font-size: 1.8vw;
color: #555555;
}
&:nth-child(2) {
font-weight: 400;
font-size: 1.2vw;
color: #999999;
}
}
}
}
}
// .spleft{
// margin-left: -15vw !important;
// }
.speitem {
min-width: 18vw;
height: 17vw;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.cardp {
width: 12.5vw;
height: 4vw;
display: flex;
flex-wrap: wrap;
margin: 0 auto;
align-items: center;
view {
min-width: 5.5vw;
height: 1.8vw;
border-radius: 0.9vw;
border: 1px solid #D2D2D2;
margin: 0.5vw 0 0 0.5vw;
display: flex;
justify-content: center;
align-items: center;
font-weight: 400;
font-size: 1vw;
color: #555555;
padding: 0 0.25vw;
&:nth-child(1),
&:nth-child(2) {
max-width: 6vw;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: block;
line-height: 1.8vw;
text-align: center;
}
&:nth-child(3) {
max-width: 11.5vw;
padding: 0 0.8vw;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: block;
line-height: 1.8vw;
text-align: center;
}
}
}
.imghs {
width: 10vw;
height: 10vw;
margin: 1vw auto 0.25vw;
padding: 0.2vw;
background: #fff;
border-radius: 1.1vw;
>image {
width: 100%;
height: 100%;
border-radius: 1.1vw;
}
}
}
}
.tan {
width: 100%;
height: 100%;
.submit {
width: 100%;
height: 1vw;
margin-top: 0.7vw;
// margin-top: 0.9vw;
padding-right: 2vw;
display: flex;
justify-content: flex-end;
view {
display: flex;
justify-content: center;
align-items: center;
&:nth-child(1) {
width: 5.7vw;
height: 2.3vw;
background: #F8F8F8;
border-radius: 1.2vw;
border: 1px solid #E5E5E5;
font-weight: 400;
font-size: 1.2vw;
color: #555555;
}
&:nth-child(2) {
width: 5.7vw;
height: 2.3vw;
background: linear-gradient(0deg, #CAE0F9, #E9F4FF);
border-radius: 1.2vw;
border: 1px solid rgba(3, 133, 250, 0.34);
font-weight: 400;
font-size: 1.2vw;
color: #1083F8;
margin-left: 0.7vw;
}
}
}
.bpq {
width: 100%;
height: 2.6vw;
position: absolute;
display: flex;
bottom: 0.5vw;
left: 1vw;
.triangle-leftpz {
width: 2vw;
height: 1.5vw;
position: absolute;
bottom: 2.2vw;
left: 11vw;
z-index: 30;
image {
width: 100%;
height: 100%;
}
}
.triangle-leftbz {
width: 2vw;
height: 1.5vw;
position: absolute;
bottom: 2.2vw;
left: 4vw;
z-index: 30;
image {
width: 100%;
height: 100%;
}
}
.gray-pgc {
background: #fff;
width: 46vw;
height: 30vw;
border-radius: 2vw;
box-shadow: 0rpx 0rpx 5rpx 0rpx rgba(116, 141, 164, 0.22);
position: absolute;
bottom: 3.6vw;
left: 1vw;
overflow: hidden;
>.submit {
position: absolute;
bottom: 0;
right: 0;
}
.scrollbgc {
width: 92%;
margin-left: 4%;
height: 22vw;
.zpj {
width: 30%;
display: flex;
flex-wrap: wrap;
flex-direction: column;
// padding: 0 1.6vw;
height: 22vw;
// background-color: red;
.zpk {
width: 16.4vw;
height: 10vw;
margin-top: 1vw;
border-radius: 1.1vw;
position: relative;
display: flex;
justify-content: center;
align-items: center;
background: #F9F9F9;
overflow: hidden;
margin-right: 1vw;
view {
width: 2vw;
height: 2vw;
z-index: 20;
position: absolute;
right: 0.8vw;
top: 0.8vw;
border-radius: 0.6vw 1.1vw 0.6vw 0.6vw;
background: rgba(255, 255, 255, 1);
display: flex;
justify-content: center;
align-items: center;
}
image {
width: 100%;
height: 100%;
}
}
.clkpz {
width: 16.4vw;
height: 10vw;
background: #FAFDFF;
border-radius: 1.1vw;
border: 1px solid #DDEFFF;
display: flex;
justify-content: center;
align-items: center;
margin-top: 1vw;
flex-direction: column;
text {
font-weight: 400;
font-size: 1vw;
color: #78B1EB;
}
image {
width: 2.8vw;
height: 2.8vw;
}
}
}
}
.pztit {
font-weight: 400;
font-size: 1.5vw;
color: #888888;
margin: 1.6vw auto 0;
width: 100%;
padding-left: 2.4vw;
}
}
.gray-bgc {
background: #fff;
width: 33vw;
height: 14.1vw;
border-radius: 2vw;
box-shadow: 0rpx 0rpx 5rpx 0rpx rgba(116, 141, 164, 0.6);
position: absolute;
bottom: 3.6vw;
left: 1vw;
overflow: hidden;
.triangle-left {
width: 2vw;
height: 1.5vw;
position: absolute;
top: 99.5%;
left: 3vw;
image {
width: 100%;
height: 100%;
}
}
.textare {
width: 29vw;
height:7.8vw;
background: #F5F5F5;
border: 4rpx solid #F5F5F5;
border-radius: 1vw;
margin: 1.6vw auto 0;
padding: 1vw;
textarea {
width: 100%;
height: 100%;
font-weight: 400;
font-size: 1.3vw;
color: #999999;
}
}
}
.qued {
width: 6vw;
height: 2.8vw;
background: linear-gradient(0deg, #CAE0F9, #E9F4FF);
border-radius: 1.3vw;
border: 1px solid rgba(3, 133, 250, 0.34);
right: 3.2vw;
top: 1vw;
position: absolute;
font-weight: 400;
font-size: 1.4vw;
color: #0385FA;
display: flex;
align-items: center;
justify-content: center;
}
.bp {
width: 5vw;
height: 2.8vw;
display: flex;
align-items: flex-end;
font-weight: 400;
font-size: 1.2vw;
color: #555555;
margin-left: 1.5vw;
white-space: nowrap;
position: relative;
>text {
min-width: 1vw;
height: 1vw;
border-radius: 0.5vw;
font-weight: 400;
font-size: 0.8vw;
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
padding: 0 0.4vw;
position: absolute;
right: -0.5vw;
top: 0;
background: #555555;
}
.g {
background: #0385FA;
border: 1px solid #0385FA;
}
.r {
background: #FF5757;
border: 1px solid #FF5757;
}
image {
width: 1.8vw;
height: 1.8vw;
margin-right: 0.4vw;
}
}
}
.tbox {
width: 100%;
height: 16vw;
position: absolute;
top: 1vw;
z-index: 28;
left: 0;
}
}
</style>