|
@@ -21,15 +21,12 @@
|
|
|
</div>
|
|
|
<div style="margin-left: 20px">
|
|
|
<el-descriptions class="margin-top" :column="3" size="medium" border>
|
|
|
- <el-descriptions-item>
|
|
|
- <template slot="label"> 电站 </template>
|
|
|
- {{ name }}
|
|
|
- </el-descriptions-item>
|
|
|
+ <el-descriptions-item label="电站">{{ name }}</el-descriptions-item>
|
|
|
</el-descriptions>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <back-button></back-button>
|
|
|
+ <back-button></back-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-card>
|
|
@@ -37,10 +34,15 @@
|
|
|
<el-table ref="adminTable" :data="dialogList" style="width: 100%" v-loading="dialogListLoading" border>
|
|
|
<el-table-column label="时间段" align="center" prop="time"></el-table-column>
|
|
|
<el-table-column label="销售合计价(元)" align="center" prop="platformPrice"></el-table-column>
|
|
|
- <el-table-column label="一级代理价" align="center" prop="firstLevelPrice"></el-table-column>
|
|
|
- <el-table-column label="二级代理价(元)" align="center">
|
|
|
+ <el-table-column label="一级代理价(元)" align="center" prop="firstLevelPrice" v-if="isAdmin!=3"></el-table-column>
|
|
|
+ <el-table-column label="二级代理价(元)" align="center" prop="secondLevelPrice" v-if="isAdmin==3"></el-table-column>
|
|
|
+ <el-table-column label="二级代理价(元)" align="center" v-else>
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.secondLevelPrice" :disabled="isAdmin==3" size="small" style="width: 80px;" @blur="saveEdit(scope.row)"></el-input>
|
|
|
+ <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)">
|
|
|
+ <i slot="suffix" size="small" class="el-icon-close" @click="cancelEdit(scope.row)"></i>
|
|
|
+ </el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -48,7 +50,8 @@
|
|
|
<el-divider></el-divider>
|
|
|
<el-card class="operate-container" shadow="hover">
|
|
|
<div style="text-align: center;">
|
|
|
- <el-button type="primary" @click="confirmForbidden">提交</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="confirmForbidden">提交</el-button>
|
|
|
+ <el-button type="info" size="small" @click="cancelForbidden">取消</el-button>
|
|
|
</div>
|
|
|
</el-card>
|
|
|
</div>
|
|
@@ -82,30 +85,41 @@ export default {
|
|
|
this.getList();
|
|
|
},
|
|
|
methods: {
|
|
|
- priceEdit( row) {
|
|
|
- row.isEdit = true;
|
|
|
- console.log(row);
|
|
|
+ toggleEdit(row) {
|
|
|
+ row.isEdit = !row.isEdit;
|
|
|
+ },
|
|
|
+ cancelEdit(row) {
|
|
|
+ if (row.firstLevelPrice >= row.platformPrice) {
|
|
|
+ row.firstLevelPrice = 0
|
|
|
+ return this.$message.error('分销价格必须小于平台价格');
|
|
|
+ }
|
|
|
+ if (row.secondLevelPrice <= row.firstLevelPrice) {
|
|
|
+ row.secondLevelPrice = 0
|
|
|
+ return this.$message.error('二级代理价不能小于一级代理价');
|
|
|
+ }
|
|
|
+ row.isEdit = false
|
|
|
},
|
|
|
saveEdit(row) {
|
|
|
- if(row.secondLevelPrice>=row.platformPrice){
|
|
|
- row.secondLevelPrice=0
|
|
|
+ if (row.secondLevelPrice >= row.platformPrice) {
|
|
|
+ row.secondLevelPrice = 0
|
|
|
return this.$message.error('分销价格必须小于平台价格');
|
|
|
}
|
|
|
- if(row.secondLevelPrice<=row.firstLevelPrice){
|
|
|
- row.secondLevelPrice=0
|
|
|
+ if (row.secondLevelPrice <= row.firstLevelPrice) {
|
|
|
+ row.secondLevelPrice = 0
|
|
|
return this.$message.error('二级代理价不能小于一级代理价');
|
|
|
}
|
|
|
+ row.isEdit = false
|
|
|
},
|
|
|
confirmForbidden() {
|
|
|
- const newArray=this.dialogList.map(item=>({
|
|
|
- adminUserId:this.listQuery.adminUserId,
|
|
|
- firstLevelPrice:item.firstLevelPrice,
|
|
|
- id:item.id,
|
|
|
- platformPrice:item.platformPrice,
|
|
|
- secondLevelPrice:item.secondLevelPrice,
|
|
|
- servicePrice:new Big(item.platformPrice).minus(new Big(item.secondLevelPrice)).toNumber(),
|
|
|
- stationId:this.listQuery.stationId,
|
|
|
- time:item.time
|
|
|
+ const newArray = this.dialogList.map(item => ({
|
|
|
+ adminUserId: this.listQuery.adminUserId,
|
|
|
+ firstLevelPrice: item.firstLevelPrice,
|
|
|
+ id: item.id,
|
|
|
+ platformPrice: item.platformPrice,
|
|
|
+ secondLevelPrice: item.secondLevelPrice,
|
|
|
+ servicePrice: new Big(item.platformPrice).minus(new Big(item.secondLevelPrice)).toNumber(),
|
|
|
+ stationId: this.listQuery.stationId,
|
|
|
+ time: item.time
|
|
|
}))
|
|
|
settingsPrice(newArray).then((res) => {
|
|
|
if (res.code == 200) {
|
|
@@ -114,17 +128,28 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ cancelForbidden() {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
getList() {
|
|
|
this.dialogListLoading = true;
|
|
|
priceList(this.listQuery).then((response) => {
|
|
|
this.dialogListLoading = false;
|
|
|
this.dialogList = response.data;
|
|
|
this.dialogList.map(item => {
|
|
|
- item.isEdit=false
|
|
|
+ this.$set(item, 'isEdit', false); //初始化为 false
|
|
|
})
|
|
|
});
|
|
|
},
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
-<style scoped></style>
|
|
|
+<style scoped>
|
|
|
+.edit{
|
|
|
+ color: #409EFF;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
+.el-icon-close{
|
|
|
+ font-size: 18px;
|
|
|
+}
|
|
|
+</style>
|