Commit 197f1733 authored by libin's avatar libin

1:seo 字段添加 imgTitle,imgKeyword,imgDesc

2:营地联系电话约束规则修改
parent 1b08b369
...@@ -6,14 +6,16 @@ ...@@ -6,14 +6,16 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="营地名称" prop="name"> <el-form-item label="营地名称" prop="name">
<el-input v-model="form.name" placeholder="请输入营地名称" @blur="checkName()"></el-input><span v-if="isExist" style="color:red;">标签名已存在</span> <el-input v-model="form.name" placeholder="请输入营地名称" @blur="checkName()"></el-input>
<span v-if="isExist" style="color:red;">标签名已存在</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="营地地址" prop="addressStr"> <el-form-item label="营地地址" prop="addressStr">
<el-input v-model="form.addressStr" readonly placeholder="请输入营地地址" :on-icon-click="selectDestination" icon="edit"></el-input> <el-input v-model="form.addressStr" readonly placeholder="请输入营地地址" :on-icon-click="selectDestination"
icon="edit"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -39,14 +41,16 @@ ...@@ -39,14 +41,16 @@
</el-col> </el-col>
</el-row> </el-row>
<el-form-item label="营地类型" prop="approvers"> <el-form-item label="营地类型" prop="approvers">
<span v-for="item in form.campsiteTagListVos" <span v-for="item in form.campsiteTagListVos"
: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-button size="small" class="el-button el-button--primary" type="button" icon="edit" @click="editLable(form.campsiteTagListVos)">编辑</el-button> <el-button size="small" class="el-button el-button--primary" type="button" icon="edit"
@click="editLable(form.campsiteTagListVos)">编辑
</el-button>
</el-form-item> </el-form-item>
<el-row> <el-row>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="热度值"> <el-form-item label="热度值">
<el-input v-model="form.hot" placeholder="请输入热度值" type="number" min="0"></el-input> <el-input v-model="form.hot" placeholder="请输入热度值" type="number" min="0"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -60,14 +64,37 @@ ...@@ -60,14 +64,37 @@
:on-success="handleAvatarSuccess" :on-success="handleAvatarSuccess"
list-type="picture"> list-type="picture">
<div slot="tip" class="el-upload__tip"><span style="color: red;">建议尺寸:485*485px</span></div> <div slot="tip" class="el-upload__tip"><span style="color: red;">建议尺寸:485*485px</span></div>
<img v-if="$utils.isString(form.logo) && !$utils.isEmpty(form.logo)" :src="form.logo" style="width:300px;max-height:300px;"> <img v-if="$utils.isString(form.logo) && !$utils.isEmpty(form.logo)" :src="form.logo"
<i v-else class="el-icon-plus avatar-uploader-icon" style="lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"></i> style="width:300px;max-height:300px;">
<i v-else class="el-icon-plus avatar-uploader-icon"
style="lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"></i>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="alt"> <el-form-item label="alt">
<el-input v-model="form.alt" type="text" placeholder="请输入描述"></el-input> <el-input v-model="form.alt" type="text" placeholder="请输入替代文本"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="img-title">
<el-input v-model="form.imgTitle" type="text" placeholder="请输入图片title"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="img-keyword">
<el-input v-model="form.imgKeyword" type="text" placeholder="请输入图片关键字"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="img-desc">
<el-input v-model="form.imgDesc" type="text" placeholder="请输入图片描述"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -80,10 +107,13 @@ ...@@ -80,10 +107,13 @@
:on-success="handlePosterSuccess" :on-success="handlePosterSuccess"
:on-progress="uploadPosterProcess" :on-progress="uploadPosterProcess"
list-type="picture"> list-type="picture">
<div slot="tip" class="el-upload__tip"> <span style="color: red;">建议尺寸:485*485px</span></div> <div slot="tip" class="el-upload__tip"><span style="color: red;">建议尺寸:485*485px</span></div>
<el-progress v-show="imgPosterFlag == true" type="circle" :percentage="percent_poster" style="margin-top: 20px"></el-progress> <el-progress v-show="imgPosterFlag == true" type="circle" :percentage="percent_poster"
<img v-if="$utils.isString(form.posterBackground) && !$utils.isEmpty(form.posterBackground)&& !imgPosterFlag" :src="form.posterBackground" style="width:300px;max-height:300px;"> style="margin-top: 20px"></el-progress>
<i v-else-if="!imgPosterFlag" class="el-icon-plus avatar-uploader-icon" style="lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"></i> <img v-if="$utils.isString(form.posterBackground) && !$utils.isEmpty(form.posterBackground)&& !imgPosterFlag"
:src="form.posterBackground" style="width:300px;max-height:300px;">
<i v-else-if="!imgPosterFlag" class="el-icon-plus avatar-uploader-icon"
style="lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"></i>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="轮播图" :style="{display:'block'}" prop="carouse"> <el-form-item label="轮播图" :style="{display:'block'}" prop="carouse">
...@@ -95,7 +125,7 @@ ...@@ -95,7 +125,7 @@
:file-list="fileList2" :file-list="fileList2"
:on-success="handleBannerSuccess" :on-success="handleBannerSuccess"
list-type="picture"> list-type="picture">
<div slot="tip" class="el-upload__tip">最多上传5张 <span style="color: red;">建议尺寸:1080*644px</span></div> <div slot="tip" class="el-upload__tip">最多上传5张 <span style="color: red;">建议尺寸:1080*644px</span></div>
<el-button v-if="fileList2.length<5" size="small" type="primary">点击上传</el-button> <el-button v-if="fileList2.length<5" size="small" type="primary">点击上传</el-button>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
...@@ -103,13 +133,15 @@ ...@@ -103,13 +133,15 @@
<el-tab-pane label="营地详情" name="first"> <el-tab-pane label="营地详情" name="first">
<!--<Editor v-if="activeName2=='first'" @input="handelContentIncrease" :value="form.content" :myQuillEditor="'myQuillEditorContent'" :activeName2="activeName2"></Editor>--> <!--<Editor v-if="activeName2=='first'" @input="handelContentIncrease" :value="form.content" :myQuillEditor="'myQuillEditorContent'" :activeName2="activeName2"></Editor>-->
<div class="editor-container" v-if="activeName2=='first'"> <div class="editor-container" v-if="activeName2=='first'">
<UE :editorId="activeName2" :defaultMsg="form.content" :config=config ref="ue" @ready="editorReadyEvent"></UE> <UE :editorId="activeName2" :defaultMsg="form.content" :config=config ref="ue"
@ready="editorReadyEvent"></UE>
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="配套&收费" name="second"> <el-tab-pane label="配套&收费" name="second">
<!--<Editor v-if="activeName2=='second'" @input="handelIntroduceIncrease" :value="form.configure" :myQuillEditor="'myQuillEditorIntroduce'" :activeName2="activeName2"></Editor>--> <!--<Editor v-if="activeName2=='second'" @input="handelIntroduceIncrease" :value="form.configure" :myQuillEditor="'myQuillEditorIntroduce'" :activeName2="activeName2"></Editor>-->
<div class="editor-container" v-if="activeName2=='second'"> <div class="editor-container" v-if="activeName2=='second'">
<UE :editorId="activeName2" :defaultMsg="form.configure" :config=config ref="ue" @ready="editorReadyEvent"></UE> <UE :editorId="activeName2" :defaultMsg="form.configure" :config=config ref="ue"
@ready="editorReadyEvent"></UE>
</div> </div>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
...@@ -117,601 +149,627 @@ ...@@ -117,601 +149,627 @@
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="cancel">取 消</el-button> <el-button @click="cancel">取 消</el-button>
<el-button type="primary" v-if="title=='创建' && !isCreate && campsiteshop_btn_update" @click="create('form')">确 定</el-button> <el-button type="primary" v-if="title=='创建' && !isCreate && campsiteshop_btn_update" @click="create('form')">确 定
<el-button type="primary" v-if="title=='编辑' && !isCreate && campsiteshop_btn_update" @click="update('form')">确 定</el-button> </el-button>
<el-button type="primary" v-if="title=='编辑' && !isCreate && campsiteshop_btn_update" @click="update('form')">确 定
</el-button>
</div> </div>
<!--编辑营地地址--> <!--编辑营地地址-->
<campsiteModal v-if="showCampsiteVisible && campsiteshop_btn_update" :obj="campsiteObj" v-on:campsiteEvent = "campsiteEvent"></campsiteModal> <campsiteModal v-if="showCampsiteVisible && campsiteshop_btn_update" :obj="campsiteObj"
v-on:campsiteEvent="campsiteEvent"></campsiteModal>
<!--编辑营地标签--> <!--编辑营地标签-->
<campsiteLabelModal v-if="editLableVisible && campsiteshop_btn_update" :allLabelList="allLabelList" :checkList="checkList" v-on:tourLabelEvent = "tourLabelEvent"></campsiteLabelModal> <campsiteLabelModal v-if="editLableVisible && campsiteshop_btn_update" :allLabelList="allLabelList"
:checkList="checkList" v-on:tourLabelEvent="tourLabelEvent"></campsiteLabelModal>
</div> </div>
</template> </template>
<style> <style>
textarea{ textarea {
display: none; display: none;
} }
.info{
.info {
border-radius: 10px; border-radius: 10px;
line-height: 20px; line-height: 20px;
padding: 10px; padding: 10px;
margin: 10px; margin: 10px;
background-color: #ffffff; background-color: #ffffff;
} }
.el-upload-list{
.el-upload-list {
display: flex; display: flex;
width: 100px; width: 100px;
} }
.el-upload-list li{
.el-upload-list li {
margin-left: 10px; margin-left: 10px;
} }
</style> </style>
<script> <script>
// import Editor from "../../modal/editorTool";//富文本 // import Editor from "../../modal/editorTool";//富文本
import UE from '../../modal/Ueditor';//百度ue富文本 import UE from '../../modal/Ueditor';//百度ue富文本
import campsiteLabelModal from "../../tourManage/modal/tourLabelModal";//标签 import campsiteLabelModal from "../../tourManage/modal/tourLabelModal";//标签
import campsiteModal from "./campsiteModal";//营地地址 import campsiteModal from "./campsiteModal";//营地地址
import { import {
getOneCampsiteShop, getOneCampsiteShop,
campsiteAllTagList, campsiteAllTagList,
editCampsiteShop, editCampsiteShop,
addCampsiteShop, addCampsiteShop,
existCampsiteShop existCampsiteShop
} from 'api/campsiteManage'; } from 'api/campsiteManage';
import { import {
getSonRegionByCodes, getSonRegionByCodes,
getRegionByCodes, getRegionByCodes,
} from 'api/base_info/region/'; } from 'api/base_info/region/';
import rsCode from '../../../utils/rsCode'; import rsCode from '../../../utils/rsCode';
import { import {
getToken getToken
} from '../../../utils/auth'; } from '../../../utils/auth';
import {mapGetters} from 'vuex'; import {mapGetters} from 'vuex';
export default {
props: ["oneRow", "title", "campsiteshop_btn_update"], export default {
name: 'upkeepDialog', props: ["oneRow", "title", "campsiteshop_btn_update"],
components: { name: 'upkeepDialog',
UE, components: {
campsiteModal, UE,
campsiteLabelModal campsiteModal,
}, campsiteLabelModal
data() { },
var checkPhone = (rule, value, callback) => { data() {
if (!value) { var checkPhone = (rule, value, callback) => {
return callback(new Error('手机号不能为空')); if (!value) {
} else { return callback(new Error('手机号不能为空'));
const reg = /^[1](([3][0-9])|([4][5,7,9])|([5][0-9])|([6][6])|([7][1,2,3,5,6,7,8])|([8][0-9])|([9][1,8,9]))[0-9]{8}$/ } else {
console.log(reg.test(value)); const reg = /^[1](([3][0-9])|([4][5,7,9])|([5][0-9])|([6][6])|([7][1,2,3,5,6,7,8])|([8][0-9])|([9][1,8,9]))[0-9]{8}$/
if (reg.test(value)) { console.log(reg.test(value));
callback(); if (reg.test(value)) {
} else { callback();
return callback(new Error('请输入正确的手机号')); } else {
} return callback(new Error('请输入正确的手机号'));
} }
}; }
return { };
imgPosterFlag:false, return {
percent_poster:0, imgPosterFlag: false,
BASE_API: process.env.BASE_API, percent_poster: 0,
defaultMsg: '这里是UE测试', BASE_API: process.env.BASE_API,
config: { defaultMsg: '这里是UE测试',
initialFrameWidth: null, config: {
initialFrameHeight: 350 initialFrameWidth: null,
initialFrameHeight: 350
},
isExist: false,//名称是否已存在
campsiteObj: {},//营地地址
departureList: [],//出发地列表
departureObj: {name: ""},//出发地
pathway: [],//途径地
isCreate: false,//是否点击了创建-确定
fileList2: [],
activeName2: '',//行程亮点
form: {
alt: '',
imgTitle: undefined,
imgKeyword: undefined,
imgDesc: undefined,
id: undefined,
name: undefined,//营地名称
hot: 0,//营地热度
servicePhone: "",//客服电话
phone: "",//联系电话
province: undefined,//省份
provinceName: undefined,//省份名称
city: undefined,//市编号
cityName: undefined,//市名称
address: undefined,//详细地址
latitude: undefined,
longitude: undefined,
content: '',//营地详情
concat: "",//联系人
logo: undefined,//封面图
configure: '',//配套&收费
campsiteTagListVos: [],//营地类型
carouse: [],//banner轮播
posterBackground: '',//海报背景
},
showCampsiteVisible: false,//编辑营地地址
rules: {
name: {
type: 'string',
required: true,
message: '请输入营地名称',
trigger: 'blur'
},
servicePhone: {
type: 'string',
required: true,
message: '请输入客服电话',
trigger: 'blur'
},
phone: {
//validator: checkPhone,
type:'string',
trigger: 'blur',
message: '请输入联系电话',
required: true
},
concat: {
type: 'string',
required: true,
message: '请输入联系人',
trigger: 'blur'
},
addressStr: {
type: 'string',
required: true,
message: '请输入营地地址',
}
},
checkList: [],//已选中的标签
allCompanies: {},
allCompaniesArr: [],
oneTourDialogVisible: false,
editLableVisible: false,//营地标签
allLabelList: [],//全部营地标签
}
}, },
isExist:false,//名称是否已存在 created() {
campsiteObj: {},//营地地址 this.getAllLabelList();
departureList: [],//出发地列表
departureObj:{name: ""},//出发地
pathway: [],//途径地
isCreate: false,//是否点击了创建-确定
fileList2:[],
activeName2: '',//行程亮点
form: {
alt:'',
id: undefined,
name: undefined,//营地名称
hot: 0,//营地热度
servicePhone: "",//客服电话
phone: "",//联系电话
province: undefined,//省份
provinceName: undefined,//省份名称
city: undefined,//市编号
cityName: undefined,//市名称
address: undefined,//详细地址
latitude: undefined,
longitude: undefined,
content: '',//营地详情
concat: "",//联系人
logo:undefined,//封面图
configure: '',//配套&收费
campsiteTagListVos: [],//营地类型
carouse:[],//banner轮播
posterBackground:'',//海报背景
}, },
showCampsiteVisible: false,//编辑营地地址 watch: {
rules: { oneTourDialogVisible(newValue, oldValue) {
name:{ if (!newValue) {
type: 'string', this.cleanForm();
required: true, }
message: '请输入营地名称',
trigger: 'blur'
}, },
servicePhone:{
type: 'string',
required: true,
message: '请输入客服电话',
trigger: 'blur'
},
phone:{validator: checkPhone, trigger: 'blur',required: true},
concat:{
type: 'string',
required: true,
message: '请输入联系人',
trigger: 'blur'
},
addressStr:{
type: 'string',
required: true,
message: '请输入营地地址',
}
}, },
checkList:[],//已选中的标签 mounted() {
allCompanies: {}, this.cleanForm();
allCompaniesArr: [], if (this.title == "编辑") {
oneTourDialogVisible: false, let row = this.oneRow;
editLableVisible: false,//营地标签 this.getOne(row.id);
allLabelList: [],//全部营地标签 } else {
} this.activeName2 = "first";
}, }
created() { this.oneTourDialogVisible = true;
this.getAllLabelList(); },
}, computed: {
watch: { getHeaderWithToken() {
oneTourDialogVisible(newValue, oldValue){ return {Authorization: getToken()};
if(!newValue){ },
this.cleanForm(); },
} methods: {
},
},
mounted() {
this.cleanForm();
if(this.title == "编辑"){
let row = this.oneRow;
this.getOne(row.id);
} else {
this.activeName2 = "first";
}
this.oneTourDialogVisible = true;
},
computed: {
getHeaderWithToken() {
return {Authorization: getToken()};
},
},
methods: {
/**
* 判断标签名是否已存在
* */
checkName(){
this.form.name = (this.form.name).trim();
if(!this.form.name){
return;
}
let params = {
name: this.form.name
};
if(this.title == "编辑"){
params.id = this.form.id;
}
existCampsiteShop(params).then(response => {
if (response.status === 200) {
this.isExist = response.data;
} else {
this.$notify({
title: '失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
},
handleClick(tab, event) {
console.log(tab, event);
},
/**
* 编辑营地标签
* */
editLable(list){
console.log(list);
this.editLableVisible = true;
},
/**
* 创建
* */
create(formName){
const set = this.$refs;
set[formName].validate(valid => {
if (valid) {
let carouse = [];//营地轮播图
this.form.carouse.map(function (item) {
let c = {
id: item.id,
imgUrl: item.imgUrl
};
carouse.push(c);
});
/** /**
* 营地类别 * 判断标签名是否已存在
* */ * */
let campsiteTagDTOS = []; checkName() {
this.form.campsiteTagListVos.map(function (item) { this.form.name = (this.form.name).trim();
campsiteTagDTOS.push(item.id); if (!this.form.name) {
}); return;
let params = { }
name: this.form.name,//营地名称 let params = {
logo: this.form.logo,//封面图 name: this.form.name
content: this.form.content,//营地详情 };
configure: this.form.configure,//配套&收费 if (this.title == "编辑") {
hot: this.form.hot,//营地热度 params.id = this.form.id;
campsiteTagDTOS: campsiteTagDTOS,//营地类别 }
carouselDTOS: carouse,//轮播图 existCampsiteShop(params).then(response => {
concat: this.form.concat,//联系人 if (response.status === 200) {
servicePhone: this.form.servicePhone,//客服电话 this.isExist = response.data;
phone: this.form.phone,//联系电话 } else {
province: this.campsiteObj.province,//省份 this.$notify({
provinceName: this.campsiteObj.provinceName,//省份名称 title: '失败',
city: this.campsiteObj.city,//市编号 message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
cityName: this.campsiteObj.cityName,//市名称 type: 'error',
address: this.campsiteObj.address,//详细地址 duration: 2000
latitude: this.campsiteObj.latitude, });
longitude: this.campsiteObj.longitude, }
posterBackground:this.form.posterBackground,//海报背景 });
alt:this.form.alt },
}; handleClick(tab, event) {
console.log(params); console.log(tab, event);
this.isExistCampsiteShop("create", params); },
} else {
return;
}
});
},
/**
* 判断营地名称是否已存在
* */
isExistCampsiteShop(type, datas){
if(!this.form.name){
return;
}
let params = {
name: this.form.name
};
if(type == 'update'){//编辑
params.id = this.form.id;
}
existCampsiteShop(params).then(response => {
if (response.status === 200) {
this.isExist = response.data;
if(response.data){
this.isCreate = false;
}
if(!response.data && type == "update"){//编辑
this.toUpdate(datas);
}
if(!response.data && type == "create"){
//创建
this.toCreate(datas);
}
} else {
this.$notify({
title: '失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
},
/**
* 编辑
* */
update(formName){
const set = this.$refs;
set[formName].validate(valid => {
if (valid) {
this.isCreate = true;
let carouse = [];//营地轮播图
this.form.carouse.map(function (item) {
let c = {
id: item.id,
imgUrl: item.imgUrl
};
carouse.push(c);
});
/** /**
* 营地类别 * 编辑营地标签
* */ * */
let campsiteTagDTOS = []; editLable(list) {
this.form.campsiteTagListVos.map(function (item) { console.log(list);
campsiteTagDTOS.push(item.id); this.editLableVisible = true;
}); },
let params = { /**
id: this.form.id, * 创建
name: this.form.name,//营地名称 * */
logo: this.form.logo,//封面图 create(formName) {
content: this.form.content,//营地详情 const set = this.$refs;
configure: this.form.configure,//配套&收费 set[formName].validate(valid => {
hot: this.form.hot,//营地热度 if (valid) {
campsiteTagDTOS: campsiteTagDTOS,//营地类别 let carouse = [];//营地轮播图
carouselDTOS: carouse,//轮播图 this.form.carouse.map(function (item) {
concat: this.form.concat,//联系人 let c = {
servicePhone: this.form.servicePhone,//客服电话 id: item.id,
phone: this.form.phone,//联系电话 imgUrl: item.imgUrl
province: this.campsiteObj.province,//省份 };
provinceName: this.campsiteObj.provinceName,//省份名称 carouse.push(c);
city: this.campsiteObj.city,//市编号 });
cityName: this.campsiteObj.cityName,//市名称 /**
address: this.campsiteObj.address,//详细地址 * 营地类别
latitude: this.campsiteObj.latitude, * */
longitude: this.campsiteObj.longitude, let campsiteTagDTOS = [];
posterBackground:this.form.posterBackground,//海报背景 this.form.campsiteTagListVos.map(function (item) {
alt:this.form.alt, campsiteTagDTOS.push(item.id);
}; });
console.log(params); let params = {
this.isExistCampsiteShop("update", params); name: this.form.name,//营地名称
} else { logo: this.form.logo,//封面图
return; content: this.form.content,//营地详情
} configure: this.form.configure,//配套&收费
}); hot: this.form.hot,//营地热度
}, campsiteTagDTOS: campsiteTagDTOS,//营地类别
/** carouselDTOS: carouse,//轮播图
* 更新 concat: this.form.concat,//联系人
* */ servicePhone: this.form.servicePhone,//客服电话
toUpdate(params){ phone: this.form.phone,//联系电话
editCampsiteShop(params).then(response => { province: this.campsiteObj.province,//省份
if (response.status === 200) { provinceName: this.campsiteObj.provinceName,//省份名称
this.$notify({ city: this.campsiteObj.city,//市编号
title: '成功', cityName: this.campsiteObj.cityName,//市名称
message: '编辑成功', address: this.campsiteObj.address,//详细地址
type: 'success', latitude: this.campsiteObj.latitude,
duration: 2000 longitude: this.campsiteObj.longitude,
}); posterBackground: this.form.posterBackground,//海报背景
this.$emit("oneCampsiteDialogEvent", true); alt: this.form.alt,
} else { imgTitle: this.form.imgTitle,
this.$notify({ imgKeyword: this.form.imgKeyword,
title: '编辑失败', imgDesc: this.form.imgDesc
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!', };
type: 'error', console.log(params);
duration: 2000 this.isExistCampsiteShop("create", params);
}); } else {
} return;
}); }
}, });
/** },
* 创建 /**
* */ * 判断营地名称是否已存在
toCreate(params){ * */
editCampsiteShop(params).then(response => { isExistCampsiteShop(type, datas) {
if (response.status === 200) { if (!this.form.name) {
this.$notify({ return;
title: '成功', }
message: '创建成功', let params = {
type: 'success', name: this.form.name
duration: 2000 };
}); if (type == 'update') {//编辑
this.$emit("oneCampsiteDialogEvent", true); params.id = this.form.id;
} else { }
this.$notify({ existCampsiteShop(params).then(response => {
title: '创建失败', if (response.status === 200) {
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!', this.isExist = response.data;
type: 'error', if (response.data) {
duration: 2000 this.isCreate = false;
}); }
} if (!response.data && type == "update") {//编辑
}); this.toUpdate(datas);
}, }
/** if (!response.data && type == "create") {
* 获取全部营地类型 //创建
* */ this.toCreate(datas);
getAllLabelList() { }
campsiteAllTagList().then(response => { } else {
this.allLabelList = response; this.$notify({
}); title: '失败',
}, message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
},
/**
* 编辑
* */
update(formName) {
const set = this.$refs;
set[formName].validate(valid => {
if (valid) {
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);
});
let params = {
id: this.form.id,
name: this.form.name,//营地名称
logo: this.form.logo,//封面图
content: this.form.content,//营地详情
configure: this.form.configure,//配套&收费
hot: this.form.hot,//营地热度
campsiteTagDTOS: campsiteTagDTOS,//营地类别
carouselDTOS: carouse,//轮播图
concat: this.form.concat,//联系人
servicePhone: this.form.servicePhone,//客服电话
phone: this.form.phone,//联系电话
province: this.campsiteObj.province,//省份
provinceName: this.campsiteObj.provinceName,//省份名称
city: this.campsiteObj.city,//市编号
cityName: this.campsiteObj.cityName,//市名称
address: this.campsiteObj.address,//详细地址
latitude: this.campsiteObj.latitude,
longitude: this.campsiteObj.longitude,
posterBackground: this.form.posterBackground,//海报背景
alt: this.form.alt,
imgTitle: this.form.imgTitle,
imgKeyword: this.form.imgKeyword,
imgDesc: this.form.imgDesc
};
console.log(params);
this.isExistCampsiteShop("update", params);
} else {
return;
}
});
},
/**
* 更新
* */
toUpdate(params) {
editCampsiteShop(params).then(response => {
if (response.status === 200) {
this.$notify({
title: '成功',
message: '编辑成功',
type: 'success',
duration: 2000
});
this.$emit("oneCampsiteDialogEvent", true);
} else {
this.$notify({
title: '编辑失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
},
/**
* 创建
* */
toCreate(params) {
editCampsiteShop(params).then(response => {
if (response.status === 200) {
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
});
this.$emit("oneCampsiteDialogEvent", true);
} else {
this.$notify({
title: '创建失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
},
/**
* 获取全部营地类型
* */
getAllLabelList() {
campsiteAllTagList().then(response => {
this.allLabelList = response;
});
},
/** /**
* 关闭营地地址弹框 * 关闭营地地址弹框
* */ * */
campsiteEvent(obj){ campsiteEvent(obj) {
this.showCampsiteVisible = false; this.showCampsiteVisible = false;
if(obj){ if (obj) {
this.campsiteObj = obj; this.campsiteObj = obj;
let provinceObj = getRegionByCodes([obj.province]); let provinceObj = getRegionByCodes([obj.province]);
let cityObj = getRegionByCodes([obj.city]); let cityObj = getRegionByCodes([obj.city]);
this.campsiteObj.provinceName = provinceObj[0].name; this.campsiteObj.provinceName = provinceObj[0].name;
this.campsiteObj.cityName = cityObj[0].name; this.campsiteObj.cityName = cityObj[0].name;
this.form.addressStr = this.campsiteObj.provinceName + this.campsiteObj.cityName + this.campsiteObj.address; this.form.addressStr = this.campsiteObj.provinceName + this.campsiteObj.cityName + this.campsiteObj.address;
console.log(this.campsiteObj); console.log(this.campsiteObj);
} }
}, },
/** /**
* 编辑营地地址 * 编辑营地地址
* */ * */
selectDestination(){ selectDestination() {
let that = this; let that = this;
this.campsiteObj.showTitle = "营地地址编辑"; this.campsiteObj.showTitle = "营地地址编辑";
this.campsiteObj.eventName ='campsiteEvent'; this.campsiteObj.eventName = 'campsiteEvent';
this.campsiteObj.keyword = this.campsiteObj.address; this.campsiteObj.keyword = this.campsiteObj.address;
this.showCampsiteVisible = true; this.showCampsiteVisible = true;
}, },
/** /**
* 关闭营地标签弹框 * 关闭营地标签弹框
* */ * */
tourLabelEvent(obj){ tourLabelEvent(obj) {
let that = this; let that = this;
this.editLableVisible = false; this.editLableVisible = false;
let arr = []; let arr = [];
let ckeckList = []; let ckeckList = [];
if(obj){ if (obj) {
this.allLabelList.map(function(item){ this.allLabelList.map(function (item) {
obj.map(function(b){ obj.map(function (b) {
if(item.name == b){ if (item.name == b) {
arr.push(item); arr.push(item);
ckeckList.push(b); ckeckList.push(b);
} }
}); });
}); });
this.form.campsiteTagListVos = arr; this.form.campsiteTagListVos = arr;
this.checkList = ckeckList; this.checkList = ckeckList;
console.log(obj); console.log(obj);
} }
}, },
/** /**
* 获取一条营地 * 获取一条营地
* */ * */
getOne(id){ getOne(id) {
let that = this; let that = this;
getOneCampsiteShop(id).then(response => { getOneCampsiteShop(id).then(response => {
this.form = response.data; this.form = response.data;
this.campsiteObj = { this.campsiteObj = {
address: response.data.address, address: response.data.address,
province: response.data.province, province: response.data.province,
provinceName: response.data.provinceName, provinceName: response.data.provinceName,
city: response.data.city, city: response.data.city,
cityName: response.data.cityName, cityName: response.data.cityName,
latitude: response.data.latitude, latitude: response.data.latitude,
longitude: response.data.longitude, longitude: response.data.longitude,
}; };
response.data.addressStr = this.campsiteObj.provinceName + this.campsiteObj.cityName + this.campsiteObj.address; response.data.addressStr = this.campsiteObj.provinceName + this.campsiteObj.cityName + this.campsiteObj.address;
let arr = []; let arr = [];
that.allLabelList.map(function(b){ that.allLabelList.map(function (b) {
response.data.campsiteTagListVos.map(function(item){ response.data.campsiteTagListVos.map(function (item) {
if(item.id == b.id){ if (item.id == b.id) {
arr.push(item.name); arr.push(item.name);
} }
}); });
}); });
this.checkList = arr; this.checkList = arr;
//轮播 //轮播
let fileList2 = []; let fileList2 = [];
response.data.carouse.map(function (p) { response.data.carouse.map(function (p) {
let pp = { let pp = {
id: p.id, id: p.id,
url: p.imgUrl url: p.imgUrl
}; };
fileList2.push(pp); fileList2.push(pp);
}); });
this.fileList2 = fileList2; this.fileList2 = fileList2;
this.activeName2 = "first"; this.activeName2 = "first";
}) })
}, },
/** /**
* 旅游-弹框-取消 * 旅游-弹框-取消
* */ * */
cancel() { cancel() {
this.cleanForm(); this.cleanForm();
this.$emit("oneCampsiteDialogEvent", false); this.$emit("oneCampsiteDialogEvent", false);
}, },
/** /**
* 配套&收费 富文本 * 配套&收费 富文本
* */ * */
handelIntroduceIncrease(step){ handelIntroduceIncrease(step) {
this.form.configure = step; this.form.configure = step;
}, },
/** /**
* 富文本 营地详情 * 富文本 营地详情
* */ * */
editorReadyEvent(instance){ editorReadyEvent(instance) {
let t = this; let t = this;
instance.addListener('contentChange', () => { instance.addListener('contentChange', () => {
if(t.activeName2 == "first"){ if (t.activeName2 == "first") {
t.form.content = instance.getContent(); t.form.content = instance.getContent();
} else if(t.activeName2 == "second"){ } else if (t.activeName2 == "second") {
t.form.configure = instance.getContent(); t.form.configure = instance.getContent();
} }
}); });
}, },
/** /**
* 删除banner * 删除banner
* */ * */
handleRemove(file, fileList){ handleRemove(file, fileList) {
let list = []; let list = [];
fileList.map(function(item){ fileList.map(function (item) {
if(item.url != file.url){ if (item.url != file.url) {
list.push(item); list.push(item);
} }
}); });
this.fileList2 = list; this.fileList2 = list;
let arr = []; let arr = [];
this.form.carouse.map(function(item){ this.form.carouse.map(function (item) {
if(item.imgUrl != file.url){ if (item.imgUrl != file.url) {
arr.push(item); arr.push(item);
} }
}); });
this.form.carouse = arr; this.form.carouse = arr;
}, },
/** /**
* 封面图上传 * 封面图上传
* **/ * **/
handleAvatarSuccess(res, file){ handleAvatarSuccess(res, file) {
this.form.logo = res.data; this.form.logo = res.data;
}, },
/** /**
* banner上传 * banner上传
* */ * */
handleBannerSuccess(res, file){ handleBannerSuccess(res, file) {
this.fileList2.push({url:res.data}); this.fileList2.push({url: res.data});
this.form.carouse.push({imgUrl:res.data}); this.form.carouse.push({imgUrl: res.data});
}, },
/** /**
* 海报背景上传 * 海报背景上传
* **/ * **/
handlePosterSuccess(res, file){ handlePosterSuccess(res, file) {
this.percent_poster = 0; this.percent_poster = 0;
this.imgPosterFlag = false; this.imgPosterFlag = false;
this.form.posterBackground = res.data; this.form.posterBackground = res.data;
}, },
/** /**
* 海报背景图上传进度 * 海报背景图上传进度
* */ * */
uploadPosterProcess(event, file, fileList) { uploadPosterProcess(event, file, fileList) {
this.imgPosterFlag = true; this.imgPosterFlag = true;
console.log(event.percent); console.log(event.percent);
this.percent_poster = Math.floor(event.percent); this.percent_poster = Math.floor(event.percent);
}, },
/** /**
* 清空旅游弹框数据 * 清空旅游弹框数据
*/ */
cleanForm() { cleanForm() {
this.campsiteObj ={name: ""};//营地地址 this.campsiteObj = {name: ""};//营地地址
this.fileList2=[]; this.fileList2 = [];
this.activeName2= '';//营地详情 this.activeName2 = '';//营地详情
this.form = { this.form = {
id: undefined, id: undefined,
name: undefined,//营地名称 name: undefined,//营地名称
hot: 0,//营地热度 hot: 0,//营地热度
servicePhone: "",//客服电话 servicePhone: "",//客服电话
phone: "",//联系电话 phone: "",//联系电话
province: undefined,//省份 province: undefined,//省份
provinceName: undefined,//省份名称 provinceName: undefined,//省份名称
city: undefined,//市编号 city: undefined,//市编号
cityName: undefined,//市名称 cityName: undefined,//市名称
address: undefined,//详细地址 address: undefined,//详细地址
latitude: undefined, latitude: undefined,
longitude: undefined, longitude: undefined,
content: '',//营地详情 content: '',//营地详情
concat: "",//联系人 concat: "",//联系人
logo:undefined,//封面图 logo: undefined,//封面图
configure: '',//配套&收费 configure: '',//配套&收费
campsiteTagListVos: [],//营地类型 campsiteTagListVos: [],//营地类型
carouse:[],//banner轮播 carouse: [],//banner轮播
posterBackground:'', posterBackground: '',
alt:'', alt: '',
}; imgTitle:undefined,
this.showCampsiteVisible= false;//编辑营地地址 imgKeyword:undefined,
} imgDesc:undefined
};
this.showCampsiteVisible = false;//编辑营地地址
}
}
} }
}
</script> </script>
...@@ -31,16 +31,16 @@ ...@@ -31,16 +31,16 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="是否为推荐"> <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="会员价格"> <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=""> <el-form-item label="">
...@@ -50,75 +50,88 @@ ...@@ -50,75 +50,88 @@
<el-row> <el-row>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="库存" prop="stock"> <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="出发地"> <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"
:key="item.id" readonly placeholder="请输入内容"></el-input> v-for="item in departureList"
<el-button size="small" class="el-button el-button--primary" type="button" icon="edit" @click="editDeparture(departureList)">编辑</el-button> :key="item.id" readonly placeholder="请输入内容"></el-input>
<!--<el-autocomplete--> <el-button size="small" class="el-button el-button--primary" type="button" icon="edit"
<!--v-for="item in departureList"--> @click="editDeparture(departureList)">编辑
<!--:key="item.id"--> </el-button>
<!--class="inline-input"--> <!--<el-autocomplete-->
<!--style="margin-left: 10px;"--> <!--v-for="item in departureList"-->
<!--v-model="item.name"--> <!--:key="item.id"-->
<!--:fetch-suggestions="querySearch"--> <!--class="inline-input"-->
<!--placeholder="请输入内容"--> <!--style="margin-left: 10px;"-->
<!--@select="handleSelect"--> <!--v-model="item.name"-->
<!--&gt;</el-autocomplete>--> <!--:fetch-suggestions="querySearch"-->
</el-form-item> <!--placeholder="请输入内容"-->
<!--@select="handleSelect"-->
<!--&gt;</el-autocomplete>-->
</el-form-item>
<!--</el-col>--> <!--</el-col>-->
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="目的地"> <el-form-item label="目的地">
<el-input v-model="destinationObj.address" readonly placeholder="请选择目的地" :on-icon-click="selectDestination" icon="edit"></el-input> <el-input v-model="destinationObj.address" readonly placeholder="请选择目的地" :on-icon-click="selectDestination"
icon="edit"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<!--<el-col :span="6">--> <!--<el-col :span="6">-->
<el-form-item label="途径地"> <el-form-item label="途径地">
<!--<el-input v-for="item in pathway" style="display: inline-block;margin-right: 10px;width: 240px;"--> <!--<el-input v-for="item in pathway" style="display: inline-block;margin-right: 10px;width: 240px;"-->
<!--:key="item.id" v-model="item.name" readonly placeholder="请选择途径地" :data-rowId="item.id" :on-icon-click="selectPathway" icon="edit"></el-input>--> <!--:key="item.id" v-model="item.name" readonly placeholder="请选择途径地" :data-rowId="item.id" :on-icon-click="selectPathway" icon="edit"></el-input>-->
<el-button v-for="item in pathway" <el-button v-for="item in pathway"
:key="item.id" size="small" class="el-button el-button--primary" type="button" @click="editPathway(item)">{{item.name}}<i class="el-icon-edit el-icon--right"></i></el-button> :key="item.id" size="small" class="el-button el-button--primary" type="button"
<el-button size="small" class="el-button el-button--primary" type="button" icon="plus" @click="addPathway()">添加</el-button> @click="editPathway(item)">{{item.name}}<i class="el-icon-edit el-icon--right"></i></el-button>
</el-form-item> <el-button size="small" class="el-button el-button--primary" type="button" icon="plus" @click="addPathway()">
添加
</el-button>
</el-form-item>
<!--</el-col>--> <!--</el-col>-->
</el-row> </el-row>
<el-row> <el-row>
<el-form-item prop="operator" label="活动日期"> <el-form-item prop="operator" label="活动日期">
<!--tourDepartTimeVo--> <!--tourDepartTimeVo-->
<el-button v-for="item in form.tourDepartTimeVo" disabled <el-button v-for="item in form.tourDepartTimeVo" disabled
:key="item.id" class="el-button el-button--default" type="button">{{item.startTime}}~{{item.endTime}}</el-button> :key="item.id" class="el-button el-button--default" type="button">
{{item.startTime}}~{{item.endTime}}
</el-button>
<el-button size="small" class="el-button el-button--primary" type="button" icon="edit" @click="editTime()">编辑</el-button> <el-button size="small" class="el-button el-button--primary" type="button" icon="edit" @click="editTime()">
<!--<el-input v-model="form.operator" placeholder="请选择活动日期"></el-input>--> 编辑
</el-form-item> </el-button>
<!--<el-input v-model="form.operator" placeholder="请选择活动日期"></el-input>-->
</el-form-item>
</el-row> </el-row>
<el-form-item label="旅行标签"> <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">-->
<!--<el-checkbox v-for="item in allLabelList"--> <!--<el-checkbox v-for="item in allLabelList"-->
<!--:key="item.id" :label="item.name"></el-checkbox>--> <!--:key="item.id" :label="item.name"></el-checkbox>-->
<!--</el-checkbox-group>--> <!--</el-checkbox-group>-->
<el-button size="small" class="el-button el-button--primary" type="button" icon="edit" @click="editLable(form.tagDTOS)">编辑</el-button> <el-button size="small" class="el-button el-button--primary" type="button" icon="edit"
@click="editLable(form.tagDTOS)">编辑
</el-button>
</el-form-item> </el-form-item>
<el-row> <el-row>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="浏览量"> <el-form-item label="浏览量">
<el-input v-model="form.viewCount" placeholder="请输入浏览量" type="number" min="0"></el-input> <el-input v-model="form.viewCount" placeholder="请输入浏览量" type="number" min="0"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="排序"> <el-form-item label="排序">
<el-input v-model="form.rank" placeholder="请输入排序值" type="number" min="0"></el-input> <el-input v-model="form.rank" placeholder="请输入排序值" type="number" min="0"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
...@@ -142,16 +155,40 @@ ...@@ -142,16 +155,40 @@
:on-success="handleAvatarSuccess" :on-success="handleAvatarSuccess"
:on-progress="uploadProcess" :on-progress="uploadProcess"
list-type="picture"> list-type="picture">
<div slot="tip" class="el-upload__tip"> <span style="color: red;">建议尺寸:320*228px</span></div> <div slot="tip" class="el-upload__tip"><span style="color: red;">建议尺寸:320*228px</span></div>
<el-progress v-show="imgFlag == true" type="circle" :percentage="percent" style="margin-top: 20px"></el-progress> <el-progress v-show="imgFlag == true" type="circle" :percentage="percent"
<img v-if="$utils.isString(form.cover) && !$utils.isEmpty(form.cover) && !imgFlag" :src="form.cover" style="width:300px;max-height:300px;"> style="margin-top: 20px"></el-progress>
<i v-else-if="!imgFlag" class="el-icon-plus avatar-uploader-icon" style="lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"></i> <img v-if="$utils.isString(form.cover) && !$utils.isEmpty(form.cover) && !imgFlag" :src="form.cover"
style="width:300px;max-height:300px;">
<i v-else-if="!imgFlag" class="el-icon-plus avatar-uploader-icon"
style="lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"></i>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="alt"> <el-form-item label="alt">
<el-input v-model="form.alt" type="text" placeholder="请输入描述"></el-input> <el-input v-model="form.alt" type="text" placeholder="请输入替代文本"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="img-title">
<el-input v-model="form.imgTitle" type="text" placeholder="请输入图片title"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="img-keyword">
<el-input v-model="form.imgKeyword" type="text" placeholder="请输入图片关键字"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="img-desc">
<el-input v-model="form.imgDesc" type="text" placeholder="请输入图片描述"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -164,10 +201,13 @@ ...@@ -164,10 +201,13 @@
:on-success="handlePosterSuccess" :on-success="handlePosterSuccess"
:on-progress="uploadPosterProcess" :on-progress="uploadPosterProcess"
list-type="picture"> list-type="picture">
<div slot="tip" class="el-upload__tip"> <span style="color: red;">建议尺寸:320*228px</span></div> <div slot="tip" class="el-upload__tip"><span style="color: red;">建议尺寸:320*228px</span></div>
<el-progress v-show="imgPosterFlag == true" type="circle" :percentage="percent_poster" style="margin-top: 20px"></el-progress> <el-progress v-show="imgPosterFlag == true" type="circle" :percentage="percent_poster"
<img v-if="$utils.isString(form.posterBackground) && !$utils.isEmpty(form.posterBackground)&& !imgPosterFlag" :src="form.posterBackground" style="width:300px;max-height:300px;"> style="margin-top: 20px"></el-progress>
<i v-else-if="!imgPosterFlag" class="el-icon-plus avatar-uploader-icon" style="lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"></i> <img v-if="$utils.isString(form.posterBackground) && !$utils.isEmpty(form.posterBackground)&& !imgPosterFlag"
:src="form.posterBackground" style="width:300px;max-height:300px;">
<i v-else-if="!imgPosterFlag" class="el-icon-plus avatar-uploader-icon"
style="lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"></i>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="轮播图" :style="{display:'block'}"> <el-form-item label="轮播图" :style="{display:'block'}">
...@@ -186,21 +226,24 @@ ...@@ -186,21 +226,24 @@
<el-tabs v-model="activeName2" type="card" @tab-click="handleClick"> <el-tabs v-model="activeName2" type="card" @tab-click="handleClick">
<el-tab-pane label="行程亮点" name="first"> <el-tab-pane label="行程亮点" name="first">
<div class="editor-container" v-if="activeName2=='first'"> <div class="editor-container" v-if="activeName2=='first'">
<UE :editorId="activeName2" :defaultMsg="form.content" :config=config ref="ue" @ready="editorReadyEvent"></UE> <UE :editorId="activeName2" :defaultMsg="form.content" :config=config ref="ue"
@ready="editorReadyEvent"></UE>
</div> </div>
<!--<Editor v-if="activeName2=='first'" @input="handelContentIncrease" :value="form.content" :myQuillEditor="'myQuillEditorContent'" :activeName2="activeName2"></Editor>--> <!--<Editor v-if="activeName2=='first'" @input="handelContentIncrease" :value="form.content" :myQuillEditor="'myQuillEditorContent'" :activeName2="activeName2"></Editor>-->
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="行程介绍" name="second"> <el-tab-pane label="行程介绍" name="second">
<div class="editor-container" v-if="activeName2=='second'"> <div class="editor-container" v-if="activeName2=='second'">
<UE :editorId="activeName2" :defaultMsg="form.introduce" :config=config ref="ue" @ready="editorReadyEvent"></UE> <UE :editorId="activeName2" :defaultMsg="form.introduce" :config=config ref="ue"
@ready="editorReadyEvent"></UE>
</div> </div>
<!--<Editor v-if="activeName2=='second'" @input="handelIntroduceIncrease" :value="form.introduce" :myQuillEditor="'myQuillEditorIntroduce'" :activeName2="activeName2"></Editor>--> <!--<Editor v-if="activeName2=='second'" @input="handelIntroduceIncrease" :value="form.introduce" :myQuillEditor="'myQuillEditorIntroduce'" :activeName2="activeName2"></Editor>-->
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="费用说明" name="third"> <el-tab-pane label="费用说明" name="third">
<div class="editor-container" v-if="activeName2=='third'"> <div class="editor-container" v-if="activeName2=='third'">
<UE :editorId="activeName2" :defaultMsg="form.explain" :config=config ref="ue" @ready="editorReadyEvent"></UE> <UE :editorId="activeName2" :defaultMsg="form.explain" :config=config ref="ue"
@ready="editorReadyEvent"></UE>
</div> </div>
<!--<Editor v-if="activeName2=='third'" @input="handelExplainIncrease" :value="form.explain" :myQuillEditor="'myQuillEditorExplain'" :activeName2="activeName2"></Editor>--> <!--<Editor v-if="activeName2=='third'" @input="handelExplainIncrease" :value="form.explain" :myQuillEditor="'myQuillEditorExplain'" :activeName2="activeName2"></Editor>-->
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</el-form> </el-form>
...@@ -210,758 +253,774 @@ ...@@ -210,758 +253,774 @@
<el-button type="primary" v-if="title=='编辑' && !isCreate&&good_btn_update" @click="update('form')">确 定</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>
<!--编辑目的地--> <!--编辑目的地-->
<destination v-if="showDestinationVisible" :obj="destinationObj" v-on:destinationEvent = "destinationEvent"></destination> <destination v-if="showDestinationVisible" :obj="destinationObj"
v-on:destinationEvent="destinationEvent"></destination>
<!--编辑途径地--> <!--编辑途径地-->
<destination v-if="showPathWayVisible" :obj="onePathObj" v-on:pathWayEvent = "pathWayEvent"></destination> <destination v-if="showPathWayVisible" :obj="onePathObj" v-on:pathWayEvent="pathWayEvent"></destination>
<!--编辑活动时间--> <!--编辑活动时间-->
<tourTime v-if="showTimeVisible" :list="form.tourDepartTimeVo" :number="form.number" v-on:tourDepartTimeEvent = "tourDepartTimeEvent"></tourTime> <tourTime v-if="showTimeVisible" :list="form.tourDepartTimeVo" :number="form.number"
v-on:tourDepartTimeEvent="tourDepartTimeEvent"></tourTime>
<!--编辑旅游标签--> <!--编辑旅游标签-->
<tourLabelModal v-if="editLableVisible" :allLabelList="allLabelList" :checkList="checkList" v-on:tourLabelEvent = "tourLabelEvent"></tourLabelModal> <tourLabelModal v-if="editLableVisible" :allLabelList="allLabelList" :checkList="checkList"
v-on:tourLabelEvent="tourLabelEvent"></tourLabelModal>
</div> </div>
</template> </template>
<style> <style>
textarea{ textarea {
display: none; display: none;
} }
.el-upload-list{
.el-upload-list {
display: flex; display: flex;
width: 100px; width: 100px;
} }
.el-upload-list li{
.el-upload-list li {
margin-left: 10px; margin-left: 10px;
} }
</style> </style>
<script> <script>
// import Editor from "../../modal/editorTool";//富文本 // import Editor from "../../modal/editorTool";//富文本
import UE from '../../modal/Ueditor';//百度ue富文本 import UE from '../../modal/Ueditor';//百度ue富文本
import Destination from "./destinationModal";//目的地弹框 import Destination from "./destinationModal";//目的地弹框
import tourTime from "./tourTime";//活动时间 import tourTime from "./tourTime";//活动时间
import tourLabelModal from "./tourLabelModal";//旅游标签 import tourLabelModal from "./tourLabelModal";//旅游标签
import departureModal from "./departureModal";//出发地弹框 import departureModal from "./departureModal";//出发地弹框
import { import {
page, page,
goodsEdit, goodsEdit,
getOneGoodsById getOneGoodsById
} from 'api/tourManage'; } from 'api/tourManage';
import {
getSonRegionByCodes,
getRegionByCodes,
} from 'api/base_info/region/';
import { import rsCode from '../../../utils/rsCode';
getSonRegionByCodes, import {
getRegionByCodes, getToken
} from 'api/base_info/region/'; } from '../../../utils/auth';
import {mapGetters} from 'vuex';
import {
getAllCompany,
getAll
} from 'api/base_info/branch_company/';
import {
getTourTagList,
getAllTourTag
} from 'api/tourManage';
import ElRow from "element-ui/packages/row/src/row";
import rsCode from '../../../utils/rsCode'; export default {
import { props: ["oneTourRow", "title", "good_btn_update"],
getToken name: 'upkeepDialog',
} from '../../../utils/auth'; components: {
import {mapGetters} from 'vuex';
import {
getAllCompany,
getAll
} from 'api/base_info/branch_company/';
import {
getTourTagList,
getAllTourTag
} from 'api/tourManage';
import ElRow from "element-ui/packages/row/src/row";
export default {
props: ["oneTourRow", "title","good_btn_update"],
name: 'upkeepDialog',
components: {
// Editor, // Editor,
ElRow, ElRow,
UE, UE,
Destination, Destination,
tourTime, tourTime,
tourLabelModal, tourLabelModal,
departureModal departureModal
},
data() {
return {
imgPosterFlag:false,
percent_poster:0,
BASE_API: process.env.BASE_API,
config: {
initialFrameWidth: null,
initialFrameHeight: 350
}, },
percent: 0,//上传进度 data() {
imgFlag: false, return {
onePathObj:{name: ""},//待编辑的途径地 imgPosterFlag: false,
destinationObj:{},//目的地 percent_poster: 0,
departureList: [],//出发地列表 BASE_API: process.env.BASE_API,
departureObj:{name: ""},//出发地 config: {
pathway: [],//途径地 initialFrameWidth: null,
isCreate: false,//是否点击了创建-确定 initialFrameHeight: 350
fileList2:[], },
activeName2: '',//行程亮点 percent: 0,//上传进度
form: { imgFlag: false,
alt:undefined, onePathObj: {name: ""},//待编辑的途径地
childPrice: undefined,//儿童价 destinationObj: {},//目的地
isOutside:"0", departureList: [],//出发地列表
tourDepartVo:undefined,//type:0出发地 1途径地 2目的地 departureObj: {name: ""},//出发地
content: "",//行程亮点 pathway: [],//途径地
cover:undefined,//封面图 isCreate: false,//是否点击了创建-确定
describe: undefined,//描述 fileList2: [],
introduce: "",//行程介绍 activeName2: '',//行程亮点
crtTime: undefined, form: {
explain: "",//费用说明 alt: undefined,
name: undefined,//旅行名称 imgTitle: undefined,
price: undefined,//成人价 imgKeyword: undefined,
rank: undefined, imgDesc: undefined,
recommend: "0",//是否设置为推荐,默认不推荐 childPrice: undefined,//儿童价
saleCount: undefined,//初始销量 isOutside: "0",
status: undefined,//0:未发布,1:上架 2:下架 tourDepartVo: undefined,//type:0出发地 1途径地 2目的地
stock: undefined,//总人数 content: "",//行程亮点
unit: undefined,//单位 cover: undefined,//封面图
updTime: undefined,//更新时间 describe: undefined,//描述
viewCount: undefined,//浏览量 introduce: "",//行程介绍
isMember: "0",//是否是会员商品 crtTime: undefined,
tagDTOS: [],//旅行标签 explain: "",//费用说明
bannerDTOS:[],//banner轮播 name: undefined,//旅行名称
posterBackground:'',//海报背景 price: undefined,//成人价
}, rank: undefined,
showDestinationVisible: false,//编辑目的地 recommend: "0",//是否设置为推荐,默认不推荐
showPathWayVisible: false,//编辑途径地 saleCount: undefined,//初始销量
showTimeVisible: false,//编辑时间 status: undefined,//0:未发布,1:上架 2:下架
rules: { stock: undefined,//总人数
name: { unit: undefined,//单位
type: 'string', updTime: undefined,//更新时间
required: true, viewCount: undefined,//浏览量
message: '请输入旅游名称', isMember: "0",//是否是会员商品
trigger: 'blur' tagDTOS: [],//旅行标签
}, bannerDTOS: [],//banner轮播
price: { posterBackground: '',//海报背景
required: true, },
message: '请输入价格', showDestinationVisible: false,//编辑目的地
}, showPathWayVisible: false,//编辑途径地
childPrice: { showTimeVisible: false,//编辑时间
required: true, rules: {
message: '请输入儿童价格' name: {
}, type: 'string',
stock: { required: true,
required: true, message: '请输入旅游名称',
message: '请输入库存' trigger: 'blur'
} },
price: {
required: true,
message: '请输入价格',
},
childPrice: {
required: true,
message: '请输入儿童价格'
},
stock: {
required: true,
message: '请输入库存'
}
},
checkList: [],//已选中的标签
allCompanies: {},
allCompaniesArr: [],
oneTourDialogVisible: false,
editLableVisible: false,//旅游标签
editDepartureVisible: false,//出发地弹框
allUpkeepItems: null,
dialogStatus: undefined,
allLabelList: [],//全部旅游标签
}
}, },
checkList:[],//已选中的标签 created() {
allCompanies: {}, getAll()
allCompaniesArr: [], .then(response => {
oneTourDialogVisible: false, this.allCompaniesArr = response.data;
editLableVisible: false,//旅游标签 })
editDepartureVisible: false,//出发地弹框 getAllCompany(codeAndBranchCompany => {
allUpkeepItems: null, this.allCompanies = codeAndBranchCompany;
dialogStatus: undefined,
allLabelList: [],//全部旅游标签
}
},
created() {
getAll()
.then(response => {
this.allCompaniesArr = response.data;
})
getAllCompany(codeAndBranchCompany => {
this.allCompanies = codeAndBranchCompany;
});
this.getAllLabelList();
},
watch: {
oneTourDialogVisible(newValue, oldValue){
if(!newValue){
this.cleanForm();
}
},
},
mounted() {
this.cleanForm();
if(this.title == "编辑"){
let row = this.oneTourRow;
this.getOneGoods(row.id);
} else{
this.activeName2 = "first";
}
this.oneTourDialogVisible = true;
},
computed: {
getHeaderWithToken() {
return {Authorization: getToken()};
},
},
methods: {
/**
* 封面图
* */
uploadProcess(event, file, fileList) {
this.imgFlag = true;
console.log(event.percent);
this.percent = Math.floor(event.percent);
},
handleClick(tab, event) {
console.log(tab, event);
},
getWeek(week, name){
let weekStr = "";
switch (week) {
case 0:
weekStr = name + "天";
break;
case 1:
weekStr = name + "一";
break;
case 2:
weekStr = name + "二";
break;
case 3:
weekStr = name + "三";
break;
case 4:
weekStr = name + "四";
break;
case 5:
weekStr = name + "五";
break;
case 6:
weekStr = name + "六";
break;
}
return weekStr;
},
/**
* 编辑出发地
* */
editDeparture(list){
console.log(list);
this.editDepartureVisible = true;
},
/**
* 关闭出发地弹框
* */
departureEvent(obj){
this.editDepartureVisible = false;
if(obj){
this.departureList = obj;
console.log(obj);
}
},
/**
* 编辑旅游标签
* */
editLable(list){
console.log(list);
this.editLableVisible = true;
},
/**
* 创建
* */
create(formName){
const set = this.$refs;
set[formName].validate(valid => {
if (valid) {
//旅游标签
let tagDTOS = [];
this.form.tagDTOS.map(function(item){
if(item.tagId){
tagDTOS.push({tagId: item.tagId});
} else {
tagDTOS.push({tagId: item.id});
}
});
let siteDTOS = [];
//出发地
this.departureList.map(function(item){
let pp = item.province?item.province:item.addrProvince;
let c = item.addrCity?item.addrCity: item.city;
let provinceObj = pp?getRegionByCodes([pp]): [{name:""}];
let cityObj = c?getRegionByCodes([c]):[{name:""}];
let p = {
name: item.name,
departTime:item.departTime?item.departTime:0,
address: item.addrDetail?item.addrDetail: item.address,
companyId: item.companyId,
province: item.addrProvince?item.addrProvince:item.province,
provinceName:provinceObj[0].name,
cityName: cityObj[0].name,
city: item.addrCity?item.addrCity: item.city,
longitude: item.longitude,
latitude: item.latitude,
type: 0,
rank: item.rank
};
siteDTOS.push(p);
}); });
if(this.departureList.length<=0){ this.getAllLabelList();
this.$notify({ },
title: '警告', watch: {
message: '请选择出发地', oneTourDialogVisible(newValue, oldValue) {
type: 'warning', if (!newValue) {
duration: 2000 this.cleanForm();
}); }
return; },
},
mounted() {
this.cleanForm();
if (this.title == "编辑") {
let row = this.oneTourRow;
this.getOneGoods(row.id);
} else {
this.activeName2 = "first";
} }
//途径地 this.oneTourDialogVisible = true;
this.pathway.map(function(item){ },
let provinceObj = item.province?getRegionByCodes([item.province]): [{name:""}]; computed: {
let cityObj = item.city?getRegionByCodes([item.city]):[{name:""}]; getHeaderWithToken() {
return {Authorization: getToken()};
},
},
methods: {
/**
* 封面图
* */
uploadProcess(event, file, fileList) {
this.imgFlag = true;
console.log(event.percent);
this.percent = Math.floor(event.percent);
},
handleClick(tab, event) {
console.log(tab, event);
},
getWeek(week, name) {
let weekStr = "";
switch (week) {
case 0:
weekStr = name + "天";
break;
case 1:
weekStr = name + "一";
break;
case 2:
weekStr = name + "二";
break;
case 3:
weekStr = name + "三";
break;
case 4:
weekStr = name + "四";
break;
case 5:
weekStr = name + "五";
break;
case 6:
weekStr = name + "六";
break;
}
return weekStr;
},
/**
* 编辑出发地
* */
editDeparture(list) {
console.log(list);
this.editDepartureVisible = true;
},
/**
* 关闭出发地弹框
* */
departureEvent(obj) {
this.editDepartureVisible = false;
if (obj) {
this.departureList = obj;
console.log(obj);
}
},
/**
* 编辑旅游标签
* */
editLable(list) {
console.log(list);
this.editLableVisible = true;
},
/**
* 创建
* */
create(formName) {
const set = this.$refs;
set[formName].validate(valid => {
if (valid) {
//旅游标签
let tagDTOS = [];
this.form.tagDTOS.map(function (item) {
if (item.tagId) {
tagDTOS.push({tagId: item.tagId});
} else {
tagDTOS.push({tagId: item.id});
}
});
let siteDTOS = [];
//出发地
this.departureList.map(function (item) {
let pp = item.province ? item.province : item.addrProvince;
let c = item.addrCity ? item.addrCity : item.city;
let provinceObj = pp ? getRegionByCodes([pp]) : [{name: ""}];
let cityObj = c ? getRegionByCodes([c]) : [{name: ""}];
let p = {
name: item.name,
departTime: item.departTime ? item.departTime : 0,
address: item.addrDetail ? item.addrDetail : item.address,
companyId: item.companyId,
province: item.addrProvince ? item.addrProvince : item.province,
provinceName: provinceObj[0].name,
cityName: cityObj[0].name,
city: item.addrCity ? item.addrCity : item.city,
longitude: item.longitude,
latitude: item.latitude,
type: 0,
rank: item.rank
};
siteDTOS.push(p);
});
if (this.departureList.length <= 0) {
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目的地 //destinationObj目的地
let destinationObj = this.destinationObj; let destinationObj = this.destinationObj;
if(!destinationObj.name){ if (!destinationObj.name) {
this.$notify({ this.$notify({
title: '警告', title: '警告',
message: '请选择目的地', message: '请选择目的地',
type: 'warning', type: 'warning',
duration: 2000 duration: 2000
}); });
return; return;
} }
let provinceObj = destinationObj.province?getRegionByCodes([destinationObj.province]):[{name:""}]; let provinceObj = destinationObj.province ? getRegionByCodes([destinationObj.province]) : [{name: ""}];
let cityObj = destinationObj.city?getRegionByCodes([destinationObj.city]):[{name:""}]; let cityObj = destinationObj.city ? getRegionByCodes([destinationObj.city]) : [{name: ""}];
let p = { let p = {
name: destinationObj.name, name: destinationObj.name,
address: destinationObj.addrDetail?destinationObj.addrDetail: destinationObj.address, address: destinationObj.addrDetail ? destinationObj.addrDetail : destinationObj.address,
province: destinationObj.addrProvince?destinationObj.addrProvince:destinationObj.province, province: destinationObj.addrProvince ? destinationObj.addrProvince : destinationObj.province,
provinceName:provinceObj[0].name, provinceName: provinceObj[0].name,
cityName: cityObj[0].name, cityName: cityObj[0].name,
city: destinationObj.addrCity?destinationObj.addrCity: destinationObj.city, city: destinationObj.addrCity ? destinationObj.addrCity : destinationObj.city,
longitude: destinationObj.longitude, longitude: destinationObj.longitude,
latitude: destinationObj.latitude, latitude: destinationObj.latitude,
type: 2 type: 2
}; };
siteDTOS.push(p); siteDTOS.push(p);
this.isCreate = true; this.isCreate = true;
let params = { let params = {
isOutside: this.form.isOutside,//省内、省外 isOutside: this.form.isOutside,//省内、省外
name: this.form.name,//旅游路线名称 name: this.form.name,//旅游路线名称
cover: this.form.cover,//封面图 cover: this.form.cover,//封面图
price: this.form.price,//成人价 price: this.form.price,//成人价
childPrice: this.form.childPrice,//儿童价 childPrice: this.form.childPrice,//儿童价
viewCount: this.form.viewCount,//商品浏览量 viewCount: this.form.viewCount,//商品浏览量
saleCount: this.form.saleCount,//商品销售量 saleCount: this.form.saleCount,//商品销售量
describe: this.form.describe,//商品描述 describe: this.form.describe,//商品描述
content: this.form.content,//商品详情(行程亮点) content: this.form.content,//商品详情(行程亮点)
introduce: this.form.introduce,//行程介绍 introduce: this.form.introduce,//行程介绍
explain: this.form.explain,//费用说明 explain: this.form.explain,//费用说明
rank: this.form.rank,//旅行排序 rank: this.form.rank,//旅行排序
recommend: this.form.recommend,//是否推荐:0-未推荐;1-已推荐 recommend: this.form.recommend,//是否推荐:0-未推荐;1-已推荐
isMember: this.form.isMember,//是否启用会员价 isMember: this.form.isMember,//是否启用会员价
stock: this.form.stock,//库存 stock: this.form.stock,//库存
unit: this.form.unit,//单位 unit: this.form.unit,//单位
number: this.form.number,//活动天数 number: this.form.number,//活动天数
bannerDTOS: this.form.bannerDTOS,//banner轮播图 bannerDTOS: this.form.bannerDTOS,//banner轮播图
siteDTOS: siteDTOS,//出发地type=0,途径地type=1,目的地type=2 siteDTOS: siteDTOS,//出发地type=0,途径地type=1,目的地type=2
priceDTOS: this.form.tourDepartTimeVo,//活动日期 priceDTOS: this.form.tourDepartTimeVo,//活动日期
tagDTOS: tagDTOS,//旅游标签 tagDTOS: tagDTOS,//旅游标签
posterBackground:this.form.posterBackground,//海报背景 posterBackground: this.form.posterBackground,//海报背景
alt: this.form.alt, //seo 标签优化 alt: this.form.alt, //seo 标签优化
}; imgTitle: this.form.imgTitle,
console.log(params); imgKeyword: this.form.imgKeyword,
goodsEdit(params).then(response => { imgDesc: this.form.imgDesc
this.isCreate = false; };
if (response.status === 200) { console.log(params);
this.$notify({ goodsEdit(params).then(response => {
title: '成功', this.isCreate = false;
message: '添加成功', if (response.status === 200) {
type: 'success', this.$notify({
duration: 2000 title: '成功',
}); message: '添加成功',
this.$emit("oneTourDialogEvent", true); type: 'success',
} else { duration: 2000
this.$notify({ });
title: '添加失败', this.$emit("oneTourDialogEvent", true);
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!', } else {
type: 'error', this.$notify({
duration: 2000 title: '添加失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
} else {
return;
}
}); });
} },
}); /**
} else { * 编辑
return; * */
} update(formName) {
}); //旅游标签
}, const set = this.$refs;
/** set[formName].validate(valid => {
* 编辑 if (valid) {
* */ let tagDTOS = [];
update(formName){ this.form.tagDTOS.map(function (item) {
//旅游标签 if (item.tagId) {
const set = this.$refs; tagDTOS.push({tagId: item.tagId});
set[formName].validate(valid => { } else {
if (valid) { tagDTOS.push({tagId: item.id});
let tagDTOS = []; }
this.form.tagDTOS.map(function(item){ });
if(item.tagId){ let siteDTOS = [];
tagDTOS.push({tagId: item.tagId}); //出发地
} else { this.departureList.map(function (item) {
tagDTOS.push({tagId: item.id}); let pp = item.province ? item.province : item.addrProvince;
} let c = item.addrCity ? item.addrCity : item.city;
}); let provinceObj = pp ? getRegionByCodes([pp]) : [{name: ""}];
let siteDTOS = []; let cityObj = c ? getRegionByCodes([c]) : [{name: ""}];
//出发地 let p = {
this.departureList.map(function(item){ id: item.id,
let pp = item.province?item.province:item.addrProvince; name: item.name,
let c = item.addrCity?item.addrCity: item.city; departTime: item.departTime ? item.departTime : 0,
let provinceObj = pp?getRegionByCodes([pp]): [{name:""}]; address: item.addrDetail ? item.addrDetail : item.address,
let cityObj = c?getRegionByCodes([c]):[{name:""}]; companyId: item.companyId,
let p = { province: item.addrProvince ? item.addrProvince : item.province,
id: item.id, provinceName: provinceObj[0].name,
name: item.name, cityName: cityObj[0].name,
departTime:item.departTime?item.departTime:0, city: item.addrCity ? item.addrCity : item.city,
address: item.addrDetail?item.addrDetail: item.address, longitude: item.longitude,
companyId: item.companyId, latitude: item.latitude,
province: item.addrProvince?item.addrProvince:item.province, type: 0,
provinceName:provinceObj[0].name, rank: item.rank
cityName: cityObj[0].name, };
city: item.addrCity?item.addrCity: item.city, siteDTOS.push(p);
longitude: item.longitude, });
latitude: item.latitude, if (this.departureList.length <= 0) {
type: 0, this.$notify({
rank: item.rank title: '警告',
}; message: '请选择出发地',
siteDTOS.push(p); type: 'warning',
}); duration: 2000
if(this.departureList.length<=0){ });
this.$notify({ return;
title: '警告', }
message: '请选择出发地', //途径地
type: 'warning', this.pathway.map(function (item) {
duration: 2000 let provinceObj = item.province ? getRegionByCodes([item.province]) : [{name: ""}];
}); let cityObj = item.city ? getRegionByCodes([item.city]) : [{name: ""}];
return; let p = {
} id: item.id,
//途径地 name: item.name,
this.pathway.map(function(item){ address: item.addrDetail ? item.addrDetail : item.address,
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目的地 //destinationObj目的地
let destinationObj = this.destinationObj; let destinationObj = this.destinationObj;
if(!destinationObj.name){ if (!destinationObj.name) {
this.$notify({ this.$notify({
title: '警告', title: '警告',
message: '请选择目的地', message: '请选择目的地',
type: 'warning', type: 'warning',
duration: 2000 duration: 2000
}); });
return; return;
} }
let provinceObj = destinationObj.province?getRegionByCodes([destinationObj.province]):[{name:""}]; let provinceObj = destinationObj.province ? getRegionByCodes([destinationObj.province]) : [{name: ""}];
let cityObj = destinationObj.city?getRegionByCodes([destinationObj.city]):[{name:""}]; let cityObj = destinationObj.city ? getRegionByCodes([destinationObj.city]) : [{name: ""}];
let p = { let p = {
id: destinationObj.id, id: destinationObj.id,
name: destinationObj.name, name: destinationObj.name,
address: destinationObj.addrDetail?destinationObj.addrDetail: destinationObj.address, address: destinationObj.addrDetail ? destinationObj.addrDetail : destinationObj.address,
province: destinationObj.addrProvince?destinationObj.addrProvince:destinationObj.province, province: destinationObj.addrProvince ? destinationObj.addrProvince : destinationObj.province,
provinceName: provinceObj[0].name, provinceName: provinceObj[0].name,
cityName: cityObj[0].name, cityName: cityObj[0].name,
city: destinationObj.addrCity?destinationObj.addrCity: destinationObj.city, city: destinationObj.addrCity ? destinationObj.addrCity : destinationObj.city,
longitude: destinationObj.longitude, longitude: destinationObj.longitude,
latitude: destinationObj.latitude, latitude: destinationObj.latitude,
type: 2 type: 2
}; };
siteDTOS.push(p); siteDTOS.push(p);
let params = { let params = {
id: this.form.id, id: this.form.id,
isOutside: this.form.isOutside,//省内、省外 isOutside: this.form.isOutside,//省内、省外
name: this.form.name,//旅游路线名称 name: this.form.name,//旅游路线名称
cover: this.form.cover,//封面图 cover: this.form.cover,//封面图
price: this.form.price,//成人价 price: this.form.price,//成人价
childPrice: this.form.childPrice,//儿童价 childPrice: this.form.childPrice,//儿童价
viewCount: this.form.viewCount,//商品浏览量 viewCount: this.form.viewCount,//商品浏览量
saleCount: this.form.saleCount,//商品销售量 saleCount: this.form.saleCount,//商品销售量
describe: this.form.describe,//商品描述 describe: this.form.describe,//商品描述
content: this.form.content,//商品详情(行程亮点) content: this.form.content,//商品详情(行程亮点)
introduce: this.form.introduce,//行程介绍 introduce: this.form.introduce,//行程介绍
explain: this.form.explain,//费用说明 explain: this.form.explain,//费用说明
rank: this.form.rank,//旅行排序 rank: this.form.rank,//旅行排序
recommend: this.form.recommend,//是否推荐:0-未推荐;1-已推荐 recommend: this.form.recommend,//是否推荐:0-未推荐;1-已推荐
isMember: this.form.isMember,//是否启用会员价 isMember: this.form.isMember,//是否启用会员价
stock: this.form.stock,//库存 stock: this.form.stock,//库存
unit: this.form.unit,//单位 unit: this.form.unit,//单位
number: this.form.number,//活动天数 number: this.form.number,//活动天数
bannerDTOS: this.form.bannerDTOS,//banner轮播图 bannerDTOS: this.form.bannerDTOS,//banner轮播图
siteDTOS: siteDTOS,//出发地type=0,途径地type=1,目的地type=2 siteDTOS: siteDTOS,//出发地type=0,途径地type=1,目的地type=2
priceDTOS: this.form.tourDepartTimeVo,//活动日期 priceDTOS: this.form.tourDepartTimeVo,//活动日期
tagDTOS: tagDTOS,//旅游标签 tagDTOS: tagDTOS,//旅游标签
posterBackground:this.form.posterBackground,//海报背景 posterBackground: this.form.posterBackground,//海报背景
alt:this.form.alt, //seo 标签优化 alt: this.form.alt, //seo 标签优化
}; imgTitle: this.form.imgTitle,
console.log(params); imgKeyword: this.form.imgKeyword,
this.isCreate = true; imgDesc: this.form.imgDesc
console.log(this.form); };
goodsEdit(params).then(response => { console.log(params);
this.isCreate = false; this.isCreate = true;
if (response.status === 200) { console.log(this.form);
this.$notify({ goodsEdit(params).then(response => {
title: '成功', this.isCreate = false;
message: '编辑成功', if (response.status === 200) {
type: 'success', this.$notify({
duration: 2000 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;
}
}); });
this.$emit("oneTourDialogEvent", true); },
} else { /**
this.$notify({ * 获取全部旅游标签
title: '编辑失败', * */
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!', getAllLabelList() {
type: 'error', getAllTourTag().then(response => {
duration: 2000 this.allLabelList = response.data;
}); });
} },
});
} else {
return;
}
});
},
/**
* 获取全部旅游标签
* */
getAllLabelList() {
getAllTourTag().then(response => {
this.allLabelList = response.data;
});
},
/** /**
* 关闭目的地弹框 * 关闭目的地弹框
* */ * */
destinationEvent(obj){ destinationEvent(obj) {
this.showDestinationVisible = false; this.showDestinationVisible = false;
if(obj){ if (obj) {
this.destinationObj = obj; this.destinationObj = obj;
console.log(obj); console.log(obj);
} }
}, },
/** /**
* 选择目的地 * 选择目的地
* */ * */
selectDestination(){ selectDestination() {
let that = this; let that = this;
this.destinationObj.showTitle = "目的地编辑"; this.destinationObj.showTitle = "目的地编辑";
this.destinationObj.headTitle = "目的地名称"; this.destinationObj.headTitle = "目的地名称";
this.destinationObj.eventName ='destinationEvent'; this.destinationObj.eventName = 'destinationEvent';
this.destinationObj.keyword = this.destinationObj.address; this.destinationObj.keyword = this.destinationObj.address;
this.showDestinationVisible = true; this.showDestinationVisible = true;
}, },
/** /**
* 关闭活动日期 * 关闭活动日期
* */ * */
tourDepartTimeEvent(params){ tourDepartTimeEvent(params) {
this.showTimeVisible = false; this.showTimeVisible = false;
if(params){ if (params) {
this.form.number = params.num; this.form.number = params.num;
this.form.tourDepartTimeVo = params.priceDTOS; this.form.tourDepartTimeVo = params.priceDTOS;
console.log(params); console.log(params);
} }
}, },
/** /**
* 关闭途径地弹框 * 关闭途径地弹框
* */ * */
pathWayEvent(obj){ pathWayEvent(obj) {
this.showPathWayVisible = false; this.showPathWayVisible = false;
if(obj){ if (obj) {
if(obj.showTitle == "途径地编辑"){ if (obj.showTitle == "途径地编辑") {
if(obj.method == "delete"){ if (obj.method == "delete") {
//删除当前路径 //删除当前路径
this.pathway.splice(obj, 1); this.pathway.splice(obj, 1);
} else { } else {
this.onePathObj = obj; this.onePathObj = obj;
} }
} else { } else {
this.pathway.push(obj); this.pathway.push(obj);
} }
console.log(obj); console.log(obj);
} }
}, },
/** /**
* 编辑一条途径地数据 * 编辑一条途径地数据
* */ * */
selectPathway(obj){ selectPathway(obj) {
let that = this; let that = this;
console.log(obj); console.log(obj);
this.onePathObj = obj; this.onePathObj = obj;
this.onePathObj.showTitle = "途径地编辑"; this.onePathObj.showTitle = "途径地编辑";
this.onePathObj.headTitle = "途径地名称"; this.onePathObj.headTitle = "途径地名称";
}, },
/** /**
* 关闭旅游标签弹框 * 关闭旅游标签弹框
* */ * */
tourLabelEvent(obj){ tourLabelEvent(obj) {
let that = this; let that = this;
this.editLableVisible = false; this.editLableVisible = false;
let arr = []; let arr = [];
let ckeckList = []; let ckeckList = [];
if(obj){ if (obj) {
this.allLabelList.map(function(item){ this.allLabelList.map(function (item) {
obj.map(function(b){ obj.map(function (b) {
if(item.name == b){ if (item.name == b) {
arr.push(item); arr.push(item);
ckeckList.push(b); ckeckList.push(b);
} }
}); });
}); });
this.form.tagDTOS = arr; this.form.tagDTOS = arr;
this.checkList = ckeckList; this.checkList = ckeckList;
console.log(obj); console.log(obj);
} }
}, },
/** /**
* 编辑一条途径地 * 编辑一条途径地
**/ **/
editPathway(item){ editPathway(item) {
this.onePathObj = item; this.onePathObj = item;
this.onePathObj.showTitle = "途径地编辑";//弹框名称 this.onePathObj.showTitle = "途径地编辑";//弹框名称
this.onePathObj.headTitle = "途径地名称"; this.onePathObj.headTitle = "途径地名称";
this.onePathObj.keyword = item.address,//根据关键词查找经纬度 this.onePathObj.keyword = item.address,//根据关键词查找经纬度
this.onePathObj.eventName = "pathWayEvent"; this.onePathObj.eventName = "pathWayEvent";
this.showPathWayVisible = true; this.showPathWayVisible = true;
}, },
/** /**
* 添加途径地 * 添加途径地
* */ * */
addPathway(){ addPathway() {
let that = this; let that = this;
this.onePathObj = { this.onePathObj = {
showTitle: "途径地添加",//弹框名称 showTitle: "途径地添加",//弹框名称
headTitle: "途径地名称", headTitle: "途径地名称",
name: undefined,//地址名称 name: undefined,//地址名称
keyword:"东莞市",//根据关键词查找经纬度 keyword: "东莞市",//根据关键词查找经纬度
address:undefined,//详细地址 address: undefined,//详细地址
longitude: 113.758993, longitude: 113.758993,
latitude:23.031565, latitude: 23.031565,
eventName: "pathWayEvent" eventName: "pathWayEvent"
}; };
this.showPathWayVisible = true; this.showPathWayVisible = true;
}, },
/** /**
* 添加时间 * 添加时间
* */ * */
editTime(){ editTime() {
this.showTimeVisible = true; this.showTimeVisible = true;
}, },
/** /**
* 获取一条旅游路线 * 获取一条旅游路线
* */ * */
getOneGoods(id){ getOneGoods(id) {
let params = { let params = {
id: id id: id
}; };
let that = this; let that = this;
getOneGoodsById(params).then(response => { getOneGoodsById(params).then(response => {
that.pathway = []; that.pathway = [];
response.data.tourDepartVo.map(function(item){ response.data.tourDepartVo.map(function (item) {
if(item.type == 0){ if (item.type == 0) {
//出发地 //出发地
that.departureList.push(item); that.departureList.push(item);
} }
if(item.type == 2 && that.destinationObj.name == ""){ if (item.type == 2 && that.destinationObj.name == "") {
//目的地 //目的地
that.destinationObj = item; that.destinationObj = item;
} }
if(item.type==1){ if (item.type == 1) {
//途径地 //途径地
that.pathway.push(item); that.pathway.push(item);
} }
}); });
let arr = []; let arr = [];
this.form = response.data; this.form = response.data;
this.allLabelList.map(function(b){ this.allLabelList.map(function (b) {
response.data.tagDTOS.map(function(item){ response.data.tagDTOS.map(function (item) {
if(item.tagId == b.id){ if (item.tagId == b.id) {
arr.push(item.name); arr.push(item.name);
} }
}); });
}); });
this.checkList = arr; this.checkList = arr;
//轮播 //轮播
let fileList2 = []; let fileList2 = [];
response.data.bannerDTOS.map(function(item){ response.data.bannerDTOS.map(function (item) {
let p = { let p = {
url: item.cover url: item.cover
}; };
fileList2.push(p); fileList2.push(p);
}); });
this.fileList2 = fileList2; this.fileList2 = fileList2;
this.form.isMember = this.form.isMember+""; this.form.isMember = this.form.isMember + "";
this.form.recommend = this.form.recommend+""; this.form.recommend = this.form.recommend + "";
this.form.isOutside = this.form.isOutside+""; this.form.isOutside = this.form.isOutside + "";
this.activeName2 = "first"; this.activeName2 = "first";
}) })
}, },
querySearch(queryString, cb) { querySearch(queryString, cb) {
let selectArry = []; let selectArry = [];
this.allCompaniesArr.map(function(item){ this.allCompaniesArr.map(function (item) {
item.value = item.name; item.value = item.name;
selectArry.push(item); selectArry.push(item);
}); });
this.selectArry = selectArry; this.selectArry = selectArry;
var results = queryString ? selectArry.filter(this.createFilter(queryString)) : selectArry; var results = queryString ? selectArry.filter(this.createFilter(queryString)) : selectArry;
// 调用 callback 返回建议列表的数据 // 调用 callback 返回建议列表的数据
cb(results); cb(results);
}, },
handleSelect(item) { handleSelect(item) {
this.departureObj = item; this.departureObj = item;
console.log(item); console.log(item);
}, },
createFilter(queryString) { createFilter(queryString) {
return (restaurant) => { return (restaurant) => {
return (restaurant.name.indexOf(queryString.toLowerCase()) != -1); return (restaurant.name.indexOf(queryString.toLowerCase()) != -1);
}; };
}, },
/** /**
* 旅游-弹框-取消 * 旅游-弹框-取消
* */ * */
cancelTour() { cancelTour() {
this.cleanForm(); this.cleanForm();
this.$emit("oneTourDialogEvent", false); this.$emit("oneTourDialogEvent", false);
}, },
/** /**
* 富文本 旅游 * 富文本 旅游
* */ * */
editorReadyEvent(instance){ editorReadyEvent(instance) {
let t = this; let t = this;
instance.addListener('contentChange', () => { instance.addListener('contentChange', () => {
if(t.activeName2 == "first"){ if (t.activeName2 == "first") {
t.form.content = instance.getContent(); t.form.content = instance.getContent();
} else if(t.activeName2 == "second"){ } else if (t.activeName2 == "second") {
t.form.introduce = instance.getContent(); t.form.introduce = instance.getContent();
} else if(t.activeName2 == "third"){ } else if (t.activeName2 == "third") {
t.form.explain = instance.getContent(); t.form.explain = instance.getContent();
} }
}); });
}, },
// /** // /**
// * 富文本内容 费用说明 // * 富文本内容 费用说明
// * @param step // * @param step
...@@ -981,99 +1040,102 @@ import ElRow from "element-ui/packages/row/src/row"; ...@@ -981,99 +1040,102 @@ import ElRow from "element-ui/packages/row/src/row";
// handelContentIncrease(step){ // handelContentIncrease(step){
// this.form.content = step; // this.form.content = step;
// }, // },
/** /**
* 删除banner * 删除banner
* */ * */
handleRemove(file, fileList){ handleRemove(file, fileList) {
let list = []; let list = [];
fileList.map(function(item){ fileList.map(function (item) {
if(item.url != file.url){ if (item.url != file.url) {
list.push(item); list.push(item);
} }
}); });
this.fileList2 = list; this.fileList2 = list;
let arr = []; let arr = [];
this.form.bannerDTOS.map(function(item){ this.form.bannerDTOS.map(function (item) {
if(item.cover != file.url){ if (item.cover != file.url) {
arr.push(item); arr.push(item);
} }
}); });
this.form.bannerDTOS = arr; this.form.bannerDTOS = arr;
}, },
/** /**
* 封面图上传 * 封面图上传
* **/ * **/
handleAvatarSuccess(res, file){ handleAvatarSuccess(res, file) {
this.percent = 0; this.percent = 0;
this.imgFlag = false; this.imgFlag = false;
this.form.cover = res.data; this.form.cover = res.data;
}, },
/** /**
* 海报背景上传 * 海报背景上传
* **/ * **/
handlePosterSuccess(res, file){ handlePosterSuccess(res, file) {
this.percent_poster = 0; this.percent_poster = 0;
this.imgPosterFlag = false; this.imgPosterFlag = false;
this.form.posterBackground = res.data; this.form.posterBackground = res.data;
}, },
/** /**
* 海报背景图上传进度 * 海报背景图上传进度
* */ * */
uploadPosterProcess(event, file, fileList) { uploadPosterProcess(event, file, fileList) {
this.imgPosterFlag = true; this.imgPosterFlag = true;
console.log(event.percent); console.log(event.percent);
this.percent_poster = Math.floor(event.percent); this.percent_poster = Math.floor(event.percent);
}, },
/** /**
* banner上传 * banner上传
* */ * */
handleBannerSuccess(res, file){ handleBannerSuccess(res, file) {
this.fileList2.push({url:res.data}); this.fileList2.push({url: res.data});
this.form.bannerDTOS.push({cover:res.data}); this.form.bannerDTOS.push({cover: res.data});
}, },
/** /**
* 清空旅游弹框数据 * 清空旅游弹框数据
*/ */
cleanForm() { cleanForm() {
this.onePathObj = {name: ""};//待编辑的途径地 this.onePathObj = {name: ""};//待编辑的途径地
this.destinationObj ={name: ""},//目的地 this.destinationObj = {name: ""},//目的地
this.departureList= [],//出发地列表 this.departureList = [],//出发地列表
this.departureObj={name: ""},//出发地 this.departureObj = {name: ""},//出发地
this.pathway= [],//途径地 this.pathway = [],//途径地
this.fileList2=[], this.fileList2 = [],
this.activeName2= '',//行程亮点 this.activeName2 = '',//行程亮点
this.form= { this.form = {
isOutside: "0",//省内、省外 isOutside: "0",//省内、省外
childPrice: undefined,//儿童价 childPrice: undefined,//儿童价
tourDepartVo:undefined,//type:0出发地 1途径地 2目的地 tourDepartVo: undefined,//type:0出发地 1途径地 2目的地
content: "",//行程亮点 content: "",//行程亮点
cover:undefined,//封面图 cover: undefined,//封面图
describe: undefined,//描述 describe: undefined,//描述
introduce: "",//行程介绍 introduce: "",//行程介绍
crtTime: undefined, crtTime: undefined,
explain: "",//费用说明 explain: "",//费用说明
name: undefined,//旅行名称 name: undefined,//旅行名称
price: undefined,//成人价 price: undefined,//成人价
rank: undefined, rank: undefined,
recommend: "0",//是否推荐0:不推荐,1推荐 recommend: "0",//是否推荐0:不推荐,1推荐
saleCount: undefined,//初始销量 saleCount: undefined,//初始销量
status: undefined,//0:未发布,1:上架 2:下架 status: undefined,//0:未发布,1:上架 2:下架
stock: undefined,//总人数 stock: undefined,//总人数
unit: undefined,//单位 unit: undefined,//单位
updTime: undefined,//更新时间 updTime: undefined,//更新时间
viewCount: undefined,//浏览量 viewCount: undefined,//浏览量
isMember: "0",//是否是会员商品0不启用,1启用 isMember: "0",//是否是会员商品0不启用,1启用
tagDTOS: [],//旅行标签 tagDTOS: [],//旅行标签
bannerDTOS:[],//banner轮播 bannerDTOS: [],//banner轮播
tourDepartTimeVo:[],//活动时间 tourDepartTimeVo: [],//活动时间
posterBackground:'',//海报背景 posterBackground: '',//海报背景
alt:'', alt: '',
}, imgTitle: undefined,
this.showDestinationVisible= false,//编辑目的地 imgKeyword: undefined,
this.showPathWayVisible= false,//编辑途径地 imgDesc: undefined
this.showTimeVisible= false;//编辑时间 },
this.activeName2 = ""; this.showDestinationVisible = false,//编辑目的地
} this.showPathWayVisible = false,//编辑途径地
this.showTimeVisible = false;//编辑时间
this.activeName2 = "";
}
}
} }
}
</script> </script>
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="车型名称" prop="name"> <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>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="车型简介" prop="intro"> <el-form-item label="车型简介" prop="intro">
<el-input v-model="form.intro" placeholder="请输入车型简介" ></el-input> <el-input v-model="form.intro" placeholder="请输入车型简介"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -94,25 +94,27 @@ ...@@ -94,25 +94,27 @@
<el-form-item label="房车配置"></el-form-item> <el-form-item label="房车配置"></el-form-item>
<el-row> <el-row>
<el-col :span="8" v-for="(item, index) in labelList" :key="item.id"> <el-col :span="8" v-for="(item, index) in labelList" :key="item.id">
<el-form-item> <el-form-item>
<span style="width: 150px;text-align:right;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;padding-right: 10px;">{{item.parent.name}}</span> <span
<el-input v-model="item.selectChild" readonly icon="edit" @click="editConfig(item)" style="width: 70%;"></el-input> style="width: 150px;text-align:right;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;padding-right: 10px;">{{item.parent.name}}</span>
<el-input v-model="item.selectChild" readonly icon="edit" @click="editConfig(item)"
style="width: 70%;"></el-input>
<!--<el-select v-model="item.childNameLists" style="width: 80%" v-if="item.parent.isMore==1" multiple placeholder="请选择" @change = "selectItem">--> <!--<el-select v-model="item.childNameLists" style="width: 80%" v-if="item.parent.isMore==1" multiple placeholder="请选择" @change = "selectItem">-->
<!--<el-option--> <!--<el-option-->
<!--v-for="iitem in item.children"--> <!--v-for="iitem in item.children"-->
<!--:key="iitem.name"--> <!--:key="iitem.name"-->
<!--:label="iitem.name"--> <!--:label="iitem.name"-->
<!--:value="iitem.id">--> <!--:value="iitem.id">-->
<!--</el-option>--> <!--</el-option>-->
<!--</el-select>--> <!--</el-select>-->
<!--<el-select v-model="item.childNameLists" v-else placeholder="请选择" @change = "selectItem">--> <!--<el-select v-model="item.childNameLists" v-else placeholder="请选择" @change = "selectItem">-->
<!--<el-option--> <!--<el-option-->
<!--v-for="iitem in item.children"--> <!--v-for="iitem in item.children"-->
<!--:key="iitem.id"--> <!--:key="iitem.id"-->
<!--:label="iitem.name"--> <!--:label="iitem.name"-->
<!--:value="iitem.id">--> <!--:value="iitem.id">-->
<!--</el-option>--> <!--</el-option>-->
<!--</el-select>--> <!--</el-select>-->
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -120,25 +122,27 @@ ...@@ -120,25 +122,27 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="关键标签"> <el-form-item label="关键标签">
<!--<el-select v-model="value5" multiple placeholder="请选择" style="width: 100%;">--> <!--<el-select v-model="value5" multiple placeholder="请选择" style="width: 100%;">-->
<!--<el-option--> <!--<el-option-->
<!--v-for="item in options"--> <!--v-for="item in options"-->
<!--:key="item.value"--> <!--:key="item.value"-->
<!--:label="item.label"--> <!--:label="item.label"-->
<!--:value="item.value">--> <!--:value="item.value">-->
<!--</el-option>--> <!--</el-option>-->
<!--</el-select>--> <!--</el-select>-->
<el-input v-model="form.keyword" placeholder="请输入关键标签" readonly icon="edit" @click="editLabe"></el-input> <el-input v-model="form.keyword" placeholder="请输入关键标签" readonly icon="edit" @click="editLabe"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-form-item label="房车参数"> <el-form-item label="房车参数">
<el-button size="small" class="el-button el-button--primary" type="button" icon="plus" @click="addModelParam()">添加</el-button> <el-button size="small" class="el-button el-button--primary" type="button" icon="plus" @click="addModelParam()">
添加
</el-button>
<el-col v-for="(item, index) in form.modelParam" :key="index"> <el-col v-for="(item, index) in form.modelParam" :key="index">
<el-form-item label="参数名称" style="margin: 10px 5px;"> <el-form-item label="参数名称" style="margin: 10px 5px;">
<el-input style="width: 30%;" v-model="item.key"></el-input> <el-input style="width: 30%;" v-model="item.key"></el-input>
<el-input style="width: 30%;" v-model="item.val"></el-input> <el-input style="width: 30%;" v-model="item.val"></el-input>
<el-button type="danger" size="small" @click="delModelParam(index)">删除</el-button> <el-button type="danger" size="small" @click="delModelParam(index)">删除</el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -152,16 +156,40 @@ ...@@ -152,16 +156,40 @@
:on-success="handleAvatarSuccess" :on-success="handleAvatarSuccess"
:on-progress="uploadProcess" :on-progress="uploadProcess"
list-type="picture"> list-type="picture">
<div slot="tip" class="el-upload__tip"> <span style="color: red;">建议尺寸:320*228px</span></div> <div slot="tip" class="el-upload__tip"><span style="color: red;">建议尺寸:320*228px</span></div>
<el-progress v-show="imgFlag == true" type="circle" :percentage="percent" style="margin-top: 20px"></el-progress> <el-progress v-show="imgFlag == true" type="circle" :percentage="percent"
<img v-if="$utils.isString(form.coverPic) && !$utils.isEmpty(form.coverPic) && !imgFlag" :src="form.coverPic" style="width:300px;max-height:300px;"> style="margin-top: 20px"></el-progress>
<i v-else-if="!imgFlag" class="el-icon-plus avatar-uploader-icon" style="lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"></i> <img v-if="$utils.isString(form.coverPic) && !$utils.isEmpty(form.coverPic) && !imgFlag" :src="form.coverPic"
style="width:300px;max-height:300px;">
<i v-else-if="!imgFlag" class="el-icon-plus avatar-uploader-icon"
style="lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"></i>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="alt"> <el-form-item label="alt">
<el-input v-model="form.alt" type="text" placeholder="请输入描述"></el-input> <el-input v-model="form.alt" type="text" placeholder="请输入替代文本"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="img-title">
<el-input v-model="form.imgTitle" type="text" placeholder="请输入图片title"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="img-keyword">
<el-input v-model="form.imgKeyword" type="text" placeholder="请输入图片关键字"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="img-desc">
<el-input v-model="form.imgDesc" type="text" placeholder="请输入图片描述"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -174,10 +202,13 @@ ...@@ -174,10 +202,13 @@
:on-success="handlePosterSuccess" :on-success="handlePosterSuccess"
:on-progress="uploadPosterProcess" :on-progress="uploadPosterProcess"
list-type="picture"> list-type="picture">
<div slot="tip" class="el-upload__tip"> <span style="color: red;">建议尺寸:320*228px</span></div> <div slot="tip" class="el-upload__tip"><span style="color: red;">建议尺寸:320*228px</span></div>
<el-progress v-show="imgPosterFlag == true" type="circle" :percentage="percent_poster" style="margin-top: 20px"></el-progress> <el-progress v-show="imgPosterFlag == true" type="circle" :percentage="percent_poster"
<img v-if="$utils.isString(form.posterBackground) && !$utils.isEmpty(form.posterBackground)&& !imgPosterFlag" :src="form.posterBackground" style="width:300px;max-height:300px;"> style="margin-top: 20px"></el-progress>
<i v-else-if="!imgPosterFlag" class="el-icon-plus avatar-uploader-icon" style="lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"></i> <img v-if="$utils.isString(form.posterBackground) && !$utils.isEmpty(form.posterBackground)&& !imgPosterFlag"
:src="form.posterBackground" style="width:300px;max-height:300px;">
<i v-else-if="!imgPosterFlag" class="el-icon-plus avatar-uploader-icon"
style="lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"></i>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="轮播图" :style="{display:'block'}"> <el-form-item label="轮播图" :style="{display:'block'}">
...@@ -198,7 +229,8 @@ ...@@ -198,7 +229,8 @@
<el-tab-pane label="车型详情" name="first"> <el-tab-pane label="车型详情" name="first">
<!--<Editor @input="handelIncrease" :value="form.modelsDetails" :myQuillEditor="'myQuillEditor'"></Editor>--> <!--<Editor @input="handelIncrease" :value="form.modelsDetails" :myQuillEditor="'myQuillEditor'"></Editor>-->
<div class="editor-container" v-if="activeName2=='first'"> <div class="editor-container" v-if="activeName2=='first'">
<UE :editorId="activeName2" :defaultMsg="form.modelsDetails" :config=config ref="ue" @ready="editorReadyEvent"></UE> <UE :editorId="activeName2" :defaultMsg="form.modelsDetails" :config=config ref="ue"
@ready="editorReadyEvent"></UE>
</div> </div>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
...@@ -212,14 +244,14 @@ ...@@ -212,14 +244,14 @@
<!--配置弹框--> <!--配置弹框-->
<el-dialog :title="modalTitle" :visible.sync="configDialogVisible"> <el-dialog :title="modalTitle" :visible.sync="configDialogVisible">
<el-form label-width="90px"> <el-form label-width="90px">
<el-form-item v-if="configItem.parent.isMore==0"> <el-form-item v-if="configItem.parent.isMore==0">
<el-radio-group v-model="childName"> <el-radio-group v-model="childName">
<el-radio v-for="item in configItemChildren" :key="item.id" :label="item.id">{{item.name}}</el-radio> <el-radio v-for="item in configItemChildren" :key="item.id" :label="item.id">{{item.name}}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item v-if="configItem.parent.isMore==1"> <el-form-item v-if="configItem.parent.isMore==1">
<el-checkbox-group v-model="childNameLists"> <el-checkbox-group v-model="childNameLists">
<el-checkbox v-for="item in configItemChildren" :key="item.id" :label="item.id">{{item.name}}</el-checkbox> <el-checkbox v-for="item in configItemChildren" :key="item.id" :label="item.id">{{item.name}}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -232,9 +264,9 @@ ...@@ -232,9 +264,9 @@
<!--关键标签弹框--> <!--关键标签弹框-->
<el-dialog title="关键标签编辑" :visible.sync="keywordDialogVisible"> <el-dialog title="关键标签编辑" :visible.sync="keywordDialogVisible">
<el-form label-width="90px"> <el-form label-width="90px">
<el-checkbox-group v-model="selectedLabel"> <el-checkbox-group v-model="selectedLabel">
<el-checkbox v-for="item in canSelectLabel" :key="item.id" :label="item.id">{{item.name}}</el-checkbox> <el-checkbox v-for="item in canSelectLabel" :key="item.id" :label="item.id">{{item.name}}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="cancelHandelLabel">取 消</el-button> <el-button @click="cancelHandelLabel">取 消</el-button>
...@@ -244,682 +276,697 @@ ...@@ -244,682 +276,697 @@
</div> </div>
</template> </template>
<style> <style>
textarea{ textarea {
display: none; display: none;
} }
.el-upload-list{
.el-upload-list {
display: flex; display: flex;
width: 100px; width: 100px;
} }
.el-upload-list li{
.el-upload-list li {
margin-left: 10px; margin-left: 10px;
} }
</style> </style>
<script> <script>
// import Editor from "../../modal/editorTool";//富文本 // import Editor from "../../modal/editorTool";//富文本
import UE from '../../modal/Ueditor';//百度ue富文本 import UE from '../../modal/Ueditor';//百度ue富文本
import { import {
getOneTypeById, getOneTypeById,
getAllParentLabel, getAllParentLabel,
getLabelList, getLabelList,
updateVehicleModel, updateVehicleModel,
addVehicleModel addVehicleModel
} from 'api/vehicleType'; } from 'api/vehicleType';
import rsCode from '../../../utils/rsCode'; import rsCode from '../../../utils/rsCode';
import { import {
getToken getToken
} from '../../../utils/auth'; } from '../../../utils/auth';
import {mapGetters} from 'vuex'; import {mapGetters} from 'vuex';
import ElRow from "element-ui/packages/row/src/row"; import ElRow from "element-ui/packages/row/src/row";
import ElCol from "element-ui/packages/col/src/col"; import ElCol from "element-ui/packages/col/src/col";
import ElFormItem from "../../../../node_modules/element-ui/packages/form/src/form-item.vue"; import ElFormItem from "../../../../node_modules/element-ui/packages/form/src/form-item.vue";
import ElRadio from "../../../../node_modules/element-ui/packages/radio/src/radio.vue"; import ElRadio from "../../../../node_modules/element-ui/packages/radio/src/radio.vue";
export default { export default {
props: ["oneRow", "title", "brandlist", "numberList","vehicleTypeList_btn_edit"], props: ["oneRow", "title", "brandlist", "numberList", "vehicleTypeList_btn_edit"],
name: 'upkeepDialog', name: 'upkeepDialog',
components: { components: {
ElRadio, ElRadio,
ElFormItem, ElFormItem,
ElCol, ElCol,
ElRow, ElRow,
UE UE
}, },
data() { data() {
return { return {
imgPosterFlag:false, imgPosterFlag: false,
percent_poster:0, percent_poster: 0,
BASE_API: process.env.BASE_API, BASE_API: process.env.BASE_API,
percent: 0,//上传进度 percent: 0,//上传进度
imgFlag: false, imgFlag: false,
config: { config: {
initialFrameWidth: null, initialFrameWidth: null,
initialFrameHeight: 350 initialFrameHeight: 350
},
labelList: [],//全部车型标签
fileList2: [],
activeName2: '',//房车详情
form: {
alt: '',
imgTitle: undefined,
imgKeyword: undefined,
imgDesc: undefined,
pPrice: 0,//普通会员
hPrice: 0,//黄金会员
zPrice: 0,//钻石会员
name: undefined,//房车名称
config: "",//房车配置
keyword: "",//房车关键标签
modelsDetails: "",//房车详情
modelParam: "",//房车参数
picture: "",//轮播图
price: 0,//租车价格
deposit: 20000,//总押金
vioDeposit: 0,//违章押金
hotSign: "2",//热门车型 1、热门 2、非热门
rentDiscountStatus: "0",//租车优惠状态 0--没有优惠;1--会员折扣;2--固定值
rentDiscountPrice: 0,//租车优惠价格 固定优化价格
buyPrice: 0,//购买价格
intro: ''
},
showDestinationVisible: false,//编辑目的地
showPathWayVisible: false,//编辑途径地
rules: {
name: {
type: 'string',
required: true,
message: '请输入车型名称',
trigger: 'blur'
}
},
checkList: [],//已选中的标签
allCompanies: {},
allCompaniesArr: [],
oneTypeDialogVisible: false,
allUpkeepItems: null,
dialogStatus: undefined,
allLabelList: [],//全部标签
showName: "",
configDialogVisible: false,//配置弹框
modalTitle: "修改房车配置",
configItem: {parent: {isMore: 0}},//待编辑配置数据
configItemChildren: [],//待配置的二级标签
childNameLists: [],
childName: "",
totalLabel: [],//关键标签id
canSelectLabel: [],//可选择的二级标签
selectedLabel: [],//已选中的标签
keywordDialogVisible: false,//关键标签弹框
}
}, },
labelList:[],//全部车型标签 created() {
fileList2:[],
activeName2: '',//房车详情
form: {
alt:'',
pPrice:0,//普通会员
hPrice:0,//黄金会员
zPrice:0,//钻石会员
name: undefined,//房车名称
config: "",//房车配置
keyword: "",//房车关键标签
modelsDetails: "",//房车详情
modelParam: "",//房车参数
picture: "",//轮播图
price: 0,//租车价格
deposit: 20000,//总押金
vioDeposit: 0,//违章押金
hotSign: "2",//热门车型 1、热门 2、非热门
rentDiscountStatus:"0",//租车优惠状态 0--没有优惠;1--会员折扣;2--固定值
rentDiscountPrice: 0,//租车优惠价格 固定优化价格
buyPrice: 0,//购买价格
intro:''
}, },
showDestinationVisible: false,//编辑目的地 watch: {
showPathWayVisible: false,//编辑途径地 oneTypeDialogVisible(newValue, oldValue) {
rules: { if (!newValue) {
name: { this.cleanForm();
type: 'string', }
required: true, },
message: '请输入车型名称', },
trigger: 'blur' mounted() {
this.cleanForm();
this.getAllTag();
this.oneTypeDialogVisible = true;
},
computed: {
...mapGetters([
'elements',
'vehicleWarningMsgType'
]),
getHeaderWithToken() {
return {Authorization: getToken()};
} }
}, },
checkList:[],//已选中的标签 methods: {
allCompanies: {}, changeConfig() {
allCompaniesArr: [], console.log(this.configItemChildren);
oneTypeDialogVisible: false, },
allUpkeepItems: null,
dialogStatus: undefined,
allLabelList: [],//全部标签
showName: "",
configDialogVisible: false,//配置弹框
modalTitle: "修改房车配置",
configItem: {parent:{isMore: 0}},//待编辑配置数据
configItemChildren:[],//待配置的二级标签
childNameLists: [],
childName:"",
totalLabel: [],//关键标签id
canSelectLabel: [],//可选择的二级标签
selectedLabel: [],//已选中的标签
keywordDialogVisible: false,//关键标签弹框
}
},
created() {
},
watch: {
oneTypeDialogVisible(newValue, oldValue){
if(!newValue){
this.cleanForm();
}
},
},
mounted() {
this.cleanForm();
this.getAllTag();
this.oneTypeDialogVisible = true;
},
computed: {
...mapGetters([
'elements',
'vehicleWarningMsgType'
]),
getHeaderWithToken() {
return {Authorization: getToken()};
}
},
methods: {
changeConfig(){
console.log(this.configItemChildren);
},
/**
* 获取全部一级、二级分类数据
* */
getAllTag() {
let listQuery = {sort: 1, page:1,limit:10};
let that = this;
getLabelList(listQuery).then(response => {
let listRs = undefined;
if (!this.$utils.isEmpty(response.data)) {
listRs = response.data;
response.data.map(function(item){
item.childName = [];
})
}
this.labelList = listRs;
if(this.title == "编辑"){
let row = this.oneRow;
this.getOne(row.id);
} else {
this.activeName2 = "first";
let tagArr = [];
this.labelList.map(function(iitem){
if(iitem.children.length >0){
tagArr.push(iitem.children[0].id);
}
});
this.form.brand = this.brandlist[0].id;
this.form.number = this.numberList[0].id;
this.labelList.map(function(iitem){
let p = [];
let pp = [];
let aa = [];
iitem.childNameLists =[];
iitem.children.map(function (c) {
tagArr.map(function (ii) {
if(c.id == ii){
p.push(c);
aa.push(c.name);
pp.push(c.id);
}
});
});
iitem.childNameList = p;
iitem.childNameLists = pp;
iitem.selectChild = aa.join(",");
});
/** /**
* 关键标签可选的二级分类 * 获取全部一级、二级分类数据
* */ * */
let labelArr = []; getAllTag() {
that.labelList.map(function (i) { let listQuery = {sort: 1, page: 1, limit: 10};
i.childNameLists.map(function (ii) { let that = this;
labelArr.push(ii) getLabelList(listQuery).then(response => {
}); let listRs = undefined;
}); if (!this.$utils.isEmpty(response.data)) {
that.totalLabel = labelArr; listRs = response.data;
let canSelectLabel = []; response.data.map(function (item) {
that.labelList.map(function (i) { item.childName = [];
i.children.map(function (ic) { })
that.totalLabel.map(function (c) { }
if(ic.id == c){ this.labelList = listRs;
canSelectLabel.push(ic); if (this.title == "编辑") {
} let row = this.oneRow;
}) this.getOne(row.id);
}) } else {
}); this.activeName2 = "first";
this.canSelectLabel = canSelectLabel; let tagArr = [];
this.labelList.map(function (iitem) {
if (iitem.children.length > 0) {
tagArr.push(iitem.children[0].id);
}
});
this.form.brand = this.brandlist[0].id;
this.form.number = this.numberList[0].id;
this.labelList.map(function (iitem) {
let p = [];
let pp = [];
let aa = [];
iitem.childNameLists = [];
iitem.children.map(function (c) {
tagArr.map(function (ii) {
if (c.id == ii) {
p.push(c);
aa.push(c.name);
pp.push(c.id);
}
});
});
iitem.childNameList = p;
iitem.childNameLists = pp;
iitem.selectChild = aa.join(",");
});
/**
* 关键标签可选的二级分类
* */
let labelArr = [];
that.labelList.map(function (i) {
i.childNameLists.map(function (ii) {
labelArr.push(ii)
});
});
that.totalLabel = labelArr;
let canSelectLabel = [];
that.labelList.map(function (i) {
i.children.map(function (ic) {
that.totalLabel.map(function (c) {
if (ic.id == c) {
canSelectLabel.push(ic);
}
})
})
});
this.canSelectLabel = canSelectLabel;
this.form.config = tagArr.join(","); this.form.config = tagArr.join(",");
} }
});
},
/**
* 封面图上传进度
* */
uploadProcess(event, file, fileList) {
this.imgFlag = true;
console.log(event.percent);
this.percent = Math.floor(event.percent);
},
/**
* 海报背景图上传进度
* */
uploadPosterProcess(event, file, fileList) {
this.imgPosterFlag = true;
console.log(event.percent);
this.percent_poster = Math.floor(event.percent);
},
/**
* 封面图上传
* **/
handleAvatarSuccess(res, file){
this.percent = 0;
this.imgFlag = false;
this.form.coverPic = res.data;
},
/**
* 海报背景上传
* **/
handlePosterSuccess(res, file){
this.percent_poster = 0;
this.imgPosterFlag = false;
this.form.posterBackground = res.data;
},
/**
* 创建
* */
create(formName){
const set = this.$refs;
set[formName].validate(valid => {
if (valid) {
let params = {
number: this.form.number,//乘卧数量
brand: this.form.brand,//房车品牌
name: this.form.name,//房车名称
config: this.totalLabel.join(","),//房车配置
keyword: this.form.keyword,//房车关键标签
modelsDetails: this.form.modelsDetails,//房车详情
modelParam: JSON.stringify(this.form.modelParam),//房车参数
picture: this.form.picture,//轮播图
coverPic: this.form.coverPic,//封面图
posterBackground: this.form.posterBackground,//海报背景
price: this.form.price,//租车价格
deposit: this.form.deposit,//总押金
vioDeposit: this.form.vioDeposit,
hotSign: this.form.hotSign,//热门车型
rentDiscountStatus: this.form.rentDiscountStatus,//租车优惠状态 0--没有优惠;1--会员折扣;2--固定值
buyPrice: this.form.buyPrice,//购买价格
alt:this.form.alt,//seo 标签优化
intro:this.form.intro
};
if(this.form.rentDiscountStatus == 2){
params.rentDiscountPrice = this.form.pPrice+","+this.form.hPrice+","+this.form.zPrice//租车优惠价格 固定优化价格
}
console.log(params);
console.log(this.form);
addVehicleModel(params).then(response => {
if (response.status === 200) {
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
}); });
this.$emit("oneDialogEvent", true); },
} else { /**
this.$notify({ * 封面图上传进度
title: '创建失败', * */
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!', uploadProcess(event, file, fileList) {
type: 'error', this.imgFlag = true;
duration: 2000 console.log(event.percent);
this.percent = Math.floor(event.percent);
},
/**
* 海报背景图上传进度
* */
uploadPosterProcess(event, file, fileList) {
this.imgPosterFlag = true;
console.log(event.percent);
this.percent_poster = Math.floor(event.percent);
},
/**
* 封面图上传
* **/
handleAvatarSuccess(res, file) {
this.percent = 0;
this.imgFlag = false;
this.form.coverPic = res.data;
},
/**
* 海报背景上传
* **/
handlePosterSuccess(res, file) {
this.percent_poster = 0;
this.imgPosterFlag = false;
this.form.posterBackground = res.data;
},
/**
* 创建
* */
create(formName) {
const set = this.$refs;
set[formName].validate(valid => {
if (valid) {
let params = {
number: this.form.number,//乘卧数量
brand: this.form.brand,//房车品牌
name: this.form.name,//房车名称
config: this.totalLabel.join(","),//房车配置
keyword: this.form.keyword,//房车关键标签
modelsDetails: this.form.modelsDetails,//房车详情
modelParam: JSON.stringify(this.form.modelParam),//房车参数
picture: this.form.picture,//轮播图
coverPic: this.form.coverPic,//封面图
posterBackground: this.form.posterBackground,//海报背景
price: this.form.price,//租车价格
deposit: this.form.deposit,//总押金
vioDeposit: this.form.vioDeposit,
hotSign: this.form.hotSign,//热门车型
rentDiscountStatus: this.form.rentDiscountStatus,//租车优惠状态 0--没有优惠;1--会员折扣;2--固定值
buyPrice: this.form.buyPrice,//购买价格
alt: this.form.alt,//seo 标签优化
intro: this.form.intro,
imgTitle: this.form.imgTitle,
imgKeyword: this.form.imgKeyword,
imgDesc: this.form.imgDesc,
};
if (this.form.rentDiscountStatus == 2) {
params.rentDiscountPrice = this.form.pPrice + "," + this.form.hPrice + "," + this.form.zPrice//租车优惠价格 固定优化价格
}
console.log(params);
console.log(this.form);
addVehicleModel(params).then(response => {
if (response.status === 200) {
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
});
this.$emit("oneDialogEvent", true);
} else {
this.$notify({
title: '创建失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
} else {
return;
}
}); });
} },
}); /**
} else { * 编辑
return; * */
} update(formName) {
}); const set = this.$refs;
}, set[formName].validate(valid => {
/** if (valid) {
* 编辑 let params = {
* */ id: this.form.id,
update(formName){ number: this.form.number,//乘卧数量
const set = this.$refs; brand: this.form.brand,//房车品牌
set[formName].validate(valid => { name: this.form.name,//房车名称
if (valid) { config: this.totalLabel.join(","),//房车配置
let params = { keyword: this.form.keyword,//房车关键标签
id: this.form.id, modelsDetails: this.form.modelsDetails,//房车详情
number: this.form.number,//乘卧数量 modelParam: JSON.stringify(this.form.modelParam),//房车参数
brand: this.form.brand,//房车品牌 picture: this.form.picture,//轮播图
name: this.form.name,//房车名称 price: this.form.price,//租车价格
config: this.totalLabel.join(","),//房车配置 coverPic: this.form.coverPic,//封面图
keyword: this.form.keyword,//房车关键标签 posterBackground: this.form.posterBackground,//海报背景
modelsDetails: this.form.modelsDetails,//房车详情 deposit: this.form.deposit,//总押金
modelParam: JSON.stringify(this.form.modelParam),//房车参数 vioDeposit: this.form.vioDeposit,
picture: this.form.picture,//轮播图 hotSign: this.form.hotSign,//热门车型
price: this.form.price,//租车价格 rentDiscountStatus: this.form.rentDiscountStatus,//租车优惠状态 0--没有优惠;1--会员折扣;2--固定值
coverPic: this.form.coverPic,//封面图
posterBackground: this.form.posterBackground,//海报背景
deposit: this.form.deposit,//总押金
vioDeposit: this.form.vioDeposit,
hotSign: this.form.hotSign,//热门车型
rentDiscountStatus: this.form.rentDiscountStatus,//租车优惠状态 0--没有优惠;1--会员折扣;2--固定值
// rentDiscountPrice:this.form.pPrice+","+this.form.hPrice+","+this.form.zPrice,//租车优惠价格 固定优化价格 // rentDiscountPrice:this.form.pPrice+","+this.form.hPrice+","+this.form.zPrice,//租车优惠价格 固定优化价格
buyPrice: this.form.buyPrice,//购买价格 buyPrice: this.form.buyPrice,//购买价格
alt:this.form.alt,//seo 标签优化 alt: this.form.alt,//seo 标签优化
intro:this.form.intro intro: this.form.intro,
}; imgTitle: this.form.imgTitle,
if(this.form.rentDiscountStatus == 2){ imgKeyword: this.form.imgKeyword,
params.rentDiscountPrice = this.form.pPrice+","+this.form.hPrice+","+this.form.zPrice//租车优惠价格 固定优化价格 imgDesc: this.form.imgDesc
} };
console.log(params); if (this.form.rentDiscountStatus == 2) {
console.log(this.form); params.rentDiscountPrice = this.form.pPrice + "," + this.form.hPrice + "," + this.form.zPrice//租车优惠价格 固定优化价格
updateVehicleModel(params).then(response => { }
if (response.status === 200) { console.log(params);
this.$notify({ console.log(this.form);
title: '成功', updateVehicleModel(params).then(response => {
message: '编辑成功', if (response.status === 200) {
type: 'success', this.$notify({
duration: 2000 title: '成功',
message: '编辑成功',
type: 'success',
duration: 2000
});
this.$emit("oneDialogEvent", true);
} else {
this.$notify({
title: '编辑失败',
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
type: 'error',
duration: 2000
});
}
});
} else {
return;
}
}); });
this.$emit("oneDialogEvent", true); },
} else { /**
this.$notify({ * 关闭编辑车型
title: '编辑失败', */
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!', cancel() {
type: 'error', this.cleanForm();
duration: 2000 this.$emit("oneDialogEvent", false);
},
/**
* 编辑关键标签
* */
editLabe() {
this.keywordDialogVisible = true;
},
/**
* 删除房车参数
* */
delModelParam(index) {
this.form.modelParam.splice(index, 1);
},
/**
* 添加房车参数
* */
addModelParam() {
console.log(this.form.modelParam);
let c = {
key: "",
val: ""
};
this.form.modelParam.push(c);
},
/**
* 关闭关键标签配置
* */
cancelHandelLabel() {
this.keywordDialogVisible = false;
},
/**
* 更新关键标签
* */
updateLabel() {
let that = this;
this.keywordDialogVisible = false;
console.log(this.selectedLabel);
let a = [];
that.labelList.map(function (i) {
i.children.map(function (cc) {
that.selectedLabel.map(function (ii) {
if (ii == cc.id) {
a.push(cc.name);
}
})
});
}); });
} that.form.keyword = a.join(",");
}); },
} else { /**
return; * 关闭房车配置弹框
} * */
}); cancelHandel() {
}, this.configDialogVisible = false;
/** },
* 关闭编辑车型 /**
*/ * 更新房车配置弹框
cancel(){ * **/
this.cleanForm(); updateConfig() {
this.$emit("oneDialogEvent", false); let that = this;
}, this.configDialogVisible = false;
/** if (this.configItem.parent.isMore == 0) {
* 编辑关键标签 //单选
* */ console.log(this.childName);
editLabe(){ that.labelList.map(function (i) {
this.keywordDialogVisible = true; if (i.parent.id == that.configItem.parent.id) {
}, i.children.map(function (ic) {
/** if (ic.id == that.childName) {
* 删除房车参数 i.selectChild = ic.name;
* */ let a = [];
delModelParam(index){ i.childNameLists[0] = that.childName;
this.form.modelParam.splice(index, 1); }
}, })
/** }
* 添加房车参数 });
* */ console.log(that.labelList);
addModelParam(){ } else {
console.log(this.form.modelParam); if (this.childNameLists.length <= 0) {
let c = { return;
key: "", }
val:"" //多选
}; console.log(this.childNameLists);
this.form.modelParam.push(c); that.labelList.map(function (i) {
}, let a = [];
/** if (i.parent.id == that.configItem.parent.id) {
* 关闭关键标签配置 i.children.map(function (ic) {
* */ that.childNameLists.map(function (cc) {
cancelHandelLabel(){ if (cc == ic.id) {
this.keywordDialogVisible = false; a.push(ic.name);
}, }
/** });
* 更新关键标签 i.selectChild = a.join(",");
* */ i.childNameLists = that.childNameLists;
updateLabel(){ })
let that = this; }
this.keywordDialogVisible = false; });
console.log(this.selectedLabel);
let a = [];
that.labelList.map(function (i) {
i.children.map(function (cc) {
that.selectedLabel.map(function (ii) {
if (ii == cc.id) {
a.push(cc.name);
}
})
});
});
that.form.keyword = a.join(",");
},
/**
* 关闭房车配置弹框
* */
cancelHandel(){
this.configDialogVisible = false;
},
/**
* 更新房车配置弹框
* **/
updateConfig(){
let that = this;
this.configDialogVisible = false;
if(this.configItem.parent.isMore == 0){
//单选
console.log(this.childName);
that.labelList.map(function (i) {
if(i.parent.id == that.configItem.parent.id){
i.children.map(function (ic) {
if(ic.id == that.childName){
i.selectChild = ic.name;
let a = [];
i.childNameLists[0] = that.childName;
} }
}) let labelArr = [];
} let labelStr = that.form.keyword.split(",");
}); that.labelList.map(function (i) {
console.log(that.labelList); i.childNameLists.map(function (ii) {
} else{ labelArr.push(ii)
if(this.childNameLists.length<=0){ });
return;
}
//多选
console.log(this.childNameLists);
that.labelList.map(function (i) {
let a = [];
if(i.parent.id == that.configItem.parent.id){
i.children.map(function (ic) {
that.childNameLists.map(function (cc) {
if(cc == ic.id){
a.push(ic.name);
}
});
i.selectChild = a.join(",");
i.childNameLists = that.childNameLists;
})
}
});
}
let labelArr = [];
let labelStr = that.form.keyword.split(",");
that.labelList.map(function (i) {
i.childNameLists.map(function (ii) {
labelArr.push(ii)
});
// let c = i.selectChild.split(","); // let c = i.selectChild.split(",");
// c.map(function (cc) { // c.map(function (cc) {
// labelStr.push(cc); // labelStr.push(cc);
// }) // })
}); });
this.totalLabel = labelArr;//房车配置选中的全部标签id this.totalLabel = labelArr;//房车配置选中的全部标签id
// that.form.keyword = labelStr.join(","); // that.form.keyword = labelStr.join(",");
that.form.keyword = "";// 改变房车配置时,清空关键标签显示的文字 that.form.keyword = "";// 改变房车配置时,清空关键标签显示的文字
that.selectedLabel = [];// 改变房车配置时,清空关键标签选中的id that.selectedLabel = [];// 改变房车配置时,清空关键标签选中的id
let canSelectLabel = []; let canSelectLabel = [];
that.labelList.map(function (i) { that.labelList.map(function (i) {
i.children.map(function (ic) { i.children.map(function (ic) {
that.totalLabel.map(function (c) { that.totalLabel.map(function (c) {
if(ic.id == c){ if (ic.id == c) {
canSelectLabel.push(ic); canSelectLabel.push(ic);
} }
}) })
}) })
}); });
this.canSelectLabel = canSelectLabel;//房车配置选中的全部标签,供关键标签选择使用 this.canSelectLabel = canSelectLabel;//房车配置选中的全部标签,供关键标签选择使用
console.log(this.canSelectLabel); console.log(this.canSelectLabel);
console.log(this.totalLabel); console.log(this.totalLabel);
console.log(that.form.keyword); console.log(that.form.keyword);
}, },
/** /**
* editConfig * editConfig
* */ * */
editConfig(item){ editConfig(item) {
this.configDialogVisible = true; this.configDialogVisible = true;
this.childNameLists = []; this.childNameLists = [];
this.childName = undefined; this.childName = undefined;
this.modalTitle = item.parent.name; this.modalTitle = item.parent.name;
item.childNameList.map(function(ii){ item.childNameList.map(function (ii) {
ii.showName = ii.id; ii.showName = ii.id;
}); });
this.configItem = item;//待编辑配置信息 this.configItem = item;//待编辑配置信息
this.configItemChildren = item.children;//待配置的二级标签 this.configItemChildren = item.children;//待配置的二级标签
this.childNameLists = item.childNameLists; this.childNameLists = item.childNameLists;
this.childName = item.childNameLists[0]; this.childName = item.childNameLists[0];
console.log(item); console.log(item);
}, },
/** /**
* 获取一条车型数据 * 获取一条车型数据
* */ * */
getOne(id){ getOne(id) {
let that = this; let that = this;
getOneTypeById(id).then(response => { getOneTypeById(id).then(response => {
let item = response.data; let item = response.data;
let pic = item.picture.split(","); let pic = item.picture.split(",");
//轮播 //轮播
let fileList2 = []; let fileList2 = [];
pic.map(function(pp){ pic.map(function (pp) {
let p = { let p = {
url: pp url: pp
}; };
fileList2.push(p); fileList2.push(p);
}); });
this.fileList2 = fileList2; this.fileList2 = fileList2;
let yhPrice = item.rentDiscountPrice?item.rentDiscountPrice.split(","):[]; let yhPrice = item.rentDiscountPrice ? item.rentDiscountPrice.split(",") : [];
if(item.rentDiscountPrice) { if (item.rentDiscountPrice) {
item.pPrice = yhPrice.length>=1?parseInt(yhPrice[0]):0; item.pPrice = yhPrice.length >= 1 ? parseInt(yhPrice[0]) : 0;
item.hPrice = yhPrice.length>=2?parseInt(yhPrice[1]):0; item.hPrice = yhPrice.length >= 2 ? parseInt(yhPrice[1]) : 0;
item.zPrice = yhPrice.length>=3?parseInt(yhPrice[2]):0; item.zPrice = yhPrice.length >= 3 ? parseInt(yhPrice[2]) : 0;
} }
item.rentDiscountStatus = item.rentDiscountStatus+""; item.rentDiscountStatus = item.rentDiscountStatus + "";
item.hotSign = item.hotSign+""; item.hotSign = item.hotSign + "";
item.brand = item.brand*1; item.brand = item.brand * 1;
item.number = item.number*1; item.number = item.number * 1;
item.modelParam = JSON.parse(item.modelParam); item.modelParam = JSON.parse(item.modelParam);
let tagArr = response.data.config.split(","); let tagArr = response.data.config.split(",");
this.labelList.map(function(iitem){ this.labelList.map(function (iitem) {
let p = []; let p = [];
let pp = []; let pp = [];
let aa = []; let aa = [];
iitem.childNameLists =[]; iitem.childNameLists = [];
iitem.children.map(function (c) { iitem.children.map(function (c) {
tagArr.map(function (ii) { tagArr.map(function (ii) {
if(c.id == ii){ if (c.id == ii) {
p.push(c); p.push(c);
aa.push(c.name); aa.push(c.name);
pp.push(c.id); pp.push(c.id);
}
});
});
iitem.childNameList = p;
iitem.childNameLists = pp;
iitem.selectChild = aa.join(",");
});
/**
* 关键标签可选的二级分类
* */
let labelArr = [];
that.labelList.map(function (i) {
i.childNameLists.map(function (ii) {
labelArr.push(ii)
});
});
that.totalLabel = labelArr;
let canSelectLabel = [];
that.labelList.map(function (i) {
i.children.map(function (ic) {
that.totalLabel.map(function (c) {
if (ic.id == c) {
canSelectLabel.push(ic);
}
})
})
});
this.canSelectLabel = canSelectLabel;
response.data.hotSign = response.data.hotSign ? response.data.hotSign : "2";
this.form = response.data;
this.activeName2 = "first";
})
},
/**
* 深拷贝
*/
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;
}); },
iitem.childNameList = p; querySearch(queryString, cb) {
iitem.childNameLists = pp; let selectArry = [];
iitem.selectChild = aa.join(","); this.allCompaniesArr.map(function (item) {
}); item.value = item.name;
/** selectArry.push(item);
* 关键标签可选的二级分类 });
* */ this.selectArry = selectArry;
let labelArr = []; var results = queryString ? selectArry.filter(this.createFilter(queryString)) : selectArry;
that.labelList.map(function (i) { // 调用 callback 返回建议列表的数据
i.childNameLists.map(function (ii) { cb(results);
labelArr.push(ii) },
}); /**
}); * 富文本内容
that.totalLabel = labelArr; * @param step
let canSelectLabel = []; */
that.labelList.map(function (i) { editorReadyEvent(instance) {
i.children.map(function (ic) { let t = this;
that.totalLabel.map(function (c) { instance.addListener('contentChange', () => {
if(ic.id == c){ t.form.modelsDetails = instance.getContent();
canSelectLabel.push(ic); });
},
/**
* 删除banner
* */
handleRemove(file, fileList) {
let list = [];
fileList.map(function (item) {
if (item.url != file.url) {
list.push(item);
}
});
this.fileList2 = list;
let arr = [];
let picture = this.form.picture.split(",");
picture.map(function (item) {
if (item != file.url) {
arr.push(item);
}
});
this.form.picture = arr.join(",");
},
/**
* banner上传
* */
handleBannerSuccess(res, file) {
this.fileList2.push({url: res.data});
let c = [];
this.fileList2.map(function (i) {
c.push(i.url);
});
this.form.picture = c.join(",");
},
/**
* 清空旅游弹框数据
*/
cleanForm() {
this.activeName2 = "";
this.form = {
name: undefined,//房车名称
config: "",//房车配置
keyword: "",//房车关键标签
modelsDetails: "",//房车详情
modelParam: [],//房车参数
picture: "",//轮播图
price: 0,//租车价格
deposit: 20000,//总押金
vioDeposit: 0,//违章押金
hotSign: "2",//热门车型 1、热门 2、非热门
rentDiscountStatus: "0",//租车优惠状态 0--没有优惠;1--会员折扣;2--固定值
rentDiscountPrice: "",//租车优惠价格 固定优化价格
buyPrice: 0,//购买价格
posterBackground: '',//海报背景
alt: '',
imgTitle: undefined,
imgKeyword: undefined,
imgDesc: undefined,
} }
}) }
})
});
this.canSelectLabel = canSelectLabel;
response.data.hotSign = response.data.hotSign? response.data.hotSign: "2";
this.form = response.data;
this.activeName2 = "first";
})
},
/**
* 深拷贝
*/
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;
},
querySearch(queryString, cb) {
let selectArry = [];
this.allCompaniesArr.map(function(item){
item.value = item.name;
selectArry.push(item);
});
this.selectArry = selectArry;
var results = queryString ? selectArry.filter(this.createFilter(queryString)) : selectArry;
// 调用 callback 返回建议列表的数据
cb(results);
},
/**
* 富文本内容
* @param step
*/
editorReadyEvent(instance){
let t = this;
instance.addListener('contentChange', () => {
t.form.modelsDetails = instance.getContent();
});
},
/**
* 删除banner
* */
handleRemove(file, fileList){
let list = [];
fileList.map(function(item){
if(item.url != file.url){
list.push(item);
}
});
this.fileList2 = list;
let arr = [];
let picture = this.form.picture.split(",");
picture.map(function(item){
if(item != file.url){
arr.push(item);
}
});
this.form.picture = arr.join(",");
},
/**
* banner上传
* */
handleBannerSuccess(res, file){
this.fileList2.push({url: res.data});
let c = [];
this.fileList2.map(function (i) {
c.push(i.url);
});
this.form.picture = c.join(",");
},
/**
* 清空旅游弹框数据
*/
cleanForm() {
this.activeName2 = "";
this.form = {
name: undefined,//房车名称
config: "",//房车配置
keyword: "",//房车关键标签
modelsDetails: "",//房车详情
modelParam: [],//房车参数
picture: "",//轮播图
price: 0,//租车价格
deposit: 20000,//总押金
vioDeposit: 0,//违章押金
hotSign: "2",//热门车型 1、热门 2、非热门
rentDiscountStatus:"0",//租车优惠状态 0--没有优惠;1--会员折扣;2--固定值
rentDiscountPrice: "",//租车优惠价格 固定优化价格
buyPrice: 0,//购买价格
posterBackground:'',//海报背景
alt:'',
} }
}
} }
}
</script> </script>
<style> <style>
.flex-aic{ .flex-aic {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.left-item{ .left-item {
width: 300px; width: 300px;
border-left: 1px solid #999; border-left: 1px solid #999;
border-right: 1px solid #999; border-right: 1px solid #999;
border-bottom: 1px solid #999; border-bottom: 1px solid #999;
padding: 3px; padding: 3px;
} }
.right-item{
width:400px; .right-item {
width: 400px;
border-right: 1px solid #999; border-right: 1px solid #999;
border-bottom: 1px solid #999; border-bottom: 1px solid #999;
padding: 3px; padding: 3px;
......
<template> <template>
<!-- 营地:创建、编辑 --> <!-- 营地:创建、编辑 -->
<div class = "activity"> <div class="activity">
<h4>{{title}}</h4> <h4>{{title}}</h4>
<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>
...@@ -10,97 +10,125 @@ ...@@ -10,97 +10,125 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="副标题" prop="subtitle"> <el-form-item label="副标题" prop="subtitle">
<el-input v-model="form.subtitle" placeholder="请输入活动副标题"></el-input> <el-input v-model="form.subtitle" placeholder="请输入活动副标题"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-form-item label="活动主图" :style="{display:'block'}" prop="banner"> <el-form-item label="活动主图" :style="{display:'block'}" prop="banner">
<el-upload <el-upload
class="upload-demo" class="upload-demo"
:headers="getHeaderWithToken" :headers="getHeaderWithToken"
:action="BASE_API+'/api/universal/file/app/unauth/admin/upload'" :action="BASE_API+'/api/universal/file/app/unauth/admin/upload'"
:show-file-list="false" :show-file-list="false"
:on-success="handleAvatarSuccess" :on-success="handleAvatarSuccess"
list-type="picture"> list-type="picture">
<div slot="tip" class="el-upload__tip"><span style="color: red;">建议尺寸:485*485px</span></div> <div slot="tip" class="el-upload__tip"><span style="color: red;">建议尺寸:485*485px</span></div>
<img v-if="$utils.isString(form.banner) && !$utils.isEmpty(form.banner)" :src="form.banner" style="width:300px;max-height:300px;"> <img v-if="$utils.isString(form.banner) && !$utils.isEmpty(form.banner)" :src="form.banner"
<i v-else class="el-icon-plus avatar-uploader-icon" style="lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"></i> style="width:300px;max-height:300px;">
</el-upload> <i v-else class="el-icon-plus avatar-uploader-icon"
</el-form-item> style="lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"></i>
</el-upload>
</el-form-item>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="alt"> <el-form-item label="alt">
<el-input v-model="form.alt" type="text" placeholder="请输入描述"></el-input> <el-input v-model="form.alt" type="text" placeholder="请输入替代文本"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="img-title">
<el-input v-model="form.imgTitle" type="text" placeholder="请输入图片title"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="img-keyword">
<el-input v-model="form.imgKeyword" type="text" placeholder="请输入图片关键字"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="img-desc">
<el-input v-model="form.imgDesc" type="text" placeholder="请输入图片描述"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="总人数" prop="limitNum">
<el-input v-model="form.limitNum" placeholder="请输入总人数" type="number" :maxlength=8></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="开始时间" prop="startTime">
<el-date-picker v-model="form.startTime" type="datetime" :editable="true" format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="结束时间" prop="endTime">
<el-date-picker v-model="form.endTime" type="datetime" :editable="true" format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="报名时间" prop="regCloseTime">
<el-date-picker v-model="form.regCloseTime" type="datetime" :editable="true" format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="活动说明" prop="actDesc">
<el-input v-model="form.actDesc" placeholder="请输入活动说明"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="排序" prop="rank">
<el-input v-model="form.rank" placeholder="请输入活动说明" type="number" :maxlength=11></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row>
<el-col :span="8">
<el-form-item label="总人数" prop="limitNum">
<el-input v-model="form.limitNum" placeholder="请输入总人数" type="number" :maxlength=8></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="开始时间" prop="startTime"> <el-form-item label="活动地址" prop="address">
<el-date-picker v-model="form.startTime" type="datetime" :editable="true" format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期"></el-date-picker> <el-input v-model="form.addressStr" readonly placeholder="请输入活动地址" :on-icon-click="selectDestination"
</el-form-item> icon="edit"></el-input>
</el-col> </el-form-item>
<el-col :span="8"> </el-col>
<el-form-item label="结束时间" prop="endTime"> </el-row>
<el-date-picker v-model="form.endTime" type="datetime" :editable="true" format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期"></el-date-picker> <el-row>
</el-form-item> <el-col :span="8">
</el-col> <el-form-item label="活动位置">
<el-select class="filter-item" v-model="form.location" placeholder="请选择状态">
<el-option :key="0" label="无限制" :value="0"></el-option>
<el-option :key="1" label="欣欣官网" :value="1"></el-option>
<el-option :key="2" label="滴房车官网" :value="2"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row> </el-row>
<el-row>
<el-col :span="8">
<el-form-item label="报名时间" prop="regCloseTime">
<el-date-picker v-model="form.regCloseTime" type="datetime" :editable="true" format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="活动说明" prop="actDesc">
<el-input v-model="form.actDesc" placeholder="请输入活动说明"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="排序" prop="rank">
<el-input v-model="form.rank" placeholder="请输入活动说明" type="number" :maxlength=11></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="活动地址" prop="address">
<el-input v-model="form.addressStr" readonly placeholder="请输入活动地址" :on-icon-click="selectDestination" icon="edit"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="活动位置">
<el-select class="filter-item" v-model="form.location" placeholder="请选择状态">
<el-option :key="0" label="无限制" :value="0"></el-option>
<el-option :key="1" label="欣欣官网" :value="1"></el-option>
<el-option :key="2" label="滴房车官网" :value="2"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<!--BASE_API + --> <!--BASE_API + -->
<el-tabs v-model="activeName2" type="card" @tab-click="handleClick"> <el-tabs v-model="activeName2" type="card" @tab-click="handleClick">
<el-tab-pane label="活动图文内容" name="first"> <el-tab-pane label="活动图文内容" name="first">
<!--<Editor v-if="activeName2=='first'" @input="handelContentIncrease" :value="form.content" :myQuillEditor="'myQuillEditorContent'" :activeName2="activeName2"></Editor>--> <!--<Editor v-if="activeName2=='first'" @input="handelContentIncrease" :value="form.content" :myQuillEditor="'myQuillEditorContent'" :activeName2="activeName2"></Editor>-->
<div class="editor-container" v-if="activeName2=='first'"> <div class="editor-container" v-if="activeName2=='first'">
<UE :editorId="activeName2" :defaultMsg="form.content" :config=config ref="ue" @ready="editorReadyEvent"></UE> <UE :editorId="activeName2" :defaultMsg="form.content" :config=config ref="ue"
@ready="editorReadyEvent"></UE>
</div> </div>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
...@@ -108,529 +136,549 @@ ...@@ -108,529 +136,549 @@
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="cancel">取 消</el-button> <el-button @click="cancel">取 消</el-button>
<el-button type="primary" v-if="title=='创建' && !isCreate && campsiteshop_btn_update" @click="create('form')">确 定</el-button> <el-button type="primary" v-if="title=='创建' && !isCreate && campsiteshop_btn_update" @click="create('form')">确 定
<el-button type="primary" v-if="title=='编辑' && !isCreate && campsiteshop_btn_update" @click="update('form')">确 定</el-button> </el-button>
<el-button type="primary" v-if="title=='编辑' && !isCreate && campsiteshop_btn_update" @click="update('form')">确 定
</el-button>
</div> </div>
<!--编辑营地地址--> <!--编辑营地地址-->
<campsiteModal v-if="showCampsiteVisible && campsiteshop_btn_update" :obj="campsiteObj" v-on:campsiteEvent = "campsiteEvent"></campsiteModal> <campsiteModal v-if="showCampsiteVisible && campsiteshop_btn_update" :obj="campsiteObj"
v-on:campsiteEvent="campsiteEvent"></campsiteModal>
<!--编辑营地标签--> <!--编辑营地标签-->
<campsiteLabelModal v-if="editLableVisible && campsiteshop_btn_update" :allLabelList="allLabelList" :checkList="checkList" v-on:tourLabelEvent = "tourLabelEvent"></campsiteLabelModal> <campsiteLabelModal v-if="editLableVisible && campsiteshop_btn_update" :allLabelList="allLabelList"
:checkList="checkList" v-on:tourLabelEvent="tourLabelEvent"></campsiteLabelModal>
</div> </div>
</template> </template>
<style> <style>
textarea{ textarea {
display: none; display: none;
} }
.info{
.info {
border-radius: 10px; border-radius: 10px;
line-height: 20px; line-height: 20px;
padding: 10px; padding: 10px;
margin: 10px; margin: 10px;
background-color: #ffffff; background-color: #ffffff;
} }
.el-upload-list{
.el-upload-list {
display: flex; display: flex;
width: 100px; width: 100px;
} }
.el-upload-list li{
.el-upload-list li {
margin-left: 10px; margin-left: 10px;
} }
</style> </style>
<script> <script>
// import Editor from "../../modal/editorTool";//富文本 // import Editor from "../../modal/editorTool";//富文本
import UE from '../../modal/Ueditor';//百度ue富文本 import UE from '../../modal/Ueditor';//百度ue富文本
import campsiteLabelModal from "../../tourManage/modal/tourLabelModal";//标签 import campsiteLabelModal from "../../tourManage/modal/tourLabelModal";//标签
import campsiteModal from "./campsiteModal";//营地地址 import campsiteModal from "./campsiteModal";//营地地址
import { import {
getOneCampsiteShop, getOneCampsiteShop,
campsiteAllTagList, campsiteAllTagList,
editCampsiteShop, editCampsiteShop,
addCampsiteShop, addCampsiteShop,
existCampsiteShop existCampsiteShop
} from 'api/campsiteManage'; } from 'api/campsiteManage';
import { import {
getOneActivityShop, getOneActivityShop,
editActivity editActivity
} from 'api/officialWebsit/activity'; } from 'api/officialWebsit/activity';
import { import {
getSonRegionByCodes, getSonRegionByCodes,
getRegionByCodes, getRegionByCodes,
} from 'api/base_info/region/'; } from 'api/base_info/region/';
import rsCode from '../../../utils/rsCode'; import rsCode from '../../../utils/rsCode';
import { import {
getToken getToken
} from '../../../utils/auth'; } from '../../../utils/auth';
import {mapGetters} from 'vuex'; import {mapGetters} from 'vuex';
export default {
props: ["oneRow", "title", "campsiteshop_btn_update"], export default {
name: 'upkeepDialog', props: ["oneRow", "title", "campsiteshop_btn_update"],
components: { name: 'upkeepDialog',
UE, components: {
campsiteModal, UE,
campsiteLabelModal campsiteModal,
}, campsiteLabelModal
data() { },
var checkPhone = (rule, value, callback) => { data() {
if (!value) { var checkPhone = (rule, value, callback) => {
return callback(new Error('手机号不能为空')); if (!value) {
} else { return callback(new Error('手机号不能为空'));
const reg = /^[1](([3][0-9])|([4][5,7,9])|([5][0-9])|([6][6])|([7][1,2,3,5,6,7,8])|([8][0-9])|([9][1,8,9]))[0-9]{8}$/ } else {
console.log(reg.test(value)); const reg = /^[1](([3][0-9])|([4][5,7,9])|([5][0-9])|([6][6])|([7][1,2,3,5,6,7,8])|([8][0-9])|([9][1,8,9]))[0-9]{8}$/
if (reg.test(value)) { console.log(reg.test(value));
callback(); if (reg.test(value)) {
} else { callback();
return callback(new Error('请输入正确的手机号')); } else {
} return callback(new Error('请输入正确的手机号'));
} }
}; }
return { };
imgPosterFlag:false, return {
percent_poster:0, imgPosterFlag: false,
BASE_API: process.env.BASE_API, percent_poster: 0,
defaultMsg: '这里是UE测试', BASE_API: process.env.BASE_API,
config: { defaultMsg: '这里是UE测试',
initialFrameWidth: null, config: {
initialFrameHeight: 350 initialFrameWidth: null,
initialFrameHeight: 350
},
isExist: false,//名称是否已存在
campsiteObj: {},//营地地址
departureList: [],//出发地列表
departureObj: {name: ""},//出发地
pathway: [],//途径地
isCreate: false,//是否点击了创建-确定
fileList2: [],
activeName2: '',//行程亮点
form: {
alt: undefined,
imgTitle: undefined,
imgKeyword: undefined,
imgDesc: undefined,
id: undefined,
title: undefined,//营地名称
subtitle: undefined,//营地热度
startTime: undefined,//客服电话
endTime: undefined,//联系电话
regCloseTime: undefined,//省份
provinceCode: undefined,//省份名称
province: undefined,//市编号
cityName: undefined,//市名称
cityCode: undefined,//详细地址
city: undefined,
townCode: undefined,
town: undefined,
address: undefined,
latitude: undefined,
longitude: undefined,
limitNum: 0,
isShow: 0,
isOpenReg: 0,
isDel: 0,
isPublish: 0,
isHomePage: 0,
crtUser: undefined,
crtName: undefined,
crtTime: undefined,
actDesc: undefined,
willNum: undefined,
location: 0,
rank: 0,
type: undefined,
banner: undefined,
content: '',//营地详情
concat: "",//联系人
logo: undefined,//封面图
configure: '',//配套&收费
campsiteTagListVos: [],//营地类型
carouse: [],//banner轮播
posterBackground: '',//海报背景
},
showCampsiteVisible: false,//编辑营地地址
rules: {
name: {
type: 'string',
required: true,
message: '请输入营地名称',
trigger: 'blur'
},
servicePhone: {
type: 'string',
required: true,
message: '请输入客服电话',
trigger: 'blur'
},
phone: {validator: checkPhone, trigger: 'blur', required: true},
concat: {
type: 'string',
required: true,
message: '请输入联系人',
trigger: 'blur'
},
addressStr: {
type: 'string',
required: true,
message: '请输入活动地址',
}
},
checkList: [],//已选中的标签
allCompanies: {},
allCompaniesArr: [],
oneTourDialogVisible: false,
editLableVisible: false,//营地标签
allLabelList: [],//全部营地标签
}
}, },
isExist:false,//名称是否已存在 created() {
campsiteObj: {},//营地地址
departureList: [],//出发地列表
departureObj:{name: ""},//出发地
pathway: [],//途径地
isCreate: false,//是否点击了创建-确定
fileList2:[],
activeName2: '',//行程亮点
form: {
alt:undefined,
id: undefined,
title: undefined,//营地名称
subtitle: undefined,//营地热度
startTime: undefined,//客服电话
endTime: undefined,//联系电话
regCloseTime: undefined,//省份
provinceCode: undefined,//省份名称
province: undefined,//市编号
cityName: undefined,//市名称
cityCode: undefined,//详细地址
city:undefined,
townCode:undefined,
town:undefined,
address:undefined,
latitude: undefined,
longitude: undefined,
limitNum:0,
isShow:0,
isOpenReg:0,
isDel:0,
isPublish:0,
isHomePage:0,
crtUser:undefined,
crtName:undefined,
crtTime:undefined,
actDesc:undefined,
willNum:undefined,
location:0,
rank:0,
type:undefined,
banner:undefined,
content: '',//营地详情
concat: "",//联系人
logo:undefined,//封面图
configure: '',//配套&收费
campsiteTagListVos: [],//营地类型
carouse:[],//banner轮播
posterBackground:'',//海报背景
}, },
showCampsiteVisible: false,//编辑营地地址 watch: {
rules: { oneTourDialogVisible(newValue, oldValue) {
name:{ if (!newValue) {
type: 'string', this.cleanForm();
required: true, }
message: '请输入营地名称',
trigger: 'blur'
}, },
servicePhone:{
type: 'string',
required: true,
message: '请输入客服电话',
trigger: 'blur'
},
phone:{validator: checkPhone, trigger: 'blur',required: true},
concat:{
type: 'string',
required: true,
message: '请输入联系人',
trigger: 'blur'
},
addressStr:{
type: 'string',
required: true,
message: '请输入活动地址',
}
}, },
checkList:[],//已选中的标签 mounted() {
allCompanies: {}, this.cleanForm();
allCompaniesArr: [], if (this.title == "编辑") {
oneTourDialogVisible: false, let row = this.oneRow;
editLableVisible: false,//营地标签 this.getOne(row.id);
allLabelList: [],//全部营地标签 } else {
} this.activeName2 = "first";
}, }
created() { this.oneTourDialogVisible = true;
}, },
watch: { computed: {
oneTourDialogVisible(newValue, oldValue){ getHeaderWithToken() {
if(!newValue){ return {Authorization: getToken()};
this.cleanForm(); },
} },
}, methods: {
}, handleClick(tab, event) {
mounted() { console.log(tab, event);
this.cleanForm(); },
if(this.title == "编辑"){
let row = this.oneRow;
this.getOne(row.id);
} else {
this.activeName2 = "first";
}
this.oneTourDialogVisible = true;
},
computed: {
getHeaderWithToken() {
return {Authorization: getToken()};
},
},
methods: {
handleClick(tab, event) {
console.log(tab, event);
},
handleChange(id) { handleChange(id) {
console.log(id) console.log(id)
}, },
/** /**
* 编辑营地标签 * 编辑营地标签
* */ * */
editLable(list){ editLable(list) {
console.log(list); console.log(list);
this.editLableVisible = true; this.editLableVisible = true;
}, },
isExistCampsiteShop(type, datas){ isExistCampsiteShop(type, datas) {
console.log(datas) console.log(datas)
if(type == "update"){//编辑 if (type == "update") {//编辑
this.toUpdate(datas); this.toUpdate(datas);
} }
if(type == "create"){ if (type == "create") {
//创建 //创建
this.toCreate(datas); this.toCreate(datas);
} }
}, },
/** /**
* 创建 * 创建
* */ * */
create(formName){ create(formName) {
const set = this.$refs; const set = this.$refs;
if(this.form.startTime && (typeof this.form.startTime == "object")){ if (this.form.startTime && (typeof this.form.startTime == "object")) {
this.form.startTime = this.form.startTime.getTime(); this.form.startTime = this.form.startTime.getTime();
} }
if(this.form.endTime && (typeof this.form.endTime == "object")){ if (this.form.endTime && (typeof this.form.endTime == "object")) {
this.form.endTime = this.form.endTime.getTime(); this.form.endTime = this.form.endTime.getTime();
} }
if(this.form.regCloseTime && (typeof this.form.regCloseTime == "object")){ if (this.form.regCloseTime && (typeof this.form.regCloseTime == "object")) {
this.form.regCloseTime = this.form.regCloseTime.getTime(); this.form.regCloseTime = this.form.regCloseTime.getTime();
} }
set[formName].validate(valid => { set[formName].validate(valid => {
if (valid) { if (valid) {
let params = { let params = {
alt:this.form.alt, alt: this.form.alt,
id: this.form.id, imgTitle:this.form.imgTitle,
title: this.form.title,//营地名称 imgKeyword:this.form.imgKeyword,
subtitle: this.form.subtitle,//营地热度 imgDesc:this.form.imgDesc,
startTime: this.form.startTime,//客服电话 id: this.form.id,
endTime: this.form.endTime,//联系电话 title: this.form.title,//营地名称
regCloseTime: this.form.regCloseTime,//省份 subtitle: this.form.subtitle,//营地热度
provinceCode: this.campsiteObj.province,//省份名称 startTime: this.form.startTime,//客服电话
province: this.campsiteObj.provinceName,//市编号 endTime: this.form.endTime,//联系电话
cityName: this.campsiteObj.cityName,//市名称 regCloseTime: this.form.regCloseTime,//省份
cityCode: this.campsiteObj.city,//详细地址 provinceCode: this.campsiteObj.province,//省份名称
city:this.campsiteObj.cityName, province: this.campsiteObj.provinceName,//市编号
townCode:this.campsiteObj.townCode, cityName: this.campsiteObj.cityName,//市名称
town:this.campsiteObj.town, cityCode: this.campsiteObj.city,//详细地址
address:this.campsiteObj.address, city: this.campsiteObj.cityName,
latitude: this.campsiteObj.latitude, townCode: this.campsiteObj.townCode,
longitude: this.campsiteObj.longitude, town: this.campsiteObj.town,
limitNum:this.form.limitNum, address: this.campsiteObj.address,
isShow:this.form.isShow, latitude: this.campsiteObj.latitude,
isOpenReg:this.form.isOpenReg, longitude: this.campsiteObj.longitude,
isDel:this.form.isDel, limitNum: this.form.limitNum,
isHomePage:this.form.isHomePage, isShow: this.form.isShow,
isHomePage:this.form.isHomePage, isOpenReg: this.form.isOpenReg,
crtUser:this.form.crtUser, isDel: this.form.isDel,
crtName:this.form.crtName, isHomePage: this.form.isHomePage,
crtTime:this.form.crtTime, isHomePage: this.form.isHomePage,
actDesc:this.form.actDesc, crtUser: this.form.crtUser,
banner:this.form.banner, crtName: this.form.crtName,
willNum:this.form.willNum, crtTime: this.form.crtTime,
location:this.form.location, actDesc: this.form.actDesc,
rank:this.form.rank, banner: this.form.banner,
type:this.form.type, willNum: this.form.willNum,
content: this.form.content,//营地详情 location: this.form.location,
}; rank: this.form.rank,
console.log(params); type: this.form.type,
this.isExistCampsiteShop("create", params); content: this.form.content,//营地详情
} else { };
return; console.log(params);
} this.isExistCampsiteShop("create", params);
}); } else {
}, return;
/** }
* 编辑 });
* */ },
update(formName){ /**
const set = this.$refs; * 编辑
* */
update(formName) {
const set = this.$refs;
if(this.form.startTime && (typeof this.form.startTime == "object")){ if (this.form.startTime && (typeof this.form.startTime == "object")) {
this.form.startTime = this.form.startTime.getTime(); this.form.startTime = this.form.startTime.getTime();
} }
if(this.form.endTime && (typeof this.form.endTime == "object")){ if (this.form.endTime && (typeof this.form.endTime == "object")) {
this.form.endTime = this.form.endTime.getTime(); this.form.endTime = this.form.endTime.getTime();
} }
if(this.form.regCloseTime && (typeof this.form.regCloseTime == "object")){ if (this.form.regCloseTime && (typeof this.form.regCloseTime == "object")) {
this.form.regCloseTime = this.form.regCloseTime.getTime(); this.form.regCloseTime = this.form.regCloseTime.getTime();
} }
set[formName].validate(valid => { set[formName].validate(valid => {
if (valid) { if (valid) {
this.isCreate = true; this.isCreate = true;
let params = { let params = {
alt:this.form.alt, alt: this.form.alt,
id: this.form.id, imgTitle:this.form.imgTitle,
title: this.form.title,//营地名称 imgKeyword:this.form.imgKeyword,
subtitle: this.form.subtitle,//营地热度 imgDesc:this.form.imgDesc,
startTime: this.form.startTime,//客服电话 id: this.form.id,
endTime: this.form.endTime,//联系电话 title: this.form.title,//营地名称
regCloseTime: this.form.regCloseTime,//省份 subtitle: this.form.subtitle,//营地热度
provinceCode: this.campsiteObj.province,//省份名称 startTime: this.form.startTime,//客服电话
province: this.campsiteObj.provinceName,//市编号 endTime: this.form.endTime,//联系电话
cityName: this.campsiteObj.cityName,//市名称 regCloseTime: this.form.regCloseTime,//省份
cityCode: this.campsiteObj.city,//详细地址 provinceCode: this.campsiteObj.province,//省份名称
city:this.campsiteObj.cityName, province: this.campsiteObj.provinceName,//市编号
townCode:this.campsiteObj.townCode, cityName: this.campsiteObj.cityName,//市名称
town:this.campsiteObj.town, cityCode: this.campsiteObj.city,//详细地址
address:this.campsiteObj.address, city: this.campsiteObj.cityName,
latitude: this.campsiteObj.latitude, townCode: this.campsiteObj.townCode,
longitude: this.campsiteObj.longitude, town: this.campsiteObj.town,
limitNum:this.form.limitNum, address: this.campsiteObj.address,
isShow:this.form.isShow, latitude: this.campsiteObj.latitude,
banner:this.form.banner, longitude: this.campsiteObj.longitude,
isOpenReg:this.form.isOpenReg, limitNum: this.form.limitNum,
isDel:this.form.isDel, isShow: this.form.isShow,
isHomePage:this.form.isHomePage, banner: this.form.banner,
isHomePage:this.form.isHomePage, isOpenReg: this.form.isOpenReg,
crtUser:this.form.crtUser, isDel: this.form.isDel,
crtName:this.form.crtName, isHomePage: this.form.isHomePage,
crtTime:this.form.crtTime, isHomePage: this.form.isHomePage,
actDesc:this.form.actDesc, crtUser: this.form.crtUser,
willNum:this.form.willNum, crtName: this.form.crtName,
location:this.form.location, crtTime: this.form.crtTime,
rank:this.form.rank, actDesc: this.form.actDesc,
type:this.form.type, willNum: this.form.willNum,
content: this.form.content,//营地详情 location: this.form.location,
}; rank: this.form.rank,
this.isExistCampsiteShop("update", params); type: this.form.type,
} else { content: this.form.content,//营地详情
return; };
} this.isExistCampsiteShop("update", params);
}); } else {
}, return;
/** }
* 更新 });
* */ },
toUpdate(params){ /**
console.log("............修改") * 更新
editActivity(params).then(response => { * */
if (response.status === 200) { toUpdate(params) {
this.$notify({ console.log("............修改")
title: '成功', editActivity(params).then(response => {
message: '编辑成功', if (response.status === 200) {
type: 'success', this.$notify({
duration: 2000 title: '成功',
}); message: '编辑成功',
this.$emit("oneCampsiteDialogEvent", true); type: 'success',
} else { duration: 2000
this.$notify({ });
title: '编辑失败', this.$emit("oneCampsiteDialogEvent", true);
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!', } else {
type: 'error', this.$notify({
duration: 2000 title: '编辑失败',
}); message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
} type: 'error',
}); duration: 2000
}, });
/** }
* 创建 });
* */ },
toCreate(params){ /**
editActivity(params).then(response => { * 创建
if (response.status === 200) { * */
this.$notify({ toCreate(params) {
title: '成功', editActivity(params).then(response => {
message: '创建成功', if (response.status === 200) {
type: 'success', this.$notify({
duration: 2000 title: '成功',
}); message: '创建成功',
this.$emit("oneCampsiteDialogEvent", true); type: 'success',
} else { duration: 2000
this.$notify({ });
title: '创建失败', this.$emit("oneCampsiteDialogEvent", true);
message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!', } else {
type: 'error', this.$notify({
duration: 2000 title: '创建失败',
}); message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
} type: 'error',
}); duration: 2000
}, });
/** }
* 关闭营地地址弹框 });
* */ },
campsiteEvent(obj){ /**
this.showCampsiteVisible = false; * 关闭营地地址弹框
if(obj){ * */
this.campsiteObj = obj; campsiteEvent(obj) {
console.log(obj) this.showCampsiteVisible = false;
let provinceObj = getRegionByCodes([obj.province]); if (obj) {
let cityObj = getRegionByCodes([obj.city]); this.campsiteObj = obj;
let townObj = getRegionByCodes([obj.townCode]) console.log(obj)
this.campsiteObj.provinceName = provinceObj[0].name; let provinceObj = getRegionByCodes([obj.province]);
this.campsiteObj.cityName = cityObj[0].name; let cityObj = getRegionByCodes([obj.city]);
this.campsiteObj.town = townObj[0].name let townObj = getRegionByCodes([obj.townCode])
this.campsiteObj.townCode = obj.townCode this.campsiteObj.provinceName = provinceObj[0].name;
this.form.addressStr = this.campsiteObj.provinceName + this.campsiteObj.cityName + this.campsiteObj.town + this.campsiteObj.address; this.campsiteObj.cityName = cityObj[0].name;
console.log(this.campsiteObj); this.campsiteObj.town = townObj[0].name
} this.campsiteObj.townCode = obj.townCode
}, this.form.addressStr = this.campsiteObj.provinceName + this.campsiteObj.cityName + this.campsiteObj.town + this.campsiteObj.address;
/** console.log(this.campsiteObj);
* 编辑营地地址 }
* */ },
selectDestination(){ /**
let that = this; * 编辑营地地址
console.log(this.campsiteObj) * */
this.campsiteObj.showTitle = "活动地址编辑"; selectDestination() {
this.campsiteObj.eventName ='campsiteEvent'; let that = this;
this.campsiteObj.keyword = this.campsiteObj.address; console.log(this.campsiteObj)
this.showCampsiteVisible = true; this.campsiteObj.showTitle = "活动地址编辑";
}, this.campsiteObj.eventName = 'campsiteEvent';
/** this.campsiteObj.keyword = this.campsiteObj.address;
* 获取一条营地 this.showCampsiteVisible = true;
* */ },
getOne(id){ /**
let that = this; * 获取一条营地
getOneActivityShop(id).then(response => { * */
this.form = response.data; getOne(id) {
this.campsiteObj = { let that = this;
address: response.data.address, getOneActivityShop(id).then(response => {
province: response.data.provinceCode, this.form = response.data;
provinceName: response.data.province, this.campsiteObj = {
city: response.data.cityCode, address: response.data.address,
cityName: response.data.city, province: response.data.provinceCode,
latitude: response.data.latitude, provinceName: response.data.province,
longitude: response.data.longitude, city: response.data.cityCode,
townCode:response.data.townCode, cityName: response.data.city,
town:response.data.town latitude: response.data.latitude,
}; longitude: response.data.longitude,
response.data.addressStr = this.campsiteObj.provinceName + this.campsiteObj.cityName + this.campsiteObj.town + this.campsiteObj.address; townCode: response.data.townCode,
}) town: response.data.town
}, };
/** response.data.addressStr = this.campsiteObj.provinceName + this.campsiteObj.cityName + this.campsiteObj.town + this.campsiteObj.address;
* 旅游-弹框-取消 })
* */ },
cancel() { /**
this.cleanForm(); * 旅游-弹框-取消
this.$emit("oneCampsiteDialogEvent", false); * */
}, cancel() {
/** this.cleanForm();
* 配套&收费 富文本 this.$emit("oneCampsiteDialogEvent", false);
* */ },
handelIntroduceIncrease(step){ /**
this.form.configure = step; * 配套&收费 富文本
}, * */
/** handelIntroduceIncrease(step) {
* 富文本 营地详情 this.form.configure = step;
* */ },
editorReadyEvent(instance){ /**
let t = this; * 富文本 营地详情
instance.addListener('contentChange', () => { * */
if(t.activeName2 == "first"){ editorReadyEvent(instance) {
t.form.content = instance.getContent(); let t = this;
} else if(t.activeName2 == "second"){ instance.addListener('contentChange', () => {
t.form.actDesc = instance.getContent(); if (t.activeName2 == "first") {
} t.form.content = instance.getContent();
}); } else if (t.activeName2 == "second") {
}, t.form.actDesc = instance.getContent();
/** }
* 封面图上传 });
* **/ },
handleAvatarSuccess(res, file){ /**
console.log(res.data) * 封面图上传
this.form.banner = res.data; * **/
}, handleAvatarSuccess(res, file) {
console.log(res.data)
this.form.banner = res.data;
},
/** /**
* 清空旅游弹框数据 * 清空旅游弹框数据
*/ */
cleanForm() { cleanForm() {
this.campsiteObj ={name: ""};//营地地址 this.campsiteObj = {name: ""};//营地地址
this.fileList2=[]; this.fileList2 = [];
this.activeName2= '';//营地详情 this.activeName2 = '';//营地详情
this.form = { this.form = {
alt:undefined, alt: undefined,
id: undefined, imgTitle:undefined,
title: undefined,//营地名称 imgKeyword:undefined,
subtitle: undefined,//营地热度 imgDesc:undefined,
startTime: "",//客服电话 id: undefined,
endTime: "",//联系电话 title: undefined,//营地名称
regCloseTime: undefined,//省份 subtitle: undefined,//营地热度
provinceCode: undefined,//省份名称 startTime: "",//客服电话
province: undefined,//市编号 endTime: "",//联系电话
cityName: undefined,//市名称 regCloseTime: undefined,//省份
cityCode: undefined,//详细地址 provinceCode: undefined,//省份名称
city:undefined, province: undefined,//市编号
townCode:undefined, cityName: undefined,//市名称
town:undefined, cityCode: undefined,//详细地址
address:undefined, city: undefined,
latitude: undefined, townCode: undefined,
longitude: undefined, town: undefined,
limitNum:0, address: undefined,
isShow:0, latitude: undefined,
isOpenReg:0, longitude: undefined,
isDel:0, limitNum: 0,
banner:undefined, isShow: 0,
isPublish:0, isOpenReg: 0,
isHomePage:0, isDel: 0,
crtUser:undefined, banner: undefined,
crtName:undefined, isPublish: 0,
crtTime:undefined, isHomePage: 0,
actDesc:undefined, crtUser: undefined,
willNum:undefined, crtName: undefined,
location:0, crtTime: undefined,
rank:undefined, actDesc: undefined,
type:undefined, willNum: undefined,
content: '',//营地详情 location: 0,
concat: "",//联系人 rank: undefined,
logo:undefined,//封面图 type: undefined,
configure: '',//配套&收费 content: '',//营地详情
campsiteTagListVos: [],//营地类型 concat: "",//联系人
carouse:[],//banner轮播 logo: undefined,//封面图
posterBackground:'',//海报背景 configure: '',//配套&收费
}; campsiteTagListVos: [],//营地类型
this.showCampsiteVisible= false;//编辑营地地址 carouse: [],//banner轮播
} posterBackground: '',//海报背景
};
this.showCampsiteVisible = false;//编辑营地地址
}
}
} }
}
</script> </script>
<style> <style>
.activity .edui-editor { .activity .edui-editor {
z-index: 2000 !important; z-index: 2000 !important;
} }
</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