dev
e 3 years ago
parent 71feaeb813
commit 843054ad54
  1. 39
      src/views/order/AddOrder.vue

@ -233,7 +233,7 @@
<el-table-column label="账号数" align="center" width="150"> <el-table-column label="账号数" align="center" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="small"> <div class="small">
<el-input :disabled="disabled||editDisabled" @change="dealComputers($event,scope.row)" v-model="scope.row.accountNum" placeholder="请输入"type="text"></el-input> <el-input :disabled="disabled||editDisabled" @change="[dealComputers($event,scope.row),dealBargain($event,scope.row)]" v-model="scope.row.accountNum" placeholder="请输入"type="text"></el-input>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@ -241,7 +241,7 @@
<el-table-column label="总金额(元)" align="center" width="180"> <el-table-column label="总金额(元)" align="center" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="small"> <div class="small">
<el-input :disabled="disabled||editDisabled" @change="[allAmount($event,scope.row),allAmountChange($event,scope.row)]" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" v-model="scope.row.totalAmount" placeholder="请输入"type="text"></el-input> <el-input :disabled="disabled||editDisabled" @blur="[allAmount($event,scope.row),allAmountChange($event,scope.row)]" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" v-model="scope.row.totalAmount" placeholder="请输入"type="text"></el-input>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@ -918,19 +918,34 @@ export default {
}) })
this.form.orderAmount = arr.reduce((a,b)=>a+b) this.form.orderAmount = arr.reduce((a,b)=>a+b)
}, },
// --
// --
allAmountChange(val,row){ allAmountChange(val,row){
if(val){ console.log(val,row,'kankan');
let all = val*10000 if(row.totalAmount){
let all = row.totalAmount
if(row.accountNum){// if(row.accountNum){//
row.finalPrice = all/row.accountNum row.finalPrice = Math.round(all/row.accountNum).toFixed(2)
} }
if(row.finalPrice){ if(row.finalPrice){//
row.accountNum = all/row.finalPrice row.accountNum = Math.floor(all/row.finalPrice)
} }
console.log(val,row); console.log(val,row);
} }
}, },
//
dealComputers(e,row){
if(row.finalPrice&&row.accountNum){
row.totalAmount = Math.round((row.finalPrice)*(row.accountNum)).toFixed(2);
}
this.allAmount()
},
//
dealBargain(e,row){
if(row.accountNum&&row.totalAmount){
row.finalPrice = Math.round(row.totalAmount/row.accountNum).toFixed(2)
}
},
// switch-- // switch--
formSwitch (e,row) { formSwitch (e,row) {
if(this.editDisabled){ if(this.editDisabled){
@ -982,13 +997,7 @@ export default {
console.log(Date.parse(endYear),nowYear,date1,date2,days,'剩余期限'); console.log(Date.parse(endYear),nowYear,date1,date2,days,'剩余期限');
row.remainingPeriod = days row.remainingPeriod = days
}, },
//
dealComputers(e,row){
if(row.finalPrice&&row.accountNum){
row.totalAmount = Math.floor(((row.finalPrice*100)*(row.accountNum*100))/10000).toFixed(2);
}
this.allAmount()
},
// //
delDataForm(index){ delDataForm(index){
this.$confirm('确定要删除吗?', '提示', { this.$confirm('确定要删除吗?', '提示', {

Loading…
Cancel
Save