运营后台增加CPS金额
This commit is contained in:
@@ -68,3 +68,11 @@ export async function updateProductBrokerage(data) {
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
export async function updateProductCps(data) {
|
||||
const res = await request.put('/car/product/cps', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
width="800px"
|
||||
:visible="visible"
|
||||
:append-to-body="true"
|
||||
:close-on-click-modal="true"
|
||||
custom-class="ele-dialog-form"
|
||||
title="修改CPS"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="金额:" prop="cpsMoney">
|
||||
<el-input
|
||||
clearable
|
||||
type="number"
|
||||
v-model="form.cpsMoney"
|
||||
placeholder="请输入金额"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template v-slot:footer>
|
||||
<el-button @click="updateVisible(false)">取消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="save">
|
||||
保存
|
||||
</el-button>
|
||||
</template>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { updateProductCps } from '@/api/car/product';
|
||||
export default {
|
||||
components: {},
|
||||
props: {
|
||||
// 弹窗是否打开
|
||||
visible: Boolean,
|
||||
// 修改回显的数据
|
||||
data: Object
|
||||
},
|
||||
data() {
|
||||
const defaultForm = {
|
||||
id: null,
|
||||
cpsMoney: ''
|
||||
};
|
||||
return {
|
||||
editVersion: false,
|
||||
defaultForm,
|
||||
// 表单数据
|
||||
form: { ...defaultForm },
|
||||
// 表单验证规则
|
||||
rules: {
|
||||
cpsMoney: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入金额',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
},
|
||||
// 提交状态
|
||||
loading: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 是否开启响应式布局
|
||||
styleResponsive() {
|
||||
return this.$store.state.theme.styleResponsive;
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
/* 保存编辑 */
|
||||
save() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
this.loading = true;
|
||||
const data = {
|
||||
...this.form
|
||||
};
|
||||
updateProductCps(data)
|
||||
.then((msg) => {
|
||||
this.loading = false;
|
||||
this.$message.success(msg);
|
||||
this.updateVisible(false);
|
||||
this.$emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
this.loading = false;
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
});
|
||||
},
|
||||
/* 更新visible */
|
||||
updateVisible(value) {
|
||||
this.$emit('update:visible', value);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
visible(visible) {
|
||||
this.editVersion = false;
|
||||
if (visible) {
|
||||
this.editVersion = true;
|
||||
if (this.data) {
|
||||
this.$util.assignObject(this.form, {
|
||||
...this.data
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.$refs.form.clearValidate();
|
||||
this.form = { ...this.defaultForm };
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.ele-image-upload-list .ele-image-upload-item {
|
||||
margin-top: 2px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
</style>
|
||||
@@ -191,6 +191,7 @@
|
||||
</el-link>
|
||||
<template v-slot:dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="editCps">CPS</el-dropdown-item>
|
||||
<el-dropdown-item command="edit">产品</el-dropdown-item>
|
||||
<el-dropdown-item command="brokerage">佣金</el-dropdown-item>
|
||||
<el-dropdown-item command="coupon">优惠券</el-dropdown-item>
|
||||
@@ -218,6 +219,8 @@
|
||||
:visible.sync="showEditBrokerage"
|
||||
@done="reload"
|
||||
/>
|
||||
<!-- 修改CPS-->
|
||||
<edit-cps :data="current" :visible.sync="showEditCps" @done="reload" />
|
||||
<ele-modal
|
||||
width="800px"
|
||||
:visible.sync="showCityName"
|
||||
@@ -248,10 +251,17 @@
|
||||
import editBrokerage from './components/editBrokerage.vue';
|
||||
import CarModelSelector from '@/components/CarSelector/index.vue';
|
||||
import RegionsSelect from '@/components/RegionsSelect/index.vue';
|
||||
import editCps from './components/editCps.vue';
|
||||
|
||||
export default {
|
||||
name: 'carProduct',
|
||||
components: { RegionsSelect, CarModelSelector, edit, editBrokerage },
|
||||
components: {
|
||||
RegionsSelect,
|
||||
CarModelSelector,
|
||||
edit,
|
||||
editBrokerage,
|
||||
editCps
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
where: {
|
||||
@@ -346,7 +356,9 @@
|
||||
crowdProfiling: [],
|
||||
couponSelling: [],
|
||||
showBizList: false,
|
||||
bizList: []
|
||||
bizList: [],
|
||||
//是否显示修改CPS
|
||||
showEditCps: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -383,6 +395,9 @@
|
||||
query: row ? { id: row.id, title: row.title } : undefined
|
||||
});
|
||||
});
|
||||
} else if (command === 'editCps') {
|
||||
this.current = row;
|
||||
this.showEditCps = true;
|
||||
}
|
||||
},
|
||||
/* 表格数据源 */
|
||||
|
||||
Reference in New Issue
Block a user