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.
142 lines
3.2 KiB
142 lines
3.2 KiB
<template>
|
|
<view>
|
|
<uni-nav-bar left-icon="left" :statusBar="true" title="CouPons" color="#fff" backgroundColor="#000000" @clickLeft="back" :border="false">
|
|
<!-- <block slot="right">
|
|
<view class="head_coupons">
|
|
<image src="../../static/img/coupons.png" mode=""></image>
|
|
</view>
|
|
|
|
</block> -->
|
|
</uni-nav-bar>
|
|
<view class="body">
|
|
|
|
<view class="coupons_item" v-for="(item,index) in list " :key="index">
|
|
<view class="coupons_item_left">
|
|
<view class="item_left_prcie">${{item.type_money}}</view>
|
|
<text class="item_left_span">Min.spend</text>
|
|
<view>${{item.min_goods_amount}}</view>
|
|
</view>
|
|
<view class="coupons_item_right">
|
|
<view class="coupons_right_info">
|
|
<view class="coupons_right_info_title">{{item.type_name}}</view>
|
|
<text>The tide zone is available</text>
|
|
<view class="coupons_right_info_time">{{item.send_start_date}} - {{item.send_end_date}}</view>
|
|
</view>
|
|
<button v-if="item.is_obtained==0" @click="obtainbonus(item.type_id)">Receive</button>
|
|
<button v-if="item.is_obtained!=0" @click="gotopage()">Use Now</button>
|
|
<image src="../../static/img/coupons_bg.png" mode="" class="coupons_item_right_bg" v-if="item.is_obtained==1"></image>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {defaultRequest,defaultRequest2} from '../../api/index.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
list:[]
|
|
}
|
|
},
|
|
methods:{
|
|
obtainbonus(id){
|
|
let tag = 0
|
|
tag = uni.getStorageSync('isLogin')
|
|
console.log(tag)
|
|
let data={_action:'obtainbonus',type_id:id}
|
|
if(tag == 1){
|
|
defaultRequest2(data).then(res=>{
|
|
console.info(res)
|
|
if(res.error==0){
|
|
uni.showToast({
|
|
icon:'none',
|
|
title:'ok!',
|
|
duration: 2000
|
|
})
|
|
}
|
|
this.getList()
|
|
})
|
|
}
|
|
else{
|
|
uni.navigateTo({
|
|
url:'../login/index'
|
|
})
|
|
}
|
|
|
|
},
|
|
getList(){
|
|
let data={_action:'getbonuslist'}
|
|
defaultRequest(data).then(res=>{
|
|
console.info(res)
|
|
if(res.error==0){
|
|
this.list=res.data
|
|
}
|
|
})
|
|
},
|
|
back(){
|
|
uni.navigateBack()
|
|
},
|
|
gotopage(){
|
|
let tag = 0
|
|
console.log(1111)
|
|
tag = uni.getStorageSync('isLogin')
|
|
console.log(tag)
|
|
if(tag == 1){
|
|
uni.switchTab({
|
|
url:'./index'
|
|
})
|
|
}
|
|
else{
|
|
uni.navigateTo({
|
|
url:'../login/index'
|
|
})
|
|
}
|
|
|
|
}
|
|
},
|
|
onLoad() {
|
|
let that = this;
|
|
let s = 0;
|
|
let time = setInterval(() => {
|
|
uni.getNetworkType({
|
|
success: (res) => {
|
|
console.log(res.networkType, s);
|
|
if (res.networkType == 'none') {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: 'Please connect to the network',
|
|
duration: 3000,
|
|
})
|
|
} else if (res.networkType !== 'none') {
|
|
that.typee = 2;
|
|
clearInterval(time);
|
|
}
|
|
}
|
|
})
|
|
s++;
|
|
}, 1000);
|
|
this.getList()
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.uni-navbar{
|
|
font-size: 32rpx;
|
|
font-weight: bold;
|
|
}
|
|
.body{
|
|
border-top: 14.67rpx #F7F7F7 solid;
|
|
padding:0 26rpx;
|
|
padding-top: 31.33rpx;
|
|
}
|
|
.head_coupons{
|
|
width: 34.67rpx;
|
|
height: 34.67rpx;
|
|
image{
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
}
|
|
</style>
|