coupon
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
<template>
|
||||
<view class="c-coupon">
|
||||
<view :class="status == 0 ? 'coupon-usable' : 'coupon-unable'">
|
||||
<view :class="type == 1 && status != 0 ? 'coupon-unable' : 'coupon-usable'">
|
||||
<view class="info-type" :style="{ backgroundImage: 'url(' + (status == 0 ? '/static/image/mine/30.png' : '/static/image/mine/31.png') + ')', backgroundSize:'contain', backgroundRepeat: 'no-repeat' }">
|
||||
<div class="wrap_left_top"></div>
|
||||
{{ couponInfo.index&1 ? '店铺优惠券' : '平台优惠券' }}
|
||||
{{ couponInfo.type == 2 ? '店铺优惠券' : '平台优惠券' }}
|
||||
</view>
|
||||
<view class="coupon-info">
|
||||
<view class="info-usable">
|
||||
<view class="price">¥<span>10</span></view>
|
||||
<view class="condition">满100使用</view>
|
||||
<view class="price">¥<span>{{ couponInfo.vouchertemplate_price }}</span></view>
|
||||
<view class="condition">满{{ couponInfo.vouchertemplate_limit }}使用</view>
|
||||
</view>
|
||||
<view class="info-store u-line-1">仅限 nike官方旗舰店 鞋子商品使用</view>
|
||||
<view class="info-integral">兑换积分:200积分</view>
|
||||
<view class="info-date">有效期2018.09.06-2018.10.06</view>
|
||||
<view class="info-store u-line-1">仅限{{ couponInfo.vouchertemplate_storename }}鞋子商品使用</view>
|
||||
<view class="info-integral">兑换积分:{{ couponInfo.vouchertemplate_points }}积分</view>
|
||||
<view class="info-date">有效期{{ couponInfo.vouchertemplate_startdate }}-{{ couponInfo.vouchertemplate_enddate }}</view>
|
||||
</view>
|
||||
<view class="coupon-btn">
|
||||
<text v-if="type == 0 && status == 0" @click="exchange">立即兑换</text>
|
||||
<text v-if="type == 0 && status == 0" @click="exchangeCoupon">立即兑换</text>
|
||||
<text v-if="type == 1 && status == 0" @click="use">立即使用</text>
|
||||
<image v-if="status == 1" src="/static/image/mine/28.png"></image>
|
||||
<image v-if="status == 2" src="/static/image/mine/29.png"></image>
|
||||
<image v-if="type == 1 && status == 1" src="/static/image/mine/28.png"></image>
|
||||
<image v-if="type == 1 && status == 2" src="/static/image/mine/29.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -27,7 +27,7 @@
|
||||
/**
|
||||
* coupon 优惠券
|
||||
* @description 优惠券组件
|
||||
* @property {Number} type 优惠券操作方式(兑换优惠券: 0 / 使用优惠券: 1)
|
||||
* @property {Number} type 优惠券操作方式(可兑换的优惠券: 0 / 自己的优惠券: 1)
|
||||
* @property {Object} coupon-info 优惠券信息
|
||||
* @event {Function} exchange 兑换优惠券
|
||||
* @event {Function} use 使用优惠券
|
||||
@@ -41,12 +41,21 @@ export default {
|
||||
type: Number,
|
||||
couponInfo: Object,
|
||||
},
|
||||
created() {
|
||||
console.log(this.couponInfo);
|
||||
},
|
||||
methods: {
|
||||
exchange() {
|
||||
this.$emit('exchange', this.couponInfo.index);
|
||||
this.$emit('exchange', this.couponInfo.vouchertemplate_id);
|
||||
},
|
||||
exchangeCoupon() {
|
||||
this.$u.api.getCoupon({ id: this.couponInfo.vouchertemplate_id }).then(res => {
|
||||
this.$u.toast(res.message);
|
||||
if(res.errCode == 0) {}
|
||||
})
|
||||
},
|
||||
use() {
|
||||
this.$emit('use', this.couponInfo.index);
|
||||
this.$emit('use', this.couponInfo.vouchertemplate_id);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user