Commit 9447f5db authored by chenfenglei's avatar chenfenglei

工具管理修改

parent 4ec672e0
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</el-cascader> </el-cascader>
</el-form-item> </el-form-item>
<el-form-item label="老师"> <el-form-item label="老师">
<el-select v-model="form.teacher_id" placeholder="请选择"> <el-select v-model="form.teacher_id" placeholder="请选择" filterable >
<el-option <el-option
v-for="(data,index) in teacherList" v-for="(data,index) in teacherList"
:key="index" :key="index"
......
...@@ -140,12 +140,12 @@ ...@@ -140,12 +140,12 @@
{{scope.row.type|classTypeFilter}} {{scope.row.type|classTypeFilter}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
label="班级名称"> label="班级名称">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.teacher_name}}一班 {{scope.row.teacher_name}}一班
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column <el-table-column
prop="max_join_num" prop="max_join_num"
label="最大人数"> label="最大人数">
...@@ -254,12 +254,13 @@ ...@@ -254,12 +254,13 @@
let nowGoods = this.goodsList.find(i=>{return i.id === this.selectedGoods[0]}); let nowGoods = this.goodsList.find(i=>{return i.id === this.selectedGoods[0]});
this.periods = nowGoods.children.find(i=>{return i.id === this.selectedGoods[1]}); this.periods = nowGoods.children.find(i=>{return i.id === this.selectedGoods[1]});
this.teacher_id = ''; this.teacher_id = '';
this.getClassList() this.getClassList()
}) })
} else { } else {
getDefaultPeriodsApi().then(res=>{ getDefaultPeriodsApi().then(res=>{
if(res){ if(res){
this.goods_id = res.goods_id; this.goods_id = res.goods_id;
console.log(res)
this.selectedGoods = [parseInt(res.goods_id),parseInt(res.id)]; this.selectedGoods = [parseInt(res.goods_id),parseInt(res.id)];
getPeriodsApi({goods_id:this.selectedGoods[0]}).then(res=>{ getPeriodsApi({goods_id:this.selectedGoods[0]}).then(res=>{
res.list.forEach(i=>{i.name = i.title}); res.list.forEach(i=>{i.name = i.title});
......
<template> <template>
<div class="head-index"> <div class="head-index">
<img class="logo" :src="iconUrl" @click="toHome"/>{{$store.state.userName}} <img class="logo" :src="iconUrl" @click="toHome" />{{$store.state.userName}}
<div class="fl-r"> <div class="fl-r">
<!-- <el-button round size="mini" class="edit-btn" @click="dialogUpdate=true">修改密码 </el-button> <!-- <el-button round size="mini" class="edit-btn" @click="dialogUpdate=true">修改密码 </el-button> -->
<el-button round size="mini" class="edit-btn" @click="logOut">退出登录 </el-button> -->
<el-dropdown> <el-dropdown>
<el-button round size="mini" class="edit-btn" >工具管理 <i class="el-icon-arrow-down el-icon--right"></i></el-button> <el-button round size="mini" class="edit-btn">工具管理
<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item @click.native="entranceObj.show=true">无需登录入口</el-dropdown-item> --> <!-- <el-dropdown-item @click.native="entranceObj.show=true">无需登录入口</el-dropdown-item> -->
<el-dropdown-item @click.native="qrcodeObj.show=true">生成二维码</el-dropdown-item> <el-dropdown-item @click.native="linkObj.show=true">生成工具</el-dropdown-item>
<el-dropdown-item @click.native="linkObj.show=true">生成短链接</el-dropdown-item>
<el-dropdown-item @click.native="userObj.show=true">清除缓存</el-dropdown-item> <el-dropdown-item @click.native="userObj.show=true">清除缓存</el-dropdown-item>
<el-dropdown-item @click.native="dialogUpdate=true">修改密码</el-dropdown-item> <el-dropdown-item @click.native="dialogUpdate=true">修改密码</el-dropdown-item>
<el-dropdown-item @click.native="logOut">退出登录</el-dropdown-item> <el-dropdown-item @click.native="logOut">退出登录</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</div> </div>
<el-dialog <el-dialog title="修改密码" :visible.sync="dialogUpdate" center width="400px">
title="修改密码"
:visible.sync="dialogUpdate"
center
width="400px">
<el-form ref="ruleForm2" label-width="80px" :model="ruleForm2" :rules="rules2"> <el-form ref="ruleForm2" label-width="80px" :model="ruleForm2" :rules="rules2">
<el-form-item label="原密码" prop="oldPass"> <el-form-item label="原密码" prop="oldPass">
<el-input type="password" v-model="ruleForm2.oldPass"></el-input> <el-input type="password" v-model="ruleForm2.oldPass"></el-input>
...@@ -35,21 +30,17 @@ ...@@ -35,21 +30,17 @@
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogUpdate = false">取 消</el-button> <el-button @click="dialogUpdate = false">取 消</el-button>
<el-button type="primary" @click="changePass">确 定</el-button> <el-button type="primary" @click="changePass">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
<clear-cache :userObj="userObj" /> <clear-cache :userObj="userObj" />
<entrance :entranceObj="entranceObj" /> <get-link :linkObj="linkObj" />
<get-link :linkObj="linkObj" />
<getqr-code :qrcodeObj="qrcodeObj" />
</div> </div>
</template> </template>
<script> <script>
import clearCache from "./other/clearCache"; import clearCache from "./other/clearCache";
import entrance from "./other/entrance"; import getLink from "./other/getLink";
import getLink from "./other/getLink";
import getqrCode from "./other/getqrCode";
import { logoutApi, editAdminPasswordApi } from "../../service/api"; import { logoutApi, editAdminPasswordApi } from "../../service/api";
import iconUrl from "../../assets/logos.png"; import iconUrl from "../../assets/logos.png";
import cookie from "../../util/cookie"; import cookie from "../../util/cookie";
...@@ -84,22 +75,14 @@ export default { ...@@ -84,22 +75,14 @@ export default {
} }
}; };
return { return {
userObj:{ userObj: {
title:'清除缓存', title: "清除缓存",
show:false show: false
}, },
entranceObj:{ linkObj: {
title:'无需登录入口', title: "生成工具",
show:false show: false
}, },
linkObj:{
title:'生成短链接',
show:false
},
qrcodeObj:{
title:'生成二维码',
show:false
},
iconUrl: iconUrl, iconUrl: iconUrl,
dialogUpdate: false, dialogUpdate: false,
rules2: { rules2: {
...@@ -114,11 +97,9 @@ export default { ...@@ -114,11 +97,9 @@ export default {
} }
}; };
}, },
components:{ components: {
clearCache, clearCache,
entrance, getLink
getLink,
getqrCode
}, },
methods: { methods: {
a() { a() {
......
<template> <template>
<el-dialog :title="linkObj.title" <el-dialog :title="linkObj.title" :visible.sync="linkObj.show" center width="800px">
:visible.sync="linkObj.show" center
width="800px"> <el-tabs v-model="activeName" type="card" style="line-height:1">
<el-form :model="form" ref="form" label-width="100px"> <el-tab-pane label="生成短链接" name="first">
<el-form-item <el-form :model="linkForm" ref="linkForm" label-width="100px">
label="输入链接" <el-form-item label="输入链接" prop="link" :rules="[ { required: true, message: '内容不能为空'}]">
prop="link" <el-input v-model="linkForm.link" autocomplete="off"></el-input>
:rules="[ </el-form-item>
{ required: true, message: '内容不能为空'} <el-form-item>
]" <el-button type="primary" @click="submitForm('linkForm')">获取</el-button>
> </el-form-item>
<el-input v-model="form.link" autocomplete="off"></el-input> </el-form>
</el-form-item> <div class="link_content" v-if="linkContent.show">
<el-form-item> <div class="content">
<el-button type="primary" @click="submitForm('form')">获取</el-button> <el-input v-model="linkContent.text" readonly="readonly" id="text"></el-input>
</el-form-item> <textarea id="input" style="opacity:0;z-index=-10;position:absolute;top:0;left:0;"></textarea>
</el-form> </div>
<div class="link_content" v-if="content.show"> <el-button type="primary" @click="copyUrl(linkContent.text)">复制链接</el-button>
<div class="content"> </div>
<el-input v-model="content.text" readonly="readonly" id="text"></el-input> </el-tab-pane>
<textarea id="input" style="opacity:0;z-index=-10;position:absolute;top:0;left:0;"></textarea> <el-tab-pane label="生成二维码" name="second">
</div> <el-form :model="qrForm" ref="qrForm" label-width="100px" class="demo-ruleForm">
<el-button type="primary" @click="copyUrl(content.text)">复制链接</el-button> <el-form-item label="输入链接" prop="link" :rules="[{ required: true, message: '内容不能为空'} ]">
</div> <el-input v-model="qrForm.link" autocomplete="off"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitqrForm('qrForm')">获取</el-button>
</el-form-item>
</el-form>
<div class="link_content" v-if="qrContent.show">
<div class="qr_content">
<img :src="qrContent.url" id="cavasimg">
</div>
</div>
</el-tab-pane>
</el-tabs>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import {getLinkApi} from "../../../service/api"; import { getLinkApi } from "../../../service/api";
export default { export default {
name: "getLink", name: "getLink",
props: ["linkObj"], props: ["linkObj"],
data() { data() {
return { return {
form: { activeName: "first",
linkForm: {
link: "" link: ""
}, },
content:{ qrForm: {
show:false, link: ""
text:"" },
linkContent: {
show: false,
text: ""
},
qrContent: {
show: false,
url: ""
} }
}; };
}, },
...@@ -45,44 +66,70 @@ export default { ...@@ -45,44 +66,70 @@ export default {
submitForm(formName) { submitForm(formName) {
this.$refs[formName].validate(valid => { this.$refs[formName].validate(valid => {
if (valid) { if (valid) {
let json={} let json = {};
json.url=this.form.link; json.url = this.linkForm.link;
getLinkApi(json).then((res)=>{ getLinkApi(json).then(res => {
this.content.show=true; this.linkContent.show = true;
this.content.text=res.url; this.linkContent.text = res.url;
}) });
} else { } else {
console.log("error submit!!"); console.log("error submit!!");
return false; return false;
} }
}); });
}, },
copyUrl(data){ submitqrForm(formName) {
let url =data; this.$refs[formName].validate(valid => {
let oInput = document.createElement('input'); if (valid) {
oInput.value = url; let json1 = {};
document.body.appendChild(oInput); json1.url = this.qrForm.link;
oInput.select(); // 选择对象 this.qrContent.show = true;
document.execCommand("Copy"); // 执行浏览器复制命令 this.qrContent.url = `https://admin_test.changchangenglish.com/api/public/qrcode?str=${
this.$message({ json1.url
message: '已成功复制到剪切板', }`;
type: 'success' } else {
}); console.log("error submit!!");
oInput.remove() return false;
}, }
});
},
copyUrl(data) {
let url = data;
let oInput = document.createElement("input");
oInput.value = url;
document.body.appendChild(oInput);
oInput.select(); // 选择对象
document.execCommand("Copy"); // 执行浏览器复制命令
this.$message({
message: "已成功复制到剪切板",
type: "success"
});
oInput.remove();
}
}, },
watch:{ watch: {
'linkObj.show':function(a){ "linkObj.show": function(a) {
if(!a){ if (!a) {
this.form.link=""; this.linkForm.link = "";
this.content.show=false; this.qrForm.link = "";
this.linkContent.show = false;
this.qrContent.show = false;
} }
} }
} }
}; };
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.content{ .content {
height: 100px; height: 100px;
} }
.qr_content {
width: 300px;
height: 300px;
margin: 0 auto 20px;
img {
width: 300px;
height: 300px;
}
}
</style> </style>
\ No newline at end of file
<template>
<el-dialog :title="qrcodeObj.title"
:visible.sync="qrcodeObj.show" center
width="800px">
<el-form :model="form" ref="form" label-width="100px" class="demo-ruleForm">
<el-form-item
label="输入链接"
prop="link"
:rules="[
{ required: true, message: '内容不能为空'}
]"
>
<el-input v-model="form.link" autocomplete="off"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('form')">获取</el-button>
</el-form-item>
</el-form>
<div class="link_content" v-if="content.show">
<div class="content">
<img :src="content.url" id="cavasimg">
</div>
<a :href="content.url" download="a.png">
<!-- <el-button type="primary" >下载二维码</el-button> -->
</a>
</div>
</el-dialog>
</template>
<script>
import {getqrCodeApi} from "../../../service/api";
export default {
name: "getqrCode",
props: ["qrcodeObj"],
data() {
return {
form: {
link: ""
},
content:{
show:false,
url:''
}
};
},
methods: {
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
let json={}
json.url=this.form.link;
this.content.show=true;
this.content.url=`https://admin_test.changchangenglish.com/api/public/qrcode?str=${json.url}`
} else {
console.log("error submit!!");
return false;
}
});
},
},
watch:{
'qrcodeObj.show':function(a){
if(!a){
this.form.link="";
this.content.show=false;
}
}
}
};
</script>
<style scoped lang="less">
.content{
width: 300px;
height: 300px;
margin: 0 auto;
img{
width: 300px;
height: 300px;
}
}
</style>
\ No newline at end of file
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
<el-form-item label="描述"> <el-form-item label="描述">
<el-input v-model="searchFrom.desc"></el-input> <el-input v-model="searchFrom.desc"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="商品ID"> <el-form-item label="商品名称">
<el-select v-model="searchFrom.value" placeholder="请选择" clearable> <el-select v-model="searchFrom.value" placeholder="请选择">
<el-option <el-option
v-for="(data,index) in goodsList" v-for="(data,index) in goodsList"
:key="index" :key="index"
:label="data.name" :label="data | filterGoods"
:value="String(data.id)"> :value="String(data.id)">
</el-option> </el-option>
</el-select> </el-select>
...@@ -32,15 +32,15 @@ ...@@ -32,15 +32,15 @@
<el-form-item label="描述"> <el-form-item label="描述">
<el-input v-model="searchFrom2.desc"></el-input> <el-input v-model="searchFrom2.desc"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="期数ID"> <el-form-item label="期数名称">
<el-select v-model="searchFrom2.value" placeholder="请选择" clearable> <el-cascader
<el-option :options="periodsList"
v-for="(data,index) in periodList" :props="{value:'id',label:'name'}"
:key="index" @active-item-change="handleItemChange"
:label="data.title" @change="changePeriods"
:value="String(data.id)"> v-model="selectedGoods"
</el-option> >
</el-select> </el-cascader>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<div class="search-btn-block"> <div class="search-btn-block">
...@@ -48,13 +48,13 @@ ...@@ -48,13 +48,13 @@
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import {getConfigListApi,getGoodsListApi,getPeriodsApi,putConfigApi} from "../../../service/api"; import {getConfigListApi,getGoodsListApi,getPeriodsApi,putConfigApi,getDefaultPeriodsApi} from "../../service/api";
import {GOODSTYPE} from '../../util/wordbook';
export default { export default {
name:"entrance", name:"entrance",
props:[ props:[
...@@ -63,7 +63,8 @@ ...@@ -63,7 +63,8 @@
data(){ data(){
return{ return{
goodsList:[], goodsList:[],
periodList:[], periodsList:[],
goods_id:null,
activeName: 'first', activeName: 'first',
searchFrom:{ searchFrom:{
key:'goods_receive_course ', key:'goods_receive_course ',
...@@ -75,10 +76,16 @@ ...@@ -75,10 +76,16 @@
desc: '', desc: '',
value: '', value: '',
}, },
selectedGoods:[],
} }
}, },
mounted(){ mounted(){
}, },
filters:{
filterGoods(val){
return '[' + GOODSTYPE[val.goods_type] + ']' + '[' +val.current_price / 100 + '元]' + val.name
},
},
methods:{ methods:{
initPage(){ initPage(){
getConfigListApi({key:this.searchFrom.key}).then(res=>{ getConfigListApi({key:this.searchFrom.key}).then(res=>{
...@@ -92,12 +99,15 @@ ...@@ -92,12 +99,15 @@
}); });
getConfigListApi({key:this.searchFrom2.key}).then(res=>{ getConfigListApi({key:this.searchFrom2.key}).then(res=>{
if(res.list && res.list.length>0){ if(res.list && res.list.length>0){
this.searchFrom2.desc = res.list[0].desc; // this.searchFrom2.desc = res.list[0].desc;
this.searchFrom2.value = res.list[0].value; // this.selectedGoods = [parseInt(res.goods_id),parseInt(res.list[0].value)];
// console.log(res.list)
}else{ }else{
this.searchFrom2.desc = ''; this.searchFrom2.desc = '';
this.searchFrom2.value = ''; this.searchFrom2.value = '';
} }
this.searchFrom2.desc = '';
this.searchFrom2.value = '';
}) })
}, },
getPeriodsList(){ getPeriodsList(){
...@@ -106,7 +116,7 @@ ...@@ -106,7 +116,7 @@
page: 1 page: 1
} }
getPeriodsApi(json1).then(res=>{ getPeriodsApi(json1).then(res=>{
this.periodList = res.list; this.periodsList = res.list;
}); });
}, },
getGoodsList(){ getGoodsList(){
...@@ -127,7 +137,6 @@ ...@@ -127,7 +137,6 @@
}).then(() => { }).then(() => {
console.log(data); console.log(data);
let json ={ let json ={
} }
json.value=data.value; json.value=data.value;
json.key=data.key; json.key=data.key;
...@@ -145,8 +154,32 @@ ...@@ -145,8 +154,32 @@
message: "请设置选择项!" message: "请设置选择项!"
}); });
} }
} },
changePeriods(data){
if(data.length>1){
this.searchFrom2.value=String(data[1]);
}
},
handleItemChange(val){
getPeriodsApi({goods_id:val[0]}).then(res=>{
res.list.forEach(i=>{i.name = i.title});
this.periodsList.find(i=>{return i.id === val[0]}).children = res.list
})
},
initPage1(){
let json = {
page: 1,
limit: 100,
goods_type:'1,2'
};
getGoodsListApi(json).then(res=>{
res.list.forEach(i=>{
i.children = [];
});
this.periodsList = res.list;
});
},
}, },
watch:{ watch:{
'entranceObj.show':function(a){ 'entranceObj.show':function(a){
...@@ -154,11 +187,7 @@ ...@@ -154,11 +187,7 @@
this.initPage() this.initPage()
this.getPeriodsList(); this.getPeriodsList();
this.getGoodsList(); this.getGoodsList();
}else{ this.initPage1();
this.searchFrom2.value="";
this.searchFrom2.desc="";
this.searchFrom.value="";
this.searchFrom.desc="";
} }
} }
} }
......
<template> <template>
<div> <div class="not_buy">
<div class="head clear-both">
<el-button plain type="success" style="float: right;margin-bottom:20px;" v-if="!$store.state.readonly" @click="entranceObj.show=true">无需登录入口</el-button>
</div>
<el-table :data="configList" style="width: 100%">
<el-table-column label="用户ID" sortable prop="scope.row.user_id" className="userInfo">
<template slot-scope="scope">
<img class="avatar" :src="scope.row.avatar">
{{scope.row.nickname}}(ID:{{scope.row.user_id}})
</template>
</el-table-column>
<el-table-column prop="class_id" label="班级ID">
</el-table-column>
<el-table-column label="商品ID/期数ID">
<template slot-scope="scope">
{{scope.row.goods_id}}/{{scope.row.periods_id}}
</template>
</el-table-column>
<el-table-column prop="created_at" label="创建时间" sortable>
</el-table-column>
<el-table-column prop="updated_at" label="结束时间" sortable>
</el-table-column>
</el-table>
<page :nowPage="nowPage" :total="total" @pageChange="onPageChange" @sizeChange="onSizeChange" />
<entrance :entranceObj="entranceObj" />
</div> </div>
</template> </template>
<script> <script>
import {getNotBuyApi} from "../../service/api" import entrance from "./entrance";
export default { import { getClassConfigApi } from "../../service/api";
name: "notBuyClass", import page from "../framework/page";
data(){ export default {
return{ name: "notBuyClass",
data() {
return {
nowPage: 1,
total: 0,
limit: 10,
configList: [],
entranceObj: {
title: "无需登录入口",
show: false
} }
};
},
components: {
entrance,
page
},
mounted() {
this.getList();
},
methods: {
onPageChange(val) {
this.nowPage = val;
this.getList();
}, },
mounted(){ onSizeChange(val) {
this.nowPage = 1;
this.limit = val;
this.getList();
}, },
getList() {
methods:{ let json = {
getList(){ limit: this.limit,
let json=""; page: this.nowPage
getNotBuyApi(json).then((res)=>{ };
console.log(res); getClassConfigApi(json).then(res => {
}) console.log(res);
}, this.total = res.total;
this.configList=res.list;
});
}
} }
} };
</script> </script>
<style scoped> <style scoped lang="less">
.not_buy {
.head {
margin-bottom: 10px;
}
width: 100%;
padding: 20px 0;
.page-div {
text-align: center;
padding-top: 20px;
}
}
.avatar {
width:50px;
height: 50px;
border-radius: 50%;
}
</style>
<style>
.userInfo >div{
display: flex;
flex-flow: row nowrap;
justify-content: flex-start;
align-items: center;
}
</style> </style>
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
import detailDialog from './detail' import detailDialog from './detail'
import refundDetail from './refundDetail' import refundDetail from './refundDetail'
import AddressArray from '../framework/address-picker/addr' import AddressArray from '../framework/address-picker/addr'
import {INVITETYPE,ORDERSTATUS,BUYTYPE,BUYTYPEOPTION,ORDERSTATUSOPTION,INVITETYPEOPTION} from "../../util/wordbook"; import {INVITETYPE,ORDERSTATUS,BUYTYPE,BUYTYPEOPTION,ORDERSTATUSOPTION,INVITETYPEOPTION,GOODSTYPE} from "../../util/wordbook";
import CommonJs from '../../util/common'; import CommonJs from '../../util/common';
export default { export default {
...@@ -670,7 +670,7 @@ ...@@ -670,7 +670,7 @@
return val = val / 100 + '元' return val = val / 100 + '元'
}, },
filterGoods(val){ filterGoods(val){
return val.name + '[' +val.current_price / 100 + '元]' return '[' + GOODSTYPE[val.goods_type] + ']' + '[' +val.current_price / 100 + '元]' + val.name
} }
} }
} }
......
...@@ -23,7 +23,15 @@ ...@@ -23,7 +23,15 @@
</el-col> </el-col>
</el-row> </el-row>
<el-form-item label="期数名称" prop="title"> <el-form-item label="期数名称" prop="title">
<el-input v-model="form.title"></el-input> <!-- <el-input v-model="form.title"></el-input> -->
<el-cascader
:options="periodsList"
:props="{value:'id',label:'name'}"
@active-item-change="handleItemChange"
@change="changePeriods"
v-model="selectedGoods"
>
</el-cascader>
</el-form-item> </el-form-item>
<el-form-item label="开始主题" prop="startNum"> <el-form-item label="开始主题" prop="startNum">
<el-select v-model="form.startNum" clearable placeholder="请选择"> <el-select v-model="form.startNum" clearable placeholder="请选择">
...@@ -46,7 +54,7 @@ ...@@ -46,7 +54,7 @@
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="带班老师" prop="teacherList" v-if = "!form.id"> <el-form-item label="带班老师" prop="teacherList" v-if = "!form.id">
<el-select v-model="form.teacherList" placeholder="请选择" @change="onTeacher1Change"> <el-select v-model="form.teacherList" placeholder="请选择" @change="onTeacher1Change" filterable multiple>
<el-option <el-option
v-for="item in teacher1Options" v-for="item in teacher1Options"
:key="item.id" :key="item.id"
...@@ -56,7 +64,7 @@ ...@@ -56,7 +64,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="观摩老师" prop="viewTeacher" v-if = "!form.id"> <el-form-item label="观摩老师" prop="viewTeacher" v-if = "!form.id">
<el-select v-model="form.viewTeacher" placeholder="请选择" @change="onTeacher2Change"> <el-select v-model="form.viewTeacher" placeholder="请选择" @change="onTeacher2Change" filterable multiple>
<el-option <el-option
v-for="item in teacher2Options" v-for="item in teacher2Options"
:key="item.id" :key="item.id"
...@@ -93,7 +101,7 @@ ...@@ -93,7 +101,7 @@
</template> </template>
<script> <script>
import {getGoodsListApi,getAddPeriodsApi,getTeacherListApi,getEditPeriodsApi,getLessonDetailApi} from "../../service/api"; import {getGoodsListApi,getAddPeriodsApi,getTeacherListApi,getEditPeriodsApi,getLessonDetailApi,getPeriodsApi} from "../../service/api";
import {ISORNOT,GOODSTYPE,LESSONTYPE,GOODSSTATUS} from "../../util/wordbook"; import {ISORNOT,GOODSTYPE,LESSONTYPE,GOODSSTATUS} from "../../util/wordbook";
import goodDialog from './dialog' import goodDialog from './dialog'
export default { export default {
...@@ -104,7 +112,14 @@ ...@@ -104,7 +112,14 @@
return{ return{
loading: false, loading: false,
form: { form: {
is_add_teacher_to_class: false is_add_teacher_to_class: false,
goods_id:'',
teacherList:'',
viewTeacher:'',
is_add_teacher_to_class:'',
rest_week_day:'',
title:"",
goods_id:"",
}, },
show: false, show: false,
viewTeacher: '', viewTeacher: '',
...@@ -173,7 +188,9 @@ ...@@ -173,7 +188,9 @@
viewTeacher: [ viewTeacher: [
{ required: true, message: '观摩老师不能为空', trigger: 'change' } { required: true, message: '观摩老师不能为空', trigger: 'change' }
] ]
} },
periodsList:[],
selectedGoods:[],
} }
}, },
components:{ components:{
...@@ -198,7 +215,7 @@ ...@@ -198,7 +215,7 @@
return GOODSSTATUS[value] return GOODSSTATUS[value]
}, },
filterGoods(val){ filterGoods(val){
return '(id:'+val.id+')' + val.name + '[' +val.current_price / 100 + '元]' return '[' + GOODSTYPE[val.goods_type] + ']' + '[' +val.current_price / 100 + '元]' + val.name
} }
}, },
methods:{ methods:{
...@@ -249,7 +266,7 @@ ...@@ -249,7 +266,7 @@
findDifferentArray(array1, array2){ findDifferentArray(array1, array2){
let newArray = [] let newArray = []
array1.forEach((val)=>{ array1.forEach((val)=>{
let index = array2.findIndex((item)=>{ let index = array1.findIndex((item)=>{
return val.id == item return val.id == item
}) })
if (index === -1) { if (index === -1) {
...@@ -281,6 +298,7 @@ ...@@ -281,6 +298,7 @@
}, },
getLessonDetail(id){ getLessonDetail(id){
getLessonDetailApi(id,{}).then((res) => { getLessonDetailApi(id,{}).then((res) => {
console.log(res)
this.itemOptions = res.detail[res.type] this.itemOptions = res.detail[res.type]
}) })
}, },
...@@ -303,12 +321,46 @@ ...@@ -303,12 +321,46 @@
} }
this.show = this.dialogObj.show this.show = this.dialogObj.show
}) })
} },
changePeriods(data){
if(data.length>1){
this.form.title=String(data[1]);
}
},
handleItemChange(val){
getPeriodsApi({goods_id:val[0]}).then(res=>{
res.list.forEach(i=>{i.name = i.title});
this.periodsList.find(i=>{return i.id === val[0]}).children = res.list
})
},
initPage1(){
let json = {
page: 1,
limit: 100,
goods_type:'1,2'
};
getGoodsListApi(json).then(res=>{
res.list.forEach(i=>{
i.children = [];
});
this.periodsList = res.list;
});
},
}, },
mounted(){ mounted(){
// this.initPage() // this.initPage()
this.getTeachers(); this.getTeachers();
this.getGoodsOption(); this.getGoodsOption();
this.initPage1();
},
watch:{
'dialogObj.show':function(a){
if(a){
}
}
} }
} }
</script> </script>
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
prop="id" prop="id"
label="商品ID"> label="商品编号" width="80">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="name" prop="name"
......
This diff is collapsed.
This diff is collapsed.
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