|
@ -8,10 +8,10 @@ |
|
|
<view class="demand">满{{ item.minPoint }} 减 {{ item.amount }}</view> |
|
|
<view class="demand">满{{ item.minPoint }} 减 {{ item.amount }}</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="get-btn" v-if="!types" :style="{color:color, borderColor:color, background:solid}" |
|
|
<view class="get-btn" :style="{color:color, borderColor:color, background:solid}" |
|
|
@click="acceptCoupon(item)">立即领取</view> |
|
|
@click="acceptCoupon(item)">立即领取</view> |
|
|
<navigator class="get-btn" v-if="types" :style="{color:color, borderColor:color, background:solid}" |
|
|
<!-- <navigator class="get-btn" v-if="types" :style="{color:color, borderColor:color, background:solid}" |
|
|
:url='item.url' @click="useCoupon(item)">立即使用</navigator> |
|
|
:url='item.url' @click="useCoupon(item)">立即使用</navigator> --> |
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
@ -21,6 +21,9 @@ |
|
|
import { |
|
|
import { |
|
|
formatDate |
|
|
formatDate |
|
|
} from '@/common/date'; |
|
|
} from '@/common/date'; |
|
|
|
|
|
import { |
|
|
|
|
|
mapState |
|
|
|
|
|
} from 'vuex'; |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
components: { |
|
|
components: { |
|
@ -54,25 +57,34 @@ |
|
|
return formatDate(date, 'yyyy-MM-dd hh:mm:ss') |
|
|
return formatDate(date, 'yyyy-MM-dd hh:mm:ss') |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
|
|
|
computed: { |
|
|
|
|
|
...mapState(['hasLogin', 'userInfo']), |
|
|
|
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
async acceptCoupon(item) { |
|
|
async acceptCoupon(item) { |
|
|
this.types = !this.types |
|
|
if (this.hasLogin) { |
|
|
uni.showLoading({ |
|
|
this.types = !this.types |
|
|
title: '请稍后' |
|
|
uni.showLoading({ |
|
|
}); |
|
|
title: '请稍后' |
|
|
|
|
|
}); |
|
|
let params = { |
|
|
|
|
|
couponId: item.id |
|
|
let params = { |
|
|
}; |
|
|
couponId: item.id |
|
|
let data = await Api.apiCall('post', Api.index.acceptCoupon, params); |
|
|
}; |
|
|
console.log(data); |
|
|
|
|
|
if (data) { |
|
|
|
|
|
this.$api.msg(data); |
|
|
|
|
|
this.clickSubMethod(item) |
|
|
this.clickSubMethod(item) |
|
|
|
|
|
// let data = await Api.apiCall('post', Api.index.acceptCoupon, params); |
|
|
|
|
|
// console.log("data?????", data); |
|
|
|
|
|
// if (data) { |
|
|
|
|
|
// // this.$api.msg(data); |
|
|
|
|
|
// this.clickSubMethod(item) |
|
|
|
|
|
|
|
|
|
|
|
// } |
|
|
|
|
|
uni.hideLoading(); |
|
|
|
|
|
} else { |
|
|
|
|
|
uni.navigateTo({ |
|
|
|
|
|
url: '/pages/public/login' |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
uni.hideLoading(); |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
clickSubMethod(vel) { |
|
|
clickSubMethod(vel) { |
|
|
console.log('clickSubMethod') |
|
|
console.log('clickSubMethod') |
|
|