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