Authored by 李奇

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

@@ -2,6 +2,7 @@ import api from '../utils/api'; @@ -2,6 +2,7 @@ import api from '../utils/api';
2 2
3 const UFO_ORDER_SUMMARY = 'ufo.order.summary' 3 const UFO_ORDER_SUMMARY = 'ufo.order.summary'
4 const UFO_FAVORITE_NUMBER = 'ufo.user.favoriteNum' 4 const UFO_FAVORITE_NUMBER = 'ufo.user.favoriteNum'
  5 +const UFO_COUPONS_COUNT = 'ufo.coupons.cnt'
5 6
6 export default { 7 export default {
7 getUFO_OrderSummary(params) { 8 getUFO_OrderSummary(params) {
@@ -18,5 +19,13 @@ export default { @@ -18,5 +19,13 @@ export default {
18 method: UFO_FAVORITE_NUMBER 19 method: UFO_FAVORITE_NUMBER
19 }, params) 20 }, params)
20 }) 21 })
  22 + },
  23 + getUFOTotalCoupons(params) {
  24 + return api.get({
  25 + url: '/coupon',
  26 + data: Object.assign({
  27 + method: UFO_COUPONS_COUNT
  28 + }, params)
  29 + })
21 } 30 }
22 } 31 }
@@ -45,7 +45,8 @@ export default class UserCenter extends Component { @@ -45,7 +45,8 @@ export default class UserCenter extends Component {
45 }, 45 },
46 { 46 {
47 text: '优惠券', 47 text: '优惠券',
48 - page: 'myCoupon' 48 + page: 'myCoupon',
  49 + num: 0
49 }, 50 },
50 { 51 {
51 text: '客服与帮助', 52 text: '客服与帮助',
@@ -252,6 +253,16 @@ export default class UserCenter extends Component { @@ -252,6 +253,16 @@ export default class UserCenter extends Component {
252 }); 253 });
253 } 254 }
254 }).catch(error => {}); 255 }).catch(error => {});
  256 + personalModel.getUFOTotalCoupons().then(ret => {
  257 + if (ret && ret.code === 200 && ret.data) {
  258 + let list = this.state.list;
  259 + let num = ret.data;
  260 + list[3].num = num;
  261 + this.setState({
  262 + list
  263 + });
  264 + }
  265 + }).catch(error => {});
255 } else { 266 } else {
256 this.setState({ 267 this.setState({
257 userInfo: this.props.globalData.userInfo, 268 userInfo: this.props.globalData.userInfo,