Commit 28bb2e39 authored by zhengke's avatar zhengke

修改

parent 43ab0d71
......@@ -4,6 +4,41 @@
right: 10px;
top: -10px;
}
.sale_upload {
width: 118px;
height: 118px;
border-radius: 4px;
border: 1px dashed #d9d9d9;
background: #fafafa;
display: flex;
align-items: center;
justify-content: center;
padding: 4px;
}
.sale_ImgDiv {
width: 118px;
height: 118px;
position: relative;
margin: 0 10px 10px 0;
}
.sale_ImgDiv img {
width: 100%;
height: 100%;
}
.saleUpload {
display: inline-block;
width: 118px;
height: 118px;
font-size: 70px;
border: 1px dashed #d9d9d9;
line-height: 120px;
text-align: center;
}
</style>
<template>
<q-dialog v-model="persistent" content-class="bg-grey-1" persistent transition-show="scale">
......@@ -18,8 +53,8 @@
class="col-6 q-pb-lg q-pr-lg" label="任务名称" :rules="[val => !!val || '请输入任务名称']" />
</div>
<div class="col-6">
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.TaskNum" ref="TaskNum"
class="col-6 q-pb-lg" label="完成任务数量" :rules="[val => !!val || '请输入任务数量']" />
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.TaskSubTitle"
ref="TaskSubTitle" class="col-6 q-pb-lg" label="任务子标题" :rules="[val => !!val || '请输入任务子标题']" />
</div>
</div>
<div class="row wrap">
......@@ -62,16 +97,100 @@
</q-input>
</div>
</div>
<div class="row wrap q-pb-lg">
<q-btn size="10px" @click="addCourse()" round color="primary" icon="iconfont icon-img_haha" />
<div class="row wrap">
<div class="col-12">任务图片</div>
</div>
<div class="row wrap" v-for="(item,index) in objOption.DetailsList" :key="index">
<div class="col-6" style="position:relative;">
<q-select filled stack-label option-value="CourseId" option-label="CourseName" v-model="item.TargetId"
ref="CouseId" :options="CourseList" label="关联课程" :dense="false" class="col-6 q-pr-lg q-pb-lg" emit-value
map-options />
<q-btn size="8px" class="deleteCusBtn" @click="deleTarget(index)" round color="red"
icon="iconfont icon-guanbi1" />
<div class="row wrap" style="margin-top:20px;">
<div class="row col-12">
<div class="sale_ImgDiv" v-for="(sItem,sIndex) in objOption.TaskImage" :key="sIndex">
<img :src="sItem" />
<q-btn size="6px" style="position:absolute;right:-8px;top:-5px;" @click="deleTask(sIndex)" round
color="red" icon="iconfont icon-guanbi1" />
</div>
<el-upload class="avatar-uploader saleUpload" action="" :before-upload="uploadFileTask"
:show-file-list="false">
<i class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</div>
</div>
<div class="row wrap" style="margin-top:20px;">
<div class="col-12">奖品图片</div>
</div>
<div class="row wrap" style="margin-top:20px;">
<div class="row col-12">
<div class="sale_ImgDiv" v-for="(sItem,sIndex) in objOption.TaskKudoImg" :key="sIndex">
<img :src="sItem" />
<q-btn size="6px" style="position:absolute;right:-8px;top:-5px;" @click="deleKudo(sIndex)" round
color="red" icon="iconfont icon-guanbi1" />
</div>
<el-upload class="avatar-uploader saleUpload" action="" :before-upload="uploadFileKudo"
:show-file-list="false">
<i class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</div>
</div>
<div class="q-pt-none scroll" style="max-height:60hv">
<table>
<thead>
<tr style="height:60px;">
<td colspan="5" style="text-align:right;">
<q-btn color="accent" size="sm" icon="add" label="新增优惠" @click="addCourse()" />
</td>
</tr>
<tr>
<td style="width:200px">
任务类型
</td>
<td style="width:200px">
优惠条件
</td>
<td style="width:140px">
完成类型
</td>
<td style="width:140px">
完成值
</td>
<td>
操作
</td>
</tr>
</thead>
<tbody v-for="(sItem, sIndex) in objOption.DetailsList" :key="sIndex">
<tr>
<td style="height:50px">
<q-select filled stack-label option-value="Id" option-label="Name" v-model="sItem.TaskType"
ref="PriceDiscountType_Id" :options="taskTypeData" label="任务类型" style="width:160px" dense
emit-value map-options />
</td>
<td>
<q-select v-if="sItem.TaskType==2" filled stack-label option-value="Id" option-label="SubjectName" v-model="sItem.TargetIdList"
:options="CourseSubjectList" multiple label="所属科目" style="width:160px" dense
emit-value map-options />
<select-tree v-if="sItem.TaskType==3" :treeData="TreeCategoryList" nodeKey="CateId" :multiple="true"
labelKey="CateName" childrenKey="ChildList" tipText="课程系列" @getChild="getChild"></select-tree>
<q-select v-if="sItem.TaskType==4" multiple filled stack-label v-model="sItem.TargetIdList" option-value="CourseId" option-label="CourseName"
:options="CourseList" label="课程" style="width:160px" dense
emit-value map-options />
</td>
<td>
<q-select filled stack-label option-value="Id" option-label="Name" v-model="sItem.TaskFinishType"
:options="finishTypeObj" label="请选择" style="width:160px" dense emit-value map-options />
</td>
<td>
<q-input filled stack-label maxlength="20" dense v-model="sItem.TaskFinishValue"
ref="TaskFinishValue" class="q-pr-none" label="任务完成值" />
</td>
<td>
<q-btn flat size="xs" icon="iconfont icon-shanchu" title="删除" color="negative" style="font-weight:400"
class="q-mr-xs" label="" @click="deleTarget(index)" />
</td>
</tr>
</tbody>
</table>
</div>
<div class="row wrap">
<div class="col-12">
<q-input filled stack-label :dense="false" v-model="objOption.TaskDesc" type="textarea" label="任务描述" />
</div>
</div>
</q-card-section>
......@@ -88,13 +207,23 @@
<script>
import {
SetCustomerTask,
GetCustomerTask
GetCustomerTask,
GetTaskTypeList
} from "../../api/sale/peemanagement";
import {
queryCourseDropdownList,
getCourseSubject,
queryCourseCategoryTree
} from '../../api/course/index'
import {
UploadSelfFile,
} from '../../api/common/common'
import selectTree from "../../components/common/select-tree";
export default {
components: {},
components: {
selectTree
},
props: {
taskOption: {
type: Object,
......@@ -108,19 +237,36 @@
objOption: {
Id: 0,
TaskName: '', //任务名称
TaskNum: 0, //完成任务数量
TaskSubTitle: '', //任务子标题
TaskImage: [], //任务图片
TaskKudoImg: [], //奖品图片
TaskKudo: '', //奖品名称
TaskDesc: '', //任务描述
TaskStartTime: "", //任务开始时间
TaskEndTime: "", //任务结束时间
DetailsList: []
},
optionTitle: '',
CourseList: []
CourseList: [],
taskTypeData: [],
CourseSubjectList: [], //科目列表
TreeCategoryList: [], //课程分类树形列表
//完成类型
finishTypeObj:[{
Id:1,
Name:'人数'
},{
Id:2,
Name:'成交金额'
}]
}
},
created() {},
mounted() {
this.getCourseList();
this.getTaskType();
this.queryCourseSubject();
this.getCategorytree();
this.initObj()
},
methods: {
......@@ -135,18 +281,25 @@
let tempData = res.Data;
this.objOption.Id = tempData.Id;
this.objOption.TaskName = tempData.TaskName;
this.objOption.TaskNum = tempData.TaskNum;
this.objOption.TaskKudo = tempData.TaskKudo;
this.objOption.TaskStartTime = tempData.TaskStartTimeStr;
this.objOption.TaskEndTime = tempData.TaskEndTimeStr;
this.objOption.DetailsList = tempData.DetailsList;
this.objOption.TaskSubTitle = tempData.TaskSubTitle;
// this.objOption.TaskImage = tempData.TaskImage;
// this.objOption.TaskKudoImg = tempData.TaskKudoImg;
this.objOption.TaskDesc = tempData.TaskDesc;
}
})
this.optionTitle = "修改客户任务"
} else {
this.objOption.Id = 0;
this.objOption.TaskName = '';
this.objOption.TaskNum = 0;
this.objOption.TaskSubTitle = '';
this.objOption.TaskImage = [];
this.objOption.TaskKudoImg = [];
this.objOption.TaskDesc = '';
this.objOption.TaskKudo = '';
this.objOption.TaskStartTime = '';
this.objOption.TaskEndTime = '';
......@@ -157,20 +310,22 @@
//保存
saveCustom() {
this.$refs.TaskName.validate();
this.$refs.TaskNum.validate();
this.$refs.TaskSubTitle.validate();
this.$refs.TaskKudo.validate();
if (!this.$refs.TaskName.hasError && !this.$refs.TaskNum.hasError && !this.$refs.TaskKudo.hasError) {
if (!this.$refs.TaskName.hasError && !this.$refs.TaskSubTitle.hasError && !this.$refs.TaskKudo.hasError) {
var oDate1 = new Date(this.objOption.TaskStartTime);
var oDate2 = new Date(this.objOption.TaskEndTime);
if (oDate1.getTime() > oDate2.getTime()) {
this.$q.notify({
type: 'negative',
position: "top",
message: `开始日期不能大于结束日期`
type: 'negative',
position: "top",
message: `开始日期不能大于结束日期`
})
return
}
this.saveCustomLoading = true;
console.log(this.objOption, '数据');
return;
SetCustomerTask(this.objOption).then(res => {
if (res.Code == 1) {
this.saveCustomLoading = false;
......@@ -198,7 +353,10 @@
DetailId: 0,
TaskId: 0,
TaskType: 1, //默认传1
TargetId: 1 //课程编号
TargetId: 1, //课程编号
TaskFinishType:1,
TaskFinishValue:'',
TargetIdList:[]
}
this.objOption.DetailsList.push(obj);
},
......@@ -215,7 +373,59 @@
//删除
deleTarget(index) {
this.objOption.DetailsList.splice(index, 1);
}
},
//删除任务图片
deleTask(index) {
this.objOption.TaskImage.splice(index, 1);
},
//删除奖品图片
deleKudo(index) {
this.objOption.TaskKudoImg.splice(index, 1);
},
//上传任务图片
uploadFileTask(files) {
UploadSelfFile('Icon', files, res => {
if (res.Code == 1) {
this.objOption.TaskImage.push(res.FileUrl);
}
})
},
//上传奖品图片
uploadFileKudo(files) {
UploadSelfFile('Icon', files, res => {
if (res.Code == 1) {
this.objOption.TaskKudoImg.push(res.FileUrl);
}
})
},
//获取任务类型数据下拉
getTaskType(){
GetTaskTypeList({}).then(res => {
console.log(res,'res');
if (res.Code == 1) {
this.taskTypeData = res.Data;
}
})
},
//获取所属科目
queryCourseSubject() {
getCourseSubject({}).then(res => {
if (res.Code == 1) {
this.CourseSubjectList = res.Data;
}
})
},
getCategorytree() {
this.TreeCategoryList = [];
var qMsg = {};
queryCourseCategoryTree(qMsg).then((res) => {
this.TreeCategoryList = res.Data;
});
},
//分类改变
getChild(cateObj) {
},
},
}
......
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