Commit 49318ef3 authored by Marcus's avatar Marcus

添加箱明细优化

1.数量只能输入正整数
2.长宽高体积重量,只能输入数字,支持小数点后2位
3.品牌首次点击与入仓一样,默认加载最新10条品牌
4.选择品名要自动带入特性
https://zentao.test.jdshangmen.com/bug-view-5099.html
parent 460d5fc2
......@@ -7,7 +7,7 @@
<el-row :gutter="10">
<el-col :span="12">
<el-form-item :label="$t('中文品名')">
<product-selector v-model="value.prodId" determined protect-once :disabled="readonly" />
<product-selector v-model="value.prodId" @change="onProductChange" determined protect-once :disabled="readonly" />
</el-form-item>
</el-col>
<el-col :span="12">
......@@ -49,27 +49,27 @@
<el-row :gutter="10">
<el-col :span="4">
<el-form-item :label="$t('长')">
<el-input v-model="boxGauge1" :disabled="readonly" />
<el-input v-model="boxGauge1" type="number" :disabled="readonly" />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item :label="$t('宽')">
<el-input v-model="boxGauge2" :disabled="readonly" />
<el-input v-model="boxGauge2" type="number" :disabled="readonly" />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item :label="$t('高')">
<el-input v-model="boxGauge3" :disabled="readonly" />
<el-input v-model="boxGauge3" type="number" :disabled="readonly" />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item :label="$t('重量')">
<el-input v-model="value.weight" :disabled="readonly" />
<el-input v-model="value.weight" type="number" :disabled="readonly" />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item :label="$t('体积')">
<el-input v-model="value.volume" :disabled="readonly" />
<el-input v-model="value.volume" type="number" :disabled="readonly" />
</el-form-item>
</el-col>
</el-row>
......@@ -86,7 +86,7 @@
</el-col>
<el-col :span="4">
<el-form-item :label="$t('数量')">
<el-input v-model="value.quantityAll" :disabled="readonly" />
<el-input v-model="value.quantityAll" type="number" :disabled="readonly" />
</el-form-item>
</el-col>
</el-row>
......@@ -152,7 +152,6 @@ export default {
}
if (this.value.usageIds) {
console.log('this.value.usageIds',this.value.usageIds)
await this.$nextTick()
this.usageIds = this.value.usageIds.split(',') || []
}
......@@ -181,6 +180,12 @@ export default {
},
handleDelete() {
this.$emit('handle-delete')
},
onProductChange(product){
if (!product) {
return
}
this.prodAttrIds = product.attrId ? product.attrId.split(',').map(e => +e) : []
}
},
watch: {
......@@ -188,19 +193,46 @@ export default {
this.value.prodAttrIds = val.join(',')
},
usageIds(val) {
console.log('val', val)
this.$nextTick(() => {
this.value.usageIds = val.join(',')
})
},
boxGauge1() {
if (this.boxGauge1 < 0 ) {
this.boxGauge1 = -this.boxGauge1
}
this.value.boxGauge = this.boxGauge1 + '*' + this.boxGauge2 + '*' + this.boxGauge3
this.value.volume = (this.boxGauge1 * this.boxGauge2 * this.boxGauge3 / 1000000).toFixed(2)
},
boxGauge2() {
if (this.boxGauge2 < 0 ) {
this.boxGauge2 = -this.boxGauge2
}
this.value.boxGauge = this.boxGauge1 + '*' + this.boxGauge2 + '*' + this.boxGauge3
this.value.volume = (this.boxGauge1 * this.boxGauge2 * this.boxGauge3 / 1000000).toFixed(2)
},
boxGauge3() {
if (this.boxGauge3 < 0 ) {
this.boxGauge3 = -this.boxGauge3
}
this.value.boxGauge = this.boxGauge1 + '*' + this.boxGauge2 + '*' + this.boxGauge3
this.value.volume = (this.boxGauge1 * this.boxGauge2 * this.boxGauge3 / 1000000).toFixed(2)
},
'value.volume'() {
if (this.value.volume < 0) {
this.value.volume = -this.value.volume
}
},
'value.quantityAll'() {
if (this.value.quantityAll < 0) {
this.value.quantityAll = -this.value.quantityAll
}
},
'value.weight'() {
if (this.value.weight < 0) {
this.value.weight = -this.value.weight
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment