Commit 53dea16e authored by hanfeng's avatar hanfeng

修改车辆订单详情

parent c55a8866
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<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 class="cx" v-model="form.intro" :rows="9" type="textarea" placeholder="请输入车型简介" ></el-input> <el-input class="cx" v-model="form.intro" :rows="9" type="textarea" placeholder="请输入车型简介"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -165,6 +165,13 @@ ...@@ -165,6 +165,13 @@
style="lineHeight:100px;width:300px;height: 100px;border: 1px dashed #ccc;"></i> 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-col :span="8">
<el-form-item label="全景链接">
<el-input v-model="form.panoramaUrl" type="text" placeholder="请输入全景链接"></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="alt"> <el-form-item label="alt">
...@@ -290,675 +297,679 @@ ...@@ -290,675 +297,679 @@
} }
</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() {
return {
imgPosterFlag: false,
percent_poster: 0,
BASE_API: process.env.BASE_API,
percent: 0,//上传进度
imgFlag: false,
config: {
initialFrameWidth: null,
initialFrameHeight: 350
}, },
data() { labelList: [],//全部车型标签
return { fileList2: [],
imgPosterFlag: false, activeName2: '',//房车详情
percent_poster: 0, form: {
BASE_API: process.env.BASE_API, alt: '',
percent: 0,//上传进度 imgTitle: undefined,
imgFlag: false, imgKeyword: undefined,
config: { imgDesc: undefined,
initialFrameWidth: null, coverPic: '',
initialFrameHeight: 350 pPrice: 0,//普通会员
}, hPrice: 0,//黄金会员
labelList: [],//全部车型标签 zPrice: 0,//钻石会员
fileList2: [], name: undefined,//房车名称
activeName2: '',//房车详情 config: "",//房车配置
form: { keyword: "",//房车关键标签
alt: '', modelsDetails: "",//房车详情
imgTitle: undefined, modelParam: "",//房车参数
imgKeyword: undefined, picture: "",//轮播图
imgDesc: undefined, price: 0,//租车价格
coverPic:'', deposit: 20000,//总押金
pPrice: 0,//普通会员 vioDeposit: 0,//违章押金
hPrice: 0,//黄金会员 hotSign: "2",//热门车型 1、热门 2、非热门
zPrice: 0,//钻石会员 rentDiscountStatus: "0",//租车优惠状态 0--没有优惠;1--会员折扣;2--固定值
name: undefined,//房车名称 rentDiscountPrice: 0,//租车优惠价格 固定优化价格
config: "",//房车配置 buyPrice: 0,//购买价格
keyword: "",//房车关键标签 intro: '',
modelsDetails: "",//房车详情 posterBackground: '',//海报背景
modelParam: "",//房车参数 panoramaUrl:undefined,
picture: "",//轮播图
price: 0,//租车价格
deposit: 20000,//总押金
vioDeposit: 0,//违章押金
hotSign: "2",//热门车型 1、热门 2、非热门
rentDiscountStatus: "0",//租车优惠状态 0--没有优惠;1--会员折扣;2--固定值
rentDiscountPrice: 0,//租车优惠价格 固定优化价格
buyPrice: 0,//购买价格
intro: '',
posterBackground: '',//海报背景
},
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,//关键标签弹框
}
},
created() {
},
watch: {
oneTypeDialogVisible(newValue, oldValue) {
if (!newValue) {
this.cleanForm();
}
},
}, },
mounted() { showDestinationVisible: false,//编辑目的地
this.cleanForm(); showPathWayVisible: false,//编辑途径地
this.getAllTag(); rules: {
this.oneTypeDialogVisible = true; name: {
type: 'string',
required: true,
message: '请输入车型名称',
trigger: 'blur'
}
}, },
computed: { checkList: [],//已选中的标签
...mapGetters([ allCompanies: {},
'elements', allCompaniesArr: [],
'vehicleWarningMsgType' oneTypeDialogVisible: false,
]), allUpkeepItems: null,
getHeaderWithToken() { dialogStatus: undefined,
return {Authorization: getToken()}; allLabelList: [],//全部标签
} showName: "",
}, configDialogVisible: false,//配置弹框
methods: { modalTitle: "修改房车配置",
changeConfig() { configItem: {parent: {isMore: 0}},//待编辑配置数据
console.log(this.configItemChildren); 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(",");
});
/** /**
* 获取全部一级、二级分类数据 * 关键标签可选的二级分类
* */ * */
getAllTag() { let labelArr = [];
let listQuery = {sort: 1, page: 1, limit: 10}; that.labelList.map(function (i) {
let that = this; i.childNameLists.map(function (ii) {
getLabelList(listQuery).then(response => { labelArr.push(ii)
let listRs = undefined; });
if (!this.$utils.isEmpty(response.data)) { });
listRs = response.data; that.totalLabel = labelArr;
response.data.map(function (item) { let canSelectLabel = [];
item.childName = []; that.labelList.map(function (i) {
}) i.children.map(function (ic) {
} that.totalLabel.map(function (c) {
this.labelList = listRs; if (ic.id == c) {
if (this.title == "编辑") { canSelectLabel.push(ic);
let row = this.oneRow; }
this.getOne(row.id); })
} else { })
this.activeName2 = "first"; });
let tagArr = []; this.canSelectLabel = canSelectLabel;
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,
imgTitle: this.form.imgTitle,
imgKeyword: this.form.imgKeyword,
imgDesc: this.form.imgDesc,
panoramaUrl: this.form.panoramaUrl,
};
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: '创建失败',
uploadProcess(event, file, fileList) { message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
this.imgFlag = true; type: 'error',
console.log(event.percent); duration: 2000
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, * */
number: this.form.number,//乘卧数量 update(formName) {
brand: this.form.brand,//房车品牌 const set = this.$refs;
name: this.form.name,//房车名称 set[formName].validate(valid => {
config: this.totalLabel.join(","),//房车配置 if (valid) {
keyword: this.form.keyword,//房车关键标签 let params = {
modelsDetails: this.form.modelsDetails,//房车详情 id: this.form.id,
modelParam: JSON.stringify(this.form.modelParam),//房车参数 number: this.form.number,//乘卧数量
picture: this.form.picture,//轮播图 brand: this.form.brand,//房车品牌
price: this.form.price,//租车价格 name: this.form.name,//房车名称
coverPic: this.form.coverPic,//封面图 config: this.totalLabel.join(","),//房车配置
posterBackground: this.form.posterBackground,//海报背景 keyword: this.form.keyword,//房车关键标签
deposit: this.form.deposit,//总押金 modelsDetails: this.form.modelsDetails,//房车详情
vioDeposit: this.form.vioDeposit, modelParam: JSON.stringify(this.form.modelParam),//房车参数
hotSign: this.form.hotSign,//热门车型 picture: this.form.picture,//轮播图
rentDiscountStatus: this.form.rentDiscountStatus,//租车优惠状态 0--没有优惠;1--会员折扣;2--固定值 price: this.form.price,//租车价格
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, imgTitle: this.form.imgTitle,
imgKeyword: this.form.imgKeyword, imgKeyword: this.form.imgKeyword,
imgDesc: this.form.imgDesc, imgDesc: this.form.imgDesc,
}; panoramaUrl:this.form.panoramaUrl
if (this.form.rentDiscountStatus == 2) { };
params.rentDiscountPrice = this.form.pPrice + "," + this.form.hPrice + "," + this.form.zPrice//租车优惠价格 固定优化价格 if (this.form.rentDiscountStatus == 2) {
} params.rentDiscountPrice = this.form.pPrice + "," + this.form.hPrice + "," + this.form.zPrice//租车优惠价格 固定优化价格
console.log(params); }
console.log(this.form); console.log(params);
updateVehicleModel(params).then(response => { console.log(this.form);
if (response.status === 200) { updateVehicleModel(params).then(response => {
this.$notify({ if (response.status === 200) {
title: '成功', this.$notify({
message: '编辑成功', title: '成功',
type: 'success', message: '编辑成功',
duration: 2000 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: '编辑失败',
cancel() { message: rsCode.msg[response.code] ? rsCode.msg[response.code] : '操作失败!',
this.cleanForm(); type: 'error',
this.$emit("oneDialogEvent", false); duration: 2000
},
/**
* 编辑关键标签
* */
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() {
updateConfig() { this.cleanForm();
let that = this; this.$emit("oneDialogEvent", false);
this.configDialogVisible = false; },
if (this.configItem.parent.isMore == 0) { /**
//单选 * 编辑关键标签
console.log(this.childName); * */
that.labelList.map(function (i) { editLabe() {
if (i.parent.id == that.configItem.parent.id) { this.keywordDialogVisible = true;
i.children.map(function (ic) { },
if (ic.id == that.childName) { /**
i.selectChild = ic.name; * 删除房车参数
let a = []; * */
i.childNameLists[0] = that.childName; delModelParam(index) {
} this.form.modelParam.splice(index, 1);
}) },
} /**
}); * 添加房车参数
console.log(that.labelList); * */
} else { addModelParam() {
if (this.childNameLists.length <= 0) { console.log(this.form.modelParam);
return; let c = {
} key: "",
//多选 val: ""
console.log(this.childNameLists); };
that.labelList.map(function (i) { this.form.modelParam.push(c);
let a = []; },
if (i.parent.id == that.configItem.parent.id) { /**
i.children.map(function (ic) { * 关闭关键标签配置
that.childNameLists.map(function (cc) { * */
if (cc == ic.id) { cancelHandelLabel() {
a.push(ic.name); this.keywordDialogVisible = false;
} },
}); /**
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() {
debugger
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) { });
i.childNameLists.map(function (ii) { console.log(that.labelList);
labelArr.push(ii) } else {
}); 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; });
}, });
querySearch(queryString, cb) { iitem.childNameList = p;
let selectArry = []; iitem.childNameLists = pp;
this.allCompaniesArr.map(function (item) { iitem.selectChild = aa.join(",");
item.value = item.name; });
selectArry.push(item); /**
}); * 关键标签可选的二级分类
this.selectArry = selectArry; * */
var results = queryString ? selectArry.filter(this.createFilter(queryString)) : selectArry; let labelArr = [];
// 调用 callback 返回建议列表的数据 that.labelList.map(function (i) {
cb(results); i.childNameLists.map(function (ii) {
}, labelArr.push(ii)
/** });
* 富文本内容 });
* @param step that.totalLabel = labelArr;
*/ let canSelectLabel = [];
editorReadyEvent(instance) { that.labelList.map(function (i) {
let t = this; i.children.map(function (ic) {
instance.addListener('contentChange', () => { that.totalLabel.map(function (c) {
t.form.modelsDetails = instance.getContent(); if (ic.id == c) {
}); 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 = {
number: undefined,//乘卧数量
brand: undefined,//房车品牌
name: '',//房车名称
config:'',//房车配置
keyword: '',//房车关键标签
modelsDetails: '',//房车详情
modelParam: '',//房车参数
picture: '',//轮播图
coverPic: '',//封面图
posterBackground: '',//海报背景
price: undefined,//租车价格
deposit: 20000,//总押金
vioDeposit: '',
rentDiscountStatus: 0,//租车优惠状态 0--没有优惠;1--会员折扣;2--固定值
buyPrice: undefined,//购买价格
alt: '',//seo 标签优化
intro: '',
imgTitle: '',
imgKeyword: '',
imgDesc: '',
pPrice: 0,//普通会员
hPrice: 0,//黄金会员
zPrice: 0,//钻石会员
hotSign: "2",//热门车型 1、热门 2、非热门
rentDiscountPrice: 0,//租车优惠价格 固定优化价格
} }
} })
})
});
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 = {
number: undefined,//乘卧数量
brand: undefined,//房车品牌
name: '',//房车名称
config: '',//房车配置
keyword: '',//房车关键标签
modelsDetails: '',//房车详情
modelParam: '',//房车参数
picture: '',//轮播图
coverPic: '',//封面图
posterBackground: '',//海报背景
price: undefined,//租车价格
deposit: 20000,//总押金
vioDeposit: '',
rentDiscountStatus: 0,//租车优惠状态 0--没有优惠;1--会员折扣;2--固定值
buyPrice: undefined,//购买价格
alt: '',//seo 标签优化
intro: '',
imgTitle: '',
imgKeyword: '',
imgDesc: '',
pPrice: 0,//普通会员
hPrice: 0,//黄金会员
zPrice: 0,//钻石会员
hotSign: "2",//热门车型 1、热门 2、非热门
rentDiscountPrice: 0,//租车优惠价格 固定优化价格
}
}
} }
}
</script> </script>
<style> <style>
.flex-aic { .flex-aic {
......
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