代码更新

This commit is contained in:
GaoHao
2025-02-26 19:46:20 +08:00
parent 7519ffced3
commit b4a0393d2d
413 changed files with 7483 additions and 60762 deletions

View File

@@ -2,52 +2,29 @@
<view class="warehouseEntry">
<view>
<view>
<view>
账存数量
</view>
<view>
{{datas.item.balance}}
</view>
<view> 账存数量 </view>
<view> {{datas.item.stockNumber}} </view>
</view>
<view>
<view>
实际数量
</view>
<view>
<input type="number" v-model="datas.form.balance" placeholder="输入数量" name="" id="">
</view>
<view> 实际数量 </view>
<view> <input type="number" v-model="datas.form.actualNumber" placeholder="输入数量" name="" id=""> </view>
</view>
<view>
<view>
单价
</view>
<view>
{{datas.item.price}}
</view>
<view> 单价 </view>
<view> {{datas.item.price}} </view>
</view>
<view>
<view>
盈亏数量
</view>
<view>
{{profitNumber}}
</view>
<view> 盈亏数量 </view>
<view> {{profitNumber}} </view>
</view>
<view>
<view>
总盈亏
</view>
<view>
{{profitPrice}}
</view>
<view> 总盈亏 </view>
<view> {{profitPrice}} </view>
</view>
</view>
</view>
<view class="bottombutton">
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="toggle" :plain="true"
text="保存"></up-button>
<!-- <up-button type="text" style="background-color: #f9f9f9;color: #999;" @tap="toggle" :plain="true"
text="取消"></up-button> -->
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="toggle" :plain="true" text="保存"></up-button>
</view>
</template>
@@ -64,7 +41,8 @@
import {
tbConsInfotbConCheck
} from '@/http/yskApi/requestAll.js';
let showStatus = ref(false)
import { stockCheck } from '@/api/cons.js';
const props = defineProps({
item: {
type: ''
@@ -77,64 +55,50 @@
onMounted(() => {
datas.item = JSON.parse(props.item)
datas.form = {
...datas.item
...datas.item,
actualNumber: 0
}
console.log(datas.form)
})
/**
* 总盈亏
*/
let profitPrice = computed(() => {
// 如果剩余数量为负数
if (datas.form.balance == '-') {
return (0 - datas.item.balance) * datas.item.price
if (datas.form.stockNumber < 0) {
return (0 - datas.item.stockNumber) * datas.item.price
} else {
return ((datas.form.balance - datas.item.balance) * datas.item.price).toFixed(2);
return ((datas.form.actualNumber - datas.item.stockNumber) * datas.item.price).toFixed(2);
}
})
/**
* 盈亏数量
*/
let profitNumber = computed(() => {
// 盈亏数量
if (datas.form.balance == '-') {
return 0 - datas.item.balance
if (datas.form.stockNumber < 0) {
return 0 - datas.item.stockNumber
} else {
return datas.form.balance - datas.item.balance
return datas.form.actualNumber - datas.item.stockNumber
}
})
function toggle() {
if(!datas.form.balance){
if(!datas.form.actualNumber){
return
}
tbConsInfotbConCheck({
stockNumber: datas.form.balance,
conInfoId: datas.form.id,
lpNum: profitNumber._value
stockCheck({
...datas.form,
actualNumber: datas.form.actualNumber,
conId: datas.form.id,
winLossNumber: profitNumber._value
}).then(res => {
// go.to('PAGES_SALES_CONSUMABLES')
go.back()
})
}
/**
* 保留小数n位不进行四舍五入
* num你传递过来的数字,
* decimal你保留的几位,默认保留小数后两位
* isInt 是否保留0
*/
function formatDecimal(num = 0, decimal = 2, isInt = false) {
num = num.toFixed(3).toString();
const index = num.indexOf(".");
if (index !== -1) {
num = num.substring(0, decimal + index + 1);
} else {
num = num.substring(0);
}
//截取后保留两位小数
if (isInt) {
return parseFloat(num);
} else {
return parseFloat(num).toFixed(decimal);
}
}
function showStatusToggle() {
showStatus.value = !showStatus.value
}
</script>
<style>
page {
@@ -142,26 +106,6 @@
}
</style>
<style scoped lang="less">
.df() {
display: flex;
align-items: center;
}
ul,
li {
list-style: none;
padding: 0;
}
.status {
margin: 0 32rpx;
position: absolute;
left: 0;
right: 0;
z-index: 10;
background-color: #fff;
}
.warehouseEntry {
width: 694rpx;
@@ -171,7 +115,6 @@
margin: 32rpx;
padding: 1rpx 24rpx;
box-sizing: border-box;
>view {
>view {
width: 646rpx;
@@ -179,7 +122,8 @@
background: #fcfcfc;
border: 2rpx solid #F9F9F9;
margin-top: 32rpx;
.df;
display: flex;
align-items: center;
>view:first-child {
width: 190rpx;