Commit 99540928 authored by 赵茹林's avatar 赵茹林

回访信息 [更新] 去掉只读时不能添加回访信息的权限判断

回访信息 [修复] 班级成员界面点沟通情况时未传teacher id导致不能添加回访信息的问题
教师列表选择框 [更新] 接口条数限制改为500
parent 24b04b2a
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
v-for="(data,index) in teacherList" v-for="(data,index) in teacherList"
:key="index" :key="index"
:label="data.name" :label="data.name"
:value="data.id" > :value="data.id">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="班级名称"> <el-form-item label="班级名称">
<el-input v-model="form.class_name" style="width:220px"></el-input> <el-input v-model="form.class_name" style="width:220px"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="最大学员"> <el-form-item label="最大学员">
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
v-for="(data,index) in classSource" v-for="(data,index) in classSource"
:key="index" :key="index"
:label="data.name" :label="data.name"
:value="data.type" > :value="data.type">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -62,118 +62,129 @@ ...@@ -62,118 +62,129 @@
</template> </template>
<script> <script>
import {getTeacherListApi,getClassDetailApi,editClassApi,addClassApi,getPeriodsApi,getGoodsListApi,getPeriodsTeacherApi,uploadFileApi,getSourceStudentApi} from "../../service/api"; import {
import {GOODSTYPE,CLASSSOURCE} from '../../util/wordbook'; getTeacherListApi,
getClassDetailApi,
editClassApi,
addClassApi,
getPeriodsApi,
getGoodsListApi,
getPeriodsTeacherApi,
uploadFileApi,
getSourceStudentApi
} from "../../service/api";
import {GOODSTYPE, CLASSSOURCE} from '../../util/wordbook';
export default { export default {
props:[ props: [
'dialogObj' 'dialogObj'
], ],
data(){ data() {
// let classSource=[]; // let classSource=[];
// for (let x in CLASSSOURCE ) { // for (let x in CLASSSOURCE ) {
// classSource.push({label:CLASSSOURCE[x],value:Number(x)}) // classSource.push({label:CLASSSOURCE[x],value:Number(x)})
// } // }
return{ return {
imageList:[], imageList: [],
form:{ form: {
teacher_id:'', teacher_id: '',
max_join_num:'', max_join_num: '',
class_name:"", class_name: "",
source:"", source: "",
qr:"" qr: ""
}, },
type:0, type: 0,
classSource:[], classSource: [],
teacherList:[], teacherList: [],
exitTeacherList: [], exitTeacherList: [],
goodsList: [], goodsList: [],
periods: {}, periods: {},
uploadShow: true uploadShow: true
} }
}, },
methods:{ methods: {
beforeAvatarUpload(){ beforeAvatarUpload() {
this.uploadShow = false this.uploadShow = false
}, },
handleRemove(){ handleRemove() {
this.uploadShow = true this.uploadShow = true
}, },
handleAvatarSuccess(res) { handleAvatarSuccess(res) {
this.imageList = [{name:res.data.url,url:process.env.IMAGE_URL_HEAD + res.data.url}] this.imageList = [{name: res.data.url, url: process.env.IMAGE_URL_HEAD + res.data.url}]
}, },
uploadFile(a) { uploadFile(a) {
this.loading = true; this.loading = true;
this.$store.dispatch('setProgress',{type:'new',id:a.file.uid}); this.$store.dispatch('setProgress', {type: 'new', id: a.file.uid});
this.fileUid = a.file.uid; this.fileUid = a.file.uid;
uploadFileApi({file:a.file,type:'all'}).then(res=>{ uploadFileApi({file: a.file, type: 'all'}).then(res => {
this.form.media_id = res.wechat_info ? res.wechat_info.media_id : ''; this.form.media_id = res.wechat_info ? res.wechat_info.media_id : '';
this.imageList = [{name:res.url,url:process.env.IMAGE_URL_HEAD + res.url}]; this.imageList = [{name: res.url, url: process.env.IMAGE_URL_HEAD + res.url}];
this.uploadShow = false; this.uploadShow = false;
this.loading = false; this.loading = false;
this.$message({ this.$message({
type: 'success', type: 'success',
message: '上传成功!' message: '上传成功!'
}); });
}).catch(()=>{ }).catch(() => {
this.loading = false; this.loading = false;
}) })
}, },
findDifferentArray(array1, array2){ findDifferentArray(array1, array2) {
let newArray = []; let newArray = [];
array1.forEach((val)=>{ array1.forEach((val) => {
let index = array2.findIndex((item)=>{ let index = array2.findIndex((item) => {
return item.teacher_id === val.id return item.teacher_id === val.id
}) })
if (index === -1) { if (index === -1) {
newArray.push(val) newArray.push(val)
} }
}) })
return newArray return newArray
}, },
getTeacher(){ getTeacher() {
getTeacherListApi({limit:100,status:0}).then(res=>{ getTeacherListApi({limit: 500, status: 0}).then(res => {
this.teacherList = res.list this.teacherList = res.list
}); });
}, },
getTeacherByPeriods(){ getTeacherByPeriods() {
getTeacherListApi({limit:100,status:0}).then(res=>{ getTeacherListApi({limit: 500, status: 0}).then(res => {
this.teacherList = res.list this.teacherList = res.list
}) })
}, },
initPage(){ initPage() {
// 1为编辑 // 1为编辑
getSourceStudentApi().then(res=>{ getSourceStudentApi().then(res => {
this.classSource = res this.classSource = res
}) })
this.periods = this.dialogObj.periods this.periods = this.dialogObj.periods
switch (this.dialogObj.type) { switch (this.dialogObj.type) {
case 0: case 0:
if(!this.dialogObj.periodsId){ if (!this.dialogObj.periodsId) {
this.getPeriodList(); this.getPeriodList();
} }
this.form = { this.form = {
teacher_id:'', teacher_id: '',
max_join_num:'', max_join_num: '',
class_name: '', class_name: '',
source:'', source: '',
qr:"" qr: ""
}; };
this.type = 0; this.type = 0;
this.uploadShow = true this.uploadShow = true
this.getTeacher(); this.getTeacher();
break; break;
case 1: case 1:
this.type = 1; this.type = 1;
getClassDetailApi(this.dialogObj.id).then(res=>{ getClassDetailApi(this.dialogObj.id).then(res => {
this.form = { this.form = {
teacher_id: parseInt(res.teacher_id), teacher_id: parseInt(res.teacher_id),
max_join_num:res.max_join_num, max_join_num: res.max_join_num,
class_name:res.class_name, class_name: res.class_name,
source:res.source, source: res.source,
}; };
if(res.qr){ if (res.qr) {
this.form.qr = res.qr this.form.qr = res.qr
this.imageList = [{name:res.qr,url:res.qr}]; this.imageList = [{name: res.qr, url: res.qr}];
} }
this.form.media_id = res.media_id ? res.media_id : ''; this.form.media_id = res.media_id ? res.media_id : '';
this.uploadShow = !res.qr this.uploadShow = !res.qr
...@@ -182,41 +193,43 @@ ...@@ -182,41 +193,43 @@
}) })
} }
}, },
getPeriodList(){ getPeriodList() {
getGoodsListApi().then(res=>{ getGoodsListApi().then(res => {
res.list.forEach(i=>{ res.list.forEach(i => {
i.name = '[' + GOODSTYPE[i.goods_type] + ']' + '[' +i.current_price / 100 + '元]' + i.name i.name = '[' + GOODSTYPE[i.goods_type] + ']' + '[' + i.current_price / 100 + '元]' + i.name
i.children = []; i.children = [];
}); });
this.goodsList = res.list; this.goodsList = res.list;
if(!this.periods) { if (!this.periods) {
getPeriodsApi({goods_id:this.goodsList[0].id}).then(res=>{ getPeriodsApi({goods_id: this.goodsList[0].id}).then(res => {
res.list.forEach(i=>{i.name = i.title}); res.list.forEach(i => {
i.name = i.title
});
this.goodsList[0].children = res.list; this.goodsList[0].children = res.list;
this.periods = res.list[0] this.periods = res.list[0]
}) })
} }
}); });
}, },
onSave(){ onSave() {
if(this.imageList.length > 0){ if (this.imageList.length > 0) {
this.form.qr = this.imageList[0].url; this.form.qr = this.imageList[0].url;
} }
let json = { let json = {
max_join_num:String(this.form.max_join_num), max_join_num: String(this.form.max_join_num),
teacher_id:String(this.form.teacher_id), teacher_id: String(this.form.teacher_id),
source : this.form.source, source: this.form.source,
class_name:this.form.class_name, class_name: this.form.class_name,
media_id:this.form.media_id media_id: this.form.media_id
}; };
if(this.form.qr){ if (this.form.qr) {
json.qr = this.form.qr json.qr = this.form.qr
} }
console.log(json) console.log(json)
switch (this.dialogObj.type) { switch (this.dialogObj.type) {
case 0: case 0:
let id = this.dialogObj.periodsId ? this.dialogObj.periodsId : this.periods.id; let id = this.dialogObj.periodsId ? this.dialogObj.periodsId : this.periods.id;
addClassApi(id,json).then(res=>{ addClassApi(id, json).then(res => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '添加成功!' message: '添加成功!'
...@@ -226,39 +239,47 @@ ...@@ -226,39 +239,47 @@
}); });
break; break;
case 1: case 1:
editClassApi(this.dialogObj.id,json).then(res=>{ editClassApi(this.dialogObj.id, json).then(res => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '修改成功!' message: '修改成功!'
}); });
this.$emit("reflash",this.periods); this.$emit("reflash", this.periods);
this.dialogObj.show = false; this.dialogObj.show = false;
}) })
} }
}, },
handleItemChange(val){ handleItemChange(val) {
getPeriodsApi({goods_id:val[0]}).then(res=>{ getPeriodsApi({goods_id: val[0]}).then(res => {
res.list.forEach(i=>{i.name = i.title}); res.list.forEach(i => {
this.goodsList.find(i=>{return i.id === val[0]}).children = res.list i.name = i.title
});
this.goodsList.find(i => {
return i.id === val[0]
}).children = res.list
}) })
}, },
changePeriods(data){ changePeriods(data) {
if(data.length>1){ if (data.length > 1) {
let nowGoods = this.goodsList.find(i=>{return i.id === data[0]}); let nowGoods = this.goodsList.find(i => {
this.periods = nowGoods.children.find(i=>{return i.id === data[1]}); return i.id === data[0]
});
this.periods = nowGoods.children.find(i => {
return i.id === data[1]
});
this.getTeacherByPeriods() this.getTeacherByPeriods()
} }
}, },
selectName(val,id){ selectName(val, id) {
let filterVal=val.filter(function(item,i){ let filterVal = val.filter(function (item, i) {
return item.id == id return item.id == id
}); });
this.form.class_name=filterVal[0].name+"一班"; this.form.class_name = filterVal[0].name + "一班";
} }
}, },
watch:{ watch: {
'dialogObj.show'(value){ 'dialogObj.show'(value) {
if(value){ if (value) {
this.initPage() this.initPage()
} }
} }
...@@ -267,12 +288,13 @@ ...@@ -267,12 +288,13 @@
</script> </script>
<style scoped> <style scoped>
.qr-img { .qr-img {
width: 148px !important; width: 148px !important;
border: none !important; border: none !important;
border-radius: 0 !important; border-radius: 0 !important;
} }
.disabled .el-upload--picture-card {
.disabled .el-upload--picture-card {
display: none !important; display: none !important;
} }
</style> </style>
...@@ -88,7 +88,9 @@ ...@@ -88,7 +88,9 @@
<el-table-column type="selection" width="40"></el-table-column> <el-table-column type="selection" width="40"></el-table-column>
<el-table-column width="120" label="沟通情况"> <el-table-column width="120" label="沟通情况">
<template slot-scope="scope"> <template slot-scope="scope">
<teacher-desc :row="scope.row" :typeFlag="true" :descType="2" @onSuccess="searchList()"></teacher-desc> <!--<teacher-desc :row="scope.row" :typeFlag="true" :descType="2" @onSuccess="searchList()"></teacher-desc>-->
<!---->
<teacher-desc :teacherId="userObj.teacherId" :row="scope.row" :typeFlag="true" :descType="2" @onSuccess="searchList()"></teacher-desc>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="用户" className="f-c" min-width="180" sortable prop="user_id"> <el-table-column label="用户" className="f-c" min-width="180" sortable prop="user_id">
......
...@@ -154,441 +154,441 @@ ...@@ -154,441 +154,441 @@
</div> </div>
</template> </template>
<script> <script>
import { import {
getTeacherListApi, getTeacherListApi,
getchannelTransListApi, getchannelTransListApi,
getPeriodsApi, getPeriodsApi,
getGoodsListApi, getGoodsListApi,
exportExcelApi, exportExcelApi,
getPeriodsOtherListApi, getPeriodsOtherListApi,
getConfigListApi, getConfigListApi,
getUpdateTimeApi getUpdateTimeApi
} from "../../service/api"; } from "../../service/api";
import page from "../framework/page"; import page from "../framework/page";
import { GOODSTYPE, CLASSSOURCE } from "../../util/wordbook"; import {GOODSTYPE, CLASSSOURCE} from "../../util/wordbook";
export default { export default {
name: "channelTransList", name: "channelTransList",
data() { data() {
return { return {
updateTime: '', updateTime: '',
typeList:[], typeList: [],
width: 0, width: 0,
nowPage: 1, nowPage: 1,
limit: 20, limit: 20,
list: [], list: [],
goods_id: null, goods_id: null,
teacherList: [], teacherList: [],
goodsList: [], goodsList: [],
periodList: [], periodList: [],
total: 0, total: 0,
today: { today: {
text: "今天", text: "今天",
onClick: () => { onClick: () => {
this.searchFrom.payTime = [ this.searchFrom.payTime = [
this.formatTime(new Date()) + " 00:00:00", this.formatTime(new Date()) + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59" this.formatTime(new Date()) + " 23:59:59"
]; ];
} }
},
yesterday: {
text: "昨天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 24 * 60 * 60 * 1000)
);
this.searchFrom.payTime = [
preDate + " 00:00:00",
preDate + " 23:59:59"
];
}
},
last30Day: {
text: "过去30天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000)
);
this.searchFrom.payTime = [
preDate + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
last7Day: {
text: "过去7天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000)
);
this.searchFrom.payTime = [
preDate + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
classToday: {
text: "今天",
onClick: () => {
this.searchFrom.classTime = [
this.formatTime(new Date()) + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
classYesterday: {
text: "昨天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 24 * 60 * 60 * 1000)
);
this.searchFrom.classTime = [
preDate + " 00:00:00",
preDate + " 23:59:59"
];
}
},
classLast30Day: {
text: "过去30天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000)
);
this.searchFrom.classTime = [
preDate + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
classLast7Day: {
text: "过去7天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000)
);
this.searchFrom.classTime = [
preDate + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
spanArr: [],
contentSpanArr: [],
searchFrom: {
payTime: [],
classTime: [],
start_at: "",
end_at: "",
invite_type: "",
invite_name: "",
watch_num: "",
periods_id: "",
squad: "",
teacher_id: "",
periods_title: ""
},
propertyList: [],
watchList: [
{id: 0, title: 5},
{id: 1, title: 6},
{id: 2, title: 10},
{id: 3, title: 20}
]
};
},
components: {page},
methods: {
periodName(row) {
//return `【${row.goods_id}】${row.periods_title}${row.watch_num}课时(${row.start_at.slice(5).replace('-', '')})-d${this.title.has_watch_num}`
//return `【${row.goods_id}】${row.periods_title}${row.watch_num}课时(${row.start_at.slice(5).replace('-', '')})`
}, },
yesterday: { seachData() {
text: "昨天", this.total = 0;
onClick: () => { this.nowPage = 1;
let preDate = this.formatTime( this.getChannelTransList();
new Date(new Date().getTime() - 24 * 60 * 60 * 1000)
);
this.searchFrom.payTime = [
preDate + " 00:00:00",
preDate + " 23:59:59"
];
}
}, },
last30Day: { onPeriodChange(value) {
text: "过去30天", let str = "";
onClick: () => { if (value.length > 1) {
let preDate = this.formatTime( str = value.join(",");
new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000) } else {
); str = value[0];
this.searchFrom.payTime = [
preDate + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
} }
this.periods_id = str;
console.log(str);
}, },
last7Day: { exportDataTable() {
text: "过去7天", let json = {};
onClick: () => { if (this.searchFrom.sort_value) {
let preDate = this.formatTime( json.sort_value = this.searchFrom.sort_value;
new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000) json.sort_key = this.searchFrom.sort_key;
);
this.searchFrom.payTime = [
preDate + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
} }
}, if (
classToday: { this.searchFrom.start_at.length > 0 &&
text: "今天", this.searchFrom.end_at.length > 0
onClick: () => { ) {
this.searchFrom.classTime = [ json.start_at = this.searchFrom.start_at;
this.formatTime(new Date()) + " 00:00:00", json.end_at = this.searchFrom.end_at;
this.formatTime(new Date()) + " 23:59:59"
];
} }
}, if (this.searchFrom.teacher_id) {
classYesterday: { json.teacher_id = this.searchFrom.teacher_id;
text: "昨天", }
onClick: () => { if (this.searchFrom.type_id) {
let preDate = this.formatTime( json.type_id = this.searchFrom.type_id;
new Date(new Date().getTime() - 24 * 60 * 60 * 1000) }
); if (this.searchFrom.invite_type.length > 0) {
this.searchFrom.classTime = [ json.invite_type = this.searchFrom.invite_type;
preDate + " 00:00:00", }
preDate + " 23:59:59" if (this.periods_id) {
]; json.periods_ids = this.periods_id;
} }
if (this.searchFrom.squad) {
json.squad = this.searchFrom.squad;
}
if (this.searchFrom.watch_num) {
json.watch_num = this.searchFrom.watch_num;
}
exportExcelApi("/api/admin/channel/class/list/export", json);
}, },
classLast30Day: { objectSpanMethod(data) {
text: "过去30天", // if (data.columnIndex === 0) {
onClick: () => { // //用于设置要合并的列s
let preDate = this.formatTime( // const _row = this.spanArr[data.rowIndex];
new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000) // const _col = _row > 0 ? 1 : 0;
); // return {
this.searchFrom.classTime = [ // rowspan: _row, //合并的行数
preDate + " 00:00:00", // colspan: _col //合并的列数
this.formatTime(new Date()) + " 23:59:59" // };
]; // } else {
// return false;
// }
},
handleItemChange(val) {
getPeriodsApi({goods_id: val[0], limit: 100}).then(res => {
res.list.forEach(i => {
i.name = i.title;
});
this.goodsList.find(i => {
return i.id === val[0];
}).children = res.list;
});
},
changePeriods(data) {
if (data.length > 1) {
this.goods_id = data[0];
let nowGoods = this.goodsList.find(i => {
return i.id === data[0];
});
this.periods = nowGoods.children.find(i => {
return i.id === data[1];
});
this.searchFrom.periods_id = this.periods.id;
this.getChannelTransList();
} }
}, },
classLast7Day: { changeTeacher(value) {
text: "过去7天", this.searchFrom.teacher_id = value;
onClick: () => { this.getChannelTransList();
let preDate = this.formatTime( },
new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000) selectChange(value) {
); this.searchFrom.watch_num = this.watchList[value].title;
this.searchFrom.classTime = [ this.getChannelTransList();
preDate + " 00:00:00", },
this.formatTime(new Date()) + " 23:59:59" formatTime(date) {
]; let year = date.getFullYear();
let Month = date.getMonth() + 1;
if (Month < 10) {
Month = `0${Month}`;
} }
let Day = date.getDate();
if (Day < 10) Day = `0${Day}`;
return `${year}-${Month}-${Day}`;
}, },
spanArr: [], onPageChange(val) {
contentSpanArr: [], this.nowPage = val;
searchFrom: { this.getChannelTransList();
payTime: [],
classTime:[],
start_at: "",
end_at: "",
invite_type: "",
invite_name: "",
watch_num: "",
periods_id: "",
squad: "",
teacher_id: "",
periods_title: ""
}, },
propertyList: [], onSizeChange(val) {
watchList: [ this.nowPage = 1;
{ id: 0, title: 5 }, this.limit = val;
{ id: 1, title: 6 },
{ id: 2, title: 10 },
{ id: 3, title: 20 }
]
};
},
components: { page },
methods: {
periodName(row) {
//return `【${row.goods_id}】${row.periods_title}${row.watch_num}课时(${row.start_at.slice(5).replace('-', '')})-d${this.title.has_watch_num}`
//return `【${row.goods_id}】${row.periods_title}${row.watch_num}课时(${row.start_at.slice(5).replace('-', '')})`
},
seachData() {
this.total = 0;
this.nowPage = 1;
this.getChannelTransList();
},
onPeriodChange(value) {
let str = "";
if (value.length > 1) {
str = value.join(",");
} else {
str = value[0];
}
this.periods_id = str;
console.log(str);
},
exportDataTable() {
let json = {};
if(this.searchFrom.sort_value){
json.sort_value = this.searchFrom.sort_value;
json.sort_key = this.searchFrom.sort_key;
}
if (
this.searchFrom.start_at.length > 0 &&
this.searchFrom.end_at.length > 0
) {
json.start_at = this.searchFrom.start_at;
json.end_at = this.searchFrom.end_at;
}
if (this.searchFrom.teacher_id) {
json.teacher_id = this.searchFrom.teacher_id;
}
if (this.searchFrom.type_id) {
json.type_id = this.searchFrom.type_id;
}
if (this.searchFrom.invite_type.length > 0) {
json.invite_type = this.searchFrom.invite_type;
}
if (this.periods_id) {
json.periods_ids = this.periods_id;
}
if (this.searchFrom.squad) {
json.squad = this.searchFrom.squad;
}
if (this.searchFrom.watch_num) {
json.watch_num = this.searchFrom.watch_num;
}
exportExcelApi("/api/admin/channel/class/list/export", json);
},
objectSpanMethod(data) {
// if (data.columnIndex === 0) {
// //用于设置要合并的列s
// const _row = this.spanArr[data.rowIndex];
// const _col = _row > 0 ? 1 : 0;
// return {
// rowspan: _row, //合并的行数
// colspan: _col //合并的列数
// };
// } else {
// return false;
// }
},
handleItemChange(val) {
getPeriodsApi({ goods_id: val[0], limit: 100 }).then(res => {
res.list.forEach(i => {
i.name = i.title;
});
this.goodsList.find(i => {
return i.id === val[0];
}).children = res.list;
});
},
changePeriods(data) {
if (data.length > 1) {
this.goods_id = data[0];
let nowGoods = this.goodsList.find(i => {
return i.id === data[0];
});
this.periods = nowGoods.children.find(i => {
return i.id === data[1];
});
this.searchFrom.periods_id = this.periods.id;
this.getChannelTransList(); this.getChannelTransList();
} },
}, getTeacherList() {
changeTeacher(value) { let json = {
this.searchFrom.teacher_id = value; page: 1,
this.getChannelTransList(); limit: 500
}, };
selectChange(value) { getTeacherListApi(json).then(res => {
this.searchFrom.watch_num = this.watchList[value].title; this.teacherList = res.list;
this.getChannelTransList();
},
formatTime(date) {
let year = date.getFullYear();
let Month = date.getMonth() + 1;
if (Month < 10) {
Month = `0${Month}`;
}
let Day = date.getDate();
if (Day < 10) Day = `0${Day}`;
return `${year}-${Month}-${Day}`;
},
onPageChange(val) {
this.nowPage = val;
this.getChannelTransList();
},
onSizeChange(val) {
this.nowPage = 1;
this.limit = val;
this.getChannelTransList();
},
getTeacherList() {
let json = {
page: 1,
limit: 200
};
getTeacherListApi(json).then(res => {
this.teacherList = res.list;
});
getConfigListApi({page:1, limit: 100,key:'code_rule_type'}).then(res=>{
this.typeList = res.list
})
},
getGoodsList() {
let json = {
page: 1,
limit: 100,
goods_type: "1,2"
};
getGoodsListApi(json).then(res => {
res.list.forEach(i => {
i.name =
"[" +
i.id +
"]" +
"[" +
GOODSTYPE[i.goods_type] +
"]" +
"[" +
i.current_price / 100 +
"元]" +
i.name;
i.children = [];
}); });
this.goodsList = res.list; getConfigListApi({page: 1, limit: 100, key: 'code_rule_type'}).then(res => {
}); this.typeList = res.list
},
getPeriodsOtherList() {
let json = { limit: 1000,page:1,max_watch_num:20 };
getPeriodsOtherListApi(json).then(res => {
res.list.forEach(val=>{
val.label = `【${val.goods_id}${val.title}${val.watch_num}课时(${val.start_at.slice(5).replace('-', '')})-d${val.has_watch_num}`
}) })
this.periodList = res.list; },
}); getGoodsList() {
}, let json = {
getChannelTransList() { page: 1,
let json = { limit: 100,
limit: this.limit, goods_type: "1,2"
page: this.nowPage };
}; getGoodsListApi(json).then(res => {
// 搜索筛选 res.list.forEach(i => {
if (this.searchFrom.invite_type) { i.name =
json.invite_type = this.searchFrom.invite_type; "[" +
} i.id +
if(this.searchFrom.sort_value){ "]" +
json.sort_value = this.searchFrom.sort_value; "[" +
json.sort_key = this.searchFrom.sort_key; GOODSTYPE[i.goods_type] +
} "]" +
if (this.searchFrom.squad) { "[" +
json.squad = this.searchFrom.squad; i.current_price / 100 +
} "元]" +
if (this.searchFrom.watch_num) { i.name;
json.watch_num = this.searchFrom.watch_num; i.children = [];
} });
if (this.periods_id) { this.goodsList = res.list;
json.periods_ids = this.periods_id; });
} },
if (this.searchFrom.type_id) { getPeriodsOtherList() {
json.type_id = this.searchFrom.type_id; let json = {limit: 1000, page: 1, max_watch_num: 20};
} getPeriodsOtherListApi(json).then(res => {
if (this.searchFrom.teacher_id) { res.list.forEach(val => {
json.teacher_id = this.searchFrom.teacher_id; val.label = `【${val.goods_id}${val.title}${val.watch_num}课时(${val.start_at.slice(5).replace('-', '')})-d${val.has_watch_num}`
} })
if (this.searchFrom.payTime&&this.searchFrom.payTime.length > 0) { this.periodList = res.list;
if ( });
this.searchFrom.payTime[0] && },
this.searchFrom.payTime[0].length > 0 getChannelTransList() {
) { let json = {
this.searchFrom.start_at = this.searchFrom.payTime[0]; limit: this.limit,
json.start_at = this.searchFrom.start_at; page: this.nowPage
};
// 搜索筛选
if (this.searchFrom.invite_type) {
json.invite_type = this.searchFrom.invite_type;
} }
if ( if (this.searchFrom.sort_value) {
this.searchFrom.payTime[1] && json.sort_value = this.searchFrom.sort_value;
this.searchFrom.payTime[1].length > 0 json.sort_key = this.searchFrom.sort_key;
) {
this.searchFrom.end_at = this.searchFrom.payTime[1];
json.end_at = this.searchFrom.end_at;
} }
} if (this.searchFrom.squad) {
if (this.searchFrom.classTime&&this.searchFrom.classTime.length > 0) { json.squad = this.searchFrom.squad;
console.log(this.searchFrom.classTime)
if (
this.searchFrom.classTime[0] &&
this.searchFrom.classTime[0].length > 0
) {
this.searchFrom.class_start_at = this.searchFrom.classTime[0];
json.class_start_at = this.searchFrom.class_start_at;
} }
if ( if (this.searchFrom.watch_num) {
this.searchFrom.classTime[1] && json.watch_num = this.searchFrom.watch_num;
this.searchFrom.classTime[1].length > 0
) {
this.searchFrom.class_end_at = this.searchFrom.classTime[1];
json.class_end_at = this.searchFrom.class_end_at;
} }
} if (this.periods_id) {
getchannelTransListApi(json).then(res => { json.periods_ids = this.periods_id;
if (res) { }
if (res.list && res.list.length > 0) { if (this.searchFrom.type_id) {
this.total = res.total; json.type_id = this.searchFrom.type_id;
this.list = res.list.map((item, index) => { }
item.index = index; if (this.searchFrom.teacher_id) {
if (index == 0) { json.teacher_id = this.searchFrom.teacher_id;
this.spanArr.push(1); }
this.pos = 0; if (this.searchFrom.payTime && this.searchFrom.payTime.length > 0) {
} else { if (
if (item.cur_date == res.list[index - 1].cur_date) { this.searchFrom.payTime[0] &&
this.spanArr[this.pos] += 1; this.searchFrom.payTime[0].length > 0
this.spanArr.push(0); ) {
} else { this.searchFrom.start_at = this.searchFrom.payTime[0];
json.start_at = this.searchFrom.start_at;
}
if (
this.searchFrom.payTime[1] &&
this.searchFrom.payTime[1].length > 0
) {
this.searchFrom.end_at = this.searchFrom.payTime[1];
json.end_at = this.searchFrom.end_at;
}
}
if (this.searchFrom.classTime && this.searchFrom.classTime.length > 0) {
console.log(this.searchFrom.classTime)
if (
this.searchFrom.classTime[0] &&
this.searchFrom.classTime[0].length > 0
) {
this.searchFrom.class_start_at = this.searchFrom.classTime[0];
json.class_start_at = this.searchFrom.class_start_at;
}
if (
this.searchFrom.classTime[1] &&
this.searchFrom.classTime[1].length > 0
) {
this.searchFrom.class_end_at = this.searchFrom.classTime[1];
json.class_end_at = this.searchFrom.class_end_at;
}
}
getchannelTransListApi(json).then(res => {
if (res) {
if (res.list && res.list.length > 0) {
this.total = res.total;
this.list = res.list.map((item, index) => {
item.index = index;
if (index == 0) {
this.spanArr.push(1); this.spanArr.push(1);
this.pos = index; this.pos = 0;
} else {
if (item.cur_date == res.list[index - 1].cur_date) {
this.spanArr[this.pos] += 1;
this.spanArr.push(0);
} else {
this.spanArr.push(1);
this.pos = index;
}
} }
item.squad = "T" + item.squad;
let name =
item.invite_name && item.invite_name.length > 0
? `(${item.invite_name})`
: "";
let goods_id =
item.goods_id && item.goods_id > 0
? `【${item.goods_id}】`
: "";
let watch_num =
item.watch_num && item.watch_num > 0
? `【${item.watch_num}个课时】`
: "";
item.invite_type = `${item.invite_type}${name}`;
item.goods_name = `${goods_id}${item.goods_name}${watch_num}`;
return item;
});
for (let key in this.list[0]) {
this.propertyList.push(key);
} }
item.squad = "T" + item.squad; this.width = document.documentElement.clientWidth - 200;
let name =
item.invite_name && item.invite_name.length > 0
? `(${item.invite_name})`
: "";
let goods_id =
item.goods_id && item.goods_id > 0
? `【${item.goods_id}】`
: "";
let watch_num =
item.watch_num && item.watch_num > 0
? `【${item.watch_num}个课时】`
: "";
item.invite_type = `${item.invite_type}${name}`;
item.goods_name = `${goods_id}${item.goods_name}${watch_num}`;
return item;
});
for (let key in this.list[0]) {
this.propertyList.push(key);
} }
this.width = document.documentElement.clientWidth - 200; if (res.list && res.list.length === 0) {
} this.list = [];
if (res.list && res.list.length === 0) { }
} else {
this.list = []; this.list = [];
} }
} else { });
this.list = []; },
} getUpdateTime() {
}); getUpdateTimeApi().then(res => {
if (res.time) {
this.updateTime = res.time
}
})
}
}, },
getUpdateTime() { mounted() {
getUpdateTimeApi().then(res => { this.getChannelTransList();
if (res.time) { this.getTeacherList();
this.updateTime = res.time // this.getPeriodsList();
} this.getGoodsList();
}) this.getPeriodsOtherList();
this.getUpdateTime();
} }
}, };
mounted() {
this.getChannelTransList();
this.getTeacherList();
// this.getPeriodsList();
this.getGoodsList();
this.getPeriodsOtherList();
this.getUpdateTime();
}
};
</script> </script>
<style lang="less" scope> <style lang="less" scope>
.channel-trans-list { .channel-trans-list {
padding: 20px 0; padding: 20px 0;
} }
</style> </style>
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="sum_one_buy_num" label="一年课购买人数" :render-header="rendertip" sortable='custom'></el-table-column> <el-table-column prop="sum_one_buy_num" label="一年课购买人数" :render-header="rendertip" sortable='custom'></el-table-column>
<el-table-column prop="sum_two_buy_num" label="两年课购买人数" :render-header="rendertip" sortable='custom'></el-table-column> <el-table-column prop="sum_two_buy_num" label="两年课购买人数" :render-header="rendertip" sortable='custom'></el-table-column>
<el-table-column prop="sum_buy_money" width="120" label="转化总额" :render-header="rendertip" sortable="custom"></el-table-column> <el-table-column prop="sum_buy_money" width="120" label="转化总额" :render-header="rendertip" sortable="custom"></el-table-column>
<el-table-column prop="sum_one_buy_money" label="一年课转化金额" :render-header="rendertip" sortable='custom'></el-table-column> <el-table-column prop="sum_one_buy_money" label="一年课转化金额" :render-header="rendertip" sortable='custom'></el-table-column>
<el-table-column prop="sum_two_buy_money" label="两年课转化金额" :render-header="rendertip" sortable='custom'></el-table-column> <el-table-column prop="sum_two_buy_money" label="两年课转化金额" :render-header="rendertip" sortable='custom'></el-table-column>
</el-table> </el-table>
...@@ -145,467 +145,474 @@ ...@@ -145,467 +145,474 @@
</div> </div>
</template> </template>
<script> <script>
import { getPeriodsConversionListApi, getGoodsListApi, getPeriodsOtherListApi, getTeacherListApi, getUpdateTimeApi } from "../../service/api"; import {
import page from "../framework/page"; getPeriodsConversionListApi,
import { GOODSTYPE, CLASSSOURCE } from "../../util/wordbook"; getGoodsListApi,
import { tipArr3 } from "../../util/tipArr"; getPeriodsOtherListApi,
export default { getTeacherListApi,
name: "periodsConversionList", getUpdateTimeApi
data() { } from "../../service/api";
return { import page from "../framework/page";
updateTime: '', import {GOODSTYPE, CLASSSOURCE} from "../../util/wordbook";
width: 0, import {tipArr3} from "../../util/tipArr";
nowPage: 1,
total: 0, export default {
limit: 20, name: "periodsConversionList",
list: [], data() {
goods_id: null, return {
teacherList: [], updateTime: '',
goodsList: [], width: 0,
periodList: [], nowPage: 1,
today: { total: 0,
text: "今天", limit: 20,
onClick: () => { list: [],
this.searchFrom.payTime = [ goods_id: null,
this.formatTime(new Date()) + " 00:00:00", teacherList: [],
this.formatTime(new Date()) + " 23:59:59" goodsList: [],
]; periodList: [],
today: {
text: "今天",
onClick: () => {
this.searchFrom.payTime = [
this.formatTime(new Date()) + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
yesterday: {
text: "昨天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 24 * 60 * 60 * 1000)
);
this.searchFrom.payTime = [
preDate + " 00:00:00",
preDate + " 23:59:59"
];
}
},
last30Day: {
text: "过去30天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000)
);
}
},
last7Day: {
text: "过去7天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000)
);
this.searchFrom.payTime = [
preDate + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
classToday: {
text: "今天",
onClick: () => {
this.searchFrom.classTime = [
this.formatTime(new Date()) + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
classYesterday: {
text: "昨天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 24 * 60 * 60 * 1000)
);
this.searchFrom.classTime = [
preDate + " 00:00:00",
preDate + " 23:59:59"
];
}
},
classLast30Day: {
text: "过去30天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000)
);
this.searchFrom.classTime = [
preDate + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
classLast7Day: {
text: "过去7天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000)
);
this.searchFrom.classTime = [
preDate + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
spanArr: [],
contentSpanArr: [],
searchFrom: {
payTime: [],
classTime: [],
start_at: "",
end_at: "",
invite_type: "",
invite_name: "",
watch_num: "",
periods_id: "",
squad: "",
teacher_id: "",
periods_title: ""
},
propertyList: [],
watchList: [
{id: 0, title: 5},
{id: 1, title: 6},
{id: 2, title: 10},
{id: 3, title: 20}
]
};
},
components: {page},
methods: {
periodName(val) {
let str = '';
if (val.goods_id) {
str += `【${val.goods_id}】`
} }
}, if (val.periods_title) {
yesterday: { str += `${val.periods_title}<br>`
text: "昨天", } else {
onClick: () => { str += `<br>`
let preDate = this.formatTime(
new Date(new Date().getTime() - 24 * 60 * 60 * 1000)
);
this.searchFrom.payTime = [
preDate + " 00:00:00",
preDate + " 23:59:59"
];
} }
}, if (val.watch_num) {
last30Day: { str += `${val.watch_num}课时`
text: "过去30天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000)
);
} }
}, if (val.start_at) {
last7Day: { str += `(${val.start_at.slice(5).replace('-', '')})`
text: "过去7天", }
onClick: () => { if (val.has_watch_num || val.has_watch_num == 0) {
let preDate = this.formatTime( str += `-d${val.has_watch_num}`
new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000)
);
this.searchFrom.payTime = [
preDate + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
} }
return str
},
rendertip(h, {column}) {
// console.log(h)
return h("span", [
h("span", column.label),
h(
"el-tooltip",
{
props: {
effect: "dark",
content: tipArr3[column.label],
placement: "top"
}
},
[
h("i", {
class: "el-icon-question",
style: "color:#409eff;display:block;"
})
]
)
]);
}, },
classToday: { sortMethod(data) {
text: "今天", this.searchFrom.sort_key = data.prop
onClick: () => { if (data.order == 'ascending') {
this.searchFrom.classTime = [ this.searchFrom.sort_value = 'asc'
this.formatTime(new Date()) + " 00:00:00", } else {
this.formatTime(new Date()) + " 23:59:59" this.searchFrom.sort_value = 'desc'
];
} }
this.getChannelTransList()
},
getTeacherList() {
let json = {
page: 1,
limit: 500
};
getTeacherListApi(json).then(res => {
this.teacherList = res.list;
});
}, },
classYesterday: { seachData() {
text: "昨天", this.total = 0;
onClick: () => { this.nowPage = 1;
let preDate = this.formatTime( this.getChannelTransList();
new Date(new Date().getTime() - 24 * 60 * 60 * 1000) },
); onPeriodChange(value) {
this.searchFrom.classTime = [ let str = "";
preDate + " 00:00:00", if (value.length > 1) {
preDate + " 23:59:59" str = value.join(",");
]; } else {
str = value[0];
} }
this.periods_id = str;
console.log(str);
},
objectSpanMethod(data) {
// if (this.propertyList.indexOf(data.column.property) > -1) {
// if (
// data.rowIndex === 0 ||
// data.row.cur_date !== this.list[data.rowIndex - 1].cur_date
// ) {
// let rowspan = 1;
// for (let i = data.rowIndex + 1; i < this.list.length; i++) {
// if (data.row.cur_date === this.list[i].cur_date) {
// rowspan++;
// } else {
// break;
// }
// }
// return {
// rowspan: rowspan,
// colspan: 1
// };
// } else {
// return {
// rowspan: 0,
// colspan: 0
// };
// }
// } else {
// return {
// rowspan: 1,
// colspan: 1
// };
// }
// if (data.columnIndex === 0) {
// //用于设置要合并的列
// const _row = this.spanArr[data.rowIndex];
// const _col = _row > 0 ? 1 : 0;
// return {
// rowspan: _row, //合并的行数
// colspan: _col //合并的列数
// };
// } else {
// return false;
// }
},
handleItemChange(val) {
getPeriodsApi({goods_id: val[0], limit: 100}).then(res => {
res.list.forEach(i => {
i.name = i.title;
});
this.goodsList.find(i => {
return i.id === val[0];
}).children = res.list;
});
}, },
classLast30Day: { changePeriods(data) {
text: "过去30天", if (data.length > 1) {
onClick: () => { this.goods_id = data[0];
let preDate = this.formatTime( let nowGoods = this.goodsList.find(i => {
new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000) return i.id === data[0];
); });
this.searchFrom.classTime = [ this.periods = nowGoods.children.find(i => {
preDate + " 00:00:00", return i.id === data[1];
this.formatTime(new Date()) + " 23:59:59" });
]; this.searchFrom.periods_id = this.periods.id;
this.getChannelTransList();
} }
}, },
classLast7Day: { changeTeacher(value) {
text: "过去7天", this.searchFrom.teacher_id = value;
onClick: () => { this.getChannelTransList();
let preDate = this.formatTime( },
new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000) selectChange(value) {
); this.searchFrom.watch_num = this.watchList[value].title;
this.searchFrom.classTime = [ this.getChannelTransList();
preDate + " 00:00:00", },
this.formatTime(new Date()) + " 23:59:59" formatTime(date) {
]; let year = date.getFullYear();
let Month = date.getMonth() + 1;
if (Month < 10) {
Month = `0${Month}`;
} }
let Day = date.getDate();
if (Day < 10) Day = `0${Day}`;
return `${year}-${Month}-${Day}`;
}, },
spanArr: [], onPageChange(val) {
contentSpanArr: [], this.nowPage = val;
searchFrom: { this.getChannelTransList();
payTime: [],
classTime:[],
start_at: "",
end_at: "",
invite_type: "",
invite_name: "",
watch_num: "",
periods_id: "",
squad: "",
teacher_id: "",
periods_title: ""
}, },
propertyList: [], onSizeChange(val) {
watchList: [ this.nowPage = 1;
{ id: 0, title: 5 }, this.limit = val;
{ id: 1, title: 6 },
{ id: 2, title: 10 },
{ id: 3, title: 20 }
]
};
},
components: { page },
methods: {
periodName(val) {
let str = '';
if (val.goods_id) {
str += `【${val.goods_id}】`
}
if (val.periods_title) {
str += `${val.periods_title}<br>`
} else {
str += `<br>`
}
if (val.watch_num) {
str += `${val.watch_num}课时`
}
if (val.start_at) {
str += `(${val.start_at.slice(5).replace('-', '')})`
}
if (val.has_watch_num || val.has_watch_num == 0) {
str += `-d${val.has_watch_num}`
}
return str
},
rendertip(h, { column }) {
// console.log(h)
return h("span", [
h("span", column.label),
h(
"el-tooltip",
{
props: {
effect: "dark",
content: tipArr3[column.label],
placement: "top"
}
},
[
h("i", {
class: "el-icon-question",
style: "color:#409eff;display:block;"
})
]
)
]);
},
sortMethod(data){
this.searchFrom.sort_key = data.prop
if(data.order=='ascending'){
this.searchFrom.sort_value = 'asc'
}else{
this.searchFrom.sort_value = 'desc'
}
this.getChannelTransList()
},
getTeacherList() {
let json = {
page: 1,
limit: 200
};
getTeacherListApi(json).then(res => {
this.teacherList = res.list;
});
},
seachData() {
this.total = 0;
this.nowPage = 1;
this.getChannelTransList();
},
onPeriodChange(value) {
let str = "";
if (value.length > 1) {
str = value.join(",");
} else {
str = value[0];
}
this.periods_id = str;
console.log(str);
},
objectSpanMethod(data) {
// if (this.propertyList.indexOf(data.column.property) > -1) {
// if (
// data.rowIndex === 0 ||
// data.row.cur_date !== this.list[data.rowIndex - 1].cur_date
// ) {
// let rowspan = 1;
// for (let i = data.rowIndex + 1; i < this.list.length; i++) {
// if (data.row.cur_date === this.list[i].cur_date) {
// rowspan++;
// } else {
// break;
// }
// }
// return {
// rowspan: rowspan,
// colspan: 1
// };
// } else {
// return {
// rowspan: 0,
// colspan: 0
// };
// }
// } else {
// return {
// rowspan: 1,
// colspan: 1
// };
// }
// if (data.columnIndex === 0) {
// //用于设置要合并的列
// const _row = this.spanArr[data.rowIndex];
// const _col = _row > 0 ? 1 : 0;
// return {
// rowspan: _row, //合并的行数
// colspan: _col //合并的列数
// };
// } else {
// return false;
// }
},
handleItemChange(val) {
getPeriodsApi({ goods_id: val[0], limit: 100 }).then(res => {
res.list.forEach(i => {
i.name = i.title;
});
this.goodsList.find(i => {
return i.id === val[0];
}).children = res.list;
});
},
changePeriods(data) {
if (data.length > 1) {
this.goods_id = data[0];
let nowGoods = this.goodsList.find(i => {
return i.id === data[0];
});
this.periods = nowGoods.children.find(i => {
return i.id === data[1];
});
this.searchFrom.periods_id = this.periods.id;
this.getChannelTransList(); this.getChannelTransList();
} },
}, getGoodsList() {
changeTeacher(value) { let json = {
this.searchFrom.teacher_id = value; page: 1,
this.getChannelTransList(); limit: 100,
}, goods_type: "1,2"
selectChange(value) { };
this.searchFrom.watch_num = this.watchList[value].title; getGoodsListApi(json).then(res => {
this.getChannelTransList(); res.list.forEach(i => {
}, i.name =
formatTime(date) { "[" +
let year = date.getFullYear(); i.id +
let Month = date.getMonth() + 1; "]" +
if (Month < 10) { "[" +
Month = `0${Month}`; GOODSTYPE[i.goods_type] +
} "]" +
let Day = date.getDate(); "[" +
if (Day < 10) Day = `0${Day}`; i.current_price / 100 +
return `${year}-${Month}-${Day}`; "元]" +
}, i.name;
onPageChange(val) { i.children = [];
this.nowPage = val; });
this.getChannelTransList(); this.goodsList = res.list;
},
onSizeChange(val) {
this.nowPage = 1;
this.limit = val;
this.getChannelTransList();
},
getGoodsList() {
let json = {
page: 1,
limit: 100,
goods_type: "1,2"
};
getGoodsListApi(json).then(res => {
res.list.forEach(i => {
i.name =
"[" +
i.id +
"]" +
"[" +
GOODSTYPE[i.goods_type] +
"]" +
"[" +
i.current_price / 100 +
"元]" +
i.name;
i.children = [];
}); });
this.goodsList = res.list; },
}); getPeriodsOtherList() {
}, let json = {limit: 1000, page: 1, max_watch_num: 20};
getPeriodsOtherList() { getPeriodsOtherListApi(json).then(res => {
let json = { limit: 1000,page:1,max_watch_num:20 }; res.list.forEach(val => {
getPeriodsOtherListApi(json).then(res => { val.label = `【${val.goods_id}${val.title}${val.watch_num}课时(${val.start_at.slice(5).replace('-', '')})-d${val.has_watch_num}`
res.list.forEach(val=>{ })
val.label = `【${val.goods_id}${val.title}${val.watch_num}课时(${val.start_at.slice(5).replace('-', '')})-d${val.has_watch_num}` this.periodList = res.list;
}) console.log(320)
this.periodList = res.list; });
console.log(320) },
}); getChannelTransList() {
}, let json = {
getChannelTransList() { limit: this.limit,
let json = { page: this.nowPage
limit: this.limit, };
page: this.nowPage // 搜索筛选
}; if (this.searchFrom.invite_type) {
// 搜索筛选 json.invite_type = this.searchFrom.invite_type;
if (this.searchFrom.invite_type) {
json.invite_type = this.searchFrom.invite_type;
}
if(this.searchFrom.sort_value){
json.sort_value = this.searchFrom.sort_value;
json.sort_key = this.searchFrom.sort_key;
}
if (this.searchFrom.squad) {
json.squad = this.searchFrom.squad;
}
if (this.searchFrom.watch_num) {
json.watch_num = this.searchFrom.watch_num;
}
if (this.periods_id) {
json.periods_ids = this.periods_id;
}
if (this.searchFrom.teacher_id) {
json.teacher_id = this.searchFrom.teacher_id;
}
if (this.searchFrom.payTime&&this.searchFrom.payTime.length > 0) {
if (
this.searchFrom.payTime[0] &&
this.searchFrom.payTime[0].length > 0
) {
this.searchFrom.start_at = this.searchFrom.payTime[0];
json.start_at = this.searchFrom.start_at;
} }
if ( if (this.searchFrom.sort_value) {
this.searchFrom.payTime[1] && json.sort_value = this.searchFrom.sort_value;
this.searchFrom.payTime[1].length > 0 json.sort_key = this.searchFrom.sort_key;
) {
this.searchFrom.end_at = this.searchFrom.payTime[1];
json.end_at = this.searchFrom.end_at;
} }
} if (this.searchFrom.squad) {
if (this.searchFrom.classTime&&this.searchFrom.classTime.length > 0) { json.squad = this.searchFrom.squad;
console.log(this.searchFrom.classTime)
if (
this.searchFrom.classTime[0] &&
this.searchFrom.classTime[0].length > 0
) {
this.searchFrom.class_start_at = this.searchFrom.classTime[0];
json.class_start_at = this.searchFrom.class_start_at;
} }
if ( if (this.searchFrom.watch_num) {
this.searchFrom.classTime[1] && json.watch_num = this.searchFrom.watch_num;
this.searchFrom.classTime[1].length > 0 }
) { if (this.periods_id) {
this.searchFrom.class_end_at = this.searchFrom.classTime[1]; json.periods_ids = this.periods_id;
json.class_end_at = this.searchFrom.class_end_at; }
if (this.searchFrom.teacher_id) {
json.teacher_id = this.searchFrom.teacher_id;
}
if (this.searchFrom.payTime && this.searchFrom.payTime.length > 0) {
if (
this.searchFrom.payTime[0] &&
this.searchFrom.payTime[0].length > 0
) {
this.searchFrom.start_at = this.searchFrom.payTime[0];
json.start_at = this.searchFrom.start_at;
}
if (
this.searchFrom.payTime[1] &&
this.searchFrom.payTime[1].length > 0
) {
this.searchFrom.end_at = this.searchFrom.payTime[1];
json.end_at = this.searchFrom.end_at;
}
}
if (this.searchFrom.classTime && this.searchFrom.classTime.length > 0) {
console.log(this.searchFrom.classTime)
if (
this.searchFrom.classTime[0] &&
this.searchFrom.classTime[0].length > 0
) {
this.searchFrom.class_start_at = this.searchFrom.classTime[0];
json.class_start_at = this.searchFrom.class_start_at;
}
if (
this.searchFrom.classTime[1] &&
this.searchFrom.classTime[1].length > 0
) {
this.searchFrom.class_end_at = this.searchFrom.classTime[1];
json.class_end_at = this.searchFrom.class_end_at;
}
} }
}
getPeriodsConversionListApi(json).then(res => { getPeriodsConversionListApi(json).then(res => {
if (res) { if (res) {
if (res.list && res.list.length > 0) { if (res.list && res.list.length > 0) {
this.total = res.total; this.total = res.total;
this.list = res.list.map((item, index) => { this.list = res.list.map((item, index) => {
item.index = index; item.index = index;
if (index == 0) { if (index == 0) {
this.spanArr.push(1);
this.pos = 0;
} else {
if (item.cur_date == res.list[index - 1].cur_date) {
this.spanArr[this.pos] += 1;
this.spanArr.push(0);
} else {
this.spanArr.push(1); this.spanArr.push(1);
this.pos = index; this.pos = 0;
} else {
if (item.cur_date == res.list[index - 1].cur_date) {
this.spanArr[this.pos] += 1;
this.spanArr.push(0);
} else {
this.spanArr.push(1);
this.pos = index;
}
} }
}
let name = let name =
item.invite_name && item.invite_name.length > 0 item.invite_name && item.invite_name.length > 0
? `(${item.invite_name})` ? `(${item.invite_name})`
: ""; : "";
let goods_id = let goods_id =
item.goods_id && item.goods_id > 0 item.goods_id && item.goods_id > 0
? `【${item.goods_id}】` ? `【${item.goods_id}】`
: ""; : "";
let watch_num = let watch_num =
item.watch_num && item.watch_num > 0 item.watch_num && item.watch_num > 0
? `【${item.watch_num}个课时】` ? `【${item.watch_num}个课时】`
: ""; : "";
item.invite_type = `${item.invite_type}${name}`; item.invite_type = `${item.invite_type}${name}`;
item.goods_name = `${goods_id}${item.goods_name}${watch_num}`; item.goods_name = `${goods_id}${item.goods_name}${watch_num}`;
return item; return item;
}); });
for (let key in this.list[0]) { for (let key in this.list[0]) {
this.propertyList.push(key); this.propertyList.push(key);
}
this.width = document.documentElement.clientWidth - 200;
} }
this.width = document.documentElement.clientWidth - 200; if (res.list && res.list.length === 0) {
} this.list = [];
if (res.list && res.list.length === 0) { }
} else {
this.list = []; this.list = [];
} }
} else { });
this.list = []; },
} getUpdateTime() {
}); getUpdateTimeApi().then(res => {
if (res.time) {
this.updateTime = res.time
}
})
}
}, },
getUpdateTime() { mounted() {
getUpdateTimeApi().then(res => { this.getChannelTransList();
if (res.time) { // this.getPeriodsList();
this.updateTime = res.time this.getGoodsList();
} this.getPeriodsOtherList();
}) this.getTeacherList();
this.getUpdateTime()
} }
}, };
mounted() {
this.getChannelTransList();
// this.getPeriodsList();
this.getGoodsList();
this.getPeriodsOtherList();
this.getTeacherList();
this.getUpdateTime()
}
};
</script> </script>
<style lang="less" scope> <style lang="less" scope>
.channel-trans-list { .channel-trans-list {
padding: 20px 0; padding: 20px 0;
} }
</style> </style>
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
:style="{width: width+'px'}" :style="{width: width+'px'}"
fixed fixed
> >
<el-table-column prop="out_trade_no" label="订单号" ></el-table-column> <el-table-column prop="out_trade_no" label="订单号"></el-table-column>
<el-table-column <el-table-column
label="购买人" label="购买人"
className="f-c" className="f-c"
...@@ -105,14 +105,14 @@ ...@@ -105,14 +105,14 @@
<img class="avatar" :src="scope.row.user_avatar"/> {{scope.row.user_nickname}}<br>(ID:{{scope.row.user_id}})<br>手机:{{scope.row.user_mobile}} <img class="avatar" :src="scope.row.user_avatar"/> {{scope.row.user_nickname}}<br>(ID:{{scope.row.user_id}})<br>手机:{{scope.row.user_mobile}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="goods_name" label="商品名称" ></el-table-column> <el-table-column prop="goods_name" label="商品名称"></el-table-column>
<el-table-column prop="periods_title" label="期数标题" ></el-table-column> <el-table-column prop="periods_title" label="期数标题"></el-table-column>
<el-table-column <el-table-column
prop="duration_over_at" prop="duration_over_at"
label="开课看课时间" label="开课看课时间"
style="font-size:12px;" style="font-size:12px;"
width="200" width="200"
> >
<template slot-scope="scope"> <template slot-scope="scope">
开课日期:{{scope.row.periods_start_at}} 开课日期:{{scope.row.periods_start_at}}
<br> <br>
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
className="f-c" className="f-c"
width="120"> width="120">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.invite_teacher_name}}<br>(ID:{{scope.row.invite_teacher_id}}) {{scope.row.invite_teacher_name}}<br>(ID:{{scope.row.invite_teacher_id}})
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
className="f-c" className="f-c"
width="120"> width="120">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.class_teacher_name}}<br>(ID:{{scope.row.class_teacher_id}}) {{scope.row.class_teacher_name}}<br>(ID:{{scope.row.class_teacher_id}})
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
...@@ -151,10 +151,10 @@ ...@@ -151,10 +151,10 @@
<img class="avatar" :src="scope.row.class_invite_user_avatar"/> {{scope.row.class_invite_user_nickname}}<br>(ID:{{scope.row.class_invite_user_id}})<br>手机:{{scope.row.class_invite_user_mobile}} <img class="avatar" :src="scope.row.class_invite_user_avatar"/> {{scope.row.class_invite_user_nickname}}<br>(ID:{{scope.row.class_invite_user_id}})<br>手机:{{scope.row.class_invite_user_mobile}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="money" label="实付金额" ></el-table-column> <el-table-column prop="money" label="实付金额"></el-table-column>
<el-table-column prop="pay_at" label="支付时间" ></el-table-column> <el-table-column prop="pay_at" label="支付时间"></el-table-column>
<el-table-column prop="in_class_at" label="进班时间" ></el-table-column> <el-table-column prop="in_class_at" label="进班时间"></el-table-column>
<el-table-column prop="status" label="支付状态" > <el-table-column prop="status" label="支付状态">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.status|orderFilter}} {{scope.row.status|orderFilter}}
</template> </template>
...@@ -170,438 +170,445 @@ ...@@ -170,438 +170,445 @@
</div> </div>
</template> </template>
<script> <script>
import { getPeriodsConversionListApi, getSourceConversionListApi, getGoodsListApi, getPeriodsOtherListApi, getTeacherListApi } from "../../service/api"; import {
import page from "../framework/page"; getPeriodsConversionListApi,
import { GOODSTYPE, CLASSSOURCE,ORDERSTATUS } from "../../util/wordbook"; getSourceConversionListApi,
import { tipArr3 } from "../../util/tipArr"; getGoodsListApi,
export default { getPeriodsOtherListApi,
name: "periodsConversionList", getTeacherListApi
data() { } from "../../service/api";
return { import page from "../framework/page";
width: 0, import {GOODSTYPE, CLASSSOURCE, ORDERSTATUS} from "../../util/wordbook";
nowPage: 1, import {tipArr3} from "../../util/tipArr";
total: 0,
limit: 20, export default {
list: [], name: "periodsConversionList",
goods_id: null, data() {
teacherList: [], return {
goodsList: [], width: 0,
periodList: [], nowPage: 1,
today: { total: 0,
text: "今天", limit: 20,
onClick: () => { list: [],
this.searchFrom.payTime = [ goods_id: null,
this.formatTime(new Date()) + " 00:00:00", teacherList: [],
this.formatTime(new Date()) + " 23:59:59" goodsList: [],
]; periodList: [],
} today: {
text: "今天",
onClick: () => {
this.searchFrom.payTime = [
this.formatTime(new Date()) + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
yesterday: {
text: "昨天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 24 * 60 * 60 * 1000)
);
this.searchFrom.payTime = [
preDate + " 00:00:00",
preDate + " 23:59:59"
];
}
},
last30Day: {
text: "过去30天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000)
);
}
},
last7Day: {
text: "过去7天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000)
);
this.searchFrom.payTime = [
preDate + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
classToday: {
text: "今天",
onClick: () => {
this.searchFrom.classTime = [
this.formatTime(new Date()) + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
classYesterday: {
text: "昨天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 24 * 60 * 60 * 1000)
);
this.searchFrom.classTime = [
preDate + " 00:00:00",
preDate + " 23:59:59"
];
}
},
classLast30Day: {
text: "过去30天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000)
);
this.searchFrom.classTime = [
preDate + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
classLast7Day: {
text: "过去7天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000)
);
this.searchFrom.classTime = [
preDate + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
propertyList: [],
spanArr: [],
contentSpanArr: [],
searchFrom: {
payTime: [],
classTime: [],
start_at: "",
end_at: "",
invite_type: "",
invite_name: "",
watch_num: "",
periods_id: "",
squad: "",
teacher_id: "",
periods_title: ""
},
watchList: [
{id: 0, title: 5},
{id: 1, title: 6},
{id: 2, title: 10},
{id: 3, title: 20}
],
goodList: []
};
},
filters: {
orderFilter(val) {
return ORDERSTATUS[val]
}, },
yesterday: { filterGoods(val) {
text: "昨天", // console.log(val,229)
onClick: () => { return (
let preDate = this.formatTime( "[" +
new Date(new Date().getTime() - 24 * 60 * 60 * 1000) val.id +
); "][" +
this.searchFrom.payTime = [ GOODSTYPE[val.goods_type] +
preDate + " 00:00:00", "]" +
preDate + " 23:59:59" "【" +
]; val.current_price / 100 +
} "元】" +
val.name
);
}
},
components: {page},
methods: {
getGoodsOption() {
let json = {
page: 1,
limit: 100,
goods_type: "1,2"
};
getGoodsListApi(json).then(res => {
this.goodList = res.list;
console.log(this.goodList, 176);
});
}, },
last30Day: { rendertip(h, {column}) {
text: "过去30天", // console.log(h)
onClick: () => { return h("span", [
let preDate = this.formatTime( h("span", column.label),
new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000) h(
); "el-tooltip",
} {
props: {
effect: "dark",
content: tipArr3[column.label],
placement: "top"
}
},
[
h("i", {
class: "el-icon-question",
style: "color:#409eff;display:block;"
})
]
)
]);
}, },
last7Day: { sortMethod(data) {
text: "过去7天", this.searchFrom.sort_key = data.prop
onClick: () => { if (data.order == 'ascending') {
let preDate = this.formatTime( this.searchFrom.sort_value = 'asc'
new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000) } else {
); this.searchFrom.sort_value = 'desc'
this.searchFrom.payTime = [
preDate + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
} }
this.getChannelTransList()
}, },
classToday: { getTeacherList() {
text: "今天", let json = {
onClick: () => { page: 1,
this.searchFrom.classTime = [ limit: 500
this.formatTime(new Date()) + " 00:00:00", };
this.formatTime(new Date()) + " 23:59:59" getTeacherListApi(json).then(res => {
]; this.teacherList = res.list;
} });
}, },
classYesterday: { seachData() {
text: "昨天", this.total = 0;
onClick: () => { this.nowPage = 1;
let preDate = this.formatTime( this.getChannelTransList();
new Date(new Date().getTime() - 24 * 60 * 60 * 1000) },
); onPeriodChange(value) {
this.searchFrom.classTime = [ let str = "";
preDate + " 00:00:00", if (value.length > 1) {
preDate + " 23:59:59" str = value.join(",");
]; } else {
str = value[0];
} }
this.periods_id = str;
console.log(str);
},
objectSpanMethod(data) {
},
handleItemChange(val) {
getPeriodsApi({goods_id: val[0], limit: 100}).then(res => {
res.list.forEach(i => {
i.name = i.title;
});
this.goodsList.find(i => {
return i.id === val[0];
}).children = res.list;
});
}, },
classLast30Day: { changePeriods(data) {
text: "过去30天", if (data.length > 1) {
onClick: () => { this.goods_id = data[0];
let preDate = this.formatTime( let nowGoods = this.goodsList.find(i => {
new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000) return i.id === data[0];
); });
this.searchFrom.classTime = [ this.periods = nowGoods.children.find(i => {
preDate + " 00:00:00", return i.id === data[1];
this.formatTime(new Date()) + " 23:59:59" });
]; this.searchFrom.periods_id = this.periods.id;
this.getChannelTransList();
} }
}, },
classLast7Day: { changeTeacher(value) {
text: "过去7天", this.searchFrom.teacher_id = value;
onClick: () => { this.getChannelTransList();
let preDate = this.formatTime( },
new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000) selectChange(value) {
); this.searchFrom.watch_num = this.watchList[value].title;
this.searchFrom.classTime = [ this.getChannelTransList();
preDate + " 00:00:00", },
this.formatTime(new Date()) + " 23:59:59" formatTime(date) {
]; let year = date.getFullYear();
let Month = date.getMonth() + 1;
if (Month < 10) {
Month = `0${Month}`;
} }
let Day = date.getDate();
if (Day < 10) Day = `0${Day}`;
return `${year}-${Month}-${Day}`;
}, },
propertyList: [], onPageChange(val) {
spanArr: [], this.nowPage = val;
contentSpanArr: [], this.getChannelTransList();
searchFrom: {
payTime: [],
classTime:[],
start_at: "",
end_at: "",
invite_type: "",
invite_name: "",
watch_num: "",
periods_id: "",
squad: "",
teacher_id: "",
periods_title: ""
}, },
watchList: [ onSizeChange(val) {
{ id: 0, title: 5 }, this.nowPage = 1;
{ id: 1, title: 6 }, this.limit = val;
{ id: 2, title: 10 }, this.getChannelTransList();
{ id: 3, title: 20 }
],
goodList: []
};
},
filters:{
orderFilter(val){
return ORDERSTATUS[val]
}, },
filterGoods(val) { getGoodsList() {
// console.log(val,229) let json = {
return ( page: 1,
"[" + limit: 100,
val.id + goods_type: "1,2"
"][" + };
GOODSTYPE[val.goods_type] + getGoodsListApi(json).then(res => {
"]" + res.list.forEach(i => {
"【" + i.name =
val.current_price / 100 + "[" +
"元】" + i.id +
val.name "]" +
); "[" +
} GOODSTYPE[i.goods_type] +
}, "]" +
components: { page }, "[" +
methods: { i.current_price / 100 +
getGoodsOption() { "元]" +
let json = { i.name;
page: 1, i.children = [];
limit: 100, });
goods_type: "1,2" this.goodsList = res.list;
};
getGoodsListApi(json).then(res => {
this.goodList = res.list;
console.log(this.goodList, 176);
});
},
rendertip(h, { column }) {
// console.log(h)
return h("span", [
h("span", column.label),
h(
"el-tooltip",
{
props: {
effect: "dark",
content: tipArr3[column.label],
placement: "top"
}
},
[
h("i", {
class: "el-icon-question",
style: "color:#409eff;display:block;"
})
]
)
]);
},
sortMethod(data){
this.searchFrom.sort_key = data.prop
if(data.order=='ascending'){
this.searchFrom.sort_value = 'asc'
}else{
this.searchFrom.sort_value = 'desc'
}
this.getChannelTransList()
},
getTeacherList() {
let json = {
page: 1,
limit: 200
};
getTeacherListApi(json).then(res => {
this.teacherList = res.list;
});
},
seachData() {
this.total = 0;
this.nowPage = 1;
this.getChannelTransList();
},
onPeriodChange(value) {
let str = "";
if (value.length > 1) {
str = value.join(",");
} else {
str = value[0];
}
this.periods_id = str;
console.log(str);
},
objectSpanMethod(data) {
},
handleItemChange(val) {
getPeriodsApi({ goods_id: val[0], limit: 100 }).then(res => {
res.list.forEach(i => {
i.name = i.title;
});
this.goodsList.find(i => {
return i.id === val[0];
}).children = res.list;
});
},
changePeriods(data) {
if (data.length > 1) {
this.goods_id = data[0];
let nowGoods = this.goodsList.find(i => {
return i.id === data[0];
}); });
this.periods = nowGoods.children.find(i => { },
return i.id === data[1]; getPeriodsOtherList() {
}); let json = {limit: 1000, page: 1, max_watch_num: 20};
this.searchFrom.periods_id = this.periods.id; getPeriodsOtherListApi(json).then(res => {
this.getChannelTransList(); res.list.forEach(val => {
} val.label = `【${val.goods_id}${val.title}${val.watch_num}课时(${val.start_at.slice(5).replace('-', '')})-d${val.has_watch_num}`
}, })
changeTeacher(value) { this.periodList = res.list;
this.searchFrom.teacher_id = value; console.log(320)
this.getChannelTransList();
},
selectChange(value) {
this.searchFrom.watch_num = this.watchList[value].title;
this.getChannelTransList();
},
formatTime(date) {
let year = date.getFullYear();
let Month = date.getMonth() + 1;
if (Month < 10) {
Month = `0${Month}`;
}
let Day = date.getDate();
if (Day < 10) Day = `0${Day}`;
return `${year}-${Month}-${Day}`;
},
onPageChange(val) {
this.nowPage = val;
this.getChannelTransList();
},
onSizeChange(val) {
this.nowPage = 1;
this.limit = val;
this.getChannelTransList();
},
getGoodsList() {
let json = {
page: 1,
limit: 100,
goods_type: "1,2"
};
getGoodsListApi(json).then(res => {
res.list.forEach(i => {
i.name =
"[" +
i.id +
"]" +
"[" +
GOODSTYPE[i.goods_type] +
"]" +
"[" +
i.current_price / 100 +
"元]" +
i.name;
i.children = [];
}); });
this.goodsList = res.list; },
}); getChannelTransList() {
}, let json = {
getPeriodsOtherList() { limit: this.limit,
let json = { limit: 1000,page:1,max_watch_num:20 }; page: this.nowPage
getPeriodsOtherListApi(json).then(res => { };
res.list.forEach(val=>{ // 搜索筛选
val.label = `【${val.goods_id}${val.title}${val.watch_num}课时(${val.start_at.slice(5).replace('-', '')})-d${val.has_watch_num}` if (this.searchFrom.invite_type) {
}) json.invite_type = this.searchFrom.invite_type;
this.periodList = res.list;
console.log(320)
});
},
getChannelTransList() {
let json = {
limit: this.limit,
page: this.nowPage
};
// 搜索筛选
if (this.searchFrom.invite_type) {
json.invite_type = this.searchFrom.invite_type;
}
if (this.searchFrom.goods_id) {
json.goods_id = this.searchFrom.goods_id;
}
if(this.searchFrom.sort_value){
json.sort_value = this.searchFrom.sort_value;
json.sort_key = this.searchFrom.sort_key;
}
if (this.searchFrom.squad) {
json.squad = this.searchFrom.squad;
}
if (this.searchFrom.watch_num) {
json.watch_num = this.searchFrom.watch_num;
}
if (this.periods_id) {
json.periods_ids = this.periods_id;
}
if (this.searchFrom.teacher_id) {
json.teacher_id = this.searchFrom.teacher_id;
}
if (this.searchFrom.out_trade_no) {
json.out_trade_no = this.searchFrom.out_trade_no;
}
if (this.searchFrom.user_id) {
json.user_id = this.searchFrom.user_id;
}
if (this.searchFrom.payTime&&this.searchFrom.payTime.length > 0) {
if (
this.searchFrom.payTime[0] &&
this.searchFrom.payTime[0].length > 0
) {
this.searchFrom.start_at = this.searchFrom.payTime[0];
json.pay_start_at = this.searchFrom.start_at;
} }
if ( if (this.searchFrom.goods_id) {
this.searchFrom.payTime[1] && json.goods_id = this.searchFrom.goods_id;
this.searchFrom.payTime[1].length > 0
) {
this.searchFrom.end_at = this.searchFrom.payTime[1];
json.pay_over_at = this.searchFrom.end_at;
} }
} if (this.searchFrom.sort_value) {
if (this.searchFrom.classTime&&this.searchFrom.classTime.length > 0) { json.sort_value = this.searchFrom.sort_value;
console.log(this.searchFrom.classTime) json.sort_key = this.searchFrom.sort_key;
if (
this.searchFrom.classTime[0] &&
this.searchFrom.classTime[0].length > 0
) {
this.searchFrom.class_start_at = this.searchFrom.classTime[0];
json.in_class_start_at = this.searchFrom.class_start_at;
} }
if ( if (this.searchFrom.squad) {
this.searchFrom.classTime[1] && json.squad = this.searchFrom.squad;
this.searchFrom.classTime[1].length > 0 }
) { if (this.searchFrom.watch_num) {
this.searchFrom.class_end_at = this.searchFrom.classTime[1]; json.watch_num = this.searchFrom.watch_num;
json.in_class_over_at = this.searchFrom.class_end_at; }
if (this.periods_id) {
json.periods_ids = this.periods_id;
}
if (this.searchFrom.teacher_id) {
json.teacher_id = this.searchFrom.teacher_id;
}
if (this.searchFrom.out_trade_no) {
json.out_trade_no = this.searchFrom.out_trade_no;
}
if (this.searchFrom.user_id) {
json.user_id = this.searchFrom.user_id;
}
if (this.searchFrom.payTime && this.searchFrom.payTime.length > 0) {
if (
this.searchFrom.payTime[0] &&
this.searchFrom.payTime[0].length > 0
) {
this.searchFrom.start_at = this.searchFrom.payTime[0];
json.pay_start_at = this.searchFrom.start_at;
}
if (
this.searchFrom.payTime[1] &&
this.searchFrom.payTime[1].length > 0
) {
this.searchFrom.end_at = this.searchFrom.payTime[1];
json.pay_over_at = this.searchFrom.end_at;
}
}
if (this.searchFrom.classTime && this.searchFrom.classTime.length > 0) {
console.log(this.searchFrom.classTime)
if (
this.searchFrom.classTime[0] &&
this.searchFrom.classTime[0].length > 0
) {
this.searchFrom.class_start_at = this.searchFrom.classTime[0];
json.in_class_start_at = this.searchFrom.class_start_at;
}
if (
this.searchFrom.classTime[1] &&
this.searchFrom.classTime[1].length > 0
) {
this.searchFrom.class_end_at = this.searchFrom.classTime[1];
json.in_class_over_at = this.searchFrom.class_end_at;
}
} }
}
getSourceConversionListApi(json).then(res => { getSourceConversionListApi(json).then(res => {
if (res) { if (res) {
if (res.list && res.list.length > 0) { if (res.list && res.list.length > 0) {
this.total = res.total; this.total = res.total;
this.list = res.list.map((item, index) => { this.list = res.list.map((item, index) => {
item.index = index; item.index = index;
if (index == 0) { if (index == 0) {
this.spanArr.push(1);
this.pos = 0;
} else {
if (item.cur_date == res.list[index - 1].cur_date) {
this.spanArr[this.pos] += 1;
this.spanArr.push(0);
} else {
this.spanArr.push(1); this.spanArr.push(1);
this.pos = index; this.pos = 0;
} else {
if (item.cur_date == res.list[index - 1].cur_date) {
this.spanArr[this.pos] += 1;
this.spanArr.push(0);
} else {
this.spanArr.push(1);
this.pos = index;
}
} }
}
let name = let name =
item.invite_name && item.invite_name.length > 0 item.invite_name && item.invite_name.length > 0
? `(${item.invite_name})` ? `(${item.invite_name})`
: ""; : "";
let goods_id = let goods_id =
item.goods_id && item.goods_id > 0 item.goods_id && item.goods_id > 0
? `【${item.goods_id}】` ? `【${item.goods_id}】`
: ""; : "";
let watch_num = let watch_num =
item.watch_num && item.watch_num > 0 item.watch_num && item.watch_num > 0
? `【${item.watch_num}个课时】` ? `【${item.watch_num}个课时】`
: ""; : "";
item.invite_type = `${item.invite_type}${name}`; item.invite_type = `${item.invite_type}${name}`;
item.goods_name = `${goods_id}${item.goods_name}${watch_num}`; item.goods_name = `${goods_id}${item.goods_name}${watch_num}`;
return item; return item;
}); });
for (let key in this.list[0]) { for (let key in this.list[0]) {
this.propertyList.push(key); this.propertyList.push(key);
}
this.width = document.documentElement.clientWidth - 200;
} }
this.width = document.documentElement.clientWidth - 200; if (res.list && res.list.length === 0) {
} this.list = [];
if (res.list && res.list.length === 0) { }
} else {
this.list = []; this.list = [];
} }
} else { });
this.list = []; }
} },
}); mounted() {
this.getChannelTransList();
// this.getPeriodsList();
this.getGoodsList();
this.getPeriodsOtherList();
this.getTeacherList()
this.getGoodsOption()
} }
}, };
mounted() {
this.getChannelTransList();
// this.getPeriodsList();
this.getGoodsList();
this.getPeriodsOtherList();
this.getTeacherList()
this.getGoodsOption()
}
};
</script> </script>
<style lang="less" scope> <style lang="less" scope>
.channel-trans-list { .channel-trans-list {
padding: 20px 0; padding: 20px 0;
} }
</style> </style>
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
<el-table-column prop="teacher_name" label="老师名称" width="180"></el-table-column> <el-table-column prop="teacher_name" label="老师名称" width="180"></el-table-column>
<el-table-column prop="sum_class_num" label="到班数" :render-header="rendertip" sortable='custom'></el-table-column> <el-table-column prop="sum_class_num" label="到班数" :render-header="rendertip" sortable='custom'></el-table-column>
<el-table-column prop="sum_friend_num" label="好友数" :render-header="rendertip" sortable='custom'></el-table-column> <el-table-column prop="sum_friend_num" label="好友数" :render-header="rendertip" sortable='custom'></el-table-column>
<el-table-column prop="friend_num_except_class_num" label="好友率" :render-header="rendertip" sortable='custom'> <el-table-column prop="friend_num_except_class_num" label="好友率" :render-header="rendertip" sortable='custom'>
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.friend_num_except_class_num}}% {{scope.row.friend_num_except_class_num}}%
</template> </template>
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="sum_one_buy_num" label="一年课购买人数" :render-header="rendertip" sortable='custom'></el-table-column> <el-table-column prop="sum_one_buy_num" label="一年课购买人数" :render-header="rendertip" sortable='custom'></el-table-column>
<el-table-column prop="sum_two_buy_num" label="两年课购买人数" :render-header="rendertip" sortable='custom'></el-table-column> <el-table-column prop="sum_two_buy_num" label="两年课购买人数" :render-header="rendertip" sortable='custom'></el-table-column>
<el-table-column prop="sum_buy_money" width="120" label="转化总额" :render-header="rendertip" sortable="custom"></el-table-column> <el-table-column prop="sum_buy_money" width="120" label="转化总额" :render-header="rendertip" sortable="custom"></el-table-column>
<el-table-column prop="sum_one_buy_money" label="一年课转化金额" :render-header="rendertip" sortable='custom'></el-table-column> <el-table-column prop="sum_one_buy_money" label="一年课转化金额" :render-header="rendertip" sortable='custom'></el-table-column>
<el-table-column prop="sum_two_buy_money" label="两年课转化金额" :render-header="rendertip" sortable='custom'></el-table-column> <el-table-column prop="sum_two_buy_money" label="两年课转化金额" :render-header="rendertip" sortable='custom'></el-table-column>
</el-table> </el-table>
...@@ -151,477 +151,478 @@ ...@@ -151,477 +151,478 @@
</div> </div>
</template> </template>
<script> <script>
import { import {
getTeacherPeriodsConversionListApi, getTeacherPeriodsConversionListApi,
getGoodsListApi, getGoodsListApi,
getPeriodsOtherListApi, getPeriodsOtherListApi,
getTeacherListApi, getTeacherListApi,
getUpdateTimeApi getUpdateTimeApi
} from "../../service/api"; } from "../../service/api";
import page from "../framework/page"; import page from "../framework/page";
import { GOODSTYPE, CLASSSOURCE } from "../../util/wordbook"; import {GOODSTYPE, CLASSSOURCE} from "../../util/wordbook";
import { tipArr3 } from "../../util/tipArr"; import {tipArr3} from "../../util/tipArr";
export default {
name: "teacherPeriodsConversionList", export default {
data() { name: "teacherPeriodsConversionList",
return { data() {
updateTime: '', return {
width: 0, updateTime: '',
nowPage: 1, width: 0,
total: 0, nowPage: 1,
limit: 20, total: 0,
list: [], limit: 20,
goods_id: null, list: [],
teacherList: [], goods_id: null,
goodsList: [], teacherList: [],
periodList: [], goodsList: [],
today: { periodList: [],
text: "今天", today: {
onClick: () => { text: "今天",
this.searchFrom.payTime = [ onClick: () => {
this.formatTime(new Date()) + " 00:00:00", this.searchFrom.payTime = [
this.formatTime(new Date()) + " 23:59:59" this.formatTime(new Date()) + " 00:00:00",
]; this.formatTime(new Date()) + " 23:59:59"
];
}
},
yesterday: {
text: "昨天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 24 * 60 * 60 * 1000)
);
this.searchFrom.payTime = [
preDate + " 00:00:00",
preDate + " 23:59:59"
];
}
},
last30Day: {
text: "过去30天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000)
);
this.searchFrom.payTime = [
preDate + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
last7Day: {
text: "过去7天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000)
);
this.searchFrom.payTime = [
preDate + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
classToday: {
text: "今天",
onClick: () => {
this.searchFrom.classTime = [
this.formatTime(new Date()) + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
classYesterday: {
text: "昨天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 24 * 60 * 60 * 1000)
);
this.searchFrom.classTime = [
preDate + " 00:00:00",
preDate + " 23:59:59"
];
}
},
classLast30Day: {
text: "过去30天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000)
);
this.searchFrom.classTime = [
preDate + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
classLast7Day: {
text: "过去7天",
onClick: () => {
let preDate = this.formatTime(
new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000)
);
this.searchFrom.classTime = [
preDate + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
},
spanArr: [],
contentSpanArr: [],
searchFrom: {
classTime: [],
payTime: [],
start_at: "",
end_at: "",
invite_type: "",
invite_name: "",
watch_num: "",
periods_id: "",
squad: "",
teacher_id: "",
periods_title: ""
},
propertyList: [],
watchList: [
{id: 0, title: 5},
{id: 1, title: 6},
{id: 2, title: 10},
{id: 3, title: 20}
]
};
},
components: {page},
methods: {
periodName(val) {
let str = '';
if (!val.periods_title) {
str = '-'
} else {
if (val.goods_id) {
str += `【${val.goods_id}】`
}
if (val.periods_title) {
str += `${val.periods_title}<br>`
}
if (val.watch_num) {
str += `${val.watch_num}课时`
}
if (val.start_at) {
str += `(${val.start_at.slice(5).replace('-', '')})`
}
if (val.has_watch_num || val.has_watch_num == 0) {
str += `-d${val.has_watch_num}`
}
} }
return str
}, },
yesterday: { rendertip(h, {column}) {
text: "昨天", // console.log(h)
onClick: () => { return h("span", [
let preDate = this.formatTime( h("span", column.label),
new Date(new Date().getTime() - 24 * 60 * 60 * 1000) h(
); "el-tooltip",
this.searchFrom.payTime = [ {
preDate + " 00:00:00", props: {
preDate + " 23:59:59" effect: "dark",
]; content: tipArr3[column.label],
} placement: "top"
}
},
[
h("i", {
class: "el-icon-question",
style: "color:#409eff;display:block;"
})
]
)
]);
}, },
last30Day: { sortMethod(data) {
text: "过去30天", this.searchFrom.sort_key = data.prop
onClick: () => { if (data.order == 'ascending') {
let preDate = this.formatTime( this.searchFrom.sort_value = 'asc'
new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000) } else {
); this.searchFrom.sort_value = 'desc'
this.searchFrom.payTime = [
preDate + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
} }
this.getChannelTransList()
}, },
last7Day: { getTeacherList() {
text: "过去7天", let json = {
onClick: () => { page: 1,
let preDate = this.formatTime( limit: 500
new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000) };
); getTeacherListApi(json).then(res => {
this.searchFrom.payTime = [ this.teacherList = res.list;
preDate + " 00:00:00", });
this.formatTime(new Date()) + " 23:59:59"
];
}
}, },
classToday: { seachData() {
text: "今天", this.total = 0;
onClick: () => { this.nowPage = 1;
this.searchFrom.classTime = [ this.getChannelTransList();
this.formatTime(new Date()) + " 00:00:00",
this.formatTime(new Date()) + " 23:59:59"
];
}
}, },
classYesterday: { onPeriodChange(value) {
text: "昨天", let str = "";
onClick: () => { if (value.length > 1) {
let preDate = this.formatTime( str = value.join(",");
new Date(new Date().getTime() - 24 * 60 * 60 * 1000) } else {
); str = value[0];
this.searchFrom.classTime = [
preDate + " 00:00:00",
preDate + " 23:59:59"
];
} }
this.periods_id = str;
console.log(str);
},
objectSpanMethod(data) {
// if (this.propertyList.indexOf(data.column.property) > -1) {
// if (
// data.rowIndex === 0 ||
// data.row.cur_date !== this.list[data.rowIndex - 1].cur_date
// ) {
// let rowspan = 1;
// for (let i = data.rowIndex + 1; i < this.list.length; i++) {
// if (data.row.cur_date === this.list[i].cur_date) {
// rowspan++;
// } else {
// break;
// }
// }
// return {
// rowspan: rowspan,
// colspan: 1
// };
// } else {
// return {
// rowspan: 0,
// colspan: 0
// };
// }
// } else {
// return {
// rowspan: 1,
// colspan: 1
// };
// }
// if (data.columnIndex === 0) {
// //用于设置要合并的列
// const _row = this.spanArr[data.rowIndex];
// const _col = _row > 0 ? 1 : 0;
// return {
// rowspan: _row, //合并的行数
// colspan: _col //合并的列数
// };
// } else {
// return false;
// }
}, },
classLast30Day: { handleItemChange(val) {
text: "过去30天", getPeriodsApi({goods_id: val[0], limit: 100}).then(res => {
onClick: () => { res.list.forEach(i => {
let preDate = this.formatTime( i.name = i.title;
new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000) });
); this.goodsList.find(i => {
this.searchFrom.classTime = [ return i.id === val[0];
preDate + " 00:00:00", }).children = res.list;
this.formatTime(new Date()) + " 23:59:59" });
]; },
changePeriods(data) {
if (data.length > 1) {
this.goods_id = data[0];
let nowGoods = this.goodsList.find(i => {
return i.id === data[0];
});
this.periods = nowGoods.children.find(i => {
return i.id === data[1];
});
this.searchFrom.periods_id = this.periods.id;
this.getChannelTransList();
} }
}, },
classLast7Day: { changeTeacher(value) {
text: "过去7天", this.searchFrom.teacher_id = value;
onClick: () => { this.getChannelTransList();
let preDate = this.formatTime( },
new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000) selectChange(value) {
); this.searchFrom.watch_num = this.watchList[value].title;
this.searchFrom.classTime = [ this.getChannelTransList();
preDate + " 00:00:00", },
this.formatTime(new Date()) + " 23:59:59" formatTime(date) {
]; let year = date.getFullYear();
let Month = date.getMonth() + 1;
if (Month < 10) {
Month = `0${Month}`;
} }
let Day = date.getDate();
if (Day < 10) Day = `0${Day}`;
return `${year}-${Month}-${Day}`;
},
onPageChange(val) {
this.nowPage = val;
this.getChannelTransList();
},
onSizeChange(val) {
this.nowPage = 1;
this.limit = val;
this.getChannelTransList();
}, },
spanArr: [], getGoodsList() {
contentSpanArr: [], let json = {
searchFrom: { page: 1,
classTime:[], limit: 100,
payTime: [], goods_type: "1,2"
start_at: "", };
end_at: "", getGoodsListApi(json).then(res => {
invite_type: "", res.list.forEach(i => {
invite_name: "", i.name =
watch_num: "", "[" +
periods_id: "", i.id +
squad: "", "]" +
teacher_id: "", "[" +
periods_title: "" GOODSTYPE[i.goods_type] +
"]" +
"[" +
i.current_price / 100 +
"元]" +
i.name;
i.children = [];
});
this.goodsList = res.list;
});
}, },
propertyList: [], getPeriodsOtherList() {
watchList: [ let json = {limit: 1000, page: 1, max_watch_num: 20};
{ id: 0, title: 5 }, getPeriodsOtherListApi(json).then(res => {
{ id: 1, title: 6 }, res.list.forEach(val => {
{ id: 2, title: 10 }, val.label = `【${val.goods_id}${val.title}${val.watch_num}课时(${val.start_at.slice(5).replace('-', '')})-d${val.has_watch_num}`
{ id: 3, title: 20 } })
] this.periodList = res.list;
}; });
}, },
components: { page }, getChannelTransList() {
methods: { let json = {
periodName(val) { limit: this.limit,
let str = ''; page: this.nowPage
if (!val.periods_title) { };
str = '-' // 搜索筛选
} else { if (this.searchFrom.invite_type) {
if (val.goods_id) { json.invite_type = this.searchFrom.invite_type;
str += `【${val.goods_id}】`
} }
if (val.periods_title) { if (this.searchFrom.sort_value) {
str += `${val.periods_title}<br>` json.sort_value = this.searchFrom.sort_value;
json.sort_key = this.searchFrom.sort_key;
} }
if (val.watch_num) { if (this.searchFrom.squad) {
str += `${val.watch_num}课时` json.squad = this.searchFrom.squad;
} }
if (val.start_at) { if (this.searchFrom.watch_num) {
str += `(${val.start_at.slice(5).replace('-', '')})` json.watch_num = this.searchFrom.watch_num;
} }
if (val.has_watch_num || val.has_watch_num == 0) { if (this.periods_id) {
str += `-d${val.has_watch_num}` json.periods_ids = this.periods_id;
} }
} if (this.searchFrom.teacher_id) {
return str json.teacher_id = this.searchFrom.teacher_id;
},
rendertip(h, { column }) {
// console.log(h)
return h("span", [
h("span", column.label),
h(
"el-tooltip",
{
props: {
effect: "dark",
content: tipArr3[column.label],
placement: "top"
}
},
[
h("i", {
class: "el-icon-question",
style: "color:#409eff;display:block;"
})
]
)
]);
},
sortMethod(data){
this.searchFrom.sort_key = data.prop
if(data.order=='ascending'){
this.searchFrom.sort_value = 'asc'
}else{
this.searchFrom.sort_value = 'desc'
}
this.getChannelTransList()
},
getTeacherList() {
let json = {
page: 1,
limit: 200
};
getTeacherListApi(json).then(res => {
this.teacherList = res.list;
});
},
seachData() {
this.total = 0;
this.nowPage = 1;
this.getChannelTransList();
},
onPeriodChange(value) {
let str = "";
if (value.length > 1) {
str = value.join(",");
} else {
str = value[0];
}
this.periods_id = str;
console.log(str);
},
objectSpanMethod(data) {
// if (this.propertyList.indexOf(data.column.property) > -1) {
// if (
// data.rowIndex === 0 ||
// data.row.cur_date !== this.list[data.rowIndex - 1].cur_date
// ) {
// let rowspan = 1;
// for (let i = data.rowIndex + 1; i < this.list.length; i++) {
// if (data.row.cur_date === this.list[i].cur_date) {
// rowspan++;
// } else {
// break;
// }
// }
// return {
// rowspan: rowspan,
// colspan: 1
// };
// } else {
// return {
// rowspan: 0,
// colspan: 0
// };
// }
// } else {
// return {
// rowspan: 1,
// colspan: 1
// };
// }
// if (data.columnIndex === 0) {
// //用于设置要合并的列
// const _row = this.spanArr[data.rowIndex];
// const _col = _row > 0 ? 1 : 0;
// return {
// rowspan: _row, //合并的行数
// colspan: _col //合并的列数
// };
// } else {
// return false;
// }
},
handleItemChange(val) {
getPeriodsApi({ goods_id: val[0], limit: 100 }).then(res => {
res.list.forEach(i => {
i.name = i.title;
});
this.goodsList.find(i => {
return i.id === val[0];
}).children = res.list;
});
},
changePeriods(data) {
if (data.length > 1) {
this.goods_id = data[0];
let nowGoods = this.goodsList.find(i => {
return i.id === data[0];
});
this.periods = nowGoods.children.find(i => {
return i.id === data[1];
});
this.searchFrom.periods_id = this.periods.id;
this.getChannelTransList();
}
},
changeTeacher(value) {
this.searchFrom.teacher_id = value;
this.getChannelTransList();
},
selectChange(value) {
this.searchFrom.watch_num = this.watchList[value].title;
this.getChannelTransList();
},
formatTime(date) {
let year = date.getFullYear();
let Month = date.getMonth() + 1;
if (Month < 10) {
Month = `0${Month}`;
}
let Day = date.getDate();
if (Day < 10) Day = `0${Day}`;
return `${year}-${Month}-${Day}`;
},
onPageChange(val) {
this.nowPage = val;
this.getChannelTransList();
},
onSizeChange(val) {
this.nowPage = 1;
this.limit = val;
this.getChannelTransList();
},
getGoodsList() {
let json = {
page: 1,
limit: 100,
goods_type: "1,2"
};
getGoodsListApi(json).then(res => {
res.list.forEach(i => {
i.name =
"[" +
i.id +
"]" +
"[" +
GOODSTYPE[i.goods_type] +
"]" +
"[" +
i.current_price / 100 +
"元]" +
i.name;
i.children = [];
});
this.goodsList = res.list;
});
},
getPeriodsOtherList() {
let json = { limit: 1000,page:1,max_watch_num:20 };
getPeriodsOtherListApi(json).then(res => {
res.list.forEach(val=>{
val.label = `【${val.goods_id}${val.title}${val.watch_num}课时(${val.start_at.slice(5).replace('-', '')})-d${val.has_watch_num}`
})
this.periodList = res.list;
});
},
getChannelTransList() {
let json = {
limit: this.limit,
page: this.nowPage
};
// 搜索筛选
if (this.searchFrom.invite_type) {
json.invite_type = this.searchFrom.invite_type;
}
if(this.searchFrom.sort_value){
json.sort_value = this.searchFrom.sort_value;
json.sort_key = this.searchFrom.sort_key;
}
if (this.searchFrom.squad) {
json.squad = this.searchFrom.squad;
}
if (this.searchFrom.watch_num) {
json.watch_num = this.searchFrom.watch_num;
}
if (this.periods_id) {
json.periods_ids = this.periods_id;
}
if (this.searchFrom.teacher_id) {
json.teacher_id = this.searchFrom.teacher_id;
}
if (this.searchFrom.payTime&&this.searchFrom.payTime.length > 0) {
if (
this.searchFrom.payTime[0] &&
this.searchFrom.payTime[0].length > 0
) {
this.searchFrom.start_at = this.searchFrom.payTime[0];
json.start_at = this.searchFrom.start_at;
} }
if ( if (this.searchFrom.payTime && this.searchFrom.payTime.length > 0) {
this.searchFrom.payTime[1] && if (
this.searchFrom.payTime[1].length > 0 this.searchFrom.payTime[0] &&
) { this.searchFrom.payTime[0].length > 0
this.searchFrom.end_at = this.searchFrom.payTime[1]; ) {
json.end_at = this.searchFrom.end_at; this.searchFrom.start_at = this.searchFrom.payTime[0];
} json.start_at = this.searchFrom.start_at;
} }
if (this.searchFrom.classTime&&this.searchFrom.classTime.length > 0) { if (
console.log(this.searchFrom.classTime) this.searchFrom.payTime[1] &&
if ( this.searchFrom.payTime[1].length > 0
this.searchFrom.classTime[0] && ) {
this.searchFrom.classTime[0].length > 0 this.searchFrom.end_at = this.searchFrom.payTime[1];
) { json.end_at = this.searchFrom.end_at;
this.searchFrom.class_start_at = this.searchFrom.classTime[0]; }
json.class_start_at = this.searchFrom.class_start_at;
} }
if ( if (this.searchFrom.classTime && this.searchFrom.classTime.length > 0) {
this.searchFrom.classTime[1] && console.log(this.searchFrom.classTime)
this.searchFrom.classTime[1].length > 0 if (
) { this.searchFrom.classTime[0] &&
this.searchFrom.class_end_at = this.searchFrom.classTime[1]; this.searchFrom.classTime[0].length > 0
json.class_end_at = this.searchFrom.class_end_at; ) {
this.searchFrom.class_start_at = this.searchFrom.classTime[0];
json.class_start_at = this.searchFrom.class_start_at;
}
if (
this.searchFrom.classTime[1] &&
this.searchFrom.classTime[1].length > 0
) {
this.searchFrom.class_end_at = this.searchFrom.classTime[1];
json.class_end_at = this.searchFrom.class_end_at;
}
} }
}
getTeacherPeriodsConversionListApi(json).then(res => { getTeacherPeriodsConversionListApi(json).then(res => {
if (res) { if (res) {
if (res.list && res.list.length > 0) { if (res.list && res.list.length > 0) {
this.total = res.total; this.total = res.total;
this.list = res.list.map((item, index) => { this.list = res.list.map((item, index) => {
item.index = index; item.index = index;
if (index == 0) { if (index == 0) {
this.spanArr.push(1);
this.pos = 0;
} else {
if (item.cur_date == res.list[index - 1].cur_date) {
this.spanArr[this.pos] += 1;
this.spanArr.push(0);
} else {
this.spanArr.push(1); this.spanArr.push(1);
this.pos = index; this.pos = 0;
} else {
if (item.cur_date == res.list[index - 1].cur_date) {
this.spanArr[this.pos] += 1;
this.spanArr.push(0);
} else {
this.spanArr.push(1);
this.pos = index;
}
} }
}
let name = let name =
item.invite_name && item.invite_name.length > 0 item.invite_name && item.invite_name.length > 0
? `(${item.invite_name})` ? `(${item.invite_name})`
: ""; : "";
let goods_id = let goods_id =
item.goods_id && item.goods_id > 0 item.goods_id && item.goods_id > 0
? `【${item.goods_id}】` ? `【${item.goods_id}】`
: ""; : "";
let watch_num = let watch_num =
item.watch_num && item.watch_num > 0 item.watch_num && item.watch_num > 0
? `【${item.watch_num}个课时】` ? `【${item.watch_num}个课时】`
: ""; : "";
item.invite_type = `${item.invite_type}${name}`; item.invite_type = `${item.invite_type}${name}`;
item.goods_name = `${goods_id}${item.goods_name}${watch_num}`; item.goods_name = `${goods_id}${item.goods_name}${watch_num}`;
return item; return item;
}); });
for (let key in this.list[0]) { for (let key in this.list[0]) {
this.propertyList.push(key); this.propertyList.push(key);
}
this.width = document.documentElement.clientWidth - 200;
} }
this.width = document.documentElement.clientWidth - 200; if (res.list && res.list.length === 0) {
} this.list = [];
if (res.list && res.list.length === 0) { }
} else {
this.list = []; this.list = [];
} }
} else { });
this.list = []; },
} getUpdateTime() {
}); getUpdateTimeApi().then(res => {
if (res.time) {
this.updateTime = res.time
}
})
}
}, },
getUpdateTime() { mounted() {
getUpdateTimeApi().then(res => { this.getChannelTransList();
if (res.time) { this.getPeriodsOtherList();
this.updateTime = res.time this.getGoodsList();
} this.getTeacherList();
}) this.getUpdateTime();
} }
}, };
mounted() {
this.getChannelTransList();
this.getPeriodsOtherList();
this.getGoodsList();
this.getTeacherList();
this.getUpdateTime();
}
};
</script> </script>
<style lang="less" scope> <style lang="less" scope>
.channel-trans-list { .channel-trans-list {
padding: 20px 0; padding: 20px 0;
} }
</style> </style>
...@@ -4,58 +4,58 @@ ...@@ -4,58 +4,58 @@
<template> <template>
<div class="index"> <div class="index">
<el-form ref="searchFrom" :model="searchFrom" label-width="80px" inline> <el-form ref="searchFrom" :model="searchFrom" label-width="80px" inline>
<el-form-item label="领取时间"> <el-form-item label="领取时间">
<el-date-picker <el-date-picker
v-model="searchFrom.time" v-model="searchFrom.time"
type="datetimerange" type="datetimerange"
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
:picker-options="{shortcuts:[today,yesterday,last7Day,last30Day]}" :picker-options="{shortcuts:[today,yesterday,last7Day,last30Day]}"
:default-time="['00:00:00','23:59:59']"> :default-time="['00:00:00','23:59:59']">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="激活时间"> <el-form-item label="激活时间">
<el-date-picker <el-date-picker
v-model="searchFrom.active_time" v-model="searchFrom.active_time"
type="datetimerange" type="datetimerange"
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
:picker-options="{shortcuts:[today,yesterday,last7Day,last30Day]}" :picker-options="{shortcuts:[today,yesterday,last7Day,last30Day]}"
:default-time="['00:00:00','23:59:59']"> :default-time="['00:00:00','23:59:59']">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="是否激活"> <el-form-item label="是否激活">
<el-select <el-select
clearable clearable
@change="initPage" @change="initPage"
v-model="searchFrom.user_buy" v-model="searchFrom.user_buy"
size="medium" size="medium"
> >
<el-option label="已激活" :value="1"></el-option> <el-option label="已激活" :value="1"></el-option>
<el-option label="未激活" :value="0"></el-option> <el-option label="未激活" :value="0"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="沟通状态"> <el-form-item label="沟通状态">
<el-select <el-select
clearable clearable
@change="initPage" @change="initPage"
v-model="searchFrom.status" v-model="searchFrom.status"
size="medium" size="medium"
> >
<el-option label="已激活" :value="1"></el-option> <el-option label="已激活" :value="1"></el-option>
<el-option label="假号" :value="2"></el-option> <el-option label="假号" :value="2"></el-option>
<el-option label="没兴趣" :value="3"></el-option> <el-option label="没兴趣" :value="3"></el-option>
<el-option label="待激活" :value="0"></el-option> <el-option label="待激活" :value="0"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="来源"> <el-form-item label="来源">
<el-input v-model="searchFrom.source" placeholder="名称"></el-input> <el-input v-model="searchFrom.source" placeholder="名称"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="昵称"> <el-form-item label="昵称">
<el-input v-model="searchFrom.nickname" style="width: 110px"></el-input> <el-input v-model="searchFrom.nickname" style="width: 110px"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="手机号"> <el-form-item label="手机号">
...@@ -75,23 +75,23 @@ ...@@ -75,23 +75,23 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" plain @click="initPage"> <el-button type="primary" plain @click="initPage">
搜索 搜索
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" plain v-if="$store.state.export" @click="doExport"> <el-button type="primary" plain v-if="$store.state.export" @click="doExport">
导出 导出
</el-button> </el-button>
</el-form-item> </el-form-item>
<!-- <el-button <!-- <el-button
@click="editComment" @click="editComment"
type="primary" type="primary"
plain plain
> >
批量编辑备注 批量编辑备注
</el-button> --> </el-button> -->
</el-form> </el-form>
<div></div> <div></div>
<div style="position: relative"> <div style="position: relative">
...@@ -108,12 +108,12 @@ ...@@ -108,12 +108,12 @@
<el-option v-for="(data,index) in teacherList" :key="index" :label="data.name" :value="data.id"> <el-option v-for="(data,index) in teacherList" :key="index" :label="data.name" :value="data.id">
</el-option> </el-option>
</el-select> </el-select>
<el-button size="small" type="success" @click="pullAll">批量分配</el-button> <el-button size="small" type="success" @click="pullAll">批量分配</el-button>
</div> </div>
</div> </div>
<el-table <el-table
:data="tableData" :data="tableData"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
type="selection" type="selection"
...@@ -121,8 +121,8 @@ ...@@ -121,8 +121,8 @@
</el-table-column> </el-table-column>
<el-table-column prop="nickname" label="领取人"> <el-table-column prop="nickname" label="领取人">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if='scope.row.user_id !== 0' > <div v-if='scope.row.user_id !== 0'>
<img class="avatar" :src="scope.row.avatar" /> <img class="avatar" :src="scope.row.avatar"/>
<div>{{scope.row.nickname}}<br>(ID:{{scope.row.user_id}})</div> <div>{{scope.row.nickname}}<br>(ID:{{scope.row.user_id}})</div>
</div> </div>
<div v-if='scope.row.user_id === 0'> <div v-if='scope.row.user_id === 0'>
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="name" label="宝宝昵称"> <el-table-column prop="name" label="宝宝昵称">
</el-table-column> </el-table-column>
<el-table-column prop="telephone" label="领取电话"> <el-table-column prop="telephone" label="领取电话">
</el-table-column> </el-table-column>
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="goods_name" label="商品名称"> <el-table-column prop="goods_name" label="商品名称">
</el-table-column> </el-table-column>
<el-table-column prop="source" label="来源"> <el-table-column prop="source" label="来源">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.source}}{{scope.row.invite_name}} {{scope.row.source}}{{scope.row.invite_name}}
</template> </template>
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
<el-table-column prop="teacher_name" label="班级老师"> <el-table-column prop="teacher_name" label="班级老师">
</el-table-column> </el-table-column>
<el-table-column prop="status" :formatter="externalLaunchStatus" label="沟通状态" width="120"> <el-table-column prop="status" :formatter="externalLaunchStatus" label="沟通状态" width="120">
</el-table-column> </el-table-column>
<el-table-column prop="active_at" label="激活时间" width="90"> <el-table-column prop="active_at" label="激活时间" width="90">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -193,165 +193,173 @@ ...@@ -193,165 +193,173 @@
<script> <script>
import page from '../framework/page' import page from '../framework/page'
import CommonJs from '../../util/common'; import CommonJs from '../../util/common';
import {getAdsInnerListApi,updateAdsInnerApi,updateAdsInnerPlApi,getTeacherListApi,getGoodsListApi,adsTeacherApi} from "../../service/api";
import { import {
GOODSTYPE, getAdsInnerListApi,
externalLaunchStatusParams updateAdsInnerApi,
} from "../../util/wordbook"; updateAdsInnerPlApi,
getTeacherListApi,
getGoodsListApi,
adsTeacherApi
} from "../../service/api";
import {
GOODSTYPE,
externalLaunchStatusParams
} from "../../util/wordbook";
export default { export default {
name: "index", name: "index",
components:{ components: {
page page
}, },
data(){ data() {
return { return {
today:{ today: {
text:'今天', text: '今天',
onClick:(vm)=>{ onClick: (vm) => {
vm.$emit('pick', [this.formatTime(new Date())+' 00:00:00',this.formatTime(new Date())+' 23:59:59']) vm.$emit('pick', [this.formatTime(new Date()) + ' 00:00:00', this.formatTime(new Date()) + ' 23:59:59'])
} }
}, },
yesterday:{ yesterday: {
text:'昨天', text: '昨天',
onClick:(vm)=>{ onClick: (vm) => {
let preDate = this.formatTime(new Date(new Date().getTime() - 24*60*60*1000)); let preDate = this.formatTime(new Date(new Date().getTime() - 24 * 60 * 60 * 1000));
vm.$emit('pick', [preDate+' 00:00:00',preDate+' 23:59:59']) vm.$emit('pick', [preDate + ' 00:00:00', preDate + ' 23:59:59'])
} }
}, },
last30Day:{ last30Day: {
text:'过去30天', text: '过去30天',
onClick:(vm)=>{ onClick: (vm) => {
let preDate = this.formatTime(new Date(new Date().getTime() - 30*24*60*60*1000)); let preDate = this.formatTime(new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000));
vm.$emit('pick', [preDate+' 00:00:00',this.formatTime(new Date())+' 23:59:59']); vm.$emit('pick', [preDate + ' 00:00:00', this.formatTime(new Date()) + ' 23:59:59']);
} }
}, },
last7Day:{ last7Day: {
text:'过去7天', text: '过去7天',
onClick:(vm)=>{ onClick: (vm) => {
let preDate = this.formatTime(new Date(new Date().getTime() - 7*24*60*60*1000)); let preDate = this.formatTime(new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000));
vm.$emit('pick', [preDate+' 00:00:00',this.formatTime(new Date())+' 23:59:59']); vm.$emit('pick', [preDate + ' 00:00:00', this.formatTime(new Date()) + ' 23:59:59']);
} }
}, },
teacherId:null, teacherId: null,
secId:[], secId: [],
total:0, total: 0,
nowPage:1, nowPage: 1,
limit: 10, limit: 10,
searchFrom: { searchFrom: {
source:'', source: '',
course_type:'-1', course_type: '-1',
}, },
tableData:[], tableData: [],
commentForm: {}, commentForm: {},
showCommentDialog: false, showCommentDialog: false,
teacherList:[], teacherList: [],
goodList: [], goodList: [],
} }
}, },
filters: { filters: {
filterStatus: function(value) { filterStatus: function (value) {
let msg = ""; let msg = "";
if (value === 0) { if (value === 0) {
msg = "未绑定"; msg = "未绑定";
} else { } else {
msg = "已绑定"; msg = "已绑定";
}
return msg;
},
filterGoods(val) {
return (
"[" +
val.id +
"]" +
"[" +
GOODSTYPE[val.goods_type] +
"]" +
"[" +
val.current_price / 100 +
"元]" +
val.name
);
} }
return msg;
}, },
filterGoods(val) { created() {
return (
"[" +
val.id +
"]" +
"[" +
GOODSTYPE[val.goods_type] +
"]" +
"[" +
val.current_price / 100 +
"元]" +
val.name
);
}
},
created(){
this.initPage() this.initPage()
this.getGoodsOption(); this.getGoodsOption();
this.getTeacherList() this.getTeacherList()
}, },
methods:{ methods: {
externalLaunchStatus(row){ externalLaunchStatus(row) {
return externalLaunchStatusParams[row.status] return externalLaunchStatusParams[row.status]
}, },
formatTime(date){ formatTime(date) {
console.log(date) console.log(date)
let year = date.getFullYear(); let year = date.getFullYear();
let Month = date.getMonth()+1; let Month = date.getMonth() + 1;
if(Month < 10){ if (Month < 10) {
Month = `0${Month}` Month = `0${Month}`
} }
let Day = date.getDate(); let Day = date.getDate();
if(Day<10)Day = `0${Day}`; if (Day < 10) Day = `0${Day}`;
return `${year}-${Month}-${Day}`; return `${year}-${Month}-${Day}`;
}, },
getGoodsOption() { getGoodsOption() {
let json = { let json = {
page: 1, page: 1,
limit: 100, limit: 100,
goods_type:'1,2' goods_type: '1,2'
}; };
getGoodsListApi(json).then(res => { getGoodsListApi(json).then(res => {
this.goodList = res.list; this.goodList = res.list;
}); });
}, },
pullAll(){ pullAll() {
if(this.secId.length < 1){ if (this.secId.length < 1) {
this.$message('请选择订单'); this.$message('请选择订单');
return false; return false;
} }
if(!this.teacherId){ if (!this.teacherId) {
this.$message('请选择老师'); this.$message('请选择老师');
return false; return false;
} }
let json = { let json = {
order_ids:[] order_ids: []
}; };
this.secId.forEach(i=>{ this.secId.forEach(i => {
json.order_ids.push(i) json.order_ids.push(i)
}); });
this.$confirm(`是否确定将这${json.order_ids.length}笔订单分配给该老师?`, '提示', { this.$confirm(`是否确定将这${json.order_ids.length}笔订单分配给该老师?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
adsTeacherApi(this.teacherId,{ids:json.order_ids.join(',')}).then(res=>{ adsTeacherApi(this.teacherId, {ids: json.order_ids.join(',')}).then(res => {
// this.secId = []; // this.secId = [];
this.$message({ this.$message({
message: '提交成功', message: '提交成功',
type: 'success' type: 'success'
}); });
this.initPage(); this.initPage();
}) })
}).catch(() => { }).catch(() => {
}); });
}, },
getTeacherList() { getTeacherList() {
let json = { let json = {
page: 1, page: 1,
limit: 200 limit: 500
}; };
getTeacherListApi(json).then(res => { getTeacherListApi(json).then(res => {
this.teacherList = res.list; this.teacherList = res.list;
}); });
}, },
handleSelectionChange(val){ handleSelectionChange(val) {
this.secId = [] this.secId = []
val.forEach(element => { val.forEach(element => {
this.secId.push(element.id) this.secId.push(element.id)
}); });
// console.log(this.secId) // console.log(this.secId)
}, },
initPage(){ initPage() {
let json = { let json = {
limit: this.limit, limit: this.limit,
page: this.nowPage page: this.nowPage
...@@ -363,120 +371,120 @@ ...@@ -363,120 +371,120 @@
json.source = this.searchFrom.source json.source = this.searchFrom.source
} }
if (this.searchFrom.mobile) { if (this.searchFrom.mobile) {
json.mobile = this.searchFrom.mobile; json.mobile = this.searchFrom.mobile;
} }
if (this.searchFrom.status) { if (this.searchFrom.status) {
json.status = this.searchFrom.status; json.status = this.searchFrom.status;
} }
if (this.searchFrom.course_type !== '-1') { if (this.searchFrom.course_type !== '-1') {
json.course_type = this.searchFrom.course_type; json.course_type = this.searchFrom.course_type;
} }
if (this.searchFrom.nickname) { if (this.searchFrom.nickname) {
debugger debugger
json.nickname = this.searchFrom.nickname; json.nickname = this.searchFrom.nickname;
} }
if (this.searchFrom.user_id) { if (this.searchFrom.user_id) {
json.user_id = this.searchFrom.user_id; json.user_id = this.searchFrom.user_id;
} }
if (this.searchFrom.teacher_id) { if (this.searchFrom.teacher_id) {
json.teacher_id = this.searchFrom.teacher_id; json.teacher_id = this.searchFrom.teacher_id;
} }
if (this.searchFrom.goods_name) { if (this.searchFrom.goods_name) {
json.goods_name = this.searchFrom.goods_name; json.goods_name = this.searchFrom.goods_name;
} }
if (this.searchFrom.user_buy != -1) { if (this.searchFrom.user_buy != -1) {
json.user_buy = this.searchFrom.user_buy; json.user_buy = this.searchFrom.user_buy;
} }
if (this.searchFrom.order_id) { if (this.searchFrom.order_id) {
json.order_id = this.searchFrom.order_id; json.order_id = this.searchFrom.order_id;
} }
if (this.searchFrom.goods_id) { if (this.searchFrom.goods_id) {
json.goods_id = this.searchFrom.goods_id; json.goods_id = this.searchFrom.goods_id;
} }
if(this.searchFrom.time && this.searchFrom.time.length ==2 ){ if (this.searchFrom.time && this.searchFrom.time.length == 2) {
json.start_at = this.searchFrom.time[0]; json.start_at = this.searchFrom.time[0];
json.end_at = this.searchFrom.time[1] json.end_at = this.searchFrom.time[1]
} }
if(this.searchFrom.active_time && this.searchFrom.active_time.length ==2 ){ if (this.searchFrom.active_time && this.searchFrom.active_time.length == 2) {
json.active_start_at = this.searchFrom.active_time[0]; json.active_start_at = this.searchFrom.active_time[0];
json.active_end_at =this.searchFrom.active_time[1] json.active_end_at = this.searchFrom.active_time[1]
} }
getAdsInnerListApi(json).then((res)=>{ getAdsInnerListApi(json).then((res) => {
this.tableData = res.list; this.tableData = res.list;
this.total = res.total this.total = res.total
}) })
}, },
onPageChange(val){ onPageChange(val) {
this.nowPage = val this.nowPage = val
this.initPage() this.initPage()
}, },
onSizeChange(val){ onSizeChange(val) {
this.nowPage = 1 this.nowPage = 1
this.limit = val this.limit = val
this.initPage() this.initPage()
}, },
doExport(){ doExport() {
let query = `?type=export`; let query = `?type=export`;
if(this.searchFrom.source){ if (this.searchFrom.source) {
query = query + '&source=' + this.searchFrom.source query = query + '&source=' + this.searchFrom.source
} }
if(this.searchFrom.mobile){ if (this.searchFrom.mobile) {
query = query + '&mobile=' + this.searchFrom.mobile query = query + '&mobile=' + this.searchFrom.mobile
} }
if(this.searchFrom.status){ if (this.searchFrom.status) {
query = query + '&status=' + this.searchFrom.status query = query + '&status=' + this.searchFrom.status
} }
if(this.searchFrom.course_type !== '-1'){ if (this.searchFrom.course_type !== '-1') {
query = query + '&course_type=' + this.searchFrom.course_type query = query + '&course_type=' + this.searchFrom.course_type
} }
if(this.searchFrom.user_buy !== '-1'){ if (this.searchFrom.user_buy !== '-1') {
query = query + '&user_buy=' + this.searchFrom.user_buy query = query + '&user_buy=' + this.searchFrom.user_buy
} }
if(this.searchFrom.nickname){ if (this.searchFrom.nickname) {
query = query + '&nickname=' + this.searchFrom.nickname query = query + '&nickname=' + this.searchFrom.nickname
} }
if(this.searchFrom.user_id){ if (this.searchFrom.user_id) {
query = query + '&user_id=' + this.searchFrom.user_id query = query + '&user_id=' + this.searchFrom.user_id
} }
if(this.searchFrom.teacher_id){ if (this.searchFrom.teacher_id) {
query = query + '&teacher_id=' + this.searchFrom.teacher_id query = query + '&teacher_id=' + this.searchFrom.teacher_id
} }
if(this.searchFrom.goods_name){ if (this.searchFrom.goods_name) {
query = query + '&goods_name=' + this.searchFrom.goods_name query = query + '&goods_name=' + this.searchFrom.goods_name
} }
if(this.searchFrom.order_id){ if (this.searchFrom.order_id) {
query = query + '&order_id=' + this.searchFrom.order_id query = query + '&order_id=' + this.searchFrom.order_id
} }
if(this.searchFrom.goods_id){ if (this.searchFrom.goods_id) {
query = query + '&goods_id=' + this.searchFrom.goods_id query = query + '&goods_id=' + this.searchFrom.goods_id
} }
if(this.searchFrom.time && this.searchFrom.time.length ==2){ if (this.searchFrom.time && this.searchFrom.time.length == 2) {
query = query + '&start_at=' + this.searchFrom.time[0]; query = query + '&start_at=' + this.searchFrom.time[0];
query = query + '&end_at=' + this.searchFrom.time[1] query = query + '&end_at=' + this.searchFrom.time[1]
} }
if(this.searchFrom.active_time && this.searchFrom.active_time.length ==2){ if (this.searchFrom.active_time && this.searchFrom.active_time.length == 2) {
query = query + '&active_start_at=' + this.searchFrom.active_time[0]; query = query + '&active_start_at=' + this.searchFrom.active_time[0];
query = query + '&active_end_at=' + this.searchFrom.active_time[1] query = query + '&active_end_at=' + this.searchFrom.active_time[1]
} }
window.open(`/api/admin/ads/export/all${query}`) window.open(`/api/admin/ads/export/all${query}`)
}, },
saveComment(){ saveComment() {
// let id = this.commentForm.id; // let id = this.commentForm.id;
let id let id
if(this.commentForm.id){ if (this.commentForm.id) {
id = this.commentForm.id id = this.commentForm.id
}else{ } else {
id = this.secId.join(',') id = this.secId.join(',')
} }
let desc = this.commentForm.desc ? this.commentForm.desc : ''; let desc = this.commentForm.desc ? this.commentForm.desc : '';
if(!desc) return; if (!desc) return;
this.$confirm('确认编辑备注', '提示', { this.$confirm('确认编辑备注', '提示', {
confirmButtonText: '继续', confirmButtonText: '继续',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
updateAdsInnerPlApi({ids:id,desc:desc}).then(res=>{ updateAdsInnerPlApi({ids: id, desc: desc}).then(res => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '编辑备注成功' message: '编辑备注成功'
...@@ -486,27 +494,27 @@ ...@@ -486,27 +494,27 @@
}); });
}) })
}, },
editNote(id, desc){ editNote(id, desc) {
this.showCommentDialog = true; this.showCommentDialog = true;
this.commentForm = { this.commentForm = {
id: id, id: id,
desc: desc desc: desc
}; };
}, },
editComment(id, desc) { editComment(id, desc) {
if(this.secId.length>0){ if (this.secId.length > 0) {
this.showCommentDialog = true; this.showCommentDialog = true;
// this.commentForm = { // this.commentForm = {
// id: id, // id: id,
// desc: desc // desc: desc
// }; // };
}else{ } else {
this.$message({ this.$message({
type: 'warning', type: 'warning',
message: '请选择' message: '请选择'
}); });
} }
}, },
} }
} }
...@@ -516,15 +524,17 @@ ...@@ -516,15 +524,17 @@
.index { .index {
padding: 20px 0; padding: 20px 0;
} }
.sms { .sms {
padding: 20px 0; padding: 20px 0;
} }
.avatar {
width: 50px;
min-width: 50px;
margin-right: 10px;
height: 50px;
border-radius: 50%; .avatar {
} width: 50px;
min-width: 50px;
margin-right: 10px;
height: 50px;
border-radius: 50%;
}
</style> </style>
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
&::-webkit-scrollbar { &::-webkit-scrollbar {
background-color: #333333; /* or add it to the track */ background-color: #333333; /* or add it to the track */
&:hover { &:hover {
&::-webkit-scrollbar-thumb { &::-webkit-scrollbar-thumb {
background-color: #999; background-color: #999;
......
...@@ -401,7 +401,7 @@ ...@@ -401,7 +401,7 @@
show: false, show: false,
nowPage: 1, nowPage: 1,
total: 0, total: 0,
limit: 100, limit: 500,
teacher_id: '' teacher_id: ''
}, },
teacherList: [], teacherList: [],
......
...@@ -153,102 +153,109 @@ ...@@ -153,102 +153,109 @@
</template> </template>
<script> <script>
import {getGoodsListApi,setOrderApi,getPeriodsApi,getTeacherListApi,getUserListApi,getOrderTypeApi} from "../../service/api" import {
getGoodsListApi,
setOrderApi,
getPeriodsApi,
getTeacherListApi,
getUserListApi,
getOrderTypeApi
} from "../../service/api"
import vueAddress from '../framework/address-picker/Address' import vueAddress from '../framework/address-picker/Address'
import AddressArray from '../framework/address-picker/addr' import AddressArray from '../framework/address-picker/addr'
import {ORDERSTATUS,BUYWay,GOODSTYPE} from "../../util/wordbook" import {ORDERSTATUS, BUYWay, GOODSTYPE} from "../../util/wordbook"
import CommonJs from '../../util/common'; import CommonJs from '../../util/common';
import page from '../framework/page' import page from '../framework/page'
export default { export default {
name: "newdialogObj", name: "newdialogObj",
props:[ props: [
'newdialogObj' 'newdialogObj'
], ],
data(){ data() {
return{ return {
rules:{ rules: {
periods_id: [ periods_id: [
{ required: true, message: '请输入期数名称', trigger: 'change' } {required: true, message: '请输入期数名称', trigger: 'change'}
], ],
goods_id: [ goods_id: [
{ required: true, message: '请输入商品名称', trigger: 'change' } {required: true, message: '请输入商品名称', trigger: 'change'}
], ],
money: [ money: [
{ required: true, message: '请输入金额', trigger: 'blur' } {required: true, message: '请输入金额', trigger: 'blur'}
], ],
user_id: [ user_id: [
{ required: true, message: '请输入用户ID', trigger: 'blur' } {required: true, message: '请输入用户ID', trigger: 'blur'}
], ],
pay_at: [ pay_at: [
{ required: true, message: '请选择日期', trigger: 'change' } {required: true, message: '请选择日期', trigger: 'change'}
], ],
order_type:[ order_type: [
{ required: true, message: '请选择支付类型', trigger: 'change' } {required: true, message: '请选择支付类型', trigger: 'change'}
], ],
out_trade_no:[ out_trade_no: [
{ required: true, message: '请填写订单号', trigger: 'change' } {required: true, message: '请填写订单号', trigger: 'change'}
], ],
}, },
nowPage: 1, nowPage: 1,
limit: 200, limit: 200,
total:0, total: 0,
form:{ form: {
periods_id:"", periods_id: "",
goods_id:"", goods_id: "",
user_id:"", user_id: "",
money:"", money: "",
buy_type:"", buy_type: "",
invite_id:"", invite_id: "",
desc:"", desc: "",
province_name:"", province_name: "",
city:"", city: "",
area:"", area: "",
city_name:"", city_name: "",
district_name:"", district_name: "",
district:"", district: "",
province:"", province: "",
address:"", address: "",
receive_mobile:"", receive_mobile: "",
receive_name:"", receive_name: "",
order_type:"", order_type: "",
pay_at:"", pay_at: "",
}, },
goodsList:[], goodsList: [],
periodsList:[], periodsList: [],
pickerOptions1:'', pickerOptions1: '',
buyWayOptioms:[], buyWayOptioms: [],
teacherList: [], teacherList: [],
addShow:false, addShow: false,
searchFrom:{ searchFrom: {},
},
userList: [], userList: [],
multipleSelection: [], multipleSelection: [],
} }
}, },
components:{ components: {
vueAddress, vueAddress,
page, page,
}, },
filters:{ filters: {
filterGoods(val){ filterGoods(val) {
return '[' + GOODSTYPE[val.goods_type] + ']' + '[' +val.current_price / 100 + '元]' + val.name return '[' + GOODSTYPE[val.goods_type] + ']' + '[' + val.current_price / 100 + '元]' + val.name
} }
}, },
methods:{ methods: {
onPageChange(val){ onPageChange(val) {
this.nowPage = val this.nowPage = val
this.getUser() this.getUser()
}, },
onSizeChange(val){ onSizeChange(val) {
this.limit = val this.limit = val
this.nowPage = 1; this.nowPage = 1;
this.getUser() this.getUser()
}, },
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val; this.multipleSelection = val;
}, },
getUser(){ getUser() {
let json = { let json = {
page: this.nowPage, page: this.nowPage,
limit: 5 limit: 5
...@@ -262,68 +269,68 @@ import {getGoodsListApi,setOrderApi,getPeriodsApi,getTeacherListApi,getUserListA ...@@ -262,68 +269,68 @@ import {getGoodsListApi,setOrderApi,getPeriodsApi,getTeacherListApi,getUserListA
if (this.searchFrom.mobile) { if (this.searchFrom.mobile) {
json.mobile = this.searchFrom.mobile json.mobile = this.searchFrom.mobile
} }
getUserListApi(json).then(res=>{ getUserListApi(json).then(res => {
this.userList = res.list; this.userList = res.list;
this.total = res.total; this.total = res.total;
}) })
}, },
saveAddOrder(data){ saveAddOrder(data) {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {
let json={ let json = {
periods_id:data.periods_id, periods_id: data.periods_id,
goods_id:data.goods_id, goods_id: data.goods_id,
user_id:data.user_id, user_id: data.user_id,
money:data.money, money: data.money,
province_name:data.province_name, province_name: data.province_name,
city_id:data.city, city_id: data.city,
city:data.city_name, city: data.city_name,
area:data.district_name, area: data.district_name,
area_id:data.district, area_id: data.district,
province_id:data.province, province_id: data.province,
address:data.address, address: data.address,
receive_mobile:data.receive_mobile, receive_mobile: data.receive_mobile,
receive_name:data.receive_name, receive_name: data.receive_name,
order_type:data.order_type, order_type: data.order_type,
} }
// 元转分 // 元转分
json.money=json.money; json.money = json.money;
if(data.pay_at){ if (data.pay_at) {
json.pay_at = CommonJs.dateFmt( data.pay_at,"yyyy-MM-dd hh:mm:ss"); json.pay_at = CommonJs.dateFmt(data.pay_at, "yyyy-MM-dd hh:mm:ss");
} }
if(this.form.invite_id){ if (this.form.invite_id) {
json.invite_id = this.form.invite_id json.invite_id = this.form.invite_id
} }
if(this.form.desc){ if (this.form.desc) {
json.desc = this.form.desc json.desc = this.form.desc
} }
if(this.form.out_trade_no){ if (this.form.out_trade_no) {
json.out_trade_no = this.form.out_trade_no json.out_trade_no = this.form.out_trade_no
} }
json.invite_type="TEACHER"; json.invite_type = "TEACHER";
if(json.province_name && json.address && json.receive_mobile && json.receive_name){ if (json.province_name && json.address && json.receive_mobile && json.receive_name) {
setOrderApi(json).then(res=>{ setOrderApi(json).then(res => {
this.newdialogObj.show=false this.newdialogObj.show = false
this.$emit("reflash"); this.$emit("reflash");
this.$message({
message: '添加成功',
type: 'success'
});
})
} else {
this.$message({ this.$message({
message: '添加成功', message: "缺少必填项",
type: 'success' type: "warning"
}); });
}) }
}else{
this.$message({
message: "缺少必填项",
type: "warning"
});
}
} else { } else {
console.log('error submit!!'); console.log('error submit!!');
return false; return false;
} }
}); });
}, },
handlerAddressChange(val){ handlerAddressChange(val) {
if(!val.province || !val.city || !val.district){ if (!val.province || !val.city || !val.district) {
return return
} }
console.log(val) console.log(val)
...@@ -346,102 +353,102 @@ import {getGoodsListApi,setOrderApi,getPeriodsApi,getTeacherListApi,getUserListA ...@@ -346,102 +353,102 @@ import {getGoodsListApi,setOrderApi,getPeriodsApi,getTeacherListApi,getUserListA
this.form.district_name = districtObj.length > 0 ? districtObj[0].label : cityObj[0].children[0].label; this.form.district_name = districtObj.length > 0 ? districtObj[0].label : cityObj[0].children[0].label;
this.form.district = districtObj.length > 0 ? districtObj[0].value : cityObj[0].children[0].value; this.form.district = districtObj.length > 0 ? districtObj[0].value : cityObj[0].children[0].value;
}, },
getGoodsOption(){ getGoodsOption() {
let json = { let json = {
page: 1, page: 1,
limit: 200, limit: 200,
course_type:0, course_type: 0,
}; };
getGoodsListApi(json).then(res=>{ getGoodsListApi(json).then(res => {
this.goodsList = res.list; this.goodsList = res.list;
}) })
}, },
onOptionChange(id){ onOptionChange(id) {
this.form.periods_id=""; this.form.periods_id = "";
getPeriodsApi({goods_id:id}).then((res) => { getPeriodsApi({goods_id: id}).then((res) => {
this.periodsList=res.list this.periodsList = res.list
}) })
}, },
getTeacherList(name){ getTeacherList(name) {
let json = { let json = {
limit: 100, limit: 500,
page: 1 page: 1
}; };
if(name) { if (name) {
json.name = name json.name = name
} }
getTeacherListApi(json).then(res=>{ getTeacherListApi(json).then(res => {
this.teacherList = res.list this.teacherList = res.list
}); });
getOrderTypeApi().then(res =>{ getOrderTypeApi().then(res => {
this.buyWayOptioms = res this.buyWayOptioms = res
}) })
}, },
remoteMethod(query) { remoteMethod(query) {
if (query !== '') { if (query !== '') {
this.getTeacherList(query); this.getTeacherList(query);
} else { } else {
this.getTeacherList(); this.getTeacherList();
} }
}, },
onAddUser(){ onAddUser() {
this.addShow = true; this.addShow = true;
this.getUser(); this.getUser();
}, },
onAdd(){ onAdd() {
if(this.multipleSelection.length === 0) { if (this.multipleSelection.length === 0) {
this.$message({ this.$message({
type: 'error', type: 'error',
message: '请选择用户!' message: '请选择用户!'
}); });
return return
} else if (this.multipleSelection.length !== 1){ } else if (this.multipleSelection.length !== 1) {
this.$message({ this.$message({
type: 'error', type: 'error',
message: '只能选择一个用户!' message: '只能选择一个用户!'
}); });
return return
} }
this.form.user_id=this.multipleSelection[0].user_id; this.form.user_id = this.multipleSelection[0].user_id;
this.addShow = false; this.addShow = false;
}, },
}, },
watch:{ watch: {
'newdialogObj.show'(val){ 'newdialogObj.show'(val) {
if(val){ if (val) {
this.getGoodsOption(); this.getGoodsOption();
this.getTeacherList(); this.getTeacherList();
// this.form={ // this.form={
// periods_id:"", // periods_id:"",
// goods_id:"", // goods_id:"",
// user_id:"", // user_id:"",
// money:"", // money:"",
// buy_type:"", // buy_type:"",
// invite_id:"", // invite_id:"",
// desc:"", // desc:"",
// province_name:"", // province_name:"",
// city:"", // city:"",
// area:"", // area:"",
// city_name:"", // city_name:"",
// district_name:"", // district_name:"",
// district:"", // district:"",
// province:"", // province:"",
// address:"", // address:"",
// receive_mobile:"", // receive_mobile:"",
// receive_name:"", // receive_name:"",
// order_type:"", // order_type:"",
// pay_at:"", // pay_at:"",
// }; // };
} }
} }
}, },
mounted(){ mounted() {
}, },
} }
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.dialog-footer{ .dialog-footer {
display: block; display: block;
text-align: center; text-align: center;
} }
......
...@@ -244,207 +244,207 @@ ...@@ -244,207 +244,207 @@
} from "../../util/wordbook"; } from "../../util/wordbook";
import CommonJs from "../../util/common"; import CommonJs from "../../util/common";
export default { export default {
name: "index", name: "index",
data() { data() {
return { return {
nowPage: 1,
total: 0,
today:{
text:'今天',
onClick:()=>{
this.searchFrom.payTime = [this.formatTime(new Date())+' 00:00:00',this.formatTime(new Date())+' 23:59:59'];
}
},
yesterday:{
text:'昨天',
onClick:()=>{
let preDate = this.formatTime(new Date(new Date().getTime() - 24*60*60*1000));
this.searchFrom.payTime = [preDate+' 00:00:00',preDate+' 23:59:59'];
}
},
last30Day:{
text:'过去30天',
onClick:()=>{
let preDate = this.formatTime(new Date(new Date().getTime() - 30*24*60*60*1000));
this.searchFrom.payTime = [preDate+' 00:00:00',this.formatTime(new Date())+' 23:59:59'];
}
},
last7Day:{
text:'过去7天',
onClick:()=>{
let preDate = this.formatTime(new Date(new Date().getTime() - 7*24*60*60*1000));
this.searchFrom.payTime = [preDate+' 00:00:00',this.formatTime(new Date())+' 23:59:59'];
}
},
sourceDialog: {
show: false,
out_trade_no: ""
},
couponDetail: {
show: false,
order_coupon_id: ""
},
refundDetail: {
show: false,
out_trade_no: ""
},
limit: 10,
searchFrom: {
nickname: "",
wait_into_course:'',
user_id: "",
invite_type: "",
invite_id: "",
buy_type: "",
status: [1, 4, 5],
goods_id: "",
out_trade_no: "",
payTime: [],
order_group_id: "",
is_captain:"",
},
tableData: [],
dialogObj: {
show: false
},
refundDialogObj: {
show: false,
id: "",
money: 0
},
dialogDetailObj: {
show: false,
detail: {}
},
goodList: [],
inviteTypeOption: INVITETYPEOPTION,
orderStatusOption: ORDERSTATUSOPTION,
buyTypeOption: BUYTYPEOPTION,
inviteSearchPlaceholder: "",
rules: {
value: [{ required: true, message: "请输入备注", trigger: "change" }]
},
promoterDialog: {
show: false,
nowPage: 1, nowPage: 1,
total: 0, total: 0,
limit: 100, today: {
teacher_id: "" text: '今天',
}, onClick: () => {
teacherList: [], this.searchFrom.payTime = [this.formatTime(new Date()) + ' 00:00:00', this.formatTime(new Date()) + ' 23:59:59'];
loading: false, }
isLeaderOption:ISLEADEROPTION, },
}; yesterday: {
}, text: '昨天',
methods: { onClick: () => {
periodName(val) { let preDate = this.formatTime(new Date(new Date().getTime() - 24 * 60 * 60 * 1000));
let str = ''; this.searchFrom.payTime = [preDate + ' 00:00:00', preDate + ' 23:59:59'];
if (!val.periods_title) { }
str = '-' },
} else { last30Day: {
if (val.goods_id) { text: '过去30天',
str += `【${val.goods_id}】` onClick: () => {
} let preDate = this.formatTime(new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000));
if (val.periods_title) { this.searchFrom.payTime = [preDate + ' 00:00:00', this.formatTime(new Date()) + ' 23:59:59'];
str += `${val.periods_title}<br>` }
} },
if (val.watch_num) { last7Day: {
str += `${val.watch_num}课时` text: '过去7天',
} onClick: () => {
if (val.start_at) { let preDate = this.formatTime(new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000));
str += `(${val.start_at.slice(5).replace('-', '')})` this.searchFrom.payTime = [preDate + ' 00:00:00', this.formatTime(new Date()) + ' 23:59:59'];
} }
if (val.has_watch_num || val.has_watch_num == 0) { },
str += `-d${val.has_watch_num}` sourceDialog: {
} show: false,
} out_trade_no: ""
return str },
}, couponDetail: {
formatTime(date){ show: false,
let year = date.getFullYear(); order_coupon_id: ""
let Month = date.getMonth()+1; },
if(Month < 10){ refundDetail: {
Month = `0${Month}` show: false,
} out_trade_no: ""
let Day = date.getDate(); },
if(Day<10)Day = `0${Day}`; limit: 10,
return `${year}-${Month}-${Day}`; searchFrom: {
}, nickname: "",
showRef(data) { wait_into_course: '',
this.refundDetail.show = true; user_id: "",
this.refundDetail.out_trade_no = data.out_trade_no; invite_type: "",
}, invite_id: "",
showCoupon(data) { buy_type: "",
this.couponDetail.show = true; status: [1, 4, 5],
this.couponDetail.order_coupon_id = data.order_coupon_id; goods_id: "",
}, out_trade_no: "",
showSource(data) { payTime: [],
this.sourceDialog.show = true; order_group_id: "",
this.sourceDialog.out_trade_no = data.out_trade_no; is_captain: "",
}, },
changeRow(data, b) { tableData: [],
if (b.indexOf(data) > -1) { dialogObj: {
getRefundListApi({ out_trade_no: data.out_trade_no }).then(res => { show: false
data.refundList = res.list; },
}); refundDialogObj: {
} show: false,
}, id: "",
exportTable() { money: 0
let json = { },
limit: this.limit, dialogDetailObj: {
page: this.nowPage show: false,
detail: {}
},
goodList: [],
inviteTypeOption: INVITETYPEOPTION,
orderStatusOption: ORDERSTATUSOPTION,
buyTypeOption: BUYTYPEOPTION,
inviteSearchPlaceholder: "",
rules: {
value: [{required: true, message: "请输入备注", trigger: "change"}]
},
promoterDialog: {
show: false,
nowPage: 1,
total: 0,
limit: 500,
teacher_id: ""
},
teacherList: [],
loading: false,
isLeaderOption: ISLEADEROPTION,
}; };
if (this.searchFrom.nickname) {
json.nickname = this.searchFrom.nickname;
}
if (this.searchFrom.user_id) {
json.user_id = this.searchFrom.user_id;
}
if (this.searchFrom.invite_type) {
json.invite_type = this.searchFrom.invite_type;
}
if (this.searchFrom.invite_id) {
json.invite_id = this.searchFrom.invite_id;
}
if (this.searchFrom.order_group_id) {
json.order_group_id = this.searchFrom.order_group_id;
}
if (this.searchFrom.buy_type) {
json.buy_type = this.searchFrom.buy_type;
}
if (this.searchFrom.status) {
json.status = this.searchFrom.status.toString();
}
if (this.searchFrom.goods_id) {
json.goods_id = this.searchFrom.goods_id;
}
if (this.searchFrom.is_captain || this.searchFrom.is_captain == 0) {
json.is_captain = this.searchFrom.is_captain;
}
if (this.searchFrom.out_trade_no) {
json.out_trade_no = this.searchFrom.out_trade_no;
}
if (this.searchFrom.receive_mobile) {
json.receive_mobile = this.searchFrom.receive_mobile;
}
if (this.searchFrom.payTime && this.searchFrom.payTime.length > 0) {
json.pay_start_at = this.searchFrom.payTime[0]
json.pay_end_at = this.searchFrom.payTime[1]
}
if (this.searchFrom.wait_into_course) {
json.wait_into_course = this.searchFrom.wait_into_course
}
json.course_type = 1; //日课
exportExcelApi("/api/admin/order/export", json,'日课订单列表');
}, },
getGoodsOption() { methods: {
let json = { periodName(val) {
page: 1, let str = '';
limit: 100, if (!val.periods_title) {
course_type:1, str = '-'
status:"1,2" } else {
}; if (val.goods_id) {
str += `【${val.goods_id}】`
}
if (val.periods_title) {
str += `${val.periods_title}<br>`
}
if (val.watch_num) {
str += `${val.watch_num}课时`
}
if (val.start_at) {
str += `(${val.start_at.slice(5).replace('-', '')})`
}
if (val.has_watch_num || val.has_watch_num == 0) {
str += `-d${val.has_watch_num}`
}
}
return str
},
formatTime(date) {
let year = date.getFullYear();
let Month = date.getMonth() + 1;
if (Month < 10) {
Month = `0${Month}`
}
let Day = date.getDate();
if (Day < 10) Day = `0${Day}`;
return `${year}-${Month}-${Day}`;
},
showRef(data) {
this.refundDetail.show = true;
this.refundDetail.out_trade_no = data.out_trade_no;
},
showCoupon(data) {
this.couponDetail.show = true;
this.couponDetail.order_coupon_id = data.order_coupon_id;
},
showSource(data) {
this.sourceDialog.show = true;
this.sourceDialog.out_trade_no = data.out_trade_no;
},
changeRow(data, b) {
if (b.indexOf(data) > -1) {
getRefundListApi({out_trade_no: data.out_trade_no}).then(res => {
data.refundList = res.list;
});
}
},
exportTable() {
let json = {
limit: this.limit,
page: this.nowPage
};
if (this.searchFrom.nickname) {
json.nickname = this.searchFrom.nickname;
}
if (this.searchFrom.user_id) {
json.user_id = this.searchFrom.user_id;
}
if (this.searchFrom.invite_type) {
json.invite_type = this.searchFrom.invite_type;
}
if (this.searchFrom.invite_id) {
json.invite_id = this.searchFrom.invite_id;
}
if (this.searchFrom.order_group_id) {
json.order_group_id = this.searchFrom.order_group_id;
}
if (this.searchFrom.buy_type) {
json.buy_type = this.searchFrom.buy_type;
}
if (this.searchFrom.status) {
json.status = this.searchFrom.status.toString();
}
if (this.searchFrom.goods_id) {
json.goods_id = this.searchFrom.goods_id;
}
if (this.searchFrom.is_captain || this.searchFrom.is_captain == 0) {
json.is_captain = this.searchFrom.is_captain;
}
if (this.searchFrom.out_trade_no) {
json.out_trade_no = this.searchFrom.out_trade_no;
}
if (this.searchFrom.receive_mobile) {
json.receive_mobile = this.searchFrom.receive_mobile;
}
if (this.searchFrom.payTime && this.searchFrom.payTime.length > 0) {
json.pay_start_at = this.searchFrom.payTime[0]
json.pay_end_at = this.searchFrom.payTime[1]
}
if (this.searchFrom.wait_into_course) {
json.wait_into_course = this.searchFrom.wait_into_course
}
json.course_type = 1; //日课
exportExcelApi("/api/admin/order/export", json, '日课订单列表');
},
getGoodsOption() {
let json = {
page: 1,
limit: 100,
course_type: 1,
status: "1,2"
};
getGoodsListApi(json).then(res => { getGoodsListApi(json).then(res => {
this.goodList = res.list; this.goodList = res.list;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<el-input v-model="form.title"></el-input> <el-input v-model="form.title"></el-input>
</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="请选择">
<el-option <el-option
v-for="item in itemOptions" v-for="item in itemOptions"
:key="item.id" :key="item.id"
...@@ -42,8 +42,8 @@ ...@@ -42,8 +42,8 @@
placeholder="选择日期"> placeholder="选择日期">
</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" filterable multiple> <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"
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
</el-option> </el-option>
</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" filterable> <el-select v-model="form.viewTeacher" placeholder="请选择" @change="onTeacher2Change" filterable>
<el-option <el-option
v-for="item in teacher2Options" v-for="item in teacher2Options"
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="将带班老师加入观摩班" v-if = "!form.id" label-width="200"> <el-form-item label="将带班老师加入观摩班" v-if="!form.id" label-width="200">
<el-switch <el-switch
v-model="form.is_add_teacher_to_class" v-model="form.is_add_teacher_to_class"
active-color="#13ce66" active-color="#13ce66"
...@@ -90,23 +90,31 @@ ...@@ -90,23 +90,31 @@
</template> </template>
<script> <script>
import {getGoodsListApi,getAddPeriodsApi,getTeacherListApi,getEditPeriodsApi,getLessonDetailApi,getPeriodsApi} from "../../service/api"; import {
import {ISORNOT,GOODSTYPE,LESSONTYPE,GOODSSTATUS} from "../../util/wordbook"; getGoodsListApi,
getAddPeriodsApi,
getTeacherListApi,
getEditPeriodsApi,
getLessonDetailApi,
getPeriodsApi
} from "../../service/api";
import {ISORNOT, GOODSTYPE, LESSONTYPE, GOODSSTATUS} from "../../util/wordbook";
import goodDialog from './dialog' import goodDialog from './dialog'
export default { export default {
props:[ props: [
'dialogObj' 'dialogObj'
], ],
data(){ data() {
return{ return {
loading: false, loading: false,
form: { form: {
is_add_teacher_to_class: false, is_add_teacher_to_class: false,
teacherList:[], teacherList: [],
viewTeacher:'', viewTeacher: '',
rest_week_day:[], rest_week_day: [],
title:"", title: "",
goods_id:"", goods_id: "",
}, },
show: false, show: false,
viewTeacher: '', viewTeacher: '',
...@@ -150,71 +158,71 @@ ...@@ -150,71 +158,71 @@
teacher2Options: [], teacher2Options: [],
goodList: [], goodList: [],
itemOptions: [], itemOptions: [],
rules:{ rules: {
title:[ title: [
{ required: true, message: '请输入名称', trigger: 'change' } {required: true, message: '请输入名称', trigger: 'change'}
], ],
startNum:[ startNum: [
{ required: true, message: '请输入开始主题', trigger: 'change' } {required: true, message: '请输入开始主题', trigger: 'change'}
], ],
start_at:[ start_at: [
{ required: true, message: '请选择开始上课时间', trigger: 'change' } {required: true, message: '请选择开始上课时间', trigger: 'change'}
], ],
rest_week_day:[ rest_week_day: [
{ required: true, message: '请选择周几不上课', trigger: 'change' } {required: true, message: '请选择周几不上课', trigger: 'change'}
], ],
teacher_ids:[ teacher_ids: [
{ required: true, message: '请选择老师ID', trigger: 'change' } {required: true, message: '请选择老师ID', trigger: 'change'}
], ],
goods_id: [ goods_id: [
{ required: true, message: '商品ID不能为空', trigger: 'change' } {required: true, message: '商品ID不能为空', trigger: 'change'}
], ],
teacherList: [ teacherList: [
{ required: true, message: '带班老师不能为空', trigger: 'change' } {required: true, message: '带班老师不能为空', trigger: 'change'}
], ],
viewTeacher: [ viewTeacher: [
{ required: true, message: '观摩老师不能为空', trigger: 'change' } {required: true, message: '观摩老师不能为空', trigger: 'change'}
] ]
}, },
periodsList:[], periodsList: [],
selectedGoods:[], selectedGoods: [],
} }
}, },
components:{ components: {
goodDialog goodDialog
}, },
watch:{ watch: {
'dialogObj.show'(val){ 'dialogObj.show'(val) {
if(val){ if (val) {
this.getTeachers(); this.getTeachers();
this.getGoodsOption(); this.getGoodsOption();
} }
}, },
show(value){ show(value) {
this.$emit("changeShow",value); this.$emit("changeShow", value);
} }
}, },
filters: { filters: {
isOrNot(value){ isOrNot(value) {
return ISORNOT[value] return ISORNOT[value]
}, },
goodsType(value){ goodsType(value) {
return GOODSTYPE[value] return GOODSTYPE[value]
}, },
lessonType(value){ lessonType(value) {
return LESSONTYPE[value] return LESSONTYPE[value]
}, },
goodsStatus(value){ goodsStatus(value) {
return GOODSSTATUS[value] return GOODSSTATUS[value]
}, },
filterGoods(val){ filterGoods(val) {
return '['+val.id+'][' + GOODSTYPE[val.goods_type] + ']' + '【' +val.current_price / 100 + '元】' + val.name return '[' + val.id + '][' + GOODSTYPE[val.goods_type] + ']' + '【' + val.current_price / 100 + '元】' + val.name
} }
}, },
methods:{ methods: {
sub(){ sub() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if(valid){ if (valid) {
let _id = this.form.goods_id; let _id = this.form.goods_id;
let json = { let json = {
title: this.form.title, title: this.form.title,
...@@ -224,7 +232,7 @@ ...@@ -224,7 +232,7 @@
} }
json.is_add_teacher_to_class = this.form.is_add_teacher_to_class ? 1 : 0; json.is_add_teacher_to_class = this.form.is_add_teacher_to_class ? 1 : 0;
if (this.form.id) { if (this.form.id) {
getEditPeriodsApi(this.form.id,json).then(res=>{ getEditPeriodsApi(this.form.id, json).then(res => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '编辑成功!' message: '编辑成功!'
...@@ -234,7 +242,7 @@ ...@@ -234,7 +242,7 @@
} else { } else {
json.teacher_ids = this.form.teacherList.join(','); json.teacher_ids = this.form.teacherList.join(',');
json.view_teacher_id = parseInt(this.form.viewTeacher); json.view_teacher_id = parseInt(this.form.viewTeacher);
getAddPeriodsApi(_id,json).then(res=>{ getAddPeriodsApi(_id, json).then(res => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '添加成功!' message: '添加成功!'
...@@ -242,26 +250,26 @@ ...@@ -242,26 +250,26 @@
this.$emit("reflash"); this.$emit("reflash");
}) })
} }
this.show=false; this.show = false;
} }
}); });
}, },
getTeachers(){ getTeachers() {
let json1 = { let json1 = {
page: 1, page: 1,
limit: 100, limit: 500,
status:0 status: 0
}; };
getTeacherListApi(json1).then((res)=>{ getTeacherListApi(json1).then((res) => {
this.teacherOptions = res.list; this.teacherOptions = res.list;
this.teacher1Options = res.list; this.teacher1Options = res.list;
this.teacher2Options = res.list; this.teacher2Options = res.list;
}) })
}, },
findDifferentArray(array1, array2){ findDifferentArray(array1, array2) {
let newArray = [] let newArray = []
array1.forEach((val)=>{ array1.forEach((val) => {
let index = array1.findIndex((item)=>{ let index = array1.findIndex((item) => {
return val.id == item return val.id == item
}) })
if (index === -1) { if (index === -1) {
...@@ -270,67 +278,73 @@ ...@@ -270,67 +278,73 @@
}) })
return newArray return newArray
}, },
onTeacher1Change(ids){ onTeacher1Change(ids) {
if(ids){ if (ids) {
this.teacher2Options = this.findDifferentArray(this.teacherOptions, ids) this.teacher2Options = this.findDifferentArray(this.teacherOptions, ids)
} else { } else {
this.teacher2Options = this.teacherOptions this.teacher2Options = this.teacherOptions
} }
}, },
onTeacher2Change(id){ onTeacher2Change(id) {
if(id){ if (id) {
this.teacher1Options = this.findDifferentArray(this.teacherOptions, [id]) this.teacher1Options = this.findDifferentArray(this.teacherOptions, [id])
} else { } else {
this.teacher1Options = this.teacherOptions this.teacher1Options = this.teacherOptions
} }
}, },
onOptionChange(id){ onOptionChange(id) {
let index = this.goodList.findIndex((val)=>{ return val.id === id}); let index = this.goodList.findIndex((val) => {
if(index >-1){ return val.id === id
});
if (index > -1) {
this.getLessonDetail(this.goodList[index].course_id); this.getLessonDetail(this.goodList[index].course_id);
} }
delete this.form.startNum delete this.form.startNum
}, },
getLessonDetail(id){ getLessonDetail(id) {
getLessonDetailApi(id,{}).then((res) => { getLessonDetailApi(id, {}).then((res) => {
this.itemOptions = res.detail[res.type] this.itemOptions = res.detail[res.type]
}) })
}, },
getGoodsOption(){ getGoodsOption() {
let json = { let json = {
page: 1, page: 1,
goods_type:'1,2', goods_type: '1,2',
limit: 100, limit: 100,
}; };
getGoodsListApi(json).then(res=>{ getGoodsListApi(json).then(res => {
this.goodList = res.list; this.goodList = res.list;
if (this.dialogObj.form.id){ if (this.dialogObj.form.id) {
this.form = this.dialogObj.form; this.form = this.dialogObj.form;
} else { } else {
this.form = { this.form = {
rest_week_day:[], rest_week_day: [],
is_add_teacher_to_class: false, is_add_teacher_to_class: false,
teacherList:[], teacherList: [],
viewTeacher:'', viewTeacher: '',
title:"", title: "",
goods_id:"", goods_id: "",
}; };
} }
if(this.dialogObj.form.course_id){ if (this.dialogObj.form.course_id) {
this.getLessonDetail(this.dialogObj.form.course_id); this.getLessonDetail(this.dialogObj.form.course_id);
} }
this.show = this.dialogObj.show this.show = this.dialogObj.show
}) })
}, },
changePeriods(data){ changePeriods(data) {
if(data.length>1){ if (data.length > 1) {
this.form.title=String(data[1]); this.form.title = String(data[1]);
} }
}, },
handleItemChange(val){ handleItemChange(val) {
getPeriodsApi({goods_id:val[0]}).then(res=>{ getPeriodsApi({goods_id: val[0]}).then(res => {
res.list.forEach(i=>{i.name = i.title}); res.list.forEach(i => {
this.periodsList.find(i=>{return i.id === val[0]}).children = res.list i.name = i.title
});
this.periodsList.find(i => {
return i.id === val[0]
}).children = res.list
}) })
}, },
}, },
......
...@@ -59,7 +59,8 @@ ...@@ -59,7 +59,8 @@
</el-card> </el-card>
<!--添加回访信息--> <!--添加回访信息-->
<el-card shadow="never" v-if="callbackObj.teacher_id && !$store.state.readonly" class="callback-item callback-input"> <!--<el-card shadow="never" v-if="callbackObj.teacher_id && !$store.state.readonly" class="callback-item callback-input">-->
<el-card shadow="never" v-if="callbackObj.teacher_id" class="callback-item callback-input">
<el-form size="small" inline> <el-form size="small" inline>
<el-form-item required> <el-form-item required>
<el-select v-model="add.method" placeholder="回访方式" style="width: 140px;"> <el-select v-model="add.method" placeholder="回访方式" style="width: 140px;">
...@@ -186,7 +187,8 @@ ...@@ -186,7 +187,8 @@
props: { props: {
callbackObj: { // user_id、teacher_id、timestamp callbackObj: { // user_id、teacher_id、timestamp
type: Object, type: Object,
default: () => {} default: () => {
}
}, },
hasUserInfo: { // 是否传过来用户信息,传来用户信息就不调接口请求用户新,否则请求(防止同时请求用户信息接口报错) hasUserInfo: { // 是否传过来用户信息,传来用户信息就不调接口请求用户新,否则请求(防止同时请求用户信息接口报错)
type: Boolean, type: Boolean,
...@@ -482,6 +484,7 @@ ...@@ -482,6 +484,7 @@
<style lang="less"> <style lang="less">
.callback-container { .callback-container {
border: none; border: none;
.el-divider--horizontal { .el-divider--horizontal {
margin: 20px 0; margin: 20px 0;
} }
......
...@@ -24,27 +24,28 @@ ...@@ -24,27 +24,28 @@
</template> </template>
<script> <script>
import {getTeacherListApi,addRelatedTeacherApi} from "../../service/api"; import {getTeacherListApi, addRelatedTeacherApi} from "../../service/api";
export default { export default {
props:[ props: [
'dialogObj' 'dialogObj'
], ],
data(){ data() {
return{ return {
form:{ form: {
id: '', id: '',
teacher_id:'', teacher_id: '',
}, },
teacherList:[], teacherList: [],
} }
}, },
methods:{ methods: {
initPage(){ initPage() {
let json ={ let json = {
page:1, page: 1,
limit:200 limit: 500
} }
getTeacherListApi(json).then(res=>{ getTeacherListApi(json).then(res => {
this.teacherList = res.list; this.teacherList = res.list;
}); });
this.form = { this.form = {
...@@ -52,9 +53,9 @@ ...@@ -52,9 +53,9 @@
teacher_id: this.dialogObj.teacher_id ? this.dialogObj.teacher_id : '' teacher_id: this.dialogObj.teacher_id ? this.dialogObj.teacher_id : ''
}; };
}, },
onSave(){ onSave() {
let json = { let json = {
teacher_id: this.form.teacher_id ? this.form.teacher_id : 0 teacher_id: this.form.teacher_id ? this.form.teacher_id : 0
}; };
addRelatedTeacherApi(this.form.id, json).then(res => { addRelatedTeacherApi(this.form.id, json).then(res => {
this.$message({ this.$message({
...@@ -66,9 +67,9 @@ ...@@ -66,9 +67,9 @@
}) })
} }
}, },
watch:{ watch: {
'dialogObj.show'(value){ 'dialogObj.show'(value) {
if(value){ if (value) {
this.initPage() this.initPage()
} }
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
:title="dialogObj.title" :title="dialogObj.title"
:visible.sync="dialogObj.show" :visible.sync="dialogObj.show"
center center
width="800px" width="800px"
> >
<el-form ref="form" :model="form" label-width="120px"> <el-form ref="form" :model="form" label-width="120px">
<el-form-item label="老师"> <el-form-item label="老师">
...@@ -25,27 +25,28 @@ ...@@ -25,27 +25,28 @@
</template> </template>
<script> <script>
import {getTeacherListApi,bindTeacherApi} from "../../service/api"; import {getTeacherListApi, bindTeacherApi} from "../../service/api";
export default { export default {
props:[ props: [
'dialogObj' 'dialogObj'
], ],
data(){ data() {
return{ return {
form:{ form: {
id: '', id: '',
teacher_id:'', teacher_id: '',
}, },
teacherList:[], teacherList: [],
} }
}, },
methods:{ methods: {
initPage(){ initPage() {
let json ={ let json = {
page:1, page: 1,
limit:200 limit: 500
} }
getTeacherListApi(json).then(res=>{ getTeacherListApi(json).then(res => {
this.teacherList = res.list; this.teacherList = res.list;
}); });
this.form = { this.form = {
...@@ -53,9 +54,9 @@ ...@@ -53,9 +54,9 @@
teacher_id: this.dialogObj.teacher_id ? this.dialogObj.teacher_id : '' teacher_id: this.dialogObj.teacher_id ? this.dialogObj.teacher_id : ''
}; };
}, },
onSave(){ onSave() {
let teacher_id=this.form.teacher_id ? this.form.teacher_id : 0 let teacher_id = this.form.teacher_id ? this.form.teacher_id : 0
bindTeacherApi(this.form.id,teacher_id).then(res => { bindTeacherApi(this.form.id, teacher_id).then(res => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '绑定成功!' message: '绑定成功!'
...@@ -64,8 +65,8 @@ ...@@ -64,8 +65,8 @@
}) })
} }
}, },
watch:{ watch: {
'dialogObj'(value){ 'dialogObj'(value) {
this.initPage() this.initPage()
} }
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<el-form-item label="用户ID"> <el-form-item label="用户ID">
<el-input v-model="searchFrom.user_id" style="width: 80px"></el-input> <el-input v-model="searchFrom.user_id" style="width: 80px"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="用户昵称"> <el-form-item label="用户昵称">
<el-input v-model="searchFrom.nickname" style="width: 110px"></el-input> <el-input v-model="searchFrom.nickname" style="width: 110px"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="手机号"> <el-form-item label="手机号">
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="绑定状态"> <el-form-item label="绑定状态">
<el-select v-model="searchFrom.user_buy" placeholder="请选择" @change="getList" style="width: 100px" clearable> <el-select v-model="searchFrom.user_buy" placeholder="请选择" @change="getList" style="width: 100px" clearable>
<el-option v-for="item in useTypeList" :key="item.user_buy" :label="item.value" :value="item.user_buy"> <el-option v-for="item in useTypeList" :key="item.user_buy" :label="item.value" :value="item.user_buy">
</el-option> </el-option>
</el-select> </el-select>
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
@change="getList"> @change="getList">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item > <el-form-item>
<el-button type="primary" @click="getList">搜索</el-button> <el-button type="primary" @click="getList">搜索</el-button>
<el-button type="primary" plain @click="exportTable(list)" v-if="$store.state.export">导出</el-button> <el-button type="primary" plain @click="exportTable(list)" v-if="$store.state.export">导出</el-button>
<el-button type="primary" plain @click="importDialog=true" v-if="$store.state.import">导入</el-button> <el-button type="primary" plain @click="importDialog=true" v-if="$store.state.import">导入</el-button>
...@@ -124,8 +124,8 @@ ...@@ -124,8 +124,8 @@
<el-option label="暂不分配" value="0"></el-option> <el-option label="暂不分配" value="0"></el-option>
<el-option v-for="(data,index) in teacherList" :key="index" :label="data.name" :value="data.id"></el-option> <el-option v-for="(data,index) in teacherList" :key="index" :label="data.name" :value="data.id"></el-option>
</el-select> </el-select>
<el-button size="small" type="success" @click="pullAll">批量分配</el-button> <el-button size="small" type="success" @click="pullAll">批量分配</el-button>
<el-button size="small" type="primary" @click="initOeder">手动添加外部订单</el-button> <el-button size="small" type="primary" @click="initOeder">手动添加外部订单</el-button>
</div> </div>
</div> </div>
<el-table :data="list" size="mini" style="width: 100%" @selection-change="handleSelectionChange"> <el-table :data="list" size="mini" style="width: 100%" @selection-change="handleSelectionChange">
...@@ -141,7 +141,7 @@ ...@@ -141,7 +141,7 @@
<el-table-column prop="nickname" label="购买人"> <el-table-column prop="nickname" label="购买人">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if='scope.row.user_id !== 0'> <div v-if='scope.row.user_id !== 0'>
<img class="avatar" :src="scope.row.avatar" /> <img class="avatar" :src="scope.row.avatar"/>
<div>{{scope.row.nickname}}<br>(ID:{{scope.row.user_id}})</div> <div>{{scope.row.nickname}}<br>(ID:{{scope.row.user_id}})</div>
</div> </div>
<div v-if='scope.row.user_id === 0'>用户未绑定</div> <div v-if='scope.row.user_id === 0'>用户未绑定</div>
...@@ -211,90 +211,90 @@ ...@@ -211,90 +211,90 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<page :nowPage="nowPage" :total="total" @pageChange="onPageChange" @sizeChange="onSizeChange" /> <page :nowPage="nowPage" :total="total" @pageChange="onPageChange" @sizeChange="onSizeChange"/>
<refund-dialog :dialogObj="refundDialogObj" @reflash="onAfterRefund" @changeShow="changeShow"></refund-dialog> <refund-dialog :dialogObj="refundDialogObj" @reflash="onAfterRefund" @changeShow="changeShow"></refund-dialog>
<refund-detail :dialogObj="refundDetail"/> <refund-detail :dialogObj="refundDetail"/>
<el-dialog :title="classObj.title" :visible.sync="classObj.show" center width="800px"> <el-dialog :title="classObj.title" :visible.sync="classObj.show" center width="800px">
<div style="margin:10px;color: #888888"> <div style="margin:10px;color: #888888">
最新同步时间:{{last_pull_time}} 最新同步时间:{{last_pull_time}}
</div> </div>
<el-table :data="classList" > <el-table :data="classList">
<el-table-column prop="teacher_name" label="班级老师"> <el-table-column prop="teacher_name" label="班级老师">
</el-table-column> </el-table-column>
<el-table-column prop="num" label="预计入班人数"> <el-table-column prop="num" label="预计入班人数">
</el-table-column> </el-table-column>
</el-table> </el-table>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
</span> </span>
</el-dialog> </el-dialog>
<el-dialog title="导入" class="import" :visible.sync="importDialog" center width="600px"> <el-dialog title="导入" class="import" :visible.sync="importDialog" center width="600px">
<div class='item'> <div class='item'>
<el-upload <el-upload
:show-file-list="false" :show-file-list="false"
:onSuccess="fileSuccess" :onSuccess="fileSuccess"
:headers="uploadHeader" :headers="uploadHeader"
:data="{param_token:param_token}" :data="{param_token:param_token}"
action="/api/admin/order/import/1" action="/api/admin/order/import/1"
> >
<el-button type="primary" plain>500条以下</el-button> <el-button type="primary" plain>500条以下</el-button>
</el-upload> </el-upload>
</div> </div>
<div class='item'> <div class='item'>
<el-upload <el-upload
:show-file-list="false" :show-file-list="false"
:onSuccess="fileSuccess" :onSuccess="fileSuccess"
:headers="uploadHeader" :headers="uploadHeader"
:data="{param_token:param_token}" :data="{param_token:param_token}"
action="/api/admin/order/import/2" action="/api/admin/order/import/2"
> >
<el-button type="warn" plain>500条或以上</el-button> <el-button type="warn" plain>500条或以上</el-button>
</el-upload> </el-upload>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog title="手动创建外部订单" :visible.sync="postOtherOrderDialog" center width="800px"> <el-dialog title="手动创建外部订单" :visible.sync="postOtherOrderDialog" center width="800px">
<el-form ref="searchFrom" size="small" :model="postOtherOrderData" label-width="125px"> <el-form ref="searchFrom" size="small" :model="postOtherOrderData" label-width="125px">
<el-form-item label="订单ID" required="" style="width: 400px" > <el-form-item label="订单ID" required="" style="width: 400px">
<el-input v-model="postOtherOrderData.order_id" ></el-input> <el-input v-model="postOtherOrderData.order_id"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="商品名称" required=""> <el-form-item label="商品名称" required="">
<el-select v-model="postOtherOrderData.goods_id" placeholder="请选择" filterable style="width: 150px" clearable> <el-select v-model="postOtherOrderData.goods_id" placeholder="请选择" filterable style="width: 150px" clearable>
<el-option v-for="(data,index) in goodList" :key="index" :label="data | filterGoods" :value="data.id"> <el-option v-for="(data,index) in goodList" :key="index" :label="data | filterGoods" :value="data.id">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- <el-form-item style="width: 400px" label="商品ID"> <!-- <el-form-item style="width: 400px" label="商品ID">
<el-input v-model="postOtherOrderData.goods_id" ></el-input> <el-input v-model="postOtherOrderData.goods_id" ></el-input>
</el-form-item> --> </el-form-item> -->
<el-form-item label="收件人姓名" required="" label-width="125px" style="width: 400px" > <el-form-item label="收件人姓名" required="" label-width="125px" style="width: 400px">
<el-input v-model="postOtherOrderData.receiver_name" ></el-input> <el-input v-model="postOtherOrderData.receiver_name"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="收件人手机号" required="" label-width="125px" style="width: 400px" > <el-form-item label="收件人手机号" required="" label-width="125px" style="width: 400px">
<el-input v-model="postOtherOrderData.receiver_mobile" ></el-input> <el-input v-model="postOtherOrderData.receiver_mobile"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="省名称" required="" label-width="125px" style="width: 400px" > <el-form-item label="省名称" required="" label-width="125px" style="width: 400px">
<el-input v-model="postOtherOrderData.receiver_province" ></el-input> <el-input v-model="postOtherOrderData.receiver_province"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="市名称" required="" label-width="125px" style="width: 400px" > <el-form-item label="市名称" required="" label-width="125px" style="width: 400px">
<el-input v-model="postOtherOrderData.receiver_city" ></el-input> <el-input v-model="postOtherOrderData.receiver_city"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="区名称" required="" label-width="125px" style="width: 400px" > <el-form-item label="区名称" required="" label-width="125px" style="width: 400px">
<el-input v-model="postOtherOrderData.receiver_area" ></el-input> <el-input v-model="postOtherOrderData.receiver_area"></el-input>
</el-form-item> </el-form-item>
<el-form-item label-width="125px" required="" style="width: 400px" left label="详细地址"> <el-form-item label-width="125px" required="" style="width: 400px" left label="详细地址">
<el-input type="textarea" v-model="postOtherOrderData.receiver_address" ></el-input> <el-input type="textarea" v-model="postOtherOrderData.receiver_address"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="活动方案" required=""> <el-form-item label="活动方案" required="">
<el-select v-model="postOtherOrderData.class_source" placeholder="请选择" filterable> <el-select v-model="postOtherOrderData.class_source" placeholder="请选择" filterable>
<el-option <el-option
v-for="(data,index) in classSource" v-for="(data,index) in classSource"
:key="index" :key="index"
:label="data.label" :label="data.label"
:value="data.value" > :value="data.value">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item > </el-form-item>
<el-form-item label-width="125px" required="" style="width: 400px" left label="备注"> <el-form-item label-width="125px" required="" style="width: 400px" left label="备注">
<el-input type="textarea" v-model="postOtherOrderData.desc" ></el-input> <el-input type="textarea" v-model="postOtherOrderData.desc"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
...@@ -302,25 +302,25 @@ ...@@ -302,25 +302,25 @@
<el-button type="primary" @click="postOtherOrderFn">确 定</el-button> <el-button type="primary" @click="postOtherOrderFn">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog title="编辑地址" :visible.sync="adressDialog" left width="500px"> <el-dialog title="编辑地址" :visible.sync="adressDialog" left width="500px">
<el-form ref="searchFrom" size="small" :model="adressData" label-width="125px"> <el-form ref="searchFrom" size="small" :model="adressData" label-width="125px">
<el-form-item label="用户姓名" style="width: 400px" > <el-form-item label="用户姓名" style="width: 400px">
<el-input v-model="adressData.receiver_name" ></el-input> <el-input v-model="adressData.receiver_name"></el-input>
</el-form-item> </el-form-item>
<el-form-item label-width="125px" style="width: 400px" label="收货人手机号"> <el-form-item label-width="125px" style="width: 400px" label="收货人手机号">
<el-input v-model="adressData.receiver_mobile" ></el-input> <el-input v-model="adressData.receiver_mobile"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="收货人省" label-width="125px" style="width: 400px" > <el-form-item label="收货人省" label-width="125px" style="width: 400px">
<el-input v-model="adressData.receiver_province" ></el-input> <el-input v-model="adressData.receiver_province"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="收货人市" label-width="125px" style="width: 400px" > <el-form-item label="收货人市" label-width="125px" style="width: 400px">
<el-input v-model="adressData.receiver_city" ></el-input> <el-input v-model="adressData.receiver_city"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="收货人区" label-width="125px" style="width: 400px" > <el-form-item label="收货人区" label-width="125px" style="width: 400px">
<el-input v-model="adressData.receiver_area" ></el-input> <el-input v-model="adressData.receiver_area"></el-input>
</el-form-item> </el-form-item>
<el-form-item label-width="125px" style="width: 400px" left label="收货人详细地址"> <el-form-item label-width="125px" style="width: 400px" left label="收货人详细地址">
<el-input type="textarea" v-model="adressData.receiver_address" ></el-input> <el-input type="textarea" v-model="adressData.receiver_address"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer" style="text-align:center;"> <span slot="footer" class="dialog-footer" style="text-align:center;">
...@@ -332,513 +332,423 @@ ...@@ -332,513 +332,423 @@
</template> </template>
<script> <script>
import page from "../framework/page"; import page from "../framework/page";
import md5 from 'js-md5'; import md5 from 'js-md5';
import refundDialog from "../order/refundDialog"; import refundDialog from "../order/refundDialog";
import refundDetail from "../order/refundDetail"; import refundDetail from "../order/refundDetail";
import CommonJs from '../../util/common'; import CommonJs from '../../util/common';
import Cookie from '../../util/cookie' import Cookie from '../../util/cookie'
import { import {
getyunjiApi, getyunjiApi,
yunjiOrderTeacherApi, yunjiOrderTeacherApi,
getGoodsListApi, getGoodsListApi,
exportExcelApi, exportExcelApi,
getTeacherListApi, getTeacherListApi,
orderDescApi, orderDescApi,
editOrderAdressApi, editOrderAdressApi,
postOtherOrderApi, postOtherOrderApi,
postClearOtherOrderApi, postClearOtherOrderApi,
getSourceStudentApi getSourceStudentApi
} from "../../service/api"; } from "../../service/api";
import { import {
ORDERSTATUS, ORDERSTATUS,
GOODSTYPE, GOODSTYPE,
ORDERSTATUSOPTION, ORDERSTATUSOPTION,
USERSTATUS, USERSTATUS,
USERSTATUSFORMATER, USERSTATUSFORMATER,
CLASSSOURCE CLASSSOURCE
} from "../../util/wordbook"; } from "../../util/wordbook";
let studentSource = {}
export default { let studentSource = {}
name: "smsRecord", export default {
components: { name: "smsRecord",
page, components: {
refundDialog, page,
refundDetail refundDialog,
}, refundDetail
data() { },
let singjson = { data() {
sing: "singsingenglish21000" let singjson = {
}; sing: "singsingenglish21000"
return { };
importDialog:false, return {
activityPlan: [], importDialog: false,
adressDialog:false, activityPlan: [],
postOtherOrderDialog:false, adressDialog: false,
postOtherOrderData:{}, postOtherOrderDialog: false,
classSource:[{ postOtherOrderData: {},
label:"系统订单随机", classSource: [{
value:2 label: "系统订单随机",
}, value: 2
{ },
label:"渠道1订单随机", {
value:3 label: "渠道1订单随机",
}, value: 3
{ },
label:"渠道2订单随机", {
value:4 label: "渠道2订单随机",
}], value: 4
adressData:{}, }],
USERSTATUS:USERSTATUS, adressData: {},
today:{ USERSTATUS: USERSTATUS,
text:'今天', today: {
onClick:(vm)=>{ text: '今天',
vm.$emit('pick', [this.formatTime(new Date())+' 00:00:00',this.formatTime(new Date())+' 23:59:59']) onClick: (vm) => {
} vm.$emit('pick', [this.formatTime(new Date()) + ' 00:00:00', this.formatTime(new Date()) + ' 23:59:59'])
}, }
yesterday:{ },
text:'昨天', yesterday: {
onClick:(vm)=>{ text: '昨天',
let preDate = this.formatTime(new Date(new Date().getTime() - 24*60*60*1000)); onClick: (vm) => {
vm.$emit('pick', [preDate+' 00:00:00',preDate+' 23:59:59']) let preDate = this.formatTime(new Date(new Date().getTime() - 24 * 60 * 60 * 1000));
} vm.$emit('pick', [preDate + ' 00:00:00', preDate + ' 23:59:59'])
}, }
last30Day:{ },
text:'过去30天', last30Day: {
onClick:(vm)=>{ text: '过去30天',
let preDate = this.formatTime(new Date(new Date().getTime() - 30*24*60*60*1000)); onClick: (vm) => {
vm.$emit('pick', [preDate+' 00:00:00',this.formatTime(new Date())+' 23:59:59']); let preDate = this.formatTime(new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000));
} vm.$emit('pick', [preDate + ' 00:00:00', this.formatTime(new Date()) + ' 23:59:59']);
}, }
last7Day:{ },
text:'过去7天', last7Day: {
onClick:(vm)=>{ text: '过去7天',
let preDate = this.formatTime(new Date(new Date().getTime() - 7*24*60*60*1000)); onClick: (vm) => {
vm.$emit('pick', [preDate+' 00:00:00',this.formatTime(new Date())+' 23:59:59']); let preDate = this.formatTime(new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000));
vm.$emit('pick', [preDate + ' 00:00:00', this.formatTime(new Date()) + ' 23:59:59']);
}
},
uploadHeader: {token: Cookie.get('cc_token')},
param_token: CommonJs.md5Code(),
nowPage: 1,
total: 0,
limit: 10,
useTypeList: [{
user_buy: 0,
value: "未绑定"
}, {
user_buy: 1,
value: "已绑定"
}],
searchFrom: {
class_source: '',
goods_id: "",
mobile: "",
active_at: [],
invite_type: '',
status: [1],
createTime: [],
course_type: '-1',
pullTime: [],
order_id: "",
teacher_id: "",
user_id: "",
nickname: "",
user_status: [],
sub_order_id: ""
},
refundDialogObj: {
show: false,
id: "",
order_type: ' other',
money: 0
},
orderStatusOption: ORDERSTATUSOPTION,
list: [],
teacherList: [],
goodList: [],
refundDetail: {
show: false,
out_trade_no: ""
},
teacherId: null,
classObj: {
show: false,
title: "当前同步进度",
order_id: 0,
teacher_id: 0
},
multipleSelection: [],
classList: [],
last_pull_time: "无",
studentSource: {}
};
},
filters: {
filterStatus: function (value) {
let msg = "";
if (value === 0) {
msg = "未绑定";
} else {
msg = "已绑定";
} }
return msg;
}, },
uploadHeader:{token:Cookie.get('cc_token')}, status(value) {
param_token:CommonJs.md5Code(), return ORDERSTATUS[value];
nowPage: 1,
total: 0,
limit: 10,
useTypeList: [{
user_buy: 0,
value: "未绑定"
}, {
user_buy: 1,
value: "已绑定"
}],
searchFrom: {
class_source: '',
goods_id: "",
mobile: "",
active_at:[],
invite_type:'',
status: [1],
createTime:[],
course_type:'-1',
pullTime:[],
order_id: "",
teacher_id: "",
user_id:"",
nickname:"",
user_status:[],
sub_order_id:""
},
refundDialogObj: {
show: false,
id: "",
order_type:' other',
money: 0
}, },
orderStatusOption: ORDERSTATUSOPTION, filterGoods(val) {
list: [], return (
teacherList: [], "[" +
goodList: [], val.id +
refundDetail: { "]" +
show: false, "[" +
out_trade_no: "" GOODSTYPE[val.goods_type] +
"]" +
"[" +
val.current_price / 100 +
"元]" +
val.name
);
}, },
teacherId:null, classType(val) {
classObj:{ // return CLASSSOURCE[val]
show: false, return studentSource[val]
title: "当前同步进度",
order_id: 0,
teacher_id: 0
},
multipleSelection:[],
classList:[],
last_pull_time:"无",
studentSource:{}
};
},
filters: {
filterStatus: function(value) {
let msg = "";
if (value === 0) {
msg = "未绑定";
} else {
msg = "已绑定";
} }
return msg;
},
status(value) {
return ORDERSTATUS[value];
}, },
filterGoods(val) { mounted() {
return (
"[" + this.getGoodsOption();
val.id + this.getTeacherList();
"]" + getSourceStudentApi().then(res => {
"[" + this.activityPlan = res;
GOODSTYPE[val.goods_type] + let obj = {}
"]" + res.forEach((item, index) => {
"[" + obj[item.type] = item.name
val.current_price / 100 + })
"元]" + studentSource = obj
val.name // console.log(obj)
); this.getList();
});
}, },
classType(val){ methods: {
// return CLASSSOURCE[val] periodName(val) {
return studentSource[val] let str = '';
} if (!val.periods_title) {
}, str = '-'
mounted() { } else {
if (val.goods_id) {
this.getGoodsOption(); str += `【${val.goods_id}】`
this.getTeacherList(); }
getSourceStudentApi().then(res=>{ if (val.periods_title) {
this.activityPlan = res; str += `${val.periods_title}<br>`
let obj = {} }
res.forEach((item,index)=>{ if (val.watch_num) {
obj[item.type]=item.name str += `${val.watch_num}课时`
}) }
studentSource = obj if (val.start_at) {
// console.log(obj) str += `(${val.start_at.slice(5).replace('-', '')})`
this.getList(); }
}); if (val.has_watch_num || val.has_watch_num == 0) {
}, str += `-d${val.has_watch_num}`
methods: { }
periodName(val) {
let str = '';
if (!val.periods_title) {
str = '-'
} else {
if (val.goods_id) {
str += `【${val.goods_id}】`
}
if (val.periods_title) {
str += `${val.periods_title}<br>`
}
if (val.watch_num) {
str += `${val.watch_num}课时`
}
if (val.start_at) {
str += `(${val.start_at.slice(5).replace('-', '')})`
}
if (val.has_watch_num || val.has_watch_num == 0) {
str += `-d${val.has_watch_num}`
} }
} return str
return str },
}, initClearOtherOrder(id) {
initClearOtherOrder(id){ this.$confirm('确认清除?', '提示', {
this.$confirm('确认清除?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
postClearOtherOrderApi(id).then(res=>{ postClearOtherOrderApi(id).then(res => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '清除成功!' message: '清除成功!'
}); });
}) })
}).catch(() => { }).catch(() => {
this.$message({ this.$message({
type:'info', type: 'info',
message: '已取消' message: '已取消'
});
});
},
postOtherOrderFn(){
let json={}
if(this.postOtherOrderData.order_id){
json.order_id = this.postOtherOrderData.order_id
}
if(this.postOtherOrderData.goods_id){
json.goods_id = this.postOtherOrderData.goods_id
}
if(this.postOtherOrderData.receiver_name){
json.receiver_name = this.postOtherOrderData.receiver_name
}
if(this.postOtherOrderData.receiver_mobile){
json.receiver_mobile = this.postOtherOrderData.receiver_mobile
}
if(this.postOtherOrderData.receiver_province){
json.receiver_province = this.postOtherOrderData.receiver_province
}
if(this.postOtherOrderData.receiver_city){
json.receiver_city = this.postOtherOrderData.receiver_city
}
if(this.postOtherOrderData.receiver_area){
json.receiver_area = this.postOtherOrderData.receiver_area
}
if(this.postOtherOrderData.receiver_address){
json.receiver_address = this.postOtherOrderData.receiver_address
}
if(this.postOtherOrderData.class_source){
json.class_source = this.postOtherOrderData.class_source
}
if(this.postOtherOrderData.desc){
json.desc = this.postOtherOrderData.desc
}
console.log(this.postOtherOrderData)
postOtherOrderApi(json).then(res =>{
this.$message('发送成功');
this.postOtherOrderDialog = false
this.getList();
})
},
initOeder(){
this.postOtherOrderDialog = true
this.postOtherOrderData = {
order_id:'',
goods_id:'',
receiver_name:"",
receiver_mobile:'',
receiver_province:'',
receiver_city:'',
receiver_area:'',
receiver_address:'',
class_source:'',
desc:''
}
},
editAdress(row){
// editOrderAdressApi
this.adressDialog = true
this.adressData ={
receiver_name:row.receiver_name,
receiver_mobile:row.receiver_mobile,
receiver_province:row.receiver_province,
receiver_city:row.receiver_city,
receiver_area:row.receiver_area,
receiver_address:row.receiver_address,
id:row.id,
}
},
editAdressCf(){
editOrderAdressApi(this.adressData.id,this.adressData).then(res => {
this.getList();
this.$message('修改成功');
this.adressDialog = false;
});
},
userStatusFormatter(val){
return(USERSTATUSFORMATER[val.user_status])
},
pullAll(){
if(this.multipleSelection.length < 1){
this.$message('请选择订单');
return false;
}
if(!this.teacherId){
this.$message('请选择老师');
return false;
}
let json = {
order_ids:[]
};
this.multipleSelection.forEach(i=>{
json.order_ids.push(i.id)
});
this.$confirm(`是否确定将这${json.order_ids.length}笔订单分配给该老师?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
yunjiOrderTeacherApi(this.teacherId,{order_ids:json.order_ids.join(',')}).then(res=>{
this.multipleSelection = [];
this.$message({
message: '提交成功',
type: 'success'
}); });
});
},
postOtherOrderFn() {
let json = {}
if (this.postOtherOrderData.order_id) {
json.order_id = this.postOtherOrderData.order_id
}
if (this.postOtherOrderData.goods_id) {
json.goods_id = this.postOtherOrderData.goods_id
}
if (this.postOtherOrderData.receiver_name) {
json.receiver_name = this.postOtherOrderData.receiver_name
}
if (this.postOtherOrderData.receiver_mobile) {
json.receiver_mobile = this.postOtherOrderData.receiver_mobile
}
if (this.postOtherOrderData.receiver_province) {
json.receiver_province = this.postOtherOrderData.receiver_province
}
if (this.postOtherOrderData.receiver_city) {
json.receiver_city = this.postOtherOrderData.receiver_city
}
if (this.postOtherOrderData.receiver_area) {
json.receiver_area = this.postOtherOrderData.receiver_area
}
if (this.postOtherOrderData.receiver_address) {
json.receiver_address = this.postOtherOrderData.receiver_address
}
if (this.postOtherOrderData.class_source) {
json.class_source = this.postOtherOrderData.class_source
}
if (this.postOtherOrderData.desc) {
json.desc = this.postOtherOrderData.desc
}
console.log(this.postOtherOrderData)
postOtherOrderApi(json).then(res => {
this.$message('发送成功');
this.postOtherOrderDialog = false
this.getList(); this.getList();
}) })
}).catch(() => { },
}); initOeder() {
this.postOtherOrderDialog = true
}, this.postOtherOrderData = {
selectedFlag(row){ order_id: '',
return row.user_id === 0 goods_id: '',
}, receiver_name: "",
handleSelectionChange(val) { receiver_mobile: '',
this.multipleSelection = val; receiver_province: '',
}, receiver_city: '',
onAfterRefund() { receiver_area: '',
this.refundDialogObj.show = false; receiver_address: '',
this.getList(); class_source: '',
}, desc: ''
showRef(data) { }
this.refundDetail.show = true; },
this.refundDetail.out_trade_no = data.order_id; editAdress(row) {
}, // editOrderAdressApi
changeShow(data) { this.adressDialog = true
this.refundDialogObj.show = data; this.adressData = {
}, receiver_name: row.receiver_name,
onRefund(id, money) { receiver_mobile: row.receiver_mobile,
this.refundDialogObj.id = id; receiver_province: row.receiver_province,
this.refundDialogObj.money = money; receiver_city: row.receiver_city,
this.refundDialogObj.show = true; receiver_area: row.receiver_area,
}, receiver_address: row.receiver_address,
id: row.id,
formatTime(date){ }
let year = date.getFullYear(); },
let Month = date.getMonth()+1; editAdressCf() {
if(Month < 10){ editOrderAdressApi(this.adressData.id, this.adressData).then(res => {
Month = `0${Month}` this.getList();
} this.$message('修改成功');
let Day = date.getDate(); this.adressDialog = false;
if(Day<10)Day = `0${Day}`;
return `${year}-${Month}-${Day}`;
},
fileSuccess(res){
console.log(res)
if(res.code==200){
this.$message({
message: res.data,
type: 'success'
}); });
}else{ },
this.$message({ userStatusFormatter(val) {
message: res.msg.replace(/\n/g,'</br>'), return (USERSTATUSFORMATER[val.user_status])
type:'error', },
duration:0, pullAll() {
showClose:true, if (this.multipleSelection.length < 1) {
dangerouslyUseHTMLString: true this.$message('请选择订单');
return false;
}
if (!this.teacherId) {
this.$message('请选择老师');
return false;
}
let json = {
order_ids: []
};
this.multipleSelection.forEach(i => {
json.order_ids.push(i.id)
}); });
} this.$confirm(`是否确定将这${json.order_ids.length}笔订单分配给该老师?`, '提示', {
}, confirmButtonText: '确定',
downLoad(){ cancelButtonText: '取消',
window.open('/static/外部订单模板.xlsx') type: 'warning'
},
onPageChange(val) {
this.nowPage = val;
this.getList();
},
getTeacherList() {
let json = {
page: 1,
limit: 200
};
getTeacherListApi(json).then(res => {
this.teacherList = res.list;
});
},
onSizeChange(val) {
this.nowPage = 1;
this.limit = val;
this.getList();
},
getList() {
let json = {
limit: this.limit,
page: this.nowPage
};
if (this.searchFrom.mobile) {
json.mobile = this.searchFrom.mobile;
}
if (this.searchFrom.status) {
json.status = this.searchFrom.status.join(',');
}
if (this.searchFrom.course_type !== '-1') {
json.course_type = this.searchFrom.course_type;
}
if (this.searchFrom.nickname) {
json.nickname = this.searchFrom.nickname;
}
if (this.searchFrom.user_id) {
json.user_id = this.searchFrom.user_id;
}
if (this.searchFrom.sub_order_id) {
json.sub_order_id = this.searchFrom.sub_order_id;
}
if (this.searchFrom.teacher_id) {
json.teacher_id = this.searchFrom.teacher_id;
}
if (this.searchFrom.goods_name) {
json.goods_name = this.searchFrom.goods_name;
}
if (this.searchFrom.user_buy || this.searchFrom.user_buy === 0) {
json.user_buy = this.searchFrom.user_buy;
}
if (this.searchFrom.order_id) {
json.order_id = this.searchFrom.order_id;
}
if (this.searchFrom.goods_id) {
json.goods_id = this.searchFrom.goods_id;
}
if (this.searchFrom.user_status.length) {
json.user_status = this.searchFrom.user_status.join(',');
}
if (this.searchFrom.invite_type) {
json.invite_type = this.searchFrom.invite_type;
}
if (this.searchFrom.createTime && this.searchFrom.createTime.length === 2){
json.start_at = this.searchFrom.createTime[0];
json.end_at = this.searchFrom.createTime[1]
}
if (this.searchFrom.active_at&&this.searchFrom.active_at.length === 2){
json.active_start_at = this.searchFrom.active_at[0];
json.active_end_at = this.searchFrom.active_at[1]
}
if (this.searchFrom.pullTime && this.searchFrom.pullTime.length === 2) {
json.pay_start_at = this.searchFrom.pullTime[0];
json.pay_end_at = this.searchFrom.pullTime[1];
}
this.searchFrom.class_source ? json.class_source = this.searchFrom.class_source : '';
getyunjiApi(json).then(res => {
this.total = res.total;
this.list = res.list ? res.list : [];
});
},
getGoodsOption() {
let json = {
page: 1,
limit: 100
};
getGoodsListApi(json).then(res => {
this.goodList = res.list;
});
},
editNote(id, desc) {
this.$prompt("", "编辑备注", {
confirmButtonText: "确定",
cancelButtonText: "取消",
inputType: "textarea",
inputValue: desc || ""
}).then(({ value }) => {
this.$confirm("确定保存?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => { }).then(() => {
orderDescApi({ desc: value }, id).then(res => { yunjiOrderTeacherApi(this.teacherId, {order_ids: json.order_ids.join(',')}).then(res => {
this.multipleSelection = [];
this.$message({ this.$message({
type: "success", message: '提交成功',
message: "编辑备注成功" type: 'success'
}); });
this.getList(); this.getList();
})
}).catch(() => {
});
},
selectedFlag(row) {
return row.user_id === 0
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
onAfterRefund() {
this.refundDialogObj.show = false;
this.getList();
},
showRef(data) {
this.refundDetail.show = true;
this.refundDetail.out_trade_no = data.order_id;
},
changeShow(data) {
this.refundDialogObj.show = data;
},
onRefund(id, money) {
this.refundDialogObj.id = id;
this.refundDialogObj.money = money;
this.refundDialogObj.show = true;
},
formatTime(date) {
let year = date.getFullYear();
let Month = date.getMonth() + 1;
if (Month < 10) {
Month = `0${Month}`
}
let Day = date.getDate();
if (Day < 10) Day = `0${Day}`;
return `${year}-${Month}-${Day}`;
},
fileSuccess(res) {
console.log(res)
if (res.code == 200) {
this.$message({
message: res.data,
type: 'success'
}); });
} else {
this.$message({
message: res.msg.replace(/\n/g, '</br>'),
type: 'error',
duration: 0,
showClose: true,
dangerouslyUseHTMLString: true
});
}
},
downLoad() {
window.open('/static/外部订单模板.xlsx')
},
onPageChange(val) {
this.nowPage = val;
this.getList();
},
getTeacherList() {
let json = {
page: 1,
limit: 500
};
getTeacherListApi(json).then(res => {
this.teacherList = res.list;
}); });
}); },
}, onSizeChange(val) {
exportTable(data) { this.nowPage = 1;
if (data.length > 0) { this.limit = val;
let json = {}; this.getList();
},
getList() {
let json = {
limit: this.limit,
page: this.nowPage
};
if (this.searchFrom.mobile) { if (this.searchFrom.mobile) {
json.mobile = this.searchFrom.mobile; json.mobile = this.searchFrom.mobile;
} }
...@@ -854,6 +764,9 @@ export default { ...@@ -854,6 +764,9 @@ export default {
if (this.searchFrom.user_id) { if (this.searchFrom.user_id) {
json.user_id = this.searchFrom.user_id; json.user_id = this.searchFrom.user_id;
} }
if (this.searchFrom.sub_order_id) {
json.sub_order_id = this.searchFrom.sub_order_id;
}
if (this.searchFrom.teacher_id) { if (this.searchFrom.teacher_id) {
json.teacher_id = this.searchFrom.teacher_id; json.teacher_id = this.searchFrom.teacher_id;
} }
...@@ -869,66 +782,164 @@ export default { ...@@ -869,66 +782,164 @@ export default {
if (this.searchFrom.goods_id) { if (this.searchFrom.goods_id) {
json.goods_id = this.searchFrom.goods_id; json.goods_id = this.searchFrom.goods_id;
} }
if (this.searchFrom.user_status.length) {
json.user_status = this.searchFrom.user_status.join(',');
}
if (this.searchFrom.invite_type) { if (this.searchFrom.invite_type) {
json.invite_type = this.searchFrom.invite_type; json.invite_type = this.searchFrom.invite_type;
} }
if (this.searchFrom.createTime && this.searchFrom.createTime.length === 2){ if (this.searchFrom.createTime && this.searchFrom.createTime.length === 2) {
json.start_at = this.searchFrom.createTime[0]; json.start_at = this.searchFrom.createTime[0];
json.end_at = this.searchFrom.createTime[1] json.end_at = this.searchFrom.createTime[1]
} }
if (this.searchFrom.active_at&&this.searchFrom.active_at.length === 2){ if (this.searchFrom.active_at && this.searchFrom.active_at.length === 2) {
json.active_start_at = this.searchFrom.active_at[0]; json.active_start_at = this.searchFrom.active_at[0];
json.active_end_at = this.searchFrom.active_at[1] json.active_end_at = this.searchFrom.active_at[1]
} }
if (this.searchFrom.pullTime&&this.searchFrom.pullTime.length === 2){ if (this.searchFrom.pullTime && this.searchFrom.pullTime.length === 2) {
json.pay_start_at = this.searchFrom.pullTime[0]; json.pay_start_at = this.searchFrom.pullTime[0];
json.pay_end_at = this.searchFrom.pullTime[1]; json.pay_end_at = this.searchFrom.pullTime[1];
} }
console.log(json) this.searchFrom.class_source ? json.class_source = this.searchFrom.class_source : '';
exportExcelApi(`api/admin/yunji/order/export`, json,'外部订单列表'); getyunjiApi(json).then(res => {
} this.total = res.total;
}, this.list = res.list ? res.list : [];
classListOption() { });
this.classObj.show=true; },
getyunjiApi({ page: 1,limit: 200}).then(res => { getGoodsOption() {
this.classList=res.teacher; let json = {
if(res.last_pull_time){ page: 1,
this.last_pull_time=res.last_pull_time; limit: 100
};
getGoodsListApi(json).then(res => {
this.goodList = res.list;
});
},
editNote(id, desc) {
this.$prompt("", "编辑备注", {
confirmButtonText: "确定",
cancelButtonText: "取消",
inputType: "textarea",
inputValue: desc || ""
}).then(({value}) => {
this.$confirm("确定保存?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
orderDescApi({desc: value}, id).then(res => {
this.$message({
type: "success",
message: "编辑备注成功"
});
this.getList();
});
});
});
},
exportTable(data) {
if (data.length > 0) {
let json = {};
if (this.searchFrom.mobile) {
json.mobile = this.searchFrom.mobile;
}
if (this.searchFrom.status) {
json.status = this.searchFrom.status.join(',');
}
if (this.searchFrom.course_type !== '-1') {
json.course_type = this.searchFrom.course_type;
}
if (this.searchFrom.nickname) {
json.nickname = this.searchFrom.nickname;
}
if (this.searchFrom.user_id) {
json.user_id = this.searchFrom.user_id;
}
if (this.searchFrom.teacher_id) {
json.teacher_id = this.searchFrom.teacher_id;
}
if (this.searchFrom.goods_name) {
json.goods_name = this.searchFrom.goods_name;
}
if (this.searchFrom.user_buy || this.searchFrom.user_buy === 0) {
json.user_buy = this.searchFrom.user_buy;
}
if (this.searchFrom.order_id) {
json.order_id = this.searchFrom.order_id;
}
if (this.searchFrom.goods_id) {
json.goods_id = this.searchFrom.goods_id;
}
if (this.searchFrom.invite_type) {
json.invite_type = this.searchFrom.invite_type;
}
if (this.searchFrom.createTime && this.searchFrom.createTime.length === 2) {
json.start_at = this.searchFrom.createTime[0];
json.end_at = this.searchFrom.createTime[1]
}
if (this.searchFrom.active_at && this.searchFrom.active_at.length === 2) {
json.active_start_at = this.searchFrom.active_at[0];
json.active_end_at = this.searchFrom.active_at[1]
}
if (this.searchFrom.pullTime && this.searchFrom.pullTime.length === 2) {
json.pay_start_at = this.searchFrom.pullTime[0];
json.pay_end_at = this.searchFrom.pullTime[1];
}
console.log(json)
exportExcelApi(`api/admin/yunji/order/export`, json, '外部订单列表');
} }
}); },
classListOption() {
this.classObj.show = true;
getyunjiApi({page: 1, limit: 200}).then(res => {
this.classList = res.teacher;
if (res.last_pull_time) {
this.last_pull_time = res.last_pull_time;
}
});
}
} }
} };
};
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.sms { .sms {
padding: 20px 0; padding: 20px 0;
} }
.el-table {
.el-button + .el-button {
margin-left: 0;
margin-top: 10px;
}
}
.el-table { .avatar {
.el-button + .el-button { width: 50px;
margin-left: 0; min-width: 50px;
margin-top: 10px; margin-right: 10px;
height: 50px;
border-radius: 50%;
} }
}
.avatar { .el-form-item__content {
width: 50px; height: 32px;
min-width: 50px; }
margin-right: 10px;
height: 50px; .import {
border-radius: 50%; top: 20vh;
} }
.el-form-item__content{height:32px;}
.import{top: 20vh;} .import .item {
.import .item{display:inline-block;margin-left: 110px} display: inline-block;
margin-left: 110px
}
</style> </style>
<style> <style>
.userInfo > div { .userInfo > div {
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
} }
</style> </style>
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