Commit 87ca1fc8 authored by 蒙文昊's avatar 蒙文昊

Merge branch 'pyq' into 'dev'

Pyq

See merge request bp/op-web-service!9
parents 60b71f6c 69a54967
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
align="center" align="center"
prop="commission_mode" prop="good_count"
label="关联商品数" label="关联商品数"
> >
</el-table-column> </el-table-column>
...@@ -185,7 +185,8 @@ ...@@ -185,7 +185,8 @@
</el-form-item> </el-form-item>
<el-form-item label="一级佣金:" prop="first_commission_value"> <el-form-item label="一级佣金:" prop="first_commission_value">
<el-input <el-input
v-model.number="ruleForm.first_commission_value" v-model="ruleForm.first_commission_value"
@input="changeValue($event,'first_commission_value')"
:disabled="shopStart !== 0" :disabled="shopStart !== 0"
> >
<template #append>%</template> <template #append>%</template>
...@@ -193,7 +194,8 @@ ...@@ -193,7 +194,8 @@
</el-form-item> </el-form-item>
<el-form-item label="二级佣金: " prop="second_commission_value"> <el-form-item label="二级佣金: " prop="second_commission_value">
<el-input <el-input
v-model.number="ruleForm.second_commission_value" v-model="ruleForm.second_commission_value"
@input="changeValue($event,'second_commission_value')"
:disabled="shopStart !== 0" :disabled="shopStart !== 0"
> >
<template #append>%</template> <template #append>%</template>
...@@ -289,16 +291,17 @@ ...@@ -289,16 +291,17 @@
</div> </div>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button type="primary" @click="cancel" style="width: 150px">{{
shopStart == 0 ? "取消" : "返回"
}}</el-button>
<el-button <el-button
type="primary" type="primary"
@click="addList" @click="addList"
style="width: 150px"
v-if="shopStart == 0" v-if="shopStart == 0"
>确 定</el-button style="width: 150px"
>保存</el-button
> >
<!-- {{
shopStart == 0 ? "返回" : "返回"
}} -->
<el-button type="primary" @click="cancel" style="width: 150px">返回</el-button>
</span> </span>
</template> </template>
</el-dialog> </el-dialog>
...@@ -329,11 +332,16 @@ export default { ...@@ -329,11 +332,16 @@ export default {
name: "GoodsRetail", name: "GoodsRetail",
data() { data() {
var commission = (rule, value, callback) => { var commission = (rule, value, callback) => {
if(this.ruleForm.first_commission_value + this.ruleForm.second_commission_value > 50 || value > 50) { if (
this.ruleForm.first_commission_value +
this.ruleForm.second_commission_value >
50 ||
value > 50
) {
callback(new Error("一级佣金与二级佣金之和不可大于50%")); callback(new Error("一级佣金与二级佣金之和不可大于50%"));
}else { } else {
callback(); callback();
} }
}; };
return { return {
tableData: [], tableData: [],
...@@ -376,25 +384,25 @@ export default { ...@@ -376,25 +384,25 @@ export default {
life_account_id: "", life_account_id: "",
goods_sku_id: "", goods_sku_id: "",
start_time: "", start_time: "",
end_time: "" end_time: "",
}, },
rules: { rules: {
marketing_name: [ marketing_name: [
{ required: true, message: "请输入活动名称", trigger: "blur" }, { required: true, message: "请输入活动名称", trigger: "blur" },
{ min: 1, max: 50, message: "长度在 50个字符内", trigger: "blur" } { min: 1, max: 50, message: "活动名称不能大于50", trigger: "blur" },
], ],
first_commission_value: [ first_commission_value: [
{ {
required: true, required: true,
message: "请填写一级佣金", message: "请填写一级佣金",
trigger: "blur" trigger: "blur",
}, },
{ type: "number", message: "必须为数值型" }, { type: "number", message: "必须为数值型" },
{ validator: commission } { validator: commission },
], ],
second_commission_value: [ second_commission_value: [
{ type: "number", message: "必须为数值型" }, { type: "number", message: "必须为数值型" },
{ validator: commission } { validator: commission },
], ],
}, },
allList: [], allList: [],
...@@ -404,10 +412,13 @@ export default { ...@@ -404,10 +412,13 @@ export default {
endTime: "", endTime: "",
marketing_id: "", marketing_id: "",
marketing_info: {}, marketing_info: {},
disabled: false disabled: false,
}; };
}, },
methods: { methods: {
changeValue(value,level){
value && value.indexOf('.')!==value.length-1 &&(this.ruleForm[level] = parseFloat(value))
},
// 查看详情列表 // 查看详情列表
async handleClick(row) { async handleClick(row) {
this.dialogFormVisible = true; this.dialogFormVisible = true;
...@@ -446,7 +457,7 @@ export default { ...@@ -446,7 +457,7 @@ export default {
try { try {
const res = await updateMarketingList({ const res = await updateMarketingList({
marketing_id: row.marketing_id, marketing_id: row.marketing_id,
online_status: type online_status: type,
}); });
if (res.code !== 0) { if (res.code !== 0) {
ElMessage.error(res.reason); ElMessage.error(res.reason);
...@@ -471,7 +482,7 @@ export default { ...@@ -471,7 +482,7 @@ export default {
goods_sku_id: "", goods_sku_id: "",
online_status: [], online_status: [],
page: 1, page: 1,
page_size: 20 page_size: 20,
}), }),
this.$refs[retailActivitie].resetFields(); this.$refs[retailActivitie].resetFields();
this.getMarketingList({}); this.getMarketingList({});
...@@ -529,7 +540,7 @@ export default { ...@@ -529,7 +540,7 @@ export default {
goods_sku_id, goods_sku_id,
life_account_id, life_account_id,
start_time, start_time,
end_time end_time,
}; };
try { try {
// 发请求 // 发请求
...@@ -547,7 +558,7 @@ export default { ...@@ -547,7 +558,7 @@ export default {
async getAllList() { async getAllList() {
let all = await getMarketingList({ let all = await getMarketingList({
page: 1, page: 1,
page_size: this.retailActivitie.count page_size: this.retailActivitie.count,
}); });
this.allList = all.result; this.allList = all.result;
}, },
...@@ -568,7 +579,7 @@ export default { ...@@ -568,7 +579,7 @@ export default {
let { let {
marketing_name, marketing_name,
first_commission_value, first_commission_value,
second_commission_value second_commission_value,
} = this.ruleForm; } = this.ruleForm;
let [start_time, end_time] = this.timeSelect; let [start_time, end_time] = this.timeSelect;
if ( if (
...@@ -586,7 +597,7 @@ export default { ...@@ -586,7 +597,7 @@ export default {
first_commission_value, first_commission_value,
second_commission_value, second_commission_value,
start_time: this.formatTime(start_time), start_time: this.formatTime(start_time),
end_time: this.formatTime(end_time) end_time: this.formatTime(end_time),
}; };
try { try {
const res = await getAddMarketingList(addParams); const res = await getAddMarketingList(addParams);
...@@ -604,7 +615,7 @@ export default { ...@@ -604,7 +615,7 @@ export default {
} }
}); });
}, },
// 清空 // 清空
resetDate() { resetDate() {
(this.ruleForm = { (this.ruleForm = {
...@@ -613,7 +624,7 @@ export default { ...@@ -613,7 +624,7 @@ export default {
second_commission_value: "", second_commission_value: "",
start_time: "", start_time: "",
end_time: "", end_time: "",
goods_sku_id: [] goods_sku_id: [],
}), }),
(this.timeSelect = []), (this.timeSelect = []),
(this.goods_list = []), (this.goods_list = []),
...@@ -621,7 +632,7 @@ export default { ...@@ -621,7 +632,7 @@ export default {
life_account_id: "", life_account_id: "",
goods_sku_id: "", goods_sku_id: "",
start_time: "", start_time: "",
end_time: "" end_time: "",
}); });
}, },
// 取消 // 取消
...@@ -629,12 +640,12 @@ export default { ...@@ -629,12 +640,12 @@ export default {
this.dialogFormVisible = false; this.dialogFormVisible = false;
this.resetDate(); this.resetDate();
this.getMarketingList(); this.getMarketingList();
} },
}, },
created() { created() {
this.getMarketingList(); this.getMarketingList();
this.getAllList(); this.getAllList();
} },
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment