Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # apps/store/home/favorite.js
Showing
5 changed files
with
48 additions
and
29 deletions
1 | <template> | 1 | <template> |
2 | <LayoutApp :show-back="true" :title="title"> | 2 | <LayoutApp :show-back="true" :title="title"> |
3 | - <Scroll :scrollEvents="['scroll']" :options="scrollOptions" @scroll="scroll" | 3 | + <Scroll :scroll-events="['scroll-end','scroll']" |
4 | + @scroll-end="fetchList" | ||
4 | v-if="favoriteProductList.list.length" | 5 | v-if="favoriteProductList.list.length" |
5 | - @pulling-up="onPullingUp"> | 6 | + > |
6 | <ProductList :list="favoriteProductList.list"></ProductList> | 7 | <ProductList :list="favoriteProductList.list"></ProductList> |
7 | </Scroll> | 8 | </Scroll> |
8 | <!-- <empty-list v-show="!isShowEmpty" /> --> | 9 | <!-- <empty-list v-show="!isShowEmpty" /> --> |
@@ -42,20 +43,23 @@ export default { | @@ -42,20 +43,23 @@ export default { | ||
42 | this.fetchFavoriteList(); | 43 | this.fetchFavoriteList(); |
43 | }, | 44 | }, |
44 | methods: { | 45 | methods: { |
45 | - ...mapActions(['fetchFavoriteList','isShowEmpty']), | 46 | + ...mapActions(['fetchFavoriteList','isMore']), |
46 | 47 | ||
47 | - async onPullingUp() { | 48 | + async fetchList() { |
49 | + if(isMore){ | ||
48 | await this.fetchFavoriteList(); | 50 | await this.fetchFavoriteList(); |
51 | + } | ||
52 | + | ||
49 | }, | 53 | }, |
50 | - scroll({ y }) { | ||
51 | - const height = this.$refs.banner.$el.offsetHeight + this.$refs.header.offsetHeight; | 54 | + // scroll({ y }) { |
55 | + // const height = this.$refs.banner.$el.offsetHeight + this.$refs.header.offsetHeight; | ||
52 | 56 | ||
53 | - if (-y >= height) { | ||
54 | - this.fixed = true; | ||
55 | - } else { | ||
56 | - this.fixed = false; | ||
57 | - } | ||
58 | - } | 57 | + // if (-y >= height) { |
58 | + // this.fixed = true; | ||
59 | + // } else { | ||
60 | + // this.fixed = false; | ||
61 | + // } | ||
62 | + // } | ||
59 | }, | 63 | }, |
60 | 64 | ||
61 | computed: { | 65 | computed: { |
@@ -24,7 +24,7 @@ export default { | @@ -24,7 +24,7 @@ export default { | ||
24 | ...mapState( | 24 | ...mapState( |
25 | { | 25 | { |
26 | amountPart1: (state) => { | 26 | amountPart1: (state) => { |
27 | - return (''+state.userWalletInfo.walletAmount).split('.')[0] | 27 | + return (''+state.userWalletInfo.walletAmount).split('.')[0].split('¥')[1] |
28 | }, | 28 | }, |
29 | amountPart2: (state) => { | 29 | amountPart2: (state) => { |
30 | return (''+state.userWalletInfo.walletAmount).split('.')[1] | 30 | return (''+state.userWalletInfo.walletAmount).split('.')[1] |
1 | import { get, set } from 'lodash'; | 1 | import { get, set } from 'lodash'; |
2 | import { getImgUrl } from '../../common/utils'; | 2 | import { getImgUrl } from '../../common/utils'; |
3 | import Vue from 'vue'; | 3 | import Vue from 'vue'; |
4 | +// const uid = '500031170'; | ||
4 | 5 | ||
5 | export default function() { | 6 | export default function() { |
6 | return { | 7 | return { |
@@ -10,43 +11,54 @@ export default function() { | @@ -10,43 +11,54 @@ export default function() { | ||
10 | pageTotal: 0, | 11 | pageTotal: 0, |
11 | recId: '', | 12 | recId: '', |
12 | favoriteProductList: { | 13 | favoriteProductList: { |
13 | - list: [] | 14 | + list:[] |
14 | }, | 15 | }, |
15 | - isShowEmpty: false, | 16 | + isMore: true, |
16 | }, | 17 | }, |
17 | mutations: { | 18 | mutations: { |
18 | addList(state, { data }) { | 19 | addList(state, { data }) { |
19 | - console.log(data); | ||
20 | - if (data && data.product_list) { | 20 | + console.log(data) |
21 | + if(data && data.product_list){ | ||
21 | // data.product_list. | 22 | // data.product_list. |
22 | - let { page, product_list = [] } = data; | 23 | + let { page, product_list = [], pageTotal } = data; |
23 | let isShowEmpty = page === 1 && product_list === 0; | 24 | let isShowEmpty = page === 1 && product_list === 0; |
24 | // console.log("isShowEmpty:"+isShowEmpty) | 25 | // console.log("isShowEmpty:"+isShowEmpty) |
25 | // state.isShowEmpty = isShowEmpty | 26 | // state.isShowEmpty = isShowEmpty |
27 | + if(pageTotal > page){ | ||
28 | + state.isMore = true; | ||
29 | + } | ||
30 | + state.pageTotal = pageTotal; | ||
31 | + state.page = page + 1; | ||
32 | + | ||
26 | let list = state.favoriteProductList.list.concat(product_list); | 33 | let list = state.favoriteProductList.list.concat(product_list); |
27 | - Vue.set(state.favoriteProductList, 'list', list); | ||
28 | - } else { | 34 | + Vue.set(state.favoriteProductList, "list", list); |
35 | + }else { | ||
29 | // state.isShowEmpty = true; | 36 | // state.isShowEmpty = true; |
30 | } | 37 | } |
31 | 38 | ||
32 | }, | 39 | }, |
33 | - errorData(state) { | 40 | + errorData(state){ |
34 | // console.log("error==isShowEmpty:") | 41 | // console.log("error==isShowEmpty:") |
35 | state.isShowEmpty = true; | 42 | state.isShowEmpty = true; |
36 | } | 43 | } |
37 | 44 | ||
38 | }, | 45 | }, |
39 | actions: { | 46 | actions: { |
40 | - async fetchFavoriteList({ commit }) { | ||
41 | - const result = await this.$api.get('/api/ufo/home/favoriteProduct', {}); | 47 | + async fetchFavoriteList({ commit, state }) { |
48 | + let page = state.page; | ||
49 | + let limit = 20; | ||
50 | + const result = await this.$api.get('/api/ufo/home/favoriteProduct', {page, limit}); | ||
42 | if (result.code === 200) { | 51 | if (result.code === 200) { |
43 | - let data = result.data; | ||
44 | - commit('addList', { data: data }); | ||
45 | - } else { | 52 | + let data =result.data; |
53 | + commit('addList', { data:data }); | ||
54 | + }else { | ||
46 | // console.log("error=//=isShowEmpty:") | 55 | // console.log("error=//=isShowEmpty:") |
47 | commit('errorData'); | 56 | commit('errorData'); |
48 | } | 57 | } |
49 | return result.data || []; | 58 | return result.data || []; |
59 | + // }else { | ||
60 | + // return []; | ||
61 | + // } | ||
50 | }, | 62 | }, |
51 | }, | 63 | }, |
52 | }; | 64 | }; |
@@ -46,11 +46,11 @@ export default function() { | @@ -46,11 +46,11 @@ export default function() { | ||
46 | endTime: 0, | 46 | endTime: 0, |
47 | }, | 47 | }, |
48 | userWalletInfo: { | 48 | userWalletInfo: { |
49 | - totalAmount: 0.0, | 49 | + totalAmount: 0.00, |
50 | withdrawLimit: 0, | 50 | withdrawLimit: 0, |
51 | withdrawAmount: 0, | 51 | withdrawAmount: 0, |
52 | shareSettlementAmount: 0, | 52 | shareSettlementAmount: 0, |
53 | - walletAmount: 0.0, | 53 | + walletAmount: '¥0.00', |
54 | }, | 54 | }, |
55 | filterData: { | 55 | filterData: { |
56 | tradeTypes: [], | 56 | tradeTypes: [], |
@@ -102,7 +102,7 @@ export default function() { | @@ -102,7 +102,7 @@ export default function() { | ||
102 | resource1: { name: 'resource1', data: state.resource1 }, | 102 | resource1: { name: 'resource1', data: state.resource1 }, |
103 | income: { | 103 | income: { |
104 | title: '我的收入', | 104 | title: '我的收入', |
105 | - num: '¥' + state.userWalletInfo.walletAmount, | 105 | + num: state.userWalletInfo.walletAmount, |
106 | page: 'income', | 106 | page: 'income', |
107 | }, // 原交易收入 tradeIncome | 107 | }, // 原交易收入 tradeIncome |
108 | buyOrder: { | 108 | buyOrder: { |
@@ -249,6 +249,8 @@ export default function() { | @@ -249,6 +249,8 @@ export default function() { | ||
249 | state.walletData.endTime = endTime; | 249 | state.walletData.endTime = endTime; |
250 | }, | 250 | }, |
251 | addUserWalletInfo(state, data) { | 251 | addUserWalletInfo(state, data) { |
252 | + // data.totalAmount = formatNumber(data.totalAmount); | ||
253 | + data.walletAmount = formatNumber(data.walletAmount); | ||
252 | state.userWalletInfo = data; | 254 | state.userWalletInfo = data; |
253 | }, | 255 | }, |
254 | addfilterData(state, data) { | 256 | addfilterData(state, data) { |
@@ -85,6 +85,7 @@ module.exports = { | @@ -85,6 +85,7 @@ module.exports = { | ||
85 | auth: true, | 85 | auth: true, |
86 | api: 'ufo.user.favoriteList', | 86 | api: 'ufo.user.favoriteList', |
87 | params: {}, | 87 | params: {}, |
88 | + auth: true, | ||
88 | }, | 89 | }, |
89 | '/api/ufo/channel/channelList': { | 90 | '/api/ufo/channel/channelList': { |
90 | ufo: true, | 91 | ufo: true, |
-
Please register or login to post a comment