Commit 63701d4f authored by 黄奎's avatar 黄奎
parents 88ebb97f 24581d89
<template>
<q-card class="q-px-md" style="width:850px;max-width:900px;">
<q-card-section class="row items-center q-pb-none">
<div class="text-h6">改价</div>
<q-space />
<q-btn icon="close" flat round dense v-close-popup />
</q-card-section>
<q-card-section style="max-height:75vh;" class="scroll">
<div class="row">
<div class="col q-mr-md">
<q-input standout bottom-slots v-model="model.Name" ref="Name" label="报价单名称" dense readonly />
</div>
<div class="col">
<q-select dense standout behavior="menu" v-model="model.CustomerSource" ref="CustomerSource"
:options="CustomerSources" option-label="name" option-value="id" label="客户来源" emit-value map-options
:rules="[val => !!val || '请选择客户来源']" readonly />
</div>
</div>
<div class="row">
<div class="col q-mr-md">
<q-select dense standout behavior="menu" v-model="model.CustomerType" ref="CustomerType"
:options="CustomerTypes" option-label="name" option-value="id" label="客户类型" emit-value map-options
:rules="[val => !!val || '请选择客户类型']" readonly />
</div>
<div class="col">
<q-input standout bottom-slots v-model="model.JoinNum" ref="JoinNum" label="报名人数" dense mask="#" fill-mask="0"
reverse-fill-mask :rules="[val => !!val || '请输入报名人数']" readonly>
<template v-slot:append>
<span style="font-size:14px;"></span>
</template>
</q-input>
</div>
</div>
<div class="row">
<div class="col q-mr-md">
<q-input standout bottom-slots v-model="model.CustomerName" ref="CustomerName" label="客户姓名" dense
:rules="[val => !!val || '请输入客户姓名']" readonly />
</div>
<div class="col">
<q-input standout bottom-slots v-model="model.CustomerTel" label="客户电话" dense mask="#" reverse-fill-mask
readonly />
</div>
</div>
<div class="row">
<div class="col q-mr-md">
<q-input standout bottom-slots v-model="model.EffectiveEnd" ref="CustomerName" label="报价有效期" dense
:rules="[val => !!val || '']" readonly />
</div>
<div class="col">
</div>
</div>
<div class="text-subtitle2 text-weight-bold q-mb-md">
<span>课程信息</span>
</div>
<div class="q-mt-md">
<q-table :pagination="pageInfo" no-data-label="暂无相关数据" flat
class="sticky-header-table sticky-right-column-table no-bottom-table" separator="none" :data="chosenCourses"
:columns="columns" row-key="name">
<template v-slot:body-cell-DiscountRemark="props">
<q-td :props="props" class="text-negative">
<div v-for="(x, i) in props.value.split('^')" style="border-bottom:1px dotted #f5f6f7;">
{{ x }}
</div>
</q-td>
</template>
<template v-slot:body-cell-DiscountPrice="props">
<q-td :props="props">
<span>{{props.row.DiscountPrice}}</span>&nbsp;
<i class="iconfont icon-edit" @click.stop="getClassItem(props.row)" title="点击修改价格">
<q-popup-proxy>
<q-banner v-if="isShowEdit">
<div class="calenderDialog" style="width:300px;">
<div style="margin:10px 0 15px 0;">设置价格</div>
<q-input standout bottom-slots filled v-model="priceMsg.price" label="价格" dense
mask="#" fill-mask="0" reverse-fill-mask :rules="[val => !!val || '请输入价格']">
</q-input>
<q-input v-model="priceMsg.remark" filled type="textarea" placeholder="优惠说明" />
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" flat color="grey-10" @click="isShowEdit=false"
style="font-weight:400 !important" />
<q-btn label="确认" color="accent q-px-md" style="font-weight:400 !important"
@click="setPriceUpdate(props.row)" />
</q-card-actions>
</div>
</q-banner>
</q-popup-proxy>
</i>
</q-td>
</template>
</q-table>
</div>
<div style="border-top:1px solid #f5f6f7;" class="row q-py-md">
<div class="col">
<span>累计优惠:</span>
<span class="q-ml-xs text-weight-bold">¥{{
model.TotalDiscountPrice ? model.TotalDiscountPrice.toFixed(2) : "0.00"
}}</span>
</div>
<div class="col text-right">
<span>课程总价:</span>
<span class="q-ml-xs text-weight-bold">¥{{
model.TotalPrice ? model.TotalPrice.toFixed(2) : "0.00"
}}</span>
</div>
</div>
</q-card-section>
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" flat color="primary" v-close-popup />
<q-btn label="保存" color="accent" class="q-px-md" style="font-weight:400 !important"
@click="transOfferToOrder" />
</q-card-actions>
</q-card>
</template>
<script>
import {
queryCourseOfferInfo,
saveOfferToOrder,
saveCourseOffer
} from "../../api/course/index";
import {
getClassDropDownList,
} from "../../api/school/index";
export default {
props: ["obj"],
data() {
return {
CustomerTypes: [{
id: 1,
name: "新客户"
},
{
id: 2,
name: "续班客户"
}
],
CustomerSources: [{
id: 1,
name: "学校介绍"
},
{
id: 2,
name: "朋友介绍"
},
{
id: 3,
name: "网络广告"
}
],
model: {},
columns: [{
name: "CourseName",
required: true,
label: "课程名称",
align: "left",
field: row => row.CourseName
},
{
name: "OriginalPrice",
required: true,
label: "现价",
align: "left",
field: row => row.OriginalPrice.toFixed(2)
},
{
name: "JoinNum",
required: true,
label: "报名人数",
align: "left",
field: row => row.JoinNum
},
{
name: "DiscountPrice",
required: true,
label: "优惠",
align: "left",
field: row => row.DiscountPrice.toFixed(2)
},
{
name: "DiscountRemark",
required: true,
label: "优惠说明",
align: "left",
field: row => row.Remark
},
{
name: "ActualPrice",
required: true,
label: "小计金额",
align: "left",
field: row => row.ActualPrice.toFixed(2)
}
],
pageInfo: {
pageIndex: 1,
pageSize: 12,
rowsPerPage: 12
},
chosenCourses: [], //报价详情列表
isShowClass: false, //选择班级
priceMsg: {
price: 0,
remark: ''
},
isShowEdit: false
};
},
computed: {
},
created() {
},
mounted() {
this.initObj();
},
methods: {
//当前点击的班级
getClassItem(item) {
this.isShowEdit = true;
var Obj = JSON.parse(JSON.stringify(item));
this.priceMsg.price = Obj.DiscountPrice;
},
//设置
setPriceUpdate(item) {
item.DiscountPrice = parseInt(this.priceMsg.price);
item.ActualPrice = parseInt(item.OriginalPrice-item.DiscountPrice);
item.Remark = item.Remark+'^'+this.priceMsg.remark;
let num1 = 0;
let num2 = 0;
this.model.OfferDetails.forEach(x => {
num1+=x.DiscountPrice;
num2+=x.ActualPrice;
});
this.model.TotalDiscountPrice = num1;
this.model.TotalPrice = num2;
this.isShowEdit=false;
},
//选择班级
setClass(item) {
this.isShowClass = true;
getClassDropDownList({
CourseId: item.CourseId,
IsAddDefault: 1, //添加默认选项
}).then(res => {
item.ClassList = [];
if (res.Code == 1) {
item.ClassList = res.Data;
}
});
},
//选择班级改变事件
changeClass(item) {
if (item.ClassId > 0) {
let val = item.ClassList.find(x => x.ClassId == item.ClassId);
if (val) {
item.ClassName = val.ClassName;
}
} else {
item.ClassName = ""
}
},
//初始化对象
initObj() {
if (this.obj && this.obj.Id > 0) {
queryCourseOfferInfo({
Id: this.obj.Id
}).then(res => {
var tempObj = res.Data;
if (res.Code == 1) {
this.model = {
Id: tempObj.Id,
Name: tempObj.Name,
EffectiveStart: tempObj.EffectiveStart,
EffectiveEnd: tempObj.EffectiveEnd,
CustomerType: tempObj.CustomerType,
CustomerSource: tempObj.CustomerSource,
TotalOriginalPrice: tempObj.TotalOriginalPrice,
TotalPrice: tempObj.TotalPrice,
TotalDiscountPrice: tempObj.TotalDiscountPrice,
CustomerInfo: tempObj.CustomerInfo,
CustomerName: tempObj.CustomerName,
CustomerTel: tempObj.CustomerTel,
OfferDetails: [],
JoinNum: tempObj.JoinNum
};
if (tempObj.OfferDetails && tempObj.OfferDetails.length > 0) {
this.model.OfferDetails = tempObj.OfferDetails;
this.chosenCourses = tempObj.OfferDetails;
}
}
})
} else {
this.model = {
Id: 0,
Name: "",
EffectiveStart: "",
EffectiveEnd: "",
CustomerType: null,
CustomerSource: null,
TotalOriginalPrice: 0.0,
TotalPrice: 0.0,
TotalDiscountPrice: 0.0,
CustomerInfo: "",
CustomerName: "",
CustomerTel: "",
OfferDetails: [],
JoinNum: 0
};
}
},
//报价单转订单
transOfferToOrder() {
saveCourseOffer(this.model).then(r => {
this.$q.notify({
icon: "iconfont icon-chenggong",
color: "positive",
timeout: 2000,
message: "报价单保存成功",
position: "top",
actions: [{
label: "点击查看",
color: "primary",
handler: () => {
this.$router.push({
path: "/sale/quotation",
query: {
Id: r.Data
}
});
}
}]
});
this.$emit("save");
});
},
},
watch: {
}
};
</script>
<style></style>
...@@ -141,8 +141,25 @@ ...@@ -141,8 +141,25 @@
<div> <div>
<q-btn v-if="props.row.CustomerStatus==1||props.row.CustomerStatus==2" flat size="xs" icon="edit" <q-btn v-if="props.row.CustomerStatus==1||props.row.CustomerStatus==2" flat size="xs" icon="edit"
color="accent" style="font-weight:400" label="编辑" @click="editQuotation(props.row)" /> color="accent" style="font-weight:400" label="编辑" @click="editQuotation(props.row)" />
<q-btn v-if="props.row.CustomerStatus==1||props.row.CustomerStatus==2" flat color="primary" label="转订单" @click="offerTransOrder(props.row)" /> <q-btn-dropdown flat size="xs" color="dark" label="更多" style="margin-left:10px;">
<q-btn flat color="primary" label="详情" @click="gotoDetails(props.row)" /> <q-list>
<q-item clickable v-close-popup @click="gotoDetails(props.row)">
<q-item-section>
<q-item-label>详情</q-item-label>
</q-item-section>
</q-item>
<q-item clickable v-close-popup v-if="props.row.CustomerStatus==1||props.row.CustomerStatus==2" @click="offerTransOrder(props.row)">
<q-item-section>
<q-item-label>转订单</q-item-label>
</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="editOrderPrice(props.row)">
<q-item-section>
<q-item-label>改价</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</div> </div>
</q-td> </q-td>
</template> </template>
...@@ -160,11 +177,17 @@ ...@@ -160,11 +177,17 @@
<q-dialog v-model="showOrderForm" persistent> <q-dialog v-model="showOrderForm" persistent>
<offertransorder-form :obj="offerObj" @save="refreshPage()"></offertransorder-form> <offertransorder-form :obj="offerObj" @save="refreshPage()"></offertransorder-form>
</q-dialog> </q-dialog>
<q-dialog v-model="showEditPrice" persistent>
<edittransorder-form :obj="offerObj" @save="refreshPage()"></edittransorder-form>
</q-dialog>
</div> </div>
</template> </template>
<script> <script>
import quotationForm from '../../components/sale/quotation-form' import quotationForm from '../../components/sale/quotation-form'
import offertransorderForm from '../../components/sale/offertransorder-form' import offertransorderForm from '../../components/sale/offertransorder-form'
import edittransorderForm from '../../components/sale/edittransorder-form'
import { import {
queryCourseOfferPage, queryCourseOfferPage,
} from '../../api/course/index' } from '../../api/course/index'
...@@ -176,7 +199,8 @@ ...@@ -176,7 +199,8 @@
}, },
components: { components: {
quotationForm, quotationForm,
offertransorderForm offertransorderForm,
edittransorderForm
}, },
data() { data() {
return { return {
...@@ -273,12 +297,13 @@ ...@@ -273,12 +297,13 @@
} }
], ],
showOrderForm: false, //是否显示转订单表单 showOrderForm: false, //是否显示转订单表单
commonId:0 commonId:0,
showEditPrice:false, //是否显示改价表单
} }
}, },
computed: mapState({ computed: mapState({
isHavePriceAction(state) { isHavePriceAction(state) {
if (state.user.userInfo.ActionMenuList) { if (state.user.userInfo&&state.user.userInfo.ActionMenuList) {
let commonNum=0; let commonNum=0;
let action = state.user.userInfo.ActionMenuList.find(x => { let action = state.user.userInfo.ActionMenuList.find(x => {
if (x.FunctionCode == "Query_All_Offer") { if (x.FunctionCode == "Query_All_Offer") {
...@@ -314,10 +339,16 @@ ...@@ -314,10 +339,16 @@
this.offerObj = item; this.offerObj = item;
this.showOrderForm = true; this.showOrderForm = true;
}, },
//改价
editOrderPrice(item){
this.offerObj = item;
this.showEditPrice = true;
},
//刷新页面 //刷新页面
refreshPage() { refreshPage() {
this.showForm = false; this.showForm = false;
this.showOrderForm = false; this.showOrderForm = false;
this.showEditPrice = false;
this.getcourseofferpage(); this.getcourseofferpage();
}, },
gotoDetails(item) { gotoDetails(item) {
......
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