Authored by baoss

个人中心增加优惠券数量

@@ -43,9 +43,10 @@ export default { @@ -43,9 +43,10 @@ export default {
43 this.fetchSellerOrder() 43 this.fetchSellerOrder()
44 // this.fetchAssets(true) 44 // this.fetchAssets(true)
45 this.fetchUserWalletInfo() 45 this.fetchUserWalletInfo()
  46 + this.fetchCoupon()
46 }, 47 },
47 methods: { 48 methods: {
48 - ...mapActions(['fetchFavoriteNum','fetchResource','fetchSellerOrder','fetchOrderSummary', 'fetchAssets', 'fetchUserWalletInfo']) 49 + ...mapActions(['fetchFavoriteNum','fetchResource','fetchSellerOrder','fetchOrderSummary', 'fetchAssets', 'fetchUserWalletInfo','fetchCoupon'])
49 }, 50 },
50 components: { 51 components: {
51 tabItem, 52 tabItem,
@@ -23,6 +23,7 @@ export default function() { @@ -23,6 +23,7 @@ export default function() {
23 favoriteNum: 0, 23 favoriteNum: 0,
24 buyNum: 0, 24 buyNum: 0,
25 askBuyNum: 0, 25 askBuyNum: 0,
  26 + couponNum: 0,
26 assetData: { 27 assetData: {
27 isFetching: false, 28 isFetching: false,
28 list: [], 29 list: [],
@@ -79,7 +80,7 @@ export default function() { @@ -79,7 +80,7 @@ export default function() {
79 buyOrder: {title: '我的订单', num: state.buyNum, page: ''}, 80 buyOrder: {title: '我的订单', num: state.buyNum, page: ''},
80 buy: {name: 'buy', title: '我的求购', num: state.askBuyNum, page: ''}, 81 buy: {name: 'buy', title: '我的求购', num: state.askBuyNum, page: ''},
81 collect: {name: 'collect', title: '我的收藏', num: state.favoriteNum, page: 'favorite'}, 82 collect: {name: 'collect', title: '我的收藏', num: state.favoriteNum, page: 'favorite'},
82 - coupon: {name: 'coupon', title: '我的优惠券', num: state.favoriteNum, page: ''}, 83 + coupon: {name: 'coupon', title: '我的优惠券', num: state.couponNum, page: ''},
83 service: {name: 'service', title: '我的客服', page: 'service'}, 84 service: {name: 'service', title: '我的客服', page: 'service'},
84 resource2: {name: 'resource2', data: state.resource2} 85 resource2: {name: 'resource2', data: state.resource2}
85 }; 86 };
@@ -171,6 +172,9 @@ export default function() { @@ -171,6 +172,9 @@ export default function() {
171 } 172 }
172 }); 173 });
173 }, 174 },
  175 + addCouponSummary(state, {count}) {
  176 + state.couponNum = count;
  177 + },
174 addAssets(state, assetData) { 178 addAssets(state, assetData) {
175 assetData.totalIncome = formatNumber(assetData.totalIncome); 179 assetData.totalIncome = formatNumber(assetData.totalIncome);
176 assetData.compensateIncome = formatNumber(assetData.compensateIncome); 180 assetData.compensateIncome = formatNumber(assetData.compensateIncome);
@@ -281,7 +285,13 @@ export default function() { @@ -281,7 +285,13 @@ export default function() {
281 commit('addOrderSummary', { data: result.data}); 285 commit('addOrderSummary', { data: result.data});
282 } 286 }
283 }, 287 },
  288 + async fetchCoupon({commit}) {
  289 + const result = await this.$api.get('/api/ufo/mine/coupon', {uid});
284 290
  291 + if (result.code === 200) {
  292 + commit('addCouponSummary', { count: result.data});
  293 + }
  294 + },
285 async fetchAssets({ commit, state }, isRefresh) { 295 async fetchAssets({ commit, state }, isRefresh) {
286 let {isFetching, endReached, currentPage, list, pageSize} = state.assetData; 296 let {isFetching, endReached, currentPage, list, pageSize} = state.assetData;
287 297
@@ -60,17 +60,20 @@ module.exports = { @@ -60,17 +60,20 @@ module.exports = {
60 auth: true, 60 auth: true,
61 path: '/ufo-gateway/shopping', 61 path: '/ufo-gateway/shopping',
62 api: 'ufo.order.summary', 62 api: 'ufo.order.summary',
63 - params: {  
64 - uid: { type: Number }, 63 + params: {},
65 }, 64 },
  65 + '/api/ufo/mine/coupon': {
  66 + ufo: true,
  67 + auth: true,
  68 + path: '/ufo-gateway/coupon',
  69 + api: 'ufo.coupons.cnt',
  70 + params: {},
66 }, 71 },
67 '/api/ufo/mine/resource': { 72 '/api/ufo/mine/resource': {
68 ufo: true, 73 ufo: true,
69 api: 'ufo.resource.get', 74 api: 'ufo.resource.get',
70 params: { 75 params: {
71 - content_code: { type: String },  
72 - uid: { type: Number },  
73 - }, 76 + content_code: { type: String }},
74 }, 77 },
75 '/api/ufo/home/noticelist': { 78 '/api/ufo/home/noticelist': {
76 ufo: true, 79 ufo: true,