| | |
| | | <div class="box_item_list_row" style="width: 50%;" v-for="(item, index) in list2" :key="index"> |
| | | <el-form-item :label="item.name"> |
| | | <div style="display: flex; flex-direction: column;"> |
| | | <el-input v-model="item.fee" @input="changeFee" type="number" placeholder="请输入金额"></el-input> |
| | | <el-input v-model="item.fee" @input="changeFee()" type="number" placeholder="请输入金额"></el-input> |
| | | <el-input v-model="item.describe" placeholder="请输入费用说明"></el-input> |
| | | </div> |
| | | </el-form-item> |
| | |
| | | }, |
| | | changeFee() { |
| | | let arr = [...this.list1, ...this.list2] |
| | | |
| | | for (let i = 0; i < arr.length; i++) { |
| | | if (!/^\d+(\.\d{1,2})?$/.test(arr[i].fee)) { |
| | | arr[i].fee = 0 |
| | | this.$message.warning('只能输入正数,最多只能输入两位小数') |
| | | } |
| | | } |
| | | |
| | | let price = 0 |
| | | arr.forEach(item => { |
| | | if (item.fee) { |
| | | price += Number(item.fee) |
| | | } |
| | | }) |
| | | this.totalPrice = price |
| | | this.totalPrice = Math.round(price * 100) / 100; |
| | | }, |
| | | confirm() { |
| | | this.$refs.form.validate((valid) => { |