Browse Source

修改规格显示

master
邓宏 1 year ago
parent
commit
8030c11791
  1. 18
      pages/massif/agrSpecs.vue

18
pages/massif/agrSpecs.vue

@ -152,9 +152,17 @@
<view class="card">
<u-form class="inline" labelWidth="auto">
<u-form-item label="规格" prop="specificationId" :required="true">
<u-form-item label="规格" prop="specificationId" :required="true" tip="asdf">
<view class="plant-youbian" :class="{noData: !formData.specDescribe}" @click="$refs.Dpicker.show=true">{{formData.specDescribe||"请选择规格"}}</view>
</u-form-item>
<text style="color:#FBA83C;font-size:20rpx;" v-if="formData.specDescribe">剩余{{formData.number}}{{specsVal.specs[2]}}</text>
<!-- <d-form label="规格" required :value="[formData.specificationId]" @select="select($event[0])" field="specDescribe" type="select" custom :columns="[specs.list]">
<view slot-scope="{row}" style="display:flex;">
<text style="margin-left:10rpx;font-weight:bold;">剩余{{row.number}}{{row.packgeUnit}}</text>
<text style="font-size:24rpx;color:#999;">({{row.specDescribe}})</text>
<text style="margin-left:auto;color:#999;">{{new Date(row.operateTime).format('yyyy-MM-dd')}}</text>
</view>
</d-form> -->
<d-form v-bind="inputQuantity" :value="formData.inputQuantity" @input="formData.inputQuantity=$event"/>
</u-form>
</view>
@ -171,6 +179,7 @@ export default {
tip:"",
list:[]
},
inputQuantity:{
label:"投入数量",
required:true,
@ -204,13 +213,14 @@ export default {
specsVal(n){
this.inputQuantity.suffix=n.specs[1]
if(n.num>0 && n.specs[0]>0){
this.$set(this.inputQuantity, "tip", `${parseFloat(n.num)/parseFloat(n.specs[0])}${n.specs[2]}`)
this.$set(this.inputQuantity, "tip", `${Math.round(parseFloat(n.num)/parseFloat(n.specs[0])*100)/100}${n.specs[2]}`)
}else{
this.$set(this.inputQuantity, "tip", "")
}
}
},
async onLoad(options){
window.the=this
this.eventChannel=this.getOpenerEventChannel()
this.eventChannel.on("detail", e=>{
this.agrDetail=e
@ -229,6 +239,8 @@ export default {
this.$provise.emit("forming_agr", list=>{
this.specs.list=res.data.map(v=>{
v.number-=list.reduce((a,b)=>a+(b.inventoryId==v.id?b.inputQuantity:0),0)
v.value=v.specificationId
v.label=v.specDescribe
return v
}).filter(v=>v.number>0)
})
@ -256,7 +268,7 @@ export default {
uni.showToast({title:"投入数量必填!",icon:"none"})
return false
}else if(parseFloat(this.specsVal.num)/parseFloat(this.specsVal.specs[0])>this.formData.number){
uni.showToast({title:`投入数量不能大于${this.formData.number}${this.specsVal.specs[2]}`,icon:"none"})
uni.showToast({title:`投入数量不能大于${Math.round(this.formData.number*this.specsVal.specs[0]*100)/100}${this.specsVal.specs[1]}`,icon:"none"})
return false
}
return true

Loading…
Cancel
Save