Authored by baoss

个人中心增加优惠券数量

... ... @@ -43,9 +43,10 @@ export default {
this.fetchSellerOrder()
// this.fetchAssets(true)
this.fetchUserWalletInfo()
this.fetchCoupon()
},
methods: {
...mapActions(['fetchFavoriteNum','fetchResource','fetchSellerOrder','fetchOrderSummary', 'fetchAssets', 'fetchUserWalletInfo'])
...mapActions(['fetchFavoriteNum','fetchResource','fetchSellerOrder','fetchOrderSummary', 'fetchAssets', 'fetchUserWalletInfo','fetchCoupon'])
},
components: {
tabItem,
... ...
... ... @@ -23,6 +23,7 @@ export default function() {
favoriteNum: 0,
buyNum: 0,
askBuyNum: 0,
couponNum: 0,
assetData: {
isFetching: false,
list: [],
... ... @@ -79,7 +80,7 @@ export default function() {
buyOrder: {title: '我的订单', num: state.buyNum, page: ''},
buy: {name: 'buy', title: '我的求购', num: state.askBuyNum, page: ''},
collect: {name: 'collect', title: '我的收藏', num: state.favoriteNum, page: 'favorite'},
coupon: {name: 'coupon', title: '我的优惠券', num: state.favoriteNum, page: ''},
coupon: {name: 'coupon', title: '我的优惠券', num: state.couponNum, page: ''},
service: {name: 'service', title: '我的客服', page: 'service'},
resource2: {name: 'resource2', data: state.resource2}
};
... ... @@ -171,6 +172,9 @@ export default function() {
}
});
},
addCouponSummary(state, {count}) {
state.couponNum = count;
},
addAssets(state, assetData) {
assetData.totalIncome = formatNumber(assetData.totalIncome);
assetData.compensateIncome = formatNumber(assetData.compensateIncome);
... ... @@ -281,7 +285,13 @@ export default function() {
commit('addOrderSummary', { data: result.data});
}
},
async fetchCoupon({commit}) {
const result = await this.$api.get('/api/ufo/mine/coupon', {uid});
if (result.code === 200) {
commit('addCouponSummary', { count: result.data});
}
},
async fetchAssets({ commit, state }, isRefresh) {
let {isFetching, endReached, currentPage, list, pageSize} = state.assetData;
... ...
... ... @@ -60,17 +60,20 @@ module.exports = {
auth: true,
path: '/ufo-gateway/shopping',
api: 'ufo.order.summary',
params: {
uid: { type: Number },
},
params: {},
},
'/api/ufo/mine/coupon': {
ufo: true,
auth: true,
path: '/ufo-gateway/coupon',
api: 'ufo.coupons.cnt',
params: {},
},
'/api/ufo/mine/resource': {
ufo: true,
api: 'ufo.resource.get',
params: {
content_code: { type: String },
uid: { type: Number },
},
content_code: { type: String }},
},
'/api/ufo/home/noticelist': {
ufo: true,
... ...