Commit 5e48c457 by 施宇

h5自营

parent d3987db0
...@@ -19,3 +19,4 @@ yarn-error.log* ...@@ -19,3 +19,4 @@ yarn-error.log*
*.sln *.sln
*.sw* *.sw*
/view /view
/view
...@@ -18,7 +18,8 @@ const state = { ...@@ -18,7 +18,8 @@ const state = {
classLight: {}, classLight: {},
zyFilterData: {}, //过滤数据 zyFilterData: {}, //过滤数据
zyData: [], zyData: [],
total: 0, loading:false,
finished:false
} }
const mutations = { const mutations = {
xianhuo(state, payload) { xianhuo(state, payload) {
...@@ -33,7 +34,7 @@ const mutations = { ...@@ -33,7 +34,7 @@ const mutations = {
} else if (payload.type == "class_light") { } else if (payload.type == "class_light") {
state.classLight = payload.data; state.classLight = payload.data;
} else if (payload.type == "zydata") { } else if (payload.type == "zydata") {
state.zyData = payload.data state.zyData = state.zyData.concat(payload.data)
} }
} }
} }
...@@ -41,10 +42,14 @@ const actions = { ...@@ -41,10 +42,14 @@ const actions = {
getZyData({ getZyData({
commit commit
}, payload) { }, payload) {
state.loading = true;
state.finished = false;
let p = payload.data.params;
console
Services.getZyData(qs.stringify(payload.data)).then((res) => { Services.getZyData(qs.stringify(payload.data)).then((res) => {
state.loading = false;
let data = res.data; let data = res.data;
if (data.error_code == 0) { if (data.error_code == 0) {
state.total = data.data.total;
if (data.data.aggs) { if (data.data.aggs) {
commit("xianhuo", { //过滤数据 commit("xianhuo", { //过滤数据
type: "filter", type: "filter",
...@@ -83,6 +88,7 @@ const actions = { ...@@ -83,6 +88,7 @@ const actions = {
} }
}).catch(function (err) { }).catch(function (err) {
state.loading = false;
}); });
} }
} }
......
...@@ -143,12 +143,10 @@ ...@@ -143,12 +143,10 @@
</div> </div>
<div class="content_scroll"> <div class="content_scroll">
<van-list <van-list
v-model="loading" v-model="loadingXh"
:finished="finished" :finished="finished"
finished-text="我是有底线的噢" finished-text="我是有底线的噢"
@load="onLoad" @load="onLoad"
error-text="请求失败,点击重新加载"
:immediate-check="true"
> >
<GoodsOne :dataList="zyData"></GoodsOne> <GoodsOne :dataList="zyData"></GoodsOne>
</van-list> </van-list>
...@@ -203,9 +201,8 @@ export default { ...@@ -203,9 +201,8 @@ export default {
isResetData: false, //是否重置数据 isResetData: false, //是否重置数据
isShowRight: false, //是否展示右侧 isShowRight: false, //是否展示右侧
list: [], list: [],
loading: false, loadingXh: false,
finished: false, p: 0
p: 1
}; };
}, },
created() {}, created() {},
...@@ -218,10 +215,15 @@ export default { ...@@ -218,10 +215,15 @@ export default {
classLight: state => state.xianhuo.classLight, classLight: state => state.xianhuo.classLight,
zyFilterData: state => state.xianhuo.zyFilterData, zyFilterData: state => state.xianhuo.zyFilterData,
zyData: state => state.xianhuo.zyData, zyData: state => state.xianhuo.zyData,
total: state => state.xianhuo.total total: state => state.xianhuo.total,
loading: state => state.xianhuo.loading,
finished: state => state.xianhuo.finished
}) })
}, },
watch: { watch: {
loading(now) {
this.loadingXh = now;
},
zyRankInit(now) { zyRankInit(now) {
this.getZyData(); this.getZyData();
}, },
...@@ -244,6 +246,8 @@ export default { ...@@ -244,6 +246,8 @@ export default {
}, },
methods: { methods: {
onLoad() { onLoad() {
console.log(this.loadingXh);
this.p++;
this.getZyData(); this.getZyData();
}, },
toSearch() {}, toSearch() {},
...@@ -298,7 +302,7 @@ export default { ...@@ -298,7 +302,7 @@ export default {
} }
}, },
getZyData(rightFilter = {}) { getZyData(rightFilter = {}) {
let params = { p: 1, offset: 10 }; let params = { p: this.p, offset: 10 };
let rightFilterStr = JSON.stringify(rightFilter); let rightFilterStr = JSON.stringify(rightFilter);
if (this.addClassStr) { if (this.addClassStr) {
params["class_id/condition"] = this.addClassStr; params["class_id/condition"] = this.addClassStr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment