|
|
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 }) {
|
...
|
...
|
|