Commit 1bd87c65 by member

fix: 修复商品链接分页问题

parent c38d6944
......@@ -63,7 +63,9 @@ export default {
watch: {
treeVis(newval) {
if (!newval) {
this.$emit('pass-mall', this.mallData);
if (this.mallData) {
this.$emit('pass-mall', this.mallData);
}
}
}
}
......
......@@ -36,6 +36,7 @@ components: {linkId
title="链接小工具"
:close-on-click-modal="false"
:visible.sync="mylinkToolsVisible"
@close="changeVisible"
:modal-append-to-body="false">
<!-- 链接类型 -->
<div class="links-types">
......@@ -72,7 +73,7 @@ components: {linkId
<goods-tree v-if="goodsTreeVisible" @pass-mall="getMallId" :tree-data="treeData"></goods-tree>
<!-- 商品分类链接 -->
<treeselect
<!-- <treeselect
v-if="threeLevelTreeVisible"
v-model="threeLevelValue"
:options="goodsCategoryOptions"
......@@ -82,7 +83,7 @@ components: {linkId
noOptionsText="暂无数据"
noResultsText="无数据"
@select="goodsCategorySelect"
/>
/> -->
<!-- 搜索后出现下列 -->
<el-select
v-if="threeLevelSearchVisible"
......@@ -308,9 +309,6 @@ components: {linkId
</table>
</div>
</div> -->
</div>
<!-- 商品链接 -->
......@@ -393,7 +391,7 @@ components: {linkId
</div>
<!-- 底部按钮 -->
<span slot="footer" class="dialog-footer">
<el-button @click="cancelLinkSelect">取 消</el-button>
<!-- <el-button @click="cancelLinkSelect">取 消</el-button> -->
<el-button type="primary" @click="confirmLinkSelect">确 定</el-button>
</span>
</el-dialog>
......@@ -401,6 +399,7 @@ components: {linkId
</template>
<script>
// 使用树形插件
// import the component
import Treeselect from '@riophae/vue-treeselect';
......@@ -412,8 +411,10 @@ import GoodsTree from './goods-tree';
import qs from 'qs';
export default {
name: 'links',
props: ['linkToolsVisible','showType','projectName'],
name: 'links-tool',
props: ['linkVisible','showType','projectName'],
data () {
return {
treeData: [],
......@@ -569,7 +570,7 @@ export default {
// ---------------------------
// 父组件传递的 props
mylinkToolsVisible: this.linkToolsVisible,
mylinkToolsVisible: false,
// 商品链接
goodsLinksVisible: false,
......@@ -672,6 +673,13 @@ export default {
}
},
methods: {
changeVisible() {
if (!this.selectLinkObj.id) {
this.selectLinkObj = '';
}
this.transData();
this.$emit('update:linkVisible', false);
},
handlePaddGift(list) {
// 拼接id
this.giftFlag = true;
......@@ -786,7 +794,7 @@ export default {
// twoLevelValueChange (二级选择,保存选择类型)
twoLevelValueChange(e) {
if (e == 'product_category_link') { // 商品链接
if (e == 'product_category_link') { // 商品分类链接
this.middleGoodId = e;
this.goodType = 10;
this.threeLevelVisible = true;
......@@ -807,6 +815,7 @@ export default {
}
var that = this
this.goodsLinksVisible = false;
this.visibleType = null;
// 清空已经选择
that.selectLinkObj.name = '';
......@@ -849,7 +858,8 @@ export default {
that.selectLinkObj.name = '';
that.selectLinkObj.url = '';
// 如果选择商品链接
if(selectTwoItem.type == 4){
if(selectTwoItem.type == 4) {
this.currentPage = 1;
that.getGoodsList(); // 获取商品列表
that.getGoodsCategory();// 获取商品品类
that.getGoodsClassify(); // 获取商品分类
......@@ -1014,7 +1024,6 @@ export default {
that.categoryOptions = [];
that.categoryOptions.push(onelevelCategory);
console.log("list:",that.categoryOptions)
return false;
}
......@@ -1024,7 +1033,6 @@ export default {
})
})
.catch(function (error) {
console.log(error);
// that.toLogin()
that.$message.error({
duration: 1000,
......@@ -1078,7 +1086,6 @@ export default {
that.goodsCategoryOptions = list;
that.classifyOptions = list;
// that.classifyOptions = list;
console.log("list:",list,that.goodsCategoryOptions)
return;
}
......@@ -1368,10 +1375,9 @@ export default {
// 页码变化触发
linkCurrentChange(val) {
var that = this
that.currentPage = val;
this.currentPage = val;
// 请求商品列表
that.getGoodsList();
this.getGoodsList();
},
// 选择商品链接
......@@ -1435,7 +1441,6 @@ export default {
that.axios.post(that.baseUrl+'/api-mall/page-mall-goods',qs.stringify(para))
.then((res) => {
console.log(res,res.data,res.data.errorCode)
var resData = res.data
if (resData.errorCode == 0) {
that.goodsList = resData.result.result
......@@ -1449,8 +1454,6 @@ export default {
})
})
.catch(function (error) {
console.log(error);
// that.toLogin()
that.$message.error({
duration: 1000,
message: error.message
......@@ -1479,25 +1482,22 @@ export default {
},
// 取消操作
cancelLinkSelect() {
var that = this
this.$confirm('确认关闭?', '', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: ''
}).then(() => {
console.log("点击确认")
that.$emit('linkSelect')
}).catch(() => {
console.log("取消 取消关闭")
});
},
// // 取消操作
// cancelLinkSelect() {
// var that = this
// this.$confirm('确认关闭?', '', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: ''
// }).then(() => {
// that.$emit('linkSelect')
// }).catch(() => {
// });
// },
// 确认操作
confirmLinkSelect() {
var that = this
// console.log(that.linksType,that.twoLevelValue,that.threeLevelValue,that.h5linkObj.conditionType)
// 如果选择 h5 判断选择的链接
if (that.oneLevelTypeValue == 5) {
if (!that.h5linkObj.name.trim() || !that.h5linkObj.url.trim()) {
......@@ -1536,7 +1536,6 @@ export default {
that.selectLinkObj.shareUrl = that.h5linkObj.shareUrl
}
}
console.log(that.selectLinkObj)
// that.selectLinkObj.fixParam = that.h5linkObj.fixParam;
// that.selectLinkObj.dynamicPara = that.h5linkObj.dynamicPara;
// 触发父组件方法,传递参数
......@@ -1579,8 +1578,6 @@ export default {
})
that.selectLinkObj.params = thirdDataList
}
console.log(this.selectLinkObj);
// 触发父组件方法,传递参数
that.transData();
return;
......@@ -1596,7 +1593,6 @@ export default {
return;
}
// 触发父组件方法,传递参数
console.log(that.selectLinkObj)
that.transData();
return;
}
......@@ -1695,6 +1691,7 @@ export default {
}
return false;
}
if (!!this.selectLinkObj.name && !!this.selectLinkObj.id) {
// 触发父组件方法,传递参数
this.transData();
......@@ -1714,7 +1711,6 @@ export default {
checkTwoLevel(v) {
var that = this
// console.log(that.threeLevelValue)
if (!that.threeLevelValue|| !that.threeLevelValue.length) {
that.$message.error({
duration: 1000,
......@@ -1785,9 +1781,8 @@ export default {
// 触发父组件方法,传递参数
transData() {
var that = this;
that.$emit('linkSelect', that.selectLinkObj)
that.resetAll();
this.$emit('linkSelect', this.selectLinkObj)
this.resetAll();
},
// 获取一级列表
......@@ -1804,7 +1799,6 @@ export default {
that.axios.post(that.baseUrl+'/api-plug/list-link-data',qs.stringify(para))
.then((res) => {
console.log(res,res.data,res.data.errorCode)
var resData = res.data
if (resData.errorCode == 0) {
that.setLevelListOptions(parentId,resData.result,num,twoType)
......@@ -1817,7 +1811,6 @@ export default {
})
})
.catch(function (error) {
console.log(error);
// that.toLogin()
that.$message.error({
duration: 1000,
......@@ -1873,7 +1866,6 @@ export default {
// 获取门店列表
getStoreList(query,threeLevelValue) {
var that = this
console.log(threeLevelValue.toString())
var para = {
searchParam: query,
selectedIds: threeLevelValue.toString(),
......@@ -1883,7 +1875,6 @@ export default {
that.axios.post(that.baseUrl+'/api-plug/query-store-by-code-name',qs.stringify(para))
.then((res) => {
console.log(res,res.data,res.data.errorCode)
var resData = res.data
if (resData.errorCode == 0) {
resData.result.forEach(function(ele,index){
......@@ -1919,11 +1910,9 @@ export default {
that.axios.post(that.baseUrl+'/api-auth/do-login',qs.stringify(para))
.then((res) => {
console.log(res,res.data,res.data.errorCode)
that.getLinksList(0,1)
})
.catch(function (error) {
console.log("error:",error);
})
},
......@@ -1952,7 +1941,6 @@ export default {
// 添加参数
addDynamic() {
var that = this
// console.log(that.dynamicRow)
if (!that.dynamicRow.key||!String(that.dynamicRow.value).trim()) {
that.$message.error({
duration: 1000,
......@@ -2040,7 +2028,7 @@ export default {
},
watch: {
linkToolsVisible(val) {
linkVisible(val) {
this.mylinkToolsVisible = val; // 新增linkToolsVisible的watch,监听变更并同步到linkToolsVisible上
},
// isWx(val) {
......@@ -2123,7 +2111,7 @@ export default {
vertical-align: middle;
width: 310px;
padding: 10px 10px;
/*height: 110px;*/
height: 110px;
border: 1px solid #dcdfe6;
border-radius: 4px;
margin-right: 7px;
......
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