Authored by huangyCode

修改倒计时显示

import api from '../utils/api';
import BaseService from '../libs/services/baseService'
export default {
myCouponList(params) {
return api.get({
api: 'yohoApi',
data: Object.assign({
method: 'app.union.shareOrder.queryUnionTypeByUid'
}, params)
})
export default class couponModel extends BaseService {
constructor(options) {
super(options)
}
myCouponList(complete) {
return this.GET(
{
method: 'ufo.coupons.get',
},
{
path: '/coupon',
complete
}
)
}
}
... ...
import Taro, {Component} from '@tarojs/taro';
import {View, Text, Navigator,Image} from '@tarojs/components';
import {View, Text, Navigator, Image} from '@tarojs/components';
import './index.scss'
import down from '../../assets/images/down@2x.png';
import couponModel from '../../models/coupon';
const model = new couponModel();
export default class MyCoupon extends Component {
constructor() {
super(...arguments);
this.state = {};
this.state = {
couponList: []
};
}
config = {
config = {};
componentWillMount() {
this.getCouponList();
}
async getCouponList() {
let couponList = await model.myCouponList();
this.setState({couponList});
};
showNote = (value) => {
let {couponList} = this.state;
couponList[value].showNotes = !couponList[value].showNotes;
this.setState({
couponList
});
this.forceUpdate();
};
render() {
let {couponList} = this.state;
return (
<View className='page'>
<View className='title'>优惠券</View>
<View className='content'>
<View className='item'>
<View className='ticket'>
<View className='left'>
<View className='price'>40</View>
<View className='type'>499可用</View>
{couponList.map((value, index) => {
return <View className='item'>
<View className='ticket'>
<View className='left'>
<View className='price'>{value.coupon_value}</View>
</View>
<View className='right'>
<View className='name'>{value.coupon_name}</View>
<View className='date'>{value.coupon_validity}</View>
<View className='desc' onClick={this.showNote.bind(this, index)}>使用说明
<Image mode='aspectFit' src={down} className={value.showNotes ? 'up' : 'down'}></Image>
</View>
</View>
</View>
<View className='right'>
<View className='name'>adidas店铺使用</View>
<View className='date'>2018.2.15-2019.3.15</View>
<View className='desc'>使用说明 <Image mode='aspectFit' src={down} className='up'></Image></View>
<View className='desc-info' style={{display: value.showNotes ? 'block' : 'none'}}>
{value.notes.map((note) => {
return <View className='p'>· {note}</View>
})}
</View>
</View>
<View className='desc-info'>
<View className='p'>· 全场通用券</View>
</View>
</View>
<View className='item'>
<View className='ticket'>
<View className='left'>
<View className='price'>40</View>
<View className='type'>499可用</View>
</View>
<View className='right'>
<View className='name'>adidas店铺使用</View>
<View className='date'>2018.2.15-2019.3.15</View>
<View className='desc'>使用说明</View>
</View>
</View>
<View className='desc-info'>
<View className='p'>· 全场通用券</View>
<View className='p'>· 全场通用券</View>
</View>
</View>
})}
</View>
</View>
)
... ...
... ... @@ -16,9 +16,7 @@ page{
.content {
margin-top: 10px
}
.item {
margin-bottom: 10px;
}
.ticket {
background:url(https://img10.static.yhbimg.com/yhb-img01/2019/03/05/20/01b68a5d4f22945fe5afcf0f768538cfd3.png) no-repeat;
background-size:contain;
... ... @@ -77,7 +75,7 @@ page{
.desc-info {
background: #fcfcfc;
padding: 20px;
margin: -21px 20px 0 20px;
margin:-21rpx 20rpx 20rpx;
.p {
margin-top: 8px;
color:#444444;
... ...