hldy_app_mini/pages/material/component/price.vue

600 lines
13 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="box guodu" :style="!show?'width: 0;right:-6vw':'width: 78vw'">
<view class="title">
<view></view>
销售价格
</view>
<view class="gys">供应商{{ cardvalue.gysName }}</view>
<view class="list">
<view class="cgdh">
<view class="zc">
采购单号 {{ cardvalue.ddNo }}
<view>库存数量<text style="padding-left: 0.5vw;">{{ Number(cardvalue.kcsl ).toFixed(2) }}</text>
</view>
</view>
<view class="sxd" @click="sxd = true">随行单</view>
</view>
<view class="contents">
<view class="carditem guodu">
<view class="speitem guodu">
<view class="imghs">
<image style="border-radius: 1vw;"
:src="cardvalue.materialImg?serverUrl+cardvalue.materialImg:'/static/index/procurement/k.png'"
mode="aspectFill">
</image>
</view>
<view class="cardp">
<view>{{ cardvalue.categoryId_dictText }}</view>
<view>{{ cardvalue.typeId_dictText }}</view>
</view>
<!-- <view class="cardp">
<view v-if="v.categoryId_dictText">{{v.categoryId_dictText}}</view>
<view v-if="v.typeId_dictText">{{v.typeId_dictText}}</view>
<view v-if="v.medicationId_dictText">{{v.medicationId_dictText}}</view>
</view> -->
</view>
<view class="msitem guodu">
<view>
<view>{{ cardvalue.materialName }}</view>
</view>
<view style="margin-top: 1vw;">
<text style="white-space: nowrap;"> 物料编码: {{ cardvalue.materialNo }}</text>
</view>
<view>
<text style="white-space: nowrap;"> 规格型号: {{ cardvalue.specificationModel }}</text>
</view>
<view>
<text style="white-space: nowrap;"> 品牌型号{{ cardvalue.brandType }}</text>
</view>
<view>
<text style="white-space: nowrap;"> 生产厂家{{ cardvalue.manufacturer }}</text>
</view>
</view>
</view>
<view class="righs">
<view class="hezi" style="position: relative;">
<view>
<text></text>
{{ Number(cardvalue.procurementPrice).toFixed(2) }}
<text class="s" v-if="cardvalue.procurementPrice < cardvalue.arrivalPrice">↑ <text
class="info-text">
¥{{ (cardvalue.arrivalPrice - cardvalue.procurementPrice).toFixed(2) }}</text></text>
<text class="j" v-if="cardvalue.procurementPrice > cardvalue.arrivalPrice">↓<text
class="info-text">
¥{{ (cardvalue.procurementPrice - cardvalue.arrivalPrice).toFixed(2) }}</text></text>
</view>
<view class="jg">
采购价格
<!-- <text class="s">↑</text><text class="sb ss">¥0.26 </text> -->
</view>
</view>
<view class="hezi" @click="openCalcul">
<view>
<text>¥</text>{{ changethenvalue==-998? Number(cardvalue.xsjg).toFixed(2):Number(changethenvalue).toFixed(2) }}
<!-- <image src="/static/index/material/edh.png" mode="aspectFill"></image> -->
<image src="/static/index/material/edl.png" mode="aspectFill"></image>
</view>
<view class="jg">
销售价格
<!-- <text class="j">↓</text><text class="sb jj">¥0.26 </text> -->
</view>
</view>
<view class="hezi">
<view>
{{ cardvalue.wlunits }}
</view>
<text>采购单位</text>
</view>
<view class="hezi">
<view style="padding-left: 0.3vw;">
{{ cardvalue.xsdw }}
<!-- <image src="/static/index/material/edr.png" mode="aspectFill"></image> -->
</view>
<text>销售单位</text>
</view>
</view>
</view>
</view>
<view class="btn">
<view class="qx" @click="emit('close')">取消</view>
<view class="qd" @click="successchange">确认</view>
</view>
<view class="mengban" style="z-index: 1;" v-if="opencal" @click="opencal=false"></view>
<view class="cal-view" :style="opencal?{}:{bottom:`-1200rpx`}">
<calculator :show="true" :translateNumber="translateNumber" @right="rightchange" @close="opencal=false">
</calculator>
</view>
</view>
<view class="mengban" v-if="sxd" @click="sxd = false"> </view>
<sxds :show="sxd" @close="sxd = false"></sxds>
<!-- <view class="mengban" style="z-index: 119;" v-if="true"></view> -->
<errorshow :show="openerror" :font="errmsg" @close="openerror=false" />
<!-- <calculator :show="addflag" @jjnum="jjnum" :caigouobj="caigouobj" @colse="qk" @right="right"></calculator> -->
</view>
</template>
<script setup lang="ts">
import { ref, onMounted, reactive, onBeforeUnmount, computed, nextTick, defineComponent, watch } from 'vue';
import sxds from './sxd.vue'
import calculator from './calculator.vue'
import { editXsjg } from '../api/api.js'
const props = defineProps({
show: {
type: Boolean
},
cardvalue: {
type: Object
}
})
watch(
() => props.show,
() => {
changethenvalue.value = -998;
opencal.value = false
}
)
const sxd = ref(false)
const emit = defineEmits(['close', 'finishit'])
const serverUrl = uni.getStorageSync('serverUrl') + '/sys/common/static/';
const opencal = ref(false);
const translateNumber = ref(0)
const openerror = ref(false)
const errmsg = ref('')
const openCalcul = () => {
opencal.value = true;
translateNumber.value = -63.21
nextTick(() => {
if (changethenvalue.value == -998) {
translateNumber.value = Number(props.cardvalue.xsjg)
} else {
translateNumber.value = Number(changethenvalue.value)
}
})
}
const changethenvalue = ref(-998)
const rightchange = (price : number) => {
changethenvalue.value = price
console.log("right", price)
opencal.value = false
}
const successchange = () => {
if (changethenvalue.value == -998) {
emit('close')
} else {
let data = {
id: props.cardvalue.id,
xsjg: changethenvalue.value
}
editXsjg(data).then((res : any) => {
if (res.success) {
console.log("看看改成啥了", res)
emit("finishit")
emit('close')
} else {
errmsg.value = res.result?.message ? res.result?.message : res.message
openerror.value = true;
}
})
// console.log("data", data)
}
}
</script>
<style lang="less" scoped>
.mengban {
width: 100vw;
height: 100vh;
position: fixed;
background: RGBA(240, 240, 240, 0.64);
top: 0;
left: 0;
z-index: 1010;
}
.box {
width: 0;
height: 100vh;
background: #FFFFFF;
position: fixed;
top: 0;
right: 0;
z-index: 1001;
overflow: hidden;
border-radius: 3vw 0 0 3vw;
padding: 3vw;
.btn {
position: absolute;
right: 3.5vw;
bottom: 2.7vw;
display: flex;
justify-content: flex-end;
view {
width: 8vw;
height: 3.4vw;
border-radius: 1.1vw;
font-size: 16px;
display: flex;
justify-content: center;
align-items: center;
margin-left: 1vw;
}
.qd {
background: #57A8FA;
color: #FFFFFF;
}
.qx {
background: #E1F0FF;
color: #555555;
}
}
.list::after {
content: '';
width: 1rpx;
height: 15vw;
background: #D2D2D2;
position: absolute;
top: 4vw;
left: 36vw;
}
.list {
width: 71.9vw;
height: 21.5vw;
background: #FFFFFF;
border-radius: 2.2vw;
border: 1px solid #D2D2D2;
margin-top: 1.7vw;
padding: 1.8vw 2.3vw 0;
position: relative;
.contents {
width: 100%;
height: 16vw;
display: flex;
.righs {
width: 30vw;
height: 100%;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-top: 3vw;
.s {
color: #FF5B5B !important;
// margin: 0 0.5vw;
position: absolute;
top: -20%;
// transform: translateY(-50%);
right: -2.5vw;
.info-text {
color: #fff;
background-color: #FF5B5B;
padding-left: 0.3vw;
padding-right: 0.5vw;
border-radius: 10rpx;
}
}
.j {
color: #0385FA !important;
margin: 0 0.5vw;
position: absolute;
top: -20%;
// transform: translateY(-50%);
right: -2.5vw;
.info-text {
color: #fff;
background-color: #0385FA;
padding-left: 0.3vw;
padding-right: 0.5vw;
border-radius: 10rpx;
}
}
.ss {
background: #FF5B5B !important;
}
.jj {
background: #0385FA !important;
}
.sb {
width: 4.8vw;
height: 2.1vw;
border-radius: 0.5vw;
font-weight: 400;
font-size: 1.4vw;
color: #FFFFFF !important;
display: flex;
justify-content: center;
align-items: center;
margin-left: 0.5vw;
}
.hezi {
width: 14vw;
height: 70rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
white-space: nowrap;
>view {
font-size: 2.2vw;
color: #333333;
display: flex;
align-items: flex-end;
font-weight: bold;
height: 2.4vw;
white-space: nowrap;
text {
font-size: 1.4vw;
line-height: 2.3vw;
}
image {
width: 1.4vw;
height: 1.4vw;
position: relative;
top: -0.4vw;
}
}
.jg {
font-size: 1.3vw;
color: #888888;
white-space: nowrap;
}
}
}
}
.cgdh {
width: 100%;
height: 40rpx;
display: flex;
align-items: center;
justify-content: space-between;
white-space: nowrap;
.zc {
font-size: 1.5vw;
color: #777777;
display: flex;
align-items: center;
view {
margin-left: 4.5vw;
text {
font-weight: bold;
font-size: 2vw;
color: #222222;
}
}
}
.sxd {
width: 5.5vw;
height: 2.4vw;
background: #FFFFFF;
border-radius: 0.9vw;
border: 1px solid #0385FA;
font-size: 1.2vw;
color: #0385FA;
display: flex;
justify-content: center;
align-items: center;
}
}
}
.gys {
font-weight: bold;
font-size: 1.4vw;
color: #777777;
margin-top: 2.3vw;
}
.title {
font-size: 1.7vw;
color: #222222;
display: flex;
align-items: center;
view {
width: 0.5vw;
height: 1.4vw;
background: radial-gradient(0% 0% at 0% 0%, #006DC9 7.25%, #0385FA 100%), #F7F7F7;
border-radius: 0.2vw;
margin-right: 1vw;
}
}
}
.guodu {
transition: .4s;
-webkit-transform-style: preserve-3d;
-webkit-overflow-scrolling: touch;
}
.carditem {
height: 100%;
width: 35vw;
display: flex;
transition: transform 500ms cubic-bezier(.2, .8, .2, 1);
will-change: transform;
margin-top: 1vw;
justify-content: space-between;
padding-right: 1.8vw;
// background-color: red;
.msitem {
min-width: 23vw;
height: 14vw;
position: relative;
display: flex;
flex-direction: column;
justify-content: space-around;
>view {
&:nth-child(2),
&:nth-child(3),
&:nth-child(4),
&:nth-child(6),
&:nth-child(5) {
margin-top: 0.25vw;
max-width: 23vw;
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;
justify-content: space-between;
align-items: center;
height: 2vw;
margin-top: 1vw;
>view {
width: 19vw;
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;
}
}
}
}
// .spleft{
// margin-left: -15vw !important;
// }
.speitem {
min-width: 13vw;
height: 14vw;
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;
}
}
}
}
.cal-view {
position: absolute;
bottom: 70rpx;
left: 400rpx;
width: 800rpx;
height: 1000rpx;
transition: bottom 0.3s ease;
z-index: 2;
}
</style>