提交 b062c6ec authored 作者: 刘旭's avatar 刘旭

修改单价

上级 03e25584
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Edge",
"request": "launch",
"type": "msedge",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
},
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}",
"externalConsole": true //可以配置
}
]
}
...@@ -20,8 +20,10 @@ ...@@ -20,8 +20,10 @@
<view <view
style="display: flex; flex-direction: row; align-items: center; margin-bottom: 10rpx;"> style="display: flex; flex-direction: row; align-items: center; margin-bottom: 10rpx;">
<text>设置单价:</text> <text>设置单价:</text>
<u-input v-model="item.unitPrice" type="number" height="50" placeholder="请输入单价" <!-- <u-input ref="inputRef" type="number" height="50" style="width: 200rpx;" /> -->
style="width: 200rpx;" @input="priceCheck($event, index)" /> <input type="number" placeholder="请输入单价" v-model="item.unitPrice"
@focus="onPriceFocus" @blur="priceCheck($event, index)"
style="width: 200rpx;">
</view> </view>
<view <view
style="display: flex; flex-direction: row; align-items: center; margin-bottom: 10rpx;"> style="display: flex; flex-direction: row; align-items: center; margin-bottom: 10rpx;">
...@@ -41,10 +43,7 @@ ...@@ -41,10 +43,7 @@
item.unitPrice item.unitPrice
? ( ? (
Number(item.unitPrice) * item.number + Number(item.unitPrice) * item.number +
Number(item.unitPrice) * Number(item.unitPrice) * item.number * tax * 0.01
item.number *
tax *
0.01
).toFixed(2) ).toFixed(2)
: 0 : 0
}} }}
...@@ -241,6 +240,7 @@ let quotationData = ref(); ...@@ -241,6 +240,7 @@ let quotationData = ref();
let orderId = ref() let orderId = ref()
let tax = ref() // 税率 let tax = ref() // 税率
let lineId = ref() // 产品线id 可以分辨是产品线还是普通商品 let lineId = ref() // 产品线id 可以分辨是产品线还是普通商品
let oldPrice = ref(0) // 用于判断是否修改价格
onLoad((options: any) => { onLoad((options: any) => {
...@@ -305,11 +305,17 @@ let taxTotlePirce = computed(() => { ...@@ -305,11 +305,17 @@ let taxTotlePirce = computed(() => {
return Number(taxTotlePic).toFixed(2); return Number(taxTotlePic).toFixed(2);
}); });
let onPriceFocus = (data: any) => {
const { value: val } = data.detail
oldPrice.value = val
}
// 单价不可以为负数 // 单价不可以为负数
let priceCheck = (val: any, index: number) => { let priceCheck = (data: any, index: number) => {
const { value: val } = data.detail
// 防止为空时出现提示 // 防止为空时出现提示
if (!val) return if (!val) return
if (val <= 0) { if (val <= 0)
nextTick(() => { nextTick(() => {
detailData.value[index].unitPrice = '' detailData.value[index].unitPrice = ''
uni.showToast({ uni.showToast({
...@@ -317,6 +323,13 @@ let priceCheck = (val: any, index: number) => { ...@@ -317,6 +323,13 @@ let priceCheck = (val: any, index: number) => {
icon: 'none' icon: 'none'
}) })
}) })
if (Number(val) === Number(oldPrice.value)) return
else {
oldPrice.value = val
let price = Number(val) * 100
nextTick(() => {
detailData.value[index].unitPrice = ((price - price * tax.value * 0.01) / 100).toFixed(2)
})
} }
} }
...@@ -635,4 +648,9 @@ let initQuotationPayment = () => { ...@@ -635,4 +648,9 @@ let initQuotationPayment = () => {
flex-direction: column; flex-direction: column;
} }
} }
:deep(.uni-input-placeholder) {
font-size: 0.875rem;
color: gray;
}
</style> </style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论