up修复数量问题
This commit is contained in:
@@ -21,7 +21,20 @@
|
||||
<text class="form-label">编号</text>
|
||||
<input class="form-input" v-model="form.serialNumber" placeholder="请输入物品编号(选填)" />
|
||||
</view>
|
||||
|
||||
|
||||
<view class="form-item">
|
||||
<text class="form-label">数量</text>
|
||||
<view class="quantity-row">
|
||||
<view class="qty-btn" @click="form.quantity > 1 && form.quantity--">
|
||||
<text class="qty-btn-text">−</text>
|
||||
</view>
|
||||
<input class="qty-input" type="number" v-model.number="form.quantity" />
|
||||
<view class="qty-btn" @click="form.quantity++">
|
||||
<text class="qty-btn-text">+</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="form-label">备注</text>
|
||||
<textarea class="form-textarea" v-model="form.remark" placeholder="请输入备注(选填)" />
|
||||
@@ -75,6 +88,7 @@ const form = ref({
|
||||
name: '',
|
||||
serialNumber: '',
|
||||
remark: '',
|
||||
quantity: 1,
|
||||
photos: []
|
||||
})
|
||||
|
||||
@@ -134,6 +148,7 @@ async function fetchDetail() {
|
||||
name: item.Name || '',
|
||||
serialNumber: item.SerialNumber || '',
|
||||
remark: item.Remark || '',
|
||||
quantity: item.Quantity ?? 1,
|
||||
photos: res.data.photos ? res.data.photos.map(p => p.Sha256) : []
|
||||
}
|
||||
} else {
|
||||
@@ -160,6 +175,7 @@ async function submitForm() {
|
||||
name: form.value.name,
|
||||
serial_number: form.value.serialNumber,
|
||||
remark: form.value.remark,
|
||||
quantity: form.value.quantity > 0 ? form.value.quantity : 1,
|
||||
photos: form.value.photos
|
||||
}
|
||||
|
||||
@@ -184,7 +200,6 @@ async function submitForm() {
|
||||
// 获取页面参数
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
onLoad((options) => {
|
||||
console.log('item-edit onLoad options:', options)
|
||||
if (options && options.id) {
|
||||
itemId.value = parseInt(options.id)
|
||||
fetchDetail()
|
||||
@@ -348,4 +363,38 @@ onLoad((options) => {
|
||||
border-radius: 12rpx;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
/* 数量选择器 */
|
||||
.quantity-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.qty-btn {
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
background-color: #f0f0f0;
|
||||
border-radius: 10rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.qty-btn-text {
|
||||
font-size: 36rpx;
|
||||
color: #333;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.qty-input {
|
||||
width: 100rpx;
|
||||
height: 72rpx;
|
||||
text-align: center;
|
||||
background-color: #f5f5f5;
|
||||
font-size: 30rpx;
|
||||
border-radius: 10rpx;
|
||||
margin: 0 16rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user