diff --git a/pages/massif/add_transaction.vue b/pages/massif/add_transaction.vue index 793c1e0..a06c312 100644 --- a/pages/massif/add_transaction.vue +++ b/pages/massif/add_transaction.vue @@ -59,7 +59,7 @@ <text style="margin:45rpx 20rpx 0 20rpx;">/</text> <d-form style="width:max-content;margin-top:40rpx;" type="select" placeholder=" " @select="formData.packUnit=$event.value[0].value" :columns="[packWeightList]" :value="[formData.packUnit]"/> </view> - <d-form label="交易数量" type="digit" suffix="袋" required field="tradeNum" :value="formData.tradeNum" @input="formData.tradeNum=$event"/> + <d-form label="交易数量" disabled type="digit" suffix="袋" :value="tradeNum"/> <d-form label="买方名称" required field="buyerName" :value="formData.buyerName" @input="formData.buyerName=$event"/> <d-form label="买方类型" required field="buyerType" type="select" :columns="[buyerType.list]" :value="buyerType.value" @select="buyerType.value=$event.value.map(v=>v.value);formData.buyerType=buyerType.value[1]"/> <d-form label="收货地址" required field="buyerAddress" type="textarea" :value="formData.buyerAddress" @input="formData.buyerAddress=$event"/> @@ -103,6 +103,11 @@ export default { eventChannel:null, } }, + computed:{ + tradeNum(){ + return Math.round((parseFloat(this.formData.tradeWeight)/parseFloat(this.formData.specification)||0)*100)/100 + }, + }, onLoad(options){ this.eventChannel=this.getOpenerEventChannel() this.eventChannel.on("detail", e=>{ @@ -148,7 +153,10 @@ export default { if(valid){ var res=await request("/api/plantTrade/add",{ method:"post", - body: this.formData + body: { + ...this.formData, + tradeNum: this.tradeNum + } }) if(res.statu){ uni.navigateBack()