|  | @@ -4,7 +4,7 @@
 | 
	
		
			
				|  |  |   * @Author: zzx
 | 
	
		
			
				|  |  |   * @Date: 2024-11-27 16:08:16
 | 
	
		
			
				|  |  |   * @LastEditors: zzx tigerzouzx@foxmail.com
 | 
	
		
			
				|  |  | - * @LastEditTime: 2024-11-28 18:00
 | 
	
		
			
				|  |  | + * @LastEditTime: 2024-12-02 18:00
 | 
	
		
			
				|  |  |  -->
 | 
	
		
			
				|  |  |  <template>
 | 
	
		
			
				|  |  |      <div class="app-container">
 | 
	
	
		
			
				|  | @@ -40,15 +40,16 @@
 | 
	
		
			
				|  |  |                      <template slot-scope="scope">
 | 
	
		
			
				|  |  |                          <span class="edit" v-if="scope.row.isEdit === false"
 | 
	
		
			
				|  |  |                              @click="toggleEdit(scope.row)">{{ scope.row.secondLevelPrice }}</span>
 | 
	
		
			
				|  |  | -                        <el-input v-else v-model="scope.row.secondLevelPrice" :disabled="isAdmin == 3" size="small" style="width: 100px;" @blur="saveEdit(scope.row)">
 | 
	
		
			
				|  |  | +                        <el-input v-else v-model="editInput" size="small" oninput="value=value.replace(/[^\d.]/g,'')" style="width: 200px;" @blur="saveEdit(scope.row)">
 | 
	
		
			
				|  |  | +                            <i slot="suffix" size="small" class="el-icon-check" @click="confrimEdit(scope.row)"></i>
 | 
	
		
			
				|  |  |                              <i slot="suffix" size="small" class="el-icon-close" @click="cancelEdit(scope.row)"></i>
 | 
	
		
			
				|  |  |                          </el-input>
 | 
	
		
			
				|  |  |                      </template>
 | 
	
		
			
				|  |  |                  </el-table-column>
 | 
	
		
			
				|  |  |              </el-table>
 | 
	
		
			
				|  |  |          </div>
 | 
	
		
			
				|  |  | -        <el-divider></el-divider>
 | 
	
		
			
				|  |  | -        <el-card class="operate-container" shadow="hover">
 | 
	
		
			
				|  |  | +        <el-divider v-if="isAdmin!=3"></el-divider>
 | 
	
		
			
				|  |  | +        <el-card class="operate-container" shadow="hover" v-if="isAdmin!=3">
 | 
	
		
			
				|  |  |              <div style="text-align: center;">
 | 
	
		
			
				|  |  |                  <el-button type="primary" size="small" @click="confirmForbidden">提交</el-button>
 | 
	
		
			
				|  |  |                  <el-button type="info" size="small" @click="cancelForbidden">取消</el-button>
 | 
	
	
		
			
				|  | @@ -74,6 +75,8 @@ export default {
 | 
	
		
			
				|  |  |              dialogList: null,
 | 
	
		
			
				|  |  |              dialogListLoading: false,
 | 
	
		
			
				|  |  |              total: null,
 | 
	
		
			
				|  |  | +            editInput: null,
 | 
	
		
			
				|  |  | +            currentEditingRow: null //用于记录当前正在编辑的行
 | 
	
		
			
				|  |  |          };
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      watch: {},
 | 
	
	
		
			
				|  | @@ -86,29 +89,52 @@ export default {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      methods: {
 | 
	
		
			
				|  |  |          toggleEdit(row) {
 | 
	
		
			
				|  |  | +            if (this.currentEditingRow) {
 | 
	
		
			
				|  |  | +                this.currentEditingRow.isEdit = false;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |              row.isEdit = !row.isEdit;
 | 
	
		
			
				|  |  | +            this.editInput = row.secondLevelPrice;
 | 
	
		
			
				|  |  | +            if (row.isEdit) {
 | 
	
		
			
				|  |  | +                this.currentEditingRow = row;
 | 
	
		
			
				|  |  | +                
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                this.currentEditingRow = null;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  | -        cancelEdit(row) {
 | 
	
		
			
				|  |  | -            if (row.firstLevelPrice >= row.platformPrice) {
 | 
	
		
			
				|  |  | -                row.firstLevelPrice = 0
 | 
	
		
			
				|  |  | +        confrimEdit(row) {
 | 
	
		
			
				|  |  | +            if (this.editInput >= row.platformPrice) {
 | 
	
		
			
				|  |  |                  return this.$message.error('分销价格必须小于平台价格');
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            if (row.secondLevelPrice <= row.firstLevelPrice) {
 | 
	
		
			
				|  |  | -                row.secondLevelPrice = 0
 | 
	
		
			
				|  |  | +            if (this.editInput <= row.firstLevelPrice) {
 | 
	
		
			
				|  |  |                  return this.$message.error('二级代理价不能小于一级代理价');
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            row.secondLevelPrice = this.editInput
 | 
	
		
			
				|  |  |              row.isEdit = false
 | 
	
		
			
				|  |  | +            this.currentEditingRow = null;
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  | -        saveEdit(row) {
 | 
	
		
			
				|  |  | -            if (row.secondLevelPrice >= row.platformPrice) {
 | 
	
		
			
				|  |  | -                row.secondLevelPrice = 0
 | 
	
		
			
				|  |  | +        cancelEdit(row) {
 | 
	
		
			
				|  |  | +            if (row.firstLevelPrice >= row.platformPrice) {
 | 
	
		
			
				|  |  |                  return this.$message.error('分销价格必须小于平台价格');
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              if (row.secondLevelPrice <= row.firstLevelPrice) {
 | 
	
		
			
				|  |  | -                row.secondLevelPrice = 0
 | 
	
		
			
				|  |  |                  return this.$message.error('二级代理价不能小于一级代理价');
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              row.isEdit = false
 | 
	
		
			
				|  |  | +            this.currentEditingRow = null;
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        saveEdit(row) {
 | 
	
		
			
				|  |  | +            // if (row.secondLevelPrice >= row.platformPrice) {
 | 
	
		
			
				|  |  | +            //     row.secondLevelPrice = 0
 | 
	
		
			
				|  |  | +            //     return this.$message.error('分销价格必须小于平台价格');
 | 
	
		
			
				|  |  | +            // }
 | 
	
		
			
				|  |  | +            // if (row.secondLevelPrice <= row.firstLevelPrice) {
 | 
	
		
			
				|  |  | +            //     row.secondLevelPrice = 0
 | 
	
		
			
				|  |  | +            //     return this.$message.error('二级代理价不能小于一级代理价');
 | 
	
		
			
				|  |  | +            // }
 | 
	
		
			
				|  |  | +            // row.secondLevelPrice = this.editInput
 | 
	
		
			
				|  |  | +            // console.log(this.editInput,'---输入框');
 | 
	
		
			
				|  |  | +            // console.log(row.secondLevelPrice,'---默认');
 | 
	
		
			
				|  |  | +            // row.isEdit = false
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |          confirmForbidden() {
 | 
	
		
			
				|  |  |              const newArray = this.dialogList.map(item => ({
 | 
	
	
		
			
				|  | @@ -149,7 +175,14 @@ export default {
 | 
	
		
			
				|  |  |      color: #409EFF;
 | 
	
		
			
				|  |  |      cursor: pointer;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | +.el-icon-check{
 | 
	
		
			
				|  |  | +    font-size: 22px;
 | 
	
		
			
				|  |  | +    font-weight: 1000;
 | 
	
		
			
				|  |  | +    color: rgb(103,194,58);
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  |  .el-icon-close{
 | 
	
		
			
				|  |  | -    font-size: 18px;
 | 
	
		
			
				|  |  | +    font-size: 22px;
 | 
	
		
			
				|  |  | +    font-weight: 1000;
 | 
	
		
			
				|  |  | +    color: rgba(240, 10, 10,0.6);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  </style>
 |