Authored by baoss

个人中心界面调整,新增交易收入页面

import Mine from './mine';
import Trade from './tradeIncome';
export default [
{
name: 'channel',
... ... @@ -7,4 +7,5 @@ export default [
component: () => import(/* webpackChunkName: "channel" */ './channel/channel')
},
...Mine,
...Trade,
];
... ...
... ... @@ -39,13 +39,9 @@ export default {
created() {
this.fetchResource()
this.fetchFavoriteNum()
this.fetchOrderSummary().then(data => {
console.log(data)
})
this.fetchOrderSummary()
this.fetchSellerOrder()
this.fetchAssets().then(data => {
console.log(data)
})
this.fetchAssets()
},
methods: {
...mapActions(['fetchFavoriteNum','fetchResource','fetchSellerOrder','fetchOrderSummary', 'fetchAssets'])
... ...
export default [{
name: 'mine',
path: '/xianyu/home/mine/tradeIncome',
component: () => import(/* webpackChunkName: "mine" */ './tradeIncome')
}];
... ...
<template>
<LayoutApp :show-back="true">
<div class="body" ref="body">
<h2>trade</h2>
</div>
</LayoutApp>
</template>
<script>
// import tabItem from './components/tabItem';
import { createNamespacedHelpers } from 'vuex';
const {mapGetters, mapActions} = createNamespacedHelpers('home/mine');
export default {
data() {
return {
}
},
computed:{
},
created() {
this.fetchAssets().then(data => {
console.log(data)
})
},
methods: {
...mapActions(['fetchAssets'])
},
components: {
}
};
</script>
<style lang="scss" scoped>
.body {
height: 100%;
overflow-y: auto;
background-color: white;
padding: 0 40px;
}
</style>
... ...
import { parseAssetList, maskAccount } from '../../utils/mine-handler';
import {parseAssetList, formatNumber, maskAccount} from '../../utils/mine-handler';
import { get, set } from 'lodash';
import { getImgUrl } from '../../common/utils';
// const uid = '600046428';
const uid = '75339977';
const uid = '500031424';
const MINE_RESOURCE_CODE1 = '11a73219a63b50067d88e75c0fe04d10';
const MINE_RESOURCE_CODE2 = 'dc2731fbbebcba6329c74a379e9c41ec';
... ... @@ -20,6 +20,7 @@ export default function() {
failNum: 0,
favoriteNum: 0,
buyNum: 0,
askBuyNum: 0,
assetData: {
list: [],
currentPage: 1,
... ... @@ -50,8 +51,7 @@ export default function() {
resource1: {name: 'resource1', data: state.resource1},
income: {title: '交易收入', num: state.assetData.totalIncome},
buyOrder: {title: '我购买的订单', num: state.buyNum},
// buy: {name: 'buy', title: '我的求购', num: 1},
buy: {name: 'buy', title: '我的求购', num: state.askBuyNum},
collect: {name: 'collect', title: '我的收藏', num: state.favoriteNum},
resource2: {name: 'resource2', data: state.resource2}
};
... ... @@ -99,10 +99,22 @@ export default function() {
addFavoriteNum(state, {count}) {
state.favoriteNum = count;
},
addOrderSummary(state, {count}) {
state.buyNum = count;
addOrderSummary(state, {data}) {
data.forEach((item) => {
switch (item.actor) {
case 'buy':
state.buyNum = item.sum;
break;
case 'bid':
state.askBuyNum = item.sum;
break;
default:
break;
}
});
},
addAssets(state, assetData) {
assetData.totalIncome = formatNumber(assetData.totalIncome);
state.assetData = Object.assign({}, state.assetData, assetData);
},
... ... @@ -156,7 +168,6 @@ export default function() {
if (result.code === 200) {
commit('addSellerOrder', { orderSumList: result.data });
}
return result.data || [];
},
async fetchFavoriteNum({ commit }) {
const result = await this.$api.get('/api/ufo/mine/favoriteNum', {uid});
... ... @@ -164,15 +175,13 @@ export default function() {
if (result.code === 200) {
commit('addFavoriteNum', { count: result.data.product_favorite_total });
}
return result.data || [];
},
async fetchOrderSummary({ commit }) {
const result = await this.$api.get('/api/ufo/mine/order/summary', {uid});
if (result.code === 200) {
commit('addOrderSummary', { count: result.data.buyCount });
commit('addOrderSummary', { data: result.data});
}
return result.data || [];
},
async fetchAssets({ commit }) {
... ...
... ... @@ -36,7 +36,7 @@ module.exports = {
},
'/api/ufo/mine/order/summary': {
ufo: true,
path: '/shopping',
path: '/ufo-gateway/shopping',
api: 'ufo.order.summary',
params: {
uid: { type: Number },
... ...