Commit 3ef276e0 authored by 罗超's avatar 罗超

Merge branch 'master' of http://gitlab.oytour.com/luochao/confucius into master

parents 8d50487e 09607817
<template> <template>
<q-dialog <q-dialog v-model="persistent" persistent content-class="bg-grey-1" transition-show="scale" transition-hide="scale">
v-model="persistent"
persistent
content-class="bg-grey-1"
transition-show="scale"
transition-hide="scale"
>
<q-card style="width: 850px;max-width:950px;"> <q-card style="width: 850px;max-width:950px;">
<q-card-section> <q-card-section>
<div class="text-h6">设置课程价格</div> <div class="text-h6">设置课程价格</div>
...@@ -13,479 +7,273 @@ ...@@ -13,479 +7,273 @@
<q-card-section class="q-pt-none scroll" style="max-height: 70vh"> <q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="text-caption q-mb-lg text-grey-6">基础价格设置</div> <div class="text-caption q-mb-lg text-grey-6">基础价格设置</div>
<div class="row wrap"> <div class="row wrap">
<!-- <div class="col-6">
<q-input
filled
stack-label
maxlength="8"
:dense="false"
v-model="priceObj.courseObj.OriginalPrice"
ref="OriginalPrice"
class="col-6 q-pr-lg q-pb-lg"
label="基础收费"
style="display:none;"
@keyup.native="checkPrice(priceObj.courseObj, 'OriginalPrice')"
:rules="[val => !!val || '请填写基础收费']"
/>
</div> -->
<div class="col-6"> <div class="col-6">
<q-input <q-input filled stack-label maxlength="8" :dense="false" v-model="priceObj.courseObj.SellPrice"
filled ref="SellPrice" class="col-6 q-pr-lg q-pb-lg" label="卖价"
stack-label @keyup.native="checkPrice(priceObj.courseObj, 'SellPrice')" :rules="[val => !!val || '请填写卖价']" />
maxlength="8"
:dense="false"
v-model="priceObj.courseObj.SellPrice"
ref="SellPrice"
class="col-6 q-pr-lg q-pb-lg"
label="直客价"
@keyup.native="checkPrice(priceObj.courseObj, 'SellPrice')"
:rules="[val => !!val || '请填写直客价']"
/>
</div>
<div class="col-6">
<q-input
filled
stack-label
maxlength="8"
:dense="false"
v-model="priceObj.courseObj.B2BPrice"
ref="B2BPrice"
class="col-6 q-pr-lg q-pb-lg"
label="同业价"
@keyup.native="checkPrice(priceObj.courseObj, 'B2BPrice')"
:rules="[val => !!val || '请填写同业价']"
/>
</div>
</div>
<div class="row wrap">
<div class="col-6">
<q-input
filled
stack-label
:dense="false"
v-model="priceObj.courseObj.B2BRebateRatio"
ref="B2BRebateRatio"
class="col-6 q-pr-lg"
label="同行返佣比例"
@keyup.native="checkPrice(priceObj.courseObj, 'B2BRebateRatio')"
suffix="%"
/>
</div>
<div class="col-6">
<q-input
filled
stack-label
:dense="false"
v-model="priceObj.courseObj.B2BReNewRatio"
ref="B2BReNewRatio"
class="col-6 q-pr-lg q-pb-lg"
label="一般同行续费返佣比例"
@keyup.native="checkPrice(priceObj.courseObj, 'B2BReNewRatio')"
suffix="%"
/>
</div>
</div>
<div class="row wrap">
<div class="col-6">
<q-input
filled
stack-label
:dense="false"
v-model="priceObj.courseObj.SchoolRebateRatio"
ref="SchoolRebateRatio"
class="col-6 q-pr-lg q-pb-lg"
label="校园同行返佣比例"
@keyup.native="checkPrice(priceObj.courseObj, 'SchoolRebateRatio')"
suffix="%"
/>
</div>
<div class="col-6">
<q-input
filled
stack-label
:dense="false"
v-model="priceObj.courseObj.SchoolReNewRatio"
ref="SchoolReNewRatio"
class="col-6 q-pr-lg q-pb-lg"
label="校园同行续费返佣比例"
@keyup.native="checkPrice(priceObj.courseObj, 'SchoolReNewRatio')"
suffix="%"
/>
</div> </div>
</div> </div>
<div class="q-pt-none scroll" style="max-height:60hv;display:none;"> <div class="text-caption q-mb-lg text-grey-6">优惠</div>
<table> <table>
<thead> <tr>
<tr style="height:60px;"> <th>
<td colspan="5" style="text-align:right;"> 优惠
<q-btn </th>
color="accent" <th>
size="sm" 首次报名优惠
icon="add" </th>
label="新增优惠" <th>
@click="addPrice()" 续费报名优惠
/> </th>
</td> </tr>
</tr> <tr>
<tr> <td>
<td style="width:200px"> 直客优惠
优惠类型 </td>
</td> <td>
<td style="width:200px"> <q-input filled stack-label :dense="false" v-model="priceObj.courseObj.B2CRatio" ref="B2CRatio"
优惠条件 @keyup.native="checkPrice(priceObj.courseObj, 'B2CRatio')" suffix="%" />
</td> </td>
<td style="width:140px"> <td>
同行返佣 <q-input filled stack-label :dense="false" v-model="priceObj.courseObj.B2CReNewRatio" ref="B2CReNewRatio"
</td> @keyup.native="checkPrice(priceObj.courseObj, 'B2CReNewRatio')" suffix="%" />
<td style="width:140px"> </td>
销售返佣 </tr>
</td> </table>
<td style="width:140px">
教育同行返佣 <div class="text-caption q-mb-lg text-grey-6">返佣</div>
</td> <table>
<td> <tr>
操作 <th>同行
</td> </th>
</tr> <th>
</thead> 首次报名返佣比例
<tbody v-for="(item, index) in priceObj.priceList"> </th>
<tr> <th>
<td style="height:50px"> 续费报名返佣比例
<q-select </th>
filled </tr>
stack-label <tr>
option-value="Id" <td>
option-label="Name" 一般同行
v-model="item.PriceDiscountType" </td>
ref="PriceDiscountType_Id" <td>
:options="priceTypeList" <q-input filled stack-label :dense="false" v-model="priceObj.courseObj.B2BRebateRatio"
label="优惠类型" ref="B2BRebateRatio" @keyup.native="checkPrice(priceObj.courseObj, 'B2BRebateRatio')" suffix="%" />
style="width:160px" </td>
dense <td>
emit-value <q-input filled stack-label :dense="false" v-model="priceObj.courseObj.B2BReNewRatio" ref="B2BReNewRatio"
map-options @keyup.native="checkPrice(priceObj.courseObj, 'B2BReNewRatio')" suffix="%" />
/> </td>
</td> </tr>
<td> <tr>
<!--买送--> <td>
<template v-if="item.PriceDiscountType == 1"> 校代
<q-input </td>
filled <td>
stack-label <q-input filled stack-label :dense="false" v-model="priceObj.courseObj.SchoolRebateRatio"
dense ref="SchoolRebateRatio" @keyup.native="checkPrice(priceObj.courseObj, 'SchoolRebateRatio')"
v-model="item.BuyNum" suffix="%" />
ref="BuyNum" </td>
label="买" <td>
@keyup.native="checkPrice(item, 'BuyNum')" <q-input filled stack-label :dense="false" v-model="priceObj.courseObj.SchoolReNewRatio"
style="width:80px;display:inline-block;" ref="SchoolReNewRatio" @keyup.native="checkPrice(priceObj.courseObj, 'SchoolReNewRatio')" suffix="%" />
suffix="" </td>
/> </tr>
<q-input <tr>
filled <td>
stack-label 转介
class="q-ml-xs" </td>
v-model="item.SendNum" <td>
ref="SendNum" <q-input filled stack-label :dense="false" v-model="priceObj.courseObj.TransIntroductceRatio"
dense ref="TransIntroductceRatio" @keyup.native="checkPrice(priceObj.courseObj, 'TransIntroductceRatio')"
label="送" suffix="%" />
@keyup.native="checkPrice(item, 'SendNum')" </td>
style="width:80px;display:inline-block;" <td>
suffix="" <q-input filled stack-label :dense="false" v-model="priceObj.courseObj.TransIntroductceReNewRatio"
> ref="TransIntroductceReNewRatio"
</q-input> @keyup.native="checkPrice(priceObj.courseObj, 'TransIntroductceReNewRatio')" suffix="%" />
</template> </td>
<!--刷卡分期--> </tr>
<template v-else-if="item.PriceDiscountType == 5"> </template> <tr>
<template v-else> <td>
<q-input 内推
filled </td>
stack-label <td>
dense <q-input filled stack-label :dense="false" v-model="priceObj.courseObj.InnerRecommendRatio"
v-model="item.PriceMoney" ref="InnerRecommendRatio" @keyup.native="checkPrice(priceObj.courseObj, 'InnerRecommendRatio')"
ref="PriceMoney" suffix="%" />
label="优惠" </td>
@keyup.native="checkPrice(item, 'PriceMoney')" <td>
style="width:120px" <q-input filled stack-label :dense="false" v-model="priceObj.courseObj.InnerRecommendReNewRatio"
suffix="%" ref="InnerRecommendReNewRatio"
/> @keyup.native="checkPrice(priceObj.courseObj, 'InnerRecommendReNewRatio')" suffix="%" />
</template> </td>
</td> </tr>
<td> </table>
<q-input
filled
stack-label
dense
v-model="item.B2BCommissionMoney"
ref="B2BCommissionMoney"
label="同行返佣"
@keyup.native="checkPrice(item, 'B2BCommissionMoney')"
style="width:100px"
>
<template v-slot:append>
<div class="text-dark text-center text-dark cursor-pointer" style="width:30px;margin-right:-12px;height:100%;font-size:14px;border-left:1px solid #ddd;padding-top:15px;" >
<span>{{item.B2BCommissionType==0?'%':'¥'}}</span>
<q-menu auto-close>
<q-list>
<q-item clickable v-close-popup @click="item.B2BCommissionType=0">
<q-item-section>按百分比(%)</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="item.B2BCommissionType=1">
<q-item-section>按固定额度(¥)</q-item-section>
</q-item>
</q-list>
</q-menu>
</div>
</template>
</q-input>
</td>
<td>
<q-input
filled
stack-label
dense
v-model="item.SaleCommissionMoney"
ref="SaleCommissionMoney"
label="销售返佣"
@keyup.native="checkPrice(item, 'SaleCommissionMoney')"
class="q-pr-none"
style="width:100px"
>
<template v-slot:append>
<div class="text-dark text-center text-dark cursor-pointer" style="width:30px;margin-right:-12px;height:100%;font-size:14px;border-left:1px solid #ddd;padding-top:15px;" >
<span>{{item.SaleCommissionType==0?'%':'¥'}}</span>
<q-menu auto-close>
<q-list>
<q-item clickable v-close-popup @click="item.SaleCommissionType=0">
<q-item-section>按百分比(%)</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="item.SaleCommissionType=1">
<q-item-section>按固定额度(¥)</q-item-section>
</q-item>
</q-list>
</q-menu>
</div>
</template>
</q-input>
</td>
<td>
<q-input
filled
stack-label
dense
v-model="item.EduCommissionMoney"
ref="EduCommissionMoney"
label="教育同行"
@keyup.native="checkPrice(item, 'EduCommissionMoney')"
class="q-pr-none"
style="width:100px"
>
<template v-slot:append>
<div class="text-dark text-center text-dark cursor-pointer" style="width:30px;margin-right:-12px;height:100%;font-size:14px;border-left:1px solid #ddd;padding-top:15px;" >
<span>{{item.EduCommissionType==0?'%':'¥'}}</span>
<q-menu auto-close>
<q-list>
<q-item clickable v-close-popup @click="item.EduCommissionType=0">
<q-item-section>按百分比(%)</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="item.EduCommissionType=1">
<q-item-section>按固定额度(¥)</q-item-section>
</q-item>
</q-list>
</q-menu>
</div>
</template>
</q-input>
</td>
<td>
<q-btn
flat
size="xs"
icon="iconfont icon-shanchu"
title="删除"
color="negative"
style="font-weight:400"
class="q-mr-xs"
label=""
@click="delPrice(index)"
/>
</td>
</tr>
</tbody>
</table>
</div>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
<q-card-actions align="right" class="bg-white"> <q-card-actions align="right" class="bg-white">
<q-btn <q-btn label="取消" flat color="grey-10" style="font-weight:400 !important" @click="closeCourseForm" />
label="取消" <q-btn label="立即提交" color="accent q-px-md" style="font-weight:400 !important" :loading="saveCourseLoading"
flat @click="saveCourse" />
color="grey-10"
style="font-weight:400 !important"
@click="closeCourseForm"
/>
<q-btn
label="立即提交"
color="accent q-px-md"
style="font-weight:400 !important"
:loading="saveCourseLoading"
@click="saveCourse"
/>
</q-card-actions> </q-card-actions>
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>
<script> <script>
import { import {
saveCoursePreferential, saveCoursePreferential,
queryCoursePreferentialList, queryCoursePreferentialList,
queryCourseInfo, queryCourseInfo,
queryCoursePreferentialType queryCoursePreferentialType
} from "../../api/course/index"; } from "../../api/course/index";
export default { export default {
components: {}, components: {},
props: { props: {
saveObj: { saveObj: {
type: Object, type: Object,
default: null default: null
} }
},
data() {
return {
persistent: true,
optionTitle: "",
saveCourseLoading: false,
//价格对象
priceObj: {
courseObj: {
CourseId: 0, //课程编号
OriginalPrice: 0, //原价
SellPrice: 0, //售价
B2BPrice: 0, //同业价
B2BRebateRatio: 0, //一般同行返佣比例
SchoolRebateRatio: 0, //校园同行返佣比例
B2BReNewRatio:0 ,//一般同行续费返佣比例
SchoolReNewRatio:0 //校园同行返佣比例
},
priceList: [] //价格列表
},
priceTypeList: [] //优惠类型列表
};
},
created() {
this.getTypeList();
},
mounted() {
this.initObj();
},
methods: {
//获取优惠类型列表
getTypeList() {
queryCoursePreferentialType().then(res => {
this.priceTypeList = res.Data;
});
}, },
//新增价格 data() {
addPrice() { return {
var currentObj = { persistent: true,
Id: 0, //主键编号 optionTitle: "",
CourseId: 0, //课程编号 saveCourseLoading: false,
PreferentialTerms: "", //优惠条件 //价格对象
SaleCommissionType: 0, //销售返佣类型(0-百分比,1-固定金额) priceObj: {
SaleCommissionMoney: 0, //销售返佣 courseObj: {
B2BCommissionType: 0, //同行返佣类型(0-百分比,1-固定金额) CourseId: 0, //课程编号
B2BCommissionMoney: 0, //同行返佣 OriginalPrice: 0, //原价
EduCommissionType: 0, //教育返佣类型 SellPrice: 0, //售价
EduCommissionMoney: 0, //教育同行佣金 B2BPrice: 0, //同业价
PriceDiscountType: 0, //课程价格优惠类型(见枚举) B2BRebateRatio: 0, //一般同行返佣比例
BuyNum: 0, //购买人数 SchoolRebateRatio: 0, //校园同行返佣比例
SendNum: 0, //赠送人数 B2BReNewRatio: 0, //一般同行续费返佣比例
PriceType: 0, //优惠价格类型(0-百分比,1-固定金额) SchoolReNewRatio: 0 //校园同行返佣比例
PriceMoney: 0 //优惠金额 },
priceList: [] //价格列表
},
priceTypeList: [] //优惠类型列表
}; };
this.priceObj.priceList.push(currentObj);
}, },
//删除价格 created() {
delPrice(index) { this.getTypeList();
this.priceObj.priceList.splice(index, 1);
},
//初始化表单
initObj() {
if (this.saveObj && this.saveObj.CourseId > 0) {
queryCourseInfo({
CourseId: this.saveObj.CourseId
}).then(res => {
this.priceObj.courseObj.CourseId = res.Data.CourseId;
this.priceObj.courseObj.OriginalPrice = res.Data.OriginalPrice;
this.priceObj.courseObj.SellPrice = res.Data.SellPrice;
});
queryCoursePreferentialList({
CourseId: this.saveObj.CourseId
}).then(res => {
if (res.Code == 1 && res.Data) {
this.priceObj.priceList = res.Data;
}
});
this.optionTitle = "修改课程优惠信息";
} else {
this.optionTitle = "新增课程优惠信息";
this.priceObj.courseObj.CourseId = 0;
this.priceObj.courseObj.OriginalPrice = 0;
this.priceObj.courseObj.SellPrice = 0;
}
}, },
//关闭弹窗 mounted() {
closeCourseForm() { this.initObj();
this.$emit("close");
this.persistent = false;
}, },
//保存菜单 methods: {
saveCourse() { //获取优惠类型列表
if (this.priceObj.priceList && this.priceObj.priceList.length > 0) { getTypeList() {
this.priceObj.priceList.forEach(item => { queryCoursePreferentialType().then(res => {
if (item.BuyNum == "") { this.priceTypeList = res.Data;
item.BuyNum = 0;
}
if (item.SendNum == "") {
item.SendNum = 0;
}
if (item.PriceMoney == "") {
item.PriceMoney = 0;
}
if (item.B2BCommissionMoney == "") {
item.B2BCommissionMoney = 0;
}
if (item.SaleCommissionMoney == "") {
item.SaleCommissionMoney = 0;
}
if (item.EduCommissionMoney == "") {
item.EduCommissionMoney = 0;
}
}); });
} },
//新增价格
this.$refs.SellPrice.validate(); addPrice() {
this.$refs.B2BPrice.validate(); var currentObj = {
if (!this.$refs.SellPrice.hasError && !this.$refs.B2BPrice.hasError){ Id: 0, //主键编号
this.saveCourseLoading = true; CourseId: 0, //课程编号
saveCoursePreferential(this.priceObj) PreferentialTerms: "", //优惠条件
.then(res => { SaleCommissionType: 0, //销售返佣类型(0-百分比,1-固定金额)
this.saveCourseLoading = false; SaleCommissionMoney: 0, //销售返佣
this.$q.notify({ B2BCommissionType: 0, //同行返佣类型(0-百分比,1-固定金额)
icon: "iconfont icon-chenggong", B2BCommissionMoney: 0, //同行返佣
color: "accent", EduCommissionType: 0, //教育返佣类型
timeout: 2000, EduCommissionMoney: 0, //教育同行佣金
message: "数据保存成功!", PriceDiscountType: 0, //课程价格优惠类型(见枚举)
position: "top" BuyNum: 0, //购买人数
SendNum: 0, //赠送人数
PriceType: 0, //优惠价格类型(0-百分比,1-固定金额)
PriceMoney: 0 //优惠金额
};
this.priceObj.priceList.push(currentObj);
},
//删除价格
delPrice(index) {
this.priceObj.priceList.splice(index, 1);
},
//初始化表单
initObj() {
if (this.saveObj && this.saveObj.CourseId > 0) {
queryCourseInfo({
CourseId: this.saveObj.CourseId
}).then(res => {
this.priceObj.courseObj.CourseId = res.Data.CourseId;
this.priceObj.courseObj.OriginalPrice = res.Data.OriginalPrice;
this.priceObj.courseObj.SellPrice = res.Data.SellPrice;
});
queryCoursePreferentialList({
CourseId: this.saveObj.CourseId
}).then(res => {
if (res.Code == 1 && res.Data) {
this.priceObj.priceList = res.Data;
}
});
this.optionTitle = "修改课程优惠信息";
} else {
this.optionTitle = "新增课程优惠信息";
this.priceObj.courseObj.CourseId = 0;
this.priceObj.courseObj.OriginalPrice = 0;
this.priceObj.courseObj.SellPrice = 0;
}
},
//关闭弹窗
closeCourseForm() {
this.$emit("close");
this.persistent = false;
},
//保存菜单
saveCourse() {
if (this.priceObj.priceList && this.priceObj.priceList.length > 0) {
this.priceObj.priceList.forEach(item => {
if (item.BuyNum == "") {
item.BuyNum = 0;
}
if (item.SendNum == "") {
item.SendNum = 0;
}
if (item.PriceMoney == "") {
item.PriceMoney = 0;
}
if (item.B2BCommissionMoney == "") {
item.B2BCommissionMoney = 0;
}
if (item.SaleCommissionMoney == "") {
item.SaleCommissionMoney = 0;
}
if (item.EduCommissionMoney == "") {
item.EduCommissionMoney = 0;
}
});
}
this.$refs.SellPrice.validate();
this.$refs.B2BPrice.validate();
if (!this.$refs.SellPrice.hasError && !this.$refs.B2BPrice.hasError) {
this.saveCourseLoading = true;
saveCoursePreferential(this.priceObj)
.then(res => {
this.saveCourseLoading = false;
this.$q.notify({
icon: "iconfont icon-chenggong",
color: "accent",
timeout: 2000,
message: "数据保存成功!",
position: "top"
});
this.$emit("success");
this.closeSaveForm();
})
.catch(() => {
this.saveCourseLoading = false;
}); });
this.$emit("success"); }
this.closeSaveForm();
})
.catch(() => {
this.saveCourseLoading = false;
});
} }
} }
} };
}; </script>
</script> \ No newline at end of file
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