Commit 93551557 by chenxin

fix: delete test code

parent 012830cb
<template>
<div>
<div class="filter-list">
<el-select v-model="cardType" style="width: 200px;" placeholder="卡券类型" clearable @change="handleChange">
<el-option v-for="item in cardOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
<el-input v-model="cardName" style="width: 200px; margin-left: 20px;" clear placeholder="输入卡券名称" @keyup.native.enter="handleSearch"></el-input>
</div>
<el-table ref="multipleTable" :data="cardData" class="card-table" tooltip-effect="dark" style="width: 100%" @row-click="handleCurrentChangeRow">
<el-table-column label width="55">
<template slot-scope="scope">
<el-radio class="radio-style" :label="scope.row.integralMallProId" :value="cardId">&nbsp;</el-radio>
</template>
</el-table-column>
<el-table-column label="卡券名称" prop="cardName"> </el-table-column>
<el-table-column prop="proSubName" label="备注名"></el-table-column>
<el-table-column prop="integralCost" label="兑换限制"></el-table-column>
<el-table-column prop="virtualStock" label="库存"></el-table-column>
</el-table>
<div class="pagination" v-if="total > 0">
<dm-pagination @current-change="cardCurrentChange" :current-page="cardCurrentPage" small :page-size="cardPageSize" layout="prev, pager, next" :total="total"></dm-pagination>
</div>
</div>
</template>
<script>
import qs from 'qs';
export default {
name: 'card-list',
props: {
pname: String,
cardId: String
},
data() {
return {
cardType: null, // 卡券类型
cardOptions: [
{ value: 1, label: '折扣券' },
{ value: 0, label: '抵金券' }
],
cardName: '',
cardCurrentPage: 1,
cardPageSize: 5,
cardLimitType: 1,
cardData: [],
total: 0
};
},
methods: {
// 当某行点击的时候
handleCurrentChangeRow(row) {
this.$nextTick(_ => {
// if (row.integralMallProId == this.radio) {
this.$emit('pass-id', row);
// }
});
},
getCardList() {
var param = {
currentPage: this.cardCurrentPage,
pageSize: this.cardPageSize,
requestProject: this.pname,
cardType: this.cardType,
proName: this.cardName
};
this.axios
.get(this.baseUrl + '/api-integral-mall/page-cards-plug', { params: param })
.then(res => {
const resData = res.data;
if (resData.errorCode == 0) {
if (!!resData.result) {
if (!!resData.result.rows) {
this.cardData = resData.result.rows;
} else {
this.cardData = [];
}
this.total = resData.result.total;
}
} else {
this.$message.error({ duration: 1000, message: resData.message });
}
})
.catch(error => {
this.$message.error({
duration: 10000,
message: error.message
});
});
},
// 当前切换分页
cardCurrentChange(val) {
this.cardCurrentPage = val;
this.getCardList();
},
handleChange(val) {
this.cardCurrentPage = 1;
this.getCardList();
},
handleSearch() {
this.cardCurrentPage = 1;
this.getCardList();
}
},
created() {
const host = window.location.origin;
this.baseUrl = host.indexOf('localhost') > -1 ? 'http://gicdev.demogic.com' : host;
},
mounted() {
this.getCardList();
}
};
</script>
<style scoped>
.filter-list {
margin-bottom: 10px;
}
.pagination {
text-align: right;
margin-top: 10px;
}
</style>
<template>
<div class="gift-list">
<div class="links-tools-row">
<el-select v-model="giftVal" style="width: 200px;" placeholder="礼品类型" clearable @change="handleChange">
<el-option v-for="item in giftOptions" :key="item.integralMallCategoryId" :label="item.categoryName" :value="item.integralMallCategoryId"></el-option>
</el-select>
<el-input v-model="giftName" style="width: 200px; margin-left: 20px;" placeholder="输入礼品名称" @keyup.native.enter="handleSearch"></el-input>
</div>
<div class="goods-link-content">
<ul class="goods-link-list">
<li class="goods-link-item" v-for="(item, index) in goodsList" :key="index" :class="activeIndex == index ? 'good-highlight' : ''" @click="selectGoodLinkItem(item, index)">
<img :src="item.mainImageUrl" class="img" alt="商品图片" />
<div class="inline-block goods-message">
<p class="limit-2 pro-name">{{ item.proName }}</p>
<p class="gray-color pro-code pro-name">所需积分:{{ item.integralCost }}</p>
<p class="pro-price pro-name">所需现金:{{ item.cashCost }}</p>
</div>
</li>
</ul>
</div>
<div class="links-tools-page" v-if="total > 0">
<dm-pagination @current-change="handleChangePage" :current-page="currentPage" :page-size="pageSize" layout="prev, pager, next" :total="total"></dm-pagination>
</div>
</div>
</template>
<script>
import qs from 'qs';
export default {
name: 'gift-list',
props: {
pname: String,
giftId: String
},
data() {
return {
currentPage: 1,
activeIndex: -1,
pageSize: 6,
total: 0,
giftVal: null,
giftOptions: [],
goodsList: [],
giftName: ''
};
},
created() {
const host = window.location.origin;
this.baseUrl = host.indexOf('localhost') > -1 ? 'http://gicdev.demogic.com' : host;
},
methods: {
// 分类
getGiftList() {
this.axios.get(`${this.baseUrl}/api-integral-mall/load-category?requestProject=gic-web`).then(res => {
const resData = res.data;
if (resData.errorCode === 0) {
if (!!resData.result && resData.result.length) {
this.giftOptions = resData.result;
}
}
});
},
// 分页换页
handleChangePage(val) {
this.currentPage = val;
this.getData();
},
handleChange() {
this.currentPage = 1;
this.getData();
},
// 分页数据 integralCost积分费用 cashCost现金费用 proName
getData() {
const params = {
requestProject: 'gic-web',
currentPage: this.currentPage,
pageSize: this.pageSize,
category: this.giftVal,
giftName: this.giftName,
changeType: -1,
releaseType: -1,
showStatus: 1,
porHot: -1
};
this.axios.post(`${this.baseUrl}/api-integral-mall/page-gift`, qs.stringify(params)).then(res => {
const data = res.data;
if (data.errorCode == 0) {
if (!!data.result && data.result.rows) {
this.goodsList = data.result.rows;
this.goodsList.map((el, index) => {
if (el.integralMallProId == this.giftId) {
this.selectGoodLinkItem(el, index);
}
});
}
this.total = data.result.total || 0;
}
});
},
selectGoodLinkItem(item, i) {
this.activeIndex = i;
this.$emit('pass-gift', item);
},
handleSearch() {
this.currentPage = 1;
this.getData();
}
},
mounted() {
this.getGiftList();
this.getData();
}
};
</script>
<style scoped>
.links-tools-row {
margin-bottom: 10px;
}
.links-tools-row .goods-link-item {
display: inline-block;
vertical-align: middle;
width: 307px;
padding: 8px;
margin-right: 7px;
margin-bottom: 10px;
border: 1px solid #dcdfe6;
border-radius: 4px;
box-sizing: border-box;
}
.links-tools-row .goods-link-item .img {
display: inline-block;
vertical-align: middle;
width: 80px;
height: 80px;
}
.links-tools-page {
text-align: right;
}
.links-tools-row .goods-link-item:hover {
cursor: pointer;
border-color: #1890ff;
}
.links-tools-row .goods-link-item .goods-message {
margin-left: 10px;
padding: 5px;
width: 198px;
box-sizing: border-box;
font-size: 12px;
}
.links-tools-row .good-highlight {
border-color: #1890ff;
}
.goods-link-item .goods-message .pro-name {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
margin: 8px 0;
}
</style>
<template>
<div class="plug-sg">
<el-popover popper-class="plug-sg__popover" placement="bottom" trigger="click" v-model="treeVis">
<el-input slot="reference" suffix-icon="el-icon-arrow-down" v-model="ategory" placeholder="所有分类"></el-input>
<el-tree class="plug-sg__tree" ref="tree" :default-expand-all="true" node-key="mallProTagId" :data="treeData" :props="defaultProps" :highlight-current="true" :current-node-key="currentGoodId" @node-click="handleNodeClick"> </el-tree>
<div class="good-tree-btn">
<el-button @click.prevent.stop="hideTree" type="text" size="small" style="color:#303133">取消</el-button>
<el-button @click.prevent.stop="confirmBtn" type="text" size="small">确定</el-button>
</div>
</el-popover>
</div>
</template>
<script>
export default {
name: 'goods-tree',
props: {
model: {
type: Object,
default() {
return {};
}
},
width: {
type: String,
default: '300'
},
treeData: Array,
currentGoodId: String
},
data() {
return {
treeVis: false,
ategory: '',
defaultProps: {
children: 'childrenList',
label: 'tagName'
}
};
},
methods: {
handleNodeClick(data) {
this.mallData = data;
this.ategory = data.tagName;
},
hideTree() {
this.treeVis = false;
},
confirmBtn() {
this.treeVis = false;
},
getRewriteData(treeData) {
treeData.map(el => {
if (el.mallProTagId == this.currentGoodId) {
this.treeVis = true;
this.handleNodeClick(el);
} else if (Array.isArray(el.childrenList)) {
this.getRewriteData(el.childrenList);
}
});
}
},
watch: {
treeVis(newval) {
if (!newval) {
if (this.mallData) {
this.$emit('pass-mall', this.mallData);
}
}
},
treeData(treeData) {
if (this.currentGoodId && Array.isArray(treeData)) {
this.getRewriteData(treeData);
}
}
}
};
</script>
<style lang="scss">
.plug-sg {
display: inline-block;
width: 200px;
&__popover {
padding: 10px 0 0 0;
}
&__btn {
height: 36px;
padding: 0 10px;
border-top: 1px solid #ebeef5;
line-height: 34px;
text-align: right;
&--cancel {
color: #606266;
}
}
&__tree {
height: 260px;
width: 200px;
overflow-y: auto;
.el-tree-node__label {
text-overflow: ellipsis;
display: inline-block;
white-space: nowrap;
width: 100%;
overflow: hidden;
}
&::-webkit-scrollbar {
width: 0px;
height: 0px;
}
}
}
.good-tree-btn {
float: right;
margin-right: 10px;
}
</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