Commit c67c876d authored by Mac's avatar Mac

课程内容

parent 98a74b16
<template>
<div class="addCourseCard">
<div class="form-box" style="margin-top: 0">
<div>
<span style="color: rgb(64, 158, 255);cursor: pointer;margin-left: 20px" @click="cancel">课程卡管理</span>
<span style="margin: 0 5px;color: #C0C4CC;">/</span>
<span>课程卡编辑</span>
</div>
</div>
<div class="el-card__body" style="background-color: white; padding: 0px;margin-top: 20px">
<el-form :model="msg" style="padding:0 20px;" :rules="rules" ref="msg" label-width="160px" size="small">
<div class="form-body">
<el-form-item label="课程卡名称" prop="Name" class="is-required">
<el-input v-model="msg.Name" />
</el-form-item>
<el-form-item label="课程卡图标" prop="CouponIco" class="is-required" >
<button class="el-button el-button--default el-button--small" @click="openChangeDig()">
选择图标
</button>
<div class="img_yuan inputM_l">
<img v-if="msg.CouponIco=='' || msg.CouponIco==null" src="../../assets/img/setup/default_img.png" alt="">
<img v-else :src="msg.CouponIco" alt="">
</div>
</el-form-item>
<el-form-item label="微店铺">
<el-select size="small" v-model="msg.SmallShopId" :filter-method="ChangeListName" filterable
placeholder="请选择">
<el-option label="不限" :value="0"></el-option>
<el-option v-for="item in SmallShopData" :key="item.Id" :label="item.Name" :value="item.Id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="赞羊用户专用">
<el-radio-group v-model="msg.IsZanYangUse">
<el-radio :label="0"></el-radio>
<el-radio :label="1"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="加入领券中心">
<el-switch
:active-value="1"
:inactive-value="0"
v-model="msg.PickupCenter"
>
</el-switch>
</el-form-item>
<el-form-item label="指定商品类别或商品" >
<div style="display: flex;flex-direction: row;align-items: center">
<div @click="getUseType(1)" style="margin-right: 15px">
<el-radio :label="1" v-model="msg.UseType">指定商品类型</el-radio>
</div>
<div @click='getUseType(2)' style="margin-right: 15px">
<el-radio :label="2" v-model="msg.UseType">指定商品</el-radio>
</div>
<el-radio :label="3" v-model="msg.UseType" @change="getUseType2" style="margin-right: 15px">全场通用</el-radio>
<el-radio :label="4" v-model="msg.UseType" @change="getUseType2" >当面付</el-radio>
</div>
<div class="splist" v-if="msg.UseType==1">
<div v-for="(item,index) in AppointList" :label="item.ProductId" :key="index" style="margin-right: 20px;" class="el-tag el-tag--warning el-tag--plain">
<span>{{item.Name}}</span>
<i class="el-tag__close el-icon-close" @click="deleteProduct(item,index)"></i>
</div>
</div>
<div class="splist" v-if="msg.UseType==2">
<div v-for="(item,index) in commoditylist" :label="item.ProductId" :key="index" style="margin-right: 20px; position: relative; cursor: pointer;" >
<div class="app-image" :style="{backgroundImage:'url(' + item.CoverImage + ')',backgroundSize:'cover'}" ></div>
<i class="el-icon-error" style="position: absolute;right: -5px;top:-5px;color: #F56C6C;font-size: 20px" @click="deletecommod(index,1)"></i>
</div>
</div>
</el-form-item>
<el-form-item label="卡券有效期" class="is-required">
<el-radio-group v-model="msg.IndateType">
<el-radio :label="1">领取后N天内有效</el-radio>
<el-radio :label="2">时间段</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="有效天数" prop="IndateDay" class="is-required" v-if="msg.IndateType==1">
<el-input v-model="msg.IndateDay" class="el-input--small" step="1" min="0" onkeyup="this.value= this.value.match(/\d+(\d{0,2})?/) ? this.value.match(/\d+(\d{0,2})?/)[0] : ''"/>
</el-form-item>
<el-form-item label="有效期范围" prop="value" class="is-required" v-if="msg.IndateType==2" >
<el-date-picker
@input="daterangeChange"
style="padding: 3px 10px;width: 450px;height: 32px"
v-model.trim="msg.value"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd HH:mm:ss"
align="right">
</el-date-picker>
</el-form-item>
<el-form-item label="核销总次数" prop="HeXiao" class="is-required">
<el-input v-model="msg.HeXiao" class="el-input--small" placeholder="请输入整数" step="1" min="1" onkeyup="this.value= this.value.match(/\d+(\d{0,2})?/) ? this.value.match(/\d+(\d{0,2})?/)[0] : ''"/>
</el-form-item>
<el-form-item label="可领取数量" prop="TotalNum" class="is-required">
<el-tooltip class="item" effect="dark" content="可领取数量为0则无法领取或发放,-1为不限制张数" placement="top"
style="position: absolute;left: -16px;top:10px">
<i class="el-tooltip el-icon-info"></i>
</el-tooltip>
<el-input v-model="msg.TotalNum" class="el-input--small" :disabled="checked" step="1" min="0" onkeyup="this.value= this.value.match(/\d+(\d{0,2})?/) ? this.value.match(/\d+(\d{0,2})?/)[0] : ''"/>
<el-checkbox v-model="checked" @change="checked==true? msg.TotalNum=-1:msg.TotalNum=0">无限制</el-checkbox>
</el-form-item>
<el-form-item label="课程卡描述">
<el-input
type="textarea"
:rows="2"
v-model="msg.Describe">
</el-input>
</el-form-item>
</div>
</el-form>
</div>
<el-button type="primary" style="margin: 12px 0 " @click="preserve('msg')" :loading="loading">保存</el-button>
<!--已指定商品类别选择-->
<el-dialog title="已指定商品类别" :visible.sync="category" width="714px">
<el-tree
:data="ProductCategoryTreeList"
show-checkbox
default-expand-all
node-key="Id"
ref="tree"
:default-checked-keys="checkedkeys"
@check="TreeList"
:props="defaultProps">
</el-tree>
<div slot="footer" class="dialog-footer">
<el-button @click="category = false">取 消</el-button>
<el-button type="primary" @click="getProductList">确 定</el-button>
</div>
</el-dialog>
<!--已指定商品选择-->
<el-dialog title="已指定商品" :visible.sync="commodity" width="1024px">
<template>
<button class="el-button el-button--primary el-button--small" style="float: right;" @click="addcommoditybtn">新增</button>
<el-table
:data="commoditylist"
style="width: 984px">
<el-table-column
prop="Id"
label="ID"
width="80">
</el-table-column>
<el-table-column
label="商品图"
width="80">
<template slot-scope="scope">
<img style="width:50px;height:50px;margin-right:1px" :src="scope.row.CoverImage" alt="">
</template>
</el-table-column>
<el-table-column
prop="Name"
label="商品名称"
width="604">
</el-table-column>
<el-table-column
prop="address"
label="操作"
>
<template slot-scope="scope">
<div class="cell">
<button type="button" class="el-button el-button--danger el-button--mini is-plain" @click="deletecommod(scope,2)"><span>删除</span></button>
</div>
</template>
</el-table-column>
</el-table>
</template>
</el-dialog>
<!--选择的商品列表-->
<el-dialog title="添加商品" :visible.sync="addcommodity" width="1024px">
<template>
<div class="el-form-item">
<div class="el-form-item__content" >
<div class="el-input el-input--small" style="width: 40%;" >
<input type="text" autocomplete="off" placeholder="商品名称" class="el-input__inner" v-model="msg2.Name"
@clear="msg2.pageIndex=1,getProductGoodsPageList()"
clearable
>
</div>
<button type="button" class="el-button el-button--default el-button--small" style="margin-left: 15px" @click="msg2.pageIndex=1,getProductGoodsPageList()">查找商品</button>
<button class="el-button el-button--default el-button--small" style="float: right;" @click="batchAdd">批量添加</button>
</div>
</div>
<el-table
v-loading="loading_t"
:data="tableData"
@selection-change="handleSelectionChange"
style="width: 984px">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
prop="Id"
label="ID"
width="80">
</el-table-column>
<el-table-column
label="商品图"
width="80">
<template slot-scope="scope">
<img style="width:50px;height:50px;margin-right:1px" :src="scope.row.CoverImage" alt="">
</template>
</el-table-column>
<el-table-column
prop="Name"
label="商品名称"
width="333">
</el-table-column>
<el-table-column
prop="address"
label="操作"
>
<template slot-scope="scope">
<el-button type="primary" plain size="mini" @click="addtableData(scope)" :disabled="scope.row.disabled">{{scope.row.disabled==true? '已添加':'添加'}}</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination style="text-align:right"
background
@current-change="handleCurrentChange"
:page-size="msg2.pageSize"
layout="prev, pager, next"
:current-page.sync="msg2.pageIndex"
:total="count">
</el-pagination>
</template>
</el-dialog>
<!-- 选择文件 -->
<el-dialog title="选择文件" :visible.sync="changeState" width="1240px">
<ChooseImg @SelectId="SelectId" ref="mychild"></ChooseImg>
</el-dialog>
</div>
</template>
<script>
import ChooseImg from "@/components/global/ChooseImg.vue";
export default {
name: "addCourseCard",
components: {
ChooseImg,
},
data(){
return{
msg:{
ID:0,
Name:'',
CouponType:1,
UseType:3,
MaxDiscountsPrice:0,
IndateDay:1,
IndateType:1,
TotalNum:-1,
Describe:'',
OnlyMember:0,
PickupCenter:0,
MemberLevelList:[],
ProductList:[],//指定商品类型的数组
StartDate:'',
EndDate:'',
value:[],
SmallShopId:0,//微店id
IsZanYangUse:0,
HeXiao:1,
CouponIco:"",
},
checkedkeys:[],//默认选中的
huiyuan:false,
zhongxin:true,
checked:true,
loading:false,
activeName:'first',
commodity:false,
addcommodity:false,
changeState:false,
SmallShopData:[],
rules:{
Name:[
{required: true, message: "课程卡名称不能为空", trigger: "blur"}
],
IndateDay:[
{required: true, message: "课程卡有效天数不能为空", trigger: "blur"}
],
TotalNum:[
{required: true, message: "发放总数不能为空", trigger: "blur"}
],
CouponIco:[
{required: true, message: "请选择课程卡图标", trigger: "blur"}
],
HeXiao:[
{required: true, message: "请输入可核销总次数", trigger: "blur"}
],
value:[
{ type: 'array', required: true, message: '课程卡有效期不能为空', trigger: 'change' }
]
},
cityOptions:[],
cities: [],
checkAll: false,
isIndeterminate: false,
category:false,
ProductCategoryTreeList:[],
commoditylist:[],//商品的list
AppointList:[],//指定商品分类
defaultProps: {
children: 'ChildList',
label: 'Name'
},
eData:{},
msg2:{
pageIndex:1,
pageSize:15,
Name:'',
GoodsStatus:0,
IsSelectSellOut:0,
CategoryIds:'',
Id:0,
StartTime:'',
EndTime:'',
},
tableData:[],
loading_t:false,
count:0,
multipleSelection:[],
AppointList2:[],
SmallShopMsg:{
Name:'',
}
}
},
created(){
this.getMemberGradeList()
this.getSmallShopsDropDownList()
},
methods:{
getMemberGradeList(){
this.cityOptions=[];
this.apipost("/api/User/GetMemberGradeList",{}, res => {
this.cities=res.data.data;
let data=res.data.data;
data.forEach(item=>{
this.cityOptions.push(item.Id)
})
})
this.getProductCategoryTreeList()
},
getDiscountCouponDetail(ID){
this.apipost("/api/Education/GetDiscountCouponDetail",{'ID':ID} , res => {
if (res.data.resultCode == 1) {
this.msg = res.data.data
this.msg.value = []
if(res.data.data.IndateType==2){
this.msg.value.push(res.data.data.StartDate.replace("T", " "))
this.msg.value.push(res.data.data.EndDate.replace("T", " "))
}
if(res.data.data.TotalNum!=-1){
this.checked=false
}
if(res.data.data.OnlyMember==0){
this.huiyuan=false
}else {
this.huiyuan=true
}
if(res.data.data.PickupCenter==0){
this.zhongxin=false
}else {
this.zhongxin=true
}
this.msg.MemberLevelList=res.data.data.MemberLevelList?res.data.data.MemberLevelList:[];
if(this.msg.MemberLevelList){ //设置全选状态
if(this.msg.MemberLevelList.length == this.cities.length){
this.checkAll=true
}
}
if(res.data.data.UseType==1){
let ProductList = res.data.data.ProductList;
let newData = []
for(let i= 0;i<ProductList.length;i++){
this.checkedkeys.push(ProductList[i].ProductId)
for(let j=0;j<this.ProductCategoryTreeList.length;j++){
if(ProductList[i].ProductId == this.ProductCategoryTreeList[j].Id){
newData.push(this.ProductCategoryTreeList[j])
}
if(this.ProductCategoryTreeList[j].ChildList.length>0){
this.getReturn(ProductList[i],this.ProductCategoryTreeList[j].ChildList)
}
}
}
this.AppointList = this.AppointList2.concat(newData)
}
if(res.data.data.UseType==2){
let ProductList = res.data.data.ProductList;
let newData = []
for(let i= 0;i<ProductList.length;i++){
this.apipost("/api/product/GetProductGoodsPageList",
{
pageIndex:1,
pageSize:15,
Name:'',
GoodsStatus:0,
IsSelectSellOut:0,
CategoryIds:'',
Id:ProductList[i].ProductId,
StartTime:'',
EndTime:'',
}
, res => {
if(res.data.resultCode==1){
let pageData= res.data.data.pageData;
newData.push(pageData[0])
}
})
}
this.commoditylist = newData
}
} else {
this.Info(res.data.message);
}
})
},
getReturn(ProductList,data){
for(let i=0;i<data.length;i++){
if(ProductList.ProductId == data[i].Id){
this.AppointList2.push(data[i])
}
if(data[i].ChildList.length>0){
this.getReturn(ProductList,data[i].ChildList)
}
}
},
getProductCategoryTreeList(){
this.apipost("/api/AppletGoods/GetProductCategoryTreeList",{}, res => {
if (res.data.resultCode == 1) {
this.ProductCategoryTreeList = res.data.data
this.getProductGoodsPageList(1)
} else {
// this.Info(res.data.message);
}
})
},
getProductGoodsPageList(type=2){
this.loading_t =true
this.apipost("/api/product/GetProductGoodsPageList", this.msg2, res => {
this.loading_t=false;
if(res.data.resultCode==1){
let pageData= res.data.data.pageData;
for(let i= 0;i<pageData.length;i++){
pageData[i].disabled=false;
this.commoditylist.forEach(x=>{
if(pageData[i].Id == x.Id){
pageData[i].disabled=true;
}
})
}
this.tableData = pageData
this.count = res.data.data.count
}
if(type==1){
setTimeout(()=>{
if(this.$route.query.ID){
this.getDiscountCouponDetail(this.$route.query.ID)
}
},10)
}
})
},
cancel(){
this.$router.go(-1)
},
handleCheckAllChange(val) {
this.msg.MemberLevelList = val ? this.cityOptions : [];
this.isIndeterminate = false;
},
handleCheckedCitiesChange(value) {
let checkedCount = value.length;
this.checkAll = checkedCount === this.cities.length;
this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
},
addtableData(data){
this.tableData[data.$index].disabled=true;
this.commoditylist.push(data.row)
this.Success('添加成功');
},
batchAdd(){ //批量添加
let newdata=[]
for(let i=0;i<this.multipleSelection.length;i++){
if(this.commoditylist.length>0){
for(let j=0;j<this.commoditylist.length;j++){
if(this.multipleSelection[i].Id!=this.commoditylist[j].Id){
newdata.push(this.multipleSelection[i])
for(let z =0;z<this.tableData.length;z++){
if(this.tableData[z].Id==this.multipleSelection[i].Id){
this.tableData[z].disabled=true;
break
}
}
}
}
}else {
newdata.push(this.multipleSelection[i])
for(let z =0;z<this.tableData.length;z++){
if(this.tableData[z].Id==this.multipleSelection[i].Id){
this.tableData[z].disabled=true;
break
}
}
}
}
if(newdata.length>0){
this.Success('添加成功');
}
this.commoditylist = this.unique(this.commoditylist.concat(newdata))
},
// 数组去重
unique(arr) {
for (var i = 0, len = arr.length; i < len; i++) {
for (var j = i + 1, len = arr.length; j < len; j++) {
if (arr[i].Id === arr[j].Id ) {
arr.splice(j, 1);
j--; // 每删除一个数j的值就减1
len--; // j值减小时len也要相应减1(减少循环次数,节省性能)
}
}
}
return arr;
},
addcommoditybtn(){
this.addcommodity=true;
for(let i=0;i<this.tableData.length;i++){
this.tableData[i].disabled= false;
for(let j=0;j<this.commoditylist.length;j++){
if(this.commoditylist[j].Id== this.tableData[i].Id){
this.tableData[i].disabled=true
}
}
}
},
deletecommod(data,type){
if(type==1){
this.commoditylist.splice(data,1)
}else {
this.commoditylist.splice(data.$index,1)
}
},
handleSelectionChange(val) {
this.multipleSelection=val
},
getUseType(val){
if(val ==1){
this.category=true;
this.$nextTick(() => {//在弹出dialog之前执行$nextTick回调函数,确保el-tree已经渲染
this.$refs.tree.setCheckedKeys(this.checkedkeys);
});
}else if(val==2){
this.checkedkeys=[]
this.commodity =true
}
},
daterangeChange(e){
let _this =this
_this.$nextTick(() => {
_this.$set(_this.msg, "value", [e[0], e[1]]);
_this.$forceUpdate();
});
},
getUseType2(){
this.checkedkeys=[]
},
deleteProduct(item,index){
this.AppointList.splice(index,1)
for(let i = 0;i<this.checkedkeys.length;i++){
if(this.checkedkeys[i]==item.ProductId){
this.checkedkeys.splice(i,1)
}
}
},
handleCurrentChange(val) {
this.msg2.pageIndex = val;
this.getProductGoodsPageList();
},
TreeList(val,e){
this.eData = e
},
preserve(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
this.loading= true
if(this.msg.IndateType==2){
this.msg.StartDate=this.msg.value[0];
this.msg.EndDate=this.msg.value[1];
this.msg.IndateDay=0
}
if(this.msg.UseType==2){
let ProductList= []
for(let i = 0;i<this.commoditylist.length;i++){
ProductList.push({'ProductId':this.commoditylist[i].Id,})
}
this.msg.ProductList =ProductList
}else if(this.msg.UseType==1){
let ProductList= []
for(let i = 0;i<this.AppointList.length;i++){
ProductList.push({'ProductId':this.AppointList[i].ProductId,})
}
this.msg.ProductList =ProductList
}
this.apipost("/api/Education/AddOrUpdateDiscountCoupon",this.msg , res => {
this.loading= false
if (res.data.resultCode == 1) {
this.Success(res.data.message);
this.$router.go(-1);//返回上一层
} else {
this.Info(res.data.message);
}
})
} else {
return false;
}
});
},
getProductList(){
this.category = false;
let e = this.eData;
let ProductList = this.msg.ProductList;
ProductList=[]
this.checkedkeys = e.checkedKeys;
if(e.checkedNodes.length>0){
for(let i= 0;i<e.checkedNodes.length;i++){
if(e.checkedNodes[i].ChildList.length==0){
ProductList.push({'ProductId':e.checkedNodes[i].Id,'Name':e.checkedNodes[i].Name})
}
}
}
this.AppointList= ProductList
},
ChangeListName(val) {
this.SmallShopMsg.Name = val;
this.getSmallShopsDropDownList()
},
getSmallShopsDropDownList(){
this.apipost("/api/SmallShops/GetAllSmallShopsList",this.SmallShopMsg , res => {
this.loading= false
if (res.data.resultCode == 1) {
this.SmallShopData = res.data.data
} else {
this.Info(res.data.message);
}
})
},
openChangeDig(){
this.changeState=true;
setTimeout(()=>{
this.$refs.mychild.InitData();
},10)
},
SelectId(msg){
this.changeState=false;
this.msg.CouponIco= this.getIconLink(msg.url);
},
},
mounted(){
}
}
</script>
<style >
.addCourseCard .form-box {
background: #fff;
padding: 20px 50% 20px 0;
margin-top: 10px;
}
.addCourseCard .el-input--small .el-input__inner{
height: 32px;
line-height: 32px;
}
.addCourseCard .img_yuan{
width: 80px;
height: 80px;
margin-top: 5px;
position: relative;
}
.addCourseCard .img_yuan img{
width: 100%;
height: 100%;
}
.addCourseCard .el-date-editor .el-range__icon {
line-height: 24px;
}
.addCourseCard .el-date-editor .el-range-separator{
line-height: 24px;
}
.addCourseCard .el-date-editor .el-range__close-icon{
line-height: 24px;
}
.addCourseCard .el-form-item__label{
padding: 0 20px 0 0;
}
.addCourseCard .form-body{
background-color: #fff;
padding: 10px 50% 10px 20px;
min-width: 1000px;
}
.addCourseCard .splist{
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.addCourseCard .app-image{
width: 50px;
height: 50px;
border-radius: 0%;
background-position: center center;
}
</style>
<template>
<div v-loading="loading" class="addLecturer">
<div class="head-title">
<span @click="CommonJump('lecturermanage')" class="blue point">讲师管理</span> / 编辑讲师管理
</div>
<div class="content">
<el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="150px" style="width:50%">
<el-form-item label="讲师名称" prop="Name" class="is-required" size="small">
<el-input v-model="addMsg.Name" placeholder="请输入讲师名称" />
</el-form-item>
<el-form-item label="头像" class="is-required" size="small">
<el-button @click="openChangeDig(1)" size="small">选择文件</el-button>
<div class="app-gallery-item" style="position: relative;width: 100px;margin-top: 10px;">
<img v-if="!addMsg.TeacherLogo || addMsg.TeacherLogo==''"
src="../../assets/img/default.png" style="width:80px;height:80px" alt="">
<img v-else style="width:80px;height:80px" :src="addMsg.TeacherLogo"
alt="">
</div>
</el-form-item>
<el-form-item label="电话" prop="Telephone" class="is-required" size="small">
<el-input v-model="addMsg.Telephone" placeholder="请输入电话" type="number"/>
</el-form-item>
<el-form-item label="专业" prop="Major" class="is-required" size="small">
<el-input v-model="addMsg.Major" placeholder="请输入专业" />
</el-form-item>
<el-form-item label="工作年限" prop="WorkYears" class="is-required" size="small">
<el-input v-model="addMsg.WorkYears" placeholder="请输入工作年限" />
</el-form-item>
<el-form-item label="上架状态" size="small">
<el-switch v-model="addMsg.TeacherStatus" active-color="#409EFF" :active-value="1"
:inactive-value="2">
</el-switch>
</el-form-item>
<el-form-item label="简介">
<UE style="width:750px;" :defaultMsg="defaultMsg" :config="config" :IsMultiple="true" ref="ue"></UE>
</el-form-item>
</el-form>
</div>
<div style="margin-top:20px">
<el-button size="small" type="primary" @click="Save('addMsg')">保存</el-button>
</div>
<!-- 选择文件 -->
<el-dialog title="选择文件" :visible.sync="changeState" width="1240px">
<ChooseImg @SelectId="SelectId"></ChooseImg>
</el-dialog>
</div>
</template>
<script>
import ChooseImg from "@/components/global/ChooseImg.vue";
import UE from "@/components/global/UE.vue";
export default {
components: {
ChooseImg,
UE
},
data() {
return {
addMsg: {
ID: 0,
TeacherLogo:'',
Name:'',
Telephone:"",
Introduction:'',
Major:'',
WorkYears:'',
TeacherStatus:2,
},
defaultMsg: "",
config: {
initialFrameWidth: null,
initialFrameHeight: 350
},
Picindex:0,
rules: {
Name: [{
required: true,
message: '请输入讲师名称',
trigger: 'blur'
}],
Telephone: [{
required: true,
message: '请输入讲师电话',
trigger: 'blur'
}],
Introduction: [{
required: true,
message: '请输入讲师简介',
trigger: 'blur'
}],
Major: [{
required: true,
message: '请输入讲师专业',
trigger: 'blur'
}],
WorkYears: [{
required: true,
message: '请输入讲师年限',
trigger: 'blur'
}],
},
loading: false,
changeState:false,
imgType:0,
};
},
created() {
if(this.$route.query.ID){
this.getData(this.$route.query.ID)
}
},
methods: {
SelectId(msg){
if(this.imgType==1){
let url = this.getIconLink(msg.url)
this.addMsg.TeacherLogo = url
}
this.changeState = false;
},
openChangeDig(num) {
this.changeState = true;
this.imgType=num;
},
Save(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if(this.addMsg.TeacherLogo==''){
this.Error('请上传品牌Logo')
return false
}
let content = this.$refs.ue.getUEContent();
this.addMsg.Introduction = content;
this.apipost("/api/Education/AddOrUpdateTeacher", this.addMsg, res => {
if (res.data.resultCode == 1) {
this.CommonJump('lecturermanage');
this.Success(res.data.message);
} else {
this.Error(res.data.message);
}
})
} else {
return false;
}
});
},
getData(ID) {
this.loading = true;
this.apipost("/api/Education/GetTeacherModel", {
ID: ID
}, res => {
this.loading = false;
this.addMsg = res.data.data;
if (this.addMsg.Introduction && this.addMsg.Introduction != "") {
this.defaultMsg = this.addMsg.Introduction;
}
})
},
},
mounted() {
}
};
</script>
<style>
.app-add-cat .el-checkbox-group {
font-size: 14px !important;
}
.app-add-cat .el-checkbox {
margin-right: 0;
}
.app-add-cat .el-dialog__body {
padding: 10px 20px !important;
}
.app-add-cat .tag-box .tag-item {
margin-right: 5px;
}
.app-add-cat .tag-box {
margin: 20px 0;
}
.app-add-cat .app-goods-cat-list .active {
background: #FAFAFA;
}
.app-add-cat .app-goods-cat-list .cat-item {
cursor: pointer;
padding: 5px 10px;
}
.app-add-cat .app-goods-cat-list {
border: 1px solid #E8EAEE;
border-radius: 5px;
margin-top: -5px;
padding: 10px 0;
overflow: scroll;
height: 400px;
}
.addLecturer .blue {
color: #409EFF;
}
.addLecturer .content {
background: #fff;
margin-top: 10px;
padding: 20px;
box-sizing: border-box;
}
.addLecturer .gez_list{
/*width: 650px;*/
margin-bottom: 12px;
padding: 20px;
border: 1px solid #EBEEF5;
background-color: #FFF;
color: #303133;
}
.addLecturer .quyu{
background-color: #f4f4f5;
color: #909399;
padding: 10px;
line-height: 30px;
height: 30px;
font-size: 12px;
border-radius: 4px;
white-space: nowrap;
margin: 5px;
}
</style>
<template>
<div class="addedautorelease">
<div class="form-box" style="margin-top: 0">
<div>
<span style="color: rgb(64, 158, 255);cursor: pointer;margin-left: 20px" @click="cancel">自动发放优惠券</span>
<span style="margin: 0 5px;color: #C0C4CC;">/</span>
<span>自动发放优惠券编辑</span>
</div>
</div>
<div class="el-card__body" style="background-color: white; padding: 15px 50% 15px 0 ;margin-top: 20px">
<el-form :model="msg" style="padding:0 20px;" :rules="rules" ref="msg" label-width="160px" size="small">
<el-form-item label="触发事件" class="is-required" style="width: 50%">
<el-select v-model="msg.TriggerType" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.Id"
:label="item.Name"
:value="item.Id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="发放的优惠券" class="is-required" style="width: 50%">
<el-select v-model="msg.DiscountCouponId" placeholder="请选择">
<el-option
v-for="item in options2"
:key="item.ID"
:label="item.Name"
:value="item.ID">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="发放次数" prop="GrantNum" class="is-required">
<el-tooltip class="item" effect="dark" content="每个用户可发放次数;如不限制发放次数,请填写0" placement="top"
style="position: absolute;left: -10px;top:10px">
<i class="el-tooltip el-icon-info"></i>
</el-tooltip>
<el-input v-model="msg.GrantNum" class="el-input--small" :disabled="checked" step="1" min="0" onkeyup="this.value= this.value.match(/\d+(\d{0,2})?/) ? this.value.match(/\d+(\d{0,2})?/)[0] : ''" style="width: 30%;"/>
<el-checkbox v-model="checked" @change="checked==true? msg.GrantNum=0:msg.GrantNum=1" style="margin-left: 10px">无限制</el-checkbox>
</el-form-item>
<el-form-item label="领取人" >
<el-radio-group v-model="msg.IsAll" >
<el-radio :label="0">所有用户</el-radio>
<el-radio :label="1">指定用户</el-radio>
<button class="el-button el-button--text" v-if="msg.IsAll ==1" @click="choice">选择用户</button>
</el-radio-group>
<div style="flex-wrap: wrap;" flex="dir:left">
<div flex="dir:top cross:center" class="user-item" v-for="(item,index) in UserList" :label="item.Id" :key="index">
<img :src="item.Photo" alt="" class="avatar">
<div class="username">{{item.Name}}</div>
<button type="button" class="el-button close el-button--danger is-circle" @click="delUserList(index)"><i class="el-icon-close"></i></button>
</div>
</div>
</el-form-item>
</el-form>
</div>
<el-button type="primary" style="margin: 12px 0 " @click="preserve('msg')" :loading="loading2">保存</el-button>
<!--选择用户-->
<el-dialog title="选择用户" :visible.sync="category" width="612px">
<div class="el-input el-input--small el-input-group el-input-group--append">
<input type="text" autocomplete="off" placeholder="输入用户ID、昵称搜索" class="el-input__inner" v-model="msg_t.Name">
<div class="el-input-group__append"><button type="button" class="el-button el-button--default" @click="search"><!----><!----><span>搜索</span></button></div>
</div>
<el-table
:data="tableData"
tooltip-effect="dark"
style="width: 100%"
v-loading="loading"
@selection-change="handleSelectionChange">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
prop="Id"
label="ID"
width="176">
</el-table-column>
<el-table-column
label="所在平台"
width="174">
<template slot-scope="scope">
<img v-if="scope.row.Source==1" style="width:24px;height:24px" src="../../assets/img/statistics/wechat.png" alt="" class="platform-img">
<img v-if="scope.row.Source==2" style="width:24px;height:24px" src="../../assets/img/statistics/zhifubao.png" alt="" class="platform-img">
<img v-if="scope.row.Source==3" style="width:24px;height:24px" src="../../assets/img/statistics/douyin.png" alt="" class="platform-img">
<img v-if="scope.row.Source==4" style="width:24px;height:24px" src="../../assets/img/statistics/baidu.png" alt="" class="platform-img">
</template>
</el-table-column>
<el-table-column
prop="Name"
label="昵称"
show-overflow-tooltip>
</el-table-column>
</el-table>
<el-pagination style="text-align:right"
background
@current-change="handleCurrentChange"
:page-size="msg_t.pageSize"
:current-page.sync="msg_t.pageIndex"
layout="prev, pager, next"
:total="count">
</el-pagination>
<div slot="footer" class="dialog-footer">
<el-button @click="category = false">取 消</el-button>
<el-button type="primary" @click="getProductList">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: "addedautorelease",
data(){
return{
msg:{
ID:0,
TriggerType:0,
DiscountCouponId:0,
GrantNum:1,
IsAll:0,
UserList:[]
},
rules:{
GrantNum:[
{required: true, message: "最多发放次数不能为空", trigger: "blur"}
]
},
checked:false,
options:[],
options2:[],
Name:'',
category:false,
tableData: [],
msg_t:{
pageIndex:1,
pageSize:10,
Name:'',
SmallShopId:0,
},
count:0,
loading:false,
UserList:[],
Storage:[],
loading2:false
}
},
created(){
this.getrigger()
this.getrigger2()
setTimeout(()=>{
if(this.$route.query.ID){
this.gettRepositoryList(this.$route.query.ID)
}
},10)
},
methods:{
gettRepositoryList(ID){
this.apipost("/api/Education/GettRepositoryList",{'ID':ID} , res => {
if (res.data.resultCode == 1) {
this.msg = res.data.data
if(res.data.data.GrantNum==0){
this.checked=true
}
if(res.data.data.UserList){
this.UserList= res.data.data.UserList
for(let i = 0;i<this.UserList.length;i++){
this.UserList[i].Id = this.UserList[i].UserId
}
}
} else {
this.Info(res.data.message);
}
})
},
getrigger(){
this.apipost("/api/Coupon/GetTriggerTypeEnumList",{}, res => {
if (res.data.resultCode == 1) {
this.options = res.data.data;
this.msg.TriggerType = res.data.data[0].Id
} else {
this.Info(res.data.message);
}
})
},
getrigger2(){
this.apipost("/api/Education/GetAllDiscountCouponList",{}, res => {
if (res.data.resultCode == 1) {
this.options2 = res.data.data;
this.msg.DiscountCouponId = res.data.data[0].ID
} else {
this.Info(res.data.message);
}
})
},
choice(){
this.options2.forEach(x=>{
if(x.ID == this.msg.DiscountCouponId){
this.msg_t.SmallShopId = x.SmallShopId
}
})
this.category = true;
this.msg_t.pageIndex =1
this.getList()
},
getList(){
this.loading =true
this.apipost("/api/User/GetPageListByKey",this.msg_t, res => {
this.loading =false
if (res.data.resultCode == 1) {
this.tableData = res.data.data.pageData;
this.count = res.data.data.count;
} else {
this.Info(res.data.message);
}
})
},
getProductList(){
if(this.UserList.length>0){
let newStorage =[]
for(let i= 0;i<this.UserList.length;i++){
for(let j= 0;j<this.Storage.length;j++){
if(this.UserList[i].Id != this.Storage[j].Id){
newStorage.push(this.Storage[j])
}
}
}
this.UserList = this.UserList.concat(newStorage)
}else {
this.UserList = this.UserList.concat(this.Storage)
}
this.category = false;
},
search(){
this.msg_t.pageIndex =1
this.getList();
},
preserve(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
let UList =[];
for(let i= 0;i<this.UserList.length;i++){
UList.push({'UserId':this.UserList[i].Id})
}
this.msg.UserList= UList
this.loading2 = true;
this.apipost("/api/Education/AddOrUpdateSelfMotion",this.msg, res => {
this.loading2 = false;
if (res.data.resultCode == 1) {
this.Success(res.data.message);
this.$router.go(-1);//返回上一层
} else {
this.Info(res.data.message);
}
})
} else {
return false;
}
});
},
handleSelectionChange(val){
this.Storage = val
},
handleCurrentChange(val) {
this.msg_t.pageIndex = val;
this.getList();
},
delUserList(index){
this.UserList.splice(index,1)
},
cancel(){
this.$router.go(-1)
}
}
}
</script>
<style >
.addedautorelease .form-box {
background: #fff;
padding: 20px 50% 20px 0;
margin-top: 10px;
}
.addedautorelease .el-input--small .el-input__inner{
margin-left: 10px;
height: 32px;
line-height: 32px;
}
.addedautorelease .form-body{
background-color: #fff;
padding: 10px 50% 10px 20px;
min-width: 1000px;
}
.addedautorelease .user-item {
border: 1px #eeeeee solid;
padding: 20px;
margin-right: 20px;
margin-bottom: 20px;
width: 120px;
height: 120px;
position: relative;
}
.addedautorelease .user-item .close {
position: absolute;
right: -10px;
top: -10px;
padding: 0;
border-radius: 100px;
width: 20px;
height: 20px;
}
.addedautorelease .user-item .avatar {
width: 50px;
height: 50px;
}
</style>
<template>
<div class="courseCardManage">
<div class="el-card__header">
<span>课程卡管理</span>
<div style="display: flex;flex-direction: row;align-items: center">
<el-button type="primary" class="el-button--small" @click="addRecharge">新增</el-button>
</div>
</div>
<div class="content">
<div style="display: flex;flex-direction: row;align-items: center">
<div class="block">
<div class="searchInput" style="width:250px">
<el-input style="display:inline-block;width:225px;height:30px"
placeholder="请输入课程卡名称搜索"
v-model="msg.Name"
size="small"
@clear="getList"
@keyup.enter.native="getList"
clearable>
</el-input>
<span @click="getList" class="el-icon-search" style="color:#979dad;font-size:14px;position:relative;top:1px"></span>
</div>
</div>
</div>
</div>
<div style="padding: 20px;background: #fff;">
<el-table
:data="tableData"
header-cell-class-name="headClass"
style="width: 100%"
border
>
<el-table-column
prop="ID"
label="ID"
width="100">
</el-table-column>
<el-table-column
prop="Name"
label="课程卡信息">
<template slot-scope="scope">
<div class="app-image" :style="{backgroundImage:'url(' + scope.row.CouponIco + ')',backgroundSize:'cover'}"></div>
<div flex="dir:left cross:center">
{{scope.row.Name}}
</div>
</template>
</el-table-column>
<el-table-column
prop="TotalNum"
label="可用次数">
<template slot-scope="scope">
<div v-if="scope.row.TotalNum!=-1">{{scope.row.TotalNum}}</div>
<div v-if="scope.row.TotalNum==-1">无限制</div>
</template>
</el-table-column>
<!-- <el-table-column-->
<!-- prop="MinConsumePrice"-->
<!-- label="最低消费金额(元)"-->
<!-- width="100">-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- label="优惠方式"-->
<!-- width="150">-->
<!-- <template slot-scope="scope">-->
<!-- <div v-if="scope.row.CouponType==1">优惠:{{scope.row.DiscountsPrice}}元</div>-->
<!-- <div v-if="scope.row.CouponType==2">-->
<!-- <div>{{scope.row.DiscountsPrice}}折</div>-->
<!-- <div v-if="scope.row.MaxDiscountsPrice!=0">优惠上限:{{scope.row.MaxDiscountsPrice}}元</div>-->
<!-- <div v-if="scope.row.MaxDiscountsPrice==0">优惠上限:无上限</div>-->
<!-- </div>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- prop="UseTypeStr"-->
<!-- label="使用范围"-->
<!-- width="120">-->
<!-- </el-table-column>-->
<el-table-column
label="有效时间"
prop="StartDate">
<template slot-scope="scope">
<div v-if="scope.row.IndateType==1">领取后{{scope.row.IndateDay}}天内有效</div>
<div v-if="scope.row.IndateType==2">开始时间:{{scope.row.StartDate}}</div>
<div v-if="scope.row.IndateType==2">结束时间:{{scope.row.EndDate}}</div>
</template>
</el-table-column>
<el-table-column
label="添加日期"
prop="CreateDate">
</el-table-column>
<el-table-column
label="加入领券中心 "
width="120">
<!--PickupType-->
<template slot-scope="scope">
<el-switch
@change="dianswitch(scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.PickupCenter"
>
</el-switch>
</template>
</el-table-column>
<el-table-column
fixed="right"
label="操作"
width="180"
>
<template slot-scope="scope">
<el-tooltip class="item" effect="dark" content="发放优惠券" placement="top" >
<img src="../../assets/img/setup/send.png" alt="" class="imgstyle" @click="grant(scope.row)">
</el-tooltip>
<el-tooltip class="item" effect="dark" content="编辑" placement="top" >
<img src="../../assets/img/setup/edit.png" alt="" class="imgstyle" @click="Edit(scope.row)">
</el-tooltip>
<el-tooltip class="item" effect="dark" content="删除" placement="top" >
<img src="../../assets/img/setup/del.png" alt="" class="imgstyle" @click="delete_b(scope.row)">
</el-tooltip>
</template>
</el-table-column>
</el-table>
<el-pagination style="text-align:right"
background
@current-change="handleCurrentChange"
:page-size="msg.pageSize"
layout="prev, pager, next"
:current-page.sync="msg.pageIndex"
:total="count">
</el-pagination>
</div>
</div>
</template>
<script>
export default {
name: "courseCardManage",
data(){
return{
msg:{
pageIndex:1,
pageSize:20,
Name:'',
},
tableData:[],
count:0,
loading:false
}
},
created(){
this.getDateList();
},
methods:{
getDateList(){
this.loading=true;
this.apipost("/api/Education/GetDiscountCouponPageList", this.msg, res => {
this.loading=false;
if(res.data.resultCode==1){
this.tableData = res.data.data.pageData;
this.count = res.data.data.count;
}else {
this.Info(res.data.message);
}
})
},
addRecharge(){
this.$router.push('/addCourseCard');
},
grant(row){
var arr=JSON.stringify(row)
this.$router.push({
name: 'edgrantCouPon',
query: {
row
}
});
},
Edit(row){
this.$router.push({
name: 'addCourseCard',
query: {
ID:row.ID,
blank: "y"
}
});
},
delete_b(row){
let that=this;
that.Confirm("是否删除?", function () {
that.apipost(
"/api/Education/DelDiscountCoupon",
{Id:row.ID},
res => {
if (res.data.resultCode == 1) {
that.Success(res.data.message);
that.getDateList();
} else {
that.Error(res.data.message);
}
},
);
});
},
SetUp(){
this.$router.push('/rechargeSet');
},
getList(){
this.msg.pageIndex = 1
this.getDateList()
},
dianswitch(row){
this.apipost("/api/Education/UpdatePickupType", {'Id':row.ID}, res => {
if(res.data.resultCode==1){
this.Success(res.data.message);
}else {
this.Info(res.data.message);
}
})
},
handleCurrentChange(val) {
this.msg.pageIndex = val;
this.getDateList();
},
},
}
</script>
<style >
.courseCardManage .el-card__header{
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
background: #fff;
}
.courseCardManage .el-button--small{
padding: 9px 15px;
}
.courseCardManage .content .searchInput{
border: 1px solid #DCDFE6;
border-radius: 4px;
margin-left: 20px;
}
.courseCardManage .content .searchInput .el-input__inner{
border:none;outline:none;
height: 30px;
line-height: 30px;
}
.courseCardManage .content .searchInput{
line-height: normal;
display: inline-table;
border-collapse: separate;
border-spacing: 0;
width:250px;
}
.courseCardManage .content{
background: #fff;
margin-top:10px;
padding: 15px;
box-sizing: border-box;
}
.courseCardManage .app-image{
background-position: center center;
width: 50px;
height: 50px;
border-radius:0%;
float: left;
margin-right: 8px;
}
</style>
<template>
<div class="edautorelease">
<div class="el-card__header">
<span>自动发放</span>
<div style="display: flex;flex-direction: row;align-items: center">
<el-button type="primary" class="el-button--small" @click="addRecharge">添加自动发放方案</el-button>
</div>
</div>
<div style="padding: 20px;background: #fff;">
<el-table
:data="tableData"
header-cell-class-name="headClass"
style="100%"
border
v-loading="loading"
>
<el-table-column
prop="ID"
label="ID">
</el-table-column>
<el-table-column
prop="TriggerTypeStr"
label="触发事件">
</el-table-column>
<el-table-column
prop="DiscountCouponName"
label="课程卡">
</el-table-column>
<el-table-column
prop="GrantNum"
label="发放次数限制">
<template slot-scope="scope">
<div v-if="scope.row.GrantNum==0">
无限制
</div>
<div v-if="scope.row.GrantNum>0">
{{scope.row.GrantNum}}
</div>
</template>
</el-table-column>
<el-table-column
fixed="right"
label="操作"
>
<template slot-scope="scope">
<el-tooltip class="item" effect="dark" content="编辑" placement="top" >
<img src="../../assets/img/setup/edit.png" alt="" class="imgstyle" @click="Edit(scope.row)">
</el-tooltip>
<el-tooltip class="item" effect="dark" content="删除" placement="top" >
<img src="../../assets/img/setup/del.png" alt="" class="imgstyle" @click="delete_b(scope.row)">
</el-tooltip>
</template>
</el-table-column>
</el-table>
<el-pagination style="text-align:right"
background
@current-change="handleCurrentChange"
:page-size="msg.pageSize"
layout="prev, pager, next"
:total="count">
</el-pagination>
</div>
</div>
</template>
<script>
export default {
name: "edautorelease",
data(){
return{
msg:{
pageIndex:1,
pageSize:20,
},
tableData:[],
count:0,
loading:false
}
},
created(){
this.getDateList();
},
methods:{
getDateList(){
this.loading=true;
this.apipost("/api/Education/GetSelfMotionPageList", this.msg, res => {
this.loading=false;
if(res.data.resultCode==1){
this.tableData = res.data.data.pageData;
this.count = res.data.data.count;
}else {
this.Info(res.data.message);
}
})
},
addRecharge(){
this.$router.push('/addedautorelease');
},
Edit(row){
this.$router.push({
name: 'addedautorelease',
query: {
ID:row.ID,
blank: "y"
}
});
},
delete_b(row){
let that=this;
that.Confirm("是否删除?", function () {
that.apipost(
"/api/Education/DelDiscountSelfMotion",
{Id:row.ID},
res => {
if (res.data.resultCode == 1) {
that.Success(res.data.message);
that.getDateList();
} else {
that.Error(res.data.message);
}
},
);
});
},
handleCurrentChange(val) {
this.msg.pageIndex = val;
this.getDateList();
},
}
}
</script>
<style >
.edautorelease .el-card__header{
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
background: #fff;
}
.edautorelease .el-button--small{
padding: 9px 15px;
}
.edautorelease .content .searchInput{
border: 1px solid #DCDFE6;
border-radius: 4px;
margin-left: 20px;
}
.edautorelease .content .searchInput .el-input__inner{
border:none;outline:none;
height: 30px;
line-height: 30px;
}
.edautorelease .content .searchInput{
line-height: normal;
display: inline-table;
border-collapse: separate;
border-spacing: 0;
width:250px;
}
.edautorelease .content{
background: #fff;
margin-top:10px;
padding: 15px;
box-sizing: border-box;
}
</style>
<template>
<div class="edgrantCouPon">
<div class="form-box" style="margin-top: 0">
<div>
<span style="color: rgb(64, 158, 255);cursor: pointer;margin-left: 20px" @click="cancel">课程卡管理</span>
<span style="margin: 0 5px;color: #C0C4CC;">/</span>
<span>课程卡发放</span>
</div>
</div>
<div class="el-card__body" style="background-color: white; padding: 15px 50% 15px 0 ;margin-top: 20px">
<el-form :model="msg" style="padding:0 20px;" :rules="rules" ref="msg" label-width="160px" size="medium">
<el-form-item label="课程卡名称">
<span>{{record.Name}}</span>
</el-form-item>
<el-form-item label="剩余数量">
<div v-if="record.TotalNum ==-1">{{record.TotalNum ==-1? '无限制领取':record.TotalNum}}</div>
<div v-if="record.TotalNum !=-1">{{record.TotalNum}}</div>
</el-form-item>
<el-form-item label="课程卡有效期">
<div v-if="record.IndateType==1">领取后{{record.IndateDay}}天内有效</div>
<div v-if="record.IndateType==2">开始时间:{{record.StartDate}}</div>
<div v-if="record.IndateType==2">结束时间:{{record.EndDate}}</div>
</el-form-item>
<el-form-item label="发送数量" prop="GrantNum">
<el-input v-model="msg.GrantNum" size="small" style="width: 40%" step="1" min="0" onkeyup="this.value= this.value.match(/\d+(\d{0,2})?/) ? this.value.match(/\d+(\d{0,2})?/)[0] : ''"/>
</el-form-item>
<el-form-item label="发放对象" >
<el-tooltip class="item" effect="dark" content="请输入昵称/ID/手机号查找用户" placement="top"
style="position: absolute;left: -10px;top:10px">
<i class="el-tooltip el-icon-info"></i>
</el-tooltip>
<el-input v-model="AliasName" style="width: 20%;margin-left: 5px" placeholder="昵称/ID/手机号" size="small"/>
<el-button :loading="loading" @click="lookup" size="small">查找用户</el-button>
<div style="width: 80%;display: flex;flex-direction: row;flex-wrap: wrap;margin-top: 5px" v-if="ByPhone.length>0">
<el-checkbox-group v-model="msg.UserIds" @change = 'SelectBy'>
<el-checkbox-button v-for="(item,index) in ByPhone" :label="item.Id" :key="index" >
<img :src="item.Photo" alt="" class="avatar">
<div class="username">{{item.AliasName}}</div>
</el-checkbox-button>
</el-checkbox-group>
</div>
<div style="width: 30%;display: flex;flex-direction: row;margin-top: 5px;justify-content: center;color: #666666" v-if="ByPhone.length==0">暂无数据~</div>
</el-form-item>
</el-form>
</div>
<el-button type="primary" style="margin: 12px 0 " @click="preserve('msg')" :loading="loading2">保存</el-button>
<el-button @click="cancel">取消</el-button>
</div>
</template>
<script>
export default {
name: "edgrantCouPon",
data(){
return{
record:{},
msg:{
GrantNum:0,
UserIds:[],
},
AliasName:'',
rules:{
GrantNum:[
{ validator: this.DiscountsPrice, trigger: 'blur' }
]
},
loading:false,
loading2:false,
ByPhone:[],
}
},
created(){
if(this.$route.query.row){
this.record = this.$route.query.row
}
},
methods:{
cancel(){
this.$router.go(-1)
},
lookup(){
this.msg.UserIds = [];//重新选择的时候清楚之前的
this.loading = true;
this.apipost("/api/User/GetListByPhoneOrAliasName",{'AliasName':this.AliasName,SmallShopId:this.record.SmallShopId}, res => {
this.loading = false;
if (res.data.resultCode == 1) {
this.ByPhone = res.data.data
} else {
this.Info(res.data.message);
}
})
},
SelectBy(val){
this.msg.UserIds = val
},
DiscountsPrice(rule, value, callback) {
if(value>0){
return callback();
}else {
return callback(new Error('发送数量需大于零'));
}
},
preserve(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
let UserIds = ''
if(this.msg.UserIds.length>0){
UserIds = this.msg.UserIds.join(",")
}
let data = {
ID: this.record.ID,
GrantNum :this.msg.GrantNum,
UserIds:UserIds,
}
this.apipost("/api/Education/GrantCoupon",data, res => {
this.loading2 = false;
if (res.data.resultCode == 1) {
this.Success(res.data.message);
this.$router.go(-1);//返回上一层
} else {
this.Info(res.data.message);
}
})
} else {
return false;
}
});
}
}
}
</script>
<style >
.edgrantCouPon .form-box {
background: #fff;
padding: 18px 50% 18px 0;
margin-top: 10px;
}
.edgrantCouPon .el-input--small .el-input__inner{
height: 32px;
line-height: 32px;
}
.edgrantCouPon .username{
margin-top: 10px;
font-size: 13px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.edgrantCouPon .el-checkbox-button__inner {
border: 1px solid #e2e2e2;
height: 125px;
width: 120px;
padding-top: 15px;
text-align: center;
margin: 0 20px 20px 0;
cursor: pointer;
border-radius: 0!important;
}
.edgrantCouPon .el-checkbox-button, .el-checkbox-button__inner{
display: inline-block;
position: relative;
}
.edgrantCouPon .avatar {
height: 60px;
width: 60px;
border-radius: 30px;
}
</style>
...@@ -169,6 +169,12 @@ ...@@ -169,6 +169,12 @@
<li class="menu_item" :class="{'Fchecked':isChecked=='/lecturermanage'}" @click="isChecked='/lecturermanage',CommonJump('lecturermanage')"> <li class="menu_item" :class="{'Fchecked':isChecked=='/lecturermanage'}" @click="isChecked='/lecturermanage',CommonJump('lecturermanage')">
<i class="el-icon-menu"></i><span>讲师管理</span> <i class="el-icon-menu"></i><span>讲师管理</span>
</li> </li>
<li class="menu_item" :class="{'Fchecked':isChecked=='/courseCardManage'}" @click="isChecked='/courseCardManage',CommonJump('courseCardManage')">
<i class="el-icon-menu"></i><span>课程卡管理</span>
</li>
<li class="menu_item" :class="{'Fchecked':isChecked=='/edautorelease'}" @click="isChecked='/edautorelease',CommonJump('edautorelease')">
<i class="el-icon-menu"></i><span>课程卡自动发放</span>
</li>
</ul> </ul>
......
<template> <template>
<div>讲师管理</div> <div class="lecturermanage">
<div class="el-card__header">
<span>讲师管理</span>
<div style="display: flex;flex-direction: row;align-items: center">
<el-button type="primary" class="el-button--small" @click="addRecharge">新增</el-button>
</div>
</div>
<div class="content">
<div style="display: flex;flex-direction: row;align-items: center">
<div class="block" >
<div class="searchInput" style="width:200px">
<el-input style="display:inline-block;width:170px;height:30px"
placeholder="请输入姓名搜索"
v-model="msg.Name"
size="small"
@clear="getList"
@keyup.enter.native="getList"
clearable>
</el-input>
<span @click="getList" class="el-icon-search" style="color:#979dad;font-size:14px;position:relative;top:1px"></span>
</div>
<div class="searchInput" style="width:200px">
<el-input style="display:inline-block;width:170px;height:30px"
placeholder="请输入ID搜索"
v-model="msg.ID"
size="small"
@clear="getList"
@keyup.enter.native="getList"
clearable>
</el-input>
<span @click="getList" class="el-icon-search" style="color:#979dad;font-size:14px;position:relative;top:1px"></span>
</div>
<div class="searchInput" style="width:200px">
<el-input style="display:inline-block;width:170px;height:30px"
placeholder="请输入联系电话搜索"
v-model="msg.Telephone"
size="small"
@clear="getList"
@keyup.enter.native="getList"
clearable>
</el-input>
<span @click="getList" class="el-icon-search" style="color:#979dad;font-size:14px;position:relative;top:1px"></span>
</div>
<el-button @click="tableSet(1)" style="margin-left:10px;" size="mini">上架</el-button>
<el-button @click="tableSet(2)" style="margin-left:10px;" size="mini">下架</el-button>
</div>
</div>
</div>
<div style="padding: 20px;background: #fff;">
<el-table
:data="tableData"
header-cell-class-name="headClass"
style="width: 100%"
border
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" style="text-align:center;"></el-table-column>
<el-table-column
prop="ID"
label="ID"
width="100">
</el-table-column>
<el-table-column
prop="Name"
label="信息">
<template slot-scope="scope">
<div class="app-image" :style="{backgroundImage:'url(' + scope.row.TeacherLogo + ')',backgroundSize:'cover'}"></div>
<div flex="dir:left cross:center">
{{scope.row.Name}}
</div>
</template>
</el-table-column>
<el-table-column
prop="Major"
label="专业"
>
</el-table-column>
<el-table-column
prop="GoodsNum"
label="关联课程数">
</el-table-column>
<el-table-column
prop="OrderNum"
label="关联订单">
</el-table-column>
<el-table-column
prop="Telephone"
label="联系电话"
>
</el-table-column>
<el-table-column
prop="TeacherStatus"
width="100"
label="状态">
<template slot-scope="scope">
<el-tag v-if="scope.row.TeacherStatus==1" type="success">销售中</el-tag>
<el-tag v-if="scope.row.TeacherStatus==2" type="warning">下架中</el-tag>
</template>
</el-table-column>
<el-table-column
fixed="right"
label="操作"
width="180"
>
<template slot-scope="scope">
<el-tooltip class="item" effect="dark" content="编辑" placement="top" >
<img src="../../assets/img/setup/edit.png" alt="" class="imgstyle" @click="Edit(scope.row)">
</el-tooltip>
<!-- <el-tooltip class="item" effect="dark" content="删除" placement="top" >-->
<!-- <img src="../../assets/img/setup/del.png" alt="" class="imgstyle" @click="delete_b(scope.row)">-->
<!-- </el-tooltip>-->
</template>
</el-table-column>
</el-table>
<el-pagination style="text-align:right"
background
@current-change="handleCurrentChange"
:page-size="msg.pageSize"
layout="prev, pager, next"
:current-page.sync="msg.pageIndex"
:total="count">
</el-pagination>
</div>
</div>
</template> </template>
<script> <script>
export default { export default {
name: "lecturermanage" name: "lecturermanage",
data(){
return{
msg:{
pageIndex:1,
pageSize:20,
Name:'',
ID:'',
Telephone:'',
},
changeState:false,
dateList:[],
tableData:[],
count:0,
loading:false,
EnableMsg:{
Ids:'',
TeacherStatus:0,
},
}
},
created(){
this.getDateList();//获取老师分页
},
methods:{
getDateList(){
let msg = JSON.parse(JSON.stringify(this.msg))
if(msg.ID ==''){
msg.ID=0
}
this.loading=true;
this.apipost("/api/Education/GetTeacherPageList", msg, res => {
this.loading=false;
if(res.data.resultCode==1){
this.tableData = res.data.data.pageData;
this.count = res.data.data.count;
}else {
this.Info(res.data.message);
}
})
},
addRecharge(){
this.$router.push('/addLecturer');
},
enableGuideCar(){
this.apipost("/api/Education/EnableTeacherInfo", this.EnableMsg, res => {
if(res.data.resultCode==1){
this.Success(res.data.message)
this.getList()
}
})
},
tableSet(type){
this.EnableMsg.TeacherStatus = type;
if(this.EnableMsg.Ids.length==0){
this.Info('请选择讲师');
return
}
this.EnableMsg.Ids = this.EnableMsg.Ids.join(",");
this.enableGuideCar()
},
Edit(row){
this.$router.push({
name: 'addLecturer',
query: {
ID:row.ID,
blank: "y"
}
});
},
delete_b(row){
let that=this;
that.Confirm("是否删除?", function () {
that.apipost(
"/api/GuideCar/DelGuideCarSiteInfo",
{Id:row.ID},
res => {
if (res.data.resultCode == 1) {
that.Success(res.data.message);
that.getDateList();
} else {
that.Error(res.data.message);
}
},
);
});
},
//勾选导游
handleSelectionChange(val){
var selectRow = JSON.parse(JSON.stringify(val));
let array= [];
selectRow.forEach(x => {
let obj = {}
obj = x.ID;
array.push(obj)
});
this.EnableMsg.Ids = array
},
getList(){
this.msg.pageIndex = 1
this.getDateList()
},
handleCurrentChange(val) {
this.msg.pageIndex = val;
this.getDateList();
},
},
} }
</script> </script>
<style scoped> <style >
.lecturermanage .el-card__header{
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
background: #fff;
}
.lecturermanage .el-button--small{
padding: 9px 15px;
}
.lecturermanage .content .searchInput{
border: 1px solid #DCDFE6;
border-radius: 4px;
/*margin-left: 10px;*/
}
.lecturermanage .content .searchInput .el-input__inner{
border:none;outline:none;
height: 30px;
line-height: 30px;
}
.lecturermanage .content .searchInput{
line-height: normal;
display: inline-table;
border-collapse: separate;
border-spacing: 0;
width:250px;
}
.lecturermanage .content{
background: #fff;
margin-top:10px;
padding: 15px;
box-sizing: border-box;
}
.lecturermanage .el-tag{
margin-right: 5px;
}
.lecturermanage .app-image{
background-position: center center;
width: 50px;
height: 50px;
border-radius:0%;
float: left;
margin-right: 8px;
}
</style> </style>
...@@ -259,6 +259,42 @@ export default new Router({ ...@@ -259,6 +259,42 @@ export default new Router({
name: 'lecturermanage', name: 'lecturermanage',
component: resolve => require(['@/components/education/lecturermanage'], resolve), component: resolve => require(['@/components/education/lecturermanage'], resolve),
}, },
//网课 新增、修改讲师
{
path: '/addLecturer',
name: 'addLecturer',
component: resolve => require(['@/components/education/addLecturer'], resolve),
},
//网课 课程卡管理
{
path: '/courseCardManage',
name: 'courseCardManage',
component: resolve => require(['@/components/education/courseCardManage'], resolve),
},
//网课 新增、修改课程卡
{
path: '/addCourseCard',
name: 'addCourseCard',
component: resolve => require(['@/components/education/addCourseCard'], resolve),
},
//网课 发放课程卡
{
path: '/edgrantCouPon',
name: 'edgrantCouPon',
component: resolve => require(['@/components/education/edgrantCouPon'], resolve),
},
//网课 自动发放
{
path: '/edautorelease',
name: 'edautorelease',
component: resolve => require(['@/components/education/edautorelease'], resolve),
},
//网课 新增、修改自动发放
{
path: '/addedautorelease',
name: 'addedautorelease',
component: resolve => require(['@/components/education/addedautorelease'], resolve),
},
] ]
......
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