Commit 62a9703a authored by lixy's avatar lixy

旅游-必填项添加

parent 43fa21bc
...@@ -323,25 +323,24 @@ ...@@ -323,25 +323,24 @@
* 创建 * 创建
* */ * */
create(formName){ create(formName){
// this.isCreate = true;
let carouse = [];//营地轮播图
this.form.carouse.map(function (item) {
let c = {
id: item.id,
imgUrl: item.imgUrl
};
carouse.push(c);
});
/**
* 营地类别
* */
let campsiteTagDTOS = [];
this.form.campsiteTagListVos.map(function (item) {
campsiteTagDTOS.push(item.id);
});
const set = this.$refs; const set = this.$refs;
set[formName].validate(valid => { set[formName].validate(valid => {
if (valid) { if (valid) {
let carouse = [];//营地轮播图
this.form.carouse.map(function (item) {
let c = {
id: item.id,
imgUrl: item.imgUrl
};
carouse.push(c);
});
/**
* 营地类别
* */
let campsiteTagDTOS = [];
this.form.campsiteTagListVos.map(function (item) {
campsiteTagDTOS.push(item.id);
});
let params = { let params = {
name: this.form.name,//营地名称 name: this.form.name,//营地名称
logo: this.form.logo,//封面图 logo: this.form.logo,//封面图
...@@ -455,7 +454,6 @@ ...@@ -455,7 +454,6 @@
return; return;
} }
}); });
}, },
/** /**
* 更新 * 更新
......
...@@ -32,12 +32,12 @@ ...@@ -32,12 +32,12 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="经度"> <el-form-item label="经度" prop="latitude">
<el-input :value="form.latitude" readonly></el-input> <el-input :value="form.latitude" readonly></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="纬度" prop="longitude">
<el-input :value="form.longitude" readonly></el-input> <el-input :value="form.longitude" readonly></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -164,56 +164,26 @@ ...@@ -164,56 +164,26 @@
addrCity: undefined, addrCity: undefined,
}, },
rules: { rules: {
name: [ name:{
{
type: 'string', type: 'string',
required: true, required: true,
message: '请输入名称', message: '请输入名称',
trigger: 'blur' trigger: 'blur'
}, },
{ address: {
min: 0,
max: 2000,
message: '长度小于 2000 个字符',
trigger: 'blur'
}
],
address: [
{
type: 'string', type: 'string',
required: true, required: true,
message: '请输入详细地址', message: '请输入详细地址',
trigger: 'blur' trigger: 'blur'
}, },
{
min: 0,
max: 2000,
message: '长度小于 2000 个字符',
trigger: 'blur'
}
],
longitude:{ longitude:{
type: 'string',
required: true, required: true,
message: '请输入经纬度', message: '请选择经纬度'
trigger: 'blur'
}, },
latitude:{ latitude:{
type: 'string',
required: true, required: true,
message: '请输入经纬度', message: '请选择经纬度'
trigger: 'blur' }
},
addrProvince:{
required: true,
message: '请选择省份',
trigger: 'blur'
},
addrCity:{
required: true,
message: '请选择城市',
trigger: 'blur'
},
}, },
allCompanies: {}, allCompanies: {},
allCompaniesArr: [], allCompaniesArr: [],
...@@ -223,7 +193,6 @@ ...@@ -223,7 +193,6 @@
baidumapSwitch:false, baidumapSwitch:false,
zoom: 16, zoom: 16,
location: "深圳市", location: "深圳市",
} }
}, },
created() { created() {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<el-form :model="form" :rules="rules" ref="form" label-width="90px"> <el-form :model="form" :rules="rules" ref="form" label-width="90px">
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="旅行名称"> <el-form-item label="旅行名称" prop="name">
<el-input v-model="form.name" placeholder="请输入旅行名称"></el-input> <el-input v-model="form.name" placeholder="请输入旅行名称"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -19,44 +19,44 @@ ...@@ -19,44 +19,44 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="旅行原价" prop="operator"> <el-form-item label="旅行原价" prop="price">
<el-input v-model="form.price" type="number" min="0" placeholder="请输入旅行原价"></el-input> <el-input v-model="form.price" type="number" min="0" placeholder="请输入旅行原价"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="儿童价" prop="operator"> <el-form-item label="儿童价" prop="childPrice">
<el-input v-model="form.childPrice" type="number" min="0" placeholder="请输入儿童价"></el-input> <el-input v-model="form.childPrice" type="number" min="0" placeholder="请输入儿童价"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="是否为推荐" prop="mileage"> <el-form-item label="是否为推荐">
<el-radio class="radio" v-model="form.recommend" label="1"></el-radio> <el-radio class="radio" v-model="form.recommend" label="1"></el-radio>
<el-radio class="radio" v-model="form.recommend" label="0"></el-radio> <el-radio class="radio" v-model="form.recommend" label="0"></el-radio>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="会员价格" prop="mileage"> <el-form-item label="会员价格">
<el-radio class="radio" v-model="form.isMember" label="1">启用会员价</el-radio> <el-radio class="radio" v-model="form.isMember" label="1">启用会员价</el-radio>
<el-radio class="radio" v-model="form.isMember" label="0">不启用会员价</el-radio> <el-radio class="radio" v-model="form.isMember" label="0">不启用会员价</el-radio>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-form-item label="" prop="mileage"> <el-form-item label="">
<el-radio class="radio" v-model="form.isOutside" label="0">省内</el-radio> <el-radio class="radio" v-model="form.isOutside" label="0">省内</el-radio>
<el-radio class="radio" v-model="form.isOutside" label="1">省外</el-radio> <el-radio class="radio" v-model="form.isOutside" label="1">省外</el-radio>
</el-form-item> </el-form-item>
<el-row> <el-row>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="库存" prop="amount"> <el-form-item label="库存" prop="stock">
<el-input v-model="form.stock" placeholder="请输入总人数" type="number" min="0"></el-input> <el-input v-model="form.stock" placeholder="请输入总人数" type="number" min="0"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<!--<el-col :span="24">--> <!--<el-col :span="24">-->
<el-form-item label="出发地" prop="departure"> <el-form-item label="出发地">
<el-input style="display: inline-block;margin-right: 10px;width: 240px;" v-model="item.name" v-for="item in departureList" <el-input style="display: inline-block;margin-right: 10px;width: 240px;" v-model="item.name" v-for="item in departureList"
:key="item.id" readonly placeholder="请输入内容"></el-input> :key="item.id" readonly placeholder="请输入内容"></el-input>
<el-button size="small" class="el-button el-button--primary" type="button" icon="edit" @click="editDeparture(departureList)">编辑</el-button> <el-button size="small" class="el-button el-button--primary" type="button" icon="edit" @click="editDeparture(departureList)">编辑</el-button>
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
<!--<el-input v-model="form.operator" placeholder="请选择活动日期"></el-input>--> <!--<el-input v-model="form.operator" placeholder="请选择活动日期"></el-input>-->
</el-form-item> </el-form-item>
</el-row> </el-row>
<el-form-item label="旅行标签" prop="approvers"> <el-form-item label="旅行标签">
<span v-for="item in form.tagDTOS" <span v-for="item in form.tagDTOS"
:key="item.id" style="border: 1px solid #ccc; padding: 5px 10px;border-radius: 5px;margin-right: 10px;">{{item.name}}</span> :key="item.id" style="border: 1px solid #ccc; padding: 5px 10px;border-radius: 5px;margin-right: 10px;">{{item.name}}</span>
<!--<el-checkbox-group v-model="checkList">--> <!--<el-checkbox-group v-model="checkList">-->
...@@ -122,12 +122,12 @@ ...@@ -122,12 +122,12 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="单位" prop="amount"> <el-form-item label="单位">
<el-input v-model="form.unit" placeholder="人"></el-input> <el-input v-model="form.unit" placeholder="人"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="销量" prop="saleCount"> <el-form-item label="销量">
<el-input v-model="form.saleCount" type="number" min="0" placeholder="请输入销量"></el-input> <el-input v-model="form.saleCount" type="number" min="0" placeholder="请输入销量"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -200,8 +200,8 @@ ...@@ -200,8 +200,8 @@
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="cancelTour">取 消</el-button> <el-button @click="cancelTour">取 消</el-button>
<el-button type="primary" v-if="title=='创建' && !isCreate" @click="create()">确 定</el-button> <el-button type="primary" v-if="title=='创建' && !isCreate" @click="create('form')">确 定</el-button>
<el-button type="primary" v-if="title=='编辑' && !isCreate&&good_btn_update" @click="update()">确 定</el-button> <el-button type="primary" v-if="title=='编辑' && !isCreate&&good_btn_update" @click="update('form')">确 定</el-button>
</div> </div>
<!--编辑出发地--> <!--编辑出发地-->
<departureModal v-if="editDepartureVisible" :list="departureList" v-on:departureEvent = "departureEvent"></departureModal> <departureModal v-if="editDepartureVisible" :list="departureList" v-on:departureEvent = "departureEvent"></departureModal>
...@@ -283,7 +283,7 @@ import ElRow from "element-ui/packages/row/src/row"; ...@@ -283,7 +283,7 @@ import ElRow from "element-ui/packages/row/src/row";
percent: 0,//上传进度 percent: 0,//上传进度
imgFlag: false, imgFlag: false,
onePathObj:{name: ""},//待编辑的途径地 onePathObj:{name: ""},//待编辑的途径地
destinationObj:{name: ""},//目的地 destinationObj:{},//目的地
departureList: [],//出发地列表 departureList: [],//出发地列表
departureObj:{name: ""},//出发地 departureObj:{name: ""},//出发地
pathway: [],//途径地 pathway: [],//途径地
...@@ -319,26 +319,24 @@ import ElRow from "element-ui/packages/row/src/row"; ...@@ -319,26 +319,24 @@ import ElRow from "element-ui/packages/row/src/row";
showPathWayVisible: false,//编辑途径地 showPathWayVisible: false,//编辑途径地
showTimeVisible: false,//编辑时间 showTimeVisible: false,//编辑时间
rules: { rules: {
name: [ name: {
{ type: 'string',
type: 'string', required: true,
required: true, message: '请输入旅游名称',
message: '请输入消息内容', trigger: 'blur'
trigger: 'blur' },
}, price: {
{ required: true,
min: 0, message: '请输入价格',
max: 100, },
message: '长度小于 100 个字符', childPrice: {
trigger: 'blur' required: true,
} message: '请输入儿童价格'
], },
// departure: { stock: {
// type: 'string', required: true,
// required: true, message: '请输入库存'
// message: '请输入出发地', }
// trigger: 'blur'
// },
}, },
checkList:[],//已选中的标签 checkList:[],//已选中的标签
allCompanies: {}, allCompanies: {},
...@@ -449,241 +447,291 @@ import ElRow from "element-ui/packages/row/src/row"; ...@@ -449,241 +447,291 @@ import ElRow from "element-ui/packages/row/src/row";
/** /**
* 创建 * 创建
* */ * */
create(){ create(formName){
this.isCreate = true; const set = this.$refs;
//旅游标签 set[formName].validate(valid => {
let tagDTOS = []; if (valid) {
this.form.tagDTOS.map(function(item){ //旅游标签
if(item.tagId){ let tagDTOS = [];
tagDTOS.push({tagId: item.tagId}); this.form.tagDTOS.map(function(item){
} else { if(item.tagId){
tagDTOS.push({tagId: item.id}); tagDTOS.push({tagId: item.tagId});
} } else {
}); tagDTOS.push({tagId: item.id});
let siteDTOS = []; }
//出发地 });
this.departureList.map(function(item){ let siteDTOS = [];
let pp = item.province?item.province:item.addrProvince; //出发地
let c = item.addrCity?item.addrCity: item.city; this.departureList.map(function(item){
let provinceObj = pp?getRegionByCodes([pp]): [{name:""}]; let pp = item.province?item.province:item.addrProvince;
let cityObj = c?getRegionByCodes([c]):[{name:""}]; let c = item.addrCity?item.addrCity: item.city;
let p = { let provinceObj = pp?getRegionByCodes([pp]): [{name:""}];
name: item.name, let cityObj = c?getRegionByCodes([c]):[{name:""}];
departTime:item.departTime?item.departTime:0, let p = {
address: item.addrDetail?item.addrDetail: item.address, name: item.name,
companyId: item.companyId, departTime:item.departTime?item.departTime:0,
province: item.addrProvince?item.addrProvince:item.province, address: item.addrDetail?item.addrDetail: item.address,
provinceName:provinceObj[0].name, companyId: item.companyId,
cityName: cityObj[0].name, province: item.addrProvince?item.addrProvince:item.province,
city: item.addrCity?item.addrCity: item.city, provinceName:provinceObj[0].name,
longitude: item.longitude, cityName: cityObj[0].name,
latitude: item.latitude, city: item.addrCity?item.addrCity: item.city,
type: 0, longitude: item.longitude,
rank: item.rank latitude: item.latitude,
}; type: 0,
siteDTOS.push(p); rank: item.rank
}); };
//途径地 siteDTOS.push(p);
this.pathway.map(function(item){ });
let provinceObj = item.province?getRegionByCodes([item.province]): [{name:""}]; if(this.departureList.length<=0){
let cityObj = item.city?getRegionByCodes([item.city]):[{name:""}]; this.$notify({
title: '警告',
message: '请选择出发地',
type: 'warning',
duration: 2000
});
return;
}
//途径地
this.pathway.map(function(item){
let provinceObj = item.province?getRegionByCodes([item.province]): [{name:""}];
let cityObj = item.city?getRegionByCodes([item.city]):[{name:""}];
// let provinceObj = getRegionByCodes([item.province]); // let provinceObj = getRegionByCodes([item.province]);
// let cityObj = getRegionByCodes([item.city]); // let cityObj = getRegionByCodes([item.city]);
let p = { let p = {
name: item.name, name: item.name,
address: item.addrDetail?item.addrDetail: item.address, address: item.addrDetail?item.addrDetail: item.address,
// companyId: item.id, // companyId: item.id,
province: item.addrProvince?item.addrProvince:item.province, province: item.addrProvince?item.addrProvince:item.province,
provinceName:provinceObj[0].name, provinceName:provinceObj[0].name,
cityName: cityObj[0].name, cityName: cityObj[0].name,
city: item.addrCity?item.addrCity: item.city, city: item.addrCity?item.addrCity: item.city,
longitude: item.longitude, longitude: item.longitude,
latitude: item.latitude, latitude: item.latitude,
type: 1, type: 1,
rank: item.rank rank: item.rank
}; };
siteDTOS.push(p); siteDTOS.push(p);
});
//destinationObj目的地
let destinationObj = this.destinationObj;
let provinceObj = destinationObj.province?getRegionByCodes([destinationObj.province]):[{name:""}];
let cityObj = destinationObj.city?getRegionByCodes([destinationObj.city]):[{name:""}];
let p = {
name: destinationObj.name,
address: destinationObj.addrDetail?destinationObj.addrDetail: destinationObj.address,
province: destinationObj.addrProvince?destinationObj.addrProvince:destinationObj.province,
provinceName:provinceObj[0].name,
cityName: cityObj[0].name,
city: destinationObj.addrCity?destinationObj.addrCity: destinationObj.city,
longitude: destinationObj.longitude,
latitude: destinationObj.latitude,
type: 2
};
siteDTOS.push(p);
let params = {
isOutside: this.form.isOutside,//省内、省外
name: this.form.name,//旅游路线名称
cover: this.form.cover,//封面图
price: this.form.price,//成人价
childPrice: this.form.childPrice,//儿童价
viewCount: this.form.viewCount,//商品浏览量
saleCount: this.form.saleCount,//商品销售量
describe: this.form.describe,//商品描述
content: this.form.content,//商品详情(行程亮点)
introduce: this.form.introduce,//行程介绍
explain: this.form.explain,//费用说明
rank: this.form.rank,//旅行排序
recommend: this.form.recommend,//是否推荐:0-未推荐;1-已推荐
isMember: this.form.isMember,//是否启用会员价
stock: this.form.stock,//库存
unit: this.form.unit,//单位
number: this.form.number,//活动天数
bannerDTOS: this.form.bannerDTOS,//banner轮播图
siteDTOS: siteDTOS,//出发地type=0,途径地type=1,目的地type=2
priceDTOS: this.form.tourDepartTimeVo,//活动日期
tagDTOS: tagDTOS,//旅游标签
posterBackground:this.form.posterBackground,//海报背景
};
console.log(params);
goodsEdit(params).then(response => {
this.isCreate = false;
if (response.status === 200) {
this.$notify({
title: '成功',
message: '添加成功',
type: 'success',
duration: 2000
}); });
this.$emit("oneTourDialogEvent", true); //destinationObj目的地
} else { let destinationObj = this.destinationObj;
this.$notify({ if(!destinationObj.name){
title: '添加失败', this.$notify({
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!', title: '警告',
type: 'error', message: '请选择目的地',
duration: 2000 type: 'warning',
duration: 2000
});
return;
}
let provinceObj = destinationObj.province?getRegionByCodes([destinationObj.province]):[{name:""}];
let cityObj = destinationObj.city?getRegionByCodes([destinationObj.city]):[{name:""}];
let p = {
name: destinationObj.name,
address: destinationObj.addrDetail?destinationObj.addrDetail: destinationObj.address,
province: destinationObj.addrProvince?destinationObj.addrProvince:destinationObj.province,
provinceName:provinceObj[0].name,
cityName: cityObj[0].name,
city: destinationObj.addrCity?destinationObj.addrCity: destinationObj.city,
longitude: destinationObj.longitude,
latitude: destinationObj.latitude,
type: 2
};
siteDTOS.push(p);
this.isCreate = true;
let params = {
isOutside: this.form.isOutside,//省内、省外
name: this.form.name,//旅游路线名称
cover: this.form.cover,//封面图
price: this.form.price,//成人价
childPrice: this.form.childPrice,//儿童价
viewCount: this.form.viewCount,//商品浏览量
saleCount: this.form.saleCount,//商品销售量
describe: this.form.describe,//商品描述
content: this.form.content,//商品详情(行程亮点)
introduce: this.form.introduce,//行程介绍
explain: this.form.explain,//费用说明
rank: this.form.rank,//旅行排序
recommend: this.form.recommend,//是否推荐:0-未推荐;1-已推荐
isMember: this.form.isMember,//是否启用会员价
stock: this.form.stock,//库存
unit: this.form.unit,//单位
number: this.form.number,//活动天数
bannerDTOS: this.form.bannerDTOS,//banner轮播图
siteDTOS: siteDTOS,//出发地type=0,途径地type=1,目的地type=2
priceDTOS: this.form.tourDepartTimeVo,//活动日期
tagDTOS: tagDTOS,//旅游标签
posterBackground:this.form.posterBackground,//海报背景
};
console.log(params);
goodsEdit(params).then(response => {
this.isCreate = false;
if (response.status === 200) {
this.$notify({
title: '成功',
message: '添加成功',
type: 'success',
duration: 2000
});
this.$emit("oneTourDialogEvent", true);
} else {
this.$notify({
title: '添加失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
}); });
} else {
return;
} }
}); });
}, },
/** /**
* 编辑 * 编辑
* */ * */
update(){ update(formName){
//旅游标签 //旅游标签
this.isCreate = true; const set = this.$refs;
let tagDTOS = []; set[formName].validate(valid => {
this.form.tagDTOS.map(function(item){ if (valid) {
if(item.tagId){ let tagDTOS = [];
tagDTOS.push({tagId: item.tagId}); this.form.tagDTOS.map(function(item){
} else { if(item.tagId){
tagDTOS.push({tagId: item.id}); tagDTOS.push({tagId: item.tagId});
} } else {
}); tagDTOS.push({tagId: item.id});
let siteDTOS = []; }
//出发地 });
this.departureList.map(function(item){ let siteDTOS = [];
let pp = item.province?item.province:item.addrProvince; //出发地
let c = item.addrCity?item.addrCity: item.city; this.departureList.map(function(item){
let provinceObj = pp?getRegionByCodes([pp]): [{name:""}]; let pp = item.province?item.province:item.addrProvince;
let cityObj = c?getRegionByCodes([c]):[{name:""}]; let c = item.addrCity?item.addrCity: item.city;
let p = { let provinceObj = pp?getRegionByCodes([pp]): [{name:""}];
id: item.id, let cityObj = c?getRegionByCodes([c]):[{name:""}];
name: item.name, let p = {
departTime:item.departTime?item.departTime:0, id: item.id,
address: item.addrDetail?item.addrDetail: item.address, name: item.name,
companyId: item.companyId, departTime:item.departTime?item.departTime:0,
province: item.addrProvince?item.addrProvince:item.province, address: item.addrDetail?item.addrDetail: item.address,
provinceName:provinceObj[0].name, companyId: item.companyId,
cityName: cityObj[0].name, province: item.addrProvince?item.addrProvince:item.province,
city: item.addrCity?item.addrCity: item.city, provinceName:provinceObj[0].name,
longitude: item.longitude, cityName: cityObj[0].name,
latitude: item.latitude, city: item.addrCity?item.addrCity: item.city,
type: 0, longitude: item.longitude,
rank: item.rank latitude: item.latitude,
}; type: 0,
siteDTOS.push(p); rank: item.rank
}); };
//途径地 siteDTOS.push(p);
this.pathway.map(function(item){ });
let provinceObj = item.province?getRegionByCodes([item.province]): [{name:""}]; if(this.departureList.length<=0){
let cityObj = item.city?getRegionByCodes([item.city]):[{name:""}]; this.$notify({
let p = { title: '警告',
id: item.id, message: '请选择出发地',
name: item.name, type: 'warning',
address: item.addrDetail?item.addrDetail: item.address, duration: 2000
});
return;
}
//途径地
this.pathway.map(function(item){
let provinceObj = item.province?getRegionByCodes([item.province]): [{name:""}];
let cityObj = item.city?getRegionByCodes([item.city]):[{name:""}];
let p = {
id: item.id,
name: item.name,
address: item.addrDetail?item.addrDetail: item.address,
// companyId: item.id, // companyId: item.id,
province: item.addrProvince?item.addrProvince:item.province, province: item.addrProvince?item.addrProvince:item.province,
provinceName: provinceObj[0].name, provinceName: provinceObj[0].name,
cityName: cityObj[0].name, cityName: cityObj[0].name,
city: item.addrCity?item.addrCity: item.city, city: item.addrCity?item.addrCity: item.city,
longitude: item.longitude, longitude: item.longitude,
latitude: item.latitude, latitude: item.latitude,
type: 1, type: 1,
rank: item.rank rank: item.rank
}; };
siteDTOS.push(p); siteDTOS.push(p);
});
//destinationObj目的地
let destinationObj = this.destinationObj;
let provinceObj = destinationObj.province?getRegionByCodes([destinationObj.province]):[{name:""}];
let cityObj = destinationObj.city?getRegionByCodes([destinationObj.city]):[{name:""}];
let p = {
id: destinationObj.id,
name: destinationObj.name,
address: destinationObj.addrDetail?destinationObj.addrDetail: destinationObj.address,
province: destinationObj.addrProvince?destinationObj.addrProvince:destinationObj.province,
provinceName: provinceObj[0].name,
cityName: cityObj[0].name,
city: destinationObj.addrCity?destinationObj.addrCity: destinationObj.city,
longitude: destinationObj.longitude,
latitude: destinationObj.latitude,
type: 2
};
siteDTOS.push(p);
let params = {
id: this.form.id,
isOutside: this.form.isOutside,//省内、省外
name: this.form.name,//旅游路线名称
cover: this.form.cover,//封面图
price: this.form.price,//成人价
childPrice: this.form.childPrice,//儿童价
viewCount: this.form.viewCount,//商品浏览量
saleCount: this.form.saleCount,//商品销售量
describe: this.form.describe,//商品描述
content: this.form.content,//商品详情(行程亮点)
introduce: this.form.introduce,//行程介绍
explain: this.form.explain,//费用说明
rank: this.form.rank,//旅行排序
recommend: this.form.recommend,//是否推荐:0-未推荐;1-已推荐
isMember: this.form.isMember,//是否启用会员价
stock: this.form.stock,//库存
unit: this.form.unit,//单位
number: this.form.number,//活动天数
bannerDTOS: this.form.bannerDTOS,//banner轮播图
siteDTOS: siteDTOS,//出发地type=0,途径地type=1,目的地type=2
priceDTOS: this.form.tourDepartTimeVo,//活动日期
tagDTOS: tagDTOS,//旅游标签
posterBackground:this.form.posterBackground,//海报背景
};
console.log(params);
console.log(this.form);
goodsEdit(params).then(response => {
this.isCreate = false;
if (response.status === 200) {
this.$notify({
title: '成功',
message: '编辑成功',
type: 'success',
duration: 2000
}); });
this.$emit("oneTourDialogEvent", true); //destinationObj目的地
} else { let destinationObj = this.destinationObj;
this.$notify({ if(!destinationObj.name){
title: '编辑失败', this.$notify({
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!', title: '警告',
type: 'error', message: '请选择目的地',
duration: 2000 type: 'warning',
duration: 2000
});
return;
}
let provinceObj = destinationObj.province?getRegionByCodes([destinationObj.province]):[{name:""}];
let cityObj = destinationObj.city?getRegionByCodes([destinationObj.city]):[{name:""}];
let p = {
id: destinationObj.id,
name: destinationObj.name,
address: destinationObj.addrDetail?destinationObj.addrDetail: destinationObj.address,
province: destinationObj.addrProvince?destinationObj.addrProvince:destinationObj.province,
provinceName: provinceObj[0].name,
cityName: cityObj[0].name,
city: destinationObj.addrCity?destinationObj.addrCity: destinationObj.city,
longitude: destinationObj.longitude,
latitude: destinationObj.latitude,
type: 2
};
siteDTOS.push(p);
let params = {
id: this.form.id,
isOutside: this.form.isOutside,//省内、省外
name: this.form.name,//旅游路线名称
cover: this.form.cover,//封面图
price: this.form.price,//成人价
childPrice: this.form.childPrice,//儿童价
viewCount: this.form.viewCount,//商品浏览量
saleCount: this.form.saleCount,//商品销售量
describe: this.form.describe,//商品描述
content: this.form.content,//商品详情(行程亮点)
introduce: this.form.introduce,//行程介绍
explain: this.form.explain,//费用说明
rank: this.form.rank,//旅行排序
recommend: this.form.recommend,//是否推荐:0-未推荐;1-已推荐
isMember: this.form.isMember,//是否启用会员价
stock: this.form.stock,//库存
unit: this.form.unit,//单位
number: this.form.number,//活动天数
bannerDTOS: this.form.bannerDTOS,//banner轮播图
siteDTOS: siteDTOS,//出发地type=0,途径地type=1,目的地type=2
priceDTOS: this.form.tourDepartTimeVo,//活动日期
tagDTOS: tagDTOS,//旅游标签
posterBackground:this.form.posterBackground,//海报背景
};
console.log(params);
this.isCreate = true;
console.log(this.form);
goodsEdit(params).then(response => {
this.isCreate = false;
if (response.status === 200) {
this.$notify({
title: '成功',
message: '编辑成功',
type: 'success',
duration: 2000
});
this.$emit("oneTourDialogEvent", true);
} else {
this.$notify({
title: '编辑失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
}); });
} else {
return;
} }
}); });
}, },
......
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