Authored by lea guo

修改路由控制

<template>
<layout-app title="出售中">
<layout-app title="出售中" class="in-sale-list-wrapper">
<div class="content-wrapper">
<scroll
@pulling-up="fetchData"
... ... @@ -110,11 +110,14 @@ export default {
};
</script>
<style lang="scss" scoped>
.in-sale-list-wrapper /deep/ .layout-context {
display: flex;
flex-direction: column;
}
.content-wrapper {
height: 100%;
overflow-x: hidden;
overflow-y: auto;
-webkit-box-orient: vertical;
flex: 1 0 0;
overflow: hidden;
.empty-wrapper {
margin: 20vh 0;
... ...
<template>
<layout-app :title="$route.params.owner === 'sell' ? '我的出售' : '我的订单'">
<layout-app
:title="$route.params.owner === 'sell' ? '我的出售' : '我的订单'"
class="list-page"
>
<status-nav @change="change" :owner="owner" :status="currentStatus" />
<div class="content-wrapper">
<scroll
... ... @@ -107,10 +110,26 @@ export default {
};
}
},
activated() {
this.resetData();
this.fetchData();
beforeRouteEnter(to, from, next) {
if (from.name === "mine" || !from.name) {
next(vm => {
const { owner, status } = to.params;
if (typeof status === "undefined") {
vm.currentStatus = owner === "buy" ? 1 : 2;
} else {
vm.currentStatus = +status;
}
vm.resetData();
vm.fetchData();
});
} else {
next();
}
},
// activated() {
// this.resetData();
// this.fetchData();
// },
methods: {
...mapActions(["fetchOrderList", "confirmReceipt"]),
...mapMutations(["resetData"]),
... ... @@ -138,11 +157,14 @@ export default {
};
</script>
<style lang="scss" scoped>
.list-page /deep/ .layout-context {
display: flex;
flex-direction: column;
}
.content-wrapper {
height: calc(100vh - 100px);
overflow-x: hidden;
overflow-y: auto;
-webkit-box-orient: vertical;
flex: 1 0 0;
overflow: hidden;
.footer-wrapper {
display: flex;
... ...
... ... @@ -111,7 +111,7 @@ export default function() {
title: '我的订单',
num: state.buyNum,
page: 'OrderList',
params: { owner: ownType.BUY },
params: { owner: ownType.BUY, status: 1 },
},
buy: {
name: 'buy',
... ... @@ -139,7 +139,7 @@ export default function() {
},
bindAccount: {
name: 'bindAccount',
page: 'bindAccount'
page: 'bindAccount',
},
resource2: { name: 'resource2', data: state.resource2 },
};
... ... @@ -181,9 +181,9 @@ export default function() {
return {
goodsIncome: state.assetData.goodsIncome,
totalIncome: state.assetData.totalIncome,
compensateIncome: state.assetData.compensateIncome
compensateIncome: state.assetData.compensateIncome,
};
}
},
},
mutations: {
addList(state, { list }) {
... ... @@ -246,7 +246,9 @@ export default function() {
},
addAssets(state, assetData) {
assetData.totalIncome = formatNumber(assetData.totalIncome || 0);
assetData.compensateIncome = formatNumber(assetData.compensateIncome || 0);
assetData.compensateIncome = formatNumber(
assetData.compensateIncome || 0,
);
assetData.goodsIncome = formatNumber(assetData.goodsIncome || 0);
state.assetData = Object.assign({}, state.assetData, assetData);
},
... ... @@ -332,10 +334,9 @@ export default function() {
set(result, 'data[0].data[0].src', src);
commit('addResource', {
resource1: result.data[0]
resource1: result.data[0],
});
}
}
if (result1.code === 200) {
if (result.data.length !== 0) {
... ... @@ -398,7 +399,7 @@ export default function() {
let page = isRefresh ? 1 : currentPage + 1;
const result = await this.$api.get('/api/ufo/mine/assets', {
page,
limit: pageSize
limit: pageSize,
});
// commit('assetFetching', {isFetching: false});
... ... @@ -441,7 +442,7 @@ export default function() {
limit: pageSize,
tradeType,
startTime,
endTime
endTime,
});
if (result.code === 200) {
... ...