|
|
@@ -20,11 +20,11 @@
|
|
|
<van-button
|
|
|
size="small"
|
|
|
@click="getActivity(item, index)"
|
|
|
- :disabled="!canGet(item)"
|
|
|
+ :disabled="!canGet(item) || item.stock === 0"
|
|
|
type="primary"
|
|
|
round
|
|
|
block
|
|
|
- >领取</van-button
|
|
|
+ >{{ item.stock ? '领取' : '无库存' }}</van-button
|
|
|
>
|
|
|
</div>
|
|
|
|
|
|
@@ -34,19 +34,24 @@
|
|
|
|
|
|
<van-empty v-if="empty" description="暂无活动哦~" :image="require('@assets/kong_png_wusousuo.png')" />
|
|
|
</van-list>
|
|
|
+
|
|
|
+ <order-open ref="box" :imgSrc="getImg(orderInfo.pic)"></order-open>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import OrderOpen from '../../components/order/OrderOpen.vue';
|
|
|
import list from '../../mixins/list';
|
|
|
export default {
|
|
|
+ components: { OrderOpen },
|
|
|
name: 'Search',
|
|
|
mixins: [list],
|
|
|
data() {
|
|
|
return {
|
|
|
list: [],
|
|
|
empty: false,
|
|
|
- url: '/activityCollection/all'
|
|
|
+ url: '/activityCollection/all',
|
|
|
+ orderInfo: {}
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -89,10 +94,30 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
getActivity(info, index) {
|
|
|
- this.$dialog.confirm({
|
|
|
- title: '提示',
|
|
|
- message: `确认要使用${info.num}张${info.collectionName}兑换一张${info.awardCollectionName}吗?`,
|
|
|
- confirmButtonText: '立即兑换'
|
|
|
+ this.$dialog
|
|
|
+ .confirm({
|
|
|
+ title: '提示',
|
|
|
+ message: `确认要使用${info.num}张${info.collectionName}兑换一张${info.awardCollectionName}吗?`,
|
|
|
+ confirmButtonText: '立即兑换'
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ return this.$http.post('/activityOrder/create?mintActivityId=' + info.id);
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.getData(true);
|
|
|
+ this.orderInfo = res;
|
|
|
+ this.show();
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ if (e && e.error) {
|
|
|
+ this.$toast(e.error);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ show() {
|
|
|
+ this.$refs.box.show = true;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.box.open();
|
|
|
});
|
|
|
}
|
|
|
}
|