Commit 7acf9aac authored by lixy's avatar lixy

旅行:删除、上架、下架、编辑、创建

parent 68bd2c2d
...@@ -146,3 +146,23 @@ export function getAllTourTag(query) { ...@@ -146,3 +146,23 @@ export function getAllTourTag(query) {
params: query params: query
}); });
} }
/**
* 获取全部旅游标签
* @param query
*/
export function goodDel(id) {
return fetch({
url: '/api/tour/good/admin/goodDel/' + id,
method: 'get'
});
}
/**
* 上架、下架
* */
export function upStatusChange(query) {
return fetch({
url: '/api/tour/good/admin/upStatus',
method: 'get',
params: query
});
}
<template> <template>
<div class="app-container calendar-list-container" v-loading.body="showLoadingBody"> <div class="app-container calendar-list-container" v-loading.body="showLoadingBody">
<div v-if="!oneTourDialogVisible"> <div v-if="!oneTourDialogVisible">
<div class="filter-container" ref="filter-container"> <div class="filter-container" ref="filter-container">
...@@ -7,15 +6,15 @@ ...@@ -7,15 +6,15 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="旅行名称"> <el-form-item label="旅行名称">
<el-input v-model.number="listQuery.code" placeholder="请输入旅行名称"></el-input> <el-input v-model.number="listQuery.name" placeholder="请输入旅行名称"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="标签"> <el-form-item label="标签">
<el-select class="filter-item" v-model="listQuery.status" placeholder="请选择标签"> <el-select class="filter-item" v-model="listQuery.tagId" placeholder="请选择标签">
<el-option :key="undefined" label="无" :value="undefined"></el-option> <el-option :key="undefined" label="无" :value="undefined"></el-option>
<el-option v-for="(val, key, index) in getAllVehicleStatus() " :key="val.code" :label="val.val" <el-option v-for="val in allLabelList" :key="val.id" :label="val.name"
:value="val.code"></el-option> :value="val.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -51,19 +50,31 @@ ...@@ -51,19 +50,31 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column width="200" align="center" label="销量"> <el-table-column width="100" align="center" label="销量">
<template scope="scope"> <template scope="scope">
<span>{{scope.row.saleCount}}</span> <span>{{scope.row.saleCount}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" width="200" label="操作"> <el-table-column align="center" width="300" label="操作">
<template scope="scope"> <template scope="scope">
<el-button v-if="tourManage_btn_edit" size="small" type="success" @click="handleUpdate(scope.row)">编辑 <el-button v-if="tourManage_btn_edit" size="small" type="success" @click="handleUpdate(scope.row)">编辑
</el-button> </el-button>
<el-button size="small" type="warn" @click="undercarriageHandler(scope.row)"> <el-button size="small" type="primary" v-if="scope.row.status==2|| scope.row.status==0" @click="upStatus(scope.row)">
</el-button> </el-button>
<el-button size="small" type="danger" @click="deleteHandler(scope.row)">删除 <el-button size="small" type="warn" v-if="scope.row.status==1" @click="upStatus(scope.row)">下架
</el-button> </el-button>
<el-popover
ref="popover5"
placement="top"
width="160"
v-model="scope.row.visible2">
<p>确定删除吗?</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="scope.row.visible2 = false">取消</el-button>
<el-button type="primary" size="mini" @click="deleteHandler(scope.row)">确定</el-button>
</div>
</el-popover>
<el-button type="danger" size="small" v-popover:popover5>删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -102,7 +113,10 @@ ...@@ -102,7 +113,10 @@
import { import {
page, page,
goodsEdit goodsEdit,
getAllTourTag,
goodDel,
upStatusChange
} from 'api/tourManage'; } from 'api/tourManage';
import Element1 from "../admin/menu/components/element"; import Element1 from "../admin/menu/components/element";
...@@ -129,6 +143,7 @@ ...@@ -129,6 +143,7 @@
saleCount: undefined,//销量 saleCount: undefined,//销量
stock: undefined,//总数量 stock: undefined,//总数量
}, },
allLabelList:[],//全部标签
rules: { rules: {
subordinateBranch: [ subordinateBranch: [
{ {
...@@ -305,7 +320,9 @@ ...@@ -305,7 +320,9 @@
listLoading: true, listLoading: true,
listQuery: { listQuery: {
page: 1, page: 1,
limit: 20 limit: 20,
tagId: undefined,
name: '',//关键词
}, },
inline: true, inline: true,
tourManage_btn_edit: false,//编辑 tourManage_btn_edit: false,//编辑
...@@ -324,6 +341,7 @@ ...@@ -324,6 +341,7 @@
}, },
created() { created() {
this.getList(); this.getList();
this.getAllLabelList();//获取全部标签
this.tourManage_btn_edit = true;//this.elements['tourManage:btn_edit']; this.tourManage_btn_edit = true;//this.elements['tourManage:btn_edit'];
this.tourManage_btn_add = true;//this.elements['tourManage:btn_add']; this.tourManage_btn_add = true;//this.elements['tourManage:btn_add'];
}, },
...@@ -461,11 +479,20 @@ ...@@ -461,11 +479,20 @@
} }
}, },
methods: { methods: {
/**
* 获取全部旅游标签
* */
getAllLabelList() {
getAllTourTag().then(response => {
this.allLabelList = response.data;
});
},
/** /**
* 添加 * 添加
* */ * */
handleCreate() { handleCreate() {
this.resetTemp(); this.resetTemp();
this.oneTourRow = {};
this.modalTitle = '创建'; this.modalTitle = '创建';
this.oneTourDialogVisible = true; this.oneTourDialogVisible = true;
}, },
...@@ -473,8 +500,53 @@ ...@@ -473,8 +500,53 @@
* 操作-删除 * 操作-删除
* */ * */
deleteHandler(row) { deleteHandler(row) {
this.oneTourRow = row; goodDel(row.id).then(response => {
this.oneTourDialogVisible = true; if (response.status === 200) {
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
});
this.oneTourDialogVisible = false;
this.getList();
} else {
this.$notify({
title: '删除失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
},
/**
* 上架、下架 参数 id status 1-上架;2-下架 post
*/
upStatus(row){
let params = {
id: row.id,
status: row.status==1?2:1
};
upStatusChange(params).then(response => {
if (response.status === 200) {
this.$notify({
title: '成功',
message: '成功',
type: 'success',
duration: 2000
});
this.oneTourDialogVisible = false;
this.getList();
} else {
this.$notify({
title: '失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
}, },
/** /**
* 编辑 * 编辑
...@@ -717,6 +789,9 @@ ...@@ -717,6 +789,9 @@
if (!this.$utils.isEmpty(response.data.data) && this.$utils.isInteger(response.data.totalCount)) { if (!this.$utils.isEmpty(response.data.data) && this.$utils.isInteger(response.data.totalCount)) {
listRs = response.data.data; listRs = response.data.data;
totalCountRs = response.data.totalCount; totalCountRs = response.data.totalCount;
listRs.map(function(item){
item.visible2 = false;
});
} }
this.listLoading = false; this.listLoading = false;
this.list = listRs; this.list = listRs;
......
...@@ -5,15 +5,15 @@ ...@@ -5,15 +5,15 @@
<el-row style="margin: 10px 0;" v-for="item in lists" <el-row style="margin: 10px 0;" v-for="item in lists"
:key="item.id"> :key="item.id">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="出发地" > <el-form-item label="出发地">
<el-autocomplete <el-select v-model="item.name" filterable placeholder="请选择">
class="inline-input" <el-option
style="margin-left: 10px;" v-for="iitem in allCompaniesArr"
v-model="item.name" :key="iitem.value"
:fetch-suggestions="querySearch" :label="iitem.name"
placeholder="请输入内容" :value="iitem.id">
@select="handleSelect" </el-option>
></el-autocomplete> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
...@@ -29,13 +29,13 @@ ...@@ -29,13 +29,13 @@
<!--</el-time-picker>--> <!--</el-time-picker>-->
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <!--<el-col :span="8">-->
<el-form-item label="排序"> <!--<el-form-item label="排序">-->
<el-input style="width: 150px;" type="number" min="0" v-model="item.rank" placeholder="请输入排序"></el-input> <!--<el-input style="width: 150px;" type="number" min="0" v-model="item.rank" placeholder="请输入排序"></el-input>-->
<el-button type="danger" size="small" @click="deleteItem(item)">删除</el-button> <!--<el-button type="danger" size="small" @click="deleteItem(item)">删除</el-button>-->
</el-form-item> <!--</el-form-item>-->
</el-col> <!--</el-col>-->
<!--<el-col :span="3"> <el-button type="danger" size="small" @click="deleteItem(item)">删除</el-button></el-col>--> <el-col :span="3"> <el-button type="danger" size="small" @click="deleteItem(item)">删除</el-button></el-col>
</el-row> </el-row>
</el-form> </el-form>
...@@ -78,10 +78,11 @@ ...@@ -78,10 +78,11 @@
return { return {
isVisible: false, isVisible: false,
time:"", time:"",
lists: [],//新增项
t: {}, t: {},
lists:[],
num: 0, num: 0,
obj:{}//新增项 obj:{},//新增项
allCompaniesArr:[],
} }
}, },
created() { created() {
...@@ -103,13 +104,14 @@ ...@@ -103,13 +104,14 @@
mounted() { mounted() {
let that = this; let that = this;
let arr = []; let arr = [];
this.list.map(function(item){debugger this.list.map(function(item){
item.h = parseInt(item.departTime / 3600); item.h = parseInt(item.departTime / 3600);
item.s = (item.departTime-item.h*3600)/60; item.s = (item.departTime-item.h*3600)/60;
item.departTimeNew = item.h+":"+item.s; item.departTimeNew = item.h+":"+item.s;
item.rank = item.rank?item.rank:0; item.rank = item.rank?item.rank:0;
item.visible2 = false; item.visible2 = false;
arr.push(item); let c = that.objDeepCopy(item);
arr.push(c);
}); });
this.lists = arr; this.lists = arr;
this.isVisible = true; this.isVisible = true;
...@@ -120,14 +122,50 @@ ...@@ -120,14 +122,50 @@
]) ])
}, },
methods: { methods: {
deleteHandler(){}, changeDeparture(item){
let select = {};
this.allCompaniesArr.map(function(ii){
if(ii.id == item.name){
select = ii;
}
});
this.lists.map(function(iitem){debugger
if(iitem.id == item.id){
iitem.name = select.name;
iitem.address = select.address;
iitem.companyId = select.id;
iitem.addrProvince = select.addrProvince;
iitem.addrCity = select.addrCity;
iitem.longitude = select.longitude;
iitem.latitude = select.latitude;
}
});
debugger
},
/**
* 深拷贝
*/
objDeepCopy (source) {
var sourceCopy = source instanceof Array ? [] : {};
for (var item in source) {
sourceCopy[item] = typeof source[item] === 'object' ? objDeepCopy(source[item]) : source[item];
}
return sourceCopy;
},
addTime(){ addTime(){
this.t = { let t = {
addrCity: undefined,
addrDetail: undefined,
addrProvince: undefined,
id: undefined,
companyId: undefined,
latitude: undefined,
longitude: undefined,
name: "", name: "",
rank: 0, zoneId: undefined,
departTime: 28800, departTime: 28800,
}; };
this.lists.push(this.t); this.lists.push(t);
}, },
/** /**
* 改变出发时间 * 改变出发时间
...@@ -137,19 +175,11 @@ ...@@ -137,19 +175,11 @@
val.departTime = arr[0]*3600+ arr[1]*60; val.departTime = arr[0]*3600+ arr[1]*60;
console.log(val); console.log(val);
}, },
changeTime(val){
// if(typeof val == "object"){
// let hour = val.departTime.getHours();
// let sec = val.departTime.getMinutes();
// val.departTime = hour*3600+ sec*60;
// console.log(val.departTime);
// }
},
/** /**
* 删除分公司出发地 * 删除分公司出发地
* */ * */
deleteItem(obj){ deleteItem(obj){
this.lists.splice(this.lists.indexOf(obj),1); this.list.splice(this.list.indexOf(obj),1);
console.log(obj); console.log(obj);
}, },
/** /**
...@@ -157,14 +187,31 @@ ...@@ -157,14 +187,31 @@
* */ * */
okHandler() { okHandler() {
let arr = []; let arr = [];
// this.lists.map(function(item){ let that = this;
// this.list.map(function(item){
// // 时间转时间戳 // // 时间转时间戳
// let hour = item.departTime_new.getHours(); // let hour = item.departTime_new.getHours();
// let sec = item.departTime_new.getMinutes(); // let sec = item.departTime_new.getMinutes();
// item.departTime = hour*3600+ sec*60; // item.departTime = hour*3600+ sec*60;
// }); // });
this.lists.map(function(item){
let departTime = item.departTime;
let select = {};
that.allCompaniesArr.map(function(ii){
if(ii.id == item.name){
item.name = ii.name;
item.companyId = ii.id;
item.longitude = ii.longitude;
item.latitude = ii.latitude;
item.departTime = departTime;
}
});
});
debugger
// this.lists.map(function)
this.$emit('departureEvent', this.lists); this.$emit('departureEvent', this.lists);
console.log( this.list) console.log( this.lists)
}, },
/** /**
* 弹框-取消 * 弹框-取消
...@@ -183,11 +230,6 @@ ...@@ -183,11 +230,6 @@
// 调用 callback 返回建议列表的数据 // 调用 callback 返回建议列表的数据
cb(results); cb(results);
}, },
handleSelect(item) {
this.lists.splice(this.lists.indexOf(item),1);
item.departTime = 28800;
this.lists.push(item);
},
createFilter(queryString) { createFilter(queryString) {
return (restaurant) => { return (restaurant) => {
return (restaurant.name.indexOf(queryString.toLowerCase()) != -1); return (restaurant.name.indexOf(queryString.toLowerCase()) != -1);
......
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
<el-button type="primary" size="mini" @click="deleteHandler()">确定</el-button> <el-button type="primary" size="mini" @click="deleteHandler()">确定</el-button>
</div> </div>
</el-popover> </el-popover>
<el-button v-if="form.headTitle == '途径地名称'" type="danger" v-popover:popover5>删除</el-button> <el-button v-if="form.showTitle == '途径地编辑'" type="danger" v-popover:popover5>删除</el-button>
<el-button type="primary" @click="okHandler('form')">确 定</el-button> <el-button type="primary" @click="okHandler('form')">确 定</el-button>
</div> </div>
</el-dialog> </el-dialog>
...@@ -255,7 +255,7 @@ ...@@ -255,7 +255,7 @@
this.form = this.obj; this.form = this.obj;
this.listQuery.addrProvince = this.obj.province; this.listQuery.addrProvince = this.obj.province;
this.listQuery.addrCity = this.obj.city; this.listQuery.addrCity = this.obj.city;
this.keyword = row.keyword; this.keyword = row.keyword?row.keyword:"东莞市";
this.isVisible = true; this.isVisible = true;
}, },
computed: { computed: {
......
This diff is collapsed.
...@@ -93,7 +93,16 @@ ...@@ -93,7 +93,16 @@
watch: { watch: {
isVisible(newValue, oldValue){ isVisible(newValue, oldValue){
if(!newValue){ if(!newValue){
this.$emit('tourDepartTimeEvent', false); let arr = [];
this.list.map(function(item){
if(item.startTime){
arr.push(item);
}
});
let params = {
priceDTOS: arr
};
this.$emit('tourDepartTimeEvent', params);
} }
}, },
}, },
...@@ -166,7 +175,16 @@ ...@@ -166,7 +175,16 @@
* 弹框-取消 * 弹框-取消
* */ * */
cancel() { cancel() {
this.$emit('tourDepartTimeEvent', false); let arr = [];
this.list.map(function(item){
if(item.startTime){
arr.push(item);
}
});
let params = {
priceDTOS: arr
};
this.$emit('tourDepartTimeEvent', params);
}, },
dateChange1(val) { this.filters.startDate = val; }, dateChange1(val) { this.filters.startDate = val; },
/** /**
......
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