2023-02-23
功能完善
This commit is contained in:
@@ -8,10 +8,10 @@
|
||||
<view class="demand">满{{ item.minPoint }} 减 {{ item.amount }}</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>
|
||||
<navigator class="get-btn" v-if="types" :style="{color:color, borderColor:color, background:solid}"
|
||||
:url='item.url' @click="useCoupon(item)">立即使用</navigator>
|
||||
<!-- <navigator class="get-btn" v-if="types" :style="{color:color, borderColor:color, background:solid}"
|
||||
:url='item.url' @click="useCoupon(item)">立即使用</navigator> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
import {
|
||||
formatDate
|
||||
} from '@/common/date';
|
||||
import {
|
||||
mapState
|
||||
} from 'vuex';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -54,25 +57,34 @@
|
||||
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapState(['hasLogin', 'userInfo']),
|
||||
},
|
||||
methods: {
|
||||
async acceptCoupon(item) {
|
||||
this.types = !this.types
|
||||
uni.showLoading({
|
||||
title: '请稍后'
|
||||
});
|
||||
if (this.hasLogin) {
|
||||
this.types = !this.types
|
||||
uni.showLoading({
|
||||
title: '请稍后'
|
||||
});
|
||||
|
||||
let params = {
|
||||
couponId: item.id
|
||||
};
|
||||
let data = await Api.apiCall('post', Api.index.acceptCoupon, params);
|
||||
console.log(data);
|
||||
if (data) {
|
||||
this.$api.msg(data);
|
||||
let params = {
|
||||
couponId: item.id
|
||||
};
|
||||
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) {
|
||||
console.log('clickSubMethod')
|
||||
|
||||
Reference in New Issue
Block a user