feat: 商品管理长度宽度单位改为mm,面积改为m²,最多5位数字
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -65,17 +65,17 @@
|
|||||||
</view>
|
</view>
|
||||||
</picker>
|
</picker>
|
||||||
</view>
|
</view>
|
||||||
<view class="form-row">
|
<view class="form-row size-row">
|
||||||
<view class="form-item half">
|
<view class="form-item half">
|
||||||
<text class="label">长度</text>
|
<text class="label">长度(mm)</text>
|
||||||
<input class="input" type="digit" v-model="form.length" placeholder="非必须" />
|
<input class="input" type="digit" v-model="form.length" placeholder="非必须" maxlength="5" />
|
||||||
</view>
|
</view>
|
||||||
<view class="form-item half">
|
<view class="form-item half">
|
||||||
<text class="label">宽度</text>
|
<text class="label">宽度(mm)</text>
|
||||||
<input class="input" type="digit" v-model="form.width" placeholder="非必须" />
|
<input class="input" type="digit" v-model="form.width" placeholder="非必须" maxlength="5" />
|
||||||
</view>
|
</view>
|
||||||
<view class="form-item half">
|
<view class="form-item half">
|
||||||
<text class="label">面积</text>
|
<text class="label">面积(m²)</text>
|
||||||
<input class="input" type="digit" v-model="form.area" placeholder="自动计算" disabled />
|
<input class="input" type="digit" v-model="form.area" placeholder="自动计算" disabled />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -151,9 +151,9 @@ export default {
|
|||||||
computedArea() {
|
computedArea() {
|
||||||
const l = parseFloat(this.form.length)
|
const l = parseFloat(this.form.length)
|
||||||
const w = parseFloat(this.form.width)
|
const w = parseFloat(this.form.width)
|
||||||
// 长度(cm) × 宽度(cm) ÷ 10000 = 面积(m²)
|
// 长度(mm) × 宽度(mm) ÷ 1000000 = 面积(m²)
|
||||||
if (!isNaN(l) && !isNaN(w) && l > 0 && w > 0) {
|
if (!isNaN(l) && !isNaN(w) && l > 0 && w > 0) {
|
||||||
return (l * w / 10000).toFixed(2)
|
return (l * w / 1000000).toFixed(4)
|
||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user