Authored by 李奇

个人中心支持显示优惠券数量

... ... @@ -2,6 +2,7 @@ import api from '../utils/api';
const UFO_ORDER_SUMMARY = 'ufo.order.summary'
const UFO_FAVORITE_NUMBER = 'ufo.user.favoriteNum'
const UFO_COUPONS_COUNT = 'ufo.coupons.cnt'
export default {
getUFO_OrderSummary(params) {
... ... @@ -18,5 +19,13 @@ export default {
method: UFO_FAVORITE_NUMBER
}, params)
})
},
getUFOTotalCoupons(params) {
return api.get({
url: '/coupon',
data: Object.assign({
method: UFO_COUPONS_COUNT
}, params)
})
}
}
\ No newline at end of file
}
... ...
... ... @@ -45,7 +45,8 @@ export default class UserCenter extends Component {
},
{
text: '优惠券',
page: 'myCoupon'
page: 'myCoupon',
num: 0
},
{
text: '客服与帮助',
... ... @@ -252,6 +253,16 @@ export default class UserCenter extends Component {
});
}
}).catch(error => {});
personalModel.getUFOTotalCoupons().then(ret => {
if (ret && ret.code === 200 && ret.data) {
let list = this.state.list;
let num = ret.data;
list[3].num = num;
this.setState({
list
});
}
}).catch(error => {});
} else {
this.setState({
userInfo: this.props.globalData.userInfo,
... ...