Commit 40a2f3ee by member

链接小工具修复错误提示

parent a79f4a9c
......@@ -412,6 +412,7 @@ import GoodsTree from './goods-tree';
// import axios from 'axios'
import qs from 'qs';
import { setTimeout } from 'timers';
export default {
name: 'links-tool',
......@@ -1505,221 +1506,224 @@ export default {
// 确认操作
confirmLinkSelect() {
var that = this
setTimeout(_ => {
// 如果选择 h5 判断选择的链接
if (that.oneLevelTypeValue == 5) {
if (!that.h5linkObj.name.trim() || !that.h5linkObj.url.trim()) {
that.$message.error({
duration: 1000,
message: "请填写链接内容"
})
var that = this;
// 如果选择 h5 判断选择的链接
if (that.oneLevelTypeValue == 5) {
if (!that.h5linkObj.name.trim() || !that.h5linkObj.url.trim()) {
that.$message.error({
duration: 1000,
message: "请填写链接内容"
})
return;
}
if (!!that.h5linkObj.share && that.h5linkObj.shareWebType == 1 && !that.h5linkObj.shareUrl) {
that.$message.error({
duration: 1000,
message: "请填写分享链接"
})
return;
}
that.selectLinkObj.conditionType = that.h5linkObj.conditionType;
that.selectLinkObj.name = that.h5linkObj.name;
that.selectLinkObj.url = that.h5linkObj.url;// +'?'+that.h5linkObj.fixParam+'&'+that.h5linkObj.dynamicPara;
// 去掉固定参数 20180912 that.h5linkObj.fixParam
that.selectLinkObj.params = '';
if (!!that.dynamicList.length) {
let h5DataList = JSON.parse(JSON.stringify(that.dynamicList))
h5DataList.forEach(function(ele,index){
delete ele.editAble;
delete ele.selectKey;
delete ele.inputValue;
})
that.selectLinkObj.params = h5DataList
}
that.selectLinkObj.share = (that.h5linkObj.share== true? 1:0)
if (!!that.h5linkObj.share) {
that.selectLinkObj.shareWebType = that.h5linkObj.shareWebType;
if (that.h5linkObj.shareWebType == 1) {
that.selectLinkObj.shareUrl = that.h5linkObj.shareUrl
}
}
// that.selectLinkObj.fixParam = that.h5linkObj.fixParam;
// that.selectLinkObj.dynamicPara = that.h5linkObj.dynamicPara;
// 触发父组件方法,传递参数
that.transData();
return;
}
if (!!that.h5linkObj.share && that.h5linkObj.shareWebType == 1 && !that.h5linkObj.shareUrl) {
that.$message.error({
duration: 1000,
message: "请填写分享链接"
// 如果是第三方小程序
if (that.oneLevelTypeValue == 7) {
if (!this.twoLevelValue) {
that.$message.error({
duration: 1000,
message: "请选择第三方小程序"
})
}
// const reg = /^(http|https|www)(:\/\/)?.[A-Za-z]+.[A-Za-z]+.*/;
// if (!reg.test(this.thirdObj.pagePath)) {
// this.$message.error({
// duration: 1000,
// message: "输入的网址不合法!"
// })
// return;
// }
this.twoLevelOptions.forEach(v => {
if (v.value === this.twoLevelValue) {
that.selectLinkObj.name = v.label;
that.selectLinkObj.appid = v.value;
// that.selectLinkObj.id = selectOneItem.linkId;
// that.selectLinkObj.id = v.id;
}
})
this.selectLinkObj.pagePath = this.thirdObj.pagePath;
that.selectLinkObj.params = ''
if (!!that.dynamicList.length) {
let thirdDataList = JSON.parse(JSON.stringify(that.dynamicList))
thirdDataList.forEach(function(ele,index){
delete ele.editAble;
delete ele.selectKey;
delete ele.inputValue;
})
that.selectLinkObj.params = thirdDataList
}
// 触发父组件方法,传递参数
that.transData();
return;
}
that.selectLinkObj.conditionType = that.h5linkObj.conditionType;
that.selectLinkObj.name = that.h5linkObj.name;
that.selectLinkObj.url = that.h5linkObj.url;// +'?'+that.h5linkObj.fixParam+'&'+that.h5linkObj.dynamicPara;
// 去掉固定参数 20180912 that.h5linkObj.fixParam
that.selectLinkObj.params = '';
if (!!that.dynamicList.length) {
let h5DataList = JSON.parse(JSON.stringify(that.dynamicList))
h5DataList.forEach(function(ele,index){
delete ele.editAble;
delete ele.selectKey;
delete ele.inputValue;
})
that.selectLinkObj.params = h5DataList
}
that.selectLinkObj.share = (that.h5linkObj.share== true? 1:0)
if (!!that.h5linkObj.share) {
that.selectLinkObj.shareWebType = that.h5linkObj.shareWebType;
if (that.h5linkObj.shareWebType == 1) {
that.selectLinkObj.shareUrl = that.h5linkObj.shareUrl
// 如果选择的自定义页面
if (that.oneLevelTypeValue == 6) {
if (!that.twoLevelValue.trim()) {
that.$message.error({
duration: 1000,
message: "请选择自定义页面"
})
return;
}
// 触发父组件方法,传递参数
that.transData();
return;
}
// that.selectLinkObj.fixParam = that.h5linkObj.fixParam;
// that.selectLinkObj.dynamicPara = that.h5linkObj.dynamicPara;
// 触发父组件方法,传递参数
that.transData();
return;
}
// 如果是第三方小程序
if (that.oneLevelTypeValue == 7) {
if (!this.twoLevelValue) {
that.$message.error({
duration: 1000,
message: "请选择第三方小程序"
})
}
// const reg = /^(http|https|www)(:\/\/)?.[A-Za-z]+.[A-Za-z]+.*/;
// if (!reg.test(this.thirdObj.pagePath)) {
// this.$message.error({
// duration: 1000,
// message: "输入的网址不合法!"
// })
// return;
// }
this.twoLevelOptions.forEach(v => {
if (v.value === this.twoLevelValue) {
that.selectLinkObj.name = v.label;
that.selectLinkObj.appid = v.value;
// that.selectLinkObj.id = selectOneItem.linkId;
// that.selectLinkObj.id = v.id;
// 确定是会员功能 然后看是那个类型的
if (this.linkId == 27) {
if (this.visibleType == 8) {
// 优惠券
if (this.chooseFlag) {
this.selectLinkObj.name = '积分商城/' + this.cardName;
this.selectLinkObj.id = this.giftType;
this.selectLinkObj.params = {
integralMallProId: this.cardUrl
};
this.transData();
return;
} else {
this.$message.warning({
duration: 1000,
message: "请选择卡券!"
})
return false;
}
} else if (this.visibleType == 9) {
// 礼品
if (this.giftFlag) {
this.selectLinkObj.name = '积分商城/' + this.giftName;
this.selectLinkObj.id = this.giftType;
this.selectLinkObj.params = {
integralMallProId: this.giftUrl
};
this.transData();
return;
} else {
this.$message.warning({
duration: 1000,
message: "请选择礼品!"
})
return false;
}
}
})
this.selectLinkObj.pagePath = this.thirdObj.pagePath;
that.selectLinkObj.params = ''
if (!!that.dynamicList.length) {
let thirdDataList = JSON.parse(JSON.stringify(that.dynamicList))
thirdDataList.forEach(function(ele,index){
delete ele.editAble;
delete ele.selectKey;
delete ele.inputValue;
})
that.selectLinkObj.params = thirdDataList
}
// 触发父组件方法,传递参数
that.transData();
return;
}
// 如果选择的自定义页面
if (that.oneLevelTypeValue == 6) {
if (!that.twoLevelValue.trim()) {
that.$message.error({
duration: 1000,
message: "请选择自定义页面"
})
return;
}
// 触发父组件方法,传递参数
that.transData();
return;
}
// 确定是会员功能 然后看是那个类型的
if (this.linkId == 27) {
if (this.visibleType == 8) {
// 优惠券
if (this.chooseFlag) {
this.selectLinkObj.name = '积分商城/' + this.cardName;
this.selectLinkObj.id = this.giftType;
if (this.linkId == 16) {
if ( this.goodType == 10) {
// 商品分类链接
this.selectLinkObj.name = '商品分类链接/' + this.tagName;
this.selectLinkObj.id = this.middleGoodId;
this.selectLinkObj.params = {
integralMallProId: this.cardUrl
tagid: this.cardUrl,
title: this.tagName
};
this.transData();
return;
} else {
this.$message.warning({
duration: 1000,
message: "请选择卡券!"
})
console.log(this.cardUrl);
if (this.cardUrl) {
this.transData();
} else {
this.$message.error({
duration: 1000,
message: "请选择链接"
});
}
return false;
}
} else if (this.visibleType == 9) {
// 礼品
if (this.giftFlag) {
this.selectLinkObj.name = '积分商城/' + this.giftName;
this.selectLinkObj.id = this.giftType;
} else if (this.goodType == 11) {
this.selectLinkObj.name = '商城自定义页面/' + this.pageName;
this.selectLinkObj.id = this.middleGoodId;
this.selectLinkObj.params = {
integralMallProId: this.giftUrl
pageId: this.pageId,
title: this.pageName
};
this.transData();
return;
} else {
this.$message.warning({
duration: 1000,
message: "请选择礼品!"
})
if (this.pageId) {
this.transData();
} else {
this.$message.error({
duration: 1000,
message: "请选择链接"
});
}
return false;
}
}
}
if (this.linkId == 16) {
if ( this.goodType == 10) {
// 商品分类链接
this.selectLinkObj.name = '商品分类链接/' + this.tagName;
this.selectLinkObj.id = this.middleGoodId;
this.selectLinkObj.params = {
tagid: this.cardUrl,
title: this.tagName
};
if (this.cardUrl) {
this.transData();
} else {
if (!this.twoLevelValue) {
this.$message.error({
duration: 1000,
message: "请选择链接"
});
}
}
// 如果门店签到
if(that.twoLevelSelectValue == 'sign'){
if(!that.checkTwoLevel(that.twoLevelSelectValue)){
return false;
}
return false;
} else if (this.goodType == 11) {
this.selectLinkObj.name = '商城自定义页面/' + this.pageName;
this.selectLinkObj.id = this.middleGoodId;
this.selectLinkObj.params = {
pageId: this.pageId,
title: this.pageName
};
if (this.pageId) {
this.transData();
} else {
this.$message.error({
duration: 1000,
message: "请选择链接"
});
}
// 如果是商品分类
if(that.twoLevelSelectValue == 'goodsCate'){
if(!that.checkTwoLevel(that.twoLevelSelectValue)){
return false;
}
return false;
}
if (!this.twoLevelValue) {
// 分享有赏
if (this.linkId === 'yueshi') {
this.selectLinkObj.id = this.linkId;
this.selectLinkObj.name = '分享有赏';
this.$emit('linkSelect', this.selectLinkObj);
this.$emit('update:linkVisible', false);
this.resetAll();
return;
}
if (!!this.selectLinkObj.name && !!this.selectLinkObj.id) {
// 触发父组件方法,传递参数
this.transData();
} else {
this.$message.error({
duration: 1000,
message: "请选择链接"
});
}
}
// 如果门店签到
if(that.twoLevelSelectValue == 'sign'){
if(!that.checkTwoLevel(that.twoLevelSelectValue)){
return false;
}
return false;
}
// 如果是商品分类
if(that.twoLevelSelectValue == 'goodsCate'){
if(!that.checkTwoLevel(that.twoLevelSelectValue)){
return false;
})
}
return false;
}
// 分享有赏
if (this.linkId === 'yueshi') {
this.selectLinkObj.id = this.linkId;
this.selectLinkObj.name = '分享有赏';
this.$emit('linkSelect', this.selectLinkObj);
this.$emit('update:linkVisible', false);
this.resetAll();
return;
}
if (!!this.selectLinkObj.name && !!this.selectLinkObj.id) {
// 触发父组件方法,传递参数
this.transData();
} else {
this.$message.error({
duration: 1000,
message: "请选择链接"
})
}
});
},
getMallId(item) {
......@@ -1799,10 +1803,9 @@ export default {
// 触发父组件方法,传递参数
transData() {
console.log(this.selectLinkObj);
this.$emit('linkSelect', this.selectLinkObj);
this.$emit('update:linkVisible', false);
// this.resetAll();
this.resetAll();
},
// 获取一级列表
......
<template>
<!-- 链接小工具 -->
<div class="link-tools-contain">
......@@ -383,6 +382,7 @@ import GoodsTree from './goods-tree';
// import axios from 'axios'
import qs from 'qs';
import { setTimeout } from 'timers';
export default {
name: 'links-tool',
......@@ -1476,221 +1476,224 @@ export default {
// 确认操作
confirmLinkSelect() {
var that = this
setTimeout(_ => {
// 如果选择 h5 判断选择的链接
if (that.oneLevelTypeValue == 5) {
if (!that.h5linkObj.name.trim() || !that.h5linkObj.url.trim()) {
that.$message.error({
duration: 1000,
message: "请填写链接内容"
})
var that = this;
// 如果选择 h5 判断选择的链接
if (that.oneLevelTypeValue == 5) {
if (!that.h5linkObj.name.trim() || !that.h5linkObj.url.trim()) {
that.$message.error({
duration: 1000,
message: "请填写链接内容"
})
return;
}
if (!!that.h5linkObj.share && that.h5linkObj.shareWebType == 1 && !that.h5linkObj.shareUrl) {
that.$message.error({
duration: 1000,
message: "请填写分享链接"
})
return;
}
that.selectLinkObj.conditionType = that.h5linkObj.conditionType;
that.selectLinkObj.name = that.h5linkObj.name;
that.selectLinkObj.url = that.h5linkObj.url;// +'?'+that.h5linkObj.fixParam+'&'+that.h5linkObj.dynamicPara;
// 去掉固定参数 20180912 that.h5linkObj.fixParam
that.selectLinkObj.params = '';
if (!!that.dynamicList.length) {
let h5DataList = JSON.parse(JSON.stringify(that.dynamicList))
h5DataList.forEach(function(ele,index){
delete ele.editAble;
delete ele.selectKey;
delete ele.inputValue;
})
that.selectLinkObj.params = h5DataList
}
that.selectLinkObj.share = (that.h5linkObj.share== true? 1:0)
if (!!that.h5linkObj.share) {
that.selectLinkObj.shareWebType = that.h5linkObj.shareWebType;
if (that.h5linkObj.shareWebType == 1) {
that.selectLinkObj.shareUrl = that.h5linkObj.shareUrl
}
}
// that.selectLinkObj.fixParam = that.h5linkObj.fixParam;
// that.selectLinkObj.dynamicPara = that.h5linkObj.dynamicPara;
// 触发父组件方法,传递参数
that.transData();
return;
}
if (!!that.h5linkObj.share && that.h5linkObj.shareWebType == 1 && !that.h5linkObj.shareUrl) {
that.$message.error({
duration: 1000,
message: "请填写分享链接"
// 如果是第三方小程序
if (that.oneLevelTypeValue == 7) {
if (!this.twoLevelValue) {
that.$message.error({
duration: 1000,
message: "请选择第三方小程序"
})
}
// const reg = /^(http|https|www)(:\/\/)?.[A-Za-z]+.[A-Za-z]+.*/;
// if (!reg.test(this.thirdObj.pagePath)) {
// this.$message.error({
// duration: 1000,
// message: "输入的网址不合法!"
// })
// return;
// }
this.twoLevelOptions.forEach(v => {
if (v.value === this.twoLevelValue) {
that.selectLinkObj.name = v.label;
that.selectLinkObj.appid = v.value;
// that.selectLinkObj.id = selectOneItem.linkId;
// that.selectLinkObj.id = v.id;
}
})
this.selectLinkObj.pagePath = this.thirdObj.pagePath;
that.selectLinkObj.params = ''
if (!!that.dynamicList.length) {
let thirdDataList = JSON.parse(JSON.stringify(that.dynamicList))
thirdDataList.forEach(function(ele,index){
delete ele.editAble;
delete ele.selectKey;
delete ele.inputValue;
})
that.selectLinkObj.params = thirdDataList
}
// 触发父组件方法,传递参数
that.transData();
return;
}
that.selectLinkObj.conditionType = that.h5linkObj.conditionType;
that.selectLinkObj.name = that.h5linkObj.name;
that.selectLinkObj.url = that.h5linkObj.url;// +'?'+that.h5linkObj.fixParam+'&'+that.h5linkObj.dynamicPara;
// 去掉固定参数 20180912 that.h5linkObj.fixParam
that.selectLinkObj.params = '';
if (!!that.dynamicList.length) {
let h5DataList = JSON.parse(JSON.stringify(that.dynamicList))
h5DataList.forEach(function(ele,index){
delete ele.editAble;
delete ele.selectKey;
delete ele.inputValue;
})
that.selectLinkObj.params = h5DataList
}
that.selectLinkObj.share = (that.h5linkObj.share== true? 1:0)
if (!!that.h5linkObj.share) {
that.selectLinkObj.shareWebType = that.h5linkObj.shareWebType;
if (that.h5linkObj.shareWebType == 1) {
that.selectLinkObj.shareUrl = that.h5linkObj.shareUrl
// 如果选择的自定义页面
if (that.oneLevelTypeValue == 6) {
if (!that.twoLevelValue.trim()) {
that.$message.error({
duration: 1000,
message: "请选择自定义页面"
})
return;
}
// 触发父组件方法,传递参数
that.transData();
return;
}
// that.selectLinkObj.fixParam = that.h5linkObj.fixParam;
// that.selectLinkObj.dynamicPara = that.h5linkObj.dynamicPara;
// 触发父组件方法,传递参数
that.transData();
return;
}
// 如果是第三方小程序
if (that.oneLevelTypeValue == 7) {
if (!this.twoLevelValue) {
that.$message.error({
duration: 1000,
message: "请选择第三方小程序"
})
}
// const reg = /^(http|https|www)(:\/\/)?.[A-Za-z]+.[A-Za-z]+.*/;
// if (!reg.test(this.thirdObj.pagePath)) {
// this.$message.error({
// duration: 1000,
// message: "输入的网址不合法!"
// })
// return;
// }
this.twoLevelOptions.forEach(v => {
if (v.value === this.twoLevelValue) {
that.selectLinkObj.name = v.label;
that.selectLinkObj.appid = v.value;
// that.selectLinkObj.id = selectOneItem.linkId;
// that.selectLinkObj.id = v.id;
// 确定是会员功能 然后看是那个类型的
if (this.linkId == 27) {
if (this.visibleType == 8) {
// 优惠券
if (this.chooseFlag) {
this.selectLinkObj.name = '积分商城/' + this.cardName;
this.selectLinkObj.id = this.giftType;
this.selectLinkObj.params = {
integralMallProId: this.cardUrl
};
this.transData();
return;
} else {
this.$message.warning({
duration: 1000,
message: "请选择卡券!"
})
return false;
}
} else if (this.visibleType == 9) {
// 礼品
if (this.giftFlag) {
this.selectLinkObj.name = '积分商城/' + this.giftName;
this.selectLinkObj.id = this.giftType;
this.selectLinkObj.params = {
integralMallProId: this.giftUrl
};
this.transData();
return;
} else {
this.$message.warning({
duration: 1000,
message: "请选择礼品!"
})
return false;
}
}
})
this.selectLinkObj.pagePath = this.thirdObj.pagePath;
that.selectLinkObj.params = ''
if (!!that.dynamicList.length) {
let thirdDataList = JSON.parse(JSON.stringify(that.dynamicList))
thirdDataList.forEach(function(ele,index){
delete ele.editAble;
delete ele.selectKey;
delete ele.inputValue;
})
that.selectLinkObj.params = thirdDataList
}
// 触发父组件方法,传递参数
that.transData();
return;
}
// 如果选择的自定义页面
if (that.oneLevelTypeValue == 6) {
if (!that.twoLevelValue.trim()) {
that.$message.error({
duration: 1000,
message: "请选择自定义页面"
})
return;
}
// 触发父组件方法,传递参数
that.transData();
return;
}
// 确定是会员功能 然后看是那个类型的
if (this.linkId == 27) {
if (this.visibleType == 8) {
// 优惠券
if (this.chooseFlag) {
this.selectLinkObj.name = '积分商城/' + this.cardName;
this.selectLinkObj.id = this.giftType;
if (this.linkId == 16) {
if ( this.goodType == 10) {
// 商品分类链接
this.selectLinkObj.name = '商品分类链接/' + this.tagName;
this.selectLinkObj.id = this.middleGoodId;
this.selectLinkObj.params = {
integralMallProId: this.cardUrl
tagid: this.cardUrl,
title: this.tagName
};
this.transData();
return;
} else {
this.$message.warning({
duration: 1000,
message: "请选择卡券!"
})
console.log(this.cardUrl);
if (this.cardUrl) {
this.transData();
} else {
this.$message.error({
duration: 1000,
message: "请选择链接"
});
}
return false;
}
} else if (this.visibleType == 9) {
// 礼品
if (this.giftFlag) {
this.selectLinkObj.name = '积分商城/' + this.giftName;
this.selectLinkObj.id = this.giftType;
} else if (this.goodType == 11) {
this.selectLinkObj.name = '商城自定义页面/' + this.pageName;
this.selectLinkObj.id = this.middleGoodId;
this.selectLinkObj.params = {
integralMallProId: this.giftUrl
pageId: this.pageId,
title: this.pageName
};
this.transData();
return;
} else {
this.$message.warning({
duration: 1000,
message: "请选择礼品!"
})
if (this.pageId) {
this.transData();
} else {
this.$message.error({
duration: 1000,
message: "请选择链接"
});
}
return false;
}
}
}
if (this.linkId == 16) {
if ( this.goodType == 10) {
// 商品分类链接
this.selectLinkObj.name = '商品分类链接/' + this.tagName;
this.selectLinkObj.id = this.middleGoodId;
this.selectLinkObj.params = {
tagid: this.cardUrl,
title: this.tagName
};
if (this.cardUrl) {
this.transData();
} else {
if (!this.twoLevelValue) {
this.$message.error({
duration: 1000,
message: "请选择链接"
});
}
}
// 如果门店签到
if(that.twoLevelSelectValue == 'sign'){
if(!that.checkTwoLevel(that.twoLevelSelectValue)){
return false;
}
return false;
} else if (this.goodType == 11) {
this.selectLinkObj.name = '商城自定义页面/' + this.pageName;
this.selectLinkObj.id = this.middleGoodId;
this.selectLinkObj.params = {
pageId: this.pageId,
title: this.pageName
};
if (this.pageId) {
this.transData();
} else {
this.$message.error({
duration: 1000,
message: "请选择链接"
});
}
// 如果是商品分类
if(that.twoLevelSelectValue == 'goodsCate'){
if(!that.checkTwoLevel(that.twoLevelSelectValue)){
return false;
}
return false;
}
if (!this.twoLevelValue) {
// 分享有赏
if (this.linkId === 'yueshi') {
this.selectLinkObj.id = this.linkId;
this.selectLinkObj.name = '分享有赏';
this.$emit('linkSelect', this.selectLinkObj);
this.$emit('update:linkVisible', false);
this.resetAll();
return;
}
if (!!this.selectLinkObj.name && !!this.selectLinkObj.id) {
// 触发父组件方法,传递参数
this.transData();
} else {
this.$message.error({
duration: 1000,
message: "请选择链接"
});
}
}
// 如果门店签到
if(that.twoLevelSelectValue == 'sign'){
if(!that.checkTwoLevel(that.twoLevelSelectValue)){
return false;
}
return false;
}
// 如果是商品分类
if(that.twoLevelSelectValue == 'goodsCate'){
if(!that.checkTwoLevel(that.twoLevelSelectValue)){
return false;
})
}
return false;
}
// 分享有赏
if (this.linkId === 'yueshi') {
this.selectLinkObj.id = this.linkId;
this.selectLinkObj.name = '分享有赏';
this.$emit('linkSelect', this.selectLinkObj);
this.$emit('update:linkVisible', false);
this.resetAll();
return;
}
if (!!this.selectLinkObj.name && !!this.selectLinkObj.id) {
// 触发父组件方法,传递参数
this.transData();
} else {
this.$message.error({
duration: 1000,
message: "请选择链接"
})
}
});
},
getMallId(item) {
......@@ -1770,10 +1773,9 @@ export default {
// 触发父组件方法,传递参数
transData() {
console.log(this.selectLinkObj);
this.$emit('linkSelect', this.selectLinkObj);
this.$emit('update:linkVisible', false);
// this.resetAll();
this.resetAll();
},
// 获取一级列表
......
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