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.
|
|
<template><!--优惠券--><view class="coupon-warp-box" :style="'margin-bottom: ' + meta.margin_bottom + 'px'" v-if="indexCoupon && indexCoupon.length"> <view class="coupon-item-box" :style="'background: ' + config.mainColor" v-for="(item, index) in indexCoupon" :key="index"> <view class="coupon-item"> <view class="left"> <block v-if="item.associate.action_type.type == 'cash'"> <span class="money"> ¥ </span> <span class="num"> {{ item.associate.action_type.value }} </span> </block>
<block v-if="item.associate.action_type.type == 'discount'"> <span class="num"> {{ item.associate.action_type.value }} </span> <span class="money"> 折 </span> </block> </view> <view class="right"> <view class="label"> {{item.associate.title}} </view> <view class="btn" :style="'color: ' + config.mainColor" :data-code="item.associate.code" :data-index="index" v-if="!item.associate.has_get" @tap="getCoupon"> 点击领取 </view> <view class="btn" :data-id="item.associate_id" v-else catchtap="_jumpList"> 去使用 </view> </view> </view> </view></view></template><script>
export default { data() { return {}; },
props: { config: { type: Object, value: '' }, indexCoupon: { type: Array, value: '' }, show: { type: Number, value: '' }, meta: { type: Object, value: "" } }, //组件的方法
methods: { //分发事件出去
getCoupon(e) { var code = e.currentTarget.dataset.code; var index = e.currentTarget.dataset.index; var myEventDetail = { code: code, index: index }; this.$emit('myGetCoupon', myEventDetail); },
_jumpList(e) { var id = e.currentTarget.dataset.id; wx.navigateTo({ url: '/pages/coupon/goods/goods?id=' + id }); }
}};</script>
<style rel="stylesheet/less" lang="less">@import "index-coupon";</style>
|