|
@@ -1,46 +1,46 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <div class="shop">
|
|
|
|
|
- <van-tabs sticky shrink @change="changeTab" v-model:active="active" swipeable :swipe-threshold="2">
|
|
|
|
|
- <van-tab title="通行证购买">
|
|
|
|
|
- <div class="list" @click="clear">
|
|
|
|
|
- <pass-card
|
|
|
|
|
- v-for="(item, index) in ticketPrices"
|
|
|
|
|
- @choose="choose"
|
|
|
|
|
- :key="index"
|
|
|
|
|
- :info="item"
|
|
|
|
|
- :isChoose="chooseTicket === item.type"
|
|
|
|
|
- ></pass-card>
|
|
|
|
|
- </div>
|
|
|
|
|
- </van-tab>
|
|
|
|
|
- <van-tab title="通行证兑换">
|
|
|
|
|
- <div class="list">
|
|
|
|
|
- <pass-card
|
|
|
|
|
- v-for="(item, index) in ticketPrices"
|
|
|
|
|
- @choose="choose"
|
|
|
|
|
- balance
|
|
|
|
|
- :key="index"
|
|
|
|
|
- :info="item"
|
|
|
|
|
- :isChoose="chooseTicket === item.type"
|
|
|
|
|
- ></pass-card>
|
|
|
|
|
- </div>
|
|
|
|
|
- </van-tab>
|
|
|
|
|
- <van-tab title="藏品兑换">
|
|
|
|
|
- <div class="list">
|
|
|
|
|
- <product-info isChoose></product-info>
|
|
|
|
|
- <product-info></product-info>
|
|
|
|
|
- <product-info></product-info>
|
|
|
|
|
- </div>
|
|
|
|
|
- </van-tab>
|
|
|
|
|
|
|
+ <div class="shop" @click="clear">
|
|
|
|
|
+ <van-tabs shrink @change="changeTab" v-model:active="active" :swipe-threshold="2">
|
|
|
|
|
+ <van-tab title="通行证购买"> </van-tab>
|
|
|
|
|
+ <van-tab title="通行证兑换"> </van-tab>
|
|
|
|
|
+ <van-tab title="藏品兑换"> </van-tab>
|
|
|
</van-tabs>
|
|
</van-tabs>
|
|
|
|
|
|
|
|
|
|
+ <van-list
|
|
|
|
|
+ @click="clear"
|
|
|
|
|
+ v-model:loading="loading"
|
|
|
|
|
+ :immediate-check="false"
|
|
|
|
|
+ :finished="finished"
|
|
|
|
|
+ finished-text=""
|
|
|
|
|
+ @load="getData"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template v-if="active === 2">
|
|
|
|
|
+ <product-info
|
|
|
|
|
+ v-for="(item, index) in list"
|
|
|
|
|
+ @choose="choose"
|
|
|
|
|
+ :key="index"
|
|
|
|
|
+ :info="item"
|
|
|
|
|
+ :isChoose="chooseTicket === item.id"
|
|
|
|
|
+ ></product-info>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-else>
|
|
|
|
|
+ <pass-card
|
|
|
|
|
+ v-for="(item, index) in list"
|
|
|
|
|
+ @choose="choose"
|
|
|
|
|
+ :key="index"
|
|
|
|
|
+ :info="item"
|
|
|
|
|
+ :isChoose="chooseTicket === item.type"
|
|
|
|
|
+ :balance="active === 1"
|
|
|
|
|
+ ></pass-card>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </van-list>
|
|
|
|
|
+
|
|
|
<div class="bottom" v-if="chooseTicket">
|
|
<div class="bottom" v-if="chooseTicket">
|
|
|
- <van-button color="#12131E" block v-if="active == 0" @click="buy">确认购买</van-button>
|
|
|
|
|
- <van-button type="primary" block v-else @click="$router.push('/exchange?ticket=' + chooseTicket)"
|
|
|
|
|
- >确认兑换</van-button
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <van-button color="#12131E" block v-if="active == 0" @click.stop="buy">确认购买</van-button>
|
|
|
|
|
+ <van-button type="primary" block v-else @click.stop="goExchange">确认兑换</van-button>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <ticket-buy ref="buy" :info="ticketInfo"></ticket-buy>
|
|
|
|
|
|
|
+ <ticket-buy ref="buy" :info="ticketInfo" @click.stop=""></ticket-buy>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -48,14 +48,18 @@
|
|
|
import PassCard from '../components/PassCard.vue';
|
|
import PassCard from '../components/PassCard.vue';
|
|
|
import ProductInfo from '../components/product/productInfo.vue';
|
|
import ProductInfo from '../components/product/productInfo.vue';
|
|
|
import TicketBuy from '../components/TicketBuy.vue';
|
|
import TicketBuy from '../components/TicketBuy.vue';
|
|
|
|
|
+import list from '../mixins/list.js';
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
active: 0,
|
|
active: 0,
|
|
|
ticketPrices: [],
|
|
ticketPrices: [],
|
|
|
- chooseTicket: ''
|
|
|
|
|
|
|
+ chooseTicket: '',
|
|
|
|
|
+ list: [],
|
|
|
|
|
+ listKey: ''
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
|
|
+ mixins: [list],
|
|
|
components: {
|
|
components: {
|
|
|
PassCard,
|
|
PassCard,
|
|
|
ProductInfo,
|
|
ProductInfo,
|
|
@@ -63,28 +67,55 @@ export default {
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
|
ticketInfo() {
|
|
ticketInfo() {
|
|
|
- let info = [...this.ticketPrices].find(item => {
|
|
|
|
|
|
|
+ let info = [...this.list].find(item => {
|
|
|
return item.type === this.chooseTicket;
|
|
return item.type === this.chooseTicket;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
return info ? info : {};
|
|
return info ? info : {};
|
|
|
|
|
+ },
|
|
|
|
|
+ url() {
|
|
|
|
|
+ if (this.active === 2) {
|
|
|
|
|
+ return '/exchangeItem/all';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return '/ticketPrice/all';
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
- this.$http
|
|
|
|
|
- .post('/ticketPrice/all', { size: 1000, query: { del: false } }, { body: 'json' })
|
|
|
|
|
- .then(res => {
|
|
|
|
|
- this.ticketPrices = res;
|
|
|
|
|
- })
|
|
|
|
|
- .catch(e => {
|
|
|
|
|
- console.log(e);
|
|
|
|
|
- this.$toast(e.error);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ // this.$http
|
|
|
|
|
+ // .post('/ticketPrice/all', { size: 1000, query: { del: false } }, { body: 'json' })
|
|
|
|
|
+ // .then(res => {
|
|
|
|
|
+ // this.ticketPrices = res;
|
|
|
|
|
+ // })
|
|
|
|
|
+ // .catch(e => {
|
|
|
|
|
+ // console.log(e);
|
|
|
|
|
+ // this.$toast(e.error);
|
|
|
|
|
+ // });
|
|
|
if (this.$route.query.active) {
|
|
if (this.$route.query.active) {
|
|
|
this.active = Number(this.$route.query.active);
|
|
this.active = Number(this.$route.query.active);
|
|
|
|
|
+ if (this.active == 2) {
|
|
|
|
|
+ this.listKey = 'content';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.listKey = '';
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.getData(true);
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ goExchange() {
|
|
|
|
|
+ if (this.active === 1) {
|
|
|
|
|
+ this.$router.push('/exchange?ticket=' + this.chooseTicket);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$router.push('/exchangeCollection?exchangeItemId=' + this.chooseTicket);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ beforeData() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ query: { del: false }
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
choose(type) {
|
|
choose(type) {
|
|
|
this.chooseTicket = type;
|
|
this.chooseTicket = type;
|
|
|
},
|
|
},
|
|
@@ -95,6 +126,12 @@ export default {
|
|
|
active: this.active
|
|
active: this.active
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
+ if (this.active == 2) {
|
|
|
|
|
+ this.listKey = 'content';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.listKey = '';
|
|
|
|
|
+ }
|
|
|
|
|
+ this.getData(true);
|
|
|
},
|
|
},
|
|
|
clear() {
|
|
clear() {
|
|
|
this.chooseTicket = '';
|
|
this.chooseTicket = '';
|
|
@@ -113,15 +150,15 @@ export default {
|
|
|
justify-content: space-between;
|
|
justify-content: space-between;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /deep/.van-swipe__track {
|
|
|
|
|
- min-height: calc(var(--app-height) - var(--safe-top) - var(--safe-bottom) - 94px);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // /deep/.van-swipe__track {
|
|
|
|
|
+ // min-height: calc(var(--app-height) - var(--safe-top) - var(--safe-bottom) - 94px);
|
|
|
|
|
+ // }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.list {
|
|
.list {
|
|
|
padding: 8px;
|
|
padding: 8px;
|
|
|
.bottom(50px);
|
|
.bottom(50px);
|
|
|
- min-height: calc(var(--app-height) - var(--safe-top) - var(--safe-bottom) - 94px);
|
|
|
|
|
|
|
+ // min-height: calc(var(--app-height) - var(--safe-top) - var(--safe-bottom) - 94px);
|
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
|
}
|
|
}
|
|
|
|
|
|