up修复数量问题
This commit is contained in:
@@ -27,16 +27,30 @@
|
||||
|
||||
|
||||
|
||||
<!-- ===== 分组:关于 ===== -->
|
||||
<view class="group">
|
||||
<text class="group-title">关于</text>
|
||||
<view class="group-body">
|
||||
<view class="cell">
|
||||
<text class="cell-label">版本号</text>
|
||||
<text class="cell-value">{{ version }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref,onMounted } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { isUrl } from '@/utils/index.js'
|
||||
import { useConfigStore } from '../../stores/config'
|
||||
|
||||
const useConfig=useConfigStore()
|
||||
|
||||
// ---- 版本号 ----
|
||||
const version = ref('')
|
||||
|
||||
// ---- 响应式状态 ----
|
||||
const isTested=ref(false)//是否点了测试
|
||||
const isTesting=ref(false)//是否正在测试
|
||||
@@ -100,8 +114,26 @@ function onEditApiUrl() {
|
||||
}
|
||||
|
||||
|
||||
onMounted(()=>{
|
||||
onMounted(() => {
|
||||
// 真机/打包环境:通过 plus.runtime 获取
|
||||
// #ifndef H5
|
||||
version.value = plus.runtime.version || ''
|
||||
// #endif
|
||||
|
||||
// H5 端:从 manifest.json 读取
|
||||
// #ifdef H5
|
||||
fetch('/manifest.json')
|
||||
.then(r => r.text())
|
||||
.then(text => {
|
||||
// manifest.json 可能含 JS 注释,需先去除再解析
|
||||
const cleaned = text.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, '')
|
||||
const m = JSON.parse(cleaned)
|
||||
version.value = (m.versionName || '') + ' (' + (m.versionCode || '') + ')'
|
||||
})
|
||||
.catch(() => {
|
||||
version.value = ''
|
||||
})
|
||||
// #endif
|
||||
})
|
||||
|
||||
</script>
|
||||
@@ -145,6 +177,12 @@ onMounted(()=>{
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
/* 左侧标签 */
|
||||
.cell-label {
|
||||
font-size: 30rpx;
|
||||
color: #1c1c1e;
|
||||
}
|
||||
|
||||
/* 点击高亮(uni-app 用 hover-class 实现,这里仅演示结构) */
|
||||
.cell:active {
|
||||
background-color: #f2f2f7;
|
||||
|
||||
@@ -17,6 +17,19 @@
|
||||
<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="请输入备注(选填)" />
|
||||
@@ -68,6 +81,7 @@ const form = ref({
|
||||
name: '',
|
||||
serialNumber: '',
|
||||
remark: '',
|
||||
quantity: 1,
|
||||
photos: []
|
||||
})
|
||||
|
||||
@@ -129,6 +143,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,
|
||||
container_id: containerId.value || null,
|
||||
photos: form.value.photos
|
||||
}
|
||||
@@ -154,7 +169,6 @@ async function submitForm() {
|
||||
// 获取页面参数
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
onLoad((options) => {
|
||||
console.log('add-item onLoad options:', options)
|
||||
if (options && options.container_id) {
|
||||
containerId.value = parseInt(options.container_id)
|
||||
}
|
||||
@@ -311,4 +325,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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -82,6 +82,7 @@
|
||||
<view class="item-info">
|
||||
<text class="item-name">{{ item.Name }}</text>
|
||||
<text class="item-meta" v-if="item.SerialNumber">编号: {{ item.SerialNumber }}</text>
|
||||
<text class="item-meta">数量: {{ item.Quantity ?? 1 }}</text>
|
||||
</view>
|
||||
<view class="item-arrow">›</view>
|
||||
</view>
|
||||
@@ -110,6 +111,7 @@
|
||||
<view class="item-info">
|
||||
<text class="item-name">{{ item.Name }}</text>
|
||||
<text class="item-meta" v-if="item.SerialNumber">编号: {{ item.SerialNumber }}</text>
|
||||
<text class="item-meta">数量: {{ item.Quantity ?? 1 }}</text>
|
||||
<text class="item-location" v-if="item.ContainerBreadcrumb">
|
||||
位置: {{ item.ContainerBreadcrumb }}
|
||||
</text>
|
||||
|
||||
Reference in New Issue
Block a user