You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
282 lines
7.1 KiB
282 lines
7.1 KiB
<template>
|
|
<div class="integral">
|
|
<div class="BG">
|
|
<div class="BG_H">积分商城</div>
|
|
<div class="BG_myIntegral" v-if="isSignin">我的积分:{{ IntegralInfo.point }}</div>
|
|
<div class="BG_noLogin" v-if="!isSignin">
|
|
您还未登录,请前往
|
|
<nuxt-link class="goLogin" to="/login">登录</nuxt-link>!
|
|
</div>
|
|
</div>
|
|
<div class="wrapper_1200">
|
|
<el-tabs v-model="activeName" @tab-click="handleClick">
|
|
<el-tab-pane
|
|
v-for="(item, index) in typelists"
|
|
:key="index"
|
|
:label="item.type_name"
|
|
:name="String(item.id)"
|
|
>
|
|
<div class="integral_content" v-for="(V, I) in integralData" :key="I">
|
|
<!-- <div class="integral_title">{{ V.type_name }}</div> -->
|
|
<div class="integral_cardBox">
|
|
<div class="integral_card" @click="goDetail(V.id)">
|
|
<div class="integral_card_img">
|
|
<img :src="imgUrl + V.image" alt />
|
|
</div>
|
|
<div class="integral_card_title">
|
|
<div class="integral_card_name">{{ V.name }}</div>
|
|
<div class="integral_card_txt">
|
|
<div class="l">
|
|
<img src="../../assets/images/integral_exchange.png" alt />
|
|
<p v-if="V.type == 1">{{ V.point }}积分+{{ V.price }}元</p>
|
|
<p v-if="V.type == 2">{{ V.point }}积分</p>
|
|
</div>
|
|
<div class="r">库存:{{ V.stock }}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</el-tab-pane>
|
|
</el-tabs>
|
|
<Page
|
|
:total="Page.total"
|
|
:pageSize="Page.pageSize"
|
|
:currentPage="Page.currentPage"
|
|
:emptyShow="false"
|
|
@currentChange="currentChange"
|
|
/>
|
|
<div class="nothing" v-if="!isSignin">
|
|
<img src="@/assets/images/noGoods.png" style="margin: 0 auto" />
|
|
<p style="text-align: center">您尚未登录,请先进行登录</p>
|
|
</div>
|
|
<div class="nothing" v-if="!integralData.length && isSignin">
|
|
<img src="@/assets/images/noGoods.png" style="margin: 0 auto" />
|
|
|
|
<p style="text-align: center">暂无商品,去看点别的吧</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import Setting from "~/setting";
|
|
export default {
|
|
auth: false,
|
|
data() {
|
|
return {
|
|
isSignin: localStorage.getItem("token") ? true : false,
|
|
imgUrl: Setting.uplodBaseURL,
|
|
Page: {
|
|
total: 0,
|
|
pageSize: 4,
|
|
currentPage: 1,
|
|
},
|
|
typelists: [],
|
|
activeName: "1",
|
|
integralData: [],
|
|
IntegralInfo: {},
|
|
};
|
|
},
|
|
created() {
|
|
if (this.isSignin) {
|
|
this.getTypeLists();
|
|
this.getlist();
|
|
this.getIntegralInfo();
|
|
}
|
|
},
|
|
methods: {
|
|
getTypeLists() {
|
|
this.$axios
|
|
.post(`/goodsexchange/typelists`)
|
|
.then((res) => {
|
|
this.typelists = res.data;
|
|
})
|
|
.catch((err) => {
|
|
console.log(err);
|
|
});
|
|
},
|
|
getlist(id) {
|
|
let obj = {
|
|
type_id: id ? id : 1,
|
|
};
|
|
this.$axios
|
|
.post(`/goodsexchange/lists`, obj)
|
|
.then((res) => {
|
|
this.Page.currentPage = res.data.currentPage;
|
|
this.Page.total = res.data.count;
|
|
this.integralData = res.data.list;
|
|
console.log(res.data.list);
|
|
})
|
|
.catch((err) => {
|
|
this.$message.error(err);
|
|
});
|
|
},
|
|
handleClick(tab, event) {
|
|
console.log(tab);
|
|
this.getlist(Number(tab.name));
|
|
},
|
|
currentChange(e) {
|
|
this.Page.currentPage = e;
|
|
this.getlist();
|
|
},
|
|
// 获取积分
|
|
getIntegralInfo() {
|
|
let obj = {
|
|
account_type: "point",
|
|
};
|
|
this.$axios.post("/memberaccount/info", obj).then((res) => {
|
|
this.IntegralInfo = res.data;
|
|
});
|
|
},
|
|
goDetail(id) {
|
|
this.$router.push({
|
|
path: "/integral/integral_goods_detail",
|
|
query: {
|
|
id,
|
|
},
|
|
});
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
.integral {
|
|
.BG {
|
|
width: 1920;
|
|
height: 220px;
|
|
background: url("../../assets/images/integralBG.png") no-repeat;
|
|
background-size: 100% 100%;
|
|
margin: 0 auto;
|
|
margin-bottom: 20px;
|
|
|
|
.BG_H {
|
|
width: 221px;
|
|
height: 58px;
|
|
font-size: 46px;
|
|
font-family: Helvetica;
|
|
color: #ffffff;
|
|
line-height: 55px;
|
|
padding-top: 52px;
|
|
margin: 0 auto;
|
|
font-style: italic;
|
|
}
|
|
.BG_myIntegral {
|
|
margin: 0 auto;
|
|
width: 200px;
|
|
height: 28px;
|
|
font-size: 20px;
|
|
font-family: PingFangSC-Semibold, PingFang SC;
|
|
font-weight: 600;
|
|
color: #ffffff;
|
|
line-height: 28px;
|
|
padding-top: 80px;
|
|
}
|
|
.BG_noLogin {
|
|
margin: 0 auto;
|
|
width: 200px;
|
|
height: 28px;
|
|
padding-top: 80px;
|
|
color: #ffffff;
|
|
.goLogin {
|
|
color: red;
|
|
cursor: pointer;
|
|
}
|
|
}
|
|
}
|
|
.integral_content {
|
|
.integral_title {
|
|
width: 72px;
|
|
height: 25px;
|
|
font-size: 18px;
|
|
font-family: PingFangSC-Medium, PingFang SC;
|
|
font-weight: 500;
|
|
color: #222222;
|
|
line-height: 25px;
|
|
margin: 20px;
|
|
margin-bottom: 0px;
|
|
}
|
|
.integral_cardBox {
|
|
display: flex;
|
|
// justify-content: space-around;
|
|
flex-wrap: wrap;
|
|
.integral_card {
|
|
width: 260px;
|
|
height: 303px;
|
|
background: #ffffff;
|
|
box-shadow: 0px 0px 10px 0px rgba(102, 102, 102, 0.2);
|
|
border-radius: 8px;
|
|
margin: 20px;
|
|
cursor: pointer;
|
|
.integral_card_img {
|
|
width: 259px;
|
|
height: 202px;
|
|
}
|
|
.integral_card_title {
|
|
margin: 15px;
|
|
.integral_card_name {
|
|
width: 200px;
|
|
height: 28px;
|
|
font-size: 20px;
|
|
font-family: PingFangSC-Medium, PingFang SC;
|
|
font-weight: 500;
|
|
color: #222222;
|
|
line-height: 28px;
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
text-overflow: ellipsis;
|
|
}
|
|
.integral_card_txt {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
height: 40px;
|
|
font-size: 14px;
|
|
font-family: PingFangSC-Regular, PingFang SC;
|
|
font-weight: 400;
|
|
line-height: 40px;
|
|
.l {
|
|
display: flex;
|
|
color: #ff7d02;
|
|
img {
|
|
width: 16px;
|
|
height: 16px;
|
|
margin-top: 12px;
|
|
}
|
|
}
|
|
.r {
|
|
color: #666666;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.wrapper_1200 {
|
|
/deep/.el-tabs__item.is-active {
|
|
color: var(--themeColor);
|
|
}
|
|
/deep/.el-tabs__active-bar {
|
|
background-color: var(--themeColor);
|
|
}
|
|
/deep/ .el-tabs__item:hover {
|
|
color: var(--themeColor);
|
|
}
|
|
/deep/ .el-tab-pane {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
}
|
|
}
|
|
}
|
|
.nothing {
|
|
padding-bottom: 150px;
|
|
font-size: 16px;
|
|
text-align: center;
|
|
color: #969696;
|
|
|
|
img {
|
|
margin: 0 auto !important;
|
|
}
|
|
p {
|
|
text-align: center !important;
|
|
}
|
|
}
|
|
</style>
|
|
|